email-builder-online 3.4.48 → 3.4.49

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/index.cjs CHANGED
@@ -44,7 +44,7 @@ ${e}</tr>
44
44
  `}tablecell(e,n){const i=n.header?"th":"td";return(n.align?`<${i} align="${n.align}">`:`<${i}>`)+e+`</${i}>
45
45
  `}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,n,i){const r=yx(e);if(r===null)return i;e=r;let a='<a href="'+e+'"';return n&&(a+=' title="'+n+'"'),a+=">"+i+"</a>",a}image(e,n,i){const r=yx(e);if(r===null)return i;e=r;let a=`<img src="${e}" alt="${i}"`;return n&&(a+=` title="${n}"`),a+=">",a}text(e){return e}}class W0{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,n,i){return""+i}image(e,n,i){return""+i}br(){return""}}class ca{constructor(e){V(this,"options");V(this,"renderer");V(this,"textRenderer");this.options=e||Sl,this.options.renderer=this.options.renderer||new vm,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new W0}static parse(e,n){return new ca(n).parse(e)}static parseInline(e,n){return new ca(n).parseInline(e)}parse(e,n=!0){let i="";for(let r=0;r<e.length;r++){const a=e[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[a.type]){const s=a,o=this.options.extensions.renderers[s.type].call({parser:this},s);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(s.type)){i+=o||"";continue}}switch(a.type){case"space":continue;case"hr":{i+=this.renderer.hr();continue}case"heading":{const s=a;i+=this.renderer.heading(this.parseInline(s.tokens),s.depth,nz(this.parseInline(s.tokens,this.textRenderer)));continue}case"code":{const s=a;i+=this.renderer.code(s.text,s.lang,!!s.escaped);continue}case"table":{const s=a;let o="",l="";for(let u=0;u<s.header.length;u++)l+=this.renderer.tablecell(this.parseInline(s.header[u].tokens),{header:!0,align:s.align[u]});o+=this.renderer.tablerow(l);let c="";for(let u=0;u<s.rows.length;u++){const d=s.rows[u];l="";for(let p=0;p<d.length;p++)l+=this.renderer.tablecell(this.parseInline(d[p].tokens),{header:!1,align:s.align[p]});c+=this.renderer.tablerow(l)}i+=this.renderer.table(o,c);continue}case"blockquote":{const s=a,o=this.parse(s.tokens);i+=this.renderer.blockquote(o);continue}case"list":{const s=a,o=s.ordered,l=s.start,c=s.loose;let u="";for(let d=0;d<s.items.length;d++){const p=s.items[d],f=p.checked,h=p.task;let _="";if(p.task){const g=this.renderer.checkbox(!!f);c?p.tokens.length>0&&p.tokens[0].type==="paragraph"?(p.tokens[0].text=g+" "+p.tokens[0].text,p.tokens[0].tokens&&p.tokens[0].tokens.length>0&&p.tokens[0].tokens[0].type==="text"&&(p.tokens[0].tokens[0].text=g+" "+p.tokens[0].tokens[0].text)):p.tokens.unshift({type:"text",text:g+" "}):_+=g+" "}_+=this.parse(p.tokens,c),u+=this.renderer.listitem(_,h,!!f)}i+=this.renderer.list(u,o,l);continue}case"html":{const s=a;i+=this.renderer.html(s.text,s.block);continue}case"paragraph":{const s=a;i+=this.renderer.paragraph(this.parseInline(s.tokens));continue}case"text":{let s=a,o=s.tokens?this.parseInline(s.tokens):s.text;for(;r+1<e.length&&e[r+1].type==="text";)s=e[++r],o+=`
46
46
  `+(s.tokens?this.parseInline(s.tokens):s.text);i+=n?this.renderer.paragraph(o):o;continue}default:{const s='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return i}parseInline(e,n){n=n||this.renderer;let i="";for(let r=0;r<e.length;r++){const a=e[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[a.type]){const s=this.options.extensions.renderers[a.type].call({parser:this},a);if(s!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){i+=s||"";continue}}switch(a.type){case"escape":{const s=a;i+=n.text(s.text);break}case"html":{const s=a;i+=n.html(s.text);break}case"link":{const s=a;i+=n.link(s.href,s.title,this.parseInline(s.tokens,n));break}case"image":{const s=a;i+=n.image(s.href,s.title,s.text);break}case"strong":{const s=a;i+=n.strong(this.parseInline(s.tokens,n));break}case"em":{const s=a;i+=n.em(this.parseInline(s.tokens,n));break}case"codespan":{const s=a;i+=n.codespan(s.text);break}case"br":{i+=n.br();break}case"del":{const s=a;i+=n.del(this.parseInline(s.tokens,n));break}case"text":{const s=a;i+=n.text(s.text);break}default:{const s='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return i}}class ud{constructor(e){V(this,"options");this.options=e||Sl}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}V(ud,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));var El,Hv,MP;class Oz{constructor(...e){To(this,El);V(this,"defaults",G0());V(this,"options",this.setOptions);V(this,"parse",Dr(this,El,Hv).call(this,la.lex,ca.parse));V(this,"parseInline",Dr(this,El,Hv).call(this,la.lexInline,ca.parseInline));V(this,"Parser",ca);V(this,"Renderer",vm);V(this,"TextRenderer",W0);V(this,"Lexer",la);V(this,"Tokenizer",Em);V(this,"Hooks",ud);this.use(...e)}walkTokens(e,n){let i=[];for(const r of e)switch(i=i.concat(n.call(this,r)),r.type){case"table":{const a=r;for(const s of a.header)i=i.concat(this.walkTokens(s.tokens,n));for(const s of a.rows)for(const o of s)i=i.concat(this.walkTokens(o.tokens,n));break}case"list":{const a=r;i=i.concat(this.walkTokens(a.items,n));break}default:{const a=r;this.defaults.extensions?.childTokens?.[a.type]?this.defaults.extensions.childTokens[a.type].forEach(s=>{const o=a[s].flat(1/0);i=i.concat(this.walkTokens(o,n))}):a.tokens&&(i=i.concat(this.walkTokens(a.tokens,n)))}}return i}use(...e){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(i=>{const r={...i};if(r.async=this.defaults.async||r.async||!1,i.extensions&&(i.extensions.forEach(a=>{if(!a.name)throw new Error("extension name required");if("renderer"in a){const s=n.renderers[a.name];s?n.renderers[a.name]=function(...o){let l=a.renderer.apply(this,o);return l===!1&&(l=s.apply(this,o)),l}:n.renderers[a.name]=a.renderer}if("tokenizer"in a){if(!a.level||a.level!=="block"&&a.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const s=n[a.level];s?s.unshift(a.tokenizer):n[a.level]=[a.tokenizer],a.start&&(a.level==="block"?n.startBlock?n.startBlock.push(a.start):n.startBlock=[a.start]:a.level==="inline"&&(n.startInline?n.startInline.push(a.start):n.startInline=[a.start]))}"childTokens"in a&&a.childTokens&&(n.childTokens[a.name]=a.childTokens)}),r.extensions=n),i.renderer){const a=this.defaults.renderer||new vm(this.defaults);for(const s in i.renderer){if(!(s in a))throw new Error(`renderer '${s}' does not exist`);if(s==="options")continue;const o=s,l=i.renderer[o],c=a[o];a[o]=(...u)=>{let d=l.apply(a,u);return d===!1&&(d=c.apply(a,u)),d||""}}r.renderer=a}if(i.tokenizer){const a=this.defaults.tokenizer||new Em(this.defaults);for(const s in i.tokenizer){if(!(s in a))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;const o=s,l=i.tokenizer[o],c=a[o];a[o]=(...u)=>{let d=l.apply(a,u);return d===!1&&(d=c.apply(a,u)),d}}r.tokenizer=a}if(i.hooks){const a=this.defaults.hooks||new ud;for(const s in i.hooks){if(!(s in a))throw new Error(`hook '${s}' does not exist`);if(s==="options")continue;const o=s,l=i.hooks[o],c=a[o];ud.passThroughHooks.has(s)?a[o]=u=>{if(this.defaults.async)return Promise.resolve(l.call(a,u)).then(p=>c.call(a,p));const d=l.call(a,u);return c.call(a,d)}:a[o]=(...u)=>{let d=l.apply(a,u);return d===!1&&(d=c.apply(a,u)),d}}r.hooks=a}if(i.walkTokens){const a=this.defaults.walkTokens,s=i.walkTokens;r.walkTokens=function(o){let l=[];return l.push(s.call(this,o)),a&&(l=l.concat(a.call(this,o))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,n){return la.lex(e,n??this.defaults)}parser(e,n){return ca.parse(e,n??this.defaults)}}El=new WeakSet,Hv=function(e,n){return(i,r)=>{const a={...r},s={...this.defaults,...a};this.defaults.async===!0&&a.async===!1&&(s.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),s.async=!0);const o=Dr(this,El,MP).call(this,!!s.silent,!!s.async);if(typeof i>"u"||i===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof i!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(i)+", string expected"));if(s.hooks&&(s.hooks.options=s),s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(i):i).then(l=>e(l,s)).then(l=>s.hooks?s.hooks.processAllTokens(l):l).then(l=>s.walkTokens?Promise.all(this.walkTokens(l,s.walkTokens)).then(()=>l):l).then(l=>n(l,s)).then(l=>s.hooks?s.hooks.postprocess(l):l).catch(o);try{s.hooks&&(i=s.hooks.preprocess(i));let l=e(i,s);s.hooks&&(l=s.hooks.processAllTokens(l)),s.walkTokens&&this.walkTokens(l,s.walkTokens);let c=n(l,s);return s.hooks&&(c=s.hooks.postprocess(c)),c}catch(l){return o(l)}}},MP=function(e,n){return i=>{if(i.message+=`
47
- Please report this to https://github.com/markedjs/marked.`,e){const r="<p>An error occurred:</p><pre>"+Ui(i.message+"",!0)+"</pre>";return n?Promise.resolve(r):r}if(n)return Promise.reject(i);throw i}};const il=new Oz;function Rt(t,e){return il.parse(t,e)}Rt.options=Rt.setOptions=function(t){return il.setOptions(t),Rt.defaults=il.defaults,CP(Rt.defaults),Rt};Rt.getDefaults=G0;Rt.defaults=Sl;Rt.use=function(...t){return il.use(...t),Rt.defaults=il.defaults,CP(Rt.defaults),Rt};Rt.walkTokens=function(t,e){return il.walkTokens(t,e)};Rt.parseInline=il.parseInline;Rt.Parser=ca;Rt.parser=ca.parse;Rt.Renderer=vm;Rt.TextRenderer=W0;Rt.Lexer=la;Rt.lexer=la.lex;Rt.Tokenizer=Em;Rt.Hooks=ud;Rt.parse=Rt;Rt.options;Rt.setOptions;Rt.use;Rt.walkTokens;Rt.parseInline;ca.parse;la.lex;function Rz(t){return String(t??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Mz(t){const e=String(t?.text??"");if(t?.markdown===!0){const n=Rt.parse(e,{async:!1});return typeof n=="string"?n:String(n)}return`<p>${Rz(e)}</p>`}function hc(t){const e={...t};for(const[n,i]of Object.entries(e)){const r=i.type;if(r==="CustomEditor"||r==="Wysiwyg")e[n]={...i,type:"NotionText"};else if(r==="Text"){const a=i.data??{},s=a.props??{},o=Mz(s);e[n]={...i,type:"NotionText",data:{...a,props:{html:o}}}}}return e}const Pz=10,Lz=.4,Tm=385,$d="https://maildrill.s3.eu-south-1.amazonaws.com/assets/emailbuilder-placeholder.jpg";let m_=null;const Fz=2e3;function Ep(){m_&&clearTimeout(m_),m_=setTimeout(()=>{const t=new CustomEvent("email-builder-auto-save",{detail:!0});window.dispatchEvent(t)},Fz)}const Bz=()=>({document:hc(JSON.parse(JSON.stringify(M$))),selectedBlockId:null,selectedSidebarTab:"styles",selectedMainTab:"editor",selectedScreenSize:"desktop",windowWidth:0,inspectorDrawerOpen:!0,componentTreeOpen:!1,samplesDrawerOpen:!0,inspectorDrawerWidth:Tm,devMode:!1,imageUploading:{uploading:!1,id:""},disableEdition:!1,disableUpdate:!1,freeMode:!1,minHeight:"calc(100dvh - 65px)",color:{primary:"",secondary:""},galleryImages:!0,imagePlaceholder:$d,darkMode:!0,colorPicker:{paletteColors:R$,isLocked:!1},tour:!1,stickyHeader:!0,heightContent:"calc(100dvh - 50px)",containerGrow:!0,notionTextInlineEditingBlockId:null,highlightColor:"#FF6B35"}),ne=_P(()=>Bz());v.createContext(ne);function PP(){const t=ne(e=>e.document[ne(n=>n.selectedBlockId)||""]);return t?t.type:null}function Tx(t){return ne.setState({windowWidth:t})}function Uz(){return ne(t=>t.devMode)}function $z(t){return ne.setState({devMode:t})}function K0(){return ne(t=>t.document)}function LP(t){return ne(e=>e.document[t])}function zz(t){return ne(e=>e.document[t]?.type)}function Gz(t){return ne(e=>e.selectedBlockId===t)}function Jc(){return ne(t=>t.selectedBlockId)}function Sp(){return ne(t=>t.notionTextInlineEditingBlockId)}function Cx(t){return ne.setState({notionTextInlineEditingBlockId:t})}function qz(){return!!Sp()}function Hz(){return Sp()}function jz(){return ne(t=>t.highlightColor)}function dn(){return ne(t=>t.selectedScreenSize)}function Q0(){return ne(t=>t.selectedMainTab)}function nf(t){return t==="preview"&&Hi(null),ne.setState({inspectorDrawerOpen:t==="editor"}),ne.setState({selectedMainTab:t})}function va(){return ne(t=>t.selectedSidebarTab)}function Vz(){return ne(t=>t.inspectorDrawerOpen)}function X0(){return ne(t=>t.componentTreeOpen)}function jv(){ne.setState(t=>({componentTreeOpen:!t.componentTreeOpen}))}function Jh(){return ne(t=>t.imageUploading)}function Yz(){return ne(t=>t.disableEdition)}function Hi(t){Dc();const e=ne.getState().document[t||""]?.type,n=_m.includes(e||null)?"styles":"block-configuration",i={};return t!==null&&ne.getState().selectedMainTab==="editor"&&(i.inspectorDrawerOpen=!0),ne.setState({selectedBlockId:t,selectedSidebarTab:n,...i})}function Wz(t){return ne.setState({selectedSidebarTab:t})}function uc(t){const e=ne.getState().document,n=hc(t);return Ur(e,n),X$(),ne.setState({document:n,selectedSidebarTab:"styles",selectedBlockId:null})}const Cm=(t,e,n=5,i=0)=>{if(t===e)return!0;if(t===null||e===null||t===void 0||e===void 0)return t===e;if(typeof t!=typeof e)return!1;if(typeof t!="object")return t===e;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(i<n){if(!Cm(t[s],e[s],n,i+1))return!1}else if(t[s]!==e[s])return!1;return!0}if(i>=n)try{return JSON.stringify(t)===JSON.stringify(e)}catch{return!1}const r=Object.keys(t),a=Object.keys(e);if(r.length!==a.length)return!1;for(const s of r){if(!a.includes(s))return!1;const o=t[s],l=e[s];if(!Cm(o,l,n,i+1))return!1}return!0};function Kz(t){return typeof t=="string"}function FP(t){return Kz(t)?{version:1,type:"full",doc:t}:t}function BP(t,e){const n=FP(t);if(n.type==="full")return JSON.parse(n.doc);const i=BP(e[n.baseIndex],e);return gp(Hn(i),Hn(n.ops),!1,!1,!0).newDocument}function J0(t,e){if(t<0||t>=e.length)throw new Error(`reconstructFromPatch: índice ${t} fuera de rango [0, ${e.length})`);const n=e[t],i=FP(n);if(i.type==="full")return JSON.parse(i.doc);const r=J0(i.baseIndex,e);return gp(Hn(r),Hn(i.ops),!1,!1,!0).newDocument}function Qz(t,e,n){const i=JSON.stringify(t),r=i.length;if(n<0)return{version:1,type:"full",doc:i};const a=BP(e[n],e),s=SP(a,t);if(s.length===0)return null;const o=JSON.stringify(s).length,l=e.length-n;return o>r*Lz||l>=Pz?{version:1,type:"full",doc:i}:{version:1,type:"patch",baseIndex:n,ops:s}}function Xz(t){for(let e=t.length-1;e>=0;e--)if(t[e].type==="full")return e;return-1}function dd(t){const e=_p(),n=Xz(e);return Qz(t,e,n)}function UP(t){return{version:1,type:"full",doc:JSON.stringify(t)}}let zd=[],wi=!1,ws=[];function Jz(t,e){const n=new Set,i=Object.keys(t),r=Object.keys(e);for(const a of r)(!t[a]||!Cm(t[a],e[a]))&&n.add(a);for(const a of i)e[a]||n.add(a);return[...n]}const Zz=1e3;let Bo=null;function $P(){Bo&&clearTimeout(Bo),Bo=setTimeout(()=>{zP(),Bo=null},Zz)}function eG(t){return t.map(e=>({original:e.original,new:e.new}))}function zP(){const t=[...zd];zd=[];const e=eG(t);for(const n of e)tG(n.original,n.new)}function Ur(t,e,n){const i={original:t,new:e,blockIds:n??Jz(t,e)};if(wi){ws.push(i);return}zd.push(i),$P()}function GP(t){const e=wi;wi=!0,ws=[];try{const n=t();if(ws.length>0){const i=ws[0],r=ws[ws.length-1];zd.push({original:i.original,new:r.new,blockIds:ws.flatMap(a=>a.blockIds??[])}),$P()}return n}finally{wi=e,ws=[]}}function Dc(){Bo&&(clearTimeout(Bo),Bo=null),zd.length>0&&zP();const{pendingUndoTimeout:t,pendingOriginalDocument:e}=vP();if(t)if(clearTimeout(t),e){const n=dd(e);if(n){const i=[..._p()];ia({stackUndo:[...i,n],pendingOriginalDocument:null,pendingUndoTimeout:null,lastChange:null})}else ia({pendingOriginalDocument:null,pendingUndoTimeout:null,lastChange:null})}else ia({pendingUndoTimeout:null,lastChange:null})}function tG(t,e){const{pendingUndoTimeout:r,pendingOriginalDocument:a,lastChange:s}=vP();let o=!0,l=null;const c=(f,h)=>{if(f?.type==="Image"&&h?.type==="Image"){const _=f.data.props?.width,g=h.data.props?.width;return _==null&&typeof g=="number"}return!1};if(t===e)return null;const u=Object.keys(t),d=Object.keys(e);if(u.length!==d.length)l=d.find(f=>!t[f])||u.find(f=>!e[f])||null;else for(const f of d){const h=t[f],_=e[f];if(h!==_){if(h&&_&&c(h,_)){o=!1;break}if(!Cm(h,_)){l=f;break}}}if(o&&l!==null){const f=Date.now(),h=[..._p()];if(h.length>=50&&h.shift(),l){if(s&&s.blockId!==l&&a){r&&clearTimeout(r);const _=dd(a);_&&ia({stackUndo:[...h,_],pendingOriginalDocument:null,pendingUndoTimeout:null,lastChange:null,stackRedo:[]})}if(s&&s.blockId===l&&f-s.timestamp<400){r&&clearTimeout(r);const _=setTimeout(()=>{const g=dd(a);g&&ia({stackUndo:[...h,g],pendingOriginalDocument:null,pendingUndoTimeout:null,lastChange:null,stackRedo:[]})},400);ia({pendingUndoTimeout:_,stackRedo:[],lastChange:{blockId:l,timestamp:f}})}else{r&&clearTimeout(r);const _=setTimeout(()=>{const g=dd(t);g&&ia({stackUndo:[...h,g],stackRedo:[],pendingOriginalDocument:null,pendingUndoTimeout:null,lastChange:null})},400);ia({pendingOriginalDocument:t,pendingUndoTimeout:_,stackRedo:[],lastChange:{blockId:l,timestamp:f}})}}}return null}function vp(t,e=!0){const n=ne.getState().document,i={...n,...t};e&&wi&&Ur(n,i);const r=()=>{ne.setState({document:i}),e&&!wi&&Promise.resolve().then(()=>Ur(n,i)),Ep();const a=new CustomEvent("email-builder-auto-save",{detail:e});window.dispatchEvent(a)};return e?(v.startTransition(r),ne.getState()):r()}function km(t){return ne.setState({selectedScreenSize:t})}function gc(t,e){return ne.setState({imageUploading:{uploading:t,id:e||""}})}function qP(t){return ne.setState({disableEdition:t})}function nG(){return ne.getState().document.root.data}function Zh(){return ne(t=>t.document?.root?.data)}function kx(){Dc();const t=ne.getState().document,e=_p(),n=TP();if(e.length===0)return;const i=[...e],r=i.length-1;i.pop();const a=ne.getState().selectedBlockId,s=J0(r,e);ia({stackUndo:i,stackRedo:[...n,UP(t)]}),s?.root?.data?.childrenIds?.includes(a)||Hi(null),ne.setState({document:s})}function xx(){Dc();const t=ne.getState().document,e=_p(),n=TP();if(n.length===0)return;const i=[...n],r=i.length-1;i.pop();const a=ne.getState().selectedBlockId,s=J0(r,n),o=dd(t)??UP(t);ia({stackUndo:[...e,o],stackRedo:i}),s?.root?.data?.childrenIds?.includes(a)||Hi(null),ne.setState({document:s})}function iG(t){return ne.setState({color:t})}function rG(t){return ne.setState({galleryImages:t})}function xm(){return ne.getState().galleryImages}function aG(t){return ne.setState({imagePlaceholder:t})}function sG(){return ne.getState().imagePlaceholder}function oG(t){return ne.setState({freeMode:t})}function Z0(){return ne.getState().freeMode}function lG(t){return ne.setState({darkMode:t})}function cG(t){return ne.setState({heightContent:t})}function uG(t){return ne.setState({containerGrow:t})}function dG(){return ne.getState().containerGrow}function Gd(t,e,n,i=!0){vl({draggedId:e,targetId:t})&&console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");const r=ne.getState().document,a=JSON.parse(JSON.stringify({...r})),s=u=>{if(!u||t===e)return u;const d=u.indexOf(e);return d<0?u:u.toSpliced(d,1)},o=u=>{if(!u||t===e)return u;const d=u.indexOf(t);if(d<0)return u;const p=n==="up"?d:d+1;return u.toSpliced(p,0,e)};let l=null,c=null;for(const[u,d]of Object.entries(a)){const p=d;if(c)break;switch(p.type){case"EmailLayout":p.data.childrenIds?.length&&p.data.childrenIds.includes(e)&&(c=u,a[u]={...p,data:{...p.data,childrenIds:s(p.data.childrenIds)}});break;case"Container":p.data.props?.childrenIds?.length&&p.data.props.childrenIds.includes(e)&&(c=u,a[u]={...p,data:{...p.data,props:{...p.data.props,childrenIds:s(p.data.props.childrenIds)}}});break;case"ColumnsContainer":if(p.data.props?.columns){let f=!1;const h=p.data.props.columns.map((_,g)=>_?.childrenIds?.includes(e)?(c=`${u}-column-${g}`,f=!0,{..._,childrenIds:s(_.childrenIds)}):_);f&&(a[u]={...p,data:{...p.data,props:{...p.data.props,columns:h}}})}break}}if(l=null,i)for(const[u,d]of Object.entries(a)){const p=d;if(l)break;switch(p.type){case"EmailLayout":p.data.childrenIds?.length&&p.data.childrenIds.includes(t)&&(l=u,a[u]={...p,data:{...p.data,childrenIds:o(p.data.childrenIds)}});break;case"Container":p.data.props?.childrenIds?.length&&p.data.props.childrenIds.includes(t)&&(l=u,a[u]={...p,data:{...p.data,props:{...p.data.props,childrenIds:o(p.data.props.childrenIds)}}});break;case"ColumnsContainer":if(p.data.props?.columns){const f=p.data.props.columns.map((h,_)=>h?.childrenIds?.includes(t)?(l=`${u}-column-${_}`,{...h,childrenIds:o(h.childrenIds)}):h);a[u]={...p,data:{...p.data,props:{...p.data.props,columns:f}}}}break}}return vp(a)}function pG({parentId:t,blockId:e,indexArray:n}){if(vl({draggedId:e,targetId:t})){console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");return}return GP(()=>{Gd("",e,"down",!1);const i=ne.getState().document,r=JSON.parse(JSON.stringify({...i}));if(!r[t])return;const a=r[t],s=[...a.data.props.columns||[]];return s[n||0]={childrenIds:[e]},r[t]={type:"ColumnsContainer",data:{...a.data,props:{...a.data.props,columns:s}}},vp(r)})}function fG({parentId:t,blockId:e}){if(vl({draggedId:e,targetId:t})){console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");return}return GP(()=>{Gd("",e,"down",!1);const n=ne.getState().document,i=JSON.parse(JSON.stringify({...n}));if(!i[t])return;const r=i[t];return i[t]={type:"Container",data:{...r.data,props:{...r.data.props,childrenIds:[e]}}},vp(i)})}function vl({draggedId:t,targetId:e}){if(t===e)return!0;const n=ne.getState().document;function i(r,a){const s=n[r];if(!s)return!1;let o=[];switch(s.type){case"EmailLayout":o=s.data.childrenIds||[];break;case"Container":o=s.data.props?.childrenIds||[];break;case"ColumnsContainer":s.data.props?.columns&&s.data.props.columns.forEach(l=>{l?.childrenIds&&(o=[...o,...l.childrenIds])});break}if(o.includes(a))return!0;for(const l of o)if(i(l,a))return!0;return!1}return i(t,e)}function mG(){return ne(t=>t.colorPicker)}function h_(t){ne.setState(e=>({colorPicker:{...e.colorPicker,...t}}))}function HP(t,e){const n=ne.getState().document,i=n[t];if(!i){console.warn(`Block ${t} not found`);return}const r=e(i);if(i===r)return;const a={...n,[t]:r},s=n;wi&&Ur(s,a,[t]),v.startTransition(()=>{ne.setState({document:a}),wi||Promise.resolve().then(()=>Ur(s,a,[t]))}),Ep()}function hG(t,e){const n=ne.getState().document,i=n[t];if(!i){console.warn(`Block ${t} not found`);return}const r=e(i);if(i===r)return;const a={...n,[t]:r},s=n;wi&&Ur(s,a,[t]),ne.setState({document:a}),wi||Promise.resolve().then(()=>Ur(s,a,[t])),Ep()}function gG(t,e){HP(t,n=>{const i=typeof e=="function"?e(n.data.props):{...n.data.props,...e};return{...n,data:{...n.data,props:i}}})}function Dx(t,e){hG(t,n=>{const i=typeof e=="function"?e(n.data.props):{...n.data.props,...e};return{...n,data:{...n.data,props:i}}})}function Vv(t,e,n,i){const r=ne.getState().document,a=r[t];if(!a)return;const s=a.type==="EmailLayout"?{...a,data:{...a.data,childrenIds:i}}:{...a,data:{...a.data,props:{...a.data?.props,childrenIds:i}}},o={...r,[e]:n,[t]:s};wi&&Ur(r,o,[t,e]),v.startTransition(()=>{ne.setState({document:o}),wi||Promise.resolve().then(()=>Ur(r,o,[t,e]))}),Ep()}function _G(t){const e=ne.getState().document,n={...e,...t};wi&&Ur(e,n,Object.keys(t)),v.startTransition(()=>{ne.setState({document:n}),wi||Promise.resolve().then(()=>Ur(e,n,Object.keys(t)))}),Ep()}function Yv(t,e){HP(t,e)}var St;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function n(r){throw new Error}t.assertNever=n,t.arrayToEnum=r=>{const a={};for(const s of r)a[s]=s;return a},t.getValidEnumValues=r=>{const a=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),s={};for(const o of a)s[o]=r[o];return t.objectValues(s)},t.objectValues=r=>t.objectKeys(r).map(function(a){return r[a]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const a=[];for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&a.push(s);return a},t.find=(r,a)=>{for(const s of r)if(a(s))return s},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function i(r,a=" | "){return r.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}t.joinValues=i,t.jsonStringifyReplacer=(r,a)=>typeof a=="bigint"?a.toString():a})(St||(St={}));var wx;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(wx||(wx={}));const ve=St.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Os=t=>{switch(typeof t){case"undefined":return ve.undefined;case"string":return ve.string;case"number":return Number.isNaN(t)?ve.nan:ve.number;case"boolean":return ve.boolean;case"function":return ve.function;case"bigint":return ve.bigint;case"symbol":return ve.symbol;case"object":return Array.isArray(t)?ve.array:t===null?ve.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ve.promise:typeof Map<"u"&&t instanceof Map?ve.map:typeof Set<"u"&&t instanceof Set?ve.set:typeof Date<"u"&&t instanceof Date?ve.date:ve.object;default:return ve.unknown}},ie=St.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Za extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(a){return a.message},i={_errors:[]},r=a=>{for(const s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(r);else if(s.code==="invalid_return_type")r(s.returnTypeError);else if(s.code==="invalid_arguments")r(s.argumentsError);else if(s.path.length===0)i._errors.push(n(s));else{let o=i,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(n(s))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return r(this),i}static assert(e){if(!(e instanceof Za))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,St.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},i=[];for(const r of this.issues)if(r.path.length>0){const a=r.path[0];n[a]=n[a]||[],n[a].push(e(r))}else i.push(e(r));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}}Za.create=t=>new Za(t);const Wv=(t,e)=>{let n;switch(t.code){case ie.invalid_type:t.received===ve.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case ie.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,St.jsonStringifyReplacer)}`;break;case ie.unrecognized_keys:n=`Unrecognized key(s) in object: ${St.joinValues(t.keys,", ")}`;break;case ie.invalid_union:n="Invalid input";break;case ie.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${St.joinValues(t.options)}`;break;case ie.invalid_enum_value:n=`Invalid enum value. Expected ${St.joinValues(t.options)}, received '${t.received}'`;break;case ie.invalid_arguments:n="Invalid function arguments";break;case ie.invalid_return_type:n="Invalid function return type";break;case ie.invalid_date:n="Invalid date";break;case ie.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:St.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case ie.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case ie.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case ie.custom:n="Invalid input";break;case ie.invalid_intersection_types:n="Intersection results could not be merged";break;case ie.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case ie.not_finite:n="Number must be finite";break;default:n=e.defaultError,St.assertNever(t)}return{message:n}};let bG=Wv;function yG(){return bG}const EG=t=>{const{data:e,path:n,errorMaps:i,issueData:r}=t,a=[...n,...r.path||[]],s={...r,path:a};if(r.message!==void 0)return{...r,path:a,message:r.message};let o="";const l=i.filter(c=>!!c).slice().reverse();for(const c of l)o=c(s,{data:e,defaultError:o}).message;return{...r,path:a,message:o}};function he(t,e){const n=yG(),i=EG({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Wv?void 0:Wv].filter(r=>!!r)});t.common.issues.push(i)}class gi{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const i=[];for(const r of n){if(r.status==="aborted")return Ge;r.status==="dirty"&&e.dirty(),i.push(r.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,n){const i=[];for(const r of n){const a=await r.key,s=await r.value;i.push({key:a,value:s})}return gi.mergeObjectSync(e,i)}static mergeObjectSync(e,n){const i={};for(const r of n){const{key:a,value:s}=r;if(a.status==="aborted"||s.status==="aborted")return Ge;a.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof s.value<"u"||r.alwaysSet)&&(i[a.value]=s.value)}return{status:e.value,value:i}}}const Ge=Object.freeze({status:"aborted"}),qu=t=>({status:"dirty",value:t}),Tr=t=>({status:"valid",value:t}),Ax=t=>t.status==="aborted",Nx=t=>t.status==="dirty",wc=t=>t.status==="valid",Dm=t=>typeof Promise<"u"&&t instanceof Promise;var we;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(we||(we={}));class ga{constructor(e,n,i,r){this._cachedPath=[],this.parent=e,this.data=n,this._path=i,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ix=(t,e)=>{if(wc(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Za(t.common.issues);return this._error=n,this._error}}};function nt(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:i,description:r}=t;if(e&&(n||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(s,o)=>{const{message:l}=t;return s.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??i??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:l??n??o.defaultError}},description:r}}class pt{get description(){return this._def.description}_getType(e){return Os(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Os(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new gi,ctx:{common:e.parent.common,data:e.data,parsedType:Os(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Dm(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const i=this.safeParse(e,n);if(i.success)return i.data;throw i.error}safeParse(e,n){const i={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Os(e)},r=this._parseSync({data:e,path:i.path,parent:i});return Ix(i,r)}"~validate"(e){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Os(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return wc(i)?{value:i.value}:{issues:n.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>wc(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){const i=await this.safeParseAsync(e,n);if(i.success)return i.data;throw i.error}async safeParseAsync(e,n){const i={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Os(e)},r=this._parse({data:e,path:i.path,parent:i}),a=await(Dm(r)?r:Promise.resolve(r));return Ix(i,a)}refine(e,n){const i=r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n;return this._refinement((r,a)=>{const s=e(r),o=()=>a.addIssue({code:ie.custom,...i(r)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(o(),!1)):s?!0:(o(),!1)})}refinement(e,n){return this._refinement((i,r)=>e(i)?!0:(r.addIssue(typeof n=="function"?n(i,r):n),!1))}_refinement(e){return new sl({schema:this,typeName:qe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Ya.create(this,this._def)}nullable(){return ol.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return fa.create(this)}promise(){return Rm.create(this,this._def)}or(e){return Am.create([this,e],this._def)}and(e){return Nm.create(this,e,this._def)}transform(e){return new sl({...nt(this._def),schema:this,typeName:qe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Mm({...nt(this._def),innerType:this,defaultValue:n,typeName:qe.ZodDefault})}brand(){return new WP({typeName:qe.ZodBranded,type:this,...nt(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Pm({...nt(this._def),innerType:this,catchValue:n,typeName:qe.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return tT.create(this,e)}readonly(){return Lm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const SG=/^c[^\s-]{8,}$/i,vG=/^[0-9a-z]+$/,TG=/^[0-9A-HJKMNP-TV-Z]{26}$/i,CG=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,kG=/^[a-z0-9_-]{21}$/i,xG=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,DG=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,wG=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,AG="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let g_;const NG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,IG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,OG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,RG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,MG=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,PG=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,jP="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",LG=new RegExp(`^${jP}$`);function VP(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function FG(t){return new RegExp(`^${VP(t)}$`)}function BG(t){let e=`${jP}T${VP(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function UG(t,e){return!!((e==="v4"||!e)&&NG.test(t)||(e==="v6"||!e)&&OG.test(t))}function $G(t,e){if(!xG.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const i=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(i));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function zG(t,e){return!!((e==="v4"||!e)&&IG.test(t)||(e==="v6"||!e)&&RG.test(t))}class Ha extends pt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ve.string){const a=this._getOrReturnCtx(e);return he(a,{code:ie.invalid_type,expected:ve.string,received:a.parsedType}),Ge}const i=new gi;let r;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),he(r,{code:ie.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),i.dirty());else if(a.kind==="max")e.data.length>a.value&&(r=this._getOrReturnCtx(e,r),he(r,{code:ie.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),i.dirty());else if(a.kind==="length"){const s=e.data.length>a.value,o=e.data.length<a.value;(s||o)&&(r=this._getOrReturnCtx(e,r),s?he(r,{code:ie.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&he(r,{code:ie.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),i.dirty())}else if(a.kind==="email")wG.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"email",code:ie.invalid_string,message:a.message}),i.dirty());else if(a.kind==="emoji")g_||(g_=new RegExp(AG,"u")),g_.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"emoji",code:ie.invalid_string,message:a.message}),i.dirty());else if(a.kind==="uuid")CG.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"uuid",code:ie.invalid_string,message:a.message}),i.dirty());else if(a.kind==="nanoid")kG.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"nanoid",code:ie.invalid_string,message:a.message}),i.dirty());else if(a.kind==="cuid")SG.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"cuid",code:ie.invalid_string,message:a.message}),i.dirty());else if(a.kind==="cuid2")vG.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"cuid2",code:ie.invalid_string,message:a.message}),i.dirty());else if(a.kind==="ulid")TG.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"ulid",code:ie.invalid_string,message:a.message}),i.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),he(r,{validation:"url",code:ie.invalid_string,message:a.message}),i.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"regex",code:ie.invalid_string,message:a.message}),i.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(r=this._getOrReturnCtx(e,r),he(r,{code:ie.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),i.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(r=this._getOrReturnCtx(e,r),he(r,{code:ie.invalid_string,validation:{startsWith:a.value},message:a.message}),i.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(r=this._getOrReturnCtx(e,r),he(r,{code:ie.invalid_string,validation:{endsWith:a.value},message:a.message}),i.dirty()):a.kind==="datetime"?BG(a).test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{code:ie.invalid_string,validation:"datetime",message:a.message}),i.dirty()):a.kind==="date"?LG.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{code:ie.invalid_string,validation:"date",message:a.message}),i.dirty()):a.kind==="time"?FG(a).test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{code:ie.invalid_string,validation:"time",message:a.message}),i.dirty()):a.kind==="duration"?DG.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"duration",code:ie.invalid_string,message:a.message}),i.dirty()):a.kind==="ip"?UG(e.data,a.version)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"ip",code:ie.invalid_string,message:a.message}),i.dirty()):a.kind==="jwt"?$G(e.data,a.alg)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"jwt",code:ie.invalid_string,message:a.message}),i.dirty()):a.kind==="cidr"?zG(e.data,a.version)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"cidr",code:ie.invalid_string,message:a.message}),i.dirty()):a.kind==="base64"?MG.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"base64",code:ie.invalid_string,message:a.message}),i.dirty()):a.kind==="base64url"?PG.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"base64url",code:ie.invalid_string,message:a.message}),i.dirty()):St.assertNever(a);return{status:i.value,value:e.data}}_regex(e,n,i){return this.refinement(r=>e.test(r),{validation:n,code:ie.invalid_string,...we.errToObj(i)})}_addCheck(e){return new Ha({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...we.errToObj(e)})}url(e){return this._addCheck({kind:"url",...we.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...we.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...we.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...we.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...we.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...we.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...we.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...we.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...we.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...we.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...we.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...we.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...we.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...we.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...we.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...we.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...we.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...we.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...we.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...we.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...we.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...we.errToObj(n)})}nonempty(e){return this.min(1,we.errToObj(e))}trim(){return new Ha({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ha({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ha({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Ha.create=t=>new Ha({checks:[],typeName:qe.ZodString,coerce:t?.coerce??!1,...nt(t)});function GG(t,e){const n=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,r=n>i?n:i,a=Number.parseInt(t.toFixed(r).replace(".","")),s=Number.parseInt(e.toFixed(r).replace(".",""));return a%s/10**r}class Ac extends pt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ve.number){const a=this._getOrReturnCtx(e);return he(a,{code:ie.invalid_type,expected:ve.number,received:a.parsedType}),Ge}let i;const r=new gi;for(const a of this._def.checks)a.kind==="int"?St.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),he(i,{code:ie.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(i=this._getOrReturnCtx(e,i),he(i,{code:ie.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(i=this._getOrReturnCtx(e,i),he(i,{code:ie.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="multipleOf"?GG(e.data,a.value)!==0&&(i=this._getOrReturnCtx(e,i),he(i,{code:ie.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),he(i,{code:ie.not_finite,message:a.message}),r.dirty()):St.assertNever(a);return{status:r.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,we.toString(n))}gt(e,n){return this.setLimit("min",e,!1,we.toString(n))}lte(e,n){return this.setLimit("max",e,!0,we.toString(n))}lt(e,n){return this.setLimit("max",e,!1,we.toString(n))}setLimit(e,n,i,r){return new Ac({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:we.toString(r)}]})}_addCheck(e){return new Ac({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:we.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:we.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:we.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:we.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:we.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:we.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:we.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:we.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:we.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&St.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(n===null||i.value>n)&&(n=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(n)&&Number.isFinite(e)}}Ac.create=t=>new Ac({checks:[],typeName:qe.ZodNumber,coerce:t?.coerce||!1,...nt(t)});class qd extends pt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ve.bigint)return this._getInvalidInput(e);let i;const r=new gi;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(i=this._getOrReturnCtx(e,i),he(i,{code:ie.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(i=this._getOrReturnCtx(e,i),he(i,{code:ie.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),he(i,{code:ie.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):St.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return he(n,{code:ie.invalid_type,expected:ve.bigint,received:n.parsedType}),Ge}gte(e,n){return this.setLimit("min",e,!0,we.toString(n))}gt(e,n){return this.setLimit("min",e,!1,we.toString(n))}lte(e,n){return this.setLimit("max",e,!0,we.toString(n))}lt(e,n){return this.setLimit("max",e,!1,we.toString(n))}setLimit(e,n,i,r){return new qd({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:we.toString(r)}]})}_addCheck(e){return new qd({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:we.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:we.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:we.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:we.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:we.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}qd.create=t=>new qd({checks:[],typeName:qe.ZodBigInt,coerce:t?.coerce??!1,...nt(t)});class Kv extends pt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ve.boolean){const i=this._getOrReturnCtx(e);return he(i,{code:ie.invalid_type,expected:ve.boolean,received:i.parsedType}),Ge}return Tr(e.data)}}Kv.create=t=>new Kv({typeName:qe.ZodBoolean,coerce:t?.coerce||!1,...nt(t)});class wm extends pt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ve.date){const a=this._getOrReturnCtx(e);return he(a,{code:ie.invalid_type,expected:ve.date,received:a.parsedType}),Ge}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return he(a,{code:ie.invalid_date}),Ge}const i=new gi;let r;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),he(r,{code:ie.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),i.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(r=this._getOrReturnCtx(e,r),he(r,{code:ie.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),i.dirty()):St.assertNever(a);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new wm({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:we.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:we.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}wm.create=t=>new wm({checks:[],coerce:t?.coerce||!1,typeName:qe.ZodDate,...nt(t)});class Ox extends pt{_parse(e){if(this._getType(e)!==ve.symbol){const i=this._getOrReturnCtx(e);return he(i,{code:ie.invalid_type,expected:ve.symbol,received:i.parsedType}),Ge}return Tr(e.data)}}Ox.create=t=>new Ox({typeName:qe.ZodSymbol,...nt(t)});class Qv extends pt{_parse(e){if(this._getType(e)!==ve.undefined){const i=this._getOrReturnCtx(e);return he(i,{code:ie.invalid_type,expected:ve.undefined,received:i.parsedType}),Ge}return Tr(e.data)}}Qv.create=t=>new Qv({typeName:qe.ZodUndefined,...nt(t)});class Xv extends pt{_parse(e){if(this._getType(e)!==ve.null){const i=this._getOrReturnCtx(e);return he(i,{code:ie.invalid_type,expected:ve.null,received:i.parsedType}),Ge}return Tr(e.data)}}Xv.create=t=>new Xv({typeName:qe.ZodNull,...nt(t)});class Rx extends pt{constructor(){super(...arguments),this._any=!0}_parse(e){return Tr(e.data)}}Rx.create=t=>new Rx({typeName:qe.ZodAny,...nt(t)});class Mx extends pt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Tr(e.data)}}Mx.create=t=>new Mx({typeName:qe.ZodUnknown,...nt(t)});class Js extends pt{_parse(e){const n=this._getOrReturnCtx(e);return he(n,{code:ie.invalid_type,expected:ve.never,received:n.parsedType}),Ge}}Js.create=t=>new Js({typeName:qe.ZodNever,...nt(t)});class Px extends pt{_parse(e){if(this._getType(e)!==ve.undefined){const i=this._getOrReturnCtx(e);return he(i,{code:ie.invalid_type,expected:ve.void,received:i.parsedType}),Ge}return Tr(e.data)}}Px.create=t=>new Px({typeName:qe.ZodVoid,...nt(t)});class fa extends pt{_parse(e){const{ctx:n,status:i}=this._processInputParams(e),r=this._def;if(n.parsedType!==ve.array)return he(n,{code:ie.invalid_type,expected:ve.array,received:n.parsedType}),Ge;if(r.exactLength!==null){const s=n.data.length>r.exactLength.value,o=n.data.length<r.exactLength.value;(s||o)&&(he(n,{code:s?ie.too_big:ie.too_small,minimum:o?r.exactLength.value:void 0,maximum:s?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),i.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(he(n,{code:ie.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),i.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(he(n,{code:ie.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((s,o)=>r.type._parseAsync(new ga(n,s,n.path,o)))).then(s=>gi.mergeArray(i,s));const a=[...n.data].map((s,o)=>r.type._parseSync(new ga(n,s,n.path,o)));return gi.mergeArray(i,a)}get element(){return this._def.type}min(e,n){return new fa({...this._def,minLength:{value:e,message:we.toString(n)}})}max(e,n){return new fa({...this._def,maxLength:{value:e,message:we.toString(n)}})}length(e,n){return new fa({...this._def,exactLength:{value:e,message:we.toString(n)}})}nonempty(e){return this.min(1,e)}}fa.create=(t,e)=>new fa({type:t,minLength:null,maxLength:null,exactLength:null,typeName:qe.ZodArray,...nt(e)});function ec(t){if(t instanceof bn){const e={};for(const n in t.shape){const i=t.shape[n];e[n]=Ya.create(ec(i))}return new bn({...t._def,shape:()=>e})}else return t instanceof fa?new fa({...t._def,type:ec(t.element)}):t instanceof Ya?Ya.create(ec(t.unwrap())):t instanceof ol?ol.create(ec(t.unwrap())):t instanceof rl?rl.create(t.items.map(e=>ec(e))):t}class bn extends pt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=St.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==ve.object){const c=this._getOrReturnCtx(e);return he(c,{code:ie.invalid_type,expected:ve.object,received:c.parsedType}),Ge}const{status:i,ctx:r}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof Js&&this._def.unknownKeys==="strip"))for(const c in r.data)s.includes(c)||o.push(c);const l=[];for(const c of s){const u=a[c],d=r.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new ga(r,d,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof Js){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of o)l.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(c==="strict")o.length>0&&(he(r,{code:ie.unrecognized_keys,keys:o}),i.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of o){const d=r.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new ga(r,d,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,p=await u.value;c.push({key:d,value:p,alwaysSet:u.alwaysSet})}return c}).then(c=>gi.mergeObjectSync(i,c)):gi.mergeObjectSync(i,l)}get shape(){return this._def.shape()}strict(e){return we.errToObj,new bn({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,i)=>{const r=this._def.errorMap?.(n,i).message??i.defaultError;return n.code==="unrecognized_keys"?{message:we.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new bn({...this._def,unknownKeys:"strip"})}passthrough(){return new bn({...this._def,unknownKeys:"passthrough"})}extend(e){return new bn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new bn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:qe.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new bn({...this._def,catchall:e})}pick(e){const n={};for(const i of St.objectKeys(e))e[i]&&this.shape[i]&&(n[i]=this.shape[i]);return new bn({...this._def,shape:()=>n})}omit(e){const n={};for(const i of St.objectKeys(this.shape))e[i]||(n[i]=this.shape[i]);return new bn({...this._def,shape:()=>n})}deepPartial(){return ec(this)}partial(e){const n={};for(const i of St.objectKeys(this.shape)){const r=this.shape[i];e&&!e[i]?n[i]=r:n[i]=r.optional()}return new bn({...this._def,shape:()=>n})}required(e){const n={};for(const i of St.objectKeys(this.shape))if(e&&!e[i])n[i]=this.shape[i];else{let a=this.shape[i];for(;a instanceof Ya;)a=a._def.innerType;n[i]=a}return new bn({...this._def,shape:()=>n})}keyof(){return YP(St.objectKeys(this.shape))}}bn.create=(t,e)=>new bn({shape:()=>t,unknownKeys:"strip",catchall:Js.create(),typeName:qe.ZodObject,...nt(e)});bn.strictCreate=(t,e)=>new bn({shape:()=>t,unknownKeys:"strict",catchall:Js.create(),typeName:qe.ZodObject,...nt(e)});bn.lazycreate=(t,e)=>new bn({shape:t,unknownKeys:"strip",catchall:Js.create(),typeName:qe.ZodObject,...nt(e)});class Am extends pt{_parse(e){const{ctx:n}=this._processInputParams(e),i=this._def.options;function r(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;const s=a.map(o=>new Za(o.ctx.common.issues));return he(n,{code:ie.invalid_union,unionErrors:s}),Ge}if(n.common.async)return Promise.all(i.map(async a=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(r);{let a;const s=[];for(const l of i){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!a&&(a={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(l=>new Za(l));return he(n,{code:ie.invalid_union,unionErrors:o}),Ge}}get options(){return this._def.options}}Am.create=(t,e)=>new Am({options:t,typeName:qe.ZodUnion,...nt(e)});const Ua=t=>t instanceof Zv?Ua(t.schema):t instanceof sl?Ua(t.innerType()):t instanceof Om?[t.value]:t instanceof al?t.options:t instanceof e1?St.objectValues(t.enum):t instanceof Mm?Ua(t._def.innerType):t instanceof Qv?[void 0]:t instanceof Xv?[null]:t instanceof Ya?[void 0,...Ua(t.unwrap())]:t instanceof ol?[null,...Ua(t.unwrap())]:t instanceof WP||t instanceof Lm?Ua(t.unwrap()):t instanceof Pm?Ua(t._def.innerType):[];class eT extends pt{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ve.object)return he(n,{code:ie.invalid_type,expected:ve.object,received:n.parsedType}),Ge;const i=this.discriminator,r=n.data[i],a=this.optionsMap.get(r);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(he(n,{code:ie.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),Ge)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,i){const r=new Map;for(const a of n){const s=Ua(a.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of s){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,a)}}return new eT({typeName:qe.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:r,...nt(i)})}}function Jv(t,e){const n=Os(t),i=Os(e);if(t===e)return{valid:!0,data:t};if(n===ve.object&&i===ve.object){const r=St.objectKeys(e),a=St.objectKeys(t).filter(o=>r.indexOf(o)!==-1),s={...t,...e};for(const o of a){const l=Jv(t[o],e[o]);if(!l.valid)return{valid:!1};s[o]=l.data}return{valid:!0,data:s}}else if(n===ve.array&&i===ve.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let a=0;a<t.length;a++){const s=t[a],o=e[a],l=Jv(s,o);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return n===ve.date&&i===ve.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Nm extends pt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e),r=(a,s)=>{if(Ax(a)||Ax(s))return Ge;const o=Jv(a.value,s.value);return o.valid?((Nx(a)||Nx(s))&&n.dirty(),{status:n.value,value:o.data}):(he(i,{code:ie.invalid_intersection_types}),Ge)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([a,s])=>r(a,s)):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}Nm.create=(t,e,n)=>new Nm({left:t,right:e,typeName:qe.ZodIntersection,...nt(n)});class rl extends pt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==ve.array)return he(i,{code:ie.invalid_type,expected:ve.array,received:i.parsedType}),Ge;if(i.data.length<this._def.items.length)return he(i,{code:ie.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ge;!this._def.rest&&i.data.length>this._def.items.length&&(he(i,{code:ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const a=[...i.data].map((s,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new ga(i,s,i.path,o)):null}).filter(s=>!!s);return i.common.async?Promise.all(a).then(s=>gi.mergeArray(n,s)):gi.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new rl({...this._def,rest:e})}}rl.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new rl({items:t,typeName:qe.ZodTuple,rest:null,...nt(e)})};class Im extends pt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==ve.object)return he(i,{code:ie.invalid_type,expected:ve.object,received:i.parsedType}),Ge;const r=[],a=this._def.keyType,s=this._def.valueType;for(const o in i.data)r.push({key:a._parse(new ga(i,o,i.path,o)),value:s._parse(new ga(i,i.data[o],i.path,o)),alwaysSet:o in i.data});return i.common.async?gi.mergeObjectAsync(n,r):gi.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(e,n,i){return n instanceof pt?new Im({keyType:e,valueType:n,typeName:qe.ZodRecord,...nt(i)}):new Im({keyType:Ha.create(),valueType:e,typeName:qe.ZodRecord,...nt(n)})}}class Lx extends pt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==ve.map)return he(i,{code:ie.invalid_type,expected:ve.map,received:i.parsedType}),Ge;const r=this._def.keyType,a=this._def.valueType,s=[...i.data.entries()].map(([o,l],c)=>({key:r._parse(new ga(i,o,i.path,[c,"key"])),value:a._parse(new ga(i,l,i.path,[c,"value"]))}));if(i.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of s){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Ge;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),o.set(c.value,u.value)}return{status:n.value,value:o}})}else{const o=new Map;for(const l of s){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Ge;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),o.set(c.value,u.value)}return{status:n.value,value:o}}}}Lx.create=(t,e,n)=>new Lx({valueType:e,keyType:t,typeName:qe.ZodMap,...nt(n)});class Hd extends pt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==ve.set)return he(i,{code:ie.invalid_type,expected:ve.set,received:i.parsedType}),Ge;const r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(he(i,{code:ie.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&i.data.size>r.maxSize.value&&(he(i,{code:ie.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());const a=this._def.valueType;function s(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Ge;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const o=[...i.data.values()].map((l,c)=>a._parse(new ga(i,l,i.path,c)));return i.common.async?Promise.all(o).then(l=>s(l)):s(o)}min(e,n){return new Hd({...this._def,minSize:{value:e,message:we.toString(n)}})}max(e,n){return new Hd({...this._def,maxSize:{value:e,message:we.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Hd.create=(t,e)=>new Hd({valueType:t,minSize:null,maxSize:null,typeName:qe.ZodSet,...nt(e)});class Zv extends pt{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Zv.create=(t,e)=>new Zv({getter:t,typeName:qe.ZodLazy,...nt(e)});class Om extends pt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return he(n,{received:n.data,code:ie.invalid_literal,expected:this._def.value}),Ge}return{status:"valid",value:e.data}}get value(){return this._def.value}}Om.create=(t,e)=>new Om({value:t,typeName:qe.ZodLiteral,...nt(e)});function YP(t,e){return new al({values:t,typeName:qe.ZodEnum,...nt(e)})}class al extends pt{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),i=this._def.values;return he(n,{expected:St.joinValues(i),received:n.parsedType,code:ie.invalid_type}),Ge}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),i=this._def.values;return he(n,{received:n.data,code:ie.invalid_enum_value,options:i}),Ge}return Tr(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return al.create(e,{...this._def,...n})}exclude(e,n=this._def){return al.create(this.options.filter(i=>!e.includes(i)),{...this._def,...n})}}al.create=YP;class e1 extends pt{_parse(e){const n=St.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==ve.string&&i.parsedType!==ve.number){const r=St.objectValues(n);return he(i,{expected:St.joinValues(r),received:i.parsedType,code:ie.invalid_type}),Ge}if(this._cache||(this._cache=new Set(St.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=St.objectValues(n);return he(i,{received:i.data,code:ie.invalid_enum_value,options:r}),Ge}return Tr(e.data)}get enum(){return this._def.values}}e1.create=(t,e)=>new e1({values:t,typeName:qe.ZodNativeEnum,...nt(e)});class Rm extends pt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ve.promise&&n.common.async===!1)return he(n,{code:ie.invalid_type,expected:ve.promise,received:n.parsedType}),Ge;const i=n.parsedType===ve.promise?n.data:Promise.resolve(n.data);return Tr(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Rm.create=(t,e)=>new Rm({type:t,typeName:qe.ZodPromise,...nt(e)});class sl extends pt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===qe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:i}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:s=>{he(i,s),s.fatal?n.abort():n.dirty()},get path(){return i.path}};if(a.addIssue=a.addIssue.bind(a),r.type==="preprocess"){const s=r.transform(i.data,a);if(i.common.async)return Promise.resolve(s).then(async o=>{if(n.value==="aborted")return Ge;const l=await this._def.schema._parseAsync({data:o,path:i.path,parent:i});return l.status==="aborted"?Ge:l.status==="dirty"||n.value==="dirty"?qu(l.value):l});{if(n.value==="aborted")return Ge;const o=this._def.schema._parseSync({data:s,path:i.path,parent:i});return o.status==="aborted"?Ge:o.status==="dirty"||n.value==="dirty"?qu(o.value):o}}if(r.type==="refinement"){const s=o=>{const l=r.refinement(o,a);if(i.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(i.common.async===!1){const o=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?Ge:(o.status==="dirty"&&n.dirty(),s(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(o=>o.status==="aborted"?Ge:(o.status==="dirty"&&n.dirty(),s(o.value).then(()=>({status:n.value,value:o.value}))))}if(r.type==="transform")if(i.common.async===!1){const s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!wc(s))return Ge;const o=r.transform(s.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(s=>wc(s)?Promise.resolve(r.transform(s.value,a)).then(o=>({status:n.value,value:o})):Ge);St.assertNever(r)}}sl.create=(t,e,n)=>new sl({schema:t,typeName:qe.ZodEffects,effect:e,...nt(n)});sl.createWithPreprocess=(t,e,n)=>new sl({schema:e,effect:{type:"preprocess",transform:t},typeName:qe.ZodEffects,...nt(n)});class Ya extends pt{_parse(e){return this._getType(e)===ve.undefined?Tr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ya.create=(t,e)=>new Ya({innerType:t,typeName:qe.ZodOptional,...nt(e)});class ol extends pt{_parse(e){return this._getType(e)===ve.null?Tr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ol.create=(t,e)=>new ol({innerType:t,typeName:qe.ZodNullable,...nt(e)});class Mm extends pt{_parse(e){const{ctx:n}=this._processInputParams(e);let i=n.data;return n.parsedType===ve.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Mm.create=(t,e)=>new Mm({innerType:t,typeName:qe.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...nt(e)});class Pm extends pt{_parse(e){const{ctx:n}=this._processInputParams(e),i={...n,common:{...n.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return Dm(r)?r.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Za(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Za(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}Pm.create=(t,e)=>new Pm({innerType:t,typeName:qe.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...nt(e)});class Fx extends pt{_parse(e){if(this._getType(e)!==ve.nan){const i=this._getOrReturnCtx(e);return he(i,{code:ie.invalid_type,expected:ve.nan,received:i.parsedType}),Ge}return{status:"valid",value:e.data}}}Fx.create=t=>new Fx({typeName:qe.ZodNaN,...nt(t)});class WP extends pt{_parse(e){const{ctx:n}=this._processInputParams(e),i=n.data;return this._def.type._parse({data:i,path:n.path,parent:n})}unwrap(){return this._def.type}}class tT extends pt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?Ge:a.status==="dirty"?(n.dirty(),qu(a.value)):this._def.out._parseAsync({data:a.value,path:i.path,parent:i})})();{const r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?Ge:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:i.path,parent:i})}}static create(e,n){return new tT({in:e,out:n,typeName:qe.ZodPipeline})}}class Lm extends pt{_parse(e){const n=this._def.innerType._parse(e),i=r=>(wc(r)&&(r.value=Object.freeze(r.value)),r);return Dm(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}}Lm.create=(t,e)=>new Lm({innerType:t,typeName:qe.ZodReadonly,...nt(e)});var qe;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(qe||(qe={}));const Me=Ha.create,se=Ac.create,Nc=Kv.create;Js.create;const _c=fa.create,Le=bn.create,bc=Am.create,qG=eT.create;Nm.create;const KP=rl.create,HG=Im.create,t1=Om.create,jt=al.create;Rm.create;Ya.create;ol.create;function rf(t,e){return!t||t&&t[e]===0?"initial":t[e]!==void 0?`${t[e]}px solid ${t?.color??"black"}`:"initial"}function fi({className:t,background:e,backgroundColor:n,padding:i={top:0,right:0,bottom:0,left:0},width:r,align:a,children:s,border:o,borderRadius:l,isParent:c=!0,overflow:u="visible"}){const d=t?`a${t}`:"",p={width:r,minWidth:r,borderRadius:l??"initial",borderTop:rf(o,"top"),borderBottom:rf(o,"bottom"),borderLeft:rf(o,"left"),borderRight:rf(o,"right"),overflow:u,borderCollapse:"initial"};return e&&String(e).trim()!==""?p.background=e:n&&(p.backgroundColor=n),m.jsx("table",{className:t,width:r,border:0,cellSpacing:"0",cellPadding:"0",style:p,children:m.jsxs("tbody",{children:[m.jsxs("tr",{height:i.top,style:{height:`${i.top}px`},className:c?`t${t}`:`it${t}`,children:[m.jsx("td",{style:{width:`${i.left}px`},className:c?`l${t}`:`il${t}`}),m.jsx("td",{}),m.jsx("td",{style:{width:`${i.right}px`},className:c?`r${t}`:`ir${t}`})]}),m.jsxs("tr",{children:[m.jsx("td",{style:{width:`${i.left}px`},className:c?`l${t}`:`il${t}`}),m.jsx("td",{className:d,align:a,children:s}),m.jsx("td",{style:{width:`${i.right}px`},className:c?`r${t}`:`ir${t}`})]}),m.jsxs("tr",{height:i.bottom,style:{height:`${i.bottom}px`},className:c?`b${t}`:`ib${t}`,children:[m.jsx("td",{style:{width:`${i.left}px`},className:c?`l${t}`:`il${t}`}),m.jsx("td",{}),m.jsx("td",{style:{width:`${i.right}px`},className:c?`r${t}`:`ir${t}`})]})]})})}const Tl=(t,e)=>{const n=/#([0-9a-fA-F]{3,6})\b/;return n.test(t)?t.replace(n,e):t.trim()===""?e:t.replace(/^(\S+)/,`$1 ${e}`)};function Fm(t){const e=t?.shape??"rectangle";if(typeof e=="string")switch(e){case"rectangle":return;case"pill":return 9999;default:return}else if(typeof e=="object"&&e!==null){const{topLeft:n=0,topRight:i=0,bottomLeft:r=0,bottomRight:a=0}=e;return`${i}px ${n}px ${a}px ${r}px`}}function jG(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=(e>>>0)*16777619;return e>>>0}function VG(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";if(t===0)return"a";let n="";for(;t>0;)n=e[t%62]+n,t=Math.floor(t/62);return n}function dt(t){const e=jG(t);return`b${VG(e)}`}const Bx=Le({top:se(),bottom:se(),right:se(),left:se()}).optional().nullable(),QP=Le({style:Le({textAlign:jt(["left","center","right"]).optional().nullable(),padding:Bx,mobilePadding:Bx,backgroundColor:Me().optional()}).passthrough().optional().nullable(),props:Le({size:se().gt(0).optional().nullable(),shape:jt(["circle","square","rounded"]).optional().nullable(),imageUrl:Me().optional().nullable(),alt:Me().optional().nullable()}).optional().nullable()}).passthrough(),Uo={size:64,imageUrl:"",alt:"",shape:"square"};function XP({style:t,props:e,blockId:n}){const i=e?.size??Uo.size,r=e?.imageUrl??Uo.imageUrl,a=e?.alt??Uo.alt;e?.shape??Uo.shape;const s=Jh(),o={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},l=m.jsx(fi,{isParent:!1,children:m.jsxs(m.Fragment,{children:[m.jsx("img",{alt:a??"",src:r??"",width:i,style:{width:i,height:"auto",outline:"none",border:"none",textDecoration:"none",verticalAlign:t?.contentAlignment??"middle",display:"inline-block",maxWidth:"100%",opacity:s.uploading&&s.id===n?.5:1,transition:"opacity 0.2s ease-in-out"}}),s.uploading&&s.id===n&&m.jsx("div",{style:o,children:m.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle",style:{width:"32px",height:"32px",animation:"1s linear infinite spin",stroke:"currentColor"},children:m.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})]})}),c=dt(n);return m.jsx(fi,{className:`${c}`,padding:t.padding,backgroundColor:t.backgroundColor,align:t.textAlign,width:"100%",children:l})}function Cr({title:t,children:e}){return m.jsxs(T.Container,{sx:{padding:"0!important",paddingTop:"1rem!important"},children:[m.jsx(T.Typography,{sx:{fontWeight:"bold",mb:2,pb:1,color:"text.primary",fontSize:"1.25rem",borderBottom:n=>`1px solid ${n.palette.divider}`},children:t}),m.jsx(T.Stack,{spacing:2,gap:1,mb:3,pt:1,children:e})]})}const Vt=({label:t})=>{const e=G.useTheme();return t?m.jsx("p",{style:{fontWeight:"bold",color:e.palette.text.primary},children:t}):null},Wn=({children:t})=>m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.3rem"},children:t.map(e=>e)}),YG=G.styled(T.Box)(({theme:t})=>({display:"flex",alignItems:"center",border:`1px solid ${t.palette.divider}`,borderRadius:"8px",padding:"4px",minWidth:58,maxWidth:"fit-content",backgroundColor:t.palette.background.paper,"&:hover":{borderColor:t.palette.primary.main},"&:focus-within":{borderColor:t.palette.primary.main,boxShadow:`0 0 0 1px ${t.palette.primary.main}`}})),WG=G.styled("input")(({theme:t})=>({border:"none",outline:"none",background:"transparent",textAlign:"center",width:"27px",minWidth:"27px",maxWidth:"27px",padding:"0!important",lineHeight:"normal",fontSize:"0.9rem",color:t.palette.text.primary,"&::-webkit-outer-spin-button, &::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},"&[type=number]":{MozAppearance:"textfield"}})),Ux=G.styled(T.IconButton)(({theme:t})=>({padding:"0",color:t.palette.primary.main,"&:hover":{backgroundColor:G.alpha(t.palette.primary.main,.04)},"& .MuiSvgIcon-root":{fontSize:14}}));function cn({iconLabel:t,label:e,value:n,setValue:i,units:r,min:a=0,max:s,step:o=void 0,marks:l=!0,...c}){const u=n??a,[d,p]=v.useState(u.toString()),f=S=>{let C=S;C<a&&(C=a),s!==void 0&&C>s&&(C=s),i(C),p(C.toString())},h=S=>{const C=S.target.value;if(p(C),C!==""){const D=Number(C);isNaN(D)||D>=a&&i(D)}},_=()=>{if(d===""||isNaN(Number(d)))p(u.toString());else{const S=Number(d);f(S)}},g=S=>{S.key==="Enter"&&_()};v.useEffect(()=>{p((n??a).toString())},[n,a]);const b=()=>{const S=u+1;f(S)},y=()=>{const S=u-1;f(S)},E=(S,C)=>{typeof C=="number"&&i(C)};return m.jsxs(Wn,{children:[m.jsx(Vt,{label:e}),m.jsxs(T.Stack,{direction:"row",alignItems:"center",spacing:2,justifyContent:"space-between",width:"100%",children:[m.jsx(T.Box,{sx:{minWidth:24,lineHeight:1,flexShrink:0},children:t}),m.jsx(T.Slider,{...c,value:u,min:a,max:s||1e3,step:o,color:"primary",marks:l,onChange:E}),m.jsxs(YG,{children:[m.jsx(WG,{type:"number",value:d,onChange:h,onBlur:_,onKeyDown:g,min:a,max:s,step:o}),m.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",ml:.5},children:[m.jsx(Ux,{onClick:b,disabled:s!==void 0&&u>=s,children:m.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",children:m.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})}),m.jsx(Ux,{onClick:y,disabled:u<=a,children:m.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",style:{transform:"rotate(180deg)"},children:m.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})})]})]}),m.jsx(T.Typography,{variant:"caption",color:"text.secondary",sx:{fontSize:"16px",ml:"4px!important"},children:r})]})]})}function Po({label:t,defaultValue:e,onChange:n,...i}){const[r,a]=v.useState(e??0);return e!=r&&a(e),m.jsxs(Wn,{children:[m.jsx(Vt,{label:t}),m.jsx(cn,{value:r??0,setValue:s=>{a(s),n(s)},...i})]})}function KG(t,e){const n=v.useRef(null),i=v.useRef(t),r=v.useRef([]);i.current=t;const a=v.useCallback((...s)=>{r.current=s,n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{i.current(...s),n.current=null},e)},[e]);return a.flush=v.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=null,i.current(...r.current))},[]),a}const yc=36,nT=8,eg={width:"100%","& .MuiInputBase-root":{"&:not(.MuiInputBase-multiline)":{height:`${yc}px`}},"& .MuiOutlinedInput-root":{borderRadius:`${nT}px`,"&:not(.MuiInputBase-multiline)":{height:`${yc}px`}},"& .MuiInputBase-input":{paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",height:"unset"}},QG={width:"100%",height:`${yc}px`,paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",display:"flex",alignItems:"center",borderRadius:`${nT}px`};function ll({helperText:t,label:e,placeholder:n,rows:i,InputProps:r,defaultValue:a,onChange:s}){const[o,l]=v.useState(a);v.useEffect(()=>{o!==a&&l(a)},[a]);const c=KG(d=>{s(d)},150),u=typeof i=="number"&&i>1;return m.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[m.jsx(Vt,{label:e}),m.jsx(T.TextField,{fullWidth:!0,multiline:u,minRows:i,variant:"outlined",placeholder:n,helperText:t,InputProps:r,value:o,sx:eg,onChange:d=>{const p=d.target.value;l(p),c(p)},onBlur:()=>{c.flush()}})]})}function XG({onClick:t,disabled:e,primary:n=!1}){const{t:i}=Ke.useTranslation("inspector");return m.jsx(T.IconButton,{"aria-label":i("inputs.common.close"),onClick:t,disabled:e,sx:{position:"absolute",right:8,top:8,color:r=>n?"brand.blue":r.palette.grey[500],"&:hover":{opacity:.8}},children:m.jsx($.Close,{})})}function JG({imageUrl:t,saving:e=!1}){return m.jsxs(T.Card,{sx:{position:"relative"},children:[e&&m.jsx(T.Stack,{justifyContent:"center",alignItems:"center",sx:{position:"absolute",top:7,left:0,width:"100%",height:"314px",zIndex:20,backgroundColor:"#212121AA",mb:1},children:m.jsx(T.CircularProgress,{size:48,thickness:6,color:"inherit",sx:{color:"white"}})}),m.jsx(T.CardMedia,{component:"img",sx:{objectFit:"contain",width:"100%",height:"326px"},image:t,alt:"Generated Image"})]})}function ZG({value:t,onChange:e,disabled:n}){return m.jsxs(m.Fragment,{children:[m.jsx(T.Typography,{sx:{fontSize:"14px",fontWeight:700},children:"Image description"}),m.jsx(T.TextField,{disabled:n,autoFocus:!0,margin:"dense",id:"prompt",placeholder:"Enter a detailed description here...",type:"text",fullWidth:!0,multiline:!0,rows:4,variant:"outlined",value:t,onChange:i=>e(i.target.value),sx:{mt:.5,"& .MuiOutlinedInput-root":{borderRadius:"8px"}}})]})}const e7=t=>({400:{code:400,title:t.title||"Invalid Request",message:t.message||"The request was invalid. Please check your input and try again.",action:t.action||"Modify your prompt and try again"},401:{code:401,title:t.title||"Authentication Required",message:t.message||"You need to be authenticated to perform this action.",action:t.action||"Please log in and try again"},403:{code:403,title:t.title||"Access Denied",message:t.message||"You don't have permission to perform this action.",action:t.action||"Contact support if you believe this is a mistake"},404:{code:404,title:t.title||"Not Found",message:t.message||"The requested resource was not found.",action:t.action||"Try again or use a different prompt"},422:{code:422,title:t.title||"Invalid Input",message:t.message||"The provided input cannot be processed.",action:t.action||"Modify your prompt and try again"},429:{code:429,title:t.title||"Too Many Requests",message:t.message||"You've made too many requests. Please wait a moment.",action:t.action||"Please wait a few minutes before trying again"},500:{code:500,title:t.title||"Server Error",message:t.message||"An unexpected error occurred on our servers.",action:t.action||"Please try again later"},502:{code:502,title:t.title||"Bad Gateway",message:t.message||"The server received an invalid response.",action:t.action||"Please try again later"},503:{code:503,title:t.title||"Service Unavailable",message:t.message||"The service is temporarily unavailable.",action:t.action||"Please try again later"}})[t.code]||{code:t.code,title:"Unexpected Error",message:"An unexpected error occurred.",action:"Please try again later"};function JP({src:t,style:e}){const{t:n}=Ke.useTranslation("inspector"),[i,r]=v.useState(!1),[a,s]=v.useState(!1),[o,l]=v.useState(""),[c,u]=v.useState(null),[d,p]=v.useState(!1),[f,h]=v.useState(null),[_,g]=v.useState(!1),b=()=>{r(!0),h(null)},y=()=>{a||(r(!1),s(!1),u(null),l(""),p(!1),h(null),g(!1))},E=()=>{const D=c&&!d?"store-ai-image":"request-ai-image",w=c&&!d?c:o;h(null),D==="store-ai-image"?(g(!0),s(!1),setTimeout(()=>{s(!1),y()},2e3)):s(!0),window.dispatchEvent(new CustomEvent(D,{detail:w}))},S=()=>{p(!0),u(null),h(null),g(!1)};v.useEffect(()=>{const D=w=>{const{detail:k}=w;if(s(!1),k.error){h(e7(k.error));return}if(!k.success||!k.url){h({code:0,title:"Generation Failed",message:"Failed to generate the image.",action:"Please try again"});return}u(k.url),p(!1)};return window.addEventListener("generated-image",D),()=>{window.removeEventListener("generated-image",D)}},[]),v.useEffect(()=>{y()},[t]);const C=!c||d;return m.jsxs(m.Fragment,{children:[m.jsx(T.Button,{style:e,startIcon:m.jsx($.AutoAwesome,{className:"w-4 h-4"}),variant:"contained",onClick:b,children:n("inputs.aiImageGeneration.generate")}),m.jsx(T.Dialog,{open:i,onClose:y,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{bgcolor:"background.paper",color:"text.primary",borderRadius:"8px"}},children:m.jsxs("form",{onSubmit:D=>{D.preventDefault(),E()},children:[m.jsxs(T.DialogTitle,{sx:{fontWeight:700,fontSize:"24px",color:f?"error.main":"inherit"},children:[n(f?"inputs.aiImageGeneration.titleError":a?"inputs.aiImageGeneration.titleLoading":c?"inputs.aiImageGeneration.titleReady":"inputs.aiImageGeneration.titleCreate"),m.jsx(XG,{onClick:y,disabled:a,primary:!0})]}),m.jsxs(T.DialogContent,{children:[m.jsx(T.DialogContentText,{sx:{pb:1,color:f?"error.dark":"inherit"},children:n(f?"inputs.aiImageGeneration.descriptionError":a?"inputs.aiImageGeneration.descriptionLoading":C?"inputs.aiImageGeneration.descriptionCreate":"inputs.aiImageGeneration.descriptionReady")}),c&&!d?m.jsxs(T.Stack,{sx:{position:"relative"},children:[m.jsx(JG,{imageUrl:c,saving:_}),m.jsxs(T.Alert,{variant:"outlined",severity:"warning",icon:!1,children:[n("inputs.aiImageGeneration.warningRegenerate")," ",m.jsx("b",{children:n("inputs.aiImageGeneration.warningInsertFirst")})," ",n("inputs.aiImageGeneration.warningFirst")]})]}):a&&!c?m.jsx(T.Stack,{justifyContent:"center",alignItems:"center",sx:{backgroundColor:D=>D.palette.mainColor[50],height:"326px",width:"100%"},children:m.jsx(T.CircularProgress,{size:48,thickness:6})}):m.jsx(ZG,{value:o,onChange:l,disabled:a})]}),!a&&m.jsxs(T.DialogActions,{className:"p-6",children:[c&&!d&&m.jsx(T.Button,{startIcon:m.jsx($.Refresh,{className:"w-4 h-4"}),onClick:S,variant:"outlined",disabled:a,children:n("inputs.aiImageGeneration.regenerate")}),!c&&!d&&m.jsx(T.Button,{onClick:y,variant:"text",disabled:d,children:n("inputs.aiImageGeneration.cancel")}),m.jsxs(T.Button,{startIcon:c&&!d?m.jsx($.Attachment,{className:"w-4 h-4"}):m.jsx($.AutoAwesome,{className:"w-4 h-4"}),onClick:E,variant:"contained",disabled:!o||o?.length<20,children:[n(c&&!d?"inputs.aiImageGeneration.insertImage":"inputs.aiImageGeneration.generateImage"),a&&m.jsx(T.CircularProgress,{size:16,className:"ml-2"})]})]})]})})]})}const t7=({className:t,...e})=>m.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",className:t,"aria-hidden":"true",focusable:"false",...e,children:m.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 3l6 6l6-6"})}),n7=T.styled(T.Select)(({theme:t})=>({fontFamily:t.typography.fontFamily,color:t.palette.text.primary,backgroundColor:t.palette.background.input??t.palette.grey[100],width:"100%",height:`${yc}px`,"&.MuiInputBase-root, &.MuiOutlinedInput-root":{height:`${yc}px`,minHeight:`${yc}px`,boxSizing:"border-box",borderRadius:`${nT}px`,border:`1px solid ${t.palette.divider}`},"&& .MuiSelect-select, && .MuiInputBase-input":{paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"36px",lineHeight:"20px",minHeight:"unset"},"& .MuiSelect-icon":{color:t.palette.secondary.main,right:12,top:"calc(50% - 4px)",transition:"transform 200ms ease",pointerEvents:"none"},"& .MuiSelect-iconOpen":{transform:"rotate(180deg)"},"&:hover":{backgroundColor:t.palette.grey[200]},"&.Mui-focused":{borderColor:t.palette.primary.main}})),Zs=v.forwardRef((t,e)=>{const n=T.useTheme(),i={backgroundColor:n.palette.background.input??n.palette.grey[100],marginTop:"4px",borderRadius:"10px",border:`1px solid ${n.palette.divider}`,boxShadow:`0 1px 3px ${T.alpha("#000000",.6)}`,color:n.palette.text.primary},r={...t.MenuProps?.PaperProps,sx:{...typeof t.MenuProps?.PaperProps?.sx=="object"&&t.MenuProps.PaperProps?.sx,...i}},a=t.MenuProps?.slotProps??{},s=a.paper??{};return m.jsx(n7,{ref:e,...t,IconComponent:t7,MenuProps:{...t.MenuProps,PaperProps:r,slotProps:{...a,paper:{...s,...r,sx:{...typeof s.sx=="object"&&s.sx,...typeof t.MenuProps?.PaperProps?.sx=="object"&&t.MenuProps.PaperProps?.sx,...i}}}}})});Zs.displayName="CustomSelect";const i7=({defaultValue:t,onChange:e,values:n})=>{const i=Jc(),{t:r}=Ke.useTranslation("inspector"),a=G.useTheme(),s=()=>m.jsx(T.SvgIcon,{viewBox:"0 0 18 18",fontSize:"small",children:m.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:"#F59E0B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})}),o=H=>{if(!H)return{url:"",repeat:"no-repeat",position:"center center",size:"cover"};const Te=H.match(/url\("([^"]+)"\)/),Ve=Te?Te[1]:"";let ot="no-repeat";H.includes("repeat-x")?ot="repeat-x":H.includes("repeat-y")?ot="repeat-y":H.includes("repeat")&&!H.includes("no-repeat")&&(ot="repeat");let xt="center center";const Dt=["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"];for(const Xn of Dt)if(H.includes(Xn)){xt=Xn;break}let $t="cover";return H.includes("contain")?$t="contain":H.includes("auto")&&($t="auto"),{url:Ve,repeat:ot,position:xt,size:$t}},l=H=>H.url?`url("${H.url}") ${H.repeat} ${H.position} / ${H.size}`:"",[c,u]=v.useState(t||null),[d,p]=v.useState(o(t)),[f,h]=v.useState(!1),[_,g]=v.useState(()=>!!window.__emailBuilderEnableAI),[,b]=v.useState(null),[y,E]=v.useState(o(t).url||""),[S,C]=v.useState(!1),[D,w]=v.useState(""),[k,x]=v.useState(!1),O=v.useRef(null),A=Z0(),[X,P]=v.useState(null);v.useEffect(()=>{const H=window.__emailBuilderCustomImageProvider;H&&(P(H),setTimeout(()=>{i&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:i,currentImageUrl:d.url||null,alt:null}}))},100))},[]);const[Y,z]=v.useState(()=>sessionStorage.getItem("hideBackgroundImageWarning")==="true"),F=(H,Te)=>{const Ve={...d,...H};if(p(Ve),Ve.url){const ot=l(Ve);u(ot),e(ot,Te)}else console.error("Update params error: ",Ve)},K=(H,Te)=>{if(!H)return!1;const Ve=H?.toLowerCase(),ot=Ve.includes(".svg")||Ve.includes("svg"),xt=Te&&(Te.includes("image/svg+xml")||Te.includes("svg"));return ot||!!xt},re=async H=>{try{C(!0),w(""),x(!1);try{new URL(H)}catch{return w("Invalid URL format"),!1}const Te=new AbortController,Ve=setTimeout(()=>Te.abort(),1e4);try{const ot=await fetch(H,{method:"HEAD",signal:Te.signal});if(clearTimeout(Ve),!ot.ok)return w(`HTTP ${ot.status}: ${ot.statusText}`),!1;const xt=ot.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(Xn=>xt&&xt.toLowerCase().includes(Xn.toLowerCase()))?(K(H,xt)&&x(!0),w(""),!0):(w("URL does not point to an image"),!1)}catch(ot){return clearTimeout(Ve),ot.name==="AbortError"?(w("Request timeout - URL took too long to respond"),!1):new Promise(xt=>{const Dt=new Image,$t=setTimeout(()=>{w("Request timeout - URL took too long to respond"),xt(!1)},1e4);Dt.onload=()=>{clearTimeout($t),K(H)&&x(!0),w(""),xt(!0)},Dt.onerror=()=>{clearTimeout($t),w("Cannot access image - CORS policy, network error, or invalid URL"),xt(!1)},Dt.src=H})}}catch{return w("Unexpected error occurred while validating URL"),!1}finally{C(!1)}},ke=async()=>{y.trim()&&await re(y.trim())&&F({url:y.trim()})},ue=H=>{H.key==="Enter"&&ke()},Ue=H=>{E(H.target.value),D&&w(""),k&&x(!1)},Ce=H=>{const Te=["image/png","image/jpeg","image/gif"],ot=Array.from(H),xt=ot.filter($t=>Te.includes($t.type)&&$t.size<=5242880);if(xt.length!==ot.length&&alert(r("inputs.common.invalidFiles")),xt.length===0)return;const Dt=xt.map($t=>new Promise(Xn=>{const Vr=new FileReader;Vr.onload=_s=>Xn(_s.target?.result),Vr.readAsDataURL($t)}));Promise.all(Dt).then($t=>{const Xn={images:$t,id:i||"",styles:n};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:Xn})),gc(!0,i||"")})},de=H=>{H.preventDefault(),h(!0)},pe=()=>{h(!1)},Qe=H=>{H.preventDefault(),h(!1);const Te=H.dataTransfer.files;Ce(Te)},gt=()=>{const H=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent(H)},Ze=()=>{p({url:"",repeat:"no-repeat",position:"center center",size:"cover"}),u(null),e(null),E(""),x(!1)},ee=H=>{switch(H){case"top left":return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M5.26523 9.79159L5.17094 5.17183M5.17094 5.17183L9.79071 5.26611M5.17094 5.17183L10.8278 10.8287",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"top center":return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M4.7998 7.33333L7.9998 4M7.9998 4L11.1998 7.33333M7.9998 4V12",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"top right":return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M6.20841 5.2662L10.8282 5.17192M10.8282 5.17192L10.7339 9.79169M10.8282 5.17192L5.17132 10.8288",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"center left":return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M7.33333 11.2002L4 8.00019M4 8.00019L7.33333 4.8002M4 8.00019L12 8.0002",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"center center":return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"center right":return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M8.66667 4.7998L12 7.9998M12 7.9998L8.66667 11.1998M12 7.9998L4 7.9998",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"bottom left":return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M9.79062 10.7348L5.17085 10.8291M5.17085 10.8291L5.26513 6.20929M5.17085 10.8291L10.8277 5.1722",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"bottom center":return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M11.1998 8.66667L7.9998 12M7.9998 12L4.7998 8.66667M7.9998 12L7.99981 4",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"bottom right":return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M10.7338 6.20938L10.8281 10.8291M10.8281 10.8291L6.20831 10.7349M10.8281 10.8291L5.17122 5.17229",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});default:return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})})}},Ae=H=>({"top left":r("inputs.backgroundImage.positions.topLeft"),"top center":r("inputs.backgroundImage.positions.topCenter"),"top right":r("inputs.backgroundImage.positions.topRight"),"center left":r("inputs.backgroundImage.positions.centerLeft"),"center center":r("inputs.backgroundImage.positions.center"),"center right":r("inputs.backgroundImage.positions.centerRight"),"bottom left":r("inputs.backgroundImage.positions.bottomLeft"),"bottom center":r("inputs.backgroundImage.positions.bottomCenter"),"bottom right":r("inputs.backgroundImage.positions.bottomRight")})[H]??r("inputs.backgroundImage.positions.center");return v.useEffect(()=>{const H=window.__emailBuilderEnableAI;H!==void 0&&g(!!H);const Te=Ve=>{const{detail:ot}=Ve;g(!!ot)};return window.addEventListener("email-builder-ai-generation",Te),()=>{window.removeEventListener("email-builder-ai-generation",Te)}},[]),v.useEffect(()=>{const H=xt=>{const{detail:Dt}=xt;gc(!1,Dt.id||""),F({url:Dt.url},Dt.styles),qP(!1),E(Dt.url)},Te=xt=>{gc(xt?.detail?.uploading??!1,xt?.detail?.id??"")},Ve=()=>{O?.current?.click()},ot=xt=>{const{detail:Dt}=xt;if(Dt&&!Dt.includes("url("))F({url:Dt},Dt.styles),E(Dt);else{const $t=o(Dt);p($t),u(Dt),e(Dt),E($t.url)}};return window.addEventListener("email-builder-set-image",ot),window.addEventListener("email-builder-upload-image-receive",H),window.addEventListener("email-builder-upload-file",Ve),window.addEventListener("email-builder-toggle-upload-file",Te),()=>{window.removeEventListener("email-builder-upload-image-receive",H),window.removeEventListener("email-builder-set-image",ot),window.removeEventListener("email-builder-upload-file",Ve),window.removeEventListener("email-builder-toggle-upload-file",Te)}},[d]),v.useEffect(()=>{t&&x(K(d.url))},[t,d.url]),v.useEffect(()=>{if(t!==c){const H=o(t);p(H),u(t||null),E(H.url||"")}},[t]),m.jsxs(Wn,{children:[m.jsxs(T.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[m.jsx(Vt,{label:r("inputs.backgroundImage.label")}),!Y&&m.jsx(T.Tooltip,{title:r("inputs.backgroundImage.warningTooltip"),placement:"top",children:m.jsx(T.IconButton,{size:"small",sx:{p:0},children:m.jsx(s,{})})})]}),X?m.jsx(T.Box,{sx:{mb:2},children:X}):m.jsx("div",{style:{display:"flex",gap:8},children:A?m.jsxs(T.Box,{sx:{width:"100%"},children:[m.jsxs(T.Stack,{direction:"row",spacing:1,children:[m.jsx(T.TextField,{fullWidth:!0,placeholder:r("inputs.image.urlPlaceholder"),value:y,onChange:Ue,onKeyPress:ue,error:!!D,disabled:S,sx:eg}),m.jsx(T.Button,{variant:"contained",onClick:ke,disabled:!y.trim()||S,sx:{minWidth:"auto",px:2,position:"relative"},children:S?m.jsx(T.CircularProgress,{size:20,color:"inherit"}):r("inputs.common.add")})]}),D&&m.jsx(T.Alert,{severity:"error",sx:{mt:1,fontSize:"0.875rem",maxHeight:"70px"},children:D}),k&&m.jsx(T.Alert,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},action:m.jsx(T.IconButton,{"aria-label":r("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{x(!1)},children:m.jsx($.Close,{fontSize:"inherit"})}),children:r("inputs.common.svgWarning")}),d.url&&m.jsxs(T.Box,{sx:{position:"relative",maxWidth:"50%",display:"block",margin:"0.5rem auto 0 auto"},children:[m.jsx("img",{src:d.url||"",alt:"",style:{width:"100%",objectFit:"contain",aspectRatio:"1 / 1",height:"auto",borderRadius:"8px",border:`2px solid ${a.palette.divider}`,backgroundColor:a.palette.background.paper,backgroundImage:`linear-gradient(45deg, ${a.palette.action.hover} 25%, transparent 25%, transparent 75%, ${a.palette.action.hover} 75%), linear-gradient(45deg, ${a.palette.action.hover} 25%, transparent 25%, transparent 75%, ${a.palette.action.hover} 75%)`,backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"}}),m.jsx(T.IconButton,{onClick:Ze,sx:{position:"absolute",top:5,right:5,backgroundColor:"background.paper",color:"error.main",padding:1,width:35,height:35,"&:hover":{backgroundColor:"error.50"}},size:"small",children:m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:m.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"})})})]})]}):m.jsxs(m.Fragment,{children:[d.url&&m.jsxs(T.Box,{sx:{position:"relative",maxWidth:"40%"},children:[m.jsx("div",{style:{borderRadius:"8px",border:`2px solid ${a.palette.divider}`,height:"100%",backgroundColor:a.palette.background.paper,backgroundImage:`linear-gradient(45deg, ${a.palette.action.hover} 25%, transparent 25%, transparent 75%, ${a.palette.action.hover} 75%), linear-gradient(45deg, ${a.palette.action.hover} 25%, transparent 25%, transparent 75%, ${a.palette.action.hover} 75%)`,backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"},children:m.jsx("img",{src:d.url||"",alt:"",style:{width:"100%",objectFit:"contain",aspectRatio:"1 / 1",height:"100%"}})}),m.jsx(T.IconButton,{onClick:Ze,sx:{position:"absolute",top:5,right:5,backgroundColor:"background.paper",color:"error.main",padding:1,width:35,height:35,"&:hover":{backgroundColor:"error.50"}},size:"small",children:m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:m.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"})})})]}),m.jsxs(T.Box,{onDragOver:de,onDragLeave:pe,onDrop:Qe,sx:{width:"100%",minWidth:"40%",border:"2px solid",borderColor:f?"primary.main":"divider",borderRadius:"8px",padding:"24px 8px 36px 8px",textAlign:"center",bgcolor:f?"primary.50":"background.paper",transition:"all 0.2s ease"},children:[m.jsx(T.Box,{sx:{display:"flex",justifyContent:"center"},children:m.jsx($.PhotoOutlined,{sx:{fontSize:32,color:"primary"}})}),m.jsxs("label",{style:{cursor:"pointer"},children:[m.jsx("input",{ref:O,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:H=>{const Te=H.target.files;Te&&Te.length>0&&Ce(Array.from(Te))}}),m.jsx(T.Typography,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:r("inputs.common.uploadFile")}),m.jsxs(T.Typography,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",r("inputs.common.dragAndDrop")]})]}),m.jsx(T.Typography,{variant:"body2",sx:{color:"text.secondary",mt:1},children:r("inputs.common.fileInfo")})]})]})}),d.url&&m.jsxs(T.Box,{sx:{mt:2},children:[m.jsxs(T.Box,{sx:{mb:2},children:[m.jsx(Vt,{label:r("inputs.backgroundImage.fillType")}),m.jsxs(T.ToggleButtonGroup,{value:d.size,exclusive:!0,onChange:(H,Te)=>{Te!==null&&F({size:Te})},size:"small",fullWidth:!0,children:[m.jsx(T.ToggleButton,{value:"cover",children:r("inputs.backgroundImage.fillOptions.cover")}),m.jsx(T.ToggleButton,{value:"contain",children:r("inputs.backgroundImage.fillOptions.contain")}),m.jsx(T.ToggleButton,{value:"auto",children:r("inputs.backgroundImage.fillOptions.auto")})]})]}),m.jsxs(T.Stack,{direction:"row",spacing:2,sx:{mb:2},children:[m.jsxs("div",{style:{flex:1},children:[m.jsx(Vt,{label:r("inputs.backgroundImage.repeat")}),m.jsxs(Zs,{style:{width:"100%"},value:d.repeat,size:"small",onChange:H=>F({repeat:H.target.value}),children:[m.jsx(T.MenuItem,{value:"no-repeat",children:r("inputs.backgroundImage.repeatOptions.none")}),m.jsx(T.MenuItem,{value:"repeat",children:r("inputs.backgroundImage.repeatOptions.repeat")}),m.jsx(T.MenuItem,{value:"repeat-x",children:r("inputs.backgroundImage.repeatOptions.repeatX")}),m.jsx(T.MenuItem,{value:"repeat-y",children:r("inputs.backgroundImage.repeatOptions.repeatY")})]})]}),m.jsxs("div",{style:{flex:1},children:[m.jsx(Vt,{label:r("inputs.backgroundImage.position")}),m.jsx(Zs,{style:{width:"100%"},value:d.position,size:"small",onChange:H=>F({position:H.target.value}),renderValue:H=>m.jsxs(T.Box,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[ee(H),Ae(H)]}),children:["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"].map(H=>m.jsx(T.MenuItem,{sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important "},value:H,children:m.jsxs(T.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[ee(H),Ae(H)]})},H))})]})]})]}),!X&&!A&&k&&m.jsx(T.Alert,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},children:r("inputs.common.svgWarning")}),(!X&&xm()&&!A||X&&_)&&m.jsxs(m.Fragment,{children:[m.jsxs(T.Stack,{direction:"row",alignItems:"center",spacing:1,sx:{mt:2},children:[m.jsx(T.Divider,{sx:{flexGrow:1}}),m.jsx(T.Typography,{sx:{color:"text.secondary"},children:r("inputs.backgroundImage.or")}),m.jsx(T.Divider,{sx:{flexGrow:1}})]}),m.jsx(T.Stack,{flexDirection:"row",gap:2,sx:{mt:2},children:!X&&xm()&&!A&&m.jsx(T.Button,{variant:"outlined",onClick:gt,startIcon:m.jsx($.ImageSearchOutlined,{}),sx:{width:"100%"},children:r("inputs.backgroundImage.browseGallery")})})]}),!X&&_&&m.jsx(JP,{src:d.url,style:{width:"100%",margin:0}})]})};function Zc(){return(Zc=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function tg(t,e){if(t==null)return{};var n,i,r={},a=Object.keys(t);for(i=0;i<a.length;i++)e.indexOf(n=a[i])>=0||(r[n]=t[n]);return r}function jd(t){var e=v.useRef(t),n=v.useRef(function(i){e.current&&e.current(i)});return e.current=t,n.current}var Vd=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t<e?e:t},pd=function(t){return"touches"in t},n1=function(t){return t&&t.ownerDocument.defaultView||self},$x=function(t,e,n){var i=t.getBoundingClientRect(),r=pd(e)?(function(a,s){for(var o=0;o<a.length;o++)if(a[o].identifier===s)return a[o];return a[0]})(e.touches,n):e;return{left:Vd((r.pageX-(i.left+n1(t).pageXOffset))/i.width),top:Vd((r.pageY-(i.top+n1(t).pageYOffset))/i.height)}},zx=function(t){!pd(t)&&t.preventDefault()},ZP=v.memo(function(t){var e=t.onMove,n=t.onKey,i=tg(t,["onMove","onKey"]),r=v.useRef(null),a=jd(e),s=jd(n),o=v.useRef(null),l=v.useRef(!1),c=v.useMemo(function(){var f=function(g){zx(g),(pd(g)?g.touches.length>0:g.buttons>0)&&r.current?a($x(r.current,g,o.current)):_(!1)},h=function(){return _(!1)};function _(g){var b=l.current,y=n1(r.current),E=g?y.addEventListener:y.removeEventListener;E(b?"touchmove":"mousemove",f),E(b?"touchend":"mouseup",h)}return[function(g){var b=g.nativeEvent,y=r.current;if(y&&(zx(b),!(function(S,C){return C&&!pd(S)})(b,l.current)&&y)){if(pd(b)){l.current=!0;var E=b.changedTouches||[];E.length&&(o.current=E[0].identifier)}y.focus(),a($x(y,b,o.current)),_(!0)}},function(g){var b=g.which||g.keyCode;b<37||b>40||(g.preventDefault(),s({left:b===39?.05:b===37?-.05:0,top:b===40?.05:b===38?-.05:0}))},_]},[s,a]),u=c[0],d=c[1],p=c[2];return v.useEffect(function(){return p},[p]),v.createElement("div",Zc({},i,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:r,onKeyDown:d,tabIndex:0,role:"slider"}))}),iT=function(t){return t.filter(Boolean).join(" ")},eL=function(t){var e=t.color,n=t.left,i=t.top,r=i===void 0?.5:i,a=iT(["react-colorful__pointer",t.className]);return v.createElement("div",{className:a,style:{top:100*r+"%",left:100*n+"%"}},v.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},jn=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n},r7=function(t){return c7(i1(t))},i1=function(t){return t[0]==="#"&&(t=t.substring(1)),t.length<6?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?jn(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16),a:t.length===8?jn(parseInt(t.substring(6,8),16)/255,2):1}},a7=function(t){return l7(o7(t))},s7=function(t){var e=t.s,n=t.v,i=t.a,r=(200-e)*n/100;return{h:jn(t.h),s:jn(r>0&&r<200?e*n/100/(r<=100?r:200-r)*100:0),l:jn(r/2),a:jn(i,2)}},r1=function(t){var e=s7(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},o7=function(t){var e=t.h,n=t.s,i=t.v,r=t.a;e=e/360*6,n/=100,i/=100;var a=Math.floor(e),s=i*(1-n),o=i*(1-(e-a)*n),l=i*(1-(1-e+a)*n),c=a%6;return{r:jn(255*[i,o,s,s,l,i][c]),g:jn(255*[l,i,i,o,s,s][c]),b:jn(255*[s,s,l,i,i,o][c]),a:jn(r,2)}},af=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},l7=function(t){var e=t.r,n=t.g,i=t.b,r=t.a,a=r<1?af(jn(255*r)):"";return"#"+af(e)+af(n)+af(i)+a},c7=function(t){var e=t.r,n=t.g,i=t.b,r=t.a,a=Math.max(e,n,i),s=a-Math.min(e,n,i),o=s?a===e?(n-i)/s:a===n?2+(i-e)/s:4+(e-n)/s:0;return{h:jn(60*(o<0?o+6:o)),s:jn(a?s/a*100:0),v:jn(a/255*100),a:r}},u7=v.memo(function(t){var e=t.hue,n=t.onChange,i=iT(["react-colorful__hue",t.className]);return v.createElement("div",{className:i},v.createElement(ZP,{onMove:function(r){n({h:360*r.left})},onKey:function(r){n({h:Vd(e+360*r.left,0,360)})},"aria-label":"Hue","aria-valuenow":jn(e),"aria-valuemax":"360","aria-valuemin":"0"},v.createElement(eL,{className:"react-colorful__hue-pointer",left:e/360,color:r1({h:e,s:100,v:100,a:1})})))}),d7=v.memo(function(t){var e=t.hsva,n=t.onChange,i={backgroundColor:r1({h:e.h,s:100,v:100,a:1})};return v.createElement("div",{className:"react-colorful__saturation",style:i},v.createElement(ZP,{onMove:function(r){n({s:100*r.left,v:100-100*r.top})},onKey:function(r){n({s:Vd(e.s+100*r.left,0,100),v:Vd(e.v-100*r.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+jn(e.s)+"%, Brightness "+jn(e.v)+"%"},v.createElement(eL,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:r1(e)})))}),tL=function(t,e){if(t===e)return!0;for(var n in t)if(t[n]!==e[n])return!1;return!0},p7=function(t,e){return t.toLowerCase()===e.toLowerCase()||tL(i1(t),i1(e))};function f7(t,e,n){var i=jd(n),r=v.useState(function(){return t.toHsva(e)}),a=r[0],s=r[1],o=v.useRef({color:e,hsva:a});v.useEffect(function(){if(!t.equal(e,o.current.color)){var c=t.toHsva(e);o.current={hsva:c,color:e},s(c)}},[e,t]),v.useEffect(function(){var c;tL(a,o.current.hsva)||t.equal(c=t.fromHsva(a),o.current.color)||(o.current={hsva:a,color:c},i(c))},[a,t,i]);var l=v.useCallback(function(c){s(function(u){return Object.assign({},u,c)})},[]);return[a,l]}var m7=typeof window<"u"?v.useLayoutEffect:v.useEffect,h7=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},Gx=new Map,g7=function(t){m7(function(){var e=t.current?t.current.ownerDocument:document;if(e!==void 0&&!Gx.has(e)){var n=e.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,Gx.set(e,n);var i=h7();i&&n.setAttribute("nonce",i),e.head.appendChild(n)}},[])},_7=function(t){var e=t.className,n=t.colorModel,i=t.color,r=i===void 0?n.defaultColor:i,a=t.onChange,s=tg(t,["className","colorModel","color","onChange"]),o=v.useRef(null);g7(o);var l=f7(n,r,a),c=l[0],u=l[1],d=iT(["react-colorful",e]);return v.createElement("div",Zc({},s,{ref:o,className:d}),v.createElement(d7,{hsva:c,onChange:u}),v.createElement(u7,{hue:c.h,onChange:u,className:"react-colorful__last-control"}))},b7={defaultColor:"000",toHsva:r7,fromHsva:function(t){return a7({h:t.h,s:t.s,v:t.v,a:1})},equal:p7},y7=function(t){return v.createElement(_7,Zc({},t,{colorModel:b7}))},E7=/^#?([0-9A-F]{3,8})$/i,S7=function(t){var e=t.color,n=e===void 0?"":e,i=t.onChange,r=t.onBlur,a=t.escape,s=t.validate,o=t.format,l=t.process,c=tg(t,["color","onChange","onBlur","escape","validate","format","process"]),u=v.useState(function(){return a(n)}),d=u[0],p=u[1],f=jd(i),h=jd(r),_=v.useCallback(function(b){var y=a(b.target.value);p(y),s(y)&&f(l?l(y):y)},[a,l,s,f]),g=v.useCallback(function(b){s(b.target.value)||p(a(n)),h(b)},[n,a,s,h]);return v.useEffect(function(){p(a(n))},[n,a]),v.createElement("input",Zc({},c,{value:o?o(d):d,spellCheck:"false",onChange:_,onBlur:g}))},qx=function(t){return"#"+t},v7=function(t){var e=t.prefixed,n=t.alpha,i=tg(t,["prefixed","alpha"]),r=v.useCallback(function(s){return s.replace(/([^0-9A-F]+)/gi,"").substring(0,n?8:6)},[n]),a=v.useCallback(function(s){return(function(o,l){var c=E7.exec(o),u=c?c[1].length:0;return u===3||u===6||!!l&&u===4||!!l&&u===8})(s,n)},[n]);return v.createElement(S7,Zc({},i,{escape:r,format:e?qx:void 0,process:qx,validate:a}))};const Hx={width:24,height:24};function T7({paletteColors:t,isLocked:e,onToggleLock:n,onChange:i}){const r=G.useTheme(),a=t.slice(30);return m.jsxs(T.Stack,{spacing:1,children:[m.jsx("div",{style:{height:1,width:"100%",margin:"8px 0",backgroundColor:r.palette.grey[400]}}),m.jsxs(T.Box,{display:"grid",gridTemplateColumns:"repeat(6, 1fr)",gap:"4px",children:[a.map((s,o)=>m.jsx(T.Button,{sx:{...Hx,backgroundColor:s,border:"1px solid",margin:"0!important",borderColor:r.palette.grey[50],minWidth:24,display:"inline-flex","&:hover":{backgroundColor:s,borderColor:"grey.500"}},onClick:()=>i&&i(s)},o+29)),n&&m.jsx(T.Button,{onClick:n,sx:{backgroundColor:"transparent",border:"1px solid",...Hx,minWidth:24,margin:"0!important",borderColor:e?r.palette.error.main:r.palette.divider,display:"inline-flex",color:e?r.palette.error.main:r.palette.text.secondary,"&:hover":{backgroundColor:e?r.palette.error.light+"20":"action.hover",borderColor:e?r.palette.error.main:r.palette.text.secondary}},title:e?"Unlock recent colors":"Lock recent colors",children:e?m.jsx($.Lock,{fontSize:"small"}):m.jsx($.LockOpen,{fontSize:"small"})})]})]})}const C7={p:1,".react-colorful__pointer ":{width:16,height:16},".react-colorful__saturation":{mb:1,borderRadius:"8px"},".react-colorful__last-control":{borderRadius:"8px"},".react-colorful__hue-pointer":{width:"4px",borderRadius:"8px",height:24,cursor:"col-resize"},".react-colorful__saturation-pointer":{cursor:"all-scroll"},input:{padding:1,border:"1px solid",borderColor:"grey.300",borderRadius:"8px",width:"100%"}},jx=(t,e)=>{if(!t||t.trim()==="")return e;const i=e.slice(-5),r=e.slice(0,30),a=i.filter(o=>o!==t&&o!==""),s=[t,...a].slice(0,5);for(;s.length<5;)s.push("");return[...r,...s]};function a1({value:t,nullable:e,onChange:n}){const[i,r]=v.useState(t||"#000000"),[a,s]=v.useState(null),{paletteColors:o,isLocked:l}=mG(),[c,u]=v.useState(!1),d=G.useTheme(),p=v.useCallback(b=>{if(l)return;a&&clearTimeout(a);const y=setTimeout(()=>{const E=jx(b,o);h_({paletteColors:E})},300);s(y)},[a,l,o]),f=()=>{const b=!l;if(h_({isLocked:b}),!b&&i){const y=jx(i,o);h_({isLocked:b,paletteColors:y})}},h=b=>{u(!0),r(b)},_=()=>{n(i),p(i)},g=b=>{r(b),n(b),p(b)};return v.useEffect(()=>{t!==i&&r(t||"#000000")},[t]),v.useEffect(()=>()=>{a&&clearTimeout(a)},[a]),m.jsxs(T.Stack,{spacing:1,sx:C7,children:[m.jsx(y7,{color:i,onChange:h,onMouseUp:_,onTouchEnd:_,onMouseLeave:b=>c?_():null}),m.jsx(T7,{isLocked:l,onToggleLock:f,paletteColors:o,value:t,nullable:e,onChange:b=>{b?(r(b),n(b),p(b)):n(null)}}),m.jsxs(T.Box,{pt:1,display:"flex",gap:1,alignItems:"center",children:[m.jsx(v7,{prefixed:!0,color:i,onChange:g,style:{flex:1,backgroundColor:d.palette.background.paper,color:d.palette.text.primary,padding:"1px 4px",fontSize:"12px"}}),e&&m.jsx(T.Button,{onClick:()=>n&&n(null),sx:{backgroundColor:"transparent",width:24,height:24,minWidth:24,margin:"0!important",borderColor:d.palette.divider,display:"inline-flex","&:hover":{backgroundColor:"action.hover",borderColor:d.palette.text.secondary}},children:m.jsx($.FormatColorReset,{color:"primary",fontSize:"small"})})]})]})}function nL({label:t,defaultValue:e,onChange:n,nullable:i,compact:r=!1,...a}){const[s,o]=v.useState(null),[l,c]=v.useState(e),{t:u}=Ke.useTranslation("inspector");v.useEffect(()=>{l!==e&&c(e)},[e]);const d=b=>{o(b.currentTarget)},p=r?{border:"1px solid",borderColor:"cadet.400",width:28,height:28,borderRadius:"8px",bgcolor:"#FFFFFF"}:{border:t?"1px solid":"",borderColor:"cadet.400",width:"100%",height:36,paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",borderRadius:"8px",bgcolor:"#FFFFFF"},f=b=>{c(b),n(b)},h=()=>!i||typeof l!="string"||l.trim().length===0?null:m.jsx(T.Tooltip,{disableInteractive:!0,arrow:!0,title:u("inputs.background.reset"),placement:"left",children:m.jsx(T.Box,{sx:{minWidth:24,lineHeight:1,flexShrink:0,pr:"4px",display:"grid",placeItems:"center"},onClick:()=>f(null),children:m.jsx($.FormatColorReset,{sx:{color:"primary.main"}})})}),_=l?m.jsx(T.ButtonBase,{onClick:d,sx:{...p,bgcolor:l}}):m.jsx(T.ButtonBase,{onClick:d,sx:{...p},children:m.jsx($.AddOutlined,{fontSize:"small"})}),g=m.jsx(T.Menu,{anchorEl:s,open:!!s,onClose:()=>o(null),sx:{"& .MuiPaper-root":{boxShadow:"0 4px 6px rgba(0, 0, 0, 0.4);",borderRadius:1,maxWidth:"200px",transform:"translateX(-100%) !important;"}},MenuListProps:{sx:{height:"auto",padding:0}},children:m.jsx(a1,{value:l||"",nullable:i,onChange:b=>f(b)})});return r?m.jsxs(m.Fragment,{children:[_,g]}):m.jsxs(Wn,{children:[m.jsx(Vt,{label:t}),m.jsxs(T.Stack,{direction:"row",alignContent:"center",spacing:1,children:[_,h()]}),g]})}function Ko(t){return m.jsx(nL,{...t,nullable:!1})}function __(t){return m.jsx(nL,{...t,nullable:!0})}const Vx=({mobile:t=!1,label:e,borderColor:n,borderTop:i,borderBottom:r,borderLeft:a,borderRight:s,onChange:o})=>{const{t:l}=Ke.useTranslation("inspector"),c=()=>t?{top:"borderTopMobile",bottom:"borderBottomMobile",left:"borderLeftMobile",right:"borderRightMobile"}:{top:"borderTop",bottom:"borderBottom",left:"borderLeft",right:"borderRight"},u=w=>{const k=Object.values(w);return k.every(x=>x===k[0])},d=c(),p={[d.top]:i??0,[d.bottom]:r??0,[d.left]:a??0,[d.right]:s??0},[f,h]=v.useState(()=>u(p)?"all":"custom"),[_,g]=v.useState(n??"#000000"),[b,y]=v.useState(p);v.useEffect(()=>{n!==_&&g(n??"#000000");const w={[d.top]:i??0,[d.bottom]:r??0,[d.left]:a??0,[d.right]:s??0};Object.keys(w).some(x=>b[x]!==w[x])&&(y(w),u(w)||h("custom"))},[n,i,r,a,s,t]);const E=()=>{if(f!=="all"){const w=b[d.top]??0;C(w),h("all")}else h("custom")},S=w=>{g(w),o({borderColor:w,...b})},C=w=>{const k={[d.top]:w,[d.bottom]:w,[d.left]:w,[d.right]:w};y(k),o({...k,borderColor:_})},D=(w,k)=>{y(O=>({...O,[k]:w}));const x={...b,borderColor:_,[k]:w};u(x)||h("custom"),o(x)};return m.jsxs("div",{children:[m.jsxs(T.Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[m.jsx(Vt,{label:e}),m.jsxs(T.Stack,{direction:"row",spacing:1,alignItems:"center",children:[m.jsx(Ko,{defaultValue:_,onChange:S,compact:!0}),m.jsx(T.Tooltip,{title:l(f==="all"?"border.unlockBorders":"border.lockBordersTogether"),children:m.jsx(T.IconButton,{size:"small",onClick:E,sx:{color:f==="all"?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:f==="all"?m.jsx($.Lock,{fontSize:"small"}):m.jsx($.LockOpen,{fontSize:"small"})})})]})]}),f==="all"&&m.jsx(Po,{label:"",iconLabel:m.jsx($.BorderOuterOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[d.top],onChange:C}),f==="custom"&&m.jsxs(T.Stack,{spacing:2,children:[m.jsx(Po,{label:"",iconLabel:m.jsx($.BorderTopOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[d.top],onChange:w=>D(w,d.top)}),m.jsx(Po,{label:"",iconLabel:m.jsx($.BorderBottomOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[d.bottom],onChange:w=>D(w,d.bottom)}),m.jsx(Po,{label:"",iconLabel:m.jsx($.BorderLeftOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[d.left],onChange:w=>D(w,d.left)}),m.jsx(Po,{label:"",iconLabel:m.jsx($.BorderRightOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[d.right],onChange:w=>D(w,d.right)})]})]})},iL=[{key:"INHERIT",label:"Inherit",value:"inherit"},{key:"LATO",label:"Lato",value:'"Lato", sans-serif'},{key:"MERRIWEATHER",label:"Merriweather",value:'"Merriweather", serif'},{key:"MONTSERRAT",label:"Montserrat",value:'"Montserrat", sans-serif'},{key:"OPEN_SANS",label:"Open Sans",value:'"Open Sans", sans-serif'},{key:"OSWALD",label:"Oswald",value:'"Oswald", sans-serif'},{key:"PACIFICO",label:"Pacifico",value:'"Pacifico", cursive'},{key:"PLAYFAIR",label:"Playfair",value:'"Playfair", serif'},{key:"ROBOTO",label:"Roboto",value:'"Roboto", sans-serif'},{key:"MODERN_SANS",label:"Modern sans",value:'"Helvetica Neue", "Arial Nova", "Nimbus Sans", Arial, sans-serif'}],k7={FAMILY:"MODERN_SANS"},eu=jt(["MODERN_SANS","LATO","MERRIWEATHER","MONTSERRAT","OPEN_SANS","OSWALD","PACIFICO","PLAYFAIR","ROBOTO","INHERIT"]).nullable().optional(),Yx=t=>iL.find(e=>e.key===t)?.value;function es(t){const e=nG();let n=Yx(t);return n||(n=Yx(e?.fontFamily),n||"inherit")}const x7=iL.map(t=>m.jsx(T.MenuItem,{value:t.key,sx:{fontFamily:t.value},children:t.label},t.key));function rL({label:t,onChange:e,defaultValue:n}){const i="INHERIT",[r,a]=v.useState(n??i);v.useEffect(()=>{r!==n&&a(n??i)},[n]);const s=o=>{const l=o?.target?.value;a(l),e(l===null?null:l)};return m.jsxs(Wn,{children:[m.jsx(Vt,{label:t}),m.jsx(Zs,{style:{width:"100%"},value:r,size:"small",onChange:s,children:x7})]})}function Wx({label:t,defaultValue:e=16,onChange:n,maxValue:i,minValue:r,step:a}){const[s,o]=v.useState(e);v.useEffect(()=>{s!==e&&o(e)},[e]);const l=c=>{o(c),n(c)};return m.jsxs(Wn,{children:[m.jsx(Vt,{label:t}),m.jsx(cn,{iconLabel:m.jsx($.TextFieldsOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:s,setValue:l,units:"px",step:a??2,min:r||8,max:i||48})]})}function so({label:t,children:e,defaultValue:n,onChange:i}){const[r,a]=v.useState(n);return v.useEffect(()=>{n!==r&&a(n)},[n]),m.jsxs(Wn,{children:[m.jsx(Vt,{label:t}),m.jsx(T.Box,{sx:{...QG,paddingLeft:"0px",paddingRight:"0px"},children:m.jsx(T.ToggleButtonGroup,{exclusive:!0,fullWidth:!0,value:r,size:"small",sx:{width:"100%"},onChange:(s,o)=>{if(typeof o!="string")throw new Error("RadioGroupInput can only receive string values");a(o),i(o)},children:e})})]})}function D7({label:t,defaultValue:e,onChange:n}){const[i,r]=v.useState(e);return v.useEffect(()=>{i!==e&&r(e)},[e]),m.jsxs(so,{label:t,defaultValue:i,onChange:a=>{r(a),n(a)},children:[m.jsx(T.ToggleButton,{value:"normal",children:"Regular"}),m.jsx(T.ToggleButton,{value:"bold",children:"Bold"})]})}const Kx=({label:t,defaultValue:e,onChange:n})=>{const{t:i}=Ke.useTranslation("inspector"),r=t??i("inputs.common.height");return m.jsx(cn,{label:r,iconLabel:m.jsx($.HeightOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:1,max:100,marks:!1,value:e??1,setValue:n})},w7=[{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)"}],A7=w7.map(t=>m.jsx(T.MenuItem,{value:t.key,children:t.label},t.key));function N7({label:t,onChange:e,defaultValue:n}){const i="INHERIT",[r,a]=v.useState(n?.toString()??i);v.useEffect(()=>{r!==n?.toString()&&a(n?.toString()??i)},[n]);const s=o=>{const l=o?.target?.value;a(l),e(l===i?null:parseFloat(l))};return m.jsxs(Wn,{children:[m.jsx(Vt,{label:t}),m.jsxs(Zs,{style:{width:"100%"},value:r,size:"small",onChange:s,children:[m.jsx(T.MenuItem,{value:i,children:"Default value"}),A7]})]})}function Qx({label:t,defaultValue:e,onChange:n}){const{t:r}=Ke.useTranslation("inspector"),[a,s]=v.useState(()=>e||{top:0,left:0,bottom:0,right:0});v.useEffect(()=>{e&&(e.top!==a.top||e.left!==a.left||e.bottom!==a.bottom||e.right!==a.right)&&s(e)},[e]);const[o,l]=v.useState(!1);function c(d,p){let f;o?f={top:p,bottom:p,left:p,right:p}:f={...a,[d]:p},s(f),n(f)}const u=()=>{if(!o){const d={top:a.top,bottom:a.top,left:a.top,right:a.top};s(d),n(d)}l(!o)};return m.jsxs(Wn,{children:[m.jsxs(T.Stack,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[m.jsx(Vt,{label:t}),m.jsx(T.Tooltip,{title:r(o?"inputs.responsiveSize.unlockTooltip":"inputs.responsiveSize.lockTooltip"),children:m.jsx(T.IconButton,{size:"small",onClick:u,sx:{marginTop:"0!important",color:o?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:o?m.jsx($.Lock,{fontSize:"small"}):m.jsx($.LockOpen,{fontSize:"small"})})})]}),o?m.jsx(cn,{iconLabel:m.jsx("span",{children:r("inputs.responsiveSize.allSides")}),value:a.top,setValue:d=>c("top",d),units:"px",step:16,min:0,max:120,marks:!0}):m.jsxs(m.Fragment,{children:[m.jsx(cn,{iconLabel:m.jsx($.AlignVerticalTopOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:a.top,setValue:d=>c("top",d),units:"px",step:16,min:0,max:120,marks:!0}),m.jsx(cn,{iconLabel:m.jsx($.AlignVerticalBottomOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:a.bottom,setValue:d=>c("bottom",d),units:"px",step:16,min:0,max:120,marks:!0}),m.jsx(cn,{iconLabel:m.jsx($.AlignHorizontalLeftOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:a.left,setValue:d=>c("left",d),units:"px",step:16,min:0,max:120,marks:!0}),m.jsx(cn,{iconLabel:m.jsx($.AlignHorizontalRightOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:a.right,setValue:d=>c("right",d),units:"px",step:16,min:0,max:120,marks:!0})]})]})}const I7=({label:t,defaultValue:e,onChange:n,maxValue:i=600,shapeSteps:r=8})=>{const{t:a}=Ke.useTranslation("inspector"),[s,o]=v.useState(()=>typeof e=="object"&&e!==null?"rectangle":e||"rectangle"),[l,c]=v.useState(()=>typeof e=="object"&&e!==null?e:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0}),[u,d]=v.useState(!1);v.useEffect(()=>{typeof e=="object"&&e!==null?(c(e),o("rounded")):e&&o(e)},[e]);const p=b=>{o(b),n(b==="rounded"?l:b)},f=(b,y)=>{let E;u?E={topLeft:y,topRight:y,bottomLeft:y,bottomRight:y}:E={...l,[b]:y},c(E),n(E)},h=()=>{if(!u){const b={topLeft:l.topLeft,topRight:l.topLeft,bottomLeft:l.topLeft,bottomRight:l.topLeft};c(b),n(b)}d(!u)},_=i,g=t||a("shape.label");return m.jsxs(m.Fragment,{children:[m.jsxs(so,{label:g,defaultValue:s,onChange:p,children:[m.jsx(T.ToggleButton,{value:"rectangle",children:a("shape.square")}),m.jsx(T.ToggleButton,{value:"pill",children:a("shape.pill")}),m.jsx(T.ToggleButton,{value:"rounded",children:a("shape.custom")})]}),s==="rounded"&&m.jsxs(T.Stack,{spacing:2,alignItems:"flexStart",pb:1,children:[m.jsxs(T.Stack,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[m.jsx(Vt,{label:a("shape.borderRadius")}),m.jsx(T.Tooltip,{title:a(u?"shape.unlockTooltip":"shape.lockTooltip"),children:m.jsx(T.IconButton,{size:"small",onClick:h,sx:{marginTop:"0!important",color:u?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:u?m.jsx($.Lock,{fontSize:"small"}):m.jsx($.LockOpen,{fontSize:"small"})})})]}),u?m.jsx(m.Fragment,{children:m.jsx(cn,{iconLabel:m.jsx($.RoundedCorner,{sx:{fontSize:16}}),value:l.topRight,setValue:b=>f("topLeft",b),units:"px",min:0,step:r,marks:r>1,max:_})}):m.jsxs(m.Fragment,{children:[m.jsx(cn,{iconLabel:m.jsx($.RoundedCorner,{sx:{fontSize:16,transform:"rotate(0deg)"}}),value:l.topLeft,setValue:b=>f("topLeft",b),units:"px",min:0,step:r,marks:r>1,max:_}),m.jsx(cn,{iconLabel:m.jsx($.RoundedCorner,{sx:{fontSize:16,transform:"rotate(270deg)"}}),value:l.topRight,setValue:b=>f("topRight",b),units:"px",min:0,step:r,marks:r>1,max:_}),m.jsx(cn,{iconLabel:m.jsx($.RoundedCorner,{sx:{fontSize:16,transform:"rotate(180deg)"}}),value:l.bottomLeft,setValue:b=>f("bottomLeft",b),units:"px",min:0,step:r,marks:r>1,max:_}),m.jsx(cn,{iconLabel:m.jsx($.RoundedCorner,{sx:{fontSize:16,transform:"rotate(90deg)"}}),value:l.bottomRight,setValue:b=>f("bottomRight",b),units:"px",min:0,step:r,marks:r>1,max:_})]})]})]})};function Xx({label:t,defaultValue:e,onChange:n}){const[i,r]=v.useState(e??"left");return v.useEffect(()=>{e!==i&&r(e??"left")},[e]),m.jsxs(Wn,{children:[m.jsx(Vt,{label:t}),m.jsxs(so,{label:"",defaultValue:i,onChange:a=>{r(a),n(a)},children:[m.jsx(T.ToggleButton,{value:"left",children:m.jsx($.FormatAlignLeftOutlined,{fontSize:"small"})}),m.jsx(T.ToggleButton,{value:"center",children:m.jsx($.FormatAlignCenterOutlined,{fontSize:"small"})}),m.jsx(T.ToggleButton,{value:"right",children:m.jsx($.FormatAlignRightOutlined,{fontSize:"small"})})]})]})}const Jx=({label:t,defaultValue:e,onChange:n,step:i,...r})=>{const{t:a}=Ke.useTranslation("inspector"),s=t??a("inputs.common.width");return m.jsx(cn,{label:s,iconLabel:m.jsx($.HeightOutlined,{sx:{color:"text.primary",transform:"rotate(90deg)"}}),units:"%",step:i,min:1,max:100,marks:!1,value:e??1,setValue:n,...r})};function O7({name:t,value:e,onChange:n,shapeMaxValue:i,shapeSteps:r}){const a=dn(),s=Zh(),{t:o}=Ke.useTranslation("inspector"),l=(f,h)=>{const _=e[f],g=e[h];return _??g},c=(f,h)=>{n(h?{...e,...h,[t]:f}:{...e,[t]:f})},u=f=>{n({...e,...f})},p=(()=>{switch(t){case"textAlignMobile":return l("textAlignMobile","textAlign");case"mobilePadding":return l("mobilePadding","padding");case"fontSizeMobile":return l("fontSizeMobile","fontSize")??16;case"heightMobile":return l("heightMobile","height");case"widthMobile":return l("widthMobile","width");case"borderMobile":return{borderTop:l("borderTopMobile","borderTop"),borderBottom:l("borderBottomMobile","borderBottom"),borderLeft:l("borderLeftMobile","borderLeft"),borderRight:l("borderRightMobile","borderRight")};default:return e[t]??null}})();switch(t){case"backgroundColor":return m.jsx(__,{label:o("properties.backgroundColor"),defaultValue:p??s?.canvasColor,onChange:c});case"background":return m.jsx(i7,{defaultValue:p,onChange:(f,h)=>c(f,h),values:e});case"borderColor":return m.jsx(__,{label:o("properties.border"),defaultValue:p,onChange:c});case"borderRadius":return m.jsx(Po,{iconLabel:m.jsx($.RoundedCornerOutlined,{}),units:"px",step:4,marks:!0,min:0,max:48,label:o("properties.borderRadius"),defaultValue:p,onChange:c});case"color":return m.jsx(__,{label:o("properties.color"),defaultValue:p,onChange:c});case"fontFamily":return m.jsx(rL,{label:o("properties.fontFamily"),defaultValue:p,onChange:c});case"fontWeight":return m.jsx(D7,{label:o("properties.fontWeight"),defaultValue:p,onChange:c});case"textAlign":return a==="desktop"&&m.jsx(Xx,{label:o("properties.alignment"),defaultValue:p,onChange:c});case"textAlignMobile":return a!="desktop"&&m.jsx(Xx,{label:o("properties.alignment"),defaultValue:p,onChange:c});case"padding":return a==="desktop"&&m.jsx(Qx,{label:o("properties.padding"),defaultValue:p,onChange:c});case"mobilePadding":return a!="desktop"&&m.jsx(Qx,{label:o("properties.padding"),defaultValue:p,onChange:c});case"fontSize":return a==="desktop"&&m.jsx(Wx,{maxValue:80,step:8,label:o("properties.fontSize"),defaultValue:p??16,onChange:c});case"fontSizeMobile":return a!="desktop"&&m.jsx(Wx,{maxValue:80,step:8,label:o("properties.fontSize"),defaultValue:p,onChange:c});case"lineHeight":return m.jsx(N7,{label:o("properties.lineHeight"),defaultValue:p??1.5,onChange:c});case"shape":return m.jsx(I7,{shapeSteps:r,maxValue:i,label:o("properties.shape"),defaultValue:p,onChange:c});case"height":return a==="desktop"&&m.jsx(Kx,{label:o("properties.height"),defaultValue:p,onChange:c});case"heightMobile":return a!="desktop"&&m.jsx(Kx,{label:o("properties.height"),defaultValue:p,onChange:c});case"width":return a==="desktop"&&m.jsx(Jx,{label:o("properties.width"),defaultValue:p,onChange:c});case"widthMobile":return a!="desktop"&&m.jsx(Jx,{label:o("properties.width"),defaultValue:p,onChange:c});case"border":return a==="desktop"&&m.jsx(Vx,{label:o("properties.border"),borderColor:e.borderColor??null,borderTop:e.borderTop??null,borderBottom:e.borderBottom??null,borderLeft:e.borderLeft??null,borderRight:e.borderRight??null,onChange:u});case"borderMobile":return a!="desktop"&&m.jsx(Vx,{mobile:!0,label:o("properties.border"),borderColor:e.borderColor??null,borderTop:p.borderTop??null,borderBottom:p.borderBottom??null,borderLeft:p.borderLeft??null,borderRight:p.borderRight??null,onChange:u});default:return null}}function di({names:t,value:e,onChange:n,disabledCSSValidation:i=!1,shapeMaxValue:r,shapeSteps:a}){const s=va(),o=PP();return(i||s=="css"||_m.includes(o||""))&&m.jsx(m.Fragment,{children:t.map(l=>m.jsx(O7,{shapeMaxValue:r,shapeSteps:a,name:l,value:e||{},onChange:n},l))})}const rT=t=>t?["http","mailto:","tel:","sms:","whatsapp:"].some(n=>t.startsWith(n))?t:`//${t}`:"#",Bm=Le({top:se(),bottom:se(),right:se(),left:se()}).optional().nullable(),Tp=t=>t?{top:t?.top??0,right:t?.right??0,bottom:t?.bottom??0,left:t?.left??0}:{top:0,right:0,bottom:0,left:0},R7=Le({topLeft:se().min(0).optional(),topRight:se().min(0).optional(),bottomLeft:se().min(0).optional(),bottomRight:se().min(0).optional()}),aT=Le({style:Le({padding:Bm,mobilePadding:Bm,background:Me().nullable().optional(),backgroundColor:Me().regex(/^#[0-9a-fA-F]{6}$/).optional().nullable(),textAlign:jt(["center","left","right"]).optional().nullable(),textAlignMobile:jt(["center","left","right"]).optional().nullable(),shape:bc([jt(["rectangle","pill"]),R7]).optional().nullable()}),props:Le({touched:Nc().optional().nullable(),scale:se().optional().nullable(),size:Me().optional().nullable(),sizeMobile:Me().optional().nullable(),width:se().optional().nullable(),widthMobile:se().optional().nullable(),scaleMobile:se().optional().nullable(),touchedMobile:Nc().optional().nullable(),original_width:se().optional().nullable(),height:se().optional().nullable(),url:Me().optional().nullable(),alt:Me().optional().nullable(),linkHref:Me().optional().nullable(),contentAlignment:jt(["top","middle","bottom"]).optional().nullable()}).optional().nullable()}).passthrough();function aL({style:t,props:e,blockId:n}){const i=dn(),r=Jh(),a={padding:Tp(i=="desktop"?t?.padding:t?.mobilePadding??t?.padding),backgroundColor:t?.backgroundColor??void 0,textAlign:i=="desktop"?t?.textAlign??void 0:t?.textAlignMobile??t?.textAlign??void 0},s=(g,b)=>g==="fill"?"100%":g==="scale"?`${b}%`:e?.width,o=e?.linkHref??null,l=i=="desktop"?s(e?.size,e?.scale):s(e?.sizeMobile,e?.scaleMobile),c={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},u=t?.background??"",d=t?.backgroundColor,p=d?Tl(u,d):u,f=g=>{const b=g.currentTarget;setTimeout(()=>{if(!e?.width&&b.offsetWidth){const y=b.offsetWidth;gG(n,{...e,width:y})}},100)},h=m.jsxs(m.Fragment,{children:[m.jsx("img",{alt:e?.alt??"",src:e?.url??"",width:l,onLoad:f,style:{width:l,height:"auto",outline:"none",border:"none",textDecoration:"none",verticalAlign:e?.contentAlignment??"middle",display:"inline-block",maxWidth:"100%",opacity:r.uploading&&r.id===n?.5:1,transition:"opacity 0.2s ease-in-out",borderRadius:Fm(t)}}),r.uploading&&r.id===n&&m.jsx("div",{style:c,children:m.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle",style:{width:"32px",height:"32px",animation:"1s linear infinite spin",stroke:"currentColor"},children:m.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})]}),_=dt(n);return o?m.jsx(fi,{className:`${_}`,padding:a.padding,background:p,align:a.textAlign,width:"100%",children:m.jsx("a",{href:rT(o),style:{textDecoration:"none",display:"block",width:"100%",height:"100%"},target:"_blank",children:h})}):m.jsx(fi,{className:`${_}`,padding:a.padding,background:p,align:a.textAlign,width:"100%",children:h})}const sL=({data:t,setData:e,blockId:n})=>{const{t:i}=Ke.useTranslation("inspector"),[r,a]=v.useState(!1),[s,o]=v.useState(()=>!!window.__emailBuilderEnableAI),[,l]=v.useState(null),[c,u]=v.useState(""),[d,p]=v.useState(!1),[f,h]=v.useState(""),[_,g]=v.useState(!1),b=v.useRef(null),y=Z0(),[E,S]=v.useState(null);v.useEffect(()=>{const F=window.__emailBuilderCustomImageProvider;F&&(S(F),setTimeout(()=>{n&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:n,currentImageUrl:t.props?.url||null,alt:t.props?.alt||null}}))},100))},[]);const C=F=>{const K=aT.safeParse(F);K.success?(e(K.data),l(null)):l(K.error)},D=(F,K)=>{const re=F.toLowerCase(),ke=re.includes(".svg")||re.includes("svg"),ue=K&&(K.includes("image/svg+xml")||K.includes("svg"));return ke||!!ue},w=async F=>{try{p(!0),h(""),g(!1);try{new URL(F)}catch{return h(i("inputs.image.invalidUrl")),!1}const K=new AbortController,re=setTimeout(()=>K.abort(),1e4);try{const ke=await fetch(F,{method:"HEAD",signal:K.signal});if(clearTimeout(re),!ke.ok)return h(`HTTP ${ke.status}: ${ke.statusText}`),!1;const ue=ke.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(de=>ue&&ue.toLowerCase().includes(de.toLowerCase()))?(D(F,ue)&&g(!0),h(""),!0):(h(i("inputs.image.notImage")),!1)}catch(ke){return clearTimeout(re),ke.name==="AbortError"?(h(i("inputs.image.timeout")),!1):new Promise(ue=>{const Ue=new Image,Ce=setTimeout(()=>{h(i("inputs.image.timeout")),ue(!1)},1e4);Ue.onload=()=>{clearTimeout(Ce),D(F)&&g(!0),h(""),ue(!0)},Ue.onerror=()=>{clearTimeout(Ce),h("Cannot access image - CORS policy, network error, or invalid URL"),ue(!1)},Ue.src=F})}}catch{return h("Unexpected error occurred while validating URL"),!1}finally{p(!1)}},k=async()=>{c.trim()&&await w(c.trim())&&(C({...t,props:{...t.props,url:c.trim()}}),u(""))},x=F=>{F.key==="Enter"&&k()},O=F=>{u(F.target.value),f&&h(""),_&&g(!1)},A=F=>{const K=["image/png","image/jpeg","image/gif"],ke=F.filter(Ue=>K.includes(Ue.type)&&Ue.size<=5242880);if(ke.length!==F.length&&alert(i("inputs.common.invalidFiles")),ke.length===0)return;const ue=ke.map(Ue=>new Promise(Ce=>{const de=new FileReader;de.onload=pe=>Ce(pe.target?.result),de.readAsDataURL(Ue)}));Promise.all(ue).then(Ue=>{const Ce={images:Ue,id:n||""};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:Ce})),gc(!0,n||"")})},X=F=>{F.preventDefault(),a(!0)},P=F=>{const K=F.currentTarget.getBoundingClientRect(),re=F.clientX,ke=F.clientY;(re<K.left||re>=K.right||ke<K.top||ke>=K.bottom)&&a(!1)},Y=F=>{F.preventDefault(),a(!1);const K=Array.from(F.dataTransfer.files);K.length>0&&A(K)},z=()=>{const F=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent(F)};return v.useEffect(()=>{const F=window.__emailBuilderEnableAI;F!==void 0&&o(!!F);const K=re=>{const{detail:ke}=re;o(!!ke)};return window.addEventListener("email-builder-ai-generation",K),()=>{window.removeEventListener("email-builder-ai-generation",K)}},[]),v.useEffect(()=>{const F=ue=>{const{detail:Ue}=ue;gc(!1,Ue.id||""),C({...t,props:{...t.props,url:Ue.url}}),qP(!1)},K=ue=>{gc(ue?.detail?.uploading??!1,ue?.detail?.id??"")},re=()=>{b?.current?.click()},ke=ue=>{const{detail:Ue}=ue;C({...t,props:{...t.props,url:Ue}})};return window.addEventListener("email-builder-set-image",ke),window.addEventListener("email-builder-upload-image-receive",F),window.addEventListener("email-builder-upload-file",re),window.addEventListener("email-builder-toggle-upload-file",K),()=>{window.removeEventListener("email-builder-toggle-upload-file",K),window.removeEventListener("email-builder-upload-image-receive",F),window.removeEventListener("email-builder-set-image",ke),window.removeEventListener("email-builder-upload-file",re)}},[t]),v.useEffect(()=>{t.props?.url&&g(D(t.props.url))},[t.props?.url]),m.jsxs(T.Stack,{gap:1,children:[E?m.jsx(T.Box,{sx:{mb:2},children:E}):m.jsx("div",{style:{display:"flex",gap:8},children:y?m.jsxs(Wn,{children:[m.jsx(Vt,{label:i("inputs.image.urlLabel")}),m.jsxs(T.Stack,{direction:"row",spacing:1,children:[m.jsx(T.TextField,{fullWidth:!0,placeholder:i("inputs.image.urlPlaceholder"),value:c,onChange:O,onKeyPress:x,error:!!f,disabled:d,sx:{...eg,"& .MuiOutlinedInput-root":{"& fieldset":{borderColor:f?"error.main":"#E5E5E5"},"&:hover fieldset":{borderColor:f?"error.main":"primary.main"},"&.Mui-focused fieldset":{borderColor:f?"error.main":"primary.main"}}}}),m.jsx(T.Button,{variant:"contained",onClick:k,disabled:!c.trim()||d,sx:{minWidth:"auto",px:2,position:"relative"},children:d?m.jsx(T.CircularProgress,{size:20,color:"inherit"}):i("inputs.common.add")})]}),f&&m.jsx(T.Alert,{severity:"error",sx:{mt:1,fontSize:"0.875rem","& .MuiAlert-message":{padding:"4px 0",display:"flex",flexDirection:"column",justifyContent:"space-around"}},children:f}),_&&m.jsx(T.Alert,{severity:"warning",sx:{mt:1,marginX:"4px",fontSize:"0.875rem",top:0,"& .MuiAlert-message":{padding:"4px 0",display:"flex",flexDirection:"column",justifyContent:"space-around"}},action:m.jsx(T.IconButton,{"aria-label":i("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{g(!1)},children:m.jsx($.Close,{fontSize:"inherit"})}),children:i("inputs.common.svgWarning")}),m.jsx("img",{src:t.props?.url,alt:t.props?.alt,style:{width:"70%",margin:"0.5rem auto 0 auto",objectFit:"contain",display:"block",aspectRatio:"1 / 1",height:"auto",borderRadius:"8px",border:"2px solid #E5E5E5",backgroundColor:"#fff",backgroundImage:"linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%), linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%)",backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"}})]}):m.jsxs(m.Fragment,{children:[m.jsx("img",{src:t.props?.url,alt:t.props?.alt,style:{width:"50%",objectFit:"contain",aspectRatio:"1 / 1",height:"auto",borderRadius:"8px",border:"2px solid #E5E5E5",backgroundColor:"#ffffff",backgroundImage:"linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%), linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%)",backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"}}),m.jsxs(T.Box,{onDragOver:X,onDragLeave:P,onDrop:Y,sx:{width:"100%",border:"2px solid",borderColor:r?"primary.main":"#E5E5E5",borderRadius:"8px",padding:4,textAlign:"center",bgcolor:r?"primary.50":"background.paper",transition:"all 0.2s ease"},children:[m.jsx(T.Box,{sx:{display:"flex",justifyContent:"center",mb:2},children:m.jsx($.PhotoOutlined,{sx:{fontSize:32,color:"primary"}})}),m.jsxs("label",{style:{cursor:"pointer"},children:[m.jsx("input",{ref:b,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:F=>{const K=F.target.files;K&&K.length>0&&A(Array.from(K))}}),m.jsx(T.Typography,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:i("inputs.common.uploadFile")}),m.jsxs(T.Typography,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",i("inputs.common.dragAndDrop")]})]}),m.jsx(T.Typography,{variant:"body2",sx:{color:"text.secondary",mt:1},children:i("inputs.common.fileInfo")})]})]})}),!E&&!y&&_&&m.jsx(T.Alert,{severity:"warning",sx:{fontSize:"0.875rem","& .MuiAlert-message":{padding:"4px 0",display:"flex",flexDirection:"column",justifyContent:"space-around"}},children:"SVG images may not display correctly in Outlook email clients. Consider using PNG or JPG format for better compatibility."}),(!E&&(xm()&&!y||s)||E&&s)&&m.jsxs(T.Stack,{direction:"row",alignItems:"center",spacing:1,children:[m.jsx(T.Divider,{sx:{flexGrow:1}}),m.jsx(T.Typography,{sx:{color:"text.secondary"},children:"or"}),m.jsx(T.Divider,{sx:{flexGrow:1}})]}),m.jsx(m.Fragment,{children:m.jsxs(T.Stack,{flexDirection:"row",gap:2,children:[!E&&xm()&&!y&&m.jsx(T.Button,{variant:"outlined",onClick:z,startIcon:m.jsx($.ImageSearchOutlined,{}),sx:{color:"mainColor.main",borderColor:"mainColor.light","&:hover":{borderColor:"mainColor.main",backgroundColor:"action.hover"}},style:{width:"100%"},children:"Browse gallery"}),s&&m.jsx(JP,{src:t.props?.url,style:{width:"100%",margin:0}})]})})]})};function M7({data:t,setData:e}){const[,n]=v.useState(null),i=Jc(),{t:r}=Ke.useTranslation("inspector"),a=c=>{const u=QP.safeParse(c);u.success?(e(u.data),n(null)):n(u.error)},s=t.props?.size??Uo.size,o=t.props?.alt??Uo.alt;t.props?.shape??Uo.shape;const l=va();return v.useEffect(()=>{const c=u=>{const{detail:d}=u;a({...t,props:{...t.props,alt:o}}),a({...t,props:{...t.props,imageUrl:d}})};return window.addEventListener("email-builder-set-image",c),()=>{window.removeEventListener("email-builder-set-image",c)}},[t,a]),m.jsxs(Cr,{title:r("inputs.panels.avatar.title"),children:[l=="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsx(sL,{data:t,setData:c=>e({...t,props:{...t.props,imageUrl:c.props.url,alt:o}}),blockId:i}),m.jsx(Po,{label:r("inputs.panels.avatar.sizeLabel"),iconLabel:m.jsx($.AspectRatioOutlined,{sx:{color:"text.secondary"}}),units:"px",step:3,min:32,max:256,defaultValue:s,onChange:c=>{a({...t,props:{...t.props,size:c}})}}),m.jsx(ll,{label:r("inputs.panels.avatar.altLabel"),defaultValue:o,onChange:c=>{a({...t,props:{...t.props,alt:c}})}})]}),m.jsx(di,{names:["textAlign","backgroundColor","padding","mobilePadding"],value:t.style,onChange:c=>a({...t,style:c})})]})}const b_=Me().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),Zx=Le({top:se(),bottom:se(),right:se(),left:se()}).optional().nullable(),P7=t=>({top:t?.top??0,right:t?.right??0,bottom:t?.bottom??0,left:t?.left??0}),L7=Le({topLeft:se().min(0).optional(),topRight:se().min(0).optional(),bottomLeft:se().min(0).optional(),bottomRight:se().min(0).optional()}),eD=Le({top:se().min(0).optional(),bottom:se().min(0).optional(),left:se().min(0).optional(),right:se().min(0).optional()}),oL=Le({style:Le({backgroundColor:b_,fontSize:se().min(0).optional().nullable(),fontSizeMobile:se().min(0).optional().nullable(),fontFamily:eu,background:Me().nullable().optional(),fontWeight:jt(["bold","normal"]).optional().nullable(),textAlign:jt(["left","center","right"]).optional().nullable(),textAlignMobile:jt(["left","center","right"]).optional().nullable(),padding:Zx,mobilePadding:Zx,shape:bc([jt(["rectangle","pill"]),L7]).optional().nullable()}).passthrough().optional().nullable(),props:Le({buttonBackgroundColor:b_,buttonTextColor:b_,fullWidth:Nc().optional().nullable(),fullWidthMobile:Nc().optional().nullable(),size:bc([jt(["x-small","small","medium"]),eD]).optional().nullable(),sizeMobile:bc([jt(["x-small","small","medium"]),eD]).optional().nullable(),text:Me().optional().nullable(),url:Me().optional().nullable()}).optional().nullable()}).passthrough();function tD(t){if(typeof t!="string")return t;switch(t){case"x-small":return{top:4,bottom:4,right:8,left:8};case"small":return{top:8,bottom:8,right:12,left:12};case"medium":default:return{top:12,bottom:12,left:20,right:20}}}const Fs={text:"",url:"",fullWidth:!1,size:"medium",buttonBackgroundColor:"#999999"};function lL({style:t,props:e,blockId:n}){const i=Zh(),r=dn(),a=e?.text??Fs.text,s=e?.url??Fs.url,o=r==="desktop"?e?.fullWidth??!1:e?.fullWidthMobile??e?.fullWidth??!1,l=e?.buttonTextColor??i.textColor,c=e?.buttonBackgroundColor??Fs.buttonBackgroundColor,u={backgroundColor:t?.backgroundColor??void 0,textAlign:r=="desktop"?t?.textAlign??void 0:t?.textAlignMobile??t?.textAlign,padding:P7(r=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},d={color:l,fontSize:r=="desktop"?t?.fontSize??16:t?.fontSizeMobile??t?.fontSize??16,fontFamily:es(t?.fontFamily),fontWeight:t?.fontWeight??"bold",display:"inline-block",textDecoration:"none"},p={color:t?.borderColor??void 0,top:r=="desktop"?t?.borderTop??void 0:t?.borderTopMobile??t?.borderTop,bottom:r=="desktop"?t?.borderBottom??void 0:t?.borderBottomMobile??t?.borderBottom,left:r=="desktop"?t?.borderLeft??void 0:t?.borderLeftMobile??t?.borderLeft,right:r=="desktop"?t?.borderRight??void 0:t?.borderRightMobile??t?.borderRight},f=t?.background??"",h=t?.backgroundColor,_=h?Tl(f,h):f,g=dt(n);return m.jsx(fi,{background:_,backgroundColor:h,padding:u.padding,align:u.textAlign,width:"100%",className:`c${g}`,children:m.jsx("a",{href:rT(s),target:"_blank",className:`abtn-${g}`,children:m.jsx(fi,{className:g,padding:r=="desktop"?tD(e?.size):tD(e?.sizeMobile??e?.size),borderRadius:Fm(t),background:c,backgroundColor:c,isParent:!1,align:"center",width:o?"100%":void 0,border:p,children:m.jsx("span",{className:`btn${g}`,style:d,children:a})})})})}function F7({size:t,sizeMobile:e,onChange:n,label:i,maxValue:r=100,paddingSteps:a=8}){const{t:s}=Ke.useTranslation("inspector"),o=i??s("inputs.common.size"),l=dn(),[c,u]=v.useState(()=>{const y=l==="desktop"?t:e!==void 0?e:t;return typeof y=="object"&&y!==null?y:{top:8,bottom:8,left:16,right:16}}),[d,p]=v.useState(!1);v.useEffect(()=>{const y=l==="desktop"?t:e!==void 0?e:t;typeof y=="object"&&y!==null&&u(y)},[t,e,l]);const f=()=>{const y=l==="desktop"?t:e!==void 0?e:t;return typeof y=="object"&&y!==null?"custom":y},h=y=>{if(l==="desktop"){const E={size:y==="custom"?c:y};e==null&&(E.sizeMobile=y==="custom"?c:y),n(E)}else n({sizeMobile:y==="custom"?c:y})},_=(y,E)=>{let S;d?S={top:E,bottom:E,left:E,right:E}:S={...c,[y]:E},u(S),n(l==="desktop"?{size:S}:{sizeMobile:S})},g=()=>{if(!d){const E={top:16,bottom:16,left:16,right:16};u(E),n(l==="desktop"?{size:E}:{sizeMobile:E})}p(!d)},b=f();return m.jsxs(T.Stack,{spacing:2,children:[m.jsxs(so,{label:o,defaultValue:b,onChange:h,children:[m.jsx(T.ToggleButton,{value:"x-small",children:s("inputs.responsiveSize.options.xSmall")}),m.jsx(T.ToggleButton,{value:"small",children:s("inputs.responsiveSize.options.small")}),m.jsx(T.ToggleButton,{value:"medium",children:s("inputs.responsiveSize.options.medium")}),m.jsx(T.ToggleButton,{value:"custom",children:s("inputs.responsiveSize.options.custom")})]}),b==="custom"&&m.jsxs(T.Stack,{spacing:2,alignItems:"flexStart",pb:1,children:[m.jsxs(T.Stack,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[m.jsx(Vt,{label:s("inputs.responsiveSize.customPadding")}),m.jsx(T.Tooltip,{title:s(d?"inputs.responsiveSize.unlockTooltip":"inputs.responsiveSize.lockTooltip"),children:m.jsx(T.IconButton,{size:"small",onClick:g,sx:{marginTop:"0!important",color:d?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:d?m.jsx($.Lock,{fontSize:"small"}):m.jsx($.LockOpen,{fontSize:"small"})})})]}),d?m.jsx(cn,{iconLabel:s("inputs.responsiveSize.allSides"),value:c.top,setValue:y=>_("top",y),units:"px",min:0,step:a,marks:a>1,max:r}):m.jsxs(m.Fragment,{children:[m.jsx(cn,{iconLabel:m.jsx($.AlignVerticalTopOutlined,{sx:{fontSize:16}}),value:c.top,setValue:y=>_("top",y),units:"px",min:0,step:a,marks:a>1,max:r}),m.jsx(cn,{iconLabel:m.jsx($.AlignVerticalBottomOutlined,{sx:{fontSize:16}}),value:c.bottom,setValue:y=>_("bottom",y),units:"px",min:0,step:a,marks:a>1,max:r}),m.jsx(cn,{iconLabel:m.jsx($.AlignHorizontalLeftOutlined,{sx:{fontSize:16}}),value:c.left,setValue:y=>_("left",y),units:"px",min:0,step:a,marks:a>1,max:r}),m.jsx(cn,{iconLabel:m.jsx($.AlignHorizontalRightOutlined,{sx:{fontSize:16}}),value:c.right,setValue:y=>_("right",y),units:"px",min:0,step:a,marks:a>1,max:r})]})]})]})}function B7({fullWidth:t,fullWidthMobile:e,onChange:n,label:i="Width"}){const r=dn(),{t:a}=Ke.useTranslation("inspector"),s=()=>r==="desktop"?t:e!==void 0?e:t,o=c=>{const u=c==="FULL_WIDTH";if(r==="desktop"){const d={fullWidth:u};e==null&&(d.fullWidthMobile=u),n(d)}else n({fullWidthMobile:u})},l=s();return m.jsxs(so,{label:i,defaultValue:l?"FULL_WIDTH":"AUTO",onChange:o,children:[m.jsx(T.ToggleButton,{value:"FULL_WIDTH",children:a("inputs.width.full")}),m.jsx(T.ToggleButton,{value:"AUTO",children:a("inputs.width.auto")})]})}function U7({data:t,setData:e}){const[,n]=v.useState(null),i=Zh(),{t:r}=Ke.useTranslation("inspector"),a=_=>{const g=oL.safeParse(_);g.success?(e(g.data),n(null)):n(g.error)},s=t.props?.text??Fs.text,o=t.props?.url??Fs.url,l=t.props?.fullWidth??Fs.fullWidth,c=t.props?.size??Fs.size,u=t.props?.buttonTextColor??i.textColor,d=t.props?.buttonBackgroundColor??Fs.buttonBackgroundColor,p=t.props?.fullWidthMobile,f=t.props?.sizeMobile,h=va();return m.jsxs(Cr,{title:r("inputs.panels.button.title"),children:[h=="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsx(di,{disabledCSSValidation:!0,names:["fontFamily","fontSize","fontSizeMobile","fontWeight"],value:t.style,onChange:_=>a({...t,style:_})}),m.jsx(ll,{label:r("inputs.panels.button.textLabel"),defaultValue:s,onChange:_=>a({...t,props:{...t.props,text:_}})}),m.jsx(ll,{label:r("inputs.panels.button.targetLabel"),placeholder:r("inputs.panels.button.targetPlaceholder"),defaultValue:o,onChange:_=>a({...t,props:{...t.props,url:_}})}),m.jsx(B7,{label:r("properties.width"),fullWidth:l,fullWidthMobile:p,onChange:_=>a({...t,props:{...t.props,..._}})}),m.jsx(F7,{size:c,sizeMobile:f,onChange:_=>a({...t,props:{...t.props,..._}})}),m.jsx(Ko,{label:r("inputs.panels.button.textColor"),defaultValue:u,onChange:_=>a({...t,props:{...t.props,buttonTextColor:_}})}),m.jsx(Ko,{label:r("inputs.panels.button.buttonColor"),defaultValue:d,onChange:_=>a({...t,props:{...t.props,buttonBackgroundColor:_}})})]}),m.jsx(di,{names:["shape","textAlign","textAlignMobile","backgroundColor","border","borderMobile","padding","mobilePadding"],value:t.style,shapeMaxValue:80,onChange:_=>a({...t,style:_})})]})}const $7=KP([se().nullish(),se().nullish(),se().nullish()]).optional().nullable(),cL=Le({style:Le({background:Me().nullable().optional(),backgroundColor:Me().nullable().optional(),padding:Bm,mobilePadding:Bm}).optional().nullable(),props:Le({fixedWidths:$7,columnsCount:bc([t1(2),t1(3)]).optional().nullable(),layout:Me().optional().nullable(),contentAlignment:jt(["top","middle","bottom"]).optional().nullable(),contentAlignmentMobile:jt(["top","middle","bottom"]).optional().nullable()}).optional().nullable()}).passthrough(),z7={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},fd={columnsCount:2,contentAlignment:"middle"};function s1({style:t,columns:e,props:n,blockId:i}){const r=dn(),a=Jh(),s={padding:Tp(r=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},o={columnsCount:n?.columnsCount??fd.columnsCount,contentAlignment:r=="desktop"?n?.contentAlignment??fd.contentAlignment:n?.contentAlignmentMobile??n?.contentAlignment??fd.contentAlignment,fixedWidths:n?.fixedWidths,blockId:i},l=t?.background??"",c=t?.backgroundColor,u=c?Tl(l,c):l,d=dt(i);return m.jsxs(fi,{background:u,backgroundColor:c,className:`${d}`,padding:s.padding,width:"100%",children:[a.uploading&&a.id===i?m.jsx("div",{style:z7,children:m.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle",style:{width:"32px",height:"32px",animation:"1s linear infinite spin",stroke:"currentColor"},children:m.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}):m.jsx(m.Fragment,{}),m.jsx("table",{border:0,cellSpacing:"0",cellPadding:"0",style:{width:"100%"},children:m.jsx("tbody",{style:{width:"100%"},children:m.jsxs("tr",{style:{width:"100%"},children:[m.jsx(y_,{index:0,props:o,columns:e}),m.jsx(y_,{index:1,props:o,columns:e}),m.jsx(y_,{index:2,props:o,columns:e})]})})})]})}function y_({index:t,props:e,columns:n}){const i=e?.contentAlignment??fd.contentAlignment;if((e?.columnsCount??fd.columnsCount)===2&&t===2)return null;const a={boxSizing:"border-box",verticalAlign:i,width:`${e.fixedWidths?.[t]}%`??void 0},s=(n&&n[t])??null,o=e.blockId?dt(e.blockId):"";return m.jsx("td",{className:`col${o}`,style:a,children:s})}const G7=cL.shape.props.unwrap().unwrap().shape,sT=Le({style:cL.shape.style,props:Le({...G7,columns:KP([Le({childrenIds:_c(Me())}),Le({childrenIds:_c(Me())}),Le({childrenIds:_c(Me())})])}).optional().nullable()}).passthrough(),q7=(t,e,n)=>{if(!t||!document)return;const i=dt(t),r=document.querySelector(`.${i}`);if(!r)return;const a=r.parentElement;if(!a)return;const s=Math.ceil(a.getBoundingClientRect().width);n.props?.touched||n.props?.width!==s&&e({...n,props:{...n.props,width:s}})},H7=t=>{if(!t||!document)return;const e=dt(t),n=document.querySelector(`.${e}`);if(!n)return;const i=n.parentElement;if(!i)return;const r=Math.ceil(i.getBoundingClientRect().width);return r||null},j7={desktop:"contentAlignment",mobile:"contentAlignmentMobile"};function V7({data:t,updateData:e}){const{t:n}=Ke.useTranslation("inspector"),i=dn(),r=j7[i]||"contentAlignment",a=t.props?.[r]??t.props?.contentAlignment,s=o=>{e({...t,props:{...t.props,[r]:o}})};return m.jsxs(so,{label:n("inputs.alignment.label"),defaultValue:a,onChange:s,children:[m.jsx(T.ToggleButton,{value:"top",children:m.jsx($.VerticalAlignTopOutlined,{fontSize:"small"})}),m.jsx(T.ToggleButton,{value:"middle",children:m.jsx($.VerticalAlignCenterOutlined,{fontSize:"small"})}),m.jsx(T.ToggleButton,{value:"bottom",children:m.jsx($.VerticalAlignBottomOutlined,{fontSize:"small"})})]})}const ku={grid:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(100px, 1fr))",gap:"16px",width:"100%"},card:{cursor:"pointer",border:"1px solid #e5e7eb",borderRadius:"8px",backgroundColor:"primary"},cardContent:{padding:"8px"},layoutPreview:{display:"flex",gap:"4px",height:"30px",width:"100%",justifyContent:"space-between"}},Y7=({defaultValue:t,onChange:e,columns:n})=>{const{t:i}=Ke.useTranslation("inspector"),[r,a]=v.useState(t||"layout-50-50"),s=T.useTheme();v.useEffect(()=>{r!==t&&a(t==="layout-33-34-33"?"layout-33-33-33":t)},[t]);const o=[{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]}],l=[{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-30-30-40",distribution:[30,30,40]},{id:"layout-40-20-40",distribution:[40,20,40]}],[c,u]=v.useState(l),d=(p,f)=>{a(p),e({layout:p,fixedWidths:f})};return v.useEffect(()=>{if(n===2)u(o),o.findIndex(p=>p.id==t)===-1&&d("layout-50-50",[50,50,null]);else{if(u(l),t==="layout-33-34-33"){d("layout-33-33-33",[33.34,33.33,33.33]);return}l.findIndex(p=>p.id==t)===-1&&d("layout-33-33-33",[33.34,33.33,33.33])}},[n]),v.useEffect(()=>{t==="layout-33-34-33"&&d("layout-33-33-33",[33.34,33.33,33.33])},[t]),m.jsxs(Wn,{children:[m.jsx(Vt,{label:i("inputs.layout.label")}),m.jsx("div",{style:ku.grid,children:c.map((p,f)=>m.jsx("div",{onClick:()=>d(p.id,p.distribution),style:{...ku.card,gridColumn:f===0?"span 2":void 0,border:r===p.id?`2px solid ${s.palette.secondary.main}`:ku.card.border},children:m.jsx("div",{style:ku.cardContent,children:m.jsx("div",{style:ku.layoutPreview,children:p.distribution.map((h,_)=>m.jsx("div",{style:{width:`${h}%`,backgroundColor:r===p.id?s.palette.secondary.main:"#e5e7eb",borderRadius:"4px",transition:"background-color 0.2s ease",display:"grid",placeItems:"center",fontSize:"12px",color:r===p.id?"white":"black"}},_))})})},p.id))})]})};function W7({data:t,setData:e}){const[,n]=v.useState(null),[i,r]=v.useState(t.props?.columnsCount??2),a=va(),s=dn(),{t:o}=Ke.useTranslation("inspector"),l=f=>{const h=ne.getState().document,_=f.filter(g=>h[g]?.type==="Image");s==="desktop"&&_.map(g=>q7(g,e,h[g].data))},c=f=>{const h=sT.safeParse(f);h.success?(h.data.props.columns.map(_=>l(_.childrenIds)),e(h.data),i&&h.data.props?.columnsCount!==i&&r(h.data.props?.columnsCount??2),n(null)):(console.error("Error on columns: ",h.error),n(h.error))},u={layout:"layout-50-50",fixedWidths:[50,50,null],columnsCount:2},d={layout:"layout-33-34-33",fixedWidths:[33,34,33],columnsCount:3},p=f=>{const h=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:[...t.props.columns];return f==="2"?{...u,columns:h}:{...d,columns:h}};return m.jsxs(Cr,{title:o("inputs.panels.columns.title"),children:[a=="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsxs(so,{label:o("inputs.panels.columns.countLabel"),defaultValue:t.props?.columnsCount===2?"2":"3",onChange:f=>{const h=p(f);c({...t,props:{...t.props,...h}})},children:[m.jsx(T.ToggleButton,{style:{fontWeight:"bold"},value:"2",children:"2"}),m.jsx(T.ToggleButton,{style:{fontWeight:"bold"},value:"3",children:"3"})]}),m.jsx(Y7,{columns:t.props?.columnsCount??3,defaultValue:t.props?.layout,onChange:({layout:f,fixedWidths:h})=>{const _=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:t.props.columns;c({...t,props:{...t.props,layout:f,fixedWidths:h,columns:_}})}})]}),a=="css"&&m.jsxs(m.Fragment,{children:[m.jsx(V7,{data:t,updateData:e}),m.jsx(di,{names:["backgroundColor","background","padding","mobilePadding"],value:t.style,onChange:f=>c({...t,style:f})})]})]})}const nD=Me().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),iD=Le({top:se(),bottom:se(),right:se(),left:se()}).optional().nullable(),K7=Le({topLeft:se().min(0).optional(),topRight:se().min(0).optional(),bottomLeft:se().min(0).optional(),bottomRight:se().min(0).optional()}),rD={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},Q7=Le({style:Le({backgroundColor:nD,background:Me().nullable().optional(),borderColor:nD,borderRadius:se().optional().nullable(),borderTop:se().optional().nullable(),borderBottom:se().optional().nullable(),borderLeft:se().optional().nullable(),borderRight:se().optional().nullable(),borderTopMobile:se().optional().nullable(),borderBottomMobile:se().optional().nullable(),borderLeftMobile:se().optional().nullable(),borderRightMobile:se().optional().nullable(),shape:bc([jt(["rectangle","pill"]),K7]).optional().nullable(),padding:iD,mobilePadding:iD}).optional().nullable()}).passthrough();function uL({style:t,children:e,blockId:n}){const i=dn(),r=Jh(),a={border:{color:t?.borderColor??void 0,top:i=="desktop"?t?.borderTop??void 0:t?.borderTopMobile??t?.borderTop,bottom:i=="desktop"?t?.borderBottom??void 0:t?.borderBottomMobile??t?.borderBottom,left:i=="desktop"?t?.borderLeft??void 0:t?.borderLeftMobile??t?.borderLeft,right:i=="desktop"?t?.borderRight??void 0:t?.borderRightMobile??t?.borderRight},padding:Tp(i=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},s=t?.background??"",o=t?.backgroundColor,l=o?Tl(s,o):s,c=dt(n);return e?m.jsx(fi,{className:`${c}`,background:l,backgroundColor:t?.backgroundColor,borderRadius:Fm(t),padding:a.padding,width:"100%",border:a.border,children:m.jsxs(m.Fragment,{children:[r.uploading&&r.id===n&&m.jsx("div",{style:rD,children:m.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle",style:{width:"32px",height:"32px",animation:"1s linear infinite spin",stroke:"currentColor"},children:m.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}),e]})}):m.jsx(fi,{className:`${c}`,background:l,backgroundColor:o,borderRadius:Fm(t),padding:a.padding,width:"100%",border:a.border,children:m.jsx("div",{children:r.uploading&&r.id===n&&m.jsx("div",{style:rD,children:m.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle",style:{width:"32px",height:"32px",animation:"1s linear infinite spin",stroke:"currentColor"},children:m.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})})})}const dL=Le({style:Q7.shape.style,props:Le({childrenIds:_c(Me()).optional().nullable()}).optional().nullable()}).passthrough();function pL({data:t,setData:e}){const[,n]=v.useState(null),{t:i}=Ke.useTranslation("inspector"),r=a=>{const s=dL.safeParse(a);s.success?(e(s.data),n(null)):n(s.error)};return m.jsx(Cr,{title:i("inputs.panels.container.title"),children:m.jsx(di,{names:["backgroundColor","background","border","borderMobile","shape","padding","mobilePadding"],value:t.style,shapeSteps:30,onChange:a=>r({...t,style:a})})})}const X7=Me().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),aD=Le({top:se(),bottom:se(),right:se(),left:se()}).optional().nullable(),fL=Le({style:Le({background:Me().nullable().optional(),backgroundColor:X7,padding:aD,mobilePadding:aD,height:se().optional().nullable(),heightMobile:se().optional().nullable(),color:Me().optional().nullable(),width:se().optional().nullable(),widthMobile:se().optional().nullable(),textAlign:Me().optional().nullable(),textAlignMobile:Me().optional().nullable()}).passthrough().optional().nullable()}).passthrough(),ko={height:1,color:"#333333",width:100,textAlign:"left"};function mL({style:t,blockId:e}){const n=dn(),i=Tp(n==="desktop"?t?.padding:t?.mobilePadding??t?.padding),r=n==="desktop"?t?.height??ko.height:t?.heightMobile??t?.height??ko.height,a=t?.color??ko.color,s=n==="desktop"?(t?.width??ko.width)+"%":(t?.widthMobile??t?.width??ko.width)+"%",o=n==="desktop"?t?.textAlign??ko.textAlign:t?.textAlignMobile??t?.textAlign??ko.textAlign,l=t?.background??"",c=t?.backgroundColor??"",u=c?Tl(l,c):l,d=dt(e);return m.jsx(fi,{className:`c${d}`,background:u,backgroundColor:c,width:"100%",padding:i,align:o,children:m.jsx(fi,{display:"inline-block",className:`${d}`,background:a,backgroundColor:c,width:s,padding:{top:r,bottom:0,left:0,right:0},isParent:!1,children:m.jsx("div",{})})})}function hL({data:t,setData:e}){const[,n]=v.useState(null),{t:i}=Ke.useTranslation("inspector"),r=a=>{const s=fL.safeParse(a);s.success?(e(s.data),n(null)):n(s.error)};return m.jsx(Cr,{title:i("inputs.panels.divider.title"),children:m.jsx(di,{names:["width","widthMobile","height","heightMobile","color","backgroundColor","textAlign","textAlignMobile","padding","mobilePadding"],value:t.style,onChange:a=>r({...t,style:a})})})}const xu=Me().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),gL=Le({backdropColor:xu,borderColor:xu,borderRadius:se().optional().nullable(),canvasColor:xu,textColor:xu,fontFamily:eu,childrenIds:_c(Me()).optional().nullable(),linkGlobal:Le({linkColor:xu,underline:Nc()}).optional().nullable(),showVersion:Nc().optional().nullable()}),J7=({label:t,linkColor:e,underline:n=!1,onChange:i})=>{const[r,a]=v.useState(e??"#FF0000"),[s,o]=v.useState(n),l=T.useTheme(),{t:c}=Ke.useTranslation("inspector"),u=t??c("inputs.links.color"),d=s?"enabled":"disabled",p={container:{width:"100%"},toggleGroup:{width:"100%",backgroundColor:l.palette.background.paper,padding:"4px",borderRadius:"8px"},toggleButton:{flex:1,padding:"6px 16px",textTransform:"none",fontSize:"14px",color:l.palette.text.primary,"&.Mui-selected":{backgroundColor:l.palette.grey[200],color:l.palette.text.primary,"&:hover":{backgroundColor:l.palette.grey[300]}},"&:hover":{backgroundColor:l.palette.grey[100]}}};v.useEffect(()=>{e!==r&&a(e??"#FF0000")},[e]),v.useEffect(()=>{n!==s&&o(n)},[n]);const f=_=>{const g=_??"#FF0000";a(g),i({linkColor:g,underline:s})},h=(_,g)=>{if(!g)return;const b=g==="enabled";o(b),i({linkColor:r,underline:b})};return m.jsxs(Wn,{children:[m.jsx(Ko,{label:u,defaultValue:r,onChange:f}),m.jsx(Vt,{label:c("inputs.links.underline")}),m.jsx(T.Box,{sx:p.container,children:m.jsxs(T.ToggleButtonGroup,{value:d,exclusive:!0,onChange:h,sx:p.toggleGroup,children:[m.jsx(T.ToggleButton,{value:"enabled",sx:p.toggleButton,children:m.jsx(T.Tooltip,{disableInteractive:!0,arrow:!0,title:c("inputs.links.underlineOn"),children:m.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 40 40",role:"img","aria-label":"aiia subrayado",xmlns:"http://www.w3.org/2000/svg",children:[m.jsx("title",{children:"aiia subrayado"}),m.jsx("rect",{width:"20",height:"20",fill:"none"}),m.jsx("text",{x:"50%",y:"26",textAnchor:"middle",fontFamily:"system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif",fontSize:"24",fill:"currentColor",children:"aiia"}),m.jsx("line",{x1:"6",y1:"31",x2:"34",y2:"31",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})})}),m.jsx(T.ToggleButton,{value:"disabled",sx:p.toggleButton,children:m.jsx(T.Tooltip,{disableInteractive:!0,arrow:!0,title:c("inputs.links.underlineOff"),children:m.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 40 40",role:"img","aria-label":"aiia",xmlns:"http://www.w3.org/2000/svg",children:[m.jsx("title",{children:"aiia"}),m.jsx("rect",{width:"20",height:"20",fill:"none"}),m.jsx("text",{x:"50%",y:"26",textAnchor:"middle",fontFamily:"system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif",fontSize:"24",fill:"currentColor",children:"aiia"})]})})})]})})]})},Z7="email-builder-online",eq="3.4.48",E_={name:Z7,version:eq};function _L({data:t,setData:e}){const[,n]=v.useState(null),{t:i}=Ke.useTranslation("inspector"),r=a=>{const s=gL.safeParse(a);s.success?(e(s.data),n(null)):n(s.error)};return m.jsxs(Cr,{title:i("inputs.panels.emailLayout.title"),children:[m.jsx(Ko,{label:i("inputs.panels.emailLayout.backgroundColor"),defaultValue:t.backdropColor??"#F5F5F5",onChange:a=>r({...t,backdropColor:a})}),m.jsx(Ko,{label:i("inputs.panels.emailLayout.canvasColor"),defaultValue:t.canvasColor??"#FFFFFF",onChange:a=>r({...t,canvasColor:a})}),m.jsx(rL,{label:i("inputs.panels.emailLayout.fontFamily"),defaultValue:t.fontFamily||k7.FAMILY,onChange:a=>r({...t,fontFamily:a})}),m.jsx(Ko,{label:i("inputs.panels.emailLayout.textColor"),defaultValue:t.textColor??"#262626",onChange:a=>r({...t,textColor:a})}),m.jsx(J7,{label:i("inputs.panels.emailLayout.linksLabel"),linkColor:t.linkGlobal?.linkColor||"#000000",underline:t.linkGlobal?.underline||!1,onChange:a=>r({...t,linkGlobal:a})}),t.showVersion&&m.jsx(T.Box,{color:"text.secondary",sx:{display:"flex",justifyContent:"flex-end",mt:2},children:m.jsxs(T.Box,{sx:{textAlign:"right"},children:[m.jsxs(T.Typography,{variant:"body2",children:[i("inputs.panels.emailLayout.version"),": ",E_.version]}),m.jsx(T.Link,{href:`https://www.npmjs.com/package/${E_.name}`,target:"_blank",rel:"noopener noreferrer",sx:{fontSize:"0.875rem",mt:.5,display:"inline-block"},children:E_.name})]})})]})}const sD=Me().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),tq=Le({top:se(),bottom:se(),right:se(),left:se()}).optional().nullable(),nq=t=>t?`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`:void 0,bL=Le({props:Le({text:Me().optional().nullable(),level:jt(["h1","h2","h3"]).optional().nullable()}).optional().nullable(),style:Le({color:sD,backgroundColor:sD,fontFamily:eu,fontWeight:jt(["bold","normal"]).optional().nullable(),textAlign:jt(["left","center","right"]).optional().nullable(),padding:tq}).optional().nullable()}),Um={level:"h2",text:""};function yL({props:t,style:e}){const n=t?.level??Um.level,i=t?.text??Um.text,r={color:e?.color??void 0,backgroundColor:e?.backgroundColor??void 0,fontWeight:e?.fontWeight??"bold",textAlign:e?.textAlign??void 0,margin:0,fontFamily:es(e?.fontFamily),fontSize:iq(n),padding:nq(e?.padding)};switch(n){case"h1":return m.jsx("h1",{style:r,children:i});case"h2":return m.jsx("h2",{style:r,children:i});case"h3":return m.jsx("h3",{style:r,children:i})}}function iq(t){switch(t){case"h1":return 32;case"h2":return 24;case"h3":return 20}}function rq({data:t,setData:e}){const[,n]=v.useState(null),{t:i}=Ke.useTranslation("inspector"),r=s=>{const o=bL.safeParse(s);o.success?(e(o.data),n(null)):n(o.error)},a=va();return m.jsxs(Cr,{title:i("inputs.panels.heading.title"),children:[a=="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsx(ll,{label:i("inputs.panels.heading.contentLabel"),rows:3,defaultValue:t.props?.text??Um.text,onChange:s=>{r({...t,props:{...t.props,text:s}})}}),m.jsxs(so,{label:i("inputs.panels.heading.levelLabel"),defaultValue:t.props?.level??Um.level,onChange:s=>{r({...t,props:{...t.props,level:s}})},children:[m.jsx(T.ToggleButton,{value:"h1",children:"H1"}),m.jsx(T.ToggleButton,{value:"h2",children:"H2"}),m.jsx(T.ToggleButton,{value:"h3",children:"H3"})]})]}),m.jsx(di,{names:["color","backgroundColor","fontFamily","fontWeight","textAlign","padding","mobilePadding"],value:t.style,onChange:s=>r({...t,style:s})})]})}const oD=Me().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),aq=Le({top:se(),bottom:se(),right:se(),left:se()}).optional().nullable(),sq=t=>t?`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`:void 0,EL=Le({style:Le({color:oD,backgroundColor:oD,fontFamily:eu,fontSize:se().min(0).optional().nullable(),textAlign:jt(["left","right","center"]).optional().nullable(),padding:aq}).optional().nullable(),props:Le({contents:Me().optional().nullable()}).optional().nullable()});function SL({style:t,props:e}){const n=e?.contents,i={color:t?.color??void 0,backgroundColor:t?.backgroundColor??void 0,fontFamily:es(t?.fontFamily),fontSize:t?.fontSize??void 0,textAlign:t?.textAlign??void 0,padding:sq(t?.padding)};return n?m.jsx("div",{style:i,dangerouslySetInnerHTML:{__html:n}}):m.jsx("div",{style:i})}function oq({data:t,setData:e}){const[,n]=v.useState(null),{t:i}=Ke.useTranslation("inspector"),r=s=>{const o=EL.safeParse(s);o.success?(e(o.data),n(null)):n(o.error)},a=va();return m.jsxs(Cr,{title:i("inputs.panels.html.title"),children:[a=="block-configuration"&&m.jsx(m.Fragment,{children:m.jsx(ll,{label:i("inputs.panels.html.contentLabel"),rows:5,defaultValue:t.props?.contents??"",onChange:s=>r({...t,props:{...t.props,contents:s}})})}),m.jsx(di,{names:["color","backgroundColor","fontFamily","fontSize","textAlign","padding","mobilePadding"],value:t.style,onChange:s=>r({...t,style:s})})]})}const lq=(t,e,n)=>{const i=dn();v.useEffect(()=>{const r=()=>{if(!t||!document||i=="mobile")return;const o=dt(t),l=document.querySelector(`.${o}`);if(!l)return;const c=l.parentElement;if(!c)return;const u=Math.ceil(c.getBoundingClientRect().width);n.props?.size===void 0||n.props?.size==="original"||n.props?.touched&&n.props?.width<=u||n.props?.width!==u&&!n.props?.touched&&e({...n,props:{...n.props,width:u}})};r();const a=new ResizeObserver(r),s=document.querySelector(`.${dt(t)}`);return s?.parentElement&&a.observe(s.parentElement),()=>{a.disconnect()}},[t,e,n,i])},cq=({defaultValue:t="original",scale:e=100,onChange:n})=>{const[i,r]=v.useState(t),[a,s]=v.useState(e);dn();const o=T.useTheme(),{t:l}=Ke.useTranslation("inspector"),c={container:{width:"100%"},label:{color:o.palette.text.primary},toggleGroup:{width:"100%",backgroundColor:o.palette.background.paper,padding:"4px",borderRadius:"8px"},toggleButton:{flex:1,padding:"6px 16px",textTransform:"none",fontSize:"14px",color:o.palette.text.primary,"&.Mui-selected":{backgroundColor:o.palette.grey[200],color:o.palette.text.primary,"&:hover":{backgroundColor:o.palette.grey[300]}},"&:hover":{backgroundColor:o.palette.grey[100]}},sliderContainer:{marginTop:"16px",padding:"0 8px"},slider:{"& .MuiSlider-thumb":{backgroundColor:o.palette.primary.main,"&:hover":{boxShadow:`0 0 0 8px ${o.palette.primary.main}20`}},"& .MuiSlider-rail":{backgroundColor:o.palette.grey[300]},"& .MuiSlider-track":{backgroundColor:o.palette.primary.main}},scaleValue:{color:o.palette.text.secondary}};v.useEffect(()=>{(t!==i||e!==a)&&(t!==i&&r(t),t==="scale"&&s(e))},[t,e]);const u=(p,f)=>{f!==null&&(r(f),n&&n({mode:f,scale:f==="scale"?a:void 0}))},d=p=>{s(p),n&&n({mode:i,scale:p})};return m.jsxs(Wn,{children:[m.jsx(Vt,{label:l("inputs.sizeSelector.label")}),m.jsxs(T.Box,{sx:c.container,children:[m.jsxs(T.ToggleButtonGroup,{value:i,exclusive:!0,onChange:u,sx:c.toggleGroup,children:[m.jsx(T.ToggleButton,{value:"original",sx:c.toggleButton,children:l("inputs.sizeSelector.contain")}),m.jsx(T.ToggleButton,{value:"fill",sx:c.toggleButton,children:l("inputs.sizeSelector.cover")}),m.jsx(T.ToggleButton,{value:"scale",sx:c.toggleButton,children:l("inputs.sizeSelector.scale")})]}),m.jsx(T.Collapse,{in:i==="scale",children:m.jsx(T.Box,{sx:c.sliderContainer,children:m.jsx(cn,{iconLabel:m.jsx($.WidthWideOutlined,{}),value:a,setValue:d,marks:!1,units:"%",min:1,max:100})})})]})]})};function uq({data:t,setData:e}){const[n,i]=v.useState(null),r=Jc(),a=va(),s=dn(),{t:o}=Ke.useTranslation("inspector");lq(r||"",e,t),v.useEffect(()=>{r&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:r,currentImageUrl:t.props?.url||null,alt:t.props?.alt||null}}))},[r,t.props?.url,t.props?.alt]);const l=v.useCallback(_=>{const g=aT.safeParse(_);g.success?JSON.stringify(t)!==JSON.stringify(g.data)&&(e(g.data),i(null)):i(g.error)},[t,e]),c=v.useCallback((_,g,b)=>{const y=H7(r)||lc,E={..._.props};if(b&&(E.touchedMobile=!0),g.mode==="original"){const S=_.props?.original_width??null;return b?{...E,sizeMobile:g.mode,widthMobile:S}:{...E,size:g.mode,width:S,sizeMobile:E.touchedMobile?E.sizeMobile:g.mode,widthMobile:E.touchedMobile?E.widthMobile:S}}if(g.mode==="fill")return b?{...E,sizeMobile:g.mode,widthMobile:null}:{...E,size:g.mode,width:null,sizeMobile:E.touchedMobile?E.sizeMobile:g.mode,widthMobile:E.touchedMobile?E.widthMobile:null};if(g.mode==="scale"){const S=Math.ceil(y/100*g.scale);return b?{...E,sizeMobile:g.mode,scaleMobile:g.scale,widthMobile:S}:{...E,size:g.mode,scale:g.scale,width:S,sizeMobile:E.touchedMobile?E.sizeMobile:g.mode,scaleMobile:E.touchedMobile?E.scaleMobile:g.scale,widthMobile:E.touchedMobile?E.widthMobile:S}}return E},[r]),u=v.useCallback((_,g)=>{const b=c(t,_,g);l({...t,props:b})},[t,l,c]),d=v.useMemo(()=>s!=="desktop"?{size:t.props?.touchedMobile?t.props?.sizeMobile:t.props?.size??"original",scale:t.props?.touchedMobile?t.props?.scaleMobile:t.props?.scale}:{size:t.props?.size??"original",scale:t.props?.scale},[s,t.props?.touchedMobile,t.props?.sizeMobile,t.props?.size,t.props?.scaleMobile,t.props?.scale]),p=v.useCallback(_=>{l({...t,props:{...t.props,alt:_}})},[t,l]),f=v.useCallback(_=>{const g=_.trim().length===0?null:_.trim();l({...t,props:{...t.props,linkHref:g}})},[t,l]),h=v.useCallback(_=>{l({...t,style:_})},[t,l]);return m.jsxs(Cr,{title:o("inputs.panels.image.title"),children:[a==="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsx(sL,{data:t,setData:e,blockId:r}),m.jsx(ll,{label:o("inputs.panels.image.altLabel"),placeholder:o("inputs.panels.image.altPlaceholder"),defaultValue:t.props?.alt??"",onChange:p}),m.jsx(ll,{label:o("inputs.panels.image.urlLabel"),placeholder:o("inputs.panels.image.urlPlaceholder"),defaultValue:t.props?.linkHref??"",onChange:f}),m.jsx(cq,{defaultValue:d.size,scale:d.scale??void 0,onChange:_=>u(_,s!=="desktop")})]}),m.jsx(di,{names:["textAlign","textAlignMobile","backgroundColor","shape","padding","mobilePadding"],value:t.style,shapeMaxValue:300,shapeSteps:20,onChange:h})]})}const lD=Me().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),cD=Le({top:se(),bottom:se(),right:se(),left:se()}).optional().nullable(),vL=Le({style:Le({color:lD,backgroundColor:lD,background:Me().nullable().optional(),fontSize:se().gte(0).optional().nullable(),fontFamily:eu,fontWeight:jt(["bold","normal"]).optional().nullable(),textAlign:jt(["left","center","right"]).optional().nullable(),padding:cD,mobilePadding:cD,optionSize:jt(["small","medium","large"]).optional().nullable(),theme:jt(["light","dark","colored"]).optional().nullable()}).passthrough().optional().nullable(),gap:se().optional(),items:_c(Le({id:Me(),key:Me(),label:Me(),iconName:Me(),theme:Me(),size:Me(),sizePx:Me(),url:Me(),href:Me().optional().nullable()}))}).passthrough();function TL({style:t,items:e,blockId:n,gap:i=1,gapMobile:r}){var a,s,o,l,c,u;const d=dn(),p=(a=t?.background)!==null&&a!==void 0?a:"",f=t?.backgroundColor,h=f?Tl(p,f):p,_={color:(s=t?.color)!==null&&s!==void 0?s:void 0,background:h,backgroundColor:t?.backgroundColor,fontSize:(o=t?.fontSize)!==null&&o!==void 0?o:16,fontFamily:es(t?.fontFamily),fontWeight:(l=t?.fontWeight)!==null&&l!==void 0?l:void 0,textAlign:d=="desktop"?t?.textAlign:(c=t?.textAlignMobile)!==null&&c!==void 0?c:t?.textAlign,padding:d=="desktop"?t?.padding:(u=t?.mobilePadding)!==null&&u!==void 0?u:t?.padding},g=d==="desktop"?i:r??i,b=dt(n);return v.createElement(dq,{blockId:`${b}`,items:e,wStyle:_,gap:g})}const dq=({items:t,blockId:e,wStyle:n,gap:i})=>{const r=a=>{switch(a){case 0:return"first";case t.length-1:return"last";default:return"inside"}};return v.createElement(fi,{className:e,background:n.background,backgroundColor:n.backgroundColor,padding:n?.padding,align:n.textAlign,width:"100%"},v.createElement("table",{style:{display:"inline-block"},border:0,cellSpacing:"0",cellPadding:"0"},v.createElement("tbody",null,v.createElement("tr",null,t.map((a,s)=>{const o=r(s);return v.createElement(v.Fragment,{key:a.id},o!=="first"&&v.createElement("td",{className:`gap-${e}`,width:Math.ceil(i/2)}),v.createElement("td",{key:`${a.id}-${a.url}`,id:`${a.id}-${a.url}`,width:a.sizePx,style:{textAlign:"center",whiteSpace:"nowrap"}},v.createElement("a",{key:`item_${s}`,target:"_blank",href:rT(a.href),style:{textDecoration:"none"}},v.createElement("img",{src:a.url,alt:a.key,style:{width:a.sizePx||36,height:a.sizePx||36,display:"block"}}))),o!=="last"&&v.createElement("td",{className:`gap-${e}`,width:Math.ceil(i/2)}))})))))},pq="https://maildrill-dev.s3.us-east-2.amazonaws.com/icons/",fq={positive:!0,original:!0,negative:!0},mq={small:!0,medium:!0,large:!0,xlarge:!0},B={theme:"positive",size:"medium"},Ct=(t,e,n="medium")=>{var i,r;const a=(i=oT.find(o=>o.key===n))===null||i===void 0?void 0:i.value,s=(r=CL.find(o=>o.key===e))===null||r===void 0?void 0:r.value;return`${pq}${t}_${s}_${a}.png`},Nt=t=>{var e;return((e=oT.find(n=>n.key===t))===null||e===void 0?void 0:e.value)||"36px"},oT=[{value:"24px",key:"small",label:"Small"},{value:"36px",key:"medium",label:"Medium"},{value:"48px",key:"large",label:"Large"}],CL=[{value:"Positive",key:"positive",label:"Light"},{value:"Original",key:"original",label:"Color"},{value:"Negative",key:"negative",label:"Dark"}],Yf=[{key:"facebook",label:"Facebook",iconName:"Facebook",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Facebook",B.theme,B.size),href:"https://www.facebook.com/your-profile"},{key:"web",label:"Web",iconName:"Web",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Web",B.theme,B.size),href:"https://www.google.com"},{key:"mail",label:"Mail",iconName:"Mail",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Mail",B.theme,B.size),href:"https://mail.google.com/"},{key:"apple",label:"Apple",iconName:"Apple",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Apple",B.theme,B.size),href:"https://www.apple.com/"},{key:"bluesky",label:"Bluesky",iconName:"Bluesky",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Bluesky",B.theme,B.size),href:"https://bsky.app/"},{key:"clubhouse",label:"ClubHouse",iconName:"Clubhouse",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Clubhouse",B.theme,B.size),href:"https://www.clubhouse.com/"},{key:"dribbble",label:"Dribbble",iconName:"Dribbble",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Dribbble",B.theme,B.size),href:"https://dribbble.com/"},{key:"figma",label:"Figma",iconName:"Figma",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Figma",B.theme,B.size),href:"https://www.figma.com/"},{key:"github",label:"Github",iconName:"Github",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Github",B.theme,B.size),href:"https://github.com/"},{key:"google",label:"Google",iconName:"Google",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Google",B.theme,B.size),href:"https://google.com/"},{key:"instagram",label:"Instagram",iconName:"Instagram",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Instagram",B.theme,B.size),href:"https://www.instagram.com/your-profile"},{key:"linkedin",label:"LinkedIn",iconName:"LinkedIn",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("LinkedIn",B.theme,B.size),href:"https://www.linkedin.com/in/your-profile"},{key:"medium-social",label:"Medium",iconName:"Medium",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Medium",B.theme,B.size),href:"https://medium.com/"},{key:"messenger",label:"Messenger",iconName:"Messenger",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Messenger",B.theme,B.size),href:"https://www.messenger.com/"},{key:"pinterest",label:"Pinterest",iconName:"Pinterest",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Pinterest",B.theme,B.size),href:"https://www.pinterest.com/"},{key:"reddit",label:"Reddit",iconName:"Reddit",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Reddit",B.theme,B.size),href:"https://www.reddit.com/"},{key:"signal",label:"Signal",iconName:"Signal",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Signal",B.theme,B.size),href:"https://signal.org/"},{key:"snapchat",label:"Snapchat",iconName:"Snapchat",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Snapchat",B.theme,B.size),href:"https://www.snapchat.com/"},{key:"spotify",label:"Spotify",iconName:"Spotify",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Spotify",B.theme,B.size),href:"https://www.spotify.com/"},{key:"telegram",label:"Telegram",iconName:"Telegram",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Telegram",B.theme,B.size),href:"https://t.me/your-profile"},{key:"threads",label:"Threads",iconName:"Threads",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Threads",B.theme,B.size),href:"https://www.threads.net/"},{key:"tiktok",label:"TikTok",iconName:"TikTok",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("TikTok",B.theme,B.size),href:"https://www.tiktok.com/@your-profile"},{key:"tumblr",label:"Tumblr",iconName:"Tumblr",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Tumblr",B.theme,B.size),href:"https://www.tumblr.com/"},{key:"twitch",label:"Twitch",iconName:"Twitch",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Twitch",B.theme,B.size),href:"https://www.twitch.tv/"},{key:"vk",label:"VK",iconName:"VK",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("VK",B.theme,B.size),href:"https://vk.com/"},{key:"whatsapp",label:"WhatsApp",iconName:"WhatsApp",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("WhatsApp",B.theme,B.size),href:"https://www.whatsapp.com/"},{key:"x",label:"X",iconName:"X",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("X",B.theme,B.size),href:"https://x.com/your-profile"},{key:"youtube",label:"YouTube",iconName:"YouTube",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("YouTube",B.theme,B.size),href:"https://www.youtube.com/channel/your-channel-id"}];function Hu(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}const hq=({element:t,index:e,moveItem:n,onSelectChange:i,onUrlChange:r,onRemove:a,onDuplicate:s,canRemove:o,theme:l})=>{const c=v.useRef(null),[u,d]=v.useState(null),{t:p}=Ke.useTranslation("inspector"),f=x=>{const O=x.getClientOffset(),A=c.current?.getBoundingClientRect();if(!O||!A)return null;const X=(A.bottom-A.top)/2;return O.y-A.top<X?"up":"down"},[{handlerId:h,isOver:_},g]=Qs.useDrop(()=>({accept:"social-media-item",collect(x){return{handlerId:x.getHandlerId(),isOver:x.isOver({shallow:!0})}},hover(x,O){if(!c.current)return;if(x.index===e){d(null);return}if(!O.isOver({shallow:!0})){d(null);return}const P=f(O);d(P)},drop(x,O){if(d(null),!c.current)return;const A=x.index,X=e;if(A===X)return;const P=f(O);let Y=X;P==="down"&&(Y=X+1),A<Y&&(Y=Y-1),setTimeout(()=>{n(A,Y)},0),x.index=Y},end:()=>{d(null)}}),[t.id,e,n]),[{isDragging:b},y]=Qs.useDrag(()=>({type:"social-media-item",item:()=>({id:t.id,index:e}),collect:x=>({isDragging:x.isDragging()}),end:()=>{d(null)}}),[t.id,e]);v.useEffect(()=>{_||d(null)},[_]);const E=b?.4:1;v.useEffect(()=>{if(c.current&&y&&g){const x=c.current;y(x),g(x)}},[y,g]);const S=()=>{setTimeout(()=>a(e),0)},C=()=>{setTimeout(()=>s(e),0)},D=x=>{const O=x.target.value;setTimeout(()=>i(e,O,t),0)},w=x=>{const O=x.target.value;setTimeout(()=>r(e,O,t),0)},k=()=>m.jsxs("div",{style:{height:"3px",background:l.palette.secondary.main,position:"relative",color:l.palette.secondary.main,margin:"4px 0"},children:[m.jsx("svg",{style:{position:"absolute",left:"-25px",top:"50%",transform:"translateY(-50%)"},width:"20",height:"20",viewBox:"0 0 32 32",children:m.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"})}),m.jsx("svg",{style:{position:"absolute",right:"-25px",top:"50%",transform:"translateY(-50%) scaleX(-1)"},width:"20",height:"20",viewBox:"0 0 32 32",children:m.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 m.jsxs(m.Fragment,{children:[u==="up"&&m.jsx(k,{}),m.jsxs(T.Stack,{ref:c,"data-handler-id":h,sx:{border:1,borderColor:"divider",padding:1,paddingTop:0,borderRadius:1,backgroundColor:"background.paper",marginBottom:1.5,opacity:E,cursor:b?"grabbing":"grab",boxShadow:b?l.shadows[3]:"none"},gap:1,children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:`1px solid ${l.palette.divider}`},children:[m.jsx("div",{style:{display:"flex",alignItems:"center"},children:m.jsx($.DragIndicator,{sx:{color:b?"primary.main":"text.secondary",cursor:"grab",marginLeft:-.9,"&:hover":{color:"primary.main"}}})}),m.jsxs("div",{children:[m.jsx(T.Tooltip,{disableInteractive:!0,arrow:!0,title:"Duplicate",placement:"left",children:m.jsx(T.IconButton,{color:"primary",size:"small",onClick:C,children:m.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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"})})})}),o&&m.jsx(T.Tooltip,{disableInteractive:!0,arrow:!0,title:"Remove",placement:"left",children:m.jsx(T.IconButton,{color:"error",size:"small",onClick:S,children:m.jsx($.DeleteOutline,{sx:{fontSize:20}})})})]})]}),m.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"0.5rem"},children:[m.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[m.jsx(Vt,{label:p("inputs.social.icon")}),m.jsx(Zs,{fullWidth:!0,labelId:"demo-simple-select-label",id:"demo-simple-select",value:t.key,size:"small",onChange:D,children:Yf.map(x=>m.jsx(T.MenuItem,{value:x.key,children:x.label},`${t.id}_${x.key}`))})]}),m.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[m.jsx(Vt,{label:p("inputs.social.url")}),m.jsx(T.TextField,{size:"small",fullWidth:!0,value:t.href??"",onChange:w,variant:"outlined",placeholder:"https://your-website.com",sx:eg})]})]})]}),u==="down"&&m.jsx(k,{})]})};function gq({items:t=[],onChange:e}){const{t:n}=Ke.useTranslation("inspector"),i=T.useTheme(),[r,a]=v.useState(()=>t.map(g=>({...g,id:g.id||Hu()}))),[s,o]=v.useState(t[0]?.theme||"default"),[l,c]=v.useState(t[0]?.size||"medium");v.useEffect(()=>{t.length>0&&(o(t[0].theme),c(t[0].size),a(t.map(g=>({...g,id:g.id||Hu()}))))},[t]);const u=(g,b)=>{a(y=>{const E=[...y],[S]=E.splice(g,1);return E.splice(b,0,S),e&&setTimeout(()=>e(E),0),E})},d=()=>{a(g=>{const b={...Yf[0],theme:s,size:l,sizePx:Nt(l),url:Ct(Yf[0].iconName,s,l),id:Hu()},y=[...g,b];return e&&setTimeout(()=>e(y),0),y})},p=g=>{a(b=>{const y=b.filter((E,S)=>S!==g);return e&&setTimeout(()=>e(y),0),y})},f=(g,b,y)=>{let E=[...r];if(b in fq?(o(b),E=E.map(S=>{const C=Ct(S.iconName,b,S.size);return{...S,theme:b,url:C}})):b in mq&&(c(b),E=E.map(S=>{const C=Ct(S.iconName,S.theme,b),D=Nt(b);return{...S,size:b,sizePx:D,url:C}})),g!==null&&y){const S=Yf.find(C=>C.key===b);S&&(E=E.map((C,D)=>{const w={key:S.key,label:S.label,iconName:S.iconName,href:S.href},k=Ct(w.iconName,y.theme,y.size);return D===g?{...C,...w,url:k,id:y.id}:C}))}a(E),e&&setTimeout(()=>e(E),0)},h=(g,b,y)=>{const E=r.map((S,C)=>C===g?{...y,href:b}:S);a(E),e&&setTimeout(()=>e(E),0)},_=g=>{a(b=>{const y={...JSON.parse(JSON.stringify(b[g])),id:Hu()},E=[...b.slice(0,g+1),y,...b.slice(g+1)];return e&&setTimeout(()=>e(E),0),E})};return m.jsxs(m.Fragment,{children:[m.jsxs("div",{style:{marginBottom:"1rem",display:"grid",gridTemplateColumns:"repeat(2,1fr)",gap:"1rem"},children:[m.jsxs(Wn,{children:[m.jsx(Vt,{label:n("inputs.social.theme")}),m.jsx(Zs,{fullWidth:!0,labelId:"theme-selector",id:"theme-selector",value:s,size:"small",onChange:g=>f(null,g.target.value,null),children:CL.map(g=>m.jsx(T.MenuItem,{value:g.key,children:g.label},`${g.key}`))})]}),m.jsxs(Wn,{children:[m.jsx(Vt,{label:n("inputs.social.size")}),m.jsx(Zs,{fullWidth:!0,labelId:"size-selector",id:"size-selector",value:l,size:"small",onChange:g=>f(null,g.target.value,null),children:oT.map(g=>m.jsx(T.MenuItem,{value:g.key,children:g.label},`${g.key}`))})]})]}),r?.map((g,b)=>m.jsx(hq,{element:g,index:b,moveItem:u,onSelectChange:f,onUrlChange:h,onRemove:p,onDuplicate:_,canRemove:r.length>1,theme:i},g.id)),m.jsx(T.Button,{onClick:d,sx:{borderRadius:1},variant:"contained",endIcon:m.jsx($.Add,{}),children:"Add"})]})}const _q=({data:t,setData:e})=>{const[,n]=v.useState(null),i=dn(),{t:r}=Ke.useTranslation("inspector"),a=u=>{const d=vL.safeParse(u);d.success?(e(d.data),n(null)):n(d.error)},s=u=>{a({...t,items:u})},o=u=>{a({...t,style:u})},l=(u,d=!1)=>{if(d){a({...t,gapMobile:u});return}a({...t,gap:u})},c=va();return m.jsxs(Cr,{title:r("inputs.panels.social.title"),children:[c=="block-configuration"&&m.jsx(T.Box,{sx:{minWidth:120,margin:1},children:m.jsx(gq,{items:t?.items||[],onChange:s})}),c=="css"&&m.jsxs(m.Fragment,{children:[m.jsxs(Wn,{children:[m.jsx(Vt,{label:r("inputs.panels.social.gap")}),i=="desktop"?m.jsx(cn,{iconLabel:m.jsx($.SpaceBar,{sx:{color:"text.primary"}}),value:t?.gap??4,setValue:l,marks:!0,step:4,units:"px",min:0,max:40}):m.jsx(cn,{iconLabel:m.jsx($.SpaceBar,{sx:{color:"text.primary"}}),value:t?.gapMobile??t?.gap??4,setValue:u=>l(u,!0),marks:!0,step:4,units:"px",min:0,max:40})]}),m.jsx(di,{names:["textAlign","textAlignMobile","backgroundColor","padding","mobilePadding"],value:t.style,onChange:u=>o(u)})]})]})},bq=Me().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),kL=Le({style:Le({height:se().optional().nullable(),heightMobile:se().optional().nullable(),background:Me().nullable().optional(),backgroundColor:bq}).optional().nullable()}),uD={height:16};function xL({style:t,blockId:e}){const i=dn()==="desktop"?t?.height??uD.height:t?.heightMobile??t?.height??uD.height,r=t?.background??"",a=t?.backgroundColor??"",s=a?Tl(r,a):r,o={width:"100%",minWidth:"100%",backgroundColor:a||void 0,background:s||void 0},l=dt(e);return m.jsx("table",{className:l,width:"100%",style:o,children:m.jsx("tbody",{children:m.jsx("tr",{className:`it${l}`,height:i,style:{height:i},children:m.jsx("td",{})})})})}function DL({data:t,setData:e}){const[,n]=v.useState(null),{t:i}=Ke.useTranslation("inspector"),r=a=>{const s=kL.safeParse(a);s.success?(e(s.data),n(null)):n(s.error)};return m.jsx(Cr,{title:i("inputs.panels.spacer.title"),children:m.jsx(di,{names:["height","heightMobile","backgroundColor"],value:t.style,onChange:a=>r({...t,style:a})})})}function yq({data:t,setData:e}){const n=va(),{t:i}=Ke.useTranslation("inspector"),r=t.style||{},a=s=>{const o={...r||{},...s||{}};e({...t,style:o})};return m.jsxs(Cr,{title:i("inputs.panels.notionText.title","Notion Text"),children:[n==="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{style:{display:"flex",gap:"8px"},children:[m.jsx("div",{style:{flex:1},children:m.jsx(di,{disabledCSSValidation:!0,names:["fontFamily"],value:r,onChange:a})}),m.jsx("div",{style:{flex:1},children:m.jsx(di,{disabledCSSValidation:!0,names:["lineHeight"],value:r,onChange:a})})]}),m.jsx(di,{disabledCSSValidation:!0,names:["fontSize","fontSizeMobile"],value:r,onChange:a})]}),n==="css"&&m.jsx(di,{names:["backgroundColor","border","borderMobile","padding","mobilePadding"],value:r,onChange:a})]})}function dD(t){return m.jsx(T.Box,{sx:{m:3,p:1,border:"1px dashed",borderColor:"divider"},children:m.jsx(T.Typography,{color:"text.secondary",children:t})})}function Eq(){const t=Jc(),e=LP(t||"");if(!t)return dD("Click on a block to inspect.");if(!e)return dD(`Block with id ${t} was not found. Click on a block to reset.`);const{data:n,type:i}=e,r=v.useCallback(a=>{Yv(t,()=>a)},[t]);switch(i){case"Avatar":return m.jsx(M7,{data:n,setData:a=>r({type:i,data:a})},t);case"Button":return m.jsx(U7,{data:n,setData:a=>r({type:i,data:a})},t);case"ColumnsContainer":return m.jsx(W7,{data:n,setData:a=>r({type:i,data:a})},t);case"Container":return m.jsx(pL,{data:n,setData:a=>r({type:i,data:a})},t);case"Divider":return m.jsx(hL,{data:n,setData:a=>r({type:i,data:a})},t);case"Heading":return m.jsx(rq,{data:n,setData:a=>r({type:i,data:a})},t);case"Html":return m.jsx(oq,{data:n,setData:a=>r({type:i,data:a})},t);case"Image":return m.jsx(uq,{data:n,setData:a=>r({type:i,data:a})},t);case"EmailLayout":return m.jsx(_L,{data:n,setData:a=>r({type:i,data:a})},t);case"Spacer":return m.jsx(DL,{data:n,setData:a=>r({type:i,data:a})},t);case"NotionText":return m.jsx(yq,{data:n,setData:a=>r({type:i,data:a})},t);case"SocialMedia":return m.jsx(_q,{data:n,setData:a=>r({type:i,data:a})},t);default:return m.jsx("pre",{children:JSON.stringify(e,null," ")})}}const Sq=v.memo(Eq),vq={EmailLayout:{label:"Email",iconName:"DashboardOutlined"},NotionText:{label:"Notion 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"},Heading:{label:"Heading",iconName:"Title"},Html:{label:"HTML",iconName:"CodeOutlined"},Avatar:{label:"Avatar",iconName:"AccountCircleOutlined"}},Tq=t=>e=>e.document[t];function Cq(t){const e=t.document;if(!e||!e.root)return null;function n(r,a){const s=a.document[r];if(!s)return[];switch(s.type){case"EmailLayout":return s.data?.childrenIds||[];case"Container":return s.data?.props?.childrenIds||[];case"ColumnsContainer":return s.data?.props?.columns?.flatMap(o=>o.childrenIds||[])||[];default:return[]}}function i(r,a,s){const l=s.document[r]?.type??"Unknown",c=vq[l]??{label:l,iconName:"WidgetsOutlined"},d=n(r,s).map(p=>i(p,a+1,s));return{blockId:r,type:l,label:c.label,iconName:c.iconName,children:d,depth:a}}return i("root",0,t)}function kq(t){return ne(t)}function xq(t){return ne(Tq(t))}function Dq(){const t=Jc(),e=xq(t??"root");if(!e)return null;const{data:n,type:i}=e,r=v.useCallback(s=>{t&&Yv(t,()=>s)},[t]),a=v.useCallback(s=>{Yv("root",()=>s)},[]);switch(i){case"Container":return m.jsx(pL,{data:n,setData:s=>r({type:i,data:s})},t);case"Divider":return m.jsx(hL,{data:n,setData:s=>r({type:i,data:s})},t);case"Spacer":return m.jsx(DL,{data:n,setData:s=>r({type:i,data:s})},t);case"EmailLayout":return m.jsx(_L,{data:n,setData:s=>a({type:i,data:s})},"root");default:return m.jsx("pre",{children:JSON.stringify(e,null," ")})}}function wq({sticky:t,heightContent:e}){const n=va(),i=PP(),r=Jc(),a=dn(),s=T.useTheme(),{t:o}=Ke.useTranslation("inspector"),l=()=>{const f={position:"absolute",top:"1rem",right:"0rem",height:"24px",lineHeight:"normal",width:"fit",fontSize:"12px"};switch(n){case"block-configuration":case"css":return m.jsxs("div",{style:{position:"relative"},children:[m.jsx(T.Chip,{color:"primary",sx:f,label:`${o(a==="desktop"?"header.desktop":"header.mobile")}`}),m.jsx(Sq,{})]});case"styles":return m.jsxs("div",{style:{position:"relative"},children:[m.jsx(Dq,{}),m.jsx(T.Chip,{color:"primary",sx:f,label:`${o(a==="desktop"?"header.desktop":"header.mobile")}`})]})}},c=()=>m.jsx("svg",{style:{marginRight:"4px",color:"inherit"},width:"21",height:"20",viewBox:"0 0 21 20",fill:"none",children:m.jsx("path",{d:"M3.83398 5H17.1673M3.83398 10H17.1673M3.83398 15H9.66732",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),u=()=>m.jsx("svg",{style:{marginRight:"4px",color:"inherit"},width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:m.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"})});v.useEffect(()=>{const f=h=>{const _=h.target;Tx(_.innerWidth)};return window&&Tx(window.innerWidth),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}},[n]);const d=(f,h)=>{Wz(h)},p=t?e?`calc(${e} - ${ys})`:void 0:e??void 0;return m.jsxs(T.Container,{sx:f=>({width:Tm,padding:"0!important",margin:"0!important",height:p,maxHeight:p,display:"flex",flexDirection:"column",overflow:"hidden",position:t?"sticky":"static",top:t?ys:0,backgroundColor:`${f.palette.background.paper} !important`}),children:[m.jsx(T.Box,{sx:{position:"sticky",top:0,zIndex:1,backgroundColor:`${s.palette.background.paper} !important`},children:m.jsxs(T.Tabs,{sx:{backgroundColor:`${s.palette.background.paper} !important`},value:n,onChange:d,children:[r!=null&&!_m.includes(i||"")&&[m.jsx(T.Tab,{sx:{height:ys,minHeight:ys,fontWeight:"bold"},value:"block-configuration",label:o("header.content"),icon:m.jsx(c,{}),iconPosition:"start"},"block-configuration"),m.jsx(T.Tab,{sx:{height:ys,minHeight:ys,fontWeight:"bold"},value:"css",label:o("header.styles"),icon:m.jsx(u,{}),iconPosition:"start"},"css")],_m.includes(i)&&[m.jsx(T.Tab,{sx:{height:ys,minHeight:ys,fontWeight:"bold"},value:"styles",label:o("header.styles"),icon:m.jsx(u,{}),iconPosition:"start"},"styles")]]})}),m.jsx(T.Container,{sx:f=>({flex:"1 1 auto",minHeight:0,overflowY:"auto",px:2,backgroundColor:`${f.palette.background.paper} !important`}),children:l()})]})}const wL=({children:t,topOffset:e=0,zIndex:n=10,className:i="",style:r={},disabled:a=!1,threshold:s=null,...o})=>{const[l,c]=v.useState(!1),[u,d]=v.useState({width:0,height:0}),[p,f]=v.useState({left:0}),[h,_]=v.useState(0),[g,b]=v.useState(!1),y=v.useRef(null),E=v.useRef(null),S=v.useRef(null);v.useEffect(()=>{if(a){c(!1),b(!1),_(0);return}const w=E.current,k=y.current;if(!w||!k)return;let x=null;s&&(s.startsWith("#")?x=document.getElementById(s.slice(1)):(s.startsWith("."),x=document.querySelector(s)));const O=()=>{const z=k.getBoundingClientRect();d({width:z.width,height:z.height}),f({left:z.left})},A=()=>{if(!x||!k)return{offset:0,isPushed:!1};const z=x.getBoundingClientRect(),F=k.getBoundingClientRect(),K=e+F.height;if(z.top<K){const re=K-z.top,ke=F.height+20;return{offset:-Math.min(re,ke),isPushed:!0}}return{offset:0,isPushed:!1}},X=new IntersectionObserver(([z])=>{const F=!z.isIntersecting;if(F&&!l&&O(),c(F),F&&s){const{offset:K,isPushed:re}=A();_(K),b(re)}else F||(_(0),b(!1))},{threshold:0,rootMargin:`-${e}px 0px 0px 0px`}),P=new ResizeObserver(()=>{O()}),Y=()=>{if(s&&l){const{offset:z,isPushed:F}=A();_(z),b(F)}};return X.observe(w),P.observe(k),s&&window.addEventListener("scroll",Y,{passive:!0}),O(),()=>{X.disconnect(),P.disconnect(),s&&window.removeEventListener("scroll",Y)}},[e,l,a,s]);const C=!a&&l,D=C?`${e+h}px`:"auto";return m.jsxs("div",{ref:S,className:i,...o,children:[!a&&m.jsx("div",{ref:E,style:{height:"1px",position:"absolute",top:`-${e+1}px`,left:0,right:0,pointerEvents:"none"}}),C&&m.jsx("div",{style:{height:`${u.height}px`,width:`${u.width}px`}}),m.jsx("div",{ref:y,style:{position:C?"fixed":"static",top:D,width:"auto",height:"auto",zIndex:C?n:"auto",transition:g?"none":"box-shadow 0.2s ease-in-out, top 0.3s ease-out",...g&&h<-u.height*.3&&{opacity:Math.max(0,1+(h+u.height*.3)/(u.height*.7))},...r},children:t})]})};var AL=mP();function $n(t){this.content=t}$n.prototype={constructor:$n,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var i=n&&n!=t?this.remove(n):this,r=i.find(t),a=i.content.slice();return r==-1?a.push(n||t,e):(a[r+1]=e,n&&(a[r]=n)),new $n(a)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new $n(n)},addToStart:function(t,e){return new $n([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new $n(n)},addBefore:function(t,e,n){var i=this.remove(e),r=i.content.slice(),a=i.find(t);return r.splice(a==-1?r.length:a,0,e,n),new $n(r)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=$n.from(t),t.size?new $n(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=$n.from(t),t.size?new $n(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=$n.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};$n.from=function(t){if(t instanceof $n)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new $n(e)};function NL(t,e,n){for(let i=0;;i++){if(i==t.childCount||i==e.childCount)return t.childCount==e.childCount?null:n;let r=t.child(i),a=e.child(i);if(r==a){n+=r.nodeSize;continue}if(!r.sameMarkup(a))return n;if(r.isText&&r.text!=a.text){for(let s=0;r.text[s]==a.text[s];s++)n++;return n}if(r.content.size||a.content.size){let s=NL(r.content,a.content,n+1);if(s!=null)return s}n+=r.nodeSize}}function IL(t,e,n,i){for(let r=t.childCount,a=e.childCount;;){if(r==0||a==0)return r==a?null:{a:n,b:i};let s=t.child(--r),o=e.child(--a),l=s.nodeSize;if(s==o){n-=l,i-=l;continue}if(!s.sameMarkup(o))return{a:n,b:i};if(s.isText&&s.text!=o.text){let c=0,u=Math.min(s.text.length,o.text.length);for(;c<u&&s.text[s.text.length-c-1]==o.text[o.text.length-c-1];)c++,n--,i--;return{a:n,b:i}}if(s.content.size||o.content.size){let c=IL(s.content,o.content,n-1,i-1);if(c)return c}n-=l,i-=l}}class J{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let i=0;i<e.length;i++)this.size+=e[i].nodeSize}nodesBetween(e,n,i,r=0,a){for(let s=0,o=0;o<n;s++){let l=this.content[s],c=o+l.nodeSize;if(c>e&&i(l,r+o,a||null,s)!==!1&&l.content.size){let u=o+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),i,r+u)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,i,r){let a="",s=!0;return this.nodesBetween(e,n,(o,l)=>{let c=o.isText?o.text.slice(Math.max(e,l)-l,n-l):o.isLeaf?r?typeof r=="function"?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&i&&(s?s=!1:a+=i),a+=c},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,i=e.firstChild,r=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(i)&&(r[r.length-1]=n.withText(n.text+i.text),a=1);a<e.content.length;a++)r.push(e.content[a]);return new J(r,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let i=[],r=0;if(n>e)for(let a=0,s=0;s<n;a++){let o=this.content[a],l=s+o.nodeSize;l>e&&((s<e||l>n)&&(o.isText?o=o.cut(Math.max(0,e-s),Math.min(o.text.length,n-s)):o=o.cut(Math.max(0,e-s-1),Math.min(o.content.size,n-s-1))),i.push(o),r+=o.nodeSize),s=l}return new J(i,r)}cutByIndex(e,n){return e==n?J.empty:e==0&&n==this.content.length?this:new J(this.content.slice(e,n))}replaceChild(e,n){let i=this.content[e];if(i==n)return this;let r=this.content.slice(),a=this.size+n.nodeSize-i.nodeSize;return r[e]=n,new J(r,a)}addToStart(e){return new J([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new J(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,i=0;n<this.content.length;n++){let r=this.content[n];e(r,i,n),i+=r.nodeSize}}findDiffStart(e,n=0){return NL(this,e,n)}findDiffEnd(e,n=this.size,i=e.size){return IL(this,e,n,i)}findIndex(e){if(e==0)return sf(0,e);if(e==this.size)return sf(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,i=0;;n++){let r=this.child(n),a=i+r.nodeSize;if(a>=e)return a==e?sf(n+1,a):sf(n,i);i=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return J.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new J(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return J.empty;let n,i=0;for(let r=0;r<e.length;r++){let a=e[r];i+=a.nodeSize,r&&a.isText&&e[r-1].sameMarkup(a)?(n||(n=e.slice(0,r)),n[n.length-1]=a.withText(n[n.length-1].text+a.text)):n&&n.push(a)}return new J(n||e,i)}static from(e){if(!e)return J.empty;if(e instanceof J)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new J([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}J.empty=new J([],0);const S_={index:0,offset:0};function sf(t,e){return S_.index=t,S_.offset=e,S_}function $m(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!$m(t[i],e[i]))return!1}else{for(let i in t)if(!(i in e)||!$m(t[i],e[i]))return!1;for(let i in e)if(!(i in t))return!1}return!0}let Ut=class o1{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,i=!1;for(let r=0;r<e.length;r++){let a=e[r];if(this.eq(a))return e;if(this.type.excludes(a.type))n||(n=e.slice(0,r));else{if(a.type.excludes(this.type))return e;!i&&a.type.rank>this.type.rank&&(n||(n=e.slice(0,r)),n.push(this),i=!0),n&&n.push(a)}}return n||(n=e.slice()),i||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&$m(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let i=e.marks[n.type];if(!i)throw new RangeError(`There is no mark type ${n.type} in this schema`);let r=i.create(n.attrs);return i.checkAttrs(r.attrs),r}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let i=0;i<e.length;i++)if(!e[i].eq(n[i]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return o1.none;if(e instanceof o1)return[e];let n=e.slice();return n.sort((i,r)=>i.type.rank-r.type.rank),n}};Ut.none=[];class zm extends Error{}class be{constructor(e,n,i){this.content=e,this.openStart=n,this.openEnd=i}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let i=RL(this.content,e+this.openStart,n);return i&&new be(i,this.openStart,this.openEnd)}removeBetween(e,n){return new be(OL(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return be.empty;let i=n.openStart||0,r=n.openEnd||0;if(typeof i!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new be(J.fromJSON(e,n.content),i,r)}static maxOpen(e,n=!0){let i=0,r=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)i++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)r++;return new be(e,i,r)}}be.empty=new be(J.empty,0,0);function OL(t,e,n){let{index:i,offset:r}=t.findIndex(e),a=t.maybeChild(i),{index:s,offset:o}=t.findIndex(n);if(r==e||a.isText){if(o!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(i!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(i,a.copy(OL(a.content,e-r-1,n-r-1)))}function RL(t,e,n,i){let{index:r,offset:a}=t.findIndex(e),s=t.maybeChild(r);if(a==e||s.isText)return i&&!i.canReplace(r,r,n)?null:t.cut(0,e).append(n).append(t.cut(e));let o=RL(s.content,e-a-1,n,s);return o&&t.replaceChild(r,s.copy(o))}function Aq(t,e,n){if(n.openStart>t.depth)throw new zm("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new zm("Inconsistent open depths");return ML(t,e,n,0)}function ML(t,e,n,i){let r=t.index(i),a=t.node(i);if(r==e.index(i)&&i<t.depth-n.openStart){let s=ML(t,e,n,i+1);return a.copy(a.content.replaceChild(r,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==i&&e.depth==i){let s=t.parent,o=s.content;return Xo(s,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:s,end:o}=Nq(n,t);return Xo(a,LL(t,s,o,e,i))}else return Xo(a,Gm(t,e,i))}function PL(t,e){if(!e.type.compatibleContent(t.type))throw new zm("Cannot join "+e.type.name+" onto "+t.type.name)}function l1(t,e,n){let i=t.node(n);return PL(i,e.node(n)),i}function Qo(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function md(t,e,n,i){let r=(e||t).node(n),a=0,s=e?e.index(n):r.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(Qo(t.nodeAfter,i),a++));for(let o=a;o<s;o++)Qo(r.child(o),i);e&&e.depth==n&&e.textOffset&&Qo(e.nodeBefore,i)}function Xo(t,e){return t.type.checkContent(e),t.copy(e)}function LL(t,e,n,i,r){let a=t.depth>r&&l1(t,e,r+1),s=i.depth>r&&l1(n,i,r+1),o=[];return md(null,t,r,o),a&&s&&e.index(r)==n.index(r)?(PL(a,s),Qo(Xo(a,LL(t,e,n,i,r+1)),o)):(a&&Qo(Xo(a,Gm(t,e,r+1)),o),md(e,n,r,o),s&&Qo(Xo(s,Gm(n,i,r+1)),o)),md(i,null,r,o),new J(o)}function Gm(t,e,n){let i=[];if(md(null,t,n,i),t.depth>n){let r=l1(t,e,n+1);Qo(Xo(r,Gm(t,e,n+1)),i)}return md(e,null,n,i),new J(i)}function Nq(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)r=e.node(a).copy(J.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class Yd{constructor(e,n,i){this.pos=e,this.path=n,this.parentOffset=i,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let i=this.pos-this.path[this.path.length-1],r=e.child(n);return i?e.child(n).cut(i):r}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let i=this.path[n*3],r=n==0?0:this.path[n*3-1]+1;for(let a=0;a<e;a++)r+=i.child(a).nodeSize;return r}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Ut.none;if(this.textOffset)return e.child(n).marks;let i=e.maybeChild(n-1),r=e.maybeChild(n);if(!i){let o=i;i=r,r=o}let a=i.marks;for(var s=0;s<a.length;s++)a[s].type.spec.inclusive===!1&&(!r||!a[s].isInSet(r.marks))&&(a=a[s--].removeFromSet(a));return a}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let i=n.marks,r=e.parent.maybeChild(e.index());for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let i=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);i>=0;i--)if(e.pos<=this.end(i)&&(!n||n(this.node(i))))return new qm(this,e,i);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let i=[],r=0,a=n;for(let s=e;;){let{index:o,offset:l}=s.content.findIndex(a),c=a-l;if(i.push(s,o,r+l),!c||(s=s.child(o),s.isText))break;a=c-1,r+=l+1}return new Yd(n,i,a)}static resolveCached(e,n){let i=pD.get(e);if(i)for(let a=0;a<i.elts.length;a++){let s=i.elts[a];if(s.pos==n)return s}else pD.set(e,i=new Iq);let r=i.elts[i.i]=Yd.resolve(e,n);return i.i=(i.i+1)%Oq,r}}class Iq{constructor(){this.elts=[],this.i=0}}const Oq=12,pD=new WeakMap;class qm{constructor(e,n,i){this.$from=e,this.$to=n,this.depth=i}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Rq=Object.create(null);class Pr{constructor(e,n,i,r=Ut.none){this.type=e,this.attrs=n,this.marks=r,this.content=i||J.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,i,r=0){this.content.nodesBetween(e,n,i,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,i,r){return this.content.textBetween(e,n,i,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,i){return this.type==e&&$m(this.attrs,n||e.defaultAttrs||Rq)&&Ut.sameSet(this.marks,i||Ut.none)}copy(e=null){return e==this.content?this:new Pr(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Pr(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,i=!1){if(e==n)return be.empty;let r=this.resolve(e),a=this.resolve(n),s=i?0:r.sharedDepth(n),o=r.start(s),c=r.node(s).content.cut(r.pos-o,a.pos-o);return new be(c,r.depth-s,a.depth-s)}replace(e,n,i){return Aq(this.resolve(e),this.resolve(n),i)}nodeAt(e){for(let n=this;;){let{index:i,offset:r}=n.content.findIndex(e);if(n=n.maybeChild(i),!n)return null;if(r==e||n.isText)return n;e-=r+1}}childAfter(e){let{index:n,offset:i}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:i}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:i}=this.content.findIndex(e);if(i<e)return{node:this.content.child(n),index:n,offset:i};let r=this.content.child(n-1);return{node:r,index:n-1,offset:i-r.nodeSize}}resolve(e){return Yd.resolveCached(this,e)}resolveNoCache(e){return Yd.resolve(this,e)}rangeHasMark(e,n,i){let r=!1;return n>e&&this.nodesBetween(e,n,a=>(i.isInSet(a.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),FL(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,i=J.empty,r=0,a=i.childCount){let s=this.contentMatchAt(e).matchFragment(i,r,a),o=s&&s.matchFragment(this.content,n);if(!o||!o.validEnd)return!1;for(let l=r;l<a;l++)if(!this.type.allowsMarks(i.child(l).marks))return!1;return!0}canReplaceWith(e,n,i,r){if(r&&!this.type.allowsMarks(r))return!1;let a=this.contentMatchAt(e).matchType(i),s=a&&a.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ut.none;for(let n=0;n<this.marks.length;n++){let i=this.marks[n];i.type.checkAttrs(i.attrs),e=i.addToSet(e)}if(!Ut.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let i;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");i=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,i)}let r=J.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,r,i);return a.type.checkAttrs(a.attrs),a}}Pr.prototype.text=void 0;class Hm extends Pr{constructor(e,n,i,r){if(super(e,n,null,r),!i)throw new RangeError("Empty text nodes are not allowed");this.text=i}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):FL(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Hm(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Hm(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function FL(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class cl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let i=new Mq(e,n);if(i.next==null)return cl.empty;let r=BL(i);i.next&&i.err("Unexpected trailing text");let a=zq($q(r));return Gq(a,i),a}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,i=e.childCount){let r=this;for(let a=n;r&&a<i;a++)r=r.matchType(e.child(a).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let i=0;i<e.next.length;i++)if(this.next[n].type==e.next[i].type)return!0;return!1}fillBefore(e,n=!1,i=0){let r=[this];function a(s,o){let l=s.matchFragment(e,i);if(l&&(!n||l.validEnd))return J.from(o.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&r.indexOf(d)==-1){r.push(d);let p=a(d,o.concat(u));if(p)return p}}return null}return a(this,[])}findWrapping(e){for(let i=0;i<this.wrapCache.length;i+=2)if(this.wrapCache[i]==e)return this.wrapCache[i+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),i=[{match:this,type:null,via:null}];for(;i.length;){let r=i.shift(),a=r.match;if(a.matchType(e)){let s=[];for(let o=r;o.type;o=o.via)s.push(o.type);return s.reverse()}for(let s=0;s<a.next.length;s++){let{type:o,next:l}=a.next[s];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in n)&&(!r.type||l.validEnd)&&(i.push({match:o.contentMatch,type:o,via:r}),n[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(i){e.push(i);for(let r=0;r<i.next.length;r++)e.indexOf(i.next[r].next)==-1&&n(i.next[r].next)}return n(this),e.map((i,r)=>{let a=r+(i.validEnd?"*":" ")+" ";for(let s=0;s<i.next.length;s++)a+=(s?", ":"")+i.next[s].type.name+"->"+e.indexOf(i.next[s].next);return a}).join(`
47
+ Please report this to https://github.com/markedjs/marked.`,e){const r="<p>An error occurred:</p><pre>"+Ui(i.message+"",!0)+"</pre>";return n?Promise.resolve(r):r}if(n)return Promise.reject(i);throw i}};const il=new Oz;function Rt(t,e){return il.parse(t,e)}Rt.options=Rt.setOptions=function(t){return il.setOptions(t),Rt.defaults=il.defaults,CP(Rt.defaults),Rt};Rt.getDefaults=G0;Rt.defaults=Sl;Rt.use=function(...t){return il.use(...t),Rt.defaults=il.defaults,CP(Rt.defaults),Rt};Rt.walkTokens=function(t,e){return il.walkTokens(t,e)};Rt.parseInline=il.parseInline;Rt.Parser=ca;Rt.parser=ca.parse;Rt.Renderer=vm;Rt.TextRenderer=W0;Rt.Lexer=la;Rt.lexer=la.lex;Rt.Tokenizer=Em;Rt.Hooks=ud;Rt.parse=Rt;Rt.options;Rt.setOptions;Rt.use;Rt.walkTokens;Rt.parseInline;ca.parse;la.lex;function Rz(t){return String(t??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Mz(t){const e=String(t?.text??"");if(t?.markdown===!0){const n=Rt.parse(e,{async:!1});return typeof n=="string"?n:String(n)}return`<p>${Rz(e)}</p>`}function hc(t){const e={...t};for(const[n,i]of Object.entries(e)){const r=i.type;if(r==="CustomEditor"||r==="Wysiwyg")e[n]={...i,type:"NotionText"};else if(r==="Text"){const a=i.data??{},s=a.props??{},o=Mz(s);e[n]={...i,type:"NotionText",data:{...a,props:{html:o}}}}}return e}const Pz=10,Lz=.4,Tm=385,$d="https://maildrill.s3.eu-south-1.amazonaws.com/assets/emailbuilder-placeholder.jpg";let m_=null;const Fz=2e3;function Ep(){m_&&clearTimeout(m_),m_=setTimeout(()=>{const t=new CustomEvent("email-builder-auto-save",{detail:!0});window.dispatchEvent(t)},Fz)}const Bz=()=>({document:hc(JSON.parse(JSON.stringify(M$))),selectedBlockId:null,selectedSidebarTab:"styles",selectedMainTab:"editor",selectedScreenSize:"desktop",windowWidth:0,inspectorDrawerOpen:!0,componentTreeOpen:!1,samplesDrawerOpen:!0,inspectorDrawerWidth:Tm,devMode:!1,imageUploading:{uploading:!1,id:""},disableEdition:!1,disableUpdate:!1,freeMode:!1,minHeight:"calc(100dvh - 65px)",color:{primary:"",secondary:""},galleryImages:!0,imagePlaceholder:$d,darkMode:!0,colorPicker:{paletteColors:R$,isLocked:!1},tour:!1,stickyHeader:!0,heightContent:"calc(100dvh - 50px)",containerGrow:!0,notionTextInlineEditingBlockId:null,highlightColor:"#FF6B35"}),ne=_P(()=>Bz());v.createContext(ne);function PP(){const t=ne(e=>e.document[ne(n=>n.selectedBlockId)||""]);return t?t.type:null}function Tx(t){return ne.setState({windowWidth:t})}function Uz(){return ne(t=>t.devMode)}function $z(t){return ne.setState({devMode:t})}function K0(){return ne(t=>t.document)}function LP(t){return ne(e=>e.document[t])}function zz(t){return ne(e=>e.document[t]?.type)}function Gz(t){return ne(e=>e.selectedBlockId===t)}function Jc(){return ne(t=>t.selectedBlockId)}function Sp(){return ne(t=>t.notionTextInlineEditingBlockId)}function Cx(t){return ne.setState({notionTextInlineEditingBlockId:t})}function qz(){return!!Sp()}function Hz(){return Sp()}function jz(){return ne(t=>t.highlightColor)}function dn(){return ne(t=>t.selectedScreenSize)}function Q0(){return ne(t=>t.selectedMainTab)}function nf(t){return t==="preview"&&Hi(null),ne.setState({inspectorDrawerOpen:t==="editor"}),ne.setState({selectedMainTab:t})}function va(){return ne(t=>t.selectedSidebarTab)}function Vz(){return ne(t=>t.inspectorDrawerOpen)}function X0(){return ne(t=>t.componentTreeOpen)}function jv(){ne.setState(t=>({componentTreeOpen:!t.componentTreeOpen}))}function Jh(){return ne(t=>t.imageUploading)}function Yz(){return ne(t=>t.disableEdition)}function Hi(t){Dc();const e=ne.getState().document[t||""]?.type,n=_m.includes(e||null)?"styles":"block-configuration",i={};return t!==null&&ne.getState().selectedMainTab==="editor"&&(i.inspectorDrawerOpen=!0),ne.setState({selectedBlockId:t,selectedSidebarTab:n,...i})}function Wz(t){return ne.setState({selectedSidebarTab:t})}function uc(t){const e=ne.getState().document,n=hc(t);return Ur(e,n),X$(),ne.setState({document:n,selectedSidebarTab:"styles",selectedBlockId:null})}const Cm=(t,e,n=5,i=0)=>{if(t===e)return!0;if(t===null||e===null||t===void 0||e===void 0)return t===e;if(typeof t!=typeof e)return!1;if(typeof t!="object")return t===e;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(i<n){if(!Cm(t[s],e[s],n,i+1))return!1}else if(t[s]!==e[s])return!1;return!0}if(i>=n)try{return JSON.stringify(t)===JSON.stringify(e)}catch{return!1}const r=Object.keys(t),a=Object.keys(e);if(r.length!==a.length)return!1;for(const s of r){if(!a.includes(s))return!1;const o=t[s],l=e[s];if(!Cm(o,l,n,i+1))return!1}return!0};function Kz(t){return typeof t=="string"}function FP(t){return Kz(t)?{version:1,type:"full",doc:t}:t}function BP(t,e){const n=FP(t);if(n.type==="full")return JSON.parse(n.doc);const i=BP(e[n.baseIndex],e);return gp(Hn(i),Hn(n.ops),!1,!1,!0).newDocument}function J0(t,e){if(t<0||t>=e.length)throw new Error(`reconstructFromPatch: índice ${t} fuera de rango [0, ${e.length})`);const n=e[t],i=FP(n);if(i.type==="full")return JSON.parse(i.doc);const r=J0(i.baseIndex,e);return gp(Hn(r),Hn(i.ops),!1,!1,!0).newDocument}function Qz(t,e,n){const i=JSON.stringify(t),r=i.length;if(n<0)return{version:1,type:"full",doc:i};const a=BP(e[n],e),s=SP(a,t);if(s.length===0)return null;const o=JSON.stringify(s).length,l=e.length-n;return o>r*Lz||l>=Pz?{version:1,type:"full",doc:i}:{version:1,type:"patch",baseIndex:n,ops:s}}function Xz(t){for(let e=t.length-1;e>=0;e--)if(t[e].type==="full")return e;return-1}function dd(t){const e=_p(),n=Xz(e);return Qz(t,e,n)}function UP(t){return{version:1,type:"full",doc:JSON.stringify(t)}}let zd=[],wi=!1,ws=[];function Jz(t,e){const n=new Set,i=Object.keys(t),r=Object.keys(e);for(const a of r)(!t[a]||!Cm(t[a],e[a]))&&n.add(a);for(const a of i)e[a]||n.add(a);return[...n]}const Zz=1e3;let Bo=null;function $P(){Bo&&clearTimeout(Bo),Bo=setTimeout(()=>{zP(),Bo=null},Zz)}function eG(t){return t.map(e=>({original:e.original,new:e.new}))}function zP(){const t=[...zd];zd=[];const e=eG(t);for(const n of e)tG(n.original,n.new)}function Ur(t,e,n){const i={original:t,new:e,blockIds:n??Jz(t,e)};if(wi){ws.push(i);return}zd.push(i),$P()}function GP(t){const e=wi;wi=!0,ws=[];try{const n=t();if(ws.length>0){const i=ws[0],r=ws[ws.length-1];zd.push({original:i.original,new:r.new,blockIds:ws.flatMap(a=>a.blockIds??[])}),$P()}return n}finally{wi=e,ws=[]}}function Dc(){Bo&&(clearTimeout(Bo),Bo=null),zd.length>0&&zP();const{pendingUndoTimeout:t,pendingOriginalDocument:e}=vP();if(t)if(clearTimeout(t),e){const n=dd(e);if(n){const i=[..._p()];ia({stackUndo:[...i,n],pendingOriginalDocument:null,pendingUndoTimeout:null,lastChange:null})}else ia({pendingOriginalDocument:null,pendingUndoTimeout:null,lastChange:null})}else ia({pendingUndoTimeout:null,lastChange:null})}function tG(t,e){const{pendingUndoTimeout:r,pendingOriginalDocument:a,lastChange:s}=vP();let o=!0,l=null;const c=(f,h)=>{if(f?.type==="Image"&&h?.type==="Image"){const _=f.data.props?.width,g=h.data.props?.width;return _==null&&typeof g=="number"}return!1};if(t===e)return null;const u=Object.keys(t),d=Object.keys(e);if(u.length!==d.length)l=d.find(f=>!t[f])||u.find(f=>!e[f])||null;else for(const f of d){const h=t[f],_=e[f];if(h!==_){if(h&&_&&c(h,_)){o=!1;break}if(!Cm(h,_)){l=f;break}}}if(o&&l!==null){const f=Date.now(),h=[..._p()];if(h.length>=50&&h.shift(),l){if(s&&s.blockId!==l&&a){r&&clearTimeout(r);const _=dd(a);_&&ia({stackUndo:[...h,_],pendingOriginalDocument:null,pendingUndoTimeout:null,lastChange:null,stackRedo:[]})}if(s&&s.blockId===l&&f-s.timestamp<400){r&&clearTimeout(r);const _=setTimeout(()=>{const g=dd(a);g&&ia({stackUndo:[...h,g],pendingOriginalDocument:null,pendingUndoTimeout:null,lastChange:null,stackRedo:[]})},400);ia({pendingUndoTimeout:_,stackRedo:[],lastChange:{blockId:l,timestamp:f}})}else{r&&clearTimeout(r);const _=setTimeout(()=>{const g=dd(t);g&&ia({stackUndo:[...h,g],stackRedo:[],pendingOriginalDocument:null,pendingUndoTimeout:null,lastChange:null})},400);ia({pendingOriginalDocument:t,pendingUndoTimeout:_,stackRedo:[],lastChange:{blockId:l,timestamp:f}})}}}return null}function vp(t,e=!0){const n=ne.getState().document,i={...n,...t};e&&wi&&Ur(n,i);const r=()=>{ne.setState({document:i}),e&&!wi&&Promise.resolve().then(()=>Ur(n,i)),Ep();const a=new CustomEvent("email-builder-auto-save",{detail:e});window.dispatchEvent(a)};return e?(v.startTransition(r),ne.getState()):r()}function km(t){return ne.setState({selectedScreenSize:t})}function gc(t,e){return ne.setState({imageUploading:{uploading:t,id:e||""}})}function qP(t){return ne.setState({disableEdition:t})}function nG(){return ne.getState().document.root.data}function Zh(){return ne(t=>t.document?.root?.data)}function kx(){Dc();const t=ne.getState().document,e=_p(),n=TP();if(e.length===0)return;const i=[...e],r=i.length-1;i.pop();const a=ne.getState().selectedBlockId,s=J0(r,e);ia({stackUndo:i,stackRedo:[...n,UP(t)]}),s?.root?.data?.childrenIds?.includes(a)||Hi(null),ne.setState({document:s})}function xx(){Dc();const t=ne.getState().document,e=_p(),n=TP();if(n.length===0)return;const i=[...n],r=i.length-1;i.pop();const a=ne.getState().selectedBlockId,s=J0(r,n),o=dd(t)??UP(t);ia({stackUndo:[...e,o],stackRedo:i}),s?.root?.data?.childrenIds?.includes(a)||Hi(null),ne.setState({document:s})}function iG(t){return ne.setState({color:t})}function rG(t){return ne.setState({galleryImages:t})}function xm(){return ne.getState().galleryImages}function aG(t){return ne.setState({imagePlaceholder:t})}function sG(){return ne.getState().imagePlaceholder}function oG(t){return ne.setState({freeMode:t})}function Z0(){return ne.getState().freeMode}function lG(t){return ne.setState({darkMode:t})}function cG(t){return ne.setState({heightContent:t})}function uG(t){return ne.setState({containerGrow:t})}function dG(){return ne.getState().containerGrow}function Gd(t,e,n,i=!0){vl({draggedId:e,targetId:t})&&console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");const r=ne.getState().document,a=JSON.parse(JSON.stringify({...r})),s=u=>{if(!u||t===e)return u;const d=u.indexOf(e);return d<0?u:u.toSpliced(d,1)},o=u=>{if(!u||t===e)return u;const d=u.indexOf(t);if(d<0)return u;const p=n==="up"?d:d+1;return u.toSpliced(p,0,e)};let l=null,c=null;for(const[u,d]of Object.entries(a)){const p=d;if(c)break;switch(p.type){case"EmailLayout":p.data.childrenIds?.length&&p.data.childrenIds.includes(e)&&(c=u,a[u]={...p,data:{...p.data,childrenIds:s(p.data.childrenIds)}});break;case"Container":p.data.props?.childrenIds?.length&&p.data.props.childrenIds.includes(e)&&(c=u,a[u]={...p,data:{...p.data,props:{...p.data.props,childrenIds:s(p.data.props.childrenIds)}}});break;case"ColumnsContainer":if(p.data.props?.columns){let f=!1;const h=p.data.props.columns.map((_,g)=>_?.childrenIds?.includes(e)?(c=`${u}-column-${g}`,f=!0,{..._,childrenIds:s(_.childrenIds)}):_);f&&(a[u]={...p,data:{...p.data,props:{...p.data.props,columns:h}}})}break}}if(l=null,i)for(const[u,d]of Object.entries(a)){const p=d;if(l)break;switch(p.type){case"EmailLayout":p.data.childrenIds?.length&&p.data.childrenIds.includes(t)&&(l=u,a[u]={...p,data:{...p.data,childrenIds:o(p.data.childrenIds)}});break;case"Container":p.data.props?.childrenIds?.length&&p.data.props.childrenIds.includes(t)&&(l=u,a[u]={...p,data:{...p.data,props:{...p.data.props,childrenIds:o(p.data.props.childrenIds)}}});break;case"ColumnsContainer":if(p.data.props?.columns){const f=p.data.props.columns.map((h,_)=>h?.childrenIds?.includes(t)?(l=`${u}-column-${_}`,{...h,childrenIds:o(h.childrenIds)}):h);a[u]={...p,data:{...p.data,props:{...p.data.props,columns:f}}}}break}}return vp(a)}function pG({parentId:t,blockId:e,indexArray:n}){if(vl({draggedId:e,targetId:t})){console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");return}return GP(()=>{Gd("",e,"down",!1);const i=ne.getState().document,r=JSON.parse(JSON.stringify({...i}));if(!r[t])return;const a=r[t],s=[...a.data.props.columns||[]];return s[n||0]={childrenIds:[e]},r[t]={type:"ColumnsContainer",data:{...a.data,props:{...a.data.props,columns:s}}},vp(r)})}function fG({parentId:t,blockId:e}){if(vl({draggedId:e,targetId:t})){console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");return}return GP(()=>{Gd("",e,"down",!1);const n=ne.getState().document,i=JSON.parse(JSON.stringify({...n}));if(!i[t])return;const r=i[t];return i[t]={type:"Container",data:{...r.data,props:{...r.data.props,childrenIds:[e]}}},vp(i)})}function vl({draggedId:t,targetId:e}){if(t===e)return!0;const n=ne.getState().document;function i(r,a){const s=n[r];if(!s)return!1;let o=[];switch(s.type){case"EmailLayout":o=s.data.childrenIds||[];break;case"Container":o=s.data.props?.childrenIds||[];break;case"ColumnsContainer":s.data.props?.columns&&s.data.props.columns.forEach(l=>{l?.childrenIds&&(o=[...o,...l.childrenIds])});break}if(o.includes(a))return!0;for(const l of o)if(i(l,a))return!0;return!1}return i(t,e)}function mG(){return ne(t=>t.colorPicker)}function h_(t){ne.setState(e=>({colorPicker:{...e.colorPicker,...t}}))}function HP(t,e){const n=ne.getState().document,i=n[t];if(!i){console.warn(`Block ${t} not found`);return}const r=e(i);if(i===r)return;const a={...n,[t]:r},s=n;wi&&Ur(s,a,[t]),v.startTransition(()=>{ne.setState({document:a}),wi||Promise.resolve().then(()=>Ur(s,a,[t]))}),Ep()}function hG(t,e){const n=ne.getState().document,i=n[t];if(!i){console.warn(`Block ${t} not found`);return}const r=e(i);if(i===r)return;const a={...n,[t]:r},s=n;wi&&Ur(s,a,[t]),ne.setState({document:a}),wi||Promise.resolve().then(()=>Ur(s,a,[t])),Ep()}function gG(t,e){HP(t,n=>{const i=typeof e=="function"?e(n.data.props):{...n.data.props,...e};return{...n,data:{...n.data,props:i}}})}function Dx(t,e){hG(t,n=>{const i=typeof e=="function"?e(n.data.props):{...n.data.props,...e};return{...n,data:{...n.data,props:i}}})}function Vv(t,e,n,i){const r=ne.getState().document,a=r[t];if(!a)return;const s=a.type==="EmailLayout"?{...a,data:{...a.data,childrenIds:i}}:{...a,data:{...a.data,props:{...a.data?.props,childrenIds:i}}},o={...r,[e]:n,[t]:s};wi&&Ur(r,o,[t,e]),v.startTransition(()=>{ne.setState({document:o}),wi||Promise.resolve().then(()=>Ur(r,o,[t,e]))}),Ep()}function _G(t){const e=ne.getState().document,n={...e,...t};wi&&Ur(e,n,Object.keys(t)),v.startTransition(()=>{ne.setState({document:n}),wi||Promise.resolve().then(()=>Ur(e,n,Object.keys(t)))}),Ep()}function Yv(t,e){HP(t,e)}var St;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function n(r){throw new Error}t.assertNever=n,t.arrayToEnum=r=>{const a={};for(const s of r)a[s]=s;return a},t.getValidEnumValues=r=>{const a=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),s={};for(const o of a)s[o]=r[o];return t.objectValues(s)},t.objectValues=r=>t.objectKeys(r).map(function(a){return r[a]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const a=[];for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&a.push(s);return a},t.find=(r,a)=>{for(const s of r)if(a(s))return s},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function i(r,a=" | "){return r.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}t.joinValues=i,t.jsonStringifyReplacer=(r,a)=>typeof a=="bigint"?a.toString():a})(St||(St={}));var wx;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(wx||(wx={}));const ve=St.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Os=t=>{switch(typeof t){case"undefined":return ve.undefined;case"string":return ve.string;case"number":return Number.isNaN(t)?ve.nan:ve.number;case"boolean":return ve.boolean;case"function":return ve.function;case"bigint":return ve.bigint;case"symbol":return ve.symbol;case"object":return Array.isArray(t)?ve.array:t===null?ve.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ve.promise:typeof Map<"u"&&t instanceof Map?ve.map:typeof Set<"u"&&t instanceof Set?ve.set:typeof Date<"u"&&t instanceof Date?ve.date:ve.object;default:return ve.unknown}},ie=St.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Za extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(a){return a.message},i={_errors:[]},r=a=>{for(const s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(r);else if(s.code==="invalid_return_type")r(s.returnTypeError);else if(s.code==="invalid_arguments")r(s.argumentsError);else if(s.path.length===0)i._errors.push(n(s));else{let o=i,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(n(s))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return r(this),i}static assert(e){if(!(e instanceof Za))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,St.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},i=[];for(const r of this.issues)if(r.path.length>0){const a=r.path[0];n[a]=n[a]||[],n[a].push(e(r))}else i.push(e(r));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}}Za.create=t=>new Za(t);const Wv=(t,e)=>{let n;switch(t.code){case ie.invalid_type:t.received===ve.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case ie.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,St.jsonStringifyReplacer)}`;break;case ie.unrecognized_keys:n=`Unrecognized key(s) in object: ${St.joinValues(t.keys,", ")}`;break;case ie.invalid_union:n="Invalid input";break;case ie.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${St.joinValues(t.options)}`;break;case ie.invalid_enum_value:n=`Invalid enum value. Expected ${St.joinValues(t.options)}, received '${t.received}'`;break;case ie.invalid_arguments:n="Invalid function arguments";break;case ie.invalid_return_type:n="Invalid function return type";break;case ie.invalid_date:n="Invalid date";break;case ie.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:St.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case ie.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case ie.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case ie.custom:n="Invalid input";break;case ie.invalid_intersection_types:n="Intersection results could not be merged";break;case ie.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case ie.not_finite:n="Number must be finite";break;default:n=e.defaultError,St.assertNever(t)}return{message:n}};let bG=Wv;function yG(){return bG}const EG=t=>{const{data:e,path:n,errorMaps:i,issueData:r}=t,a=[...n,...r.path||[]],s={...r,path:a};if(r.message!==void 0)return{...r,path:a,message:r.message};let o="";const l=i.filter(c=>!!c).slice().reverse();for(const c of l)o=c(s,{data:e,defaultError:o}).message;return{...r,path:a,message:o}};function he(t,e){const n=yG(),i=EG({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Wv?void 0:Wv].filter(r=>!!r)});t.common.issues.push(i)}class gi{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const i=[];for(const r of n){if(r.status==="aborted")return Ge;r.status==="dirty"&&e.dirty(),i.push(r.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,n){const i=[];for(const r of n){const a=await r.key,s=await r.value;i.push({key:a,value:s})}return gi.mergeObjectSync(e,i)}static mergeObjectSync(e,n){const i={};for(const r of n){const{key:a,value:s}=r;if(a.status==="aborted"||s.status==="aborted")return Ge;a.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof s.value<"u"||r.alwaysSet)&&(i[a.value]=s.value)}return{status:e.value,value:i}}}const Ge=Object.freeze({status:"aborted"}),qu=t=>({status:"dirty",value:t}),Tr=t=>({status:"valid",value:t}),Ax=t=>t.status==="aborted",Nx=t=>t.status==="dirty",wc=t=>t.status==="valid",Dm=t=>typeof Promise<"u"&&t instanceof Promise;var we;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(we||(we={}));class ga{constructor(e,n,i,r){this._cachedPath=[],this.parent=e,this.data=n,this._path=i,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ix=(t,e)=>{if(wc(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Za(t.common.issues);return this._error=n,this._error}}};function nt(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:i,description:r}=t;if(e&&(n||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(s,o)=>{const{message:l}=t;return s.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??i??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:l??n??o.defaultError}},description:r}}class pt{get description(){return this._def.description}_getType(e){return Os(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Os(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new gi,ctx:{common:e.parent.common,data:e.data,parsedType:Os(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Dm(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const i=this.safeParse(e,n);if(i.success)return i.data;throw i.error}safeParse(e,n){const i={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Os(e)},r=this._parseSync({data:e,path:i.path,parent:i});return Ix(i,r)}"~validate"(e){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Os(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return wc(i)?{value:i.value}:{issues:n.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>wc(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){const i=await this.safeParseAsync(e,n);if(i.success)return i.data;throw i.error}async safeParseAsync(e,n){const i={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Os(e)},r=this._parse({data:e,path:i.path,parent:i}),a=await(Dm(r)?r:Promise.resolve(r));return Ix(i,a)}refine(e,n){const i=r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n;return this._refinement((r,a)=>{const s=e(r),o=()=>a.addIssue({code:ie.custom,...i(r)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(o(),!1)):s?!0:(o(),!1)})}refinement(e,n){return this._refinement((i,r)=>e(i)?!0:(r.addIssue(typeof n=="function"?n(i,r):n),!1))}_refinement(e){return new sl({schema:this,typeName:qe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Ya.create(this,this._def)}nullable(){return ol.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return fa.create(this)}promise(){return Rm.create(this,this._def)}or(e){return Am.create([this,e],this._def)}and(e){return Nm.create(this,e,this._def)}transform(e){return new sl({...nt(this._def),schema:this,typeName:qe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Mm({...nt(this._def),innerType:this,defaultValue:n,typeName:qe.ZodDefault})}brand(){return new WP({typeName:qe.ZodBranded,type:this,...nt(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Pm({...nt(this._def),innerType:this,catchValue:n,typeName:qe.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return tT.create(this,e)}readonly(){return Lm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const SG=/^c[^\s-]{8,}$/i,vG=/^[0-9a-z]+$/,TG=/^[0-9A-HJKMNP-TV-Z]{26}$/i,CG=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,kG=/^[a-z0-9_-]{21}$/i,xG=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,DG=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,wG=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,AG="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let g_;const NG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,IG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,OG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,RG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,MG=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,PG=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,jP="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",LG=new RegExp(`^${jP}$`);function VP(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function FG(t){return new RegExp(`^${VP(t)}$`)}function BG(t){let e=`${jP}T${VP(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function UG(t,e){return!!((e==="v4"||!e)&&NG.test(t)||(e==="v6"||!e)&&OG.test(t))}function $G(t,e){if(!xG.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const i=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(i));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function zG(t,e){return!!((e==="v4"||!e)&&IG.test(t)||(e==="v6"||!e)&&RG.test(t))}class Ha extends pt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ve.string){const a=this._getOrReturnCtx(e);return he(a,{code:ie.invalid_type,expected:ve.string,received:a.parsedType}),Ge}const i=new gi;let r;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),he(r,{code:ie.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),i.dirty());else if(a.kind==="max")e.data.length>a.value&&(r=this._getOrReturnCtx(e,r),he(r,{code:ie.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),i.dirty());else if(a.kind==="length"){const s=e.data.length>a.value,o=e.data.length<a.value;(s||o)&&(r=this._getOrReturnCtx(e,r),s?he(r,{code:ie.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&he(r,{code:ie.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),i.dirty())}else if(a.kind==="email")wG.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"email",code:ie.invalid_string,message:a.message}),i.dirty());else if(a.kind==="emoji")g_||(g_=new RegExp(AG,"u")),g_.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"emoji",code:ie.invalid_string,message:a.message}),i.dirty());else if(a.kind==="uuid")CG.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"uuid",code:ie.invalid_string,message:a.message}),i.dirty());else if(a.kind==="nanoid")kG.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"nanoid",code:ie.invalid_string,message:a.message}),i.dirty());else if(a.kind==="cuid")SG.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"cuid",code:ie.invalid_string,message:a.message}),i.dirty());else if(a.kind==="cuid2")vG.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"cuid2",code:ie.invalid_string,message:a.message}),i.dirty());else if(a.kind==="ulid")TG.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"ulid",code:ie.invalid_string,message:a.message}),i.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),he(r,{validation:"url",code:ie.invalid_string,message:a.message}),i.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"regex",code:ie.invalid_string,message:a.message}),i.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(r=this._getOrReturnCtx(e,r),he(r,{code:ie.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),i.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(r=this._getOrReturnCtx(e,r),he(r,{code:ie.invalid_string,validation:{startsWith:a.value},message:a.message}),i.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(r=this._getOrReturnCtx(e,r),he(r,{code:ie.invalid_string,validation:{endsWith:a.value},message:a.message}),i.dirty()):a.kind==="datetime"?BG(a).test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{code:ie.invalid_string,validation:"datetime",message:a.message}),i.dirty()):a.kind==="date"?LG.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{code:ie.invalid_string,validation:"date",message:a.message}),i.dirty()):a.kind==="time"?FG(a).test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{code:ie.invalid_string,validation:"time",message:a.message}),i.dirty()):a.kind==="duration"?DG.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"duration",code:ie.invalid_string,message:a.message}),i.dirty()):a.kind==="ip"?UG(e.data,a.version)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"ip",code:ie.invalid_string,message:a.message}),i.dirty()):a.kind==="jwt"?$G(e.data,a.alg)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"jwt",code:ie.invalid_string,message:a.message}),i.dirty()):a.kind==="cidr"?zG(e.data,a.version)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"cidr",code:ie.invalid_string,message:a.message}),i.dirty()):a.kind==="base64"?MG.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"base64",code:ie.invalid_string,message:a.message}),i.dirty()):a.kind==="base64url"?PG.test(e.data)||(r=this._getOrReturnCtx(e,r),he(r,{validation:"base64url",code:ie.invalid_string,message:a.message}),i.dirty()):St.assertNever(a);return{status:i.value,value:e.data}}_regex(e,n,i){return this.refinement(r=>e.test(r),{validation:n,code:ie.invalid_string,...we.errToObj(i)})}_addCheck(e){return new Ha({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...we.errToObj(e)})}url(e){return this._addCheck({kind:"url",...we.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...we.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...we.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...we.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...we.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...we.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...we.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...we.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...we.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...we.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...we.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...we.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...we.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...we.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...we.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...we.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...we.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...we.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...we.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...we.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...we.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...we.errToObj(n)})}nonempty(e){return this.min(1,we.errToObj(e))}trim(){return new Ha({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ha({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ha({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Ha.create=t=>new Ha({checks:[],typeName:qe.ZodString,coerce:t?.coerce??!1,...nt(t)});function GG(t,e){const n=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,r=n>i?n:i,a=Number.parseInt(t.toFixed(r).replace(".","")),s=Number.parseInt(e.toFixed(r).replace(".",""));return a%s/10**r}class Ac extends pt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ve.number){const a=this._getOrReturnCtx(e);return he(a,{code:ie.invalid_type,expected:ve.number,received:a.parsedType}),Ge}let i;const r=new gi;for(const a of this._def.checks)a.kind==="int"?St.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),he(i,{code:ie.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(i=this._getOrReturnCtx(e,i),he(i,{code:ie.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(i=this._getOrReturnCtx(e,i),he(i,{code:ie.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="multipleOf"?GG(e.data,a.value)!==0&&(i=this._getOrReturnCtx(e,i),he(i,{code:ie.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),he(i,{code:ie.not_finite,message:a.message}),r.dirty()):St.assertNever(a);return{status:r.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,we.toString(n))}gt(e,n){return this.setLimit("min",e,!1,we.toString(n))}lte(e,n){return this.setLimit("max",e,!0,we.toString(n))}lt(e,n){return this.setLimit("max",e,!1,we.toString(n))}setLimit(e,n,i,r){return new Ac({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:we.toString(r)}]})}_addCheck(e){return new Ac({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:we.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:we.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:we.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:we.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:we.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:we.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:we.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:we.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:we.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&St.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(n===null||i.value>n)&&(n=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(n)&&Number.isFinite(e)}}Ac.create=t=>new Ac({checks:[],typeName:qe.ZodNumber,coerce:t?.coerce||!1,...nt(t)});class qd extends pt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ve.bigint)return this._getInvalidInput(e);let i;const r=new gi;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(i=this._getOrReturnCtx(e,i),he(i,{code:ie.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(i=this._getOrReturnCtx(e,i),he(i,{code:ie.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),he(i,{code:ie.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):St.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return he(n,{code:ie.invalid_type,expected:ve.bigint,received:n.parsedType}),Ge}gte(e,n){return this.setLimit("min",e,!0,we.toString(n))}gt(e,n){return this.setLimit("min",e,!1,we.toString(n))}lte(e,n){return this.setLimit("max",e,!0,we.toString(n))}lt(e,n){return this.setLimit("max",e,!1,we.toString(n))}setLimit(e,n,i,r){return new qd({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:we.toString(r)}]})}_addCheck(e){return new qd({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:we.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:we.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:we.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:we.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:we.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}qd.create=t=>new qd({checks:[],typeName:qe.ZodBigInt,coerce:t?.coerce??!1,...nt(t)});class Kv extends pt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ve.boolean){const i=this._getOrReturnCtx(e);return he(i,{code:ie.invalid_type,expected:ve.boolean,received:i.parsedType}),Ge}return Tr(e.data)}}Kv.create=t=>new Kv({typeName:qe.ZodBoolean,coerce:t?.coerce||!1,...nt(t)});class wm extends pt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ve.date){const a=this._getOrReturnCtx(e);return he(a,{code:ie.invalid_type,expected:ve.date,received:a.parsedType}),Ge}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return he(a,{code:ie.invalid_date}),Ge}const i=new gi;let r;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),he(r,{code:ie.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),i.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(r=this._getOrReturnCtx(e,r),he(r,{code:ie.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),i.dirty()):St.assertNever(a);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new wm({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:we.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:we.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}wm.create=t=>new wm({checks:[],coerce:t?.coerce||!1,typeName:qe.ZodDate,...nt(t)});class Ox extends pt{_parse(e){if(this._getType(e)!==ve.symbol){const i=this._getOrReturnCtx(e);return he(i,{code:ie.invalid_type,expected:ve.symbol,received:i.parsedType}),Ge}return Tr(e.data)}}Ox.create=t=>new Ox({typeName:qe.ZodSymbol,...nt(t)});class Qv extends pt{_parse(e){if(this._getType(e)!==ve.undefined){const i=this._getOrReturnCtx(e);return he(i,{code:ie.invalid_type,expected:ve.undefined,received:i.parsedType}),Ge}return Tr(e.data)}}Qv.create=t=>new Qv({typeName:qe.ZodUndefined,...nt(t)});class Xv extends pt{_parse(e){if(this._getType(e)!==ve.null){const i=this._getOrReturnCtx(e);return he(i,{code:ie.invalid_type,expected:ve.null,received:i.parsedType}),Ge}return Tr(e.data)}}Xv.create=t=>new Xv({typeName:qe.ZodNull,...nt(t)});class Rx extends pt{constructor(){super(...arguments),this._any=!0}_parse(e){return Tr(e.data)}}Rx.create=t=>new Rx({typeName:qe.ZodAny,...nt(t)});class Mx extends pt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Tr(e.data)}}Mx.create=t=>new Mx({typeName:qe.ZodUnknown,...nt(t)});class Js extends pt{_parse(e){const n=this._getOrReturnCtx(e);return he(n,{code:ie.invalid_type,expected:ve.never,received:n.parsedType}),Ge}}Js.create=t=>new Js({typeName:qe.ZodNever,...nt(t)});class Px extends pt{_parse(e){if(this._getType(e)!==ve.undefined){const i=this._getOrReturnCtx(e);return he(i,{code:ie.invalid_type,expected:ve.void,received:i.parsedType}),Ge}return Tr(e.data)}}Px.create=t=>new Px({typeName:qe.ZodVoid,...nt(t)});class fa extends pt{_parse(e){const{ctx:n,status:i}=this._processInputParams(e),r=this._def;if(n.parsedType!==ve.array)return he(n,{code:ie.invalid_type,expected:ve.array,received:n.parsedType}),Ge;if(r.exactLength!==null){const s=n.data.length>r.exactLength.value,o=n.data.length<r.exactLength.value;(s||o)&&(he(n,{code:s?ie.too_big:ie.too_small,minimum:o?r.exactLength.value:void 0,maximum:s?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),i.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(he(n,{code:ie.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),i.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(he(n,{code:ie.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((s,o)=>r.type._parseAsync(new ga(n,s,n.path,o)))).then(s=>gi.mergeArray(i,s));const a=[...n.data].map((s,o)=>r.type._parseSync(new ga(n,s,n.path,o)));return gi.mergeArray(i,a)}get element(){return this._def.type}min(e,n){return new fa({...this._def,minLength:{value:e,message:we.toString(n)}})}max(e,n){return new fa({...this._def,maxLength:{value:e,message:we.toString(n)}})}length(e,n){return new fa({...this._def,exactLength:{value:e,message:we.toString(n)}})}nonempty(e){return this.min(1,e)}}fa.create=(t,e)=>new fa({type:t,minLength:null,maxLength:null,exactLength:null,typeName:qe.ZodArray,...nt(e)});function ec(t){if(t instanceof bn){const e={};for(const n in t.shape){const i=t.shape[n];e[n]=Ya.create(ec(i))}return new bn({...t._def,shape:()=>e})}else return t instanceof fa?new fa({...t._def,type:ec(t.element)}):t instanceof Ya?Ya.create(ec(t.unwrap())):t instanceof ol?ol.create(ec(t.unwrap())):t instanceof rl?rl.create(t.items.map(e=>ec(e))):t}class bn extends pt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=St.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==ve.object){const c=this._getOrReturnCtx(e);return he(c,{code:ie.invalid_type,expected:ve.object,received:c.parsedType}),Ge}const{status:i,ctx:r}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof Js&&this._def.unknownKeys==="strip"))for(const c in r.data)s.includes(c)||o.push(c);const l=[];for(const c of s){const u=a[c],d=r.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new ga(r,d,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof Js){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of o)l.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(c==="strict")o.length>0&&(he(r,{code:ie.unrecognized_keys,keys:o}),i.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of o){const d=r.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new ga(r,d,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,p=await u.value;c.push({key:d,value:p,alwaysSet:u.alwaysSet})}return c}).then(c=>gi.mergeObjectSync(i,c)):gi.mergeObjectSync(i,l)}get shape(){return this._def.shape()}strict(e){return we.errToObj,new bn({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,i)=>{const r=this._def.errorMap?.(n,i).message??i.defaultError;return n.code==="unrecognized_keys"?{message:we.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new bn({...this._def,unknownKeys:"strip"})}passthrough(){return new bn({...this._def,unknownKeys:"passthrough"})}extend(e){return new bn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new bn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:qe.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new bn({...this._def,catchall:e})}pick(e){const n={};for(const i of St.objectKeys(e))e[i]&&this.shape[i]&&(n[i]=this.shape[i]);return new bn({...this._def,shape:()=>n})}omit(e){const n={};for(const i of St.objectKeys(this.shape))e[i]||(n[i]=this.shape[i]);return new bn({...this._def,shape:()=>n})}deepPartial(){return ec(this)}partial(e){const n={};for(const i of St.objectKeys(this.shape)){const r=this.shape[i];e&&!e[i]?n[i]=r:n[i]=r.optional()}return new bn({...this._def,shape:()=>n})}required(e){const n={};for(const i of St.objectKeys(this.shape))if(e&&!e[i])n[i]=this.shape[i];else{let a=this.shape[i];for(;a instanceof Ya;)a=a._def.innerType;n[i]=a}return new bn({...this._def,shape:()=>n})}keyof(){return YP(St.objectKeys(this.shape))}}bn.create=(t,e)=>new bn({shape:()=>t,unknownKeys:"strip",catchall:Js.create(),typeName:qe.ZodObject,...nt(e)});bn.strictCreate=(t,e)=>new bn({shape:()=>t,unknownKeys:"strict",catchall:Js.create(),typeName:qe.ZodObject,...nt(e)});bn.lazycreate=(t,e)=>new bn({shape:t,unknownKeys:"strip",catchall:Js.create(),typeName:qe.ZodObject,...nt(e)});class Am extends pt{_parse(e){const{ctx:n}=this._processInputParams(e),i=this._def.options;function r(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;const s=a.map(o=>new Za(o.ctx.common.issues));return he(n,{code:ie.invalid_union,unionErrors:s}),Ge}if(n.common.async)return Promise.all(i.map(async a=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(r);{let a;const s=[];for(const l of i){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!a&&(a={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(l=>new Za(l));return he(n,{code:ie.invalid_union,unionErrors:o}),Ge}}get options(){return this._def.options}}Am.create=(t,e)=>new Am({options:t,typeName:qe.ZodUnion,...nt(e)});const Ua=t=>t instanceof Zv?Ua(t.schema):t instanceof sl?Ua(t.innerType()):t instanceof Om?[t.value]:t instanceof al?t.options:t instanceof e1?St.objectValues(t.enum):t instanceof Mm?Ua(t._def.innerType):t instanceof Qv?[void 0]:t instanceof Xv?[null]:t instanceof Ya?[void 0,...Ua(t.unwrap())]:t instanceof ol?[null,...Ua(t.unwrap())]:t instanceof WP||t instanceof Lm?Ua(t.unwrap()):t instanceof Pm?Ua(t._def.innerType):[];class eT extends pt{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ve.object)return he(n,{code:ie.invalid_type,expected:ve.object,received:n.parsedType}),Ge;const i=this.discriminator,r=n.data[i],a=this.optionsMap.get(r);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(he(n,{code:ie.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),Ge)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,i){const r=new Map;for(const a of n){const s=Ua(a.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of s){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,a)}}return new eT({typeName:qe.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:r,...nt(i)})}}function Jv(t,e){const n=Os(t),i=Os(e);if(t===e)return{valid:!0,data:t};if(n===ve.object&&i===ve.object){const r=St.objectKeys(e),a=St.objectKeys(t).filter(o=>r.indexOf(o)!==-1),s={...t,...e};for(const o of a){const l=Jv(t[o],e[o]);if(!l.valid)return{valid:!1};s[o]=l.data}return{valid:!0,data:s}}else if(n===ve.array&&i===ve.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let a=0;a<t.length;a++){const s=t[a],o=e[a],l=Jv(s,o);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return n===ve.date&&i===ve.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Nm extends pt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e),r=(a,s)=>{if(Ax(a)||Ax(s))return Ge;const o=Jv(a.value,s.value);return o.valid?((Nx(a)||Nx(s))&&n.dirty(),{status:n.value,value:o.data}):(he(i,{code:ie.invalid_intersection_types}),Ge)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([a,s])=>r(a,s)):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}Nm.create=(t,e,n)=>new Nm({left:t,right:e,typeName:qe.ZodIntersection,...nt(n)});class rl extends pt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==ve.array)return he(i,{code:ie.invalid_type,expected:ve.array,received:i.parsedType}),Ge;if(i.data.length<this._def.items.length)return he(i,{code:ie.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ge;!this._def.rest&&i.data.length>this._def.items.length&&(he(i,{code:ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const a=[...i.data].map((s,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new ga(i,s,i.path,o)):null}).filter(s=>!!s);return i.common.async?Promise.all(a).then(s=>gi.mergeArray(n,s)):gi.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new rl({...this._def,rest:e})}}rl.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new rl({items:t,typeName:qe.ZodTuple,rest:null,...nt(e)})};class Im extends pt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==ve.object)return he(i,{code:ie.invalid_type,expected:ve.object,received:i.parsedType}),Ge;const r=[],a=this._def.keyType,s=this._def.valueType;for(const o in i.data)r.push({key:a._parse(new ga(i,o,i.path,o)),value:s._parse(new ga(i,i.data[o],i.path,o)),alwaysSet:o in i.data});return i.common.async?gi.mergeObjectAsync(n,r):gi.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(e,n,i){return n instanceof pt?new Im({keyType:e,valueType:n,typeName:qe.ZodRecord,...nt(i)}):new Im({keyType:Ha.create(),valueType:e,typeName:qe.ZodRecord,...nt(n)})}}class Lx extends pt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==ve.map)return he(i,{code:ie.invalid_type,expected:ve.map,received:i.parsedType}),Ge;const r=this._def.keyType,a=this._def.valueType,s=[...i.data.entries()].map(([o,l],c)=>({key:r._parse(new ga(i,o,i.path,[c,"key"])),value:a._parse(new ga(i,l,i.path,[c,"value"]))}));if(i.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of s){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Ge;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),o.set(c.value,u.value)}return{status:n.value,value:o}})}else{const o=new Map;for(const l of s){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Ge;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),o.set(c.value,u.value)}return{status:n.value,value:o}}}}Lx.create=(t,e,n)=>new Lx({valueType:e,keyType:t,typeName:qe.ZodMap,...nt(n)});class Hd extends pt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==ve.set)return he(i,{code:ie.invalid_type,expected:ve.set,received:i.parsedType}),Ge;const r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(he(i,{code:ie.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&i.data.size>r.maxSize.value&&(he(i,{code:ie.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());const a=this._def.valueType;function s(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Ge;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const o=[...i.data.values()].map((l,c)=>a._parse(new ga(i,l,i.path,c)));return i.common.async?Promise.all(o).then(l=>s(l)):s(o)}min(e,n){return new Hd({...this._def,minSize:{value:e,message:we.toString(n)}})}max(e,n){return new Hd({...this._def,maxSize:{value:e,message:we.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Hd.create=(t,e)=>new Hd({valueType:t,minSize:null,maxSize:null,typeName:qe.ZodSet,...nt(e)});class Zv extends pt{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Zv.create=(t,e)=>new Zv({getter:t,typeName:qe.ZodLazy,...nt(e)});class Om extends pt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return he(n,{received:n.data,code:ie.invalid_literal,expected:this._def.value}),Ge}return{status:"valid",value:e.data}}get value(){return this._def.value}}Om.create=(t,e)=>new Om({value:t,typeName:qe.ZodLiteral,...nt(e)});function YP(t,e){return new al({values:t,typeName:qe.ZodEnum,...nt(e)})}class al extends pt{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),i=this._def.values;return he(n,{expected:St.joinValues(i),received:n.parsedType,code:ie.invalid_type}),Ge}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),i=this._def.values;return he(n,{received:n.data,code:ie.invalid_enum_value,options:i}),Ge}return Tr(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return al.create(e,{...this._def,...n})}exclude(e,n=this._def){return al.create(this.options.filter(i=>!e.includes(i)),{...this._def,...n})}}al.create=YP;class e1 extends pt{_parse(e){const n=St.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==ve.string&&i.parsedType!==ve.number){const r=St.objectValues(n);return he(i,{expected:St.joinValues(r),received:i.parsedType,code:ie.invalid_type}),Ge}if(this._cache||(this._cache=new Set(St.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=St.objectValues(n);return he(i,{received:i.data,code:ie.invalid_enum_value,options:r}),Ge}return Tr(e.data)}get enum(){return this._def.values}}e1.create=(t,e)=>new e1({values:t,typeName:qe.ZodNativeEnum,...nt(e)});class Rm extends pt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ve.promise&&n.common.async===!1)return he(n,{code:ie.invalid_type,expected:ve.promise,received:n.parsedType}),Ge;const i=n.parsedType===ve.promise?n.data:Promise.resolve(n.data);return Tr(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Rm.create=(t,e)=>new Rm({type:t,typeName:qe.ZodPromise,...nt(e)});class sl extends pt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===qe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:i}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:s=>{he(i,s),s.fatal?n.abort():n.dirty()},get path(){return i.path}};if(a.addIssue=a.addIssue.bind(a),r.type==="preprocess"){const s=r.transform(i.data,a);if(i.common.async)return Promise.resolve(s).then(async o=>{if(n.value==="aborted")return Ge;const l=await this._def.schema._parseAsync({data:o,path:i.path,parent:i});return l.status==="aborted"?Ge:l.status==="dirty"||n.value==="dirty"?qu(l.value):l});{if(n.value==="aborted")return Ge;const o=this._def.schema._parseSync({data:s,path:i.path,parent:i});return o.status==="aborted"?Ge:o.status==="dirty"||n.value==="dirty"?qu(o.value):o}}if(r.type==="refinement"){const s=o=>{const l=r.refinement(o,a);if(i.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(i.common.async===!1){const o=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?Ge:(o.status==="dirty"&&n.dirty(),s(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(o=>o.status==="aborted"?Ge:(o.status==="dirty"&&n.dirty(),s(o.value).then(()=>({status:n.value,value:o.value}))))}if(r.type==="transform")if(i.common.async===!1){const s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!wc(s))return Ge;const o=r.transform(s.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(s=>wc(s)?Promise.resolve(r.transform(s.value,a)).then(o=>({status:n.value,value:o})):Ge);St.assertNever(r)}}sl.create=(t,e,n)=>new sl({schema:t,typeName:qe.ZodEffects,effect:e,...nt(n)});sl.createWithPreprocess=(t,e,n)=>new sl({schema:e,effect:{type:"preprocess",transform:t},typeName:qe.ZodEffects,...nt(n)});class Ya extends pt{_parse(e){return this._getType(e)===ve.undefined?Tr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ya.create=(t,e)=>new Ya({innerType:t,typeName:qe.ZodOptional,...nt(e)});class ol extends pt{_parse(e){return this._getType(e)===ve.null?Tr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ol.create=(t,e)=>new ol({innerType:t,typeName:qe.ZodNullable,...nt(e)});class Mm extends pt{_parse(e){const{ctx:n}=this._processInputParams(e);let i=n.data;return n.parsedType===ve.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Mm.create=(t,e)=>new Mm({innerType:t,typeName:qe.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...nt(e)});class Pm extends pt{_parse(e){const{ctx:n}=this._processInputParams(e),i={...n,common:{...n.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return Dm(r)?r.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Za(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Za(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}Pm.create=(t,e)=>new Pm({innerType:t,typeName:qe.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...nt(e)});class Fx extends pt{_parse(e){if(this._getType(e)!==ve.nan){const i=this._getOrReturnCtx(e);return he(i,{code:ie.invalid_type,expected:ve.nan,received:i.parsedType}),Ge}return{status:"valid",value:e.data}}}Fx.create=t=>new Fx({typeName:qe.ZodNaN,...nt(t)});class WP extends pt{_parse(e){const{ctx:n}=this._processInputParams(e),i=n.data;return this._def.type._parse({data:i,path:n.path,parent:n})}unwrap(){return this._def.type}}class tT extends pt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?Ge:a.status==="dirty"?(n.dirty(),qu(a.value)):this._def.out._parseAsync({data:a.value,path:i.path,parent:i})})();{const r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?Ge:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:i.path,parent:i})}}static create(e,n){return new tT({in:e,out:n,typeName:qe.ZodPipeline})}}class Lm extends pt{_parse(e){const n=this._def.innerType._parse(e),i=r=>(wc(r)&&(r.value=Object.freeze(r.value)),r);return Dm(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}}Lm.create=(t,e)=>new Lm({innerType:t,typeName:qe.ZodReadonly,...nt(e)});var qe;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(qe||(qe={}));const Me=Ha.create,se=Ac.create,Nc=Kv.create;Js.create;const _c=fa.create,Le=bn.create,bc=Am.create,qG=eT.create;Nm.create;const KP=rl.create,HG=Im.create,t1=Om.create,jt=al.create;Rm.create;Ya.create;ol.create;function rf(t,e){return!t||t&&t[e]===0?"initial":t[e]!==void 0?`${t[e]}px solid ${t?.color??"black"}`:"initial"}function fi({className:t,background:e,backgroundColor:n,padding:i={top:0,right:0,bottom:0,left:0},width:r,align:a,children:s,border:o,borderRadius:l,isParent:c=!0,overflow:u="visible"}){const d=t?`a${t}`:"",p={width:r,minWidth:r,borderRadius:l??"initial",borderTop:rf(o,"top"),borderBottom:rf(o,"bottom"),borderLeft:rf(o,"left"),borderRight:rf(o,"right"),overflow:u,borderCollapse:"initial"};return e&&String(e).trim()!==""?p.background=e:n&&(p.backgroundColor=n),m.jsx("table",{className:t,width:r,border:0,cellSpacing:"0",cellPadding:"0",style:p,children:m.jsxs("tbody",{children:[m.jsxs("tr",{height:i.top,style:{height:`${i.top}px`},className:c?`t${t}`:`it${t}`,children:[m.jsx("td",{style:{width:`${i.left}px`},className:c?`l${t}`:`il${t}`}),m.jsx("td",{}),m.jsx("td",{style:{width:`${i.right}px`},className:c?`r${t}`:`ir${t}`})]}),m.jsxs("tr",{children:[m.jsx("td",{style:{width:`${i.left}px`},className:c?`l${t}`:`il${t}`}),m.jsx("td",{className:d,align:a,children:s}),m.jsx("td",{style:{width:`${i.right}px`},className:c?`r${t}`:`ir${t}`})]}),m.jsxs("tr",{height:i.bottom,style:{height:`${i.bottom}px`},className:c?`b${t}`:`ib${t}`,children:[m.jsx("td",{style:{width:`${i.left}px`},className:c?`l${t}`:`il${t}`}),m.jsx("td",{}),m.jsx("td",{style:{width:`${i.right}px`},className:c?`r${t}`:`ir${t}`})]})]})})}const Tl=(t,e)=>{const n=/#([0-9a-fA-F]{3,6})\b/;return n.test(t)?t.replace(n,e):t.trim()===""?e:t.replace(/^(\S+)/,`$1 ${e}`)};function Fm(t){const e=t?.shape??"rectangle";if(typeof e=="string")switch(e){case"rectangle":return;case"pill":return 9999;default:return}else if(typeof e=="object"&&e!==null){const{topLeft:n=0,topRight:i=0,bottomLeft:r=0,bottomRight:a=0}=e;return`${i}px ${n}px ${a}px ${r}px`}}function jG(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=(e>>>0)*16777619;return e>>>0}function VG(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";if(t===0)return"a";let n="";for(;t>0;)n=e[t%62]+n,t=Math.floor(t/62);return n}function dt(t){const e=jG(t);return`b${VG(e)}`}const Bx=Le({top:se(),bottom:se(),right:se(),left:se()}).optional().nullable(),QP=Le({style:Le({textAlign:jt(["left","center","right"]).optional().nullable(),padding:Bx,mobilePadding:Bx,backgroundColor:Me().optional()}).passthrough().optional().nullable(),props:Le({size:se().gt(0).optional().nullable(),shape:jt(["circle","square","rounded"]).optional().nullable(),imageUrl:Me().optional().nullable(),alt:Me().optional().nullable()}).optional().nullable()}).passthrough(),Uo={size:64,imageUrl:"",alt:"",shape:"square"};function XP({style:t,props:e,blockId:n}){const i=e?.size??Uo.size,r=e?.imageUrl??Uo.imageUrl,a=e?.alt??Uo.alt;e?.shape??Uo.shape;const s=Jh(),o={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},l=m.jsx(fi,{isParent:!1,children:m.jsxs(m.Fragment,{children:[m.jsx("img",{alt:a??"",src:r??"",width:i,style:{width:i,height:"auto",outline:"none",border:"none",textDecoration:"none",verticalAlign:t?.contentAlignment??"middle",display:"inline-block",maxWidth:"100%",opacity:s.uploading&&s.id===n?.5:1,transition:"opacity 0.2s ease-in-out"}}),s.uploading&&s.id===n&&m.jsx("div",{style:o,children:m.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle",style:{width:"32px",height:"32px",animation:"1s linear infinite spin",stroke:"currentColor"},children:m.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})]})}),c=dt(n);return m.jsx(fi,{className:`${c}`,padding:t.padding,backgroundColor:t.backgroundColor,align:t.textAlign,width:"100%",children:l})}function Cr({title:t,children:e}){return m.jsxs(T.Container,{sx:{padding:"0!important",paddingTop:"1rem!important"},children:[m.jsx(T.Typography,{sx:{fontWeight:"bold",mb:2,pb:1,color:"text.primary",fontSize:"1.25rem",borderBottom:n=>`1px solid ${n.palette.divider}`},children:t}),m.jsx(T.Stack,{spacing:2,gap:1,mb:3,pt:1,children:e})]})}const Vt=({label:t})=>{const e=G.useTheme();return t?m.jsx("p",{style:{fontWeight:"bold",color:e.palette.text.primary},children:t}):null},Wn=({children:t})=>m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.3rem"},children:t.map(e=>e)}),YG=G.styled(T.Box)(({theme:t})=>({display:"flex",alignItems:"center",border:`1px solid ${t.palette.divider}`,borderRadius:"8px",padding:"4px",minWidth:58,maxWidth:"fit-content",backgroundColor:t.palette.background.paper,"&:hover":{borderColor:t.palette.primary.main},"&:focus-within":{borderColor:t.palette.primary.main,boxShadow:`0 0 0 1px ${t.palette.primary.main}`}})),WG=G.styled("input")(({theme:t})=>({border:"none",outline:"none",background:"transparent",textAlign:"center",width:"27px",minWidth:"27px",maxWidth:"27px",padding:"0!important",lineHeight:"normal",fontSize:"0.9rem",color:t.palette.text.primary,"&::-webkit-outer-spin-button, &::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},"&[type=number]":{MozAppearance:"textfield"}})),Ux=G.styled(T.IconButton)(({theme:t})=>({padding:"0",color:t.palette.primary.main,"&:hover":{backgroundColor:G.alpha(t.palette.primary.main,.04)},"& .MuiSvgIcon-root":{fontSize:14}}));function cn({iconLabel:t,label:e,value:n,setValue:i,units:r,min:a=0,max:s,step:o=void 0,marks:l=!0,...c}){const u=n??a,[d,p]=v.useState(u.toString()),f=S=>{let C=S;C<a&&(C=a),s!==void 0&&C>s&&(C=s),i(C),p(C.toString())},h=S=>{const C=S.target.value;if(p(C),C!==""){const D=Number(C);isNaN(D)||D>=a&&i(D)}},_=()=>{if(d===""||isNaN(Number(d)))p(u.toString());else{const S=Number(d);f(S)}},g=S=>{S.key==="Enter"&&_()};v.useEffect(()=>{p((n??a).toString())},[n,a]);const b=()=>{const S=u+1;f(S)},y=()=>{const S=u-1;f(S)},E=(S,C)=>{typeof C=="number"&&i(C)};return m.jsxs(Wn,{children:[m.jsx(Vt,{label:e}),m.jsxs(T.Stack,{direction:"row",alignItems:"center",spacing:2,justifyContent:"space-between",width:"100%",children:[m.jsx(T.Box,{sx:{minWidth:24,lineHeight:1,flexShrink:0},children:t}),m.jsx(T.Slider,{...c,value:u,min:a,max:s||1e3,step:o,color:"primary",marks:l,onChange:E}),m.jsxs(YG,{children:[m.jsx(WG,{type:"number",value:d,onChange:h,onBlur:_,onKeyDown:g,min:a,max:s,step:o}),m.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",ml:.5},children:[m.jsx(Ux,{onClick:b,disabled:s!==void 0&&u>=s,children:m.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",children:m.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})}),m.jsx(Ux,{onClick:y,disabled:u<=a,children:m.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",style:{transform:"rotate(180deg)"},children:m.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})})]})]}),m.jsx(T.Typography,{variant:"caption",color:"text.secondary",sx:{fontSize:"16px",ml:"4px!important"},children:r})]})]})}function Po({label:t,defaultValue:e,onChange:n,...i}){const[r,a]=v.useState(e??0);return e!=r&&a(e),m.jsxs(Wn,{children:[m.jsx(Vt,{label:t}),m.jsx(cn,{value:r??0,setValue:s=>{a(s),n(s)},...i})]})}function KG(t,e){const n=v.useRef(null),i=v.useRef(t),r=v.useRef([]);i.current=t;const a=v.useCallback((...s)=>{r.current=s,n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{i.current(...s),n.current=null},e)},[e]);return a.flush=v.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=null,i.current(...r.current))},[]),a}const yc=36,nT=8,eg={width:"100%","& .MuiInputBase-root":{"&:not(.MuiInputBase-multiline)":{height:`${yc}px`}},"& .MuiOutlinedInput-root":{borderRadius:`${nT}px`,"&:not(.MuiInputBase-multiline)":{height:`${yc}px`}},"& .MuiInputBase-input":{paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",height:"unset"}},QG={width:"100%",height:`${yc}px`,paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",display:"flex",alignItems:"center",borderRadius:`${nT}px`};function ll({helperText:t,label:e,placeholder:n,rows:i,InputProps:r,defaultValue:a,onChange:s}){const[o,l]=v.useState(a);v.useEffect(()=>{o!==a&&l(a)},[a]);const c=KG(d=>{s(d)},150),u=typeof i=="number"&&i>1;return m.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[m.jsx(Vt,{label:e}),m.jsx(T.TextField,{fullWidth:!0,multiline:u,minRows:i,variant:"outlined",placeholder:n,helperText:t,InputProps:r,value:o,sx:eg,onChange:d=>{const p=d.target.value;l(p),c(p)},onBlur:()=>{c.flush()}})]})}function XG({onClick:t,disabled:e,primary:n=!1}){const{t:i}=Ke.useTranslation("inspector");return m.jsx(T.IconButton,{"aria-label":i("inputs.common.close"),onClick:t,disabled:e,sx:{position:"absolute",right:8,top:8,color:r=>n?"brand.blue":r.palette.grey[500],"&:hover":{opacity:.8}},children:m.jsx($.Close,{})})}function JG({imageUrl:t,saving:e=!1}){return m.jsxs(T.Card,{sx:{position:"relative"},children:[e&&m.jsx(T.Stack,{justifyContent:"center",alignItems:"center",sx:{position:"absolute",top:7,left:0,width:"100%",height:"314px",zIndex:20,backgroundColor:"#212121AA",mb:1},children:m.jsx(T.CircularProgress,{size:48,thickness:6,color:"inherit",sx:{color:"white"}})}),m.jsx(T.CardMedia,{component:"img",sx:{objectFit:"contain",width:"100%",height:"326px"},image:t,alt:"Generated Image"})]})}function ZG({value:t,onChange:e,disabled:n}){return m.jsxs(m.Fragment,{children:[m.jsx(T.Typography,{sx:{fontSize:"14px",fontWeight:700},children:"Image description"}),m.jsx(T.TextField,{disabled:n,autoFocus:!0,margin:"dense",id:"prompt",placeholder:"Enter a detailed description here...",type:"text",fullWidth:!0,multiline:!0,rows:4,variant:"outlined",value:t,onChange:i=>e(i.target.value),sx:{mt:.5,"& .MuiOutlinedInput-root":{borderRadius:"8px"}}})]})}const e7=t=>({400:{code:400,title:t.title||"Invalid Request",message:t.message||"The request was invalid. Please check your input and try again.",action:t.action||"Modify your prompt and try again"},401:{code:401,title:t.title||"Authentication Required",message:t.message||"You need to be authenticated to perform this action.",action:t.action||"Please log in and try again"},403:{code:403,title:t.title||"Access Denied",message:t.message||"You don't have permission to perform this action.",action:t.action||"Contact support if you believe this is a mistake"},404:{code:404,title:t.title||"Not Found",message:t.message||"The requested resource was not found.",action:t.action||"Try again or use a different prompt"},422:{code:422,title:t.title||"Invalid Input",message:t.message||"The provided input cannot be processed.",action:t.action||"Modify your prompt and try again"},429:{code:429,title:t.title||"Too Many Requests",message:t.message||"You've made too many requests. Please wait a moment.",action:t.action||"Please wait a few minutes before trying again"},500:{code:500,title:t.title||"Server Error",message:t.message||"An unexpected error occurred on our servers.",action:t.action||"Please try again later"},502:{code:502,title:t.title||"Bad Gateway",message:t.message||"The server received an invalid response.",action:t.action||"Please try again later"},503:{code:503,title:t.title||"Service Unavailable",message:t.message||"The service is temporarily unavailable.",action:t.action||"Please try again later"}})[t.code]||{code:t.code,title:"Unexpected Error",message:"An unexpected error occurred.",action:"Please try again later"};function JP({src:t,style:e}){const{t:n}=Ke.useTranslation("inspector"),[i,r]=v.useState(!1),[a,s]=v.useState(!1),[o,l]=v.useState(""),[c,u]=v.useState(null),[d,p]=v.useState(!1),[f,h]=v.useState(null),[_,g]=v.useState(!1),b=()=>{r(!0),h(null)},y=()=>{a||(r(!1),s(!1),u(null),l(""),p(!1),h(null),g(!1))},E=()=>{const D=c&&!d?"store-ai-image":"request-ai-image",w=c&&!d?c:o;h(null),D==="store-ai-image"?(g(!0),s(!1),setTimeout(()=>{s(!1),y()},2e3)):s(!0),window.dispatchEvent(new CustomEvent(D,{detail:w}))},S=()=>{p(!0),u(null),h(null),g(!1)};v.useEffect(()=>{const D=w=>{const{detail:k}=w;if(s(!1),k.error){h(e7(k.error));return}if(!k.success||!k.url){h({code:0,title:"Generation Failed",message:"Failed to generate the image.",action:"Please try again"});return}u(k.url),p(!1)};return window.addEventListener("generated-image",D),()=>{window.removeEventListener("generated-image",D)}},[]),v.useEffect(()=>{y()},[t]);const C=!c||d;return m.jsxs(m.Fragment,{children:[m.jsx(T.Button,{style:e,startIcon:m.jsx($.AutoAwesome,{className:"w-4 h-4"}),variant:"contained",onClick:b,children:n("inputs.aiImageGeneration.generate")}),m.jsx(T.Dialog,{open:i,onClose:y,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{bgcolor:"background.paper",color:"text.primary",borderRadius:"8px"}},children:m.jsxs("form",{onSubmit:D=>{D.preventDefault(),E()},children:[m.jsxs(T.DialogTitle,{sx:{fontWeight:700,fontSize:"24px",color:f?"error.main":"inherit"},children:[n(f?"inputs.aiImageGeneration.titleError":a?"inputs.aiImageGeneration.titleLoading":c?"inputs.aiImageGeneration.titleReady":"inputs.aiImageGeneration.titleCreate"),m.jsx(XG,{onClick:y,disabled:a,primary:!0})]}),m.jsxs(T.DialogContent,{children:[m.jsx(T.DialogContentText,{sx:{pb:1,color:f?"error.dark":"inherit"},children:n(f?"inputs.aiImageGeneration.descriptionError":a?"inputs.aiImageGeneration.descriptionLoading":C?"inputs.aiImageGeneration.descriptionCreate":"inputs.aiImageGeneration.descriptionReady")}),c&&!d?m.jsxs(T.Stack,{sx:{position:"relative"},children:[m.jsx(JG,{imageUrl:c,saving:_}),m.jsxs(T.Alert,{variant:"outlined",severity:"warning",icon:!1,children:[n("inputs.aiImageGeneration.warningRegenerate")," ",m.jsx("b",{children:n("inputs.aiImageGeneration.warningInsertFirst")})," ",n("inputs.aiImageGeneration.warningFirst")]})]}):a&&!c?m.jsx(T.Stack,{justifyContent:"center",alignItems:"center",sx:{backgroundColor:D=>D.palette.mainColor[50],height:"326px",width:"100%"},children:m.jsx(T.CircularProgress,{size:48,thickness:6})}):m.jsx(ZG,{value:o,onChange:l,disabled:a})]}),!a&&m.jsxs(T.DialogActions,{className:"p-6",children:[c&&!d&&m.jsx(T.Button,{startIcon:m.jsx($.Refresh,{className:"w-4 h-4"}),onClick:S,variant:"outlined",disabled:a,children:n("inputs.aiImageGeneration.regenerate")}),!c&&!d&&m.jsx(T.Button,{onClick:y,variant:"text",disabled:d,children:n("inputs.aiImageGeneration.cancel")}),m.jsxs(T.Button,{startIcon:c&&!d?m.jsx($.Attachment,{className:"w-4 h-4"}):m.jsx($.AutoAwesome,{className:"w-4 h-4"}),onClick:E,variant:"contained",disabled:!o||o?.length<20,children:[n(c&&!d?"inputs.aiImageGeneration.insertImage":"inputs.aiImageGeneration.generateImage"),a&&m.jsx(T.CircularProgress,{size:16,className:"ml-2"})]})]})]})})]})}const t7=({className:t,...e})=>m.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",className:t,"aria-hidden":"true",focusable:"false",...e,children:m.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 3l6 6l6-6"})}),n7=T.styled(T.Select)(({theme:t})=>({fontFamily:t.typography.fontFamily,color:t.palette.text.primary,backgroundColor:t.palette.background.input??t.palette.grey[100],width:"100%",height:`${yc}px`,"&.MuiInputBase-root, &.MuiOutlinedInput-root":{height:`${yc}px`,minHeight:`${yc}px`,boxSizing:"border-box",borderRadius:`${nT}px`,border:`1px solid ${t.palette.divider}`},"&& .MuiSelect-select, && .MuiInputBase-input":{paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"36px",lineHeight:"20px",minHeight:"unset"},"& .MuiSelect-icon":{color:t.palette.secondary.main,right:12,top:"calc(50% - 4px)",transition:"transform 200ms ease",pointerEvents:"none"},"& .MuiSelect-iconOpen":{transform:"rotate(180deg)"},"&:hover":{backgroundColor:t.palette.grey[200]},"&.Mui-focused":{borderColor:t.palette.primary.main}})),Zs=v.forwardRef((t,e)=>{const n=T.useTheme(),i={backgroundColor:n.palette.background.input??n.palette.grey[100],marginTop:"4px",borderRadius:"10px",border:`1px solid ${n.palette.divider}`,boxShadow:`0 1px 3px ${T.alpha("#000000",.6)}`,color:n.palette.text.primary},r={...t.MenuProps?.PaperProps,sx:{...typeof t.MenuProps?.PaperProps?.sx=="object"&&t.MenuProps.PaperProps?.sx,...i}},a=t.MenuProps?.slotProps??{},s=a.paper??{};return m.jsx(n7,{ref:e,...t,IconComponent:t7,MenuProps:{...t.MenuProps,PaperProps:r,slotProps:{...a,paper:{...s,...r,sx:{...typeof s.sx=="object"&&s.sx,...typeof t.MenuProps?.PaperProps?.sx=="object"&&t.MenuProps.PaperProps?.sx,...i}}}}})});Zs.displayName="CustomSelect";const i7=({defaultValue:t,onChange:e,values:n})=>{const i=Jc(),{t:r}=Ke.useTranslation("inspector"),a=G.useTheme(),s=()=>m.jsx(T.SvgIcon,{viewBox:"0 0 18 18",fontSize:"small",children:m.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:"#F59E0B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})}),o=H=>{if(!H)return{url:"",repeat:"no-repeat",position:"center center",size:"cover"};const Te=H.match(/url\("([^"]+)"\)/),Ve=Te?Te[1]:"";let ot="no-repeat";H.includes("repeat-x")?ot="repeat-x":H.includes("repeat-y")?ot="repeat-y":H.includes("repeat")&&!H.includes("no-repeat")&&(ot="repeat");let xt="center center";const Dt=["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"];for(const Xn of Dt)if(H.includes(Xn)){xt=Xn;break}let $t="cover";return H.includes("contain")?$t="contain":H.includes("auto")&&($t="auto"),{url:Ve,repeat:ot,position:xt,size:$t}},l=H=>H.url?`url("${H.url}") ${H.repeat} ${H.position} / ${H.size}`:"",[c,u]=v.useState(t||null),[d,p]=v.useState(o(t)),[f,h]=v.useState(!1),[_,g]=v.useState(()=>!!window.__emailBuilderEnableAI),[,b]=v.useState(null),[y,E]=v.useState(o(t).url||""),[S,C]=v.useState(!1),[D,w]=v.useState(""),[k,x]=v.useState(!1),O=v.useRef(null),A=Z0(),[X,P]=v.useState(null);v.useEffect(()=>{const H=window.__emailBuilderCustomImageProvider;H&&(P(H),setTimeout(()=>{i&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:i,currentImageUrl:d.url||null,alt:null}}))},100))},[]);const[Y,z]=v.useState(()=>sessionStorage.getItem("hideBackgroundImageWarning")==="true"),F=(H,Te)=>{const Ve={...d,...H};if(p(Ve),Ve.url){const ot=l(Ve);u(ot),e(ot,Te)}else console.error("Update params error: ",Ve)},K=(H,Te)=>{if(!H)return!1;const Ve=H?.toLowerCase(),ot=Ve.includes(".svg")||Ve.includes("svg"),xt=Te&&(Te.includes("image/svg+xml")||Te.includes("svg"));return ot||!!xt},re=async H=>{try{C(!0),w(""),x(!1);try{new URL(H)}catch{return w("Invalid URL format"),!1}const Te=new AbortController,Ve=setTimeout(()=>Te.abort(),1e4);try{const ot=await fetch(H,{method:"HEAD",signal:Te.signal});if(clearTimeout(Ve),!ot.ok)return w(`HTTP ${ot.status}: ${ot.statusText}`),!1;const xt=ot.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(Xn=>xt&&xt.toLowerCase().includes(Xn.toLowerCase()))?(K(H,xt)&&x(!0),w(""),!0):(w("URL does not point to an image"),!1)}catch(ot){return clearTimeout(Ve),ot.name==="AbortError"?(w("Request timeout - URL took too long to respond"),!1):new Promise(xt=>{const Dt=new Image,$t=setTimeout(()=>{w("Request timeout - URL took too long to respond"),xt(!1)},1e4);Dt.onload=()=>{clearTimeout($t),K(H)&&x(!0),w(""),xt(!0)},Dt.onerror=()=>{clearTimeout($t),w("Cannot access image - CORS policy, network error, or invalid URL"),xt(!1)},Dt.src=H})}}catch{return w("Unexpected error occurred while validating URL"),!1}finally{C(!1)}},ke=async()=>{y.trim()&&await re(y.trim())&&F({url:y.trim()})},ue=H=>{H.key==="Enter"&&ke()},Ue=H=>{E(H.target.value),D&&w(""),k&&x(!1)},Ce=H=>{const Te=["image/png","image/jpeg","image/gif"],ot=Array.from(H),xt=ot.filter($t=>Te.includes($t.type)&&$t.size<=5242880);if(xt.length!==ot.length&&alert(r("inputs.common.invalidFiles")),xt.length===0)return;const Dt=xt.map($t=>new Promise(Xn=>{const Vr=new FileReader;Vr.onload=_s=>Xn(_s.target?.result),Vr.readAsDataURL($t)}));Promise.all(Dt).then($t=>{const Xn={images:$t,id:i||"",styles:n};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:Xn})),gc(!0,i||"")})},de=H=>{H.preventDefault(),h(!0)},pe=()=>{h(!1)},Qe=H=>{H.preventDefault(),h(!1);const Te=H.dataTransfer.files;Ce(Te)},gt=()=>{const H=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent(H)},Ze=()=>{p({url:"",repeat:"no-repeat",position:"center center",size:"cover"}),u(null),e(null),E(""),x(!1)},ee=H=>{switch(H){case"top left":return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M5.26523 9.79159L5.17094 5.17183M5.17094 5.17183L9.79071 5.26611M5.17094 5.17183L10.8278 10.8287",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"top center":return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M4.7998 7.33333L7.9998 4M7.9998 4L11.1998 7.33333M7.9998 4V12",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"top right":return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M6.20841 5.2662L10.8282 5.17192M10.8282 5.17192L10.7339 9.79169M10.8282 5.17192L5.17132 10.8288",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"center left":return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M7.33333 11.2002L4 8.00019M4 8.00019L7.33333 4.8002M4 8.00019L12 8.0002",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"center center":return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"center right":return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M8.66667 4.7998L12 7.9998M12 7.9998L8.66667 11.1998M12 7.9998L4 7.9998",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"bottom left":return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M9.79062 10.7348L5.17085 10.8291M5.17085 10.8291L5.26513 6.20929M5.17085 10.8291L10.8277 5.1722",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"bottom center":return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M11.1998 8.66667L7.9998 12M7.9998 12L4.7998 8.66667M7.9998 12L7.99981 4",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"bottom right":return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M10.7338 6.20938L10.8281 10.8291M10.8281 10.8291L6.20831 10.7349M10.8281 10.8291L5.17122 5.17229",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});default:return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})})}},Ae=H=>({"top left":r("inputs.backgroundImage.positions.topLeft"),"top center":r("inputs.backgroundImage.positions.topCenter"),"top right":r("inputs.backgroundImage.positions.topRight"),"center left":r("inputs.backgroundImage.positions.centerLeft"),"center center":r("inputs.backgroundImage.positions.center"),"center right":r("inputs.backgroundImage.positions.centerRight"),"bottom left":r("inputs.backgroundImage.positions.bottomLeft"),"bottom center":r("inputs.backgroundImage.positions.bottomCenter"),"bottom right":r("inputs.backgroundImage.positions.bottomRight")})[H]??r("inputs.backgroundImage.positions.center");return v.useEffect(()=>{const H=window.__emailBuilderEnableAI;H!==void 0&&g(!!H);const Te=Ve=>{const{detail:ot}=Ve;g(!!ot)};return window.addEventListener("email-builder-ai-generation",Te),()=>{window.removeEventListener("email-builder-ai-generation",Te)}},[]),v.useEffect(()=>{const H=xt=>{const{detail:Dt}=xt;gc(!1,Dt.id||""),F({url:Dt.url},Dt.styles),qP(!1),E(Dt.url)},Te=xt=>{gc(xt?.detail?.uploading??!1,xt?.detail?.id??"")},Ve=()=>{O?.current?.click()},ot=xt=>{const{detail:Dt}=xt;if(Dt&&!Dt.includes("url("))F({url:Dt},Dt.styles),E(Dt);else{const $t=o(Dt);p($t),u(Dt),e(Dt),E($t.url)}};return window.addEventListener("email-builder-set-image",ot),window.addEventListener("email-builder-upload-image-receive",H),window.addEventListener("email-builder-upload-file",Ve),window.addEventListener("email-builder-toggle-upload-file",Te),()=>{window.removeEventListener("email-builder-upload-image-receive",H),window.removeEventListener("email-builder-set-image",ot),window.removeEventListener("email-builder-upload-file",Ve),window.removeEventListener("email-builder-toggle-upload-file",Te)}},[d]),v.useEffect(()=>{t&&x(K(d.url))},[t,d.url]),v.useEffect(()=>{if(t!==c){const H=o(t);p(H),u(t||null),E(H.url||"")}},[t]),m.jsxs(Wn,{children:[m.jsxs(T.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[m.jsx(Vt,{label:r("inputs.backgroundImage.label")}),!Y&&m.jsx(T.Tooltip,{title:r("inputs.backgroundImage.warningTooltip"),placement:"top",children:m.jsx(T.IconButton,{size:"small",sx:{p:0},children:m.jsx(s,{})})})]}),X?m.jsx(T.Box,{sx:{mb:2},children:X}):m.jsx("div",{style:{display:"flex",gap:8},children:A?m.jsxs(T.Box,{sx:{width:"100%"},children:[m.jsxs(T.Stack,{direction:"row",spacing:1,children:[m.jsx(T.TextField,{fullWidth:!0,placeholder:r("inputs.image.urlPlaceholder"),value:y,onChange:Ue,onKeyPress:ue,error:!!D,disabled:S,sx:eg}),m.jsx(T.Button,{variant:"contained",onClick:ke,disabled:!y.trim()||S,sx:{minWidth:"auto",px:2,position:"relative"},children:S?m.jsx(T.CircularProgress,{size:20,color:"inherit"}):r("inputs.common.add")})]}),D&&m.jsx(T.Alert,{severity:"error",sx:{mt:1,fontSize:"0.875rem",maxHeight:"70px"},children:D}),k&&m.jsx(T.Alert,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},action:m.jsx(T.IconButton,{"aria-label":r("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{x(!1)},children:m.jsx($.Close,{fontSize:"inherit"})}),children:r("inputs.common.svgWarning")}),d.url&&m.jsxs(T.Box,{sx:{position:"relative",maxWidth:"50%",display:"block",margin:"0.5rem auto 0 auto"},children:[m.jsx("img",{src:d.url||"",alt:"",style:{width:"100%",objectFit:"contain",aspectRatio:"1 / 1",height:"auto",borderRadius:"8px",border:`2px solid ${a.palette.divider}`,backgroundColor:a.palette.background.paper,backgroundImage:`linear-gradient(45deg, ${a.palette.action.hover} 25%, transparent 25%, transparent 75%, ${a.palette.action.hover} 75%), linear-gradient(45deg, ${a.palette.action.hover} 25%, transparent 25%, transparent 75%, ${a.palette.action.hover} 75%)`,backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"}}),m.jsx(T.IconButton,{onClick:Ze,sx:{position:"absolute",top:5,right:5,backgroundColor:"background.paper",color:"error.main",padding:1,width:35,height:35,"&:hover":{backgroundColor:"error.50"}},size:"small",children:m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:m.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"})})})]})]}):m.jsxs(m.Fragment,{children:[d.url&&m.jsxs(T.Box,{sx:{position:"relative",maxWidth:"40%"},children:[m.jsx("div",{style:{borderRadius:"8px",border:`2px solid ${a.palette.divider}`,height:"100%",backgroundColor:a.palette.background.paper,backgroundImage:`linear-gradient(45deg, ${a.palette.action.hover} 25%, transparent 25%, transparent 75%, ${a.palette.action.hover} 75%), linear-gradient(45deg, ${a.palette.action.hover} 25%, transparent 25%, transparent 75%, ${a.palette.action.hover} 75%)`,backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"},children:m.jsx("img",{src:d.url||"",alt:"",style:{width:"100%",objectFit:"contain",aspectRatio:"1 / 1",height:"100%"}})}),m.jsx(T.IconButton,{onClick:Ze,sx:{position:"absolute",top:5,right:5,backgroundColor:"background.paper",color:"error.main",padding:1,width:35,height:35,"&:hover":{backgroundColor:"error.50"}},size:"small",children:m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:m.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"})})})]}),m.jsxs(T.Box,{onDragOver:de,onDragLeave:pe,onDrop:Qe,sx:{width:"100%",minWidth:"40%",border:"2px solid",borderColor:f?"primary.main":"divider",borderRadius:"8px",padding:"24px 8px 36px 8px",textAlign:"center",bgcolor:f?"primary.50":"background.paper",transition:"all 0.2s ease"},children:[m.jsx(T.Box,{sx:{display:"flex",justifyContent:"center"},children:m.jsx($.PhotoOutlined,{sx:{fontSize:32,color:"primary"}})}),m.jsxs("label",{style:{cursor:"pointer"},children:[m.jsx("input",{ref:O,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:H=>{const Te=H.target.files;Te&&Te.length>0&&Ce(Array.from(Te))}}),m.jsx(T.Typography,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:r("inputs.common.uploadFile")}),m.jsxs(T.Typography,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",r("inputs.common.dragAndDrop")]})]}),m.jsx(T.Typography,{variant:"body2",sx:{color:"text.secondary",mt:1},children:r("inputs.common.fileInfo")})]})]})}),d.url&&m.jsxs(T.Box,{sx:{mt:2},children:[m.jsxs(T.Box,{sx:{mb:2},children:[m.jsx(Vt,{label:r("inputs.backgroundImage.fillType")}),m.jsxs(T.ToggleButtonGroup,{value:d.size,exclusive:!0,onChange:(H,Te)=>{Te!==null&&F({size:Te})},size:"small",fullWidth:!0,children:[m.jsx(T.ToggleButton,{value:"cover",children:r("inputs.backgroundImage.fillOptions.cover")}),m.jsx(T.ToggleButton,{value:"contain",children:r("inputs.backgroundImage.fillOptions.contain")}),m.jsx(T.ToggleButton,{value:"auto",children:r("inputs.backgroundImage.fillOptions.auto")})]})]}),m.jsxs(T.Stack,{direction:"row",spacing:2,sx:{mb:2},children:[m.jsxs("div",{style:{flex:1},children:[m.jsx(Vt,{label:r("inputs.backgroundImage.repeat")}),m.jsxs(Zs,{style:{width:"100%"},value:d.repeat,size:"small",onChange:H=>F({repeat:H.target.value}),children:[m.jsx(T.MenuItem,{value:"no-repeat",children:r("inputs.backgroundImage.repeatOptions.none")}),m.jsx(T.MenuItem,{value:"repeat",children:r("inputs.backgroundImage.repeatOptions.repeat")}),m.jsx(T.MenuItem,{value:"repeat-x",children:r("inputs.backgroundImage.repeatOptions.repeatX")}),m.jsx(T.MenuItem,{value:"repeat-y",children:r("inputs.backgroundImage.repeatOptions.repeatY")})]})]}),m.jsxs("div",{style:{flex:1},children:[m.jsx(Vt,{label:r("inputs.backgroundImage.position")}),m.jsx(Zs,{style:{width:"100%"},value:d.position,size:"small",onChange:H=>F({position:H.target.value}),renderValue:H=>m.jsxs(T.Box,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[ee(H),Ae(H)]}),children:["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"].map(H=>m.jsx(T.MenuItem,{sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important "},value:H,children:m.jsxs(T.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[ee(H),Ae(H)]})},H))})]})]})]}),!X&&!A&&k&&m.jsx(T.Alert,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},children:r("inputs.common.svgWarning")}),(!X&&xm()&&!A||X&&_)&&m.jsxs(m.Fragment,{children:[m.jsxs(T.Stack,{direction:"row",alignItems:"center",spacing:1,sx:{mt:2},children:[m.jsx(T.Divider,{sx:{flexGrow:1}}),m.jsx(T.Typography,{sx:{color:"text.secondary"},children:r("inputs.backgroundImage.or")}),m.jsx(T.Divider,{sx:{flexGrow:1}})]}),m.jsx(T.Stack,{flexDirection:"row",gap:2,sx:{mt:2},children:!X&&xm()&&!A&&m.jsx(T.Button,{variant:"outlined",onClick:gt,startIcon:m.jsx($.ImageSearchOutlined,{}),sx:{width:"100%"},children:r("inputs.backgroundImage.browseGallery")})})]}),!X&&_&&m.jsx(JP,{src:d.url,style:{width:"100%",margin:0}})]})};function Zc(){return(Zc=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function tg(t,e){if(t==null)return{};var n,i,r={},a=Object.keys(t);for(i=0;i<a.length;i++)e.indexOf(n=a[i])>=0||(r[n]=t[n]);return r}function jd(t){var e=v.useRef(t),n=v.useRef(function(i){e.current&&e.current(i)});return e.current=t,n.current}var Vd=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t<e?e:t},pd=function(t){return"touches"in t},n1=function(t){return t&&t.ownerDocument.defaultView||self},$x=function(t,e,n){var i=t.getBoundingClientRect(),r=pd(e)?(function(a,s){for(var o=0;o<a.length;o++)if(a[o].identifier===s)return a[o];return a[0]})(e.touches,n):e;return{left:Vd((r.pageX-(i.left+n1(t).pageXOffset))/i.width),top:Vd((r.pageY-(i.top+n1(t).pageYOffset))/i.height)}},zx=function(t){!pd(t)&&t.preventDefault()},ZP=v.memo(function(t){var e=t.onMove,n=t.onKey,i=tg(t,["onMove","onKey"]),r=v.useRef(null),a=jd(e),s=jd(n),o=v.useRef(null),l=v.useRef(!1),c=v.useMemo(function(){var f=function(g){zx(g),(pd(g)?g.touches.length>0:g.buttons>0)&&r.current?a($x(r.current,g,o.current)):_(!1)},h=function(){return _(!1)};function _(g){var b=l.current,y=n1(r.current),E=g?y.addEventListener:y.removeEventListener;E(b?"touchmove":"mousemove",f),E(b?"touchend":"mouseup",h)}return[function(g){var b=g.nativeEvent,y=r.current;if(y&&(zx(b),!(function(S,C){return C&&!pd(S)})(b,l.current)&&y)){if(pd(b)){l.current=!0;var E=b.changedTouches||[];E.length&&(o.current=E[0].identifier)}y.focus(),a($x(y,b,o.current)),_(!0)}},function(g){var b=g.which||g.keyCode;b<37||b>40||(g.preventDefault(),s({left:b===39?.05:b===37?-.05:0,top:b===40?.05:b===38?-.05:0}))},_]},[s,a]),u=c[0],d=c[1],p=c[2];return v.useEffect(function(){return p},[p]),v.createElement("div",Zc({},i,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:r,onKeyDown:d,tabIndex:0,role:"slider"}))}),iT=function(t){return t.filter(Boolean).join(" ")},eL=function(t){var e=t.color,n=t.left,i=t.top,r=i===void 0?.5:i,a=iT(["react-colorful__pointer",t.className]);return v.createElement("div",{className:a,style:{top:100*r+"%",left:100*n+"%"}},v.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},jn=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n},r7=function(t){return c7(i1(t))},i1=function(t){return t[0]==="#"&&(t=t.substring(1)),t.length<6?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?jn(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16),a:t.length===8?jn(parseInt(t.substring(6,8),16)/255,2):1}},a7=function(t){return l7(o7(t))},s7=function(t){var e=t.s,n=t.v,i=t.a,r=(200-e)*n/100;return{h:jn(t.h),s:jn(r>0&&r<200?e*n/100/(r<=100?r:200-r)*100:0),l:jn(r/2),a:jn(i,2)}},r1=function(t){var e=s7(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},o7=function(t){var e=t.h,n=t.s,i=t.v,r=t.a;e=e/360*6,n/=100,i/=100;var a=Math.floor(e),s=i*(1-n),o=i*(1-(e-a)*n),l=i*(1-(1-e+a)*n),c=a%6;return{r:jn(255*[i,o,s,s,l,i][c]),g:jn(255*[l,i,i,o,s,s][c]),b:jn(255*[s,s,l,i,i,o][c]),a:jn(r,2)}},af=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},l7=function(t){var e=t.r,n=t.g,i=t.b,r=t.a,a=r<1?af(jn(255*r)):"";return"#"+af(e)+af(n)+af(i)+a},c7=function(t){var e=t.r,n=t.g,i=t.b,r=t.a,a=Math.max(e,n,i),s=a-Math.min(e,n,i),o=s?a===e?(n-i)/s:a===n?2+(i-e)/s:4+(e-n)/s:0;return{h:jn(60*(o<0?o+6:o)),s:jn(a?s/a*100:0),v:jn(a/255*100),a:r}},u7=v.memo(function(t){var e=t.hue,n=t.onChange,i=iT(["react-colorful__hue",t.className]);return v.createElement("div",{className:i},v.createElement(ZP,{onMove:function(r){n({h:360*r.left})},onKey:function(r){n({h:Vd(e+360*r.left,0,360)})},"aria-label":"Hue","aria-valuenow":jn(e),"aria-valuemax":"360","aria-valuemin":"0"},v.createElement(eL,{className:"react-colorful__hue-pointer",left:e/360,color:r1({h:e,s:100,v:100,a:1})})))}),d7=v.memo(function(t){var e=t.hsva,n=t.onChange,i={backgroundColor:r1({h:e.h,s:100,v:100,a:1})};return v.createElement("div",{className:"react-colorful__saturation",style:i},v.createElement(ZP,{onMove:function(r){n({s:100*r.left,v:100-100*r.top})},onKey:function(r){n({s:Vd(e.s+100*r.left,0,100),v:Vd(e.v-100*r.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+jn(e.s)+"%, Brightness "+jn(e.v)+"%"},v.createElement(eL,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:r1(e)})))}),tL=function(t,e){if(t===e)return!0;for(var n in t)if(t[n]!==e[n])return!1;return!0},p7=function(t,e){return t.toLowerCase()===e.toLowerCase()||tL(i1(t),i1(e))};function f7(t,e,n){var i=jd(n),r=v.useState(function(){return t.toHsva(e)}),a=r[0],s=r[1],o=v.useRef({color:e,hsva:a});v.useEffect(function(){if(!t.equal(e,o.current.color)){var c=t.toHsva(e);o.current={hsva:c,color:e},s(c)}},[e,t]),v.useEffect(function(){var c;tL(a,o.current.hsva)||t.equal(c=t.fromHsva(a),o.current.color)||(o.current={hsva:a,color:c},i(c))},[a,t,i]);var l=v.useCallback(function(c){s(function(u){return Object.assign({},u,c)})},[]);return[a,l]}var m7=typeof window<"u"?v.useLayoutEffect:v.useEffect,h7=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},Gx=new Map,g7=function(t){m7(function(){var e=t.current?t.current.ownerDocument:document;if(e!==void 0&&!Gx.has(e)){var n=e.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,Gx.set(e,n);var i=h7();i&&n.setAttribute("nonce",i),e.head.appendChild(n)}},[])},_7=function(t){var e=t.className,n=t.colorModel,i=t.color,r=i===void 0?n.defaultColor:i,a=t.onChange,s=tg(t,["className","colorModel","color","onChange"]),o=v.useRef(null);g7(o);var l=f7(n,r,a),c=l[0],u=l[1],d=iT(["react-colorful",e]);return v.createElement("div",Zc({},s,{ref:o,className:d}),v.createElement(d7,{hsva:c,onChange:u}),v.createElement(u7,{hue:c.h,onChange:u,className:"react-colorful__last-control"}))},b7={defaultColor:"000",toHsva:r7,fromHsva:function(t){return a7({h:t.h,s:t.s,v:t.v,a:1})},equal:p7},y7=function(t){return v.createElement(_7,Zc({},t,{colorModel:b7}))},E7=/^#?([0-9A-F]{3,8})$/i,S7=function(t){var e=t.color,n=e===void 0?"":e,i=t.onChange,r=t.onBlur,a=t.escape,s=t.validate,o=t.format,l=t.process,c=tg(t,["color","onChange","onBlur","escape","validate","format","process"]),u=v.useState(function(){return a(n)}),d=u[0],p=u[1],f=jd(i),h=jd(r),_=v.useCallback(function(b){var y=a(b.target.value);p(y),s(y)&&f(l?l(y):y)},[a,l,s,f]),g=v.useCallback(function(b){s(b.target.value)||p(a(n)),h(b)},[n,a,s,h]);return v.useEffect(function(){p(a(n))},[n,a]),v.createElement("input",Zc({},c,{value:o?o(d):d,spellCheck:"false",onChange:_,onBlur:g}))},qx=function(t){return"#"+t},v7=function(t){var e=t.prefixed,n=t.alpha,i=tg(t,["prefixed","alpha"]),r=v.useCallback(function(s){return s.replace(/([^0-9A-F]+)/gi,"").substring(0,n?8:6)},[n]),a=v.useCallback(function(s){return(function(o,l){var c=E7.exec(o),u=c?c[1].length:0;return u===3||u===6||!!l&&u===4||!!l&&u===8})(s,n)},[n]);return v.createElement(S7,Zc({},i,{escape:r,format:e?qx:void 0,process:qx,validate:a}))};const Hx={width:24,height:24};function T7({paletteColors:t,isLocked:e,onToggleLock:n,onChange:i}){const r=G.useTheme(),a=t.slice(30);return m.jsxs(T.Stack,{spacing:1,children:[m.jsx("div",{style:{height:1,width:"100%",margin:"8px 0",backgroundColor:r.palette.grey[400]}}),m.jsxs(T.Box,{display:"grid",gridTemplateColumns:"repeat(6, 1fr)",gap:"4px",children:[a.map((s,o)=>m.jsx(T.Button,{sx:{...Hx,backgroundColor:s,border:"1px solid",margin:"0!important",borderColor:r.palette.grey[50],minWidth:24,display:"inline-flex","&:hover":{backgroundColor:s,borderColor:"grey.500"}},onClick:()=>i&&i(s)},o+29)),n&&m.jsx(T.Button,{onClick:n,sx:{backgroundColor:"transparent",border:"1px solid",...Hx,minWidth:24,margin:"0!important",borderColor:e?r.palette.error.main:r.palette.divider,display:"inline-flex",color:e?r.palette.error.main:r.palette.text.secondary,"&:hover":{backgroundColor:e?r.palette.error.light+"20":"action.hover",borderColor:e?r.palette.error.main:r.palette.text.secondary}},title:e?"Unlock recent colors":"Lock recent colors",children:e?m.jsx($.Lock,{fontSize:"small"}):m.jsx($.LockOpen,{fontSize:"small"})})]})]})}const C7={p:1,".react-colorful__pointer ":{width:16,height:16},".react-colorful__saturation":{mb:1,borderRadius:"8px"},".react-colorful__last-control":{borderRadius:"8px"},".react-colorful__hue-pointer":{width:"4px",borderRadius:"8px",height:24,cursor:"col-resize"},".react-colorful__saturation-pointer":{cursor:"all-scroll"},input:{padding:1,border:"1px solid",borderColor:"grey.300",borderRadius:"8px",width:"100%"}},jx=(t,e)=>{if(!t||t.trim()==="")return e;const i=e.slice(-5),r=e.slice(0,30),a=i.filter(o=>o!==t&&o!==""),s=[t,...a].slice(0,5);for(;s.length<5;)s.push("");return[...r,...s]};function a1({value:t,nullable:e,onChange:n}){const[i,r]=v.useState(t||"#000000"),[a,s]=v.useState(null),{paletteColors:o,isLocked:l}=mG(),[c,u]=v.useState(!1),d=G.useTheme(),p=v.useCallback(b=>{if(l)return;a&&clearTimeout(a);const y=setTimeout(()=>{const E=jx(b,o);h_({paletteColors:E})},300);s(y)},[a,l,o]),f=()=>{const b=!l;if(h_({isLocked:b}),!b&&i){const y=jx(i,o);h_({isLocked:b,paletteColors:y})}},h=b=>{u(!0),r(b)},_=()=>{n(i),p(i)},g=b=>{r(b),n(b),p(b)};return v.useEffect(()=>{t!==i&&r(t||"#000000")},[t]),v.useEffect(()=>()=>{a&&clearTimeout(a)},[a]),m.jsxs(T.Stack,{spacing:1,sx:C7,children:[m.jsx(y7,{color:i,onChange:h,onMouseUp:_,onTouchEnd:_,onMouseLeave:b=>c?_():null}),m.jsx(T7,{isLocked:l,onToggleLock:f,paletteColors:o,value:t,nullable:e,onChange:b=>{b?(r(b),n(b),p(b)):n(null)}}),m.jsxs(T.Box,{pt:1,display:"flex",gap:1,alignItems:"center",children:[m.jsx(v7,{prefixed:!0,color:i,onChange:g,style:{flex:1,backgroundColor:d.palette.background.paper,color:d.palette.text.primary,padding:"1px 4px",fontSize:"12px"}}),e&&m.jsx(T.Button,{onClick:()=>n&&n(null),sx:{backgroundColor:"transparent",width:24,height:24,minWidth:24,margin:"0!important",borderColor:d.palette.divider,display:"inline-flex","&:hover":{backgroundColor:"action.hover",borderColor:d.palette.text.secondary}},children:m.jsx($.FormatColorReset,{color:"primary",fontSize:"small"})})]})]})}function nL({label:t,defaultValue:e,onChange:n,nullable:i,compact:r=!1,...a}){const[s,o]=v.useState(null),[l,c]=v.useState(e),{t:u}=Ke.useTranslation("inspector");v.useEffect(()=>{l!==e&&c(e)},[e]);const d=b=>{o(b.currentTarget)},p=r?{border:"1px solid",borderColor:"cadet.400",width:28,height:28,borderRadius:"8px",bgcolor:"#FFFFFF"}:{border:t?"1px solid":"",borderColor:"cadet.400",width:"100%",height:36,paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",borderRadius:"8px",bgcolor:"#FFFFFF"},f=b=>{c(b),n(b)},h=()=>!i||typeof l!="string"||l.trim().length===0?null:m.jsx(T.Tooltip,{disableInteractive:!0,arrow:!0,title:u("inputs.background.reset"),placement:"left",children:m.jsx(T.Box,{sx:{minWidth:24,lineHeight:1,flexShrink:0,pr:"4px",display:"grid",placeItems:"center"},onClick:()=>f(null),children:m.jsx($.FormatColorReset,{sx:{color:"primary.main"}})})}),_=l?m.jsx(T.ButtonBase,{onClick:d,sx:{...p,bgcolor:l}}):m.jsx(T.ButtonBase,{onClick:d,sx:{...p},children:m.jsx($.AddOutlined,{fontSize:"small"})}),g=m.jsx(T.Menu,{anchorEl:s,open:!!s,onClose:()=>o(null),sx:{"& .MuiPaper-root":{boxShadow:"0 4px 6px rgba(0, 0, 0, 0.4);",borderRadius:1,maxWidth:"200px",transform:"translateX(-100%) !important;"}},MenuListProps:{sx:{height:"auto",padding:0}},children:m.jsx(a1,{value:l||"",nullable:i,onChange:b=>f(b)})});return r?m.jsxs(m.Fragment,{children:[_,g]}):m.jsxs(Wn,{children:[m.jsx(Vt,{label:t}),m.jsxs(T.Stack,{direction:"row",alignContent:"center",spacing:1,children:[_,h()]}),g]})}function Ko(t){return m.jsx(nL,{...t,nullable:!1})}function __(t){return m.jsx(nL,{...t,nullable:!0})}const Vx=({mobile:t=!1,label:e,borderColor:n,borderTop:i,borderBottom:r,borderLeft:a,borderRight:s,onChange:o})=>{const{t:l}=Ke.useTranslation("inspector"),c=()=>t?{top:"borderTopMobile",bottom:"borderBottomMobile",left:"borderLeftMobile",right:"borderRightMobile"}:{top:"borderTop",bottom:"borderBottom",left:"borderLeft",right:"borderRight"},u=w=>{const k=Object.values(w);return k.every(x=>x===k[0])},d=c(),p={[d.top]:i??0,[d.bottom]:r??0,[d.left]:a??0,[d.right]:s??0},[f,h]=v.useState(()=>u(p)?"all":"custom"),[_,g]=v.useState(n??"#000000"),[b,y]=v.useState(p);v.useEffect(()=>{n!==_&&g(n??"#000000");const w={[d.top]:i??0,[d.bottom]:r??0,[d.left]:a??0,[d.right]:s??0};Object.keys(w).some(x=>b[x]!==w[x])&&(y(w),u(w)||h("custom"))},[n,i,r,a,s,t]);const E=()=>{if(f!=="all"){const w=b[d.top]??0;C(w),h("all")}else h("custom")},S=w=>{g(w),o({borderColor:w,...b})},C=w=>{const k={[d.top]:w,[d.bottom]:w,[d.left]:w,[d.right]:w};y(k),o({...k,borderColor:_})},D=(w,k)=>{y(O=>({...O,[k]:w}));const x={...b,borderColor:_,[k]:w};u(x)||h("custom"),o(x)};return m.jsxs("div",{children:[m.jsxs(T.Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[m.jsx(Vt,{label:e}),m.jsxs(T.Stack,{direction:"row",spacing:1,alignItems:"center",children:[m.jsx(Ko,{defaultValue:_,onChange:S,compact:!0}),m.jsx(T.Tooltip,{title:l(f==="all"?"border.unlockBorders":"border.lockBordersTogether"),children:m.jsx(T.IconButton,{size:"small",onClick:E,sx:{color:f==="all"?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:f==="all"?m.jsx($.Lock,{fontSize:"small"}):m.jsx($.LockOpen,{fontSize:"small"})})})]})]}),f==="all"&&m.jsx(Po,{label:"",iconLabel:m.jsx($.BorderOuterOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[d.top],onChange:C}),f==="custom"&&m.jsxs(T.Stack,{spacing:2,children:[m.jsx(Po,{label:"",iconLabel:m.jsx($.BorderTopOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[d.top],onChange:w=>D(w,d.top)}),m.jsx(Po,{label:"",iconLabel:m.jsx($.BorderBottomOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[d.bottom],onChange:w=>D(w,d.bottom)}),m.jsx(Po,{label:"",iconLabel:m.jsx($.BorderLeftOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[d.left],onChange:w=>D(w,d.left)}),m.jsx(Po,{label:"",iconLabel:m.jsx($.BorderRightOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[d.right],onChange:w=>D(w,d.right)})]})]})},iL=[{key:"INHERIT",label:"Inherit",value:"inherit"},{key:"LATO",label:"Lato",value:'"Lato", sans-serif'},{key:"MERRIWEATHER",label:"Merriweather",value:'"Merriweather", serif'},{key:"MONTSERRAT",label:"Montserrat",value:'"Montserrat", sans-serif'},{key:"OPEN_SANS",label:"Open Sans",value:'"Open Sans", sans-serif'},{key:"OSWALD",label:"Oswald",value:'"Oswald", sans-serif'},{key:"PACIFICO",label:"Pacifico",value:'"Pacifico", cursive'},{key:"PLAYFAIR",label:"Playfair",value:'"Playfair", serif'},{key:"ROBOTO",label:"Roboto",value:'"Roboto", sans-serif'},{key:"MODERN_SANS",label:"Modern sans",value:'"Helvetica Neue", "Arial Nova", "Nimbus Sans", Arial, sans-serif'}],k7={FAMILY:"MODERN_SANS"},eu=jt(["MODERN_SANS","LATO","MERRIWEATHER","MONTSERRAT","OPEN_SANS","OSWALD","PACIFICO","PLAYFAIR","ROBOTO","INHERIT"]).nullable().optional(),Yx=t=>iL.find(e=>e.key===t)?.value;function es(t){const e=nG();let n=Yx(t);return n||(n=Yx(e?.fontFamily),n||"inherit")}const x7=iL.map(t=>m.jsx(T.MenuItem,{value:t.key,sx:{fontFamily:t.value},children:t.label},t.key));function rL({label:t,onChange:e,defaultValue:n}){const i="INHERIT",[r,a]=v.useState(n??i);v.useEffect(()=>{r!==n&&a(n??i)},[n]);const s=o=>{const l=o?.target?.value;a(l),e(l===null?null:l)};return m.jsxs(Wn,{children:[m.jsx(Vt,{label:t}),m.jsx(Zs,{style:{width:"100%"},value:r,size:"small",onChange:s,children:x7})]})}function Wx({label:t,defaultValue:e=16,onChange:n,maxValue:i,minValue:r,step:a}){const[s,o]=v.useState(e);v.useEffect(()=>{s!==e&&o(e)},[e]);const l=c=>{o(c),n(c)};return m.jsxs(Wn,{children:[m.jsx(Vt,{label:t}),m.jsx(cn,{iconLabel:m.jsx($.TextFieldsOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:s,setValue:l,units:"px",step:a??2,min:r||8,max:i||48})]})}function so({label:t,children:e,defaultValue:n,onChange:i}){const[r,a]=v.useState(n);return v.useEffect(()=>{n!==r&&a(n)},[n]),m.jsxs(Wn,{children:[m.jsx(Vt,{label:t}),m.jsx(T.Box,{sx:{...QG,paddingLeft:"0px",paddingRight:"0px"},children:m.jsx(T.ToggleButtonGroup,{exclusive:!0,fullWidth:!0,value:r,size:"small",sx:{width:"100%"},onChange:(s,o)=>{if(typeof o!="string")throw new Error("RadioGroupInput can only receive string values");a(o),i(o)},children:e})})]})}function D7({label:t,defaultValue:e,onChange:n}){const[i,r]=v.useState(e);return v.useEffect(()=>{i!==e&&r(e)},[e]),m.jsxs(so,{label:t,defaultValue:i,onChange:a=>{r(a),n(a)},children:[m.jsx(T.ToggleButton,{value:"normal",children:"Regular"}),m.jsx(T.ToggleButton,{value:"bold",children:"Bold"})]})}const Kx=({label:t,defaultValue:e,onChange:n})=>{const{t:i}=Ke.useTranslation("inspector"),r=t??i("inputs.common.height");return m.jsx(cn,{label:r,iconLabel:m.jsx($.HeightOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:1,max:100,marks:!1,value:e??1,setValue:n})},w7=[{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)"}],A7=w7.map(t=>m.jsx(T.MenuItem,{value:t.key,children:t.label},t.key));function N7({label:t,onChange:e,defaultValue:n}){const i="INHERIT",[r,a]=v.useState(n?.toString()??i);v.useEffect(()=>{r!==n?.toString()&&a(n?.toString()??i)},[n]);const s=o=>{const l=o?.target?.value;a(l),e(l===i?null:parseFloat(l))};return m.jsxs(Wn,{children:[m.jsx(Vt,{label:t}),m.jsxs(Zs,{style:{width:"100%"},value:r,size:"small",onChange:s,children:[m.jsx(T.MenuItem,{value:i,children:"Default value"}),A7]})]})}function Qx({label:t,defaultValue:e,onChange:n}){const{t:r}=Ke.useTranslation("inspector"),[a,s]=v.useState(()=>e||{top:0,left:0,bottom:0,right:0});v.useEffect(()=>{e&&(e.top!==a.top||e.left!==a.left||e.bottom!==a.bottom||e.right!==a.right)&&s(e)},[e]);const[o,l]=v.useState(!1);function c(d,p){let f;o?f={top:p,bottom:p,left:p,right:p}:f={...a,[d]:p},s(f),n(f)}const u=()=>{if(!o){const d={top:a.top,bottom:a.top,left:a.top,right:a.top};s(d),n(d)}l(!o)};return m.jsxs(Wn,{children:[m.jsxs(T.Stack,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[m.jsx(Vt,{label:t}),m.jsx(T.Tooltip,{title:r(o?"inputs.responsiveSize.unlockTooltip":"inputs.responsiveSize.lockTooltip"),children:m.jsx(T.IconButton,{size:"small",onClick:u,sx:{marginTop:"0!important",color:o?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:o?m.jsx($.Lock,{fontSize:"small"}):m.jsx($.LockOpen,{fontSize:"small"})})})]}),o?m.jsx(cn,{iconLabel:m.jsx("span",{children:r("inputs.responsiveSize.allSides")}),value:a.top,setValue:d=>c("top",d),units:"px",step:16,min:0,max:120,marks:!0}):m.jsxs(m.Fragment,{children:[m.jsx(cn,{iconLabel:m.jsx($.AlignVerticalTopOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:a.top,setValue:d=>c("top",d),units:"px",step:16,min:0,max:120,marks:!0}),m.jsx(cn,{iconLabel:m.jsx($.AlignVerticalBottomOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:a.bottom,setValue:d=>c("bottom",d),units:"px",step:16,min:0,max:120,marks:!0}),m.jsx(cn,{iconLabel:m.jsx($.AlignHorizontalLeftOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:a.left,setValue:d=>c("left",d),units:"px",step:16,min:0,max:120,marks:!0}),m.jsx(cn,{iconLabel:m.jsx($.AlignHorizontalRightOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:a.right,setValue:d=>c("right",d),units:"px",step:16,min:0,max:120,marks:!0})]})]})}const I7=({label:t,defaultValue:e,onChange:n,maxValue:i=600,shapeSteps:r=8})=>{const{t:a}=Ke.useTranslation("inspector"),[s,o]=v.useState(()=>typeof e=="object"&&e!==null?"rectangle":e||"rectangle"),[l,c]=v.useState(()=>typeof e=="object"&&e!==null?e:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0}),[u,d]=v.useState(!1);v.useEffect(()=>{typeof e=="object"&&e!==null?(c(e),o("rounded")):e&&o(e)},[e]);const p=b=>{o(b),n(b==="rounded"?l:b)},f=(b,y)=>{let E;u?E={topLeft:y,topRight:y,bottomLeft:y,bottomRight:y}:E={...l,[b]:y},c(E),n(E)},h=()=>{if(!u){const b={topLeft:l.topLeft,topRight:l.topLeft,bottomLeft:l.topLeft,bottomRight:l.topLeft};c(b),n(b)}d(!u)},_=i,g=t||a("shape.label");return m.jsxs(m.Fragment,{children:[m.jsxs(so,{label:g,defaultValue:s,onChange:p,children:[m.jsx(T.ToggleButton,{value:"rectangle",children:a("shape.square")}),m.jsx(T.ToggleButton,{value:"pill",children:a("shape.pill")}),m.jsx(T.ToggleButton,{value:"rounded",children:a("shape.custom")})]}),s==="rounded"&&m.jsxs(T.Stack,{spacing:2,alignItems:"flexStart",pb:1,children:[m.jsxs(T.Stack,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[m.jsx(Vt,{label:a("shape.borderRadius")}),m.jsx(T.Tooltip,{title:a(u?"shape.unlockTooltip":"shape.lockTooltip"),children:m.jsx(T.IconButton,{size:"small",onClick:h,sx:{marginTop:"0!important",color:u?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:u?m.jsx($.Lock,{fontSize:"small"}):m.jsx($.LockOpen,{fontSize:"small"})})})]}),u?m.jsx(m.Fragment,{children:m.jsx(cn,{iconLabel:m.jsx($.RoundedCorner,{sx:{fontSize:16}}),value:l.topRight,setValue:b=>f("topLeft",b),units:"px",min:0,step:r,marks:r>1,max:_})}):m.jsxs(m.Fragment,{children:[m.jsx(cn,{iconLabel:m.jsx($.RoundedCorner,{sx:{fontSize:16,transform:"rotate(0deg)"}}),value:l.topLeft,setValue:b=>f("topLeft",b),units:"px",min:0,step:r,marks:r>1,max:_}),m.jsx(cn,{iconLabel:m.jsx($.RoundedCorner,{sx:{fontSize:16,transform:"rotate(270deg)"}}),value:l.topRight,setValue:b=>f("topRight",b),units:"px",min:0,step:r,marks:r>1,max:_}),m.jsx(cn,{iconLabel:m.jsx($.RoundedCorner,{sx:{fontSize:16,transform:"rotate(180deg)"}}),value:l.bottomLeft,setValue:b=>f("bottomLeft",b),units:"px",min:0,step:r,marks:r>1,max:_}),m.jsx(cn,{iconLabel:m.jsx($.RoundedCorner,{sx:{fontSize:16,transform:"rotate(90deg)"}}),value:l.bottomRight,setValue:b=>f("bottomRight",b),units:"px",min:0,step:r,marks:r>1,max:_})]})]})]})};function Xx({label:t,defaultValue:e,onChange:n}){const[i,r]=v.useState(e??"left");return v.useEffect(()=>{e!==i&&r(e??"left")},[e]),m.jsxs(Wn,{children:[m.jsx(Vt,{label:t}),m.jsxs(so,{label:"",defaultValue:i,onChange:a=>{r(a),n(a)},children:[m.jsx(T.ToggleButton,{value:"left",children:m.jsx($.FormatAlignLeftOutlined,{fontSize:"small"})}),m.jsx(T.ToggleButton,{value:"center",children:m.jsx($.FormatAlignCenterOutlined,{fontSize:"small"})}),m.jsx(T.ToggleButton,{value:"right",children:m.jsx($.FormatAlignRightOutlined,{fontSize:"small"})})]})]})}const Jx=({label:t,defaultValue:e,onChange:n,step:i,...r})=>{const{t:a}=Ke.useTranslation("inspector"),s=t??a("inputs.common.width");return m.jsx(cn,{label:s,iconLabel:m.jsx($.HeightOutlined,{sx:{color:"text.primary",transform:"rotate(90deg)"}}),units:"%",step:i,min:1,max:100,marks:!1,value:e??1,setValue:n,...r})};function O7({name:t,value:e,onChange:n,shapeMaxValue:i,shapeSteps:r}){const a=dn(),s=Zh(),{t:o}=Ke.useTranslation("inspector"),l=(f,h)=>{const _=e[f],g=e[h];return _??g},c=(f,h)=>{n(h?{...e,...h,[t]:f}:{...e,[t]:f})},u=f=>{n({...e,...f})},p=(()=>{switch(t){case"textAlignMobile":return l("textAlignMobile","textAlign");case"mobilePadding":return l("mobilePadding","padding");case"fontSizeMobile":return l("fontSizeMobile","fontSize")??16;case"heightMobile":return l("heightMobile","height");case"widthMobile":return l("widthMobile","width");case"borderMobile":return{borderTop:l("borderTopMobile","borderTop"),borderBottom:l("borderBottomMobile","borderBottom"),borderLeft:l("borderLeftMobile","borderLeft"),borderRight:l("borderRightMobile","borderRight")};default:return e[t]??null}})();switch(t){case"backgroundColor":return m.jsx(__,{label:o("properties.backgroundColor"),defaultValue:p??s?.canvasColor,onChange:c});case"background":return m.jsx(i7,{defaultValue:p,onChange:(f,h)=>c(f,h),values:e});case"borderColor":return m.jsx(__,{label:o("properties.border"),defaultValue:p,onChange:c});case"borderRadius":return m.jsx(Po,{iconLabel:m.jsx($.RoundedCornerOutlined,{}),units:"px",step:4,marks:!0,min:0,max:48,label:o("properties.borderRadius"),defaultValue:p,onChange:c});case"color":return m.jsx(__,{label:o("properties.color"),defaultValue:p,onChange:c});case"fontFamily":return m.jsx(rL,{label:o("properties.fontFamily"),defaultValue:p,onChange:c});case"fontWeight":return m.jsx(D7,{label:o("properties.fontWeight"),defaultValue:p,onChange:c});case"textAlign":return a==="desktop"&&m.jsx(Xx,{label:o("properties.alignment"),defaultValue:p,onChange:c});case"textAlignMobile":return a!="desktop"&&m.jsx(Xx,{label:o("properties.alignment"),defaultValue:p,onChange:c});case"padding":return a==="desktop"&&m.jsx(Qx,{label:o("properties.padding"),defaultValue:p,onChange:c});case"mobilePadding":return a!="desktop"&&m.jsx(Qx,{label:o("properties.padding"),defaultValue:p,onChange:c});case"fontSize":return a==="desktop"&&m.jsx(Wx,{maxValue:80,step:8,label:o("properties.fontSize"),defaultValue:p??16,onChange:c});case"fontSizeMobile":return a!="desktop"&&m.jsx(Wx,{maxValue:80,step:8,label:o("properties.fontSize"),defaultValue:p,onChange:c});case"lineHeight":return m.jsx(N7,{label:o("properties.lineHeight"),defaultValue:p??1.5,onChange:c});case"shape":return m.jsx(I7,{shapeSteps:r,maxValue:i,label:o("properties.shape"),defaultValue:p,onChange:c});case"height":return a==="desktop"&&m.jsx(Kx,{label:o("properties.height"),defaultValue:p,onChange:c});case"heightMobile":return a!="desktop"&&m.jsx(Kx,{label:o("properties.height"),defaultValue:p,onChange:c});case"width":return a==="desktop"&&m.jsx(Jx,{label:o("properties.width"),defaultValue:p,onChange:c});case"widthMobile":return a!="desktop"&&m.jsx(Jx,{label:o("properties.width"),defaultValue:p,onChange:c});case"border":return a==="desktop"&&m.jsx(Vx,{label:o("properties.border"),borderColor:e.borderColor??null,borderTop:e.borderTop??null,borderBottom:e.borderBottom??null,borderLeft:e.borderLeft??null,borderRight:e.borderRight??null,onChange:u});case"borderMobile":return a!="desktop"&&m.jsx(Vx,{mobile:!0,label:o("properties.border"),borderColor:e.borderColor??null,borderTop:p.borderTop??null,borderBottom:p.borderBottom??null,borderLeft:p.borderLeft??null,borderRight:p.borderRight??null,onChange:u});default:return null}}function di({names:t,value:e,onChange:n,disabledCSSValidation:i=!1,shapeMaxValue:r,shapeSteps:a}){const s=va(),o=PP();return(i||s=="css"||_m.includes(o||""))&&m.jsx(m.Fragment,{children:t.map(l=>m.jsx(O7,{shapeMaxValue:r,shapeSteps:a,name:l,value:e||{},onChange:n},l))})}const rT=t=>t?["http","mailto:","tel:","sms:","whatsapp:"].some(n=>t.startsWith(n))?t:`//${t}`:"#",Bm=Le({top:se(),bottom:se(),right:se(),left:se()}).optional().nullable(),Tp=t=>t?{top:t?.top??0,right:t?.right??0,bottom:t?.bottom??0,left:t?.left??0}:{top:0,right:0,bottom:0,left:0},R7=Le({topLeft:se().min(0).optional(),topRight:se().min(0).optional(),bottomLeft:se().min(0).optional(),bottomRight:se().min(0).optional()}),aT=Le({style:Le({padding:Bm,mobilePadding:Bm,background:Me().nullable().optional(),backgroundColor:Me().regex(/^#[0-9a-fA-F]{6}$/).optional().nullable(),textAlign:jt(["center","left","right"]).optional().nullable(),textAlignMobile:jt(["center","left","right"]).optional().nullable(),shape:bc([jt(["rectangle","pill"]),R7]).optional().nullable()}),props:Le({touched:Nc().optional().nullable(),scale:se().optional().nullable(),size:Me().optional().nullable(),sizeMobile:Me().optional().nullable(),width:se().optional().nullable(),widthMobile:se().optional().nullable(),scaleMobile:se().optional().nullable(),touchedMobile:Nc().optional().nullable(),original_width:se().optional().nullable(),height:se().optional().nullable(),url:Me().optional().nullable(),alt:Me().optional().nullable(),linkHref:Me().optional().nullable(),contentAlignment:jt(["top","middle","bottom"]).optional().nullable()}).optional().nullable()}).passthrough();function aL({style:t,props:e,blockId:n}){const i=dn(),r=Jh(),a={padding:Tp(i=="desktop"?t?.padding:t?.mobilePadding??t?.padding),backgroundColor:t?.backgroundColor??void 0,textAlign:i=="desktop"?t?.textAlign??void 0:t?.textAlignMobile??t?.textAlign??void 0},s=(g,b)=>g==="fill"?"100%":g==="scale"?`${b}%`:e?.width,o=e?.linkHref??null,l=i=="desktop"?s(e?.size,e?.scale):s(e?.sizeMobile,e?.scaleMobile),c={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},u=t?.background??"",d=t?.backgroundColor,p=d?Tl(u,d):u,f=g=>{const b=g.currentTarget;setTimeout(()=>{if(!e?.width&&b.offsetWidth){const y=b.offsetWidth;gG(n,{...e,width:y})}},100)},h=m.jsxs(m.Fragment,{children:[m.jsx("img",{alt:e?.alt??"",src:e?.url??"",width:l,onLoad:f,style:{width:l,height:"auto",outline:"none",border:"none",textDecoration:"none",verticalAlign:e?.contentAlignment??"middle",display:"inline-block",maxWidth:"100%",opacity:r.uploading&&r.id===n?.5:1,transition:"opacity 0.2s ease-in-out",borderRadius:Fm(t)}}),r.uploading&&r.id===n&&m.jsx("div",{style:c,children:m.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle",style:{width:"32px",height:"32px",animation:"1s linear infinite spin",stroke:"currentColor"},children:m.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})]}),_=dt(n);return o?m.jsx(fi,{className:`${_}`,padding:a.padding,background:p,align:a.textAlign,width:"100%",children:m.jsx("a",{href:rT(o),style:{textDecoration:"none",display:"block",width:"100%",height:"100%"},target:"_blank",children:h})}):m.jsx(fi,{className:`${_}`,padding:a.padding,background:p,align:a.textAlign,width:"100%",children:h})}const sL=({data:t,setData:e,blockId:n})=>{const{t:i}=Ke.useTranslation("inspector"),[r,a]=v.useState(!1),[s,o]=v.useState(()=>!!window.__emailBuilderEnableAI),[,l]=v.useState(null),[c,u]=v.useState(""),[d,p]=v.useState(!1),[f,h]=v.useState(""),[_,g]=v.useState(!1),b=v.useRef(null),y=Z0(),[E,S]=v.useState(null);v.useEffect(()=>{const F=window.__emailBuilderCustomImageProvider;F&&(S(F),setTimeout(()=>{n&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:n,currentImageUrl:t.props?.url||null,alt:t.props?.alt||null}}))},100))},[]);const C=F=>{const K=aT.safeParse(F);K.success?(e(K.data),l(null)):l(K.error)},D=(F,K)=>{const re=F.toLowerCase(),ke=re.includes(".svg")||re.includes("svg"),ue=K&&(K.includes("image/svg+xml")||K.includes("svg"));return ke||!!ue},w=async F=>{try{p(!0),h(""),g(!1);try{new URL(F)}catch{return h(i("inputs.image.invalidUrl")),!1}const K=new AbortController,re=setTimeout(()=>K.abort(),1e4);try{const ke=await fetch(F,{method:"HEAD",signal:K.signal});if(clearTimeout(re),!ke.ok)return h(`HTTP ${ke.status}: ${ke.statusText}`),!1;const ue=ke.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(de=>ue&&ue.toLowerCase().includes(de.toLowerCase()))?(D(F,ue)&&g(!0),h(""),!0):(h(i("inputs.image.notImage")),!1)}catch(ke){return clearTimeout(re),ke.name==="AbortError"?(h(i("inputs.image.timeout")),!1):new Promise(ue=>{const Ue=new Image,Ce=setTimeout(()=>{h(i("inputs.image.timeout")),ue(!1)},1e4);Ue.onload=()=>{clearTimeout(Ce),D(F)&&g(!0),h(""),ue(!0)},Ue.onerror=()=>{clearTimeout(Ce),h("Cannot access image - CORS policy, network error, or invalid URL"),ue(!1)},Ue.src=F})}}catch{return h("Unexpected error occurred while validating URL"),!1}finally{p(!1)}},k=async()=>{c.trim()&&await w(c.trim())&&(C({...t,props:{...t.props,url:c.trim()}}),u(""))},x=F=>{F.key==="Enter"&&k()},O=F=>{u(F.target.value),f&&h(""),_&&g(!1)},A=F=>{const K=["image/png","image/jpeg","image/gif"],ke=F.filter(Ue=>K.includes(Ue.type)&&Ue.size<=5242880);if(ke.length!==F.length&&alert(i("inputs.common.invalidFiles")),ke.length===0)return;const ue=ke.map(Ue=>new Promise(Ce=>{const de=new FileReader;de.onload=pe=>Ce(pe.target?.result),de.readAsDataURL(Ue)}));Promise.all(ue).then(Ue=>{const Ce={images:Ue,id:n||""};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:Ce})),gc(!0,n||"")})},X=F=>{F.preventDefault(),a(!0)},P=F=>{const K=F.currentTarget.getBoundingClientRect(),re=F.clientX,ke=F.clientY;(re<K.left||re>=K.right||ke<K.top||ke>=K.bottom)&&a(!1)},Y=F=>{F.preventDefault(),a(!1);const K=Array.from(F.dataTransfer.files);K.length>0&&A(K)},z=()=>{const F=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent(F)};return v.useEffect(()=>{const F=window.__emailBuilderEnableAI;F!==void 0&&o(!!F);const K=re=>{const{detail:ke}=re;o(!!ke)};return window.addEventListener("email-builder-ai-generation",K),()=>{window.removeEventListener("email-builder-ai-generation",K)}},[]),v.useEffect(()=>{const F=ue=>{const{detail:Ue}=ue;gc(!1,Ue.id||""),C({...t,props:{...t.props,url:Ue.url}}),qP(!1)},K=ue=>{gc(ue?.detail?.uploading??!1,ue?.detail?.id??"")},re=()=>{b?.current?.click()},ke=ue=>{const{detail:Ue}=ue;C({...t,props:{...t.props,url:Ue}})};return window.addEventListener("email-builder-set-image",ke),window.addEventListener("email-builder-upload-image-receive",F),window.addEventListener("email-builder-upload-file",re),window.addEventListener("email-builder-toggle-upload-file",K),()=>{window.removeEventListener("email-builder-toggle-upload-file",K),window.removeEventListener("email-builder-upload-image-receive",F),window.removeEventListener("email-builder-set-image",ke),window.removeEventListener("email-builder-upload-file",re)}},[t]),v.useEffect(()=>{t.props?.url&&g(D(t.props.url))},[t.props?.url]),m.jsxs(T.Stack,{gap:1,children:[E?m.jsx(T.Box,{sx:{mb:2},children:E}):m.jsx("div",{style:{display:"flex",gap:8},children:y?m.jsxs(Wn,{children:[m.jsx(Vt,{label:i("inputs.image.urlLabel")}),m.jsxs(T.Stack,{direction:"row",spacing:1,children:[m.jsx(T.TextField,{fullWidth:!0,placeholder:i("inputs.image.urlPlaceholder"),value:c,onChange:O,onKeyPress:x,error:!!f,disabled:d,sx:{...eg,"& .MuiOutlinedInput-root":{"& fieldset":{borderColor:f?"error.main":"#E5E5E5"},"&:hover fieldset":{borderColor:f?"error.main":"primary.main"},"&.Mui-focused fieldset":{borderColor:f?"error.main":"primary.main"}}}}),m.jsx(T.Button,{variant:"contained",onClick:k,disabled:!c.trim()||d,sx:{minWidth:"auto",px:2,position:"relative"},children:d?m.jsx(T.CircularProgress,{size:20,color:"inherit"}):i("inputs.common.add")})]}),f&&m.jsx(T.Alert,{severity:"error",sx:{mt:1,fontSize:"0.875rem","& .MuiAlert-message":{padding:"4px 0",display:"flex",flexDirection:"column",justifyContent:"space-around"}},children:f}),_&&m.jsx(T.Alert,{severity:"warning",sx:{mt:1,marginX:"4px",fontSize:"0.875rem",top:0,"& .MuiAlert-message":{padding:"4px 0",display:"flex",flexDirection:"column",justifyContent:"space-around"}},action:m.jsx(T.IconButton,{"aria-label":i("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{g(!1)},children:m.jsx($.Close,{fontSize:"inherit"})}),children:i("inputs.common.svgWarning")}),m.jsx("img",{src:t.props?.url,alt:t.props?.alt,style:{width:"70%",margin:"0.5rem auto 0 auto",objectFit:"contain",display:"block",aspectRatio:"1 / 1",height:"auto",borderRadius:"8px",border:"2px solid #E5E5E5",backgroundColor:"#fff",backgroundImage:"linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%), linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%)",backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"}})]}):m.jsxs(m.Fragment,{children:[m.jsx("img",{src:t.props?.url,alt:t.props?.alt,style:{width:"50%",objectFit:"contain",aspectRatio:"1 / 1",height:"auto",borderRadius:"8px",border:"2px solid #E5E5E5",backgroundColor:"#ffffff",backgroundImage:"linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%), linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%)",backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"}}),m.jsxs(T.Box,{onDragOver:X,onDragLeave:P,onDrop:Y,sx:{width:"100%",border:"2px solid",borderColor:r?"primary.main":"#E5E5E5",borderRadius:"8px",padding:4,textAlign:"center",bgcolor:r?"primary.50":"background.paper",transition:"all 0.2s ease"},children:[m.jsx(T.Box,{sx:{display:"flex",justifyContent:"center",mb:2},children:m.jsx($.PhotoOutlined,{sx:{fontSize:32,color:"primary"}})}),m.jsxs("label",{style:{cursor:"pointer"},children:[m.jsx("input",{ref:b,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:F=>{const K=F.target.files;K&&K.length>0&&A(Array.from(K))}}),m.jsx(T.Typography,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:i("inputs.common.uploadFile")}),m.jsxs(T.Typography,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",i("inputs.common.dragAndDrop")]})]}),m.jsx(T.Typography,{variant:"body2",sx:{color:"text.secondary",mt:1},children:i("inputs.common.fileInfo")})]})]})}),!E&&!y&&_&&m.jsx(T.Alert,{severity:"warning",sx:{fontSize:"0.875rem","& .MuiAlert-message":{padding:"4px 0",display:"flex",flexDirection:"column",justifyContent:"space-around"}},children:"SVG images may not display correctly in Outlook email clients. Consider using PNG or JPG format for better compatibility."}),(!E&&(xm()&&!y||s)||E&&s)&&m.jsxs(T.Stack,{direction:"row",alignItems:"center",spacing:1,children:[m.jsx(T.Divider,{sx:{flexGrow:1}}),m.jsx(T.Typography,{sx:{color:"text.secondary"},children:"or"}),m.jsx(T.Divider,{sx:{flexGrow:1}})]}),m.jsx(m.Fragment,{children:m.jsxs(T.Stack,{flexDirection:"row",gap:2,children:[!E&&xm()&&!y&&m.jsx(T.Button,{variant:"outlined",onClick:z,startIcon:m.jsx($.ImageSearchOutlined,{}),sx:{color:"mainColor.main",borderColor:"mainColor.light","&:hover":{borderColor:"mainColor.main",backgroundColor:"action.hover"}},style:{width:"100%"},children:"Browse gallery"}),s&&m.jsx(JP,{src:t.props?.url,style:{width:"100%",margin:0}})]})})]})};function M7({data:t,setData:e}){const[,n]=v.useState(null),i=Jc(),{t:r}=Ke.useTranslation("inspector"),a=c=>{const u=QP.safeParse(c);u.success?(e(u.data),n(null)):n(u.error)},s=t.props?.size??Uo.size,o=t.props?.alt??Uo.alt;t.props?.shape??Uo.shape;const l=va();return v.useEffect(()=>{const c=u=>{const{detail:d}=u;a({...t,props:{...t.props,alt:o}}),a({...t,props:{...t.props,imageUrl:d}})};return window.addEventListener("email-builder-set-image",c),()=>{window.removeEventListener("email-builder-set-image",c)}},[t,a]),m.jsxs(Cr,{title:r("inputs.panels.avatar.title"),children:[l=="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsx(sL,{data:t,setData:c=>e({...t,props:{...t.props,imageUrl:c.props.url,alt:o}}),blockId:i}),m.jsx(Po,{label:r("inputs.panels.avatar.sizeLabel"),iconLabel:m.jsx($.AspectRatioOutlined,{sx:{color:"text.secondary"}}),units:"px",step:3,min:32,max:256,defaultValue:s,onChange:c=>{a({...t,props:{...t.props,size:c}})}}),m.jsx(ll,{label:r("inputs.panels.avatar.altLabel"),defaultValue:o,onChange:c=>{a({...t,props:{...t.props,alt:c}})}})]}),m.jsx(di,{names:["textAlign","backgroundColor","padding","mobilePadding"],value:t.style,onChange:c=>a({...t,style:c})})]})}const b_=Me().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),Zx=Le({top:se(),bottom:se(),right:se(),left:se()}).optional().nullable(),P7=t=>({top:t?.top??0,right:t?.right??0,bottom:t?.bottom??0,left:t?.left??0}),L7=Le({topLeft:se().min(0).optional(),topRight:se().min(0).optional(),bottomLeft:se().min(0).optional(),bottomRight:se().min(0).optional()}),eD=Le({top:se().min(0).optional(),bottom:se().min(0).optional(),left:se().min(0).optional(),right:se().min(0).optional()}),oL=Le({style:Le({backgroundColor:b_,fontSize:se().min(0).optional().nullable(),fontSizeMobile:se().min(0).optional().nullable(),fontFamily:eu,background:Me().nullable().optional(),fontWeight:jt(["bold","normal"]).optional().nullable(),textAlign:jt(["left","center","right"]).optional().nullable(),textAlignMobile:jt(["left","center","right"]).optional().nullable(),padding:Zx,mobilePadding:Zx,shape:bc([jt(["rectangle","pill"]),L7]).optional().nullable()}).passthrough().optional().nullable(),props:Le({buttonBackgroundColor:b_,buttonTextColor:b_,fullWidth:Nc().optional().nullable(),fullWidthMobile:Nc().optional().nullable(),size:bc([jt(["x-small","small","medium"]),eD]).optional().nullable(),sizeMobile:bc([jt(["x-small","small","medium"]),eD]).optional().nullable(),text:Me().optional().nullable(),url:Me().optional().nullable()}).optional().nullable()}).passthrough();function tD(t){if(typeof t!="string")return t;switch(t){case"x-small":return{top:4,bottom:4,right:8,left:8};case"small":return{top:8,bottom:8,right:12,left:12};case"medium":default:return{top:12,bottom:12,left:20,right:20}}}const Fs={text:"",url:"",fullWidth:!1,size:"medium",buttonBackgroundColor:"#999999"};function lL({style:t,props:e,blockId:n}){const i=Zh(),r=dn(),a=e?.text??Fs.text,s=e?.url??Fs.url,o=r==="desktop"?e?.fullWidth??!1:e?.fullWidthMobile??e?.fullWidth??!1,l=e?.buttonTextColor??i.textColor,c=e?.buttonBackgroundColor??Fs.buttonBackgroundColor,u={backgroundColor:t?.backgroundColor??void 0,textAlign:r=="desktop"?t?.textAlign??void 0:t?.textAlignMobile??t?.textAlign,padding:P7(r=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},d={color:l,fontSize:r=="desktop"?t?.fontSize??16:t?.fontSizeMobile??t?.fontSize??16,fontFamily:es(t?.fontFamily),fontWeight:t?.fontWeight??"bold",display:"inline-block",textDecoration:"none"},p={color:t?.borderColor??void 0,top:r=="desktop"?t?.borderTop??void 0:t?.borderTopMobile??t?.borderTop,bottom:r=="desktop"?t?.borderBottom??void 0:t?.borderBottomMobile??t?.borderBottom,left:r=="desktop"?t?.borderLeft??void 0:t?.borderLeftMobile??t?.borderLeft,right:r=="desktop"?t?.borderRight??void 0:t?.borderRightMobile??t?.borderRight},f=t?.background??"",h=t?.backgroundColor,_=h?Tl(f,h):f,g=dt(n);return m.jsx(fi,{background:_,backgroundColor:h,padding:u.padding,align:u.textAlign,width:"100%",className:`c${g}`,children:m.jsx("a",{href:rT(s),target:"_blank",className:`abtn-${g}`,children:m.jsx(fi,{className:g,padding:r=="desktop"?tD(e?.size):tD(e?.sizeMobile??e?.size),borderRadius:Fm(t),background:c,backgroundColor:c,isParent:!1,align:"center",width:o?"100%":void 0,border:p,children:m.jsx("span",{className:`btn${g}`,style:d,children:a})})})})}function F7({size:t,sizeMobile:e,onChange:n,label:i,maxValue:r=100,paddingSteps:a=8}){const{t:s}=Ke.useTranslation("inspector"),o=i??s("inputs.common.size"),l=dn(),[c,u]=v.useState(()=>{const y=l==="desktop"?t:e!==void 0?e:t;return typeof y=="object"&&y!==null?y:{top:8,bottom:8,left:16,right:16}}),[d,p]=v.useState(!1);v.useEffect(()=>{const y=l==="desktop"?t:e!==void 0?e:t;typeof y=="object"&&y!==null&&u(y)},[t,e,l]);const f=()=>{const y=l==="desktop"?t:e!==void 0?e:t;return typeof y=="object"&&y!==null?"custom":y},h=y=>{if(l==="desktop"){const E={size:y==="custom"?c:y};e==null&&(E.sizeMobile=y==="custom"?c:y),n(E)}else n({sizeMobile:y==="custom"?c:y})},_=(y,E)=>{let S;d?S={top:E,bottom:E,left:E,right:E}:S={...c,[y]:E},u(S),n(l==="desktop"?{size:S}:{sizeMobile:S})},g=()=>{if(!d){const E={top:16,bottom:16,left:16,right:16};u(E),n(l==="desktop"?{size:E}:{sizeMobile:E})}p(!d)},b=f();return m.jsxs(T.Stack,{spacing:2,children:[m.jsxs(so,{label:o,defaultValue:b,onChange:h,children:[m.jsx(T.ToggleButton,{value:"x-small",children:s("inputs.responsiveSize.options.xSmall")}),m.jsx(T.ToggleButton,{value:"small",children:s("inputs.responsiveSize.options.small")}),m.jsx(T.ToggleButton,{value:"medium",children:s("inputs.responsiveSize.options.medium")}),m.jsx(T.ToggleButton,{value:"custom",children:s("inputs.responsiveSize.options.custom")})]}),b==="custom"&&m.jsxs(T.Stack,{spacing:2,alignItems:"flexStart",pb:1,children:[m.jsxs(T.Stack,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[m.jsx(Vt,{label:s("inputs.responsiveSize.customPadding")}),m.jsx(T.Tooltip,{title:s(d?"inputs.responsiveSize.unlockTooltip":"inputs.responsiveSize.lockTooltip"),children:m.jsx(T.IconButton,{size:"small",onClick:g,sx:{marginTop:"0!important",color:d?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:d?m.jsx($.Lock,{fontSize:"small"}):m.jsx($.LockOpen,{fontSize:"small"})})})]}),d?m.jsx(cn,{iconLabel:s("inputs.responsiveSize.allSides"),value:c.top,setValue:y=>_("top",y),units:"px",min:0,step:a,marks:a>1,max:r}):m.jsxs(m.Fragment,{children:[m.jsx(cn,{iconLabel:m.jsx($.AlignVerticalTopOutlined,{sx:{fontSize:16}}),value:c.top,setValue:y=>_("top",y),units:"px",min:0,step:a,marks:a>1,max:r}),m.jsx(cn,{iconLabel:m.jsx($.AlignVerticalBottomOutlined,{sx:{fontSize:16}}),value:c.bottom,setValue:y=>_("bottom",y),units:"px",min:0,step:a,marks:a>1,max:r}),m.jsx(cn,{iconLabel:m.jsx($.AlignHorizontalLeftOutlined,{sx:{fontSize:16}}),value:c.left,setValue:y=>_("left",y),units:"px",min:0,step:a,marks:a>1,max:r}),m.jsx(cn,{iconLabel:m.jsx($.AlignHorizontalRightOutlined,{sx:{fontSize:16}}),value:c.right,setValue:y=>_("right",y),units:"px",min:0,step:a,marks:a>1,max:r})]})]})]})}function B7({fullWidth:t,fullWidthMobile:e,onChange:n,label:i="Width"}){const r=dn(),{t:a}=Ke.useTranslation("inspector"),s=()=>r==="desktop"?t:e!==void 0?e:t,o=c=>{const u=c==="FULL_WIDTH";if(r==="desktop"){const d={fullWidth:u};e==null&&(d.fullWidthMobile=u),n(d)}else n({fullWidthMobile:u})},l=s();return m.jsxs(so,{label:i,defaultValue:l?"FULL_WIDTH":"AUTO",onChange:o,children:[m.jsx(T.ToggleButton,{value:"FULL_WIDTH",children:a("inputs.width.full")}),m.jsx(T.ToggleButton,{value:"AUTO",children:a("inputs.width.auto")})]})}function U7({data:t,setData:e}){const[,n]=v.useState(null),i=Zh(),{t:r}=Ke.useTranslation("inspector"),a=_=>{const g=oL.safeParse(_);g.success?(e(g.data),n(null)):n(g.error)},s=t.props?.text??Fs.text,o=t.props?.url??Fs.url,l=t.props?.fullWidth??Fs.fullWidth,c=t.props?.size??Fs.size,u=t.props?.buttonTextColor??i.textColor,d=t.props?.buttonBackgroundColor??Fs.buttonBackgroundColor,p=t.props?.fullWidthMobile,f=t.props?.sizeMobile,h=va();return m.jsxs(Cr,{title:r("inputs.panels.button.title"),children:[h=="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsx(di,{disabledCSSValidation:!0,names:["fontFamily","fontSize","fontSizeMobile","fontWeight"],value:t.style,onChange:_=>a({...t,style:_})}),m.jsx(ll,{label:r("inputs.panels.button.textLabel"),defaultValue:s,onChange:_=>a({...t,props:{...t.props,text:_}})}),m.jsx(ll,{label:r("inputs.panels.button.targetLabel"),placeholder:r("inputs.panels.button.targetPlaceholder"),defaultValue:o,onChange:_=>a({...t,props:{...t.props,url:_}})}),m.jsx(B7,{label:r("properties.width"),fullWidth:l,fullWidthMobile:p,onChange:_=>a({...t,props:{...t.props,..._}})}),m.jsx(F7,{size:c,sizeMobile:f,onChange:_=>a({...t,props:{...t.props,..._}})}),m.jsx(Ko,{label:r("inputs.panels.button.textColor"),defaultValue:u,onChange:_=>a({...t,props:{...t.props,buttonTextColor:_}})}),m.jsx(Ko,{label:r("inputs.panels.button.buttonColor"),defaultValue:d,onChange:_=>a({...t,props:{...t.props,buttonBackgroundColor:_}})})]}),m.jsx(di,{names:["shape","textAlign","textAlignMobile","backgroundColor","border","borderMobile","padding","mobilePadding"],value:t.style,shapeMaxValue:80,onChange:_=>a({...t,style:_})})]})}const $7=KP([se().nullish(),se().nullish(),se().nullish()]).optional().nullable(),cL=Le({style:Le({background:Me().nullable().optional(),backgroundColor:Me().nullable().optional(),padding:Bm,mobilePadding:Bm}).optional().nullable(),props:Le({fixedWidths:$7,columnsCount:bc([t1(2),t1(3)]).optional().nullable(),layout:Me().optional().nullable(),contentAlignment:jt(["top","middle","bottom"]).optional().nullable(),contentAlignmentMobile:jt(["top","middle","bottom"]).optional().nullable()}).optional().nullable()}).passthrough(),z7={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},fd={columnsCount:2,contentAlignment:"middle"};function s1({style:t,columns:e,props:n,blockId:i}){const r=dn(),a=Jh(),s={padding:Tp(r=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},o={columnsCount:n?.columnsCount??fd.columnsCount,contentAlignment:r=="desktop"?n?.contentAlignment??fd.contentAlignment:n?.contentAlignmentMobile??n?.contentAlignment??fd.contentAlignment,fixedWidths:n?.fixedWidths,blockId:i},l=t?.background??"",c=t?.backgroundColor,u=c?Tl(l,c):l,d=dt(i);return m.jsxs(fi,{background:u,backgroundColor:c,className:`${d}`,padding:s.padding,width:"100%",children:[a.uploading&&a.id===i?m.jsx("div",{style:z7,children:m.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle",style:{width:"32px",height:"32px",animation:"1s linear infinite spin",stroke:"currentColor"},children:m.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}):m.jsx(m.Fragment,{}),m.jsx("table",{border:0,cellSpacing:"0",cellPadding:"0",style:{width:"100%"},children:m.jsx("tbody",{style:{width:"100%"},children:m.jsxs("tr",{style:{width:"100%"},children:[m.jsx(y_,{index:0,props:o,columns:e}),m.jsx(y_,{index:1,props:o,columns:e}),m.jsx(y_,{index:2,props:o,columns:e})]})})})]})}function y_({index:t,props:e,columns:n}){const i=e?.contentAlignment??fd.contentAlignment;if((e?.columnsCount??fd.columnsCount)===2&&t===2)return null;const a={boxSizing:"border-box",verticalAlign:i,width:`${e.fixedWidths?.[t]}%`??void 0},s=(n&&n[t])??null,o=e.blockId?dt(e.blockId):"";return m.jsx("td",{className:`col${o}`,style:a,children:s})}const G7=cL.shape.props.unwrap().unwrap().shape,sT=Le({style:cL.shape.style,props:Le({...G7,columns:KP([Le({childrenIds:_c(Me())}),Le({childrenIds:_c(Me())}),Le({childrenIds:_c(Me())})])}).optional().nullable()}).passthrough(),q7=(t,e,n)=>{if(!t||!document)return;const i=dt(t),r=document.querySelector(`.${i}`);if(!r)return;const a=r.parentElement;if(!a)return;const s=Math.ceil(a.getBoundingClientRect().width);n.props?.touched||n.props?.width!==s&&e({...n,props:{...n.props,width:s}})},H7=t=>{if(!t||!document)return;const e=dt(t),n=document.querySelector(`.${e}`);if(!n)return;const i=n.parentElement;if(!i)return;const r=Math.ceil(i.getBoundingClientRect().width);return r||null},j7={desktop:"contentAlignment",mobile:"contentAlignmentMobile"};function V7({data:t,updateData:e}){const{t:n}=Ke.useTranslation("inspector"),i=dn(),r=j7[i]||"contentAlignment",a=t.props?.[r]??t.props?.contentAlignment,s=o=>{e({...t,props:{...t.props,[r]:o}})};return m.jsxs(so,{label:n("inputs.alignment.label"),defaultValue:a,onChange:s,children:[m.jsx(T.ToggleButton,{value:"top",children:m.jsx($.VerticalAlignTopOutlined,{fontSize:"small"})}),m.jsx(T.ToggleButton,{value:"middle",children:m.jsx($.VerticalAlignCenterOutlined,{fontSize:"small"})}),m.jsx(T.ToggleButton,{value:"bottom",children:m.jsx($.VerticalAlignBottomOutlined,{fontSize:"small"})})]})}const ku={grid:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(100px, 1fr))",gap:"16px",width:"100%"},card:{cursor:"pointer",border:"1px solid #e5e7eb",borderRadius:"8px",backgroundColor:"primary"},cardContent:{padding:"8px"},layoutPreview:{display:"flex",gap:"4px",height:"30px",width:"100%",justifyContent:"space-between"}},Y7=({defaultValue:t,onChange:e,columns:n})=>{const{t:i}=Ke.useTranslation("inspector"),[r,a]=v.useState(t||"layout-50-50"),s=T.useTheme();v.useEffect(()=>{r!==t&&a(t==="layout-33-34-33"?"layout-33-33-33":t)},[t]);const o=[{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]}],l=[{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-30-30-40",distribution:[30,30,40]},{id:"layout-40-20-40",distribution:[40,20,40]}],[c,u]=v.useState(l),d=(p,f)=>{a(p),e({layout:p,fixedWidths:f})};return v.useEffect(()=>{if(n===2)u(o),o.findIndex(p=>p.id==t)===-1&&d("layout-50-50",[50,50,null]);else{if(u(l),t==="layout-33-34-33"){d("layout-33-33-33",[33.34,33.33,33.33]);return}l.findIndex(p=>p.id==t)===-1&&d("layout-33-33-33",[33.34,33.33,33.33])}},[n]),v.useEffect(()=>{t==="layout-33-34-33"&&d("layout-33-33-33",[33.34,33.33,33.33])},[t]),m.jsxs(Wn,{children:[m.jsx(Vt,{label:i("inputs.layout.label")}),m.jsx("div",{style:ku.grid,children:c.map((p,f)=>m.jsx("div",{onClick:()=>d(p.id,p.distribution),style:{...ku.card,gridColumn:f===0?"span 2":void 0,border:r===p.id?`2px solid ${s.palette.secondary.main}`:ku.card.border},children:m.jsx("div",{style:ku.cardContent,children:m.jsx("div",{style:ku.layoutPreview,children:p.distribution.map((h,_)=>m.jsx("div",{style:{width:`${h}%`,backgroundColor:r===p.id?s.palette.secondary.main:"#e5e7eb",borderRadius:"4px",transition:"background-color 0.2s ease",display:"grid",placeItems:"center",fontSize:"12px",color:r===p.id?"white":"black"}},_))})})},p.id))})]})};function W7({data:t,setData:e}){const[,n]=v.useState(null),[i,r]=v.useState(t.props?.columnsCount??2),a=va(),s=dn(),{t:o}=Ke.useTranslation("inspector"),l=f=>{const h=ne.getState().document,_=f.filter(g=>h[g]?.type==="Image");s==="desktop"&&_.map(g=>q7(g,e,h[g].data))},c=f=>{const h=sT.safeParse(f);h.success?(h.data.props.columns.map(_=>l(_.childrenIds)),e(h.data),i&&h.data.props?.columnsCount!==i&&r(h.data.props?.columnsCount??2),n(null)):(console.error("Error on columns: ",h.error),n(h.error))},u={layout:"layout-50-50",fixedWidths:[50,50,null],columnsCount:2},d={layout:"layout-33-34-33",fixedWidths:[33,34,33],columnsCount:3},p=f=>{const h=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:[...t.props.columns];return f==="2"?{...u,columns:h}:{...d,columns:h}};return m.jsxs(Cr,{title:o("inputs.panels.columns.title"),children:[a=="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsxs(so,{label:o("inputs.panels.columns.countLabel"),defaultValue:t.props?.columnsCount===2?"2":"3",onChange:f=>{const h=p(f);c({...t,props:{...t.props,...h}})},children:[m.jsx(T.ToggleButton,{style:{fontWeight:"bold"},value:"2",children:"2"}),m.jsx(T.ToggleButton,{style:{fontWeight:"bold"},value:"3",children:"3"})]}),m.jsx(Y7,{columns:t.props?.columnsCount??3,defaultValue:t.props?.layout,onChange:({layout:f,fixedWidths:h})=>{const _=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:t.props.columns;c({...t,props:{...t.props,layout:f,fixedWidths:h,columns:_}})}})]}),a=="css"&&m.jsxs(m.Fragment,{children:[m.jsx(V7,{data:t,updateData:e}),m.jsx(di,{names:["backgroundColor","background","padding","mobilePadding"],value:t.style,onChange:f=>c({...t,style:f})})]})]})}const nD=Me().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),iD=Le({top:se(),bottom:se(),right:se(),left:se()}).optional().nullable(),K7=Le({topLeft:se().min(0).optional(),topRight:se().min(0).optional(),bottomLeft:se().min(0).optional(),bottomRight:se().min(0).optional()}),rD={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},Q7=Le({style:Le({backgroundColor:nD,background:Me().nullable().optional(),borderColor:nD,borderRadius:se().optional().nullable(),borderTop:se().optional().nullable(),borderBottom:se().optional().nullable(),borderLeft:se().optional().nullable(),borderRight:se().optional().nullable(),borderTopMobile:se().optional().nullable(),borderBottomMobile:se().optional().nullable(),borderLeftMobile:se().optional().nullable(),borderRightMobile:se().optional().nullable(),shape:bc([jt(["rectangle","pill"]),K7]).optional().nullable(),padding:iD,mobilePadding:iD}).optional().nullable()}).passthrough();function uL({style:t,children:e,blockId:n}){const i=dn(),r=Jh(),a={border:{color:t?.borderColor??void 0,top:i=="desktop"?t?.borderTop??void 0:t?.borderTopMobile??t?.borderTop,bottom:i=="desktop"?t?.borderBottom??void 0:t?.borderBottomMobile??t?.borderBottom,left:i=="desktop"?t?.borderLeft??void 0:t?.borderLeftMobile??t?.borderLeft,right:i=="desktop"?t?.borderRight??void 0:t?.borderRightMobile??t?.borderRight},padding:Tp(i=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},s=t?.background??"",o=t?.backgroundColor,l=o?Tl(s,o):s,c=dt(n);return e?m.jsx(fi,{className:`${c}`,background:l,backgroundColor:t?.backgroundColor,borderRadius:Fm(t),padding:a.padding,width:"100%",border:a.border,children:m.jsxs(m.Fragment,{children:[r.uploading&&r.id===n&&m.jsx("div",{style:rD,children:m.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle",style:{width:"32px",height:"32px",animation:"1s linear infinite spin",stroke:"currentColor"},children:m.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}),e]})}):m.jsx(fi,{className:`${c}`,background:l,backgroundColor:o,borderRadius:Fm(t),padding:a.padding,width:"100%",border:a.border,children:m.jsx("div",{children:r.uploading&&r.id===n&&m.jsx("div",{style:rD,children:m.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle",style:{width:"32px",height:"32px",animation:"1s linear infinite spin",stroke:"currentColor"},children:m.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})})})}const dL=Le({style:Q7.shape.style,props:Le({childrenIds:_c(Me()).optional().nullable()}).optional().nullable()}).passthrough();function pL({data:t,setData:e}){const[,n]=v.useState(null),{t:i}=Ke.useTranslation("inspector"),r=a=>{const s=dL.safeParse(a);s.success?(e(s.data),n(null)):n(s.error)};return m.jsx(Cr,{title:i("inputs.panels.container.title"),children:m.jsx(di,{names:["backgroundColor","background","border","borderMobile","shape","padding","mobilePadding"],value:t.style,shapeSteps:30,onChange:a=>r({...t,style:a})})})}const X7=Me().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),aD=Le({top:se(),bottom:se(),right:se(),left:se()}).optional().nullable(),fL=Le({style:Le({background:Me().nullable().optional(),backgroundColor:X7,padding:aD,mobilePadding:aD,height:se().optional().nullable(),heightMobile:se().optional().nullable(),color:Me().optional().nullable(),width:se().optional().nullable(),widthMobile:se().optional().nullable(),textAlign:Me().optional().nullable(),textAlignMobile:Me().optional().nullable()}).passthrough().optional().nullable()}).passthrough(),ko={height:1,color:"#333333",width:100,textAlign:"left"};function mL({style:t,blockId:e}){const n=dn(),i=Tp(n==="desktop"?t?.padding:t?.mobilePadding??t?.padding),r=n==="desktop"?t?.height??ko.height:t?.heightMobile??t?.height??ko.height,a=t?.color??ko.color,s=n==="desktop"?(t?.width??ko.width)+"%":(t?.widthMobile??t?.width??ko.width)+"%",o=n==="desktop"?t?.textAlign??ko.textAlign:t?.textAlignMobile??t?.textAlign??ko.textAlign,l=t?.background??"",c=t?.backgroundColor??"",u=c?Tl(l,c):l,d=dt(e);return m.jsx(fi,{className:`c${d}`,background:u,backgroundColor:c,width:"100%",padding:i,align:o,children:m.jsx(fi,{display:"inline-block",className:`${d}`,background:a,backgroundColor:c,width:s,padding:{top:r,bottom:0,left:0,right:0},isParent:!1,children:m.jsx("div",{})})})}function hL({data:t,setData:e}){const[,n]=v.useState(null),{t:i}=Ke.useTranslation("inspector"),r=a=>{const s=fL.safeParse(a);s.success?(e(s.data),n(null)):n(s.error)};return m.jsx(Cr,{title:i("inputs.panels.divider.title"),children:m.jsx(di,{names:["width","widthMobile","height","heightMobile","color","backgroundColor","textAlign","textAlignMobile","padding","mobilePadding"],value:t.style,onChange:a=>r({...t,style:a})})})}const xu=Me().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),gL=Le({backdropColor:xu,borderColor:xu,borderRadius:se().optional().nullable(),canvasColor:xu,textColor:xu,fontFamily:eu,childrenIds:_c(Me()).optional().nullable(),linkGlobal:Le({linkColor:xu,underline:Nc()}).optional().nullable(),showVersion:Nc().optional().nullable()}),J7=({label:t,linkColor:e,underline:n=!1,onChange:i})=>{const[r,a]=v.useState(e??"#FF0000"),[s,o]=v.useState(n),l=T.useTheme(),{t:c}=Ke.useTranslation("inspector"),u=t??c("inputs.links.color"),d=s?"enabled":"disabled",p={container:{width:"100%"},toggleGroup:{width:"100%",backgroundColor:l.palette.background.paper,padding:"4px",borderRadius:"8px"},toggleButton:{flex:1,padding:"6px 16px",textTransform:"none",fontSize:"14px",color:l.palette.text.primary,"&.Mui-selected":{backgroundColor:l.palette.grey[200],color:l.palette.text.primary,"&:hover":{backgroundColor:l.palette.grey[300]}},"&:hover":{backgroundColor:l.palette.grey[100]}}};v.useEffect(()=>{e!==r&&a(e??"#FF0000")},[e]),v.useEffect(()=>{n!==s&&o(n)},[n]);const f=_=>{const g=_??"#FF0000";a(g),i({linkColor:g,underline:s})},h=(_,g)=>{if(!g)return;const b=g==="enabled";o(b),i({linkColor:r,underline:b})};return m.jsxs(Wn,{children:[m.jsx(Ko,{label:u,defaultValue:r,onChange:f}),m.jsx(Vt,{label:c("inputs.links.underline")}),m.jsx(T.Box,{sx:p.container,children:m.jsxs(T.ToggleButtonGroup,{value:d,exclusive:!0,onChange:h,sx:p.toggleGroup,children:[m.jsx(T.ToggleButton,{value:"enabled",sx:p.toggleButton,children:m.jsx(T.Tooltip,{disableInteractive:!0,arrow:!0,title:c("inputs.links.underlineOn"),children:m.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 40 40",role:"img","aria-label":"aiia subrayado",xmlns:"http://www.w3.org/2000/svg",children:[m.jsx("title",{children:"aiia subrayado"}),m.jsx("rect",{width:"20",height:"20",fill:"none"}),m.jsx("text",{x:"50%",y:"26",textAnchor:"middle",fontFamily:"system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif",fontSize:"24",fill:"currentColor",children:"aiia"}),m.jsx("line",{x1:"6",y1:"31",x2:"34",y2:"31",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})})}),m.jsx(T.ToggleButton,{value:"disabled",sx:p.toggleButton,children:m.jsx(T.Tooltip,{disableInteractive:!0,arrow:!0,title:c("inputs.links.underlineOff"),children:m.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 40 40",role:"img","aria-label":"aiia",xmlns:"http://www.w3.org/2000/svg",children:[m.jsx("title",{children:"aiia"}),m.jsx("rect",{width:"20",height:"20",fill:"none"}),m.jsx("text",{x:"50%",y:"26",textAnchor:"middle",fontFamily:"system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif",fontSize:"24",fill:"currentColor",children:"aiia"})]})})})]})})]})},Z7="email-builder-online",eq="3.4.49",E_={name:Z7,version:eq};function _L({data:t,setData:e}){const[,n]=v.useState(null),{t:i}=Ke.useTranslation("inspector"),r=a=>{const s=gL.safeParse(a);s.success?(e(s.data),n(null)):n(s.error)};return m.jsxs(Cr,{title:i("inputs.panels.emailLayout.title"),children:[m.jsx(Ko,{label:i("inputs.panels.emailLayout.backgroundColor"),defaultValue:t.backdropColor??"#F5F5F5",onChange:a=>r({...t,backdropColor:a})}),m.jsx(Ko,{label:i("inputs.panels.emailLayout.canvasColor"),defaultValue:t.canvasColor??"#FFFFFF",onChange:a=>r({...t,canvasColor:a})}),m.jsx(rL,{label:i("inputs.panels.emailLayout.fontFamily"),defaultValue:t.fontFamily||k7.FAMILY,onChange:a=>r({...t,fontFamily:a})}),m.jsx(Ko,{label:i("inputs.panels.emailLayout.textColor"),defaultValue:t.textColor??"#262626",onChange:a=>r({...t,textColor:a})}),m.jsx(J7,{label:i("inputs.panels.emailLayout.linksLabel"),linkColor:t.linkGlobal?.linkColor||"#000000",underline:t.linkGlobal?.underline||!1,onChange:a=>r({...t,linkGlobal:a})}),t.showVersion&&m.jsx(T.Box,{color:"text.secondary",sx:{display:"flex",justifyContent:"flex-end",mt:2},children:m.jsxs(T.Box,{sx:{textAlign:"right"},children:[m.jsxs(T.Typography,{variant:"body2",children:[i("inputs.panels.emailLayout.version"),": ",E_.version]}),m.jsx(T.Link,{href:`https://www.npmjs.com/package/${E_.name}`,target:"_blank",rel:"noopener noreferrer",sx:{fontSize:"0.875rem",mt:.5,display:"inline-block"},children:E_.name})]})})]})}const sD=Me().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),tq=Le({top:se(),bottom:se(),right:se(),left:se()}).optional().nullable(),nq=t=>t?`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`:void 0,bL=Le({props:Le({text:Me().optional().nullable(),level:jt(["h1","h2","h3"]).optional().nullable()}).optional().nullable(),style:Le({color:sD,backgroundColor:sD,fontFamily:eu,fontWeight:jt(["bold","normal"]).optional().nullable(),textAlign:jt(["left","center","right"]).optional().nullable(),padding:tq}).optional().nullable()}),Um={level:"h2",text:""};function yL({props:t,style:e}){const n=t?.level??Um.level,i=t?.text??Um.text,r={color:e?.color??void 0,backgroundColor:e?.backgroundColor??void 0,fontWeight:e?.fontWeight??"bold",textAlign:e?.textAlign??void 0,margin:0,fontFamily:es(e?.fontFamily),fontSize:iq(n),padding:nq(e?.padding)};switch(n){case"h1":return m.jsx("h1",{style:r,children:i});case"h2":return m.jsx("h2",{style:r,children:i});case"h3":return m.jsx("h3",{style:r,children:i})}}function iq(t){switch(t){case"h1":return 32;case"h2":return 24;case"h3":return 20}}function rq({data:t,setData:e}){const[,n]=v.useState(null),{t:i}=Ke.useTranslation("inspector"),r=s=>{const o=bL.safeParse(s);o.success?(e(o.data),n(null)):n(o.error)},a=va();return m.jsxs(Cr,{title:i("inputs.panels.heading.title"),children:[a=="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsx(ll,{label:i("inputs.panels.heading.contentLabel"),rows:3,defaultValue:t.props?.text??Um.text,onChange:s=>{r({...t,props:{...t.props,text:s}})}}),m.jsxs(so,{label:i("inputs.panels.heading.levelLabel"),defaultValue:t.props?.level??Um.level,onChange:s=>{r({...t,props:{...t.props,level:s}})},children:[m.jsx(T.ToggleButton,{value:"h1",children:"H1"}),m.jsx(T.ToggleButton,{value:"h2",children:"H2"}),m.jsx(T.ToggleButton,{value:"h3",children:"H3"})]})]}),m.jsx(di,{names:["color","backgroundColor","fontFamily","fontWeight","textAlign","padding","mobilePadding"],value:t.style,onChange:s=>r({...t,style:s})})]})}const oD=Me().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),aq=Le({top:se(),bottom:se(),right:se(),left:se()}).optional().nullable(),sq=t=>t?`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`:void 0,EL=Le({style:Le({color:oD,backgroundColor:oD,fontFamily:eu,fontSize:se().min(0).optional().nullable(),textAlign:jt(["left","right","center"]).optional().nullable(),padding:aq}).optional().nullable(),props:Le({contents:Me().optional().nullable()}).optional().nullable()});function SL({style:t,props:e}){const n=e?.contents,i={color:t?.color??void 0,backgroundColor:t?.backgroundColor??void 0,fontFamily:es(t?.fontFamily),fontSize:t?.fontSize??void 0,textAlign:t?.textAlign??void 0,padding:sq(t?.padding)};return n?m.jsx("div",{style:i,dangerouslySetInnerHTML:{__html:n}}):m.jsx("div",{style:i})}function oq({data:t,setData:e}){const[,n]=v.useState(null),{t:i}=Ke.useTranslation("inspector"),r=s=>{const o=EL.safeParse(s);o.success?(e(o.data),n(null)):n(o.error)},a=va();return m.jsxs(Cr,{title:i("inputs.panels.html.title"),children:[a=="block-configuration"&&m.jsx(m.Fragment,{children:m.jsx(ll,{label:i("inputs.panels.html.contentLabel"),rows:5,defaultValue:t.props?.contents??"",onChange:s=>r({...t,props:{...t.props,contents:s}})})}),m.jsx(di,{names:["color","backgroundColor","fontFamily","fontSize","textAlign","padding","mobilePadding"],value:t.style,onChange:s=>r({...t,style:s})})]})}const lq=(t,e,n)=>{const i=dn();v.useEffect(()=>{const r=()=>{if(!t||!document||i=="mobile")return;const o=dt(t),l=document.querySelector(`.${o}`);if(!l)return;const c=l.parentElement;if(!c)return;const u=Math.ceil(c.getBoundingClientRect().width);n.props?.size===void 0||n.props?.size==="original"||n.props?.touched&&n.props?.width<=u||n.props?.width!==u&&!n.props?.touched&&e({...n,props:{...n.props,width:u}})};r();const a=new ResizeObserver(r),s=document.querySelector(`.${dt(t)}`);return s?.parentElement&&a.observe(s.parentElement),()=>{a.disconnect()}},[t,e,n,i])},cq=({defaultValue:t="original",scale:e=100,onChange:n})=>{const[i,r]=v.useState(t),[a,s]=v.useState(e);dn();const o=T.useTheme(),{t:l}=Ke.useTranslation("inspector"),c={container:{width:"100%"},label:{color:o.palette.text.primary},toggleGroup:{width:"100%",backgroundColor:o.palette.background.paper,padding:"4px",borderRadius:"8px"},toggleButton:{flex:1,padding:"6px 16px",textTransform:"none",fontSize:"14px",color:o.palette.text.primary,"&.Mui-selected":{backgroundColor:o.palette.grey[200],color:o.palette.text.primary,"&:hover":{backgroundColor:o.palette.grey[300]}},"&:hover":{backgroundColor:o.palette.grey[100]}},sliderContainer:{marginTop:"16px",padding:"0 8px"},slider:{"& .MuiSlider-thumb":{backgroundColor:o.palette.primary.main,"&:hover":{boxShadow:`0 0 0 8px ${o.palette.primary.main}20`}},"& .MuiSlider-rail":{backgroundColor:o.palette.grey[300]},"& .MuiSlider-track":{backgroundColor:o.palette.primary.main}},scaleValue:{color:o.palette.text.secondary}};v.useEffect(()=>{(t!==i||e!==a)&&(t!==i&&r(t),t==="scale"&&s(e))},[t,e]);const u=(p,f)=>{f!==null&&(r(f),n&&n({mode:f,scale:f==="scale"?a:void 0}))},d=p=>{s(p),n&&n({mode:i,scale:p})};return m.jsxs(Wn,{children:[m.jsx(Vt,{label:l("inputs.sizeSelector.label")}),m.jsxs(T.Box,{sx:c.container,children:[m.jsxs(T.ToggleButtonGroup,{value:i,exclusive:!0,onChange:u,sx:c.toggleGroup,children:[m.jsx(T.ToggleButton,{value:"original",sx:c.toggleButton,children:l("inputs.sizeSelector.contain")}),m.jsx(T.ToggleButton,{value:"fill",sx:c.toggleButton,children:l("inputs.sizeSelector.cover")}),m.jsx(T.ToggleButton,{value:"scale",sx:c.toggleButton,children:l("inputs.sizeSelector.scale")})]}),m.jsx(T.Collapse,{in:i==="scale",children:m.jsx(T.Box,{sx:c.sliderContainer,children:m.jsx(cn,{iconLabel:m.jsx($.WidthWideOutlined,{}),value:a,setValue:d,marks:!1,units:"%",min:1,max:100})})})]})]})};function uq({data:t,setData:e}){const[n,i]=v.useState(null),r=Jc(),a=va(),s=dn(),{t:o}=Ke.useTranslation("inspector");lq(r||"",e,t),v.useEffect(()=>{r&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:r,currentImageUrl:t.props?.url||null,alt:t.props?.alt||null}}))},[r,t.props?.url,t.props?.alt]);const l=v.useCallback(_=>{const g=aT.safeParse(_);g.success?JSON.stringify(t)!==JSON.stringify(g.data)&&(e(g.data),i(null)):i(g.error)},[t,e]),c=v.useCallback((_,g,b)=>{const y=H7(r)||lc,E={..._.props};if(b&&(E.touchedMobile=!0),g.mode==="original"){const S=_.props?.original_width??null;return b?{...E,sizeMobile:g.mode,widthMobile:S}:{...E,size:g.mode,width:S,sizeMobile:E.touchedMobile?E.sizeMobile:g.mode,widthMobile:E.touchedMobile?E.widthMobile:S}}if(g.mode==="fill")return b?{...E,sizeMobile:g.mode,widthMobile:null}:{...E,size:g.mode,width:null,sizeMobile:E.touchedMobile?E.sizeMobile:g.mode,widthMobile:E.touchedMobile?E.widthMobile:null};if(g.mode==="scale"){const S=Math.ceil(y/100*g.scale);return b?{...E,sizeMobile:g.mode,scaleMobile:g.scale,widthMobile:S}:{...E,size:g.mode,scale:g.scale,width:S,sizeMobile:E.touchedMobile?E.sizeMobile:g.mode,scaleMobile:E.touchedMobile?E.scaleMobile:g.scale,widthMobile:E.touchedMobile?E.widthMobile:S}}return E},[r]),u=v.useCallback((_,g)=>{const b=c(t,_,g);l({...t,props:b})},[t,l,c]),d=v.useMemo(()=>s!=="desktop"?{size:t.props?.touchedMobile?t.props?.sizeMobile:t.props?.size??"original",scale:t.props?.touchedMobile?t.props?.scaleMobile:t.props?.scale}:{size:t.props?.size??"original",scale:t.props?.scale},[s,t.props?.touchedMobile,t.props?.sizeMobile,t.props?.size,t.props?.scaleMobile,t.props?.scale]),p=v.useCallback(_=>{l({...t,props:{...t.props,alt:_}})},[t,l]),f=v.useCallback(_=>{const g=_.trim().length===0?null:_.trim();l({...t,props:{...t.props,linkHref:g}})},[t,l]),h=v.useCallback(_=>{l({...t,style:_})},[t,l]);return m.jsxs(Cr,{title:o("inputs.panels.image.title"),children:[a==="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsx(sL,{data:t,setData:e,blockId:r}),m.jsx(ll,{label:o("inputs.panels.image.altLabel"),placeholder:o("inputs.panels.image.altPlaceholder"),defaultValue:t.props?.alt??"",onChange:p}),m.jsx(ll,{label:o("inputs.panels.image.urlLabel"),placeholder:o("inputs.panels.image.urlPlaceholder"),defaultValue:t.props?.linkHref??"",onChange:f}),m.jsx(cq,{defaultValue:d.size,scale:d.scale??void 0,onChange:_=>u(_,s!=="desktop")})]}),m.jsx(di,{names:["textAlign","textAlignMobile","backgroundColor","shape","padding","mobilePadding"],value:t.style,shapeMaxValue:300,shapeSteps:20,onChange:h})]})}const lD=Me().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),cD=Le({top:se(),bottom:se(),right:se(),left:se()}).optional().nullable(),vL=Le({style:Le({color:lD,backgroundColor:lD,background:Me().nullable().optional(),fontSize:se().gte(0).optional().nullable(),fontFamily:eu,fontWeight:jt(["bold","normal"]).optional().nullable(),textAlign:jt(["left","center","right"]).optional().nullable(),padding:cD,mobilePadding:cD,optionSize:jt(["small","medium","large"]).optional().nullable(),theme:jt(["light","dark","colored"]).optional().nullable()}).passthrough().optional().nullable(),gap:se().optional(),items:_c(Le({id:Me(),key:Me(),label:Me(),iconName:Me(),theme:Me(),size:Me(),sizePx:Me(),url:Me(),href:Me().optional().nullable()}))}).passthrough();function TL({style:t,items:e,blockId:n,gap:i=1,gapMobile:r}){var a,s,o,l,c,u;const d=dn(),p=(a=t?.background)!==null&&a!==void 0?a:"",f=t?.backgroundColor,h=f?Tl(p,f):p,_={color:(s=t?.color)!==null&&s!==void 0?s:void 0,background:h,backgroundColor:t?.backgroundColor,fontSize:(o=t?.fontSize)!==null&&o!==void 0?o:16,fontFamily:es(t?.fontFamily),fontWeight:(l=t?.fontWeight)!==null&&l!==void 0?l:void 0,textAlign:d=="desktop"?t?.textAlign:(c=t?.textAlignMobile)!==null&&c!==void 0?c:t?.textAlign,padding:d=="desktop"?t?.padding:(u=t?.mobilePadding)!==null&&u!==void 0?u:t?.padding},g=d==="desktop"?i:r??i,b=dt(n);return v.createElement(dq,{blockId:`${b}`,items:e,wStyle:_,gap:g})}const dq=({items:t,blockId:e,wStyle:n,gap:i})=>{const r=a=>{switch(a){case 0:return"first";case t.length-1:return"last";default:return"inside"}};return v.createElement(fi,{className:e,background:n.background,backgroundColor:n.backgroundColor,padding:n?.padding,align:n.textAlign,width:"100%"},v.createElement("table",{style:{display:"inline-block"},border:0,cellSpacing:"0",cellPadding:"0"},v.createElement("tbody",null,v.createElement("tr",null,t.map((a,s)=>{const o=r(s);return v.createElement(v.Fragment,{key:a.id},o!=="first"&&v.createElement("td",{className:`gap-${e}`,width:Math.ceil(i/2)}),v.createElement("td",{key:`${a.id}-${a.url}`,id:`${a.id}-${a.url}`,width:a.sizePx,style:{textAlign:"center",whiteSpace:"nowrap"}},v.createElement("a",{key:`item_${s}`,target:"_blank",href:rT(a.href),style:{textDecoration:"none"}},v.createElement("img",{src:a.url,alt:a.key,style:{width:a.sizePx||36,height:a.sizePx||36,display:"block"}}))),o!=="last"&&v.createElement("td",{className:`gap-${e}`,width:Math.ceil(i/2)}))})))))},pq="https://maildrill-dev.s3.us-east-2.amazonaws.com/icons/",fq={positive:!0,original:!0,negative:!0},mq={small:!0,medium:!0,large:!0,xlarge:!0},B={theme:"positive",size:"medium"},Ct=(t,e,n="medium")=>{var i,r;const a=(i=oT.find(o=>o.key===n))===null||i===void 0?void 0:i.value,s=(r=CL.find(o=>o.key===e))===null||r===void 0?void 0:r.value;return`${pq}${t}_${s}_${a}.png`},Nt=t=>{var e;return((e=oT.find(n=>n.key===t))===null||e===void 0?void 0:e.value)||"36px"},oT=[{value:"24px",key:"small",label:"Small"},{value:"36px",key:"medium",label:"Medium"},{value:"48px",key:"large",label:"Large"}],CL=[{value:"Positive",key:"positive",label:"Light"},{value:"Original",key:"original",label:"Color"},{value:"Negative",key:"negative",label:"Dark"}],Yf=[{key:"facebook",label:"Facebook",iconName:"Facebook",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Facebook",B.theme,B.size),href:"https://www.facebook.com/your-profile"},{key:"web",label:"Web",iconName:"Web",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Web",B.theme,B.size),href:"https://www.google.com"},{key:"mail",label:"Mail",iconName:"Mail",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Mail",B.theme,B.size),href:"https://mail.google.com/"},{key:"apple",label:"Apple",iconName:"Apple",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Apple",B.theme,B.size),href:"https://www.apple.com/"},{key:"bluesky",label:"Bluesky",iconName:"Bluesky",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Bluesky",B.theme,B.size),href:"https://bsky.app/"},{key:"clubhouse",label:"ClubHouse",iconName:"Clubhouse",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Clubhouse",B.theme,B.size),href:"https://www.clubhouse.com/"},{key:"dribbble",label:"Dribbble",iconName:"Dribbble",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Dribbble",B.theme,B.size),href:"https://dribbble.com/"},{key:"figma",label:"Figma",iconName:"Figma",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Figma",B.theme,B.size),href:"https://www.figma.com/"},{key:"github",label:"Github",iconName:"Github",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Github",B.theme,B.size),href:"https://github.com/"},{key:"google",label:"Google",iconName:"Google",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Google",B.theme,B.size),href:"https://google.com/"},{key:"instagram",label:"Instagram",iconName:"Instagram",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Instagram",B.theme,B.size),href:"https://www.instagram.com/your-profile"},{key:"linkedin",label:"LinkedIn",iconName:"LinkedIn",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("LinkedIn",B.theme,B.size),href:"https://www.linkedin.com/in/your-profile"},{key:"medium-social",label:"Medium",iconName:"Medium",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Medium",B.theme,B.size),href:"https://medium.com/"},{key:"messenger",label:"Messenger",iconName:"Messenger",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Messenger",B.theme,B.size),href:"https://www.messenger.com/"},{key:"pinterest",label:"Pinterest",iconName:"Pinterest",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Pinterest",B.theme,B.size),href:"https://www.pinterest.com/"},{key:"reddit",label:"Reddit",iconName:"Reddit",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Reddit",B.theme,B.size),href:"https://www.reddit.com/"},{key:"signal",label:"Signal",iconName:"Signal",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Signal",B.theme,B.size),href:"https://signal.org/"},{key:"snapchat",label:"Snapchat",iconName:"Snapchat",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Snapchat",B.theme,B.size),href:"https://www.snapchat.com/"},{key:"spotify",label:"Spotify",iconName:"Spotify",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Spotify",B.theme,B.size),href:"https://www.spotify.com/"},{key:"telegram",label:"Telegram",iconName:"Telegram",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Telegram",B.theme,B.size),href:"https://t.me/your-profile"},{key:"threads",label:"Threads",iconName:"Threads",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Threads",B.theme,B.size),href:"https://www.threads.net/"},{key:"tiktok",label:"TikTok",iconName:"TikTok",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("TikTok",B.theme,B.size),href:"https://www.tiktok.com/@your-profile"},{key:"tumblr",label:"Tumblr",iconName:"Tumblr",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Tumblr",B.theme,B.size),href:"https://www.tumblr.com/"},{key:"twitch",label:"Twitch",iconName:"Twitch",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("Twitch",B.theme,B.size),href:"https://www.twitch.tv/"},{key:"vk",label:"VK",iconName:"VK",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("VK",B.theme,B.size),href:"https://vk.com/"},{key:"whatsapp",label:"WhatsApp",iconName:"WhatsApp",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("WhatsApp",B.theme,B.size),href:"https://www.whatsapp.com/"},{key:"x",label:"X",iconName:"X",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("X",B.theme,B.size),href:"https://x.com/your-profile"},{key:"youtube",label:"YouTube",iconName:"YouTube",theme:B.theme,size:B.size,sizePx:Nt(B.size),url:Ct("YouTube",B.theme,B.size),href:"https://www.youtube.com/channel/your-channel-id"}];function Hu(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}const hq=({element:t,index:e,moveItem:n,onSelectChange:i,onUrlChange:r,onRemove:a,onDuplicate:s,canRemove:o,theme:l})=>{const c=v.useRef(null),[u,d]=v.useState(null),{t:p}=Ke.useTranslation("inspector"),f=x=>{const O=x.getClientOffset(),A=c.current?.getBoundingClientRect();if(!O||!A)return null;const X=(A.bottom-A.top)/2;return O.y-A.top<X?"up":"down"},[{handlerId:h,isOver:_},g]=Qs.useDrop(()=>({accept:"social-media-item",collect(x){return{handlerId:x.getHandlerId(),isOver:x.isOver({shallow:!0})}},hover(x,O){if(!c.current)return;if(x.index===e){d(null);return}if(!O.isOver({shallow:!0})){d(null);return}const P=f(O);d(P)},drop(x,O){if(d(null),!c.current)return;const A=x.index,X=e;if(A===X)return;const P=f(O);let Y=X;P==="down"&&(Y=X+1),A<Y&&(Y=Y-1),setTimeout(()=>{n(A,Y)},0),x.index=Y},end:()=>{d(null)}}),[t.id,e,n]),[{isDragging:b},y]=Qs.useDrag(()=>({type:"social-media-item",item:()=>({id:t.id,index:e}),collect:x=>({isDragging:x.isDragging()}),end:()=>{d(null)}}),[t.id,e]);v.useEffect(()=>{_||d(null)},[_]);const E=b?.4:1;v.useEffect(()=>{if(c.current&&y&&g){const x=c.current;y(x),g(x)}},[y,g]);const S=()=>{setTimeout(()=>a(e),0)},C=()=>{setTimeout(()=>s(e),0)},D=x=>{const O=x.target.value;setTimeout(()=>i(e,O,t),0)},w=x=>{const O=x.target.value;setTimeout(()=>r(e,O,t),0)},k=()=>m.jsxs("div",{style:{height:"3px",background:l.palette.secondary.main,position:"relative",color:l.palette.secondary.main,margin:"4px 0"},children:[m.jsx("svg",{style:{position:"absolute",left:"-25px",top:"50%",transform:"translateY(-50%)"},width:"20",height:"20",viewBox:"0 0 32 32",children:m.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"})}),m.jsx("svg",{style:{position:"absolute",right:"-25px",top:"50%",transform:"translateY(-50%) scaleX(-1)"},width:"20",height:"20",viewBox:"0 0 32 32",children:m.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 m.jsxs(m.Fragment,{children:[u==="up"&&m.jsx(k,{}),m.jsxs(T.Stack,{ref:c,"data-handler-id":h,sx:{border:1,borderColor:"divider",padding:1,paddingTop:0,borderRadius:1,backgroundColor:"background.paper",marginBottom:1.5,opacity:E,cursor:b?"grabbing":"grab",boxShadow:b?l.shadows[3]:"none"},gap:1,children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:`1px solid ${l.palette.divider}`},children:[m.jsx("div",{style:{display:"flex",alignItems:"center"},children:m.jsx($.DragIndicator,{sx:{color:b?"primary.main":"text.secondary",cursor:"grab",marginLeft:-.9,"&:hover":{color:"primary.main"}}})}),m.jsxs("div",{children:[m.jsx(T.Tooltip,{disableInteractive:!0,arrow:!0,title:"Duplicate",placement:"left",children:m.jsx(T.IconButton,{color:"primary",size:"small",onClick:C,children:m.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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"})})})}),o&&m.jsx(T.Tooltip,{disableInteractive:!0,arrow:!0,title:"Remove",placement:"left",children:m.jsx(T.IconButton,{color:"error",size:"small",onClick:S,children:m.jsx($.DeleteOutline,{sx:{fontSize:20}})})})]})]}),m.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"0.5rem"},children:[m.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[m.jsx(Vt,{label:p("inputs.social.icon")}),m.jsx(Zs,{fullWidth:!0,labelId:"demo-simple-select-label",id:"demo-simple-select",value:t.key,size:"small",onChange:D,children:Yf.map(x=>m.jsx(T.MenuItem,{value:x.key,children:x.label},`${t.id}_${x.key}`))})]}),m.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[m.jsx(Vt,{label:p("inputs.social.url")}),m.jsx(T.TextField,{size:"small",fullWidth:!0,value:t.href??"",onChange:w,variant:"outlined",placeholder:"https://your-website.com",sx:eg})]})]})]}),u==="down"&&m.jsx(k,{})]})};function gq({items:t=[],onChange:e}){const{t:n}=Ke.useTranslation("inspector"),i=T.useTheme(),[r,a]=v.useState(()=>t.map(g=>({...g,id:g.id||Hu()}))),[s,o]=v.useState(t[0]?.theme||"default"),[l,c]=v.useState(t[0]?.size||"medium");v.useEffect(()=>{t.length>0&&(o(t[0].theme),c(t[0].size),a(t.map(g=>({...g,id:g.id||Hu()}))))},[t]);const u=(g,b)=>{a(y=>{const E=[...y],[S]=E.splice(g,1);return E.splice(b,0,S),e&&setTimeout(()=>e(E),0),E})},d=()=>{a(g=>{const b={...Yf[0],theme:s,size:l,sizePx:Nt(l),url:Ct(Yf[0].iconName,s,l),id:Hu()},y=[...g,b];return e&&setTimeout(()=>e(y),0),y})},p=g=>{a(b=>{const y=b.filter((E,S)=>S!==g);return e&&setTimeout(()=>e(y),0),y})},f=(g,b,y)=>{let E=[...r];if(b in fq?(o(b),E=E.map(S=>{const C=Ct(S.iconName,b,S.size);return{...S,theme:b,url:C}})):b in mq&&(c(b),E=E.map(S=>{const C=Ct(S.iconName,S.theme,b),D=Nt(b);return{...S,size:b,sizePx:D,url:C}})),g!==null&&y){const S=Yf.find(C=>C.key===b);S&&(E=E.map((C,D)=>{const w={key:S.key,label:S.label,iconName:S.iconName,href:S.href},k=Ct(w.iconName,y.theme,y.size);return D===g?{...C,...w,url:k,id:y.id}:C}))}a(E),e&&setTimeout(()=>e(E),0)},h=(g,b,y)=>{const E=r.map((S,C)=>C===g?{...y,href:b}:S);a(E),e&&setTimeout(()=>e(E),0)},_=g=>{a(b=>{const y={...JSON.parse(JSON.stringify(b[g])),id:Hu()},E=[...b.slice(0,g+1),y,...b.slice(g+1)];return e&&setTimeout(()=>e(E),0),E})};return m.jsxs(m.Fragment,{children:[m.jsxs("div",{style:{marginBottom:"1rem",display:"grid",gridTemplateColumns:"repeat(2,1fr)",gap:"1rem"},children:[m.jsxs(Wn,{children:[m.jsx(Vt,{label:n("inputs.social.theme")}),m.jsx(Zs,{fullWidth:!0,labelId:"theme-selector",id:"theme-selector",value:s,size:"small",onChange:g=>f(null,g.target.value,null),children:CL.map(g=>m.jsx(T.MenuItem,{value:g.key,children:g.label},`${g.key}`))})]}),m.jsxs(Wn,{children:[m.jsx(Vt,{label:n("inputs.social.size")}),m.jsx(Zs,{fullWidth:!0,labelId:"size-selector",id:"size-selector",value:l,size:"small",onChange:g=>f(null,g.target.value,null),children:oT.map(g=>m.jsx(T.MenuItem,{value:g.key,children:g.label},`${g.key}`))})]})]}),r?.map((g,b)=>m.jsx(hq,{element:g,index:b,moveItem:u,onSelectChange:f,onUrlChange:h,onRemove:p,onDuplicate:_,canRemove:r.length>1,theme:i},g.id)),m.jsx(T.Button,{onClick:d,sx:{borderRadius:1},variant:"contained",endIcon:m.jsx($.Add,{}),children:"Add"})]})}const _q=({data:t,setData:e})=>{const[,n]=v.useState(null),i=dn(),{t:r}=Ke.useTranslation("inspector"),a=u=>{const d=vL.safeParse(u);d.success?(e(d.data),n(null)):n(d.error)},s=u=>{a({...t,items:u})},o=u=>{a({...t,style:u})},l=(u,d=!1)=>{if(d){a({...t,gapMobile:u});return}a({...t,gap:u})},c=va();return m.jsxs(Cr,{title:r("inputs.panels.social.title"),children:[c=="block-configuration"&&m.jsx(T.Box,{sx:{minWidth:120,margin:1},children:m.jsx(gq,{items:t?.items||[],onChange:s})}),c=="css"&&m.jsxs(m.Fragment,{children:[m.jsxs(Wn,{children:[m.jsx(Vt,{label:r("inputs.panels.social.gap")}),i=="desktop"?m.jsx(cn,{iconLabel:m.jsx($.SpaceBar,{sx:{color:"text.primary"}}),value:t?.gap??4,setValue:l,marks:!0,step:4,units:"px",min:0,max:40}):m.jsx(cn,{iconLabel:m.jsx($.SpaceBar,{sx:{color:"text.primary"}}),value:t?.gapMobile??t?.gap??4,setValue:u=>l(u,!0),marks:!0,step:4,units:"px",min:0,max:40})]}),m.jsx(di,{names:["textAlign","textAlignMobile","backgroundColor","padding","mobilePadding"],value:t.style,onChange:u=>o(u)})]})]})},bq=Me().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),kL=Le({style:Le({height:se().optional().nullable(),heightMobile:se().optional().nullable(),background:Me().nullable().optional(),backgroundColor:bq}).optional().nullable()}),uD={height:16};function xL({style:t,blockId:e}){const i=dn()==="desktop"?t?.height??uD.height:t?.heightMobile??t?.height??uD.height,r=t?.background??"",a=t?.backgroundColor??"",s=a?Tl(r,a):r,o={width:"100%",minWidth:"100%",backgroundColor:a||void 0,background:s||void 0},l=dt(e);return m.jsx("table",{className:l,width:"100%",style:o,children:m.jsx("tbody",{children:m.jsx("tr",{className:`it${l}`,height:i,style:{height:i},children:m.jsx("td",{})})})})}function DL({data:t,setData:e}){const[,n]=v.useState(null),{t:i}=Ke.useTranslation("inspector"),r=a=>{const s=kL.safeParse(a);s.success?(e(s.data),n(null)):n(s.error)};return m.jsx(Cr,{title:i("inputs.panels.spacer.title"),children:m.jsx(di,{names:["height","heightMobile","backgroundColor"],value:t.style,onChange:a=>r({...t,style:a})})})}function yq({data:t,setData:e}){const n=va(),{t:i}=Ke.useTranslation("inspector"),r=t.style||{},a=s=>{const o={...r||{},...s||{}};e({...t,style:o})};return m.jsxs(Cr,{title:i("inputs.panels.notionText.title","Notion Text"),children:[n==="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{style:{display:"flex",gap:"8px"},children:[m.jsx("div",{style:{flex:1},children:m.jsx(di,{disabledCSSValidation:!0,names:["fontFamily"],value:r,onChange:a})}),m.jsx("div",{style:{flex:1},children:m.jsx(di,{disabledCSSValidation:!0,names:["lineHeight"],value:r,onChange:a})})]}),m.jsx(di,{disabledCSSValidation:!0,names:["fontSize","fontSizeMobile"],value:r,onChange:a})]}),n==="css"&&m.jsx(di,{names:["backgroundColor","border","borderMobile","padding","mobilePadding"],value:r,onChange:a})]})}function dD(t){return m.jsx(T.Box,{sx:{m:3,p:1,border:"1px dashed",borderColor:"divider"},children:m.jsx(T.Typography,{color:"text.secondary",children:t})})}function Eq(){const t=Jc(),e=LP(t||"");if(!t)return dD("Click on a block to inspect.");if(!e)return dD(`Block with id ${t} was not found. Click on a block to reset.`);const{data:n,type:i}=e,r=v.useCallback(a=>{Yv(t,()=>a)},[t]);switch(i){case"Avatar":return m.jsx(M7,{data:n,setData:a=>r({type:i,data:a})},t);case"Button":return m.jsx(U7,{data:n,setData:a=>r({type:i,data:a})},t);case"ColumnsContainer":return m.jsx(W7,{data:n,setData:a=>r({type:i,data:a})},t);case"Container":return m.jsx(pL,{data:n,setData:a=>r({type:i,data:a})},t);case"Divider":return m.jsx(hL,{data:n,setData:a=>r({type:i,data:a})},t);case"Heading":return m.jsx(rq,{data:n,setData:a=>r({type:i,data:a})},t);case"Html":return m.jsx(oq,{data:n,setData:a=>r({type:i,data:a})},t);case"Image":return m.jsx(uq,{data:n,setData:a=>r({type:i,data:a})},t);case"EmailLayout":return m.jsx(_L,{data:n,setData:a=>r({type:i,data:a})},t);case"Spacer":return m.jsx(DL,{data:n,setData:a=>r({type:i,data:a})},t);case"NotionText":return m.jsx(yq,{data:n,setData:a=>r({type:i,data:a})},t);case"SocialMedia":return m.jsx(_q,{data:n,setData:a=>r({type:i,data:a})},t);default:return m.jsx("pre",{children:JSON.stringify(e,null," ")})}}const Sq=v.memo(Eq),vq={EmailLayout:{label:"Email",iconName:"DashboardOutlined"},NotionText:{label:"Notion 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"},Heading:{label:"Heading",iconName:"Title"},Html:{label:"HTML",iconName:"CodeOutlined"},Avatar:{label:"Avatar",iconName:"AccountCircleOutlined"}},Tq=t=>e=>e.document[t];function Cq(t){const e=t.document;if(!e||!e.root)return null;function n(r,a){const s=a.document[r];if(!s)return[];switch(s.type){case"EmailLayout":return s.data?.childrenIds||[];case"Container":return s.data?.props?.childrenIds||[];case"ColumnsContainer":return s.data?.props?.columns?.flatMap(o=>o.childrenIds||[])||[];default:return[]}}function i(r,a,s){const l=s.document[r]?.type??"Unknown",c=vq[l]??{label:l,iconName:"WidgetsOutlined"},d=n(r,s).map(p=>i(p,a+1,s));return{blockId:r,type:l,label:c.label,iconName:c.iconName,children:d,depth:a}}return i("root",0,t)}function kq(t){return ne(t)}function xq(t){return ne(Tq(t))}function Dq(){const t=Jc(),e=xq(t??"root");if(!e)return null;const{data:n,type:i}=e,r=v.useCallback(s=>{t&&Yv(t,()=>s)},[t]),a=v.useCallback(s=>{Yv("root",()=>s)},[]);switch(i){case"Container":return m.jsx(pL,{data:n,setData:s=>r({type:i,data:s})},t);case"Divider":return m.jsx(hL,{data:n,setData:s=>r({type:i,data:s})},t);case"Spacer":return m.jsx(DL,{data:n,setData:s=>r({type:i,data:s})},t);case"EmailLayout":return m.jsx(_L,{data:n,setData:s=>a({type:i,data:s})},"root");default:return m.jsx("pre",{children:JSON.stringify(e,null," ")})}}function wq({sticky:t,heightContent:e}){const n=va(),i=PP(),r=Jc(),a=dn(),s=T.useTheme(),{t:o}=Ke.useTranslation("inspector"),l=()=>{const f={position:"absolute",top:"1rem",right:"0rem",height:"24px",lineHeight:"normal",width:"fit",fontSize:"12px"};switch(n){case"block-configuration":case"css":return m.jsxs("div",{style:{position:"relative"},children:[m.jsx(T.Chip,{color:"primary",sx:f,label:`${o(a==="desktop"?"header.desktop":"header.mobile")}`}),m.jsx(Sq,{})]});case"styles":return m.jsxs("div",{style:{position:"relative"},children:[m.jsx(Dq,{}),m.jsx(T.Chip,{color:"primary",sx:f,label:`${o(a==="desktop"?"header.desktop":"header.mobile")}`})]})}},c=()=>m.jsx("svg",{style:{marginRight:"4px",color:"inherit"},width:"21",height:"20",viewBox:"0 0 21 20",fill:"none",children:m.jsx("path",{d:"M3.83398 5H17.1673M3.83398 10H17.1673M3.83398 15H9.66732",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),u=()=>m.jsx("svg",{style:{marginRight:"4px",color:"inherit"},width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:m.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"})});v.useEffect(()=>{const f=h=>{const _=h.target;Tx(_.innerWidth)};return window&&Tx(window.innerWidth),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}},[n]);const d=(f,h)=>{Wz(h)},p=t?e?`calc(${e} - ${ys})`:void 0:e??void 0;return m.jsxs(T.Container,{sx:f=>({width:Tm,padding:"0!important",margin:"0!important",height:p,maxHeight:p,display:"flex",flexDirection:"column",overflow:"hidden",position:t?"sticky":"static",top:t?ys:0,backgroundColor:`${f.palette.background.paper} !important`}),children:[m.jsx(T.Box,{sx:{position:"sticky",top:0,zIndex:1,backgroundColor:`${s.palette.background.paper} !important`},children:m.jsxs(T.Tabs,{sx:{backgroundColor:`${s.palette.background.paper} !important`},value:n,onChange:d,children:[r!=null&&!_m.includes(i||"")&&[m.jsx(T.Tab,{sx:{height:ys,minHeight:ys,fontWeight:"bold"},value:"block-configuration",label:o("header.content"),icon:m.jsx(c,{}),iconPosition:"start"},"block-configuration"),m.jsx(T.Tab,{sx:{height:ys,minHeight:ys,fontWeight:"bold"},value:"css",label:o("header.styles"),icon:m.jsx(u,{}),iconPosition:"start"},"css")],_m.includes(i)&&[m.jsx(T.Tab,{sx:{height:ys,minHeight:ys,fontWeight:"bold"},value:"styles",label:o("header.styles"),icon:m.jsx(u,{}),iconPosition:"start"},"styles")]]})}),m.jsx(T.Container,{sx:f=>({flex:"1 1 auto",minHeight:0,overflowY:"auto",px:2,backgroundColor:`${f.palette.background.paper} !important`}),children:l()})]})}const wL=({children:t,topOffset:e=0,zIndex:n=10,className:i="",style:r={},disabled:a=!1,threshold:s=null,...o})=>{const[l,c]=v.useState(!1),[u,d]=v.useState({width:0,height:0}),[p,f]=v.useState({left:0}),[h,_]=v.useState(0),[g,b]=v.useState(!1),y=v.useRef(null),E=v.useRef(null),S=v.useRef(null);v.useEffect(()=>{if(a){c(!1),b(!1),_(0);return}const w=E.current,k=y.current;if(!w||!k)return;let x=null;s&&(s.startsWith("#")?x=document.getElementById(s.slice(1)):(s.startsWith("."),x=document.querySelector(s)));const O=()=>{const z=k.getBoundingClientRect();d({width:z.width,height:z.height}),f({left:z.left})},A=()=>{if(!x||!k)return{offset:0,isPushed:!1};const z=x.getBoundingClientRect(),F=k.getBoundingClientRect(),K=e+F.height;if(z.top<K){const re=K-z.top,ke=F.height+20;return{offset:-Math.min(re,ke),isPushed:!0}}return{offset:0,isPushed:!1}},X=new IntersectionObserver(([z])=>{const F=!z.isIntersecting;if(F&&!l&&O(),c(F),F&&s){const{offset:K,isPushed:re}=A();_(K),b(re)}else F||(_(0),b(!1))},{threshold:0,rootMargin:`-${e}px 0px 0px 0px`}),P=new ResizeObserver(()=>{O()}),Y=()=>{if(s&&l){const{offset:z,isPushed:F}=A();_(z),b(F)}};return X.observe(w),P.observe(k),s&&window.addEventListener("scroll",Y,{passive:!0}),O(),()=>{X.disconnect(),P.disconnect(),s&&window.removeEventListener("scroll",Y)}},[e,l,a,s]);const C=!a&&l,D=C?`${e+h}px`:"auto";return m.jsxs("div",{ref:S,className:i,...o,children:[!a&&m.jsx("div",{ref:E,style:{height:"1px",position:"absolute",top:`-${e+1}px`,left:0,right:0,pointerEvents:"none"}}),C&&m.jsx("div",{style:{height:`${u.height}px`,width:`${u.width}px`}}),m.jsx("div",{ref:y,style:{position:C?"fixed":"static",top:D,width:"auto",height:"auto",zIndex:C?n:"auto",transition:g?"none":"box-shadow 0.2s ease-in-out, top 0.3s ease-out",...g&&h<-u.height*.3&&{opacity:Math.max(0,1+(h+u.height*.3)/(u.height*.7))},...r},children:t})]})};var AL=mP();function $n(t){this.content=t}$n.prototype={constructor:$n,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var i=n&&n!=t?this.remove(n):this,r=i.find(t),a=i.content.slice();return r==-1?a.push(n||t,e):(a[r+1]=e,n&&(a[r]=n)),new $n(a)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new $n(n)},addToStart:function(t,e){return new $n([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new $n(n)},addBefore:function(t,e,n){var i=this.remove(e),r=i.content.slice(),a=i.find(t);return r.splice(a==-1?r.length:a,0,e,n),new $n(r)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=$n.from(t),t.size?new $n(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=$n.from(t),t.size?new $n(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=$n.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};$n.from=function(t){if(t instanceof $n)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new $n(e)};function NL(t,e,n){for(let i=0;;i++){if(i==t.childCount||i==e.childCount)return t.childCount==e.childCount?null:n;let r=t.child(i),a=e.child(i);if(r==a){n+=r.nodeSize;continue}if(!r.sameMarkup(a))return n;if(r.isText&&r.text!=a.text){for(let s=0;r.text[s]==a.text[s];s++)n++;return n}if(r.content.size||a.content.size){let s=NL(r.content,a.content,n+1);if(s!=null)return s}n+=r.nodeSize}}function IL(t,e,n,i){for(let r=t.childCount,a=e.childCount;;){if(r==0||a==0)return r==a?null:{a:n,b:i};let s=t.child(--r),o=e.child(--a),l=s.nodeSize;if(s==o){n-=l,i-=l;continue}if(!s.sameMarkup(o))return{a:n,b:i};if(s.isText&&s.text!=o.text){let c=0,u=Math.min(s.text.length,o.text.length);for(;c<u&&s.text[s.text.length-c-1]==o.text[o.text.length-c-1];)c++,n--,i--;return{a:n,b:i}}if(s.content.size||o.content.size){let c=IL(s.content,o.content,n-1,i-1);if(c)return c}n-=l,i-=l}}class J{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let i=0;i<e.length;i++)this.size+=e[i].nodeSize}nodesBetween(e,n,i,r=0,a){for(let s=0,o=0;o<n;s++){let l=this.content[s],c=o+l.nodeSize;if(c>e&&i(l,r+o,a||null,s)!==!1&&l.content.size){let u=o+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),i,r+u)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,i,r){let a="",s=!0;return this.nodesBetween(e,n,(o,l)=>{let c=o.isText?o.text.slice(Math.max(e,l)-l,n-l):o.isLeaf?r?typeof r=="function"?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&i&&(s?s=!1:a+=i),a+=c},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,i=e.firstChild,r=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(i)&&(r[r.length-1]=n.withText(n.text+i.text),a=1);a<e.content.length;a++)r.push(e.content[a]);return new J(r,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let i=[],r=0;if(n>e)for(let a=0,s=0;s<n;a++){let o=this.content[a],l=s+o.nodeSize;l>e&&((s<e||l>n)&&(o.isText?o=o.cut(Math.max(0,e-s),Math.min(o.text.length,n-s)):o=o.cut(Math.max(0,e-s-1),Math.min(o.content.size,n-s-1))),i.push(o),r+=o.nodeSize),s=l}return new J(i,r)}cutByIndex(e,n){return e==n?J.empty:e==0&&n==this.content.length?this:new J(this.content.slice(e,n))}replaceChild(e,n){let i=this.content[e];if(i==n)return this;let r=this.content.slice(),a=this.size+n.nodeSize-i.nodeSize;return r[e]=n,new J(r,a)}addToStart(e){return new J([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new J(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,i=0;n<this.content.length;n++){let r=this.content[n];e(r,i,n),i+=r.nodeSize}}findDiffStart(e,n=0){return NL(this,e,n)}findDiffEnd(e,n=this.size,i=e.size){return IL(this,e,n,i)}findIndex(e){if(e==0)return sf(0,e);if(e==this.size)return sf(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,i=0;;n++){let r=this.child(n),a=i+r.nodeSize;if(a>=e)return a==e?sf(n+1,a):sf(n,i);i=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return J.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new J(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return J.empty;let n,i=0;for(let r=0;r<e.length;r++){let a=e[r];i+=a.nodeSize,r&&a.isText&&e[r-1].sameMarkup(a)?(n||(n=e.slice(0,r)),n[n.length-1]=a.withText(n[n.length-1].text+a.text)):n&&n.push(a)}return new J(n||e,i)}static from(e){if(!e)return J.empty;if(e instanceof J)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new J([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}J.empty=new J([],0);const S_={index:0,offset:0};function sf(t,e){return S_.index=t,S_.offset=e,S_}function $m(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!$m(t[i],e[i]))return!1}else{for(let i in t)if(!(i in e)||!$m(t[i],e[i]))return!1;for(let i in e)if(!(i in t))return!1}return!0}let Ut=class o1{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,i=!1;for(let r=0;r<e.length;r++){let a=e[r];if(this.eq(a))return e;if(this.type.excludes(a.type))n||(n=e.slice(0,r));else{if(a.type.excludes(this.type))return e;!i&&a.type.rank>this.type.rank&&(n||(n=e.slice(0,r)),n.push(this),i=!0),n&&n.push(a)}}return n||(n=e.slice()),i||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&$m(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let i=e.marks[n.type];if(!i)throw new RangeError(`There is no mark type ${n.type} in this schema`);let r=i.create(n.attrs);return i.checkAttrs(r.attrs),r}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let i=0;i<e.length;i++)if(!e[i].eq(n[i]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return o1.none;if(e instanceof o1)return[e];let n=e.slice();return n.sort((i,r)=>i.type.rank-r.type.rank),n}};Ut.none=[];class zm extends Error{}class be{constructor(e,n,i){this.content=e,this.openStart=n,this.openEnd=i}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let i=RL(this.content,e+this.openStart,n);return i&&new be(i,this.openStart,this.openEnd)}removeBetween(e,n){return new be(OL(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return be.empty;let i=n.openStart||0,r=n.openEnd||0;if(typeof i!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new be(J.fromJSON(e,n.content),i,r)}static maxOpen(e,n=!0){let i=0,r=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)i++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)r++;return new be(e,i,r)}}be.empty=new be(J.empty,0,0);function OL(t,e,n){let{index:i,offset:r}=t.findIndex(e),a=t.maybeChild(i),{index:s,offset:o}=t.findIndex(n);if(r==e||a.isText){if(o!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(i!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(i,a.copy(OL(a.content,e-r-1,n-r-1)))}function RL(t,e,n,i){let{index:r,offset:a}=t.findIndex(e),s=t.maybeChild(r);if(a==e||s.isText)return i&&!i.canReplace(r,r,n)?null:t.cut(0,e).append(n).append(t.cut(e));let o=RL(s.content,e-a-1,n,s);return o&&t.replaceChild(r,s.copy(o))}function Aq(t,e,n){if(n.openStart>t.depth)throw new zm("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new zm("Inconsistent open depths");return ML(t,e,n,0)}function ML(t,e,n,i){let r=t.index(i),a=t.node(i);if(r==e.index(i)&&i<t.depth-n.openStart){let s=ML(t,e,n,i+1);return a.copy(a.content.replaceChild(r,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==i&&e.depth==i){let s=t.parent,o=s.content;return Xo(s,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:s,end:o}=Nq(n,t);return Xo(a,LL(t,s,o,e,i))}else return Xo(a,Gm(t,e,i))}function PL(t,e){if(!e.type.compatibleContent(t.type))throw new zm("Cannot join "+e.type.name+" onto "+t.type.name)}function l1(t,e,n){let i=t.node(n);return PL(i,e.node(n)),i}function Qo(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function md(t,e,n,i){let r=(e||t).node(n),a=0,s=e?e.index(n):r.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(Qo(t.nodeAfter,i),a++));for(let o=a;o<s;o++)Qo(r.child(o),i);e&&e.depth==n&&e.textOffset&&Qo(e.nodeBefore,i)}function Xo(t,e){return t.type.checkContent(e),t.copy(e)}function LL(t,e,n,i,r){let a=t.depth>r&&l1(t,e,r+1),s=i.depth>r&&l1(n,i,r+1),o=[];return md(null,t,r,o),a&&s&&e.index(r)==n.index(r)?(PL(a,s),Qo(Xo(a,LL(t,e,n,i,r+1)),o)):(a&&Qo(Xo(a,Gm(t,e,r+1)),o),md(e,n,r,o),s&&Qo(Xo(s,Gm(n,i,r+1)),o)),md(i,null,r,o),new J(o)}function Gm(t,e,n){let i=[];if(md(null,t,n,i),t.depth>n){let r=l1(t,e,n+1);Qo(Xo(r,Gm(t,e,n+1)),i)}return md(e,null,n,i),new J(i)}function Nq(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)r=e.node(a).copy(J.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class Yd{constructor(e,n,i){this.pos=e,this.path=n,this.parentOffset=i,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let i=this.pos-this.path[this.path.length-1],r=e.child(n);return i?e.child(n).cut(i):r}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let i=this.path[n*3],r=n==0?0:this.path[n*3-1]+1;for(let a=0;a<e;a++)r+=i.child(a).nodeSize;return r}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Ut.none;if(this.textOffset)return e.child(n).marks;let i=e.maybeChild(n-1),r=e.maybeChild(n);if(!i){let o=i;i=r,r=o}let a=i.marks;for(var s=0;s<a.length;s++)a[s].type.spec.inclusive===!1&&(!r||!a[s].isInSet(r.marks))&&(a=a[s--].removeFromSet(a));return a}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let i=n.marks,r=e.parent.maybeChild(e.index());for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let i=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);i>=0;i--)if(e.pos<=this.end(i)&&(!n||n(this.node(i))))return new qm(this,e,i);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let i=[],r=0,a=n;for(let s=e;;){let{index:o,offset:l}=s.content.findIndex(a),c=a-l;if(i.push(s,o,r+l),!c||(s=s.child(o),s.isText))break;a=c-1,r+=l+1}return new Yd(n,i,a)}static resolveCached(e,n){let i=pD.get(e);if(i)for(let a=0;a<i.elts.length;a++){let s=i.elts[a];if(s.pos==n)return s}else pD.set(e,i=new Iq);let r=i.elts[i.i]=Yd.resolve(e,n);return i.i=(i.i+1)%Oq,r}}class Iq{constructor(){this.elts=[],this.i=0}}const Oq=12,pD=new WeakMap;class qm{constructor(e,n,i){this.$from=e,this.$to=n,this.depth=i}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Rq=Object.create(null);class Pr{constructor(e,n,i,r=Ut.none){this.type=e,this.attrs=n,this.marks=r,this.content=i||J.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,i,r=0){this.content.nodesBetween(e,n,i,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,i,r){return this.content.textBetween(e,n,i,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,i){return this.type==e&&$m(this.attrs,n||e.defaultAttrs||Rq)&&Ut.sameSet(this.marks,i||Ut.none)}copy(e=null){return e==this.content?this:new Pr(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Pr(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,i=!1){if(e==n)return be.empty;let r=this.resolve(e),a=this.resolve(n),s=i?0:r.sharedDepth(n),o=r.start(s),c=r.node(s).content.cut(r.pos-o,a.pos-o);return new be(c,r.depth-s,a.depth-s)}replace(e,n,i){return Aq(this.resolve(e),this.resolve(n),i)}nodeAt(e){for(let n=this;;){let{index:i,offset:r}=n.content.findIndex(e);if(n=n.maybeChild(i),!n)return null;if(r==e||n.isText)return n;e-=r+1}}childAfter(e){let{index:n,offset:i}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:i}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:i}=this.content.findIndex(e);if(i<e)return{node:this.content.child(n),index:n,offset:i};let r=this.content.child(n-1);return{node:r,index:n-1,offset:i-r.nodeSize}}resolve(e){return Yd.resolveCached(this,e)}resolveNoCache(e){return Yd.resolve(this,e)}rangeHasMark(e,n,i){let r=!1;return n>e&&this.nodesBetween(e,n,a=>(i.isInSet(a.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),FL(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,i=J.empty,r=0,a=i.childCount){let s=this.contentMatchAt(e).matchFragment(i,r,a),o=s&&s.matchFragment(this.content,n);if(!o||!o.validEnd)return!1;for(let l=r;l<a;l++)if(!this.type.allowsMarks(i.child(l).marks))return!1;return!0}canReplaceWith(e,n,i,r){if(r&&!this.type.allowsMarks(r))return!1;let a=this.contentMatchAt(e).matchType(i),s=a&&a.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ut.none;for(let n=0;n<this.marks.length;n++){let i=this.marks[n];i.type.checkAttrs(i.attrs),e=i.addToSet(e)}if(!Ut.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let i;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");i=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,i)}let r=J.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,r,i);return a.type.checkAttrs(a.attrs),a}}Pr.prototype.text=void 0;class Hm extends Pr{constructor(e,n,i,r){if(super(e,n,null,r),!i)throw new RangeError("Empty text nodes are not allowed");this.text=i}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):FL(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Hm(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Hm(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function FL(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class cl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let i=new Mq(e,n);if(i.next==null)return cl.empty;let r=BL(i);i.next&&i.err("Unexpected trailing text");let a=zq($q(r));return Gq(a,i),a}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,i=e.childCount){let r=this;for(let a=n;r&&a<i;a++)r=r.matchType(e.child(a).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let i=0;i<e.next.length;i++)if(this.next[n].type==e.next[i].type)return!0;return!1}fillBefore(e,n=!1,i=0){let r=[this];function a(s,o){let l=s.matchFragment(e,i);if(l&&(!n||l.validEnd))return J.from(o.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&r.indexOf(d)==-1){r.push(d);let p=a(d,o.concat(u));if(p)return p}}return null}return a(this,[])}findWrapping(e){for(let i=0;i<this.wrapCache.length;i+=2)if(this.wrapCache[i]==e)return this.wrapCache[i+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),i=[{match:this,type:null,via:null}];for(;i.length;){let r=i.shift(),a=r.match;if(a.matchType(e)){let s=[];for(let o=r;o.type;o=o.via)s.push(o.type);return s.reverse()}for(let s=0;s<a.next.length;s++){let{type:o,next:l}=a.next[s];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in n)&&(!r.type||l.validEnd)&&(i.push({match:o.contentMatch,type:o,via:r}),n[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(i){e.push(i);for(let r=0;r<i.next.length;r++)e.indexOf(i.next[r].next)==-1&&n(i.next[r].next)}return n(this),e.map((i,r)=>{let a=r+(i.validEnd?"*":" ")+" ";for(let s=0;s<i.next.length;s++)a+=(s?", ":"")+i.next[s].type.name+"->"+e.indexOf(i.next[s].next);return a}).join(`
48
48
  `)}}cl.empty=new cl(!0);let Mq=class{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function BL(t){let e=[];do e.push(Pq(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Pq(t){let e=[];do e.push(Lq(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Lq(t){let e=Uq(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=Fq(t,e);else break;return e}function fD(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Fq(t,e){let n=fD(t),i=n;return t.eat(",")&&(t.next!="}"?i=fD(t):i=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:i,expr:e}}function Bq(t,e){let n=t.nodeTypes,i=n[e];if(i)return[i];let r=[];for(let a in n){let s=n[a];s.isInGroup(e)&&r.push(s)}return r.length==0&&t.err("No node type or group '"+e+"' found"),r}function Uq(t){if(t.eat("(")){let e=BL(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=Bq(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function $q(t){let e=[[]];return r(a(t,0),n()),e;function n(){return e.push([])-1}function i(s,o,l){let c={term:l,to:o};return e[s].push(c),c}function r(s,o){s.forEach(l=>l.to=o)}function a(s,o){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(a(c,o)),[]);if(s.type=="seq")for(let l=0;;l++){let c=a(s.exprs[l],o);if(l==s.exprs.length-1)return c;r(c,o=n())}else if(s.type=="star"){let l=n();return i(o,l),r(a(s.expr,l),l),[i(l)]}else if(s.type=="plus"){let l=n();return r(a(s.expr,o),l),r(a(s.expr,l),l),[i(l)]}else{if(s.type=="opt")return[i(o)].concat(a(s.expr,o));if(s.type=="range"){let l=o;for(let c=0;c<s.min;c++){let u=n();r(a(s.expr,l),u),l=u}if(s.max==-1)r(a(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let u=n();i(l,u),r(a(s.expr,l),u),l=u}return[i(l)]}else{if(s.type=="name")return[i(o,void 0,s.value)];throw new Error("Unknown expr type")}}}}function UL(t,e){return e-t}function mD(t,e){let n=[];return i(e),n.sort(UL);function i(r){let a=t[r];if(a.length==1&&!a[0].term)return i(a[0].to);n.push(r);for(let s=0;s<a.length;s++){let{term:o,to:l}=a[s];!o&&n.indexOf(l)==-1&&i(l)}}}function zq(t){let e=Object.create(null);return n(mD(t,0));function n(i){let r=[];i.forEach(s=>{t[s].forEach(({term:o,to:l})=>{if(!o)return;let c;for(let u=0;u<r.length;u++)r[u][0]==o&&(c=r[u][1]);mD(t,l).forEach(u=>{c||r.push([o,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let a=e[i.join(",")]=new cl(i.indexOf(t.length-1)>-1);for(let s=0;s<r.length;s++){let o=r[s][1].sort(UL);a.next.push({type:r[s][0],next:e[o.join(",")]||n(o)})}return a}}function Gq(t,e){for(let n=0,i=[t];n<i.length;n++){let r=i[n],a=!r.validEnd,s=[];for(let o=0;o<r.next.length;o++){let{type:l,next:c}=r.next[o];s.push(l.name),a&&!(l.isText||l.hasRequiredAttrs())&&(a=!1),i.indexOf(c)==-1&&i.push(c)}a&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function $L(t){let e=Object.create(null);for(let n in t){let i=t[n];if(!i.hasDefault)return null;e[n]=i.default}return e}function zL(t,e){let n=Object.create(null);for(let i in t){let r=e&&e[i];if(r===void 0){let a=t[i];if(a.hasDefault)r=a.default;else throw new RangeError("No value supplied for attribute "+i)}n[i]=r}return n}function GL(t,e,n,i){for(let r in e)if(!(r in t))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let r in t){let a=t[r];a.validate&&a.validate(e[r])}}function qL(t,e){let n=Object.create(null);if(e)for(let i in e)n[i]=new Hq(t,i,e[i]);return n}let hD=class HL{constructor(e,n,i){this.name=e,this.schema=n,this.spec=i,this.markSet=null,this.groups=i.group?i.group.split(" "):[],this.attrs=qL(e,i.attrs),this.defaultAttrs=$L(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(i.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==cl.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:zL(this.attrs,e)}create(e=null,n,i){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Pr(this,this.computeAttrs(e),J.from(n),Ut.setFrom(i))}createChecked(e=null,n,i){return n=J.from(n),this.checkContent(n),new Pr(this,this.computeAttrs(e),n,Ut.setFrom(i))}createAndFill(e=null,n,i){if(e=this.computeAttrs(e),n=J.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let r=this.contentMatch.matchFragment(n),a=r&&r.fillBefore(J.empty,!0);return a?new Pr(this,e,n.append(a),Ut.setFrom(i)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let i=0;i<e.childCount;i++)if(!this.allowsMarks(e.child(i).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){GL(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let i=0;i<e.length;i++)this.allowsMarkType(e[i].type)?n&&n.push(e[i]):n||(n=e.slice(0,i));return n?n.length?n:Ut.none:e}static compile(e,n){let i=Object.create(null);e.forEach((a,s)=>i[a]=new HL(a,n,s));let r=n.spec.topNode||"doc";if(!i[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!i.text)throw new RangeError("Every schema needs a 'text' type");for(let a in i.text.attrs)throw new RangeError("The text node type should not have attributes");return i}};function qq(t,e,n){let i=n.split("|");return r=>{let a=r===null?"null":typeof r;if(i.indexOf(a)<0)throw new RangeError(`Expected value of type ${i} for attribute ${e} on type ${t}, got ${a}`)}}class Hq{constructor(e,n,i){this.hasDefault=Object.prototype.hasOwnProperty.call(i,"default"),this.default=i.default,this.validate=typeof i.validate=="string"?qq(e,n,i.validate):i.validate}get isRequired(){return!this.hasDefault}}class ng{constructor(e,n,i,r){this.name=e,this.rank=n,this.schema=i,this.spec=r,this.attrs=qL(e,r.attrs),this.excluded=null;let a=$L(this.attrs);this.instance=a?new Ut(this,a):null}create(e=null){return!e&&this.instance?this.instance:new Ut(this,zL(this.attrs,e))}static compile(e,n){let i=Object.create(null),r=0;return e.forEach((a,s)=>i[a]=new ng(a,r++,n,s)),i}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){GL(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class jL{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let r in e)n[r]=e[r];n.nodes=$n.from(e.nodes),n.marks=$n.from(e.marks||{}),this.nodes=hD.compile(this.spec.nodes,this),this.marks=ng.compile(this.spec.marks,this);let i=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let a=this.nodes[r],s=a.spec.content||"",o=a.spec.marks;if(a.contentMatch=i[s]||(i[s]=cl.parse(s,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=o=="_"?null:o?gD(this,o.split(" ")):o==""||!a.inlineContent?[]:null}for(let r in this.marks){let a=this.marks[r],s=a.spec.excludes;a.excluded=s==null?[a]:s==""?[]:gD(this,s.split(" "))}this.nodeFromJSON=r=>Pr.fromJSON(this,r),this.markFromJSON=r=>Ut.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,i,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof hD){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,i,r)}text(e,n){let i=this.nodes.text;return new Hm(i,i.defaultAttrs,e,Ut.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function gD(t,e){let n=[];for(let i=0;i<e.length;i++){let r=e[i],a=t.marks[r],s=a;if(a)n.push(a);else for(let o in t.marks){let l=t.marks[o];(r=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(r)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[i]+"'")}return n}function jq(t){return t.tag!=null}function Vq(t){return t.style!=null}class qs{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let i=this.matchedStyles=[];n.forEach(r=>{if(jq(r))this.tags.push(r);else if(Vq(r)){let a=/[^=]*/.exec(r.style)[0];i.indexOf(a)<0&&i.push(a),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let a=e.nodes[r.node];return a.contentMatch.matchType(a)})}parse(e,n={}){let i=new bD(this,n,!1);return i.addAll(e,Ut.none,n.from,n.to),i.finish()}parseSlice(e,n={}){let i=new bD(this,n,!0);return i.addAll(e,Ut.none,n.from,n.to),be.maxOpen(i.finish())}matchTag(e,n,i){for(let r=i?this.tags.indexOf(i)+1:0;r<this.tags.length;r++){let a=this.tags[r];if(Kq(e,a.tag)&&(a.namespace===void 0||e.namespaceURI==a.namespace)&&(!a.context||n.matchesContext(a.context))){if(a.getAttrs){let s=a.getAttrs(e);if(s===!1)continue;a.attrs=s||void 0}return a}}}matchStyle(e,n,i,r){for(let a=r?this.styles.indexOf(r)+1:0;a<this.styles.length;a++){let s=this.styles[a],o=s.style;if(!(o.indexOf(e)!=0||s.context&&!i.matchesContext(s.context)||o.length>e.length&&(o.charCodeAt(e.length)!=61||o.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function i(r){let a=r.priority==null?50:r.priority,s=0;for(;s<n.length;s++){let o=n[s];if((o.priority==null?50:o.priority)<a)break}n.splice(s,0,r)}for(let r in e.marks){let a=e.marks[r].spec.parseDOM;a&&a.forEach(s=>{i(s=yD(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let a=e.nodes[r].spec.parseDOM;a&&a.forEach(s=>{i(s=yD(s)),s.node||s.ignore||s.mark||(s.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new qs(e,qs.schemaRules(e)))}}const VL={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Yq={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},YL={ol:!0,ul:!0},Wd=1,c1=2,hd=4;function _D(t,e,n){return e!=null?(e?Wd:0)|(e==="full"?c1:0):t&&t.whitespace=="pre"?Wd|c1:n&~hd}class of{constructor(e,n,i,r,a,s){this.type=e,this.attrs=n,this.marks=i,this.solid=r,this.options=s,this.content=[],this.activeMarks=Ut.none,this.match=a||(s&hd?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(J.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let i=this.type.contentMatch,r;return(r=i.findWrapping(e.type))?(this.match=i,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Wd)){let i=this.content[this.content.length-1],r;if(i&&i.isText&&(r=/[ \t\r\n\u000c]+$/.exec(i.text))){let a=i;i.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-r[0].length))}}let n=J.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(J.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!VL.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class bD{constructor(e,n,i){this.parser=e,this.options=n,this.isOpen=i,this.open=0,this.localPreserveWS=!1;let r=n.topNode,a,s=_D(null,n.preserveWhitespace,0)|(i?hd:0);r?a=new of(r.type,r.attrs,Ut.none,!0,n.topMatch||r.type.contentMatch,s):i?a=new of(null,null,Ut.none,!0,null,s):a=new of(e.schema.topNodeType,null,Ut.none,!0,null,s),this.nodes=[a],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let i=e.nodeValue,r=this.top,a=r.options&c1?"full":this.localPreserveWS||(r.options&Wd)>0,{schema:s}=this.parser;if(a==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(i)){if(a)if(a==="full")i=i.replace(/\r\n?/g,`
49
49
  `);else if(s.linebreakReplacement&&/[\r\n]/.test(i)&&this.top.findWrapping(s.linebreakReplacement.create())){let o=i.split(/\r?\n|\r/);for(let l=0;l<o.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),n,!0),o[l]&&this.insertNode(s.text(o[l]),n,!/\S/.test(o[l]));i=""}else i=i.replace(/\r?\n|\r/g," ");else if(i=i.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(i)&&this.open==this.nodes.length-1){let o=r.content[r.content.length-1],l=e.previousSibling;(!o||l&&l.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(i=i.slice(1))}i&&this.insertNode(s.text(i),n,!/\S/.test(i)),this.findInText(e)}else this.findInside(e)}addElement(e,n,i){let r=this.localPreserveWS,a=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),o;YL.hasOwnProperty(s)&&this.parser.normalizeLists&&Wq(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,i));e:if(l?l.ignore:Yq.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(VL.hasOwnProperty(s))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),c=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(a),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
50
50
  `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let i=e.style;if(i&&i.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let a=this.parser.matchedStyles[r],s=i.getPropertyValue(a);if(s)for(let o=void 0;;){let l=this.parser.matchStyle(a,s,this,o);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)o=l;else break}}return n}addElementByRule(e,n,i,r){let a,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),i,e.nodeName=="BR")||this.leafFallback(e,i);else{let l=this.enter(s,n.attrs||null,i,n.preserveWhitespace);l&&(a=!0,i=l)}else{let l=this.parser.schema.marks[n.mark];i=i.concat(l.create(n.attrs))}let o=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,i,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,i,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,i),this.findAround(e,l,!1)}a&&this.sync(o)&&this.open--}addAll(e,n,i,r){let a=i||0;for(let s=i?e.childNodes[i]:e.firstChild,o=r==null?null:e.childNodes[r];s!=o;s=s.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(s,n);this.findAtPoint(e,a)}findPlace(e,n,i){let r,a;for(let s=this.open,o=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(e);if(c&&(!r||r.length>c.length+o)&&(r=c,a=l,!c.length))break;if(l.solid){if(i)break;o+=2}}if(!r)return null;this.sync(a);for(let s=0;s<r.length;s++)n=this.enterInner(r[s],null,n,!1);return n}insertNode(e,n,i){if(e.isInline&&this.needsBlock&&!this.top.type){let a=this.textblockFromContext();a&&(n=this.enterInner(a,null,n))}let r=this.findPlace(e,n,i);if(r){this.closeExtra();let a=this.top;a.match&&(a.match=a.match.matchType(e.type));let s=Ut.none;for(let o of r.concat(e.marks))(a.type?a.type.allowsMarkType(o.type):ED(o.type,e.type))&&(s=o.addToSet(s));return a.content.push(e.mark(s)),!0}return!1}enter(e,n,i,r){let a=this.findPlace(e.create(n),i,!1);return a&&(a=this.enterInner(e,n,i,!0,r)),a}enterInner(e,n,i,r=!1,a){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let o=_D(e,a,s.options);s.options&hd&&s.content.length==0&&(o|=hd);let l=Ut.none;return i=i.filter(c=>(s.type?s.type.allowsMarkType(c.type):ED(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new of(e,n,l,r,null,o)),this.open++,i}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Wd)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let i=this.nodes[n].content;for(let r=i.length-1;r>=0;r--)e+=i[r].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let i=0;i<this.find.length;i++)this.find[i].node==e&&this.find[i].offset==n&&(this.find[i].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,i){if(e!=n&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&n.compareDocumentPosition(this.find[r].node)&(i?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),i=this.options.context,r=!this.isOpen&&(!i||i.parent.type==this.nodes[0].type),a=-(i?i.depth+1:0)+(r?0:1),s=(o,l)=>{for(;o>=0;o--){let c=n[o];if(c==""){if(o==n.length-1||o==0)continue;for(;l>=a;l--)if(s(o-1,l))return!0;return!1}else{let u=l>0||l==0&&r?this.nodes[l].type:i&&l>=a?i.node(l-a).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(i&&i.isTextblock&&i.defaultAttrs)return i}for(let n in this.parser.schema.nodes){let i=this.parser.schema.nodes[n];if(i.isTextblock&&i.defaultAttrs)return i}}}function Wq(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let i=e.nodeType==1?e.nodeName.toLowerCase():null;i&&YL.hasOwnProperty(i)&&n?(n.appendChild(e),e=n):i=="li"?n=e:i&&(n=null)}}function Kq(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function yD(t){let e={};for(let n in t)e[n]=t[n];return e}function ED(t,e){let n=e.schema.nodes;for(let i in n){let r=n[i];if(!r.allowsMarkType(t))continue;let a=[],s=o=>{a.push(o);for(let l=0;l<o.edgeCount;l++){let{type:c,next:u}=o.edge(l);if(c==e||a.indexOf(u)<0&&s(u))return!0}};if(s(r.contentMatch))return!0}}class Cl{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},i){i||(i=v_(n).createDocumentFragment());let r=i,a=[];return e.forEach(s=>{if(a.length||s.marks.length){let o=0,l=0;for(;o<a.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(a[o][0])||c.type.spec.spanning===!1)break;o++,l++}for(;o<a.length;)r=a.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],u=this.serializeMark(c,s.isInline,n);u&&(a.push([c,r]),r.appendChild(u.dom),r=u.contentDOM||u.dom)}}r.appendChild(this.serializeNodeInner(s,n))}),i}serializeNodeInner(e,n){let{dom:i,contentDOM:r}=Wf(v_(n),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,r)}return i}serializeNode(e,n={}){let i=this.serializeNodeInner(e,n);for(let r=e.marks.length-1;r>=0;r--){let a=this.serializeMark(e.marks[r],e.isInline,n);a&&((a.contentDOM||a.dom).appendChild(i),i=a.dom)}return i}serializeMark(e,n,i={}){let r=this.marks[e.type.name];return r&&Wf(v_(i),r(e,n),null,e.attrs)}static renderSpec(e,n,i=null,r){return Wf(e,n,i,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Cl(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=SD(e.nodes);return n.text||(n.text=i=>i.text),n}static marksFromSchema(e){return SD(e.marks)}}function SD(t){let e={};for(let n in t){let i=t[n].spec.toDOM;i&&(e[n]=i)}return e}function v_(t){return t.document||window.document}const vD=new WeakMap;function Qq(t){let e=vD.get(t);return e===void 0&&vD.set(t,e=Xq(t)),e}function Xq(t){let e=null;function n(i){if(i&&typeof i=="object")if(Array.isArray(i))if(typeof i[0]=="string")e||(e=[]),e.push(i);else for(let r=0;r<i.length;r++)n(i[r]);else for(let r in i)n(i[r])}return n(t),e}function Wf(t,e,n,i){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],a;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(i&&(a=Qq(i))&&a.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=r.indexOf(" ");s>0&&(n=r.slice(0,s),r=r.slice(s+1));let o,l=n?t.createElementNS(n,r):t.createElement(r),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let p=d.indexOf(" ");p>0?l.setAttributeNS(d.slice(0,p),d.slice(p+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let p=e[d];if(p===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:h}=Wf(t,p,n,i);if(l.appendChild(f),h){if(o)throw new RangeError("Multiple content holes");o=h}}}return{dom:l,contentDOM:o}}const WL=65535,KL=Math.pow(2,16);function Jq(t,e){return t+e*KL}function TD(t){return t&WL}function Zq(t){return(t-(t&WL))/KL}const QL=1,XL=2,Kf=4,JL=8;class u1{constructor(e,n,i){this.pos=e,this.delInfo=n,this.recover=i}get deleted(){return(this.delInfo&JL)>0}get deletedBefore(){return(this.delInfo&(QL|Kf))>0}get deletedAfter(){return(this.delInfo&(XL|Kf))>0}get deletedAcross(){return(this.delInfo&Kf)>0}}class zi{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&zi.empty)return zi.empty}recover(e){let n=0,i=TD(e);if(!this.inverted)for(let r=0;r<i;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[i*3]+n+Zq(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,i){let r=0,a=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[o+a],u=this.ranges[o+s],d=l+c;if(e<=d){let p=c?e==l?-1:e==d?1:n:n,f=l+r+(p<0?0:u);if(i)return f;let h=e==(n<0?l:d)?null:Jq(o/3,e-l),_=e==l?XL:e==d?QL:Kf;return(n<0?e!=l:e!=d)&&(_|=JL),new u1(f,_,h)}r+=u-c}return i?e+r:new u1(e+r,0,null)}touches(e,n){let i=0,r=TD(n),a=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[o+a],u=l+c;if(e<=u&&o==r*3)return!0;i+=this.ranges[o+s]-c}return!1}forEach(e){let n=this.inverted?2:1,i=this.inverted?1:2;for(let r=0,a=0;r<this.ranges.length;r+=3){let s=this.ranges[r],o=s-(this.inverted?a:0),l=s+(this.inverted?0:a),c=this.ranges[r+n],u=this.ranges[r+i];e(o,o+c,l,l+u),a+=u-c}}invert(){return new zi(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?zi.empty:new zi(e<0?[0,-e,0]:[0,0,e])}}zi.empty=new zi([]);class Kd{constructor(e,n,i=0,r=e?e.length:0){this.mirror=n,this.from=i,this.to=r,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Kd(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,i=this._maps.length;n<e._maps.length;n++){let r=e.getMirror(n);this.appendMap(e._maps[n],r!=null&&r<n?i+r:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,i=this._maps.length+e._maps.length;n>=0;n--){let r=e.getMirror(n);this.appendMap(e._maps[n].invert(),r!=null&&r>n?i-r-1:void 0)}}invert(){let e=new Kd;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let i=this.from;i<this.to;i++)e=this._maps[i].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,i){let r=0;for(let a=this.from;a<this.to;a++){let s=this._maps[a],o=s.mapResult(e,n);if(o.recover!=null){let l=this.getMirror(a);if(l!=null&&l>a&&l<this.to){a=l,e=this._maps[l].recover(o.recover);continue}}r|=o.delInfo,e=o.pos}return i?e:new u1(e,r,null)}}const T_=Object.create(null);class si{getMap(){return zi.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=T_[n.stepType];if(!i)throw new RangeError(`No step type ${n.stepType} defined`);return i.fromJSON(e,n)}static jsonID(e,n){if(e in T_)throw new RangeError("Duplicate use of step JSON ID "+e);return T_[e]=n,n.prototype.jsonID=e,n}}class yn{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new yn(e,null)}static fail(e){return new yn(null,e)}static fromReplace(e,n,i,r){try{return yn.ok(e.replace(n,i,r))}catch(a){if(a instanceof zm)return yn.fail(a.message);throw a}}}function lT(t,e,n){let i=[];for(let r=0;r<t.childCount;r++){let a=t.child(r);a.content.size&&(a=a.copy(lT(a.content,e,a))),a.isInline&&(a=e(a,n,r)),i.push(a)}return J.fromArray(i)}class $s extends si{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=e.resolve(this.from),r=i.node(i.sharedDepth(this.to)),a=new be(lT(n.content,(s,o)=>!s.isAtom||!o.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),n.openStart,n.openEnd);return yn.fromReplace(e,this.from,this.to,a)}invert(){return new Or(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new $s(n.pos,i.pos,this.mark)}merge(e){return e instanceof $s&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new $s(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new $s(n.from,n.to,e.markFromJSON(n.mark))}}si.jsonID("addMark",$s);class Or extends si{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=new be(lT(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return yn.fromReplace(e,this.from,this.to,i)}invert(){return new $s(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new Or(n.pos,i.pos,this.mark)}merge(e){return e instanceof Or&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Or(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Or(n.from,n.to,e.markFromJSON(n.mark))}}si.jsonID("removeMark",Or);class zs extends si{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return yn.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return yn.fromReplace(e,this.pos,this.pos+1,new be(J.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let i=this.mark.addToSet(n.marks);if(i.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(i))return new zs(this.pos,n.marks[r]);return new zs(this.pos,this.mark)}}return new ul(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new zs(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new zs(n.pos,e.markFromJSON(n.mark))}}si.jsonID("addNodeMark",zs);class ul extends si{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return yn.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return yn.fromReplace(e,this.pos,this.pos+1,new be(J.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new zs(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ul(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ul(n.pos,e.markFromJSON(n.mark))}}si.jsonID("removeNodeMark",ul);class In extends si{constructor(e,n,i,r=!1){super(),this.from=e,this.to=n,this.slice=i,this.structure=r}apply(e){return this.structure&&d1(e,this.from,this.to)?yn.fail("Structure replace would overwrite content"):yn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new zi([this.from,this.to-this.from,this.slice.size])}invert(e){return new In(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deletedAcross&&i.deletedAcross?null:new In(n.pos,Math.max(n.pos,i.pos),this.slice,this.structure)}merge(e){if(!(e instanceof In)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?be.empty:new be(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new In(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?be.empty:new be(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new In(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new In(n.from,n.to,be.fromJSON(e,n.slice),!!n.structure)}}si.jsonID("replace",In);class Mn extends si{constructor(e,n,i,r,a,s,o=!1){super(),this.from=e,this.to=n,this.gapFrom=i,this.gapTo=r,this.slice=a,this.insert=s,this.structure=o}apply(e){if(this.structure&&(d1(e,this.from,this.gapFrom)||d1(e,this.gapTo,this.to)))return yn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return yn.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,n.content);return i?yn.fromReplace(e,this.from,this.to,i):yn.fail("Content does not fit in gap")}getMap(){return new zi([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Mn(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return n.deletedAcross&&i.deletedAcross||r<n.pos||a>i.pos?null:new Mn(n.pos,i.pos,r,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Mn(n.from,n.to,n.gapFrom,n.gapTo,be.fromJSON(e,n.slice),n.insert,!!n.structure)}}si.jsonID("replaceAround",Mn);function d1(t,e,n){let i=t.resolve(e),r=n-e,a=i.depth;for(;r>0&&a>0&&i.indexAfter(a)==i.node(a).childCount;)a--,r--;if(r>0){let s=i.node(a).maybeChild(i.indexAfter(a));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function eH(t,e,n,i){let r=[],a=[],s,o;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!i.isInSet(d)&&u.type.allowsMarkType(i.type)){let p=Math.max(c,e),f=Math.min(c+l.nodeSize,n),h=i.addToSet(d);for(let _=0;_<d.length;_++)d[_].isInSet(h)||(s&&s.to==p&&s.mark.eq(d[_])?s.to=f:r.push(s=new Or(p,f,d[_])));o&&o.to==p?o.to=f:a.push(o=new $s(p,f,i))}}),r.forEach(l=>t.step(l)),a.forEach(l=>t.step(l))}function tH(t,e,n,i){let r=[],a=0;t.doc.nodesBetween(e,n,(s,o)=>{if(!s.isInline)return;a++;let l=null;if(i instanceof ng){let c=s.marks,u;for(;u=i.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else i?i.isInSet(s.marks)&&(l=[i]):l=s.marks;if(l&&l.length){let c=Math.min(o+s.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],p;for(let f=0;f<r.length;f++){let h=r[f];h.step==a-1&&d.eq(r[f].style)&&(p=h)}p?(p.to=c,p.step=a):r.push({style:d,from:Math.max(o,e),to:c,step:a})}}}),r.forEach(s=>t.step(new Or(s.from,s.to,s.style)))}function cT(t,e,n,i=n.contentMatch,r=!0){let a=t.doc.nodeAt(e),s=[],o=e+1;for(let l=0;l<a.childCount;l++){let c=a.child(l),u=o+c.nodeSize,d=i.matchType(c.type);if(!d)s.push(new In(o,u,be.empty));else{i=d;for(let p=0;p<c.marks.length;p++)n.allowsMarkType(c.marks[p].type)||t.step(new Or(o,u,c.marks[p]));if(r&&c.isText&&n.whitespace!="pre"){let p,f=/\r?\n|\r/g,h;for(;p=f.exec(c.text);)h||(h=new be(J.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new In(o+p.index,o+p.index+p[0].length,h))}}o=u}if(!i.validEnd){let l=i.fillBefore(J.empty,!0);t.replace(o,o,new be(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function nH(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function tu(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let i=t.depth,r=0,a=0;;--i){let s=t.$from.node(i),o=t.$from.index(i)+r,l=t.$to.indexAfter(i)-a;if(i<t.depth&&s.canReplace(o,l,n))return i;if(i==0||s.type.spec.isolating||!nH(s,o,l))break;o&&(r=1),l<s.childCount&&(a=1)}return null}function iH(t,e,n){let{$from:i,$to:r,depth:a}=e,s=i.before(a+1),o=r.after(a+1),l=s,c=o,u=J.empty,d=0;for(let h=a,_=!1;h>n;h--)_||i.index(h)>0?(_=!0,u=J.from(i.node(h).copy(u)),d++):l--;let p=J.empty,f=0;for(let h=a,_=!1;h>n;h--)_||r.after(h+1)<r.end(h)?(_=!0,p=J.from(r.node(h).copy(p)),f++):c++;t.step(new Mn(l,c,s,o,new be(u.append(p),d,f),u.size-d,!0))}function uT(t,e,n=null,i=t){let r=rH(t,e),a=r&&aH(i,e);return a?r.map(CD).concat({type:e,attrs:n}).concat(a.map(CD)):null}function CD(t){return{type:t,attrs:null}}function rH(t,e){let{parent:n,startIndex:i,endIndex:r}=t,a=n.contentMatchAt(i).findWrapping(e);if(!a)return null;let s=a.length?a[0]:e;return n.canReplaceWith(i,r,s)?a:null}function aH(t,e){let{parent:n,startIndex:i,endIndex:r}=t,a=n.child(i),s=e.contentMatch.findWrapping(a.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let c=i;l&&c<r;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:s}function sH(t,e,n){let i=J.empty;for(let s=n.length-1;s>=0;s--){if(i.size){let o=n[s].type.contentMatch.matchFragment(i);if(!o||!o.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=J.from(n[s].type.create(n[s].attrs,i))}let r=e.start,a=e.end;t.step(new Mn(r,a,r,a,new be(i,0,0),n.length,!0))}function oH(t,e,n,i,r){if(!i.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=t.steps.length;t.doc.nodesBetween(e,n,(s,o)=>{let l=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(i,l)&&lH(t.doc,t.mapping.slice(a).map(o),i)){let c=null;if(i.schema.linebreakReplacement){let f=i.whitespace=="pre",h=!!i.contentMatch.matchType(i.schema.linebreakReplacement);f&&!h?c=!1:!f&&h&&(c=!0)}c===!1&&eF(t,s,o,a),cT(t,t.mapping.slice(a).map(o,1),i,void 0,c===null);let u=t.mapping.slice(a),d=u.map(o,1),p=u.map(o+s.nodeSize,1);return t.step(new Mn(d,p,d+1,p-1,new be(J.from(i.create(l,null,s.marks)),0,0),1,!0)),c===!0&&ZL(t,s,o,a),!1}})}function ZL(t,e,n,i){e.forEach((r,a)=>{if(r.isText){let s,o=/\r?\n|\r/g;for(;s=o.exec(r.text);){let l=t.mapping.slice(i).map(n+1+a+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function eF(t,e,n,i){e.forEach((r,a)=>{if(r.type==r.type.schema.linebreakReplacement){let s=t.mapping.slice(i).map(n+1+a);t.replaceWith(s,s+1,e.type.schema.text(`
@@ -435,5 +435,5 @@ ${u}`),u}async function rxe(t,e){let n=await Uk(e),i=n.preprocess?await n.prepro
435
435
  h1,h2,h3,h4,h5,h6{font-size:revert;font-weight:revert;}
436
436
  p{margin: 0;}
437
437
  ol,ul{list-style:revert;margin:revert;padding:revert;}
438
- `;function Wh(t,{rootBlockId:e}){const{cleanedDocument:n,css:i}=s6(t);return m.jsx(nu,{children:"<!DOCTYPE html>"+l$.renderToStaticMarkup(m.jsxs("html",{lang:"en",children:[m.jsxs("head",{children:[m.jsx("link",{href:"https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&family=Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700;1,900&family=Montserrat:ital,wght@0,100..900;1,100..900&family=Open+Sans:ital,wght@0,300..800;1,300..800&family=Oswald:wght@200..700&family=Pacifico&family=Playfair:ital,opsz,wght@0,5..1200,300..900;1,5..1200,300..900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap",rel:"stylesheet"}),m.jsx("style",{dangerouslySetInnerHTML:{__html:`${i}`}}),m.jsx("style",{dangerouslySetInnerHTML:{__html:`${dDe}`}}),m.jsx("title",{children:"emailbuilder.online"})]}),m.jsx("body",{style:{width:"100%",margin:"0",padding:"0",backgroundColor:t?.root?.data?.backdropColor??"#f4f4f4"},children:m.jsx("table",{role:"presentation",style:{width:"100%",height:"100%",border:"0"},children:m.jsx("tbody",{children:m.jsx("tr",{children:m.jsx("td",{align:"center",valign:"middle",style:{padding:"0"},children:m.jsx("table",{role:"presentation",style:{maxWidth:"600px",width:"100%",border:"0"},children:m.jsx("tr",{children:m.jsx("td",{children:m.jsx(SB,{isNotClient:!0,document:n,rootBlockId:e})})})})})})})})})]})).replace(/<div style="position:relative">\s*<button\s+class="MuiButtonBase-root\b.*?>.*?<\/button>.*?<\/div>/gs,"")})}function pDe(){const t=K0(),e=v.useMemo(()=>Wh(t,{rootBlockId:"root"}),[t]);return m.jsx("div",{style:{width:"100%",margin:"0 auto"},children:m.jsx(X5,{type:"html",value:e?.props.children})})}function fDe(){const t=K0(),e=v.useMemo(()=>JSON.stringify(t,null," "),[t]);return m.jsx("div",{style:{width:"100%",margin:"0 auto"},children:m.jsx(X5,{type:"json",value:e})})}const mDe={AccountCircleOutlined:$.AccountCircleOutlined,ArticleOutlined:$.ArticleOutlined,CodeOutlined:$.CodeOutlined,Crop32Outlined:$.Crop32Outlined,DashboardOutlined:$.DashboardOutlined,Groups2:$.Groups2,HorizontalRuleOutlined:$.HorizontalRuleOutlined,ImageOutlined:$.ImageOutlined,LibraryAddOutlined:$.LibraryAddOutlined,SmartButtonOutlined:$.SmartButtonOutlined,TextFieldsOutlined:$.TextFieldsOutlined,Title:$.Title,ViewColumnOutlined:$.ViewColumnOutlined,WidgetsOutlined:$.WidgetsOutlined};function hDe(t){const e=document.querySelector(`[data-block-id="${t}"]`);e&&e.scrollIntoView({behavior:"smooth",block:"center"})}function J5({node:t,selectedBlockId:e,onSelect:n}){const i=mDe[t.iconName]??$.WidgetsOutlined,r=e===t.blockId,a=ne(g=>g.darkMode),[s,o]=v.useState(null),l=v.useRef(null),c=g=>{const b=g.getClientOffset(),y=l.current?.getBoundingClientRect();if(!b||!y)return null;const E=(y.bottom-y.top)/2;return b.y-y.top<E?"up":"down"},[{isOver:u},d]=Qs.useDrop(()=>({accept:"block",drop:(g,b)=>{const y=t.blockId,E=g.blockId;if(y===E||b.didDrop())return;const S=c(b)??"down";Gd(y,E,S)},canDrop:g=>!vl({targetId:t.blockId,draggedId:g.blockId}),collect:g=>({isOver:g.canDrop()?g.isOver({shallow:!0}):!1}),hover:(g,b)=>{if(g.blockId===t.blockId){o(null);return}if(!b.canDrop()||!b.isOver({shallow:!0})){o(null);return}const y=c(b);if(!y){o(null);return}o(y)},end:()=>{o(null)}})),[{isDragging:p},f]=Qs.useDrag(()=>({type:"block",item:{blockId:t.blockId},collect:g=>({isDragging:g.isDragging()})}));v.useEffect(()=>{u||o(null)},[u]);const h=g=>{l.current=g,g&&f(d(g))},_=g=>{g.stopPropagation(),t.type==="NotionText"&&window.dispatchEvent(new CustomEvent("email-builder-highlight-editor",{detail:!0})),n(t.blockId),hDe(t.blockId)};return m.jsxs(T.Box,{sx:{width:"100%"},children:[m.jsxs(T.Box,{ref:h,onClick:_,sx:{display:"flex",alignItems:"center",gap:1,py:.5,px:1,pl:1+(t.depth-1)*2,cursor:"pointer",backgroundColor:r?"action.selected":u?"action.hover":"transparent",borderLeftWidth:3,borderLeftStyle:"solid",borderLeftColor:r?"primary.main":"transparent",borderTop:s==="up"?2:0,borderTopColor:"primary.main",borderBottom:s==="down"?2:0,borderBottomColor:"primary.main",opacity:p?.6:1,"&:hover":{backgroundColor:"action.hover"}},children:[m.jsx(i,{fontSize:"small",sx:g=>({color:r?g.palette.primary.main:a?g.palette.text.primary:g.palette.text.secondary,flexShrink:0})}),m.jsx(T.Typography,{variant:"body2",noWrap:!0,sx:{flex:1,minWidth:0,fontWeight:r?600:400},children:t.label})]}),t.children.map(g=>m.jsx(J5,{node:g,selectedBlockId:e,onSelect:n},g.blockId))]})}function gDe(){const{t}=Ke.useTranslation("inspector"),e=kq(Cq),n=ne(s=>s.selectedBlockId),i=X0(),r=typeof document<"u"?document.querySelector('[data-component-tree-toggle="true"]'):null,a=s=>{r&&r.contains(s.target)||jv()};return!e||!i||!r?null:m.jsx(T.Popper,{open:i,anchorEl:r,placement:"bottom-end",transition:!0,popperOptions:{strategy:"fixed"},sx:{zIndex:1300},children:({TransitionProps:s})=>m.jsx(T.Grow,{...s,style:{transformOrigin:"right top"},children:m.jsx(T.Paper,{elevation:8,sx:{width:260,maxHeight:"50vh",overflow:"hidden",borderRadius:2,display:"flex",flexDirection:"column",boxShadow:16,border:1,borderColor:"divider"},children:m.jsx(T.ClickAwayListener,{onClickAway:a,children:m.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",maxHeight:"50vh"},children:[m.jsxs(T.Box,{sx:{p:1,pb:0,borderBottom:1,borderColor:"divider",display:"flex",alignItems:"center",justifyContent:"space-between",userSelect:"none",flexShrink:0},children:[m.jsx(T.Typography,{variant:"subtitle2",color:"text.secondary",children:t("header.componentTree","Component tree")}),m.jsx(T.IconButton,{size:"small",onClick:()=>jv(),"aria-label":t("header.closeComponentTree","Close component tree"),sx:o=>({color:o.palette.text.secondary}),children:m.jsx($.Close,{fontSize:"small"})})]}),m.jsx(T.Box,{sx:{p:.5,pb:2,overflowY:"auto",flex:1,minHeight:0},children:e.children.map(o=>m.jsx(J5,{node:o,selectedBlockId:n,onSelect:l=>Hi(l)},o.blockId))})]})})})})})}function _De(){const{t}=Ke.useTranslation("inspector"),e=X0();ne(r=>r.darkMode);const n=()=>{jv()},i=e?t("header.closeComponentTree","Close component tree"):t("header.openComponentTree","Open component tree");return m.jsx(T.Tooltip,{title:i,placement:"bottom",children:m.jsx(T.IconButton,{onClick:n,size:"small","aria-label":i,"data-component-tree-toggle":"true",sx:r=>({color:e?r.palette.primary.main:r.palette.text.primary,"&:hover":{color:r.palette.primary.dark,backgroundColor:`${G.alpha(r.palette.primary.main,.08)}`}}),children:e?m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",height:"20px",width:"20px",viewBox:"0 -960 960 960",fill:"currentColor",children:m.jsx("path",{d:"M480-400 40-640l440-240 440 240-440 240Zm0 160L63-467l84-46 333 182 333-182 84 46-417 227Zm0 160L63-307l84-46 333 182 333-182 84 46L480-80Zm0-411 273-149-273-149-273 149 273 149Zm0-149Z"})}):m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",height:"20px",width:"20px",viewBox:"0 -960 960 960",fill:"currentColor",children:m.jsx("path",{d:"M480-400 40-640l440-240 440 240-440 240Zm0 160L63-467l84-46 333 182 333-182 84 46-417 227Zm0 160L63-307l84-46 333 182 333-182 84 46L480-80Zm0-411 273-149-273-149-273 149 273 149Zm0-149Z"})})})})}function bDe({enableEditorTab:t=!0,enablePreviewTab:e=!0,enableHtmlTab:n=!0,enableJsonTab:i=!0}){const r=Q0(),a=Uz(),s=dn(),{t:o}=Ke.useTranslation("inspector"),l=v.useMemo(()=>{const u=[];return t&&u.push("editor"),e&&u.push("preview"),n&&u.push("html"),i&&a&&u.push("json"),u},[t,e,n,i,a]);v.useEffect(()=>{l.includes(r)||nf(l[0]??"editor")},[l.join(","),r]);const c=(u,d)=>{const p=sessionStorage.getItem("lastSelectedScreenSize")||"desktop";switch(d){case"html":nf("html"),sessionStorage.setItem("lastSelectedScreenSize",s||"desktop"),km("desktop");break;case"preview":case"json":case"editor":km(p),nf(d);return;default:nf("editor")}};return m.jsxs(T.Tabs,{value:r,onChange:c,children:[t&&m.jsx(T.Tab,{id:"tab-editor",value:"editor",label:m.jsx(T.Tooltip,{disableInteractive:!0,arrow:!0,title:o("header.edit"),children:m.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M12.6935 4.36019L15.6398 7.30647M13.9435 3.11019C14.7571 2.2966 16.0762 2.2966 16.8898 3.11019C17.7034 3.92379 17.7034 5.24288 16.8898 6.05647L5.41667 17.5296H2.5V14.5537L13.9435 3.11019Z",stroke:"inherit",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}),e&&m.jsx(T.Tab,{id:"tab-preview",value:"preview",label:m.jsx(T.Tooltip,{disableInteractive:!0,arrow:!0,title:o("header.preview"),children:m.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[m.jsx("path",{d:"M12.5003 9.99984C12.5003 11.3805 11.381 12.4998 10.0003 12.4998C8.61957 12.4998 7.50029 11.3805 7.50029 9.99984C7.50029 8.61913 8.61957 7.49984 10.0003 7.49984C11.381 7.49984 12.5003 8.61913 12.5003 9.99984Z",stroke:"inherit",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),m.jsx("path",{d:"M2.04883 9.99981C3.11072 6.6189 6.26929 4.1665 10.0007 4.1665C13.732 4.1665 16.8906 6.61893 17.9525 9.99987C16.8906 13.3808 13.732 15.8332 10.0007 15.8332C6.26929 15.8332 3.11071 13.3807 2.04883 9.99981Z",stroke:"inherit",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})}),n&&m.jsx(T.Tab,{id:"tab-html",value:"html",label:m.jsx(T.Tooltip,{disableInteractive:!0,arrow:!0,title:o("header.htmlOutput"),children:m.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M8.33268 16.6668L11.666 3.3335M14.9993 6.66683L18.3327 10.0002L14.9993 13.3335M4.99935 13.3335L1.66602 10.0002L4.99935 6.66683",stroke:"inherit",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})},"html"),i&&a&&m.jsx(T.Tab,{id:"tab-json",value:"json",label:m.jsx(T.Tooltip,{disableInteractive:!0,arrow:!0,title:o("header.jsonOutput"),children:m.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M7.49935 10L12.4993 10M7.49935 13.3333L12.4993 13.3333M14.166 17.5H5.83268C4.91221 17.5 4.16602 16.7538 4.16602 15.8333L4.16602 4.16667C4.16602 3.24619 4.91221 2.5 5.83268 2.5L10.4875 2.5C10.7085 2.5 10.9205 2.5878 11.0768 2.74408L15.5886 7.25592C15.7449 7.4122 15.8327 7.62416 15.8327 7.84518L15.8327 15.8333C15.8327 16.7538 15.0865 17.5 14.166 17.5Z",stroke:"inherit",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})},"json")]})}const Lv=16350,yDe=v.memo(function({onRendered:e}){const n=ne(i=>i.document,(i,r)=>i===r);return m.jsx(SB,{document:n,disabledInteraction:!0,isNotClient:!0,onRendered:e})});function EDe({sticky:t,heightContent:e,enableEditorTab:n=!0,enablePreviewTab:i=!0,enableHtmlTab:r=!1,enableJsonTab:a=!0,enableComponentTree:s=!0}){const o=Q0(),l=X0(),c=Yz(),u=K$(),d=Q$(),p=v.useRef(null),[f,h]=v.useState(0),_=G.useTheme(),[g,b]=v.useState(!1),y=dG(),{t:E}=Ke.useTranslation("inspector"),[S,C]=v.useState(!1),D=v.useRef(null),w=4e3,[k,x]=v.useState(!1),O=v.useRef(null),A=({onRendered:de,children:pe})=>(v.useEffect(()=>{if(typeof de=="function"){const Qe=requestAnimationFrame(()=>de());return()=>cancelAnimationFrame(Qe)}}),m.jsx(m.Fragment,{children:pe})),X=()=>m.jsx(T.SvgIcon,{viewBox:"0 0 18 18",fontSize:"small",children:m.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"})}),P=v.useCallback(()=>{let de=null;switch(o){case"html":de=r?m.jsx(pDe,{}):null;break;case"json":de=a?m.jsx(fDe,{}):null;break}return de},[c,o,r,a]);v.useEffect(()=>{const de=pe=>{const{detail:Qe}=pe,gt=hc(Qe);v.startTransition(()=>{vp(gt,!1)}),requestAnimationFrame(()=>{C(!0),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{C(!1)},w),x(!0),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{x(!1)},w)})};return window.addEventListener("email-builder-update-template",de),()=>{window.removeEventListener("email-builder-update-template",de)}},[o]),v.useEffect(()=>{const de=()=>{p.current?.offsetWidth&&h(p.current.offsetWidth)};de();const pe=new ResizeObserver(de);return p.current&&pe.observe(p.current),()=>{p.current&&pe.disconnect()}},[p]);const Y=ne(de=>{try{const{css:pe}=s6(de.document);return{length:pe.length,threshold:Lv,exceeded:pe.length>Lv}}catch{return{length:0,threshold:Lv,exceeded:!1}}},(de,pe)=>de.length===pe.length&&de.exceeded===pe.exceeded);v.useEffect(()=>{const de=pe=>{(pe.ctrlKey||pe.metaKey)&&(pe.key==="z"&&!pe.shiftKey&&u?(pe.preventDefault(),kx()):(pe.key==="y"||pe.key==="z"&&pe.shiftKey)&&d&&(pe.preventDefault(),xx()))};return document.addEventListener("keydown",de),()=>{document.removeEventListener("keydown",de)}},[u,d]);const z=()=>{const de=ne.getState().document,pe=Wh(de,{rootBlockId:"root"});console.log("Get data: ",de,pe);const Qe=new CustomEvent("save-template",{detail:{json:de,html:pe.props.children}});window.dispatchEvent(Qe)},F=v.useCallback(()=>{kx()},[]),K=v.useCallback(()=>{xx()},[]),re=v.useMemo(()=>{if(o==="html"){const de=ne.getState().document;return Wh(de,{rootBlockId:"root"})}return null},[o]),ke=v.useMemo(()=>{if(o==="json"){const de=ne.getState().document;return JSON.stringify(de)}return""},[o]),ue=v.useCallback(()=>{switch(o){case"preview":return m.jsx(m.Fragment,{children:m.jsx(Vw,{})});case"html":return m.jsx(T.Tooltip,{title:E("header.copy_html"),placement:"left-start",sx:{color:"text.primary"},children:m.jsx(T.IconButton,{onClick:()=>Ue(re?.props.children||""),children:m.jsx($.ContentCopyOutlined,{fontSize:"small"})})});case"json":return m.jsxs(m.Fragment,{children:[m.jsx(vJ,{}),m.jsx(T.Tooltip,{title:E("header.copy_json"),placement:"left-start",sx:{color:"text.primary"},children:m.jsx(T.IconButton,{onClick:()=>Ue(ke),children:m.jsx($.ContentCopyOutlined,{fontSize:"small"})})})]});case"editor":default:return m.jsxs(m.Fragment,{children:[m.jsx(T.Tooltip,{title:E("header.undo"),children:m.jsx("div",{onClick:F,style:{transform:"rotateY(180deg)"},className:`buttonsUndoRedo ${u?"":"disabledButton"} `,children:m.jsx("svg",{width:"24px",height:"24px",viewBox:"0 0 25 25",children:m.jsx("path",{fill:"currentColor",d:"M9.9 19q-2.425 0-4.163-1.575T4 13.5t1.738-3.925T9.9 8h6.3l-2.6-2.6L15 4l5 5l-5 5l-1.4-1.4l2.6-2.6H9.9q-1.575 0-2.738 1T6 13.5T7.163 16T9.9 17H17v2z"})})})}),m.jsx(T.Tooltip,{title:E("header.redo"),children:m.jsx("div",{onClick:K,className:`buttonsUndoRedo ${d?"":"disabledButton"} `,children:m.jsx("svg",{width:"24px",height:"24px",viewBox:"0 0 25 25",children:m.jsx("path",{fill:"currentColor",d:"M9.9 19q-2.425 0-4.163-1.575T4 13.5t1.738-3.925T9.9 8h6.3l-2.6-2.6L15 4l5 5l-5 5l-1.4-1.4l2.6-2.6H9.9q-1.575 0-2.738 1T6 13.5T7.163 16T9.9 17H17v2z"})})})}),m.jsx(Vw,{}),s&&m.jsx(_De,{})]})}},[o,re,ke,u,d,E,F,K,s]),Ue=async de=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(de);else{const pe=document.createElement("textarea");pe.value=de,pe.setAttribute("readonly",""),pe.style.position="absolute",pe.style.left="-9999px",document.body.appendChild(pe),pe.select(),document.execCommand("copy"),document.body.removeChild(pe)}b(!0)}catch(pe){console.error("Error copying text:",pe)}},Ce=!!e;return m.jsxs(T.Container,{maxWidth:!1,sx:{flex:"1 1 auto",minWidth:"410px",height:"100%",padding:"0!important",position:"relative",...Ce&&{display:"flex",flexDirection:"column",overflow:"hidden",minHeight:0}},children:[m.jsx("button",{id:"saveData",style:{display:"none"},onClick:z,children:"Save"}),m.jsx(T.Box,{sx:Ce?{flexShrink:0}:void 0,children:m.jsx(wL,{threshold:".preview-container-end",disabled:!t,topOffset:0,children:m.jsxs("div",{id:"ee-editor-header",children:[m.jsx("div",{style:{height:50,width:f||"100%",borderBottom:1,borderColor:"divider",backgroundColor:_.palette.background.paper,zIndex:1,display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:0},children:m.jsxs(T.Stack,{px:2,direction:"row",gap:2,width:"100%",justifyContent:"space-between",alignItems:"center",children:[m.jsx(T.Stack,{direction:"row",spacing:2,children:m.jsx(bDe,{enableEditorTab:n,enablePreviewTab:i,enableHtmlTab:r,enableJsonTab:a})}),m.jsx(T.Stack,{direction:"row",spacing:2,alignItems:"center",children:ue()})]})}),Y&&(Y.length/Y.threshold>=.9||Y.exceeded)&&m.jsxs(T.Alert,{severity:Y?.exceeded?"error":"warning",icon:m.jsx(X,{}),sx:{borderRadius:0,m:0,"& .MuiAlert-message":{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",gap:2}},children:[m.jsxs("span",{children:[m.jsx("span",{style:{fontWeight:700},children:"Attention!"})," ",Y?.exceeded?"You have exceeded the style limit (≈16,000 characters). Some clients will ignore responsive design.":"The email is close to the style limit (≈16,000 characters). If you exceed it, some clients may ignore responsive design."]}),m.jsx(T.Tooltip,{title:`CSS in header: ${Y?.length.toLocaleString()} / ${Y?.threshold.toLocaleString()} characters`,placement:"bottom",children:m.jsx(T.Chip,{size:"small",label:`CSS: ${Y?.length.toLocaleString()} / ${Y?.threshold.toLocaleString()}`,color:Y?.exceeded?"error":"warning",variant:"filled"})})]})]})})}),m.jsxs(T.Box,{className:"preview-container",ref:p,onClick:()=>{o==="editor"&&Hi(null)},sx:{minWidth:370,width:"100%",zIndex:0,marginTop:"0px!important",borderLeft:"1px solid primary",borderBottom:"1px solid primary",padding:"0 ",paddingBottom:"47px",...Ce?{flex:"1 1 auto",minHeight:0,overflowY:"auto",overflowX:"hidden"}:{minHeight:"100dvh",maxHeight:void 0,overflowY:o==="editor"&&y?"visible":"auto",overflowX:"hidden",height:"100%"},position:"relative",pt:o==="editor"?"28px":0},children:[m.jsx(T.Box,{sx:{display:o==="editor"?"block":"none",height:"100%"},children:m.jsx(T.Box,{sx:{opacity:k?0:1,transition:"opacity 120ms ease-out"},children:m.jsx(A,{onRendered:()=>{x(!1),O.current&&(clearTimeout(O.current),O.current=null)},children:m.jsx(T.Box,{sx:{ml:"-24px",width:"calc(100% + 24px)"},children:m.jsx(Nh,{id:"root"})})})})}),m.jsx(T.Box,{sx:{display:o==="preview"?"block":"none",height:"100%"},children:m.jsx(T.Box,{sx:{opacity:S?0:1,transition:"opacity 120ms ease-out"},children:m.jsx(yDe,{onRendered:()=>{C(!1),D.current&&(clearTimeout(D.current),D.current=null)}})})}),P(),(o==="preview"&&S||o==="editor"&&k)&&m.jsxs(T.Box,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:_.palette.background.default,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",zIndex:1e3,gap:2},children:[m.jsx(T.CircularProgress,{size:48}),m.jsx(T.Typography,{variant:"body1",color:"text.secondary",children:"Loading..."})]})]}),m.jsx("div",{className:"preview-container-end",style:{width:"100%"}}),s&&l&&o==="editor"&&m.jsx(gDe,{}),m.jsx(T.Snackbar,{open:g,autoHideDuration:3e3,onClose:()=>b(!1),anchorOrigin:{vertical:"top",horizontal:"center"},message:"Your text has been copied"})]})}function SDe({galleryImages:t=!0,freeMode:e=!0,darkMode:n=!1,heightContent:i=null,containerGrow:r=!0,sticky:a=!1,htmlTab:s=!1,jsonTab:o=!1,imagePlaceholder:l=$d,componentTree:c=!0}){const u=Vz(),d=T.useTheme();v.useEffect(()=>{const h=window.emailBuilder?.emailBuilderDevMode??!0;$z(h)},[]),v.useEffect(()=>{rG(t)},[t]),v.useEffect(()=>{oG(e)},[e]),v.useEffect(()=>{lG(n)},[n]),v.useEffect(()=>{cG(i)},[i]),v.useEffect(()=>{uG(r)},[r]),v.useEffect(()=>{aG(l)},[l]),v.useEffect(()=>{iG({primary:d.palette.primary.main,secondary:d.palette.secondary.main})},[d.palette.primary.main,d.palette.secondary.main]),v.useEffect(()=>{const f=()=>{Dc()};return window.addEventListener("beforeunload",f),()=>{window.removeEventListener("beforeunload",f),Dc()}},[]);const p=!!i;return m.jsxs(T.Container,{className:`${n?"dark-email-builder":"light-email-builder"}`,maxWidth:"none",sx:f=>{const h=p;return{margin:"0",position:"relative",width:"100%",height:h?i:"100%",maxHeight:h?i:void 0,display:"flex",overflowX:"hidden",overflowY:h?"hidden":"auto",padding:"0!important",border:`1px solid ${f.palette.divider}`,borderRadius:2}},children:[m.jsx(T.Box,{sx:f=>({flex:1,minWidth:0,minHeight:p?0:void 0,height:"100%",borderRight:`1px solid ${f.palette.divider}`,display:"flex",flexDirection:"column",overflow:"hidden"}),children:m.jsx(EDe,{enableHtmlTab:s,enableJsonTab:o,sticky:a,heightContent:i,enableComponentTree:c})}),m.jsx(T.Box,{sx:f=>({backgroundColor:`${f.palette.background.paper} !important`,height:"100%",minHeight:p?0:void 0,display:"flex",alignItems:"stretch",borderTopRightRadius:12,overflow:"hidden"}),children:m.jsx(wL,{disabled:!a,threshold:".preview-container-end",topOffset:0,style:{width:u?`${Tm}px`:0,flexBasis:u?`${Tm}px`:0,minWidth:0,transition:"width 220ms cubic-bezier(0.4, 0, 0.2, 1), flex-basis 220ms cubic-bezier(0.4, 0, 0.2, 1)",overflow:"hidden",padding:0,flexShrink:0},children:m.jsx(T.Box,{sx:{height:"100%",minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden",borderBottomRightRadius:12},children:m.jsx(wq,{sticky:a,heightContent:i})})})})]})}const vDe="English (US)",TDe={confirm:"Confirm",cancel:"Cancel",save:"Save",delete:"Delete"},CDe={notionTextPlaceholder:"Write here",editing:"Editing"},kDe={bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",lists:"Lists",bulletList:"Bullet List",numberedList:"Numbered List",textAlign:"Text Align",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignJustify:"Align Justify",textColor:"Text Color",backgroundColor:"Background Color",link:"Link",insertMergeTag:"Insert Merge Tag",insertEmoji:"Insert Emoji",aiFeatures:"AI Features",clearFormatting:"Clear Formatting"},xDe={editLink:"Edit link",insertLink:"Insert link",urlLabel:"URL",urlPlaceholder:"https://example.com",invalidUrl:"Enter a valid URL"},nP={language:vDe,generic:TDe,editor:CDe,bubbleMenu:kDe,linkEditor:xDe},DDe={undo:"Undo (CTRL + Z)",redo:"Redo (CTRL + Y)",copy_html:"Copia HTML",copy_json:"Copia JSON",edit:"Modifica",preview:"Anteprima",htmlOutput:"HTML",jsonOutput:"JSON",desktop:"Desktop",mobile:"Mobile",content:"Content",styles:"Styles",componentTree:"Component tree",openComponentTree:"Open component tree",closeComponentTree:"Close component tree"},wDe={copyFormat:"Copy format",pasteFormatting:"Paste formatting",noFormatSupported:"No format supported",duplicate:"Duplicate",delete:"Delete"},ADe={unlockBorders:"Unlock borders",lockBordersTogether:"Lock borders together"},NDe={label:"Style",square:"Square",pill:"Pill",custom:"Custom",borderRadius:"Border Radius",lockTooltip:"Lock corners together",unlockTooltip:"Unlock corners"},IDe={backgroundColor:"Background Color",border:"Border",padding:"Padding",fontWeight:"Font Weight",fontSize:"Font Size",fontFamily:"Font family",width:"Width",shape:"Shape",borderRadius:"Border radius",alignment:"Alignment",height:"Height",lineHeight:"Line Height",color:"Color"},ODe={width:{full:"Full",auto:"Auto"},common:{size:"Size",width:"Width",height:"Height",uploadFile:"Upload a file",dragAndDrop:"or drag and drop",fileInfo:"PNG, JPG, GIF up to 5MB",add:"Add",close:"Close",invalidFiles:"Some files were invalid (wrong type or too large). Only valid files will be uploaded.",svgWarning:"SVG images may not display correctly in Outlook email clients. Consider using PNG or JPG format for better compatibility."},columnWidths:{label:"Columns width",tooltip:"Images in these columns cannot exceed the column's width",left:"Left",right:"Right",center:"Center"},alignment:{label:"Alignment"},responsiveSize:{customPadding:"Custom Padding",lockTooltip:"Lock padding sides together",unlockTooltip:"Unlock padding sides",allSides:"All",options:{xSmall:"XS",small:"SM",medium:"MD",custom:"Custom"}},sizeSelector:{label:"Size",contain:"Contain",cover:"Cover",scale:"Scale"},screenSelector:{desktop:"Desktop view",mobile:"Mobile view"},links:{color:"Link color",underline:"Link underline",underlineOn:"Underline on",underlineOff:"Underline off"},backgroundImage:{label:"Background image",warningTooltip:"Some email clients don't support background images. Add a background color as fallback.",or:"or",browseGallery:"Browse gallery",fillType:"Background fill type",repeat:"Background repeat",position:"Background position",fillOptions:{cover:"Cover",contain:"Contain",auto:"Auto"},repeatOptions:{none:"No repeat",repeat:"Repeat",repeatX:"Repeat X",repeatY:"Repeat Y"},positions:{topLeft:"Top Left",topCenter:"Top Center",topRight:"Top Right",centerLeft:"Center Left",center:"Center",centerRight:"Center Right",bottomLeft:"Bottom Left",bottomCenter:"Bottom Center",bottomRight:"Bottom Right"}},image:{urlLabel:"Image URL",urlPlaceholder:"Enter image URL...",invalidUrl:"Invalid URL format",timeout:"Request timeout - URL took too long to respond",notImage:"URL does not point to an image"},aiImageGeneration:{generate:"Generate",titleError:"Image generation failed",titleLoading:"Generating Your Image",titleCreate:"Create your image",titleReady:"Your Image is ready",descriptionError:"Try simplifying your prompt or describing something else. If the issue persists, please try again later.",descriptionLoading:"Hang tight! This may take a few seconds as we bring your image to life.",descriptionCreate:"Describe the image you want us to generate. Be specific to get the best results.",descriptionReady:"Here's your image. Not quite right? You can tweak it and try again.",warningRegenerate:"Regenerating will discard this image, and it won't be saved in your gallery. To keep it, make sure to",warningInsertFirst:"Insert the image",warningFirst:"first.",regenerate:"Regenerate",cancel:"Cancel",insertImage:"Insert Image",generateImage:"Generate image"},social:{icon:"Icon",url:"URL",theme:"Theme",size:"Size"},layout:{label:"Layout"},panels:{avatar:{title:"Avatar block",sizeLabel:"Size",altLabel:"Alt text"},button:{title:"Button block",textLabel:"Text",targetLabel:"Target",targetPlaceholder:"https://your-site.com",textColor:"Text color",buttonColor:"Button color"},columns:{title:"Columns block",countLabel:"Number of columns"},container:{title:"Container block"},divider:{title:"Divider block"},emailLayout:{title:"Global styles",backgroundColor:"Background color",canvasColor:"Canvas color",fontFamily:"Font family",textColor:"Text color",linksLabel:"Links",version:"Version",showVersion:"Show version"},heading:{title:"Heading block",contentLabel:"Content",levelLabel:"Level"},html:{title:"HTML block",contentLabel:"Content"},image:{title:"Image block",altLabel:"Alt text",altPlaceholder:"Two white watches",urlLabel:"URL",urlPlaceholder:"https://your-website.com"},social:{title:"Social media icons",gap:"Gap"},spacer:{title:"Spacer block"},text:{title:"Text block",contentLabel:"Content",markdownLabel:"Markdown",doubleClickToEdit:"Double-click on the block in the canvas to edit the content"},notionText:{title:"Notion Text"}}},iP={header:DDe,actions:wDe,border:ADe,shape:NDe,properties:IDe,inputs:ODe},RDe="Español (Latinoamérica)",MDe={confirm:"Confirmar",cancel:"Cancelar",save:"Guardar",delete:"Eliminar"},PDe={notionTextPlaceholder:"Escribe aquí",editing:"Editando"},LDe={bold:"Negrita",italic:"Cursiva",underline:"Subrayado",strikethrough:"Tachado",lists:"Listas",bulletList:"Lista con viñetas",numberedList:"Lista numerada",textAlign:"Alineación de texto",alignLeft:"Alinear a la izquierda",alignCenter:"Alinear al centro",alignRight:"Alinear a la derecha",alignJustify:"Justificar",textColor:"Color de texto",backgroundColor:"Color de fondo",link:"Enlace",insertMergeTag:"Insertar etiqueta dinámica",insertEmoji:"Insertar emoji",aiFeatures:"Funciones de IA",clearFormatting:"Limpiar formato"},FDe={editLink:"Editar enlace",insertLink:"Insertar enlace",urlLabel:"URL",urlPlaceholder:"https://ejemplo.com",invalidUrl:"Ingresa una URL válida"},rP={language:RDe,generic:MDe,editor:PDe,bubbleMenu:LDe,linkEditor:FDe},BDe={undo:"Deshacer (CTRL + Z)",redo:"Rehacer (CTRL + Y)",copy_html:"Copiar HTML",copy_json:"Copiar JSON",edit:"Editar",preview:"Vista previa",htmlOutput:"HTML",jsonOutput:"JSON",desktop:"Escritorio",mobile:"Móvil",content:"Contenido",styles:"Estilos",componentTree:"Árbol de bloques",openComponentTree:"Abrir árbol de bloques",closeComponentTree:"Cerrar árbol de bloques"},UDe={copyFormat:"Copiar formato",pasteFormatting:"Pegar formato",noFormatSupported:"Formato no compatible",duplicate:"Duplicar",delete:"Eliminar"},$De={unlockBorders:"Desbloquear bordes",lockBordersTogether:"Bloquear bordes juntos"},zDe={label:"Estilo",square:"Cuadrado",pill:"Píldora",custom:"Personalizado",borderRadius:"Radio del borde",lockTooltip:"Bloquear esquinas juntas",unlockTooltip:"Desbloquear esquinas"},GDe={backgroundColor:"Color de fondo",border:"Borde",padding:"Relleno",fontWeight:"Grosor de fuente",fontSize:"Tamaño de fuente",fontFamily:"Familia tipográfica",width:"Ancho",shape:"Forma",borderRadius:"Radio del borde",alignment:"Alineación",height:"Altura",lineHeight:"Altura de línea",color:"Color"},qDe={width:{full:"Completo",auto:"Automático"},common:{size:"Tamaño",width:"Ancho",height:"Altura",uploadFile:"Subir un archivo",dragAndDrop:"o arrastra y suelta",fileInfo:"PNG, JPG, GIF hasta 5MB",add:"Agregar",close:"Cerrar",invalidFiles:"Algunos archivos no son válidos (tipo incorrecto o demasiado grandes). Solo se subirán los archivos válidos.",svgWarning:"Las imágenes SVG pueden no mostrarse correctamente en clientes de correo como Outlook. Considera usar PNG o JPG para una mejor compatibilidad."},columnWidths:{label:"Ancho de columnas",tooltip:"Las imágenes en estas columnas no pueden exceder el ancho de la columna",left:"Izquierda",right:"Derecha",center:"Centro"},alignment:{label:"Alineación"},responsiveSize:{customPadding:"Relleno personalizado",lockTooltip:"Bloquear lados del relleno juntos",unlockTooltip:"Desbloquear lados del relleno",allSides:"Todos",options:{xSmall:"XS",small:"SM",medium:"MD",custom:"Personalizado"}},sizeSelector:{label:"Tamaño",contain:"Contener",cover:"Cubrir",scale:"Escalar"},screenSelector:{desktop:"Vista de escritorio",mobile:"Vista móvil"},links:{color:"Color del enlace",underline:"Subrayado del enlace",underlineOn:"Subrayado activado",underlineOff:"Subrayado desactivado"},backgroundImage:{label:"Imagen de fondo",warningTooltip:"Algunos clientes de correo no soportan imágenes de fondo. Agrega un color de fondo como alternativa.",or:"o",browseGallery:"Explorar galería",fillType:"Tipo de relleno de fondo",repeat:"Repetición de fondo",position:"Posición de fondo",fillOptions:{cover:"Cubrir",contain:"Contener",auto:"Automático"},repeatOptions:{none:"Sin repetición",repeat:"Repetir",repeatX:"Repetir X",repeatY:"Repetir Y"},positions:{topLeft:"Arriba izquierda",topCenter:"Arriba centro",topRight:"Arriba derecha",centerLeft:"Centro izquierda",center:"Centro",centerRight:"Centro derecha",bottomLeft:"Abajo izquierda",bottomCenter:"Abajo centro",bottomRight:"Abajo derecha"}},image:{urlLabel:"URL de la imagen",urlPlaceholder:"Ingresa la URL de la imagen...",invalidUrl:"Formato de URL inválido",timeout:"Tiempo de espera agotado - La URL tardó demasiado en responder",notImage:"La URL no apunta a una imagen"},aiImageGeneration:{generate:"Generar",titleError:"Error al generar la imagen",titleLoading:"Generando tu imagen",titleCreate:"Crea tu imagen",titleReady:"Tu imagen está lista",descriptionError:"Intenta simplificar tu descripción o describir algo diferente. Si el problema persiste, inténtalo más tarde.",descriptionLoading:"¡Un momento! Esto puede tardar unos segundos mientras damos vida a tu imagen.",descriptionCreate:"Describe la imagen que quieres generar. Sé específico para obtener los mejores resultados.",descriptionReady:"Aquí está tu imagen. ¿No es lo que esperabas? Puedes ajustarla e intentarlo de nuevo.",warningRegenerate:"Regenerar descartará esta imagen y no se guardará en tu galería. Para conservarla, asegúrate de",warningInsertFirst:"Insertar la imagen",warningFirst:"primero.",regenerate:"Regenerar",cancel:"Cancelar",insertImage:"Insertar imagen",generateImage:"Generar imagen"},social:{icon:"Ícono",url:"URL",theme:"Tema",size:"Tamaño"},layout:{label:"Diseño"},panels:{avatar:{title:"Bloque de avatar",sizeLabel:"Tamaño",altLabel:"Texto alternativo"},button:{title:"Bloque de botón",textLabel:"Texto",targetLabel:"Destino",targetPlaceholder:"https://tu-sitio.com",textColor:"Color del texto",buttonColor:"Color del botón"},columns:{title:"Bloque de columnas",countLabel:"Número de columnas"},container:{title:"Bloque contenedor"},divider:{title:"Bloque divisor"},emailLayout:{title:"Estilos globales",backgroundColor:"Color de fondo",canvasColor:"Color del lienzo",fontFamily:"Familia tipográfica",textColor:"Color del texto",linksLabel:"Enlaces",version:"Versión",showVersion:"Mostrar versión"},heading:{title:"Bloque de encabezado",contentLabel:"Contenido",levelLabel:"Nivel"},html:{title:"Bloque HTML",contentLabel:"Contenido"},image:{title:"Bloque de imagen",altLabel:"Texto alternativo",altPlaceholder:"Dos relojes blancos",urlLabel:"URL",urlPlaceholder:"https://tu-sitio-web.com"},social:{title:"Íconos de redes sociales",gap:"Espaciado"},spacer:{title:"Bloque espaciador"},text:{title:"Bloque de texto",contentLabel:"Contenido",markdownLabel:"Markdown",doubleClickToEdit:"Haz doble clic en el bloque del canvas para editar el contenido"}}},aP={header:BDe,actions:UDe,border:$De,shape:zDe,properties:GDe,inputs:qDe},HDe="Italiano",jDe={confirm:"Conferma",cancel:"Annulla",save:"Salva",delete:"Elimina"},VDe={notionTextPlaceholder:"Scrivi qui",editing:"Modifica"},YDe={bold:"Grassetto",italic:"Corsivo",underline:"Sottolineato",strikethrough:"Barrato",lists:"Elenchi",bulletList:"Elenco puntato",numberedList:"Elenco numerato",textAlign:"Allineamento testo",alignLeft:"Allinea a sinistra",alignCenter:"Allinea al centro",alignRight:"Allinea a destra",alignJustify:"Giustifica",textColor:"Colore del testo",backgroundColor:"Colore di sfondo",link:"Collegamento",insertMergeTag:"Inserisci tag dinamico",insertEmoji:"Inserisci emoji",aiFeatures:"Funzioni IA",clearFormatting:"Cancella formattazione"},WDe={editLink:"Modifica collegamento",insertLink:"Inserisci collegamento",urlLabel:"URL",urlPlaceholder:"https://esempio.com",invalidUrl:"Inserisci un URL valido"},sP={language:HDe,generic:jDe,editor:VDe,bubbleMenu:YDe,linkEditor:WDe},KDe={undo:"Annulla (CTRL + Z)",redo:"Ripeti (CTRL + Y)",copy_html:"Copia HTML",copy_json:"Copia JSON",edit:"Modifica",preview:"Anteprima",htmlOutput:"HTML",jsonOutput:"JSON",desktop:"Desktop",mobile:"Mobile",content:"Contenuto",styles:"Stili",componentTree:"Albero componenti",openComponentTree:"Apri albero componenti",closeComponentTree:"Chiudi albero componenti"},QDe={copyFormat:"Copia formato",pasteFormatting:"Incolla formato",noFormatSupported:"Formato non supportato",duplicate:"Duplica",delete:"Elimina"},XDe={unlockBorders:"Sblocca bordi",lockBordersTogether:"Blocca bordi insieme"},JDe={label:"Stile",square:"Quadrato",pill:"Pillola",custom:"Personalizzato",borderRadius:"Raggio del bordo",lockTooltip:"Blocca angoli insieme",unlockTooltip:"Sblocca angoli"},ZDe={backgroundColor:"Colore di sfondo",border:"Bordo",padding:"Riempimento",fontWeight:"Spessore del carattere",fontSize:"Dimensione del carattere",fontFamily:"Famiglia di caratteri",width:"Larghezza",shape:"Forma",borderRadius:"Raggio del bordo",alignment:"Allineamento",height:"Altezza",lineHeight:"Altezza della linea",color:"Colore"},ewe={width:{full:"Completo",auto:"Automatico"},common:{size:"Dimensione",width:"Larghezza",height:"Altezza",uploadFile:"Carica un file",dragAndDrop:"o trascina e rilascia",fileInfo:"PNG, JPG, GIF fino a 5MB",add:"Aggiungi",close:"Chiudi",invalidFiles:"Alcuni file non sono validi (tipo errato o troppo grandi). Solo i file validi verranno caricati.",svgWarning:"Le immagini SVG potrebbero non essere visualizzate correttamente nei client di posta Outlook. Considera l'uso di PNG o JPG per una migliore compatibilità."},columnWidths:{label:"Larghezza delle colonne",tooltip:"Le immagini in queste colonne non possono superare la larghezza della colonna",left:"Sinistra",right:"Destra",center:"Centro"},alignment:{label:"Allineamento"},responsiveSize:{customPadding:"Riempimento personalizzato",lockTooltip:"Blocca i lati del riempimento insieme",unlockTooltip:"Sblocca i lati del riempimento",allSides:"Tutti",options:{xSmall:"XS",small:"SM",medium:"MD",custom:"Personalizzato"}},sizeSelector:{label:"Dimensione",contain:"Contieni",cover:"Copri",scale:"Scala"},screenSelector:{desktop:"Vista desktop",mobile:"Vista mobile"},links:{color:"Colore del collegamento",underline:"Sottolineatura del collegamento",underlineOn:"Sottolineatura attiva",underlineOff:"Sottolineatura disattiva"},backgroundImage:{label:"Immagine di sfondo",warningTooltip:"Alcuni client di posta non supportano le immagini di sfondo. Aggiungi un colore di sfondo come alternativa.",or:"o",browseGallery:"Sfoglia galleria",fillType:"Tipo di riempimento dello sfondo",repeat:"Ripetizione dello sfondo",position:"Posizione dello sfondo",fillOptions:{cover:"Copri",contain:"Contieni",auto:"Automatico"},repeatOptions:{none:"Nessuna ripetizione",repeat:"Ripeti",repeatX:"Ripeti X",repeatY:"Ripeti Y"},positions:{topLeft:"In alto a sinistra",topCenter:"In alto al centro",topRight:"In alto a destra",centerLeft:"Centro sinistra",center:"Centro",centerRight:"Centro destra",bottomLeft:"In basso a sinistra",bottomCenter:"In basso al centro",bottomRight:"In basso a destra"}},image:{urlLabel:"URL dell'immagine",urlPlaceholder:"Inserisci l'URL dell'immagine...",invalidUrl:"Formato URL non valido",timeout:"Timeout della richiesta - L'URL ha impiegato troppo tempo per rispondere",notImage:"L'URL non punta a un'immagine"},aiImageGeneration:{generate:"Genera",titleError:"Generazione immagine fallita",titleLoading:"Generazione dell'immagine in corso",titleCreate:"Crea la tua immagine",titleReady:"La tua immagine è pronta",descriptionError:"Prova a semplificare il prompt o a descrivere qualcos'altro. Se il problema persiste, riprova più tardi.",descriptionLoading:"Aspetta! Potrebbero volerci alcuni secondi per dare vita alla tua immagine.",descriptionCreate:"Descrivi l'immagine che vuoi generare. Sii specifico per ottenere i migliori risultati.",descriptionReady:"Ecco la tua immagine. Non è quella giusta? Puoi modificarla e riprovare.",warningRegenerate:"Rigenerare scarterà questa immagine e non verrà salvata nella tua galleria. Per conservarla, assicurati di",warningInsertFirst:"Inserire l'immagine",warningFirst:"prima.",regenerate:"Rigenera",cancel:"Annulla",insertImage:"Inserisci immagine",generateImage:"Genera immagine"},social:{icon:"Icona",url:"URL",theme:"Tema",size:"Dimensione"},layout:{label:"Layout"},panels:{avatar:{title:"Blocco avatar",sizeLabel:"Dimensione",altLabel:"Testo alternativo"},button:{title:"Blocco pulsante",textLabel:"Testo",targetLabel:"Destinazione",targetPlaceholder:"https://tuo-sito.com",textColor:"Colore del testo",buttonColor:"Colore del pulsante"},columns:{title:"Blocco colonne",countLabel:"Numero di colonne"},container:{title:"Blocco contenitore"},divider:{title:"Blocco divisore"},emailLayout:{title:"Stili globali",backgroundColor:"Colore di sfondo",canvasColor:"Colore della tela",fontFamily:"Famiglia di caratteri",textColor:"Colore del testo",linksLabel:"Collegamenti",version:"Versione",showVersion:"Mostra versione"},heading:{title:"Blocco intestazione",contentLabel:"Contenuto",levelLabel:"Livello"},html:{title:"Blocco HTML",contentLabel:"Contenuto"},image:{title:"Blocco immagine",altLabel:"Testo alternativo",altPlaceholder:"Due orologi bianchi",urlLabel:"URL",urlPlaceholder:"https://tuo-sito-web.com"},social:{title:"Icone dei social media",gap:"Spaziatura"},spacer:{title:"Blocco spaziatore"},text:{title:"Blocco testo",contentLabel:"Contenuto",markdownLabel:"Markdown",doubleClickToEdit:"Fai doppio clic sul blocco nella tela per modificare il contenuto"}}},oP={header:KDe,actions:QDe,border:XDe,shape:JDe,properties:ZDe,inputs:ewe},twe=["en-US","es-419","it-IT"],lP={en:"en-US","en-US":"en-US",es:"es-419","es-419":"es-419",it:"it-IT","it-IT":"it-IT"};function nwe(t){return t?lP[t]??lP[t.split("-")[0]]??"en-US":"en-US"}const Z5={"en-US":{common:nP,inspector:iP},"es-419":{common:rP,inspector:aP},"it-IT":{common:sP,inspector:oP},en:{common:nP,inspector:iP},es:{common:rP,inspector:aP},it:{common:sP,inspector:oP}},iwe=["en-US","es-419","it-IT","en","es","it"];function rwe(){iwe.forEach(t=>{const e=Z5[t];e&&Object.keys(e).forEach(n=>{Yo.hasResourceBundle(t,n)||Yo.addResourceBundle(t,n,e[n],!0,!0)})})}Yo.isInitialized?rwe():Yo.use(Ke.initReactI18next).init({resources:Z5,fallbackLng:"en-US",supportedLngs:[...twe],ns:["common","inspector"],defaultNS:"common",interpolation:{escapeValue:!1},returnNull:!1}).catch(()=>{});const e$="#212443",ld="#4F46E5",Qr="#1F8466",Ba="#E81212",li="#F6DC9F",t$="#6C0E7C",awe="#CC996C",swe='inherit, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',Fe=(t,e)=>{if(!e)try{let n;return t.startsWith("#")?n=G.hexToRgb(t):n=t,n}catch{return"rgb(0, 123, 255)"}try{return t===e$?G.lighten(t,.3):t===t$?G.lighten(t,.4):t===li?G.darken(t,.2):G.lighten(t,.1)}catch{return ld}},ge=G.createTheme({palette:{background:{default:"#F5F5F5",paper:"#FFFFFF"},text:{primary:"#1F1F21",secondary:"#4F4F4F"}},typography:{fontFamily:swe}}),owe=(t=ld,e=ld,n=!1)=>{const i=f=>typeof f=="string"&&f.startsWith("#"),r=i(t)?t:ld,a=i(e)?e:ld,s=Fe(r,n),o=Fe(a,n),l=f=>{try{const h=G.getContrastRatio(f,n?"#000":"#fff")>4.5?n?"#000":"#fff":n?"#fff":"#111";return{main:f,light:G.lighten(f,.2),dark:G.darken(f,.2),contrastText:h}}catch{return ge.palette.primary}},c={default:n?"#121212":"#FFFFFF",paper:n?"#1e1e1e":"#FFFFFF",input:n?"#2c2c2c":"#F9FAFB"},u={primary:n?"#FFFFFF":"#1F1F21",secondary:n?"#CCCCCC":"#4F4F4F",disabled:n?"#FFFFFF":"#BDBDBD"},d={100:n?"#2c2c2c":"#F9FAFB",200:n?"#3c3c3c":"#F2F5F7",300:n?"#4c4c4c":"#DCE4EA",400:n?"#666666":"#A8BBCA",500:n?"#999999":"#6A8BA4"};return G.createTheme(ge,{shape:{borderRadius:8},palette:{mode:n?"dark":"light",background:c,text:u,primary:l(s),secondary:l(o),mainColor:{main:s,light:G.alpha(s,n?.7:.5),dark:G.alpha(s,n?1:.9),contrastText:G.getContrastRatio(s,n?"#000":"#fff")>4.5?n?"#000":"#fff":n?"#fff":"#111"},secondaryColor:{main:o,light:G.alpha(o,n?.7:.5),dark:G.alpha(o,n?1:.9),contrastText:G.getContrastRatio(o,n?"#000":"#fff")>4.5?n?"#000":"#fff":n?"#fff":"#111"},brand:{navy:Fe(e$,n),blue:s,red:Fe(Ba,n),green:Fe(Qr,n),yellow:Fe(li,n),purple:Fe(t$,n),brown:Fe(awe,n)},success:{main:Fe(Qr,n),light:G.lighten(Fe(Qr,n),.15),dark:G.darken(Fe(Qr,n),.15),contrastText:G.getContrastRatio(Fe(Qr,n),n?"#000":"#fff")>4.5?n?"#000":"#fff":n?"#fff":"#111"},error:{main:Fe(Ba,n),light:G.lighten(Fe(Ba,n),.15),dark:G.darken(Fe(Ba,n),.15),contrastText:G.getContrastRatio(Fe(Ba,n),n?"#000":"#fff")>4.5?n?"#000":"#fff":n?"#fff":"#111"},warning:{main:Fe(li,n),light:G.lighten(Fe(li,n),.15),dark:G.darken(Fe(li,n),.15),contrastText:G.getContrastRatio(Fe(li,n),n?"#000":"#fff")>4.5?n?"#000":"#fff":n?"#fff":"#111"},info:{main:s,light:G.lighten(s,.15),dark:G.darken(s,.15),contrastText:G.getContrastRatio(s,n?"#000":"#fff")>4.5?n?"#000":"#fff":n?"#fff":"#111"},cadet:{100:d[100],200:d[200],300:d[300],400:d[400],500:d[500]},highlight:{100:G.lighten(Fe(li,n),n?.6:.8),200:G.lighten(Fe(li,n),n?.4:.6),300:G.lighten(Fe(li,n),n?.2:.4),400:G.lighten(Fe(li,n),n?.1:.2),500:Fe(li,n)},divider:n?"#4a4a4a":"#d0d0d0",grey:{50:n?"#1a1a1a":"#fafafa",100:d[100],200:d[200],300:d[300],400:d[400],500:d[500],600:n?"#cccccc":"#757575",700:n?"#e0e0e0":"#616161",800:n?"#f0f0f0":"#424242",900:n?"#ffffff":"#212121"}},components:{MuiAlert:{styleOverrides:{root:{fontSize:ge.typography.pxToRem(14),"&.MuiAlert-colorWarning":{borderColor:n?"#332f29":"#FFFBEB",backgroundColor:`${n?"#f1be50":"#FEF3C7"} !important`,color:n?"#2f2f2f":"#78350f",borderRadius:"8px","& .MuiAlert-icon":{color:"#78350f"}},"&.MuiAlert-colorError":{borderColor:n?"#4a1f1f":"#FEE2E2",backgroundColor:`${n?"#5b2323":"#FEE2E2"} !important`,color:n?"#ffffff":"#7F1D1D",borderRadius:"8px","& .MuiAlert-icon":{color:n?"#ffffff":"#7F1D1D"},"& .MuiAlert-message":{color:n?"#ffffff":"#7F1D1D"}}},action:{paddingTop:0,marginRight:0},filledSuccess:{backgroundColor:Fe(Qr,n)}}},MuiStepLabel:{styleOverrides:{label:{fontWeight:ge.typography.fontWeightMedium}}},MuiDialog:{defaultProps:{fullWidth:!0}},MuiDialogContent:{styleOverrides:{root:{paddingTop:ge.spacing(1),paddingBottom:ge.spacing(2)}}},MuiDialogTitle:{defaultProps:{variant:"h4"},styleOverrides:{root:{paddingTop:ge.spacing(3),paddingBottom:ge.spacing(1)}}},MuiDialogActions:{styleOverrides:{root:{borderTop:"1px solid",borderTopColor:n?"#3c3c3c":ge.palette.divider,marginTop:ge.spacing(1),padding:`${ge.spacing(1.5)} ${ge.spacing(3)}`}}},MuiSnackbar:{styleOverrides:{root:{position:"absolute",zIndex:9999}}},MuiSnackbarContent:{styleOverrides:{root:{borderRadius:"8px",boxShadow:n?"0 8px 32px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3)":"0 8px 32px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.08)",fontWeight:ge.typography.fontWeightMedium,fontSize:ge.typography.pxToRem(14),minWidth:"288px",maxWidth:"568px",backgroundColor:c.default,color:u.primary,border:`1px solid ${G.alpha(s,n?.3:.2)}`,"&.MuiSnackbarContent-success":{backgroundColor:n?G.alpha(Fe(Qr,n),.15):G.alpha(Fe(Qr,n),.1),color:n?u.primary:Fe(Qr,n),border:`1px solid ${G.alpha(Fe(Qr,n),n?.3:.2)}`},"&.MuiSnackbarContent-error":{backgroundColor:n?G.alpha(Fe(Ba,n),.15):G.alpha(Fe(Ba,n),.1),color:n?u.primary:Fe(Ba,n),border:`1px solid ${G.alpha(Fe(Ba,n),n?.3:.2)}`},"&.MuiSnackbarContent-warning":{backgroundColor:n?G.alpha(Fe(li,n),.15):G.alpha(Fe(li,n),.1),color:n?u.primary:G.darken(Fe(li,n),.6),border:`1px solid ${G.alpha(Fe(li,n),n?.3:.2)}`},"&.MuiSnackbarContent-info":{backgroundColor:n?G.alpha(s,.15):G.alpha(s,.1),color:n?u.primary:s,border:`1px solid ${G.alpha(s,n?.3:.2)}`}},message:{padding:"6px 0",display:"flex",alignItems:"center",gap:ge.spacing(1)},action:{paddingLeft:ge.spacing(2),marginRight:ge.spacing(-1),"& .MuiButton-root":{color:"inherit",fontWeight:ge.typography.fontWeightMedium,textTransform:"none",minWidth:"auto",padding:`${ge.spacing(.5)} ${ge.spacing(1)}`,"&:hover":{backgroundColor:G.alpha(u.primary,n?.08:.04)}},"& .MuiIconButton-root":{color:"inherit",padding:ge.spacing(.5),"&:hover":{backgroundColor:G.alpha(u.primary,n?.08:.04)}}}}},MuiTableCell:{styleOverrides:{root:{...ge.typography.body2,borderColor:d[200],color:u.primary},head:{...ge.typography.overline,fontWeight:ge.typography.fontWeightMedium,letterSpacing:"0.075em",color:u.secondary}}},MuiTableRow:{styleOverrides:{root:{"&:last-child td":{borderBottom:0}}}},MuiAvatar:{styleOverrides:{root:{textTransform:"uppercase",fontSize:ge.typography.pxToRem(14)}}},MuiChip:{styleOverrides:{root:{"&.MuiChip-filledWarning":{backgroundColor:Fe(n?"#d18829":"#bead4a",n),color:"#ffffff","& .MuiChip-icon":{color:"#ffffff"}},"&.MuiChip-filledError":{color:"#ffffff","& .MuiChip-label":{color:"#ffffff"},"& .MuiChip-icon":{color:"#ffffff"}}},"&.MuiChip-colorError .MuiChip-label":{color:"#ffffff"},sizeSmall:{borderRadius:ge.spacing(.5),fontSize:12},iconSmall:{fontSize:14,marginLeft:ge.spacing(1)},colorSecondary:{borderColor:d[400],color:u.primary},label:{fontWeight:ge.typography.fontWeightMedium}}},MuiDrawer:{defaultProps:{PaperProps:{elevation:0}}},MuiTooltip:{styleOverrides:{tooltip:{fontSize:ge.typography.pxToRem(12),backgroundColor:n?G.alpha(d[500],.95):G.alpha("#2c2c2c",.9),color:"#ffffff",border:n?`1px solid ${G.alpha(d[400],.2)}`:`1px solid ${G.alpha("#000000",.1)}`,boxShadow:n?`0px 4px 12px ${G.alpha("#000000",.6)}`:`0px 4px 12px ${G.alpha("#000000",.25)}`,borderRadius:"6px"},arrow:{color:n?G.alpha(d[500],.95):G.alpha("#2c2c2c",.9),"&::before":{border:n?`1px solid ${G.alpha(d[400],.2)}`:`1px solid ${G.alpha("#000000",.1)}`}}}},MuiPaper:{defaultProps:{elevation:0,square:!0},styleOverrides:{root:{backgroundColor:c.paper}}},MuiToggleButton:{styleOverrides:{root:{paddingLeft:ge.spacing(1.5),paddingRight:ge.spacing(1.5),color:u.primary,borderColor:d[300],backgroundColor:"transparent","&:hover":{backgroundColor:d[100],borderColor:d[400],"& .MuiSvgIcon-root":{color:s}},"&.Mui-selected":{color:s,backgroundColor:G.alpha(s,.1),borderColor:s,"&:hover":{backgroundColor:n?G.darken(s,.9):G.lighten(s,.8),borderColor:s,"& .MuiSvgIcon-root":{color:s}}},"&.Mui-disabled":{color:u.disabled,borderColor:d[200]}}}},MuiButtonBase:{defaultProps:{},styleOverrides:{root:{"&:focus":{outline:"none",boxShadow:"none"},"&:focus-visible":{outline:"none",boxShadow:"none"},"&.MuiButton-outlinedIndigo":{border:`2px solid ${s}`,borderRadius:"8px",fontWeight:"bold",padding:"5px 0",color:s,backgroundColor:"transparent","&:hover":{borderWidth:"2px",backgroundColor:G.alpha(s,.05),borderColor:Fe(s,n)},"&:active":{backgroundColor:G.alpha(s,.1)},"&.Mui-disabled":{border:`2px solid ${d[300]}`,color:u.disabled,backgroundColor:"transparent",cursor:"not-allowed"},"&:focus":{outline:"none",boxShadow:"none"}},"&.MuiButton-contained":{borderRadius:"8px",fontWeight:"bold",border:"2px solid transparent",backgroundColor:s,color:u.primary==="#FFFFFF"?"#000000":"#FFFFFF","&:hover":{backgroundColor:Fe(s,n),boxShadow:`0 4px 12px ${G.alpha(s,.3)}`},"&:active":{backgroundColor:n?G.darken(s,.1):G.darken(s,.2)},"&.Mui-disabled":{backgroundColor:d[200],color:u.disabled,border:"2px solid transparent",boxShadow:"none",cursor:"not-allowed"},"&:focus":{outline:"none",boxShadow:"none"}},"&.MuiButton-text.primary":{color:s,fontWeight:"bold","&:hover":{backgroundColor:G.alpha(s,.08),color:Fe(s,n)},"&.Mui-disabled":{color:u.disabled,backgroundColor:"transparent",cursor:"not-allowed"},"&:focus":{outline:"none",boxShadow:"none"}},"&.MuiButton-containedSecondary.Mui-disabled":{backgroundColor:d[200],color:u.disabled,border:"2px solid transparent",boxShadow:"none",cursor:"not-allowed"},"&.MuiButton-outlined.Mui-disabled":{border:`1px solid ${d[300]}`,color:u.disabled,backgroundColor:"transparent",cursor:"not-allowed"},"&.MuiButton-text.Mui-disabled":{color:u.disabled,backgroundColor:"transparent",cursor:"not-allowed"},"&.Mui-disabled":{opacity:n?.5:.6,cursor:"not-allowed","&:hover":{backgroundColor:"inherit",boxShadow:"none",transform:"none",borderColor:"inherit"},"&:active":{backgroundColor:"inherit",transform:"none"},"&:focus":{outline:"none",boxShadow:"none"}}}}},MuiSlider:{styleOverrides:{root:{color:s,height:6,padding:"15px 0","& .MuiSlider-rail":{backgroundColor:d[300],opacity:1,height:2},"& .MuiSlider-track":{backgroundColor:s,height:2,border:"none"},"& .MuiSlider-thumb":{backgroundColor:s,border:`2px solid ${c.paper}`,width:16,height:16,boxShadow:`0 2px 6px ${G.alpha("#000000",.2)}`,"&:hover":{boxShadow:`0 0 0 8px ${G.alpha(s,.16)}`},"&:focus":{boxShadow:`0 0 0 8px ${G.alpha(s,.16)}`},"&.Mui-active":{boxShadow:`0 0 0 14px ${G.alpha(s,.16)}`},"&.Mui-disabled":{backgroundColor:u.disabled,border:`2px solid ${d[200]}`}},"& .MuiSlider-valueLabel":{backgroundColor:n?G.alpha(d[500],.95):G.alpha("#2c2c2c",.9),color:"#ffffff",fontSize:ge.typography.pxToRem(12),borderRadius:"6px",padding:"6px 8px","&::before":{borderTopColor:n?G.alpha(d[500],.95):G.alpha("#2c2c2c",.9)}},"& .MuiSlider-mark":{backgroundColor:G.alpha(s,n?.6:.4),height:6,width:1,"&.MuiSlider-markActive":{backgroundColor:G.alpha(s,n?.9:.7)}},"& .MuiSlider-markLabel":{color:u.secondary,fontSize:ge.typography.pxToRem(12),"&.MuiSlider-markLabelActive":{color:s}}},colorSecondary:{color:o,"& .MuiSlider-track":{backgroundColor:o},"& .MuiSlider-thumb":{backgroundColor:o,"&:hover":{boxShadow:`0 0 0 8px ${G.alpha(o,.16)}`},"&:focus":{boxShadow:`0 0 0 8px ${G.alpha(o,.16)}`},"&.Mui-active":{boxShadow:`0 0 0 14px ${G.alpha(o,.16)}`}}}}},MuiIconButton:{styleOverrides:{root:{borderRadius:"8px",padding:"8px",transition:ge.transitions.create(["background-color","box-shadow","color"],{duration:ge.transitions.duration.short}),"&:hover":{backgroundColor:G.alpha(u.primary,.04)},"&:focus":{outline:"none",boxShadow:"none"},"&.Mui-disabled":{color:u.disabled,backgroundColor:"transparent",cursor:"not-allowed"}},sizeSmall:{padding:"6px",fontSize:ge.typography.pxToRem(18)},sizeMedium:{padding:"8px",fontSize:ge.typography.pxToRem(20)},sizeLarge:{padding:"12px",fontSize:ge.typography.pxToRem(24)},colorPrimary:{color:Fe(s,n),"&:hover":{backgroundColor:G.alpha(s,.08),color:Fe(s,n)},"&:active":{backgroundColor:G.alpha(s,.12)},"&.Mui-disabled":{color:u.disabled},"&:focus":{outline:"none",boxShadow:"none"}},colorSecondary:{color:Fe(o,n),"&:hover":{backgroundColor:G.alpha(o,.08),color:Fe(o,n)},"&:focus":{outline:"none",boxShadow:"none"},"&:active":{backgroundColor:G.alpha(o,.12)},"&.Mui-disabled":{color:u.disabled}},colorError:{color:n?"#f87171":"#dc2626","&:hover":{backgroundColor:G.alpha(n?"#f87171":"#dc2626",.08),color:n?"#fca5a5":"#b91c1c"},"&:focus":{outline:"none",boxShadow:"none"},"&:active":{backgroundColor:G.alpha(n?"#f87171":"#dc2626",.12)},"&.Mui-disabled":{color:u.disabled}},colorWarning:{color:n?"#fbbf24":"#d97706","&:hover":{backgroundColor:G.alpha(n?"#fbbf24":"#d97706",.08),color:n?"#fcd34d":"#b45309"},"&:focus":{outline:"none",boxShadow:"none"},"&:active":{backgroundColor:G.alpha(n?"#fbbf24":"#d97706",.12)},"&.Mui-disabled":{color:u.disabled}},colorInfo:{color:n?"#60a5fa":"#2563eb","&:hover":{backgroundColor:G.alpha(n?"#60a5fa":"#2563eb",.08),color:n?"#93c5fd":"#1d4ed8"},"&:focus":{outline:"none",boxShadow:"none"},"&:active":{backgroundColor:G.alpha(n?"#60a5fa":"#2563eb",.12)},"&.Mui-disabled":{color:u.disabled}},colorSuccess:{color:n?"#4ade80":"#16a34a","&:hover":{backgroundColor:G.alpha(n?"#4ade80":"#16a34a",.08),color:n?"#86efac":"#15803d"},"&:focus":{outline:"none",boxShadow:"none"},"&:active":{backgroundColor:G.alpha(n?"#4ade80":"#16a34a",.12)},"&.Mui-disabled":{color:u.disabled}},colorInherit:{color:u.primary,"&:hover":{backgroundColor:G.alpha(u.primary,.04)},"&:focus":{outline:"none",boxShadow:"none"},"&:active":{backgroundColor:G.alpha(u.primary,.08)},"&.Mui-disabled":{color:u.disabled}},contained:{backgroundColor:c.paper,boxShadow:`0 1px 3px ${G.alpha("#000000",.12)}`,"&:hover":{backgroundColor:d[100],boxShadow:`0 2px 6px ${G.alpha("#000000",.15)}`},"&:focus":{outline:"none",boxShadow:"none"},"&:active":{boxShadow:`0 1px 2px ${G.alpha("#000000",.2)}`},"&.Mui-disabled":{backgroundColor:d[100],boxShadow:"none",color:u.disabled}},edge:{"&.MuiIconButton-edgeStart":{marginLeft:"-12px"},"&.MuiIconButton-edgeEnd":{marginRight:"-12px"}}},variants:[{props:{variant:"soft"},style:{backgroundColor:G.alpha(s,.08),color:Fe(s,n),"&:hover":{backgroundColor:G.alpha(s,.12)},"&:focus":{backgroundColor:G.alpha(s,.12),boxShadow:`0 0 0 2px ${G.alpha(s,.3)}`},"&:active":{backgroundColor:G.alpha(s,.16)}}},{props:{variant:"outlined"},style:{border:`1px solid ${G.alpha(s,.3)}`,color:Fe(s,n),"&:hover":{backgroundColor:G.alpha(s,.04),borderColor:Fe(s,n)},"&:focus":{backgroundColor:G.alpha(s,.04),borderColor:Fe(s,n),boxShadow:`0 0 0 2px ${G.alpha(s,.2)}`},"&:active":{backgroundColor:G.alpha(s,.08)}}}]},MuiButtonGroup:{defaultProps:{disableElevation:!0}},MuiButton:{defaultProps:{disableElevation:!0},styleOverrides:{contained:{"&:hover":{backgroundColor:G.alpha(s,.8)}},textPrimary:{color:u.primary},textSecondary:{color:u.secondary},outlinedPrimary:{borderColor:d[300],color:u.primary,"&:hover, &:active, &:focus":{borderColor:d[500],color:u.primary}},containedSecondary:{backgroundColor:c.paper,border:`1px solid ${d[300]}`,color:u.primary,"&:hover, &:active, &:focus":{backgroundColor:c.paper,borderColor:d[500],color:u.primary}}}},MuiInputBase:{styleOverrides:{root:{"&:not(.Mui-disabled, .Mui-error):before":{borderBottom:`1px solid ${d[400]}`},"&:hover:not(.Mui-disabled, .Mui-error):before":{borderBottom:`1px solid ${d[500]} !important`},"&:after":{borderBottom:`1px solid ${u.primary} !important`},"&.MuiOutlinedInput-root:not(.Mui-error)":{"& fieldset":{borderColor:d[300],transition:"border-color 0.2s"}},"&.MuiOutlinedInput-root:not(.Mui-disabled, .Mui-error)":{"&:hover fieldset":{borderColor:d[400]},"&.Mui-focused fieldset":{borderColor:u.secondary,borderWidth:1}},".MuiSelect-icon":{fill:u.primary}},input:{fontSize:ge.typography.pxToRem(14),color:u.primary,"&.Mui-disabled":{WebkitTextFillColor:"inherit",color:u.secondary}},inputSizeSmall:{padding:"4px 12px !important"}}},MuiOutlinedInput:{styleOverrides:{root:{input:{padding:"8px 12px"}},notchedOutline:{"& legend":{fontSize:"0.85em",maxWidth:"100%"}}}},MuiInputAdornment:{styleOverrides:{root:{"& .MuiTypography-root":{fontSize:ge.typography.pxToRem(14),color:u.secondary}}}},MuiInputLabel:{defaultProps:{shrink:!0},styleOverrides:{shrink:{transform:"scale(0.85)",fontWeight:ge.typography.fontWeightMedium,color:u.secondary,"&.Mui-focused":{color:u.primary},"&.MuiInputLabel-standard":{transform:"translate(0, -4px) scale(0.85)",color:u.secondary},"&.MuiInputLabel-outlined":{transform:"translate(15px, -8px) scale(0.85)"}}}},MuiSelect:{styleOverrides:{root:{"&.MuiSelect-nativeInput":{padding:0}}},defaultProps:{MenuProps:{PaperProps:{sx:{borderRadius:"4px",boxShadow:n?"0 4px 10px rgba(0, 0, 0, 0.6)":"0 4px 10px rgba(0, 0, 0, 0.3)",backgroundColor:c.paper}}}}},MuiTabs:{defaultProps:{variant:"scrollable"},styleOverrides:{indicator:{height:1,backgroundColor:s}}},MuiTab:{styleOverrides:{root:{textTransform:"none",minWidth:ge.spacing(2),paddingLeft:ge.spacing(1.5),paddingRight:ge.spacing(1.5),fontSize:ge.typography.pxToRem(14),fontFamily:ge.typography.fontFamily,lineHeight:1.5,fontWeight:ge.typography.fontWeightMedium,transition:"color 0.2s, stroke 0.2s",stroke:u.secondary,color:u.secondary,"&.Mui-selected":{color:s,stroke:s},"&:hover":{color:G.darken(s,.15),stroke:G.darken(s,.15),backgroundColor:G.alpha(s,.06)}}}},MuiCard:{styleOverrides:{root:{borderRadius:0,backgroundColor:c.paper}}},MuiCardHeader:{styleOverrides:{title:{fontSize:ge.typography.pxToRem(18),fontWeight:ge.typography.fontWeightMedium,color:u.primary}}},MuiStack:{defaultProps:{spacing:2},styleOverrides:{root:{"& > :not(style) ~ :not(style)":{marginTop:"0px !important"}}}}},typography:{fontFamily:ge.typography.fontFamily,h1:{fontFamily:ge.typography.fontFamily,fontSize:ge.typography.pxToRem(40),lineHeight:1.2,letterSpacing:"-0.02em",fontWeight:ge.typography.fontWeightMedium,color:u.primary},h2:{fontFamily:ge.typography.fontFamily,fontSize:ge.typography.pxToRem(32),lineHeight:1.2,letterSpacing:"-0.02em",fontWeight:ge.typography.fontWeightMedium,color:u.primary},h3:{fontFamily:ge.typography.fontFamily,fontSize:ge.typography.pxToRem(24),lineHeight:1.5,letterSpacing:"-0.01em",fontWeight:ge.typography.fontWeightMedium,color:u.primary},h4:{fontFamily:ge.typography.fontFamily,fontSize:ge.typography.pxToRem(20),lineHeight:1.5,letterSpacing:"-0.01em",fontWeight:ge.typography.fontWeightMedium,color:u.primary},h5:{fontFamily:ge.typography.fontFamily,fontSize:ge.typography.pxToRem(18),lineHeight:1.5,letterSpacing:"-0.01em",fontWeight:ge.typography.fontWeightMedium,color:u.primary},h6:{fontFamily:ge.typography.fontFamily,fontSize:ge.typography.pxToRem(16),lineHeight:1.5,letterSpacing:"-0.005em",fontWeight:ge.typography.fontWeightMedium,color:u.primary},body1:{fontSize:ge.typography.pxToRem(14),color:u.primary},body2:{fontSize:ge.typography.pxToRem(12),color:u.primary},overline:{fontWeight:ge.typography.fontWeightMedium,letterSpacing:"0.05em"},button:{textTransform:"none",fontWeight:ge.typography.fontWeightMedium,lineHeight:1.5},caption:{letterSpacing:0,lineHeight:1.5}},shadows:n?["none","0px 4px 15px rgba(0, 0, 0, 0.12), 0px 0px 2px rgba(0, 0, 0, 0.12), 0px 0px 1px rgba(0, 0, 0, 0.12)","0px 10px 20px rgba(0, 0, 0, 0.15), 0px 2px 6px rgba(0, 0, 0, 0.15), 0px 0px 1px rgba(0, 0, 0, 0.15)","0px 16px 24px rgba(0, 0, 0, 0.18), 0px 2px 6px rgba(0, 0, 0, 0.18), 0px 0px 1px rgba(0, 0, 0, 0.18)","0px 24px 32px rgba(0, 0, 0, 0.21), 0px 16px 24px rgba(0, 0, 0, 0.21), 0px 4px 8px rgba(0, 0, 0, 0.21)",...Array(20).fill("none")]:["none","0px 4px 15px rgba(33, 36, 67, 0.04), 0px 0px 2px rgba(33, 36, 67, 0.04), 0px 0px 1px rgba(33, 36, 67, 0.04)","0px 10px 20px rgba(33, 36, 67, 0.04), 0px 2px 6px rgba(33, 36, 67, 0.04), 0px 0px 1px rgba(33, 36, 67, 0.04)","0px 16px 24px rgba(33, 36, 67, 0.05), 0px 2px 6px rgba(33, 36, 67, 0.05), 0px 0px 1px rgba(33, 36, 67, 0.05)","0px 24px 32px rgba(33, 36, 67, 0.06), 0px 16px 24px rgba(33, 36, 67, 0.06), 0px 4px 8px rgba(33, 36, 67, 0.06)",...Array(20).fill("none")]})},jk=v.forwardRef(({primaryColor:t,secondaryColor:e,galleryImages:n,darkMode:i,freeMode:r,height:a,stickyHeader:s,sticky:o,htmlTab:l,jsonTab:c,locale:u,dataLocale:d,imagePlaceholder:p,initialDocument:f,data:h,onSave:_,onAutoSave:g,customImageProvider:b,mergeTags:y,enableAI:E,onAIRequest:S,showVersion:C,componentTree:D=!0},w)=>{const[k,x]=v.useState(t||"#058705"),[O,A]=v.useState(e||"#079707"),[X,P]=v.useState(n||!1),[Y,z]=v.useState($d),F=(()=>{if(typeof window<"u")return window?.emailBuilder?.emailBuilderFreeMode})(),[K,re]=v.useState(F??r??!0),[ke,ue]=v.useState(i??!1),[Ue,Ce]=v.useState(s??!0),[de,pe]=v.useState(o??!1),[Qe,gt]=v.useState(a);v.useImperativeHandle(w,()=>({getDocument:()=>ne.getState().document,setDocument:ee=>{uc(ee)},save:()=>{Dc();const ee=ne.getState().document;return _&&_(ee),ee},getHtml:()=>{const ee=ne.getState().document;return Wh(ee,{rootBlockId:"root"}).props.children},setImageUrl:(ee,Ae)=>{const H=new CustomEvent("email-builder-set-image",{detail:Ae});window.dispatchEvent(H);const Te=ne.getState().document;if(Te[ee]){const Ve={...Te[ee],data:{...Te[ee].data,props:{...Te[ee].data.props,url:Ae}}};ne.setState({document:{...Te,[ee]:Ve}})}}}),[_]),v.useEffect(()=>{const ee=Ae=>{if(g&&Ae.detail){const H=ne.getState().document;g(H)}};return window.addEventListener("email-builder-auto-save",ee),()=>{window.removeEventListener("email-builder-auto-save",ee)}},[g]),v.useEffect(()=>{const ee=Ae=>{if(Ae.detail?.document)try{let H=Ae.detail.document;H=hc(H),C!==void 0&&H.root&&(H={...H,root:{...H.root,data:{...H.root.data,showVersion:C}}}),uc(JSON.parse(JSON.stringify(H)))}catch(H){console.error("Error loading document from custom event:",H)}};return window.addEventListener("email-builder:load-document",ee),()=>{window.removeEventListener("email-builder:load-document",ee)}},[C]),v.useEffect(()=>{const ee=u??d;if(ee){const Ae=nwe(ee);Ae!==Yo.language&&Yo.changeLanguage(Ae).catch(()=>{})}},[u,d]),v.useEffect(()=>{t!==void 0&&x(t)},[t]),v.useEffect(()=>{e!==void 0&&A(e)},[e]),v.useEffect(()=>{n!==void 0&&P(n)},[n]),v.useEffect(()=>{i!==void 0&&ue(i)},[i]),v.useEffect(()=>{r!==void 0&&re(r)},[r]),v.useEffect(()=>{s!==void 0&&Ce(s)},[s]),v.useEffect(()=>{o!==void 0&&pe(o)},[o]),v.useEffect(()=>{a!==void 0&&gt(a)},[a]),v.useEffect(()=>{z(p||$d)},[p]),v.useEffect(()=>(typeof window<"u"&&(window.__emailBuilderCustomImageProvider=b),()=>{typeof window<"u"&&delete window.__emailBuilderCustomImageProvider}),[b]),v.useEffect(()=>(typeof window<"u"&&(window.__emailBuilderCustomMergeTags=y),()=>{typeof window<"u"&&delete window.__emailBuilderCustomMergeTags}),[y]),v.useEffect(()=>(typeof window<"u"&&(window.__emailBuilderEnableAI=E??!1,window.__emailBuilderOnAIRequest=S),()=>{typeof window<"u"&&delete window.__emailBuilderOnAIRequest}),[E,S]),v.useEffect(()=>{const ee=h||f;if(ee)try{let Ae;typeof ee=="string"?Ae=JSON.parse(ee):Ae=ee,Ae=hc(Ae),C!==void 0&&Ae.root&&(Ae={...Ae,root:{...Ae.root,data:{...Ae.root.data,showVersion:C}}}),uc(JSON.parse(JSON.stringify(Ae)))}catch(Ae){console.error("Error initializing document:",Ae)}},[]),v.useEffect(()=>{if(h)try{let ee;typeof h=="string"?ee=JSON.parse(h):ee=h,ee=hc(ee),C!==void 0&&ee.root&&(ee={...ee,root:{...ee.root,data:{...ee.root.data,showVersion:C}}}),uc(JSON.parse(JSON.stringify(ee)))}catch(ee){console.error("Error updating document:",ee)}},[h,C]);const Ze=owe(k,O,ke);return m.jsx("div",{style:{position:"relative",width:"100%",height:"100%"},children:m.jsx(Qs.DndProvider,{backend:a$.HTML5Backend,children:m.jsx(T.ThemeProvider,{theme:Ze,children:m.jsxs(Ke.I18nextProvider,{i18n:Yo,children:[m.jsx(T.GlobalStyles,{styles:ee=>({".ce-inline-toolbar, .codex-editor--narrow .ce-toolbox, .ce-conversion-toolbar, .ce-settings, .ce-settings__button, .ce-toolbar__settings-btn:hover, .cdx-button, .ce-popover, .ce-toolbar__plus:hover":{background:ee.palette.primary.main,color:"#fff"},"::selection, .ce-block--selected .ce-block__content":{background:`${ee.palette.secondary.main} !important`},".ce-popover-item:hover":{backgroundColor:`${ee.palette.primary.main} !important`,color:"#fff"},".cdx-settings-button:hover, .ce-settings__button:hover, .ce-toolbox__button--active, .ce-toolbox__button:hover, .cdx-button:hover, .ce-inline-toolbar__dropdown:hover, .ce-inline-tool:hover, .ce-popover__item:hover, .ce-toolbar__settings-btn:hover":{backgroundColor:ee.palette.primary.main,color:"#fff !important"},".tag__title":{color:`${ee.palette.primary.main} !important`},".editor-js-loader":{borderBottomColor:ee.palette.primary.main},".ql-tooltip .ql-action":{background:ee.palette.secondary.main,color:"#fff !important"},".email-builder-body::-webkit-scrollbar-thumb":{background:ee.palette.primary.main},".buttonsUndoRedo":{color:ee.palette.primary.main,transition:"color 0.2s, background-color 0.2s",borderRadius:"8px"},".buttonsUndoRedo:hover":{color:ee.palette.primary.dark,backgroundColor:`${G.alpha(ee.palette.primary.main,.08)}`},".ql-snow .ql-toolbar button.ql-active":{color:ee.palette.primary.main},".lucide-loader-circle":{color:ee.palette.primary.main},".eb-editor-esc-tip":{backgroundColor:ee.palette.secondary.main}})}),m.jsx(T.CssBaseline,{}),m.jsx(SDe,{sticky:de,heightContent:Qe,freeMode:K,darkMode:ke,galleryImages:X,stickyHeader:Ue,htmlTab:l,jsonTab:c,imagePlaceholder:Y,componentTree:D})]})})})})});let Vf=null;function lwe(){return Vf||(Vf=v$(jk,{props:{primaryColor:"string",secondaryColor:"string",galleryImages:"boolean",darkMode:"boolean",freeMode:"boolean",height:"string",stickyHeader:"boolean",sticky:"boolean",htmlTab:"boolean",jsonTab:"boolean",locale:"string",dataLocale:"string",imagePlaceholder:"string",data:"json",showVersion:"boolean",componentTree:"boolean",enableAI:"boolean",mergeTags:"json"}}),Vf)}function n$(t="email-builder"){typeof customElements>"u"||customElements.get(t)||customElements.define(t,lwe())}if(typeof window<"u")try{n$("email-builder")}catch{}exports.EmailBuilder=jk;exports.default=jk;exports.registerEmailBuilder=n$;
438
+ `;function Wh(t,{rootBlockId:e}){const{cleanedDocument:n,css:i}=s6(t);return m.jsx(nu,{children:"<!DOCTYPE html>"+l$.renderToStaticMarkup(m.jsxs("html",{lang:"en",children:[m.jsxs("head",{children:[m.jsx("link",{href:"https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&family=Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700;1,900&family=Montserrat:ital,wght@0,100..900;1,100..900&family=Open+Sans:ital,wght@0,300..800;1,300..800&family=Oswald:wght@200..700&family=Pacifico&family=Playfair:ital,opsz,wght@0,5..1200,300..900;1,5..1200,300..900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap",rel:"stylesheet"}),m.jsx("style",{dangerouslySetInnerHTML:{__html:`${i}`}}),m.jsx("style",{dangerouslySetInnerHTML:{__html:`${dDe}`}}),m.jsx("title",{children:"emailbuilder.online"})]}),m.jsx("body",{style:{width:"100%",margin:"0",padding:"0",backgroundColor:t?.root?.data?.backdropColor??"#f4f4f4"},children:m.jsx("table",{role:"presentation",style:{width:"100%",height:"100%",border:"0"},children:m.jsx("tbody",{children:m.jsx("tr",{children:m.jsx("td",{align:"center",valign:"middle",style:{padding:"0"},children:m.jsx("table",{role:"presentation",style:{maxWidth:"600px",width:"100%",border:"0"},children:m.jsx("tr",{children:m.jsx("td",{children:m.jsx(SB,{isNotClient:!0,document:n,rootBlockId:e})})})})})})})})})]})).replace(/<div style="position:relative">\s*<button\s+class="MuiButtonBase-root\b.*?>.*?<\/button>.*?<\/div>/gs,"")})}function pDe(){const t=K0(),e=v.useMemo(()=>Wh(t,{rootBlockId:"root"}),[t]);return m.jsx("div",{style:{width:"100%",margin:"0 auto"},children:m.jsx(X5,{type:"html",value:e?.props.children})})}function fDe(){const t=K0(),e=v.useMemo(()=>JSON.stringify(t,null," "),[t]);return m.jsx("div",{style:{width:"100%",margin:"0 auto"},children:m.jsx(X5,{type:"json",value:e})})}const mDe={AccountCircleOutlined:$.AccountCircleOutlined,ArticleOutlined:$.ArticleOutlined,CodeOutlined:$.CodeOutlined,Crop32Outlined:$.Crop32Outlined,DashboardOutlined:$.DashboardOutlined,Groups2:$.Groups2,HorizontalRuleOutlined:$.HorizontalRuleOutlined,ImageOutlined:$.ImageOutlined,LibraryAddOutlined:$.LibraryAddOutlined,SmartButtonOutlined:$.SmartButtonOutlined,TextFieldsOutlined:$.TextFieldsOutlined,Title:$.Title,ViewColumnOutlined:$.ViewColumnOutlined,WidgetsOutlined:$.WidgetsOutlined};function hDe(t){const e=document.querySelector(`[data-block-id="${t}"]`);e&&e.scrollIntoView({behavior:"smooth",block:"center"})}function J5({node:t,selectedBlockId:e,onSelect:n}){const i=mDe[t.iconName]??$.WidgetsOutlined,r=e===t.blockId,a=ne(g=>g.darkMode),[s,o]=v.useState(null),l=v.useRef(null),c=g=>{const b=g.getClientOffset(),y=l.current?.getBoundingClientRect();if(!b||!y)return null;const E=(y.bottom-y.top)/2;return b.y-y.top<E?"up":"down"},[{isOver:u},d]=Qs.useDrop(()=>({accept:"block",drop:(g,b)=>{const y=t.blockId,E=g.blockId;if(y===E||b.didDrop())return;const S=c(b)??"down";Gd(y,E,S)},canDrop:g=>!vl({targetId:t.blockId,draggedId:g.blockId}),collect:g=>({isOver:g.canDrop()?g.isOver({shallow:!0}):!1}),hover:(g,b)=>{if(g.blockId===t.blockId){o(null);return}if(!b.canDrop()||!b.isOver({shallow:!0})){o(null);return}const y=c(b);if(!y){o(null);return}o(y)},end:()=>{o(null)}})),[{isDragging:p},f]=Qs.useDrag(()=>({type:"block",item:{blockId:t.blockId},collect:g=>({isDragging:g.isDragging()})}));v.useEffect(()=>{u||o(null)},[u]);const h=g=>{l.current=g,g&&f(d(g))},_=g=>{g.stopPropagation(),t.type==="NotionText"&&window.dispatchEvent(new CustomEvent("email-builder-highlight-editor",{detail:!0})),n(t.blockId),hDe(t.blockId)};return m.jsxs(T.Box,{sx:{width:"100%"},children:[m.jsxs(T.Box,{ref:h,onClick:_,sx:{display:"flex",alignItems:"center",gap:1,py:.5,px:1,pl:1+(t.depth-1)*2,cursor:"pointer",backgroundColor:r?"action.selected":u?"action.hover":"transparent",borderLeftWidth:3,borderLeftStyle:"solid",borderLeftColor:r?"primary.main":"transparent",borderTop:s==="up"?2:0,borderTopColor:"primary.main",borderBottom:s==="down"?2:0,borderBottomColor:"primary.main",opacity:p?.6:1,"&:hover":{backgroundColor:"action.hover"}},children:[m.jsx(i,{fontSize:"small",sx:g=>({color:r?g.palette.primary.main:a?g.palette.text.primary:g.palette.text.secondary,flexShrink:0})}),m.jsx(T.Typography,{variant:"body2",noWrap:!0,sx:{flex:1,minWidth:0,fontWeight:r?600:400},children:t.label})]}),t.children.map(g=>m.jsx(J5,{node:g,selectedBlockId:e,onSelect:n},g.blockId))]})}function gDe(){const{t}=Ke.useTranslation("inspector"),e=kq(Cq),n=ne(s=>s.selectedBlockId),i=X0(),r=typeof document<"u"?document.querySelector('[data-component-tree-toggle="true"]'):null,a=s=>{r&&r.contains(s.target)||jv()};return!e||!i||!r?null:m.jsx(T.Popper,{open:i,anchorEl:r,placement:"bottom-end",transition:!0,popperOptions:{strategy:"fixed"},sx:{zIndex:1300},children:({TransitionProps:s})=>m.jsx(T.Grow,{...s,style:{transformOrigin:"right top"},children:m.jsx(T.Paper,{elevation:8,sx:{width:260,maxHeight:"50vh",overflow:"hidden",borderRadius:2,display:"flex",flexDirection:"column",boxShadow:16,border:1,borderColor:"divider"},children:m.jsx(T.ClickAwayListener,{onClickAway:a,children:m.jsxs(T.Box,{sx:{display:"flex",flexDirection:"column",maxHeight:"50vh"},children:[m.jsxs(T.Box,{sx:{p:1,pb:0,borderBottom:1,borderColor:"divider",display:"flex",alignItems:"center",justifyContent:"space-between",userSelect:"none",flexShrink:0},children:[m.jsx(T.Typography,{variant:"subtitle2",color:"text.secondary",children:t("header.componentTree","Component tree")}),m.jsx(T.IconButton,{size:"small",onClick:()=>jv(),"aria-label":t("header.closeComponentTree","Close component tree"),sx:o=>({color:o.palette.text.secondary}),children:m.jsx($.Close,{fontSize:"small"})})]}),m.jsx(T.Box,{sx:{p:.5,pb:2,overflowY:"auto",flex:1,minHeight:0},children:e.children.map(o=>m.jsx(J5,{node:o,selectedBlockId:n,onSelect:l=>Hi(l)},o.blockId))})]})})})})})}function _De(){const{t}=Ke.useTranslation("inspector"),e=X0();ne(r=>r.darkMode);const n=()=>{jv()},i=e?t("header.closeComponentTree","Close component tree"):t("header.openComponentTree","Open component tree");return m.jsx(T.Tooltip,{title:i,placement:"bottom",children:m.jsx(T.IconButton,{onClick:n,size:"small","aria-label":i,"data-component-tree-toggle":"true",sx:r=>({color:e?r.palette.primary.main:r.palette.text.primary,"&:hover":{color:r.palette.primary.dark,backgroundColor:`${G.alpha(r.palette.primary.main,.08)}`}}),children:e?m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",height:"20px",width:"20px",viewBox:"0 -960 960 960",fill:"currentColor",children:m.jsx("path",{d:"M480-400 40-640l440-240 440 240-440 240Zm0 160L63-467l84-46 333 182 333-182 84 46-417 227Zm0 160L63-307l84-46 333 182 333-182 84 46L480-80Zm0-411 273-149-273-149-273 149 273 149Zm0-149Z"})}):m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",height:"20px",width:"20px",viewBox:"0 -960 960 960",fill:"currentColor",children:m.jsx("path",{d:"M480-400 40-640l440-240 440 240-440 240Zm0 160L63-467l84-46 333 182 333-182 84 46-417 227Zm0 160L63-307l84-46 333 182 333-182 84 46L480-80Zm0-411 273-149-273-149-273 149 273 149Zm0-149Z"})})})})}function bDe({enableEditorTab:t=!0,enablePreviewTab:e=!0,enableHtmlTab:n=!0,enableJsonTab:i=!0}){const r=Q0(),a=Uz(),s=dn(),{t:o}=Ke.useTranslation("inspector"),l=v.useMemo(()=>{const u=[];return t&&u.push("editor"),e&&u.push("preview"),n&&u.push("html"),i&&a&&u.push("json"),u},[t,e,n,i,a]);v.useEffect(()=>{l.includes(r)||nf(l[0]??"editor")},[l.join(","),r]);const c=(u,d)=>{const p=sessionStorage.getItem("lastSelectedScreenSize")||"desktop";switch(d){case"html":nf("html"),sessionStorage.setItem("lastSelectedScreenSize",s||"desktop"),km("desktop");break;case"preview":case"json":case"editor":km(p),nf(d);return;default:nf("editor")}};return m.jsxs(T.Tabs,{value:r,onChange:c,children:[t&&m.jsx(T.Tab,{id:"tab-editor",value:"editor",label:m.jsx(T.Tooltip,{disableInteractive:!0,arrow:!0,title:o("header.edit"),children:m.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M12.6935 4.36019L15.6398 7.30647M13.9435 3.11019C14.7571 2.2966 16.0762 2.2966 16.8898 3.11019C17.7034 3.92379 17.7034 5.24288 16.8898 6.05647L5.41667 17.5296H2.5V14.5537L13.9435 3.11019Z",stroke:"inherit",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}),e&&m.jsx(T.Tab,{id:"tab-preview",value:"preview",label:m.jsx(T.Tooltip,{disableInteractive:!0,arrow:!0,title:o("header.preview"),children:m.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[m.jsx("path",{d:"M12.5003 9.99984C12.5003 11.3805 11.381 12.4998 10.0003 12.4998C8.61957 12.4998 7.50029 11.3805 7.50029 9.99984C7.50029 8.61913 8.61957 7.49984 10.0003 7.49984C11.381 7.49984 12.5003 8.61913 12.5003 9.99984Z",stroke:"inherit",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),m.jsx("path",{d:"M2.04883 9.99981C3.11072 6.6189 6.26929 4.1665 10.0007 4.1665C13.732 4.1665 16.8906 6.61893 17.9525 9.99987C16.8906 13.3808 13.732 15.8332 10.0007 15.8332C6.26929 15.8332 3.11071 13.3807 2.04883 9.99981Z",stroke:"inherit",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})}),n&&m.jsx(T.Tab,{id:"tab-html",value:"html",label:m.jsx(T.Tooltip,{disableInteractive:!0,arrow:!0,title:o("header.htmlOutput"),children:m.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M8.33268 16.6668L11.666 3.3335M14.9993 6.66683L18.3327 10.0002L14.9993 13.3335M4.99935 13.3335L1.66602 10.0002L4.99935 6.66683",stroke:"inherit",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})},"html"),i&&a&&m.jsx(T.Tab,{id:"tab-json",value:"json",label:m.jsx(T.Tooltip,{disableInteractive:!0,arrow:!0,title:o("header.jsonOutput"),children:m.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M7.49935 10L12.4993 10M7.49935 13.3333L12.4993 13.3333M14.166 17.5H5.83268C4.91221 17.5 4.16602 16.7538 4.16602 15.8333L4.16602 4.16667C4.16602 3.24619 4.91221 2.5 5.83268 2.5L10.4875 2.5C10.7085 2.5 10.9205 2.5878 11.0768 2.74408L15.5886 7.25592C15.7449 7.4122 15.8327 7.62416 15.8327 7.84518L15.8327 15.8333C15.8327 16.7538 15.0865 17.5 14.166 17.5Z",stroke:"inherit",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})},"json")]})}const Lv=16350,yDe=v.memo(function({onRendered:e}){const n=ne(i=>i.document,(i,r)=>i===r);return m.jsx(SB,{document:n,disabledInteraction:!0,isNotClient:!0,onRendered:e})});function EDe({sticky:t,heightContent:e,enableEditorTab:n=!0,enablePreviewTab:i=!0,enableHtmlTab:r=!1,enableJsonTab:a=!0,enableComponentTree:s=!0}){const o=Q0(),l=X0(),c=Yz(),u=K$(),d=Q$(),p=v.useRef(null),[f,h]=v.useState(0),_=G.useTheme(),[g,b]=v.useState(!1),y=dG(),{t:E}=Ke.useTranslation("inspector"),[S,C]=v.useState(!1),D=v.useRef(null),w=4e3,[k,x]=v.useState(!1),O=v.useRef(null),A=({onRendered:de,children:pe})=>(v.useEffect(()=>{if(typeof de=="function"){const Qe=requestAnimationFrame(()=>de());return()=>cancelAnimationFrame(Qe)}}),m.jsx(m.Fragment,{children:pe})),X=()=>m.jsx(T.SvgIcon,{viewBox:"0 0 18 18",fontSize:"small",children:m.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"})}),P=v.useCallback(()=>{let de=null;switch(o){case"html":de=r?m.jsx(pDe,{}):null;break;case"json":de=a?m.jsx(fDe,{}):null;break}return de},[c,o,r,a]);v.useEffect(()=>{const de=pe=>{const{detail:Qe}=pe,gt=hc(Qe);v.startTransition(()=>{vp(gt,!1)}),requestAnimationFrame(()=>{C(!0),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{C(!1)},w),x(!0),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{x(!1)},w)})};return window.addEventListener("email-builder-update-template",de),()=>{window.removeEventListener("email-builder-update-template",de)}},[o]),v.useEffect(()=>{const de=()=>{p.current?.offsetWidth&&h(p.current.offsetWidth)};de();const pe=new ResizeObserver(de);return p.current&&pe.observe(p.current),()=>{p.current&&pe.disconnect()}},[p]);const Y=ne(de=>{try{const{css:pe}=s6(de.document);return{length:pe.length,threshold:Lv,exceeded:pe.length>Lv}}catch{return{length:0,threshold:Lv,exceeded:!1}}},(de,pe)=>de.length===pe.length&&de.exceeded===pe.exceeded);v.useEffect(()=>{const de=pe=>{(pe.ctrlKey||pe.metaKey)&&(pe.key==="z"&&!pe.shiftKey&&u?(pe.preventDefault(),kx()):(pe.key==="y"||pe.key==="z"&&pe.shiftKey)&&d&&(pe.preventDefault(),xx()))};return document.addEventListener("keydown",de),()=>{document.removeEventListener("keydown",de)}},[u,d]);const z=()=>{const de=ne.getState().document,pe=Wh(de,{rootBlockId:"root"});console.log("Get data: ",de,pe);const Qe=new CustomEvent("save-template",{detail:{json:de,html:pe.props.children}});window.dispatchEvent(Qe)},F=v.useCallback(()=>{kx()},[]),K=v.useCallback(()=>{xx()},[]),re=v.useMemo(()=>{if(o==="html"){const de=ne.getState().document;return Wh(de,{rootBlockId:"root"})}return null},[o]),ke=v.useMemo(()=>{if(o==="json"){const de=ne.getState().document;return JSON.stringify(de)}return""},[o]),ue=v.useCallback(()=>{switch(o){case"preview":return m.jsx(m.Fragment,{children:m.jsx(Vw,{})});case"html":return m.jsx(T.Tooltip,{title:E("header.copy_html"),placement:"left-start",sx:{color:"text.primary"},children:m.jsx(T.IconButton,{onClick:()=>Ue(re?.props.children||""),children:m.jsx($.ContentCopyOutlined,{fontSize:"small"})})});case"json":return m.jsxs(m.Fragment,{children:[m.jsx(vJ,{}),m.jsx(T.Tooltip,{title:E("header.copy_json"),placement:"left-start",sx:{color:"text.primary"},children:m.jsx(T.IconButton,{onClick:()=>Ue(ke),children:m.jsx($.ContentCopyOutlined,{fontSize:"small"})})})]});case"editor":default:return m.jsxs(m.Fragment,{children:[m.jsx(T.Tooltip,{title:E("header.undo"),children:m.jsx("div",{onClick:F,style:{transform:"rotateY(180deg)"},className:`buttonsUndoRedo ${u?"":"disabledButton"} `,children:m.jsx("svg",{width:"24px",height:"24px",viewBox:"0 0 25 25",children:m.jsx("path",{fill:"currentColor",d:"M9.9 19q-2.425 0-4.163-1.575T4 13.5t1.738-3.925T9.9 8h6.3l-2.6-2.6L15 4l5 5l-5 5l-1.4-1.4l2.6-2.6H9.9q-1.575 0-2.738 1T6 13.5T7.163 16T9.9 17H17v2z"})})})}),m.jsx(T.Tooltip,{title:E("header.redo"),children:m.jsx("div",{onClick:K,className:`buttonsUndoRedo ${d?"":"disabledButton"} `,children:m.jsx("svg",{width:"24px",height:"24px",viewBox:"0 0 25 25",children:m.jsx("path",{fill:"currentColor",d:"M9.9 19q-2.425 0-4.163-1.575T4 13.5t1.738-3.925T9.9 8h6.3l-2.6-2.6L15 4l5 5l-5 5l-1.4-1.4l2.6-2.6H9.9q-1.575 0-2.738 1T6 13.5T7.163 16T9.9 17H17v2z"})})})}),m.jsx(Vw,{}),s&&m.jsx(_De,{})]})}},[o,re,ke,u,d,E,F,K,s]),Ue=async de=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(de);else{const pe=document.createElement("textarea");pe.value=de,pe.setAttribute("readonly",""),pe.style.position="absolute",pe.style.left="-9999px",document.body.appendChild(pe),pe.select(),document.execCommand("copy"),document.body.removeChild(pe)}b(!0)}catch(pe){console.error("Error copying text:",pe)}},Ce=!!e;return m.jsxs(T.Container,{maxWidth:!1,sx:{flex:"1 1 auto",minWidth:"410px",height:"100%",padding:"0!important",position:"relative",...Ce&&{display:"flex",flexDirection:"column",overflow:"hidden",minHeight:0}},children:[m.jsx("button",{id:"saveData",style:{display:"none"},onClick:z,children:"Save"}),m.jsx(T.Box,{sx:Ce?{flexShrink:0}:void 0,children:m.jsx(wL,{threshold:".preview-container-end",disabled:!t,topOffset:0,children:m.jsxs("div",{id:"ee-editor-header",children:[m.jsx("div",{style:{height:50,width:f||"100%",borderBottom:1,borderColor:"divider",backgroundColor:_.palette.background.paper,zIndex:1,display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:0},children:m.jsxs(T.Stack,{px:2,direction:"row",gap:2,width:"100%",justifyContent:"space-between",alignItems:"center",children:[m.jsx(T.Stack,{direction:"row",spacing:2,children:m.jsx(bDe,{enableEditorTab:n,enablePreviewTab:i,enableHtmlTab:r,enableJsonTab:a})}),m.jsx(T.Stack,{direction:"row",spacing:2,alignItems:"center",children:ue()})]})}),Y&&(Y.length/Y.threshold>=.9||Y.exceeded)&&m.jsxs(T.Alert,{severity:Y?.exceeded?"error":"warning",icon:m.jsx(X,{}),sx:{borderRadius:0,m:0,"& .MuiAlert-message":{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",gap:2}},children:[m.jsxs("span",{children:[m.jsx("span",{style:{fontWeight:700},children:"Attention!"})," ",Y?.exceeded?"You have exceeded the style limit (≈16,000 characters). Some clients will ignore responsive design.":"The email is close to the style limit (≈16,000 characters). If you exceed it, some clients may ignore responsive design."]}),m.jsx(T.Tooltip,{title:`CSS in header: ${Y?.length.toLocaleString()} / ${Y?.threshold.toLocaleString()} characters`,placement:"bottom",children:m.jsx(T.Chip,{size:"small",label:`CSS: ${Y?.length.toLocaleString()} / ${Y?.threshold.toLocaleString()}`,color:Y?.exceeded?"error":"warning",variant:"filled"})})]})]})})}),m.jsxs(T.Box,{className:"preview-container",ref:p,onClick:()=>{o==="editor"&&Hi(null)},sx:{minWidth:370,width:"100%",zIndex:0,marginTop:"0px!important",borderLeft:"1px solid primary",borderBottom:"1px solid primary",padding:"0 ",paddingBottom:"47px",...Ce?{flex:"1 1 auto",minHeight:0,overflowY:"auto",overflowX:"hidden"}:{minHeight:"100dvh",maxHeight:void 0,overflowY:o==="editor"&&y?"visible":"auto",overflowX:"hidden",height:"100%"},position:"relative",pt:o==="editor"?"28px":0},children:[m.jsx(T.Box,{sx:{display:o==="editor"?"block":"none",height:"100%"},children:m.jsx(T.Box,{sx:{opacity:k?0:1,transition:"opacity 120ms ease-out"},children:m.jsx(A,{onRendered:()=>{x(!1),O.current&&(clearTimeout(O.current),O.current=null)},children:m.jsx(T.Box,{sx:{ml:"-24px",width:"calc(100% + 24px)"},children:m.jsx(Nh,{id:"root"})})})})}),m.jsx(T.Box,{sx:{display:o==="preview"?"block":"none",height:"100%"},children:m.jsx(T.Box,{sx:{opacity:S?0:1,transition:"opacity 120ms ease-out"},children:m.jsx(yDe,{onRendered:()=>{C(!1),D.current&&(clearTimeout(D.current),D.current=null)}})})}),P(),(o==="preview"&&S||o==="editor"&&k)&&m.jsxs(T.Box,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:_.palette.background.default,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",zIndex:1e3,gap:2},children:[m.jsx(T.CircularProgress,{size:48}),m.jsx(T.Typography,{variant:"body1",color:"text.secondary",children:"Loading..."})]})]}),m.jsx("div",{className:"preview-container-end",style:{width:"100%"}}),s&&l&&o==="editor"&&m.jsx(gDe,{}),m.jsx(T.Snackbar,{open:g,autoHideDuration:3e3,onClose:()=>b(!1),anchorOrigin:{vertical:"top",horizontal:"center"},message:"Your text has been copied"})]})}function SDe({galleryImages:t=!0,freeMode:e=!0,darkMode:n=!1,heightContent:i=null,containerGrow:r=!0,sticky:a=!1,htmlTab:s=!1,jsonTab:o=!1,imagePlaceholder:l=$d,componentTree:c=!0}){const u=Vz(),d=T.useTheme();v.useEffect(()=>{const h=window.emailBuilder?.emailBuilderDevMode??!0;$z(h)},[]),v.useEffect(()=>{rG(t)},[t]),v.useEffect(()=>{oG(e)},[e]),v.useEffect(()=>{lG(n)},[n]),v.useEffect(()=>{cG(i)},[i]),v.useEffect(()=>{uG(r)},[r]),v.useEffect(()=>{aG(l)},[l]),v.useEffect(()=>{iG({primary:d.palette.primary.main,secondary:d.palette.secondary.main})},[d.palette.primary.main,d.palette.secondary.main]),v.useEffect(()=>{const f=()=>{Dc()};return window.addEventListener("beforeunload",f),()=>{window.removeEventListener("beforeunload",f),Dc()}},[]);const p=!!i;return m.jsxs(T.Container,{className:`${n?"dark-email-builder":"light-email-builder"}`,maxWidth:"none",sx:f=>{const h=p;return{margin:"0",position:"relative",width:"100%",height:h?i:"100%",maxHeight:h?i:void 0,display:"flex",overflowX:"hidden",overflowY:h?"hidden":"auto",padding:"0!important",border:`1px solid ${f.palette.divider}`,borderRadius:2}},children:[m.jsx(T.Box,{sx:f=>({flex:1,minWidth:0,minHeight:p?0:void 0,height:"100%",borderRight:`1px solid ${f.palette.divider}`,display:"flex",flexDirection:"column",overflow:"hidden"}),children:m.jsx(EDe,{enableHtmlTab:s,enableJsonTab:o,sticky:a,heightContent:i,enableComponentTree:c})}),m.jsx(T.Box,{sx:f=>({backgroundColor:`${f.palette.background.paper} !important`,height:"100%",minHeight:p?0:void 0,display:"flex",alignItems:"stretch",borderTopRightRadius:12,overflow:"hidden"}),children:m.jsx(wL,{disabled:!a,threshold:".preview-container-end",topOffset:0,style:{width:u?`${Tm}px`:0,flexBasis:u?`${Tm}px`:0,minWidth:0,transition:"width 220ms cubic-bezier(0.4, 0, 0.2, 1), flex-basis 220ms cubic-bezier(0.4, 0, 0.2, 1)",overflow:"hidden",padding:0,flexShrink:0},children:m.jsx(T.Box,{sx:{height:"100%",minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden",borderBottomRightRadius:12},children:m.jsx(wq,{sticky:a,heightContent:i})})})})]})}const vDe="English (US)",TDe={confirm:"Confirm",cancel:"Cancel",save:"Save",delete:"Delete"},CDe={notionTextPlaceholder:"Write here",editing:"Editing"},kDe={bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",lists:"Lists",bulletList:"Bullet List",numberedList:"Numbered List",textAlign:"Text Align",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",alignJustify:"Align Justify",textColor:"Text Color",backgroundColor:"Background Color",link:"Link",insertMergeTag:"Insert Merge Tag",insertEmoji:"Insert Emoji",aiFeatures:"AI Features",clearFormatting:"Clear Formatting"},xDe={editLink:"Edit link",insertLink:"Insert link",urlLabel:"URL",urlPlaceholder:"https://example.com",invalidUrl:"Enter a valid URL"},nP={language:vDe,generic:TDe,editor:CDe,bubbleMenu:kDe,linkEditor:xDe},DDe={undo:"Undo (CTRL + Z)",redo:"Redo (CTRL + Y)",copy_html:"Copia HTML",copy_json:"Copia JSON",edit:"Modifica",preview:"Anteprima",htmlOutput:"HTML",jsonOutput:"JSON",desktop:"Desktop",mobile:"Mobile",content:"Content",styles:"Styles",componentTree:"Component tree",openComponentTree:"Open component tree",closeComponentTree:"Close component tree"},wDe={copyFormat:"Copy format",pasteFormatting:"Paste formatting",noFormatSupported:"No format supported",duplicate:"Duplicate",delete:"Delete"},ADe={unlockBorders:"Unlock borders",lockBordersTogether:"Lock borders together"},NDe={label:"Style",square:"Square",pill:"Pill",custom:"Custom",borderRadius:"Border Radius",lockTooltip:"Lock corners together",unlockTooltip:"Unlock corners"},IDe={backgroundColor:"Background Color",border:"Border",padding:"Padding",fontWeight:"Font Weight",fontSize:"Font Size",fontFamily:"Font family",width:"Width",shape:"Shape",borderRadius:"Border radius",alignment:"Alignment",height:"Height",lineHeight:"Line Height",color:"Color"},ODe={width:{full:"Full",auto:"Auto"},common:{size:"Size",width:"Width",height:"Height",uploadFile:"Upload a file",dragAndDrop:"or drag and drop",fileInfo:"PNG, JPG, GIF up to 5MB",add:"Add",close:"Close",invalidFiles:"Some files were invalid (wrong type or too large). Only valid files will be uploaded.",svgWarning:"SVG images may not display correctly in Outlook email clients. Consider using PNG or JPG format for better compatibility."},columnWidths:{label:"Columns width",tooltip:"Images in these columns cannot exceed the column's width",left:"Left",right:"Right",center:"Center"},alignment:{label:"Alignment"},responsiveSize:{customPadding:"Custom Padding",lockTooltip:"Lock padding sides together",unlockTooltip:"Unlock padding sides",allSides:"All",options:{xSmall:"XS",small:"SM",medium:"MD",custom:"Custom"}},sizeSelector:{label:"Size",contain:"Contain",cover:"Cover",scale:"Scale"},screenSelector:{desktop:"Desktop view",mobile:"Mobile view"},links:{color:"Link color",underline:"Link underline",underlineOn:"Underline on",underlineOff:"Underline off"},backgroundImage:{label:"Background image",warningTooltip:"Some email clients don't support background images. Add a background color as fallback.",or:"or",browseGallery:"Browse gallery",fillType:"Background fill type",repeat:"Background repeat",position:"Background position",fillOptions:{cover:"Cover",contain:"Contain",auto:"Auto"},repeatOptions:{none:"No repeat",repeat:"Repeat",repeatX:"Repeat X",repeatY:"Repeat Y"},positions:{topLeft:"Top Left",topCenter:"Top Center",topRight:"Top Right",centerLeft:"Center Left",center:"Center",centerRight:"Center Right",bottomLeft:"Bottom Left",bottomCenter:"Bottom Center",bottomRight:"Bottom Right"}},image:{urlLabel:"Image URL",urlPlaceholder:"Enter image URL...",invalidUrl:"Invalid URL format",timeout:"Request timeout - URL took too long to respond",notImage:"URL does not point to an image"},aiImageGeneration:{generate:"Generate",titleError:"Image generation failed",titleLoading:"Generating Your Image",titleCreate:"Create your image",titleReady:"Your Image is ready",descriptionError:"Try simplifying your prompt or describing something else. If the issue persists, please try again later.",descriptionLoading:"Hang tight! This may take a few seconds as we bring your image to life.",descriptionCreate:"Describe the image you want us to generate. Be specific to get the best results.",descriptionReady:"Here's your image. Not quite right? You can tweak it and try again.",warningRegenerate:"Regenerating will discard this image, and it won't be saved in your gallery. To keep it, make sure to",warningInsertFirst:"Insert the image",warningFirst:"first.",regenerate:"Regenerate",cancel:"Cancel",insertImage:"Insert Image",generateImage:"Generate image"},social:{icon:"Icon",url:"URL",theme:"Theme",size:"Size"},layout:{label:"Layout"},panels:{avatar:{title:"Avatar block",sizeLabel:"Size",altLabel:"Alt text"},button:{title:"Button block",textLabel:"Text",targetLabel:"Target",targetPlaceholder:"https://your-site.com",textColor:"Text color",buttonColor:"Button color"},columns:{title:"Columns block",countLabel:"Number of columns"},container:{title:"Container block"},divider:{title:"Divider block"},emailLayout:{title:"Global styles",backgroundColor:"Background color",canvasColor:"Canvas color",fontFamily:"Font family",textColor:"Text color",linksLabel:"Links",version:"Version",showVersion:"Show version"},heading:{title:"Heading block",contentLabel:"Content",levelLabel:"Level"},html:{title:"HTML block",contentLabel:"Content"},image:{title:"Image block",altLabel:"Alt text",altPlaceholder:"Two white watches",urlLabel:"URL",urlPlaceholder:"https://your-website.com"},social:{title:"Social media icons",gap:"Gap"},spacer:{title:"Spacer block"},text:{title:"Text block",contentLabel:"Content",markdownLabel:"Markdown",doubleClickToEdit:"Double-click on the block in the canvas to edit the content"},notionText:{title:"Notion Text"}}},iP={header:DDe,actions:wDe,border:ADe,shape:NDe,properties:IDe,inputs:ODe},RDe="Español (Latinoamérica)",MDe={confirm:"Confirmar",cancel:"Cancelar",save:"Guardar",delete:"Eliminar"},PDe={notionTextPlaceholder:"Escribe aquí",editing:"Editando"},LDe={bold:"Negrita",italic:"Cursiva",underline:"Subrayado",strikethrough:"Tachado",lists:"Listas",bulletList:"Lista con viñetas",numberedList:"Lista numerada",textAlign:"Alineación de texto",alignLeft:"Alinear a la izquierda",alignCenter:"Alinear al centro",alignRight:"Alinear a la derecha",alignJustify:"Justificar",textColor:"Color de texto",backgroundColor:"Color de fondo",link:"Enlace",insertMergeTag:"Insertar etiqueta dinámica",insertEmoji:"Insertar emoji",aiFeatures:"Funciones de IA",clearFormatting:"Limpiar formato"},FDe={editLink:"Editar enlace",insertLink:"Insertar enlace",urlLabel:"URL",urlPlaceholder:"https://ejemplo.com",invalidUrl:"Ingresa una URL válida"},rP={language:RDe,generic:MDe,editor:PDe,bubbleMenu:LDe,linkEditor:FDe},BDe={undo:"Deshacer (CTRL + Z)",redo:"Rehacer (CTRL + Y)",copy_html:"Copiar HTML",copy_json:"Copiar JSON",edit:"Editar",preview:"Vista previa",htmlOutput:"HTML",jsonOutput:"JSON",desktop:"Escritorio",mobile:"Móvil",content:"Contenido",styles:"Estilos",componentTree:"Árbol de bloques",openComponentTree:"Abrir árbol de bloques",closeComponentTree:"Cerrar árbol de bloques"},UDe={copyFormat:"Copiar formato",pasteFormatting:"Pegar formato",noFormatSupported:"Formato no compatible",duplicate:"Duplicar",delete:"Eliminar"},$De={unlockBorders:"Desbloquear bordes",lockBordersTogether:"Bloquear bordes juntos"},zDe={label:"Estilo",square:"Cuadrado",pill:"Píldora",custom:"Personalizado",borderRadius:"Radio del borde",lockTooltip:"Bloquear esquinas juntas",unlockTooltip:"Desbloquear esquinas"},GDe={backgroundColor:"Color de fondo",border:"Borde",padding:"Relleno",fontWeight:"Grosor de fuente",fontSize:"Tamaño de fuente",fontFamily:"Familia tipográfica",width:"Ancho",shape:"Forma",borderRadius:"Radio del borde",alignment:"Alineación",height:"Altura",lineHeight:"Altura de línea",color:"Color"},qDe={width:{full:"Completo",auto:"Automático"},common:{size:"Tamaño",width:"Ancho",height:"Altura",uploadFile:"Subir un archivo",dragAndDrop:"o arrastra y suelta",fileInfo:"PNG, JPG, GIF hasta 5MB",add:"Agregar",close:"Cerrar",invalidFiles:"Algunos archivos no son válidos (tipo incorrecto o demasiado grandes). Solo se subirán los archivos válidos.",svgWarning:"Las imágenes SVG pueden no mostrarse correctamente en clientes de correo como Outlook. Considera usar PNG o JPG para una mejor compatibilidad."},columnWidths:{label:"Ancho de columnas",tooltip:"Las imágenes en estas columnas no pueden exceder el ancho de la columna",left:"Izquierda",right:"Derecha",center:"Centro"},alignment:{label:"Alineación"},responsiveSize:{customPadding:"Relleno personalizado",lockTooltip:"Bloquear lados del relleno juntos",unlockTooltip:"Desbloquear lados del relleno",allSides:"Todos",options:{xSmall:"XS",small:"SM",medium:"MD",custom:"Personalizado"}},sizeSelector:{label:"Tamaño",contain:"Contener",cover:"Cubrir",scale:"Escalar"},screenSelector:{desktop:"Vista de escritorio",mobile:"Vista móvil"},links:{color:"Color del enlace",underline:"Subrayado del enlace",underlineOn:"Subrayado activado",underlineOff:"Subrayado desactivado"},backgroundImage:{label:"Imagen de fondo",warningTooltip:"Algunos clientes de correo no soportan imágenes de fondo. Agrega un color de fondo como alternativa.",or:"o",browseGallery:"Explorar galería",fillType:"Tipo de relleno de fondo",repeat:"Repetición de fondo",position:"Posición de fondo",fillOptions:{cover:"Cubrir",contain:"Contener",auto:"Automático"},repeatOptions:{none:"Sin repetición",repeat:"Repetir",repeatX:"Repetir X",repeatY:"Repetir Y"},positions:{topLeft:"Arriba izquierda",topCenter:"Arriba centro",topRight:"Arriba derecha",centerLeft:"Centro izquierda",center:"Centro",centerRight:"Centro derecha",bottomLeft:"Abajo izquierda",bottomCenter:"Abajo centro",bottomRight:"Abajo derecha"}},image:{urlLabel:"URL de la imagen",urlPlaceholder:"Ingresa la URL de la imagen...",invalidUrl:"Formato de URL inválido",timeout:"Tiempo de espera agotado - La URL tardó demasiado en responder",notImage:"La URL no apunta a una imagen"},aiImageGeneration:{generate:"Generar",titleError:"Error al generar la imagen",titleLoading:"Generando tu imagen",titleCreate:"Crea tu imagen",titleReady:"Tu imagen está lista",descriptionError:"Intenta simplificar tu descripción o describir algo diferente. Si el problema persiste, inténtalo más tarde.",descriptionLoading:"¡Un momento! Esto puede tardar unos segundos mientras damos vida a tu imagen.",descriptionCreate:"Describe la imagen que quieres generar. Sé específico para obtener los mejores resultados.",descriptionReady:"Aquí está tu imagen. ¿No es lo que esperabas? Puedes ajustarla e intentarlo de nuevo.",warningRegenerate:"Regenerar descartará esta imagen y no se guardará en tu galería. Para conservarla, asegúrate de",warningInsertFirst:"Insertar la imagen",warningFirst:"primero.",regenerate:"Regenerar",cancel:"Cancelar",insertImage:"Insertar imagen",generateImage:"Generar imagen"},social:{icon:"Ícono",url:"URL",theme:"Tema",size:"Tamaño"},layout:{label:"Diseño"},panels:{avatar:{title:"Bloque de avatar",sizeLabel:"Tamaño",altLabel:"Texto alternativo"},button:{title:"Bloque de botón",textLabel:"Texto",targetLabel:"Destino",targetPlaceholder:"https://tu-sitio.com",textColor:"Color del texto",buttonColor:"Color del botón"},columns:{title:"Bloque de columnas",countLabel:"Número de columnas"},container:{title:"Bloque contenedor"},divider:{title:"Bloque divisor"},emailLayout:{title:"Estilos globales",backgroundColor:"Color de fondo",canvasColor:"Color del lienzo",fontFamily:"Familia tipográfica",textColor:"Color del texto",linksLabel:"Enlaces",version:"Versión",showVersion:"Mostrar versión"},heading:{title:"Bloque de encabezado",contentLabel:"Contenido",levelLabel:"Nivel"},html:{title:"Bloque HTML",contentLabel:"Contenido"},image:{title:"Bloque de imagen",altLabel:"Texto alternativo",altPlaceholder:"Dos relojes blancos",urlLabel:"URL",urlPlaceholder:"https://tu-sitio-web.com"},social:{title:"Íconos de redes sociales",gap:"Espaciado"},spacer:{title:"Bloque espaciador"},text:{title:"Bloque de texto",contentLabel:"Contenido",markdownLabel:"Markdown",doubleClickToEdit:"Haz doble clic en el bloque del canvas para editar el contenido"}}},aP={header:BDe,actions:UDe,border:$De,shape:zDe,properties:GDe,inputs:qDe},HDe="Italiano",jDe={confirm:"Conferma",cancel:"Annulla",save:"Salva",delete:"Elimina"},VDe={notionTextPlaceholder:"Scrivi qui",editing:"Modifica"},YDe={bold:"Grassetto",italic:"Corsivo",underline:"Sottolineato",strikethrough:"Barrato",lists:"Elenchi",bulletList:"Elenco puntato",numberedList:"Elenco numerato",textAlign:"Allineamento testo",alignLeft:"Allinea a sinistra",alignCenter:"Allinea al centro",alignRight:"Allinea a destra",alignJustify:"Giustifica",textColor:"Colore del testo",backgroundColor:"Colore di sfondo",link:"Collegamento",insertMergeTag:"Inserisci tag dinamico",insertEmoji:"Inserisci emoji",aiFeatures:"Funzioni IA",clearFormatting:"Cancella formattazione"},WDe={editLink:"Modifica collegamento",insertLink:"Inserisci collegamento",urlLabel:"URL",urlPlaceholder:"https://esempio.com",invalidUrl:"Inserisci un URL valido"},sP={language:HDe,generic:jDe,editor:VDe,bubbleMenu:YDe,linkEditor:WDe},KDe={undo:"Annulla (CTRL + Z)",redo:"Ripeti (CTRL + Y)",copy_html:"Copia HTML",copy_json:"Copia JSON",edit:"Modifica",preview:"Anteprima",htmlOutput:"HTML",jsonOutput:"JSON",desktop:"Desktop",mobile:"Mobile",content:"Contenuto",styles:"Stili",componentTree:"Albero componenti",openComponentTree:"Apri albero componenti",closeComponentTree:"Chiudi albero componenti"},QDe={copyFormat:"Copia formato",pasteFormatting:"Incolla formato",noFormatSupported:"Formato non supportato",duplicate:"Duplica",delete:"Elimina"},XDe={unlockBorders:"Sblocca bordi",lockBordersTogether:"Blocca bordi insieme"},JDe={label:"Stile",square:"Quadrato",pill:"Pillola",custom:"Personalizzato",borderRadius:"Raggio del bordo",lockTooltip:"Blocca angoli insieme",unlockTooltip:"Sblocca angoli"},ZDe={backgroundColor:"Colore di sfondo",border:"Bordo",padding:"Riempimento",fontWeight:"Spessore del carattere",fontSize:"Dimensione del carattere",fontFamily:"Famiglia di caratteri",width:"Larghezza",shape:"Forma",borderRadius:"Raggio del bordo",alignment:"Allineamento",height:"Altezza",lineHeight:"Altezza della linea",color:"Colore"},ewe={width:{full:"Completo",auto:"Automatico"},common:{size:"Dimensione",width:"Larghezza",height:"Altezza",uploadFile:"Carica un file",dragAndDrop:"o trascina e rilascia",fileInfo:"PNG, JPG, GIF fino a 5MB",add:"Aggiungi",close:"Chiudi",invalidFiles:"Alcuni file non sono validi (tipo errato o troppo grandi). Solo i file validi verranno caricati.",svgWarning:"Le immagini SVG potrebbero non essere visualizzate correttamente nei client di posta Outlook. Considera l'uso di PNG o JPG per una migliore compatibilità."},columnWidths:{label:"Larghezza delle colonne",tooltip:"Le immagini in queste colonne non possono superare la larghezza della colonna",left:"Sinistra",right:"Destra",center:"Centro"},alignment:{label:"Allineamento"},responsiveSize:{customPadding:"Riempimento personalizzato",lockTooltip:"Blocca i lati del riempimento insieme",unlockTooltip:"Sblocca i lati del riempimento",allSides:"Tutti",options:{xSmall:"XS",small:"SM",medium:"MD",custom:"Personalizzato"}},sizeSelector:{label:"Dimensione",contain:"Contieni",cover:"Copri",scale:"Scala"},screenSelector:{desktop:"Vista desktop",mobile:"Vista mobile"},links:{color:"Colore del collegamento",underline:"Sottolineatura del collegamento",underlineOn:"Sottolineatura attiva",underlineOff:"Sottolineatura disattiva"},backgroundImage:{label:"Immagine di sfondo",warningTooltip:"Alcuni client di posta non supportano le immagini di sfondo. Aggiungi un colore di sfondo come alternativa.",or:"o",browseGallery:"Sfoglia galleria",fillType:"Tipo di riempimento dello sfondo",repeat:"Ripetizione dello sfondo",position:"Posizione dello sfondo",fillOptions:{cover:"Copri",contain:"Contieni",auto:"Automatico"},repeatOptions:{none:"Nessuna ripetizione",repeat:"Ripeti",repeatX:"Ripeti X",repeatY:"Ripeti Y"},positions:{topLeft:"In alto a sinistra",topCenter:"In alto al centro",topRight:"In alto a destra",centerLeft:"Centro sinistra",center:"Centro",centerRight:"Centro destra",bottomLeft:"In basso a sinistra",bottomCenter:"In basso al centro",bottomRight:"In basso a destra"}},image:{urlLabel:"URL dell'immagine",urlPlaceholder:"Inserisci l'URL dell'immagine...",invalidUrl:"Formato URL non valido",timeout:"Timeout della richiesta - L'URL ha impiegato troppo tempo per rispondere",notImage:"L'URL non punta a un'immagine"},aiImageGeneration:{generate:"Genera",titleError:"Generazione immagine fallita",titleLoading:"Generazione dell'immagine in corso",titleCreate:"Crea la tua immagine",titleReady:"La tua immagine è pronta",descriptionError:"Prova a semplificare il prompt o a descrivere qualcos'altro. Se il problema persiste, riprova più tardi.",descriptionLoading:"Aspetta! Potrebbero volerci alcuni secondi per dare vita alla tua immagine.",descriptionCreate:"Descrivi l'immagine che vuoi generare. Sii specifico per ottenere i migliori risultati.",descriptionReady:"Ecco la tua immagine. Non è quella giusta? Puoi modificarla e riprovare.",warningRegenerate:"Rigenerare scarterà questa immagine e non verrà salvata nella tua galleria. Per conservarla, assicurati di",warningInsertFirst:"Inserire l'immagine",warningFirst:"prima.",regenerate:"Rigenera",cancel:"Annulla",insertImage:"Inserisci immagine",generateImage:"Genera immagine"},social:{icon:"Icona",url:"URL",theme:"Tema",size:"Dimensione"},layout:{label:"Layout"},panels:{avatar:{title:"Blocco avatar",sizeLabel:"Dimensione",altLabel:"Testo alternativo"},button:{title:"Blocco pulsante",textLabel:"Testo",targetLabel:"Destinazione",targetPlaceholder:"https://tuo-sito.com",textColor:"Colore del testo",buttonColor:"Colore del pulsante"},columns:{title:"Blocco colonne",countLabel:"Numero di colonne"},container:{title:"Blocco contenitore"},divider:{title:"Blocco divisore"},emailLayout:{title:"Stili globali",backgroundColor:"Colore di sfondo",canvasColor:"Colore della tela",fontFamily:"Famiglia di caratteri",textColor:"Colore del testo",linksLabel:"Collegamenti",version:"Versione",showVersion:"Mostra versione"},heading:{title:"Blocco intestazione",contentLabel:"Contenuto",levelLabel:"Livello"},html:{title:"Blocco HTML",contentLabel:"Contenuto"},image:{title:"Blocco immagine",altLabel:"Testo alternativo",altPlaceholder:"Due orologi bianchi",urlLabel:"URL",urlPlaceholder:"https://tuo-sito-web.com"},social:{title:"Icone dei social media",gap:"Spaziatura"},spacer:{title:"Blocco spaziatore"},text:{title:"Blocco testo",contentLabel:"Contenuto",markdownLabel:"Markdown",doubleClickToEdit:"Fai doppio clic sul blocco nella tela per modificare il contenuto"}}},oP={header:KDe,actions:QDe,border:XDe,shape:JDe,properties:ZDe,inputs:ewe},twe=["en-US","es-419","it-IT"],lP={en:"en-US","en-US":"en-US",es:"es-419","es-419":"es-419",it:"it-IT","it-IT":"it-IT"};function nwe(t){return t?lP[t]??lP[t.split("-")[0]]??"en-US":"en-US"}const Z5={"en-US":{common:nP,inspector:iP},"es-419":{common:rP,inspector:aP},"it-IT":{common:sP,inspector:oP},en:{common:nP,inspector:iP},es:{common:rP,inspector:aP},it:{common:sP,inspector:oP}},iwe=["en-US","es-419","it-IT","en","es","it"];function rwe(){iwe.forEach(t=>{const e=Z5[t];e&&Object.keys(e).forEach(n=>{Yo.hasResourceBundle(t,n)||Yo.addResourceBundle(t,n,e[n],!0,!0)})})}Yo.isInitialized?rwe():Yo.use(Ke.initReactI18next).init({resources:Z5,fallbackLng:"en-US",supportedLngs:[...twe],ns:["common","inspector"],defaultNS:"common",interpolation:{escapeValue:!1},returnNull:!1}).catch(()=>{});const e$="#212443",ld="#4F46E5",Qr="#1F8466",Ba="#E81212",li="#F6DC9F",t$="#6C0E7C",awe="#CC996C",swe='inherit, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',Fe=(t,e)=>{if(!e)try{let n;return t.startsWith("#")?n=G.hexToRgb(t):n=t,n}catch{return"rgb(0, 123, 255)"}try{return t===e$?G.lighten(t,.3):t===t$?G.lighten(t,.4):t===li?G.darken(t,.2):G.lighten(t,.1)}catch{return ld}},ge=G.createTheme({palette:{background:{default:"#F5F5F5",paper:"#FFFFFF"},text:{primary:"#1F1F21",secondary:"#4F4F4F"}},typography:{fontFamily:swe}}),owe=(t=ld,e=ld,n=!1)=>{const i=f=>typeof f=="string"&&f.startsWith("#"),r=i(t)?t:ld,a=i(e)?e:ld,s=Fe(r,n),o=Fe(a,n),l=f=>{try{const h=G.getContrastRatio(f,n?"#000":"#fff")>4.5?n?"#000":"#fff":n?"#fff":"#111";return{main:f,light:G.lighten(f,.2),dark:G.darken(f,.2),contrastText:h}}catch{return ge.palette.primary}},c={default:n?"#121212":"#FFFFFF",paper:n?"#1e1e1e":"#FFFFFF",input:n?"#2c2c2c":"#F9FAFB"},u={primary:n?"#FFFFFF":"#1F1F21",secondary:n?"#CCCCCC":"#4F4F4F",disabled:n?"#FFFFFF":"#BDBDBD"},d={100:n?"#2c2c2c":"#F9FAFB",200:n?"#3c3c3c":"#F2F5F7",300:n?"#4c4c4c":"#DCE4EA",400:n?"#666666":"#A8BBCA",500:n?"#999999":"#6A8BA4"};return G.createTheme(ge,{shape:{borderRadius:8},palette:{mode:n?"dark":"light",background:c,text:u,primary:l(s),secondary:l(o),mainColor:{main:s,light:G.alpha(s,n?.7:.5),dark:G.alpha(s,n?1:.9),contrastText:G.getContrastRatio(s,n?"#000":"#fff")>4.5?n?"#000":"#fff":n?"#fff":"#111"},secondaryColor:{main:o,light:G.alpha(o,n?.7:.5),dark:G.alpha(o,n?1:.9),contrastText:G.getContrastRatio(o,n?"#000":"#fff")>4.5?n?"#000":"#fff":n?"#fff":"#111"},brand:{navy:Fe(e$,n),blue:s,red:Fe(Ba,n),green:Fe(Qr,n),yellow:Fe(li,n),purple:Fe(t$,n),brown:Fe(awe,n)},success:{main:Fe(Qr,n),light:G.lighten(Fe(Qr,n),.15),dark:G.darken(Fe(Qr,n),.15),contrastText:G.getContrastRatio(Fe(Qr,n),n?"#000":"#fff")>4.5?n?"#000":"#fff":n?"#fff":"#111"},error:{main:Fe(Ba,n),light:G.lighten(Fe(Ba,n),.15),dark:G.darken(Fe(Ba,n),.15),contrastText:G.getContrastRatio(Fe(Ba,n),n?"#000":"#fff")>4.5?n?"#000":"#fff":n?"#fff":"#111"},warning:{main:Fe(li,n),light:G.lighten(Fe(li,n),.15),dark:G.darken(Fe(li,n),.15),contrastText:G.getContrastRatio(Fe(li,n),n?"#000":"#fff")>4.5?n?"#000":"#fff":n?"#fff":"#111"},info:{main:s,light:G.lighten(s,.15),dark:G.darken(s,.15),contrastText:G.getContrastRatio(s,n?"#000":"#fff")>4.5?n?"#000":"#fff":n?"#fff":"#111"},cadet:{100:d[100],200:d[200],300:d[300],400:d[400],500:d[500]},highlight:{100:G.lighten(Fe(li,n),n?.6:.8),200:G.lighten(Fe(li,n),n?.4:.6),300:G.lighten(Fe(li,n),n?.2:.4),400:G.lighten(Fe(li,n),n?.1:.2),500:Fe(li,n)},divider:n?"#4a4a4a":"#d0d0d0",grey:{50:n?"#1a1a1a":"#fafafa",100:d[100],200:d[200],300:d[300],400:d[400],500:d[500],600:n?"#cccccc":"#757575",700:n?"#e0e0e0":"#616161",800:n?"#f0f0f0":"#424242",900:n?"#ffffff":"#212121"}},components:{MuiAlert:{styleOverrides:{root:{fontSize:ge.typography.pxToRem(14),"&.MuiAlert-colorWarning":{borderColor:n?"#332f29":"#FFFBEB",backgroundColor:`${n?"#f1be50":"#FEF3C7"} !important`,color:n?"#2f2f2f":"#78350f",borderRadius:"8px","& .MuiAlert-icon":{color:"#78350f"}},"&.MuiAlert-colorError":{borderColor:n?"#4a1f1f":"#FEE2E2",backgroundColor:`${n?"#5b2323":"#FEE2E2"} !important`,color:n?"#ffffff":"#7F1D1D",borderRadius:"8px","& .MuiAlert-icon":{color:n?"#ffffff":"#7F1D1D"},"& .MuiAlert-message":{color:n?"#ffffff":"#7F1D1D"}}},action:{paddingTop:0,marginRight:0},filledSuccess:{backgroundColor:Fe(Qr,n)}}},MuiStepLabel:{styleOverrides:{label:{fontWeight:ge.typography.fontWeightMedium}}},MuiDialog:{defaultProps:{fullWidth:!0}},MuiDialogContent:{styleOverrides:{root:{paddingTop:ge.spacing(1),paddingBottom:ge.spacing(2)}}},MuiDialogTitle:{defaultProps:{variant:"h4"},styleOverrides:{root:{paddingTop:ge.spacing(3),paddingBottom:ge.spacing(1)}}},MuiDialogActions:{styleOverrides:{root:{borderTop:"1px solid",borderTopColor:n?"#3c3c3c":ge.palette.divider,marginTop:ge.spacing(1),padding:`${ge.spacing(1.5)} ${ge.spacing(3)}`}}},MuiSnackbar:{styleOverrides:{root:{position:"absolute",zIndex:9999}}},MuiSnackbarContent:{styleOverrides:{root:{borderRadius:"8px",boxShadow:n?"0 8px 32px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3)":"0 8px 32px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.08)",fontWeight:ge.typography.fontWeightMedium,fontSize:ge.typography.pxToRem(14),minWidth:"288px",maxWidth:"568px",backgroundColor:c.default,color:u.primary,border:`1px solid ${G.alpha(s,n?.3:.2)}`,"&.MuiSnackbarContent-success":{backgroundColor:n?G.alpha(Fe(Qr,n),.15):G.alpha(Fe(Qr,n),.1),color:n?u.primary:Fe(Qr,n),border:`1px solid ${G.alpha(Fe(Qr,n),n?.3:.2)}`},"&.MuiSnackbarContent-error":{backgroundColor:n?G.alpha(Fe(Ba,n),.15):G.alpha(Fe(Ba,n),.1),color:n?u.primary:Fe(Ba,n),border:`1px solid ${G.alpha(Fe(Ba,n),n?.3:.2)}`},"&.MuiSnackbarContent-warning":{backgroundColor:n?G.alpha(Fe(li,n),.15):G.alpha(Fe(li,n),.1),color:n?u.primary:G.darken(Fe(li,n),.6),border:`1px solid ${G.alpha(Fe(li,n),n?.3:.2)}`},"&.MuiSnackbarContent-info":{backgroundColor:n?G.alpha(s,.15):G.alpha(s,.1),color:n?u.primary:s,border:`1px solid ${G.alpha(s,n?.3:.2)}`}},message:{padding:"6px 0",display:"flex",alignItems:"center",gap:ge.spacing(1)},action:{paddingLeft:ge.spacing(2),marginRight:ge.spacing(-1),"& .MuiButton-root":{color:"inherit",fontWeight:ge.typography.fontWeightMedium,textTransform:"none",minWidth:"auto",padding:`${ge.spacing(.5)} ${ge.spacing(1)}`,"&:hover":{backgroundColor:G.alpha(u.primary,n?.08:.04)}},"& .MuiIconButton-root":{color:"inherit",padding:ge.spacing(.5),"&:hover":{backgroundColor:G.alpha(u.primary,n?.08:.04)}}}}},MuiTableCell:{styleOverrides:{root:{...ge.typography.body2,borderColor:d[200],color:u.primary},head:{...ge.typography.overline,fontWeight:ge.typography.fontWeightMedium,letterSpacing:"0.075em",color:u.secondary}}},MuiTableRow:{styleOverrides:{root:{"&:last-child td":{borderBottom:0}}}},MuiAvatar:{styleOverrides:{root:{textTransform:"uppercase",fontSize:ge.typography.pxToRem(14)}}},MuiChip:{styleOverrides:{root:{"&.MuiChip-filledWarning":{backgroundColor:Fe(n?"#d18829":"#bead4a",n),color:"#ffffff","& .MuiChip-icon":{color:"#ffffff"}},"&.MuiChip-filledError":{color:"#ffffff","& .MuiChip-label":{color:"#ffffff"},"& .MuiChip-icon":{color:"#ffffff"}}},"&.MuiChip-colorError .MuiChip-label":{color:"#ffffff"},sizeSmall:{borderRadius:ge.spacing(.5),fontSize:12},iconSmall:{fontSize:14,marginLeft:ge.spacing(1)},colorSecondary:{borderColor:d[400],color:u.primary},label:{fontWeight:ge.typography.fontWeightMedium}}},MuiDrawer:{defaultProps:{PaperProps:{elevation:0}}},MuiTooltip:{styleOverrides:{tooltip:{fontSize:ge.typography.pxToRem(12),backgroundColor:n?G.alpha(d[500],.95):G.alpha("#2c2c2c",.9),color:"#ffffff",border:n?`1px solid ${G.alpha(d[400],.2)}`:`1px solid ${G.alpha("#000000",.1)}`,boxShadow:n?`0px 4px 12px ${G.alpha("#000000",.6)}`:`0px 4px 12px ${G.alpha("#000000",.25)}`,borderRadius:"6px"},arrow:{color:n?G.alpha(d[500],.95):G.alpha("#2c2c2c",.9),"&::before":{border:n?`1px solid ${G.alpha(d[400],.2)}`:`1px solid ${G.alpha("#000000",.1)}`}}}},MuiPaper:{defaultProps:{elevation:0,square:!0},styleOverrides:{root:{backgroundColor:c.paper}}},MuiToggleButton:{styleOverrides:{root:{paddingLeft:ge.spacing(1.5),paddingRight:ge.spacing(1.5),color:u.primary,borderColor:d[300],backgroundColor:"transparent","&:hover":{backgroundColor:d[100],borderColor:d[400],"& .MuiSvgIcon-root":{color:s}},"&.Mui-selected":{color:s,backgroundColor:G.alpha(s,.1),borderColor:s,"&:hover":{backgroundColor:n?G.darken(s,.9):G.lighten(s,.8),borderColor:s,"& .MuiSvgIcon-root":{color:s}}},"&.Mui-disabled":{color:u.disabled,borderColor:d[200]}}}},MuiButtonBase:{defaultProps:{},styleOverrides:{root:{"&:focus":{outline:"none",boxShadow:"none"},"&:focus-visible":{outline:"none",boxShadow:"none"},"&.MuiButton-outlinedIndigo":{border:`2px solid ${s}`,borderRadius:"8px",fontWeight:"bold",padding:"5px 0",color:s,backgroundColor:"transparent","&:hover":{borderWidth:"2px",backgroundColor:G.alpha(s,.05),borderColor:Fe(s,n)},"&:active":{backgroundColor:G.alpha(s,.1)},"&.Mui-disabled":{border:`2px solid ${d[300]}`,color:u.disabled,backgroundColor:"transparent",cursor:"not-allowed"},"&:focus":{outline:"none",boxShadow:"none"}},"&.MuiButton-contained":{borderRadius:"8px",fontWeight:"bold",border:"2px solid transparent",backgroundColor:s,color:u.primary==="#FFFFFF"?"#000000":"#FFFFFF","&:hover":{backgroundColor:Fe(s,n),boxShadow:`0 4px 12px ${G.alpha(s,.3)}`},"&:active":{backgroundColor:n?G.darken(s,.1):G.darken(s,.2)},"&.Mui-disabled":{backgroundColor:d[200],color:u.disabled,border:"2px solid transparent",boxShadow:"none",cursor:"not-allowed"},"&:focus":{outline:"none",boxShadow:"none"}},"&.MuiButton-text.primary":{color:s,fontWeight:"bold","&:hover":{backgroundColor:G.alpha(s,.08),color:Fe(s,n)},"&.Mui-disabled":{color:u.disabled,backgroundColor:"transparent",cursor:"not-allowed"},"&:focus":{outline:"none",boxShadow:"none"}},"&.MuiButton-containedSecondary.Mui-disabled":{backgroundColor:d[200],color:u.disabled,border:"2px solid transparent",boxShadow:"none",cursor:"not-allowed"},"&.MuiButton-outlined.Mui-disabled":{border:`1px solid ${d[300]}`,color:u.disabled,backgroundColor:"transparent",cursor:"not-allowed"},"&.MuiButton-text.Mui-disabled":{color:u.disabled,backgroundColor:"transparent",cursor:"not-allowed"},"&.Mui-disabled":{opacity:n?.5:.6,cursor:"not-allowed","&:hover":{backgroundColor:"inherit",boxShadow:"none",transform:"none",borderColor:"inherit"},"&:active":{backgroundColor:"inherit",transform:"none"},"&:focus":{outline:"none",boxShadow:"none"}}}}},MuiSlider:{styleOverrides:{root:{color:s,height:6,padding:"15px 0","& .MuiSlider-rail":{backgroundColor:d[300],opacity:1,height:2},"& .MuiSlider-track":{backgroundColor:s,height:2,border:"none"},"& .MuiSlider-thumb":{backgroundColor:s,border:`2px solid ${c.paper}`,width:16,height:16,boxShadow:`0 2px 6px ${G.alpha("#000000",.2)}`,"&:hover":{boxShadow:`0 0 0 8px ${G.alpha(s,.16)}`},"&:focus":{boxShadow:`0 0 0 8px ${G.alpha(s,.16)}`},"&.Mui-active":{boxShadow:`0 0 0 14px ${G.alpha(s,.16)}`},"&.Mui-disabled":{backgroundColor:u.disabled,border:`2px solid ${d[200]}`}},"& .MuiSlider-valueLabel":{backgroundColor:n?G.alpha(d[500],.95):G.alpha("#2c2c2c",.9),color:"#ffffff",fontSize:ge.typography.pxToRem(12),borderRadius:"6px",padding:"6px 8px","&::before":{borderTopColor:n?G.alpha(d[500],.95):G.alpha("#2c2c2c",.9)}},"& .MuiSlider-mark":{backgroundColor:G.alpha(s,n?.6:.4),height:6,width:1,"&.MuiSlider-markActive":{backgroundColor:G.alpha(s,n?.9:.7)}},"& .MuiSlider-markLabel":{color:u.secondary,fontSize:ge.typography.pxToRem(12),"&.MuiSlider-markLabelActive":{color:s}}},colorSecondary:{color:o,"& .MuiSlider-track":{backgroundColor:o},"& .MuiSlider-thumb":{backgroundColor:o,"&:hover":{boxShadow:`0 0 0 8px ${G.alpha(o,.16)}`},"&:focus":{boxShadow:`0 0 0 8px ${G.alpha(o,.16)}`},"&.Mui-active":{boxShadow:`0 0 0 14px ${G.alpha(o,.16)}`}}}}},MuiIconButton:{styleOverrides:{root:{borderRadius:"8px",padding:"8px",transition:ge.transitions.create(["background-color","box-shadow","color"],{duration:ge.transitions.duration.short}),"&:hover":{backgroundColor:G.alpha(u.primary,.04)},"&:focus":{outline:"none",boxShadow:"none"},"&.Mui-disabled":{color:u.disabled,backgroundColor:"transparent",cursor:"not-allowed"}},sizeSmall:{padding:"6px",fontSize:ge.typography.pxToRem(18)},sizeMedium:{padding:"8px",fontSize:ge.typography.pxToRem(20)},sizeLarge:{padding:"12px",fontSize:ge.typography.pxToRem(24)},colorPrimary:{color:Fe(s,n),"&:hover":{backgroundColor:G.alpha(s,.08),color:Fe(s,n)},"&:active":{backgroundColor:G.alpha(s,.12)},"&.Mui-disabled":{color:u.disabled},"&:focus":{outline:"none",boxShadow:"none"}},colorSecondary:{color:Fe(o,n),"&:hover":{backgroundColor:G.alpha(o,.08),color:Fe(o,n)},"&:focus":{outline:"none",boxShadow:"none"},"&:active":{backgroundColor:G.alpha(o,.12)},"&.Mui-disabled":{color:u.disabled}},colorError:{color:n?"#f87171":"#dc2626","&:hover":{backgroundColor:G.alpha(n?"#f87171":"#dc2626",.08),color:n?"#fca5a5":"#b91c1c"},"&:focus":{outline:"none",boxShadow:"none"},"&:active":{backgroundColor:G.alpha(n?"#f87171":"#dc2626",.12)},"&.Mui-disabled":{color:u.disabled}},colorWarning:{color:n?"#fbbf24":"#d97706","&:hover":{backgroundColor:G.alpha(n?"#fbbf24":"#d97706",.08),color:n?"#fcd34d":"#b45309"},"&:focus":{outline:"none",boxShadow:"none"},"&:active":{backgroundColor:G.alpha(n?"#fbbf24":"#d97706",.12)},"&.Mui-disabled":{color:u.disabled}},colorInfo:{color:n?"#60a5fa":"#2563eb","&:hover":{backgroundColor:G.alpha(n?"#60a5fa":"#2563eb",.08),color:n?"#93c5fd":"#1d4ed8"},"&:focus":{outline:"none",boxShadow:"none"},"&:active":{backgroundColor:G.alpha(n?"#60a5fa":"#2563eb",.12)},"&.Mui-disabled":{color:u.disabled}},colorSuccess:{color:n?"#4ade80":"#16a34a","&:hover":{backgroundColor:G.alpha(n?"#4ade80":"#16a34a",.08),color:n?"#86efac":"#15803d"},"&:focus":{outline:"none",boxShadow:"none"},"&:active":{backgroundColor:G.alpha(n?"#4ade80":"#16a34a",.12)},"&.Mui-disabled":{color:u.disabled}},colorInherit:{color:u.primary,"&:hover":{backgroundColor:G.alpha(u.primary,.04)},"&:focus":{outline:"none",boxShadow:"none"},"&:active":{backgroundColor:G.alpha(u.primary,.08)},"&.Mui-disabled":{color:u.disabled}},contained:{backgroundColor:c.paper,boxShadow:`0 1px 3px ${G.alpha("#000000",.12)}`,"&:hover":{backgroundColor:d[100],boxShadow:`0 2px 6px ${G.alpha("#000000",.15)}`},"&:focus":{outline:"none",boxShadow:"none"},"&:active":{boxShadow:`0 1px 2px ${G.alpha("#000000",.2)}`},"&.Mui-disabled":{backgroundColor:d[100],boxShadow:"none",color:u.disabled}},edge:{"&.MuiIconButton-edgeStart":{marginLeft:"-12px"},"&.MuiIconButton-edgeEnd":{marginRight:"-12px"}}},variants:[{props:{variant:"soft"},style:{backgroundColor:G.alpha(s,.08),color:Fe(s,n),"&:hover":{backgroundColor:G.alpha(s,.12)},"&:focus":{backgroundColor:G.alpha(s,.12),boxShadow:`0 0 0 2px ${G.alpha(s,.3)}`},"&:active":{backgroundColor:G.alpha(s,.16)}}},{props:{variant:"outlined"},style:{border:`1px solid ${G.alpha(s,.3)}`,color:Fe(s,n),"&:hover":{backgroundColor:G.alpha(s,.04),borderColor:Fe(s,n)},"&:focus":{backgroundColor:G.alpha(s,.04),borderColor:Fe(s,n),boxShadow:`0 0 0 2px ${G.alpha(s,.2)}`},"&:active":{backgroundColor:G.alpha(s,.08)}}}]},MuiButtonGroup:{defaultProps:{disableElevation:!0}},MuiButton:{defaultProps:{disableElevation:!0},styleOverrides:{contained:{"&:hover":{backgroundColor:G.alpha(s,.8)}},textPrimary:{color:u.primary},textSecondary:{color:u.secondary},outlinedPrimary:{borderColor:d[300],color:u.primary,"&:hover, &:active, &:focus":{borderColor:d[500],color:u.primary}},containedSecondary:{backgroundColor:c.paper,border:`1px solid ${d[300]}`,color:u.primary,"&:hover, &:active, &:focus":{backgroundColor:c.paper,borderColor:d[500],color:u.primary}}}},MuiInputBase:{styleOverrides:{root:{"&:not(.Mui-disabled, .Mui-error):before":{borderBottom:`1px solid ${d[400]}`},"&:hover:not(.Mui-disabled, .Mui-error):before":{borderBottom:`1px solid ${d[500]} !important`},"&:after":{borderBottom:`1px solid ${u.primary} !important`},"&.MuiOutlinedInput-root:not(.Mui-error)":{"& fieldset":{borderColor:d[300],transition:"border-color 0.2s"}},"&.MuiOutlinedInput-root:not(.Mui-disabled, .Mui-error)":{"&:hover fieldset":{borderColor:d[400]},"&.Mui-focused fieldset":{borderColor:u.secondary,borderWidth:1}},".MuiSelect-icon":{fill:u.primary}},input:{fontSize:ge.typography.pxToRem(14),color:u.primary,"&.Mui-disabled":{WebkitTextFillColor:"inherit",color:u.secondary}},inputSizeSmall:{padding:"4px 12px !important"}}},MuiOutlinedInput:{styleOverrides:{root:{input:{padding:"8px 12px"}},notchedOutline:{"& legend":{fontSize:"0.85em",maxWidth:"100%"}}}},MuiInputAdornment:{styleOverrides:{root:{"& .MuiTypography-root":{fontSize:ge.typography.pxToRem(14),color:u.secondary}}}},MuiInputLabel:{defaultProps:{shrink:!0},styleOverrides:{shrink:{transform:"scale(0.85)",fontWeight:ge.typography.fontWeightMedium,color:u.secondary,"&.Mui-focused":{color:u.primary},"&.MuiInputLabel-standard":{transform:"translate(0, -4px) scale(0.85)",color:u.secondary},"&.MuiInputLabel-outlined":{transform:"translate(15px, -8px) scale(0.85)"}}}},MuiSelect:{styleOverrides:{root:{"&.MuiSelect-nativeInput":{padding:0}}},defaultProps:{MenuProps:{PaperProps:{sx:{borderRadius:"4px",boxShadow:n?"0 4px 10px rgba(0, 0, 0, 0.6)":"0 4px 10px rgba(0, 0, 0, 0.3)",backgroundColor:c.paper}}}}},MuiTabs:{defaultProps:{variant:"scrollable"},styleOverrides:{indicator:{height:1,backgroundColor:s}}},MuiTab:{styleOverrides:{root:{textTransform:"none",minWidth:ge.spacing(2),paddingLeft:ge.spacing(1.5),paddingRight:ge.spacing(1.5),fontSize:ge.typography.pxToRem(14),fontFamily:ge.typography.fontFamily,lineHeight:1.5,fontWeight:ge.typography.fontWeightMedium,transition:"color 0.2s, stroke 0.2s",stroke:u.secondary,color:u.secondary,"&.Mui-selected":{color:s,stroke:s},"&:hover":{color:G.darken(s,.15),stroke:G.darken(s,.15),backgroundColor:G.alpha(s,.06)}}}},MuiCard:{styleOverrides:{root:{borderRadius:0,backgroundColor:c.paper}}},MuiCardHeader:{styleOverrides:{title:{fontSize:ge.typography.pxToRem(18),fontWeight:ge.typography.fontWeightMedium,color:u.primary}}},MuiStack:{defaultProps:{spacing:2},styleOverrides:{root:{"& > :not(style) ~ :not(style)":{marginTop:"0px !important"}}}}},typography:{fontFamily:ge.typography.fontFamily,h1:{fontFamily:ge.typography.fontFamily,fontSize:ge.typography.pxToRem(40),lineHeight:1.2,letterSpacing:"-0.02em",fontWeight:ge.typography.fontWeightMedium,color:u.primary},h2:{fontFamily:ge.typography.fontFamily,fontSize:ge.typography.pxToRem(32),lineHeight:1.2,letterSpacing:"-0.02em",fontWeight:ge.typography.fontWeightMedium,color:u.primary},h3:{fontFamily:ge.typography.fontFamily,fontSize:ge.typography.pxToRem(24),lineHeight:1.5,letterSpacing:"-0.01em",fontWeight:ge.typography.fontWeightMedium,color:u.primary},h4:{fontFamily:ge.typography.fontFamily,fontSize:ge.typography.pxToRem(20),lineHeight:1.5,letterSpacing:"-0.01em",fontWeight:ge.typography.fontWeightMedium,color:u.primary},h5:{fontFamily:ge.typography.fontFamily,fontSize:ge.typography.pxToRem(18),lineHeight:1.5,letterSpacing:"-0.01em",fontWeight:ge.typography.fontWeightMedium,color:u.primary},h6:{fontFamily:ge.typography.fontFamily,fontSize:ge.typography.pxToRem(16),lineHeight:1.5,letterSpacing:"-0.005em",fontWeight:ge.typography.fontWeightMedium,color:u.primary},body1:{fontSize:ge.typography.pxToRem(14),color:u.primary},body2:{fontSize:ge.typography.pxToRem(12),color:u.primary},overline:{fontWeight:ge.typography.fontWeightMedium,letterSpacing:"0.05em"},button:{textTransform:"none",fontWeight:ge.typography.fontWeightMedium,lineHeight:1.5},caption:{letterSpacing:0,lineHeight:1.5}},shadows:n?["none","0px 4px 15px rgba(0, 0, 0, 0.12), 0px 0px 2px rgba(0, 0, 0, 0.12), 0px 0px 1px rgba(0, 0, 0, 0.12)","0px 10px 20px rgba(0, 0, 0, 0.15), 0px 2px 6px rgba(0, 0, 0, 0.15), 0px 0px 1px rgba(0, 0, 0, 0.15)","0px 16px 24px rgba(0, 0, 0, 0.18), 0px 2px 6px rgba(0, 0, 0, 0.18), 0px 0px 1px rgba(0, 0, 0, 0.18)","0px 24px 32px rgba(0, 0, 0, 0.21), 0px 16px 24px rgba(0, 0, 0, 0.21), 0px 4px 8px rgba(0, 0, 0, 0.21)",...Array(20).fill("none")]:["none","0px 4px 15px rgba(33, 36, 67, 0.04), 0px 0px 2px rgba(33, 36, 67, 0.04), 0px 0px 1px rgba(33, 36, 67, 0.04)","0px 10px 20px rgba(33, 36, 67, 0.04), 0px 2px 6px rgba(33, 36, 67, 0.04), 0px 0px 1px rgba(33, 36, 67, 0.04)","0px 16px 24px rgba(33, 36, 67, 0.05), 0px 2px 6px rgba(33, 36, 67, 0.05), 0px 0px 1px rgba(33, 36, 67, 0.05)","0px 24px 32px rgba(33, 36, 67, 0.06), 0px 16px 24px rgba(33, 36, 67, 0.06), 0px 4px 8px rgba(33, 36, 67, 0.06)",...Array(20).fill("none")]})},jk=v.forwardRef(({primaryColor:t,secondaryColor:e,galleryImages:n,darkMode:i,freeMode:r,height:a,stickyHeader:s,sticky:o,htmlTab:l,jsonTab:c,locale:u,dataLocale:d,imagePlaceholder:p,initialDocument:f,data:h,onSave:_,onAutoSave:g,customImageProvider:b,mergeTags:y,enableAI:E,onAIRequest:S,showVersion:C,componentTree:D=!0},w)=>{const[k,x]=v.useState(t||"#058705"),[O,A]=v.useState(e||"#079707"),[X,P]=v.useState(n||!1),[Y,z]=v.useState($d),F=(()=>{if(typeof window<"u")return window?.emailBuilder?.emailBuilderFreeMode})(),[K,re]=v.useState(F??r??!0),[ke,ue]=v.useState(i??!1),[Ue,Ce]=v.useState(s??!0),[de,pe]=v.useState(o??!1),[Qe,gt]=v.useState(a);v.useImperativeHandle(w,()=>({getDocument:()=>ne.getState().document,setDocument:ee=>{uc(ee)},save:()=>{Dc();const ee=ne.getState().document;return _&&_(ee),ee},getHtml:()=>{const ee=ne.getState().document;return Wh(ee,{rootBlockId:"root"}).props.children},setImageUrl:(ee,Ae)=>{const H=new CustomEvent("email-builder-set-image",{detail:Ae});window.dispatchEvent(H);const Te=ne.getState().document;if(Te[ee]){const Ve={...Te[ee],data:{...Te[ee].data,props:{...Te[ee].data.props,url:Ae}}};ne.setState({document:{...Te,[ee]:Ve}})}}}),[_]),v.useEffect(()=>{const ee=Ae=>{if(g&&Ae.detail){const H=ne.getState().document;g(H)}};return window.addEventListener("email-builder-auto-save",ee),()=>{window.removeEventListener("email-builder-auto-save",ee)}},[g]),v.useEffect(()=>{const ee=Ae=>{if(Ae.detail?.document)try{let H=Ae.detail.document;H=hc(H),C!==void 0&&H.root&&(H={...H,root:{...H.root,data:{...H.root.data,showVersion:C}}}),uc(JSON.parse(JSON.stringify(H)))}catch(H){console.error("Error loading document from custom event:",H)}};return window.addEventListener("email-builder:load-document",ee),()=>{window.removeEventListener("email-builder:load-document",ee)}},[C]),v.useEffect(()=>{const ee=u??d;if(ee){const Ae=nwe(ee);Ae!==Yo.language&&Yo.changeLanguage(Ae).catch(()=>{})}},[u,d]),v.useEffect(()=>{t!==void 0&&x(t)},[t]),v.useEffect(()=>{e!==void 0&&A(e)},[e]),v.useEffect(()=>{n!==void 0&&P(n)},[n]),v.useEffect(()=>{i!==void 0&&ue(i)},[i]),v.useEffect(()=>{r!==void 0&&re(r)},[r]),v.useEffect(()=>{s!==void 0&&Ce(s)},[s]),v.useEffect(()=>{o!==void 0&&pe(o)},[o]),v.useEffect(()=>{a!==void 0&&gt(a)},[a]),v.useEffect(()=>{z(p||$d)},[p]),v.useEffect(()=>(typeof window<"u"&&(window.__emailBuilderCustomImageProvider=b),()=>{typeof window<"u"&&delete window.__emailBuilderCustomImageProvider}),[b]),v.useEffect(()=>(typeof window<"u"&&(window.__emailBuilderCustomMergeTags=y),()=>{typeof window<"u"&&delete window.__emailBuilderCustomMergeTags}),[y]),v.useEffect(()=>(typeof window<"u"&&(E&&(window.__emailBuilderEnableAI=!0),window.__emailBuilderOnAIRequest=S),()=>{typeof window<"u"&&delete window.__emailBuilderOnAIRequest}),[E,S]),v.useEffect(()=>{const ee=h||f;if(ee)try{let Ae;typeof ee=="string"?Ae=JSON.parse(ee):Ae=ee,Ae=hc(Ae),C!==void 0&&Ae.root&&(Ae={...Ae,root:{...Ae.root,data:{...Ae.root.data,showVersion:C}}}),uc(JSON.parse(JSON.stringify(Ae)))}catch(Ae){console.error("Error initializing document:",Ae)}},[]),v.useEffect(()=>{if(h)try{let ee;typeof h=="string"?ee=JSON.parse(h):ee=h,ee=hc(ee),C!==void 0&&ee.root&&(ee={...ee,root:{...ee.root,data:{...ee.root.data,showVersion:C}}}),uc(JSON.parse(JSON.stringify(ee)))}catch(ee){console.error("Error updating document:",ee)}},[h,C]);const Ze=owe(k,O,ke);return m.jsx("div",{style:{position:"relative",width:"100%",height:"100%"},children:m.jsx(Qs.DndProvider,{backend:a$.HTML5Backend,children:m.jsx(T.ThemeProvider,{theme:Ze,children:m.jsxs(Ke.I18nextProvider,{i18n:Yo,children:[m.jsx(T.GlobalStyles,{styles:ee=>({".ce-inline-toolbar, .codex-editor--narrow .ce-toolbox, .ce-conversion-toolbar, .ce-settings, .ce-settings__button, .ce-toolbar__settings-btn:hover, .cdx-button, .ce-popover, .ce-toolbar__plus:hover":{background:ee.palette.primary.main,color:"#fff"},"::selection, .ce-block--selected .ce-block__content":{background:`${ee.palette.secondary.main} !important`},".ce-popover-item:hover":{backgroundColor:`${ee.palette.primary.main} !important`,color:"#fff"},".cdx-settings-button:hover, .ce-settings__button:hover, .ce-toolbox__button--active, .ce-toolbox__button:hover, .cdx-button:hover, .ce-inline-toolbar__dropdown:hover, .ce-inline-tool:hover, .ce-popover__item:hover, .ce-toolbar__settings-btn:hover":{backgroundColor:ee.palette.primary.main,color:"#fff !important"},".tag__title":{color:`${ee.palette.primary.main} !important`},".editor-js-loader":{borderBottomColor:ee.palette.primary.main},".ql-tooltip .ql-action":{background:ee.palette.secondary.main,color:"#fff !important"},".email-builder-body::-webkit-scrollbar-thumb":{background:ee.palette.primary.main},".buttonsUndoRedo":{color:ee.palette.primary.main,transition:"color 0.2s, background-color 0.2s",borderRadius:"8px"},".buttonsUndoRedo:hover":{color:ee.palette.primary.dark,backgroundColor:`${G.alpha(ee.palette.primary.main,.08)}`},".ql-snow .ql-toolbar button.ql-active":{color:ee.palette.primary.main},".lucide-loader-circle":{color:ee.palette.primary.main},".eb-editor-esc-tip":{backgroundColor:ee.palette.secondary.main}})}),m.jsx(T.CssBaseline,{}),m.jsx(SDe,{sticky:de,heightContent:Qe,freeMode:K,darkMode:ke,galleryImages:X,stickyHeader:Ue,htmlTab:l,jsonTab:c,imagePlaceholder:Y,componentTree:D})]})})})})});let Vf=null;function lwe(){return Vf||(Vf=v$(jk,{props:{primaryColor:"string",secondaryColor:"string",galleryImages:"boolean",darkMode:"boolean",freeMode:"boolean",height:"string",stickyHeader:"boolean",sticky:"boolean",htmlTab:"boolean",jsonTab:"boolean",locale:"string",dataLocale:"string",imagePlaceholder:"string",data:"json",showVersion:"boolean",componentTree:"boolean",enableAI:"boolean",mergeTags:"json"}}),Vf)}function n$(t="email-builder"){typeof customElements>"u"||customElements.get(t)||customElements.define(t,lwe())}if(typeof window<"u")try{n$("email-builder")}catch{}exports.EmailBuilder=jk;exports.default=jk;exports.registerEmailBuilder=n$;
439
439
  //# sourceMappingURL=index.cjs.map