useblocks 1.1.102 → 1.1.103
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/iframe/.vite/manifest.json +4 -4
- package/iframe/{iframe-eblock.1c4e77a0.html → iframe-eblock.b65837b7.html} +2 -2
- package/iframe/{iframe.1c4e77a0.html → iframe.b65837b7.html} +2 -2
- package/iframe/js/{discussHandlers.Xh4-JUcT.js → discussHandlers.B36tbVEC.js} +44 -44
- package/iframe/js/{iframe-eblock.body.1c4e77a0.js → iframe-eblock.body.b65837b7.js} +1 -1
- package/iframe/js/iframe-eblock.js +2 -2
- package/iframe/js/{iframe.body.1c4e77a0.js → iframe.body.b65837b7.js} +3 -3
- package/iframe/js/iframe.js +2 -2
- package/package.json +1 -1
- package/runtime/react/index.js +1 -1
- package/static/core/{b7aa9fec.js → 20098caa.js} +1 -1
- package/static/core/{1b68c0f0.js → 29993987.js} +1 -1
- package/static/core/{6a671446.js → 2a85f6f1.js} +1 -1
- package/static/core/{edf450a1.js → 348ec5fd.js} +1 -1
- package/static/core/{26cc947d.js → 3501b0a6.js} +1 -1
- package/static/core/{11b821ed.js → 36448ec6.js} +1 -1
- package/static/core/{5e7c221f.js → 41dd8b28.js} +13 -13
- package/static/core/{44d2c046.js → 47bde21f.js} +1 -1
- package/static/core/{f1ee2bef.js → 50c87f51.js} +1 -1
- package/static/core/{a98b6879.js → 5c36eb62.js} +1 -1
- package/static/core/{f323e60e.js → 5d7aff4e.js} +1 -1
- package/static/core/{5d849eef.js → 63f26591.js} +1 -1
- package/static/core/{3ec42945.js → 68650ff2.js} +1 -1
- package/static/core/{cc180859.js → 69cf8e2c.js} +1 -1
- package/static/core/{ca4dad9b.js → 6b904901.js} +2 -2
- package/static/core/{3fb172c7.js → 8288f720.js} +1 -1
- package/static/core/{91e07171.js → a013bc08.js} +1 -1
- package/static/core/{a2e57e5f.js → aa3448fe.js} +1 -1
- package/static/core/{448f03f8.js → b7d1fefc.js} +1 -1
- package/static/core/{53103851.js → c9a4d1ef.js} +2 -2
- package/static/core/{ae22b7f6.js → d74756b9.js} +1 -1
- package/static/core/{b653f9c5.js → defdbce4.js} +1 -1
- package/static/core/{64be048b.js → ed8a3337.js} +1 -1
- package/static/core/{847338a8.js → f8819751.js} +1 -1
- package/static/core/{d7666ad0.js → fd8197a8.js} +1 -1
- package/static/umd-runtime/{runtime.2paN090q.js → runtime.D3aKaKTc.js} +1 -1
- package/useblocks-core.b65837b7.js +859 -0
- package/useblocks-esm.js +6 -6
- package/{useblocks-po.1c4e77a0.js → useblocks-po.b65837b7.js} +1 -1
- package/useblocks.d.ts +31 -6
- package/useblocks.js +6 -6
- package/vendor/useblocks-ui-kit/package.json +1 -1
- package/useblocks-core.1c4e77a0.js +0 -859
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
(function(){try{if(typeof document<"u"){var r=".blocks-app .form-editor-calendar-panel.panel-form{height:100%;min-height:0;max-height:100%}.blocks-app .form-editor-calendar-panel .panel-form__body.form-editor-calendar-panel__body{-webkit-overflow-scrolling:touch;flex:1;min-width:0;min-height:0;overflow:hidden auto}.blocks-app .form-editor-calendar-panel .panel-form__body-content{box-sizing:border-box;min-height:0}.blocks-app .form-editor-calendar-panel__title{font-size:16px;font-weight:600}.blocks-app .form-editor-calendar-panel__inner{box-sizing:border-box;padding:16px 20px 32px}.blocks-app .form-editor-calendar.ant-form-vertical>.ant-form-item{margin-bottom:20px}.blocks-app .form-editor-calendar__label-with-info{align-items:center;gap:6px;display:inline-flex}.blocks-app .form-editor-calendar__info-icon{color:var(--ub-colorTextSecondary);cursor:help;display:inline-flex}.blocks-app .form-editor-calendar__section-divider{margin:16px 0 20px}.blocks-app .form-editor-calendar__more-btn{margin-bottom:12px}.blocks-app .form-editor-calendar__expanded{flex-direction:column;gap:0;margin-top:8px;display:flex}.blocks-app .form-editor-calendar__expanded>.form-section:first-child>.form-section__header .form-section__title{padding-top:12px}.blocks-app .form-editor-calendar__section.form-section .form-section__body{padding-top:8px;padding-bottom:18px}.blocks-app .form-editor-calendar__bg-preview{align-items:center;gap:12px;margin-top:4px;padding-top:12px;display:flex}.blocks-app .form-editor-calendar__bg-chip{border-radius:calc(var(--ub-borderRadius) * 1px);border:1px solid var(--ub-colorBorderSecondary);justify-content:center;align-items:center;min-width:40px;height:36px;padding:0 10px;line-height:1;display:inline-flex}.blocks-app .form-editor-calendar__bg-chip--active{box-shadow:0 0 0 1px var(--ub-colorPrimaryBg)}.blocks-app .form-editor-calendar__full-width{width:100%}.blocks-app .form-editor-calendar__typography-stack{flex-direction:column;gap:16px;display:flex}.blocks-app .form-editor-calendar .form-border-radius-inputs,.blocks-app .form-editor-calendar .em-form-border-inputs{margin-top:4px}.blocks-app .form-editor-checkbox-panel.panel-form{height:100%;min-height:0;max-height:100%}.blocks-app .form-editor-checkbox-panel .panel-form__body.form-editor-checkbox-panel__body{-webkit-overflow-scrolling:touch;flex:1;min-width:0;min-height:0;overflow:hidden auto}.blocks-app .form-editor-checkbox-panel .panel-form__body-content{box-sizing:border-box;min-height:0}.blocks-app .form-editor-checkbox-panel__title{font-size:16px;font-weight:600}.blocks-app .form-editor-checkbox-panel__inner{box-sizing:border-box;padding:16px 20px 32px}.blocks-app .form-editor-checkbox.ant-form-vertical>.ant-form-item{margin-bottom:20px}.blocks-app .form-editor-checkbox__label-with-info{align-items:center;gap:6px;display:inline-flex}.blocks-app .form-editor-checkbox__info-icon{color:var(--ub-colorTextSecondary);cursor:help;display:inline-flex}.blocks-app .form-editor-checkbox__default-radios.em-radio.ant-radio-group,.blocks-app .form-editor-checkbox__shape-radios.em-radio.ant-radio-group{flex-wrap:wrap;align-items:center;gap:8px 24px;display:flex}.blocks-app .form-editor-checkbox__icon-toggle-group.em-radio.ant-radio-group{flex-wrap:nowrap;gap:6px;display:flex}.blocks-app .form-editor-checkbox__icon-toggle-group .ant-radio-button-wrapper{justify-content:center;align-items:center;min-width:32px;padding-inline:10px;line-height:1;display:inline-flex}.blocks-app .form-editor-checkbox__inner-section-divider{margin:12px 0 16px}.blocks-app .form-editor-checkbox__align-form-item.ant-form-item{margin-bottom:0}.blocks-app .form-editor-checkbox__align-block{margin-top:16px}.blocks-app .form-editor-checkbox__align-columns{flex-wrap:wrap;align-items:flex-start;gap:16px 24px;display:flex}.blocks-app .form-editor-checkbox__align-column{flex:140px;min-width:108px}.blocks-app .form-editor-checkbox__section-divider{margin:16px 0 20px}.blocks-app .form-editor-checkbox__more-btn{margin-bottom:12px}.blocks-app .form-editor-checkbox__bg-preview{flex-direction:column;gap:8px;margin-top:4px;padding-top:8px;display:flex}.blocks-app .form-editor-checkbox__preview-panel{border:1px solid var(--ub-colorBorderSecondary);border-radius:calc(var(--ub-borderRadius) * 1px);box-sizing:border-box;flex-direction:column;gap:6px;padding:10px;display:flex}.blocks-app .form-editor-checkbox__preview-row{box-sizing:border-box;align-items:center;gap:10px;min-height:28px;padding:4px 0;display:flex}.blocks-app .form-editor-checkbox__preview-checkbox{box-sizing:border-box;border-style:solid;border-width:2px;flex-shrink:0;justify-content:center;align-items:center;width:16px;height:16px;display:inline-flex}.blocks-app .form-editor-checkbox__preview-checkbox--round{border-radius:50%}.blocks-app .form-editor-checkbox__preview-checkbox--square{border-radius:2px}.blocks-app .form-editor-checkbox__preview-label{color:var(--ub-colorText);font-size:12px;line-height:1.3}.blocks-app .form-editor-checkbox__section.form-section .form-section__body{padding-top:8px;padding-bottom:18px}.blocks-app .form-editor-checkbox__expanded{flex-direction:column;gap:0;margin-top:8px;display:flex}.blocks-app .form-editor-checkbox__expanded>.form-section:first-child>.form-section__header .form-section__title{padding-top:12px}.blocks-app .form-editor-checkbox__full-width{width:100%}.blocks-app .form-editor-checkbox__micro-label{color:var(--ub-colorTextSecondary);margin-bottom:0;font-size:12px;line-height:1.2;display:block}.blocks-app .form-editor-checkbox .form-border-radius-inputs,.blocks-app .form-editor-checkbox .em-form-border-inputs{margin-top:4px}.blocks-app .form-editor-dropdown-list-panel.panel-form{height:100%;min-height:0;max-height:100%}.blocks-app .form-editor-dropdown-list-panel .panel-form__body.form-editor-dropdown-list-panel__body{-webkit-overflow-scrolling:touch;flex:1;min-width:0;min-height:0;overflow:hidden auto}.blocks-app .form-editor-dropdown-list-panel .panel-form__body-content{box-sizing:border-box;min-height:0}.blocks-app .form-editor-dropdown-list-panel__title{font-size:16px;font-weight:600}.blocks-app .form-editor-dropdown-list-panel__inner{box-sizing:border-box;padding:16px 20px 32px}.blocks-app .form-editor-dropdown.ant-form-vertical>.ant-form-item{margin-bottom:20px}.blocks-app .form-editor-dropdown__section-divider{margin:16px 0 20px}.blocks-app .form-editor-dropdown__more-btn{margin-bottom:12px}.blocks-app .form-editor-dropdown__bg-preview{flex-direction:column;gap:8px;margin-top:4px;padding-top:8px;display:flex}.blocks-app .form-editor-dropdown__trigger-mock{border:1px solid var(--ub-colorBorderSecondary);border-radius:calc(var(--ub-borderRadius) * 1px);box-sizing:border-box;justify-content:space-between;align-items:center;gap:8px;min-height:32px;padding:4px 11px;display:flex}.blocks-app .form-editor-dropdown__trigger-mock-text{min-width:0;color:var(--ub-colorTextQuaternary,var(--ub-colorTextSecondary));text-overflow:ellipsis;white-space:nowrap;flex:1;font-size:12px;line-height:1.3;overflow:hidden}.blocks-app .form-editor-dropdown__trigger-mock-arrow{flex-shrink:0;align-items:center;line-height:0;display:inline-flex}.blocks-app .form-editor-dropdown__list-mock{border:1px solid var(--ub-colorBorderSecondary);border-radius:calc(var(--ub-borderRadius) * 1px);box-sizing:border-box;flex-direction:column;gap:4px;padding:8px 10px;display:flex}.blocks-app .form-editor-dropdown__list-mock-item{color:var(--ub-colorText);font-size:12px;line-height:1.4}.blocks-app .form-editor-dropdown__section.form-section .form-section__body{padding-top:8px;padding-bottom:18px}.blocks-app .form-editor-dropdown__expanded{flex-direction:column;gap:0;margin-top:8px;display:flex}.blocks-app .form-editor-dropdown__expanded>.form-section:first-child>.form-section__header .form-section__title{padding-top:12px}.blocks-app .form-editor-dropdown__full-width{width:100%}.blocks-app .form-editor-dropdown .form-border-radius-inputs,.blocks-app .form-editor-dropdown .em-form-border-inputs{margin-top:4px}.blocks-app .form-editor-input-panel.panel-form{height:100%;min-height:0;max-height:100%}.blocks-app .form-editor-input-panel .panel-form__body.form-editor-input-panel__body{-webkit-overflow-scrolling:touch;flex:1;min-width:0;min-height:0;overflow:hidden auto}.blocks-app .form-editor-input-panel .panel-form__body-content{box-sizing:border-box;min-height:0}.blocks-app .form-editor-input-panel__title{font-size:16px;font-weight:600}.blocks-app .form-editor-input-panel__inner{box-sizing:border-box;padding:16px 20px 32px}.blocks-app .form-editor-input.ant-form-vertical>.ant-form-item{margin-bottom:20px}.blocks-app .form-editor-input__icon-toggle-group.em-radio.ant-radio-group{flex-wrap:nowrap;gap:6px;display:flex}.blocks-app .form-editor-input__icon-toggle-group .ant-radio-button-wrapper{justify-content:center;align-items:center;min-width:32px;padding-inline:10px;line-height:1;display:inline-flex}.blocks-app .form-editor-input__align-form-item.ant-form-item{margin-bottom:0}.blocks-app .form-editor-input__align-columns{flex-wrap:wrap;align-items:flex-start;gap:16px 24px;display:flex}.blocks-app .form-editor-input__align-column{flex:140px;min-width:108px}.blocks-app .form-editor-input__section-divider{margin:16px 0 20px}.blocks-app .form-editor-input__more-btn{margin-bottom:12px}.blocks-app .form-editor-input__bg-preview{margin-top:4px;padding-top:8px}.blocks-app .form-editor-input__preview-panel{border:1px solid var(--ub-colorBorderSecondary);border-radius:calc(var(--ub-borderRadius) * 1px);box-sizing:border-box;padding:10px}.blocks-app .form-editor-input__preview-input{border-radius:calc(var(--ub-borderRadius) * 1px);box-sizing:border-box;text-align:left;border-style:solid;border-width:1px;width:100%;min-height:32px;padding:6px 11px;font-size:14px;line-height:1.4}.blocks-app .form-editor-input__preview-placeholder-bit{opacity:.65}.blocks-app .form-editor-input__section.form-section .form-section__body{padding-top:8px;padding-bottom:18px}.blocks-app .form-editor-input__expanded{flex-direction:column;gap:0;margin-top:8px;display:flex}.blocks-app .form-editor-input__expanded>.form-section:first-child>.form-section__header .form-section__title{padding-top:12px}.blocks-app .form-editor-input__full-width{width:100%}.blocks-app .form-editor-input .form-border-radius-inputs,.blocks-app .form-editor-input .em-form-border-inputs{margin-top:4px}.blocks-app .form-editor-input__padding-row{flex-wrap:wrap;align-items:flex-start;gap:8px;width:100%;display:flex}.blocks-app .form-editor-input__padding-field.ant-form-item{flex:120px;min-width:100px;max-width:calc(50% - 4px);margin-bottom:0}.blocks-app .form-editor-input__padding-link-btn{flex:0 0 32px;justify-content:center;align-items:center;width:32px;height:32px;padding:0;display:inline-flex}.blocks-app .form-editor-input__advanced-block{flex-direction:column;gap:8px;width:100%;display:flex}.blocks-app .form-editor-input__advanced-block+.form-editor-input__advanced-block{margin-top:16px}.blocks-app .form-editor-input__advanced-switch-row{align-items:center;gap:12px;width:100%;padding:6px 0;display:flex}.blocks-app .form-editor-input__advanced-switch-label{color:var(--ub-colorText);flex:auto;min-width:0;margin:0;font-size:14px;line-height:1.3}.blocks-app .form-editor-input__advanced-description{margin:0;font-size:12px;line-height:1.35;display:block}.blocks-app .form-editor-input__visibility-row{flex-wrap:wrap;align-items:center;gap:12px 16px;width:100%;display:flex}.blocks-app .form-editor-input__visibility-form-item.ant-form-item,.blocks-app .form-editor-input__direction-form-item.ant-form-item{margin-bottom:0}.blocks-app .form-editor-input__visibility-segment.ant-radio-group,.blocks-app .form-editor-input__visibility-amp.ant-radio-group{flex-wrap:wrap;gap:6px;display:flex}.blocks-app .form-editor-input__visibility-segment .ant-radio-button-wrapper,.blocks-app .form-editor-input__visibility-amp .ant-radio-button-wrapper{justify-content:center;align-items:center;display:inline-flex}.blocks-app .form-editor-radio-panel.panel-form{height:100%;min-height:0;max-height:100%}.blocks-app .form-editor-radio-panel .panel-form__body.form-editor-radio-panel__body{-webkit-overflow-scrolling:touch;flex:1;min-width:0;min-height:0;overflow:hidden auto}.blocks-app .form-editor-radio-panel .panel-form__body-content{box-sizing:border-box;min-height:0}.blocks-app .form-editor-radio-panel__title{font-size:16px;font-weight:600}.blocks-app .form-editor-radio-panel__inner{box-sizing:border-box;padding:16px 20px 32px}.blocks-app .form-editor-radio.ant-form-vertical>.ant-form-item{margin-bottom:20px}.blocks-app .form-editor-radio__default-radios.em-radio.ant-radio-group,.blocks-app .form-editor-radio__shape-radios.em-radio.ant-radio-group{flex-wrap:wrap;align-items:center;gap:8px 24px;display:flex}.blocks-app .form-editor-radio__icon-toggle-group.em-radio.ant-radio-group{flex-wrap:nowrap;gap:6px;display:flex}.blocks-app .form-editor-radio__icon-toggle-group .ant-radio-button-wrapper{justify-content:center;align-items:center;min-width:32px;padding-inline:10px;line-height:1;display:inline-flex}.blocks-app .form-editor-radio__inner-section-divider{margin:12px 0 16px}.blocks-app .form-editor-radio__position-block,.blocks-app .form-editor-radio__layout-form-item.ant-form-item,.blocks-app .form-editor-radio__align-form-item.ant-form-item{margin-bottom:0}.blocks-app .form-editor-radio__align-block{margin-top:16px}.blocks-app .form-editor-radio__section-divider{margin:16px 0 20px}.blocks-app .form-editor-radio__more-btn{margin-bottom:12px}.blocks-app .form-editor-radio__bg-preview{flex-direction:column;gap:8px;margin-top:4px;padding-top:8px;display:flex}.blocks-app .form-editor-radio__preview-panel{border:1px solid var(--ub-colorBorderSecondary);border-radius:calc(var(--ub-borderRadius) * 1px);box-sizing:border-box;flex-direction:column;gap:6px;padding:10px;display:flex}.blocks-app .form-editor-radio__preview-row{border-radius:calc(var(--ub-borderRadius) * 1px);box-sizing:border-box;align-items:center;gap:10px;min-height:28px;padding:4px 8px;display:flex}.blocks-app .form-editor-radio__preview-dot{border:2px solid var(--ub-colorBorderSecondary);box-sizing:border-box;border-radius:50%;flex-shrink:0;width:14px;height:14px}.blocks-app .form-editor-radio__preview-dot--selected{border-style:solid}.blocks-app .form-editor-radio__preview-label{color:var(--ub-colorText);font-size:12px;line-height:1.3}.blocks-app .form-editor-radio__section.form-section .form-section__body{padding-top:8px;padding-bottom:18px}.blocks-app .form-editor-radio__expanded{flex-direction:column;gap:0;margin-top:8px;display:flex}.blocks-app .form-editor-radio__expanded>.form-section:first-child>.form-section__header .form-section__title{padding-top:12px}.blocks-app .form-editor-radio__full-width{width:100%}.blocks-app .form-editor-radio__micro-label{color:var(--ub-colorTextSecondary);margin-bottom:0;font-size:12px;line-height:1.2;display:block}.blocks-app .form-editor-radio .form-border-radius-inputs,.blocks-app .form-editor-radio .em-form-border-inputs{margin-top:4px}",o=window.__useblocks_styles__||(window.__useblocks_styles__={sheets:{},order:[]}),t=r;if(!o.sheets[t]){var e=null;try{typeof CSSStyleSheet=="function"&&"replaceSync"in CSSStyleSheet.prototype&&(e=new CSSStyleSheet,e.replaceSync(r))}catch{e=null}if(e){if(!o.host||!o.host.isConnected||!o.host.sheet){var i=document.createElement("style");i.setAttribute("data-useblocks","true"),document.head.appendChild(i),o.host=i}for(var d=o.host.sheet,a=0;a<e.cssRules.length;a++)try{d.insertRule(e.cssRules[a].cssText,d.cssRules.length)}catch{}(o.texts||(o.texts=[])).push(r),(o.listeners||[]).forEach(function(p){try{p(r)}catch{}})}else{var i=document.createElement("style");i.setAttribute("data-useblocks","true"),i.appendChild(document.createTextNode(r)),document.head.appendChild(i)}o.sheets[t]=!0,o.order.push(t)}}}catch(p){console.error("vite-plugin-css-injected-by-js",p)}})();
|
|
2
|
-
__useblocks__.define("static/core/c57eb9c3.js",["require","exports","module","static/core/2ff39ddf.js","static/core/d68c5a64.js","static/core/9242dd6e.js","react","react/jsx-runtime","__delivery__/libs","classnames"],function(B,I,De){const J=B("./2ff39ddf.js"),r=B("./d68c5a64.js"),u=B("./9242dd6e.js");let d=B("react");d=J.__toESM(d);let e=B("react/jsx-runtime"),i=B("__delivery__/libs"),Q=B("classnames");Q=J.__toESM(Q);var S=J.__toESM(r.require_prop_types()),h="calendar_",ee=`${h}borderRadiusAll`,N=`${h}borderRadiusTopLeft`,y=`${h}borderRadiusTopRight`,L=`${h}borderRadiusBottomLeft`,w=`${h}borderRadiusBottomRight`,ne="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",he=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function ie({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:he,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}ie.propTypes={namePrefix:S.default.string.isRequired,microLabel:S.default.node.isRequired};function xe(){const t=i.ui_kit$Form.useWatch("inactiveDateBg"),l=i.ui_kit$Form.useWatch("activeDateBg"),a=i.ui_kit$Form.useWatch("inactiveColor"),o=i.ui_kit$Form.useWatch("activeColor"),c=i.ui_kit$Form.useWatch("inactiveFontFamily"),_=i.ui_kit$Form.useWatch("activeFontFamily"),m=i.ui_kit$Form.useWatch("inactiveFontSize"),$=i.ui_kit$Form.useWatch("activeFontSize"),b=i.ui_kit$Form.useWatch("inactiveTextStrong"),g=i.ui_kit$Form.useWatch("activeTextStrong");return(0,e.jsxs)("div",{className:"form-editor-calendar__bg-preview","aria-hidden":!0,children:[(0,e.jsx)("span",{className:"form-editor-calendar__bg-chip",style:{background:t,color:a,fontFamily:c,fontSize:m,fontWeight:b?700:400},children:"31"}),(0,e.jsx)("span",{className:"form-editor-calendar__bg-chip form-editor-calendar__bg-chip--active",style:{background:l,color:o,fontFamily:_,fontSize:$,fontWeight:g?700:400},children:"15"})]})}var ke=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>({placeholder:"",valueMode:void 0,dateFormat:"24h",required:!1,inactiveDateBg:"#ffffff",activeDateBg:"#01bca6",inactiveFontFamily:ne,inactiveFontSize:19,inactiveLineHeight:24,inactiveColor:"#333333",inactiveTextStrong:!1,inactiveTextItalic:!1,inactiveTextStrikethrough:!1,inactiveTextUnderline:!1,activeFontFamily:ne,activeFontSize:19,activeLineHeight:24,activeColor:"#ffffff",activeTextStrong:!0,activeTextItalic:!1,activeTextStrikethrough:!1,activeTextUnderline:!1,[`${h}borderPosition`]:`${h}borderAll`,[`${h}borderAll`]:{width:1,style:"solid",color:"#ffffff"},[`${h}borderTop`]:{...u.NULL_BORDER},[`${h}borderBottom`]:{...u.NULL_BORDER},[`${h}borderRight`]:{...u.NULL_BORDER},[`${h}borderLeft`]:{...u.NULL_BORDER},[ee]:5,[N]:null,[y]:null,[L]:null,[w]:null}),[]),g=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),v=(0,d.useCallback)(()=>{const n=o.getFieldsValue(!0);if(m){const j=n[ee]??0;o.setFieldsValue({[N]:j,[y]:j,[L]:j,[w]:j})}else{const j=n[N];j===n[y]&&j===n[L]&&j===n[w]?o.setFieldsValue({[ee]:j}):o.setFieldsValue({[N]:null,[y]:null,[L]:null,[w]:null})}$(j=>!j)},[o,m]),R=[{value:"24h",label:t("24 hours")},{value:"12h",label:t("12 hours")},{value:"DDMMYYYY",label:"DD.MM.YYYY"},{value:"YYYYMMDD",label:"YYYY-MM-DD"}],C=[{value:"empty",label:t("Enter value")},{value:"today",label:t("Today")},{value:"custom",label:t("Custom")}],T=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),s=(0,e.jsx)("div",{className:"form-editor-calendar-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-calendar",autoComplete:"off",initialValues:b,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"placeholder",label:t("Placeholder"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text visible at the start"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"valueMode",label:(0,e.jsxs)("span",{className:"form-editor-calendar__label-with-info",children:[t("Value"),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Default or bound value for the field"),children:(0,e.jsx)("span",{className:"form-editor-calendar__info-icon",children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"InfoCircleOutlined",component:i.icons$InfoCircleOutlined,size:16})})})]}),children:(0,e.jsx)(i.ui_kit$Select,{className:"form-editor-calendar__full-width",placeholder:t("Enter value"),options:C,allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"dateFormat",label:t("Date format"),children:(0,e.jsx)(i.ui_kit$Select,{className:"form-editor-calendar__full-width",options:R})}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Required field")}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-calendar__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-calendar__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(n=>!n),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-calendar__expanded",children:[(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-calendar__section",title:t("Background"),children:(0,e.jsxs)(i.ui_kit$Space,{orientation:"vertical",size:20,className:"form-editor-calendar__full-width",children:[(0,e.jsx)(i.ui_kit$FormColorField,{name:"inactiveDateBg",label:t("Inactive date background color")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"activeDateBg",label:t("Active date background color")}),(0,e.jsx)(xe,{})]})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-calendar__section",title:t("Input field text"),children:(0,e.jsxs)("div",{className:"form-editor-calendar__typography-stack",children:[(0,e.jsx)(ie,{namePrefix:"inactive",microLabel:t("Inactive date font")}),(0,e.jsx)(ie,{namePrefix:"active",microLabel:t("Active date font")})]})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-calendar__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:h,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:v,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-calendar__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:h})})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-calendar-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:g,closeIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Close",component:i.icons$Close,size:24,strokeWidth:a.iconStrokeWidth}),extra:T,children:(0,e.jsx)(i.ui_kit$PanelForm.HeaderTitle,{className:"form-editor-calendar-panel__title",children:t("Calendar")})}),(0,e.jsx)(i.ui_kit$PanelForm.Body,{className:"form-editor-calendar-panel__body",padding:{horizontal:0,vertical:0},children:s})]})},x="checkbox_",te=`${x}borderRadiusAll`,O=`${x}borderRadiusTopLeft`,E=`${x}borderRadiusTopRight`,A=`${x}borderRadiusBottomLeft`,P=`${x}borderRadiusBottomRight`,fe="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",ae=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function se({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:ae,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}se.propTypes={namePrefix:S.default.string.isRequired,microLabel:S.default.node.isRequired};function $e(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("markerShape"),a=i.ui_kit$Form.useWatch("appearanceBackground"),o=i.ui_kit$Form.useWatch("appearanceStrokeColor"),c=i.ui_kit$Form.useWatch("appearanceCheckColor"),_=i.ui_kit$Form.useWatch("useCustomCheckIcon"),m=(0,Q.default)("form-editor-checkbox__preview-checkbox",l==="round"&&"form-editor-checkbox__preview-checkbox--round",l==="square"&&"form-editor-checkbox__preview-checkbox--square");return(0,e.jsx)("div",{className:"form-editor-checkbox__bg-preview","aria-hidden":!0,children:(0,e.jsxs)("div",{className:"form-editor-checkbox__preview-panel",children:[(0,e.jsxs)("div",{className:"form-editor-checkbox__preview-row",children:[(0,e.jsx)("span",{className:m,style:{borderColor:o,background:c},children:!_&&(0,e.jsx)(i.ui_kit$EmIcons,{icon:"CheckOutlined",component:i.icons$CheckOutlined,size:10,style:{color:"#ffffff"}})}),(0,e.jsx)("span",{className:"form-editor-checkbox__preview-label",children:t("Checked")})]}),(0,e.jsxs)("div",{className:"form-editor-checkbox__preview-row",children:[(0,e.jsx)("span",{className:m,style:{borderColor:o,background:a}}),(0,e.jsx)("span",{className:"form-editor-checkbox__preview-label",children:t("Unchecked")})]})]})})}function be(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("useCustomCheckIcon");return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"markerShape",label:t("Marker shape"),children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-checkbox__shape-radios",children:[(0,e.jsx)(i.ui_kit$Radio,{value:"round",children:t("Round")}),(0,e.jsx)(i.ui_kit$Radio,{value:"square",children:t("Square")})]})}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-checkbox__inner-section-divider"}),(0,e.jsxs)(i.ui_kit$Space,{orientation:"vertical",size:16,className:"form-editor-checkbox__full-width",children:[(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceBackground",label:t("Background color")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceStrokeColor",label:t("Stroke color")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceCheckColor",label:t("Checked fill color")})]}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"useCustomCheckIcon",label:t("Use custom icon for checked state")}),l&&(0,e.jsx)(i.ui_kit$Form.Item,{name:"customCheckIconUrl",label:t("Checked icon URL"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:"https://",allowClear:!0})}),(0,e.jsx)($e,{})]})}function ge(){const{__:t}=r.useI18n(),l=r.useAppConfig().iconStrokeWidth;return(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-checkbox__section",title:t("Position in cell"),children:(0,e.jsxs)("div",{className:"form-editor-checkbox__align-columns",children:[(0,e.jsxs)("div",{className:"form-editor-checkbox__align-column",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-checkbox__micro-label",children:t("Horizontal alignment")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"alignHorizontal",className:"form-editor-checkbox__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-checkbox__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"left",title:t("Align left"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignLeftOutlined",component:i.icons$AlignLeftOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"center",title:t("Align center"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignCenterOutlined",component:i.icons$AlignCenterOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"right",title:t("Align right"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignRightOutlined",component:i.icons$AlignRightOutlined,size:16,strokeWidth:l})})]})})]}),(0,e.jsxs)("div",{className:"form-editor-checkbox__align-column",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-checkbox__micro-label",children:t("Vertical alignment")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"alignVertical",className:"form-editor-checkbox__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-checkbox__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"top",title:t("Align top"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalTop",component:i.icons$AlignVerticalTop,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"middle",title:t("Align middle"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalCenter",component:i.icons$AlignVerticalCenter,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"bottom",title:t("Align bottom"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalBottom",component:i.icons$AlignVerticalBottom,size:16,strokeWidth:l})})]})})]})]})})}function je(){const{__:t}=r.useI18n();return i.ui_kit$Form.useWatch("showHelperText")?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"helperText",label:t("Helper text"),children:(0,e.jsx)(i.ui_kit$Input.TextArea,{rows:2,placeholder:t("Tooltip or hint text"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"validationErrorText",label:t("Validation error message"),children:(0,e.jsx)(i.ui_kit$Input.TextArea,{rows:2,placeholder:t("Message when validation fails"),allowClear:!0})})]}):null}var Fe=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>[{value:"v1",label:`${t("Value")} 1`},{value:"v2",label:`${t("Value")} 2`},{value:"custom",label:t("Custom")}],[t]),g=(0,d.useMemo)(()=>({fieldHeading:"",boundValue:void 0,checkboxLabel:"",required:!1,defaultState:"disabled",showHelperText:!1,helperText:"",validationErrorText:"",alignHorizontal:"left",alignVertical:"top",markerShape:"square",appearanceBackground:"#ffffff",appearanceStrokeColor:"#d9d9d9",appearanceCheckColor:"#01bca6",useCustomCheckIcon:!1,customCheckIconUrl:"",labelTextFontFamily:fe,labelTextFontSize:19,labelTextLineHeight:24,labelTextColor:"#333333",labelTextStrong:!1,labelTextItalic:!1,labelTextStrikethrough:!1,labelTextUnderline:!1,[`${x}borderPosition`]:`${x}borderAll`,[`${x}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${x}borderTop`]:{...u.NULL_BORDER},[`${x}borderBottom`]:{...u.NULL_BORDER},[`${x}borderRight`]:{...u.NULL_BORDER},[`${x}borderLeft`]:{...u.NULL_BORDER},[te]:5,[O]:null,[E]:null,[A]:null,[P]:null}),[]),v=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),R=(0,d.useCallback)(()=>{const s=o.getFieldsValue(!0);if(m){const n=s[te]??0;o.setFieldsValue({[O]:n,[E]:n,[A]:n,[P]:n})}else{const n=s[O];n===s[E]&&n===s[A]&&n===s[P]?o.setFieldsValue({[te]:n}):o.setFieldsValue({[O]:null,[E]:null,[A]:null,[P]:null})}$(n=>!n)},[o,m]),C=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),T=(0,e.jsx)("div",{className:"form-editor-checkbox-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-checkbox",autoComplete:"off",initialValues:g,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldHeading",label:t("Field heading"),children:(0,e.jsx)(i.ui_kit$Input.TextArea,{rows:2,placeholder:t("Title shown above the control"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"boundValue",label:(0,e.jsxs)("span",{className:"form-editor-checkbox__label-with-info",children:[t("Value"),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Stored or bound value for this field"),children:(0,e.jsx)("span",{className:"form-editor-checkbox__info-icon",children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"InfoCircleOutlined",component:i.icons$InfoCircleOutlined,size:12})})})]}),children:(0,e.jsx)(i.ui_kit$Select,{className:"form-editor-checkbox__full-width",placeholder:t("Enter value"),options:b,allowClear:!0,getPopupContainer:ae})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"checkboxLabel",label:t("Label next to checkbox"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text beside the box"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Required field")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"defaultState",label:t("Default value"),children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-checkbox__default-radios",children:[(0,e.jsx)(i.ui_kit$Radio,{value:"enabled",children:t("Enabled")}),(0,e.jsx)(i.ui_kit$Radio,{value:"disabled",children:t("Disabled")})]})}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"showHelperText",label:t("Helper text / tooltip")}),(0,e.jsx)(je,{}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-checkbox__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-checkbox__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(s=>!s),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-checkbox__expanded",children:[(0,e.jsx)(ge,{}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-checkbox__section",title:t("Appearance"),children:(0,e.jsx)(be,{})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-checkbox__section",title:t("Label text style"),children:(0,e.jsx)(se,{namePrefix:"labelText",microLabel:t("Caption next to checkbox")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-checkbox__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:x,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:R,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-checkbox__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:x})})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-checkbox-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:v,closeIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Close",component:i.icons$Close,size:24,strokeWidth:a.iconStrokeWidth}),extra:C,children:(0,e.jsx)(i.ui_kit$PanelForm.HeaderTitle,{className:"form-editor-checkbox-panel__title",children:t("Checkbox")})}),(0,e.jsx)(i.ui_kit$PanelForm.Body,{className:"form-editor-checkbox-panel__body",padding:{horizontal:0,vertical:0},children:T})]})},k="dropdown_",oe=`${k}borderRadiusAll`,D=`${k}borderRadiusTopLeft`,V=`${k}borderRadiusTopRight`,z=`${k}borderRadiusBottomLeft`,W=`${k}borderRadiusBottomRight`,ve="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",ce=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function de({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:ce,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}de.propTypes={namePrefix:S.default.string.isRequired,microLabel:S.default.node.isRequired};function Re(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("triggerBackground"),a=i.ui_kit$Form.useWatch("listPanelBackground"),o=i.ui_kit$Form.useWatch("arrowColor");return(0,e.jsxs)("div",{className:"form-editor-dropdown__bg-preview","aria-hidden":!0,children:[(0,e.jsxs)("div",{className:"form-editor-dropdown__trigger-mock",style:{background:l},children:[(0,e.jsx)("span",{className:"form-editor-dropdown__trigger-mock-text",children:t("Text visible at the start")}),(0,e.jsx)("span",{className:"form-editor-dropdown__trigger-mock-arrow",style:{color:o},children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DownOutlined",component:i.icons$DownOutlined,size:14})})]}),(0,e.jsxs)("div",{className:"form-editor-dropdown__list-mock",style:{background:a},children:[(0,e.jsxs)("span",{className:"form-editor-dropdown__list-mock-item",children:[t("Value")," 1"]}),(0,e.jsxs)("span",{className:"form-editor-dropdown__list-mock-item",children:[t("Value")," 2"]})]})]})}var Ce=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>[{value:"v1",label:`${t("Value")} 1`},{value:"v2",label:`${t("Value")} 2`},{value:"custom",label:t("Custom")}],[t]),g=(0,d.useMemo)(()=>({placeholder:"",options:[{title:"",boundValue:void 0},{title:"",boundValue:void 0}],allowMultiple:!1,required:!1,triggerBackground:"#ffffff",listPanelBackground:"#ffffff",arrowColor:"rgba(0, 0, 0, 0.45)",listTextFontFamily:ve,listTextFontSize:14,listTextLineHeight:22,listTextColor:"#333333",listTextStrong:!1,listTextItalic:!1,listTextStrikethrough:!1,listTextUnderline:!1,[`${k}borderPosition`]:`${k}borderAll`,[`${k}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${k}borderTop`]:{...u.NULL_BORDER},[`${k}borderBottom`]:{...u.NULL_BORDER},[`${k}borderRight`]:{...u.NULL_BORDER},[`${k}borderLeft`]:{...u.NULL_BORDER},[oe]:5,[D]:null,[V]:null,[z]:null,[W]:null}),[]),v=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),R=(0,d.useCallback)(()=>{const s=o.getFieldsValue(!0);if(m){const n=s[oe]??0;o.setFieldsValue({[D]:n,[V]:n,[z]:n,[W]:n})}else{const n=s[D];n===s[V]&&n===s[z]&&n===s[W]?o.setFieldsValue({[oe]:n}):o.setFieldsValue({[D]:null,[V]:null,[z]:null,[W]:null})}$(n=>!n)},[o,m]),C=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),T=(0,e.jsx)("div",{className:"form-editor-dropdown-list-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-dropdown",autoComplete:"off",initialValues:g,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"placeholder",label:t("Placeholder"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text visible at the start"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$FormOptionsList,{name:"options",boundValueOptions:b,getPopupContainer:ce,labels:{itemTitle:s=>`${t("Value")} ${s}`,headingLabel:t("Heading"),valueLabel:t("Value"),valueTooltip:t("Stored or bound value for this option"),addLabel:t("Add value"),removeTooltip:t("Remove"),headingPlaceholder:t("Enter heading"),valuePlaceholder:t("Enter value")}}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"allowMultiple",label:t("Allow multiple selection")}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Required field")}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-dropdown__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-dropdown__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(s=>!s),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-dropdown__expanded",children:[(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-dropdown__section",title:t("Background"),children:(0,e.jsxs)(i.ui_kit$Space,{orientation:"vertical",size:20,className:"form-editor-dropdown__full-width",children:[(0,e.jsx)(i.ui_kit$FormColorField,{name:"triggerBackground",label:t("Closed field background")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"listPanelBackground",label:t("List panel background")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"arrowColor",label:t("Arrow color")}),(0,e.jsx)(Re,{})]})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-dropdown__section",title:t("List text style"),children:(0,e.jsx)(de,{namePrefix:"listText",microLabel:t("List item appearance")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-dropdown__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:k,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:R,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-dropdown__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:k})})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-dropdown-list-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:v,closeIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Close",component:i.icons$Close,size:24,strokeWidth:a.iconStrokeWidth}),extra:C,children:(0,e.jsx)(i.ui_kit$PanelForm.HeaderTitle,{className:"form-editor-dropdown-list-panel__title",children:t("Dropdown list")})}),(0,e.jsx)(i.ui_kit$PanelForm.Body,{className:"form-editor-dropdown-list-panel__body",padding:{horizontal:0,vertical:0},children:T})]})},F={TEXT:"text",EMAIL:"email",PHONE:"phone",NAME:"name",URL:"url",PASSWORD:"password"},p="inputField_",le=`${p}borderRadiusAll`,U=`${p}borderRadiusTopLeft`,H=`${p}borderRadiusTopRight`,M=`${p}borderRadiusBottomLeft`,q=`${p}borderRadiusBottomRight`,ue="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",G=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function me({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:G,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}function Te(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("fieldBackground"),a=i.ui_kit$Form.useWatch(`${p}borderAll`),o=i.ui_kit$Form.useWatch("placeholderTextColor"),c=i.ui_kit$Form.useWatch("inputValueTextColor"),_=a?.color??"#d9d9d9";return(0,e.jsx)("div",{className:"form-editor-input__bg-preview","aria-hidden":!0,children:(0,e.jsx)("div",{className:"form-editor-input__preview-panel",children:(0,e.jsxs)("div",{className:"form-editor-input__preview-input",style:{background:l,borderColor:_,color:c},children:[(0,e.jsx)("span",{className:"form-editor-input__preview-placeholder-bit",style:{color:o},children:t("Placeholder")}),(0,e.jsx)("span",{children:" · "}),(0,e.jsx)("span",{children:t("Value")})]})})})}function Se(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useFormInstance(),a=(0,d.useCallback)(()=>{const o=l.getFieldValue("paddingHorizontal");o!=null&&o!==""&&l.setFieldValue("fieldMinHeight",o)},[l]);return(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Internal padding"),children:(0,e.jsxs)("div",{className:"form-editor-input__padding-row",children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"paddingHorizontal",className:"form-editor-input__padding-field",children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:200,placeholder:"0",prefix:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ColumnWidthOutlined",component:i.icons$ColumnWidthOutlined}),addonAfter:"px"})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldMinHeight",className:"form-editor-input__padding-field",children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:200,placeholder:t("Height"),prefix:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ColumnHeightOutlined",component:i.icons$ColumnHeightOutlined}),addonAfter:"px"})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Apply horizontal padding to height"),children:(0,e.jsx)(i.ui_kit$Button,{type:"default",className:"form-editor-input__padding-link-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"BorderOuterOutlined",component:i.icons$BorderOuterOutlined,size:16}),onClick:a})})]})})}function Be(){const{__:t}=r.useI18n();return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"form-editor-input__advanced-block",children:[(0,e.jsxs)("div",{className:"form-editor-input__advanced-switch-row",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{className:"form-editor-input__advanced-switch-label",children:t("Field state appearance")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"customStylesForStates",valuePropName:"checked",noStyle:!0,children:(0,e.jsx)(i.ui_kit$Switch,{})})]}),(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-input__advanced-description",children:t("Use your own styles instead of defaults for states such as error, focus, and success.")})]}),(0,e.jsxs)("div",{className:"form-editor-input__advanced-block",children:[(0,e.jsxs)("div",{className:"form-editor-input__advanced-switch-row",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{className:"form-editor-input__advanced-switch-label",children:t("High contrast mode")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"highContrastMode",valuePropName:"checked",noStyle:!0,children:(0,e.jsx)(i.ui_kit$Switch,{})})]}),(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-input__advanced-description",children:t("Improves visibility by automatically tuning the form for accessibility. Turn off to restore the previous look.")})]})]})}function Ie(){const{__:t}=r.useI18n(),l=r.useAppConfig().iconStrokeWidth;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Visibility"),children:(0,e.jsxs)("div",{className:"form-editor-input__visibility-row",children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldVisibility",className:"form-editor-input__visibility-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-input__visibility-segment",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"always",children:t("Always")}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"desktop",title:t("Desktop"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DesktopOutlined",component:i.icons$DesktopOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"mobile",title:t("Mobile"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"MobileOutlined",component:i.icons$MobileOutlined,size:16,strokeWidth:l})})]})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldDirection",className:"form-editor-input__direction-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-input__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"ltr",title:t("Left to right"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ArrowLeftOutlined",component:i.icons$ArrowLeftOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"rtl",title:t("Right to left"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ArrowRightOutlined",component:i.icons$ArrowRightOutlined,size:16,strokeWidth:l})})]})})]})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Visibility in AMP"),children:(0,e.jsx)(i.ui_kit$Form.Item,{name:"ampVisibility",className:"form-editor-input__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-input__visibility-amp",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"always",children:t("Always")}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"amp",children:"AMP"}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"html",children:"HTML"})]})})})]})}function Ne(){const{__:t}=r.useI18n();return i.ui_kit$Form.useWatch("limitLength")?(0,e.jsx)(i.ui_kit$Form.Item,{name:"maxLength",label:t("Maximum length"),children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:1,max:9999,placeholder:t("Characters"),addonAfter:t("chars")})}):null}function ye(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("inputType"),a=(0,d.useMemo)(()=>[{value:"minLength8",label:t("Minimum length 8 characters")},{value:"lowercase",label:t("Lowercase letters (a-z)")},{value:"uppercase",label:t("Uppercase letters (A-Z)")},{value:"digits",label:t("Digits (0-9)")},{value:"special",label:t("Special characters")}],[t]),o=(0,d.useMemo)(()=>[{value:"https",label:"HTTPS"},{value:"http",label:"HTTP"},{value:"mailto",label:"mailto:"},{value:"ftp",label:"FTP"}],[]);return l?(0,e.jsxs)(e.Fragment,{children:[l===F.TEXT&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"limitLength",label:t("Character limit")}),(0,e.jsx)(Ne,{})]}),l===F.PHONE&&(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"countryCodeSelector",label:t("Country selector (flag+code)")}),l===F.URL&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"urlAutoPrependProtocol",label:t("Auto-prepend protocol on blur")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"allowedProtocols",label:t("Allowed protocols"),children:(0,e.jsx)(i.ui_kit$Select,{mode:"multiple",className:"form-editor-input__full-width",placeholder:t("Choose allowed protocols"),options:o,getPopupContainer:G,allowClear:!0})})]}),l===F.PASSWORD&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"showPasswordEye",label:t("Show eye icon")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"passwordComplexityRules",label:t("Complexity rules"),children:(0,e.jsx)(i.ui_kit$Select,{mode:"multiple",className:"form-editor-input__full-width",placeholder:t("Choose complexity rules"),options:a,getPopupContainer:G,allowClear:!0})})]})]}):null}var Le=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>[{value:F.TEXT,label:t("Text")},{value:F.EMAIL,label:t("Email")},{value:F.PHONE,label:t("Phone number")},{value:F.NAME,label:t("Name")},{value:F.URL,label:t("URL")},{value:F.PASSWORD,label:t("Password")}],[t]),g=(0,d.useMemo)(()=>({placeholder:"",required:!1,limitLength:!1,maxLength:100,hintText:"",countryCodeSelector:!1,urlAutoPrependProtocol:!1,allowedProtocols:[],showPasswordEye:!1,passwordComplexityRules:[],paddingHorizontal:16,customStylesForStates:!1,highContrastMode:!1,fieldVisibility:"always",fieldDirection:"ltr",ampVisibility:"always",fieldBackground:"#ffffff",inputValueTextFontFamily:ue,inputValueTextFontSize:14,inputValueTextLineHeight:22,inputValueTextColor:"#333333",inputValueTextStrong:!1,inputValueTextItalic:!1,inputValueTextStrikethrough:!1,inputValueTextUnderline:!1,placeholderTextFontFamily:ue,placeholderTextFontSize:14,placeholderTextLineHeight:22,placeholderTextColor:"rgba(0, 0, 0, 0.25)",placeholderTextStrong:!1,placeholderTextItalic:!1,placeholderTextStrikethrough:!1,placeholderTextUnderline:!1,[`${p}borderPosition`]:`${p}borderAll`,[`${p}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${p}borderTop`]:{...u.NULL_BORDER},[`${p}borderBottom`]:{...u.NULL_BORDER},[`${p}borderRight`]:{...u.NULL_BORDER},[`${p}borderLeft`]:{...u.NULL_BORDER},[le]:5,[U]:null,[H]:null,[M]:null,[q]:null}),[]),v=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),R=(0,d.useCallback)(()=>{const s=o.getFieldsValue(!0);if(m){const n=s[le]??0;o.setFieldsValue({[U]:n,[H]:n,[M]:n,[q]:n})}else{const n=s[U];n===s[H]&&n===s[M]&&n===s[q]?o.setFieldsValue({[le]:n}):o.setFieldsValue({[U]:null,[H]:null,[M]:null,[q]:null})}$(n=>!n)},[o,m]),C=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),T=(0,e.jsx)("div",{className:"form-editor-input-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-input",autoComplete:"off",initialValues:g,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"inputType",label:t("Type"),children:(0,e.jsx)(i.ui_kit$Select,{className:"form-editor-input__full-width",placeholder:t("Choose input type"),options:b,allowClear:!0,getPopupContainer:G})}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Field required")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"placeholder",label:t("Placeholder"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text visible at the start"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"hintText",label:t("Hint text"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Come up with a hint"),allowClear:!0})}),(0,e.jsx)(ye,{}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-input__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-input__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(s=>!s),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-input__expanded",children:[(0,e.jsx)(Se,{}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Size"),collapsible:!0,defaultOpen:!1,children:(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldMaxWidth",label:t("Max width"),children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:2e3,placeholder:t("Not set"),addonAfter:"px"})})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Background"),children:(0,e.jsx)(i.ui_kit$FormColorField,{name:"fieldBackground",label:t("Background color")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Input field text"),children:(0,e.jsx)(me,{namePrefix:"inputValueText",microLabel:t("Font")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Placeholder text"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(me,{namePrefix:"placeholderText",microLabel:t("Font")})}),(0,e.jsx)(Te,{}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:p,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:R,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:p})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Accessibility"),children:(0,e.jsx)(Be,{})}),(0,e.jsx)(Ie,{})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-input-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:v,closeIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Close",component:i.icons$Close,size:24,strokeWidth:a.iconStrokeWidth}),extra:C,children:(0,e.jsx)(i.ui_kit$PanelForm.HeaderTitle,{className:"form-editor-input-panel__title",children:t("Input")})}),(0,e.jsx)(i.ui_kit$PanelForm.Body,{className:"form-editor-input-panel__body",padding:{horizontal:0,vertical:0},children:T})]})},f="radio_",re=`${f}borderRadiusAll`,Y=`${f}borderRadiusTopLeft`,X=`${f}borderRadiusTopRight`,K=`${f}borderRadiusBottomLeft`,Z=`${f}borderRadiusBottomRight`,we="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",pe=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function _e({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:pe,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}_e.propTypes={namePrefix:S.default.string.isRequired,microLabel:S.default.node.isRequired};function Oe(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("appearanceBackground"),a=i.ui_kit$Form.useWatch("appearanceStrokeColor"),o=i.ui_kit$Form.useWatch("appearanceDotColor");return(0,e.jsx)("div",{className:"form-editor-radio__bg-preview","aria-hidden":!0,children:(0,e.jsxs)("div",{className:"form-editor-radio__preview-panel",children:[(0,e.jsxs)("div",{className:"form-editor-radio__preview-row",style:{background:l},children:[(0,e.jsx)("span",{className:"form-editor-radio__preview-dot form-editor-radio__preview-dot--selected",style:{borderColor:a,background:o}}),(0,e.jsxs)("span",{className:"form-editor-radio__preview-label",children:[t("Value")," 1"]})]}),(0,e.jsxs)("div",{className:"form-editor-radio__preview-row",style:{background:l},children:[(0,e.jsx)("span",{className:"form-editor-radio__preview-dot",style:{borderColor:a,background:"transparent"}}),(0,e.jsxs)("span",{className:"form-editor-radio__preview-label",children:[t("Value")," 2"]})]})]})})}function Ee(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("markerShape");return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"markerShape",label:t("Marker shape"),children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-radio__shape-radios",children:[(0,e.jsx)(i.ui_kit$Radio,{value:"round",children:t("Round")}),(0,e.jsx)(i.ui_kit$Radio,{value:"custom",children:t("Custom icon")})]})}),l==="custom"&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"customIconUrl",label:t("Icon URL"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:"https://",allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"customIconAlt",label:t("Icon description"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Accessibility text"),allowClear:!0})})]}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-radio__inner-section-divider"}),(0,e.jsxs)(i.ui_kit$Space,{orientation:"vertical",size:16,className:"form-editor-radio__full-width",children:[(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceBackground",label:t("Background color")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceStrokeColor",label:t("Stroke color")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceDotColor",label:t("Dot color")})]}),(0,e.jsx)(Oe,{})]})}function Ae(){const{__:t}=r.useI18n(),l=r.useAppConfig().iconStrokeWidth;return(0,e.jsxs)(i.ui_kit$FormSection,{className:"form-editor-radio__section",title:t("Position in cell"),children:[(0,e.jsxs)(i.ui_kit$Row,{gutter:[12,16],className:"form-editor-radio__position-block",children:[(0,e.jsxs)(i.ui_kit$Col,{xs:24,sm:10,md:9,children:[(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-radio__micro-label",children:t("Layout")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"radioLayout",className:"form-editor-radio__layout-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-radio__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"horizontal",title:t("Horizontal"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"MenuOutlined",component:i.icons$MenuOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"vertical",title:t("Vertical"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Column",component:i.icons$Column,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"grid",title:t("Grid"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Grid01Icon",component:i.icons$Grid01Icon,size:16,strokeWidth:l})})]})})]}),(0,e.jsx)(i.ui_kit$Col,{xs:24,sm:14,md:15,children:(0,e.jsx)(i.ui_kit$Form.Item,{name:"radioOptionGap",label:t("Spacing"),children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:120,placeholder:t("Spacing"),addonAfter:"px"})})})]}),(0,e.jsxs)("div",{className:"form-editor-radio__align-block",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-radio__micro-label",children:t("Horizontal alignment")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"alignHorizontal",className:"form-editor-radio__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-radio__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"left",title:t("Align left"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignLeftOutlined",component:i.icons$AlignLeftOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"center",title:t("Align center"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignCenterOutlined",component:i.icons$AlignCenterOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"right",title:t("Align right"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignRightOutlined",component:i.icons$AlignRightOutlined,size:16,strokeWidth:l})})]})})]}),(0,e.jsxs)("div",{className:"form-editor-radio__align-block",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-radio__micro-label",children:t("Vertical alignment")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"alignVertical",className:"form-editor-radio__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-radio__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"top",title:t("Align top"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalTop",component:i.icons$AlignVerticalTop,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"middle",title:t("Align middle"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalCenter",component:i.icons$AlignVerticalCenter,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"bottom",title:t("Align bottom"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalBottom",component:i.icons$AlignVerticalBottom,size:16,strokeWidth:l})})]})})]})]})}var Pe=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>[{value:"v1",label:`${t("Value")} 1`},{value:"v2",label:`${t("Value")} 2`},{value:"custom",label:t("Custom")}],[t]),g=(0,d.useMemo)(()=>({placeholder:"",options:[{title:"",boundValue:void 0},{title:"",boundValue:void 0}],allowShuffle:!1,required:!1,defaultState:"enabled",radioLayout:"vertical",radioOptionGap:20,alignHorizontal:"left",alignVertical:"top",markerShape:"round",customIconUrl:"",customIconAlt:"",appearanceBackground:"#ffffff",appearanceStrokeColor:"#01bca6",appearanceDotColor:"#01bca6",labelTextFontFamily:we,labelTextFontSize:19,labelTextLineHeight:24,labelTextColor:"#333333",labelTextStrong:!1,labelTextItalic:!1,labelTextStrikethrough:!1,labelTextUnderline:!1,[`${f}borderPosition`]:`${f}borderAll`,[`${f}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${f}borderTop`]:{...u.NULL_BORDER},[`${f}borderBottom`]:{...u.NULL_BORDER},[`${f}borderRight`]:{...u.NULL_BORDER},[`${f}borderLeft`]:{...u.NULL_BORDER},[re]:5,[Y]:null,[X]:null,[K]:null,[Z]:null}),[]),v=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),R=(0,d.useCallback)(()=>{const s=o.getFieldsValue(!0);if(m){const n=s[re]??0;o.setFieldsValue({[Y]:n,[X]:n,[K]:n,[Z]:n})}else{const n=s[Y];n===s[X]&&n===s[K]&&n===s[Z]?o.setFieldsValue({[re]:n}):o.setFieldsValue({[Y]:null,[X]:null,[K]:null,[Z]:null})}$(n=>!n)},[o,m]),C=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),T=(0,e.jsx)("div",{className:"form-editor-radio-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-radio",autoComplete:"off",initialValues:g,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"placeholder",label:t("Placeholder"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text visible at the start"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$FormOptionsList,{name:"options",boundValueOptions:b,getPopupContainer:pe,labels:{itemTitle:s=>`${t("Value")} ${s}`,headingLabel:t("Heading"),valueLabel:t("Value"),valueTooltip:t("Stored or bound value for this option"),addLabel:t("Add value"),removeTooltip:t("Remove"),headingPlaceholder:t("Enter heading"),valuePlaceholder:t("Enter value")}}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"allowShuffle",label:t("Shuffle options")}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Required field")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"defaultState",label:t("Default value"),children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-radio__default-radios",children:[(0,e.jsx)(i.ui_kit$Radio,{value:"enabled",children:t("Enabled")}),(0,e.jsx)(i.ui_kit$Radio,{value:"disabled",children:t("Disabled")})]})}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-radio__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-radio__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(s=>!s),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-radio__expanded",children:[(0,e.jsx)(Ae,{}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-radio__section",title:t("Appearance"),children:(0,e.jsx)(Ee,{})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-radio__section",title:t("Label text style"),children:(0,e.jsx)(_e,{namePrefix:"labelText",microLabel:t("Caption next to options")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-radio__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:f,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:R,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-radio__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:f})})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-radio-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:v,closeIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Close",component:i.icons$Close,size:24,strokeWidth:a.iconStrokeWidth}),extra:C,children:(0,e.jsx)(i.ui_kit$PanelForm.HeaderTitle,{className:"form-editor-radio-panel__title",children:t("Radio button")})}),(0,e.jsx)(i.ui_kit$PanelForm.Body,{className:"form-editor-radio-panel__body",padding:{horizontal:0,vertical:0},children:T})]})};I.FormEditorCalendarPanel=ke,I.FormEditorCheckboxPanel=Fe,I.FormEditorDropdownListPanel=Ce,I.FormEditorInputPanel=Le,I.FormEditorRadioPanel=Pe});
|
|
2
|
+
__useblocks__.define("static/core/46571be7.js",["require","exports","module","static/core/2ff39ddf.js","static/core/c81e0921.js","static/core/edfcbabd.js","react","react/jsx-runtime","__delivery__/libs","classnames"],function(B,I,De){const J=B("./2ff39ddf.js"),r=B("./c81e0921.js"),u=B("./edfcbabd.js");let d=B("react");d=J.__toESM(d);let e=B("react/jsx-runtime"),i=B("__delivery__/libs"),Q=B("classnames");Q=J.__toESM(Q);var S=J.__toESM(r.require_prop_types()),h="calendar_",ee=`${h}borderRadiusAll`,N=`${h}borderRadiusTopLeft`,y=`${h}borderRadiusTopRight`,L=`${h}borderRadiusBottomLeft`,w=`${h}borderRadiusBottomRight`,ne="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",he=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function ie({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:he,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}ie.propTypes={namePrefix:S.default.string.isRequired,microLabel:S.default.node.isRequired};function xe(){const t=i.ui_kit$Form.useWatch("inactiveDateBg"),l=i.ui_kit$Form.useWatch("activeDateBg"),a=i.ui_kit$Form.useWatch("inactiveColor"),o=i.ui_kit$Form.useWatch("activeColor"),c=i.ui_kit$Form.useWatch("inactiveFontFamily"),_=i.ui_kit$Form.useWatch("activeFontFamily"),m=i.ui_kit$Form.useWatch("inactiveFontSize"),$=i.ui_kit$Form.useWatch("activeFontSize"),b=i.ui_kit$Form.useWatch("inactiveTextStrong"),g=i.ui_kit$Form.useWatch("activeTextStrong");return(0,e.jsxs)("div",{className:"form-editor-calendar__bg-preview","aria-hidden":!0,children:[(0,e.jsx)("span",{className:"form-editor-calendar__bg-chip",style:{background:t,color:a,fontFamily:c,fontSize:m,fontWeight:b?700:400},children:"31"}),(0,e.jsx)("span",{className:"form-editor-calendar__bg-chip form-editor-calendar__bg-chip--active",style:{background:l,color:o,fontFamily:_,fontSize:$,fontWeight:g?700:400},children:"15"})]})}var ke=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>({placeholder:"",valueMode:void 0,dateFormat:"24h",required:!1,inactiveDateBg:"#ffffff",activeDateBg:"#01bca6",inactiveFontFamily:ne,inactiveFontSize:19,inactiveLineHeight:24,inactiveColor:"#333333",inactiveTextStrong:!1,inactiveTextItalic:!1,inactiveTextStrikethrough:!1,inactiveTextUnderline:!1,activeFontFamily:ne,activeFontSize:19,activeLineHeight:24,activeColor:"#ffffff",activeTextStrong:!0,activeTextItalic:!1,activeTextStrikethrough:!1,activeTextUnderline:!1,[`${h}borderPosition`]:`${h}borderAll`,[`${h}borderAll`]:{width:1,style:"solid",color:"#ffffff"},[`${h}borderTop`]:{...u.NULL_BORDER},[`${h}borderBottom`]:{...u.NULL_BORDER},[`${h}borderRight`]:{...u.NULL_BORDER},[`${h}borderLeft`]:{...u.NULL_BORDER},[ee]:5,[N]:null,[y]:null,[L]:null,[w]:null}),[]),g=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),v=(0,d.useCallback)(()=>{const n=o.getFieldsValue(!0);if(m){const j=n[ee]??0;o.setFieldsValue({[N]:j,[y]:j,[L]:j,[w]:j})}else{const j=n[N];j===n[y]&&j===n[L]&&j===n[w]?o.setFieldsValue({[ee]:j}):o.setFieldsValue({[N]:null,[y]:null,[L]:null,[w]:null})}$(j=>!j)},[o,m]),R=[{value:"24h",label:t("24 hours")},{value:"12h",label:t("12 hours")},{value:"DDMMYYYY",label:"DD.MM.YYYY"},{value:"YYYYMMDD",label:"YYYY-MM-DD"}],C=[{value:"empty",label:t("Enter value")},{value:"today",label:t("Today")},{value:"custom",label:t("Custom")}],T=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),s=(0,e.jsx)("div",{className:"form-editor-calendar-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-calendar",autoComplete:"off",initialValues:b,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"placeholder",label:t("Placeholder"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text visible at the start"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"valueMode",label:(0,e.jsxs)("span",{className:"form-editor-calendar__label-with-info",children:[t("Value"),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Default or bound value for the field"),children:(0,e.jsx)("span",{className:"form-editor-calendar__info-icon",children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"InfoCircleOutlined",component:i.icons$InfoCircleOutlined,size:16})})})]}),children:(0,e.jsx)(i.ui_kit$Select,{className:"form-editor-calendar__full-width",placeholder:t("Enter value"),options:C,allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"dateFormat",label:t("Date format"),children:(0,e.jsx)(i.ui_kit$Select,{className:"form-editor-calendar__full-width",options:R})}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Required field")}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-calendar__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-calendar__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(n=>!n),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-calendar__expanded",children:[(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-calendar__section",title:t("Background"),children:(0,e.jsxs)(i.ui_kit$Space,{orientation:"vertical",size:20,className:"form-editor-calendar__full-width",children:[(0,e.jsx)(i.ui_kit$FormColorField,{name:"inactiveDateBg",label:t("Inactive date background color")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"activeDateBg",label:t("Active date background color")}),(0,e.jsx)(xe,{})]})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-calendar__section",title:t("Input field text"),children:(0,e.jsxs)("div",{className:"form-editor-calendar__typography-stack",children:[(0,e.jsx)(ie,{namePrefix:"inactive",microLabel:t("Inactive date font")}),(0,e.jsx)(ie,{namePrefix:"active",microLabel:t("Active date font")})]})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-calendar__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:h,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:v,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-calendar__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:h})})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-calendar-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:g,closeIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Close",component:i.icons$Close,size:24,strokeWidth:a.iconStrokeWidth}),extra:T,children:(0,e.jsx)(i.ui_kit$PanelForm.HeaderTitle,{className:"form-editor-calendar-panel__title",children:t("Calendar")})}),(0,e.jsx)(i.ui_kit$PanelForm.Body,{className:"form-editor-calendar-panel__body",padding:{horizontal:0,vertical:0},children:s})]})},x="checkbox_",te=`${x}borderRadiusAll`,O=`${x}borderRadiusTopLeft`,E=`${x}borderRadiusTopRight`,A=`${x}borderRadiusBottomLeft`,P=`${x}borderRadiusBottomRight`,fe="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",ae=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function se({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:ae,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}se.propTypes={namePrefix:S.default.string.isRequired,microLabel:S.default.node.isRequired};function $e(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("markerShape"),a=i.ui_kit$Form.useWatch("appearanceBackground"),o=i.ui_kit$Form.useWatch("appearanceStrokeColor"),c=i.ui_kit$Form.useWatch("appearanceCheckColor"),_=i.ui_kit$Form.useWatch("useCustomCheckIcon"),m=(0,Q.default)("form-editor-checkbox__preview-checkbox",l==="round"&&"form-editor-checkbox__preview-checkbox--round",l==="square"&&"form-editor-checkbox__preview-checkbox--square");return(0,e.jsx)("div",{className:"form-editor-checkbox__bg-preview","aria-hidden":!0,children:(0,e.jsxs)("div",{className:"form-editor-checkbox__preview-panel",children:[(0,e.jsxs)("div",{className:"form-editor-checkbox__preview-row",children:[(0,e.jsx)("span",{className:m,style:{borderColor:o,background:c},children:!_&&(0,e.jsx)(i.ui_kit$EmIcons,{icon:"CheckOutlined",component:i.icons$CheckOutlined,size:10,style:{color:"#ffffff"}})}),(0,e.jsx)("span",{className:"form-editor-checkbox__preview-label",children:t("Checked")})]}),(0,e.jsxs)("div",{className:"form-editor-checkbox__preview-row",children:[(0,e.jsx)("span",{className:m,style:{borderColor:o,background:a}}),(0,e.jsx)("span",{className:"form-editor-checkbox__preview-label",children:t("Unchecked")})]})]})})}function be(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("useCustomCheckIcon");return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"markerShape",label:t("Marker shape"),children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-checkbox__shape-radios",children:[(0,e.jsx)(i.ui_kit$Radio,{value:"round",children:t("Round")}),(0,e.jsx)(i.ui_kit$Radio,{value:"square",children:t("Square")})]})}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-checkbox__inner-section-divider"}),(0,e.jsxs)(i.ui_kit$Space,{orientation:"vertical",size:16,className:"form-editor-checkbox__full-width",children:[(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceBackground",label:t("Background color")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceStrokeColor",label:t("Stroke color")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceCheckColor",label:t("Checked fill color")})]}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"useCustomCheckIcon",label:t("Use custom icon for checked state")}),l&&(0,e.jsx)(i.ui_kit$Form.Item,{name:"customCheckIconUrl",label:t("Checked icon URL"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:"https://",allowClear:!0})}),(0,e.jsx)($e,{})]})}function ge(){const{__:t}=r.useI18n(),l=r.useAppConfig().iconStrokeWidth;return(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-checkbox__section",title:t("Position in cell"),children:(0,e.jsxs)("div",{className:"form-editor-checkbox__align-columns",children:[(0,e.jsxs)("div",{className:"form-editor-checkbox__align-column",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-checkbox__micro-label",children:t("Horizontal alignment")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"alignHorizontal",className:"form-editor-checkbox__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-checkbox__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"left",title:t("Align left"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignLeftOutlined",component:i.icons$AlignLeftOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"center",title:t("Align center"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignCenterOutlined",component:i.icons$AlignCenterOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"right",title:t("Align right"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignRightOutlined",component:i.icons$AlignRightOutlined,size:16,strokeWidth:l})})]})})]}),(0,e.jsxs)("div",{className:"form-editor-checkbox__align-column",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-checkbox__micro-label",children:t("Vertical alignment")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"alignVertical",className:"form-editor-checkbox__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-checkbox__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"top",title:t("Align top"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalTop",component:i.icons$AlignVerticalTop,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"middle",title:t("Align middle"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalCenter",component:i.icons$AlignVerticalCenter,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"bottom",title:t("Align bottom"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalBottom",component:i.icons$AlignVerticalBottom,size:16,strokeWidth:l})})]})})]})]})})}function je(){const{__:t}=r.useI18n();return i.ui_kit$Form.useWatch("showHelperText")?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"helperText",label:t("Helper text"),children:(0,e.jsx)(i.ui_kit$Input.TextArea,{rows:2,placeholder:t("Tooltip or hint text"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"validationErrorText",label:t("Validation error message"),children:(0,e.jsx)(i.ui_kit$Input.TextArea,{rows:2,placeholder:t("Message when validation fails"),allowClear:!0})})]}):null}var Fe=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>[{value:"v1",label:`${t("Value")} 1`},{value:"v2",label:`${t("Value")} 2`},{value:"custom",label:t("Custom")}],[t]),g=(0,d.useMemo)(()=>({fieldHeading:"",boundValue:void 0,checkboxLabel:"",required:!1,defaultState:"disabled",showHelperText:!1,helperText:"",validationErrorText:"",alignHorizontal:"left",alignVertical:"top",markerShape:"square",appearanceBackground:"#ffffff",appearanceStrokeColor:"#d9d9d9",appearanceCheckColor:"#01bca6",useCustomCheckIcon:!1,customCheckIconUrl:"",labelTextFontFamily:fe,labelTextFontSize:19,labelTextLineHeight:24,labelTextColor:"#333333",labelTextStrong:!1,labelTextItalic:!1,labelTextStrikethrough:!1,labelTextUnderline:!1,[`${x}borderPosition`]:`${x}borderAll`,[`${x}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${x}borderTop`]:{...u.NULL_BORDER},[`${x}borderBottom`]:{...u.NULL_BORDER},[`${x}borderRight`]:{...u.NULL_BORDER},[`${x}borderLeft`]:{...u.NULL_BORDER},[te]:5,[O]:null,[E]:null,[A]:null,[P]:null}),[]),v=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),R=(0,d.useCallback)(()=>{const s=o.getFieldsValue(!0);if(m){const n=s[te]??0;o.setFieldsValue({[O]:n,[E]:n,[A]:n,[P]:n})}else{const n=s[O];n===s[E]&&n===s[A]&&n===s[P]?o.setFieldsValue({[te]:n}):o.setFieldsValue({[O]:null,[E]:null,[A]:null,[P]:null})}$(n=>!n)},[o,m]),C=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),T=(0,e.jsx)("div",{className:"form-editor-checkbox-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-checkbox",autoComplete:"off",initialValues:g,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldHeading",label:t("Field heading"),children:(0,e.jsx)(i.ui_kit$Input.TextArea,{rows:2,placeholder:t("Title shown above the control"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"boundValue",label:(0,e.jsxs)("span",{className:"form-editor-checkbox__label-with-info",children:[t("Value"),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Stored or bound value for this field"),children:(0,e.jsx)("span",{className:"form-editor-checkbox__info-icon",children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"InfoCircleOutlined",component:i.icons$InfoCircleOutlined,size:12})})})]}),children:(0,e.jsx)(i.ui_kit$Select,{className:"form-editor-checkbox__full-width",placeholder:t("Enter value"),options:b,allowClear:!0,getPopupContainer:ae})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"checkboxLabel",label:t("Label next to checkbox"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text beside the box"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Required field")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"defaultState",label:t("Default value"),children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-checkbox__default-radios",children:[(0,e.jsx)(i.ui_kit$Radio,{value:"enabled",children:t("Enabled")}),(0,e.jsx)(i.ui_kit$Radio,{value:"disabled",children:t("Disabled")})]})}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"showHelperText",label:t("Helper text / tooltip")}),(0,e.jsx)(je,{}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-checkbox__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-checkbox__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(s=>!s),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-checkbox__expanded",children:[(0,e.jsx)(ge,{}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-checkbox__section",title:t("Appearance"),children:(0,e.jsx)(be,{})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-checkbox__section",title:t("Label text style"),children:(0,e.jsx)(se,{namePrefix:"labelText",microLabel:t("Caption next to checkbox")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-checkbox__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:x,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:R,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-checkbox__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:x})})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-checkbox-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:v,closeIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Close",component:i.icons$Close,size:24,strokeWidth:a.iconStrokeWidth}),extra:C,children:(0,e.jsx)(i.ui_kit$PanelForm.HeaderTitle,{className:"form-editor-checkbox-panel__title",children:t("Checkbox")})}),(0,e.jsx)(i.ui_kit$PanelForm.Body,{className:"form-editor-checkbox-panel__body",padding:{horizontal:0,vertical:0},children:T})]})},k="dropdown_",oe=`${k}borderRadiusAll`,D=`${k}borderRadiusTopLeft`,V=`${k}borderRadiusTopRight`,z=`${k}borderRadiusBottomLeft`,W=`${k}borderRadiusBottomRight`,ve="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",ce=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function de({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:ce,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}de.propTypes={namePrefix:S.default.string.isRequired,microLabel:S.default.node.isRequired};function Re(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("triggerBackground"),a=i.ui_kit$Form.useWatch("listPanelBackground"),o=i.ui_kit$Form.useWatch("arrowColor");return(0,e.jsxs)("div",{className:"form-editor-dropdown__bg-preview","aria-hidden":!0,children:[(0,e.jsxs)("div",{className:"form-editor-dropdown__trigger-mock",style:{background:l},children:[(0,e.jsx)("span",{className:"form-editor-dropdown__trigger-mock-text",children:t("Text visible at the start")}),(0,e.jsx)("span",{className:"form-editor-dropdown__trigger-mock-arrow",style:{color:o},children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DownOutlined",component:i.icons$DownOutlined,size:14})})]}),(0,e.jsxs)("div",{className:"form-editor-dropdown__list-mock",style:{background:a},children:[(0,e.jsxs)("span",{className:"form-editor-dropdown__list-mock-item",children:[t("Value")," 1"]}),(0,e.jsxs)("span",{className:"form-editor-dropdown__list-mock-item",children:[t("Value")," 2"]})]})]})}var Ce=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>[{value:"v1",label:`${t("Value")} 1`},{value:"v2",label:`${t("Value")} 2`},{value:"custom",label:t("Custom")}],[t]),g=(0,d.useMemo)(()=>({placeholder:"",options:[{title:"",boundValue:void 0},{title:"",boundValue:void 0}],allowMultiple:!1,required:!1,triggerBackground:"#ffffff",listPanelBackground:"#ffffff",arrowColor:"rgba(0, 0, 0, 0.45)",listTextFontFamily:ve,listTextFontSize:14,listTextLineHeight:22,listTextColor:"#333333",listTextStrong:!1,listTextItalic:!1,listTextStrikethrough:!1,listTextUnderline:!1,[`${k}borderPosition`]:`${k}borderAll`,[`${k}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${k}borderTop`]:{...u.NULL_BORDER},[`${k}borderBottom`]:{...u.NULL_BORDER},[`${k}borderRight`]:{...u.NULL_BORDER},[`${k}borderLeft`]:{...u.NULL_BORDER},[oe]:5,[D]:null,[V]:null,[z]:null,[W]:null}),[]),v=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),R=(0,d.useCallback)(()=>{const s=o.getFieldsValue(!0);if(m){const n=s[oe]??0;o.setFieldsValue({[D]:n,[V]:n,[z]:n,[W]:n})}else{const n=s[D];n===s[V]&&n===s[z]&&n===s[W]?o.setFieldsValue({[oe]:n}):o.setFieldsValue({[D]:null,[V]:null,[z]:null,[W]:null})}$(n=>!n)},[o,m]),C=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),T=(0,e.jsx)("div",{className:"form-editor-dropdown-list-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-dropdown",autoComplete:"off",initialValues:g,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"placeholder",label:t("Placeholder"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text visible at the start"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$FormOptionsList,{name:"options",boundValueOptions:b,getPopupContainer:ce,labels:{itemTitle:s=>`${t("Value")} ${s}`,headingLabel:t("Heading"),valueLabel:t("Value"),valueTooltip:t("Stored or bound value for this option"),addLabel:t("Add value"),removeTooltip:t("Remove"),headingPlaceholder:t("Enter heading"),valuePlaceholder:t("Enter value")}}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"allowMultiple",label:t("Allow multiple selection")}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Required field")}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-dropdown__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-dropdown__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(s=>!s),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-dropdown__expanded",children:[(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-dropdown__section",title:t("Background"),children:(0,e.jsxs)(i.ui_kit$Space,{orientation:"vertical",size:20,className:"form-editor-dropdown__full-width",children:[(0,e.jsx)(i.ui_kit$FormColorField,{name:"triggerBackground",label:t("Closed field background")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"listPanelBackground",label:t("List panel background")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"arrowColor",label:t("Arrow color")}),(0,e.jsx)(Re,{})]})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-dropdown__section",title:t("List text style"),children:(0,e.jsx)(de,{namePrefix:"listText",microLabel:t("List item appearance")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-dropdown__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:k,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:R,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-dropdown__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:k})})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-dropdown-list-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:v,closeIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Close",component:i.icons$Close,size:24,strokeWidth:a.iconStrokeWidth}),extra:C,children:(0,e.jsx)(i.ui_kit$PanelForm.HeaderTitle,{className:"form-editor-dropdown-list-panel__title",children:t("Dropdown list")})}),(0,e.jsx)(i.ui_kit$PanelForm.Body,{className:"form-editor-dropdown-list-panel__body",padding:{horizontal:0,vertical:0},children:T})]})},F={TEXT:"text",EMAIL:"email",PHONE:"phone",NAME:"name",URL:"url",PASSWORD:"password"},p="inputField_",le=`${p}borderRadiusAll`,U=`${p}borderRadiusTopLeft`,H=`${p}borderRadiusTopRight`,M=`${p}borderRadiusBottomLeft`,q=`${p}borderRadiusBottomRight`,ue="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",G=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function me({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:G,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}function Te(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("fieldBackground"),a=i.ui_kit$Form.useWatch(`${p}borderAll`),o=i.ui_kit$Form.useWatch("placeholderTextColor"),c=i.ui_kit$Form.useWatch("inputValueTextColor"),_=a?.color??"#d9d9d9";return(0,e.jsx)("div",{className:"form-editor-input__bg-preview","aria-hidden":!0,children:(0,e.jsx)("div",{className:"form-editor-input__preview-panel",children:(0,e.jsxs)("div",{className:"form-editor-input__preview-input",style:{background:l,borderColor:_,color:c},children:[(0,e.jsx)("span",{className:"form-editor-input__preview-placeholder-bit",style:{color:o},children:t("Placeholder")}),(0,e.jsx)("span",{children:" · "}),(0,e.jsx)("span",{children:t("Value")})]})})})}function Se(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useFormInstance(),a=(0,d.useCallback)(()=>{const o=l.getFieldValue("paddingHorizontal");o!=null&&o!==""&&l.setFieldValue("fieldMinHeight",o)},[l]);return(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Internal padding"),children:(0,e.jsxs)("div",{className:"form-editor-input__padding-row",children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"paddingHorizontal",className:"form-editor-input__padding-field",children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:200,placeholder:"0",prefix:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ColumnWidthOutlined",component:i.icons$ColumnWidthOutlined}),addonAfter:"px"})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldMinHeight",className:"form-editor-input__padding-field",children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:200,placeholder:t("Height"),prefix:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ColumnHeightOutlined",component:i.icons$ColumnHeightOutlined}),addonAfter:"px"})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Apply horizontal padding to height"),children:(0,e.jsx)(i.ui_kit$Button,{type:"default",className:"form-editor-input__padding-link-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"BorderOuterOutlined",component:i.icons$BorderOuterOutlined,size:16}),onClick:a})})]})})}function Be(){const{__:t}=r.useI18n();return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"form-editor-input__advanced-block",children:[(0,e.jsxs)("div",{className:"form-editor-input__advanced-switch-row",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{className:"form-editor-input__advanced-switch-label",children:t("Field state appearance")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"customStylesForStates",valuePropName:"checked",noStyle:!0,children:(0,e.jsx)(i.ui_kit$Switch,{})})]}),(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-input__advanced-description",children:t("Use your own styles instead of defaults for states such as error, focus, and success.")})]}),(0,e.jsxs)("div",{className:"form-editor-input__advanced-block",children:[(0,e.jsxs)("div",{className:"form-editor-input__advanced-switch-row",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{className:"form-editor-input__advanced-switch-label",children:t("High contrast mode")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"highContrastMode",valuePropName:"checked",noStyle:!0,children:(0,e.jsx)(i.ui_kit$Switch,{})})]}),(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-input__advanced-description",children:t("Improves visibility by automatically tuning the form for accessibility. Turn off to restore the previous look.")})]})]})}function Ie(){const{__:t}=r.useI18n(),l=r.useAppConfig().iconStrokeWidth;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Visibility"),children:(0,e.jsxs)("div",{className:"form-editor-input__visibility-row",children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldVisibility",className:"form-editor-input__visibility-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-input__visibility-segment",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"always",children:t("Always")}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"desktop",title:t("Desktop"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DesktopOutlined",component:i.icons$DesktopOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"mobile",title:t("Mobile"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"MobileOutlined",component:i.icons$MobileOutlined,size:16,strokeWidth:l})})]})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldDirection",className:"form-editor-input__direction-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-input__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"ltr",title:t("Left to right"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ArrowLeftOutlined",component:i.icons$ArrowLeftOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"rtl",title:t("Right to left"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ArrowRightOutlined",component:i.icons$ArrowRightOutlined,size:16,strokeWidth:l})})]})})]})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Visibility in AMP"),children:(0,e.jsx)(i.ui_kit$Form.Item,{name:"ampVisibility",className:"form-editor-input__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-input__visibility-amp",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"always",children:t("Always")}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"amp",children:"AMP"}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"html",children:"HTML"})]})})})]})}function Ne(){const{__:t}=r.useI18n();return i.ui_kit$Form.useWatch("limitLength")?(0,e.jsx)(i.ui_kit$Form.Item,{name:"maxLength",label:t("Maximum length"),children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:1,max:9999,placeholder:t("Characters"),addonAfter:t("chars")})}):null}function ye(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("inputType"),a=(0,d.useMemo)(()=>[{value:"minLength8",label:t("Minimum length 8 characters")},{value:"lowercase",label:t("Lowercase letters (a-z)")},{value:"uppercase",label:t("Uppercase letters (A-Z)")},{value:"digits",label:t("Digits (0-9)")},{value:"special",label:t("Special characters")}],[t]),o=(0,d.useMemo)(()=>[{value:"https",label:"HTTPS"},{value:"http",label:"HTTP"},{value:"mailto",label:"mailto:"},{value:"ftp",label:"FTP"}],[]);return l?(0,e.jsxs)(e.Fragment,{children:[l===F.TEXT&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"limitLength",label:t("Character limit")}),(0,e.jsx)(Ne,{})]}),l===F.PHONE&&(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"countryCodeSelector",label:t("Country selector (flag+code)")}),l===F.URL&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"urlAutoPrependProtocol",label:t("Auto-prepend protocol on blur")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"allowedProtocols",label:t("Allowed protocols"),children:(0,e.jsx)(i.ui_kit$Select,{mode:"multiple",className:"form-editor-input__full-width",placeholder:t("Choose allowed protocols"),options:o,getPopupContainer:G,allowClear:!0})})]}),l===F.PASSWORD&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"showPasswordEye",label:t("Show eye icon")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"passwordComplexityRules",label:t("Complexity rules"),children:(0,e.jsx)(i.ui_kit$Select,{mode:"multiple",className:"form-editor-input__full-width",placeholder:t("Choose complexity rules"),options:a,getPopupContainer:G,allowClear:!0})})]})]}):null}var Le=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>[{value:F.TEXT,label:t("Text")},{value:F.EMAIL,label:t("Email")},{value:F.PHONE,label:t("Phone number")},{value:F.NAME,label:t("Name")},{value:F.URL,label:t("URL")},{value:F.PASSWORD,label:t("Password")}],[t]),g=(0,d.useMemo)(()=>({placeholder:"",required:!1,limitLength:!1,maxLength:100,hintText:"",countryCodeSelector:!1,urlAutoPrependProtocol:!1,allowedProtocols:[],showPasswordEye:!1,passwordComplexityRules:[],paddingHorizontal:16,customStylesForStates:!1,highContrastMode:!1,fieldVisibility:"always",fieldDirection:"ltr",ampVisibility:"always",fieldBackground:"#ffffff",inputValueTextFontFamily:ue,inputValueTextFontSize:14,inputValueTextLineHeight:22,inputValueTextColor:"#333333",inputValueTextStrong:!1,inputValueTextItalic:!1,inputValueTextStrikethrough:!1,inputValueTextUnderline:!1,placeholderTextFontFamily:ue,placeholderTextFontSize:14,placeholderTextLineHeight:22,placeholderTextColor:"rgba(0, 0, 0, 0.25)",placeholderTextStrong:!1,placeholderTextItalic:!1,placeholderTextStrikethrough:!1,placeholderTextUnderline:!1,[`${p}borderPosition`]:`${p}borderAll`,[`${p}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${p}borderTop`]:{...u.NULL_BORDER},[`${p}borderBottom`]:{...u.NULL_BORDER},[`${p}borderRight`]:{...u.NULL_BORDER},[`${p}borderLeft`]:{...u.NULL_BORDER},[le]:5,[U]:null,[H]:null,[M]:null,[q]:null}),[]),v=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),R=(0,d.useCallback)(()=>{const s=o.getFieldsValue(!0);if(m){const n=s[le]??0;o.setFieldsValue({[U]:n,[H]:n,[M]:n,[q]:n})}else{const n=s[U];n===s[H]&&n===s[M]&&n===s[q]?o.setFieldsValue({[le]:n}):o.setFieldsValue({[U]:null,[H]:null,[M]:null,[q]:null})}$(n=>!n)},[o,m]),C=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),T=(0,e.jsx)("div",{className:"form-editor-input-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-input",autoComplete:"off",initialValues:g,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"inputType",label:t("Type"),children:(0,e.jsx)(i.ui_kit$Select,{className:"form-editor-input__full-width",placeholder:t("Choose input type"),options:b,allowClear:!0,getPopupContainer:G})}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Field required")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"placeholder",label:t("Placeholder"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text visible at the start"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"hintText",label:t("Hint text"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Come up with a hint"),allowClear:!0})}),(0,e.jsx)(ye,{}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-input__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-input__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(s=>!s),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-input__expanded",children:[(0,e.jsx)(Se,{}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Size"),collapsible:!0,defaultOpen:!1,children:(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldMaxWidth",label:t("Max width"),children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:2e3,placeholder:t("Not set"),addonAfter:"px"})})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Background"),children:(0,e.jsx)(i.ui_kit$FormColorField,{name:"fieldBackground",label:t("Background color")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Input field text"),children:(0,e.jsx)(me,{namePrefix:"inputValueText",microLabel:t("Font")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Placeholder text"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(me,{namePrefix:"placeholderText",microLabel:t("Font")})}),(0,e.jsx)(Te,{}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:p,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:R,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:p})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Accessibility"),children:(0,e.jsx)(Be,{})}),(0,e.jsx)(Ie,{})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-input-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:v,closeIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Close",component:i.icons$Close,size:24,strokeWidth:a.iconStrokeWidth}),extra:C,children:(0,e.jsx)(i.ui_kit$PanelForm.HeaderTitle,{className:"form-editor-input-panel__title",children:t("Input")})}),(0,e.jsx)(i.ui_kit$PanelForm.Body,{className:"form-editor-input-panel__body",padding:{horizontal:0,vertical:0},children:T})]})},f="radio_",re=`${f}borderRadiusAll`,Y=`${f}borderRadiusTopLeft`,X=`${f}borderRadiusTopRight`,K=`${f}borderRadiusBottomLeft`,Z=`${f}borderRadiusBottomRight`,we="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",pe=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function _e({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:pe,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}_e.propTypes={namePrefix:S.default.string.isRequired,microLabel:S.default.node.isRequired};function Oe(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("appearanceBackground"),a=i.ui_kit$Form.useWatch("appearanceStrokeColor"),o=i.ui_kit$Form.useWatch("appearanceDotColor");return(0,e.jsx)("div",{className:"form-editor-radio__bg-preview","aria-hidden":!0,children:(0,e.jsxs)("div",{className:"form-editor-radio__preview-panel",children:[(0,e.jsxs)("div",{className:"form-editor-radio__preview-row",style:{background:l},children:[(0,e.jsx)("span",{className:"form-editor-radio__preview-dot form-editor-radio__preview-dot--selected",style:{borderColor:a,background:o}}),(0,e.jsxs)("span",{className:"form-editor-radio__preview-label",children:[t("Value")," 1"]})]}),(0,e.jsxs)("div",{className:"form-editor-radio__preview-row",style:{background:l},children:[(0,e.jsx)("span",{className:"form-editor-radio__preview-dot",style:{borderColor:a,background:"transparent"}}),(0,e.jsxs)("span",{className:"form-editor-radio__preview-label",children:[t("Value")," 2"]})]})]})})}function Ee(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("markerShape");return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"markerShape",label:t("Marker shape"),children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-radio__shape-radios",children:[(0,e.jsx)(i.ui_kit$Radio,{value:"round",children:t("Round")}),(0,e.jsx)(i.ui_kit$Radio,{value:"custom",children:t("Custom icon")})]})}),l==="custom"&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"customIconUrl",label:t("Icon URL"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:"https://",allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"customIconAlt",label:t("Icon description"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Accessibility text"),allowClear:!0})})]}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-radio__inner-section-divider"}),(0,e.jsxs)(i.ui_kit$Space,{orientation:"vertical",size:16,className:"form-editor-radio__full-width",children:[(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceBackground",label:t("Background color")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceStrokeColor",label:t("Stroke color")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceDotColor",label:t("Dot color")})]}),(0,e.jsx)(Oe,{})]})}function Ae(){const{__:t}=r.useI18n(),l=r.useAppConfig().iconStrokeWidth;return(0,e.jsxs)(i.ui_kit$FormSection,{className:"form-editor-radio__section",title:t("Position in cell"),children:[(0,e.jsxs)(i.ui_kit$Row,{gutter:[12,16],className:"form-editor-radio__position-block",children:[(0,e.jsxs)(i.ui_kit$Col,{xs:24,sm:10,md:9,children:[(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-radio__micro-label",children:t("Layout")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"radioLayout",className:"form-editor-radio__layout-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-radio__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"horizontal",title:t("Horizontal"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"MenuOutlined",component:i.icons$MenuOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"vertical",title:t("Vertical"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Column",component:i.icons$Column,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"grid",title:t("Grid"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Grid01Icon",component:i.icons$Grid01Icon,size:16,strokeWidth:l})})]})})]}),(0,e.jsx)(i.ui_kit$Col,{xs:24,sm:14,md:15,children:(0,e.jsx)(i.ui_kit$Form.Item,{name:"radioOptionGap",label:t("Spacing"),children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:120,placeholder:t("Spacing"),addonAfter:"px"})})})]}),(0,e.jsxs)("div",{className:"form-editor-radio__align-block",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-radio__micro-label",children:t("Horizontal alignment")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"alignHorizontal",className:"form-editor-radio__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-radio__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"left",title:t("Align left"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignLeftOutlined",component:i.icons$AlignLeftOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"center",title:t("Align center"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignCenterOutlined",component:i.icons$AlignCenterOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"right",title:t("Align right"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignRightOutlined",component:i.icons$AlignRightOutlined,size:16,strokeWidth:l})})]})})]}),(0,e.jsxs)("div",{className:"form-editor-radio__align-block",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-radio__micro-label",children:t("Vertical alignment")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"alignVertical",className:"form-editor-radio__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-radio__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"top",title:t("Align top"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalTop",component:i.icons$AlignVerticalTop,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"middle",title:t("Align middle"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalCenter",component:i.icons$AlignVerticalCenter,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"bottom",title:t("Align bottom"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalBottom",component:i.icons$AlignVerticalBottom,size:16,strokeWidth:l})})]})})]})]})}var Pe=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>[{value:"v1",label:`${t("Value")} 1`},{value:"v2",label:`${t("Value")} 2`},{value:"custom",label:t("Custom")}],[t]),g=(0,d.useMemo)(()=>({placeholder:"",options:[{title:"",boundValue:void 0},{title:"",boundValue:void 0}],allowShuffle:!1,required:!1,defaultState:"enabled",radioLayout:"vertical",radioOptionGap:20,alignHorizontal:"left",alignVertical:"top",markerShape:"round",customIconUrl:"",customIconAlt:"",appearanceBackground:"#ffffff",appearanceStrokeColor:"#01bca6",appearanceDotColor:"#01bca6",labelTextFontFamily:we,labelTextFontSize:19,labelTextLineHeight:24,labelTextColor:"#333333",labelTextStrong:!1,labelTextItalic:!1,labelTextStrikethrough:!1,labelTextUnderline:!1,[`${f}borderPosition`]:`${f}borderAll`,[`${f}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${f}borderTop`]:{...u.NULL_BORDER},[`${f}borderBottom`]:{...u.NULL_BORDER},[`${f}borderRight`]:{...u.NULL_BORDER},[`${f}borderLeft`]:{...u.NULL_BORDER},[re]:5,[Y]:null,[X]:null,[K]:null,[Z]:null}),[]),v=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),R=(0,d.useCallback)(()=>{const s=o.getFieldsValue(!0);if(m){const n=s[re]??0;o.setFieldsValue({[Y]:n,[X]:n,[K]:n,[Z]:n})}else{const n=s[Y];n===s[X]&&n===s[K]&&n===s[Z]?o.setFieldsValue({[re]:n}):o.setFieldsValue({[Y]:null,[X]:null,[K]:null,[Z]:null})}$(n=>!n)},[o,m]),C=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),T=(0,e.jsx)("div",{className:"form-editor-radio-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-radio",autoComplete:"off",initialValues:g,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"placeholder",label:t("Placeholder"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text visible at the start"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$FormOptionsList,{name:"options",boundValueOptions:b,getPopupContainer:pe,labels:{itemTitle:s=>`${t("Value")} ${s}`,headingLabel:t("Heading"),valueLabel:t("Value"),valueTooltip:t("Stored or bound value for this option"),addLabel:t("Add value"),removeTooltip:t("Remove"),headingPlaceholder:t("Enter heading"),valuePlaceholder:t("Enter value")}}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"allowShuffle",label:t("Shuffle options")}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Required field")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"defaultState",label:t("Default value"),children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-radio__default-radios",children:[(0,e.jsx)(i.ui_kit$Radio,{value:"enabled",children:t("Enabled")}),(0,e.jsx)(i.ui_kit$Radio,{value:"disabled",children:t("Disabled")})]})}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-radio__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-radio__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(s=>!s),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-radio__expanded",children:[(0,e.jsx)(Ae,{}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-radio__section",title:t("Appearance"),children:(0,e.jsx)(Ee,{})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-radio__section",title:t("Label text style"),children:(0,e.jsx)(_e,{namePrefix:"labelText",microLabel:t("Caption next to options")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-radio__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:f,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:R,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-radio__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:f})})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-radio-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:v,closeIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Close",component:i.icons$Close,size:24,strokeWidth:a.iconStrokeWidth}),extra:C,children:(0,e.jsx)(i.ui_kit$PanelForm.HeaderTitle,{className:"form-editor-radio-panel__title",children:t("Radio button")})}),(0,e.jsx)(i.ui_kit$PanelForm.Body,{className:"form-editor-radio-panel__body",padding:{horizontal:0,vertical:0},children:T})]})};I.FormEditorCalendarPanel=ke,I.FormEditorCheckboxPanel=Fe,I.FormEditorDropdownListPanel=Ce,I.FormEditorInputPanel=Le,I.FormEditorRadioPanel=Pe});
|
|
3
3
|
|
|
4
|
-
__useblocks__.define("static/core/
|
|
4
|
+
__useblocks__.define("static/core/de822f7e.js",["require","exports","module","static/core/2ff39ddf.js","static/core/c81e0921.js","static/core/bce6ca28.js","vite/preload-helper"],function(h,I,W){const A=h("./2ff39ddf.js"),n=h("./c81e0921.js"),p=h("./bce6ca28.js");let D=h("vite/preload-helper");var R=A.__exportAll({IMPORT_UPLOAD_CONCURRENCY:()=>15,createDocumentProcessor:()=>T,createFileProcessor:()=>H,createImportFileNamer:()=>_,ensureFileExtension:()=>$,extractUploadResult:()=>F,fetchFileData:()=>U,getExt:()=>C,handleUploadResult:()=>j,importEmail:()=>L,importHtml:()=>x,importZip:()=>P,splitFileName:()=>b,uploadFile:()=>n.uploadFile});function C(e){const t=e.split(".");return t[t.length-1].toLowerCase()}function b(e){const t=e.split(".");return t[t.length-1].toLowerCase()}var w="index.html";function M(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function _(){const e=new Map;return(t,r)=>{const s=r.toLowerCase(),a=e.get(s);if(a===void 0)return e.set(s,t),r;if(a===t)return r;const i=r.lastIndexOf("."),l=`-${M(t)}`;return i>0?`${r.slice(0,i)}${l}${r.slice(i)}`:`${r}${l}`}}function E(e,t){return e.find(r=>r.toLowerCase().endsWith(t))}async function P(e,t,r){const s=await n.readZip(e),a=Object.keys(s),i=s[w]&&w||E(a,w)||E(a,".html")||E(a,".htm");if(i){const l=i.split("/"),d=document.location.pathname.split("/"),u=document.location.origin+d.slice(0,d.length-l.length).join("/")+"/",{html:m,hasBrowserExtensionArtifacts:N}=n.prepareEmailHtmlForEditor(n.zipEntryToText(s[i])),c=l.slice(0,l.length-1).join("/"),g=_();return{html:await p.changeHtml(m,async y=>{const f=y.document;await p.replaceImagesInDocument(f,async o=>{o=o.replace("\\","/"),o.startsWith(".")&&(o=o.substring(1)),o.startsWith("/")&&(o=o.substring(1)),o.startsWith(u)&&(o=o.substring(u.length)),c&&!o.match("^(ht|f)tp(s?)://")&&(o=`${c}/${o}`);const v=s[o];return v?t(n.zipEntryToBlob(v),o):t(o,g(o,p.getFileNameWithExt(o)))}),r&&r(y)}),hasBrowserExtensionArtifacts:N}}}async function x(e,t,r){const{html:s,hasBrowserExtensionArtifacts:a}=n.prepareEmailHtmlForEditor(e),i=_();return{html:await p.changeHtml(s,async l=>{const d=l.document;await p.replaceImagesInDocument(d,async u=>(u=u.replace("\\","/"),t(u,i(u,p.getFileNameWithExt(u))))),r&&r(l)}),hasBrowserExtensionArtifacts:a}}async function L(e,t,r){if(e)switch(C(e.name)){case"zip":return P(e,t,r);case"eml":{const s=await e.arrayBuffer(),{default:a}=await(0,D.__vitePreload)(async()=>{const{default:l}=await Promise.resolve().then(()=>h("./6561b34a.js"));return{default:l}},void 0,{}.url),i=(await a.parse(s)).html??void 0;if(typeof i>"u")throw new Error("Eml does not contain text/html");return x(i,t,r)}default:return x(await e.text(),t,r)}}async function U(e,t){if(typeof e!="string")return e;try{const r=await t({url:n.normalizeUrl(e)});return r?.data,r?.data||null}catch{return null}}async function $(e,t){if(!e||typeof e!="string")return`default.${await n.getMimeExtension(t)||"bin"}`;if(e.split(".").length<2){const r=await n.getMimeExtension(t);if(r)return`${e}.${r}`}return e}function F(e){if(e&&typeof e=="object"&&!Array.isArray(e)&&"code"in e&&"message"in e&&e.data){if(e.data.status===400)return{file_url:null,error:{code:e.code,message:e.message,status:e.data.status}};if(e.data.file_url)return{file_url:e.data.file_url,error:null}}if(Array.isArray(e)&&e.length>0){const t=e[0];if(t&&typeof t=="object"){if("code"in t&&"message"in t&&t.data?.status===400)return{file_url:null,error:{code:t.code,message:t.message,status:t.data.status}};if("file_url"in t&&t.file_url)return{file_url:t.file_url,error:null}}}if(e&&typeof e=="object"&&!Array.isArray(e)&&0 in e){if(e.data?.status===400)return{file_url:null,error:{status:e.data.status}};if(e[0]?.file_url)return{file_url:e[0].file_url,error:null}}return{file_url:null,error:null}}function j(e,t){if(!e||e.error)return typeof t=="string"?t:"";const r=F(e.data);return r.error?typeof t=="string"?t:"":r.file_url?r.file_url:typeof t=="string"?t:""}var B=15;function O(e){let t=0;const r=[],s=()=>{t--,r.shift()?.()};return async a=>{t>=e&&await new Promise(i=>r.push(i)),t++;try{return await a()}finally{s()}}}var H=(e,t,r,s,a)=>{const{maxSizeMB:i,maxWidthOrHeight:l}=n.resolveImageCompressionLimits(a),d=n.getBrowserImageCompressionLibUrl(),u=O(15);return(m,N)=>u(async()=>{try{const c=await U(m,e);if(!c)return typeof m=="string"?m:"";const g=await $(N,c.type),y=c.type?.trim()||n.inferImageMimeFromFileName(g)||"";let f=new File([c],g.toLowerCase(),{type:y});if(n.isAllowedImageUploadFile(f)){const o=f.type?.trim()||n.inferImageMimeFromFileName(f.name)||c.type||"";try{f=await n.prepareImageForUpload(f,{maxSizeMB:i,maxWidthOrHeight:l,mimeType:o||c.type,fileName:f.name,libURL:d,enableCompression:n.shouldEnableImageCompression(a,o),convertSvgToPng:!0})}catch{}}return j(await t({user_id:r.id,folder:s.id,file:f}),m)}catch{return typeof m=="string"?m:""}})},T=e=>t=>{const r=t.document;r.title=(r.querySelector("title")?.textContent??"").replace(/\s+/g," ").trim()||p.getFileNameAndExt(e.name)[0]};Object.defineProperty(I,"extractUploadResult",{enumerable:!0,get:function(){return F}}),Object.defineProperty(I,"import_exports",{enumerable:!0,get:function(){return R}})});
|
|
5
5
|
|
|
6
|
-
__useblocks__.define("static/core/
|
|
6
|
+
__useblocks__.define("static/core/edfcbabd.js",["require","exports","module","static/core/2ff39ddf.js","static/core/c81e0921.js","react","react/jsx-runtime","__delivery__/libs"],function(t,e,S){const i=t("./2ff39ddf.js"),o=t("./c81e0921.js");let r=t("react");r=i.__toESM(r);let l=t("react/jsx-runtime"),d=t("__delivery__/libs");function n(){return o.usePlanFeatureGate("google_fonts").isLocked?void 0:o.loadGFonts}var u=c=>{const{form:g,namePrefix:s="",typeOfForm:I="desktop"}=c,E=o.useSelector(o.selectEmailSettings).usedColors;return(0,l.jsx)(d.ui_kit$FormBorderInputs,{form:g,namePrefix:s,typeOfForm:I,usedColors:E})},b={paddingTop:"top",paddingLeft:"left",paddingRight:"right",paddingBottom:"bottom",mobilePaddingTop:"top",mobilePaddingLeft:"left",mobilePaddingRight:"right",mobilePaddingBottom:"bottom"},m={borderRadiusAll:"all",borderRadiusTopLeft:"topLeft",borderRadiusBottomLeft:"bottomLeft",borderRadiusTopRight:"topRight",borderRadiusBottomRight:"bottomRight"},R={mobileBorderRadiusAll:"all",mobileBorderRadiusTopLeft:"topLeft",mobileBorderRadiusBottomLeft:"bottomLeft",mobileBorderRadiusTopRight:"topRight",mobileBorderRadiusBottomRight:"bottomRight"},a={all:"borderAll",top:"borderTop",right:"borderRight",bottom:"borderBottom",left:"borderLeft"},O={all:"mobileBorderAll",top:"mobileBorderTop",right:"mobileBorderRight",bottom:"mobileBorderBottom",left:"mobileBorderLeft"},_={width:null,style:null,color:null},B={borderAll:"all",borderTop:"top",borderRight:"right",borderBottom:"bottom",borderLeft:"left"},f={mobileBorderAll:"all",mobileBorderTop:"top",mobileBorderRight:"right",mobileBorderBottom:"bottom",mobileBorderLeft:"left"};Object.defineProperty(e,"BORDER_POSITIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"BORDER_RADIUS_POSITION",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"MOBILE_BORDER_POSITIONS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"MOBILE_BORDER_RADIUS_POSITION",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"MOBILE_REVERSE_BORDER_POSITIONS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"NULL_BORDER",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"PADDING_POSITION",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"REVERSE_BORDER_POSITIONS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"SelectedElementFormBorder",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"useGoogleFontsLoader",{enumerable:!0,get:function(){return n}})});
|
|
7
7
|
|
|
8
8
|
(function(){try{if(typeof document<"u"){var t='.blocks-app .upload-bg-image{margin-bottom:calc(var(--ub-formItemMarginBottomXS) * 1px)}.blocks-app .upload-bg-image__inner-wrap{border:calc(var(--ub-borderWidth) * 1px) solid var(--ub-colorFillSecondaryDarken);border-radius:calc(var(--ub-borderRadius) * 1px);cursor:pointer;background-color:var(--ub-colorBgContainer);justify-content:space-between;align-items:center;transition:all .2s linear .2s;display:flex}.blocks-app .upload-bg-image__inner-wrap:hover{border-color:var(--ub-borderColorHover)}.blocks-app .upload-bg-image__uploader{width:calc((var(--ub-formControlHeight) - var(--ub-borderWidth) * 2 + 1) * 1px);height:calc((var(--ub-formControlHeight) - var(--ub-borderWidth) * 2) * 1px);border-radius:calc(var(--ub-borderRadius) * .8px);border:none;border-right:1px solid var(--ub-colorFillSecondaryDarken);flex-shrink:0;margin-right:10px;overflow:hidden}.blocks-app .upload-bg-image__uploader-content{background:0 0;flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%;font-size:11px;display:flex}.blocks-app .upload-bg-image__uploader-content-inner{width:inherit;height:inherit;position:relative}.blocks-app .upload-bg-image__uploader-img-wrap{width:inherit;height:inherit;z-index:1;border:none;position:absolute;overflow:hidden}.blocks-app .upload-bg-image__uploader-img-wrap:after{opacity:0;content:"";transition:opacity .3s;position:absolute;inset:0}.blocks-app .upload-bg-image__uploader-content:hover .upload-bg-image__uploader-img-wrap:after{opacity:1}.blocks-app .upload-bg-image .upload-bg-image__empty{border-top:2px solid var(--ub-colorError);z-index:2;width:27px;position:absolute;top:16px;left:3px;transform:rotate(-45deg)}.blocks-app .upload-bg-image .inputGroup{flex-direction:column;width:100%;display:flex}.blocks-app .upload-bg-image .image-size{color:var(--ub-colorTextTertiary);padding-right:15px;font-size:12px}.blocks-app .upload-bg-image .image-empty-text,.blocks-app .upload-bg-image .image-size-splitter{color:var(--ub-colorTextQuaternary)}.blocks-app .upload-bg-image__edit,.blocks-app .upload-bg-image__edit-menu{color:var(--ub-colorLink);right:calc((var(--ub-borderWidth) + 2) * 1px);padding:6px;line-height:1;position:absolute}.blocks-app .upload-bg-image__edit{right:calc((var(--ub-borderWidth) + 32) * 1px);position:absolute}.blocks-app .upload-bg-image__uploader-icons-wrap{z-index:2;width:inherit;height:inherit;opacity:1;cursor:pointer;justify-content:center;align-items:center;transition:opacity .3s;display:flex;position:relative}.blocks-app .upload-bg-image__uploader-content:hover .upload-bg-image__uploader-icons-wrap{opacity:.85}.blocks-app .upload-bg-image__uploader-icons-wrap-upload{z-index:1;width:inherit;height:inherit;opacity:.8;cursor:pointer;justify-content:center;align-items:center;transition:opacity .3s;display:flex;position:relative}.blocks-app .upload-bg-image__uploader-content:hover .upload-bg-image__uploader-icons-wrap-upload{opacity:.85}.blocks-app .upload-bg-image__uploader-icons-wrap-upload .upload-bg-image__uploader-content:empty{background-color:var(--ub-colorFillSecondary);border-radius:calc(var(--ub-borderRadius) * 1px)}.blocks-app .upload-bg-image__uploader-link,.blocks-app .upload-bg-image__uploader-link:hover{color:#fff}.blocks-app .upload-bg-image__uploader-icon{color:#fff;margin:0 3px;font-size:14px}.blocks-app .upload-bg-image__uploader-img{object-fit:cover;width:100%;height:100%;display:block!important}.blocks-app .upload-bg-image__uploader-img-placeholder{width:100%;height:100%;display:block}.blocks-app .upload-bg-image__uploader-icon-btn{cursor:pointer;background:0 0;border:0;margin:0;padding:0}.blocks-app .upload-bg-image__input{border-color:var(--ub-colorFillSecondaryDarken)}.blocks-app .upload-bg-image__uploader .ant-upload-select{cursor:pointer;width:100%;height:100%;display:block}.blocks-app .upload-bg-image__uploader .ant-upload-select .ant-upload{width:100%;height:100%;display:block}.dark .blocks-app .upload-bg-image__uploader{border-right:1px solid var(--ub-colorBorder)}.blocks-app .countdown-color .color-picker-input__picker-holder{z-index:auto;left:auto;right:-10px}.blocks-app .email-pane .box-shadow-control .ant-collapse-panel,.blocks-app .email-pane .border-control .ant-collapse-panel,.blocks-app .box-shadow-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body,.blocks-app .border-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body{overflow:visible}.blocks-app .selected-image-form_busy{position:relative}.blocks-app .selected-image-form__loader{z-index:5;background-color:color-mix(in srgb, var(--ub-colorBgContainer) 60%, transparent);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);box-shadow:28px 0 0 0 color-mix(in srgb, var(--ub-colorBgContainer) 60%, transparent), -28px 0 0 0 color-mix(in srgb, var(--ub-colorBgContainer) 60%, transparent);position:absolute;inset:0}.blocks-app .selected-image-form__loader-body{flex-direction:column;justify-content:center;align-items:center;gap:16px;height:100%;display:flex;position:absolute;top:0;left:0;right:0}.blocks-app .selected-image-form__loader-title{color:var(--ub-colorTextSecondary);text-align:center;padding:0 24px;font-size:13px}.blocks-app .selected-text-common-form__border-radio{position:relative}.blocks-app .selected-text-common-form__border-radio:after{content:"·";border:3px solid var(--ub-colorPrimary);border-radius:50%;font-size:0;line-height:0;position:absolute;top:2px;right:2px}.blocks-app .selected-text-common-form__border-col{margin-top:22px;margin-bottom:10px}@media (width<=1840px){.blocks-app .selected-text-common-form__border-col{margin-top:0}}.blocks-app .selected-text-common-form__border-item.ant-form-item .ant-row{flex-direction:row;align-items:center}.blocks-app .selected-text-common-form__border-item.ant-form-item .ant-row .ant-col.ant-form-item-label{white-space:nowrap;padding-top:6px}.blocks-app .selected-text-common-form__padding-input{max-width:46px;margin-bottom:0}.blocks-app .selected-text-common-form__padding-input input{text-align:center;padding:4px 8px}.blocks-app .selected-text-common-form__padding-input .ant-input-number-focused input{text-align:left}.blocks-app .selected-text-common-form__button--active,.blocks-app .selected-text-common-form__button--active:focus{color:#40a9ff;border-color:#40a9ff}.blocks-app .selected-text-common-form__br-input{margin-bottom:10px}.blocks-app .selected-text-common-form__tooltip{margin-left:4px}.blocks-app .selected-text-common-form__icon-radius{width:16px;height:100%}.blocks-app .selected-text-common-form__block{margin-bottom:24px}.blocks-app .selected-text-common-form__button_style{padding-left:10px;padding-right:10px;transition:none}.blocks-app .selected-text-common-form__format-toolbar{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:4px;display:flex}.blocks-app .selected-text-common-form__format-toolbar .ant-form-item{margin-bottom:0}.blocks-app .ant-app .bullet-type .ant-select-selector{padding-left:5px}.blocks-app .selected_text_common_form_mobile .ant-form-item{margin:0}.blocks-app .selected_text_common_form_mobile .ant-input-number-affix-wrapper{padding-inline-start:7px}.blocks-app .selected_text_common_form_mobile .ant-select-single:not(.ant-select-customize-input) .ant-select-selector,.blocks-app .selected_text_common_form_mobile .ant-input-number-group .ant-input-number-group-addon{padding:0 7px}.blocks-app .selected_text_common_form_mobile .ant-input-number .ant-input-number-handler-wrap{width:16px}.blocks-app .selected_text_common_form_mobile .ant-select .ant-select-arrow{inset-inline-end:7px;font-size:10px!important}.blocks-app .selected_text_common_form_mobile .ant-divider-vertical{height:46px;top:0}.blocks-app .selected_text_common_form_mobile .selected_text_common_form_mobile__group{padding:6px 0}.blocks-app .selected_text_common_form_mobile .selected-td-form__button{background:var(--ub-colorFillSecondary);width:34px;height:34px;border:1px solid #0000!important}.blocks-app .selected_text_common_form_mobile .ant-btn-default:not(:disabled,.ant-btn-disabled,.email-pane__content-col .selected-td-form__button--active):hover{background:var(--ub-colorFillSecondaryDarken);color:inherit;border-color:#0000}.blocks-app .selected_text_common_form_mobile .selected-td-form__button--active{background:var(--ub-colorPrimaryBg);color:var(--ub-colorPrimary);border-color:#0000}.blocks-app .selected_text_common_form_mobile .selected-td-form__button--active:hover{background:var(--ub-colorPrimaryBgHover)!important;color:var(--ub-colorPrimaryTextHover)!important}.blocks-app .selected_text_common_form_mobile .color-picker-input{width:34px;height:34px}.blocks-app .selected_text_common_form_mobile .color-picker-input .ant-input-affix-wrapper{display:none}.blocks-app .selected_text_common_form_mobile .color-picker-input__control-wrap .ant-color-picker-trigger{border:1px solid var(--ub-colorFillSecondaryDarken);width:34px;height:34px;top:0;left:0}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper{background:var(--ub-colorFillSecondary);height:34px;padding:0 9px;border:1px solid #0000!important}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper:not(.ant-radio-button-wrapper-checked):hover{color:inherit;background:var(--ub-colorFillSecondaryDarken)}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper.ant-radio-button-wrapper-checked{background:var(--ub-colorPrimaryBg);color:var(--ub-colorPrimary)}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper.ant-radio-button-wrapper-checked:hover{background:var(--ub-colorPrimaryBgHover);color:var(--ub-colorPrimaryTextHover)}.blocks-app .selected_text_common_form_mobile .codemode-textalign-dropdown{background-color:var(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadius) * 1px);box-shadow:var(--ub-boxShadowSecondary);padding:6px}.blocks-app .mobile-background-image-field .upload-bg-image{margin-bottom:0}.blocks-app .selected_element_vindent_values{font-size:12px}.blocks-app .selected_element_vindent_values span{cursor:pointer;margin-right:10px}.blocks-app .selected_element_vindent_values span:hover{color:#40a9ff}.blocks-app .selected-td-form__border-side-wrapper{display:inline-flex;position:relative}.blocks-app .selected-td-form__border-side-wrapper label{border-radius:calc(var(--ub-borderRadius) * 1px)}.blocks-app .selected-td-form__border-side-wrapper:hover .selected-td-form__border-side-clear{opacity:1}.blocks-app .selected-td-form__border-side-clear{z-index:1;opacity:0;cursor:pointer;color:var(--ub-colorTextSecondary);background-color:var(--ub-colorBgLayout);border-radius:50%;width:20px;height:20px;transition:opacity .15s;position:absolute;top:-6px;right:-4px}.blocks-app .selected-td-form__border-side-clear:hover{color:var(--ub-colorError)}.blocks-app .selected-td-form__border-radio:after{content:"·";border:3px solid var(--ub-colorPrimary);border-radius:50%;font-size:0;line-height:0;position:absolute;top:2px;right:2px}@media (width<=1840px){.blocks-app .selected-td-form__border-col{margin-top:0}}.blocks-app .selected-td-form__border-item.ant-form-item .ant-row{flex-direction:row;align-items:center}.blocks-app .selected-td-form__border-item.ant-form-item .ant-row .ant-col.ant-form-item-label{white-space:nowrap;padding-top:6px}.blocks-app .selected-td-form__padding-input input{text-align:center;padding:4px 8px}.blocks-app .selected-td-form__padding-input .ant-input-number-focused input{text-align:left}.blocks-app .selected-td-form__button--active,.blocks-app .selected-td-form__button--active:focus{color:#40a9ff;border-color:#40a9ff}.blocks-app .selected-td-form__tooltip{margin-left:4px}.blocks-app .selected-td-form__icon-radius{flex-shrink:0;justify-content:center;align-items:center;width:16px;height:16px;display:inline-flex}.blocks-app .selected-td-form__button_style{padding-left:10px;padding-right:10px;transition:none}.blocks-app .selected-td-form__border-radio{position:relative}.blocks-app .selected-td-form__border-radio:after{content:"·";border:3px solid var(--ub-colorPrimary);border-radius:50%;font-size:0;line-height:0;position:absolute;top:2px;left:2px;right:auto}.blocks-app .selected-td-form__border-col{margin-top:0;margin-bottom:0}@media (width<=1840px){.blocks-app .selected-td-form__border-col{margin-top:0}}.blocks-app .selected-td-form__border-item.ant-form-item .ant-col.ant-form-item-label{white-space:nowrap;padding-top:6px}.blocks-app .selected-td-form__padding-input{max-width:50px;margin-bottom:0}.blocks-app .selected-td-form__padding-input input{padding:4px 8px}.blocks-app .selected-td-form__br-input{margin-bottom:10px}.blocks-app .selected-td-form__tooltip{vertical-align:baseline;margin-left:4px}.blocks-app .selected-td-form__icon-radius{width:16px;height:100%}.blocks-app .selected-td-form__block{margin-bottom:24px}.blocks-app .carousel__slide{background-color:var(--ub-colorFillQuaternary);border-radius:calc(var(--ub-borderRadius) * 1px);margin-bottom:calc(var(--ub-formItemMarginBottomXS) * 1px);border:calc(var(--ub-borderWidth) * 1px) solid var(--ub-colorFillSecondaryDarken);padding:10px}.blocks-app .email-pane .box-shadow-control .ant-collapse-panel,.blocks-app .email-pane .border-control .ant-collapse-panel,.blocks-app .box-shadow-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body,.blocks-app .border-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body{overflow:visible}.blocks-app .selected-image-form__add-title{margin-top:-15px;margin-bottom:30px}.blocks-app .selected-image-form__add-title span{cursor:pointer}.blocks-app .selected-image-form__add-title span:hover{color:#40a9ff}.blocks-app .email-pane .box-shadow-control .ant-collapse-panel,.blocks-app .email-pane .border-control .ant-collapse-panel,.blocks-app .box-shadow-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body,.blocks-app .border-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body{overflow:visible}.blocks-app .selected-social-form{box-sizing:border-box;min-width:0;padding:0 0 16px}.blocks-app .selected-social-form .selected-social-form__form{padding:0 0 8px}.blocks-app .selected-social-form .selected-social-form__align-block{margin-bottom:16px}.blocks-app .selected-social-form .selected-social-form__align-block .ant-form-item,.blocks-app .selected-social-form .selected-social-form__section{margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__section--bordered{border-top:1px solid var(--ub-colorBorderSecondary,#f0f0f0);margin-top:16px;padding-top:16px}.blocks-app .selected-social-form .selected-social-form__section-title{color:var(--ub-colorText,#000000e0);margin:0 0 16px;font-size:14px;font-weight:400;line-height:1.2}.blocks-app .selected-social-form .selected-social-form__field-row{margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__field-icon{color:var(--ub-colorTextSecondary,#8c8c8c)}.blocks-app .selected-social-form .selected-social-form__input-full{width:100%}.blocks-app .selected-social-form .selected-social-form__items{flex-direction:column;gap:6px;margin-bottom:6px;display:flex}.blocks-app .selected-social-form .selected-social-form__card{border:1px solid var(--ub-colorBorderSecondary,#f0f0f0);background:var(--ub-colorFillTertiary,#f8f8f8);border-radius:6px;padding:12px;transition:border-color .15s,box-shadow .15s,opacity .15s}.blocks-app .selected-social-form .selected-social-form__card--dragging{opacity:.72}.blocks-app .selected-social-form .selected-social-form__card--drag-over{border-color:var(--ub-colorPrimary);box-shadow:0 0 0 1px var(--ub-colorPrimary)}.blocks-app .selected-social-form .selected-social-form__card-head{justify-content:space-between;align-items:center;gap:8px;margin-bottom:12px;display:flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-main{flex:auto;align-items:center;gap:8px;min-width:0;display:flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle{width:24px;height:24px;color:var(--ub-colorTextSecondary,#8c8c8c);cursor:grab;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;margin:0;padding:0;transition:color .15s,background-color .15s;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle:hover{color:var(--ub-colorText,#000000e0);background:var(--ub-colorFillSecondary,#f0f0f0)}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle:active{cursor:grabbing}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle:focus-visible{outline:2px solid var(--ub-colorPrimary);outline-offset:1px}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle .anticon{font-size:14px;transform:rotate(90deg)}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn{box-sizing:border-box;aspect-ratio:1;width:24px;min-width:24px;max-width:24px;height:24px;min-height:24px;max-height:24px;color:var(--ub-colorTextSecondary,#8c8c8c);background:0 0;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;padding:0;line-height:1;transition:color .15s,background-color .15s;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn .anticon{justify-content:center;align-items:center;line-height:0;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn svg{width:18px;height:18px;display:block}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn:hover{color:var(--ub-colorText,#000000e0);background:var(--ub-colorFillSecondary,#f0f0f0)}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn:focus-visible{outline:2px solid var(--ub-colorPrimary);outline-offset:1px}.blocks-app .selected-social-form .selected-social-form__card-title{min-width:0;color:var(--ub-colorText,#000000e0);flex:auto;font-size:14px;font-weight:300;line-height:1.2}.blocks-app .selected-social-form .selected-social-form__card-field.ant-row{margin-bottom:8px}.blocks-app .selected-social-form .selected-social-form__card-field.ant-row:last-child{margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__bg-color-row{width:100%;margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__bg-color-row .ant-col .ant-form-item{max-width:none;margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__bg-color-row .ant-form-item-control-input-content,.blocks-app .selected-social-form .selected-social-form__meta-block{width:100%}.blocks-app .selected-social-form .selected-social-form__meta-toggle-row{flex-wrap:wrap;align-items:center;display:flex}.blocks-app .selected-social-form .selected-social-form__meta-fields.is-hidden,.blocks-app .selected-social-form .selected-social-form__card-field.is-hidden{display:none}.blocks-app .selected-social-form .selected-social-form__meta-fields{flex-direction:column;gap:6px;width:100%;display:flex}.blocks-app .selected-social-form .selected-social-form__meta-fields .ant-form-item{margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__meta-fields .ant-form-item-control-input-content{width:100%}.blocks-app .selected-social-form .selected-social-form__platform-row{align-items:flex-start;gap:8px;width:100%;margin-bottom:8px;display:flex}.blocks-app .selected-social-form .selected-social-form__platform-field{flex:auto;min-width:0;margin-bottom:0!important}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn{box-sizing:border-box;width:calc(var(--ub-formControlHeight) * 1px);min-width:calc(var(--ub-formControlHeight) * 1px);max-width:calc(var(--ub-formControlHeight) * 1px);height:calc(var(--ub-formControlHeight) * 1px);min-height:calc(var(--ub-formControlHeight) * 1px);max-height:calc(var(--ub-formControlHeight) * 1px);line-height:calc((var(--ub-formControlHeight) - 2) * 1px);color:var(--ub-colorTextSecondary,#8c8c8c);border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;margin:0;padding:0;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn.ant-btn-icon-only .ant-btn-icon{justify-content:center;align-items:center;width:100%;height:100%;line-height:0;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn.ant-btn-icon-only .ant-btn-icon svg{display:block}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn:hover{color:var(--ub-colorText,#000000e0);background:var(--ub-colorFillSecondary,#f0f0f0)}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn:focus-visible{outline:2px solid var(--ub-colorPrimary);outline-offset:1px}.blocks-app .selected-social-form .selected-social-form__platform-select{width:100%}.blocks-app .selected-social-form .selected-social-form__platform-select.ant-select-single .ant-select-selector .ant-select-selection-item{align-self:center;align-items:center;line-height:1.2;display:flex}.blocks-app .selected-social-form .selected-social-form__platform-select .ant-select-arrow{color:var(--ub-colorTextSecondary,#8c8c8c)}.blocks-app .selected-social-form .selected-social-form__platform-select .ant-select-arrow svg{width:16px;height:16px}.blocks-app .selected-social-form .selected-social-form__platform-option{align-items:center;gap:4px;min-width:0;line-height:1.2;display:flex}.blocks-app .selected-social-form .selected-social-form__platform-option img{flex-shrink:0;width:30px;height:30px;margin-left:-6px;display:block}.blocks-app .selected-social-form .selected-social-form__platform-option-text{white-space:nowrap;text-overflow:ellipsis;line-height:1.2;overflow:hidden}.blocks-app .selected-social-form .selected-social-form__add-bar{background:var(--ub-colorFillTertiary,#f8f8f8);height:32px;color:var(--ub-colorText,#000000e0);border-radius:6px;justify-content:center;align-items:center;gap:8px;margin-top:0;padding:8px 12px;font-size:14px;font-weight:300;line-height:1.2;display:flex}.blocks-app .selected-social-form .selected-social-form__add-bar:not(:disabled):hover{background:var(--ub-colorFillSecondary,#f0f0f0);color:var(--ub-colorText,#000000e0)}.blocks-app .selected-social-form__platform-dropdown .ant-select-item-option{align-items:center}.blocks-app .selected-social-form__platform-dropdown .ant-select-item-option-content{align-items:center;min-height:0;line-height:1.2;display:flex}.blocks-app .selected-social-form__platform-dropdown .selected-social-form__platform-option{gap:0}.blocks-app .selected-social-form__platform-dropdown .selected-social-form__platform-option img{width:30px;height:30px;margin-left:-6px}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-suffix{flex-shrink:0;align-items:center;display:inline-flex}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-clear-icon:not(.ant-input-clear-icon-hidden){color:var(--ub-colorTextSecondary,#8c8c8c)}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-clear-icon:not(.ant-input-clear-icon-hidden) .anticon{vertical-align:0;justify-content:center;align-items:center;line-height:0;display:inline-flex}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-clear-icon:not(.ant-input-clear-icon-hidden) svg{width:16px;height:16px;display:block}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-clear-icon:not(.ant-input-clear-icon-hidden):hover{color:var(--ub-colorText,#000000e0)}.blocks-app .ant-app .email-pane__content-col .selected-social-form .ant-form-item.selected-social-form__card-field{margin-bottom:8px}.blocks-app .ant-app .email-pane__content-col .selected-social-form .ant-form-item.selected-social-form__card-field:last-child{margin-bottom:0}.blocks-app .email-pane .selected-social-form form.selected-social-form__form.element-controls,.blocks-app .email-pane .email-pane__collapse-wrapper.mobile-properties .selected-social-form form.selected-social-form__form.element-controls{height:auto;max-height:none}.blocks-app .ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-header{padding:20px 0;font-size:14px}.blocks-app .ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body{padding-left:0;padding-right:0}.blocks-app .ant-collapse.hidden-props .ant-alert{margin-bottom:24px}.blocks-app .selected_form-mobile-props{padding:24px 14px 0 24px}.blocks-app .email-pane_code-mode:not(.email-pane_code-mode-bottom) .selected-element-panel-content.selected-element-panel__hidden{visibility:hidden;opacity:0;height:0}.blocks-app .email-properties__collapse-panel .selected-element-panel-content{height:100%}.blocks-app .email-pane_code-mode:not(.email-pane_code-mode-bottom) .selected-element-panel-content{width:auto;box-shadow:var(--ub-boxShadowSecondary);border-radius:calc(var(--ub-borderRadius) * 1px);border:none;margin:0;padding:0 6px;transition:opacity .2s;position:absolute;top:-60px;left:50%;transform:translate(-50%)}.blocks-app .em-analytics__email-tab-properties,.blocks-app .em-analytics__email-tab-history{z-index:999;position:absolute}.blocks-app .em-analytics__email-tab-properties .email-pane__collapse-wrapper,.blocks-app .em-analytics__email-tab-history .email-pane__collapse-wrapper{z-index:999;box-shadow:0 1px 2px -2px #00000029,0 3px 6px #0000001f,0 5px 12px 4px #0000000f}.blocks-app .email-pane__col-wrapper_pinch .em-analytics__email-tab-properties .email-pane__collapse-wrapper,.blocks-app .email-pane__col-wrapper_pinch .em-analytics__email-tab-history .email-pane__collapse-wrapper{box-shadow:none}.blocks-app .selected-element-panel{height:100%;overflow:visible}.blocks-app .selected-element-panel button.selected-element-panel__extra-btn,.blocks-app .selected-element-panel__extra-btn button{height:24px;padding:0 7px}.blocks-app .selected-element-panel-content{position:relative}.blocks-app .selected-element-panel-content.column-settings-show_onecol{padding-top:75px}.blocks-app .selected-element-panel__columns-settings{z-index:1;width:100%;position:relative}.blocks-app .selected-element-panel__columns-settings__header{justify-content:space-between;align-items:center;gap:12px;margin-bottom:15px;display:flex}.blocks-app .selected-element-panel__columns-settings__header-title{color:var(--ub-colorText);font-size:14px;line-height:1.5}.blocks-app .selected-element-panel__columns-settings__title{white-space:nowrap;text-overflow:ellipsis;margin-bottom:20px;font-size:16px;font-weight:500;line-height:20px;overflow:hidden}.blocks-app .selected-element-panel__columns-settings__links{white-space:nowrap;justify-content:flex-end;align-items:center;gap:8px;margin-left:auto;font-size:14px;display:flex}.blocks-app .selected-element-panel__columns-settings__links span{color:var(--ub-colorLink);cursor:pointer}.blocks-app .selected-element-panel__columns-settings__links span:hover{color:#40a9ff}.blocks-app .selected-element-panel__columns-settings__links__add{align-items:center;gap:4px;display:inline-flex}.blocks-app .selected-element-panel__columns-settings__links__add.noactive,.blocks-app .selected-element-panel__columns-settings__links__add.noactive span{color:#00000073;cursor:not-allowed}.blocks-app .selected-element-panel__columns-settings__controls{align-items:center;gap:8px;display:flex}.blocks-app .selected-element-panel__columns-settings__controls__column{align-items:center;min-width:40px;display:flex;position:relative}.blocks-app .selected-element-panel__columns-settings__controls__column:first-child .selected-element-panel__columns-settings__controls__divider{visibility:hidden}.blocks-app .selected-element-panel__columns-settings__controls__column__remove,.blocks-app .selected-element-panel__columns-settings__controls__column__copy,.blocks-app .selected-element-panel__columns-settings__controls__column__swap{text-align:center;box-sizing:border-box;cursor:pointer;z-index:1;color:#000000d9;background-color:#fff;border:none;border-radius:50%;justify-content:center;align-items:center;width:25px;height:25px;padding:0;font-size:14px;display:none;position:absolute;left:-10px;box-shadow:0 0 7px -2px #00000059}.blocks-app .selected-element-panel__columns-settings__controls__column__remove{top:-11px}.blocks-app .selected-element-panel__columns-settings__controls__column__copy{color:#000000a6;top:20px}.blocks-app .selected-element-panel__columns-settings__controls__column__swap{color:#000000a6;top:10px;left:-16px}.blocks-app .selected-element-panel__columns-settings__controls__column__remove:hover,.blocks-app .selected-element-panel__columns-settings__controls__column__copy:hover,.blocks-app .selected-element-panel__columns-settings__controls__column__swap:hover{box-shadow:0 0 7px -2px #000000b3}.blocks-app .selected-element-panel__columns-settings__controls:hover .selected-element-panel__columns-settings__controls__column__swap,:is(.blocks-app .selected-element-panel__columns-settings__controls__column:hover:not(:has(.selected-element-panel__columns-settings__controls__column__swap:hover)) .selected-element-panel__columns-settings__controls__column__remove,.blocks-app .selected-element-panel__columns-settings__controls__column:hover:not(:has(.selected-element-panel__columns-settings__controls__column__swap:hover)) .selected-element-panel__columns-settings__controls__column__copy){display:flex}.blocks-app .selected-element-panel__columns-settings__controls__column:hover:not(:has(.selected-element-panel__columns-settings__controls__column__swap:hover)) .selected-element-panel__columns-settings__controls__column__swap{display:none}.blocks-app .selected-element-panel__columns-settings__controls__field{text-align:center;border-radius:6px;width:100%;height:45px}.blocks-app .selected-element-panel__columns-settings__controls__field .ant-input-number{background:0 0;border:none}.blocks-app .selected-element-panel__columns-settings__controls__field .ant-input-number .ant-input-number-input{text-align:center;height:43px}.blocks-app .selected-element-panel__columns-settings__controls__divider{cursor:w-resize}.blocks-app .selected-element-panel__columns-settings__divider-wrapper{display:none}.blocks-app .selected-element-panel .selected-element-panel__columns-settings__divider-wrapper{display:block;position:relative}.blocks-app .selected-element-panel .selected-element-panel__columns-settings__divider{width:calc(100% + 80px);height:20px;margin:24px -40px 0;position:absolute;bottom:-20px}.blocks-app .selected-element-panel__content_abs{border:1px solid var(--ub-colorBorder);z-index:100;background-color:var(--ub-colorBgContainer);border-top:none;border-radius:0 0 8px 8px;width:100%;max-width:1400px;min-height:15px;margin-bottom:15px;transition:all .5s;display:flex;position:sticky;top:0;left:0}.blocks-app .selected-element-panel__mobile-switch{background-color:var(--ub-colorPrimary)}.blocks-app .selected-element-panel__mobile-switch.ant-switch-checked{background-color:var(--ub-colorInfo)}.blocks-app #selected_element_form_desktop_props .ant-alert-info .ant-alert-title{color:var(--ub-colorInfoText)}.blocks-app .ant-app .selected_form-mobile-switch{margin-bottom:20px;font-size:16px;font-weight:500}.blocks-app .ant-app .selected_form-mobile-props{--ub-colorPrimaryBorder:var(--ub-colorInfo);--ub-controlOutline:var(--ub-colorInfoBgHover)}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number:focus,.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-focused,.blocks-app .ant-app .selected_form-mobile-props .ant-input:focus,.blocks-app .ant-app .selected_form-mobile-props .ant-select-focused:not(.ant-select-disabled).ant-select:not(.ant-select-customize-input) .ant-select-selector,.blocks-app .ant-app .selected_form-mobile-props .ant-input-affix-wrapper:focus,.blocks-app .ant-app .selected_form-mobile-props .ant-input-affix-wrapper-focused{border-color:var(--ub-colorInfo);box-shadow:0 0 0 calc(var(--ub-controlOutlineWidth) * 1px) var(--ub-controlOutline)!important}:is(.blocks-app .ant-app .selected_form-mobile-props .ant-input-affix-wrapper>.ant-input:focus,.blocks-app .ant-app .selected_form-mobile-props .ant-space-compact:has(>.ant-input-number):focus-within>.ant-input-number,.blocks-app .ant-app .selected_form-mobile-props .input-select:focus-within .ant-input-affix-wrapper){box-shadow:none!important}.blocks-app .ant-app .selected_form-mobile-props .ant-select:not(.ant-select-disabled):hover .ant-select-selector{border-color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-select-item-option-selected:not(.ant-select-item-option-disabled){background-color:#edd3ed}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within{box-shadow:var(--ub-colorInfoBg) 0 0 0 2px!important}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within .ant-input-number-affix-wrapper:not(:last-child),.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within .ant-input-number-group-addon:last-child,.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within>.ant-input-number:first-child{border-color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within .ant-input-number-affix-wrapper:not(:last-child){border-right-color:var(--ub-colorFillSecondaryDarken)}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group-addon .ant-select-open .ant-select-selector,.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group-addon .ant-select-focused .ant-select-selector,.blocks-app .ant-app .selected_form-mobile-props .ant-radio-button-wrapper:hover,.blocks-app .ant-app .selected_form-mobile-props .ant-collapse>.ant-collapse-item>.ant-collapse-header:hover{color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-btn-background-ghost.ant-btn-primary{color:var(--ub-colorInfo);border-color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):first-child,.blocks-app .ant-app .selected_form-mobile-props .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled),.blocks-app .ant-app .selected_form-mobile-props .selected-td-form__button--active{background-color:var(--ub-colorInfoBg)!important;color:var(--ub-colorInfoText)!important}.blocks-app .ant-app .selected_form-mobile-props .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):before,.blocks-app .ant-app .selected_form-mobile-props .ant-switch-checked{background-color:var(--ub-colorInfoTextActive)}.blocks-app .ant-app .selected_form-mobile-props .ant-switch.ant-switch-checked:hover:not(.ant-switch-disabled){background-color:var(--ub-colorInfoHover)}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-action:hover .ant-input-number-action-up-inner,.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-action:hover .ant-input-number-action-down-inner{color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-alert-info{background-color:var(--ub-colorInfoBg);border:none}.blocks-app .ant-app .selected_form-mobile-props .ant-alert-info .ant-alert-title{color:var(--ub-colorInfoText)}.blocks-app .selected-element-panel__extra-btn-container{position:absolute;top:13px;right:50px}.blocks-app .selected-element-panel__extra-btn-container .ant-btn-text:disabled{color:var(--ub-colorTextQuaternary)}.blocks-app .email-properties__collapse .ant-tabs-content>.ant-tabs-tabpane{height:100%}.blocks-app .ant-app .columns-presets{width:100%;margin-bottom:calc(var(--ub-formItemMarginBottomMD) * 1px);align-items:center;gap:7px;display:flex}.blocks-app .ant-app .columns-presets .ant-btn{flex:1;min-width:0;padding:7px 9px;line-height:1!important}.blocks-app .email-pane__collapse-wrapper .ant-modal-close{width:24px;height:24px;font-size:16px}.blocks-app .email-pane__collapse-wrapper .ant-modal-close .anticon{line-height:0}.blocks-app .groups-management__group-select label{width:100%}.blocks-app .groups-management__group-select label:after{display:none}.blocks-app .groups-management__group_menu{border-color:var(--ub-colorFillSecondaryDarken)}.blocks-app .annotations-preview{z-index:1100;pointer-events:auto;background:#fff;border-radius:8px;width:300px;padding:16px;position:absolute;top:0;box-shadow:0 4px 12px #00000026}.blocks-app .annotations-preview--popover{opacity:1;z-index:1;pointer-events:auto;width:420px;max-height:calc(100vh - 48px);position:absolute;top:0;left:-15px;overflow:hidden;transform:translate(-100%)}.blocks-app .annotations-preview__content{pointer-events:none}.blocks-app .annotations-preview__type{color:#202124;margin-bottom:10px;font-size:13px;font-weight:600}.blocks-app .annotations-preview__footer{pointer-events:auto;justify-content:space-between;align-items:center;gap:8px;margin-top:12px;display:flex}.blocks-app .annotations-preview__apply-wrap{margin-left:auto;display:inline-flex}.blocks-app .email-pane__col-wrapper_reverse .annotations-preview--popover{left:auto;right:-15px;transform:translate(100%)}.blocks-app .preview-skeleton{background:linear-gradient(90deg,#f1f3f4 25%,#e8eaed 50%,#f1f3f4 75%) 0 0/200% 100%;border-radius:4px;flex-shrink:0;animation:1.4s ease-in-out infinite preview-skeleton-shimmer;display:block}.blocks-app .preview-skeleton--circle{border-radius:50%}.blocks-app .preview-skeleton--block{border-radius:0}@keyframes preview-skeleton-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}.blocks-app .product-carousel-preview__header{margin-bottom:12px}.blocks-app .product-carousel-preview__header-main{align-items:flex-start;gap:12px;display:flex}.blocks-app .product-carousel-preview__logo{object-fit:cover;border:1px solid #f0f0f0;border-radius:50%;flex-shrink:0;width:40px;height:40px}.blocks-app .product-carousel-preview__logo-skeleton{border:none}.blocks-app .product-carousel-preview__subject-skeleton{flex:1;min-width:0;max-width:220px}.blocks-app .product-carousel-preview__header-text{flex:1;min-width:0}.blocks-app .product-carousel-preview__header-row{justify-content:space-between;align-items:center;gap:8px;display:flex}.blocks-app .product-carousel-preview__header-row--subject{align-items:flex-start;margin-top:2px}.blocks-app .product-carousel-preview__brand-name{color:#202124;font-size:14px;font-weight:600;line-height:20px}.blocks-app .product-carousel-preview__time{color:#5f6368;flex-shrink:0;font-size:11px;line-height:16px}.blocks-app .product-carousel-preview__subject-line{color:#202124;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-size:13px;line-height:18px;overflow:hidden}.blocks-app .product-carousel-preview__star-icon{color:#5f6368;flex-shrink:0}.blocks-app .product-carousel-preview__carousel{gap:8px;margin:0 -2px;padding-bottom:4px;display:flex;overflow-x:auto}.blocks-app .product-carousel-preview__carousel::-webkit-scrollbar{display:none}.blocks-app .product-carousel-preview__carousel{-ms-overflow-style:none;scrollbar-width:none}.blocks-app .product-carousel-preview__card{background:#fff;border:1px solid #dadce0;border-radius:8px;flex:0 0 128px;width:128px;overflow:hidden}.blocks-app .product-carousel-preview__card-image{aspect-ratio:1;background-color:#f1f3f4;background-position:50%;background-size:cover;width:100%}.blocks-app .product-carousel-preview__card-image-skeleton{aspect-ratio:1;width:100%}.blocks-app .product-carousel-preview__card-body{padding:8px}.blocks-app .product-carousel-preview__card-headline{color:#3c4043;-webkit-line-clamp:2;-webkit-box-orient:vertical;min-height:32px;font-size:12px;line-height:16px;display:-webkit-box;overflow:hidden}.blocks-app .product-carousel-preview__card-headline-skeleton{flex-direction:column;gap:4px;min-height:32px;display:flex}.blocks-app .product-carousel-preview__card-prices{flex-wrap:wrap;align-items:baseline;gap:6px;margin-top:6px;display:flex}.blocks-app .product-carousel-preview__card-sale-price{color:#202124;font-size:13px;font-weight:600;line-height:16px}.blocks-app .product-carousel-preview__card-original-price{color:#5f6368;font-size:12px;line-height:16px;text-decoration:line-through}.blocks-app .single-image-preview__header{margin-bottom:10px}.blocks-app .single-image-preview__header-main{align-items:flex-start;gap:12px;display:flex}.blocks-app .single-image-preview__logo{object-fit:cover;border:1px solid #f0f0f0;border-radius:50%;flex-shrink:0;width:40px;height:40px}.blocks-app .single-image-preview__logo-skeleton{border:none}.blocks-app .single-image-preview__header-text{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.blocks-app .single-image-preview__header-row{justify-content:space-between;align-items:center;gap:8px;display:flex}.blocks-app .single-image-preview__brand-name{color:#202124;font-size:14px;font-weight:600;line-height:20px}.blocks-app .single-image-preview__time{color:#5f6368;flex-shrink:0;font-size:11px;line-height:16px}.blocks-app .single-image-preview__subject-line{color:#202124;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:600;line-height:18px;overflow:hidden}.blocks-app .single-image-preview__subject-skeleton{max-width:100%}.blocks-app .single-image-preview__promo-row{justify-content:space-between;align-items:center;gap:8px;min-height:18px;display:flex}.blocks-app .single-image-preview__promo-content{flex:1;align-items:center;gap:4px;min-width:0;display:flex}.blocks-app .single-image-preview__promo-icon{color:#188038;flex-shrink:0}.blocks-app .single-image-preview__promo-icon-skeleton{border-radius:4px;flex-shrink:0}.blocks-app .single-image-preview__promo-badge{color:#188038;flex-shrink:0;font-size:13px;font-weight:500;line-height:16px}.blocks-app .single-image-preview__promo-separator{color:#5f6368;flex-shrink:0;font-size:13px;line-height:16px}.blocks-app .single-image-preview__promo-code{text-overflow:ellipsis;white-space:nowrap;color:#5f6368;min-width:0;font-size:13px;line-height:16px;overflow:hidden}.blocks-app .single-image-preview__promo-skeleton{flex-shrink:0}.blocks-app .single-image-preview__star-icon{color:#5f6368;flex-shrink:0}.blocks-app .single-image-preview__card{background:#fff;border:1px solid #dadce0;border-radius:10px;width:calc(100% - 76px);max-width:100%;margin-left:52px;margin-right:24px;overflow:hidden}.blocks-app .single-image-preview__card-image{aspect-ratio:1.91;background-color:#f1f3f4;background-position:50%;background-size:cover;width:100%}.blocks-app .single-image-preview__card-image-skeleton{aspect-ratio:1.91;width:100%}.blocks-app .single-image-preview__card-body{padding:10px 12px 12px}.blocks-app .single-image-preview__card-description{color:#3c4043;-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:14px;line-height:16px;display:-webkit-box;overflow:hidden}.blocks-app .single-image-preview__card-description-skeleton{flex-direction:column;gap:6px;min-height:34px;display:flex}.blocks-app .deal-annotation-preview__header-main{align-items:flex-start;gap:12px;display:flex}.blocks-app .deal-annotation-preview__logo{object-fit:cover;border:1px solid #f0f0f0;border-radius:50%;flex-shrink:0;width:40px;height:40px}.blocks-app .deal-annotation-preview__logo-skeleton{border:none}.blocks-app .deal-annotation-preview__header-text{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.blocks-app .deal-annotation-preview__header-row{justify-content:space-between;align-items:center;gap:8px;display:flex}.blocks-app .deal-annotation-preview__brand-name{color:#202124;font-size:14px;font-weight:600;line-height:20px}.blocks-app .deal-annotation-preview__time{color:#5f6368;flex-shrink:0;font-size:11px;line-height:16px}.blocks-app .deal-annotation-preview__subject-line{color:#202124;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:600;line-height:18px;overflow:hidden}.blocks-app .deal-annotation-preview__subject-skeleton{max-width:100%}.blocks-app .deal-annotation-preview__promo-row{justify-content:space-between;align-items:center;gap:8px;min-height:18px;display:flex}.blocks-app .deal-annotation-preview__promo-content{flex:1;align-items:center;gap:4px;min-width:0;display:flex}.blocks-app .deal-annotation-preview__promo-icon{color:#188038;flex-shrink:0}.blocks-app .deal-annotation-preview__promo-icon-skeleton{border-radius:4px;flex-shrink:0}.blocks-app .deal-annotation-preview__promo-badge{color:#188038;flex-shrink:0;font-size:13px;font-weight:500;line-height:16px}.blocks-app .deal-annotation-preview__promo-separator{color:#5f6368;flex-shrink:0;font-size:13px;line-height:16px}.blocks-app .deal-annotation-preview__promo-code{text-overflow:ellipsis;white-space:nowrap;color:#5f6368;min-width:0;font-size:13px;line-height:16px;overflow:hidden}.blocks-app .deal-annotation-preview__promo-skeleton{flex-shrink:0}.blocks-app .deal-annotation-preview__star-icon{color:#5f6368;flex-shrink:0}.blocks-app .deal-card-preview{background:#f1f3f4;border-radius:12px;flex-direction:column;gap:12px;padding:16px;display:flex}.blocks-app .deal-card-preview__sender{color:#202124;font-size:12px;font-weight:600;line-height:16px}.blocks-app .deal-card-preview__headline{color:#202124;word-break:break-word;font-size:22px;font-weight:400;line-height:28px}.blocks-app .deal-card-preview__headline-skeleton{max-width:100%}.blocks-app .deal-card-preview__details{align-items:flex-start;gap:24px;display:flex}.blocks-app .deal-card-preview__expires{align-items:flex-start;gap:8px;min-width:0;display:flex}.blocks-app .deal-card-preview__clock-icon{color:#5f6368;flex-shrink:0;margin-top:1px}.blocks-app .deal-card-preview__code{min-width:0}.blocks-app .deal-card-preview__detail-text{flex-direction:column;gap:2px;min-width:0;display:flex}.blocks-app .deal-card-preview__detail-label{color:#202124;font-size:12px;font-weight:600;line-height:16px}.blocks-app .deal-card-preview__detail-value{color:#5f6368;word-break:break-word;font-size:12px;font-weight:400;line-height:16px}.blocks-app .deal-card-preview__detail-skeleton{margin-top:1px}.blocks-app .deal-card-preview__actions{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.blocks-app .deal-card-preview__button{color:#001d35;white-space:nowrap;background:#c2e7ff;border-radius:999px;justify-content:center;align-items:center;padding:8px 16px;font-size:13px;font-weight:500;line-height:16px;display:inline-flex}.blocks-app .annotations-panel .selected-social-form__section-title{align-items:baseline;gap:6px;display:flex}.blocks-app .annotations-panel__docs-hint{color:var(--ub-colorTextSecondary,#8c8c8c);margin-top:16px;font-size:12px;font-weight:300;line-height:1.4}.blocks-app .annotations-panel__section-hint{color:var(--ub-colorTextSecondary,#8c8c8c);font-size:12px;font-weight:300}.blocks-app .annotations-panel__field-tooltip-wrap{width:100%;margin-bottom:8px;display:block}.blocks-app .annotations-panel__cards-section{margin-top:16px}.blocks-app .email-pane__content-col .selected-social-form.annotations-panel .selected-social-form__form .ant-form-item.selected-social-form__card-field:last-child{margin-bottom:8px}.blocks-app .email-settings{height:100%;display:flex}.blocks-app .email-settings__collapse{flex-direction:column;width:100%;height:100%;min-height:0;max-height:100%;display:flex;overflow:hidden}.blocks-app .email-settings__collapse.ant-collapse{border:0}.blocks-app .email-settings__collapse.secondary-tabs.ant-tabs .ant-tabs-content-holder{flex:1;min-height:0;overflow:hidden auto}.blocks-app .email-settings__collapse.secondary-tabs.ant-tabs .ant-tabs-content,.blocks-app .email-settings__collapse.secondary-tabs.ant-tabs .ant-tabs-tabpane-active{overflow:visible}.blocks-app .email-settings__collapse-panel:last-child.ant-collapse-item-active{padding-bottom:12px}.blocks-app .email-settings__collapse-panel.ant-collapse-item{min-height:50px;overflow:hidden}.blocks-app .email-settings__collapse-panel-content{width:100%}.blocks-app .email-settings .ant-collapse-body{padding:0 2px 0 12px;overflow:hidden}.blocks-app #content_appearance_panel_form button.ant-btn:not(.ant-btn-primary):hover{border-color:#d9d9d9}.blocks-app .section-title-bull{color:var(--ub-colorTextQuaternary)}.blocks-app .appearance-panel__content-styles{flex-direction:column;height:100%;min-height:0;display:flex}.blocks-app .appearance-panel__content-styles.ant-tabs{height:100%;min-height:0}.blocks-app .appearance-panel__content-styles .ant-tabs-content-holder,.blocks-app .appearance-panel__content-styles .ant-tabs-content,.blocks-app .appearance-panel__content-styles .ant-tabs-tabpane,.blocks-app .appearance-panel__content-styles .ant-tabs-tabpane-active,.blocks-app .appearance-panel__content-styles .email-settings__collapse-panel-content,.blocks-app .appearance-panel__content-styles .appearance-panel,.blocks-app .appearance-panel__content-styles .element-controls{min-height:0}.blocks-app .appearance-panel__content-styles .ant-tabs-content-holder,.blocks-app .appearance-panel__content-styles .ant-tabs-content,.blocks-app .appearance-panel__content-styles .ant-tabs-tabpane-active,.blocks-app .appearance-panel__content-styles .email-settings__collapse-panel-content,.blocks-app .appearance-panel__content-styles .appearance-panel{flex-direction:column;flex:1;display:flex}.blocks-app .appearance-panel__content-styles .ant-tabs-content-holder{overflow:hidden auto}.blocks-app .appearance-panel__content-styles .ant-tabs-content,.blocks-app .appearance-panel__content-styles .ant-tabs-tabpane-active{overflow:visible}.blocks-app .modal-select-role__cards-grid{grid-gap:20px;grid-template-columns:repeat(auto-fit,322px);padding:10px 24px 24px;display:grid}.blocks-app .modal-select-role .element-card__select-role{cursor:pointer;height:300px}.blocks-app .modal-select-role .element-card__select-role img{cursor:pointer;background-color:#fff;width:100%}.blocks-app .modal-select-role .element-card__select-role .ant-card-body{height:50px}.blocks-app .modal-select-role__title-wrapper{display:inline-block}.blocks-app .ai-response-paragraph{margin-bottom:16px}.blocks-app .em-analytics__email-tab-discuss{overflow:auto!important}.blocks-app .discuss-ai-wrapper{flex-direction:column;flex:1;height:100%;min-height:0;display:flex}.blocks-app .discuss-ai-wrapper .ant-tabs-content-holder,.blocks-app .discuss-ai-wrapper .ant-tabs-content,.blocks-app .discuss-ai-wrapper .ant-tabs-tabpane,.blocks-app .discuss-ai-wrapper .ant-tabs-tabpane-active{flex-direction:column;flex:1;min-height:0;display:flex}.blocks-app .discuss-ai-wrapper .ant-tabs-content{overflow:hidden auto}.blocks-app .discuss-ai-wrapper .discuss-main{min-height:0}.blocks-app .ant-tabs-content .discuss-ai{background-color:#fafafa;border:1px solid #f1ebeb;border-radius:8px;margin:0 0 20px;padding:24px 36px 0}.dark .blocks-app .ant-tabs-content .discuss-ai{background-color:#181818;border-color:#262626}.blocks-app .discuss-main{margin:0}.blocks-app .discuss-main__form{position:relative}.blocks-app .discuss-main__buttons{justify-content:space-between;display:flex}.blocks-app .discuss-main>.comment-list{margin-bottom:16px}.blocks-app .discuss-main>form{padding-bottom:20px}.blocks-app .discuss-main .ant-comment-actions{opacity:.6;transition:all .3s cubic-bezier(.645,.045,.355,1)}.blocks-app .discuss-main .replyEditMode{opacity:.5}.blocks-app .modal-select-role{max-height:1400px}.blocks-app .modal-select-role .element-card.element-card_select-role .ant-card-cover{border:none;height:auto}.blocks-app .modal-select-role .element-card .ant-card-body{height:auto}.blocks-app .modal-select-role__cards-grid{grid-gap:20px;grid-template-columns:repeat(3,260px);width:auto;padding:10px 24px 24px;display:grid}.blocks-app .modal-select-role .element-card_select-role{cursor:pointer}.blocks-app .modal-select-role .element-card_select-role img,.blocks-app .modal-select-role .element-card__no-img{background-color:#fff}@media (width<=1200px){.blocks-app .modal-select-role__cards-grid{grid-template-columns:repeat(4,240px);width:auto}.blocks-app .modal-select-role .element-card__title{font-size:15px}}.blocks-app .ant-comment .ant-comment-avatar{cursor:auto}.blocks-app .ant-comment .ant-comment-avatar .anticon-robot{background:var(--ub-colorInfo)}.blocks-app .ant-comment .ant-comment-avatar .anticon-user{background:var(--ub-colorPrimary)}.blocks-app .ant-comment.ai-comment .ant-comment-avatar .anticon-robot{background:var(--ub-colorInfo)}.blocks-app .ant-comment.ai-comment .ant-comment-avatar .anticon-user{background:var(--ub-colorPrimary)}.blocks-app .ant-comment.ai-comment .ai-guide__example{border-left:1px solid #3b91ff;padding-left:15px;font-style:italic}.blocks-app .ant-comment.ai-comment .ai-guide__example strong{font-weight:500}.blocks-app .ant-comment-content-detail{margin-top:16px;margin-left:-30px}.blocks-app .ant-comment-content-detail p{white-space:normal;margin:16px 0;line-height:1.4}.blocks-app .ant-comment-content-detail ul{margin:16px 0}.blocks-app .ant-comment-content-detail .buttons-variants{white-space:normal;margin-left:0;padding-left:0}.blocks-app body.dark .ant-comment-content-detail .buttons-variants .ant-btn-default:hover{background:#e6f7ff}.blocks-app .ant-comment-content-detail .buttons-variants li{white-space:normal;margin-bottom:4px}.blocks-app .ant-comment-content-detail .buttons-variants .ant-btn.ant-btn-sm{text-align:left;height:auto;padding:4px 7px;line-height:1.4}.blocks-app .ant-comment-content-detail .ai-response-variant{margin:15px 0}.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-title,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-preheader,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-copy{cursor:pointer;background-color:#1890ff33;border-radius:4px;margin:4px 0;padding:3px 8px;line-height:1.4;transition:all .3s;display:block}.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-title:hover,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-preheader:hover,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-copy:hover{color:#000}.blocks-app body.dark .ant-comment-content-detail .ai-response-variant .ai-response-title:hover,.blocks-app body.dark .ant-comment-content-detail .ai-response-variant .ai-response-preheader:hover,.blocks-app body.dark .ant-comment-content-detail .ai-response-variant .ai-response-copy:hover{color:#fff}.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-title:hover,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-preheader:hover,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-copy:hover{background-color:#1890ff55}.blocks-app .limit-upgrade-modal.ant-modal{max-width:calc(100vw - 24px)}.blocks-app .limit-upgrade-modal .ant-modal-content{border-radius:16px;padding:0;overflow:hidden;box-shadow:0 12px 24px -4px #191d3a14}.blocks-app .limit-upgrade-modal .ant-modal-header{display:none}.blocks-app .limit-upgrade-modal .ant-modal-content .ant-modal-body{padding:0}.blocks-app .limit-upgrade-modal__wrap{background:var(--ub-colorBgContainer);flex-direction:column;align-items:center;width:400px;max-width:100%;display:flex}.blocks-app .limit-upgrade-modal__header{z-index:1;box-sizing:border-box;justify-content:flex-end;align-items:center;display:flex;position:absolute;top:20px;right:20px}.blocks-app .limit-upgrade-modal__close{background:var(--ub-colorBgContainer);width:34px;height:34px;color:var(--ub-colorTextSecondary);cursor:pointer;border:none;border-radius:6px;justify-content:center;align-items:center;margin:0;padding:0;transition:background .15s,color .15s;display:flex}.blocks-app .limit-upgrade-modal__close:hover{background:var(--ub-colorFillTertiary);color:var(--ub-colorText)}.blocks-app .limit-upgrade-modal__close .anticon{font-size:16px}.blocks-app .limit-upgrade-modal__body{box-sizing:border-box;flex-direction:column;align-items:center;gap:16px;width:100%;padding:44px 40px 24px;display:flex}.blocks-app .limit-upgrade-modal__title{text-align:center;max-width:320px;color:var(--ub-colorText);margin:0;font-size:18px;font-weight:400;line-height:130%}.blocks-app .limit-upgrade-modal__subtitle{text-align:center;max-width:320px;color:var(--ub-colorTextSecondary);margin:0;font-size:14px;font-weight:100;line-height:120%}.blocks-app .limit-upgrade-modal__limits-row{flex-flow:wrap;justify-content:center;align-items:center;gap:8px;width:100%;max-width:320px;display:flex}.blocks-app .limit-upgrade-modal__icon-circle{box-sizing:border-box;border:1px solid var(--ub-colorText);width:34px;height:34px;color:var(--ub-colorText);border-radius:32px;flex:none;justify-content:center;align-items:center;padding:8px;display:flex}.blocks-app .limit-upgrade-modal__icon-circle .anticon{font-size:18px}.blocks-app .limit-upgrade-modal__icon-circle svg{flex-shrink:0;width:18px;height:18px;display:block}.blocks-app .limit-upgrade-modal__limit-old{color:#f85243;flex-shrink:0;font-size:40px;font-weight:100;line-height:100%}.blocks-app .limit-upgrade-modal__arrow-btn{color:#fff;background:#8946fb;border-radius:38px;flex:none;justify-content:center;align-items:center;width:34px;height:34px;display:flex}.blocks-app .limit-upgrade-modal__arrow-icon{font-size:16px;transform:rotate(45deg)}.blocks-app .limit-upgrade-modal__limit-new{color:#7ed846;flex-shrink:0;font-size:40px;font-weight:400;line-height:100%}.blocks-app .limit-upgrade-modal__limit-new--infinity{font-size:36px;line-height:40px}.blocks-app .limit-upgrade-modal__divider{border:none;border-top:1px solid var(--ub-colorBorderSecondary);width:100%;height:0;margin:0}.blocks-app .limit-upgrade-modal__footer{box-sizing:border-box;flex-direction:column;justify-content:center;align-items:center;width:100%;padding:16px 0;display:flex}.blocks-app .limit-upgrade-modal__footer--dual{flex-flow:wrap;justify-content:center;align-items:center;gap:8px;padding:16px}.blocks-app .limit-upgrade-modal__cta.ant-btn-primary{min-width:147px;height:32px;box-shadow:none;background:#2884ff;border-color:#2884ff;border-radius:6px;padding:8px 16px;font-size:14px;font-weight:400;line-height:19px}.blocks-app .limit-upgrade-modal__cta.ant-btn-primary:hover{background:#1a75f0;border-color:#1a75f0}.blocks-app .limit-upgrade-modal__cta-secondary.ant-btn-default{border-color:var(--ub-colorBorder);min-width:147px;height:32px;color:var(--ub-colorText);box-shadow:none;border-radius:6px;padding:8px 16px;font-size:14px;font-weight:400;line-height:19px}.blocks-app .limit-upgrade-modal__cta-secondary.ant-btn-default:hover{color:#2884ff;border-color:#2884ff}.blocks-app .optimise-wrapper{flex-direction:column;flex:1;height:100%;min-height:0;display:flex}.blocks-app .optimise-wrapper .ant-tabs-content-holder,.blocks-app .optimise-wrapper .ant-tabs-content,.blocks-app .optimise-wrapper .ant-tabs-tabpane,.blocks-app .optimise-wrapper .ant-tabs-tabpane-active{flex-direction:column;flex:1;min-height:0;display:flex}.blocks-app .optimise-wrapper .ant-tabs-content{overflow:hidden auto}.blocks-app .optimise{background:0 0;border:none;min-height:0}.blocks-app .optimise.ant-collapse>.ant-collapse-item:last-child{border-bottom:none!important}.blocks-app .optimise .ant-list-item-meta-title{-webkit-user-select:text;user-select:text}.blocks-app .optimise__summary{justify-content:space-between;width:100%;display:flex}.blocks-app .optimise__summary>div:not(:last-child){margin-right:10px}.blocks-app .optimise__summary h4{line-height:1}.blocks-app .optimise .ant-divider.ant-divider-horizontal{border-top:1px solid var(--ub-colorBorderSecondary);background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);width:calc(100% + 50px);margin:26px -25px}.blocks-app .optimise.ant-collapse>.ant-collapse-item{border-bottom:1px solid var(--ub-colorBorderSecondary)}.blocks-app .optimise.ant-collapse>.ant-collapse-item .ant-collapse-header{padding:12px 0 12px 24px}.blocks-app .optimise.ant-collapse>.ant-collapse-item .ant-collapse-panel{border-top:none}.blocks-app .optimise.ant-collapse>.ant-collapse-item .ant-collapse-body{padding:24px 14px 12px 24px;overflow-y:hidden;padding-top:0!important;padding-right:24px!important}.blocks-app .optimise .valid{white-space:nowrap;color:var(--ub-colorSuccessText)}.blocks-app .optimise .error{white-space:nowrap;color:var(--ub-colorErrorText)}.blocks-app .optimise .warning{white-space:nowrap;color:var(--ub-colorWarningText)}.blocks-app .optimise__title-wrapper{justify-content:space-between;align-items:flex-start;width:100%;display:flex}.blocks-app .optimise__title-wrapper h5{width:70%}.blocks-app .optimise__link{-webkit-user-select:text;user-select:text}.blocks-app .optimise__link:hover{color:var(--ub-colorLinkHover)!important}.blocks-app .email-pane .optimise .ant-collapse-panel{height:calc(100% - 184px)}.blocks-app .optimise__image-item .image-item__meta_fail .ant-list-item-meta-avatar{background:linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-colorBorder) 0), linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-colorBorder) 0);background-position:0 0,4px 4px;background-size:8px 8px;border-radius:6px}.blocks-app .optimise__image-item .image-item__meta.ant-list-item-meta{align-items:stretch}.blocks-app .optimise__image-item .image-item__image{cursor:pointer;object-fit:contain;border-radius:calc(var(--ub-borderRadius) * 1px);background:linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-colorBorder) 0), linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-colorBorder) 0);background-position:0 0,4px 4px;background-size:8px 8px}.blocks-app .optimise__image-item .image-item__image+.ant-image-mask{border-radius:calc(var(--ub-borderRadius) * 1px)}.blocks-app .optimise__image-item .image-item__image_fail{height:92px!important}.blocks-app .optimise .ant-list .ant-list-item .ant-list-item-meta .ant-list-item-meta-avatar{margin-inline-end:12px}.blocks-app .optimise .warnings{color:var(--ub-colorWarningText)}.blocks-app .optimise .errors{color:var(--ub-colorErrorText)}.blocks-app .optimise .valid{color:var(--ub-colorSuccessText)}.blocks-app .optimise__button.warnings{border-color:var(--ub-colorWarningBorder);background:var(--ub-colorWarningBg)}.blocks-app .optimise__button.warnings:not(.ant-tag-checkable-checked):hover{border-color:var(--ub-colorWarningBorderHover);color:var(--ub-colorWarningTextHover);background:var(--ub-colorWarningBgHover)}.blocks-app .optimise__button.warnings_active{color:#fff;background-color:var(--ub-colorWarningActive);border-color:var(--ub-colorWarningActive)}.blocks-app .optimise__button.errors{border-color:var(--ub-colorErrorBorder);background:var(--ub-colorErrorBg)}.blocks-app .optimise__button.errors:not(.ant-tag-checkable-checked):hover{border-color:var(--ub-colorErrorBorderHover);color:var(--ub-colorErrorTextHover);background:var(--ub-colorErrorBgHover)}.blocks-app .optimise__button.errors_active{color:#fff;background-color:var(--ub-colorErrorActive);border-color:var(--ub-colorErrorActive)}.blocks-app .optimise__button.valid{border-color:var(--ub-colorSuccessBorder);background:var(--ub-colorSuccessBg)}.blocks-app .optimise__button.valid:not(.ant-tag-checkable-checked):hover{border-color:var(--ub-colorSuccessBorderHover);color:var(--ub-colorSuccessTextHover);background:var(--ub-colorSuccessBgHover)}.blocks-app .optimise__button.valid_active{color:#fff;background-color:var(--ub-colorSuccessActive);border-color:var(--ub-colorSuccessActive)}.blocks-app .optimise .ant-alert-info{width:100%;margin-top:5px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__divider-no-margin.selected-td-form__divider{margin-top:0;margin-bottom:0}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-col.optimise__col-align-right{text-align:right}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-24{margin-bottom:24px}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-16{margin-bottom:16px}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-14{margin-bottom:14px}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-12{margin-bottom:12px}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-8{margin-bottom:8px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__link-blue.ant-typography{color:#177ddc;text-decoration:underline}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-image.optimise__image-auto-height{height:auto}.blocks-app .ant-app .email-pane .ant-tabs .optimise__text-clickable.ant-typography{cursor:pointer}.blocks-app .ant-app .email-pane .ant-tabs .optimise__valid-title.ant-typography{margin:0;font-size:14px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__valid-title-space.ant-space{flex-wrap:wrap}.blocks-app .ant-app .email-pane .ant-tabs .optimise__alert-custom.ant-alert{width:100%;padding:14px 14px 10px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__summary-title.ant-typography{margin-bottom:0}.blocks-app .ant-app .email-pane .ant-tabs .optimise__summary-label{font-size:12px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-score-title.ant-typography{margin:0}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-score-value{margin-right:12px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-score-text.ant-typography{margin-right:12px;font-size:20px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-report-score.ant-typography{font-size:20px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-report-description{margin-left:12px}.blocks-app .img-preview{background-color:var(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadiusXL) * 1px);box-shadow:var(--ub-boxShadow);opacity:0;border:1px solid #fff;max-width:668px;padding:3px;transition:opacity .3s,transform .3s;position:absolute;top:0;left:-15px;transform:translate(-99%)}.blocks-app .img-preview-content{border:1px solid var(--ub-colorBorderSecondary);border-radius:calc(var(--ub-borderRadiusLG) * 1px);background:linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 25%, transparent 75%, var(--ub-colorBorder) 75%), linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 25%, transparent 75%, var(--ub-colorBorder) 75%);background-position:0 0,4px 4px;background-size:8px 8px;overflow:hidden}.blocks-app .img-preview-content table{border-collapse:initial}.dark .blocks-app .img-preview{border-color:#4f4f4f}.blocks-app .indexing-tray{z-index:4010;width:360px;max-width:calc(100vw - 40px);position:fixed;bottom:20px;right:20px}.blocks-app .indexing-tray__card{box-shadow:0 6px 16px #0000001f}.blocks-app .indexing-tray__title{font-size:14px;margin:0!important}.blocks-app .blocks-search{height:100%;min-height:0;overflow:visible}.blocks-app .blocks-search .ant-select-clear{right:30px}.blocks-app .blocks-search form{z-index:1;width:85%;padding:16px 0 0 24px;position:absolute;top:0;left:0}.blocks-app .blocks-search__form{display:none}.blocks-app .blocks-search__form.is_search{display:block}.blocks-app .blocks-search__divider-wrapper{z-index:1;margin-top:12px;position:relative}.blocks-app .blocks-search__divider{pointer-events:none;width:auto;height:20px;margin:24px 0 0;position:absolute;bottom:-20px;left:-24px;right:-13px}.blocks-app .blocks-search__type-wrapper{min-width:35%;min-height:0;padding:20px 24px 14px 0;overflow-y:auto}.blocks-app .blocks-search__type-wrapper ul{padding:0}.blocks-app .blocks-search__type-wrapper li{cursor:pointer;color:var(--ub-colorTextSecondary);text-align:left;margin-bottom:12px;line-height:1.2;list-style:none}.blocks-app .blocks-search__type-wrapper li.active{color:var(--ub-colorLink)}.blocks-app .blocks-search__type-wrapper li:hover{color:var(--ub-colorLinkHover)}.blocks-app .blocks-search__result-wrapper{height:100%;min-height:0;margin-left:0;margin-right:0;padding-left:24px;display:flex;position:relative}.blocks-app .blocks-search__result-wrapper:after{content:"";background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);z-index:1;width:100%;height:20px;position:absolute;top:0;left:0}.blocks-app .blocks-search__result-wrapper.is_search:after{top:72px}.dark .blocks-app .blocks-search__result-wrapper:after{background:linear-gradient(180deg, var(--ub-colorBgBase) -100%, transparent 50%)}.blocks-app .blocks-search__result-wrapper.is_search{flex:auto;min-width:0;margin-left:0;margin-right:0;padding-top:20px;padding-left:0;padding-right:6px;display:block;position:static;overflow:hidden auto}.blocks-app .blocks-search__blocks-wrapper{min-width:65%;min-height:0;padding-top:20px;padding-left:10px;padding-right:14px;overflow-y:scroll}.blocks-app .blocks-search__result-holder{opacity:0}.blocks-app .blocks-search__blocks-wrapper{overflow-anchor:none}.blocks-app .blocks-search__blocks-wrapper.is_search{box-sizing:border-box;width:100%;min-width:0;padding-top:0;padding-left:4px;padding-right:0}.blocks-app .blocks-search__result{margin-bottom:14px}.blocks-app .ant-dropdown .ant-dropdown-menu .blocks-search__result__menu-item{padding:9px}.blocks-app .blocks-search__result-header{z-index:2;justify-content:space-between;padding:4px 10px;font-size:13px;display:none;position:relative;box-shadow:0 5px 20px #00000012}.blocks-app .blocks-search__result-global-mark{z-index:10;pointer-events:none;position:absolute;top:1px;right:1px}.blocks-app .blocks-search__result-body{background:var(--ub-colorBgElevated);border:1px solid var(--ub-colorBorder);border-radius:calc(var(--ub-borderRadiusSM) * 1px);text-align:center;cursor:grab;background-color:var(--ub-controlTmpOutline);min-height:13px;padding:0;transition:border-color .3s cubic-bezier(.645,.045,.355,1),background-color .3s cubic-bezier(.645,.045,.355,1),box-shadow .3s cubic-bezier(.645,.045,.355,1);position:relative;overflow:hidden}.blocks-app .blocks-search__result-body:hover{border-color:var(--ub-colorTextDisabled);cursor:grab!important}.blocks-app .blocks-search__result-body:active{cursor:grabbing}.blocks-app .blocks-search__result-body:not([data-preview-measured]){min-height:180px}.blocks-app .blocks-search__result-body:after{content:"";z-index:1;width:100%;height:100%;display:block;position:absolute;top:0;left:0}.blocks-app .blocks-search__result-html{transform-origin:0 0;text-align:left;min-width:660px;height:100%;overflow-x:visible}.blocks-app .blocks-search__result-body:not([data-preview-measured]) .blocks-search__result-html{min-height:1px}.blocks-app .blocks-search .em-dragging-element .blocks-search__result-body{background-color:var(--ub-controlTmpOutline)}.blocks-app .blocks-search .em-ghost-element{border-radius:calc(var(--ub-borderRadiusXL) * 1px);overflow:hidden;background-color:var(--ub-colorBgContainer)!important}.blocks-app .email-pane .ant-tabs .blocks-search__result-divider.ant-divider-horizontal{width:100%;margin-left:0;margin-right:0}.blocks-app .blocks-search.is_search{display:flex}.blocks-app .blocks-search.is_search .blocks-search__type-wrapper{min-width:33%;padding-left:24px;padding-right:0}.blocks-app .block-search__preview{background-color:var(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadiusXL) * 1px);box-shadow:var(--ub-boxShadow);opacity:0;border:1px solid #fff;width:668px;padding:3px;transition:opacity .3s,transform .3s;position:absolute;top:0;left:-15px;transform:translate(-99%)}.blocks-app .block-search__preview-title{color:var(--ub-colorTextSecondary);padding:8px 15px;font-size:14px}.blocks-app .block-search__preview-content{border:1px solid var(--ub-colorBorderSecondary);border-radius:calc(var(--ub-borderRadiusLG) * 1px);overflow:hidden}.blocks-app .block-search__preview-content table{border-collapse:initial}.dark .blocks-app .block-search__preview{border-color:#4f4f4f}.blocks-app .email-pane__col-wrapper_reverse .block-search__preview{left:auto;right:-15px;transform:translate(99%)}.blocks-app .block-global-badge{color:var(--ub-colorTextSecondary);pointer-events:auto;justify-content:center;align-items:center;line-height:0;display:inline-flex}.blocks-app .block-global-badge svg{display:block}.blocks-app .block-global-badge--tile{box-sizing:border-box;background-color:#ffffffb8;border-radius:6px;width:24px;min-width:24px;height:24px;min-height:24px;padding:0;box-shadow:0 1px 2px #0000001a}.blocks-app .block-global-badge--tile svg{flex-shrink:0}.blocks-app body.dark .block-global-badge--tile,.dark .blocks-app .block-global-badge--tile{color:#ffffffe0;background-color:#0000008c;box-shadow:0 1px 3px #00000059}.blocks-app .discuss-wrapper{flex-direction:column;flex:1;height:100%;min-height:0;display:flex}.blocks-app .discuss-wrapper .ant-tabs-content-holder,.blocks-app .discuss-wrapper .ant-tabs-content,.blocks-app .discuss-wrapper .ant-tabs-tabpane,.blocks-app .discuss-wrapper .ant-tabs-tabpane-active{flex-direction:column;flex:1;min-height:0;display:flex}.blocks-app .discuss-wrapper .ant-tabs-tabpane-active{overflow:hidden}.blocks-app .discuss-wrapper .discuss-main{flex-direction:column;height:100%;min-height:0;display:flex;position:relative;overflow:hidden}.blocks-app .discuss-main>.comment-list{flex:auto;min-height:0;margin-bottom:24px;overflow:hidden auto}.blocks-app .discuss-main>form{flex-shrink:0}.blocks-app .discuss-main .ant-comment-content{flex:1;min-width:0}.blocks-app .discuss-main .ant-comment-content-author{flex-wrap:wrap;align-items:baseline;gap:8px;margin-bottom:4px;display:flex}.blocks-app .discuss-main .ant-comment .ant-comment-content-author-name{color:var(--ub-colorTextBase);font-weight:500;transition:color .3s;font-size:14px!important;line-height:1.4!important}.blocks-app .discuss-main .ant-comment-content-author-time{color:var(--ub-colorTextSecondary);white-space:nowrap;font-size:12px;line-height:1.4}.blocks-app .discuss-main .comment-item-noavatar .ant-comment-content-detail{margin-left:0}.blocks-app .discuss-main .ant-comment-content-detail p{white-space:normal;color:var(--ub-colorText);margin:0 0 16px;line-height:1.4}.blocks-app .discuss-main .ant-comment-content-detail :not(.ant-btn,.buttons-variants,.buttons-variants *){-webkit-user-select:text;user-select:text}.blocks-app .discuss-main .ant-dropdown-trigger{z-index:1;color:var(--ub-colorText);margin:-36px 0 -1px -24px;padding:36px 0 1px 24px;position:relative}.blocks-app .discuss-main .ant-comment-nested .ant-dropdown-trigger{margin-left:-18px;padding-left:18px}.blocks-app .discuss-main .ant-comment-inner{transition:all .5s}.blocks-app .discuss-main .ant-comment.active>.ant-comment-inner{background:#efdbff}.blocks-app .discuss-main .targetted-comment-item>.ant-comment-inner{background:var(--ub-colorInfoBg);cursor:pointer}.blocks-app .discuss-main .ant-comment-actions{opacity:.6;margin-top:6px;transition:all .3s cubic-bezier(.645,.045,.355,1);display:none}.blocks-app .discuss-main .ant-form-item-control-input-content{margin-left:2px}.blocks-app .discuss-main .ant-tooltip-container{text-align:center}.blocks-app .discuss-main .ant-comment-content:hover .ant-comment-actions{opacity:1}.blocks-app .discuss-main .replyEditMode{opacity:.5;display:none}.blocks-app .discuss-main .icon-target{font-size:16px;transform:translateY(5%)}.blocks-app .discuss-main .comment-icon-target{border-radius:8px;margin-left:5px;padding:0 8px 2px}.blocks-app .discuss-main .comment-icon-target:hover{cursor:pointer}.blocks-app .discuss-main .ant-btn.ant-btn-primary.button-target.button-target_choose{background:var(--ub-colorInfo)}.blocks-app .discuss-main .ant-space button{margin-right:0}.blocks-app .anticon-history{transform:scaleX(-1)}.blocks-app .history-panel{border-right:1px solid var(--ub-colorBorder);flex-direction:column;justify-content:space-between;height:100%;display:flex;box-shadow:-12px 0 48px 16px #00000008,-9px 0 28px #0000000d,-6px 0 16px -8px #00000014}.blocks-app .history-panel__sider{z-index:11;background:var(--ub-colorBgContainer);height:100%;position:absolute;top:0;bottom:0;left:80px}.blocks-app .history-panel__list-header,.blocks-app .history-panel__header{justify-content:space-between;align-items:center;padding:0 24px 9px;font-weight:500;display:flex}.blocks-app .history-panel__list-header :last-child{min-width:60px}.blocks-app .history-panel__header{padding-left:24px;padding-right:24px}.blocks-app .history-panel__list-header:before{background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);border-top:1px solid var(--ub-colorBorderSecondary);content:"";z-index:1;background-position:0 -2px;background-repeat:no-repeat;border-bottom:none;height:20px;position:absolute;inset:30px 0 -20px}.dark .blocks-app .history-panel__list-header:before{background:linear-gradient(180deg, var(--ub-colorBgBase), transparent 40%)}.blocks-app .history-panel__header-title{font-size:14px;font-style:normal;line-height:24px}.blocks-app body.dark .history-panel__header-title{color:#fff}.blocks-app .history-panel__header-close{color:#00000073;margin-right:-16px}.blocks-app body.dark .history-panel__header-close{color:#fff}.blocks-app .history-panel__list{height:100%;margin:10px -24px 0}.blocks-app .history-panel__list .ant-list-header{border:none;margin-bottom:5px;padding:0;font-weight:500}.blocks-app .history-panel__list .ant-spin-nested-loading,.blocks-app .history-panel__list .ant-spin-container{height:100%}.blocks-app .history-panel__list .ant-list-items{height:calc(100% - 30px);overflow:auto}.blocks-app .history-panel__list .ant-list-item{cursor:pointer;border:none;padding:9px 24px}.blocks-app .history-panel__list .ant-list-item:hover{background-color:var(--ub-colorFillQuaternary)}.blocks-app .history-panel__list .ant-btn.ant-btn-sm{border:none;height:22px;line-height:1;padding:0!important}.blocks-app .history-panel .ant-list-item{padding:9px 0}.blocks-app .history-panel__list-date,.blocks-app .history-panel__list-header .history-panel__list-date{min-width:130px}.blocks-app .history-panel__list-author{white-space:nowrap;text-overflow:ellipsis;flex:1;overflow:hidden}.blocks-app .history-panel__restore{opacity:0;visibility:hidden}.blocks-app .history-panel__item_active{background-color:var(--ub-colorFillSecondary)}.blocks-app body.dark .history-panel__item_active{background:#111b26}.blocks-app .history-panel__item_active .history-panel__restore{opacity:1;visibility:visible}.blocks-app .ant-layout-sider.history-panel__sider .ant-layout-sider-children{opacity:1;width:500px;height:100%;transition:opacity .5s;position:absolute;right:0}.blocks-app .ant-layout-sider-collapsed.history-panel__sider .ant-layout-sider-children{opacity:0}.blocks-app .add-new-block-modal__save-btn .ant-btn-icon .anticon{font-size:22px;line-height:0}.blocks-app .add-new-block-modal__save-btn .ant-btn-icon .anticon svg{width:22px;height:22px}.blocks-app .modal-footer{justify-content:flex-end;padding:8px 0;display:flex}.blocks-app .modal-spinner{justify-content:center;align-items:center;height:108px;display:flex}',e=window.__useblocks_styles__||(window.__useblocks_styles__={sheets:{},order:[]}),p=t;if(!e.sheets[p]){var a=null;try{typeof CSSStyleSheet=="function"&&"replaceSync"in CSSStyleSheet.prototype&&(a=new CSSStyleSheet,a.replaceSync(t))}catch{a=null}if(a){if(!e.host||!e.host.isConnected||!e.host.sheet){var o=document.createElement("style");o.setAttribute("data-useblocks","true"),document.head.appendChild(o),e.host=o}for(var i=e.host.sheet,r=0;r<a.cssRules.length;r++)try{i.insertRule(a.cssRules[r].cssText,i.cssRules.length)}catch{}(e.texts||(e.texts=[])).push(t),(e.listeners||[]).forEach(function(l){try{l(t)}catch{}})}else{var o=document.createElement("style");o.setAttribute("data-useblocks","true"),o.appendChild(document.createTextNode(t)),document.head.appendChild(o)}e.sheets[p]=!0,e.order.push(p)}}}catch(l){console.error("vite-plugin-css-injected-by-js",l)}})();
|
|
9
|
-
__useblocks__.define("static/core/5e7c221f.js",["require","exports","module","static/core/2ff39ddf.js","static/core/c1dc75d5.js","static/core/d68c5a64.js","static/core/c75aa9c7.js","static/core/3c41f519.js","static/core/9977c164.js","static/core/9242dd6e.js","react","react/jsx-runtime","__delivery__/libs","react-dom","vite/preload-helper","classnames","dayjs"],function(fo,no,Lm){const to=fo("./2ff39ddf.js"),xo=fo("./c1dc75d5.js"),r=fo("./d68c5a64.js"),wo=fo("./c75aa9c7.js"),di=fo("./3c41f519.js"),La=fo("./9977c164.js"),W=fo("./9242dd6e.js");let n=fo("react");n=to.__toESM(n);let o=fo("react/jsx-runtime"),t=fo("__delivery__/libs"),Oa=fo("react-dom"),Lt=fo("vite/preload-helper"),He=fo("classnames");He=to.__toESM(He);let Oo=fo("dayjs");Oo=to.__toESM(Oo);var g=to.__toESM(r.require_prop_types());async function Tr(e){if(typeof createImageBitmap=="function")try{const i=await createImageBitmap(e);try{return{width:i.width,height:i.height}}finally{i.close?.()}}catch{}return new Promise((i,l)=>{const s=URL.createObjectURL(e),a=new Image;a.onload=()=>{URL.revokeObjectURL(s);const d=a.naturalWidth||a.width,c=a.naturalHeight||a.height;d>0&&c>0?i({width:d,height:c}):l(new Error("Could not read image dimensions"))},a.onerror=()=>{URL.revokeObjectURL(s),l(new Error("Could not decode image"))},a.src=s})}function ft(e){return e.trim()}var $a=67108864,Fa=2e3;function Ot(e){e.abandonTimer!==void 0&&(clearTimeout(e.abandonTimer),e.abandonTimer=void 0)}function Rr(e,i){return i?new Promise((l,s)=>{if(i.aborted){s(new DOMException("Aborted","AbortError"));return}const a=()=>{s(new DOMException("Aborted","AbortError"))};i.addEventListener("abort",a,{once:!0}),e.then(d=>{i.removeEventListener("abort",a),l(d)},d=>{i.removeEventListener("abort",a),s(d)})}):e}function Ma(e={}){const i=e.maxCacheBytes??$a,l=e.abandonDelayMs??Fa,s=new Map,a=new Map;let d=0;function c(_){const E=s.get(_);E&&(d-=E.size,s.delete(_))}function p(_,E){if(c(_),!(E.size>i)){s.set(_,E),d+=E.size;for(const w of s.keys()){if(d<=i)break;c(w)}}}function f(_){const E=a.get(_);E&&(Ot(E),a.delete(_))}function x(_,E){E.waiters-=1,!(E.waiters>0||E.abandonTimer!==void 0||a.get(_)!==E)&&(E.abandonTimer=setTimeout(()=>{E.abandonTimer=void 0,!(a.get(_)!==E||E.waiters>0)&&(a.delete(_),E.controller.abort())},l))}function k(_,E,w){return E.waiters+=1,Ot(E),w.then(()=>x(_,E),()=>x(_,E)),w}async function b(_,E,w){const v=ft(_);if(!v)throw new Error("Empty image URL");const A=s.get(v);if(A){if(E?.aborted)throw new DOMException("Aborted","AbortError");return s.delete(v),s.set(v,A),A}const j=a.get(v);if(j)return k(v,j,Rr(j.promise,E));const C=new AbortController,P={promise:w(v,C.signal).then(Y=>(f(v),p(v,Y),Y)).catch(Y=>{throw f(v),Y}),controller:C,waiters:0,abandonTimer:void 0};return a.set(v,P),k(v,P,Rr(P.promise,E))}function h(_){const E=ft(_);if(!E)return;const w=a.get(E);w&&(Ot(w),w.controller.abort(),a.delete(E)),c(E)}function T(){for(const[,_]of a)Ot(_),_.controller.abort();a.clear(),s.clear(),d=0}return{resolve:b,abandonKey:h,invalidateAll:T}}async function yr(e,i){if(!e||typeof e.findFileByUrl!="function")return null;const l=await e.findFileByUrl(i);if(!l)return null;const s=typeof e.getFileById=="function"&&l.id&&await e.getFileById(l.id)||l,a=s.url||i,d=s.thumbnailUrl||s.thumbnail||a||(typeof e.getThumbnailUrl=="function"?await e.getThumbnailUrl(s):"")||"";return d?{file:s,previewUrl:d}:null}function $t(e){if(!e)return!1;try{return new URL(e,typeof window<"u"&&window.location?window.location.origin:"http://localhost").pathname.includes("/static/media/")}catch{return!1}}function Da(e){if(!(e instanceof Blob)||e.size===0)throw new r.e("Failed to download file from the URL.","UploadUrlDownloadFailed");const i=e.type?.split(";")[0]?.trim()||"image/png";if(!i.startsWith("image/"))throw new r.e("Content type at the URL is not allowed.","UploadUrlContentTypeNotAllowed");return{blob:e,mimeType:i}}async function Va(e,i){const l=await fetch(e,i);if(!l.ok)throw new Error(`Server returned ${l.status}`);return l.blob()}async function Ha(e,i,l){const s=l?{signal:l}:void 0,{blob:a}=await r.se(e,{handleFileProxy:async d=>{const c=await i.fireFileProxy(d);return r.pickFileProxyBlobFromFireResults(c)??null},handleProxyUrl:async d=>{const c=await i.fireProxyUrl(d);return r.pickProxyUrlOverrideFromFireResults(c,d)},fetchWithProxy:(d,c,p)=>xo.fetchWithResourceProxy(d,{config:i.appConfig,standalone:i.isStandalone,intent:p?.intent||"downloadBlob",validateBlob:async f=>!f.type||f.type.startsWith("image/"),init:c})},d=>Va(d,s),Da,{fetchInit:s});return a}function wr(){const e=r.useAppConfig(),i=r.useIsStandalone(),l=r.useProjectData(),s=r.useEditorProjectId(),a=l?.id!==void 0?String(l.id):s||"",d=r.useEventEmitter(xo.events.FILE_PROXY_EVENT_ID),c=r.useEventEmitter(xo.events.PROXY_URL_EVENT_ID);return(0,n.useCallback)(async(p,f)=>Ha(p,{appConfig:e,isStandalone:i,fireFileProxy:x=>d.fire({url:x,project:a}),fireProxyUrl:x=>c.fire({url:x,project:a})},f),[e,a,i,d,c])}function Ua(e){return xo.getContainer(e).getOrCreateInstance(xo.IMAGE_BLOB_RESOLVER_ID,()=>Ma())}function jr(){const e=r.useStore();return(0,n.useMemo)(()=>Ua(e),[e])}function Ft(e){const i=String(e??"").split(";")[0].trim();if(!i)return"";const l=i.toLowerCase(),s=l.indexOf("/");if(s===-1)return l;const a=l.slice(s+1);return a==="svg+xml"?"svg":a}var vr=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),ci=({onChange:e,value:i,validateStatus:l,placeholder:s,disabled:a,name:d,elementSettings:c,imageInfo:p,previewReloadSignal:f,onRemotePreviewValidate:x})=>{const k=r.useCurrentUser(),b=r.useProjectData(),h=r.useAppConfig(),T=r.useIsStandalone(),{__:_}=r.useI18n();r.useSendPostMessage();const E=r.useSendPostMessageEx(),{openImagePicker:w}=r.useImagePicker(),v=r.useStorageProvider(),A=r.useRestClient(),j=b?.id!==void 0?String(b?.id):"",C=k?.id!=="0"?String(k.id):"",{dataProvider:P}=(0,n.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:v,projectId:j,restApi:A,i18n:{__:_},pathPostfix:C,appConfig:h,isStandalone:T}),[h,T,j,A,v,C,_]),Y=wr(),[z]=r.useLazyGetImageInfoQuery(),[$,O]=(0,n.useState)({width:"",height:"",size:""}),[y,oe]=(0,n.useState)(!1),[G,q]=(0,n.useState)(0),[te,ue]=(0,n.useState)(""),me=(0,n.useRef)(""),se=(0,n.useRef)(f?.counter||0),_e=jr(),ve=(0,n.useRef)(""),de=(0,n.useRef)(""),[De,ye]=(0,n.useState)(0),re=r.usePlanFeatureGate("image_editor"),ke=()=>{ve.current&&(URL.revokeObjectURL(ve.current),ve.current="")};(0,n.useEffect)(()=>{if(!i){O({width:"",height:"",size:"",format:""}),me.current="",ue(""),ke();return}if(i.startsWith("data:")||i.startsWith("blob:")){ke(),me.current=i,ue(i),O({width:"",height:"",size:"",format:""});return}const ee=r.stripEmVersionFromUrlString(i);de.current=ee;const J=ft(ee),H=new AbortController;let X=!1;const ce=async ne=>{ke();const Ae=De?r.appendEmVersionForPreviewReload(ne):ne;me.current=Ae,ue(Ae);try{const{data:we}=await z(ee);return X||!we?!1:(O({width:we?.width,height:we?.height,size:we?.fileSize!=null?(we.fileSize/1024).toFixed(0):"",format:Ft(we?.format)}),!0)}catch{return!1}},xe=async()=>{const ne=await _e.resolve(J,H.signal,Y);if(X)return;const{width:Ae,height:we}=await Tr(ne);if(X)return;ke();const $e=URL.createObjectURL(ne);ve.current=$e,me.current=$e,ue($e),O({width:Ae,height:we,size:(ne.size/1024).toFixed(0),format:Ft(ne.type)})};return(async()=>{try{if(!T){const ne=await yr(P,ee);if(ne?.previewUrl&&await ce(ne.previewUrl))return}await xe()}catch{X||(ke(),me.current="",ue(""),O({width:"",height:"",size:"",format:""}))}})(),()=>{X=!0,H.abort()}},[i,P,Y,z,T,_e,De]);const ae=(0,n.useCallback)(()=>{const ee=de.current;ee&&_e.abandonKey(ft(ee)),ye(Date.now())},[_e]);(0,n.useEffect)(()=>{!f?.counter||f.name!==d||f.counter!==se.current&&(se.current=f.counter,ae())},[d,f,ae]),(0,n.useEffect)(()=>()=>ke(),[]);const Q=async(ee=null)=>{const J=d.startsWith("src"),H=ee||(J?r.MODALS.UPLOAD_IMAGE_MODAL:r.MODALS.UPLOAD_BACKGROUND_MODAL),X=r.stripEmVersionFromUrlString(i||""),ce=await w({kind:J?"img":"background",currentUrl:$t(X)?"":X,entryModal:H});if(!ce?.url)return;const xe=X===r.stripEmVersionFromUrlString(ce.url);(!xe||ce.url!==i)&&e(ce.url),ce.meta?.mode==="save"&&xe&&(ae(),J&&E(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(ce.url)}))},he=[{label:_("Upload"),key:"Upload",onClick:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}];h.imageCenterStockEnabled&&he.push({label:_("Stock"),key:"Stock",onClick:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_STOCK:r.MODALS.UPLOAD_BACKGROUND_MODAL_STOCK)}),h.imageCenterGifEnabled&&he.push({label:_("GIF"),key:"GIF",onClick:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_GIF:r.MODALS.UPLOAD_BACKGROUND_MODAL_GIF)}),h.elementAIimageEnabled&&he.push({label:_("AI"),key:"AI",onClick:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_AI:r.MODALS.UPLOAD_BACKGROUND_MODAL_AI)});const pe=()=>{oe(!1)};return(0,o.jsxs)("div",{className:(0,He.default)("upload-bg-image",{"upload-bg-image_disabled":a}),children:[i?(0,o.jsxs)("div",{className:"ant-input-file-uploader upload-bg-image__inner-wrap",onClick:ee=>{ee.target?.closest(".upload-bg-image__edit")||ee.target?.closest(".upload-bg-image__edit-menu")||ee.target?.closest(".upload-bg-image__menu")||ee.target?.closest(".inputGroup")||Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)},children:[(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,popupRender:()=>h.imagePathDropdownEnabled?(0,o.jsx)("div",{className:"inputGroup",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image,size:20,strokeWidth:h.iconStrokeWidth,style:{verticalAlign:"text-top"}}),allowClear:!0,onChange:e,value:i,placeholder:s,name:d,disabled:a,className:"upload-bg-image__input"})}):(0,o.jsx)(o.Fragment,{}),classNames:{root:"upload-bg-image__dropdown-overlay"},styles:{root:{top:32,marginTop:"8px",width:347,left:0}},trigger:["hover"],placement:"bottom",getPopupContainer:ee=>ee.closest(".upload-bg-image__inner-wrap"),children:(0,o.jsxs)("div",{className:"upload-bg-image__hover-container",style:{display:"flex",alignItems:"center"},children:[(0,o.jsx)("div",{className:"upload-bg-image__uploader",children:(0,o.jsx)("div",{className:"upload-bg-image__uploader-content",children:(0,o.jsxs)("div",{className:"upload-bg-image__uploader-content-inner",children:[(0,o.jsx)("div",{className:"upload-bg-image__uploader-img-wrap",children:te?(0,o.jsx)("img",{className:"upload-bg-image__uploader-img",src:te,alt:"",onLoad:()=>{x&&vr(r.stripEmVersionFromUrlString(i||""))&&x("success")},onError:()=>{const ee=de.current,J=r.stripEmVersionFromUrlString(te||""),H=r.stripEmVersionFromUrlString(ee||"");if(ee&&J!==H){me.current=ee,ue(ee);return}x&&vr(H)&&x("error")}}):(0,o.jsx)("div",{className:"upload-bg-image__uploader-img-placeholder","aria-hidden":!0})}),(0,o.jsx)("div",{className:"upload-bg-image__uploader-icons-wrap",children:(0,o.jsx)("div",{className:"upload-bg-image__uploader-content"})})]})})}),$.width&&$.height?(0,o.jsxs)("div",{className:"image-size",children:[$.width," × ",$.height,!!c&&(c.type===r.ELEMENT_TYPES.IMG||c.type===r.ELEMENT_TYPES.CAROUSEL)&&" → "+p.renderedWidth+" × "+p.renderedHeight,(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsxs)("span",{children:[$.size," ",_("kB")]}),$.format&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)("span",{className:"image-size-format",children:$.format})]})]}):(0,o.jsx)(t.ui_kit$Text,{type:"secondary",className:"image-empty-text",children:s})]})}),(0,o.jsx)("div",{style:{flexGrow:1}}),$.format!=="gif"&&h.imageCenterEditorEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:_("Edit"),children:(0,o.jsx)(t.ui_kit$Text,{type:"link",className:"upload-bg-image__edit",children:(0,o.jsx)(r.EmIcons,{icon:"Edit",component:t.icons$Edit,size:16,strokeWidth:h.iconStrokeWidth,onClick:()=>{re.isLocked?(oe(!0),q(r.FEATURE_UPSELL_SLIDE.image_editor)):Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_EDIT:r.MODALS.UPLOAD_BACKGROUND_MODAL_EDIT)}})})}),(0,o.jsx)(t.ui_kit$Dropdown,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:he},classNames:{root:"upload-bg-image__menu"},children:(0,o.jsx)(t.ui_kit$Text,{type:"link",className:"upload-bg-image__edit-menu image-change",children:i?(0,o.jsx)(r.EmIcons,{size:16,strokeWidth:h.iconStrokeWidth,icon:"SyncOutlined",component:t.icons$SyncOutlined,onClick:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}):_("Upload")})},"Actions")]}):(0,o.jsx)(t.ui_kit$Button,{type:"default",block:!0,onClick:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD),icon:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image,size:16,strokeWidth:h.iconStrokeWidth}),children:_("Add image")}),(0,o.jsx)(r.PlanUpgradePrompt,{open:y,onCancel:pe,initialSlide:G})]})};ci.propTypes={};var Wa=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),za=(e,i,l)=>i||(l?.type===r.ELEMENT_TYPES.CAROUSEL?["images",e]:Array.isArray(e)?e:[e]),Ir=e=>Array.isArray(e)?e.join("_"):e,No=({form:e,label:i,name:l,watchPath:s,disabled:a=!1,elementSettings:d,previewReloadSignal:c=void 0})=>{const{token:p}=(0,t.ui_kit$useToken)(),[f,x]=(0,n.useState)("success"),k=(0,n.useMemo)(()=>({marginBottom:p.formItemMarginBottomXS}),[p.formItemMarginBottomXS]),b=t.ui_kit$Form.useWatch(za(l,s,d),e);return(0,n.useEffect)(()=>{if(!b){x("");return}if(typeof b=="string"&&(b.startsWith("data:")||b.startsWith("blob:"))){x("success");return}if(Wa(b)){x("validating");return}x("success")},[b]),(0,o.jsx)(t.ui_kit$Form.Item,{name:l,validateStatus:f,style:k,children:(0,o.jsx)(ci,{validateStatus:f,placeholder:i,name:Ir(l),disabled:a,elementSettings:d,imageInfo:d?.type===r.ELEMENT_TYPES.CAROUSEL?d?.carouselImages?.[Ir(l).split("_")[1]]:d,previewReloadSignal:c,onRemotePreviewValidate:x})})};No.propTypes={label:g.default.string.isRequired,name:g.default.oneOfType([g.default.string,g.default.arrayOf(g.default.oneOfType([g.default.string,g.default.number]))]).isRequired,watchPath:g.default.arrayOf(g.default.oneOfType([g.default.string,g.default.number])),tooltipTitle:g.default.string,disabled:g.default.bool,previewReloadSignal:g.default.shape({name:g.default.string,counter:g.default.number}),form:g.default.shape({getFieldValue:g.default.func.isRequired}).isRequired},No.defaulProps={disabled:!1,previewReloadSignal:null};var So=({form:e,oneBorderRadiusValue:i,setOneBorderRadiusValue:l,elementSettings:s,namePrefix:a="",typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),p=d==="mobile",f=p?"mobileBorderRadius":"borderRadius",x=p?"mobileBorderRadiusAll":"borderRadiusAll",k=p?"mobileBorderRadiusTopLeft":"borderRadiusTopLeft",b=p?"mobileBorderRadiusTopRight":"borderRadiusTopRight",h=p?"mobileBorderRadiusBottomRight":"borderRadiusBottomRight",T=p?"mobileBorderRadiusBottomLeft":"borderRadiusBottomLeft",_=p?W.MOBILE_BORDER_RADIUS_POSITION:W.BORDER_RADIUS_POSITION,E=()=>{const w=e.getFieldsValue(!0);let v;i?(e.setFieldsValue({[k]:w[x]||null,[T]:w[x]||null,[b]:w[x]||null,[h]:w[x]||null}),v={[f]:{[_[k]]:w[x]||0,[_[T]]:w[x]||0,[_[b]]:w[x]||0,[_[h]]:w[x]||0}}):w[k]===w[T]&&w[k]===w[b]&&w[k]===w[h]?(e.setFieldsValue({[x]:w[k]}),v={[f]:{[_[x]]:w[k]}}):(e.setFieldsValue({[k]:null,[T]:null,[b]:null,[h]:null}),v={[f]:{[_[x]]:0,[_[k]]:0,[_[T]]:0,[_[b]]:0,[_[h]]:0}});const A=p?{mobileBorderRadius:{all:w.mobileBorderRadiusAll||null,classNamePrefix:"em-mob-border_radius_all-"}}:{[`${a}${f}`]:{...s[`${a}${f}`],...v[`${a}${f}`]}};c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:A}),l(j=>!j)};return(0,o.jsx)(t.ui_kit$FormBorderRadiusInputs,{namePrefix:a,typeOfForm:d,oneBorderRadiusValue:i,onToggle:E,borderRadiusIcon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"BorderRadius",component:t.icons$BorderRadius,className:"selected-td-form__icon-radius"})})};So.displayName="SelectedElementFormBorderRadius";var Ga="em-mob-text_align-",Ya=({value:e,onChange:i,onSync:l,fieldName:s,...a})=>{const d=(typeof e=="object"?e?.value:e)??"",c=p=>{const f={classNamePrefix:Ga,value:p};i?.(f),l?.({[s]:f})};return(0,o.jsx)(t.ui_kit$FormAlignControl,{value:d,onChange:c,...a})},Uo=({form:e,elementSettings:i,imgParent:l=!1,name:s="align",tooltipTitle:a,typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),p=r.useAppConfig(),f=d==="mobile",x=f?"mobileAlign":s;if(f){const k=b=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:b})};return(0,o.jsx)(t.ui_kit$Form.Item,{name:x,children:(0,o.jsx)(Ya,{fieldName:x,onSync:k,disabled:l&&!i.parent,strokeWidth:p.iconStrokeWidth,tooltipTitle:a})})}return(0,o.jsx)(t.ui_kit$Form.Item,{name:x,children:(0,o.jsx)(t.ui_kit$FormAlignControl,{disabled:l&&!i.parent,strokeWidth:p.iconStrokeWidth,tooltipTitle:a})})},Mo=({form:e,elementSettings:i,tooltipTitle:l,disabled:s=!1,isNewIconType:a=!1,typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),p=r.useAppConfig(),f=d==="mobile",x=f?"mobileVerticalAlign":"valign",k=b=>{e.setFieldsValue({[x]:b}),f||c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[x]:b}})};return(0,o.jsx)(t.ui_kit$Form.Item,{name:x,children:(0,o.jsx)(t.ui_kit$FormVerticalAlignControl,{...!f&&{value:i.valign,onChange:k},disabled:s,isNewIconType:a,strokeWidth:p.iconStrokeWidth})})},Xa=["mobileBoxShadowHOffset","mobileBoxShadowVOffset","mobileBoxShadowBlurRadius","mobileBoxShadowSpreadRadius","mobileBoxShadowColor","mobileBoxShadowInset"],Ka=({form:e,elementSettings:i,enableSwitch:l,usedColors:s,withoutShadowLabel:a})=>{const d=r.useSendPostMessage(),c=i.mobileBoxShadow,[p,f]=(0,n.useState)(!c||c.hOffset===0&&c.vOffset===0&&c.blurRadius===0&&c.spreadRadius===0),x=t.ui_kit$Form.useWatch(Xa,e);(0,n.useEffect)(()=>{if(!x)return;const[b,h,T,_,E,w]=x;(b===0||b===void 0||b===null)&&(h===0||h===void 0||h===null)&&(T===0||T===void 0||T===null)&&(_===0||_===void 0||_===null)&&(E===""||E===void 0||E===null)&&(w===!1||w===void 0)||f(!1)},[x]);const k=()=>{f(b=>!b),e.setFieldsValue({mobileBoxShadowHOffset:p?"":0,mobileBoxShadowVOffset:p?"":0,mobileBoxShadowBlurRadius:p?"":0,mobileBoxShadowSpreadRadius:p?"":0,mobileBoxShadowColor:"",mobileBoxShadowInset:!1}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBoxShadow:{classNamePrefix:"em-mob-box_shadow-",hOffset:p?null:0,vOffset:p?null:0,blurRadius:p?null:0,spreadRadius:p?null:0,color:null,inset:!1}}})};return(0,o.jsxs)(o.Fragment,{children:[l&&(0,o.jsx)("div",{style:{float:"right",marginTop:-9,marginRight:50},children:(0,o.jsx)(t.ui_kit$Switch,{id:"without-shadow",label:a,labelSize:"small",size:"small",checked:p,onChange:k})}),(0,o.jsx)("p",{style:{paddingBottom:"8px",margin:"-30px 0 0"},children:" "}),(0,o.jsx)(t.ui_kit$FormBoxShadowInputs,{typeOfForm:"mobile",usedColors:s})]})},jo=({typeOfForm:e="desktop",form:i,elementSettings:l,enableSwitch:s=!0})=>{const{__:a}=r.useI18n(),d=r.useSelector(r.selectEmailSettings).usedColors;return e==="mobile"&&i&&l?(0,o.jsx)(Ka,{form:i,elementSettings:l,enableSwitch:s,usedColors:d,withoutShadowLabel:a("Without shadow")}):(0,o.jsx)(t.ui_kit$FormBoxShadowInputs,{typeOfForm:e,usedColors:d})};jo.displayName="SelectedElementFormBoxShadow";var vo=({form:e,elementSettings:i,directionControl:l})=>{const{__:s}=r.useI18n();return(0,o.jsx)(t.ui_kit$FormDisplayControl,{directionControl:l,className:"selected-element-form-show",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"show",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$Radio.Group,{children:(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Radio.Button,{value:"all",children:s("Both")}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:s("Desktop"),children:(0,o.jsx)(t.ui_kit$Radio.Button,{value:"desktop",children:(0,o.jsx)(r.EmIcons,{icon:"DesktopOutlined",component:t.icons$DesktopOutlined})})}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:s("Mobile"),children:(0,o.jsx)(t.ui_kit$Radio.Button,{value:"mobile",children:(0,o.jsx)(r.EmIcons,{icon:"MobileOutlined",component:t.icons$MobileOutlined})})})]})})})})},ui=({form:e,elementSettings:i,handleChangeValues:l})=>{const{__:s}=r.useI18n(),a=(0,n.useRef)(),{token:d}=(0,t.ui_kit$useToken)(),[c,p]=(0,n.useState)(!1),[f,x]=(0,n.useState)(!1),[k,b]=(0,n.useState)(!1),[h,T]=(0,n.useState)(!1),[_,E]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let O=new URL("https://emailmaker.ru/?"+i.countdown);p(O.searchParams.get("font1").endsWith("-b")||O.searchParams.get("font1").endsWith("-bi")),x(O.searchParams.get("font1").endsWith("-i")||O.searchParams.get("font1").endsWith("-bi")),b(O.searchParams.get("font2").endsWith("-b")||O.searchParams.get("font2").endsWith("-bi")),T(O.searchParams.get("font2").endsWith("-i")||O.searchParams.get("font2").endsWith("-bi")),E(O.searchParams.get("tp")==="true")},[i]);const w=[{value:"-12",label:s("-12:00 Apia")},{value:"-11",label:s("-11:00 Pago Pago, Midway Atoll")},{value:"-10",label:s("-10:00 Honolulu, Anchorage")},{value:"-9",label:s("-9:00 Anchorage, Yukon")},{value:"-8",label:s("-8:00 Los Angeles, Vancouver")},{value:"-7",label:s("-7:00 Denver, Phoenix")},{value:"-6",label:s("-6:00 Mexico City, Guadalajara")},{value:"-5",label:s("-5:00 New York, Toronto, Havana")},{value:"-4",label:s("-4:00 Caracas, Santo Domingo")},{value:"-3",label:s("-3:00 Buenos Aires, Santiago, Montevideo")},{value:"-2",label:s("-2:00 South Georgia, Saint Helena")},{value:"-1",label:s("-1:00 Azores, Cape Verde")},{value:"0",label:s("+0:00 London, Lisbon, Dublin")},{value:"1",label:s("+1:00 Paris, Berlin, Rome")},{value:"2",label:s("+2:00 Athens, Kiev, Istanbul")},{value:"3",label:s("+3:00 Istanbul, Doha, Baghdad")},{value:"4",label:s("+4:00 Baku, Dubai, Tbilisi")},{value:"5",label:s("+5:00 Karachi, Tashkent, Islamabad")},{value:"6",label:s("+6:00 Almaty, Dhaka, Bishkek")},{value:"7",label:s("+7:00 Bangkok, Ho Chi Minh City, Jakarta")},{value:"8",label:s("+8:00 Beijing, Hong Kong, Singapore")},{value:"9",label:s("+9:00 Tokyo, Seoul, Jayapura")},{value:"10",label:s("+10:00 Sydney, Melbourne, Port Moresby")},{value:"11",label:s("+11:00 Honiara, Nuku'alofa, Apia")}],v=[{value:"20",label:s("20 s")},{value:"40",label:s("40 s")},{value:"60",label:s("60 s")}],A=[{value:"arial",label:"Arial"},{value:"courier-new",label:"Courier New"},{value:"georgia",label:"Georgia"},{value:"helvetica",label:"Helvetica"},{value:"tahoma",label:"Tahoma"},{value:"times-new-roman",label:"Times New Roman"},{value:"trebuchet-ms",label:"Trebuchet MS"},{value:"verdana",label:"Verdana"},{value:"open-sans",label:"Open Sans"},{value:"roboto",label:"Roboto"}],j=O=>O&&O<(0,Oo.default)().endOf("day")-864e5,C=O=>{E(O)},P=()=>{const O=!c;e.setFieldValue("countdownNumbersStrong",O),l({countdownNumbersStrong:O}),p(O)},Y=()=>{const O=!f;e.setFieldValue("countdownNumbersItalic",O),l({countdownNumbersItalic:O}),x(O)},z=()=>{const O=!k;e.setFieldValue("countdownLabelsStrong",O),l({countdownLabelsStrong:O}),b(O)},$=()=>{const O=!h;e.setFieldValue("countdownLabelsItalic",O),l({countdownLabelsItalic:O}),T(O)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("End time"),name:"countdownTime",children:(0,o.jsx)(t.ui_kit$DatePicker,{ref:a,format:"MM/DD/YYYY HH:mm",disabledDate:j,showTime:!0,placement:"bottomRight",getPopupContainer:O=>{const y=O?.closest(".blocks-app");return y||(O?.ownerDocument?.body??document.body)},allowClear:!1,allowEmpty:!1})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("Time zone"),name:"countdownTimeZone",style:{width:"100%"},children:(0,o.jsx)(t.ui_kit$Select,{placeholder:s("Select the time zone"),getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),children:w.map(O=>(0,o.jsx)(t.ui_kit$Select.Option,{value:O.value,children:O.label},O.value))})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:20,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("Background color"),name:"countdownBackgroundColor",className:"countdown-color",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:s("Background color"),usedColors:i.usedColors})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownTransparency",valuePropName:"checked",style:{paddingTop:29},children:(0,o.jsx)(t.ui_kit$Switch,{id:"countdownTransparency",label:s("Transparency"),labelSize:"small",size:"small",onChange:C})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:s("Countdown font settings"),compact:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersFont",style:{marginBottom:d.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:A})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersColor",className:"countdown-color",style:{marginBottom:d.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{usedColors:i.usedColors})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersFontSize",children:(0,o.jsx)(t.ui_kit$InputNumber,{min:12,placeholder:s("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:s("Strong"),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersStrong",children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":c}),onClick:P,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-td-form__icon-radius"})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:s("Italic"),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersItalic",children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":f}),onClick:Y,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})})})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:s("Time units font settings"),compact:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsFont",style:{marginBottom:d.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:A})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsColor",className:"countdown-color",style:{marginBottom:d.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{usedColors:i.usedColors})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsFontSize",children:(0,o.jsx)(t.ui_kit$InputNumber,{min:8,placeholder:s("Font size"),addonAfter:"px",prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined})})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:s("Strong"),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsStrong",children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":k}),onClick:z,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-td-form__icon-radius"})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:s("Italic"),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsItalic",children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":h}),onClick:$,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})})})})})]})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("Language"),name:"countdownLanguage",style:{width:"100%"},children:(0,o.jsx)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:[{value:"ru_RU",label:"Русский"},{value:"en_US",label:"English"},{value:"uk_UA",label:"Українська"},{value:"pt_BR",label:"Português"},{value:"fr-CA",label:"Français"},{value:"de_DE",label:"Deutsch"},{value:"pl_PL",label:"Polski"},{value:"es_ES",label:"Español"},{value:"tr_TR",label:"Türkçe"},{value:"lt_LT",label:"Lietuvių kalba"},{value:"lv_LV",label:"Latviešu valoda"},{value:"et_EE",label:"Eesti keel"},{value:"hu_HU",label:"Magyar"},{value:"el_GR",label:"Ελληνικά"},{value:"it_IT",label:"Italiano"}]})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("Duration"),name:"countdownDuration",style:{width:"100%"},children:(0,o.jsx)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:v})})})]})]})};ui.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string};var mi=({form:e,elementSettings:i})=>{const{__:l}=r.useI18n(),{token:s}=(0,t.ui_kit$useToken)();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("URL of the video clip."),placement:"right",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:["video","source"],className:"selected-image-form__alt",children:(0,o.jsx)(t.ui_kit$Input,{allowClear:!0,placeholder:l("Video URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"VideoCameraOutlined",component:t.icons$VideoCameraOutlined})})})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Play button"),name:["video","playButton"],style:{width:"100%",marginBottom:s.formItemMarginBottomMD+4},children:(0,o.jsxs)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),children:[(0,o.jsxs)(t.ui_kit$Select.Option,{value:"youtube_red",children:[(0,o.jsx)(r.EmIcons,{icon:"YoutubeOutlined",component:t.icons$YoutubeOutlined,style:{color:"#FF0000"}})," ",l("Youtube Red")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"youtube_black",children:[(0,o.jsx)(r.EmIcons,{icon:"YoutubeOutlined",component:t.icons$YoutubeOutlined})," ",l("Youtube Black")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"youtube_white",children:[(0,o.jsx)(r.EmIcons,{icon:"YoutubeOutlined",component:t.icons$YoutubeOutlined,style:{color:"#aaa"}})," ",l("Youtube White")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"vimeo",children:[(0,o.jsx)(r.EmIcons,{icon:"Vimeo",component:t.icons$Vimeo})," ",l("Vimeo")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"white_circle",children:[(0,o.jsx)(r.EmIcons,{icon:"PlayCircleOutlined",component:t.icons$PlayCircleOutlined,style:{color:"#aaa"}})," ",l("White circle")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"black_circle",children:[(0,o.jsx)(r.EmIcons,{icon:"PlayCircleOutlined",component:t.icons$PlayCircleOutlined})," ",l("Black circle")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"white_circle_outlined",children:[(0,o.jsx)(r.EmIcons,{icon:"RightCircleOutlined",component:t.icons$RightCircleOutlined,style:{color:"#aaa"}})," ",l("White circle outlined")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"black_circle_outlined",children:[(0,o.jsx)(r.EmIcons,{icon:"RightCircleOutlined",component:t.icons$RightCircleOutlined})," ",l("Black circle outlined")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"none",children:[" ",l("Without button")]})]})})]})};mi.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string};var qa={marginBottom:10},Io=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(t.ui_kit$Row,{gutter:20,style:qa,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"ampShow",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$Radio.Group,{children:(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Radio.Button,{value:"all",children:e("Both")}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:e("AMP"),children:(0,o.jsx)(t.ui_kit$Radio.Button,{value:"amp",children:"AMP"})}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:e("HTML"),children:(0,o.jsx)(t.ui_kit$Radio.Button,{value:"html",children:"HTML"})})]})})})})})},{Option:pi}=t.ui_kit$Select,{mobileBorderRadiusAll:Ja,mobileBorderRadiusTopLeft:hi,mobileBorderRadiusBottomLeft:bi,mobileBorderRadiusTopRight:fi,mobileBorderRadiusBottomRight:gi,borderRadiusBottomRight:_i,borderRadiusTopRight:xi,borderRadiusBottomLeft:ki,borderRadiusTopLeft:Ei,alt:Qa,src:Za,title:en,link:lt,borderRadiusAll:Cr,imgReplacer:on,expanded:tn}={link:"link",borderRadiusBottomRight:"borderRadiusBottomRight",borderRadiusTopRight:"borderRadiusTopRight",borderRadiusBottomLeft:"borderRadiusBottomLeft",borderRadiusTopLeft:"borderRadiusTopLeft",mobileBorderRadiusAll:"mobileBorderRadiusAll",mobileBorderRadiusTopLeft:"mobileBorderRadiusTopLeft",mobileBorderRadiusBottomLeft:"mobileBorderRadiusBottomLeft",mobileBorderRadiusTopRight:"mobileBorderRadiusTopRight",mobileBorderRadiusBottomRight:"mobileBorderRadiusBottomRight",alt:"alt",imgReplacer:"imgReplacer",src:"src",title:"title",borderRadiusAll:"borderRadiusAll",expanded:"expanded"},Qo=({linkProtocol:e})=>{switch(e){case"https://":return(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined});case"mailto:":return(0,o.jsx)(r.EmIcons,{icon:"MailOutlined",component:t.icons$MailOutlined});case"tel:":return(0,o.jsx)(r.EmIcons,{icon:"PhoneOutlined",component:t.icons$PhoneOutlined});case"sms:":return(0,o.jsx)(r.EmIcons,{icon:"CommentOutlined",component:t.icons$CommentOutlined});case"ftp://":return(0,o.jsx)(r.EmIcons,{icon:"FileOutlined",component:t.icons$FileOutlined});case"#":return(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined});default:return(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined})}},rn=e=>[{value:"https://",label:e("Site")},{value:"mailto:",label:e("E-mail")},{value:"tel:",label:e("Phone")},{value:"sms:",label:e("SMS")},{value:"ftp://",label:e("File")},{value:"#",label:e("Anchor")},{value:"",label:e("Other")}],Zo=({handleLinkProtocolsChange:e,linkProtocol:i,__:l})=>{const s=n.default.useMemo(()=>rn(l),[l]);return(0,o.jsx)(t.ui_kit$Select,{style:{width:90,textAlign:"left"},value:i,onChange:e,options:s,popupMatchSelectWidth:!1,listHeight:320})},et=({show:e,__:i,style:l,className:s})=>{const a=n.default.useMemo(()=>({marginBottom:8,...l}),[l]);return e?(0,o.jsx)(t.ui_kit$Alert,{className:s,title:i("Anchor links do not work in Outlook, Gmail, and several other email clients."),type:"warning",showIcon:!0,style:a}):null},Bi=e=>!(!e.startsWith("#")||e.indexOf("#",1)!==-1),ln=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*(["'])((?:\\.|(?!\1).)*?)\1(?:\s*\/?>)?\s*$/i,sn=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*([^\s/>]+)(?:\s*\/?>)?\s*$/i;function ot(e){if(typeof e!="string")return e;let i=e.trim();if(!i)return i;const l=i.match(ln);if(l)i=l[2];else{const s=i.match(sn);s&&(i=s[1])}return i.startsWith("https://http")&&(i=i.substring(8)),i}var Mt=(e,i="https://")=>e?e.startsWith("https://")||e.startsWith("http://")?"https://":e.startsWith("mailto:")?"mailto:":e.startsWith("tel:")?"tel:":e.startsWith("sms:")?"sms:":e.startsWith("ftp://")?"ftp://":Bi(e)?"#":"":i,Wo=(e,i)=>{const l=Mt(e,"");return i(l),l},Pr=e=>{if(!e||!e.startsWith("mailto:"))return{subject:"",body:"",baseEmail:e||""};try{const i=new URL(e),l=e.split("?")[0];return{subject:i.searchParams.get("subject")||"",body:i.searchParams.get("body")||"",baseEmail:l}}catch{return{subject:"",body:"",baseEmail:e.split("?")[0]}}},Si=(e,i,l)=>{if(!e||!e.startsWith("mailto:"))return e;const s=e.split("?")[0],a=[];return i&&a.push(`subject=${encodeURIComponent(i)}`),l&&a.push(`body=${encodeURIComponent(l)}`),a.length>0?`${s}?${a.join("&")}`:s},u=e=>e||(e===0?"0":""),po=e=>e&&e!=="auto"?e:e===0?"0":"",Ar=(e,i)=>{if(typeof e=="object"&&e!==null&&"value"in e){if(e.value)return e.value;if(e.value==="")return""}return typeof e=="string"&&e?e:i||""};function Ti(e){const i={...e,link:e.link==null?"https://":e.link,borderRadiusAll:u(e.borderRadius?.all),borderRadiusTopLeft:u(e.borderRadius?.topLeft),borderRadiusBottomLeft:u(e.borderRadius?.bottomLeft),borderRadiusTopRight:u(e.borderRadius?.topRight),borderRadiusBottomRight:u(e.borderRadius?.bottomRight),mobileBorderRadiusAll:u(e.mobileBorderRadius?.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius?.topLeft!==null?e.mobileBorderRadius?.topLeft:e.mobileBorderRadius?.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius?.bottomLeft!==null?e.mobileBorderRadius?.bottomLeft:e.mobileBorderRadius?.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius?.topRight!==null?e.mobileBorderRadius?.topRight:e.mobileBorderRadius?.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius?.bottomRight!==null?e.mobileBorderRadius?.bottomRight:e.mobileBorderRadius?.all),show:e.show?e.show:"all",altSrc:e.src};if(e.video&&(i.videoPlayButton=e.video.playButton??"youtube_red",i.videoSource=e.video.source??""),e.carouselImages?.length>0){const l={};e.carouselImages?.map((s,a)=>(Object.keys(s).forEach(d=>{l[d+"_"+a]=s[d]}),!0)),i.images=l}if(e.sections?.length>0){const l=[];e.sections?.map((s,a)=>(l.push({[`expanded_${a}`]:s.expanded}),!0)),i.sections=l}return i}function Nr(e,i,l){const s=l.hasOwnProperty("images"),a=l.hasOwnProperty("sections"),d=Object.keys(s?l.images:a?l.sections:l)[0],c=s?l.images:a?l.sections:l;let p={};const f=i.getFieldsValue(!0);switch(d.split("_")[0]){case en:case Za:case Qa:case on:if(s){const k=[...e.carouselImages];k[d.split("_")[1]][d.split("_")[0]]=c[d],p={carouselImages:k}}else p=c;break;case tn:if(a){const k=[...e.sections];k[d.split("_")[1]][d.split("_")[0]]=c[d],p={sections:k}}break;case lt:let x=ot(c[d]);e.type===r.ELEMENT_TYPES.CAROUSEL?(p.carouselImages=e.carouselImages,s?(i.setFieldValue(["images",[lt+"_"+d.split("_")[1]]],x),p.carouselImages[d.split("_")[1]].link=x,p.link="",i.setFieldValue(lt,"")):(e.carouselImages.forEach((k,b)=>{i.setFieldValue(["images",lt+"_"+b],x),p.carouselImages[b].link=x,p.link=x}),i.setFieldValue(lt,x))):(i.setFieldValue(lt,x),p.link=x);break;case Cr:p={borderRadius:{...e.borderRadius,[W.BORDER_RADIUS_POSITION[Ei]]:f[Ei],[W.BORDER_RADIUS_POSITION[ki]]:f[ki],[W.BORDER_RADIUS_POSITION[xi]]:f[xi],[W.BORDER_RADIUS_POSITION[_i]]:f[_i],[W.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case Ei:case ki:case xi:case _i:p={borderRadius:{...e.borderRadius,[W.BORDER_RADIUS_POSITION[Cr]]:null,[W.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case Ja:case hi:case bi:case fi:case gi:p={mobileBorderRadius:{...e.mobileBorderRadius,[W.MOBILE_BORDER_RADIUS_POSITION[hi]]:f[hi],[W.MOBILE_BORDER_RADIUS_POSITION[bi]]:f[bi],[W.MOBILE_BORDER_RADIUS_POSITION[fi]]:f[fi],[W.MOBILE_BORDER_RADIUS_POSITION[gi]]:f[gi],[W.MOBILE_BORDER_RADIUS_POSITION[d]]:c[d],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[d]+"-"}};break;default:p=c}return{...e,...p}}var $o=(0,o.jsxs)(t.ui_kit$Select,{className:"select-after",children:[(0,o.jsx)(pi,{value:"px",children:"px"}),(0,o.jsx)(pi,{value:"%",children:"%"})]}),an=(0,o.jsx)(t.ui_kit$Select,{className:"select-after",children:(0,o.jsx)(pi,{value:"px",children:"px"})}),Lr=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:a,boxShadowShow:d,oneBorderRadiusValue:c,setOneBorderRadiusValue:p,hasLink:f,hasAlt:x,hasTitle:k,isOpenSrcReplacer:b,mergeTagItems:h,mergeMenuOpen:T,setMergeMenuOpen:_,cascaderRef:E,linkInputRef:w,linkButtonRef:v,altInputRef:A,altButtonRef:j,titleInputRef:C,titleButtonRef:P,srcReplacerInputRef:Y,srcReplacerButtonRef:z,linkProtocol:$,handleLinkProtocolsChange:O,linkButtonHandler:y,linkInputHandler:oe,altButtonHandler:G,altInputHandler:q,titleButtonHandler:te,titleInputHandler:ue,srcReplacerButtonHandler:me,srcInputHandler:se,handleSelect:_e,onChange:ve,filter:de,renderSearchOption:De,handleChangeValues:ye,toggleShowBorderHandler:re,toggleShowBorderRadiusHandler:ke,toggleShowBoxShadowHandler:ae})=>{const{__:Q}=r.useI18n(),{token:he}=(0,t.ui_kit$useToken)(),pe=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Uo,{form:e,elementSettings:i,imgParent:!0})}),pe.formImageFieldVerticalAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,align:"right",children:(0,o.jsx)(Mo,{form:e,elementSettings:i})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:i.type==="countdown"?15:24}}),i.type==="countdown"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(ui,{form:e,elementSettings:i,handleChangeValues:ye}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),pe.mergeTagsShow&&h&&(0,o.jsx)(t.ui_kit$Col,{span:24,id:"merge_tags_wrapper",children:(0,o.jsxs)(t.ui_kit$Form.Item,{style:{marginBottom:24},children:[(0,o.jsx)(t.ui_kit$Button,{id:"merge_tags_button",icon:(0,o.jsx)(r.EmIcons,{icon:"MergeTags",component:t.icons$MergeTags}),style:{width:"100%",display:T?"none":"inline-flex"},onClick:()=>_(!0),children:Q("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:E,classNames:{popup:{root:"merge-tags"}},options:h,placeholder:Q("Start typing the title"),showSearch:{filter:de,render:De},spellCheck:"false",getPopupContainer:ee=>ee.closest(".email-pane__collapse-wrapper"),onChange:ve,style:{display:T?"block":"none"},open:T,onKeyDown:ee=>{ee.key==="Escape"&&_(!1)}})]})}),i.type==="video"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(mi,{form:e,elementSettings:i}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),(i.type==="img"||i.type==="video")&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,o.jsx)(No,{form:e,label:Q("Image path"),name:"src",placeholder:Q("Image path"),elementSettings:i,tooltipTitle:""})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,style:{marginBottom:!x&&!f&&!k&&!b?he.formItemMarginBottomMD+4:he.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:x||Q("Alternative text"),placement:"bottom",getPopupContainer:ee=>ee.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":!!x}),onClick:G,ref:j,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),pe.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:k||Q("Tooltip text"),placement:"bottom",getPopupContainer:ee=>ee.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":!!k}),onClick:te,ref:P,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:f||Q("Hyperlink URL"),placement:"bottom",getPopupContainer:ee=>ee.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":!!f}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:y,ref:v})}),pe.formImageFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:Q("Image replacer"),placement:"bottom",getPopupContainer:ee=>ee.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":b}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:me,ref:z})})]}),(!!f||!!x||!!k||!!b)&&(0,o.jsxs)("div",{style:{marginBottom:he.formItemMarginBottomMD+4},children:[!!f&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(et,{show:$==="#",__:Q,style:{marginBottom:he.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Q("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:he.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Zo,{linkProtocol:$,handleLinkProtocolsChange:O,__:Q}),placeholder:Q("Hyperlink URL"),allowClear:!0,ref:w,onChange:oe,onSelect:_e,prefix:(0,o.jsx)(Qo,{linkProtocol:$})})})})]}),!!x&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Q("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:he.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:Q("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:q,ref:A,onSelect:_e})})}),pe.formFieldImageTitleEnabled&&!!k&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Q("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:he.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:Q("Enter the title of the image"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:ue,ref:C,onSelect:_e})})}),!!b&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Q("Image src"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"imgReplacer",className:"selected-image-form__alt",style:{marginBottom:he.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:Q("Code that will replace the image `src`"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:Q("Image src")}),onChange:se,ref:Y,onSelect:_e})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:Q("Size"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:i.maxWidth,showHeight:pe.formImageFieldHeightEnabled,showMinMax:!1,gutter:he.marginSM,rowStyle:{marginBottom:pe.formImageFieldHeightEnabled?4:24},labels:{width:Q("Width"),height:Q("Height"),minWidth:Q("Minimum width"),maxWidth:Q("Maximum width")}})}),pe.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Q("Borders"),collapsible:!0,open:s,onToggle:re,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),pe.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Q("Border radius"),collapsible:!0,open:a,onToggle:ke,dividerTop:!0,children:(0,o.jsx)(So,{form:e,oneBorderRadiusValue:c,setOneBorderRadiusValue:p,elementSettings:i})}),pe.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Q("Box shadow"),collapsible:!0,open:d,onToggle:ae,dividerTop:!0,children:(0,o.jsx)(jo,{})}),pe.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Q("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})}),pe.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:Q("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};Lr.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,hasLink:g.default.string,hasAlt:g.default.string,hasTitle:g.default.string,isOpenSrcReplacer:g.default.oneOfType([g.default.bool,g.default.number]),mergeTagItems:g.default.array,mergeMenuOpen:g.default.bool,setMergeMenuOpen:g.default.func,cascaderRef:g.default.object,linkInputRef:g.default.object,linkButtonRef:g.default.object,altInputRef:g.default.object,altButtonRef:g.default.object,titleInputRef:g.default.object,titleButtonRef:g.default.object,srcReplacerInputRef:g.default.object,srcReplacerButtonRef:g.default.object,linkProtocol:g.default.string,handleLinkProtocolsChange:g.default.func,linkButtonHandler:g.default.func,linkInputHandler:g.default.func,altButtonHandler:g.default.func,altInputHandler:g.default.func,titleButtonHandler:g.default.func,titleInputHandler:g.default.func,srcReplacerButtonHandler:g.default.func,srcInputHandler:g.default.func,handleSelect:g.default.func,onChange:g.default.func,filter:g.default.func,renderSearchOption:g.default.func,handleChangeValues:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func};var zo=({form:e,name:i,elementSettings:l,isPicture:s,tooltipTitle:a})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),p=(0,n.useRef)(),[f,x]=(0,n.useState)(l[i]?.value==="auto"),{token:k}=(0,t.ui_kit$useToken)(),[b,h]=(0,n.useState)(""),T=E=>{e.setFieldsValue({[i]:"",[i+"Dim"]:"px"}),x(w=>!w),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{[i]:{classNamePrefix:"em-mob-width-",value:f?null:"auto",dim:""}}})},_=E=>{x(!1),h(e.getFieldsValue(!0)[i+"Dim"]==="%"?100:"")};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:a,placement:"bottom",children:(0,o.jsx)("div",{children:(0,o.jsx)(t.ui_kit$Form.Item,{name:i,style:{marginBottom:k.formItemMarginBottomXS/2},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{ref:p,min:0,max:b,placeholder:d("Width"),onChange:_,prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:(0,o.jsx)(t.ui_kit$Form.Item,{name:i+"Dim",noStyle:!0,children:$o})})})})}),!s&&(0,o.jsx)(t.ui_kit$Switch,{id:"auto-width",label:d("Auto"),labelSize:"small",size:"small",checked:f,onChange:T})]})};zo.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string};var tt=({form:e,name:i,elementSettings:l,isPicture:s,tooltipTitle:a})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),p=(0,n.useRef)(),[f,x]=(0,n.useState)(l.mobileHeight?.value==="auto"),{token:k}=(0,t.ui_kit$useToken)(),b=T=>{e.setFieldsValue({mobileHeight:"",mobileHeightDim:"px"}),x(_=>!_),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{mobileHeight:{classNamePrefix:"em-mob-height-",value:f?null:"auto",dim:""}}})},h=T=>{x(!1)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:a,placement:"bottom",children:(0,o.jsx)("div",{children:(0,o.jsx)(t.ui_kit$Form.Item,{name:i,style:{marginBottom:k.formItemMarginBottomXS/2},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{ref:p,min:0,placeholder:d("Height"),onChange:h,prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})}),!s&&(0,o.jsx)(t.ui_kit$Switch,{id:"auto-height",label:d("Auto"),labelSize:"small",size:"small",checked:f,onChange:b})]})};tt.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string};var Or=({form:e,elementSettings:i,handleChangeValues:l,boxShadow:s,mobileBordersShow:a,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:p,oneMobileBorderRadiusValue:f,setOneMobileBorderRadiusValue:x,hasLink:k,hasAlt:b,hasTitle:h,linkInputRef:T,linkButtonRef:_,altInputRef:E,altButtonRef:w,titleInputRef:v,titleButtonRef:A,linkInputHandler:j,altButtonHandler:C,altInputHandler:P,titleButtonHandler:Y,titleInputHandler:z,linkButtonHandler:$,toggleShowMobileBorderHandler:O,toggleShowMobileBorderRadiusHandler:y,toggleShowMobileBoxShadowHandler:oe,toggleShowMobileSizeHandler:G})=>{const{__:q}=r.useI18n(),{token:te}=(0,t.ui_kit$useToken)(),ue=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:30,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Uo,{form:e,elementSettings:i,imgParent:!0,typeOfForm:"mobile"})}),ue.formImageFieldVerticalAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,align:"right",children:(0,o.jsx)(Mo,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:i.type==="countdown"?15:24}}),i.type==="countdown"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(ui,{form:e,elementSettings:i,handleChangeValues:l}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),i.type==="video"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(mi,{form:e,elementSettings:i}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),(i.type==="img"||i.type==="video")&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,o.jsx)(No,{form:e,label:q("Image path"),name:"src",placeholder:q("Image path"),elementSettings:i,tooltipTitle:""})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,style:{marginBottom:!b&&!k&&!h?te.formItemMarginBottomMD+4:te.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:b||q("Alternative text"),placement:"bottom",getPopupContainer:me=>me.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":!!b}),onClick:C,ref:w,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),ue.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:h||q("Tooltip text"),placement:"bottom",getPopupContainer:me=>me.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":!!h}),onClick:Y,ref:A,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:k||q("Hyperlink URL"),placement:"bottom",getPopupContainer:me=>me.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":!!k}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:$,ref:_})})]}),(!!k||!!b||!!h)&&(0,o.jsxs)("div",{style:{marginBottom:te.formItemMarginBottomMD+4},children:[!!k&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:q("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:te.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{ref:T,allowClear:!0,placeholder:q("Hyperlink URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined}),onChange:j})})}),!!b&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:q("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:te.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:q("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:P,ref:E})})}),ue.formFieldImageTitleEnabled&&!!h&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:q("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:te.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:q("Tooltip text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:z,ref:v})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:q("Size"),collapsible:!0,open:p,onToggle:G,dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:24},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(zo,{form:e,name:"mobileWidth",elementSettings:i,isPicture:"true",tooltipTitle:q("Width")})}),ue.formImageFieldHeightEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(tt,{form:e,name:"mobileHeight",elementSettings:i,isPicture:"true",tooltipTitle:q("Height")})})]})}),ue.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:q("Borders"),collapsible:!0,open:a,onToggle:O,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),ue.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:q("Border radius"),collapsible:!0,open:d,onToggle:y,dividerTop:!0,children:(0,o.jsx)(So,{form:e,oneBorderRadiusValue:f,setOneBorderRadiusValue:x,elementSettings:i,typeOfForm:"mobile"})}),ue.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:q("Box shadow"),collapsible:!0,open:c,onToggle:oe,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile"})}),ue.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:q("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})}),ue.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:q("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};Or.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,handleChangeValues:g.default.func,boxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,hasLink:g.default.string,hasAlt:g.default.string,hasTitle:g.default.string,linkInputRef:g.default.object,linkButtonRef:g.default.object,altInputRef:g.default.object,altButtonRef:g.default.object,titleInputRef:g.default.object,titleButtonRef:g.default.object,linkInputHandler:g.default.func,altButtonHandler:g.default.func,altInputHandler:g.default.func,titleButtonHandler:g.default.func,titleInputHandler:g.default.func,linkButtonHandler:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func};var nn=e=>typeof e=="object"&&e!==null?e.path:void 0;function Fo(){const e=(0,n.useRef)(!1),i=(0,n.useRef)(null),l=(0,n.useCallback)(a=>{e.current=!a},[]),s=(0,n.useCallback)((a,d)=>{const c=JSON.stringify(nn(a)??null);return i.current!==c&&(i.current=c,e.current=!1),d?e.current:(e.current=!1,!1)},[]);return(0,n.useMemo)(()=>({markBorderToggled:l,isStaleBorderSnapshot:s}),[l,s])}function st(e){const i=(0,n.useRef)(null),l=(0,n.useRef)(e);return l.current=e,{remember:(0,n.useCallback)(s=>{i.current=s},[]),fillFields:(0,n.useCallback)((s,a)=>{l.current!==i.current&&s.setFieldsValue(a)},[])}}var dn=1e3,cn=2e4,$r="https://useblocks.io/app/",Fr=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm(),s=Fo(),a=Fo();let d=r.useDispatch();const c=r.useAppConfig(),p=r.useEditorProjectId(),f=r.useNotification(),x=r.useSendPostMessage(),k=r.useSendPostMessageEx(),{openImagePicker:b}=r.useImagePicker(),h=r.useSelector(r.selectEmailViewType),T=r.useSelector(r.selectMobileViewActive),_=r.useCurrentUser(),E=r.useSelector(r.selectIsCodeMode),w=r.useSelector(r.selectCodeModeDirection),[v]=r.useUploadImageMutation(),[A,j]=r.useSendShortLinkMutation(),[C,P]=(0,n.useState)({name:"",counter:0}),Y=(0,n.useRef)(null),z=(0,n.useRef)(null),$=(0,n.useRef)(null),O=(0,n.useRef)(null),y=(0,n.useRef)(null),oe=(0,n.useRef)(null),G=(0,n.useRef)(null),q=(0,n.useRef)(null),te=(0,n.useRef)(null),[ue,me]=(0,n.useState)({}),[se,_e]=(0,n.useState)(!0),[ve,de]=(0,n.useState)(!0),[De,ye]=(0,n.useState)(""),[re,ke]=(0,n.useState)(""),[ae,Q]=(0,n.useState)(""),[he,pe]=(0,n.useState)(!1),[ee,J]=(0,n.useState)(!1),[H,X]=(0,n.useState)(!1),[ce,xe]=(0,n.useState)(!1),[ne,Ae]=(0,n.useState)(!1),[we,$e]=(0,n.useState)(!1),[K,ie]=(0,n.useState)(!1),[je,V]=(0,n.useState)(!1),[Se,Ie]=(0,n.useState)("https://"),Ne=(0,n.useRef)(!1),Fe=(0,n.useRef)(),Ve=e,Ue=(0,n.useRef)(Ve);Ue.current=Ve;const le=(0,n.useCallback)(()=>l.getFieldsValue(!0).video,[l]),[Te,I]=(0,n.useState)(),[Z,Be]=(0,n.useState)(!1),[Ce,Me]=(0,n.useState)(null),[Ge,Ye]=(0,n.useState)({start:0,end:0}),[D,L]=(0,n.useState)(!1),[R,F]=(0,n.useState)(!1),[fe,Le]=(0,n.useState)(!1),[eo,Xe]=(0,n.useState)(!1),lo=(0,n.useRef)(void 0),Qe=(0,n.useRef)(null),uo=(0,n.useRef)(null),Eo=eo||fe||je;(0,n.useEffect)(()=>()=>clearTimeout(lo.current),[]);const B=(0,n.useRef)(null);(0,n.useEffect)(()=>{const N=B.current,Pe=N?.firstElementChild??null;if(!Eo||!N||!Pe)return;const Ee=[];for(let oo=N.parentElement;oo;oo=oo.parentElement)getComputedStyle(oo).overflowY!=="visible"&&Ee.push(oo);let ge=0,Oe="";const Ke=()=>{const oo=N.getBoundingClientRect(),Je=N.offsetHeight>0?oo.height/N.offsetHeight:1;let ho=Math.max(oo.top,0),ao=Math.min(oo.bottom,window.innerHeight);Ee.forEach(Jo=>{const bt=Jo.getBoundingClientRect();ho=Math.max(ho,bt.top),ao=Math.min(ao,bt.bottom)});const bo=(ho-oo.top)/(Je||1),Po=Math.max(ao-ho,0)/(Je||1),yo=`${Math.round(bo)}/${Math.round(Po)}`;yo!==Oe&&(Oe=yo,Pe.style.top=`${bo}px`,Pe.style.height=`${Po}px`),ge=requestAnimationFrame(Ke)};return Ke(),()=>cancelAnimationFrame(ge)},[Eo]);const S=()=>{const N=Qe.current;uo.current=N?.isConnected&&typeof N.selectionStart=="number"?{element:N,start:N.selectionStart,end:N.selectionEnd??N.selectionStart}:null},m=E&&w!=="bottom",M=r.useElementEntityKind();(0,n.useEffect)(()=>{Z&&te.current&&te.current.focus()},[Z]);const U=(N,Pe)=>{const Ee=document.getElementById(Pe);if(Ee){const ge=Pe.substring(Pe.indexOf("selected_image_form_")+20),Oe=Ee.value?.substring(0,Ge.start),Ke=Ee.value?.substring(Ge.end);x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{...e,[ge]:Oe+N+Ke}}),l.setFieldValue(ge,Oe+N+Ke),Ee.focus(),setTimeout(()=>{Ee.selectionStart=Ge.start,Ee.selectionEnd=Ge.start+N.length},400),L(!0)}},Re=r.useAppConfig().mergeTags;(0,n.useEffect)(()=>{Re?.items?.length&&I(r.mapMargeTags(Re.items,i,(N,Pe)=>{Be(!1),k(r.EVENT_TYPES.SANDBOX_ADD_MERGETAG,N),Pe.stopPropagation(),Pe.preventDefault()}))},[Re,I,i,Be,k]);const be=(N,Pe)=>{if(Be(!1),N){const Ee=Re.syntax.length>1?Te.findIndex(Oe=>Oe.key===Pe[0].key):0,ge=Re.syntax[Ee].replace("%value%",N[N.length-1]);Ce?.getAttribute("id")==="selected_image_form_title"||Ce?.getAttribute("id")==="selected_image_form_alt"||Ce?.getAttribute("id")==="selected_image_form_link"||Ce?.getAttribute("id")==="selected_image_form_imgReplacer"?U(ge,Ce?.getAttribute("id")):(l.setFieldValue("imgReplacer",ge),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:ge}}))}},ze=(N,Pe)=>Pe.some(Ee=>Ee.label.toLowerCase().indexOf(N.toLowerCase())>-1),co=(N,Pe)=>{const Ee=Pe.map((ge,Oe)=>{const Ke=ge.label.split(new RegExp(`(${N})`,"gi"));return(0,o.jsxs)("span",{children:[Oe!==0&&(0,o.jsx)("span",{children:" / "}),Ke.map((oo,Je)=>oo.toLowerCase()===N.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:oo},Je):oo)]},ge.value)});return(0,o.jsx)("div",{title:Pe.map(ge=>ge.label).join(" / "),children:Ee})},so=r.useRootElement();(0,n.useEffect)(()=>{const N=({target:ge})=>{ge.closest('[id="merge_tags_wrapper"]')||(Qe.current=ge,Me(ge))},Pe=({target:ge})=>{!ge.closest(".merge-tags")&&!ge.closest("#merge_tags_button")&&Be(!1)},Ee=new xo.Disposable;return Ee.addDisposable(r.addWindowListenerFromShadow(so,"focusin",N)),Ee.addDisposable(r.addWindowListenerFromShadow(so,"click",Pe)),()=>{Ee.dispose()}},[so]);const mo=({target:N})=>{if(N&&!D){const{selectionStart:Pe,selectionEnd:Ee}=N;Ye({start:Pe,end:Ee})}L(!1)},ko=e.border,qo=e.mobileBorder,Co=Object.keys(ko).find(N=>ko[N]?.width||ko[N]?.style||ko[N]?.color),Bo=Object.keys(qo).find(N=>qo[N]?.width||qo[N]?.style||qo[N]?.color),ro=N=>N&&(N?.width||N?.style||N?.color)?N:"",{remember:Ro,fillFields:Vo}=st(e);(0,n.useEffect)(()=>{if(e){e.src!==Fe.current&&(Fe.current=e.src,Ne.current=!1);const N=e.boxShadow;if(me(N),e.link&&Ie(Mt(e.link,"https://")),Vo(l,{...e,link:e.link==null?"https://":e.link,width:e.width?.value,widthDim:e.width?.dim,height:e.height?.value,heightDim:e.height?.dim,borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),mobileBorderAll:ro(e.mobileBorder.all)||!(ro(e.mobileBorder.top)||ro(e.mobileBorder.bottom)||ro(e.mobileBorder.right)||ro(e.mobileBorder.left))&&ro(e.border.all),mobileBorderTop:ro(e.mobileBorder.top)||!ro(e.mobileBorder.all)&&ro(e.border.top),mobileBorderBottom:ro(e.mobileBorder.bottom)||!ro(e.mobileBorder.all)&&ro(e.border.bottom),mobileBorderRight:ro(e.mobileBorder.right)||!ro(e.mobileBorder.all)&&ro(e.border.right),mobileBorderLeft:ro(e.mobileBorder.left)||!ro(e.mobileBorder.all)&&ro(e.border.left),borderRadiusAll:u(e.borderRadius.all),borderRadiusTopLeft:u(e.borderRadius.topLeft),borderRadiusBottomLeft:u(e.borderRadius.bottomLeft),borderRadiusTopRight:u(e.borderRadius.topRight),borderRadiusBottomRight:u(e.borderRadius.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:po(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:po(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:po(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:po(e.mobileHeight?.value)?e.mobileHeight?.dim:e.height?.dim,mobileBorderRadiusAll:u(e.mobileBorderRadius.all)||u(e.borderRadius.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius?.topLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topLeft)||u(e.borderRadius?.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius?.bottomLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomLeft)||u(e.borderRadius?.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius?.topRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topRight)||u(e.borderRadius?.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius?.bottomRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomRight)||u(e.borderRadius?.all),mobileBoxShadowInset:e.mobileBoxShadow?.inset!=null?e.mobileBoxShadow.inset:e.boxShadow?.inset||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset)||u(e.boxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset)||u(e.boxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius)||u(e.boxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius)||u(e.boxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color||e.boxShadow?.color),mobileAlign:u(e.mobileAlign?.value)||e.align,mobileVerticalAlign:u(e.mobileVerticalAlign?.value||e.valign),show:e.show?e.show:"all",altSrc:e.src,video:{source:"",playButton:"youtube_red",...Ve.video}}),e.countdown){let ge=new URL("https://emailmaker.ru/?"+e.countdown),Oe=ge.searchParams.get("font1"),Ke=!1,oo=!1;Oe.endsWith("-b")?(Oe=Oe.substring(0,Oe.length-2),Ke=!0):Oe.endsWith("-i")?(Oe=Oe.substring(0,Oe.length-2),oo=!0):Oe.endsWith("-bi")&&(Oe=Oe.substring(0,Oe.length-3),Ke=!0,oo=!0);let Je=ge.searchParams.get("font2"),ho=!1,ao=!1;Je.endsWith("-b")?(Je=Je.substring(0,Je.length-2),ho=!0):Je.endsWith("-i")?(Je=Je.substring(0,Je.length-2),ao=!0):Je.endsWith("-bi")&&(Je=Je.substring(0,Je.length-3),ho=!0,ao=!0),Vo(l,{countdownTime:(0,Oo.default)(new Date(Date.parse(ge.searchParams.get("time"))+ge.searchParams.get("timezone")*36e5+new Date().getTimezoneOffset()/60*36e5).toISOString()),countdownDuration:ge.searchParams.get("frames")||20,countdownTimeZone:ge.searchParams.get("timezone"),countdownLanguage:ge.searchParams.get("locale").replace("-","_"),countdownBackgroundColor:"#"+ge.searchParams.get("bg"),countdownTransparency:ge.searchParams.get("tp")==="true"?"checked":"",countdownNumbersFont:Oe,countdownNumbersFontSize:ge.searchParams.get("size1")/2,countdownNumbersFontSizeDim:"px",countdownNumbersColor:"#"+ge.searchParams.get("color1"),countdownLabelsFont:Je,countdownLabelsFontSize:ge.searchParams.get("size2")/2,countdownLabelsFontSizeDim:"px",countdownLabelsColor:"#"+ge.searchParams.get("color2"),countdownNumbersStrong:Ke,countdownNumbersItalic:oo,countdownLabelsStrong:ho,countdownLabelsItalic:ao})}!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?_e(!1):_e(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||!u(e.borderRadius.all)&&!u(e.mobileBorderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?de(!1):de(!0);const Pe=s.isStaleBorderSnapshot(e,!!Co),Ee=a.isStaleBorderSnapshot(e,!!Bo);Pe&&l.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Ee||Pe&&!Bo)&&l.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),pe(ge=>Co&&!Pe?!0:ge),J(ge=>Co&&!Pe||Bo&&!Ee?!0:ge),X(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),xe(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight||!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),Ae(!!e.boxShadow),$e(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),ie(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value||!!e.height.value),e.link?ye(e.link):ye(Ne.current?"...":""),ke(e.alt),Q(e.title),F(e.imgReplacer?.length)}},[l,e,Vo,Ve,Co,Bo,s,a]),(0,n.useEffect)(()=>{if(Eo)return;const N=uo.current;uo.current=null,!(!N||!N.element.isConnected||N.element.disabled)&&Qe.current===N.element&&(N.element.focus(),N.element.setSelectionRange(N.start,N.end))},[Eo]);const _o=async(N,Pe,Ee)=>{const ge={};ge.user_id=_.id,ge.folder=N,Pe&&(Pe=await r.prepareImageForEditorUpload(Pe,c),ge.file=Pe),Ee&&(ge.page_url=Ee);const Oe=await v(ge);if(Oe.error)f.fromError("IMAGE_UPLOAD_ERROR",Pe,Oe.error,!0);else{const Ke=La.extractUploadResult(Oe.data);if(Ke.error)return;if(Ke.file_url)return Ke.file_url}},Ho=(N,Pe)=>new Promise((Ee,ge)=>{const Oe=new Image,Ke=new Image;Oe.crossOrigin="Anonymous",Ke.crossOrigin="Anonymous";let oo=Pe?2:1;const Je=()=>{clearTimeout(ao),ge(new Error("video preview images are not loaded"))},ho=()=>{oo-=1,oo===0&&(clearTimeout(ao),Ee({frame:Oe,button:Pe?Ke:null}))},ao=setTimeout(Je,cn);Oe.onload=ho,Oe.onerror=Je,Oe.src=N,Pe&&(Ke.onload=ho,Ke.onerror=Je,Ke.src=Pe)}),vt=(N,Pe,Ee,ge)=>{const Oe=document.createElement("canvas"),Ke=Oe.getContext("2d");if(Oe.width=N.width,Oe.height=N.height,Ke.clearRect(0,0,Oe.width,Oe.height),Ke.drawImage(N,0,0,N.width,N.height),!Pe)return Oe;const oo=Math.min(Oe.width,Oe.height);let Je;if(N.height>N.width)Je=.3;else{const bt=N.width/N.height;Je=Math.min(ge,.3+(bt-1)/(Ee-1)*.1)}const ho=oo*Je,ao=Pe.width/Pe.height;let bo,Po;ao>=1?(bo=ho,Po=ho/ao):(Po=ho,bo=ho*ao);const yo=(Oe.width-bo)/2,Jo=(Oe.height-Po)/2;return Ke.drawImage(Pe,yo,Jo,bo,Po),Oe},Lo=N=>new Promise(Pe=>{N.toBlob(Ee=>Pe(Ee?new File([Ee],"image.jpeg",{type:"image/jpeg"}):null),"image/jpg",1)}),It=async N=>{const Pe=l.getFieldsValue(!0).video?.playButton||e.video?.playButton;if(!(!N||!Pe||Pe==="none"||fe)){S(),Le(!0);try{const{frame:Ee,button:ge}=await Ho(N,`${$r}${Pe}.png`),Oe=await Lo(vt(Ee,ge,2,.4)),Ke=Oe&&await _o(p,Oe);if(!Ke)return;x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Ue.current.type,settings:{src:Ke}}),Pt({...Ue.current,src:Ke,video:le()||Ue.current.video,activateSection:null,changeKey:"src"}),setTimeout(()=>{l.setFieldValue("src",Ke)},100)}catch{}finally{Le(!1)}}},Er=async()=>{const N=le(),Pe=N?.source,Ee=N?.playButton;if(!Pe)return;const ge=()=>le()?.source!==Pe;S(),Xe(!0);try{const Oe=await _o("tmp",null,Pe);if(!Oe||ge())return;const{frame:Ke,button:oo}=await Ho(Oe,Ee&&Ee!=="none"?`${$r}${Ee}.png`:null);if(ge())return;const Je=await Lo(vt(Ke,oo,2.5,.35)),ho=Je&&await _o(p,Je);ho&&!ge()&&Br(ho)}catch{}finally{Xe(!1)}},Ct=N=>{clearTimeout(lo.current),lo.current=setTimeout(()=>{N()},dn)},ni=()=>{const N=l.getFieldsValue(!0);let Pe=new URL("https://cdt3.useblocks.io/rndt?"+e.countdown),Ee=N.countdownNumbersFont;N.countdownNumbersStrong&&N.countdownNumbersItalic?Ee+="-bi":N.countdownNumbersStrong?Ee+="-b":N.countdownNumbersItalic&&(Ee+="-i");let ge=N.countdownLabelsFont;N.countdownLabelsStrong&&N.countdownLabelsItalic?ge+="-bi":N.countdownLabelsStrong?ge+="-b":N.countdownLabelsItalic&&(ge+="-i"),Pe.searchParams.set("time",new Date(N.countdownTime.$d-N.countdownTimeZone*36e5-new Date().getTimezoneOffset()/60*36e5).toISOString()),Pe.searchParams.set("bg",N.countdownBackgroundColor.substring(1)||"#FFFFFF"),Pe.searchParams.set("tp",!!N.countdownTransparency),Pe.searchParams.set("font1",Ee),Pe.searchParams.set("size1",N.countdownNumbersFontSize*2||12),Pe.searchParams.set("color1",N.countdownNumbersColor.substring(1)||"#000000"),Pe.searchParams.set("font2",ge),Pe.searchParams.set("size2",N.countdownLabelsFontSize*2||8),Pe.searchParams.set("color2",N.countdownLabelsColor.substring(1)||"#959595"),Pe.searchParams.set("spacing",Math.round(N.countdownNumbersFontSize*.4)||5),Pe.searchParams.set("locale",N.countdownLanguage.replace("_","-")),Pe.searchParams.set("timezone",N.countdownTimeZone),Pe.searchParams.set("frames",N.countdownDuration),A({link:JSON.stringify({target:Pe.href})}),S(),V(!0)},Pt=(0,n.useCallback)(N=>{Ro(N),d(M==="email"?r.setElementSettings$1(N):r.setElementSettings(N))},[d,M,Ro]),Br=(0,n.useCallback)((N,Pe)=>{const Ee=Ue.current,ge=r.stripEmVersionFromUrlString(Ee.src||"")===r.stripEmVersionFromUrlString(N||"");(!ge||N!==Ee.src)&&(x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Ee.type,settings:{src:N}}),Pt({...Ee,src:N,...Ee.type==="video"?{video:le()||Ee.video}:{},activateSection:null,changeKey:"src"}),l.setFieldValue("src",N)),Pe?.mode==="save"&&ge&&(P(Oe=>({name:"src",counter:Oe.counter+1})),k(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(N)}))},[l,le,Pt,x,k]),At=(0,n.useCallback)(async N=>{const Pe=e.src||"",Ee=r.stripEmVersionFromUrlString(Pe),ge=await b({kind:"img",currentUrl:$t(Ee)?"":Ee,entryModal:N});ge?.url&&Br(ge.url,ge.meta)},[Br,e.src,b]),Sr=(N,...Pe)=>{const Ee=l.getFieldsValue(!0),ge=Object.keys(N)[0];let Oe;switch(ge){case"link":let Ke=ot(N[ge]);Ke!==N[ge]&&l.setFieldValue("link",Ke),Oe={link:Ke};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Oe={boxShadow:{hOffset:Ee.boxShadowHOffset,vOffset:Ee.boxShadowVOffset,blurRadius:Ee.boxShadowBlurRadius,spreadRadius:Ee.boxShadowSpreadRadius,color:Ee.boxShadowColor,inset:Ee.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":Ee.borderPosition==="borderAll"?(Oe={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...Ee.borderAll}}},l.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):Ee.borderAll?.width||Ee.borderAll?.style||Ee.borderAll?.color?(Oe={border:{all:null,left:Ee.borderAll,right:Ee.borderAll,top:Ee.borderAll,bottom:Ee.borderAll,[W.REVERSE_BORDER_POSITIONS[ge]]:{...Ee[ge],...N[ge]}}},l.setFieldsValue({borderAll:null,borderLeft:Ee.borderAll,borderRight:Ee.borderAll,borderTop:Ee.borderAll,borderBottom:Ee.borderAll,[ge]:{...Ee[ge],...N[ge]}})):(Oe={border:{all:null,left:Ee.borderLeft,right:Ee.borderRight,top:Ee.borderTop,bottom:Ee.borderBottom,[W.REVERSE_BORDER_POSITIONS[ge]]:{...Ee[ge],...N[ge]}}},l.setFieldsValue({border:Oe.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(Ee.mobileBorderPosition==="mobileBorderAll")Oe={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...Ee.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[ge]+"-"}}},l.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const ao=W.MOBILE_REVERSE_BORDER_POSITIONS[ge],bo={...Ee[ge],...N[ge]},Po=!bo?.width&&!bo?.style&&!bo?.color;if(Ee.mobileBorder?.all?.width||Ee.mobileBorder?.all?.style||Ee.mobileBorder?.all?.color){const yo=Ee.mobileBorderAll;Oe={mobileBorder:{all:null,left:yo,right:yo,top:yo,bottom:yo,[ao]:Po?null:{...bo,classNamePrefix:"em-mob-border_"+ao+"-"}}},l.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:yo,mobileBorderRight:yo,mobileBorderTop:yo,mobileBorderBottom:yo,[ge]:bo})}else{const yo=e.mobileBorder||{},Jo=bt=>{const Nt=yo[bt];return Nt&&(Nt?.width||Nt?.style||Nt?.color)?Nt:null};Oe={mobileBorder:{all:null,left:ao==="left"?Po?null:{...bo,classNamePrefix:"em-mob-border_left-"}:Jo("left"),right:ao==="right"?Po?null:{...bo,classNamePrefix:"em-mob-border_right-"}:Jo("right"),top:ao==="top"?Po?null:{...bo,classNamePrefix:"em-mob-border_top-"}:Jo("top"),bottom:ao==="bottom"?Po?null:{...bo,classNamePrefix:"em-mob-border_bottom-"}:Jo("bottom")}},l.setFieldsValue({[ge]:bo})}}break;case"width":Oe={[ge]:{value:N[ge],dim:Ee.widthDim}};break;case"widthDim":Oe={width:{value:Ee.width,dim:N[ge]}};break;case"height":Oe={[ge]:{value:N[ge],dim:Ee.heightDim}};break;case"heightDim":Oe={height:{value:Ee.height,dim:N[ge]}};break;case"borderRadiusAll":Oe={borderRadius:{[W.BORDER_RADIUS_POSITION[ge]]:+N[ge]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Oe={borderRadius:{topLeft:Ee.borderRadiusTopLeft,bottomLeft:Ee.borderRadiusBottomLeft,topRight:Ee.borderRadiusTopRight,bottomRight:Ee.borderRadiusBottomRight,[W.BORDER_RADIUS_POSITION[ge]]:+N[ge]}};break;case"mobileWidth":Oe={[ge]:{classNamePrefix:"em-mob-width-",value:N[ge],dim:Ee.mobileWidthDim}};break;case"mobileWidthDim":Oe={mobileWidth:{classNamePrefix:"em-mob-width-",value:Ee.mobileWidth||100,dim:N[ge]}};break;case"mobileHeight":Oe={[ge]:{classNamePrefix:"em-mob-height-",value:N[ge],dim:Ee.mobileHeightDim}};break;case"mobileHeightDim":Oe={mobileHeight:{classNamePrefix:"em-mob-height-",value:Ee.mobileHeight,dim:N[ge]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Oe={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[ge]]:N[ge],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[ge]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Oe={mobileBoxShadow:{hOffset:Ee.mobileBoxShadowHOffset,vOffset:Ee.mobileBoxShadowVOffset,blurRadius:Ee.mobileBoxShadowBlurRadius,spreadRadius:Ee.mobileBoxShadowSpreadRadius,color:Ee.mobileBoxShadowColor,inset:Ee.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":Oe={[ge]:{classNamePrefix:"em-mob-text_align-",value:N[ge]}};break;case"mobileVerticalAlign":Oe={[ge]:{classNamePrefix:"em-mob-vertical_align-",value:N[ge]}};break;case"countdownTime":case"countdownTimeZone":case"countdownBackgroundColor":case"countdownNumbersFont":case"countdownNumbersFontSize":case"countdownNumbersColor":case"countdownLabelsFont":case"countdownLabelsFontSize":case"countdownLabelsColor":case"countdownLanguage":case"countdownDuration":case"countdownTransparency":case"countdownNumbersStrong":case"countdownNumbersItalic":case"countdownLabelsStrong":case"countdownLabelsItalic":Ct(ni);break;case"video":{const ao={...e.video,...Ee.video,...N.video},bo=ao.source??Ee.link;Ct(Er),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"video",settings:{video:ao,link:bo}}),Pt({...e,video:ao,link:bo,activateSection:null,changeKey:"video"});break}case"src":const oo=N[ge],Je=e.src,ho=Ee.video?.playButton||e.video?.playButton;if(e.type==="video"&&ho&&ho!=="none"&&!fe&&oo&&(!Je||oo!==Je)){Ct(()=>It(oo));return}Oe=N;break;default:Oe=N}ge!=="borderPosition"&&ge!=="mobileBorderPosition"&&ge.indexOf("countdown")===-1&&ge!=="video"&&(x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Oe}),ge!=="video"&&ge.indexOf("countdown")===-1&&ge!=="mobileBorderRadiusAll"&&ge!=="mobileBorderRadiusTopLeft"&&ge!=="mobileBorderRadiusTopRight"&&ge!=="mobileBorderRadiusBottomLeft"&&ge!=="mobileBorderRadiusBottomRight"&&Pt({...e,...Oe,mobileBorderRadius:{...e.mobileBorderRadius,...Oe?.mobileBorderRadius},activateSection:null,changeKey:ge}))};(0,n.useEffect)(()=>{j.isError&&(f.error(j),V(!1))},[j]),(0,n.useEffect)(()=>{if(j.isSuccess&&je){if(j.data.data?.status===400)f.error({title:j.data.code,description:j.data.message});else{let N=new URL(j.data.target),Pe={countdown:{link:j.data.link,params:N.search.substring(1)}};x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Pe})}V(!1)}},[j,je,e,f,x]);const Tm=N=>{N.data.operation===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(d(r.closeSecondModal()),d(r.closeModal$1()))};r.useListenPostMessage(Tm),r.useImageControlRequest(e.src,N=>{N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?At(r.MODALS.UPLOAD_IMAGE_MODAL_AI):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?At(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?At(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?At(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP&&At(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK)});const Rm=()=>{const N=l.getFieldsValue(!0);s.markBorderToggled(!he),setTimeout(()=>{pe(Pe=>!Pe),he?(N.borderAll=W.NULL_BORDER,N.borderTop=W.NULL_BORDER,N.borderBottom=W.NULL_BORDER,N.borderRight=W.NULL_BORDER,N.borderLeft=W.NULL_BORDER):N.borderAll={width:1,color:"#E5E5E5",style:"solid"},x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:N.borderAll.color,style:N.borderAll.style,width:N.borderAll.width}}}})})},ym=()=>{const N=l.getFieldsValue(!0);a.markBorderToggled(!ee),setTimeout(()=>{J(Pe=>!Pe),ee?(N.mobileBorderAll=W.NULL_BORDER,N.mobileBorderTop=W.NULL_BORDER,N.mobileBorderBottom=W.NULL_BORDER,N.mobileBorderRight=W.NULL_BORDER,N.mobileBorderLeft=W.NULL_BORDER):N.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:N.mobileBorderAll.color,style:N.mobileBorderAll.style,width:N.mobileBorderAll.width}}}})})},wm=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{X(Pe=>!Pe),H?(N.borderRadiusAll=0,_e(!0)):N.borderRadiusAll=5,x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:N.borderRadiusAll}}})})},jm=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{xe(Pe=>!Pe),ce?(N.mobileBorderRadiusAll=null,de(!0)):N.mobileBorderRadiusAll=5,x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:N.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},vm=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{Ae(Pe=>!Pe),ne?(N.boxShadowInset=!1,N.boxShadowHOffset=null,N.boxShadowVOffset=null,N.boxShadowBlurRadius=null,N.boxShadowSpreadRadius=null,N.boxShadowColor=""):(N.boxShadowInset=!1,N.boxShadowHOffset=5,N.boxShadowVOffset=5,N.boxShadowBlurRadius=10,N.boxShadowSpreadRadius=-5,N.boxShadowColor="#000000"),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:N.boxShadowBlurRadius,color:N.boxShadowColor,hOffset:N.boxShadowHOffset,inset:N.boxShadowInset,spreadRadius:N.boxShadowSpreadRadius,vOffset:N.boxShadowVOffset}}})})},Im=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{$e(Pe=>!Pe),we?(N.mobileBoxShadowInset=!1,N.mobileBoxShadowHOffset=null,N.mobileBoxShadowVOffset=null,N.mobileBoxShadowBlurRadius=null,N.mobileBoxShadowSpreadRadius=null,N.mobileBoxShadowColor=""):(N.mobileBoxShadowInset=!1,N.mobileBoxShadowHOffset=5,N.mobileBoxShadowVOffset=5,N.mobileBoxShadowBlurRadius=10,N.mobileBoxShadowSpreadRadius=-5,N.mobileBoxShadowColor="#000000"),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:N.mobileBoxShadowBlurRadius,color:N.mobileBoxShadowColor,hOffset:N.mobileBoxShadowHOffset,inset:N.mobileBoxShadowInset,spreadRadius:N.mobileBoxShadowSpreadRadius,vOffset:N.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Cm=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{ie(Pe=>!Pe),K&&(N.mobileWidth="",N.mobileHeight="",x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"},mobileHeight:{value:null,dim:"px",classNamePrefix:"em-mob-height-"}}}))})},va=()=>{De?(Ne.current=!1,ye(""),l.setFieldValue("link",""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{link:""}})):(Ne.current=!0,ye(Y.current&&Y.current.input.value?Y.current.input.value:"..."),setTimeout(()=>{Y.current.focus()}))},Ia=N=>{N.target.value===""?ye("..."):(z.current.classList.add("selected-td-form__button--active"),ye(N.target.value)),Wo(N.target.value,Ie)},Ca=()=>{const N=l.getFieldsValue(!0);re?(ke(""),N.alt="",x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{alt:""}})):(ke($.current&&$.current.input.value?$.current.input.value:"..."),setTimeout(()=>{$.current.focus()}))},Pa=N=>{N.target.value===""?ke("..."):(O.current.classList.add("selected-td-form__button--active"),ke(N.target.value))},Aa=()=>{const N=l.getFieldsValue(!0);ae?(Q(""),N.title="",x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{title:""}})):(Q(y.current&&y.current.input.value?y.current.input.value:"..."),setTimeout(()=>{y.current.focus()}))},Pm=()=>{F(!R),R?(l.setFieldValue("imgReplacer",""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:""}})):setTimeout(()=>G.current.focus())},Am=N=>{N.target.value!==""&&q.current.classList.add("selected-td-form__button--active")},Na=N=>{N.target.value===""?Q("..."):(oe.current.classList.add("selected-td-form__button--active"),Q(N.target.value))},Nm=N=>{l.setFieldValue("link",N!=="mergetag"?N:""),Ie(N)};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_image_form",initialValues:{src:"",width:"",height:"",widthDim:"",heightDim:"",alt:"",align:"left",border:"",boxShadow:"",show:"all",borderPosition:W.BORDER_POSITIONS[Co]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[Bo]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileAlign:"left",mobileVerticalAlign:"",link:"https://",imgReplacer:"",countdownNumbersStrong:!1,countdownNumbersItalic:!1,countdownLabelsStrong:!1,countdownLabelsItalic:!1,video:{source:"",playButton:"youtube_red"}},onValuesChange:Sr,autoComplete:"off",disabled:Eo,className:Eo?"element-controls selected-image-form_busy":"element-controls",children:[Eo&&(0,o.jsx)("div",{className:"selected-image-form__loader",ref:B,children:(0,o.jsxs)("div",{className:"selected-image-form__loader-body",children:[(0,o.jsx)(t.ui_kit$Spin,{size:"large"}),(0,o.jsx)("div",{className:"selected-image-form__loader-title",children:Ve.type==="countdown"?i("Preparing countdown preview…"):i("Preparing video preview…")})]})}),!m&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),h==="mobile"&&T.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(Or,{form:l,elementSettings:e,handleChangeValues:Sr,boxShadow:ue,mobileBordersShow:ee,mobileBorderRadiusShow:ce,mobileBoxShadowShow:we,mobileSizeShow:K,oneMobileBorderRadiusValue:ve,setOneMobileBorderRadiusValue:de,hasLink:De,hasAlt:re,hasTitle:ae,linkInputRef:Y,linkButtonRef:z,altInputRef:$,altButtonRef:O,titleInputRef:y,titleButtonRef:oe,linkInputHandler:Ia,altButtonHandler:Ca,altInputHandler:Pa,titleButtonHandler:Aa,titleInputHandler:Na,linkButtonHandler:va,toggleShowMobileBorderHandler:ym,toggleShowMobileBorderRadiusHandler:jm,toggleShowMobileBoxShadowHandler:Im,toggleShowMobileSizeHandler:Cm})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Lr,{form:l,elementSettings:e,boxShadow:ue,bordersShow:he,borderRadiusShow:H,boxShadowShow:ne,oneBorderRadiusValue:se,setOneBorderRadiusValue:_e,hasLink:De,hasAlt:re,hasTitle:ae,isOpenSrcReplacer:R,mergeTagItems:Te,mergeMenuOpen:Z,setMergeMenuOpen:Be,cascaderRef:te,linkInputRef:Y,linkButtonRef:z,altInputRef:$,altButtonRef:O,titleInputRef:y,titleButtonRef:oe,srcReplacerInputRef:G,srcReplacerButtonRef:q,linkProtocol:Se,handleLinkProtocolsChange:Nm,linkButtonHandler:va,linkInputHandler:Ia,altButtonHandler:Ca,altInputHandler:Pa,titleButtonHandler:Aa,titleInputHandler:Na,srcReplacerButtonHandler:Pm,srcInputHandler:Am,handleSelect:mo,onChange:be,filter:ze,renderSearchOption:co,handleChangeValues:Sr,toggleShowBorderHandler:Rm,toggleShowBorderRadiusHandler:wm,toggleShowBoxShadowHandler:vm})})]})};Fr.propTypes={elementSettings:g.default.object.isRequired};var Mr=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:e("The font-size CSS property sets the size of the font."),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileFontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:e("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})},it=({form:e,elementSettings:i,imgParent:l=!1,name:s="align",setAlignStateHandle:a=()=>{},withHotKeys:d=!0})=>{const{__:c}=r.useI18n(),p=r.useSendPostMessage(),f=r.useAppConfig(),[x,k]=(0,n.useState)(null);(0,n.useEffect)(()=>{globalThis?.navigator?.userAgent.includes("Macintosh")&&k(!0)},[]);const b=v=>{a(v),e.setFieldsValue({[s]:v}),p({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[s]:v}})},h=d?{alignLeft:c("Text align left ( ⌘+Shift+L )"),alignCenter:c("Text align center ( ⌘+Shift+E )"),alignRight:c("Text align right ( ⌘+Shift+R )"),alignJustify:c("Text align justify ( ⌘+Shift+J )")}:void 0,T=d?{alignLeft:c("Text align left ( Ctrl+Shift+L )"),alignCenter:c("Text align center ( Ctrl+Shift+E )"),alignRight:c("Text align right ( Ctrl+Shift+R )"),alignJustify:c("Text align justify ( Ctrl+Shift+J )")}:void 0,_=d?x?h:T:void 0,E=i[s],w=typeof E=="string"?E:"";return(0,o.jsx)(t.ui_kit$Form.Item,{name:s,children:(0,o.jsx)(t.ui_kit$FormAlignTextControl,{value:w,onChange:b,disabled:l&&!i.parent,strokeWidth:f?.iconStrokeWidth,labels:_})})},qe=({form:e,elementSettings:i,name:l,icon:s,tooltipTitle:a=null,showTooltip:d=!0,forceInactive:c=!1})=>{const{__:p}=r.useI18n(),f=e.getFieldValue(l),x=r.useSendPostMessage(),[k,b]=(0,n.useState)(i[l]);(0,n.useEffect)(()=>{i[l]!==e.getFieldValue(l)&&(e.setFieldValue(l,i[l]),b(i[l]))},[i,e,l]),(0,n.useEffect)(()=>{k!==f&&b(f)},[f,k,l]);const h=()=>{const T={[l]:!k};e.setFieldValue(l,!k),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:T}),l==="textSuperscript"?e.setFieldValue("textSubscript",!1):l==="textSubscript"&&e.setFieldValue("textSuperscript",!1),b(_=>!_)};return(0,o.jsx)(t.ui_kit$Form.Item,{name:l,children:d?(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:a||p(l.substring(4)),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":k&&!c}),onClick:h,children:s})}):(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":k&&!c}),onClick:h,children:s})})};qe.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string,imgParent:g.default.bool};var Dr=()=>{const{__:e}=r.useI18n();return[{symbol:"•",code:"•",description:e("Bullet")},{symbol:"+",code:"+",description:e("Plus")},{symbol:"»",code:"»",description:e("Double quotation")},{symbol:"×",code:"×",description:e("Cross")},{symbol:"–",code:"—",description:e("Dash")},{symbol:"›",code:"›",description:e("Single quotation")},{symbol:"→",code:"→",description:e("Arrow")},{symbol:"⇒",code:"⇒",description:e("Double arrow")},{symbol:"►",code:"▸",description:e("Pointer")},{symbol:"−",code:"−",description:e("Minus")},{symbol:"∗",code:"∗",description:e("Star")},{symbol:"♦",code:"♦",description:e("Diamond")}]},un=(e,i="#c6c3c3",l={},s)=>{const{symbolSize:a="25px",marginRight:d="5px",marginBottom:c="5px",textStyle:p={whiteSpace:"normal",lineHeight:"1.2"}}=l;return e.map(f=>({value:f.code,label:(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,o.jsx)("span",{style:{color:i||"#c6c3c3",marginRight:d,marginBottom:c,fontSize:a,lineHeight:"0.7",width:a,textAlign:"center",...p},children:f.symbol}),(0,o.jsx)("span",{style:p,children:f.description})]})}))},gt=({form:e,fillFields:i,elementSettings:l,showAddParagraph:s=!0,isButton:a=!1,linkProtocol:d,setLinkProtocol:c,linkTarget:p,isBulletFontColorChecked:f=!1,setIsBulletFontColorChecked:x=()=>{},showTopDivider:k=!0})=>{const{__:b}=r.useI18n(),h=W.useGoogleFontsLoader(),{token:T}=(0,t.ui_kit$useToken)(),_=r.useNotification(),E=r.useSendPostMessage(),w=r.useSendPostMessageEx(),v=r.useAppConfig(),A=(0,n.useRef)(),j=(0,n.useRef)(null),C=(0,n.useRef)(null),P=(0,n.useRef)(null),Y=(0,n.useRef)(!1),z=l,[$,O]=(0,n.useState)(!!z.textReplacer?.length),[y,oe]=(0,n.useState)(!!z.textAnchor?.length),[G,q]=(0,n.useState)(null),[te,ue]=(0,n.useState)({start:0,end:0}),[me,se]=(0,n.useState)(!1),[_e,ve]=(0,n.useState)([]),[de,De]=(0,n.useState)(z.list?.bulletsColor),[ye,re]=(0,n.useState)(l);l!==ye&&(re(l),De(z.list?.bulletsColor),O(!!z.textReplacer?.length),oe(!!z.textAnchor?.length));const[ke,ae]=(0,n.useState)(!1),[Q,he]=(0,n.useState)(!1),pe=(0,n.useRef)(null),ee=(0,n.useRef)(""),J=Dr(),H=(0,n.useMemo)(()=>J,[]),X={textColor:t.ui_kit$Form.useWatch("textColor",e),textLink:t.ui_kit$Form.useWatch("textLink",e),linkHref:t.ui_kit$Form.useWatch("linkHref",e),listUL:t.ui_kit$Form.useWatch("listUL",e),listOL:t.ui_kit$Form.useWatch("listOL",e)};(0,n.useEffect)(()=>{a&&l?.textColor!==void 0&&e.setFieldValue("textColor",l.textColor)},[a,l?.textColor,e]);let ce=null;(0,n.useEffect)(()=>{if(X?.textColor&&f){const L=e.getFieldValue("textColor");E({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{ColorBullets:L}})}},[X?.textColor]),(0,n.useEffect)(()=>{const L=e.getFieldValue("textLink");typeof l.linkHref=="string"&&ae(!0),pe&&!L&&(ae(!1),e.setFieldsValue({linkHref:null})),pe.current=L||null},[X?.textLink,X?.linkHref,l.linkHref,e]),(0,n.useEffect)(()=>{const L=e.getFieldValue("listUL"),R=e.getFieldValue("listOL");L&&ee.current!=="listUL"?(e.setFieldValue("listOL",!1),ee.current="listUL"):R&&ee.current!=="listOL"&&(e.setFieldValue("listUL",!1),ee.current="listOL"),!L&&!R&&(ee.current="")},[X?.listUL,X?.listOL,e]);const xe=L=>{L.data.operation===r.EVENT_TYPES.APPLICATION_FOCUS_IN_IFRAME&&q(null)};r.useListenPostMessage(xe);const[ne,Ae]=(0,n.useState)(null);(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&Ae(!0)},[]);const we=(0,n.useRef)(null);function $e(L){const R=L.key.toLowerCase();let F=!1;return((ce==="control"||ce==="meta")&&(R==="a"||R==="A")||(ce==="a"||ce==="A")&&(R==="control"||R==="meta"))&&(F=!0),ce=R,R!=="control"&&R!=="a"&&R!=="A"&&R!=="meta"&&(ce=null),F}const K=L=>{E({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:L,locale:"en_US"}),_.success({title:b("It`s done!")})},ie=[{key:"1",label:b("This element"),onClick:()=>K("typograf")},{key:"2",label:b("The whole email"),onClick:()=>K("typograf_all")}],[je,V]=(0,n.useState)(),[Se,Ie]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const L=un(H,de,{});ve(L)},[H,de]),(0,n.useEffect)(()=>{const L=l.linkHref||l.href;L&&Wo(L,c);const R=l.linkHref||l.href,F=R&&Bi(R)?R.slice(1):R||"https://";(i??((fe,Le)=>fe.setFieldsValue(Le)))(e,{linkHref:F})},[e,l,c,i]);const Ne=r.useAppConfig().mergeTags;(0,n.useEffect)(()=>{Ne?.items?.length&&V(r.mapMargeTags(Ne.items,b,(L,R)=>{Ie(!1),w(r.EVENT_TYPES.SANDBOX_ADD_MERGETAG,L),R.stopPropagation(),R.preventDefault()}))},[Ne,V,b,Ie,w]);const Fe=L=>{e.setFieldValue("linkHref",L!=="mergetag"?L:""),c(L)},Ve=(L,R)=>{if(Ie(!1),L){const F=Ne.syntax.length>1?je.findIndex(Le=>Le.key===R[0].key):0,fe=Ne.syntax[F].replace("%value%",L[L.length-1]);if(G?.getAttribute("id")==="selected_button_form_href"||G?.getAttribute("id")==="selected_text_form_linkHref"||G?.getAttribute("id")==="selected_text_form_textReplacer")Be(fe,G?.getAttribute("id"));else{e.setFieldValue("textReplacer",fe);const Le=Date.now();E({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:`${fe}~~${Le}`}})}}},Ue=(L,R)=>R.some(F=>F.label.toLowerCase().indexOf(L.toLowerCase())>-1),le=(L,R)=>{const F=R.map((fe,Le)=>{const eo=fe.label.split(new RegExp(`(${L})`,"gi"));return(0,o.jsxs)("span",{children:[Le!==0&&(0,o.jsx)("span",{children:" / "}),eo.map((Xe,lo)=>Xe.toLowerCase()===L.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:Xe},lo):Xe)]},fe.value)});return(0,o.jsx)("div",{title:R.map(fe=>fe.label).join(" / "),children:F})};(0,n.useEffect)(()=>{Se&&we.current&&we.current.focus()},[Se]);const Te=r.useRootElement();(0,n.useEffect)(()=>{const L=({target:fe})=>{fe.closest('[id="merge_tags_wrapper"]')||q(fe)},R=({target:fe})=>{!fe.closest(".merge-tags")&&!fe.closest("#merge_tags_button")&&Ie(!1)},F=new xo.Disposable;return F.addDisposable(r.addWindowListenerFromShadow(Te,"focusin",L)),F.addDisposable(r.addWindowListenerFromShadow(Te,"click",R)),()=>{F.dispose()}},[Te]);const I=(0,n.useCallback)(()=>{const L=window.getSelection();L&&L.toString().length>0&&(Y.current=!0)},[]),Z=(0,n.useCallback)(({target:L})=>{if(L&&!me){const{selectionStart:R,selectionEnd:F}=L;ue({start:R,end:F})}se(!1)},[me]);(0,n.useEffect)(()=>Z({target:p?.target}),[p,Z]);const Be=(L,R)=>{const F=document.getElementById(R);if(F){const fe=F.value?.substring(0,te.start),Le=F.value?.substring(te.end),eo=R.substring(R.lastIndexOf("_")+1);E({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{[eo]:fe+L+Le}}),e.setFieldValue(eo,fe+L+Le),F.focus(),setTimeout(()=>{F.selectionStart=te.start,F.selectionEnd=te.start+L.length},400),se(!0)}},Ce=()=>{O(!$),$?(e.setFieldValue("textReplacer",""),E({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:""}})):setTimeout(()=>j.current.focus())},Me=L=>{L.target.value!==""&&C.current?.classList.add("selected-td-form__button--active")},Ge=(L="unknown")=>{oe(!y),y?(e.setFieldValue("textAnchor",""),E({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textAnchor:""}})):setTimeout(()=>P.current?.focus())},Ye=L=>{const R=L.target,F=R.value,fe=R.selectionStart,Le=$e(L);if(Y.current&&fe===0&&E({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:`${F}~`}}),Y.current=Le,fe===0&&L.key===" "){L.preventDefault();return}if(L.key===" "){if(fe!==F.length){L.preventDefault();return}F.endsWith(" ")&&L.preventDefault()}},D=L=>{De(L),f&&x(!1)};return(0,o.jsxs)(o.Fragment,{children:[s&&!l.showOnMobile&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Row,{gutter:20,style:{paddingBottom:4},children:(0,o.jsx)(t.ui_kit$Col,{span:12,gutter:20,children:(0,o.jsx)(it,{form:e,elementSettings:l,name:"textAlign"})})})}),v.formTextFieldTypografEnabled&&!a||v.mergeTagsShow&&je?(0,o.jsx)(t.ui_kit$FormSection,{title:null,dividerTop:k,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginTop:4},children:[v.formTextFieldTypografEnabled&&!a&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"AddImage",style:{marginBottom:T.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"AddImage",component:t.icons$AddImage}),onClick:()=>K("add_img"),style:{width:"100%"},children:b("Add image")})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"Typography",style:{marginBottom:T.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,menu:{items:ie},trigger:["hover"],placement:"bottom",getPopupContainer:L=>L.closest(".selected-element-panel"),children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Typograf",component:t.icons$Typograf}),onClick:()=>K("typograf"),style:{width:"100%"},children:b("Typography")})})})})]}),v.mergeTagsShow&&je&&(0,o.jsxs)(t.ui_kit$Col,{span:24,id:"merge_tags_wrapper",style:{marginBottom:T.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Button,{id:"merge_tags_button",icon:(0,o.jsx)(r.EmIcons,{icon:"MergeTags",component:t.icons$MergeTags}),style:{width:"100%",display:Se?"none":"inline-flex"},onClick:()=>Ie(!0),children:b("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:we,classNames:{popup:{root:"merge-tags"}},options:je,placeholder:b("Start typing the title"),showSearch:{filter:Ue,render:le},spellCheck:"false",getPopupContainer:L=>L.closest(".email-pane__collapse-wrapper"),onChange:Ve,style:{display:Se?"block":"none",width:"100%"},open:Se,onKeyDown:L=>{L.key==="Escape"&&Ie(!1)}})]})]})}):null,(0,o.jsxs)(t.ui_kit$FormSection,{title:null,dividerTop:k||v.formTextFieldTypografEnabled&&!a,bodyStyle:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Text font"),placement:"bottom",zIndex:1,getPopupContainer:L=>L.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:h,getPopupContainer:L=>L.closest(".email-pane__collapse-wrapper")})})}),!l.showOnMobile&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:b("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:b("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{marginBottom:10,marginTop:5},children:(0,o.jsxs)(t.ui_kit$Col,{span:24,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:-10},children:[a&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsxs)("div",{className:"selected-text-common-form__format-toolbar",children:[(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textStrong",tooltipTitle:b(ne?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})}),(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textItalic",tooltipTitle:b(ne?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})}),(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textUnderline",tooltipTitle:b(ne?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})}),(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:b(ne?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Text color"),placement:"bottom",zIndex:1,getPopupContainer:L=>L.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:b("Please set the font color")}],className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:b("Color"),usedColors:l.usedColors})})})})]}),!a&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textStrong",tooltipTitle:b(ne?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textItalic",tooltipTitle:b(ne?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textUnderline",tooltipTitle:b(ne?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})}),l?.list?.isList&&(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:b(ne?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]}),!l?.list?.isList&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:l,name:"listUL",tooltipTitle:b("Unordered list"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnorderedListOutlined",component:t.icons$UnorderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:Z})}),!l?.list?.isList&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:l,name:"listOL",tooltipTitle:b("Ordered list"),icon:(0,o.jsx)(r.EmIcons,{icon:"OrderedListOutlined",component:t.icons$OrderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:Z})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textSuperscript",tooltipTitle:b("Text superscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Superscript",component:t.icons$Superscript})})}),l?.list?.isList&&(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textSubscript",tooltipTitle:b("Text subscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Subscript",component:t.icons$Subscript})})]}),s&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,className:(0,He.default)("selected-text-common-form__button selected-text-common-form__button_style",{"selected-text-common-form__button--active":typeof l.linkHref=="string"}),elementSettings:l,name:"textLink",forceInactive:!!l.textAnchor,tooltipTitle:b("Link"),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"}),onSelect:Z})}),l?.list?.isList&&v.formTextFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:b("Text replacer"),placement:"bottom",getPopupContainer:L=>L.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":$}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:Ce,ref:C})})}),(!l?.list?.isList||s&&l?.list?.isList)&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:b("More options"),placement:"bottom",getPopupContainer:L=>L.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":Q||y}),icon:(0,o.jsx)(r.EmIcons,{icon:"DotsHoriz",component:t.icons$DotsHoriz,className:"selected-td-form__icon-radius"}),onClick:()=>he(!Q)})})})]})]}),!a&&Q&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[!l?.list?.isList&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:b(ne?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]}),(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textSubscript",tooltipTitle:b("Text subscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Subscript",component:t.icons$Subscript})})]}),v.formTextFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:b("Text replacer"),placement:"bottom",getPopupContainer:L=>L.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":$}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:Ce,ref:C})})})]}),s&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:b("Anchor"),placement:"bottom",getPopupContainer:L=>L.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":y}),icon:(0,o.jsx)(r.EmIcons,{icon:"Anchor",component:t.icons$Anchor,className:"selected-text-common-form__icon-radius"}),onMouseDown:L=>{L.preventDefault(),Ge("mouseDown")}})})})]}),s&&typeof l.linkHref=="string"&&ke&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(et,{show:d==="#",__:b,style:{marginBottom:T.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b(d==="#"?"Anchor name":"The URL that the hyperlink directs to."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkHref",style:{marginBottom:d==="mailto:"?T.formItemMarginBottomXS:""},children:(0,o.jsx)(t.ui_kit$Input,{ref:A,addonBefore:(0,o.jsx)(Zo,{linkProtocol:d,handleLinkProtocolsChange:Fe,__:b}),allowClear:!0,placeholder:b(d==="#"?"Anchor name":"Hyperlink URL"),autoFocus:l?.isNewLink,onSelect:Z,prefix:(0,o.jsx)(Qo,{linkProtocol:d})})})}),d==="mailto:"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"subject",style:{marginBottom:T.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:b("Subject"),onSelect:Z})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:T.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:b("Body"),onSelect:Z})})]})]}),s&&y&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Anchor name"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textAnchor",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:b("Anchor name"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content addon-text-content--icon",title:b("Anchor"),"aria-hidden":!0,children:(0,o.jsx)(r.EmIcons,{icon:"Anchor",component:t.icons$Anchor,className:"selected-text-common-form__icon-radius",size:18})}),ref:P,onSelect:Z,onBlur:()=>{e.getFieldValue("textAnchor")?.trim()||oe(!1)}})})}),!a&&$&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textReplacer",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:b("The code that will replace this text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:b("Text")}),onChange:Me,onKeyDown:Ye,onDoubleClick:I,ref:j,onSelect:Z})})})]})}),!a&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Text color"),placement:"bottom",zIndex:1,getPopupContainer:L=>L.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:b("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:b("Color"),usedColors:l.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Text background"),placement:"bottom",zIndex:1,getPopupContainer:L=>L.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:b("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:b("Background color"),usedColors:l.usedColors})})})})]})]}),!a&&l?.list?.isList&&(0,o.jsxs)(t.ui_kit$FormSection,{title:b("List settings"),dividerTop:!0,children:[l?.list?.listType==="OL"&&(0,o.jsx)(t.ui_kit$Row,{children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets font"),placement:"bottom",zIndex:1,getPopupContainer:L=>L.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"BulletsFontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:h,getPopupContainer:L=>L.closest(".email-pane__collapse-wrapper"),style:{marginTop:"-9px"}})})})})}),(0,o.jsx)(t.ui_kit$Row,{gutter:[10],children:l?.list?.listType==="UL"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets type"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"BulletType",className:"bullet-type",children:(0,o.jsx)(t.ui_kit$Select,{size:"medium",placeholder:b("Bullets type"),onClick:L=>L.stopPropagation(),options:_e})})})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:[10],children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets color"),placement:"bottom",zIndex:1,getPopupContainer:L=>L.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"ColorBullets",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:b("Bullets color"),usedColors:l.usedColors,disabled:f,onChange:D,externalValue:f?X?.textColor:void 0})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"BulletsSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,defaultValue:l?.list?.bulletFontSize,placeholder:b("Bullets size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})})]}),l?.list?.listType==="OL"&&(0,o.jsxs)(t.ui_kit$Row,{children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:l,name:"BulletTextStrong",tooltipTitle:b(ne?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:l,name:"BulletTextItalic",tooltipTitle:b(ne?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:l,name:"BulletTextStrikethrough",tooltipTitle:b(ne?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:l,name:"BulletTextUnderline",tooltipTitle:b(ne?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:[10],style:{marginTop:"-8px"},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Between list items"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"SpacingBetweenParagraphs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:5,max:100,placeholder:b("Between list items"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Between bullets and text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"SpacingBetweenBulletsAndText",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:1,max:100,placeholder:b("Between bullets and text"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px"})})})})]})]})]})},Ri=({form:e,elementSettings:i,showAddParagraph:l=!0,isButton:s=!1})=>{const{__:a}=r.useI18n(),d=W.useGoogleFontsLoader(),c=r.useSendPostMessage(),p=r.useDispatch(),f=r.useElementEntityKind(),x=r.useAppConfig(),[k,b]=(0,n.useState)(null);(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&b(!0)},[]);const h=A=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:A,locale:"en_US"})},[T,_]=(0,n.useState)(i.textAlign),[E,w]=(0,n.useState)(i.linkHref),v=A=>_(A);return(0,n.useEffect)(()=>{_(i.textAlign),w(i.linkHref)},[i]),(0,o.jsx)("div",{className:"selected_text_common_form_mobile",children:(0,o.jsxs)(t.ui_kit$Space,{size:"8",separator:(0,o.jsx)(t.ui_kit$Divider,{orientation:"vertical"}),children:[(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,o.jsx)("div",{style:{width:190},children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Text font"),placement:"bottom",zIndex:1,getPopupContainer:A=>A.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:d,getPopupContainer:A=>A.closest(".selected_text_common_form_mobile")})})})}),(0,o.jsx)("div",{style:{width:90},children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:a("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)("div",{style:{width:90},children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:a("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,o.jsx)(qe,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:a(k?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-td-form__icon-radius"})}),(0,o.jsx)(qe,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:a(k?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})}),(0,o.jsx)(qe,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:a(k?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-td-form__icon-radius"})}),(0,o.jsx)(qe,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:a(k?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-td-form__icon-radius"})})]}),(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Text color"),placement:"bottom",zIndex:1,getPopupContainer:A=>A.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:a("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:a("Color"),usedColors:i.usedColors,getPopupContainer:A=>A.closest(".selected_text_common_form_mobile")})})}),!s&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Text background"),placement:"bottom",zIndex:1,getPopupContainer:A=>A.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:a("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:a("Background color"),usedColors:i.usedColors})})})})]}),l&&(0,o.jsx)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:(0,o.jsxs)(o.Fragment,{children:[typeof E=="string"?(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,popupRender:()=>(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("The URL that the hyperlink directs to."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkHref",children:(0,o.jsx)(t.ui_kit$Input,{allowClear:!0,placeholder:a("Hyperlink URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined}),autoFocus:i?.isNewLink})})}),classNames:{root:"codemode-textalign-dropdown"},styles:{root:{left:520,top:52,transform:"translateX(0)",marginLeft:57}},trigger:["hover"],placement:"bottom",getPopupContainer:A=>A.closest(".selected_text_common_form_mobile"),children:(0,o.jsx)("div",{children:(0,o.jsx)(qe,{form:e,className:"selected-td-form__button selected-td-form__button_style selected-td-form__button--active",elementSettings:i,name:"textLink",icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),showTooltip:!1})})}):(0,o.jsx)(qe,{form:e,className:"selected-td-form__button selected-td-form__button_style",elementSettings:i,name:"textLink",tooltipTitle:a("Link"),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"})}),(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,popupRender:()=>(0,o.jsx)(it,{form:e,elementSettings:i,name:"textAlign",setAlignStateHandle:v}),classNames:{root:"codemode-textalign-dropdown"},styles:{root:{left:615,top:52,transform:"translateX(0)",marginLeft:57}},trigger:["hover"],placement:"bottom",getPopupContainer:A=>A.closest(".selected_text_common_form_mobile"),children:(0,o.jsx)(t.ui_kit$Button,{icon:T==="right"?(0,o.jsx)(r.EmIcons,{icon:"AlignRightOutlined",component:t.icons$AlignRightOutlined,size:18,strokeWidth:x.iconStrokeWidth}):T==="center"?(0,o.jsx)(r.EmIcons,{icon:"AlignCenterOutlined",component:t.icons$AlignCenterOutlined,size:18,strokeWidth:x.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"AlignLeftOutlined",component:t.icons$AlignLeftOutlined,size:18,strokeWidth:x.iconStrokeWidth}),className:"selected-td-form__button"})})]})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[l&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Add paragraph"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Paragraph",component:t.icons$Paragraph}),onClick:()=>h("add_p"),className:"selected-td-form__button"})}),!s&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Add inline image"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"ImageAdd",component:t.icons$ImageAdd,size:16,strokeWidth:x.iconStrokeWidth}),onClick:()=>h("add_img"),className:"selected-td-form__button"})}),(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Typograf",component:t.icons$Typograf}),className:"selected-td-form__button"})]}),(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"CloseOutlined",component:t.icons$CloseOutlined}),type:"icon",style:{marginLeft:26},onClick:()=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),p(r.resetToLastActiveSettingsTab()),setTimeout(()=>{p(f==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300)}})]})]})})},Dt=({elementSettings:e,imgParent:i=!1,name:l="mobileAlign"})=>{const{__:s}=r.useI18n(),a=r.useAppConfig();return(0,o.jsx)(t.ui_kit$Form.Item,{name:l,children:(0,o.jsx)(t.ui_kit$FormAlignTextControl,{disabled:i&&!e.parent,strokeWidth:a?.iconStrokeWidth,labels:{alignLeft:s("Text align left"),alignCenter:s("Text align center"),alignRight:s("Text align right"),alignJustify:s("Text align justify")}})})};Dt.propTypes={elementSettings:g.default.object.isRequired,imgParent:g.default.bool,name:g.default.string};var mn=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useDispatch(),s=r.useSendPostMessage(),[a]=t.ui_kit$Form.useForm(),d=r.useSelector(r.selectEmailViewType),c=r.useSelector(r.selectMobileViewActive),p=r.useSelector(r.selectIsCodeMode),f=r.useSelector(r.selectCodeModeDirection),x=p&&f!=="bottom",[k,b]=(0,n.useState)("https://"),[h,T]=(0,n.useState)(!1),_=Dr(),E=(0,n.useMemo)(()=>_,[]),w=r.useElementEntityKind(),{remember:v,fillFields:A}=st(e),j=(0,n.useCallback)(P=>{v(P),l(w==="email"?r.setElementSettings$1(P):r.setElementSettings(P))},[l,w,v]);(0,n.useEffect)(()=>{if(e){const{subject:P,body:Y,baseEmail:z}=Pr(e.linkHref),$=e.linkHref,O=typeof $=="string"&&Bi($),y=typeof $=="string"&&$.startsWith("mailto:")?z:O?$.slice(1):typeof $=="string"?$:"https://";b(Mt($||"","https://")),A(a,{...e,lineHeight:u(e.lineHeight),linkHref:y,subject:P,body:Y,mobileFontSize:u(e.mobileFontSize?.value||e.fontSize),mobileFontSizeDim:e.mobileFontSize?.dim||e.fontSizeDim,mobileLineHeight:u(e.mobileLineHeight?.value??e.lineHeight),mobileLineHeightDim:e.mobileLineHeight?.dim||e.lineHeightDim,mobileTextAlign:Ar(e.mobileTextAlign,e.textAlign),SpacingBetweenBulletsAndText:e?.list?.betweenRowCell,SpacingBetweenParagraphs:e?.list?.betweenParagraphs,BulletsSize:e?.list?.bulletFontSize,ColorBullets:e?.list?.bulletsColor,BulletTextStrong:e?.list?.bulletFontBold,BulletTextItalic:e?.list?.bulletFontItalic,CheckboxColor:h,BulletsFontFamily:e?.list?.bulletFontFamily,BulletTextUnderline:e?.list?.bulletFontUnderline,BulletTextStrikethrough:e?.list?.bulletFontStrikethrough,BulletType:E.find(oe=>oe.symbol===e?.list?.bulletType)?.code??E[0].code,textSuperscript:e?.textSuperscript,textSubscript:e?.textSubscript,listOL:e?.standardList?.listTypeOL,listUL:e?.standardList?.listTypeUL})}},[a,e]);const C=P=>{const Y=a.getFieldsValue(!0),z=Object.keys(P)[0];let $;switch(z){case"mobileFontSize":$={[z]:{classNamePrefix:"em-mob-font_size-",value:P[z],dim:Y.mobileFontSizeDim}};break;case"mobileLineHeight":$={[z]:{classNamePrefix:"em-mob-line_height-",value:P[z],dim:Y.mobileLineHeightDim}};break;case"mobileTextAlign":$={[z]:{classNamePrefix:"em-mob-text_align-",value:P[z]}};break;case"linkHref":let O=ot(P[z]);if(O!==P[z]&&a.setFieldValue("linkHref",O),k==="#"&&O&&!O.startsWith("#")&&(O="#"+O),O.startsWith("mailto:")){const oe=a.getFieldValue("subject"),G=a.getFieldValue("body");$={[z]:Si(O,oe,G)}}else $={[z]:O};Wo(O,b);break;case"subject":case"body":const y=a.getFieldValue("linkHref")||"";if(y.substring(0,7)==="mailto:"){const oe=y.split("?")[0],G=z==="subject"?P[z]:a.getFieldValue("subject"),q=z==="body"?P[z]:a.getFieldValue("body"),te=[];G&&te.push(`subject=${encodeURIComponent(G)}`),q&&te.push(`body=${encodeURIComponent(q)}`),$={linkHref:te.length>0?`${oe}?${te.join("&")}`:oe}}else return;break;default:$=P}s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:$}),j({...e,list:{...e.list,bulletsColor:a.getFieldValue("ColorBullets"),bulletFontFamily:a.getFieldValue("BulletsFontFamily"),bulletFontSize:a.getFieldValue("BulletsSize"),betweenParagraphs:a.getFieldValue("SpacingBetweenParagraphs"),betweenRowCell:a.getFieldValue("SpacingBetweenBulletsAndText"),bulletType:E.find(O=>O.code===a.getFieldValue("BulletType"))?.symbol??E[0].symbol},...$,activateSection:null,changeKey:z})};return(0,o.jsxs)(t.ui_kit$Form,{form:a,layout:"vertical",name:"selected_text_form",autoComplete:"off",onValuesChange:C,className:"element-controls",initialValues:{textAlign:"left",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1,textColor:"",textBackgroundColor:"",textLink:!1,textReplacer:"",textAnchor:"",subject:"",body:"",SpacingBetweenBulletsAndText:0,SpacingBetweenParagraphs:0,BulletsSize:0,ColorBullets:"",BulletTextStrong:!1,BulletTextItalic:!1,CheckboxColor:!1,BulletsFontFamily:"",BulletTextUnderline:!1,BulletTextStrikethrough:!1,BulletType:"",textSuperscript:!1,textSubscript:!1,listOL:!1,listUL:!1},children:[!x&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),!(d==="mobile"&&!x&&c.styles)&&(0,o.jsx)("div",{id:"selected_element_form_desktop_props",style:{paddingRight:0},children:x?(0,o.jsx)(Ri,{form:a,elementSettings:e}):(0,o.jsx)(gt,{form:a,fillFields:A,elementSettings:e,linkProtocol:k,setLinkProtocol:b,isBulletFontColorChecked:h,setIsBulletFontColorChecked:T})}),!x&&(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:d==="mobile"&&c.styles?"block":"none"},children:[(0,o.jsx)(t.ui_kit$Row,{gutter:20,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Dt,{form:a,elementSettings:e,name:"mobileTextAlign"})})}),!!e.showOnMobile&&(0,o.jsx)(gt,{form:a,fillFields:A,elementSettings:e,linkProtocol:k,setLinkProtocol:b}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Mr,{})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileLineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})]})]})]})},yi=(e,i)=>{const{__:l}=r.useI18n();return(0,o.jsx)(t.ui_kit$Tooltip,{title:l("During export, the element is converted into an image."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"exportAsPicture",valuePropName:"checked",className:"form-item-margin-xs",style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$Switch,{id:"convert-in-image",label:l("Convert into an image"),size:"small",labelStyle:{position:"relative",top:2}})})},"exportAsPicture")},Vr={marginBottom:10},Hr={position:"relative",top:2};function pn(e){return Array.isArray(e)?!!e[0]?.value:typeof e=="string"?e.trim()!=="":!!e}var rt=({form:e,showRounding:i=!1,showBackground:l=!1})=>{const{__:s}=r.useI18n(),a=pn(t.ui_kit$Form.useWatch("backgroundImage",e));return(0,o.jsxs)(o.Fragment,{children:[i&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Adds bulletproof VML markup so the button keeps rounded corners in Outlook."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"outlookRounding",valuePropName:"checked",className:"form-item-margin-xs",style:Vr,children:(0,o.jsx)(t.ui_kit$Switch,{id:"outlook-rounding",label:s("Rounded corners in Outlook (VML)"),size:"small",labelStyle:Hr})})},"outlookRounding"),l&&a&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Adds VML markup so the background image is visible in Outlook."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"outlookBackground",valuePropName:"checked",className:"form-item-margin-xs",style:Vr,children:(0,o.jsx)(t.ui_kit$Switch,{id:"outlook-background",label:s("Background image in Outlook (VML)"),size:"small",labelStyle:Hr})})},"outlookBackground")]})};rt.propTypes={form:g.default.object,showRounding:g.default.bool,showBackground:g.default.bool};var Ur=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:a,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:p,backgroundRepeatOptions:f,backgroundSizeOptions:x,sizeShow:k,modificationShow:b,oneBorderRadiusValue:h,setOneBorderRadiusValue:T,toggleShowBorderHandler:_,toggleShowBorderRadiusHandler:E,toggleShowBoxShadowHandler:w,toggleShowSizeHandler:v,toggleShowBackgroundHandler:A,toggleShowModificationHandler:j})=>{const{__:C}=r.useI18n(),P=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(Uo,{form:e,elementSettings:i,tooltipTitle:C("The align attribute sets the horizontal alignment of the table.")})}),(0,o.jsx)(t.ui_kit$FormSection,{title:C("Size"),collapsible:!0,open:k,onToggle:v,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{showHeight:!1,showMinMax:!0,columnsPerRow:2,dimensionSelect:$o,minWidthDimensionSelect:$o,maxWidthDimensionSelect:$o,rowStyle:{marginBottom:4},labels:{width:C("Width"),height:C("Height"),minWidth:C("Minimum width"),maxWidth:C("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:C("Background"),collapsible:!0,open:c,onToggle:A,dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{imageEnabled:P.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:p,usedColors:i.usedColors,colorPlaceholder:C("Background color"),horizontalPositionPlaceholder:C("Horizontal position"),horizontalPositionTooltip:C("Horizontal position"),verticalPositionPlaceholder:C("Vertical position"),verticalPositionTooltip:C("Vertical position"),backgroundRepeatTooltip:C("Background image repeat"),backgroundSizeTooltip:C("Background image size"),selectPlaceholder:C("Please choose"),backgroundRepeatOptions:f,backgroundSizeOptions:x,imageUploadSlot:P.formTableFieldBackgroundImageEnabled?(0,o.jsx)(No,{form:e,label:C("Background image"),name:"backgroundImage",tooltipTitle:C("Background image"),placeholder:C("Background image link/route")}):void 0}),(0,o.jsx)(rt,{form:e,showBackground:!0})]}),P.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("Borders"),collapsible:!0,open:s,onToggle:_,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),P.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("Border radius"),collapsible:!0,open:a,onToggle:E,dividerTop:!0,children:(0,o.jsx)(So,{form:e,oneBorderRadiusValue:h,setOneBorderRadiusValue:T,elementSettings:i})}),P.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("Box shadow"),collapsible:!0,open:d,onToggle:w,dividerTop:!0,children:(0,o.jsx)(jo,{})}),P.formFieldExportAsPictureEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("Export settings"),collapsible:!0,open:b,onToggle:j,dividerTop:!0,children:(0,o.jsx)(yi,{form:e,elementSettings:i})}),P.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})}),P.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};Ur.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,backgroundShow:g.default.bool,backgroundImageEmpty:g.default.bool,backgroundRepeatOptions:g.default.array,backgroundSizeOptions:g.default.array,sizeShow:g.default.bool,modificationShow:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func,toggleShowSizeHandler:g.default.func,toggleShowBackgroundHandler:g.default.func,toggleShowModificationHandler:g.default.func};var Wr=({form:e,elementSettings:i,label:l})=>{const{__:s}=r.useI18n();(0,n.useRef)();const[a,d]=(0,n.useState)(i.mobileBackgroundColor?.value==="none"),{token:c}=(0,t.ui_kit$useToken)(),p=r.useSendPostMessage(),f=k=>{e.setFieldsValue({mobileBackgroundColor:""}),d(b=>!b),p({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:a?"":"none"}}})},x=k=>{d(!1)};return(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)(t.ui_kit$Tooltip,{trigger:["hover"],title:s("Background color"),placement:"left",children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundColor",style:{marginBottom:c.formItemMarginBottomXS/2},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{onChange:x,placeholder:l,usedColors:i.usedColors})}),(0,o.jsx)(t.ui_kit$Switch,{id:"without-background-color",label:s("Without background color"),labelSize:"small",size:"small",checked:a,onChange:f})]})})};Wr.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired};var Vt={horizontal:[{value:"left",label:"left"},{value:"center",label:"center"},{value:"right",label:"right"}],vertical:[{value:"top",label:"top"},{value:"center",label:"center"},{value:"bottom",label:"bottom"}]},wi={mobileBackgroundColor:"em-mob-background_color-",mobileBackgroundImage:"em-mob-background_image-",mobileBackgroundPositionX:"em-mob-background_position_x-",mobileBackgroundPositionY:"em-mob-background_position_y-",mobileBackgroundRepeat:"em-mob-background_repeat-",mobileBackgroundSize:"em-mob-background_size-"},at="none",hn=/^(https?:)?\/\//i,bn=/^(\d*\.?\d+)(%|px)$/;function fn(e){return e in wi}function zr(e){return hn.test(e.trim())}function ji(e,i){const l=wi[e],s=typeof i=="string"?i:"";return e==="mobileBackgroundImage"?s&&s!==at&&!zr(s)?null:{[e]:[{classNamePrefix:l,value:s,type:"url"}]}:e==="mobileBackgroundRepeat"?{[e]:{classNamePrefix:l,value:s||at}}:{[e]:{classNamePrefix:l,value:s}}}function _t(e){const[i]=Object.keys(e??{});return!i||!fn(i)?null:ji(i,e[i])}function gn(){return Object.keys(wi).reduce((e,i)=>({...e,...ji(i,"")}),{})}function Gr(e){const i=(e??"").trim(),l=i.match(bn);return l?{position:l[1],unit:l[2]}:{position:i,unit:"px"}}function Yr(e,i){return e?isNaN(parseFloat(e))?e:e+i:""}function Go(e){const i=e??{},l=i.customTable??i;return{type:i.type,usedColors:i.usedColors,mobileBackgroundColor:l.mobileBackgroundColor,mobileBackgroundImage:l.mobileBackgroundImage,mobileBackgroundPositionX:l.mobileBackgroundPositionX,mobileBackgroundPositionY:l.mobileBackgroundPositionY,mobileBackgroundRepeat:l.mobileBackgroundRepeat,mobileBackgroundSize:l.mobileBackgroundSize}}function xt(e){const i=e??{},l=i.customTable??i,s=l.backgroundSize??"";return{image:l.backgroundImage?.[0]?.value??"",positionX:l.backgroundPositionX??"",positionY:l.backgroundPositionY??"",repeat:l.backgroundRepeat??"",size:s==="auto"?"":s}}function nt(e){const i=Go(e),l=i.mobileBackgroundImage?.[0]?.value??"";return{mobileBackgroundImage:l===at?"":l,mobileBackgroundPositionX:i.mobileBackgroundPositionX?.value??"",mobileBackgroundPositionY:i.mobileBackgroundPositionY?.value??"",mobileBackgroundRepeat:i.mobileBackgroundRepeat?.value||at,mobileBackgroundSize:i.mobileBackgroundSize?.value??""}}function kt(e){const i=Go(e),l=i.mobileBackgroundRepeat?.value;return!!i.mobileBackgroundColor?.value||!!i.mobileBackgroundImage?.[0]?.value||!!i.mobileBackgroundPositionX?.value||!!i.mobileBackgroundPositionY?.value||!!l&&l!==at||!!i.mobileBackgroundSize?.value}function _n(e,i){return e===at?!1:!!e||!!i}function Et(e,i,l){e.setFieldsValue({...nt({}),mobileBackgroundColor:""}),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Go(i).type,settings:gn()})}var xn=/^\d*\.?\d+$/,kn={bottom:"auto"},Xr={marginBottom:0},En=(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal}),Bn=(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical}),Sn=e=>e.closest(".email-pane__collapse-wrapper")??e.parentNode,Kr=({value:e,onChange:i,inheritedValue:l,options:s,placeholder:a,prefix:d})=>{const c=e||l,[p,f]=(0,n.useState)(()=>Gr(c));(0,n.useEffect)(()=>{f(h=>Yr(h.position,h.unit)===c?h:Gr(c))},[c]);const x=(0,n.useCallback)((h,T)=>{f({position:h,unit:T});const _=s.some(E=>E.value===h);(h===""||_||xn.test(h))&&i?.(Yr(h,T))},[i,s]),k=(0,n.useCallback)(h=>x(h,p.unit),[x,p.unit]),b=(0,n.useCallback)(h=>x(p.position,h),[x,p.position]);return(0,o.jsx)(t.ui_kit$InputSelect,{options:s,position:p.position,setPosition:k,unit:p.unit,setUnit:b,placeholder:a,prefix:d,dropdownStyle:kn,tooltipTitle:a,getTooltipPopupContainer:Sn})},Tn=({desktopPositionX:e,desktopPositionY:i})=>{const{__:l}=r.useI18n(),{token:s}=(0,t.ui_kit$useToken)(),a=s.formItemMarginBottomXS,d=(0,n.useMemo)(()=>({marginBottom:a}),[a]);return(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:d,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundPositionX",style:Xr,children:(0,o.jsx)(Kr,{inheritedValue:e,options:Vt.horizontal,placeholder:l("Horizontal position"),prefix:En})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundPositionY",style:Xr,children:(0,o.jsx)(Kr,{inheritedValue:i,options:Vt.vertical,placeholder:l("Vertical position"),prefix:Bn})})})]})},qr=["hover"],Jr=e=>document.querySelector(".email-properties__collapse-panel")??e.parentNode,Qr=({value:e,emptyValue:i,inheritedValue:l,...s})=>{const a=!!e&&e!==i,d=s.options.some(c=>c.value===l)?l:i;return(0,o.jsx)(t.ui_kit$Select,{...s,value:a?e:d})},Rn=({desktopPositionX:e,desktopPositionY:i,desktopRepeat:l,desktopSize:s,backgroundRepeatOptions:a,backgroundSizeOptions:d})=>{const{__:c}=r.useI18n(),{token:p}=(0,t.ui_kit$useToken)(),f=p.formItemMarginBottomXS,x=(0,n.useMemo)(()=>({marginBottom:f}),[f]),k=(0,n.useMemo)(()=>({marginBottom:(f??0)*1.5}),[f]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Tn,{desktopPositionX:e,desktopPositionY:i}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:k,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:qr,title:c("Background image repeat"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundRepeat",style:x,children:(0,o.jsx)(Qr,{emptyValue:"none",inheritedValue:l,options:a,placeholder:c("Please choose"),getPopupContainer:Jr})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:qr,title:c("Background image size"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundSize",style:x,children:(0,o.jsx)(Qr,{emptyValue:"",inheritedValue:s,options:d,placeholder:c("Please choose"),getPopupContainer:Jr})})})})]})]})},yn=ci,wn=({value:e,inheritedImage:i,...l})=>(0,o.jsx)(yn,{...l,value:e||i}),jn=e=>/^https?:\/\//i.test(e.trim()),vn=({form:e,name:i="mobileBackgroundImage",placeholder:l="",disabled:s=!1,elementSettings:a,inheritedImage:d="",isImageNone:c=!1,onImageNoneChange:p})=>{const{__:f}=r.useI18n(),{token:x}=(0,t.ui_kit$useToken)(),k=t.ui_kit$Form.useWatch(i,e),[b,h]=(0,n.useState)(""),T=k||d,_=x.formItemMarginBottomXS??0,E=(0,n.useMemo)(()=>({marginBottom:_/2}),[_]);(0,n.useEffect)(()=>{if(!T){h("");return}h(jn(T)?"validating":"success")},[T]);const w=!!k&&!zr(k),v=w?"error":b;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:i,className:"mobile-background-image-field",validateStatus:v,help:w?f("Enter a URL starting with http:// or https://"):void 0,style:E,children:(0,o.jsx)(wn,{inheritedImage:d,validateStatus:v,placeholder:l,name:i,disabled:s,elementSettings:a,imageInfo:a,onRemotePreviewValidate:h})}),(0,o.jsx)(t.ui_kit$Switch,{label:f("Without image"),labelSize:"small",size:"small",checked:c,onChange:p})]})},In={image:"",positionX:"",positionY:"",repeat:"",size:""},Bt=({elementSettings:e,imageEnabled:i=!1,desktopBackground:l=In})=>{const{__:s}=r.useI18n(),{token:a}=(0,t.ui_kit$useToken)(),d=t.ui_kit$Form.useFormInstance(),c=a.formItemMarginBottomMD,p=r.useSendPostMessage(),f=e.mobileBackgroundImage?.[0]?.value,[x,k]=(0,n.useState)(f==="none"),b=t.ui_kit$Form.useWatch("mobileBackgroundImage",d);(0,n.useEffect)(()=>{k(f==="none")},[f]),(0,n.useEffect)(()=>{b&&k(!1)},[b]);const h=(0,n.useCallback)(C=>{k(C),d.setFieldsValue({mobileBackgroundImage:""}),p({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:ji("mobileBackgroundImage",C?"none":"")})},[e.type,d,p]),T=(0,n.useMemo)(()=>[{label:s("Not defined"),value:"none"},{label:s("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:s("Repeat background (repeat)"),value:"repeat"},{label:s("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:s("Repeat background vertically (repeat-y)"),value:"repeat-y"}],[s]),_=(0,n.useMemo)(()=>[{label:s("Not defined"),value:""},{label:s("Contain"),value:"contain"},{label:s("Cover"),value:"cover"}],[s]),E=_n(x?"none":b,l.image),w=(0,n.useMemo)(()=>({marginBottom:E?c:0}),[c,E]),v=(0,n.useMemo)(()=>(0,o.jsx)("div",{style:w,children:(0,o.jsx)(Wr,{form:d,elementSettings:e,label:s("Background color")})}),[s,e,d,w]),A=(0,n.useMemo)(()=>(0,o.jsx)("div",{style:w,children:(0,o.jsx)(vn,{form:d,placeholder:s("Background image"),elementSettings:e,inheritedImage:x?"":l.image,isImageNone:x,onImageNoneChange:h})}),[s,l.image,e,d,h,x,w]),j=(0,n.useMemo)(()=>(0,o.jsx)(Rn,{desktopPositionX:l.positionX,desktopPositionY:l.positionY,desktopRepeat:l.repeat,desktopSize:l.size,backgroundRepeatOptions:T,backgroundSizeOptions:_}),[T,_,l.positionX,l.positionY,l.repeat,l.size]);return(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{colorFieldName:"mobileBackgroundColor",colorSlot:v,imageEnabled:i,backgroundImageEmpty:!E,imageUploadSlot:A,imageControlsSlot:j,usedColors:e.usedColors})},Zr=({form:e,elementSettings:i,mobileBoxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:a,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:p,oneMobileBorderRadiusValue:f,setOneMobileBorderRadiusValue:x,toggleShowMobileBorderHandler:k,toggleShowMobileBorderRadiusHandler:b,toggleShowMobileBoxShadowHandler:h,toggleShowMobileSizeHandler:T,toggleShowMobileBackgroundHandler:_})=>{const{__:E}=r.useI18n(),{token:w}=(0,t.ui_kit$useToken)(),v=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(Uo,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,o.jsx)(t.ui_kit$FormSection,{title:E("Size"),collapsible:!0,open:c,onToggle:T,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:E("Table width"),placement:"left",children:(0,o.jsx)("div",{style:{marginBottom:w.formItemMarginBottomMD+4},children:(0,o.jsx)(zo,{form:e,name:"mobileWidth",elementSettings:i})})})})})}),(0,o.jsx)(t.ui_kit$FormSection,{title:E("Background"),collapsible:!0,open:p,onToggle:_,dividerTop:!0,children:(0,o.jsx)(Bt,{elementSettings:Go(i),imageEnabled:v.formTableFieldBackgroundImageEnabled,desktopBackground:xt(i)})}),v.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Borders"),collapsible:!0,open:s,onToggle:k,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),v.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Border radius"),collapsible:!0,open:a,onToggle:b,dividerTop:!0,children:(0,o.jsx)(So,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:f,setOneBorderRadiusValue:x,elementSettings:i})}),v.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Box shadow"),collapsible:!0,open:d,onToggle:h,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile",form:e,elementSettings:i})}),v.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})}),v.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};Zr.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,mobileBoxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func,toggleShowMobileBackgroundHandler:g.default.func};var el=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),a=Fo(),d=Fo(),c=r.useDispatch(),p=r.useElementEntityKind(),[f,x]=(0,n.useState)({}),[k,b]=(0,n.useState)(!0),[h,T]=(0,n.useState)({}),[_,E]=(0,n.useState)(!0),w=r.useSelector(r.selectEmailViewType),v=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[A,j]=(0,n.useState)(e.backgroundImage[0].value===""),C=r.useSelector(r.selectIsCodeMode),P=r.useSelector(r.selectCodeModeDirection),Y=C&&P!=="bottom",[z,$]=(0,n.useState)(!1),[O,y]=(0,n.useState)(!1),[oe,G]=(0,n.useState)(!1),[q,te]=(0,n.useState)(!1),[ue,me]=(0,n.useState)(!1),[se,_e]=(0,n.useState)(!1),[ve,de]=(0,n.useState)(!1),[De,ye]=(0,n.useState)(!1),[re,ke]=(0,n.useState)(!1),[ae,Q]=(0,n.useState)(!1),[he,pe]=(0,n.useState)(!1),ee=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],J=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}],H=I=>I&&(I?.width||I?.style||I?.color)?I:"",X=e.border,ce=e.mobileBorder,xe=Object.keys(X).find(I=>X[I]?.width||X[I]?.style||X[I]?.color),ne=Object.keys(ce).find(I=>ce[I]?.width||ce[I]?.style||ce[I]?.color),{remember:Ae,fillFields:we}=st(e);(0,n.useEffect)(()=>{if(e){const I=e.boxShadow,Z=e.mobileBoxShadow;x(I),T(Z),we(s,{...e,width:e.width?.value,widthDim:e.width?.dim,maxWidth:e.maxWidth?.value,maxWidthDim:e.maxWidth?.dim,minWidth:e.minWidth?.value,minWidthDim:e.minWidth?.dim,backgroundImage:e.backgroundImage[0].value,show:e.show?e.show:"all",borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),borderRadiusAll:u(e.borderRadius.all),borderRadiusTopLeft:u(e.borderRadius.topLeft),borderRadiusBottomLeft:u(e.borderRadius.bottomLeft),borderRadiusTopRight:u(e.borderRadius.topRight),borderRadiusBottomRight:u(e.borderRadius.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:po(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileAlign:e.mobileAlign?.value,mobileBorderAll:H(e.mobileBorder.all)||!(H(e.mobileBorder.top)||H(e.mobileBorder.bottom)||H(e.mobileBorder.right)||H(e.mobileBorder.left))&&H(e.border.all),mobileBorderTop:H(e.mobileBorder.top)||!H(e.mobileBorder.all)&&H(e.border.top),mobileBorderBottom:H(e.mobileBorder.bottom)||!H(e.mobileBorder.all)&&H(e.border.bottom),mobileBorderRight:H(e.mobileBorder.right)||!H(e.mobileBorder.all)&&H(e.border.right),mobileBorderLeft:H(e.mobileBorder.left)||!H(e.mobileBorder.all)&&H(e.border.left),mobileBorderRadiusAll:u(e.mobileBorderRadius.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius.topLeft!==null?e.mobileBorderRadius.topLeft:e.mobileBorderRadius.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius.bottomLeft!==null?e.mobileBorderRadius.bottomLeft:e.mobileBorderRadius.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius.topRight!==null?e.mobileBorderRadius.topRight:e.mobileBorderRadius.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius.bottomRight!==null?e.mobileBorderRadius.bottomRight:e.mobileBorderRadius.all),mobileBoxShadowInset:u(e.mobileBoxShadow?.inset)||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color),mobileBackgroundColor:u(e.mobileBackgroundColor?.value!=="none"?e.mobileBackgroundColor?.value:""),...nt(e),exportAsPicture:e?.exportAsPicture}),!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?b(!1):b(!0),u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight)?E(!1):E(!0),j(e.backgroundImage[0].value==="");const Be=a.isStaleBorderSnapshot(e,!!xe),Ce=d.isStaleBorderSnapshot(e,!!ne);Be&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Ce||Be&&!ne)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),$(Me=>xe&&!Be?!0:Me),y(Me=>xe&&!Be||ne&&!Ce?!0:Me),G(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),te(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),me(!!e.boxShadow),_e(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),de(!!e.width?.value||!!e.minWidth?.value||!!e.maxWidth?.value),ye(!!e.mobileWidth.value),ke(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Q(kt(e)),pe(!!e.exportAsPicture)}},[s,e,xe,ne,a,d,we]);const $e=(0,n.useCallback)(I=>{Ae(I),c(p==="email"?r.setElementSettings$1(I):r.setElementSettings(I))},[c,p,Ae]),K=I=>{const Z=s.getFieldsValue(!0),Be=Object.keys(I)[0];let Ce;switch(Be){case"exportAsPicture":Ce={exportAsPicture:Z.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Ce={boxShadow:{hOffset:Z.boxShadowHOffset,vOffset:Z.boxShadowVOffset,blurRadius:Z.boxShadowBlurRadius,spreadRadius:Z.boxShadowSpreadRadius,color:Z.boxShadowColor,inset:Z.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":Z.borderPosition==="borderAll"?(Ce={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...Z.borderAll}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):Z.borderAll?.width||Z.borderAll?.style||Z.borderAll?.color?(Ce={border:{all:null,left:Z.borderAll,right:Z.borderAll,top:Z.borderAll,bottom:Z.borderAll,[W.REVERSE_BORDER_POSITIONS[Be]]:{...Z[Be],...I[Be]}}},s.setFieldsValue({borderAll:null,borderLeft:Z.borderAll,borderRight:Z.borderAll,borderTop:Z.borderAll,borderBottom:Z.borderAll,[Be]:{...Z[Be],...I[Be]}})):(Ce={border:{all:null,left:Z.borderLeft,right:Z.borderRight,top:Z.borderTop,bottom:Z.borderBottom,[W.REVERSE_BORDER_POSITIONS[Be]]:{...Z[Be],...I[Be]}}},s.setFieldsValue({border:Ce.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(Z.mobileBorderPosition==="mobileBorderAll")Ce={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...Z.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[Be]+"-"}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const Me=W.MOBILE_REVERSE_BORDER_POSITIONS[Be],Ge={...Z[Be],...I[Be]},Ye=!Ge?.width&&!Ge?.style&&!Ge?.color;if(Z.mobileBorder?.all?.width||Z.mobileBorder?.all?.style||Z.mobileBorder?.all?.color){const D=Z.mobileBorderAll;Ce={mobileBorder:{all:null,left:D,right:D,top:D,bottom:D,[Me]:Ye?null:{...Ge,classNamePrefix:"em-mob-border_"+Me+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:D,mobileBorderRight:D,mobileBorderTop:D,mobileBorderBottom:D,[Be]:Ge})}else{const D=e.mobileBorder||{},L=R=>{const F=D[R];return F&&(F?.width||F?.style||F?.color)?F:null};Ce={mobileBorder:{all:null,left:Me==="left"?Ye?null:{...Ge,classNamePrefix:"em-mob-border_left-"}:L("left"),right:Me==="right"?Ye?null:{...Ge,classNamePrefix:"em-mob-border_right-"}:L("right"),top:Me==="top"?Ye?null:{...Ge,classNamePrefix:"em-mob-border_top-"}:L("top"),bottom:Me==="bottom"?Ye?null:{...Ge,classNamePrefix:"em-mob-border_bottom-"}:L("bottom")}},s.setFieldsValue({[Be]:Ge})}}break;case"width":Ce={[Be]:{value:I[Be],dim:Z.widthDim}};break;case"widthDim":Ce={width:{value:Z.width,dim:I[Be]}};break;case"maxWidth":Ce={[Be]:{value:I[Be],dim:Z.maxWidthDim}};break;case"maxWidthDim":Ce={maxWidth:{value:Z.maxWidth,dim:I[Be]}};break;case"minWidth":Ce={[Be]:{value:I[Be],dim:Z.minWidthDim}};break;case"minWidthDim":Ce={minWidth:{value:Z.minWidth,dim:I[Be]}};break;case"backgroundImage":j(I[Be]===""),Ce={[Be]:[{...e.backgroundImage[0],value:I[Be]}],backgroundSize:"cover"};break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Ce={borderRadius:{[W.BORDER_RADIUS_POSITION[Be]]:+I[Be]}};break;case"mobileWidth":Ce={[Be]:{classNamePrefix:"em-mob-width-",value:I[Be],dim:Z.mobileWidthDim}};break;case"mobileWidthDim":Ce={mobileWidth:{classNamePrefix:"em-mob-width-",value:Z.mobileWidth||100,dim:I[Be]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Ce={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[Be]]:I[Be],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[Be]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Ce={mobileBoxShadow:{hOffset:Z.mobileBoxShadowHOffset,vOffset:Z.mobileBoxShadowVOffset,blurRadius:Z.mobileBoxShadowBlurRadius,spreadRadius:Z.mobileBoxShadowSpreadRadius,color:Z.mobileBoxShadowColor,inset:Z.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Ce=_t(I),!Ce)return;break;case"mobileAlign":Ce={[Be]:{classNamePrefix:"em-mob-table_align-",value:I[Be]}};break;default:Ce=I}Be!=="borderPosition"&&Be!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ce}),Be!=="mobileBorderRadiusAll"&&Be!=="mobileBorderRadiusTopLeft"&&Be!=="mobileBorderRadiusTopRight"&&Be!=="mobileBorderRadiusBottomLeft"&&Be!=="mobileBorderRadiusBottomRight"&&$e({...e,...Ce,mobileBorderRadius:{...e.mobileBorderRadius,...Ce?.mobileBorderRadius},activateSection:null,changeKey:Be}))},ie=()=>{const I=s.getFieldsValue(!0);a.markBorderToggled(!z),setTimeout(()=>{$(Z=>!Z),z?(I.borderAll=W.NULL_BORDER,I.borderTop=W.NULL_BORDER,I.borderBottom=W.NULL_BORDER,I.borderRight=W.NULL_BORDER,I.borderLeft=W.NULL_BORDER):I.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:I.borderAll.color,style:I.borderAll.style,width:I.borderAll.width}}}})})},je=()=>{const I=s.getFieldsValue(!0);d.markBorderToggled(!O),setTimeout(()=>{y(Z=>!Z),O?(I.mobileBorderAll=W.NULL_BORDER,I.mobileBorderTop=W.NULL_BORDER,I.mobileBorderBottom=W.NULL_BORDER,I.mobileBorderRight=W.NULL_BORDER,I.mobileBorderLeft=W.NULL_BORDER):I.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:I.mobileBorderAll.color,style:I.mobileBorderAll.style,width:I.mobileBorderAll.width}}}})})},V=()=>{const I=s.getFieldsValue(!0);setTimeout(()=>{G(Z=>!Z),oe?(I.borderRadiusAll=0,b(!0)):I.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:I.borderRadiusAll}}})})},Se=()=>{const I=s.getFieldsValue(!0);setTimeout(()=>{te(Z=>!Z),q?(I.mobileBorderRadiusAll=null,E(!0)):I.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:I.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},Ie=()=>{const I=s.getFieldsValue(!0);setTimeout(()=>{me(Z=>!Z),ue?(I.boxShadowInset=!1,I.boxShadowHOffset=null,I.boxShadowVOffset=null,I.boxShadowBlurRadius=null,I.boxShadowSpreadRadius=null,I.boxShadowColor=""):(I.boxShadowInset=!1,I.boxShadowHOffset=5,I.boxShadowVOffset=5,I.boxShadowBlurRadius=10,I.boxShadowSpreadRadius=-5,I.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:I.boxShadowBlurRadius,color:I.boxShadowColor,hOffset:I.boxShadowHOffset,inset:I.boxShadowInset,spreadRadius:I.boxShadowSpreadRadius,vOffset:I.boxShadowVOffset}}})})},Ne=()=>{const I=s.getFieldsValue(!0);setTimeout(()=>{_e(Z=>!Z),se?(I.mobileBoxShadowInset=!1,I.mobileBoxShadowHOffset=null,I.mobileBoxShadowVOffset=null,I.mobileBoxShadowBlurRadius=null,I.mobileBoxShadowSpreadRadius=null,I.mobileBoxShadowColor=""):(I.mobileBoxShadowInset=!1,I.mobileBoxShadowHOffset=5,I.mobileBoxShadowVOffset=5,I.mobileBoxShadowBlurRadius=10,I.mobileBoxShadowSpreadRadius=-5,I.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:I.mobileBoxShadowBlurRadius,color:I.mobileBoxShadowColor,hOffset:I.mobileBoxShadowHOffset,inset:I.mobileBoxShadowInset,spreadRadius:I.mobileBoxShadowSpreadRadius,vOffset:I.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Fe=()=>{const I=s.getFieldsValue(!0);setTimeout(()=>{de(Z=>!Z),ve&&(I.width="",I.minWidth="",I.maxWidth="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{width:{value:null,dim:"px"},minWidth:{value:null,dim:"px"},maxWidth:{value:null,dim:"px"}}}))})},Ve=()=>{const I=s.getFieldsValue(!0);setTimeout(()=>{ye(Z=>!Z),De&&(I.mobileWidth="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"}}}))})},Ue=()=>{const I=s.getFieldsValue(!0);setTimeout(()=>{ke(Z=>!Z),re?(I.backgroundColor="",I.backgroundImage="",I.backgroundPositionX="",I.backgroundPositionY="",I.backgroundRepeat="none",I.backgroundSize="",j(!0)):(I.backgroundColor="#E5E5E5",I.backgroundSize="",I.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:I.backgroundColor,backgroundImage:[{type:"url",value:I.backgroundImage}],backgroundPositionX:I.backgroundPositionX,backgroundPositionY:I.backgroundPositionY,backgroundRepeat:I.backgroundRepeat,backgroundSize:I.backgroundSize}})})},le=()=>{const I=s.getFieldsValue(!0);setTimeout(()=>{Q(Z=>!Z),ae?I.mobileBackgroundColor="":I.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:I.mobileBackgroundColor}}}),ae&&Et(s,e,l)})},Te=()=>{const I=s.getFieldsValue(!0);setTimeout(()=>{pe(Z=>!Z),he&&(I.exportAsPicture=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_table_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,show:"all",width:{value:"",dim:""},maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",mobileAlign:"",border:"",boxShadow:"",borderPosition:W.BORDER_POSITIONS[xe]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[ne]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileBackgroundColor:"",mobileBackgroundImage:""},onValuesChange:K,autoComplete:"off",className:"element-controls",children:[!Y&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),w==="mobile"&&v.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(Zr,{form:s,elementSettings:e,mobileBoxShadow:h,mobileBordersShow:O,mobileBorderRadiusShow:q,mobileBoxShadowShow:se,mobileSizeShow:De,mobileBackgroundShow:ae,oneMobileBorderRadiusValue:_,setOneMobileBorderRadiusValue:E,toggleShowMobileBorderHandler:je,toggleShowMobileBorderRadiusHandler:Se,toggleShowMobileBoxShadowHandler:Ne,toggleShowMobileSizeHandler:Ve,toggleShowMobileBackgroundHandler:le})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Ur,{form:s,elementSettings:e,boxShadow:f,bordersShow:z,borderRadiusShow:oe,boxShadowShow:ue,backgroundShow:re,backgroundImageEmpty:A,backgroundRepeatOptions:ee,backgroundSizeOptions:J,sizeShow:ve,modificationShow:he,oneBorderRadiusValue:k,setOneBorderRadiusValue:b,toggleShowBorderHandler:ie,toggleShowBorderRadiusHandler:V,toggleShowBoxShadowHandler:Ie,toggleShowSizeHandler:Fe,toggleShowBackgroundHandler:Ue,toggleShowModificationHandler:Te})})]})};el.propTypes={elementSettings:g.default.object.isRequired};var ol=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),a=r.useAppConfig(),d=r.useSelector(r.selectIsCodeMode),c=r.useSelector(r.selectCodeModeDirection),[p,f]=(0,n.useState)({}),[x,k]=(0,n.useState)("https://"),b=({target:_})=>{const{selectionStart:E,selectionEnd:w}=_;_&&f({target:_,selection:{start:E,end:w}})};(0,n.useEffect)(()=>{if(e){let _="",E="",w=e.href==null?"https://":e.href;if(w&&w.substring(0,7)==="mailto:"){const v=new URL(e.href);_=v.searchParams.get("subject")||"",E=v.searchParams.get("body")||"",w=e.href.split("?")[0],k("mailto:")}else e.href&&(e.href.substring(0,8)==="https://"||e.href.substring(0,7)==="http://"?k("https://"):e.href.substring(0,4)==="tel:"?k("tel:"):e.href.substring(0,4)==="sms:"?k("sms:"):e.href.substring(0,6)==="ftp://"?k("ftp://"):k(""));s.setFieldsValue({...e,href:w,subject:_,body:E})}},[s,e]);const h=_=>{const E=Object.keys(_)[0];let w=_;if(E==="href"){const v=ot(_[E]);if(v!==_[E]&&s.setFieldValue("href",v),v.substring(0,7)==="mailto:"){const A=s.getFieldValue("subject"),j=s.getFieldValue("body"),C=[];A&&C.push(`subject=${encodeURIComponent(A)}`),j&&C.push(`body=${encodeURIComponent(j)}`),w={href:C.length>0?`${v}?${C.join("&")}`:v}}else w={href:v}}if(E==="subject"||E==="body"){const v=s.getFieldValue("href")||"";if(v.substring(0,7)==="mailto:"){const A=v.split("?")[0],j=E==="subject"?_[E]:s.getFieldValue("subject"),C=E==="body"?_[E]:s.getFieldValue("body"),P=[];j&&P.push(`subject=${encodeURIComponent(j)}`),C&&P.push(`body=${encodeURIComponent(C)}`),w={href:P.length>0?`${A}?${P.join("&")}`:A}}else return}l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:w})},T=_=>{l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:_})};return(0,o.jsx)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_link_form",initialValues:{href:"https://",target:"",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1,textReplacer:"",subject:"",body:""},onValuesChange:h,autoComplete:"off",className:"element-controls",children:!d||c==="bottom"?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Hyperlink URL"),placement:"left",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:24,paddingRight:10},children:(0,o.jsx)(t.ui_kit$Input,{allowClear:!0,placeholder:i("Hyperlink URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined}),onSelect:b})})}),a.formLinkFieldInsertImageEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:i("Actions with the chosen text"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$Form.Item,{children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"PicLeftOutlined",component:t.icons$PicLeftOutlined}),onClick:()=>T("add_img"),children:i("Add inline image")})})}),(0,o.jsx)(gt,{form:s,elementSettings:e,showAddParagraph:!1,linkTarget:p,linkProtocol:x,setLinkProtocol:k})]}):(0,o.jsx)(Ri,{form:s,elementSettings:e,showAddParagraph:!1})})};ol.propTypes={elementSettings:g.default.object.isRequired};var tl=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:14,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"height",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:e("Indent height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})})};tl.propTypes={};var il=({form:e,elementSettings:i})=>(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{marginBottom:20},children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(tt,{form:e,name:"mobileHeight",elementSettings:i})})});il.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired};var rl=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm(),s=r.useDispatch(),a=r.useSendPostMessage(),d=r.useSelector(r.selectEmailViewType),c=r.useSelector(r.selectMobileViewActive),p=r.useSelector(r.selectIsCodeMode),f=r.useSelector(r.selectCodeModeDirection),x=p&&f!=="bottom",k=r.useElementEntityKind(),{remember:b,fillFields:h}=st(e);(0,n.useEffect)(()=>{e&&h(l,{...e,height:e.height?.value,heightDim:e.height?.dim,mobileHeight:po(e.mobileHeight?.value||e.height?.value),mobileHeightDim:e.mobileHeight?.dim||e.height?.dim})},[l,e,h]);const T=(0,n.useCallback)(E=>{b(E),s(k==="email"?r.setElementSettings$1(E):r.setElementSettings(E))},[s,k,b]),_=E=>{const w=l.getFieldsValue(!0),v=Object.keys(E)[0];let A;switch(v){case"height":A={[v]:{value:E[v],dim:w.heightDim}};break;case"heightDim":A={height:{value:w.height,dim:E[v]}};break;case"mobileHeight":A={[v]:{classNamePrefix:"em-mob-height-",value:E[v],dim:w.mobileHeightDim}};break;case"mobileHeightDim":A={mobileHeight:{classNamePrefix:"em-mob-height-",value:w.mobileHeight,dim:E[v]}};break;default:A=E}a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:A}),T({...e,...A,activateSection:null,changeKey:v})};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_vindent_form",initialValues:{height:"",heightDim:"",mobileHeight:"",mobileHeightDim:""},onValuesChange:_,autoComplete:"off",children:[!x&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),d==="mobile"&&c.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:d==="mobile"&&c.styles?"block":"none",marginBottom:10},children:(0,o.jsx)(il,{form:l,elementSettings:e})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",style:{display:d==="mobile"&&c.styles?"none":"block"},children:(0,o.jsx)(tl,{})})]})};rl.propTypes={elementSettings:g.default.object.isRequired};var Ht=({form:e,elementSettings:i,typeOfForm:l="desktop"})=>{const s=r.useSendPostMessage(),a=l==="mobile",d=a?"mobileDirection":"direction",c=f=>{e.setFieldsValue({[d]:f}),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[d]:f}})},p=a?i.mobileDirection?.value??"":i.direction??"";return(0,o.jsx)(t.ui_kit$Form.Item,{name:d,className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$FormDirectionControl,{value:p,onChange:c})})},Ut=e=>e.closest(".email-pane__collapse-wrapper")||e.parentNode,vi=({form:e,backgroundImageEmpty:i,appConfig:l,token:s,elementSettings:a,backgroundRepeatOptions:d,handleChangeValues:c})=>{const{__:p}=r.useI18n(),[f,x]=(0,n.useState)(""),[k,b]=(0,n.useState)("px"),[h,T]=(0,n.useState)(""),[_,E]=(0,n.useState)("px"),w=[{label:p("Not defined"),value:""},{label:p("Contain"),value:"contain"},{label:p("Cover"),value:"cover"}],v=C=>{if(!C||typeof C!="string")return{value:"",unit:"px"};C=C.trim();const P=C.match(/^(\d*\.?\d+)(%|px)$/);return P?{value:P[1],unit:P[2]}:{value:C,unit:"px"}};(0,n.useEffect)(()=>{const C=e.getFieldValue("backgroundPositionX"),P=e.getFieldValue("backgroundPositionY"),Y=v(C),z=v(P);x(String(Y.value)),b(Y.unit),T(String(z.value)),E(z.unit)},[e]);const A=(C,P)=>{x(String(C)),b(P),c&&c({backgroundPositionX:{position:C,unit:P}})},j=(C,P)=>{T(String(C)),E(P),c&&c({backgroundPositionY:{position:C,unit:P}})};return(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:8},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:p("Background color"),placement:"bottom",getPopupContainer:Ut,children:(0,o.jsx)("div",{children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"backgroundColor",style:{marginBottom:s.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:p("Background color"),usedColors:a.usedColors,placement:"bottomLeft"})})})})}),l.formCellFieldBackgroundImageEnabled&&(0,o.jsxs)(t.ui_kit$Col,{span:i?12:24,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:p("Background image"),placement:"bottom",getPopupContainer:Ut,children:(0,o.jsx)("div",{children:(0,o.jsx)(No,{form:e,label:p("Background image"),name:"backgroundImage",tooltipTitle:p("Background image"),placeholder:p("Background image link/route")})})}),!i&&(0,o.jsxs)(t.ui_kit$Form.Item,{style:{marginBottom:"0"},children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:s.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$InputSelect,{options:Vt.horizontal,position:f,setPosition:C=>A(C,k),unit:k,setUnit:C=>A(f,C),placeholder:p("Horizontal position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal}),dropdownStyle:{bottom:"auto"},tooltipTitle:p("Horizontal position"),getTooltipPopupContainer:Ut})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$InputSelect,{options:Vt.vertical,position:h,setPosition:C=>j(C,_),unit:_,setUnit:C=>j(h,C),placeholder:p("Vertical position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical}),dropdownStyle:{bottom:"auto"},tooltipTitle:p("Vertical position"),getTooltipPopupContainer:Ut})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:p("Background image repeat"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"backgroundRepeat",style:{marginBottom:s.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{placeholder:p("Please choose"),options:d,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:p("Background image size"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"backgroundSize",style:{marginBottom:s.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{placeholder:p("Please choose"),options:w,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})})]})]})]})]})},Cn=({form:e,elementSettings:i,__:l,appConfig:s})=>{const a=W.useGoogleFontsLoader(),[d,c]=(0,n.useState)(null);return(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&c(!0)},[]),(0,o.jsxs)("div",{style:{marginBottom:"-15px"},children:[s.formTextFieldTypografEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Text font"),placement:"bottom",zIndex:1,getPopupContainer:p=>p.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:a,getPopupContainer:p=>p.closest(".email-pane__collapse-wrapper")})})}),!i.showOnMobile&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:l("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:l("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:l(d?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:l(d?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:l(d?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:l(d?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Text color"),placement:"bottom",zIndex:2,getPopupContainer:p=>p.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:l("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l("Color"),usedColors:i.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Text background"),placement:"bottom",zIndex:2,getPopupContainer:p=>p.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:l("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l("Background color"),usedColors:i.usedColors})})})})]})]})},ll=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:a,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:p,backgroundRepeatOptions:f,sizeShow:x,maxWidthValue:k,modificationShow:b,paddingsExt:h,oneBorderRadiusValue:T,setOneBorderRadiusValue:_,elementListShow:E,togglePaddingHandler:w,toggleShowBorderHandler:v,toggleShowBorderRadiusHandler:A,toggleShowBoxShadowHandler:j,toggleShowSizeHandler:C,toggleShowBackgroundHandler:P,toggleShowModificationHandler:Y,handleChangeValues:z})=>{const{__:$}=r.useI18n(),{token:O}=(0,t.ui_kit$useToken)(),y=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(it,{form:e,elementSettings:i})}),y.formCellFieldVerticalAlignEnabled&&i.type!=="group"&&(i.type!=="structure"||i.type==="structure"&&i.floatBlocks.items.length===1)&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Mo,{form:e,elementSettings:i})})]}),y.formCellFieldPaddingsEnabled&&(0,o.jsxs)(o.Fragment,{children:[E&&(0,o.jsx)("div",{style:{marginTop:"15px"},children:(0,o.jsx)(Cn,{form:e,elementSettings:i,appConfig:y,__:$})}),(0,o.jsx)(t.ui_kit$FormSection,{title:$("Padding"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:h,onToggleExtended:w,showHorizontal:i.type!=="group"&&i.type!=="column",rowStyle:{paddingBottom:4},labels:{horizontal:$("Horizontal padding"),vertical:$("Vertical padding"),left:$("Left padding"),right:$("Right padding"),top:$("Top padding"),bottom:$("Bottom padding"),individual:$("Individual padding")}})})]}),i.type!=="group"&&y.formCellFieldSizeEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Size"),collapsible:!0,open:x,onToggle:C,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{showWidth:i.type!=="structure"&&i.type!=="column",maxWidth:k,dimensionSelect:$o,rowStyle:{paddingBottom:4},labels:{width:$("Width"),height:$("Height"),minWidth:$("Minimum width"),maxWidth:$("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:$("Background"),collapsible:!0,open:c,onToggle:P,dividerTop:!0,children:[(0,o.jsx)(vi,{form:e,backgroundImageEmpty:p,appConfig:y,token:O,elementSettings:i,backgroundRepeatOptions:f,handleChangeValues:z}),(0,o.jsx)(rt,{form:e,showBackground:!0})]}),y.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Borders"),collapsible:!0,open:s,onToggle:v,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),y.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Border radius"),collapsible:!0,open:a,onToggle:A,dividerTop:!0,children:(0,o.jsx)(So,{form:e,oneBorderRadiusValue:T,setOneBorderRadiusValue:_,elementSettings:i})}),y.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Box shadow"),collapsible:!0,open:d,onToggle:j,dividerTop:!0,children:(0,o.jsx)(jo,{})}),y.formFieldExportAsPictureEnabled&&i.type!=="group"&&(0,o.jsxs)(t.ui_kit$FormSection,{title:$("Settings"),collapsible:!0,open:b,onToggle:Y,dividerTop:!0,children:[i.type==="structure"&&(0,o.jsx)(t.ui_kit$Tooltip,{title:$("The block will change its colors to contrasting colors. You can change them in the Content Styles section."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"isContrastBlock",valuePropName:"checked",style:{marginBottom:0},children:(0,o.jsx)(t.ui_kit$Switch,{id:"contrast-colors",label:$("Contrast block"),size:"small",labelStyle:{position:"relative",top:2}})})},"isContrastBlock"),(0,o.jsx)(yi,{form:e,elementSettings:i})]}),y.formFieldVisibilityEnabled&&i.type!=="column"&&(0,o.jsx)(t.ui_kit$FormSection,{title:$(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,o.jsx)(Ht,{elementSettings:i,form:e}):void 0})}),y.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};ll.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,backgroundShow:g.default.bool,backgroundImageEmpty:g.default.bool,backgroundRepeatOptions:g.default.array,sizeShow:g.default.bool,maxWidthValue:g.default.oneOfType([g.default.string,g.default.number]),modificationShow:g.default.bool,paddingsExt:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,elementListShow:g.default.bool,togglePaddingHandler:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func,toggleShowSizeHandler:g.default.func,toggleShowBackgroundHandler:g.default.func,toggleShowModificationHandler:g.default.func,handleChangeValues:g.default.func};var Wt=({form:e,elementSettings:i,mobilePaddingsExt:l,setMobilePaddingsExt:s,rowStyle:a})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),p=()=>{s(x=>!x);const f=e.getFieldsValue(!0);l||(f.mobilePaddingLeftRight=f.mobilePaddingLeft,f.mobilePaddingTopBottom=f.mobilePaddingTop,f.mobilePaddingRight=f.mobilePaddingLeft,f.mobilePaddingBottom=f.mobilePaddingTop,c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobilePadding:{top:f.mobilePaddingTop!==""?f.mobilePaddingTop:null,bottom:f.mobilePaddingTopBottom!==""?f.mobilePaddingTopBottom:null,left:f.mobilePaddingLeft!==""?f.mobilePaddingLeft:null,right:f.mobilePaddingRight!==""?f.mobilePaddingRight:null,classNamePrefix:"em-mob-padding_"}}}))};return(0,o.jsx)(t.ui_kit$FormPaddingInputs,{typeOfForm:"mobile",extended:l,onToggleExtended:p,showHorizontal:!0,gutter:10,rowStyle:a,labels:{horizontal:d("Horizontal padding"),vertical:d("Vertical padding"),left:d("Left padding"),right:d("Right padding"),top:d("Top padding"),bottom:d("Bottom padding"),individual:d("Individual padding")}})};Wt.propTypes={form:g.default.shape({getFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,mobilePaddingsExt:g.default.bool.isRequired,setMobilePaddingsExt:g.default.func.isRequired,rowStyle:g.default.object};var sl=({form:e,elementSettings:i,boxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:a,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:p,mobilePaddingShow:f,mobilePaddingsExt:x,setMobilePaddingsExt:k,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:h,toggleShowMobileBorderHandler:T,toggleShowMobileBorderRadiusHandler:_,toggleShowMobileBoxShadowHandler:E,toggleShowMobileSizeHandler:w,toggleShowMobileBackgroundHandler:v,toggleShowMobilePaddingHandler:A})=>{const{__:j}=r.useI18n(),C=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Uo,{form:e,elementSettings:i,imgParent:!0,typeOfForm:"mobile"})}),C.formCellFieldVerticalAlignEnabled&&i.type!=="group"&&(i.type!=="structure"||i.type==="structure"&&i.floatBlocks.items.length===1)&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Mo,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),C.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Padding"),collapsible:!0,open:f,onToggle:A,dividerTop:!0,children:(0,o.jsx)(Wt,{form:e,elementSettings:i,mobilePaddingsExt:x,setMobilePaddingsExt:k,rowStyle:{paddingBottom:4}})}),i.type!=="group"&&C.formCellFieldSizeEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Size"),collapsible:!0,open:c,onToggle:w,dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:9},children:[i.type!=="structure"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:15},children:(0,o.jsx)(zo,{form:e,name:"mobileWidth",elementSettings:i})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:15},children:(0,o.jsx)(tt,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:j("Background"),collapsible:!0,open:p,onToggle:v,dividerTop:!0,children:(0,o.jsx)(Bt,{elementSettings:Go(i),imageEnabled:C.formCellFieldBackgroundImageEnabled,desktopBackground:xt(i)})}),C.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Borders"),collapsible:!0,open:s,onToggle:T,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),C.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Border radius"),collapsible:!0,open:a,onToggle:_,dividerTop:!0,children:(0,o.jsx)(So,{form:e,oneBorderRadiusValue:b,setOneBorderRadiusValue:h,elementSettings:i,typeOfForm:"mobile"})}),C.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Box shadow"),collapsible:!0,open:d,onToggle:E,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile"})}),C.formFieldVisibilityEnabled&&i.type!=="column"&&(0,o.jsx)(t.ui_kit$FormSection,{title:j(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,o.jsx)(Ht,{elementSettings:i,form:e,typeOfForm:"mobile"}):void 0})}),C.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};sl.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,mobilePaddingShow:g.default.bool,mobilePaddingsExt:g.default.bool,setMobilePaddingsExt:g.default.func,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func,toggleShowMobileBackgroundHandler:g.default.func,toggleShowMobilePaddingHandler:g.default.func};var al=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),s=r.useDispatch(),[a]=t.ui_kit$Form.useForm(),d=Fo(),c=Fo(),[p,f]=(0,n.useState)(""),[x,k]=(0,n.useState)({}),[b,h]=(0,n.useState)(!0),[T,_]=(0,n.useState)(!0),E=r.useSelector(r.selectEmailViewType),w=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[v,A]=(0,n.useState)(e.backgroundImage[0].value===""),j=r.useSelector(r.selectIsCodeMode),C=r.useSelector(r.selectCodeModeDirection),P=j&&C!=="bottom",[Y,z]=(0,n.useState)(!1),[$,O]=(0,n.useState)(!1),[y,oe]=(0,n.useState)(!1),[G,q]=(0,n.useState)(!1),[te,ue]=(0,n.useState)(!1),[me,se]=(0,n.useState)(!1),[_e,ve]=(0,n.useState)(!1),[de,De]=(0,n.useState)(!1),[ye,re]=(0,n.useState)(!1),[ke,ae]=(0,n.useState)(!1),[Q,he]=(0,n.useState)(!1),[pe,ee]=(0,n.useState)(!1),[J,H]=(0,n.useState)(!1),[X,ce]=(0,n.useState)(!1),[xe,ne]=(0,n.useState)(!1),Ae=r.useElementEntityKind(),we=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],$e=e.border,K=e.mobileBorder,ie=Object.keys($e).find(R=>$e[R]?.width||$e[R]?.style||$e[R]?.color),je=Object.keys(K).find(R=>K[R]?.width||K[R]?.style||K[R]?.color),V=R=>R&&(R?.width||R?.style||R?.color)?R:"",{remember:Se,fillFields:Ie}=st(e);(0,n.useEffect)(()=>{if(e){const R=e.boxShadow;k(R),Ie(a,{...e,width:e.width?.value,widthDim:e.width?.dim,height:e.height?.value,heightDim:e.height?.dim,backgroundImage:e.backgroundImage[0].value,show:e.show?e.show:"all",isContrastBlock:e.isContrastBlock,borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),mobileBorderAll:V(e.mobileBorder.all)||!(V(e.mobileBorder.top)||V(e.mobileBorder.bottom)||V(e.mobileBorder.right)||V(e.mobileBorder.left))&&V(e.border.all),mobileBorderTop:V(e.mobileBorder.top)||!V(e.mobileBorder.all)&&V(e.border.top),mobileBorderBottom:V(e.mobileBorder.bottom)||!V(e.mobileBorder.all)&&V(e.border.bottom),mobileBorderRight:V(e.mobileBorder.right)||!V(e.mobileBorder.all)&&V(e.border.right),mobileBorderLeft:V(e.mobileBorder.left)||!V(e.mobileBorder.all)&&V(e.border.left),paddingTop:u(e.padding?.all)||u(e.padding?.top),paddingLeft:u(e.padding?.all)||u(e.padding?.left),paddingRight:u(e.padding?.all)||u(e.padding?.right),paddingBottom:u(e.padding?.all)||u(e.padding?.bottom),paddingLeftRight:u(e.padding?.left)||u(e.padding?.right),paddingTopBottom:u(e.padding?.top)||u(e.padding?.bottom),borderRadiusAll:u(e.borderRadius.all),borderRadiusTopLeft:u(e.borderRadius.topLeft),borderRadiusBottomLeft:u(e.borderRadius.bottomLeft),borderRadiusTopRight:u(e.borderRadius.topRight),borderRadiusBottomRight:u(e.borderRadius.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:po(e.mobileWidth?.value)||po(e.width?.value),mobileWidthDim:po(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:po(e.mobileHeight?.value)||po(e.height?.value),mobileHeightDim:po(e.mobileHeight?.value)?e.mobileHeight?.dim:e.height?.dim,mobileBorderRadiusAll:u(e.mobileBorderRadius?.all)||u(e.borderRadius?.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius?.topLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topLeft)||u(e.borderRadius?.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius?.bottomLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomLeft)||u(e.borderRadius?.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius?.topRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topRight)||u(e.borderRadius?.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius?.bottomRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomRight)||u(e.borderRadius?.all),mobileBoxShadowInset:e.mobileBoxShadow?.inset!=null?e.mobileBoxShadow.inset:e.boxShadow?.inset||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset)||u(e.boxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset)||u(e.boxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius)||u(e.boxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius)||u(e.boxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color)||u(e.boxShadow?.color),mobileAlign:u(e.mobileAlign?.value)||e.align,mobileVerticalAlign:u(e.mobileVerticalAlign?.value||e.valign),mobileDirection:u(e.mobileDirection?.value),mobileBackgroundColor:u(e.mobileBackgroundColor?.value||e.backgroundColor||""),...nt(e),mobilePaddingTop:u(e.mobilePadding.all)||u(e.mobilePadding.top)||u(e.padding?.all)||u(e.padding?.top),mobilePaddingLeft:u(e.mobilePadding.all)||u(e.mobilePadding.left)||u(e.padding?.all)||u(e.padding?.left),mobilePaddingRight:u(e.mobilePadding.all)||u(e.mobilePadding.right)||u(e.padding?.all)||u(e.padding?.right),mobilePaddingBottom:u(e.mobilePadding.all)||u(e.mobilePadding.bottom)||u(e.padding?.all)||u(e.padding?.bottom),mobilePaddingTopBottom:u(e.mobilePadding.top)||u(e.mobilePadding.bottom)||u(e.padding?.top)||u(e.padding?.bottom),mobilePaddingLeftRight:u(e.mobilePadding.left)||u(e.mobilePadding.right)||u(e.padding?.left)||u(e.padding?.right),exportAsPicture:e?.exportAsPicture}),!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?h(!1):h(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||!u(e.borderRadius.all)&&!u(e.mobileBorderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?_(!1):_(!0),A(e.backgroundImage[0].value===""),!u(e.padding.all)&&(u(e.padding.top)||u(e.padding.right)||u(e.padding.bottom)||u(e.padding.left))&&(e.padding.top!==e.padding.bottom||e.padding.right!==e.padding.left)?z(!1):z(!0),!u(e.mobilePadding.all)&&(u(e.mobilePadding.top)||u(e.mobilePadding.right)||u(e.mobilePadding.bottom)||u(e.mobilePadding.left))&&(e.mobilePadding.top!==e.mobilePadding.bottom||e.mobilePadding.right!==e.mobilePadding.left)||!u(e.padding?.all)&&(u(e.padding?.top)||u(e.padding?.right)||u(e.padding?.bottom)||u(e.padding?.left))&&(e.padding?.top!==e.padding?.bottom||e.padding?.right!==e.padding?.left)?O(!1):O(!0);const F=d.isStaleBorderSnapshot(e,!!ie),fe=c.isStaleBorderSnapshot(e,!!je);F&&a.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(fe||F&&!je)&&a.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),oe(Le=>ie&&!F?!0:Le),q(Le=>ie&&!F||je&&!fe?!0:Le),ue(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),se(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight||!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),ve(!!e.boxShadow),De(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),re(!!e.width.value&&e.type!=="column"||!!e.height.value),ae(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value&&e.type!=="column"||!!e.height.value),he(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),ee(!!e.mobileBackgroundColor.value||!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),kt(e)&&ee(!0),H(!!e.exportAsPicture||!!e.isContrastBlock),ce(!!e.mobilePadding.all||e.mobilePadding.all===0||!!e.mobilePadding.top||e.mobilePadding.top===0||!!e.mobilePadding.bottom||e.mobilePadding.bottom===0||!!e.mobilePadding.left||e.mobilePadding.left===0||!!e.mobilePadding.right||e.mobilePadding.right===0||!!e.padding.all||e.padding.all===0||!!e.padding.top||e.padding.top===0||!!e.padding.bottom||e.padding.bottom===0||!!e.padding.left||e.padding.left===0||!!e.padding.right||e.padding.right===0),e.elementName==="List"?ne(!0):ne(!1)}},[a,e,ie,je,d,c,Ie]);const Ne=(0,n.useCallback)(R=>{Se(R),s(Ae==="email"?r.setElementSettings$1(R):r.setElementSettings(R))},[s,Ae,Se]),Fe=R=>{const F=a.getFieldsValue(!0),fe=Object.keys(R)[0];let Le;switch(f(a.getFieldsValue(!0).widthDim==="%"?100:""),fe){case"exportAsPicture":Le={exportAsPicture:F.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Le={boxShadow:{hOffset:F.boxShadowHOffset,vOffset:F.boxShadowVOffset,blurRadius:F.boxShadowBlurRadius,spreadRadius:F.boxShadowSpreadRadius,color:F.boxShadowColor,inset:F.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":F.borderPosition==="borderAll"?(Le={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...F.borderAll}}},a.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):F.borderAll?.width||F.borderAll?.style||F.borderAll?.color?(Le={border:{all:null,left:F.borderAll,right:F.borderAll,top:F.borderAll,bottom:F.borderAll,[W.REVERSE_BORDER_POSITIONS[fe]]:{...F[fe],...R[fe]}}},a.setFieldsValue({borderAll:null,borderLeft:F.borderAll,borderRight:F.borderAll,borderTop:F.borderAll,borderBottom:F.borderAll,[fe]:{...F[fe],...R[fe]}})):(Le={border:{all:null,left:F.borderLeft,right:F.borderRight,top:F.borderTop,bottom:F.borderBottom,[W.REVERSE_BORDER_POSITIONS[fe]]:{...F[fe],...R[fe]}}},a.setFieldsValue({border:Le.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(F.mobileBorderPosition==="mobileBorderAll")Le={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...F.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[fe]+"-"}}},a.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const eo=W.MOBILE_REVERSE_BORDER_POSITIONS[fe],Xe={...F[fe],...R[fe]},lo=!Xe?.width&&!Xe?.style&&!Xe?.color;if(F.mobileBorder?.all?.width||F.mobileBorder?.all?.style||F.mobileBorder?.all?.color){const Qe=F.mobileBorderAll;Le={mobileBorder:{all:null,left:Qe,right:Qe,top:Qe,bottom:Qe,[eo]:lo?null:{...Xe,classNamePrefix:"em-mob-border_"+eo+"-"}}},a.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:Qe,mobileBorderRight:Qe,mobileBorderTop:Qe,mobileBorderBottom:Qe,[fe]:Xe})}else{const Qe=e.mobileBorder||{},uo=Eo=>{const B=Qe[Eo];return B&&(B?.width||B?.style||B?.color)?B:null};Le={mobileBorder:{all:null,left:eo==="left"?lo?null:{...Xe,classNamePrefix:"em-mob-border_left-"}:uo("left"),right:eo==="right"?lo?null:{...Xe,classNamePrefix:"em-mob-border_right-"}:uo("right"),top:eo==="top"?lo?null:{...Xe,classNamePrefix:"em-mob-border_top-"}:uo("top"),bottom:eo==="bottom"?lo?null:{...Xe,classNamePrefix:"em-mob-border_bottom-"}:uo("bottom")}},a.setFieldsValue({[fe]:Xe})}}break;case"width":Le={[fe]:{value:R[fe],dim:F.widthDim}};break;case"height":Le={[fe]:{value:R[fe],dim:F.heightDim}};break;case"widthDim":Le={width:{value:F.width,dim:R[fe]}};break;case"heightDim":Le={height:{value:F.height,dim:R[fe]}};break;case"backgroundImage":A(R[fe]===""),Le={[fe]:[{...e.backgroundImage[0],value:R[fe]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":Le={padding:{left:F.paddingLeft,right:F.paddingRight,top:F.paddingTop,bottom:F.paddingBottom,[W.PADDING_POSITION[fe]]:+R[fe]}};break;case"paddingTopBottom":Le={padding:{left:F.paddingLeft,right:F.paddingRight,top:+R[fe],bottom:+R[fe]}},F.paddingTop=F.paddingBottom=+R[fe];break;case"paddingLeftRight":Le={padding:{top:F.paddingTop,bottom:F.paddingBottom,left:+R[fe],right:+R[fe]}},F.paddingLeft=F.paddingRight=+R[fe];break;case"borderRadiusAll":Le={borderRadius:{[W.BORDER_RADIUS_POSITION[fe]]:+R[fe]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Le={borderRadius:{topLeft:F.borderRadiusTopLeft,bottomLeft:F.borderRadiusBottomLeft,topRight:F.borderRadiusTopRight,bottomRight:F.borderRadiusBottomRight,[W.BORDER_RADIUS_POSITION[fe]]:+R[fe]}};break;case"mobileWidth":Le={[fe]:{classNamePrefix:"em-mob-width-",value:R[fe],dim:F.mobileWidthDim}};break;case"mobileWidthDim":Le={mobileWidth:{classNamePrefix:"em-mob-width-",value:F.mobileWidth||100,dim:R[fe]}};break;case"mobileHeight":Le={[fe]:{classNamePrefix:"em-mob-height-",value:R[fe],dim:F.mobileHeightDim}};break;case"mobileHeightDim":Le={mobileHeight:{classNamePrefix:"em-mob-height-",value:F.mobileHeight,dim:R[fe]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Le={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[fe]]:R[fe],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[fe]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Le={mobileBoxShadow:{hOffset:F.mobileBoxShadowHOffset,vOffset:F.mobileBoxShadowVOffset,blurRadius:F.mobileBoxShadowBlurRadius,spreadRadius:F.mobileBoxShadowSpreadRadius,color:F.mobileBoxShadowColor,inset:F.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":Le={[fe]:{classNamePrefix:"em-mob-text_align-",value:R[fe]}};break;case"mobileVerticalAlign":Le={[fe]:{classNamePrefix:"em-mob-vertical_align-",value:R[fe]}};break;case"mobileDirection":Le={[fe]:{classNamePrefix:"em-mob-direction-",value:R[fe]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Le=_t(R),!Le)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":Le={mobilePadding:{all:null,top:F.mobilePaddingTop!==""?F.mobilePaddingTop:null,right:F.mobilePaddingRight!==""?F.mobilePaddingRight:null,bottom:F.mobilePaddingBottom!==""?F.mobilePaddingBottom:null,left:F.mobilePaddingLeft!==""?F.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":F.mobilePaddingTop=F.mobilePaddingBottom=R[fe],Le={mobilePadding:{all:null,top:F.mobilePaddingTop!==""?F.mobilePaddingTop:null,right:F.mobilePaddingRight!==""?F.mobilePaddingRight:null,bottom:F.mobilePaddingBottom!==""?F.mobilePaddingBottom:null,left:F.mobilePaddingLeft!==""?F.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":F.mobilePaddingLeft=F.mobilePaddingRight=R[fe],Le={mobilePadding:{all:null,top:F.mobilePaddingTop!==""?F.mobilePaddingTop:null,right:F.mobilePaddingRight!==""?F.mobilePaddingRight:null,bottom:F.mobilePaddingBottom!==""?F.mobilePaddingBottom:null,left:F.mobilePaddingLeft!==""?F.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"backgroundPositionX":case"backgroundPositionY":Le={[fe]:isNaN(parseFloat(R[fe].position))?R[fe].position:R[fe].position+R[fe].unit};break;default:Le=R}fe!=="borderPosition"&&fe!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Le}),fe!=="mobileBorderRadiusAll"&&fe!=="mobileBorderRadiusTopLeft"&&fe!=="mobileBorderRadiusTopRight"&&fe!=="mobileBorderRadiusBottomLeft"&&fe!=="mobileBorderRadiusBottomRight"&&Ne({...e,...Le,mobileBorderRadius:{...e.mobileBorderRadius,...Le?.mobileBorderRadius},activateSection:null,changeKey:fe}))},Ve=()=>{z(F=>!F);const R=a.getFieldsValue(!0);Y||(R.paddingLeftRight=R.paddingLeft,R.paddingTopBottom=R.paddingTop,R.paddingRight=R.paddingLeft,R.paddingBottom=R.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:R.paddingTopBottom,bottom:R.paddingTopBottom,left:R.paddingLeftRight,right:R.paddingLeftRight}}}))},Ue=()=>{const R=a.getFieldsValue(!0);d.markBorderToggled(!y),setTimeout(()=>{oe(F=>!F),y?(R.borderAll=W.NULL_BORDER,R.borderTop=W.NULL_BORDER,R.borderBottom=W.NULL_BORDER,R.borderRight=W.NULL_BORDER,R.borderLeft=W.NULL_BORDER):R.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:R.borderAll.color,style:R.borderAll.style,width:R.borderAll.width}}}})})},le=()=>{const R=a.getFieldsValue(!0);c.markBorderToggled(!G),setTimeout(()=>{q(F=>!F),G?(R.mobileBorderAll=W.NULL_BORDER,R.mobileBorderTop=W.NULL_BORDER,R.mobileBorderBottom=W.NULL_BORDER,R.mobileBorderRight=W.NULL_BORDER,R.mobileBorderLeft=W.NULL_BORDER):R.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:R.mobileBorderAll.color,style:R.mobileBorderAll.style,width:R.mobileBorderAll.width}}}})})},Te=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{ue(F=>!F),te?(R.borderRadiusAll=0,h(!0)):R.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:R.borderRadiusAll}}})})},I=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{se(F=>!F),me?(R.mobileBorderRadiusAll=null,_(!0)):R.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:R.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},Z=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{ve(F=>!F),_e?(R.boxShadowInset=!1,R.boxShadowHOffset=null,R.boxShadowVOffset=null,R.boxShadowBlurRadius=null,R.boxShadowSpreadRadius=null,R.boxShadowColor=""):(R.boxShadowInset=!1,R.boxShadowHOffset=5,R.boxShadowVOffset=5,R.boxShadowBlurRadius=10,R.boxShadowSpreadRadius=-5,R.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:R.boxShadowBlurRadius,color:R.boxShadowColor,hOffset:R.boxShadowHOffset,inset:R.boxShadowInset,spreadRadius:R.boxShadowSpreadRadius,vOffset:R.boxShadowVOffset}}})})},Be=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{De(F=>!F),de?(R.mobileBoxShadowInset=!1,R.mobileBoxShadowHOffset=null,R.mobileBoxShadowVOffset=null,R.mobileBoxShadowBlurRadius=null,R.mobileBoxShadowSpreadRadius=null,R.mobileBoxShadowColor=""):(R.mobileBoxShadowInset=!1,R.mobileBoxShadowHOffset=5,R.mobileBoxShadowVOffset=5,R.mobileBoxShadowBlurRadius=10,R.mobileBoxShadowSpreadRadius=-5,R.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:R.mobileBoxShadowBlurRadius,color:R.mobileBoxShadowColor,hOffset:R.mobileBoxShadowHOffset,inset:R.mobileBoxShadowInset,spreadRadius:R.mobileBoxShadowSpreadRadius,vOffset:R.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Ce=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{re(F=>!F),ye&&(R.width="",R.height="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{width:{value:null,dim:"px"},height:{value:null,dim:"px"}}}))})},Me=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{ae(F=>!F),ke&&(R.mobileWidth="",R.mobileHeight="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"},mobileHeight:{value:null,dim:"px",classNamePrefix:"em-mob-height-"}}}))})},Ge=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{he(F=>!F),Q?(R.backgroundColor="",R.backgroundImage="",R.backgroundPositionX="",R.backgroundPositionY="",R.backgroundRepeat="none",R.backgroundSize="",A(!0)):(R.backgroundColor="#E5E5E5",R.backgroundSize="",R.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:R.backgroundColor,backgroundImage:[{type:"url",value:R.backgroundImage}],backgroundPositionX:R.backgroundPositionX,backgroundPositionY:R.backgroundPositionY,backgroundRepeat:R.backgroundRepeat,backgroundSize:R.backgroundSize}})})},Ye=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{ee(F=>!F),pe?R.mobileBackgroundColor="":R.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:R.mobileBackgroundColor}}}),pe&&Et(a,e,l)})},D=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{H(F=>!F),J&&(R.exportAsPicture=!1,R.isContrastBlock=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1,isContrastBlock:!1}}))})},L=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{ce(F=>!F),X&&(R.mobilePaddingLeftRight="",R.mobilePaddingLeft="",R.mobilePaddingRight="",R.mobilePaddingTopBottom="",R.mobilePaddingTop="",R.mobilePaddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobilePadding:{all:null,top:null,right:null,bottom:null,left:null,classNamePrefix:"em-mob-padding_"}}}))})};return(0,o.jsx)(t.ui_kit$Form,{form:a,layout:"vertical",name:"selected_td_form",initialValues:{horizontalPosition:"",horizontalUnit:"px",backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",align:"",valign:"",border:"",show:"all",borderPosition:W.BORDER_POSITIONS[ie]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[je]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",borderRadiusAll:"",borderRadiusTopLeft:"",borderRadiusBottomLeft:"",borderRadiusTopRight:"",borderRadiusBottomRight:"",direction:"",boxShadowInset:"",boxShadowHOffset:"",boxShadowVOffset:"",boxShadowBlurRadius:"",boxShadowSpreadRadius:"",boxShadowColor:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileAlign:"",mobileDirection:"",mobileVerticalAlign:"",mobileBackgroundColor:"",mobileBackgroundImage:"",mobilePaddingTop:"",mobilePaddingLeft:"",mobilePaddingRight:"",mobilePaddingBottom:"",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1},onValuesChange:Fe,autoComplete:"off",className:"element-controls",children:E==="mobile"&&w.styles?(0,o.jsxs)("div",{className:"selected_form-mobile-props-wrapper",style:{display:E==="mobile"&&w.styles?"flex":"none"},children:[(0,o.jsx)("div",{className:"selected_form-mobile-props-header",children:!P&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})})}),(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(sl,{form:a,elementSettings:e,boxShadow:x,mobileBordersShow:G,mobileBorderRadiusShow:me,mobileBoxShadowShow:de,mobileSizeShow:ke,mobileBackgroundShow:pe,mobilePaddingShow:X,mobilePaddingsExt:$,setMobilePaddingsExt:O,oneMobileBorderRadiusValue:T,setOneMobileBorderRadiusValue:_,toggleShowMobileBorderHandler:le,toggleShowMobileBorderRadiusHandler:I,toggleShowMobileBoxShadowHandler:Be,toggleShowMobileSizeHandler:Me,toggleShowMobileBackgroundHandler:Ye,toggleShowMobilePaddingHandler:L})})]}):(0,o.jsxs)(o.Fragment,{children:[!P&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(ll,{form:a,elementSettings:e,boxShadow:x,bordersShow:y,borderRadiusShow:te,boxShadowShow:_e,backgroundShow:Q,backgroundImageEmpty:v,backgroundRepeatOptions:we,sizeShow:ye,maxWidthValue:p,modificationShow:J,paddingsExt:Y,oneBorderRadiusValue:b,setOneBorderRadiusValue:h,elementListShow:xe,togglePaddingHandler:Ve,toggleShowBorderHandler:Ue,toggleShowBorderRadiusHandler:Te,toggleShowBoxShadowHandler:Z,toggleShowSizeHandler:Ce,toggleShowBackgroundHandler:Ge,toggleShowModificationHandler:D,handleChangeValues:Fe})})]})})};al.propTypes={elementSettings:g.default.object.isRequired};var nl=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:a,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:p,backgroundRepeatOptions:f,sizeShow:x,maxWidthValue:k,modificationShow:b,paddingShow:h,paddingsExt:T,oneBorderRadiusValue:_,setOneBorderRadiusValue:E,togglePaddingHandler:w,toggleShowPaddingHandler:v,toggleShowBorderHandler:A,toggleShowBorderRadiusHandler:j,toggleShowBoxShadowHandler:C,toggleShowSizeHandler:P,toggleShowBackgroundHandler:Y,toggleShowModificationHandler:z,handleChangeValues:$})=>{const{__:O}=r.useI18n(),{token:y}=(0,t.ui_kit$useToken)(),oe=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:O("Appearance on mobile devices"),type:"info"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(it,{form:e,elementSettings:i})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Mo,{form:e,elementSettings:i})})]}),oe.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("Padding"),collapsible:!0,open:h,onToggle:v,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:T,onToggleExtended:w,labels:{horizontal:O("Horizontal padding"),vertical:O("Vertical padding"),left:O("Left padding"),right:O("Right padding"),top:O("Top padding"),bottom:O("Bottom padding"),individual:O("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:O("Size"),collapsible:!0,open:x,onToggle:P,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:k,dimensionSelect:$o,showMinMax:!0,minWidthDimensionSelect:$o,maxWidthDimensionSelect:$o,labels:{width:O("Width"),height:O("Height"),minWidth:O("Minimum width"),maxWidth:O("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:O("Background"),collapsible:!0,open:c,onToggle:Y,dividerTop:!0,children:[(0,o.jsx)(vi,{form:e,backgroundImageEmpty:p,appConfig:oe,token:y,elementSettings:i,backgroundRepeatOptions:f,handleChangeValues:$}),(0,o.jsx)(rt,{form:e,showBackground:!0})]}),oe.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("Borders"),collapsible:!0,open:s,onToggle:A,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),oe.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("Border radius"),collapsible:!0,open:a,onToggle:j,dividerTop:!0,children:(0,o.jsx)(So,{form:e,oneBorderRadiusValue:_,setOneBorderRadiusValue:E,elementSettings:i})}),oe.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("Box shadow"),collapsible:!0,open:d,onToggle:C,dividerTop:!0,children:(0,o.jsx)(jo,{})}),oe.formFieldExportAsPictureEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("Export settings"),collapsible:!0,open:b,onToggle:z,dividerTop:!0,children:(0,o.jsx)(yi,{form:e,elementSettings:i})}),oe.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("Display control & Direction"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e,directionControl:(0,o.jsx)(Ht,{elementSettings:i,form:e})})}),oe.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};nl.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,backgroundShow:g.default.bool,backgroundImageEmpty:g.default.bool,backgroundRepeatOptions:g.default.array,sizeShow:g.default.bool,maxWidthValue:g.default.oneOfType([g.default.string,g.default.number]),modificationShow:g.default.bool,paddingShow:g.default.bool,paddingsExt:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,togglePaddingHandler:g.default.func,toggleShowPaddingHandler:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func,toggleShowSizeHandler:g.default.func,toggleShowBackgroundHandler:g.default.func,toggleShowModificationHandler:g.default.func,handleChangeValues:g.default.func};var dl=({form:e,elementSettings:i,mobileBoxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:a,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:p,mobilePaddingShow:f,mobilePaddingsExt:x,setMobilePaddingsExt:k,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:h,toggleShowMobileBorderHandler:T,toggleShowMobileBorderRadiusHandler:_,toggleShowMobileBoxShadowHandler:E,toggleShowMobileSizeHandler:w,toggleShowMobileBackgroundHandler:v,toggleShowMobilePaddingHandler:A})=>{const{__:j}=r.useI18n(),{token:C}=(0,t.ui_kit$useToken)(),P=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Dt,{form:e,elementSettings:i,imgParent:!0})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Mo,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),P.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Padding"),collapsible:!0,open:f,onToggle:A,dividerTop:!0,children:(0,o.jsx)(Wt,{form:e,elementSettings:i,mobilePaddingsExt:x,setMobilePaddingsExt:k})}),(0,o.jsx)(t.ui_kit$FormSection,{title:j("Size"),collapsible:!0,open:c,onToggle:w,dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:8},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:C.formItemMarginBottomXS*2},children:(0,o.jsx)(zo,{form:e,name:"mobileWidth",elementSettings:i})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:C.formItemMarginBottomXS},children:(0,o.jsx)(tt,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:j("Background"),collapsible:!0,open:p,onToggle:v,dividerTop:!0,children:(0,o.jsx)(Bt,{elementSettings:Go(i),imageEnabled:P.formDivFieldBackgroundImageEnabled,desktopBackground:xt(i)})}),P.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Borders"),collapsible:!0,open:s,onToggle:T,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),P.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Border radius"),collapsible:!0,open:a,onToggle:_,dividerTop:!0,children:(0,o.jsx)(So,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:b,setOneBorderRadiusValue:h,elementSettings:i})}),P.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Box shadow"),collapsible:!0,open:d,onToggle:E,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile",form:e,elementSettings:i})}),P.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Display control & Direction"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e,directionControl:(0,o.jsx)(Ht,{elementSettings:i,form:e,typeOfForm:"mobile"})})}),P.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};dl.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,mobileBoxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,mobilePaddingShow:g.default.bool,mobilePaddingsExt:g.default.bool,setMobilePaddingsExt:g.default.func,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func,toggleShowMobileBackgroundHandler:g.default.func,toggleShowMobilePaddingHandler:g.default.func};var cl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),a=Fo(),d=Fo(),[c,p]=(0,n.useState)({}),[f,x]=(0,n.useState)(!0),[k,b]=(0,n.useState)({}),[h,T]=(0,n.useState)(!0),_=r.useSelector(r.selectEmailViewType),E=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[w,v]=(0,n.useState)(e.backgroundImage[0].value===""),A=r.useSelector(r.selectIsCodeMode),j=r.useSelector(r.selectCodeModeDirection),C=A&&j!=="bottom",[P,Y]=(0,n.useState)(!1),[z,$]=(0,n.useState)(!1),[O,y]=(0,n.useState)(!1),[oe,G]=(0,n.useState)(!1),[q,te]=(0,n.useState)(!1),[ue,me]=(0,n.useState)(!1),[se,_e]=(0,n.useState)(!1),[ve,de]=(0,n.useState)(!1),[De,ye]=(0,n.useState)(!1),[re,ke]=(0,n.useState)(!1),[ae,Q]=(0,n.useState)(!1),[he,pe]=(0,n.useState)(!1),[ee,J]=(0,n.useState)(!1),[H,X]=(0,n.useState)(!1),[ce,xe]=(0,n.useState)(!1),[ne,Ae]=(0,n.useState)(""),we=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}];i("Not defined"),i("Contain"),i("Cover");const $e=e.border,K=e.mobileBorder,ie=Object.keys($e).find(D=>$e[D]?.width||$e[D]?.style||$e[D]?.color),je=Object.keys(K).find(D=>K[D]?.width||K[D]?.style||K[D]?.color),V=D=>D&&(D?.width||D?.style||D?.color)?D:"";(0,n.useEffect)(()=>{if(e){const D=e.boxShadow,L=e.mobileBoxShadow;p(D),b(L),s.setFieldsValue({...e,width:e.width?.value,widthDim:e.width?.dim,height:e.height?.value,heightDim:e.height?.dim,maxWidth:e.maxWidth?.value,maxWidthDim:e.maxWidth?.dim,minWidth:e.minWidth?.value,minWidthDim:e.minWidth?.dim,backgroundImage:e.backgroundImage[0].value,show:e.show?e.show:"all",borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),mobileBorderAll:V(e.mobileBorder.all)||!(V(e.mobileBorder.top)||V(e.mobileBorder.bottom)||V(e.mobileBorder.right)||V(e.mobileBorder.left))&&V(e.border.all),mobileBorderTop:V(e.mobileBorder.top)||!V(e.mobileBorder.all)&&V(e.border.top),mobileBorderBottom:V(e.mobileBorder.bottom)||!V(e.mobileBorder.all)&&V(e.border.bottom),mobileBorderRight:V(e.mobileBorder.right)||!V(e.mobileBorder.all)&&V(e.border.right),mobileBorderLeft:V(e.mobileBorder.left)||!V(e.mobileBorder.all)&&V(e.border.left),paddingTop:u(e.padding.all)||u(e.padding.top),paddingLeft:u(e.padding.all)||u(e.padding.left),paddingRight:u(e.padding.all)||u(e.padding.right),paddingBottom:u(e.padding.all)||u(e.padding.bottom),paddingLeftRight:u(e.padding?.left)||u(e.padding?.right),paddingTopBottom:u(e.padding?.top)||u(e.padding?.bottom),borderRadiusAll:u(e.borderRadius.all),borderRadiusTopLeft:u(e.borderRadius.topLeft),borderRadiusBottomLeft:u(e.borderRadius.bottomLeft),borderRadiusTopRight:u(e.borderRadius.topRight),borderRadiusBottomRight:u(e.borderRadius.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:po(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileHeight:po(e.mobileHeight?.value),mobileHeightDim:e.mobileHeight?.dim,mobileBorderRadiusAll:u(e.mobileBorderRadius.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius.topLeft!==null?e.mobileBorderRadius.topLeft:e.mobileBorderRadius.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius.bottomLeft!==null?e.mobileBorderRadius.bottomLeft:e.mobileBorderRadius.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius.topRight!==null?e.mobileBorderRadius.topRight:e.mobileBorderRadius.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius.bottomRight!==null?e.mobileBorderRadius.bottomRight:e.mobileBorderRadius.all),mobileBoxShadowInset:u(e.mobileBoxShadow?.inset)||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color),mobileAlign:u(e.mobileAlign?.value),mobileVerticalAlign:u(e.mobileVerticalAlign?.value),mobileDirection:u(e.mobileDirection?.value),mobileBackgroundColor:u(e.mobileBackgroundColor?.value!=="none"?e.mobileBackgroundColor?.value:""),...nt(e),mobilePaddingTop:u(e.mobilePadding.all)||u(e.mobilePadding.top),mobilePaddingLeft:u(e.mobilePadding.all)||u(e.mobilePadding.left),mobilePaddingRight:u(e.mobilePadding.all)||u(e.mobilePadding.right),mobilePaddingBottom:u(e.mobilePadding.all)||u(e.mobilePadding.bottom),mobilePaddingTopBottom:u(e.mobilePadding.top)||u(e.mobilePadding.bottom),mobilePaddingLeftRight:u(e.mobilePadding.left)||u(e.mobilePadding.right),exportAsPicture:e?.exportAsPicture}),!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?x(!1):x(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))?T(!1):T(!0),v(e.backgroundImage[0].value===""),!u(e.padding.all)&&(u(e.padding.top)||u(e.padding.right)||u(e.padding.bottom)||u(e.padding.left))&&(e.padding.top!==e.padding.bottom||e.padding.right!==e.padding.left)?Y(!1):Y(!0),!u(e.mobilePadding.all)&&(u(e.mobilePadding.top)||u(e.mobilePadding.right)||u(e.mobilePadding.bottom)||u(e.mobilePadding.left))&&(e.mobilePadding.top!==e.mobilePadding.bottom||e.mobilePadding.right!==e.mobilePadding.left)?$(!1):$(!0);const R=a.isStaleBorderSnapshot(e,!!ie),F=d.isStaleBorderSnapshot(e,!!je);R&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(F||R&&!je)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),y(fe=>ie&&!R?!0:fe),G(fe=>ie&&!R||je&&!F?!0:fe),te(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),me(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),_e(!!e.boxShadow),de(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),ye(!!e.width.value||!!e.height.value||!!e.minWidth.value||!!e.maxWidth.value),ke(!!e.mobileWidth.value||!!e.mobileHeight.value),Q(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),pe(kt(e)),J(!!e.exportAsPicture),X(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),xe(!!e.mobilePadding.all||!!e.mobilePadding.top||!!e.mobilePadding.bottom||!!e.mobilePadding.left||!!e.mobilePadding.right)}},[s,e,ie,je,a,d]);const Se=D=>{const L=s.getFieldsValue(!0),R=Object.keys(D)[0];let F;switch(Ae(s.getFieldsValue(!0).widthDim==="%"?100:""),R){case"exportAsPicture":F={exportAsPicture:L.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":F={boxShadow:{hOffset:L.boxShadowHOffset,vOffset:L.boxShadowVOffset,blurRadius:L.boxShadowBlurRadius,spreadRadius:L.boxShadowSpreadRadius,color:L.boxShadowColor,inset:L.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":L.borderPosition==="borderAll"?(F={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...L.borderAll}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):L.borderAll?.width||L.borderAll?.style||L.borderAll?.color?(F={border:{all:null,left:L.borderAll,right:L.borderAll,top:L.borderAll,bottom:L.borderAll,[W.REVERSE_BORDER_POSITIONS[R]]:{...L[R],...D[R]}}},s.setFieldsValue({borderAll:null,borderLeft:L.borderAll,borderRight:L.borderAll,borderTop:L.borderAll,borderBottom:L.borderAll,[R]:{...L[R],...D[R]}})):(F={border:{all:null,left:L.borderLeft,right:L.borderRight,top:L.borderTop,bottom:L.borderBottom,[W.REVERSE_BORDER_POSITIONS[R]]:{...L[R],...D[R]}}},s.setFieldsValue({border:F.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(L.mobileBorderPosition==="mobileBorderAll")F={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...L.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[R]+"-"}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const fe=W.MOBILE_REVERSE_BORDER_POSITIONS[R],Le={...L[R],...D[R]},eo=!Le?.width&&!Le?.style&&!Le?.color;if(L.mobileBorder?.all?.width||L.mobileBorder?.all?.style||L.mobileBorder?.all?.color){const Xe=L.mobileBorderAll;F={mobileBorder:{all:null,left:Xe,right:Xe,top:Xe,bottom:Xe,[fe]:eo?null:{...Le,classNamePrefix:"em-mob-border_"+fe+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:Xe,mobileBorderRight:Xe,mobileBorderTop:Xe,mobileBorderBottom:Xe,[R]:Le})}else{const Xe=e.mobileBorder||{},lo=Qe=>{const uo=Xe[Qe];return uo&&(uo?.width||uo?.style||uo?.color)?uo:null};F={mobileBorder:{all:null,left:fe==="left"?eo?null:{...Le,classNamePrefix:"em-mob-border_left-"}:lo("left"),right:fe==="right"?eo?null:{...Le,classNamePrefix:"em-mob-border_right-"}:lo("right"),top:fe==="top"?eo?null:{...Le,classNamePrefix:"em-mob-border_top-"}:lo("top"),bottom:fe==="bottom"?eo?null:{...Le,classNamePrefix:"em-mob-border_bottom-"}:lo("bottom")}},s.setFieldsValue({[R]:Le})}}break;case"width":F={[R]:{value:D[R],dim:L.widthDim}};break;case"height":F={[R]:{value:D[R],dim:L.heightDim}};break;case"widthDim":F={width:{value:L.width,dim:D[R]}};break;case"heightDim":F={height:{value:L.height,dim:D[R]}};break;case"maxWidth":F={[R]:{value:D[R],dim:L.maxWidthDim}};break;case"maxWidthDim":F={maxWidth:{value:L.maxWidth,dim:D[R]}};break;case"minWidth":F={[R]:{value:D[R],dim:L.minWidthDim}};break;case"minWidthDim":F={minWidth:{value:L.minWidth,dim:D[R]}};break;case"backgroundImage":v(D[R]===""),F={[R]:[{...e.backgroundImage[0],value:D[R]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":F={padding:{[W.PADDING_POSITION[R]]:+D[R]}};break;case"paddingTopBottom":F={padding:{top:+D[R],bottom:+D[R]}},L.paddingTop=L.paddingBottom=+D[R];break;case"paddingLeftRight":F={padding:{left:+D[R],right:+D[R]}},L.paddingLeft=L.paddingRight=+D[R];break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":F={borderRadius:{[W.BORDER_RADIUS_POSITION[R]]:+D[R]}};break;case"mobileWidth":F={[R]:{classNamePrefix:"em-mob-width-",value:D[R],dim:L.mobileWidthDim}};break;case"mobileWidthDim":F={mobileWidth:{classNamePrefix:"em-mob-width-",value:L.mobileWidth||100,dim:D[R]}};break;case"mobileHeight":F={[R]:{classNamePrefix:"em-mob-height-",value:D[R],dim:L.mobileHeightDim}};break;case"mobileHeightDim":F={mobileHeight:{classNamePrefix:"em-mob-height-",value:L.mobileHeight,dim:D[R]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":F={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[R]]:D[R],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[R]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":F={mobileBoxShadow:{hOffset:L.mobileBoxShadowHOffset,vOffset:L.mobileBoxShadowVOffset,blurRadius:L.mobileBoxShadowBlurRadius,spreadRadius:L.mobileBoxShadowSpreadRadius,color:L.mobileBoxShadowColor,inset:L.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":F={[R]:{classNamePrefix:"em-mob-text_align-",value:D[R]}};break;case"mobileVerticalAlign":F={[R]:{classNamePrefix:"em-mob-vertical_align-",value:D[R]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(F=_t(D),!F)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":F={mobilePadding:{all:null,top:L.mobilePaddingTop!==""?L.mobilePaddingTop:null,right:L.mobilePaddingRight!==""?L.mobilePaddingRight:null,bottom:L.mobilePaddingBottom!==""?L.mobilePaddingBottom:null,left:L.mobilePaddingLeft!==""?L.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":L.mobilePaddingTop=L.mobilePaddingBottom=D[R],F={mobilePadding:{all:null,top:L.mobilePaddingTop!==""?L.mobilePaddingTop:null,right:L.mobilePaddingRight!==""?L.mobilePaddingRight:null,bottom:L.mobilePaddingBottom!==""?L.mobilePaddingBottom:null,left:L.mobilePaddingLeft!==""?L.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":L.mobilePaddingLeft=L.mobilePaddingRight=D[R],F={mobilePadding:{all:null,top:L.mobilePaddingTop!==""?L.mobilePaddingTop:null,right:L.mobilePaddingRight!==""?L.mobilePaddingRight:null,bottom:L.mobilePaddingBottom!==""?L.mobilePaddingBottom:null,left:L.mobilePaddingLeft!==""?L.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileDirection":F={[R]:{classNamePrefix:"em-mob-direction-",value:D[R]}};break;case"backgroundPositionX":case"backgroundPositionY":F={[R]:isNaN(parseFloat(D[R].position))?D[R].position:D[R].position+D[R].unit};break;default:F=D}R!=="borderPosition"&&R!=="mobileBorderPosition"&&l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:F})},Ie=()=>{Y(L=>!L);const D=s.getFieldsValue(!0);P||(D.paddingLeftRight=D.paddingLeft,D.paddingTopBottom=D.paddingTop,D.paddingRight=D.paddingLeft,D.paddingBottom=D.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:D.paddingTopBottom,bottom:D.paddingTopBottom,left:D.paddingLeftRight,right:D.paddingLeftRight}}}))},Ne=()=>{const D=s.getFieldsValue(!0);a.markBorderToggled(!O),setTimeout(()=>{y(L=>!L),O?(D.borderAll=W.NULL_BORDER,D.borderTop=W.NULL_BORDER,D.borderBottom=W.NULL_BORDER,D.borderRight=W.NULL_BORDER,D.borderLeft=W.NULL_BORDER):D.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:D.borderAll.color,style:D.borderAll.style,width:D.borderAll.width}}}})})},Fe=()=>{const D=s.getFieldsValue(!0);d.markBorderToggled(!oe),setTimeout(()=>{G(L=>!L),oe?(D.mobileBorderAll=W.NULL_BORDER,D.mobileBorderTop=W.NULL_BORDER,D.mobileBorderBottom=W.NULL_BORDER,D.mobileBorderRight=W.NULL_BORDER,D.mobileBorderLeft=W.NULL_BORDER):D.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:D.mobileBorderAll.color,style:D.mobileBorderAll.style,width:D.mobileBorderAll.width}}}})})},Ve=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{te(L=>!L),q?(D.borderRadiusAll=0,x(!0)):D.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:D.borderRadiusAll}}})})},Ue=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{me(L=>!L),ue?(D.mobileBorderRadiusAll=null,T(!0)):D.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:D.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},le=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{_e(L=>!L),se?(D.boxShadowInset=!1,D.boxShadowHOffset=null,D.boxShadowVOffset=null,D.boxShadowBlurRadius=null,D.boxShadowSpreadRadius=null,D.boxShadowColor=""):(D.boxShadowInset=!1,D.boxShadowHOffset=5,D.boxShadowVOffset=5,D.boxShadowBlurRadius=10,D.boxShadowSpreadRadius=-5,D.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:D.boxShadowBlurRadius,color:D.boxShadowColor,hOffset:D.boxShadowHOffset,inset:D.boxShadowInset,spreadRadius:D.boxShadowSpreadRadius,vOffset:D.boxShadowVOffset}}})})},Te=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{de(L=>!L),ve?(D.mobileBoxShadowInset=!1,D.mobileBoxShadowHOffset=null,D.mobileBoxShadowVOffset=null,D.mobileBoxShadowBlurRadius=null,D.mobileBoxShadowSpreadRadius=null,D.mobileBoxShadowColor=""):(D.mobileBoxShadowInset=!1,D.mobileBoxShadowHOffset=5,D.mobileBoxShadowVOffset=5,D.mobileBoxShadowBlurRadius=10,D.mobileBoxShadowSpreadRadius=-5,D.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:D.mobileBoxShadowBlurRadius,color:D.mobileBoxShadowColor,hOffset:D.mobileBoxShadowHOffset,inset:D.mobileBoxShadowInset,spreadRadius:D.mobileBoxShadowSpreadRadius,vOffset:D.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},I=()=>{setTimeout(()=>{ye(D=>!D)})},Z=()=>{setTimeout(()=>{ke(D=>!D)})},Be=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{Q(L=>!L),ae?(D.backgroundColor="",D.backgroundImage="",D.backgroundPositionX="",D.backgroundPositionY="",D.backgroundRepeat="none",D.backgroundSize="",v(!0)):(D.backgroundColor="#E5E5E5",D.backgroundSize="",D.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:D.backgroundColor,backgroundImage:[{type:"url",value:D.backgroundImage}],backgroundPositionX:D.backgroundPositionX,backgroundPositionY:D.backgroundPositionY,backgroundRepeat:D.backgroundRepeat,backgroundSize:D.backgroundSize}})})},Ce=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{pe(L=>!L),he?D.mobileBackgroundColor="":D.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:D.mobileBackgroundColor}}}),he&&Et(s,e,l)})},Me=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{J(L=>!L),ee&&(D.exportAsPicture=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})},Ge=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{X(L=>!L),H&&(D.paddingLeftRight="",D.paddingLeft="",D.paddingRight="",D.paddingTopBottom="",D.paddingTop="",D.paddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},Ye=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{xe(L=>!L),ce&&(D.mobilePaddingLeftRight="",D.mobilePaddingLeft="",D.mobilePaddingRight="",D.mobilePaddingTopBottom="",D.mobilePaddingTop="",D.mobilePaddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobilePadding:{all:null,top:null,right:null,bottom:null,left:null,classNamePrefix:"em-mob-padding_"}}}))})};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_div_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",valign:"",border:"",boxShadow:"",show:"all",borderPosition:W.BORDER_POSITIONS[ie]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[je]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",borderRadiusAll:"",borderRadiusTopLeft:"",borderRadiusBottomLeft:"",borderRadiusTopRight:"",borderRadiusBottomRight:"",direction:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileAlign:"",mobileDirection:"",mobileVerticalAlign:"",mobileBackgroundColor:"",mobileBackgroundImage:"",mobilePaddingTop:"",mobilePaddingLeft:"",mobilePaddingRight:"",mobilePaddingBottom:""},onValuesChange:Se,autoComplete:"off",className:"element-controls",children:[!C&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),_==="mobile"&&E.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(dl,{form:s,elementSettings:e,mobileBoxShadow:k,mobileBordersShow:oe,mobileBorderRadiusShow:ue,mobileBoxShadowShow:ve,mobileSizeShow:re,mobileBackgroundShow:he,mobilePaddingShow:ce,mobilePaddingsExt:z,setMobilePaddingsExt:$,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:T,toggleShowMobileBorderHandler:Fe,toggleShowMobileBorderRadiusHandler:Ue,toggleShowMobileBoxShadowHandler:Te,toggleShowMobileSizeHandler:Z,toggleShowMobileBackgroundHandler:Ce,toggleShowMobilePaddingHandler:Ye})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(nl,{form:s,elementSettings:e,boxShadow:c,bordersShow:O,borderRadiusShow:q,boxShadowShow:se,backgroundShow:ae,backgroundImageEmpty:w,backgroundRepeatOptions:we,sizeShow:De,maxWidthValue:ne,modificationShow:ee,paddingShow:H,paddingsExt:P,oneBorderRadiusValue:f,setOneBorderRadiusValue:x,togglePaddingHandler:Ie,toggleShowPaddingHandler:Ge,toggleShowBorderHandler:Ne,toggleShowBorderRadiusHandler:Ve,toggleShowBoxShadowHandler:le,toggleShowSizeHandler:I,toggleShowBackgroundHandler:Be,toggleShowModificationHandler:Me,handleChangeValues:Se})})]})};cl.propTypes={elementSettings:g.default.object.isRequired};var ul=({form:e,elementSettings:i})=>{const{__:l}=r.useI18n(),s=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:"0"},children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Float block width"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"width",children:(0,o.jsx)(t.ui_kit$InputNumber,{min:0,placeholder:l("Float block width"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:(0,o.jsx)(t.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:$o})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Column gap"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gap",children:(0,o.jsx)(t.ui_kit$InputNumber,{min:0,placeholder:l("Column gap"),prefix:(0,o.jsx)(r.EmIcons,{icon:"SplitCellsOutlined",component:t.icons$SplitCellsOutlined}),addonAfter:(0,o.jsx)(t.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:an})})})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Vertical alignment"),dividerTop:!0,children:(0,o.jsx)(Mo,{form:e,elementSettings:i})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})}),s.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:l("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};ul.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired};var ml=({form:e,elementSettings:i})=>{const{__:l}=r.useI18n(),s=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:l("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:l("Appearance on mobile devices"),type:"info"})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:20},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(zo,{form:e,name:"mobileWidth",elementSettings:i})}),(0,o.jsx)(t.ui_kit$Col,{span:12})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Alignments"),dividerTop:!0,children:(0,o.jsx)(Mo,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})}),s.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:l("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};ml.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired};var Ii=0,pl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),a=r.useSelector(r.selectEmailViewType),d=r.useSelector(r.selectMobileViewActive),c=r.useSelector(r.selectIsCodeMode),p=r.useSelector(r.selectCodeModeDirection),f=c&&p!=="bottom";(0,n.useEffect)(()=>{e&&(s.setFieldsValue({...e,width:e.width?.value,widthDim:e.width?.dim,gap:e.gap?.value,gapDim:e.gap?.dim,maxWidth:e.maxWidth?.value,maxWidthDim:e.maxWidth?.dim,minWidth:e.minWidth?.value,minWidthDim:e.minWidth?.dim,show:e.show?e.show:"all",mobileWidth:po(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileContentWidth:po(e.mobileContentWidth?.value),mobileContentWidthDim:e.mobileContentWidth?.dim,mobileVerticalAlign:u(e.mobileVerticalAlign?.value)}),Ii=e.width.value+e.gap.value)},[s,e]);const x=k=>{const b=s.getFieldsValue(!0),h=Object.keys(k)[0];let T;switch(h){case"width":Ii=k[h]+b.gap,T={[h]:{value:k[h],dim:b.widthDim},gap:{value:b.gap}};break;case"widthDim":T={width:{value:b.width,dim:k[h]},gap:{value:b.gap}};break;case"gap":b.width=Ii-k[h],T={[h]:{value:k[h],dim:"px"}};break;case"mobileWidth":T={[h]:{classNamePrefix:"em-mob-width-",value:k[h],dim:b.mobileWidthDim}};break;case"mobileWidthDim":T={mobileWidth:{classNamePrefix:"em-mob-width-",value:b.mobileWidth||100,dim:k[h]}};break;case"mobileContentWidth":T={[h]:{classNamePrefix:"em-mob-width-",value:k[h],dim:b.mobileContentWidthDim}};break;case"mobileContentWidthDim":T={mobileContentWidth:{classNamePrefix:"em-mob-width-",value:100,dim:k[h]}};break;case"mobileVerticalAlign":T={[h]:{classNamePrefix:"em-mob-vertical_align-",value:k[h]}};break;default:T=k}l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:T})};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_float_block_form",initialValues:{width:{value:"",dim:""},gap:{value:"",dim:"px"},valign:"",show:"all",mobileWidth:"",mobileWidthDim:"",mobileContentWidth:"",mobileContentWidthDim:"",mobileVerticalAlign:""},onValuesChange:x,autoComplete:"off",className:"element-controls",children:[f&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),a==="mobile"&&d.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:a==="mobile"&&d.styles?"block":"none"},children:(0,o.jsx)(ml,{form:s,elementSettings:e})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(ul,{form:s,elementSettings:e})})]})};pl.propTypes={elementSettings:g.default.object.isRequired};var hl=({form:e,fillFields:i,elementSettings:l,boxShadow:s,bordersShow:a,borderRadiusShow:d,boxShadowShow:c,backgroundShow:p,backgroundImageEmpty:f,backgroundRepeatOptions:x,paddingShow:k,paddingsExt:b,maxWidthValue:h,oneBorderRadiusValue:T,setOneBorderRadiusValue:_,linkProtocol:E,linkTarget:w,isOpenTextReplacer:v,textReplacerButtonRef:A,textReplacerInputRef:j,handleLinkProtocolsChange:C,handleSelect:P,textReplacerInputHandler:Y,handleTextReplacerKeyDown:z,srcButtonHandler:$,togglePaddingHandler:O,toggleShowPaddingHandler:y,toggleShowBackgroundHandler:oe,toggleShowBorderHandler:G,toggleShowBorderRadiusHandler:q,toggleShowBoxShadowHandler:te,setLinkProtocol:ue,handleChangeValues:me})=>{const{__:se}=r.useI18n(),{token:_e}=(0,t.ui_kit$useToken)(),ve=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:se("Appearance on mobile devices"),type:"info"}),(0,o.jsxs)("div",{className:"selected_form-props-wrapper",children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Uo,{form:e,elementSettings:l})}),ve.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(it,{form:e,name:"textAlign",elementSettings:l})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}}),(0,o.jsx)(et,{show:E==="#",__:se,style:{marginBottom:_e.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:se("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:ve.formButtonFieldReplacerEnabled?_e.formItemMarginBottomXS:_e.formItemMarginBottomMD+4},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Zo,{linkProtocol:E,handleLinkProtocolsChange:C,__:se}),placeholder:se("Hyperlink URL"),allowClear:!0,onSelect:P,prefix:(0,o.jsx)(Qo,{linkProtocol:E})})})}),E==="mailto:"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"subject",style:{marginBottom:_e.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:se("Subject")})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:_e.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:se("Body")})})]}),ve.formButtonFieldReplacerEnabled&&(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:se("Text replacer"),placement:"bottom",getPopupContainer:de=>de.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":v}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:$,ref:A})})}),(0,o.jsx)(t.ui_kit$Col,{span:21,children:v&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:se("Text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textReplacer",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:se("The code that will replace this text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:se("Text")}),onChange:Y,onKeyDown:z,ref:j,onSelect:P})})})})]})}),ve.formButtonFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:se("Padding"),collapsible:!0,open:k,onToggle:y,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:b,onToggleExtended:O,gutter:_e.marginSM,labels:{horizontal:se("Horizontal padding"),vertical:se("Vertical padding"),left:se("Left padding"),right:se("Right padding"),top:se("Top padding"),bottom:se("Bottom padding"),individual:se("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:se("Size"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:h,dimensionSelect:$o,gutter:_e.marginSM,labels:{width:se("Width"),height:se("Height"),minWidth:se("Minimum width"),maxWidth:se("Maximum width")}})}),(0,o.jsx)(gt,{form:e,fillFields:i,elementSettings:l,showAddParagraph:!1,isButton:!0,setLinkProtocol:ue,linkProtocol:E,linkTarget:w}),(0,o.jsxs)(t.ui_kit$FormSection,{title:se("Background"),collapsible:!0,open:p,onToggle:oe,dividerTop:!0,children:[(0,o.jsx)(vi,{form:e,backgroundImageEmpty:f,appConfig:ve,token:_e,elementSettings:l,backgroundRepeatOptions:x,handleChangeValues:me}),(0,o.jsx)(rt,{form:e,showBackground:!0})]}),ve.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:se("Borders"),collapsible:!0,open:a,onToggle:G,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:l})}),ve.formFieldBorderRadiusEnabled&&(0,o.jsxs)(t.ui_kit$FormSection,{title:se("Border radius"),collapsible:!0,open:d,onToggle:q,dividerTop:!0,children:[(0,o.jsx)(So,{form:e,oneBorderRadiusValue:T,setOneBorderRadiusValue:_,elementSettings:l}),(0,o.jsx)(rt,{form:e,showRounding:!0})]}),ve.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:se("Box shadow"),collapsible:!0,open:c,onToggle:te,dividerTop:!0,children:(0,o.jsx)(jo,{})}),ve.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:se("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:l,form:e})}),ve.formFieldAmpVisibilityEnabled&&l.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:se("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})]})};hl.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,backgroundShow:g.default.bool,backgroundImageEmpty:g.default.bool,backgroundRepeatOptions:g.default.array,paddingShow:g.default.bool,paddingsExt:g.default.bool,maxWidthValue:g.default.oneOfType([g.default.string,g.default.number]),oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,linkProtocol:g.default.string,linkTarget:g.default.object,isOpenTextReplacer:g.default.bool,textReplacerButtonRef:g.default.object,textReplacerInputRef:g.default.object,handleLinkProtocolsChange:g.default.func,handleSelect:g.default.func,textReplacerInputHandler:g.default.func,handleTextReplacerKeyDown:g.default.func,srcButtonHandler:g.default.func,togglePaddingHandler:g.default.func,toggleShowPaddingHandler:g.default.func,toggleShowBackgroundHandler:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func,setLinkProtocol:g.default.func,handleChangeValues:g.default.func};var bl=({form:e,fillFields:i,elementSettings:l,boxShadow:s,mobileBordersShow:a,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:p,mobileBackgroundShow:f,mobilePaddingShow:x,mobilePaddingsExt:k,setMobilePaddingsExt:b,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:T,linkProtocol:_,handleLinkProtocolsChange:E,setLinkProtocol:w,toggleShowMobileBorderHandler:v,toggleShowMobileBorderRadiusHandler:A,toggleShowMobileBoxShadowHandler:j,toggleShowMobileSizeHandler:C,toggleShowMobileBackgroundHandler:P,toggleShowMobilePaddingHandler:Y})=>{const{__:z}=r.useI18n(),{token:$}=(0,t.ui_kit$useToken)(),O=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Uo,{form:e,elementSettings:l,imgParent:!0,typeOfForm:"mobile"})}),O.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Dt,{form:e,name:"mobileTextAlign",elementSettings:l,imgParent:!0})})]}),!!l.showOnMobile&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}}),(0,o.jsx)(et,{show:_==="#",__:z,style:{marginBottom:$.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:z("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:_==="mailto:"?$.formItemMarginBottomXS:$.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Zo,{linkProtocol:_,handleLinkProtocolsChange:E,__:z}),placeholder:z("Hyperlink URL"),allowClear:!0,prefix:(0,o.jsx)(Qo,{linkProtocol:_})})})}),_==="mailto:"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"subject",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:z("Subject")})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:$.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:z("Body")})})]})]}),!!l.showOnMobile&&(0,o.jsx)(gt,{form:e,fillFields:i,elementSettings:l,setLinkProtocol:w,linkProtocol:_,showAddParagraph:!1,isButton:!0}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Mr,{})})}),O.formButtonFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:z("Padding"),collapsible:!0,open:x,onToggle:Y,dividerTop:!0,children:(0,o.jsx)(Wt,{form:e,elementSettings:l,mobilePaddingsExt:k,setMobilePaddingsExt:b})}),(0,o.jsx)(t.ui_kit$FormSection,{title:z("Size"),collapsible:!0,open:p,onToggle:C,dividerTop:!0,bodyStyle:{paddingBottom:$.formItemMarginBottomMD},children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:z("Width"),placement:"bottom",children:(0,o.jsx)(zo,{form:e,name:"mobileWidth",elementSettings:l})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:z("Height"),placement:"bottom",children:(0,o.jsx)(tt,{form:e,name:"mobileHeight",elementSettings:l})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:z("Background"),collapsible:!0,open:f,onToggle:P,dividerTop:!0,bodyStyle:{paddingBottom:$.formItemMarginBottomMD},children:(0,o.jsx)(Bt,{elementSettings:Go(l),imageEnabled:O.formButtonFieldBackgroundImageEnabled,desktopBackground:xt(l)})}),O.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:z("Borders"),collapsible:!0,open:a,onToggle:v,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),O.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:z("Border radius"),collapsible:!0,open:d,onToggle:A,dividerTop:!0,children:(0,o.jsx)(So,{form:e,oneBorderRadiusValue:h,setOneBorderRadiusValue:T,elementSettings:l,typeOfForm:"mobile"})}),O.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:z("Box shadow"),collapsible:!0,open:c,onToggle:j,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile"})}),O.formFieldAmpVisibilityEnabled&&l.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:z("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})}),O.formFieldAmpVisibilityEnabled&&l.isAmp&&(0,o.jsx)(t.ui_kit$FormSection,{title:z("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};bl.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,mobilePaddingShow:g.default.bool,mobilePaddingsExt:g.default.bool,setMobilePaddingsExt:g.default.func,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,linkProtocol:g.default.string,handleLinkProtocolsChange:g.default.func,setLinkProtocol:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func,toggleShowMobileBackgroundHandler:g.default.func,toggleShowMobilePaddingHandler:g.default.func};var fl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),a=Fo(),d=Fo(),c=r.useDispatch(),[p,f]=(0,n.useState)({}),[x,k]=(0,n.useState)(!0),[b,h]=(0,n.useState)(!0),T=r.useSelector(r.selectEmailViewType),_=r.useSelector(r.selectMobileViewActive),[E,w]=(0,n.useState)(e.backgroundImage?.[0].value===""),v=r.useSelector(r.selectIsCodeMode),A=r.useSelector(r.selectCodeModeDirection),j=v&&A!=="bottom",C=(0,n.useRef)(null),P=(0,n.useRef)(null),[Y,z]=(0,n.useState)(!1),[$,O]=(0,n.useState)(!1),[y,oe]=(0,n.useState)(!1),[G,q]=(0,n.useState)(!1),[te,ue]=(0,n.useState)(!1),[me,se]=(0,n.useState)(!1),[_e,ve]=(0,n.useState)(!1),[de,De]=(0,n.useState)(!1),[ye,re]=(0,n.useState)(!1),[ke,ae]=(0,n.useState)(!1),[Q,he]=(0,n.useState)(!1),[pe,ee]=(0,n.useState)(!1),[J,H]=(0,n.useState)(!1),[X,ce]=(0,n.useState)(""),[xe,ne]=(0,n.useState)("https://"),[Ae,we]=(0,n.useState)({}),$e=e,[K,ie]=(0,n.useState)(!!$e.textReplacer?.length),[je,V]=(0,n.useState)(e);e!==je&&(V(e),ie(!!$e.textReplacer?.length));const Se=r.useElementEntityKind(),Ie=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],Ne=e.border,Fe=e.mobileBorder,Ve=Object.keys(Ne).find(S=>Ne[S]?.width||Ne[S]?.style||Ne[S]?.color),Ue=Object.keys(Fe).find(S=>Fe[S]?.width||Fe[S]?.style||Fe[S]?.color),le=S=>S&&(S?.width||S?.style||S?.color)?S:"",{remember:Te,fillFields:I}=st(e);(0,n.useEffect)(()=>{if(e){const S=e.boxShadow||{},m=e.mobilePadding||{},M=e.mobileAlign||{};f(S);let U="",Re="",be=e.href||"https://";if(e.href){if(e.href.startsWith("mailto:")){const so=Pr(e.href);U=so.subject,Re=so.body,be=so.baseEmail}Wo(e.href,ne)}I(s,{...e,href:be,subject:U,body:Re,width:e.width?.value,widthDim:e.width?.dim,height:e.height?.value,heightDim:e.height?.dim,backgroundImage:e.backgroundImage?.[0].value,show:e.show?e.show:"all",textAlign:e.textAlign,borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),mobileBorderAll:le(e.mobileBorder.all)||!(le(e.mobileBorder.top)||le(e.mobileBorder.bottom)||le(e.mobileBorder.right)||le(e.mobileBorder.left))&&le(e.border.all),mobileBorderTop:le(e.mobileBorder.top)||!le(e.mobileBorder.all)&&le(e.border.top),mobileBorderBottom:le(e.mobileBorder.bottom)||!le(e.mobileBorder.all)&&le(e.border.bottom),mobileBorderRight:le(e.mobileBorder.right)||!le(e.mobileBorder.all)&&le(e.border.right),mobileBorderLeft:le(e.mobileBorder.left)||!le(e.mobileBorder.all)&&le(e.border.left),paddingTop:u(e.padding?.all)||u(e.padding?.top),paddingLeft:u(e.padding?.all)||u(e.padding?.left),paddingRight:u(e.padding?.all)||u(e.padding?.right),paddingBottom:u(e.padding?.all)||u(e.padding?.bottom),paddingLeftRight:u(e.padding?.left)||u(e.padding?.right),paddingTopBottom:u(e.padding?.top)||u(e.padding?.bottom),borderRadiusAll:u(e.borderRadius?.all),borderRadiusTopLeft:u(e.borderRadius?.topLeft),borderRadiusBottomLeft:u(e.borderRadius?.bottomLeft),borderRadiusTopRight:u(e.borderRadius?.topRight),borderRadiusBottomRight:u(e.borderRadius?.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:po(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:po(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:po(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:po(e.mobileHeight?.value)?e.mobileHeight?.dim:e.height?.dim,mobileBorderRadiusAll:u(e.mobileBorderRadius?.all)||u(e.borderRadius?.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius?.topLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topLeft)||u(e.borderRadius?.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius?.bottomLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomLeft)||u(e.borderRadius?.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius?.topRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topRight)||u(e.borderRadius?.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius?.bottomRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomRight)||u(e.borderRadius?.all),mobileBoxShadowInset:e.mobileBoxShadow?.inset!=null?e.mobileBoxShadow.inset:e.boxShadow?.inset||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset)||u(e.boxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset)||u(e.boxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius)||u(e.boxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius)||u(e.boxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color)||u(e.boxShadow?.color),mobileAlign:u(M?.value)||e.align,mobileVerticalAlign:u(e.mobileVerticalAlign?.value||e.valign),mobileBackgroundColor:u(e.mobileBackgroundColor?.value||e.backgroundColor||""),...nt(e),mobilePaddingTop:u(m.all)||u(m.top)||u(e.padding?.all)||u(e.padding?.top),mobilePaddingLeft:u(m.all)||u(m.left)||u(e.padding?.all)||u(e.padding?.left),mobilePaddingRight:u(m.all)||u(m.right)||u(e.padding?.all)||u(e.padding?.right),mobilePaddingBottom:u(m.all)||u(m.bottom)||u(e.padding?.all)||u(e.padding?.bottom),mobilePaddingTopBottom:u(m.top)||u(m.bottom)||u(e.padding?.top)||u(e.padding?.bottom),mobilePaddingLeftRight:u(m.left)||u(m.right)||u(e.padding?.left)||u(e.padding?.right),mobileTextAlign:Ar(e.mobileTextAlign,e.textAlign),exportAsPicture:e?.exportAsPicture,mobileFontSize:u(e.mobileFontSize?.value||e.fontSize)}),!u(e.borderRadius?.all)&&(u(e.borderRadius?.topLeft)||u(e.borderRadius?.bottomLeft)||u(e.borderRadius?.topRight)||u(e.borderRadius?.bottomRight))?k(!1):k(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||!u(e.borderRadius.all)&&!u(e.mobileBorderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?h(!1):h(!0),w(e.backgroundImage?.[0].value===""),!u(e.padding?.all)&&(u(e.padding?.top)||u(e.padding?.right)||u(e.padding?.bottom)||u(e.padding?.left))&&(e.padding?.top!==e.padding?.bottom||e.padding?.right!==e.padding?.left)?z(!1):z(!0),!u(m.all)&&(u(m.top)||u(m.right)||u(m.bottom)||u(m.left))&&(m.top!==m.bottom||m.right!==m.left)||!u(e.padding?.all)&&(u(e.padding?.top)||u(e.padding?.right)||u(e.padding?.bottom)||u(e.padding?.left))&&(e.padding?.top!==e.padding?.bottom||e.padding?.right!==e.padding?.left)?O(!1):O(!0);const ze=a.isStaleBorderSnapshot(e,!!Ve),co=d.isStaleBorderSnapshot(e,!!Ue);ze&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(co||ze&&!Ue)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),oe(so=>Ve&&!ze?!0:so),q(so=>Ve&&!ze||Ue&&!co?!0:so),ue(!!e.borderRadius?.all||!!e.borderRadius?.topLeft||!!e.borderRadius?.bottomLeft||!!e.borderRadius?.topRight||!!e.borderRadius?.bottomRight),se(!!e.mobileBorderRadius?.all||!!e.mobileBorderRadius?.topLeft||!!e.mobileBorderRadius?.bottomLeft||!!e.mobileBorderRadius?.topRight||!!e.mobileBorderRadius?.bottomRight||!!e.borderRadius?.all||!!e.borderRadius?.topLeft||!!e.borderRadius?.bottomLeft||!!e.borderRadius?.topRight||!!e.borderRadius?.bottomRight),ve(!!e.boxShadow),De(!!e.mobileBoxShadow?.blurRadius||!!e.mobileBoxShadow?.color||!!e.mobileBoxShadow?.hOffset||!!e.mobileBoxShadow?.inset||!!e.mobileBoxShadow?.spreadRadius||!!e.mobileBoxShadow?.vOffset||!!e.boxShadow),re(!!e.mobileWidth?.value||!!e.mobileHeight?.value||!!e.width.value||!!e.height.value),ae(!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),he(!!e.mobileBackgroundColor?.value||!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),kt(e)&&he(!0),ee(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),H(!!e.mobilePadding?.all||!!e.mobilePadding?.top||!!e.mobilePadding?.bottom||!!e.mobilePadding?.left||!!e.mobilePadding?.right||!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right)}},[s,e,j,Ve,Ue,a,d,I]);const Z=(0,n.useCallback)(S=>{Te(S),c(Se==="email"?r.setElementSettings$1(S):r.setElementSettings(S))},[c,Se,Te]),Be=S=>{const m=s.getFieldsValue(!0),M=Object.keys(S)[0];let U;switch(ce(s.getFieldsValue(!0).widthDim==="%"?100:""),M){case"exportAsPicture":U={exportAsPicture:m.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":U={boxShadow:{hOffset:m.boxShadowHOffset,vOffset:m.boxShadowVOffset,blurRadius:m.boxShadowBlurRadius,spreadRadius:m.boxShadowSpreadRadius,color:m.boxShadowColor,inset:m.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":m.borderPosition==="borderAll"?(U={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...m.borderAll}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):m.borderAll?.width||m.borderAll?.style||m.borderAll?.color?(U={border:{all:null,left:m.borderAll,right:m.borderAll,top:m.borderAll,bottom:m.borderAll,[W.REVERSE_BORDER_POSITIONS[M]]:{...m[M],...S[M]}}},s.setFieldsValue({borderAll:null,borderLeft:m.borderAll,borderRight:m.borderAll,borderTop:m.borderAll,borderBottom:m.borderAll,[M]:{...m[M],...S[M]}})):(U={border:{all:null,left:m.borderLeft,right:m.borderRight,top:m.borderTop,bottom:m.borderBottom,[W.REVERSE_BORDER_POSITIONS[M]]:{...m[M],...S[M]}}},s.setFieldsValue({border:U.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(m.mobileBorderPosition==="mobileBorderAll")U={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...m.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[M]+"-"}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const ze=W.MOBILE_REVERSE_BORDER_POSITIONS[M],co={...m[M],...S[M]},so=!co?.width&&!co?.style&&!co?.color;if(m.mobileBorder?.all?.width||m.mobileBorder?.all?.style||m.mobileBorder?.all?.color){const mo=m.mobileBorderAll;U={mobileBorder:{all:null,left:mo,right:mo,top:mo,bottom:mo,[ze]:so?null:{...co,classNamePrefix:"em-mob-border_"+ze+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:mo,mobileBorderRight:mo,mobileBorderTop:mo,mobileBorderBottom:mo,[M]:co})}else{const mo=e.mobileBorder||{},ko=qo=>{const Co=mo[qo];return Co&&(Co?.width||Co?.style||Co?.color)?Co:null};U={mobileBorder:{all:null,left:ze==="left"?so?null:{...co,classNamePrefix:"em-mob-border_left-"}:ko("left"),right:ze==="right"?so?null:{...co,classNamePrefix:"em-mob-border_right-"}:ko("right"),top:ze==="top"?so?null:{...co,classNamePrefix:"em-mob-border_top-"}:ko("top"),bottom:ze==="bottom"?so?null:{...co,classNamePrefix:"em-mob-border_bottom-"}:ko("bottom")}},s.setFieldsValue({[M]:co})}}break;case"width":U={[M]:{value:S[M],dim:m.widthDim}};break;case"height":U={[M]:{value:S[M],dim:m.heightDim}};break;case"widthDim":U={width:{value:m.width,dim:S[M]}};break;case"heightDim":U={height:{value:m.height,dim:S[M]}};break;case"backgroundImage":w(S[M]===""),U={[M]:[{...e.backgroundImage[0],value:S[M]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":U={padding:{left:m.paddingLeft,right:m.paddingRight,top:m.paddingTop,bottom:m.paddingBottom,[W.PADDING_POSITION[M]]:+S[M]}};break;case"paddingTopBottom":U={padding:{left:m.paddingLeft,right:m.paddingRight,top:+S[M],bottom:+S[M]}},m.paddingTop=m.paddingBottom=+S[M];break;case"paddingLeftRight":U={padding:{top:m.paddingTop,bottom:m.paddingBottom,left:+S[M],right:+S[M]}},m.paddingLeft=m.paddingRight=+S[M];break;case"borderRadiusAll":U={borderRadius:{[W.BORDER_RADIUS_POSITION[M]]:+S[M]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":U={borderRadius:{topLeft:m.borderRadiusTopLeft,bottomLeft:m.borderRadiusBottomLeft,topRight:m.borderRadiusTopRight,bottomRight:m.borderRadiusBottomRight,[W.BORDER_RADIUS_POSITION[M]]:+S[M]}};break;case"mobileWidth":U={[M]:{classNamePrefix:"em-mob-width-",value:S[M],dim:m.mobileWidthDim}};break;case"mobileWidthDim":U={mobileWidth:{classNamePrefix:"em-mob-width-",value:m.mobileWidth||100,dim:S[M]}};break;case"mobileHeight":U={[M]:{classNamePrefix:"em-mob-height-",value:S[M],dim:m.mobileHeightDim},mobileLineHeight:{classNamePrefix:"em-mob-line_height-",value:S[M],dim:m.mobileHeightDim}};break;case"mobileHeightDim":U={mobileHeight:{classNamePrefix:"em-mob-height-",value:m.mobileHeight,dim:S[M]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":U={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[M]]:S[M],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[M]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":U={mobileBoxShadow:{hOffset:m.mobileBoxShadowHOffset,vOffset:m.mobileBoxShadowVOffset,blurRadius:m.mobileBoxShadowBlurRadius,spreadRadius:m.mobileBoxShadowSpreadRadius,color:m.mobileBoxShadowColor,inset:m.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":U={[M]:{classNamePrefix:"em-mob-table_align-",value:S[M]}};break;case"mobileTextAlign":U={[M]:{classNamePrefix:"em-mob-text_align-",value:S[M]}};break;case"mobileVerticalAlign":U={[M]:{classNamePrefix:"em-mob-vertical_align-",value:S[M]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(U=_t(S),!U)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":U={mobilePadding:{all:null,top:m.mobilePaddingTop!==""?m.mobilePaddingTop:null,right:m.mobilePaddingRight!==""?m.mobilePaddingRight:null,bottom:m.mobilePaddingBottom!==""?m.mobilePaddingBottom:null,left:m.mobilePaddingLeft!==""?m.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":m.mobilePaddingTop=m.mobilePaddingBottom=S[M],U={mobilePadding:{all:null,top:m.mobilePaddingTop!==""?m.mobilePaddingTop:null,right:m.mobilePaddingRight!==""?m.mobilePaddingRight:null,bottom:m.mobilePaddingBottom!==""?m.mobilePaddingBottom:null,left:m.mobilePaddingLeft!==""?m.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":m.mobilePaddingLeft=m.mobilePaddingRight=S[M],U={mobilePadding:{all:null,top:m.mobilePaddingTop!==""?m.mobilePaddingTop:null,right:m.mobilePaddingRight!==""?m.mobilePaddingRight:null,bottom:m.mobilePaddingBottom!==""?m.mobilePaddingBottom:null,left:m.mobilePaddingLeft!==""?m.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileFontSize":U={[M]:{classNamePrefix:"em-mob-font_size-",value:S[M],dim:m.mobileFontSizeDim}};break;case"href":let Re=ot(S[M]);Re!==S[M]&&(s.setFieldValue("href",Re),m.href=Re),Re.startsWith("mailto:")?U={[M]:Si(Re,m.subject,m.body)}:U={[M]:Re},Wo(S[M],ne);break;case"subject":case"body":const be=m.href||"";if(be.startsWith("mailto:")){const ze=M==="subject"?S[M]:m.subject,co=M==="body"?S[M]:m.body;U={href:Si(be,ze,co)}}else return;break;case"backgroundPositionX":case"backgroundPositionY":U={[M]:isNaN(parseFloat(S[M].position))?S[M].position:S[M].position+S[M].unit};break;default:U=S}M!=="borderPosition"&&M!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:U}),M!=="mobileBorderRadiusAll"&&M!=="mobileBorderRadiusTopLeft"&&M!=="mobileBorderRadiusTopRight"&&M!=="mobileBorderRadiusBottomLeft"&&M!=="mobileBorderRadiusBottomRight"&&Z({...e,...U,mobileBorderRadius:{...e.mobileBorderRadius,...U?.mobileBorderRadius},activateSection:null,changeKey:M}))},Ce=()=>{z(m=>!m);const S=s.getFieldsValue(!0);Y||(S.paddingLeftRight=S.paddingLeft,S.paddingTopBottom=S.paddingTop,S.paddingRight=S.paddingLeft,S.paddingBottom=S.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:S.paddingTopBottom,bottom:S.paddingTopBottom,left:S.paddingLeftRight,right:S.paddingLeftRight}}}))},Me=()=>{const S=s.getFieldsValue(!0);a.markBorderToggled(!y),setTimeout(()=>{oe(m=>!m),y?(S.borderAll=W.NULL_BORDER,S.borderTop=W.NULL_BORDER,S.borderBottom=W.NULL_BORDER,S.borderRight=W.NULL_BORDER,S.borderLeft=W.NULL_BORDER):S.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:S.borderAll.color,style:S.borderAll.style,width:S.borderAll.width}}}})})},Ge=()=>{const S=s.getFieldsValue(!0);d.markBorderToggled(!G),setTimeout(()=>{q(m=>!m),G?(S.mobileBorderAll=W.NULL_BORDER,S.mobileBorderTop=W.NULL_BORDER,S.mobileBorderBottom=W.NULL_BORDER,S.mobileBorderRight=W.NULL_BORDER,S.mobileBorderLeft=W.NULL_BORDER):S.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:S.mobileBorderAll.color,style:S.mobileBorderAll.style,width:S.mobileBorderAll.width}}}})})},Ye=()=>{const S=s.getFieldsValue(!0);setTimeout(()=>{ue(m=>!m),te?(S.borderRadiusAll=0,k(!0)):S.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:S.borderRadiusAll}}})})},D=()=>{const S=s.getFieldsValue(!0);setTimeout(()=>{se(m=>!m),me?(S.mobileBorderRadiusAll=null,h(!0)):S.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:S.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},L=()=>{const S=s.getFieldsValue(!0);setTimeout(()=>{ve(m=>!m),_e?(S.boxShadowInset=!1,S.boxShadowHOffset=null,S.boxShadowVOffset=null,S.boxShadowBlurRadius=null,S.boxShadowSpreadRadius=null,S.boxShadowColor=""):(S.boxShadowInset=!1,S.boxShadowHOffset=5,S.boxShadowVOffset=5,S.boxShadowBlurRadius=10,S.boxShadowSpreadRadius=-5,S.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:S.boxShadowBlurRadius,color:S.boxShadowColor,hOffset:S.boxShadowHOffset,inset:S.boxShadowInset,spreadRadius:S.boxShadowSpreadRadius,vOffset:S.boxShadowVOffset}}})})},R=()=>{const S=s.getFieldsValue(!0);setTimeout(()=>{De(m=>!m),de?(S.mobileBoxShadowInset=!1,S.mobileBoxShadowHOffset=null,S.mobileBoxShadowVOffset=null,S.mobileBoxShadowBlurRadius=null,S.mobileBoxShadowSpreadRadius=null,S.mobileBoxShadowColor=""):(S.mobileBoxShadowInset=!1,S.mobileBoxShadowHOffset=5,S.mobileBoxShadowVOffset=5,S.mobileBoxShadowBlurRadius=10,S.mobileBoxShadowSpreadRadius=-5,S.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:S.mobileBoxShadowBlurRadius,color:S.mobileBoxShadowColor,hOffset:S.mobileBoxShadowHOffset,inset:S.mobileBoxShadowInset,spreadRadius:S.mobileBoxShadowSpreadRadius,vOffset:S.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},F=()=>{const S=s.getFieldsValue(!0);setTimeout(()=>{re(m=>!m),ye&&(S.mobileWidth="",S.mobileHeight="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"},mobileHeight:{value:null,dim:"px",classNamePrefix:"em-mob-height-"}}}))})},fe=()=>{const S=s.getFieldsValue(!0);setTimeout(()=>{ae(m=>!m),ke?(S.backgroundColor="",S.backgroundImage="",S.backgroundPositionX="",S.backgroundPositionY="",S.backgroundRepeat="none",S.backgroundSize="",w(!0)):(S.backgroundColor="#E5E5E5",S.backgroundSize="",S.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:S.backgroundColor,backgroundImage:[{type:"url",value:S.backgroundImage}],backgroundPositionX:S.backgroundPositionX,backgroundPositionY:S.backgroundPositionY,backgroundRepeat:S.backgroundRepeat,backgroundSize:S.backgroundSize}})})},Le=()=>{const S=s.getFieldsValue(!0);setTimeout(()=>{he(m=>!m),Q?S.mobileBackgroundColor="":S.mobileBackgroundColor=e.commonStyles.buttons.backgroundColor||"#1C52DC",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:S.mobileBackgroundColor}}}),Q&&Et(s,e,l)})},eo=()=>{const S=s.getFieldsValue(!0);setTimeout(()=>{ee(m=>!m),pe&&(S.paddingLeftRight="",S.paddingLeft="",S.paddingRight="",S.paddingTopBottom="",S.paddingTop="",S.paddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},Xe=()=>{const S=s.getFieldsValue(!0);setTimeout(()=>{H(m=>!m),J&&(S.mobilePaddingLeftRight="",S.mobilePaddingLeft="",S.mobilePaddingRight="",S.mobilePaddingTopBottom="",S.mobilePaddingTop="",S.mobilePaddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobilePadding:{all:null,top:null,right:null,bottom:null,left:null,classNamePrefix:"em-mob-padding_"}}}))})},lo=S=>{s.setFieldValue("href",S!=="mergetag"?S:""),ne(S)},Qe=({target:S})=>{const{selectionStart:m,selectionEnd:M}=S;S&&we({target:S,selection:{start:m,end:M}})},uo=S=>{S.target.value!==""&&P.current.classList.add("selected-td-form__button--active")},Eo=()=>{ie(!K),K?(s.setFieldValue("textReplacer",""),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{textReplacer:""}})):setTimeout(()=>C.current.focus())},B=S=>{const m=S.target,M=m.value,U=m.selectionStart;if(U===0&&S.key===" "){S.preventDefault();return}if(S.key===" "){if(U!==M.length){S.preventDefault();return}M.endsWith(" ")&&S.preventDefault()}};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_button_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",align:"",valign:"",border:"",boxShadow:"",show:"all",borderPosition:W.BORDER_POSITIONS[Ve]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[Ue]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileAlign:"",mobileVerticalAlign:"",mobileBackgroundColor:"",mobileBackgroundImage:"",mobilePaddingTop:"",mobilePaddingLeft:"",mobilePaddingRight:"",mobilePaddingBottom:"",borderRadiusTopLeft:"",borderRadiusBottomLeft:"",borderRadiusTopRight:"",borderRadiusBottomRight:"",href:"https://",subject:"",body:""},onValuesChange:Be,autoComplete:"off",className:"element-controls",children:[!j&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),j?(0,o.jsx)(Ri,{form:s,elementSettings:e,showAddParagraph:!1,isButton:!0}):(0,o.jsx)(o.Fragment,{children:T==="mobile"&&_.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(bl,{form:s,fillFields:I,elementSettings:e,boxShadow:p,mobileBordersShow:G,mobileBorderRadiusShow:me,mobileBoxShadowShow:de,mobileSizeShow:ye,mobileBackgroundShow:Q,mobilePaddingShow:J,mobilePaddingsExt:$,setMobilePaddingsExt:O,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:h,linkProtocol:xe,handleLinkProtocolsChange:lo,setLinkProtocol:ne,toggleShowMobileBorderHandler:Ge,toggleShowMobileBorderRadiusHandler:D,toggleShowMobileBoxShadowHandler:R,toggleShowMobileSizeHandler:F,toggleShowMobileBackgroundHandler:Le,toggleShowMobilePaddingHandler:Xe})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(hl,{form:s,fillFields:I,elementSettings:e,boxShadow:p,bordersShow:y,borderRadiusShow:te,boxShadowShow:_e,backgroundShow:ke,backgroundImageEmpty:E,backgroundRepeatOptions:Ie,paddingShow:pe,paddingsExt:Y,maxWidthValue:X,oneBorderRadiusValue:x,setOneBorderRadiusValue:k,linkProtocol:xe,linkTarget:Ae,isOpenTextReplacer:K,textReplacerButtonRef:P,textReplacerInputRef:C,handleLinkProtocolsChange:lo,handleSelect:Qe,textReplacerInputHandler:uo,handleTextReplacerKeyDown:B,srcButtonHandler:Eo,togglePaddingHandler:Ce,toggleShowPaddingHandler:eo,toggleShowBackgroundHandler:fe,toggleShowBorderHandler:Me,toggleShowBorderRadiusHandler:Ye,toggleShowBoxShadowHandler:L,setLinkProtocol:ne,handleChangeValues:Be})})})]})};fl.propTypes={elementSettings:g.default.object.isRequired};var gl=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm(),s=r.useSendPostMessage();(0,n.useEffect)(()=>{e&&l.setFieldsValue({...e})},[l,e]);const a=d=>{s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:d})};return(0,o.jsx)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_variable_form",initialValues:{value:""},onValuesChange:a,autoComplete:"off",children:(0,o.jsx)(t.ui_kit$Form.Item,{label:i("Variable value"),name:"value",tooltip:{title:i("Type the output parameters of your platform. E.g., ")+"${Recipient.FirstName}",icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},style:{marginBottom:35},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:4,placeholder:i("Variable value")})})})};gl.propTypes={elementSettings:g.default.object.isRequired};var _l=({elementSettings:e,setElementSettings:i,postfix:l="",form:s,handleSelect:a,previewReloadSignal:d})=>{const{__:c}=r.useI18n(),{token:p}=(0,t.ui_kit$useToken)(),f=r.useAppConfig(),x=r.useSendPostMessage(),k="src"+l,b="title"+l,h="alt"+l,T="link"+l,_="imgReplacer"+l,E=(0,n.useRef)(null),w=(0,n.useRef)(null),v=(0,n.useRef)(null),A=(0,n.useRef)(null),j=(0,n.useRef)(null),C=(0,n.useRef)(null),P=(0,n.useRef)(null),Y=(0,n.useRef)(null),[z,$]=(0,n.useState)(""),[O,y]=(0,n.useState)(""),[oe,G]=(0,n.useState)(""),[q,te]=(0,n.useState)(!1),[ue,me]=(0,n.useState)("https://"),se=(0,n.useRef)(!1),_e=(0,n.useRef)(l);(0,n.useEffect)(()=>{l!==_e.current&&(_e.current=l,se.current=!1),y(e.images?.[h]),G(e.images?.[b]);const ee=e.images?.[T];$(ee||(se.current?"...":""))},[e,h,b,T,l]);const ve=()=>{z?(se.current=!1,$(""),s.setFieldValue(T,""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[T]:""}})):(se.current=!0,$(E.current&&E.current.input.value?E.current.input.value:"..."),setTimeout(()=>{E.current.focus()}))},de=ee=>{ee.target.value===""?$("..."):(w.current.classList.add("selected-td-form__button--active"),$(ee.target.value));const J=ee.target.value;Wo(J,me)},De=()=>{O?(y(""),s.setFieldValue("alt",""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[h]:""}})):(y(v.current&&v.current.input.value?v.current.input.value:"..."),setTimeout(()=>{v.current.focus()}))},ye=ee=>{ee.target.value===""?y("..."):(A.current.classList.add("selected-td-form__button--active"),y(ee.target.value))},re=()=>{oe?(G(!1),s.setFieldValue("title",""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[b]:""}})):(G(j.current&&j.current.input.value?j.current.input.value:"..."),setTimeout(()=>{j.current.focus()}))},ke=()=>{te(!q),q?(s.setFieldValue(_,""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[_]:""}})):setTimeout(()=>P.current.focus())},ae=ee=>{ee.target.value!==""&&Y.current.classList.add("selected-td-form__button--active")},Q=ee=>{ee.target.value===""?G("..."):(C.current.classList.add("selected-td-form__button--active"),G(ee.target.value))},he=ee=>{s.setFieldValue("LinkName",ee!=="mergetag"?ee:""),me(ee)},pe=ee=>{const J=s.getFieldsValue(!0),H=+l.substring(1),X=Object.keys(J?.images).reduce((xe,ne)=>(ne.includes(l)||(xe[ne]=J[ne]),xe),{}),ce=e.carouselImages?.filter((xe,ne)=>ne!==H);i(xe=>({...xe,settings:{...xe.settings,carouselImages:ce}})),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:e.caption,settings:{...e,carouselImages:ce}}),s.setFieldsValue({images:X})};return(0,o.jsxs)(o.Fragment,{children:[(e.type==="img"||e.type==="video"||e.type==="carousel")&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,o.jsx)(No,{form:s,label:c("Image path"),name:k,placeholder:c("Image path"),elementSettings:e,previewReloadSignal:d,tooltipTitle:""})}),(0,o.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:O||c("Alternative text"),placement:"bottom",getPopupContainer:ee=>ee.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":!!O}),onClick:De,ref:A,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),f.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:oe||c("Tooltip text"),placement:"bottom",getPopupContainer:ee=>ee.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":!!oe}),onClick:re,ref:C,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:z||c("Hyperlink URL"),placement:"bottom",getPopupContainer:ee=>ee.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":!!z}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:ve,ref:w})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:c("Image replacer"),placement:"bottom",getPopupContainer:ee=>ee.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":q}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:ke,ref:Y})})]}),(0,o.jsx)(t.ui_kit$Space,{size:8,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:c("Remove slide"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{type:"text",onClick:pe,icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16})})})})]}),(!!z||!!O||!!oe||!!q)&&(0,o.jsxs)("div",{children:[!!z&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(et,{show:ue==="#",__:c,style:{marginBottom:p.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:T,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Zo,{linkProtocol:ue,handleLinkProtocolsChange:he,__:c}),placeholder:c("Hyperlink URL"),allowClear:!0,ref:E,onChange:de,onSelect:a,prefix:(0,o.jsx)(Qo,{linkProtocol:ue})})})})]}),!!O&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:h,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:c("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:ye,ref:v,onSelect:a})})}),f.formFieldImageTitleEnabled&&!!oe&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:b,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:c("Enter the title of the image"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:Q,ref:j,onSelect:a})})}),!!q&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Image src"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:_,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:c("Code that will replace the image `src`"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:c("Image src")}),onChange:ae,ref:P,onSelect:a})})})]})]})};_l.propTypes={};var xl=({form:e,elementSettings:i,formFields:l,setElementSettings:s,borderRadiusShow:a,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,linkProtocol:p,mergeTagItems:f,mergeMenuOpen:x,setMergeMenuOpen:k,cascaderRef:b,handleLinkProtocolsChange:h,handleSelect:T,onChange:_,filter:E,renderSearchOption:w,toggleShowBorderRadiusHandler:v,setNewSlide:A})=>{const{__:j}=r.useI18n(),{token:C}=(0,t.ui_kit$useToken)(),P=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(et,{show:p==="#",__:j,style:{marginBottom:C.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:j("Link for all slides"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Zo,{linkProtocol:p,handleLinkProtocolsChange:h,__:j}),placeholder:j("Link for all slides"),allowClear:!0,onSelect:T,prefix:(0,o.jsx)(Qo,{linkProtocol:p})})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),P.mergeTagsShow&&f&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Col,{span:24,id:"merge_tags_wrapper",children:(0,o.jsxs)(t.ui_kit$Form.Item,{style:{marginBottom:C.formItemMarginBottomMD,marginTop:C.formItemMarginBottomMD},children:[(0,o.jsx)(t.ui_kit$Button,{id:"merge_tags_button",icon:(0,o.jsx)(r.EmIcons,{icon:"MergeTags",component:t.icons$MergeTags}),style:{width:"100%",display:x?"none":"inline-flex"},onClick:()=>k(!0),children:j("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:b,classNames:{popup:{root:"merge-tags"}},options:f,placeholder:j("Start typing the title"),showSearch:{filter:E,render:w},spellCheck:"false",getPopupContainer:Y=>Y.closest(".email-pane__collapse-wrapper"),onChange:_,style:{display:x?"block":"none"},open:x,onKeyDown:Y=>{Y.key==="Escape"&&k(!1)}})]})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"})]}),(0,o.jsx)(t.ui_kit$Form.List,{name:"images",initialValue:l?.images,children:()=>(0,o.jsx)("div",{style:{paddingTop:C.formItemMarginBottomMD+4},children:i?.settings?.carouselImages?.map((Y,z)=>(0,o.jsx)("div",{className:"carousel__slide",children:(0,o.jsx)(_l,{elementSettings:l,setElementSettings:s,postfix:"_"+z,form:e,handleSelect:T})},z))})}),(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:C.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Button,{id:"add_slide_button",icon:(0,o.jsx)(r.EmIcons,{icon:"AddSlide",component:t.icons$AddSlide}),style:{width:"100%"},onClick:()=>A(),children:j("Add slide")})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{marginTop:C.formItemMarginBottomMD-10},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"loop",valuePropName:"checked",style:{marginBottom:C.formItemMarginBottomMD-6},children:(0,o.jsx)(t.ui_kit$Switch,{id:"Loop",label:j("Loop"),size:"small",labelStyle:{position:"relative",top:2}})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"autoplay",valuePropName:"checked",style:{marginBottom:C.formItemMarginBottomMD-6},children:(0,o.jsx)(t.ui_kit$Switch,{id:"Autoplay",label:j("Autoplay"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),P.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Border radius"),collapsible:!0,open:a,onToggle:v,dividerTop:!0,children:(0,o.jsx)(So,{form:e,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,elementSettings:i.settings})})]})};xl.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,formFields:g.default.object,setElementSettings:g.default.func,borderRadiusShow:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,linkProtocol:g.default.string,mergeTagItems:g.default.array,mergeMenuOpen:g.default.bool,setMergeMenuOpen:g.default.func,cascaderRef:g.default.object,handleLinkProtocolsChange:g.default.func,handleSelect:g.default.func,onChange:g.default.func,filter:g.default.func,renderSearchOption:g.default.func,toggleShowBorderRadiusHandler:g.default.func,setNewSlide:g.default.func};var kl=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("p",{children:e("No properties to edit.")})})};kl.propTypes={};var El=2e3;function Pn(e){const i=(0,n.useRef)([]),l=(0,n.useRef)(e);return l.current=e,{remember:(0,n.useCallback)(s=>{const a=Date.now(),d=i.current.filter(c=>a-c.at<El);d.push({key:JSON.stringify(l.current(s)),at:a}),i.current=d.slice(-10)},[]),isOwnEcho:(0,n.useCallback)(s=>{if(!s)return!1;const a=Date.now(),d=JSON.stringify(l.current(s));return i.current.some(c=>a-c.at<El&&c.key===d)},[])}}function An(e,i){const l=`selected_${e}_form_images_`,s=i.startsWith(l)?l:`selected_${e}_form_`;return i.startsWith(s)?i.slice(s.length):i}function Nn(e){const i=/^(.+)_(\d+)$/.exec(e);return i?{key:i[1],index:Number(i[2])}:void 0}function Ln(e,i,l){return(e??[]).map((s,a)=>a===i.index?{...s,[i.key]:l}:s)}var On={loop:!1,autoplay:!1,borderRadiusAll:0,borderRadiusTopLeft:0,borderRadiusBottomLeft:0,borderRadiusTopRight:0,borderRadiusBottomRight:0,link:"https://",images:{},src_0:"",renderedHeight_0:0,renderedWidth_0:0,imgReplacer_0:"",title_0:"",alt_0:""};function $n(e){const i={...Ti(e)};return delete i.parent,delete i.path,i}var Bl=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm();let s=r.useDispatch();r.useAppConfig();const a=r.useSendPostMessageEx(),d=r.useSendPostMessage(),{openImagePicker:c}=r.useImagePicker(),p=r.useSelector(r.selectEmailViewType),f=r.useSelector(r.selectMobileViewActive),[x,k]=(0,n.useState)(!0),[b,h]=(0,n.useState)(!0),[T,_]=(0,n.useState)(!1),[E,w]=(0,n.useState)(!1),[v,A]=(0,n.useState)("https://"),[j,C]=(0,n.useState)(l?.getFieldsValue(!0)),[P,Y]=(0,n.useState)(e),{remember:z,isOwnEcho:$}=Pn($n),[O,y]=(0,n.useState)(e);e!==O&&(y(e),$(e?.settings)||Y(e));const[oe,G]=(0,n.useState)({name:"",counter:0}),[q,te]=(0,n.useState)(null),[ue,me]=(0,n.useState)(),[se,_e]=(0,n.useState)(!1),[ve,de]=(0,n.useState)(!1),[De,ye]=(0,n.useState)({start:0,end:0}),re=(0,n.useRef)(null),ke=`selected_${P.type}_form_link`,ae=r.useSelector(r.selectIsCodeMode),Q=r.useSelector(r.selectCodeModeDirection),he=ae&&Q!=="bottom";(0,n.useEffect)(()=>{se&&re.current&&re.current.focus()},[se]);const pe=(V,Se)=>{const Ie=document.getElementById(Se);if(Ie){const Ne=P,Fe=An(Ne.type,Se),Ve=Nn(Fe),Ue=Ie.value?.substring(0,De.start),le=Ie.value?.substring(De.end);let Te={[Fe]:Ue+V+le};Ve?Te={carouselImages:Ln(Ne.settings?.carouselImages,Ve,Ue+V+le)}:P.type===r.ELEMENT_TYPES.CAROUSEL&&ke===Se&&(Te={[Fe]:Ue+V+le,carouselImages:[...P.settings?.carouselImages.map(I=>({...I,link:Ue+V+le}))||[]]}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...P.settings,...Te}}),Y(I=>({...I,settings:{...I.settings,...Te}})),l.setFieldValue(Fe,Ue+V+le),Ie.focus(),setTimeout(()=>{Ie.selectionStart=De.start,Ie.selectionEnd=De.start+V.length},400),de(!0)}},ee=r.useAppConfig().mergeTags;(0,n.useEffect)(()=>{ee?.items?.length&&me(r.mapMargeTags(ee.items,i,(V,Se)=>{_e(!1),a(r.EVENT_TYPES.SANDBOX_ADD_MERGETAG,V),Se.stopPropagation(),Se.preventDefault()}))},[ee,me,i,_e,a]);const J=(V,Se)=>{if(_e(!1),V){const Ie=ee.syntax.length>1?ue.findIndex(Ve=>Ve.key===Se[0].key):0,Ne=ee.syntax[Ie].replace("%value%",V[V.length-1]),Fe=`selected_${P.type}_form${P.type==="carousel"?"_images":""}`;["imgReplacer","title","alt","src","link"].some(Ve=>q?.getAttribute("id").includes(`${Fe}_${Ve}`))||q?.getAttribute("id").includes(ke)?pe(Ne,q?.getAttribute("id")):(l.setFieldValue("imgReplacer",Ne),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...P.settings,imgReplacer:Ne}}),Y(Ve=>({...Ve,settings:{...Ve.settings,imgReplacer:Ne}})))}},H=r.useRootElement();(0,n.useEffect)(()=>{const V=({target:Ne})=>{Ne.closest('[id="merge_tags_wrapper"]')||te(Ne)},Se=({target:Ne})=>{!Ne.closest(".merge-tags")&&!Ne.closest("#merge_tags_button")&&_e(!1)},Ie=new xo.Disposable;return Ie.addDisposable(r.addWindowListenerFromShadow(H,"focusin",V)),Ie.addDisposable(r.addWindowListenerFromShadow(H,"click",Se)),()=>{Ie.dispose()}},[H]);const X=(V,Se)=>Se.some(Ie=>Ie.label.toLowerCase().indexOf(V.toLowerCase())>-1),ce=(V,Se)=>{const Ie=Se.map((Ne,Fe)=>{const Ve=Ne.label.split(new RegExp(`(${V})`,"gi"));return(0,o.jsxs)("span",{children:[Fe!==0&&(0,o.jsx)("span",{children:" / "}),Ve.map((Ue,le)=>Ue.toLowerCase()===V.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:Ue},le):Ue)]},Ne.value)});return(0,o.jsx)("div",{title:Se.map(Ne=>Ne.label).join(" / "),children:Ie})};(0,n.useEffect)(()=>{const V=l?.getFieldsValue(!0);C(V)},[l]);const xe=({target:V})=>{if(V&&!ve){const{selectionStart:Se,selectionEnd:Ie}=V;ye({start:Se,end:Ie})}de(!1)};(0,n.useEffect)(()=>{if(P.settings){const V=P.settings,Se=Ti(V);l?.setFieldsValue(Se),C(Se),V.link&&A(Mt(V.link,"https://")),u(V.borderRadius?.all)||(u(V.borderRadius?.topLeft)||u(V.borderRadius?.bottomLeft)||u(V.borderRadius?.topRight)||u(V.borderRadius?.bottomRight)?k(!1):u(V.borderRadius?.all)||k(!0)),u(V.mobileBorderRadius?.topLeft)||u(V.mobileBorderRadius?.bottomLeft)||u(V.mobileBorderRadius?.topRight)||u(V.mobileBorderRadius?.bottomRight)?h(!1):h(!0),_(!!V.borderRadius?.all||!!V.borderRadius?.topLeft||!!V.borderRadius?.bottomLeft||!!V.borderRadius?.topRight||!!V.borderRadius?.bottomRight),w(!!V.mobileBorderRadius?.all||!!V.mobileBorderRadius?.topLeft||!!V.mobileBorderRadius?.bottomLeft||!!V.mobileBorderRadius?.topRight||!!V.mobileBorderRadius?.bottomRight)}},[l,P]);const ne=V=>{const Se=Nr(P.settings,l,V);d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:Se.caption,settings:Se}),z({...P.settings,...Se}),Y(Ie=>({...Ie,settings:{...Ie.settings,...Se}}))},Ae=(V,Se)=>{const Ie=r.stripEmVersionFromUrlString(P.settings?.src||"")===r.stripEmVersionFromUrlString(V||"");(!Ie||V!==P.settings?.src)&&ne({src:V}),Se?.mode==="save"&&Ie&&(G(Ne=>({name:"src",counter:Ne.counter+1})),a(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(V)}))},we=async V=>{const Se=P.settings?.src||"",Ie=r.stripEmVersionFromUrlString(Se),Ne=await c({kind:"img",currentUrl:$t(Ie)?"":Ie,entryModal:V});Ne?.url&&Ae(Ne.url,Ne.meta)},$e=V=>{const Se=V.data.operation;Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_AI):Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK):Se===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(s(r.closeSecondModal()),s(r.closeModal$1()))};r.useListenPostMessage($e);const K=()=>{setTimeout(()=>{_(V=>!V),l.setFieldValue("borderRadiusAll",T?0:5),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...P.settings,borderRadius:{all:T?"":5}}}),Y(V=>({...V,settings:{...V.settings,borderRadius:{all:T?null:5}}}))})},ie=V=>{l.setFieldValue("link",V!=="mergetag"?V:""),A(V)},je=()=>{const{width:V,height:Se,renderedWidth:Ie,renderedHeight:Ne}=P?.settings?.carouselImages[0]||{width:{value:600},height:{value:600},renderedWidth:600,renderedHeight:600},Fe={src:"https://emcdn.ru/1865/231031_17_BGU9Mso.png",width:{value:V.value,dim:"px"},height:{value:Se.value,dim:"px"},alt:"",title:"",link:null,renderedWidth:Ie,renderedHeight:Ne,imgReplacer:"",mobileWidth:{value:null,dim:"px"},mobileHeight:{value:null,dim:"px"},mobileBorderRadius:{all:null,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}},Ve=[...P?.settings?.carouselImages,Fe];d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...P.settings,carouselImages:Ve}}),Y(Ue=>({...Ue,settings:{...Ue.settings,carouselImages:Ve}}))};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_carousel_form",initialValues:On,onValuesChange:ne,autoComplete:"off",className:"element-controls",children:[!he&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),p==="mobile"&&f.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(kl,{})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(xl,{form:l,elementSettings:P,formFields:j,setElementSettings:Y,borderRadiusShow:T,oneBorderRadiusValue:x,setOneBorderRadiusValue:k,linkProtocol:v,mergeTagItems:ue,mergeMenuOpen:se,setMergeMenuOpen:_e,cascaderRef:re,handleLinkProtocolsChange:ie,handleSelect:xe,onChange:J,filter:X,renderSearchOption:ce,toggleShowBorderRadiusHandler:K,setNewSlide:je})})]})};Bl.propTypes={};var Fn={animate:!0,expandSingleSection:!0,sections:[{expanded:!1,index:0}]},Sl=({elementSettings:e})=>{const{__:i}=r.useI18n(),{token:l}=(0,t.ui_kit$useToken)(),[s]=t.ui_kit$Form.useForm(),a=r.useSendPostMessage(),d=r.useAppConfig(),[c,p]=(0,n.useState)(e),[f,x]=(0,n.useState)(e);e!==f&&(x(e),p(e)),(0,n.useEffect)(()=>{if(c.settings){const T=c.settings,_=Ti(T);s?.setFieldsValue(_)}},[s,c]);const k=T=>{const _=Nr(c.settings,s,T);a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:c.type,caption:_.caption,settings:_}),p(E=>({...E,settings:{...E.settings,..._}}))},b=()=>{p(T=>({...T,sections:c?.settings?.sections.push({expanded:!1})})),a({operation:r.EVENT_TYPES.SANDBOX_ACCORDION_ADD_SECTION,settings:{section:i("Section title"),text:i("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")}})},h=T=>{p(_=>({..._,settings:{..._.settings,sections:c.settings.sections?.filter((E,w)=>w!==T)}})),a({operation:r.EVENT_TYPES.SANDBOX_ACCORDION_REMOVE_SECTION,settings:{index:T}})};return(0,o.jsx)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_carousel_form",initialValues:Fn,onValuesChange:k,autoComplete:"off",className:"element-controls",children:(0,o.jsxs)("div",{id:"selected_element_form_desktop_props",children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,children:[(0,o.jsx)(t.ui_kit$Col,{span:15,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"expandSingleSection",valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:"ExpandSingleSection",label:i("Expand only one section"),size:"small",labelStyle:{position:"relative",top:2}})})}),(0,o.jsx)(t.ui_kit$Col,{span:9,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"animate",valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:"Animate",label:i("Animate"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,o.jsx)(t.ui_kit$Form.List,{name:"sections",children:()=>(0,o.jsx)("div",{style:{paddingTop:l.formItemMarginBottomMD+4},children:c?.settings?.sections?.map((T,_)=>(0,o.jsxs)(t.ui_kit$Row,{gutter:24,children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsxs)(t.ui_kit$Space,{size:10,align:"baseline",children:[(0,o.jsx)("span",{style:{position:"relative",top:2},children:i("Section ")+(_+1)}),(0,o.jsx)(t.ui_kit$Form.Item,{name:`expanded_${_}`,valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:`expanded_${_}`,label:i("expanded"),labelSize:"small",size:"small"})})]})}),(0,o.jsx)(t.ui_kit$Col,{children:c?.settings?.sections?.length>1&&(0,o.jsx)(t.ui_kit$Button,{type:"text",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16}),style:{marginRight:"auto"},onClick:()=>h(_)})})]},`expanded_${_}`))})}),(0,o.jsx)(t.ui_kit$Row,{gutter:20,children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:l.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Button,{style:{display:"inline-flex",alignItems:"center",width:"100%"},icon:(0,o.jsx)(r.EmIcons,{icon:"PlusCircleOutlined",component:t.icons$PlusCircleOutlined,size:16,strokeWidth:d.iconStrokeWidth}),onClick:()=>b(),children:i(" Add section")})})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"})]})})};Sl.propTypes={};var{Text:Mn}=t.ui_kit$Typography,Dn="blocks",Tl="text/plain",Vn=(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),Hn=(0,o.jsx)("span",{className:"addon-text-content",children:"Title"});function Ao(e){return e.closest(".email-pane__collapse-wrapper")}function zt({form:e,name:i,placeholder:l,usedColors:s,onColorChange:a}){const d=t.ui_kit$Form.useWatch(i,e);return(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l,usedColors:s,value:typeof d=="string"?d:"",onChange:c=>a(i,c)})}var Un=/^[a-z][a-z0-9+.-]*:/i;function Rl(e){const i=ot(typeof e=="string"?e:String(e??""));return i?Un.test(i)?i:`https://${i}`:""}function Wn(e){const i=typeof e=="string"?e.trim():String(e??"").trim();if(!i)return"";if(/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(i))return i;try{return new URL(i,typeof window<"u"&&window.location?window.location.origin:"http://localhost").href}catch{return i}}function zn(e){const i=Rl(e);if(!i)return!1;try{const l=new URL(i);return!(l.protocol!=="http:"&&l.protocol!=="https:"||!l.hostname)}catch{return!1}}async function yl(e,i){if(i===r.MODALS.UPLOAD_IMAGE_MODAL_EDIT&&$t(e)){try{const l=new URL(e,typeof window<"u"&&window.location?window.location.origin:"http://localhost").href,s=await fetch(l);if(s.ok){const a=await s.blob();return{entryModal:i,currentUrl:"",imageDataUrl:await new Promise((d,c)=>{const p=new FileReader;p.onload=()=>d(p.result),p.onerror=c,p.readAsDataURL(a)})}}}catch{}return{entryModal:r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,currentUrl:""}}return{entryModal:i,currentUrl:e}}function Gn(){const e=r.useSelector(r.selectEditorThemeColor$1),[i,l]=(0,n.useState)(()=>typeof document<"u"&&document.body.classList.contains("dark"));return(0,n.useEffect)(()=>{const s=()=>l(document.body.classList.contains("dark"));s();const a=new MutationObserver(s);return a.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>a.disconnect()},[]),e==="vs-dark"||i?"dark":"light"}function Yn(e){const i=String(e?.bgColor??"").trim();return{blockBgEnabled:!!(e?.bgEnabled&&i),blockBgColor:i}}function Gt(e,i,l){return{...e,buttonBgColor:i,hostCellBgForIconLuminance:String(l??"").trim()}}function wl(e){const i=e?.settings||{};return JSON.stringify({type:e?.type??null,caption:e?.caption??null,parent:e?.parent??i.parent??null,path:i.path??null,blockIndex:i.blockIndex??null})}function jl(e){if(!Array.isArray(e)||e.length===0)return"";const i=e.map(s=>s.customIcon?"":String(s?.itemBorderColor??"").trim()),l=i[0];return i.every(s=>s===l)?l:""}function Yt(e,i){const l=String(e??"").trim(),s=String(i??"").trim();return s||l}function Xn(e,i){const l=String(e??"").trim(),s=String(i??"").trim();return!s||l&&s===l?"":s}function Kn(e,i,l){const s=String(e??"").trim(),a=String(i??"").trim(),d=String(l??"").trim();return d&&(!s||d!==s)?d:a}function qn(e,i){return(e||[]).map(l=>({...l,itemBorderColor:l.customIcon?"":i}))}function Jn(e,i,l){return(e||[]).map(s=>({...s,buttonBgColor:s.customIcon?"":Kn(i,l,s.buttonBgColor)}))}function Qn(e,i){if(e==null)return;const l=(s,a)=>{if(!a||!Object.prototype.hasOwnProperty.call(a,"platform"))return;const d=a.platform;d==null||d===""||i(s,d)};if(Array.isArray(e))e.forEach((s,a)=>{l(a,s)});else if(typeof e=="object")for(const s of Object.keys(e)){const a=Number.parseInt(s,10);Number.isNaN(a)||l(a,e[s])}}function vl({__:e,form:i,fieldName:l,pushSettingsToIframe:s,onMetaActiveChange:a}){const{token:d}=(0,t.ui_kit$useToken)(),c=t.ui_kit$Form.useWatch(["items",l],i),p=c&&typeof c=="object"?c:{},f=typeof p.alt=="string"?p.alt:"",x=typeof p.title=="string"?p.title:"",[k,b]=(0,n.useState)(!1),[h,T]=(0,n.useState)(!1),_=(0,n.useRef)(null),E=(0,n.useRef)(null),w=(0,n.useMemo)(()=>({clearIcon:(0,o.jsx)(t.ui_kit$ColorPickerClearGlyph,{})}),[]);(0,n.useEffect)(()=>{f.trim()&&b(!0)},[f]);const v=!!(f.trim()||k),A=!!(x.trim()||h),j=v||A;(0,n.useLayoutEffect)(()=>{a(l,{alt:v,title:A})},[v,l,a,A]);const C=(0,n.useMemo)(()=>({marginBottom:j?d.formItemMarginBottomXS:0}),[j,d.formItemMarginBottomXS]),P=(0,n.useMemo)(()=>[l,"alt"],[l]),Y=(0,n.useMemo)(()=>[l,"title"],[l]),z=j?"selected-social-form__meta-fields":"selected-social-form__meta-fields is-hidden",$=v?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",O=A?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",y=(0,n.useMemo)(()=>f.trim()?f.trim():e("Alternative text"),[e,f]),oe=(0,n.useMemo)(()=>x.trim()?x.trim():e("Tooltip text"),[e,x]),G=(0,n.useMemo)(()=>(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":v}),[v]),q=(0,n.useMemo)(()=>(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":A}),[A]),te=(0,n.useCallback)(se=>{setTimeout(()=>{const _e=se.current;if(_e){if(typeof _e.focus=="function"){_e.focus();return}_e.input&&typeof _e.input.focus=="function"&&_e.input.focus()}},0)},[]),ue=(0,n.useCallback)(()=>{v?(b(!1),f.trim()&&(i.setFieldValue(["items",l,"alt"],""),setTimeout(()=>s(),0))):(b(!0),te(_))},[v,f,l,te,i,s]),me=(0,n.useCallback)(()=>{if(A)a(l,{title:!1}),T(!1),x.trim()&&(i.setFieldValue(["items",l,"title"],""),setTimeout(()=>s(),0));else{T(!0),a(l,{title:!0});const se=f.trim();i.setFieldValue(["items",l,"title"],se),setTimeout(()=>s(),0),te(E)}},[f,l,te,i,a,s,A,x]);return(0,o.jsxs)("div",{className:"selected-social-form__meta-block",children:[(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected-social-form__meta-toggle-row",style:C,children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:y,placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Button,{type:"default",className:G,onClick:ue,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:oe,placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Button,{type:"default",className:q,onClick:me,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})})]}),(0,o.jsxs)("div",{className:z,children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:P,className:$,children:(0,o.jsx)(t.ui_kit$Input,{ref:_,placeholder:e("Alternative text"),allowClear:w,prefix:Vn})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:Y,className:O,children:(0,o.jsx)(t.ui_kit$Input,{ref:E,placeholder:e("Social network name"),allowClear:w,prefix:Hn})})]})]})}vl.propTypes={__:g.default.func.isRequired,form:g.default.object.isRequired,fieldName:g.default.oneOfType([g.default.number,g.default.string]).isRequired,pushSettingsToIframe:g.default.func.isRequired,onMetaActiveChange:g.default.func.isRequired};function Zn(e,i){if(!Array.isArray(e)||e.length===0)return i;let l=null;for(const s of e){const a=s.iconWidth;if(a==null||Number.isNaN(a)||a<=0)return i;if(l===null)l=a;else if(a!==l)return i}return l??i}function ed(e){if(!e)return{align:"center",iconSize:40,borderRadius:0,gap:8,globalBgColor:"",globalItemBorderColor:"",buttonBorderWidth:0,showLabel:!1,items:[]};const i=Yn(e),l=String(e?.hostCellBgForIconLuminance??"").trim(),s=Zn(e.items,e.iconSize??40),a=typeof e.buttonBorderWidth=="number"&&!Number.isNaN(e.buttonBorderWidth)?e.buttonBorderWidth:0,d=e.bgEnabled&&e.bgColor?String(e.bgColor).trim():"";return{align:e.align??"center",iconSize:s,borderRadius:e.borderRadius??0,gap:e.gap??8,globalBgColor:d,globalItemBorderColor:jl(e.items),buttonBorderWidth:a,showLabel:e.showLabel??!1,items:Array.isArray(e.items)?e.items.map(c=>{const p=!!c.customIcon,f=p?"":Yt(d,c.buttonBgColor),x=c.platform&&!p?r.getSocialIconForBlockCell(c.platform,Gt(i,f,l)):null;return{...c,customIcon:p,title:String(c.title??"").trim(),...x?{iconSrc:x}:{},iconWidth:null,iconHeight:null,buttonBgColor:f,itemBorderColor:p?"":String(c.itemBorderColor??"").trim()}}):[]}}var Il=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useAppConfig(),s=r.useDispatch(),[a]=t.ui_kit$Form.useForm(),d=r.useSendPostMessage(),c=r.useSendPostMessageEx(),{openImagePicker:p}=r.useImagePicker(),[f,x]=(0,n.useState)(e),[k,b]=(0,n.useState)(null),[h,T]=(0,n.useState)(null),_=(0,n.useRef)(null),E=(0,n.useRef)(null),w=(0,n.useRef)(null),v=(0,n.useRef)(wl(e)),A=r.useSelector(r.selectEmailSettings),j=(0,n.useRef)(null),C=(0,n.useRef)(!1),P=(0,n.useRef)(""),Y=(0,n.useRef)({}),z=Gn(),$=A?.usedColors??[],O=t.ui_kit$Form.useWatch("items",a)||[],y=(0,n.useCallback)(()=>{j.current&&(document.removeEventListener("dragover",j.current,!0),j.current=null)},[]),oe=(0,n.useCallback)(()=>{if(j.current)return;const K=ie=>{ie.preventDefault(),ie.dataTransfer&&(ie.dataTransfer.dropEffect="move")};document.addEventListener("dragover",K,!0),j.current=K},[]),G=(0,n.useMemo)(()=>r.getSocialPresetsForBrand(Dn).filter(K=>r.SOCIAL_ICON_ORIGINAL_BY_PLATFORM[K.id]),[]),q=(0,n.useMemo)(()=>G.map(K=>({value:K.id,label:(0,o.jsxs)("span",{className:"selected-social-form__platform-option",children:[(0,o.jsx)("img",{src:r.getSocialIcon(K.id,z),alt:""}),(0,o.jsx)("span",{className:"selected-social-form__platform-option-text",children:i(K.labelMsgid)})]})})),[i,G,z]),te=(0,n.useCallback)((K,ie)=>{Y.current={...Y.current,[K]:{...Y.current[K],...ie}}},[]);(0,n.useEffect)(()=>{const K=wl(e);v.current!==K&&(v.current=K,Y.current={},x(e))},[e]);const ue=(0,n.useRef)(!1);(0,n.useEffect)(()=>{if(f?.settings){if(ue.current){ue.current=!1;return}const K=f.settings;P.current=K.bgEnabled&&K.bgColor?String(K.bgColor).trim():"",a.setFieldsValue(ed(f.settings))}},[f,a]),(0,n.useEffect)(()=>()=>y(),[y]);const me=(0,n.useCallback)(()=>{const K=a.getFieldsValue(!0),ie=f.settings||{},je=String(ie.hostCellBgForIconLuminance??"").trim(),V=(K.globalBgColor||"").trim(),Se=typeof K.iconSize=="number"&&!Number.isNaN(K.iconSize)?K.iconSize:ie.iconSize??40,Ie=typeof K.borderRadius=="number"&&!Number.isNaN(K.borderRadius)?K.borderRadius:ie.borderRadius??0,Ne=typeof K.gap=="number"&&!Number.isNaN(K.gap)?K.gap:ie.gap??8,Fe={blockBgEnabled:!!V,blockBgColor:V},Ve=(K.globalItemBorderColor||"").trim();let Ue=typeof K.buttonBorderWidth=="number"&&!Number.isNaN(K.buttonBorderWidth)?K.buttonBorderWidth:0;Ue=Math.max(0,Math.min(24,Math.round(Ue)));const le={...ie,type:"social",align:K.align??ie.align??"center",iconSize:Se,borderRadius:Ie,gap:Ne,bgEnabled:!!V,bgColor:V,hostCellBgForIconLuminance:je,borderWidth:typeof ie.borderWidth=="number"?ie.borderWidth:0,borderColor:typeof ie.borderColor=="string"?ie.borderColor:"",buttonBorderColor:"",buttonBorderWidth:Ue,showLabel:K.showLabel,items:(K.items||[]).filter(Boolean).map((Te,I)=>{const Z=!!Te.customIcon,Be=Y.current[I]||{},Ce=Z?"":Xn(V,(Te.buttonBgColor||"").trim()),Me=typeof Te.href=="string"?Rl(Te.href):Te.href,Ge=Z?"":Yt(V,Ce),Ye=!Z&&Te.platform?r.getSocialIconForBlockCell(Te.platform,Gt(Fe,Ge,je)):null,D=Z?"":Ve||String(Te.itemBorderColor??"").trim(),L=Wn(Z?Te.iconSrc||"":Ye||Te.iconSrc||"");return{...Te,customIcon:Z,href:Me,iconSrc:L,iconWidth:null,iconHeight:null,buttonBgColor:Ce,itemBorderColor:D,title:Be.title?String(Te.title??"").trim():""}})};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.SOCIAL,caption:f.caption,settings:le}),P.current=V,ue.current=!0,x(Te=>({...Te,settings:le}))},[f.caption,f.settings,a,d]),se=(0,n.useCallback)(K=>{if(K==null||K==="")return-1;const ie=r.stripEmVersionFromUrlString(String(K));return(a.getFieldValue("items")||[]).findIndex(je=>r.stripEmVersionFromUrlString(je&&je.iconSrc||"")===ie)},[a]),_e=(0,n.useCallback)((K,ie,je,V)=>{const Se=[...a.getFieldValue("items")||[]];if(K<0||K>=Se.length)return;const Ie=r.stripEmVersionFromUrlString(String(V||""))===r.stripEmVersionFromUrlString(String(ie||""));(!Ie||ie!==Se[K]?.iconSrc)&&(Se[K]={...Se[K],iconSrc:ie,customIcon:!0,buttonBgColor:"",itemBorderColor:""},a.setFieldValue("items",Se),setTimeout(()=>me(),0)),je?.mode==="save"&&Ie&&c(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(ie)})},[a,me,c]),ve=(0,n.useCallback)(async(K,ie)=>{const je=r.stripEmVersionFromUrlString(String(ie||"")),V=se(ie);if(V<0)return;const Se=(a.getFieldValue("items")||[])[V]?.iconSrc,{entryModal:Ie,currentUrl:Ne,imageDataUrl:Fe}=await yl(je,K),Ve=await p({kind:"img",currentUrl:Ne,entryModal:Ie,imageDataUrl:Fe});Ve?.url&&_e(V,Ve.url,Ve.meta,Se)},[_e,se,a,p]),de=(0,n.useCallback)(async K=>{const ie=(a.getFieldValue("items")||[])[K];if(!ie)return;const{entryModal:je,currentUrl:V,imageDataUrl:Se}=await yl(r.stripEmVersionFromUrlString(String(ie.iconSrc||"")),r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD),Ie=ie.iconSrc,Ne=await p({kind:"img",currentUrl:V,entryModal:je,imageDataUrl:Se});Ne?.url&&_e(K,Ne.url,Ne.meta,Ie)},[_e,a,p]),De=(0,n.useCallback)(K=>{const ie=parseInt(K.currentTarget.dataset.socialEditIndex??"",10);Number.isNaN(ie)||de(ie)},[de]),ye=(0,n.useCallback)(K=>{const ie=K.data?.operation,je=K.data?.src;ie===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?ve(r.MODALS.UPLOAD_IMAGE_MODAL_AI,je):ie===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?ve(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,je):ie===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?ve(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT,je):ie===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?ve(r.MODALS.UPLOAD_IMAGE_MODAL_GIF,je):ie===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?ve(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK,je):ie===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(s(r.closeSecondModal()),s(r.closeModal$1()))},[s,ve]);r.useListenPostMessage(ye);const re=(0,n.useCallback)(()=>{const K=a.getFieldValue("items")||[],ie=G[0],je=(a.getFieldValue("globalItemBorderColor")||"").trim(),V=(a.getFieldValue("globalBgColor")||"").trim();if(!ie)a.setFieldsValue({items:[...K,{platform:void 0,customIcon:!1,href:"",alt:"",title:"",iconSrc:"",iconWidth:null,iconHeight:null,buttonBgColor:V,itemBorderColor:je}]});else{const Se=String(f?.settings?.hostCellBgForIconLuminance??"").trim(),Ie=Yt(V,V),Ne=r.getSocialIconForBlockCell(ie.id,Gt({blockBgEnabled:!!V,blockBgColor:V},Ie,Se)),Fe=i(ie.labelMsgid);a.setFieldsValue({items:[...K,{platform:ie.id,customIcon:!1,href:"",alt:Fe,title:"",iconSrc:Ne,iconWidth:null,iconHeight:null,buttonBgColor:V,itemBorderColor:je}]})}setTimeout(()=>me(),0)},[i,f?.settings?.hostCellBgForIconLuminance,a,G,me]),ke=(0,n.useCallback)((K,ie)=>{K.dataTransfer.setData(Tl,String(ie)),K.dataTransfer.setData(r.DND_SOCIAL_LIST_REORDER_MIME,String(ie)),K.dataTransfer.effectAllowed="move",_.current=ie,b(ie),oe()},[oe]),ae=(0,n.useCallback)(()=>{y(),_.current=null,b(null),T(null)},[y]),Q=(0,n.useCallback)((K,ie,je)=>{if(je<2)return;K.preventDefault(),K.dataTransfer.dropEffect="move";const V=_.current;V!==null&&V!==ie&&T(ie)},[]),he=(0,n.useCallback)((K,ie)=>{K.currentTarget.contains(K.relatedTarget)||T(je=>je===ie?null:je)},[]),pe=(0,n.useCallback)((K,ie,je)=>{K.preventDefault(),T(null);const V=K.dataTransfer.getData(Tl),Se=parseInt(V,10);if(Number.isNaN(Se)||Se===ie){y();return}je(Se,ie),y(),setTimeout(()=>me(),0)},[y,me]),ee=(0,n.useCallback)(K=>{const ie=K.currentTarget,je=parseInt(ie.dataset.itemIndex??"",10);Number.isNaN(je)||ke(K,je)},[ke]),J=(0,n.useCallback)(K=>{const ie=K.currentTarget,je=parseInt(ie.dataset.itemIndex??"",10),V=parseInt(ie.dataset.listLength??"",10);Number.isNaN(je)||Number.isNaN(V)||V<2||(K.preventDefault(),K.dataTransfer&&(K.dataTransfer.dropEffect="move"))},[]),H=(0,n.useCallback)(K=>{const ie=K.currentTarget,je=parseInt(ie.dataset.itemIndex??"",10),V=parseInt(ie.dataset.listLength??"",10);Number.isNaN(je)||Number.isNaN(V)||Q(K,je,V)},[Q]),X=(0,n.useCallback)(K=>{const ie=parseInt(K.currentTarget.dataset.itemIndex??"",10);Number.isNaN(ie)||he(K,ie)},[he]),ce=(0,n.useCallback)(K=>{const ie=parseInt(K.currentTarget.dataset.itemIndex??"",10),je=E.current;Number.isNaN(ie)||typeof je!="function"||pe(K,ie,je)},[pe]),xe=(0,n.useCallback)(K=>{K.stopPropagation();const ie=parseInt(K.currentTarget.dataset.fieldName??"",10),je=w.current;Number.isNaN(ie)||typeof je!="function"||(je(ie),queueMicrotask(me))},[me]),ne=(0,n.useCallback)((K,ie)=>{const je=G.find(le=>le.id===ie);if(!je)return;const V=i(je.labelMsgid),Se=Y.current[K]||{},Ie=String(a.getFieldValue(["items",K,"alt"])??"").trim();(Se.alt||Ie)&&a.setFieldValue(["items",K,"alt"],V),Se.title&&a.setFieldValue(["items",K,"title"],V);const Ne=(a.getFieldValue("globalBgColor")||"").trim(),Fe=Yt(Ne,(a.getFieldValue(["items",K,"buttonBgColor"])||"").trim()),Ve=String(f?.settings?.hostCellBgForIconLuminance??"").trim(),Ue=r.getSocialIconForBlockCell(ie,Gt({blockBgEnabled:!!Ne,blockBgColor:Ne},Fe,Ve));Ue&&(a.setFieldValue(["items",K,"customIcon"],!1),a.setFieldValue(["items",K,"iconSrc"],Ue))},[i,f?.settings?.hostCellBgForIconLuminance,a,G]),Ae=(0,n.useCallback)(K=>{if(Object.prototype.hasOwnProperty.call(K,"globalItemBorderColor")){if(!C.current){const ie=String(K.globalItemBorderColor??"").trim(),je=a.getFieldValue("items")||[];a.setFieldsValue({items:qn(je,ie)})}}else if(Object.prototype.hasOwnProperty.call(K,"globalBgColor")){const ie=P.current,je=String(K.globalBgColor??"").trim(),V=a.getFieldValue("items")||[];a.setFieldsValue({items:Jn(V,ie,je)})}else if(K?.items!=null){const ie=a.getFieldValue("items")||[],je=jl(ie);je!==(a.getFieldValue("globalItemBorderColor")||"").trim()&&(C.current=!0,a.setFieldValue("globalItemBorderColor",je),queueMicrotask(()=>{C.current=!1}));const V=f.settings?.items||[];ie.forEach((Se,Ie)=>{const Ne=Se?.platform,Fe=V[Ie]?.platform;Ne&&Ne!==Fe&&ne(Ie,Ne)})}Qn(K?.items,ne),me()},[f.settings?.items,a,me,ne]),we=(0,n.useCallback)((K,ie)=>{if(a.setFieldValue(K,ie),Array.isArray(K)&&K[0]==="items"){Ae({items:{[K[1]]:{[K[2]]:ie}}});return}Ae({[K]:ie})},[a,Ae]),$e=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"selected-social-form__section",children:[(0,o.jsx)("div",{className:"selected-social-form__section-title",children:i("General settings")}),(0,o.jsx)("div",{className:"selected-social-form__align-block",children:(0,o.jsx)(Uo,{form:a,elementSettings:{...f,type:r.ELEMENT_TYPES.SOCIAL}})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Button size"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"iconSize",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:16,max:64,prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px",placeholder:i("Button size"),className:"selected-social-form__input-full"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Corner radius"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"borderRadius",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,max:48,prefix:(0,o.jsx)(r.EmIcons,{icon:"BorderRadius",component:t.icons$BorderRadius,className:"selected-td-form__icon-radius"}),addonAfter:"px",placeholder:i("Corner radius"),className:"selected-social-form__input-full"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Spacing"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gap",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,max:48,prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingLeftRight",component:t.icons$PaddingLeftRight}),addonAfter:"px",placeholder:i("Spacing"),className:"selected-social-form__input-full"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"globalBgColor",className:"form-item-margin-xs",children:(0,o.jsx)(zt,{form:a,name:"globalBgColor",placeholder:i("Background color"),usedColors:$,onColorChange:we})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Border"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonBorderWidth",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,max:24,prefix:(0,o.jsx)(r.EmIcons,{icon:"BorderOuterOutlined",component:t.icons$BorderOuterOutlined}),addonAfter:"px",placeholder:i("Border"),className:"selected-social-form__input-full"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Border color"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"globalItemBorderColor",className:"form-item-margin-xs",children:(0,o.jsx)(zt,{form:a,name:"globalItemBorderColor",placeholder:i("Border color"),usedColors:$,onColorChange:we})})})})]})]}),(0,o.jsxs)("div",{className:"selected-social-form__section selected-social-form__section--bordered",children:[(0,o.jsx)("div",{className:"selected-social-form__section-title",children:i("Social buttons")}),(0,o.jsx)(t.ui_kit$Form.List,{name:"items",children:(K,{remove:ie,move:je})=>(E.current=je,w.current=ie,(0,o.jsx)("div",{className:"selected-social-form__items",children:K.map((V,Se)=>{const Ie=!!(O[Se]?.customIcon??O[V.name]?.customIcon);return(0,o.jsxs)("div",{className:(0,He.default)("selected-social-form__card",k===Se&&"selected-social-form__card--dragging",h===Se&&k!==Se&&"selected-social-form__card--drag-over"),"data-item-index":Se,"data-list-length":K.length,onDragEnterCapture:J,onDragOverCapture:H,onDragLeave:X,onDropCapture:ce,children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head",children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head-main",children:[K.length>1?(0,o.jsx)("span",{className:"selected-social-form__drag-handle",draggable:!0,"data-item-index":Se,onDragStart:ee,onDragEnd:ae,role:"button",tabIndex:0,"aria-label":i("Drag to reorder"),children:(0,o.jsx)(r.EmIcons,{icon:"HolderOutlined",component:t.icons$HolderOutlined})}):null,(0,o.jsxs)(Mn,{className:"selected-social-form__card-title",children:[i("Button")," ",Se+1]})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Delete"),placement:"top",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"selected-social-form__card-head-remove",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:18,strokeWidth:l.iconStrokeWidth}),"aria-label":i("Delete"),"data-field-name":V.name,onClick:xe})})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[V.name,"iconSrc"],hidden:!0,children:(0,o.jsx)(t.ui_kit$Input,{})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[V.name,"customIcon"],valuePropName:"checked",hidden:!0,children:(0,o.jsx)(t.ui_kit$Checkbox,{})}),(0,o.jsxs)("div",{className:"selected-social-form__platform-row",children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:[V.name,"platform"],className:"selected-social-form__platform-field selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:q,className:"selected-social-form__platform-select",classNames:{popup:{root:"selected-social-form__platform-dropdown"}},placeholder:i("Select"),suffixIcon:(0,o.jsx)(r.EmIcons,{icon:"ChevronDownCustom",component:t.icons$ChevronDownCustom,className:"ant-select-suffix"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Edit icon"),placement:"top",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"selected-social-form__platform-edit","data-social-edit-index":Se,icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,size:18,strokeWidth:l.iconStrokeWidth}),"aria-label":i("Edit icon"),onClick:De})})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[V.name,"href"],className:"selected-social-form__card-field",rules:[{required:!0,whitespace:!0,message:i("Please enter the URL.")},{validator:async(Ne,Fe)=>{const Ve=typeof Fe=="string"?Fe.trim():String(Fe??"").trim();if(Ve&&!zn(Ve))throw new Error(i("Please enter the correct URL."))}}],children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Link03",component:t.icons$Link03,className:"selected-social-form__field-icon"}),placeholder:i("Enter link"),allowClear:{clearIcon:(0,o.jsx)(t.ui_kit$ColorPickerClearGlyph,{})}})}),Ie?null:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__card-field selected-social-form__bg-color-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:[V.name,"buttonBgColor"],className:"selected-social-form__card-field",children:(0,o.jsx)(zt,{form:a,name:["items",V.name,"buttonBgColor"],placeholder:i("Background color"),usedColors:$,onColorChange:we})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Border color"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:[V.name,"itemBorderColor"],className:"selected-social-form__card-field",children:(0,o.jsx)(zt,{form:a,name:["items",V.name,"itemBorderColor"],placeholder:i("Border color"),usedColors:$,onColorChange:we})})})})]}),(0,o.jsx)(vl,{__:i,form:a,fieldName:V.name,pushSettingsToIframe:me,onMetaActiveChange:te})]},V.key)})}))}),(0,o.jsx)(t.ui_kit$Button,{type:"text",block:!0,className:"selected-social-form__add-bar",icon:(0,o.jsx)(r.EmIcons,{icon:"PlusSquareOutlined",component:t.icons$PlusSquareOutlined}),onClick:re,children:i("Add button")})]})]});return(0,o.jsx)("div",{className:"selected-social-form",children:(0,o.jsx)(t.ui_kit$Form,{form:a,layout:"vertical",className:"selected-social-form__form element-controls",onValuesChange:Ae,autoComplete:"off",children:(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:$e})})})};Il.propTypes={elementSettings:g.default.shape({settings:g.default.object,type:g.default.string,caption:g.default.string})};var Cl=r.BASIC_BORDER_COLOR,od=(e,i,l,s,a,d,c="")=>{const p=e.getFieldsValue(!0),f=i?"cell_":c;setTimeout(()=>{i?s(x=>!x):l(x=>!x),a&&(p[f+"borderWidth"]=null,p[f+"borderColor"]="",p[f+"borderStyle"]=""),d(x=>({...r.RESET_BORDER_PARAMS,[p[f+"borderPosition"]]:{...x[p[f+"borderPosition"]],width:p[f+"borderWidth"],color:p[f+"borderColor"],style:p[f+"borderStyle"]}}))})},td=(e,i,l,s,a,d,c)=>{const p=e.getFieldsValue(!0);setTimeout(()=>{i(f=>!f),!l&&!s[p?.mobileBorderPosition]?.color&&(p.mobileBorderStyle="solid",p.mobileBorderWidth=1,p.mobileBorderColor=Cl,a(f=>({...s,[p?.mobileBorderPosition]:{color:Cl,style:"solid",width:1}}))),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:c.type,settings:{mobileBorder:{...s,[p?.mobileBorderPosition]:{color:p.mobileBorderColor,style:p.mobileBorderStyle,width:p.mobileBorderWidth}}}})})},id=(e,i,l,s,a,d,c="")=>{const p=e.getFieldsValue(!0);setTimeout(()=>{i(f=>!f),l?(p[c+"borderRadiusAll"]=0,s(!0)):p[c+"borderRadiusAll"]||(p[c+"borderRadiusAll"]=0),a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:d.type,settings:{borderRadius:{all:p[c+"borderRadiusAll"]}}})})},rd=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!l&&!d.mobileBorderRadiusAll&&!d.mobileBorderRadiusTopLeft&&!d.mobileBorderRadiusTopRight&&!d.mobileBorderRadiusBottomRight&&!d.mobileBorderRadiusBottomLeft&&(d.mobileBorderRadiusAll=0),["all","topLeft","topRight","bottomRight","bottomLeft"].forEach(c=>{if(!d.mobileBorderRadius?.[c])return;const p=`mobileBorderRadius${c[0].toUpperCase()}${c.slice(1)}`;s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{mobileBorderRadius:{[c]:d[p],classNamePrefix:`em-mob-border_radius_${c}-`}}})})})},ld=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!l&&!d.boxShadowColor?(d.boxShadowInset=!1,d.boxShadowHOffset=5,d.boxShadowVOffset=5,d.boxShadowBlurRadius=10,d.boxShadowSpreadRadius=-5,d.boxShadowColor="#000000"):l&&(d.boxShadowInset=!1,d.boxShadowHOffset=null,d.boxShadowVOffset=null,d.boxShadowBlurRadius=null,d.boxShadowSpreadRadius=null,d.boxShadowColor=""),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{boxShadow:{blurRadius:d.boxShadowBlurRadius,color:d.boxShadowColor,hOffset:d.boxShadowHOffset,inset:d.boxShadowInset,spreadRadius:d.boxShadowSpreadRadius,vOffset:d.boxShadowVOffset}}})})},sd=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!l&&!d.mobileBoxShadowColor&&(d.mobileBoxShadowInset=!1,d.mobileBoxShadowHOffset=5,d.mobileBoxShadowVOffset=5,d.mobileBoxShadowBlurRadius=10,d.mobileBoxShadowSpreadRadius=-5,d.mobileBoxShadowColor="#000000"),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{mobileBoxShadow:{blurRadius:d.mobileBoxShadowBlurRadius,color:d.mobileBoxShadowColor,hOffset:d.mobileBoxShadowHOffset,inset:d.mobileBoxShadowInset,spreadRadius:d.mobileBoxShadowSpreadRadius,vOffset:d.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},ad=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!l&&!d.mobileWidth&&(d.mobileWidth=""),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{mobileWidth:{value:d.mobileWidth,dim:d.mobileWidthDim,classNamePrefix:"em-mob-width-"}}})})},nd=e=>{setTimeout(()=>{e(i=>!i)})},dd=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!l&&!d.mobileBackgroundColor&&(d.mobileBackgroundColor="#E5E5E5"),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:d.mobileBackgroundColor}}}),l&&Et(e,a,s)})},cd=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),l&&(d.paddingLeftRight="",d.paddingLeft="",d.paddingRight="",d.paddingTopBottom="",d.paddingTop="",d.paddingBottom="",s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{padding:{all:0}}}))})},ud=(e,i,l,s,a)=>{i(c=>!c);const d=e.getFieldsValue(!0);l||(d.paddingLeftRight=d.paddingLeft,d.paddingTopBottom=d.paddingTop,d.paddingRight=d.paddingLeft,d.paddingBottom=d.paddingTop,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{padding:{top:d.paddingTopBottom,bottom:d.paddingTopBottom,left:d.paddingLeftRight,right:d.paddingLeftRight}}}))},md=e=>{setTimeout(()=>{e(i=>!i)})},pd=(e,i,l,s,a)=>{i(c=>!c);const d=e.getFieldsValue(!0);l||(d.cell_paddingLeftRight=d.cell_paddingLeft,d.cell_paddingTopBottom=d.cell_paddingTop,d.cell_paddingRight=d.cell_paddingLeft,d.cell_paddingBottom=d.cell_paddingTop,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{cell_padding:{top:d.cell_paddingTopBottom,bottom:d.cell_paddingTopBottom,left:d.cell_paddingLeftRight,right:d.cell_paddingLeftRight}}})),(l&&d.cell_paddingLeftRight||d.cell_paddingLeftRight===0)&&(d.cell_paddingLeft=d.cell_paddingLeftRight,d.cell_paddingRight=d.cell_paddingLeftRight),(l&&d.cell_paddingTopBottom||d.cell_paddingTopBottom===0)&&(d.cell_paddingTop=d.cell_paddingTopBottom,d.cell_paddingBottom=d.cell_paddingTopBottom)},hd=({form:e,onBorderSideClear:i,formName:l,elementSettings:s,formValues:a,isMacOS:d,__:c,token:p,appConfig:f,typografItems:x,backgroundRepeatOptions:k,backgroundSizeOptions:b,sendAction:h,handleToggleShowPaddingCell:T,handleTogglePaddingCell:_,handleToggleBackground:E,handleToggleBorder:w,handleToggleBorderRadius:v,paddingCellShow:A,paddingsExt:j,backgroundShow:C,cellBordersShow:P,borderRadiusShow:Y,oneBorderRadiusValue:z,setOneBorderRadiusValue:$,textInputRef:O,linkProtocol:y,handleLinkProtocolsChange:oe,backgroundImageEmpty:G})=>{const q=W.useGoogleFontsLoader();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$FormSection,{title:c("Text"),dividerTop:!1,children:[f.formTextFieldTypografEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"AddImage",style:{marginBottom:p.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"AddImage",component:t.icons$AddImage}),onClick:()=>h("add_img"),style:{width:"100%"},children:c("Add image")})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"Typography",style:{marginBottom:p.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,menu:{items:x},trigger:["hover"],placement:"bottom",getPopupContainer:te=>te.closest(".selected-element-panel"),children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Typograf",component:t.icons$Typograf}),onClick:()=>h("typograf"),style:{width:"100%"},children:c("Typography")})})})})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Text font"),placement:"bottom",zIndex:1,getPopupContainer:te=>te.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:q,getPopupContainer:te=>te.closest(".email-pane__collapse-wrapper")})})}),!s.showOnMobile&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:c("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:c("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:s,name:"textStrong",tooltipTitle:c(d?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:s,name:"textItalic",tooltipTitle:c(d?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:s,name:"textStrikethrough",tooltipTitle:c(d?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:s,name:"textUnderline",tooltipTitle:c(d?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,className:(0,He.default)("selected-text-common-form__button selected-text-common-form__button_style",{"selected-text-common-form__button--active":typeof s.linkHref=="string"}),elementSettings:s,name:"textLink",tooltipTitle:c("Link"),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"})})})]}),a?.textLink&&(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsxs)(t.ui_kit$Col,{span:24,children:[(0,o.jsx)(et,{show:y==="#",__:c,style:{marginBottom:p.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("The URL that the hyperlink directs to."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkHref",children:(0,o.jsx)(t.ui_kit$Input,{ref:O,addonBefore:(0,o.jsx)(Zo,{linkProtocol:y,handleLinkProtocolsChange:oe,__:c}),allowClear:!0,placeholder:c("Hyperlink URL"),autoFocus:s?.customTable?.isNewLink,prefix:(0,o.jsx)(Qo,{linkProtocol:y})})})})]})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Text color"),placement:"bottom",zIndex:2,getPopupContainer:te=>te.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:c("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:c("Color"),usedColors:s.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Text background"),placement:"bottom",zIndex:2,getPopupContainer:te=>te.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:c("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:c("Background color"),usedColors:s.usedColors})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(it,{form:e,elementSettings:s,name:"textAlign"})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Mo,{form:e,elementSettings:s,name:"valign",isNewIconType:!0})})]})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:c("Padding"),collapsible:!0,open:A,onToggle:T,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{namePrefix:"cell_",extended:j,onToggleExtended:_,gutter:p.marginSM,rowStyle:{paddingBottom:4},labels:{horizontal:c("Horizontal padding"),vertical:c("Vertical padding"),left:c("Left padding"),right:c("Right padding"),top:c("Top padding"),bottom:c("Bottom padding"),individual:c("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:c("Background"),collapsible:!0,open:C,onToggle:E,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{colorFieldName:"cellBackgroundColor",imageEnabled:f.formTableFieldBackgroundImageEnabled&&!1,backgroundImageEmpty:G,usedColors:s.usedColors,colorPlaceholder:c("Background color"),horizontalPositionPlaceholder:c("Horizontal position"),horizontalPositionTooltip:c("Horizontal position"),verticalPositionPlaceholder:c("Vertical position"),verticalPositionTooltip:c("Vertical position"),backgroundRepeatTooltip:c("Background image repeat"),backgroundSizeTooltip:c("Background image size"),selectPlaceholder:c("Please choose"),backgroundRepeatOptions:k,backgroundSizeOptions:b,imageUploadSlot:(f.formTableFieldBackgroundImageEnabled,void 0)})}),(0,o.jsx)(t.ui_kit$FormSection,{title:c("Borders"),collapsible:!0,open:P,onToggle:w,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,namePrefix:"cell_"})}),f.formFieldBorderRadiusEnabled&&!1]})},Pl=({form:e,onBorderSideClear:i,elementSettings:l,paddingShow:s,paddingsExt:a,backgroundShow:d,bordersShow:c,borderRadiusShow:p,boxShadowShow:f,handleToggleShowPadding:x,handleTogglePadding:k,handleToggleBackground:b,handleToggleBorder:h,handleToggleBorderRadius:T,handleToggleBoxShadow:_,backgroundRepeatOptions:E,backgroundSizeOptions:w,backgroundImageEmpty:v,oneBorderRadiusValue:A,setOneBorderRadiusValue:j,boxShadow:C})=>{const{__:P}=r.useI18n(),Y=r.useAppConfig(),{token:z}=(0,t.ui_kit$useToken)();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$FormSection,{title:P("Padding"),collapsible:!0,open:s,onToggle:x,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:a,onToggleExtended:k,gutter:z.marginSM,labels:{horizontal:P("Horizontal padding"),vertical:P("Vertical padding"),left:P("Left padding"),right:P("Right padding"),top:P("Top padding"),bottom:P("Bottom padding"),individual:P("Individual padding")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:P("Background"),collapsible:!0,open:d,onToggle:b,dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{imageEnabled:Y.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:v,usedColors:l.usedColors,colorPlaceholder:P("Background color"),horizontalPositionPlaceholder:P("Horizontal position"),horizontalPositionTooltip:P("Horizontal position"),verticalPositionPlaceholder:P("Vertical position"),verticalPositionTooltip:P("Vertical position"),backgroundRepeatTooltip:P("Background image repeat"),backgroundSizeTooltip:P("Background image size"),selectPlaceholder:P("Please choose"),backgroundRepeatOptions:E,backgroundSizeOptions:w,imageUploadSlot:Y.formTableFieldBackgroundImageEnabled?(0,o.jsx)(No,{form:e,label:P("Background image"),name:"backgroundImage",tooltipTitle:P("Background image"),placeholder:P("Background image link/route")}):void 0}),(0,o.jsx)(rt,{form:e,showBackground:!0})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:P("Borders"),collapsible:!0,open:c,onToggle:h,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,onBorderSideClear:i})}),Y.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("Border radius"),collapsible:!0,open:p,onToggle:T,dividerTop:!0,children:(0,o.jsx)(So,{form:e,oneBorderRadiusValue:A,setOneBorderRadiusValue:j,elementSettings:l})}),Y.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("Box shadow"),collapsible:!0,open:f,onToggle:_,dividerTop:!0,children:(0,o.jsx)(jo,{})}),Y.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:l,form:e})})]})};Pl.propTypes={form:g.default.object.isRequired,onBorderSideClear:g.default.func,elementSettings:g.default.object.isRequired,paddingShow:g.default.bool,paddingsExt:g.default.bool,backgroundShow:g.default.bool,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,handleToggleShowPadding:g.default.func,handleTogglePadding:g.default.func,handleToggleBackground:g.default.func,handleToggleBorder:g.default.func,handleToggleBorderRadius:g.default.func,handleToggleBoxShadow:g.default.func,backgroundRepeatOptions:g.default.array,backgroundSizeOptions:g.default.array,backgroundImageEmpty:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,boxShadow:g.default.object};var Al=({form:e,elementSettings:i,mobileSizeShow:l,mobileBackgroundShow:s,mobileBordersShow:a,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,handleToggleMobileSize:p,handleToggleMobileBackground:f,handleToggleMobileBorder:x,handleToggleMobileBorderRadius:k,handleToggleMobileBoxShadow:b,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:T,mobileBorders:_,mobileBoxShadow:E})=>{const{__:w,_x:v}=r.useI18n(),A=r.useAppConfig(),{token:j}=(0,t.ui_kit$useToken)(),C=r.useSelector(r.selectEmailSettings);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$FormSection,{title:w("Size"),collapsible:!0,open:l,onToggle:p,dividerTop:!0,children:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:w("Table width"),placement:"left",children:(0,o.jsx)("div",{style:{marginBottom:j.formItemMarginBottomMD+4},children:(0,o.jsx)(zo,{form:e,name:"mobileWidth",elementSettings:i})})})})}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:j.formItemMarginBottomXS*2},children:(0,o.jsx)(t.ui_kit$Tooltip,{title:w("Height"),placement:"bottom",children:(0,o.jsx)(tt,{form:e,name:"mobileHeight",elementSettings:i})})})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:w("Background"),collapsible:!0,open:s,onToggle:f,dividerTop:!0,children:(0,o.jsx)(Bt,{elementSettings:Go(i),imageEnabled:A.formTableFieldBackgroundImageEnabled,desktopBackground:xt(i)})}),A.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Borders"),collapsible:!0,open:a,onToggle:x,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormBorderInputs,{form:e,fieldStructure:"flat",borderValues:_,usedColors:C.usedColors,labels:{color:w("Color"),width:v("Width","border"),none:w("None"),solid:w("Solid"),dashed:w("Dashed"),dotted:w("Dotted"),above:w("Above"),below:w("Below"),onLeft:w("On the left"),onRight:w("On the right"),around:w("Around"),usedColors:w("Used"),recommendedColors:w("Recommended")}})}),A.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Border radius"),collapsible:!0,open:d,onToggle:k,dividerTop:!0,children:(0,o.jsx)(So,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:h,setOneBorderRadiusValue:T,elementSettings:i})}),A.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Box shadow"),collapsible:!0,open:c,onToggle:b,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile",form:e,elementSettings:i,enableSwitch:!1})}),A.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})})]})};Al.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,handleToggleMobileSize:g.default.func,handleToggleMobileBackground:g.default.func,handleToggleMobileBorder:g.default.func,handleToggleMobileBorderRadius:g.default.func,handleToggleMobileBoxShadow:g.default.func,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,mobileBorders:g.default.object,mobileBoxShadow:g.default.object};var bd=({form:e,onBorderSideClear:i,elementViewType:l,mobileViewActive:s,elementSettings:a,paddingShow:d,paddingsExt:c,backgroundShow:p,bordersShow:f,borderRadiusShow:x,boxShadowShow:k,mobileSizeShow:b,mobileBackgroundShow:h,mobileBordersShow:T,mobileBorderRadiusShow:_,mobileBoxShadowShow:E,handleToggleShowPadding:w,handleTogglePadding:v,handleToggleBackground:A,handleToggleBorder:j,handleToggleBorderRadius:C,handleToggleBoxShadow:P,handleToggleMobileSize:Y,handleToggleMobileBackground:z,handleToggleMobileBorder:$,handleToggleMobileBorderRadius:O,handleToggleMobileBoxShadow:y,backgroundRepeatOptions:oe,backgroundSizeOptions:G,backgroundImageEmpty:q,oneBorderRadiusValue:te,setOneBorderRadiusValue:ue,oneMobileBorderRadiusValue:me,setOneMobileBorderRadiusValue:se,boxShadow:_e,mobileBorders:ve,mobileBoxShadow:de})=>(0,o.jsx)(o.Fragment,{children:l==="mobile"&&s.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(Al,{form:e,elementSettings:a,mobileSizeShow:b,mobileBackgroundShow:h,mobileBordersShow:T,mobileBorderRadiusShow:_,mobileBoxShadowShow:E,handleToggleMobileSize:Y,handleToggleMobileBackground:z,handleToggleMobileBorder:$,handleToggleMobileBorderRadius:O,handleToggleMobileBoxShadow:y,oneMobileBorderRadiusValue:me,setOneMobileBorderRadiusValue:se,mobileBorders:ve,mobileBoxShadow:de})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Pl,{form:e,onBorderSideClear:i,elementSettings:a,paddingShow:d,paddingsExt:c,backgroundShow:p,bordersShow:f,borderRadiusShow:x,boxShadowShow:k,handleToggleShowPadding:w,handleTogglePadding:v,handleToggleBackground:A,handleToggleBorder:j,handleToggleBorderRadius:C,handleToggleBoxShadow:P,backgroundRepeatOptions:oe,backgroundSizeOptions:G,backgroundImageEmpty:q,oneBorderRadiusValue:te,setOneBorderRadiusValue:ue,boxShadow:_e})})}),fd=["borderTop","borderBottom","borderLeft","borderRight"],Nl=({elementSettings:e,formName:i})=>{const{__:l}=r.useI18n(),s=r.useSendPostMessage(),[a]=t.ui_kit$Form.useForm(),{token:d}=(0,t.ui_kit$useToken)(),c=r.useAppConfig(),p=r.useSelector(r.selectEmailViewType),f=r.useSelector(r.selectMobileViewActive),x=r.useSelector(r.selectIsCodeMode),k=r.useSelector(r.selectCodeModeDirection),[b,h]=(0,n.useState)({}),[T,_]=(0,n.useState)(!0),[E,w]=(0,n.useState)({}),[v,A]=(0,n.useState)({}),[j,C]=(0,n.useState)(!0),[P,Y]=(0,n.useState)(e.customTable?.backgroundImage[0].value===""),[z,$]=(0,n.useState)(),[O,y]=(0,n.useState)(!1),[oe,G]=(0,n.useState)(!1),[q,te]=(0,n.useState)(!1),[ue,me]=(0,n.useState)(!1),[se,_e]=(0,n.useState)(!1),[ve,de]=(0,n.useState)(!1),[De,ye]=(0,n.useState)(!1),[re,ke]=(0,n.useState)(!1),[ae,Q]=(0,n.useState)(!0),[he,pe]=(0,n.useState)(!0),[ee,J]=(0,n.useState)(!0),[H,X]=(0,n.useState)(!1),[ce,xe]=(0,n.useState)("https://"),[ne,Ae]=(0,n.useState)({}),[we,$e]=(0,n.useState)(!1),[K,ie]=(0,n.useState)(!1),[je,V]=(0,n.useState)(!1),[Se,Ie]=(0,n.useState)({}),Ne=(0,n.useRef)(null),Fe=(0,n.useRef)(),Ve=t.ui_kit$Form.useWatch([],a),Ue=[{label:l("Not defined"),value:"none"},{label:l("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:l("Repeat background (repeat)"),value:"repeat"},{label:l("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:l("Repeat background vertically (repeat-y)"),value:"repeat-y"}],le=[{label:l("Not defined"),value:""},{label:l("Contain"),value:"contain"},{label:l("Cover"),value:"cover"}],Te={width:"",style:"",color:""},I=x&&k!=="bottom",Z=r.BASIC_BORDER_COLOR,Be=i==="Edit selected table cells"||!1,[Ce,Me]=(0,n.useState)(null);(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&Me(!0)},[]);const Ge=U=>{s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:U,locale:"en_US"})},Ye=[{key:"1",label:l("This element"),onClick:()=>Ge("typograf")},{key:"2",label:l("The whole email"),onClick:()=>Ge("typograf_all")}];let D="";(0,n.useEffect)(()=>{if(e){kt(e)&&ke(!0);const U=e.border,Re=e.boxShadow,be=e.customTable?.mobileBorder,ze=e.customTable?.mobileBoxShadow,co=e.customTable?.cellBorders;Ie(U),h(Re),w(be),A(ze),Ae(co);const so=Be?e?.customTable?.cell_borderPosition:e?.customTable?.borderPosition,mo=Object.keys(be).find(ko=>be[ko]?.width||be[ko]?.style||be[ko]?.color);a.setFieldsValue({...e,width:e.width?.value,widthDim:e.width?.dim,maxWidth:e.maxWidth?.value,maxWidthDim:e.maxWidth?.dim,minWidth:e.minWidth?.value,minWidthDim:e.minWidth?.dim,show:e.show?e.show:"all",mobileAlign:e.mobileAlign?.value,mobileBorderPosition:mo||"all",mobileBorderWidth:be[mo]?.width!==null?be[mo]?.width:"",mobileBorderColor:be[mo]?.color||"",mobileBorderStyle:be[mo]?.style||"",...nt(e),exportAsPicture:e?.exportAsPicture,paddingLeftRight:u(e.customTable?.paddingLeftRight.replace(/px$/,"")),paddingTopBottom:u(e.customTable?.paddingTopBottom.replace(/px$/,"")),paddingRight:u(e.customTable?.paddingRight.replace(/px$/,"")),paddingLeft:u(e.customTable?.paddingLeft.replace(/px$/,"")),paddingTop:u(e.customTable?.paddingTop.replace(/px$/,"")),paddingBottom:u(e.customTable?.paddingBottom.replace(/px$/,"")),backgroundColor:u(e.customTable?.backgroundColor),backgroundImage:u(e.customTable?.backgroundImage[0].value),backgroundPositionX:u(e.customTable?.backgroundPositionX),backgroundPositionY:u(e.customTable?.backgroundPositionY),backgroundRepeat:u(e.customTable?.backgroundRepeat),backgroundSize:u(e.customTable?.backgroundSize),borderAll:u(e.customTable?.borderAll),borderRadiusAll:u(e.customTable?.borderRadius.all),borderRadiusTopLeft:u(e.customTable?.borderRadius.topLeft),borderRadiusBottomLeft:u(e.customTable?.borderRadius.bottomLeft),borderRadiusTopRight:u(e.customTable?.borderRadius.topRight),borderRadiusBottomRight:u(e.customTable?.borderRadius.bottomRight),borderRadius:{all:u(e.customTable?.borderRadius.all),topLeft:u(e.customTable?.borderRadius.topLeft),topRight:u(e.customTable?.borderRadius.topRight),bottomLeft:u(e.customTable?.borderRadius.bottomLeft),bottomRight:u(e.customTable?.borderRadius.bottomRight)},borderTop:u(e.customTable?.borderTop),borderBottom:u(e.customTable?.borderBottom),borderLeft:u(e.customTable?.borderLeft),borderRight:u(e.customTable?.borderRight),borderPosition:so||"borderAll",boxShadowInset:u(e.customTable?.boxShadow?.inset)||!1,boxShadowHOffset:u(e.customTable?.boxShadow?.hOffset),boxShadowVOffset:u(e.customTable?.boxShadow?.vOffset),boxShadowBlurRadius:u(e.customTable?.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.customTable?.boxShadow?.spreadRadius),boxShadowColor:u(e.customTable?.boxShadow?.color),mobileBoxShadowInset:u(e.customTable?.mobileBoxShadow?.inset)||!1,mobileBoxShadowHOffset:u(e.customTable?.mobileBoxShadow?.hOffset),mobileBoxShadowVOffset:u(e.customTable?.mobileBoxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.customTable?.mobileBoxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.customTable?.mobileBoxShadow?.spreadRadius),mobileBoxShadowColor:u(e.customTable?.mobileBoxShadow?.color),mobileBackgroundColor:u(e.customTable?.mobileBackgroundColor?.value!=="none"?e.customTable?.mobileBackgroundColor?.value:""),mobileWidth:po(e.customTable?.mobileWidth?.value),mobileWidthDim:e.customTable?.mobileWidth?.dim,mobileHeight:po(e.customTable?.mobileHeight?.value),mobileHeightDim:e.customTable?.mobileHeight?.dim,mobileBorderRadiusAll:u(e.customTable?.mobileBorderRadius.all),mobileBorderRadiusTopLeft:u(e.customTable?.mobileBorderRadius.topLeft!==null?e.customTable?.mobileBorderRadius.topLeft:e.customTable?.mobileBorderRadius.all),mobileBorderRadiusBottomLeft:u(e.customTable?.mobileBorderRadius.bottomLeft!==null?e.customTable?.mobileBorderRadius.bottomLeft:e.customTable?.mobileBorderRadius.all),mobileBorderRadiusTopRight:u(e.customTable?.mobileBorderRadius.topRight!==null?e.customTable?.mobileBorderRadius.topRight:e.customTable?.mobileBorderRadius.all),mobileBorderRadiusBottomRight:u(e.customTable?.mobileBorderRadius.bottomRight!==null?e.customTable?.mobileBorderRadius.bottomRight:e.customTable?.mobileBorderRadius.all),cellBackgroundColor:u(e.customTable?.cellBackgroundColor),cell_borderPosition:u("cell_borderAll"),cell_borderAll:u(e.customTable?.cell_borderAll),cell_borderTop:u(e.customTable?.cell_borderTop),cell_borderBottom:u(e.customTable?.cell_borderBottom),cell_borderLeft:u(e.customTable?.cell_borderLeft),cell_borderRight:u(e.customTable?.cell_borderRight),cell_paddingLeftRight:u(e.customTable?.cell_paddingLeftRight?.replace(/px$/,"")),cell_paddingTopBottom:u(e.customTable?.cell_paddingTopBottom?.replace(/px$/,"")),cell_paddingRight:u(e.customTable?.cell_paddingRight?.replace(/px$/,"")),cell_paddingLeft:u(e.customTable?.cell_paddingLeft?.replace(/px$/,"")),cell_paddingTop:u(e.customTable?.cell_paddingTop?.replace(/px$/,"")),cell_paddingBottom:u(e.customTable?.cell_paddingBottom?.replace(/px$/,"")),fontFamily:u(e.customTable?.fontFamily),fontSize:u(e.customTable?.fontSize),lineHeight:u(e.customTable?.lineHeight),textStrong:u(e.customTable?.textStrong),textItalic:u(e.customTable?.textItalic),textStrikethrough:u(e.customTable?.textStrikethrough),textUnderline:u(e.customTable?.textUnderline),textLink:u(e.customTable?.textLink),linkHref:u(e.customTable?.linkHref),linkTarget:u(e.customTable?.linkTarget),textColor:u(e.customTable?.textColor),textBackgroundColor:u(e.customTable?.textBackgroundColor),textAlign:u(e.customTable?.textAlign),valign:u(e.customTable?.textValign)}),!u(e.customTable?.borderRadius.all)&&(u(e.customTable?.borderRadius.topLeft)||u(e.customTable?.borderRadius.bottomLeft)||u(e.customTable?.borderRadius.topRight)||u(e.customTable?.borderRadius.bottomRight))?_(!1):_(!0),!u(e.customTable?.mobileBorderRadius.all)&&u(e.customTable?.mobileBorderRadius.topLeft)||u(e.customTable?.mobileBorderRadius.bottomLeft)||u(e.customTable?.mobileBorderRadius.topRight)||u(e.customTable?.mobileBorderRadius.bottomRight)?C(!1):C(!0),Y(e.customTable?.backgroundImage[0].value===""),$(ko=>U[so]?.width||U[so]?.style||U[so]?.color?!0:ko),G(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),me(!!e.boxShadow),V(!!e.width?.value||!!e.minWidth?.value||!!e.maxWidth?.value),de(!!e.customTable?.mobileWidth.value),ie(!!e.exportAsPicture)}},[a,e]),(0,n.useEffect)(()=>{const U=a.getFieldValue("linkHref");typeof e.customTable?.linkHref=="string"&&$e(!0),Ne&&!U&&($e(!1),a.setFieldsValue({linkHref:null})),Ne.current=U||null},[Ve?.textLink,Ve?.linkHref,e.customTable?.linkHref,a]),(0,n.useEffect)(()=>{e.customTable?.linkHref&&Wo(e.customTable?.linkHref||"",xe),a.setFieldsValue({linkHref:typeof e.customTable?.linkHref=="string"?e.customTable.linkHref:"https://"})},[a,e,xe]);const L=U=>{a.setFieldValue("linkHref",U!=="mergetag"?U:""),xe(U)},R=U=>{const Re=a.getFieldsValue(!0),be=Object.keys(U)[0];let ze;const co=fd.includes(be)&&Re[be]?{...Re[be],width:Re[be].width===""?Re.borderAll?.width||"1":Re[be].width,color:Re[be].color===""?Re.borderAll?.color||Z:Re[be].color,style:Re[be].style===""?Re.borderAll?.style||"solid":Re[be].style}:null,so=["top","right","bottom","left"],mo="em-mob-border_",ko=Bo=>({...r.RESET_BORDER_PARAMS[Bo],classNamePrefix:`${mo}${Bo}-`}),qo=(Bo,ro,Ro,Vo)=>so.reduce((_o,Ho)=>(_o[Ho]={...Bo,[Ro]:Ho===ro?Vo:Bo[Ro],classNamePrefix:`${mo}${Ho}-`},_o),{}),Co=(Bo,ro,Ro,Vo)=>{const _o=Vo.mobileBorderPosition,Ho=_o==="all",vt=ro===""||ro==null;let Lo;Ho?Lo={all:{...Ro.all,[Bo]:vt?null:ro,classNamePrefix:`${mo}all-`},...so.reduce((Ct,ni)=>({...Ct,[ni]:ko(ni)}),{})}:vt?Lo={...Ro,[_o]:ko(_o),all:{...r.RESET_BORDER_PARAMS.all}}:Ro.all?.color!=null&&Ro.all?.width!=null&&Ro.all?.style!=null?Lo={...qo(Ro.all,_o,Bo,ro),all:{...r.RESET_BORDER_PARAMS.all}}:Lo={...Ro,[_o]:{...Ro[_o],[Bo]:ro,classNamePrefix:`${mo}${_o}-`},all:{...r.RESET_BORDER_PARAMS.all}};const It=Ho?Lo.all:Lo[_o],Er={mobileBorderColor:It?.color??Z,mobileBorderWidth:It?.width??1,mobileBorderStyle:It?.style??"solid"};return{newBorders:Lo,sending:{mobileBorder:Lo},formUpdates:Er}};switch(be){case"exportAsPicture":ze={exportAsPicture:Re.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":ze={boxShadow:{hOffset:Re.boxShadowHOffset,vOffset:Re.boxShadowVOffset,blurRadius:Re.boxShadowBlurRadius,spreadRadius:Re.boxShadowSpreadRadius,color:Re.boxShadowColor,inset:Re.boxShadowInset}};break;case"width":ze={[be]:{value:U[be],dim:Re.widthDim}};break;case"widthDim":ze={width:{value:Re.width,dim:U[be]}};break;case"maxWidth":ze={[be]:{value:U[be],dim:Re.maxWidthDim}};break;case"maxWidthDim":ze={maxWidth:{value:Re.maxWidth,dim:U[be]}};break;case"minWidth":ze={[be]:{value:U[be],dim:Re.minWidthDim}};break;case"minWidthDim":ze={minWidth:{value:Re.minWidth,dim:U[be]}};break;case"backgroundImage":Y(U[be]===""),ze={[be]:[{...e.customTable?.backgroundImage[0],value:U[be]}],backgroundSize:"cover"},a.setFieldsValue({backgroundColor:""});break;case"backgroundColor":Y(!0),ze=U,a.setFieldsValue({backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:""});break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":ze={borderRadius:{[W.BORDER_RADIUS_POSITION[be]]:+U[be]}};break;case"mobileWidth":ze={[be]:{classNamePrefix:"em-mob-width-",value:U[be],dim:Re.mobileWidthDim}};break;case"mobileWidthDim":ze={mobileWidth:{classNamePrefix:"em-mob-width-",value:Re.mobileWidth||100,dim:U[be]}};break;case"mobileHeight":ze={[be]:{classNamePrefix:"em-mob-height-",value:U[be],dim:Re.mobileHeightDim}};break;case"mobileBorderStyle":case"mobileBorderColor":case"mobileBorderWidth":const Bo={mobileBorderStyle:"style",mobileBorderColor:"color",mobileBorderWidth:"width"}[be],{newBorders:ro,sending:Ro,formUpdates:Vo}=Co(Bo,U[be],E,Re);Object.assign(Re,Vo),w(ro),ze=Ro;break;case"mobileBorderPosition":a.setFieldsValue({mobileBorderWidth:E[U[be]].width||"",mobileBorderColor:E[U[be]].color||"",mobileBorderStyle:E[U[be]].style||""});break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":ze={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[be]]:U[be],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[be]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":ze={mobileBoxShadow:{hOffset:Re.mobileBoxShadowHOffset,vOffset:Re.mobileBoxShadowVOffset,blurRadius:Re.mobileBoxShadowBlurRadius,spreadRadius:Re.mobileBoxShadowSpreadRadius,color:Re.mobileBoxShadowColor,inset:Re.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(ze=_t(U),!ze)return;break;case"mobileAlign":ze={[be]:{classNamePrefix:"em-mob-table_align-",value:U[be]}};break;case"borderPosition":ze=U,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:ze});break;case"borderAll":U[be]?.style===""?a.setFieldsValue({borderAll:Te}):a.setFieldsValue({borderTop:Te,borderBottom:Te,borderLeft:Te,borderRight:Te}),ze=U;break;case"borderTop":a.setFieldsValue({borderTop:co}),U[be]?.style===""?a.setFieldsValue({borderTop:Te}):a.setFieldsValue({borderAll:Te}),ze=U;break;case"borderBottom":a.setFieldsValue({borderBottom:co}),U[be]?.style===""?a.setFieldsValue({borderBottom:Te}):a.setFieldsValue({borderAll:Te}),ze=U;break;case"borderLeft":a.setFieldsValue({borderLeft:co}),U[be]?.style===""?a.setFieldsValue({borderLeft:Te}):a.setFieldsValue({borderAll:Te}),ze=U;break;case"borderRight":a.setFieldsValue({borderRight:co}),U[be]?.style===""?a.setFieldsValue({borderRight:Te}):a.setFieldsValue({borderAll:Te}),ze=U;break;case"cell_borderPosition":ze=U,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:ze});break;case"fontSize":case"lineHeight":if(U[be]===null||U[be]===""||U[be]===void 0)return;ze=U;break;case"linkHref":{const _o=ot(U[be]);_o!==U[be]&&a.setFieldValue("linkHref",_o),ze={linkHref:_o},Wo(_o,xe);break}default:ze=U}be!=="borderPosition"&&s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:ze})},F=(0,n.useCallback)(()=>{od(a,Be,$,X,z,Ie,D)},[a,Be,z,D]),fe=(0,n.useCallback)(()=>{td(a,y,O,E,w,s,e)},[a,O,E,s,e]),Le=(0,n.useCallback)(()=>{id(a,G,oe,_,s,e,D)},[a,oe,_,s,e,D]),eo=(0,n.useCallback)(()=>{rd(a,te,q,s,e)},[a,q,s,e]),Xe=(0,n.useCallback)(()=>{ld(a,me,ue,s,e)},[a,ue,s,e]),lo=(0,n.useCallback)(()=>{sd(a,_e,se,s,e)},[a,se,s,e]),Qe=(0,n.useCallback)(()=>{ad(a,de,ve,s,e)},[a,ve,s,e]),uo=(0,n.useCallback)(()=>{nd(ye)},[ye]),Eo=(0,n.useCallback)(()=>{dd(a,ke,re,s,e)},[a,re,s,e]),B=(0,n.useCallback)(()=>{cd(a,Q,ae,s,e)},[a,ae,s,e]),S=(0,n.useCallback)(()=>{ud(a,pe,he,s,e)},[a,he,s,e]),m=(0,n.useCallback)(()=>{md(J)},[J]),M=(0,n.useCallback)(()=>{pd(a,pe,he,s,e)},[a,he,s,e]);return(0,o.jsxs)(t.ui_kit$Form,{form:a,layout:"vertical",name:i,initialValues:{paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",cell_paddingTop:"",cell_paddingLeft:"",cell_paddingRight:"",cell_paddingBottom:"",cell_paddingLeftRight:"",cell_paddingTopBottom:"",borderAll:{width:"",style:"",color:""},borderTop:{width:"",style:"",color:""},borderBottom:{width:"",style:"",color:""},borderLeft:{width:"",style:"",color:""},borderRight:{width:"",style:"",color:""},cellBackgroundColor:"",backgroundImageForCell:"",cellBackgroundPositionX:"",cellBackgroundPositionY:"",cellBackgroundRepeat:"",cellBackgroundSize:"",backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,show:"all",width:{value:"",dim:""},maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",mobileAlign:"",border:"",boxShadow:"",borderPosition:"",borderColor:"",borderWidth:"",borderStyle:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"px",mobileBorder:"",mobileBorderPosition:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBorderAll:"",mobileBorderTop:"",mobileBorderBottom:"",mobileBorderLeft:"",mobileBorderRight:"",mobileBoxShadow:"",mobileBackgroundColor:"",mobileBackgroundImage:"",cell_border:"",cell_borderColor:"",cell_borderWidth:"",cell_borderStyle:"",cell_borderPosition:"cell_borderAll",cell_borderAll:{color:"",width:"",style:""},cell_borderTop:{color:"",width:"",style:""},cell_borderBottom:{color:"",width:"",style:""},cell_borderLeft:{color:"",width:"",style:""},cell_borderRight:{color:"",width:"",style:""},cell_borderRadiusAll:"",cell_RadiusTopLeft:"",cell_RadiusBottomLeft:"",cell_RadiusTopRight:"",cell_RadiusBottomRight:"",fontFamily:"",fontSize:"",lineHeight:"",textStrong:"",textItalic:"",textStrikethrough:"",textUnderline:"",textLink:"",linkHref:"",textColor:"",textAlign:"",verticalAlign:"",textBackgroundColor:"",valign:""},onValuesChange:R,autoComplete:"off",className:"element-controls",style:{padding:0,display:"flex",flexDirection:"column"},children:[!I&&(0,o.jsx)(t.ui_kit$Tooltip,{title:l("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:l("Appearance on mobile devices"),type:"info"})}),Be?(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(hd,{form:a,onBorderSideClear:R,formValues:Ve,elementSettings:e,appConfig:c,token:d,isMacOS:Ce,__:l,handleToggleShowPaddingCell:m,handleTogglePaddingCell:M,handleToggleBackground:uo,handleToggleBorder:F,handleToggleBorderRadius:Le,paddingCellShow:ee,paddingsExt:he,backgroundShow:De,cellBordersShow:H,borderRadiusShow:oe,oneBorderRadiusValue:T,setOneBorderRadiusValue:_,backgroundImageEmpty:P,backgroundRepeatOptions:Ue,backgroundSizeOptions:le,sendAction:Ge,typografItems:Ye,textInputRef:Fe,linkProtocol:ce,handleLinkProtocolsChange:L,isCodeVision:I})}):(0,o.jsx)(bd,{form:a,onBorderSideClear:R,elementSettings:e,handleToggleShowPadding:B,handleTogglePadding:S,handleToggleBackground:uo,handleToggleBorder:F,handleToggleBorderRadius:Le,handleToggleBoxShadow:Xe,handleToggleMobileSize:Qe,handleToggleMobileBackground:Eo,handleToggleMobileBorder:fe,handleToggleMobileBorderRadius:eo,handleToggleMobileBoxShadow:lo,paddingShow:ae,paddingsExt:he,backgroundShow:De,bordersShow:z,borderRadiusShow:oe,boxShadowShow:ue,mobileSizeShow:ve,mobileBackgroundShow:re,mobileBordersShow:O,mobileBorderRadiusShow:q,mobileBoxShadowShow:se,oneBorderRadiusValue:T,setOneBorderRadiusValue:_,oneMobileBorderRadiusValue:j,setOneMobileBorderRadiusValue:C,backgroundImageEmpty:P,backgroundRepeatOptions:Ue,backgroundSizeOptions:le,boxShadow:b,mobileBorders:E,mobileBoxShadow:v,elementViewType:p,mobileViewActive:f})," "]})};Nl.propTypes={elementSettings:g.default.object.isRequired};var dt=({className:e=null,formSettings:i,emailElementType:l,formName:s})=>{const a=r.useDispatch(),d=wo.useSendStyleToggleToIframe(),c=(0,n.useRef)(),p=r.useSelector(r.selectActiveSettingsTab),f=r.useSelector(r.selectElementSettings$1),x=r.useSelector(r.selectElementSettings),k=r.useContainer(),b=r.getComponentRegistry(k),h=l==="email"?f:x,T=h.type,_=T===r.ELEMENT_TYPES.CAROUSEL||T===r.ELEMENT_TYPES.IMG?i.settings:h,[E,w]=(0,n.useState)(_),[v,A]=(0,n.useState)(_);_!==v&&(A(_),w(_));const j=C=>{const P=C.data.operation,Y=C.data.action;if(P===r.EVENT_TYPES.APPLICATION_ACTION){let $=function(O,y=null){const oe={[O]:y||!E[O]};d(oe,E.type),a(r.setEmailSettings(oe)),w(G=>({...G,...oe}))};var z=$;Y==="toggle_strong"&&$("textStrong"),Y==="toggle_italic"&&$("textItalic"),Y==="toggle_underline"&&$("textUnderline"),Y==="toggle_strikethrough"&&$("textStrikethrough"),Y==="textAlign_left"&&$("textAlign","left"),Y==="textAlign_right"&&$("textAlign","right"),Y==="textAlign_center"&&$("textAlign","center")}};return r.useListenPostMessage(j),(0,o.jsx)("div",{className:"selected-element-panel",children:(0,o.jsx)(r.CSSTransition,{nodeRef:c,in:p===r.PROPERTIES,timeout:300,classNames:"transition",children:(0,o.jsxs)("div",{ref:c,className:(0,He.default)("selected-element-panel-content",{[e]:e}),children:[i?.type==="advanced"&&i?.content?(0,o.jsx)(n.Fragment,{children:b.getReactElement(i.content)},i.instanceKey):null,(h.type===r.ELEMENT_TYPES.IMG||h.type===r.ELEMENT_TYPES.COUNTDOWN||h.type===r.ELEMENT_TYPES.VIDEO)&&(0,o.jsx)(Fr,{elementSettings:h}),h.type===r.ELEMENT_TYPES.TEXT&&(0,o.jsx)(mn,{elementSettings:h}),h.type===r.ELEMENT_TYPES.LINK&&(0,o.jsx)(ol,{elementSettings:h}),h.type===r.ELEMENT_TYPES.TABLE&&(0,o.jsx)(el,{elementSettings:h}),h.type===r.ELEMENT_TYPES.CUSTOM_TABLE&&(0,o.jsx)(Nl,{elementSettings:h,formName:s}),(h.type===r.ELEMENT_TYPES.TD||h.type===r.ELEMENT_TYPES.STRUCTURE||h.type===r.ELEMENT_TYPES.GROUP||h.type===r.ELEMENT_TYPES.COLUMN)&&(0,o.jsx)(al,{elementSettings:h}),h.type===r.ELEMENT_TYPES.VAR&&(0,o.jsx)(gl,{elementSettings:h}),h.type===r.ELEMENT_TYPES.BUTTON&&(0,o.jsx)(fl,{elementSettings:h}),h.type===r.ELEMENT_TYPES.DIV&&(0,o.jsx)(cl,{elementSettings:h}),h.type===r.ELEMENT_TYPES.VINDENT&&(0,o.jsx)(rl,{elementSettings:h}),h.type===r.ELEMENT_TYPES.FLOAT_BLOCK&&(0,o.jsx)(pl,{elementSettings:h}),i.type===r.ELEMENT_TYPES.CAROUSEL&&(0,o.jsx)(Bl,{elementSettings:i}),i.type===r.ELEMENT_TYPES.ACCORDION&&(0,o.jsx)(Sl,{elementSettings:i}),i.type===r.ELEMENT_TYPES.SOCIAL&&(0,o.jsx)(Il,{elementSettings:i})]})})})};dt.propTypes={className:g.default.string,formName:g.default.string};function Yo(){return!!document.querySelector(".selected-element-panel__columns-settings__links__add")?.closest(".selected-element-panel")}var Ll=({emailElementType:e,isSelectedElement:i=!1,selectedElement:l={parent:!1}})=>{const{__:s}=r.useI18n(),a=r.useDispatch(),d=r.useSendPostMessage(),[c]=t.ui_kit$Form.useForm(),p=(0,n.useRef)(),f=(0,n.useRef)(),x=r.useSelector(r.selectElementSettings$1),k=r.useSelector(r.selectElementSettings),b=r.useAppConfig(),h=l||(e==="email"?x:k),[T,_]=(0,n.useState)(h.floatBlocks?.wrap),[E,w]=(0,n.useState)(h.floatBlocks?.dirRevers),[v,A]=(0,n.useState)(null),[j,C]=(0,n.useState)(0),[P,Y]=(0,n.useState)([]),z=r.useSelector(r.selectEmailViewType),$=(0,n.useCallback)(re=>{a(e==="email"?r.setElementSettings$1(re):r.setElementSettings(re))},[a,e]);(0,n.useEffect)(()=>{if(h&&JSON.stringify(h)!=="{}"&&c._init){if(c.resetFields(),c.setFieldsValue({gap:h.floatBlocks?.gap,gapMobile:h.floatBlocks?.gapMobile,gapDim:"px",valign:h.floatBlocks?.valign}),h.floatBlocks?.items.length>0){let Q=function(he,pe){if(he.length!==pe.length)return!1;for(let ee=0;ee<he.length;ee++)if(he[ee]!==pe[ee])return!1;return!0};var re=Q;const ke=h.floatBlocks.items.reduce((he,pe)=>he+pe.width,0),ae=h.floatBlocks.items.map(he=>((he.width||0)/ke*100).toFixed(1));C(ke),!Q(ae,P)&&h.changeKey!=="gap"&&Y(ae),h.floatBlocks.items.forEach((he,pe)=>c.setFieldsValue({["width-"+pe]:he.width||0})),h.floatBlocks.items.length>=8?document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.add("noactive"):document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.contains("noactive")&&document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.remove("noactive")}_(h.floatBlocks?.wrap)}},[c,h,v,P]);let O=0;h.floatBlocks?.items.length>0&&(O=h.floatBlocks.items.length);const y=(re,ke)=>{Object.keys(ke).forEach(ae=>{if(ae.includes("width")){const Q=parseInt(ae.match(/\d+/));c.setFieldsValue({[ae]:re.items[Q]})}})},[oe,G]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const re=()=>G(!0),ke=()=>G(!1);return document.addEventListener("keyup",ke),document.addEventListener("keydown",re),()=>{document.removeEventListener("keyup",ke),document.removeEventListener("keydown",re)}},[]);const q=re=>{f.current&&oe&&clearTimeout(f.current),f.current=setTimeout(()=>ke(re),50);function ke(ae){const Q=c.getFieldsValue(!0),he=Object.keys(ae)[0];if(A(he),he.includes("width")){if(Q[he]&&Q[he]>=30){let pe={items:[],gap:Q.gap,valign:Q.valign,activateSection:i?void 0:"structure"},ee=0;if(document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").length>1){ee=parseFloat(Object.keys(ae)[0].substring(Object.keys(ae)[0].length-1));const J=Q["width-"+(ee+1)]?ee+1:0;let H=j;Object.keys(Q).forEach(X=>{X.includes("width")&&X.indexOf("width-"+J)===-1&&(H-=Q[X])}),Q["width-"+J]=H}Object.keys(Q).forEach(J=>{J.includes("width")&&pe.items.push(Q[J])}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:pe}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...pe,items:h.floatBlocks.items.map((J,H)=>({...h.floatBlocks.items[H],width:pe.items[H]}))},changeKey:he})}}else if(he==="gap"){const pe={items:h.floatBlocks.items.map(X=>X.width),gap:h.floatBlocks.gap},ee=pe.items.reduce((X,ce)=>X+ce,0)+(pe.items.length-1)*pe.gap,J=Q.gap,H=ee-(pe.items.length-1)*J;if(H>pe.items.length*30||h.floatBlocks.gap-ae>=0){const X=(Ae,we)=>Math.round(we*Ae/100);let ce=pe.items.map((Ae,we)=>X(P[we],H));const xe=ee-(ce.reduce((Ae,we)=>Ae+we,0)+(pe.items.length-1)*J);if(xe!==0){const Ae=ce.length-Math.abs(xe);ce=ce.map((we,$e)=>Ae<=$e?we+(xe>0?1:-1):we)}let ne={items:ce,gap:J||0};y(ne,Q),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGap",settings:ne,editFromStructure:Yo()}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...ne,items:h.floatBlocks.items.map((Ae,we)=>({...Ae,width:ne.items[we]}))},changeKey:he})}}else if(he==="valign"){let pe={valign:Q.valign};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksValign",settings:pe,editFromStructure:Yo()}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...pe},changeKey:he})}else if(he==="gapMobile"){let pe={mobileHeight:{classNamePrefix:"em-mob-height-",value:ae[he],dim:"px"}};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGapMobile",settings:pe}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,gapMobile:pe.mobileHeight.value},changeKey:he})}setTimeout(()=>p?.current&&p.current.focus({cursor:"end"}),600)}},te=()=>{const re=c.getFieldsValue(!0),ke=h.floatBlocks.items.map(H=>H.width);let ae={items:[],gap:re.gap};const Q=ke.reduce((H,X)=>H+X,0),he=ke.length,pe=Math.ceil(j/he)*he,ee=pe/he,J=Q-pe;if(ae.items=Array(he).fill(ee),J!==0){const H=ke.length-Math.abs(J);ae.items=ae.items.map((X,ce)=>H<=ce?X+(J>0?1:-1):X)}y(ae,re),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:ae,editFromStructure:Yo()}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...ae,items:h.floatBlocks.items.map((H,X)=>({...H,width:ae.items[X]}))},changeKey:"width"})},ue=re=>{const ke=c.getFieldsValue(!0),ae=h.floatBlocks.items.map(ne=>ne.width),Q=h.floatBlocks.gap||20,he=re.cols-ae.length;let pe=[],ee=ae.reduce((ne,Ae)=>ne+Ae,0);re.cols>=ae.length?ee-=Q*he:ee+=Q*Math.abs(he);const J=Math.round(ee/re.cols);function H(ne,Ae){const we=[];for(let $e=0;$e<ne;$e++)we.push(re.width?.[$e]?Math.round(ee/100*re.width?.[$e]):Ae);return we}pe=H(re.cols,J);const X=ee-pe.reduce((ne,Ae)=>ne+Ae,0);if(X!==0){let ne=pe.map((we,$e)=>[$e,we]).filter(we=>we[1]>30);const Ae=ne.length-Math.abs(X);ne=ne.map((we,$e)=>{const K=Ae<=$e?we[1]+(X>0?1:-1):we[1];return[we[0],K]}),ne.map(we=>(pe[we[0]]=we[1],we))}let ce={items:pe,gap:ke.gap||20};const xe=pe.reduce((ne,Ae)=>ne+Ae,0);Y(pe.map(ne=>(ne/xe*100).toFixed(1))),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksPreset",settings:ce,editFromStructure:Yo()}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...ce,items:ce.items.map((ne,Ae)=>({width:ne,current:!1}))},changeKey:"width"})},me=()=>{const re=c.getFieldsValue(!0);if(O<8){const ke=h.floatBlocks.items.map(H=>H.width),ae=h.floatBlocks.gap,Q=ke.reduce((H,X)=>H+(X>30?X:0),0),he=(Q-30-ae)/Q,pe=ke.map(H=>H>30?Math.round(H*he):H).reduce((H,X)=>H+(X>30?X:0),0);let ee=ke.map(H=>H>30?Math.round(H*he):H);ee.push(30);const J=Q-pe-30-ae;if(J!==0){let H=ee.map((ce,xe)=>[xe,ce]).filter(ce=>ce[1]>30);const X=H.length-Math.abs(J);H=H.map((ce,xe)=>{const ne=X<=xe?ce[1]+(J>0?1:-1):ce[1];return[ce[0],ne]}),H.map(ce=>(ee[ce[0]]=ce[1],ce))}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_ADD,settings:{gap:re.gap,gapMobile:re.gapMobile,minWidth:30},editFromStructure:Yo()}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,items:ee.map((H,X)=>({width:H,current:h.floatBlocks.items[X]?.current||!1}))},changeKey:"width"})}else document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.add("noactive")},se=re=>{const ke=c.getFieldsValue(!0);let ae=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((ne,Ae)=>{ne===re.target.closest(".selected-element-panel__columns-settings__controls__column")&&(ae=Ae)});const Q=+h.floatBlocks.gap,he=+h.floatBlocks.items[ae].width+Q,pe=h.floatBlocks.items.map(ne=>+ne.width),ee=(pe.length-1)*Q,J=pe.reduce((ne,Ae)=>ne+Ae,0)+ee,H=pe.length-1,X=Math.floor(he/H);let ce=pe.filter((ne,Ae)=>Ae!==ae).map(ne=>ne+X);const xe=J-(ce.reduce((ne,Ae)=>ne+Ae,0)+(pe.length-2)*Q);if(xe!==0){const ne=ce.length-Math.abs(xe);ce=ce.map((Ae,we)=>ne<=we?Ae+(xe>0?1:-1):Ae)}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_REMOVE,settings:{removedBlockIndex:ae,gap:ke.gap},editFromStructure:Yo()}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,items:ce.map((ne,Ae)=>({width:ne,current:h.floatBlocks.items.filter((we,$e)=>$e!==ae)[Ae].current}))},changeKey:"width"})},_e=re=>{if(O>=8)return;const ke=c.getFieldsValue(!0);let ae=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((we,$e)=>{we===re.target.closest(".selected-element-panel__columns-settings__controls__column")&&(ae=$e)});const Q=parseFloat(ke.gap)||0,he=h.floatBlocks.items.map(we=>+we.width),pe=he[ae],ee=he.reduce((we,$e)=>we+$e,0),J=ee-Q,H=ee+pe,X=H>0?J/H:1;let ce=[];const xe=[];he.forEach((we,$e)=>{ce.push(Math.max(30,Math.round(we*X))),xe.push(h.floatBlocks.items[$e]?.current||!1),$e===ae&&(ce.push(Math.max(30,Math.round(pe*X))),xe.push(!1))});const ne=J-ce.reduce((we,$e)=>we+$e,0);if(ne!==0){let we=ce.map((K,ie)=>[ie,K]).filter(K=>K[1]>30);const $e=we.length-Math.abs(ne);we=we.map((K,ie)=>[K[0],$e<=ie?K[1]+(ne>0?1:-1):K[1]]),we.forEach(K=>ce[K[0]]=K[1])}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_COPY,settings:{copiedBlockIndex:ae,gap:ke.gap,widths:ce},editFromStructure:Yo()});const Ae=ce.reduce((we,$e)=>we+$e,0);Y(ce.map(we=>(we/Ae*100).toFixed(1))),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,items:ce.map((we,$e)=>({width:we,current:xe[$e]||!1}))},changeKey:"width"})},ve=(0,n.useCallback)(re=>{const ke=".selected-element-panel__columns-settings__controls__column",ae=Array.from(document.querySelectorAll(ke)).indexOf(re.target.closest(ke)),Q=ae-1;if(Q<0)return;const he=h.floatBlocks,pe=he.items.map(({width:ee,current:J})=>({width:ee,current:J||!1}));[pe[Q],pe[ae]]=[pe[ae],pe[Q]],d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_SWAP,settings:{indexA:Q,indexB:ae},editFromStructure:Yo()}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...he,items:pe},changeKey:"width"})},[h,$,i,d]),de=re=>{_(re),d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_WRAP,settings:{wrap:!T}}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,wrap:!T},changeKey:"wrap"})},De=re=>{w(re),d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_DIR,settings:{dirRevert:!E}}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,dirRevert:!E},changeKey:"dir"})},ye=()=>setTimeout(()=>p?.current&&p.current.focus({cursor:"end"}),300);return h.floatBlocks&&h.floatBlocks.items.length>0&&(0,o.jsx)(t.ui_kit$Form,{layout:"vertical",form:c,name:"float_blocks_settings_form",autoComplete:"off",initialValues:{gap:h.floatBlocks?.gap||0,gapDim:"px",gapMobile:h.floatBlocks?.gapMobile||0,valign:h.floatBlocks?.valign||"top",...h.floatBlocks?.items.reduce((re,{width:ke},ae)=>(re[`width-${ae}`]=ke,re),{})},onValuesChange:q,onFieldsChange:ye,className:"element-controls",children:(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings",style:{paddingTop:b.switchDesktopMobilePropsEnabled||b.stepToOtherElementEnabled||b.deleteButtonEnabled||h.type==="structure"?0:24},children:[h.floatBlocks.items.length===1&&(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:10},title:s('The selected element is in the block that supports a multicolumn structure. To add a new column, click the "Add a column" button.'),type:"info"}),z!=="mobile"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__header",children:[(0,o.jsx)("span",{className:"selected-element-panel__columns-settings__header-title",children:s("Columns")}),(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__links",children:[(0,o.jsxs)("span",{className:"selected-element-panel__columns-settings__links__add",onClick:me,children:[(0,o.jsx)(r.EmIcons,{icon:"PlusCircleOutlined",component:t.icons$PlusCircleOutlined,size:16,strokeWidth:b.iconStrokeWidth})," ",s("Add column")]}),h.floatBlocks.items.length>1&&(0,o.jsx)("span",{onClick:te,children:(0,o.jsxs)(t.ui_kit$Tooltip,{title:s("Make columns the same width."),children:[(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined})," ",s("Equalize")]})})]})]}),h.floatBlocks.items.length>1&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:16},children:(0,o.jsx)("div",{className:"selected-element-panel__columns-settings__controls",children:h.floatBlocks.items.map((re,ke)=>(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__controls__column "+(re.current?"current":""),style:{width:re.width/j*100+"%"},children:[ke>0&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Swap columns"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__swap",onClick:ve,children:(0,o.jsx)(r.EmIcons,{icon:"SwapHorizontalIcon",component:t.icons$SwapHorizontalIcon,size:15,strokeWidth:b.iconStrokeWidth})})}),h.floatBlocks.items.length>1&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Delete column"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__remove",onClick:se,children:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:15,strokeWidth:b.iconStrokeWidth,style:{color:"#ff4d4f"}})})}),h.floatBlocks.items.length<8&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Copy column"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__copy",onClick:_e,children:(0,o.jsx)(r.EmIcons,{icon:"CopyOutlined",component:t.icons$CopyOutlined,size:15,strokeWidth:b.iconStrokeWidth})})}),(0,o.jsx)("div",{className:"selected-element-panel__columns-settings__controls__field",children:(0,o.jsx)(t.ui_kit$Form.Item,{label:"",name:"width-"+ke,children:(0,o.jsx)(t.ui_kit$InputNumber,{min:30,value:re.width||0,placeholder:s("Width"),ref:v==="width-"+ke&&p})})})]},"floatblock-"+ke))})}),(0,o.jsxs)("div",{className:"columns-presets",children:[(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{ue({cols:1})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol1",component:t.icons$LayoutCol1})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{ue({cols:2})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol2",component:t.icons$LayoutCol2})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{ue({cols:2,width:[66,34]})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol2WideLeft",component:t.icons$LayoutCol2WideLeft})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{ue({cols:2,width:[34,66]})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol2WideRight",component:t.icons$LayoutCol2WideRight})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{ue({cols:3})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol3",component:t.icons$LayoutCol3})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{ue({cols:4})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol4",component:t.icons$LayoutCol4})})]})]}),h.floatBlocks.items.length>1&&(0,o.jsxs)(o.Fragment,{children:[z==="mobile"&&(0,o.jsx)("div",{style:{marginBottom:24},children:(0,o.jsx)(t.ui_kit$Switch,{id:"column-wrap",label:s("Line break on mobile devices"),size:"small",disabled:h.floatBlocks?.wrap===void 0,checked:T,onChange:de,labelStyle:{position:"relative",top:2}})}),z!=="mobile"&&(0,o.jsx)("div",{style:{marginBottom:24},children:(0,o.jsx)(t.ui_kit$Switch,{id:"column-dir-revers",label:s("Reverse order on desktop"),size:"small",disabled:h.floatBlocks?.wrap===void 0,checked:E,onChange:De,labelStyle:{position:"relative",top:2}})})]}),h.floatBlocks.items.length>1&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:s("Vertical alignment"),titleStyle:{paddingTop:20},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"valign",style:{marginBottom:0},children:(0,o.jsx)(t.ui_kit$FormVerticalAlignControl,{disabled:h.floatBlocks.items.length<=1,strokeWidth:b.iconStrokeWidth,labels:{alignTop:s("Align top"),alignMiddle:s("Center vertically"),alignBottom:s("Align bottom")}})})})}),(0,o.jsxs)(o.Fragment,{children:[z!=="mobile"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:s("Indent between columns"),titleStyle:{paddingTop:20},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gap",style:{marginBottom:20},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,disabled:h.floatBlocks.items.length<=1,placeholder:s("Indent between columns"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px",ref:v==="gap"&&p})})})}),z==="mobile"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:s("Indent in mobile"),titleStyle:{paddingTop:20},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gapMobile",style:{marginBottom:20},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,disabled:h.floatBlocks.items.length<=1,placeholder:s("Indent in mobile"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})})]})]})]})]})})};Ll.propTypes={selectedElement:g.default.shape({parent:g.default.string})};var gd=()=>{},Ol=({email:e,formSettings:i={},onClosePanel:l=gd})=>{const{__:s}=r.useI18n(),a=r.useRootElement(),d=r.useDispatch(),c=r.useSendPostMessage(),p=Object.prototype.hasOwnProperty.call(e,"type")?r.BLOCK:r.EMAIL,f=r.useSelector(r.selectElementSettings$1),x=r.useSelector(r.selectElementSettings),k=r.useSelector(r.selectPropertiesPanelKey),b=p==="email"?f:x,h=Object.keys(i).length>0?i.settings:b,T=i?.type==="advanced"&&!!i?.content,_=!!i?.extraTabs?.length,E=r.useAppConfig(),w=h.type==="customTable",v=!!h.type&&!!h.floatBlocks?.items.length>0&&!!h.floatBlocks?.items.filter(y=>!!y.width).length>0,A=(0,n.useRef)(null);(0,n.useEffect)(()=>{const y=Object.values(r.ELEMENT_TYPES),oe=h.type&&y.includes(h.type)?`${h.type}-${JSON.stringify(h.path||[])}`:null;if(T||_){const G=a.querySelector(".email-pane .panel-form__body");G&&(G.scrollTop=0),d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else if(h.type&&y.includes(h.type)){const G=A.current!==oe;if(A.current=oe,h.activateSection!=="structure"){if(G){const q=a.querySelector(".email-pane .panel-form__body");q&&(q.scrollTop=0)}d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else d(r.setPropertiesPanelKey(r.STRUCTURE))}else JSON.stringify(h)!=="{}"&&(A.current=null,d(r.setPropertiesPanelKey("")))},[h,d,a,T,_]);const j=(0,n.useMemo)(()=>{const y=[{key:r.EDIT_SELECTED_ELEMENT,label:(0,o.jsx)("span",{style:{textTransform:"capitalize"},children:h.caption?h.caption:s("Edit element")})}];return v&&y.push({key:r.STRUCTURE,label:s("Columns")}),y},[h.caption,v,s]),C=(0,n.useMemo)(()=>[{key:r.EDIT_SELECTED_ELEMENT,label:s("Cell")},{key:r.TABLE_PROPERTIES,label:s("Table")}],[s]),P=y=>{y.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_REMOVE}),d(p==="email"?r.setElementSettings$1({}):r.setElementSettings({}))},Y=y=>{y.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_PARENT_GET})},z=()=>{l(h),d(r.resetToLastActiveSettingsTab()),setTimeout(()=>{d(p==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET})},$=(0,o.jsxs)(o.Fragment,{children:[E.deleteButtonEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Remove element by Delete Key"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{type:"text",onClick:P,disabled:!h.deletable,icon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:18,strokeWidth:E.iconStrokeWidth})})}),E.stepToOtherElementEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Up to parent element"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{type:"text",onClick:Y,disabled:!h.parent,icon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"GoToParent",component:t.icons$GoToParent,size:18,strokeWidth:E.iconStrokeWidth})})})]}),O=E.switchDesktopMobilePropsEnabled||E.stepToOtherElementEnabled||E.deleteButtonEnabled;return(0,o.jsxs)(t.ui_kit$PanelForm,{children:[(0,o.jsx)(t.ui_kit$PanelForm.Header,{onClose:z,closeIcon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"Close",component:t.icons$Close,size:24,strokeWidth:E.iconStrokeWidth}),extra:O?$:void 0,children:(0,o.jsx)(t.ui_kit$Tabs,{items:w?C:j,activeKey:k,onChange:y=>d(r.setPropertiesPanelKey(y||""))})}),(0,o.jsx)(t.ui_kit$PanelForm.Body,{children:w?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{display:k==="Edit selected element"?void 0:"none"},children:(0,o.jsx)(dt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:p,formName:`${r.EDIT_SELECTED_TABLE_CELLS}`})}),(0,o.jsx)("div",{style:{display:k==="Table properties"?void 0:"none"},children:(0,o.jsx)(dt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:p,formName:`${r.TABLE_PROPERTIES}`})})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{display:k==="Edit selected element"?void 0:"none"},children:(0,o.jsx)(dt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:p})}),v&&(0,o.jsx)("div",{style:{display:k==="Structure"?void 0:"none"},children:(0,o.jsx)(Ll,{selectedElement:h,emailElementType:p,isSelectedElement:!1})})]})})]})},_d=({taxonomy:e})=>{const{__:i,_x:l}=r.useI18n(),s=r.useDispatch(),[a]=t.ui_kit$Form.useForm(),d=(0,n.useRef)(null),c=r.useSelector(r.selectActiveModal$1)===r.MODALS.ADD_NEW_GROUP_MODAL,p=r.useNotification(),f=r.useProjectData(),x=(0,n.useCallback)(()=>{a.resetFields(),setTimeout(()=>d.current?.focus({cursor:"start"}),0)},[a]);(0,n.useEffect)(()=>{c&&x()},[c,x]);const k=()=>s(r.closeModal$1()),[b,h]=r.useAddTermMutation(),[T,_]=(0,n.useState)(!1),E=()=>{a.validateFields().then(({name:w})=>(_(!0),b({project:f,kind:"group",name:w}).then(v=>{if("error"in v){p.error(v);return}p.success({title:i("The group “")+v.data.name+l("” was successfully created.",e)}),k()}))).catch(w=>{}).finally(()=>_(!1))};return(0,o.jsx)(t.ui_kit$Modal,{title:i("Add a new group"),open:c,onOk:E,onCancel:k,className:"new-group-modal",footer:[(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"large",loading:h.isLoading||T,onClick:E,children:i("Create group")},"submit")],children:(0,o.jsx)(t.ui_kit$Form,{form:a,layout:"vertical",name:"add_new_group_form",onFinish:E,initialValues:{remember:!1,name:""},autoComplete:"off",style:{paddingTop:10},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"name",rules:[{required:!0,message:i("Please enter the group name")}],children:(0,o.jsx)(t.ui_kit$Input,{disabled:h.isLoading,size:"large",placeholder:i("Enter the group name"),ref:d,style:{marginBottom:5}})})})})},xd=({group:e,refetch:i})=>{const{__:l,_x:s}=r.useI18n(),a=r.useDispatch(),[d]=t.ui_kit$Form.useForm(),c=(0,n.useRef)(null),p=r.useSelector(r.selectActiveModal$1)===r.MODALS.EDIT_GROUP_NAME_MODAL,f=r.useNotification(),{id:x=null,name:k=""}=e,b=()=>a(r.closeModal$1()),[h,T]=r.useEditTermMutation();(0,n.useEffect)(()=>{p&&d.setFieldsValue({name:k})},[p,k,d]);const _=()=>{d.validateFields().then(({name:E})=>{h({kind:"group",id:x,name:E}).then(({data:w,error:v})=>{v?(f.error({error:v}),d.setFieldValue("name",E)):(i().then(({data:A})=>{if(A){const j=A[0]?.children?.find(C=>C.id===x)?.name;d.setFieldValue("name",j)}}),b(),f.success({title:l("The group “")+E+s("” was successfully changed to “","group")+w.name+l("”.")}))})})};return(0,o.jsx)(t.ui_kit$Modal,{title:l("Change group name"),open:p,onOk:_,onCancel:b,className:"new-group-name-modal",footer:[(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"large",loading:T.isLoading,onClick:_,children:l("Change name")},"submit")],children:(0,o.jsx)(t.ui_kit$Form,{form:d,layout:"vertical",name:"rename_group_form",onFinish:_,initialValues:{remember:!1,name:k},autoComplete:"off",style:{paddingTop:10},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"name",rules:[{required:!0,message:l("Please enter the group name")}],children:(0,o.jsx)(t.ui_kit$Input,{disabled:T.isLoading,size:"large",placeholder:l("Enter the group name"),ref:c,style:{marginBottom:5}})})})})},kd=({className:e,refetchProjectGroups:i,isLoading:l})=>{const{__:s,_x:a}=r.useI18n(),d=r.useDispatch(),c=r.useNotification(),{modal:p}=t.ui_kit$App.useApp(),{confirm:f}=p,{token:x}=(0,t.ui_kit$useToken)(),k=r.useSelector(r.selectProjectGroups),[b]=r.useDeleteTermMutation(),h=(A,j)=>{b({kind:"group",id:Number(A)}).unwrap().then(C=>{C?.deleted&&c.success({title:s("The group “")+j+a("” was successfully deleted.","recovery")})}).catch(C=>{c.error({error:C})})},T=(A,j)=>{f({mask:{closable:!0},centered:!0,title:a("Are you sure to delete “","group")+j+s("” group and all nested groups?"),icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:22,style:{color:t.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0}}),okText:s("Yes"),cancelText:s("No"),onOk:()=>h(String(A),j)})},_=(A,j)=>{d(r.openModal$1(r.MODALS.EDIT_GROUP_NAME_MODAL)),v({id:A,name:j})},E=A=>[{label:s("Rename"),key:"Rename",icon:(0,o.jsx)(r.EmIcons,{icon:"CopyOutlined",component:t.icons$CopyOutlined,size:16}),onClick:()=>_(A.id,A.name)},{label:s("Remove"),icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16}),key:"Remove",style:{color:"#ff4d4f"},onClick:()=>T(A.id,A.name)}],[w,v]=(0,n.useState)({id:null,name:""});return(0,o.jsxs)("div",{className:(0,He.default)("groups-management",{[e]:e}),children:[l?(0,o.jsx)(t.ui_kit$Skeleton,{active:!0}):(0,o.jsxs)(t.ui_kit$Row,{children:[!!k?.length&&k?.map((A,j)=>(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:`group_${A.id}`,style:{marginBottom:x.formItemMarginBottomMD},label:(0,o.jsxs)(t.ui_kit$Flex,{justify:"space-between",align:"center",style:{width:"100%"},children:[(0,o.jsx)("span",{children:A.name}),(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"groups-management__group_menu","data-group-id":A.id,size:"large",children:(0,o.jsx)(t.ui_kit$Dropdown,{className:"groups-management__group_menu-inner",placement:"bottomLeft",menu:{items:E(A)},trigger:["hover"],children:(0,o.jsx)("span",{className:"groups-management__actions",children:(0,o.jsx)(r.EmIcons,{icon:"MoreOutlined",component:t.icons$MoreOutlined})})})})]}),className:"groups-management__group-select",rules:[{message:"Please input category name!",type:"array"}],children:(0,o.jsx)(t.ui_kit$Select,{mode:"tags",style:{width:"100%"},placeholder:s("Type category here"),options:A.children?.map(C=>({label:C.name,value:String(C.id)})),tagRender:C=>{const{label:P,closable:Y,onClose:z}=C,$=O=>{O.preventDefault(),O.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:x.colorPrimary,onMouseDown:$,closable:Y,onClose:z,style:{borderRadius:6},children:P})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})},A.id)),(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:x.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Button,{id:"add_group_button",icon:(0,o.jsx)(r.EmIcons,{icon:"AddSlide",component:t.icons$AddSlide}),style:{width:"100%"},onClick:()=>d(r.openModal$1(r.MODALS.ADD_NEW_GROUP_MODAL)),children:s("Add group")})})})]}),(0,o.jsx)(_d,{taxonomy:r.ELEMENT_TYPES.GROUP}),(0,o.jsx)(xd,{group:w,refetch:i})]})},{title:Ci,description:Xt,tags:Kt,type:Pi,is_template:Ed,group:Bd}={title:"title",description:"description",tags:"tags",type:"type",is_template:"is_template",group:"group"},Sd={[Ci]:"",[Xt]:"",[Kt]:[],[Ed]:!1},Td={[Xt]:"",[Kt]:[],[Pi]:""};function Rd(e){const i=new Set;return e?.filter(l=>i.has(l.name)?!1:(i.add(l.name),!0))}var yd=e=>Array.isArray(e)&&e.length>0,$l=({className:e="",element:i})=>{const{__:l}=r.useI18n(),s=r.useDispatch(),a=r.useEmailAttributesWriter(),[d]=t.ui_kit$Form.useForm(),{token:c}=(0,t.ui_kit$useToken)(),p=r.useAppConfig(),f=r.useSelector(r.selectProjectGroups),{data:x}=r.useGetBlocksSchemaQuery(),k=r.useProjectData(),b=i.hasOwnProperty("type")?r.BLOCK:r.EMAIL,h=i.hasOwnProperty("type")?r.BLOCK_TAGS:r.EMAIL_TAGS,{data:T,refetch:_,isLoading:E,isFetching:w,isUninitialized:v,isSuccess:A}=r.useGetTermsQuery({project:k,kind:"group"},{skip:!k?.id});(0,n.useEffect)(()=>{T&&s(r.projectGroupsLoaded(T,b==="email"?i.group??[]:void 0))},[s,T,b,i.group]),(0,n.useEffect)(()=>{!v&&_()},[v,_]);const[j,C]=(0,n.useState)([]),[P,Y]=(0,n.useState)([]),[z,$]=(0,n.useState)(i.is_template||!1),O=r.useProjectData();(0,n.useEffect)(()=>{!v&&_()},[i.group,_,v]),(0,n.useEffect)(()=>{if(A&&i.is_template&&yd(i.group)){const q=i.group;let te={};q.length&&f.length&&q?.forEach(me=>{f?.forEach(se=>{let _e=se.children.find(ve=>ve.id===me);_e&&(te.hasOwnProperty(se.id)||(te[se.id]=[]),te[se.id].push({label:_e.name,value:_e.id}))})});let ue={};for(let me in te)te.hasOwnProperty(+me)&&(ue[`group_${me}`]=te[me].map(se=>({...se,value:String(se.value)})));d.setFieldsValue(ue)}},[d,f,i.is_template,i.group,A]);const{data:y}=r.useGetTermsQuery({project:O,kind:h},{skip:!O?.id});(0,n.useEffect)(()=>{Y(Rd(y)?.map(q=>({value:q.name,key:q.id})))},[y]),(0,n.useEffect)(()=>{if(i){const q=wo.getTaxonomy(i,h)?.map(me=>me.name),te=i.emailtags||i.blocktags,ue=wo.getTaxonomy(i,h)?.filter(me=>te.includes(me.id)).map(me=>me.name);d.setFieldsValue({title:i.title,description:i.description,tags:i.tags||ue||q,type:i.type})}},[d,i,h]);const oe=q=>{const te=Object.keys(q)[0],ue=q,me=te.split("_")[0];if(me===Ci)a({title:ue[te]});else if(me===Xt)a({description:ue[te]});else if(me===Kt){const se=ue[te];a({tags:se?.map(_e=>_e.trim())})}else me==="is"&&b==="email"&&a({is_template:ue[te]});switch(te.split("_")[0]){case Bd:s(r.setEmailGroups({[te.split("_")[1]]:q[te]}));break;case Pi:s(r.blocksApi.util.updateQueryData("getBlock",i.id,se=>{Object.assign(se,{type:q[te]})}));break;default:return}};(0,n.useEffect)(()=>{if(x){const q=x.schema.properties.acf.properties.type.items.enum;let te=[];const ue={Applications:l("Apps"),Articles:l("Article"),Banners:l("Banners"),Buttons:l("Buttons"),"Call to Action":l("Call to Action"),Contacts:l("Contacts"),Content:l("Content"),"E-Commerce":l("E-Commerce"),Feature:l("Features"),Footer:l("Footers"),Header:l("Headers"),Lists:l("Lists"),Menu:l("Menus"),Other:l("Others"),Polls:l("Polls"),Promocodes:l("Promocodes"),Separators:l("Separators")};for(let me in q)te.push({label:ue[q[me]],value:q[me]});C(te)}},[x,l]);const G=q=>{$(q)};return(0,o.jsx)("div",{className:(0,He.default)("settings-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"settings_panel_form",initialValues:b==="email"?{EmailInitialValues:Sd}:Td,onValuesChange:oe,autoComplete:"off",children:[p.subjectEnabled&&b==="email"&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Title"),name:Ci,tooltip:{title:l("The title of the email is displayed in the list of the templates and usually matches the subject line, but you can change it."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$TextArea,{placeholder:l("Type title here"),autoSize:{minRows:1}})}),p.descriptionEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Description"),name:Xt,tooltip:{title:l("Description is used in other sections of the service."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$TextArea,{placeholder:l("Type your description here"),autoSize:{minRows:2}})}),p.tagsEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Tags"),name:Kt,tooltip:{title:l("Tags help you find the block in the list."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},rules:[{message:l("Please input tags!"),type:"array"}],children:(0,o.jsx)(t.ui_kit$Select,{mode:"tags",style:{width:"100%"},placeholder:l("Type your tags here"),options:P,tagRender:q=>{const{label:te,closable:ue,onClose:me}=q,se=_e=>{_e.preventDefault(),_e.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:c.colorPrimary,onMouseDown:se,closable:ue,onClose:me,style:{borderRadius:6},children:te})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})}),b==="email"&&p.isTemplateEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:16}}),(0,o.jsx)(t.ui_kit$Tooltip,{title:i.isNew?l("Save email first."):l("Use this email as a template for creating future emails."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"is_template",valuePropName:"checked",initialValue:z,children:(0,o.jsx)(t.ui_kit$Switch,{id:"setIsTemplate",label:l("Is a template"),size:"small",onChange:G,disabled:i.isNew,labelStyle:{position:"relative",top:2,fontSize:14,color:c.colorText}})})},"isTemplate")]}),z&&(0,o.jsx)(kd,{element:i,refetchProjectGroups:_,isLoading:E||w}),b==="block"&&(0,o.jsx)(t.ui_kit$Form.Item,{name:Pi,label:l("Type"),tooltip:{title:l("Select the block type to find any block on the list faster."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},rules:[{message:l("Please input type!")}],children:(0,o.jsx)(t.ui_kit$Select,{placeholder:l("Choose block type"),options:j,getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})]})})};$l.propTypes={className:g.default.string,email:g.default.object};var{utm_source:Fl,utm_medium:Ml,utm_campaign:Dl,utm_term:Vl,utm_content:Hl}={utm_source:"utm_source",utm_medium:"utm_medium",utm_campaign:"utm_campaign",utm_term:"utm_term",utm_content:"utm_content"},wd={[Fl]:"",[Ml]:"",[Dl]:"",[Vl]:"",[Hl]:""},Ul=({className:e="",email:i=void 0})=>{const{__:l}=r.useI18n(),s=r.useEmailAttributesWriter(),[a]=t.ui_kit$Form.useForm();(0,n.useEffect)(()=>{i&&a.setFieldsValue({utm_source:i.utm_parameters?.utm_source||"",utm_medium:i.utm_parameters?.utm_medium||"",utm_campaign:i.utm_parameters?.utm_campaign||"",utm_term:i.utm_parameters?.utm_term||"",utm_content:i.utm_parameters?.utm_content||""})},[a,i]);const d=c=>{const p=Object.keys(c)[0],f=c;s({utm_parameters:{...i?.utm_parameters,[p]:f[p]}})};return(0,o.jsx)("div",{className:(0,He.default)("settings-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:a,layout:"vertical",name:"settings_panel_form_utm",initialValues:wd,onValuesChange:d,autoComplete:"off",children:[(0,o.jsx)(t.ui_kit$Alert,{title:l("The specified parameters will be added to all links when exporting the email."),type:"info",showIcon:!0,style:{marginBottom:20}}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("utm_source"),name:Fl,tooltip:{title:l("Mandatory. Indicates the traffic source. Example: utm_source=google"),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:l("google")})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("utm_medium"),name:Ml,tooltip:{title:l("Identifies what type of link was used, such as cost per click or email. For example: utm_medium=cpc"),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:l("cpc")})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("utm_campaign"),name:Dl,tooltip:{title:l("Indicates a specific product promotion or a marketing campaign. Example: utm_campaign=spring_sale"),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:l("spring_sale")})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("utm_term"),name:Vl,tooltip:{title:l("Identifies search terms. For example: utm_term=running+shoes"),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:l("running+shoes")})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("utm_content"),name:Hl,tooltip:{title:l("Indicates what user clicked to get to the site: a banner or a text link. It is often used for A/B testing and ad campaigns. Example: utm_content=logolink or utm_content=textlink"),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:l("textlink")})})]})})};Ul.propTypes={className:g.default.string,email:g.default.object};var We={PRODUCT_CAROUSEL:"productCarousel",SINGLE_IMAGE_PREVIEW:"singleImagePreview",DEAL_ANNOTATION:"dealAnnotation",DEAL_CARD:"dealCard"},Wl="emailmaker-gmail-annotations";function Ai(e){return/^[A-Za-z]{3}$/.test((e??"").trim())}function jd(e){return typeof e=="object"&&e!==null}function qt(e,i){const l=e[i];return typeof l=="string"?l:""}var vd=new Set(["PromotionCard","DiscountOffer","Organization"]);function zl(e){let i;try{i=JSON.parse(e)}catch{return!1}const l=Array.isArray(i)?i:[i];return l.length===0?!1:l.every(s=>typeof s=="object"&&s!==null&&vd.has(String(s["@type"])))}function Id(){let e=new Date().getTime(),i=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,l=>{let s=Math.random()*16;return e>0?(s=(e+s)%16|0,e=Math.floor(e/16)):(s=(i+s)%16|0,i=Math.floor(i/16)),(l==="x"?s:s&3|8).toString(16)})}function Jt(e){return e.annotationType||We.PRODUCT_CAROUSEL}function ct(e){return!!(e?.image||e?.url||e?.headline||e?.price||e?.priceCurrency||e?.discountValue)}function Ni(e){return!e.description&&!e.discountCode&&!e.availabilityStarts&&!e.availabilityEnds}function Qt(e){return typeof e=="string"&&e.trim().length>0}function Li(e){return Qt(e)?/^https?:\/\//i.test(e.trim()):!1}function Gl(e){return Qt(e?.image)&&Li(e?.url)}function Cd(e){switch(Jt(e)){case We.SINGLE_IMAGE_PREVIEW:return Gl(e.cards?.[0]);case We.DEAL_ANNOTATION:return!Ni(e);case We.DEAL_CARD:return Qt(e.description)&&(Li(e.offerPageUrl)||Li(e.merchantHomepageUrl));case We.PRODUCT_CAROUSEL:default:return!!e.cards?.some(Gl)}}function Pd(e){switch(Jt(e)){case We.SINGLE_IMAGE_PREVIEW:return!ct(e.cards?.[0])&&!Qt(e.discountCode);case We.DEAL_ANNOTATION:return Ni(e);case We.DEAL_CARD:return Ni(e)&&!e.offerPageUrl&&!e.merchantHomepageUrl;case We.PRODUCT_CAROUSEL:default:return!e.cards?.some(ct)}}function Ad(e){switch(Jt(e)){case We.DEAL_ANNOTATION:case We.DEAL_CARD:return!!(e.description||e.discountCode||e.availabilityStarts||e.availabilityEnds||e.offerPageUrl||e.merchantHomepageUrl);case We.SINGLE_IMAGE_PREVIEW:return ct(e.cards?.[0]);case We.PRODUCT_CAROUSEL:default:return e.logo?!0:!!e.cards?.some(ct)}}function Nd(e){let i=typeof e.price=="string"||typeof e.price=="number"?String(e.price):"",l=typeof e.discountValue=="string"||typeof e.discountValue=="number"?String(e.discountValue):"";const s=typeof e.em_regularPrice=="string"||typeof e.em_regularPrice=="number"?String(e.em_regularPrice):"",a=typeof e.em_price=="string"||typeof e.em_price=="number"?String(e.em_price):"";if(!i&&s&&(i=s),!l&&i&&a){const d=parseFloat(i),c=parseFloat(a);!isNaN(d)&&!isNaN(c)&&d>=c&&(l=String(d-c))}return{id:Id(),image:typeof e.image=="string"?e.image:"",url:typeof e.url=="string"?e.url:"",headline:typeof e.headline=="string"?e.headline:"",price:i,priceCurrency:typeof e.priceCurrency=="string"?e.priceCurrency:"",discountValue:l}}function Yl(e,i){const l={"@context":"http://schema.org/","@type":"PromotionCard",image:e.image};if(e.url&&(l.url=e.url),e.headline&&(l.headline=e.headline),e.price&&(l.price=e.price),e.priceCurrency){const s=e.priceCurrency.trim();l.priceCurrency=Ai(s)?s.toUpperCase():s}return e.discountValue&&(l.discountValue=e.discountValue),i&&(l.position=i),l}function Oi(e){const i={"@context":"http://schema.org/","@type":"DiscountOffer"};for(const l of["description","discountCode","availabilityStarts","availabilityEnds","offerPageUrl","merchantHomepageUrl"]){const s=e[l];s&&(i[l]=s)}return i}function Xl(e){return{"@context":"http://schema.org/","@type":"Organization",logo:e}}function Ld(e){const i=Jt(e),l=[];if(i===We.DEAL_CARD)return[Oi(e)];if(i===We.DEAL_ANNOTATION){const s=[];return e.logo&&s.push(Xl(e.logo)),s.push(Oi(e)),s}if(e.logo&&l.push(Xl(e.logo)),i===We.SINGLE_IMAGE_PREVIEW){const s=e.cards?.[0];return e.discountCode?.trim()&&l.push(Oi(e)),s&&ct(s)&&l.push(Yl(s)),l}return(e.cards||[]).filter(ct).forEach((s,a)=>{l.push(Yl(s,a+1))}),l}function Od(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function $d(e){if(Pd(e))return null;const i=Od(JSON.stringify(Ld(e),null,2));return`<script type="application/ld+json" id="${Wl}">
|
|
9
|
+
__useblocks__.define("static/core/41dd8b28.js",["require","exports","module","static/core/2ff39ddf.js","static/core/c1dc75d5.js","static/core/c81e0921.js","static/core/381d4d5b.js","static/core/bce6ca28.js","static/core/de822f7e.js","static/core/edfcbabd.js","react","react/jsx-runtime","__delivery__/libs","react-dom","vite/preload-helper","classnames","dayjs"],function(fo,no,Om){const to=fo("./2ff39ddf.js"),xo=fo("./c1dc75d5.js"),r=fo("./c81e0921.js"),wo=fo("./381d4d5b.js"),di=fo("./bce6ca28.js"),La=fo("./de822f7e.js"),W=fo("./edfcbabd.js");let n=fo("react");n=to.__toESM(n);let o=fo("react/jsx-runtime"),t=fo("__delivery__/libs"),Oa=fo("react-dom"),Lt=fo("vite/preload-helper"),He=fo("classnames");He=to.__toESM(He);let Oo=fo("dayjs");Oo=to.__toESM(Oo);var g=to.__toESM(r.require_prop_types());async function Tr(e){if(typeof createImageBitmap=="function")try{const i=await createImageBitmap(e);try{return{width:i.width,height:i.height}}finally{i.close?.()}}catch{}return new Promise((i,l)=>{const s=URL.createObjectURL(e),a=new Image;a.onload=()=>{URL.revokeObjectURL(s);const d=a.naturalWidth||a.width,c=a.naturalHeight||a.height;d>0&&c>0?i({width:d,height:c}):l(new Error("Could not read image dimensions"))},a.onerror=()=>{URL.revokeObjectURL(s),l(new Error("Could not decode image"))},a.src=s})}function ft(e){return e.trim()}var $a=67108864,Fa=2e3;function Ot(e){e.abandonTimer!==void 0&&(clearTimeout(e.abandonTimer),e.abandonTimer=void 0)}function Rr(e,i){return i?new Promise((l,s)=>{if(i.aborted){s(new DOMException("Aborted","AbortError"));return}const a=()=>{s(new DOMException("Aborted","AbortError"))};i.addEventListener("abort",a,{once:!0}),e.then(d=>{i.removeEventListener("abort",a),l(d)},d=>{i.removeEventListener("abort",a),s(d)})}):e}function Ma(e={}){const i=e.maxCacheBytes??$a,l=e.abandonDelayMs??Fa,s=new Map,a=new Map;let d=0;function c(_){const E=s.get(_);E&&(d-=E.size,s.delete(_))}function p(_,E){if(c(_),!(E.size>i)){s.set(_,E),d+=E.size;for(const w of s.keys()){if(d<=i)break;c(w)}}}function f(_){const E=a.get(_);E&&(Ot(E),a.delete(_))}function x(_,E){E.waiters-=1,!(E.waiters>0||E.abandonTimer!==void 0||a.get(_)!==E)&&(E.abandonTimer=setTimeout(()=>{E.abandonTimer=void 0,!(a.get(_)!==E||E.waiters>0)&&(a.delete(_),E.controller.abort())},l))}function k(_,E,w){return E.waiters+=1,Ot(E),w.then(()=>x(_,E),()=>x(_,E)),w}async function b(_,E,w){const v=ft(_);if(!v)throw new Error("Empty image URL");const A=s.get(v);if(A){if(E?.aborted)throw new DOMException("Aborted","AbortError");return s.delete(v),s.set(v,A),A}const j=a.get(v);if(j)return k(v,j,Rr(j.promise,E));const C=new AbortController,P={promise:w(v,C.signal).then(Y=>(f(v),p(v,Y),Y)).catch(Y=>{throw f(v),Y}),controller:C,waiters:0,abandonTimer:void 0};return a.set(v,P),k(v,P,Rr(P.promise,E))}function h(_){const E=ft(_);if(!E)return;const w=a.get(E);w&&(Ot(w),w.controller.abort(),a.delete(E)),c(E)}function T(){for(const[,_]of a)Ot(_),_.controller.abort();a.clear(),s.clear(),d=0}return{resolve:b,abandonKey:h,invalidateAll:T}}async function yr(e,i){if(!e||typeof e.findFileByUrl!="function")return null;const l=await e.findFileByUrl(i);if(!l)return null;const s=typeof e.getFileById=="function"&&l.id&&await e.getFileById(l.id)||l,a=s.url||i,d=s.thumbnailUrl||s.thumbnail||a||(typeof e.getThumbnailUrl=="function"?await e.getThumbnailUrl(s):"")||"";return d?{file:s,previewUrl:d}:null}function $t(e){if(!e)return!1;try{return new URL(e,typeof window<"u"&&window.location?window.location.origin:"http://localhost").pathname.includes("/static/media/")}catch{return!1}}function Da(e){if(!(e instanceof Blob)||e.size===0)throw new r.e("Failed to download file from the URL.","UploadUrlDownloadFailed");const i=e.type?.split(";")[0]?.trim()||"image/png";if(!i.startsWith("image/"))throw new r.e("Content type at the URL is not allowed.","UploadUrlContentTypeNotAllowed");return{blob:e,mimeType:i}}async function Va(e,i){const l=await fetch(e,i);if(!l.ok)throw new Error(`Server returned ${l.status}`);return l.blob()}async function Ha(e,i,l){const s=l?{signal:l}:void 0,{blob:a}=await r.se(e,{handleFileProxy:async d=>{const c=await i.fireFileProxy(d);return r.pickFileProxyBlobFromFireResults(c)??null},handleProxyUrl:async d=>{const c=await i.fireProxyUrl(d);return r.pickProxyUrlOverrideFromFireResults(c,d)},fetchWithProxy:(d,c,p)=>xo.fetchWithResourceProxy(d,{config:i.appConfig,standalone:i.isStandalone,intent:p?.intent||"downloadBlob",validateBlob:async f=>!f.type||f.type.startsWith("image/"),init:c})},d=>Va(d,s),Da,{fetchInit:s});return a}function wr(){const e=r.useAppConfig(),i=r.useIsStandalone(),l=r.useProjectData(),s=r.useEditorProjectId(),a=l?.id!==void 0?String(l.id):s||"",d=r.useEventEmitter(xo.events.FILE_PROXY_EVENT_ID),c=r.useEventEmitter(xo.events.PROXY_URL_EVENT_ID);return(0,n.useCallback)(async(p,f)=>Ha(p,{appConfig:e,isStandalone:i,fireFileProxy:x=>d.fire({url:x,project:a}),fireProxyUrl:x=>c.fire({url:x,project:a})},f),[e,a,i,d,c])}function Ua(e){return xo.getContainer(e).getOrCreateInstance(xo.IMAGE_BLOB_RESOLVER_ID,()=>Ma())}function jr(){const e=r.useStore();return(0,n.useMemo)(()=>Ua(e),[e])}function Ft(e){const i=String(e??"").split(";")[0].trim();if(!i)return"";const l=i.toLowerCase(),s=l.indexOf("/");if(s===-1)return l;const a=l.slice(s+1);return a==="svg+xml"?"svg":a}var vr=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),ci=({onChange:e,value:i,validateStatus:l,placeholder:s,disabled:a,name:d,elementSettings:c,imageInfo:p,previewReloadSignal:f,onRemotePreviewValidate:x})=>{const k=r.useCurrentUser(),b=r.useProjectData(),h=r.useAppConfig(),T=r.useIsStandalone(),{__:_}=r.useI18n();r.useSendPostMessage();const E=r.useSendPostMessageEx(),{openImagePicker:w}=r.useImagePicker(),v=r.useStorageProvider(),A=r.useRestClient(),j=b?.id!==void 0?String(b?.id):"",C=k?.id!=="0"?String(k.id):"",{dataProvider:P}=(0,n.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:v,projectId:j,restApi:A,i18n:{__:_},pathPostfix:C,appConfig:h,isStandalone:T}),[h,T,j,A,v,C,_]),Y=wr(),[z]=r.useLazyGetImageInfoQuery(),[$,O]=(0,n.useState)({width:"",height:"",size:""}),[y,oe]=(0,n.useState)(!1),[G,q]=(0,n.useState)(0),[te,ue]=(0,n.useState)(""),me=(0,n.useRef)(""),se=(0,n.useRef)(f?.counter||0),_e=jr(),ve=(0,n.useRef)(""),de=(0,n.useRef)(""),[De,ye]=(0,n.useState)(0),re=r.usePlanFeatureGate("image_editor"),ke=()=>{ve.current&&(URL.revokeObjectURL(ve.current),ve.current="")};(0,n.useEffect)(()=>{if(!i){O({width:"",height:"",size:"",format:""}),me.current="",ue(""),ke();return}if(i.startsWith("data:")||i.startsWith("blob:")){ke(),me.current=i,ue(i),O({width:"",height:"",size:"",format:""});return}const ee=r.stripEmVersionFromUrlString(i);de.current=ee;const J=ft(ee),U=new AbortController;let X=!1;const ce=async ne=>{ke();const Ae=De?r.appendEmVersionForPreviewReload(ne):ne;me.current=Ae,ue(Ae);try{const{data:we}=await z(ee);return X||!we?!1:(O({width:we?.width,height:we?.height,size:we?.fileSize!=null?(we.fileSize/1024).toFixed(0):"",format:Ft(we?.format)}),!0)}catch{return!1}},xe=async()=>{const ne=await _e.resolve(J,U.signal,Y);if(X)return;const{width:Ae,height:we}=await Tr(ne);if(X)return;ke();const $e=URL.createObjectURL(ne);ve.current=$e,me.current=$e,ue($e),O({width:Ae,height:we,size:(ne.size/1024).toFixed(0),format:Ft(ne.type)})};return(async()=>{try{if(!T){const ne=await yr(P,ee);if(ne?.previewUrl&&await ce(ne.previewUrl))return}await xe()}catch{X||(ke(),me.current="",ue(""),O({width:"",height:"",size:"",format:""}))}})(),()=>{X=!0,U.abort()}},[i,P,Y,z,T,_e,De]);const ae=(0,n.useCallback)(()=>{const ee=de.current;ee&&_e.abandonKey(ft(ee)),ye(Date.now())},[_e]);(0,n.useEffect)(()=>{!f?.counter||f.name!==d||f.counter!==se.current&&(se.current=f.counter,ae())},[d,f,ae]),(0,n.useEffect)(()=>()=>ke(),[]);const Q=async(ee=null)=>{const J=d.startsWith("src"),U=ee||(J?r.MODALS.UPLOAD_IMAGE_MODAL:r.MODALS.UPLOAD_BACKGROUND_MODAL),X=r.stripEmVersionFromUrlString(i||""),ce=await w({kind:J?"img":"background",currentUrl:$t(X)?"":X,entryModal:U});if(!ce?.url)return;const xe=X===r.stripEmVersionFromUrlString(ce.url);(!xe||ce.url!==i)&&e(ce.url),ce.meta?.mode==="save"&&xe&&(ae(),J&&E(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(ce.url)}))},be=[{label:_("Upload"),key:"Upload",onClick:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}];h.imageCenterStockEnabled&&be.push({label:_("Stock"),key:"Stock",onClick:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_STOCK:r.MODALS.UPLOAD_BACKGROUND_MODAL_STOCK)}),h.imageCenterGifEnabled&&be.push({label:_("GIF"),key:"GIF",onClick:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_GIF:r.MODALS.UPLOAD_BACKGROUND_MODAL_GIF)}),h.elementAIimageEnabled&&be.push({label:_("AI"),key:"AI",onClick:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_AI:r.MODALS.UPLOAD_BACKGROUND_MODAL_AI)});const pe=()=>{oe(!1)};return(0,o.jsxs)("div",{className:(0,He.default)("upload-bg-image",{"upload-bg-image_disabled":a}),children:[i?(0,o.jsxs)("div",{className:"ant-input-file-uploader upload-bg-image__inner-wrap",onClick:ee=>{ee.target?.closest(".upload-bg-image__edit")||ee.target?.closest(".upload-bg-image__edit-menu")||ee.target?.closest(".upload-bg-image__menu")||ee.target?.closest(".inputGroup")||Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)},children:[(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,popupRender:()=>h.imagePathDropdownEnabled?(0,o.jsx)("div",{className:"inputGroup",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image,size:20,strokeWidth:h.iconStrokeWidth,style:{verticalAlign:"text-top"}}),allowClear:!0,onChange:e,value:i,placeholder:s,name:d,disabled:a,className:"upload-bg-image__input"})}):(0,o.jsx)(o.Fragment,{}),classNames:{root:"upload-bg-image__dropdown-overlay"},styles:{root:{top:32,marginTop:"8px",width:347,left:0}},trigger:["hover"],placement:"bottom",getPopupContainer:ee=>ee.closest(".upload-bg-image__inner-wrap"),children:(0,o.jsxs)("div",{className:"upload-bg-image__hover-container",style:{display:"flex",alignItems:"center"},children:[(0,o.jsx)("div",{className:"upload-bg-image__uploader",children:(0,o.jsx)("div",{className:"upload-bg-image__uploader-content",children:(0,o.jsxs)("div",{className:"upload-bg-image__uploader-content-inner",children:[(0,o.jsx)("div",{className:"upload-bg-image__uploader-img-wrap",children:te?(0,o.jsx)("img",{className:"upload-bg-image__uploader-img",src:te,alt:"",onLoad:()=>{x&&vr(r.stripEmVersionFromUrlString(i||""))&&x("success")},onError:()=>{const ee=de.current,J=r.stripEmVersionFromUrlString(te||""),U=r.stripEmVersionFromUrlString(ee||"");if(ee&&J!==U){me.current=ee,ue(ee);return}x&&vr(U)&&x("error")}}):(0,o.jsx)("div",{className:"upload-bg-image__uploader-img-placeholder","aria-hidden":!0})}),(0,o.jsx)("div",{className:"upload-bg-image__uploader-icons-wrap",children:(0,o.jsx)("div",{className:"upload-bg-image__uploader-content"})})]})})}),$.width&&$.height?(0,o.jsxs)("div",{className:"image-size",children:[$.width," × ",$.height,!!c&&(c.type===r.ELEMENT_TYPES.IMG||c.type===r.ELEMENT_TYPES.CAROUSEL)&&" → "+p.renderedWidth+" × "+p.renderedHeight,(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsxs)("span",{children:[$.size," ",_("kB")]}),$.format&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)("span",{className:"image-size-format",children:$.format})]})]}):(0,o.jsx)(t.ui_kit$Text,{type:"secondary",className:"image-empty-text",children:s})]})}),(0,o.jsx)("div",{style:{flexGrow:1}}),$.format!=="gif"&&h.imageCenterEditorEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:_("Edit"),children:(0,o.jsx)(t.ui_kit$Text,{type:"link",className:"upload-bg-image__edit",children:(0,o.jsx)(r.EmIcons,{icon:"Edit",component:t.icons$Edit,size:16,strokeWidth:h.iconStrokeWidth,onClick:()=>{re.isLocked?(oe(!0),q(r.FEATURE_UPSELL_SLIDE.image_editor)):Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_EDIT:r.MODALS.UPLOAD_BACKGROUND_MODAL_EDIT)}})})}),(0,o.jsx)(t.ui_kit$Dropdown,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:be},classNames:{root:"upload-bg-image__menu"},children:(0,o.jsx)(t.ui_kit$Text,{type:"link",className:"upload-bg-image__edit-menu image-change",children:i?(0,o.jsx)(r.EmIcons,{size:16,strokeWidth:h.iconStrokeWidth,icon:"SyncOutlined",component:t.icons$SyncOutlined,onClick:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}):_("Upload")})},"Actions")]}):(0,o.jsx)(t.ui_kit$Button,{type:"default",block:!0,onClick:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD),icon:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image,size:16,strokeWidth:h.iconStrokeWidth}),children:_("Add image")}),y&&(0,o.jsx)(r.PlanUpgradePrompt,{open:!0,onCancel:pe,initialSlide:G})]})};ci.propTypes={};var Wa=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),za=(e,i,l)=>i||(l?.type===r.ELEMENT_TYPES.CAROUSEL?["images",e]:Array.isArray(e)?e:[e]),Ir=e=>Array.isArray(e)?e.join("_"):e,No=({form:e,label:i,name:l,watchPath:s,disabled:a=!1,elementSettings:d,previewReloadSignal:c=void 0})=>{const{token:p}=(0,t.ui_kit$useToken)(),[f,x]=(0,n.useState)("success"),k=(0,n.useMemo)(()=>({marginBottom:p.formItemMarginBottomXS}),[p.formItemMarginBottomXS]),b=t.ui_kit$Form.useWatch(za(l,s,d),e);return(0,n.useEffect)(()=>{if(!b){x("");return}if(typeof b=="string"&&(b.startsWith("data:")||b.startsWith("blob:"))){x("success");return}if(Wa(b)){x("validating");return}x("success")},[b]),(0,o.jsx)(t.ui_kit$Form.Item,{name:l,validateStatus:f,style:k,children:(0,o.jsx)(ci,{validateStatus:f,placeholder:i,name:Ir(l),disabled:a,elementSettings:d,imageInfo:d?.type===r.ELEMENT_TYPES.CAROUSEL?d?.carouselImages?.[Ir(l).split("_")[1]]:d,previewReloadSignal:c,onRemotePreviewValidate:x})})};No.propTypes={label:g.default.string.isRequired,name:g.default.oneOfType([g.default.string,g.default.arrayOf(g.default.oneOfType([g.default.string,g.default.number]))]).isRequired,watchPath:g.default.arrayOf(g.default.oneOfType([g.default.string,g.default.number])),tooltipTitle:g.default.string,disabled:g.default.bool,previewReloadSignal:g.default.shape({name:g.default.string,counter:g.default.number}),form:g.default.shape({getFieldValue:g.default.func.isRequired}).isRequired},No.defaulProps={disabled:!1,previewReloadSignal:null};var So=({form:e,oneBorderRadiusValue:i,setOneBorderRadiusValue:l,elementSettings:s,namePrefix:a="",typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),p=d==="mobile",f=p?"mobileBorderRadius":"borderRadius",x=p?"mobileBorderRadiusAll":"borderRadiusAll",k=p?"mobileBorderRadiusTopLeft":"borderRadiusTopLeft",b=p?"mobileBorderRadiusTopRight":"borderRadiusTopRight",h=p?"mobileBorderRadiusBottomRight":"borderRadiusBottomRight",T=p?"mobileBorderRadiusBottomLeft":"borderRadiusBottomLeft",_=p?W.MOBILE_BORDER_RADIUS_POSITION:W.BORDER_RADIUS_POSITION,E=()=>{const w=e.getFieldsValue(!0);let v;i?(e.setFieldsValue({[k]:w[x]||null,[T]:w[x]||null,[b]:w[x]||null,[h]:w[x]||null}),v={[f]:{[_[k]]:w[x]||0,[_[T]]:w[x]||0,[_[b]]:w[x]||0,[_[h]]:w[x]||0}}):w[k]===w[T]&&w[k]===w[b]&&w[k]===w[h]?(e.setFieldsValue({[x]:w[k]}),v={[f]:{[_[x]]:w[k]}}):(e.setFieldsValue({[k]:null,[T]:null,[b]:null,[h]:null}),v={[f]:{[_[x]]:0,[_[k]]:0,[_[T]]:0,[_[b]]:0,[_[h]]:0}});const A=p?{mobileBorderRadius:{all:w.mobileBorderRadiusAll||null,classNamePrefix:"em-mob-border_radius_all-"}}:{[`${a}${f}`]:{...s[`${a}${f}`],...v[`${a}${f}`]}};c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:A}),l(j=>!j)};return(0,o.jsx)(t.ui_kit$FormBorderRadiusInputs,{namePrefix:a,typeOfForm:d,oneBorderRadiusValue:i,onToggle:E,borderRadiusIcon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"BorderRadius",component:t.icons$BorderRadius,className:"selected-td-form__icon-radius"})})};So.displayName="SelectedElementFormBorderRadius";var Ga="em-mob-text_align-",Ya=({value:e,onChange:i,onSync:l,fieldName:s,...a})=>{const d=(typeof e=="object"?e?.value:e)??"",c=p=>{const f={classNamePrefix:Ga,value:p};i?.(f),l?.({[s]:f})};return(0,o.jsx)(t.ui_kit$FormAlignControl,{value:d,onChange:c,...a})},Uo=({form:e,elementSettings:i,imgParent:l=!1,name:s="align",tooltipTitle:a,typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),p=r.useAppConfig(),f=d==="mobile",x=f?"mobileAlign":s;if(f){const k=b=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:b})};return(0,o.jsx)(t.ui_kit$Form.Item,{name:x,children:(0,o.jsx)(Ya,{fieldName:x,onSync:k,disabled:l&&!i.parent,strokeWidth:p.iconStrokeWidth,tooltipTitle:a})})}return(0,o.jsx)(t.ui_kit$Form.Item,{name:x,children:(0,o.jsx)(t.ui_kit$FormAlignControl,{disabled:l&&!i.parent,strokeWidth:p.iconStrokeWidth,tooltipTitle:a})})},Mo=({form:e,elementSettings:i,tooltipTitle:l,disabled:s=!1,isNewIconType:a=!1,typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),p=r.useAppConfig(),f=d==="mobile",x=f?"mobileVerticalAlign":"valign",k=b=>{e.setFieldsValue({[x]:b}),f||c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[x]:b}})};return(0,o.jsx)(t.ui_kit$Form.Item,{name:x,children:(0,o.jsx)(t.ui_kit$FormVerticalAlignControl,{...!f&&{value:i.valign,onChange:k},disabled:s,isNewIconType:a,strokeWidth:p.iconStrokeWidth})})},Xa=["mobileBoxShadowHOffset","mobileBoxShadowVOffset","mobileBoxShadowBlurRadius","mobileBoxShadowSpreadRadius","mobileBoxShadowColor","mobileBoxShadowInset"],Ka=({form:e,elementSettings:i,enableSwitch:l,usedColors:s,withoutShadowLabel:a})=>{const d=r.useSendPostMessage(),c=i.mobileBoxShadow,[p,f]=(0,n.useState)(!c||c.hOffset===0&&c.vOffset===0&&c.blurRadius===0&&c.spreadRadius===0),x=t.ui_kit$Form.useWatch(Xa,e);(0,n.useEffect)(()=>{if(!x)return;const[b,h,T,_,E,w]=x;(b===0||b===void 0||b===null)&&(h===0||h===void 0||h===null)&&(T===0||T===void 0||T===null)&&(_===0||_===void 0||_===null)&&(E===""||E===void 0||E===null)&&(w===!1||w===void 0)||f(!1)},[x]);const k=()=>{f(b=>!b),e.setFieldsValue({mobileBoxShadowHOffset:p?"":0,mobileBoxShadowVOffset:p?"":0,mobileBoxShadowBlurRadius:p?"":0,mobileBoxShadowSpreadRadius:p?"":0,mobileBoxShadowColor:"",mobileBoxShadowInset:!1}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBoxShadow:{classNamePrefix:"em-mob-box_shadow-",hOffset:p?null:0,vOffset:p?null:0,blurRadius:p?null:0,spreadRadius:p?null:0,color:null,inset:!1}}})};return(0,o.jsxs)(o.Fragment,{children:[l&&(0,o.jsx)("div",{style:{float:"right",marginTop:-9,marginRight:50},children:(0,o.jsx)(t.ui_kit$Switch,{id:"without-shadow",label:a,labelSize:"small",size:"small",checked:p,onChange:k})}),(0,o.jsx)("p",{style:{paddingBottom:"8px",margin:"-30px 0 0"},children:" "}),(0,o.jsx)(t.ui_kit$FormBoxShadowInputs,{typeOfForm:"mobile",usedColors:s})]})},jo=({typeOfForm:e="desktop",form:i,elementSettings:l,enableSwitch:s=!0})=>{const{__:a}=r.useI18n(),d=r.useSelector(r.selectEmailSettings).usedColors;return e==="mobile"&&i&&l?(0,o.jsx)(Ka,{form:i,elementSettings:l,enableSwitch:s,usedColors:d,withoutShadowLabel:a("Without shadow")}):(0,o.jsx)(t.ui_kit$FormBoxShadowInputs,{typeOfForm:e,usedColors:d})};jo.displayName="SelectedElementFormBoxShadow";var vo=({form:e,elementSettings:i,directionControl:l})=>{const{__:s}=r.useI18n();return(0,o.jsx)(t.ui_kit$FormDisplayControl,{directionControl:l,className:"selected-element-form-show",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"show",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$Radio.Group,{children:(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Radio.Button,{value:"all",children:s("Both")}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:s("Desktop"),children:(0,o.jsx)(t.ui_kit$Radio.Button,{value:"desktop",children:(0,o.jsx)(r.EmIcons,{icon:"DesktopOutlined",component:t.icons$DesktopOutlined})})}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:s("Mobile"),children:(0,o.jsx)(t.ui_kit$Radio.Button,{value:"mobile",children:(0,o.jsx)(r.EmIcons,{icon:"MobileOutlined",component:t.icons$MobileOutlined})})})]})})})})},ui=({form:e,elementSettings:i,handleChangeValues:l})=>{const{__:s}=r.useI18n(),a=(0,n.useRef)(),{token:d}=(0,t.ui_kit$useToken)(),[c,p]=(0,n.useState)(!1),[f,x]=(0,n.useState)(!1),[k,b]=(0,n.useState)(!1),[h,T]=(0,n.useState)(!1),[_,E]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let O=new URL("https://emailmaker.ru/?"+i.countdown);p(O.searchParams.get("font1").endsWith("-b")||O.searchParams.get("font1").endsWith("-bi")),x(O.searchParams.get("font1").endsWith("-i")||O.searchParams.get("font1").endsWith("-bi")),b(O.searchParams.get("font2").endsWith("-b")||O.searchParams.get("font2").endsWith("-bi")),T(O.searchParams.get("font2").endsWith("-i")||O.searchParams.get("font2").endsWith("-bi")),E(O.searchParams.get("tp")==="true")},[i]);const w=[{value:"-12",label:s("-12:00 Apia")},{value:"-11",label:s("-11:00 Pago Pago, Midway Atoll")},{value:"-10",label:s("-10:00 Honolulu, Anchorage")},{value:"-9",label:s("-9:00 Anchorage, Yukon")},{value:"-8",label:s("-8:00 Los Angeles, Vancouver")},{value:"-7",label:s("-7:00 Denver, Phoenix")},{value:"-6",label:s("-6:00 Mexico City, Guadalajara")},{value:"-5",label:s("-5:00 New York, Toronto, Havana")},{value:"-4",label:s("-4:00 Caracas, Santo Domingo")},{value:"-3",label:s("-3:00 Buenos Aires, Santiago, Montevideo")},{value:"-2",label:s("-2:00 South Georgia, Saint Helena")},{value:"-1",label:s("-1:00 Azores, Cape Verde")},{value:"0",label:s("+0:00 London, Lisbon, Dublin")},{value:"1",label:s("+1:00 Paris, Berlin, Rome")},{value:"2",label:s("+2:00 Athens, Kiev, Istanbul")},{value:"3",label:s("+3:00 Istanbul, Doha, Baghdad")},{value:"4",label:s("+4:00 Baku, Dubai, Tbilisi")},{value:"5",label:s("+5:00 Karachi, Tashkent, Islamabad")},{value:"6",label:s("+6:00 Almaty, Dhaka, Bishkek")},{value:"7",label:s("+7:00 Bangkok, Ho Chi Minh City, Jakarta")},{value:"8",label:s("+8:00 Beijing, Hong Kong, Singapore")},{value:"9",label:s("+9:00 Tokyo, Seoul, Jayapura")},{value:"10",label:s("+10:00 Sydney, Melbourne, Port Moresby")},{value:"11",label:s("+11:00 Honiara, Nuku'alofa, Apia")}],v=[{value:"20",label:s("20 s")},{value:"40",label:s("40 s")},{value:"60",label:s("60 s")}],A=[{value:"arial",label:"Arial"},{value:"courier-new",label:"Courier New"},{value:"georgia",label:"Georgia"},{value:"helvetica",label:"Helvetica"},{value:"tahoma",label:"Tahoma"},{value:"times-new-roman",label:"Times New Roman"},{value:"trebuchet-ms",label:"Trebuchet MS"},{value:"verdana",label:"Verdana"},{value:"open-sans",label:"Open Sans"},{value:"roboto",label:"Roboto"}],j=O=>O&&O<(0,Oo.default)().endOf("day")-864e5,C=O=>{E(O)},P=()=>{const O=!c;e.setFieldValue("countdownNumbersStrong",O),l({countdownNumbersStrong:O}),p(O)},Y=()=>{const O=!f;e.setFieldValue("countdownNumbersItalic",O),l({countdownNumbersItalic:O}),x(O)},z=()=>{const O=!k;e.setFieldValue("countdownLabelsStrong",O),l({countdownLabelsStrong:O}),b(O)},$=()=>{const O=!h;e.setFieldValue("countdownLabelsItalic",O),l({countdownLabelsItalic:O}),T(O)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("End time"),name:"countdownTime",children:(0,o.jsx)(t.ui_kit$DatePicker,{ref:a,format:"MM/DD/YYYY HH:mm",disabledDate:j,showTime:!0,placement:"bottomRight",getPopupContainer:O=>{const y=O?.closest(".blocks-app");return y||(O?.ownerDocument?.body??document.body)},allowClear:!1,allowEmpty:!1})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("Time zone"),name:"countdownTimeZone",style:{width:"100%"},children:(0,o.jsx)(t.ui_kit$Select,{placeholder:s("Select the time zone"),getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),children:w.map(O=>(0,o.jsx)(t.ui_kit$Select.Option,{value:O.value,children:O.label},O.value))})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:20,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("Background color"),name:"countdownBackgroundColor",className:"countdown-color",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:s("Background color"),usedColors:i.usedColors})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownTransparency",valuePropName:"checked",style:{paddingTop:29},children:(0,o.jsx)(t.ui_kit$Switch,{id:"countdownTransparency",label:s("Transparency"),labelSize:"small",size:"small",onChange:C})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:s("Countdown font settings"),compact:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersFont",style:{marginBottom:d.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:A})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersColor",className:"countdown-color",style:{marginBottom:d.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{usedColors:i.usedColors})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersFontSize",children:(0,o.jsx)(t.ui_kit$InputNumber,{min:12,placeholder:s("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:s("Strong"),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersStrong",children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":c}),onClick:P,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-td-form__icon-radius"})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:s("Italic"),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersItalic",children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":f}),onClick:Y,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})})})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:s("Time units font settings"),compact:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsFont",style:{marginBottom:d.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:A})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsColor",className:"countdown-color",style:{marginBottom:d.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{usedColors:i.usedColors})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsFontSize",children:(0,o.jsx)(t.ui_kit$InputNumber,{min:8,placeholder:s("Font size"),addonAfter:"px",prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined})})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:s("Strong"),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsStrong",children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":k}),onClick:z,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-td-form__icon-radius"})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:s("Italic"),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsItalic",children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":h}),onClick:$,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})})})})})]})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("Language"),name:"countdownLanguage",style:{width:"100%"},children:(0,o.jsx)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:[{value:"ru_RU",label:"Русский"},{value:"en_US",label:"English"},{value:"uk_UA",label:"Українська"},{value:"pt_BR",label:"Português"},{value:"fr-CA",label:"Français"},{value:"de_DE",label:"Deutsch"},{value:"pl_PL",label:"Polski"},{value:"es_ES",label:"Español"},{value:"tr_TR",label:"Türkçe"},{value:"lt_LT",label:"Lietuvių kalba"},{value:"lv_LV",label:"Latviešu valoda"},{value:"et_EE",label:"Eesti keel"},{value:"hu_HU",label:"Magyar"},{value:"el_GR",label:"Ελληνικά"},{value:"it_IT",label:"Italiano"}]})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("Duration"),name:"countdownDuration",style:{width:"100%"},children:(0,o.jsx)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:v})})})]})]})};ui.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string};var mi=({form:e,elementSettings:i})=>{const{__:l}=r.useI18n(),{token:s}=(0,t.ui_kit$useToken)();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("URL of the video clip."),placement:"right",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:["video","source"],className:"selected-image-form__alt",children:(0,o.jsx)(t.ui_kit$Input,{allowClear:!0,placeholder:l("Video URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"VideoCameraOutlined",component:t.icons$VideoCameraOutlined})})})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Play button"),name:["video","playButton"],style:{width:"100%",marginBottom:s.formItemMarginBottomMD+4},children:(0,o.jsxs)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),children:[(0,o.jsxs)(t.ui_kit$Select.Option,{value:"youtube_red",children:[(0,o.jsx)(r.EmIcons,{icon:"YoutubeOutlined",component:t.icons$YoutubeOutlined,style:{color:"#FF0000"}})," ",l("Youtube Red")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"youtube_black",children:[(0,o.jsx)(r.EmIcons,{icon:"YoutubeOutlined",component:t.icons$YoutubeOutlined})," ",l("Youtube Black")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"youtube_white",children:[(0,o.jsx)(r.EmIcons,{icon:"YoutubeOutlined",component:t.icons$YoutubeOutlined,style:{color:"#aaa"}})," ",l("Youtube White")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"vimeo",children:[(0,o.jsx)(r.EmIcons,{icon:"Vimeo",component:t.icons$Vimeo})," ",l("Vimeo")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"white_circle",children:[(0,o.jsx)(r.EmIcons,{icon:"PlayCircleOutlined",component:t.icons$PlayCircleOutlined,style:{color:"#aaa"}})," ",l("White circle")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"black_circle",children:[(0,o.jsx)(r.EmIcons,{icon:"PlayCircleOutlined",component:t.icons$PlayCircleOutlined})," ",l("Black circle")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"white_circle_outlined",children:[(0,o.jsx)(r.EmIcons,{icon:"RightCircleOutlined",component:t.icons$RightCircleOutlined,style:{color:"#aaa"}})," ",l("White circle outlined")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"black_circle_outlined",children:[(0,o.jsx)(r.EmIcons,{icon:"RightCircleOutlined",component:t.icons$RightCircleOutlined})," ",l("Black circle outlined")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"none",children:[" ",l("Without button")]})]})})]})};mi.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string};var qa={marginBottom:10},Io=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(t.ui_kit$Row,{gutter:20,style:qa,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"ampShow",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$Radio.Group,{children:(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Radio.Button,{value:"all",children:e("Both")}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:e("AMP"),children:(0,o.jsx)(t.ui_kit$Radio.Button,{value:"amp",children:"AMP"})}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:e("HTML"),children:(0,o.jsx)(t.ui_kit$Radio.Button,{value:"html",children:"HTML"})})]})})})})})},{Option:pi}=t.ui_kit$Select,{mobileBorderRadiusAll:Ja,mobileBorderRadiusTopLeft:hi,mobileBorderRadiusBottomLeft:bi,mobileBorderRadiusTopRight:fi,mobileBorderRadiusBottomRight:gi,borderRadiusBottomRight:_i,borderRadiusTopRight:xi,borderRadiusBottomLeft:ki,borderRadiusTopLeft:Ei,alt:Qa,src:Za,title:en,link:lt,borderRadiusAll:Cr,imgReplacer:on,expanded:tn}={link:"link",borderRadiusBottomRight:"borderRadiusBottomRight",borderRadiusTopRight:"borderRadiusTopRight",borderRadiusBottomLeft:"borderRadiusBottomLeft",borderRadiusTopLeft:"borderRadiusTopLeft",mobileBorderRadiusAll:"mobileBorderRadiusAll",mobileBorderRadiusTopLeft:"mobileBorderRadiusTopLeft",mobileBorderRadiusBottomLeft:"mobileBorderRadiusBottomLeft",mobileBorderRadiusTopRight:"mobileBorderRadiusTopRight",mobileBorderRadiusBottomRight:"mobileBorderRadiusBottomRight",alt:"alt",imgReplacer:"imgReplacer",src:"src",title:"title",borderRadiusAll:"borderRadiusAll",expanded:"expanded"},Qo=({linkProtocol:e})=>{switch(e){case"https://":return(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined});case"mailto:":return(0,o.jsx)(r.EmIcons,{icon:"MailOutlined",component:t.icons$MailOutlined});case"tel:":return(0,o.jsx)(r.EmIcons,{icon:"PhoneOutlined",component:t.icons$PhoneOutlined});case"sms:":return(0,o.jsx)(r.EmIcons,{icon:"CommentOutlined",component:t.icons$CommentOutlined});case"ftp://":return(0,o.jsx)(r.EmIcons,{icon:"FileOutlined",component:t.icons$FileOutlined});case"#":return(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined});default:return(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined})}},rn=e=>[{value:"https://",label:e("Site")},{value:"mailto:",label:e("E-mail")},{value:"tel:",label:e("Phone")},{value:"sms:",label:e("SMS")},{value:"ftp://",label:e("File")},{value:"#",label:e("Anchor")},{value:"",label:e("Other")}],Zo=({handleLinkProtocolsChange:e,linkProtocol:i,__:l})=>{const s=n.default.useMemo(()=>rn(l),[l]);return(0,o.jsx)(t.ui_kit$Select,{style:{width:90,textAlign:"left"},value:i,onChange:e,options:s,popupMatchSelectWidth:!1,listHeight:320})},et=({show:e,__:i,style:l,className:s})=>{const a=n.default.useMemo(()=>({marginBottom:8,...l}),[l]);return e?(0,o.jsx)(t.ui_kit$Alert,{className:s,title:i("Anchor links do not work in Outlook, Gmail, and several other email clients."),type:"warning",showIcon:!0,style:a}):null},Bi=e=>!(!e.startsWith("#")||e.indexOf("#",1)!==-1),ln=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*(["'])((?:\\.|(?!\1).)*?)\1(?:\s*\/?>)?\s*$/i,sn=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*([^\s/>]+)(?:\s*\/?>)?\s*$/i;function ot(e){if(typeof e!="string")return e;let i=e.trim();if(!i)return i;const l=i.match(ln);if(l)i=l[2];else{const s=i.match(sn);s&&(i=s[1])}return i.startsWith("https://http")&&(i=i.substring(8)),i}var Mt=(e,i="https://")=>e?e.startsWith("https://")||e.startsWith("http://")?"https://":e.startsWith("mailto:")?"mailto:":e.startsWith("tel:")?"tel:":e.startsWith("sms:")?"sms:":e.startsWith("ftp://")?"ftp://":Bi(e)?"#":"":i,Wo=(e,i)=>{const l=Mt(e,"");return i(l),l},Pr=e=>{if(!e||!e.startsWith("mailto:"))return{subject:"",body:"",baseEmail:e||""};try{const i=new URL(e),l=e.split("?")[0];return{subject:i.searchParams.get("subject")||"",body:i.searchParams.get("body")||"",baseEmail:l}}catch{return{subject:"",body:"",baseEmail:e.split("?")[0]}}},Si=(e,i,l)=>{if(!e||!e.startsWith("mailto:"))return e;const s=e.split("?")[0],a=[];return i&&a.push(`subject=${encodeURIComponent(i)}`),l&&a.push(`body=${encodeURIComponent(l)}`),a.length>0?`${s}?${a.join("&")}`:s},u=e=>e||(e===0?"0":""),po=e=>e&&e!=="auto"?e:e===0?"0":"",Ar=(e,i)=>{if(typeof e=="object"&&e!==null&&"value"in e){if(e.value)return e.value;if(e.value==="")return""}return typeof e=="string"&&e?e:i||""};function Ti(e){const i={...e,link:e.link==null?"https://":e.link,borderRadiusAll:u(e.borderRadius?.all),borderRadiusTopLeft:u(e.borderRadius?.topLeft),borderRadiusBottomLeft:u(e.borderRadius?.bottomLeft),borderRadiusTopRight:u(e.borderRadius?.topRight),borderRadiusBottomRight:u(e.borderRadius?.bottomRight),mobileBorderRadiusAll:u(e.mobileBorderRadius?.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius?.topLeft!==null?e.mobileBorderRadius?.topLeft:e.mobileBorderRadius?.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius?.bottomLeft!==null?e.mobileBorderRadius?.bottomLeft:e.mobileBorderRadius?.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius?.topRight!==null?e.mobileBorderRadius?.topRight:e.mobileBorderRadius?.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius?.bottomRight!==null?e.mobileBorderRadius?.bottomRight:e.mobileBorderRadius?.all),show:e.show?e.show:"all",altSrc:e.src};if(e.video&&(i.videoPlayButton=e.video.playButton??"youtube_red",i.videoSource=e.video.source??""),e.carouselImages?.length>0){const l={};e.carouselImages?.map((s,a)=>(Object.keys(s).forEach(d=>{l[d+"_"+a]=s[d]}),!0)),i.images=l}if(e.sections?.length>0){const l=[];e.sections?.map((s,a)=>(l.push({[`expanded_${a}`]:s.expanded}),!0)),i.sections=l}return i}function Nr(e,i,l){const s=l.hasOwnProperty("images"),a=l.hasOwnProperty("sections"),d=Object.keys(s?l.images:a?l.sections:l)[0],c=s?l.images:a?l.sections:l;let p={};const f=i.getFieldsValue(!0);switch(d.split("_")[0]){case en:case Za:case Qa:case on:if(s){const k=[...e.carouselImages];k[d.split("_")[1]][d.split("_")[0]]=c[d],p={carouselImages:k}}else p=c;break;case tn:if(a){const k=[...e.sections];k[d.split("_")[1]][d.split("_")[0]]=c[d],p={sections:k}}break;case lt:let x=ot(c[d]);e.type===r.ELEMENT_TYPES.CAROUSEL?(p.carouselImages=e.carouselImages,s?(i.setFieldValue(["images",[lt+"_"+d.split("_")[1]]],x),p.carouselImages[d.split("_")[1]].link=x,p.link="",i.setFieldValue(lt,"")):(e.carouselImages.forEach((k,b)=>{i.setFieldValue(["images",lt+"_"+b],x),p.carouselImages[b].link=x,p.link=x}),i.setFieldValue(lt,x))):(i.setFieldValue(lt,x),p.link=x);break;case Cr:p={borderRadius:{...e.borderRadius,[W.BORDER_RADIUS_POSITION[Ei]]:f[Ei],[W.BORDER_RADIUS_POSITION[ki]]:f[ki],[W.BORDER_RADIUS_POSITION[xi]]:f[xi],[W.BORDER_RADIUS_POSITION[_i]]:f[_i],[W.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case Ei:case ki:case xi:case _i:p={borderRadius:{...e.borderRadius,[W.BORDER_RADIUS_POSITION[Cr]]:null,[W.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case Ja:case hi:case bi:case fi:case gi:p={mobileBorderRadius:{...e.mobileBorderRadius,[W.MOBILE_BORDER_RADIUS_POSITION[hi]]:f[hi],[W.MOBILE_BORDER_RADIUS_POSITION[bi]]:f[bi],[W.MOBILE_BORDER_RADIUS_POSITION[fi]]:f[fi],[W.MOBILE_BORDER_RADIUS_POSITION[gi]]:f[gi],[W.MOBILE_BORDER_RADIUS_POSITION[d]]:c[d],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[d]+"-"}};break;default:p=c}return{...e,...p}}var $o=(0,o.jsxs)(t.ui_kit$Select,{className:"select-after",children:[(0,o.jsx)(pi,{value:"px",children:"px"}),(0,o.jsx)(pi,{value:"%",children:"%"})]}),an=(0,o.jsx)(t.ui_kit$Select,{className:"select-after",children:(0,o.jsx)(pi,{value:"px",children:"px"})}),Lr=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:a,boxShadowShow:d,oneBorderRadiusValue:c,setOneBorderRadiusValue:p,hasLink:f,hasAlt:x,hasTitle:k,isOpenSrcReplacer:b,mergeTagItems:h,mergeMenuOpen:T,setMergeMenuOpen:_,cascaderRef:E,linkInputRef:w,linkButtonRef:v,altInputRef:A,altButtonRef:j,titleInputRef:C,titleButtonRef:P,srcReplacerInputRef:Y,srcReplacerButtonRef:z,linkProtocol:$,handleLinkProtocolsChange:O,linkButtonHandler:y,linkInputHandler:oe,altButtonHandler:G,altInputHandler:q,titleButtonHandler:te,titleInputHandler:ue,srcReplacerButtonHandler:me,srcInputHandler:se,handleSelect:_e,onChange:ve,filter:de,renderSearchOption:De,handleChangeValues:ye,toggleShowBorderHandler:re,toggleShowBorderRadiusHandler:ke,toggleShowBoxShadowHandler:ae})=>{const{__:Q}=r.useI18n(),{token:be}=(0,t.ui_kit$useToken)(),pe=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Uo,{form:e,elementSettings:i,imgParent:!0})}),pe.formImageFieldVerticalAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,align:"right",children:(0,o.jsx)(Mo,{form:e,elementSettings:i})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:i.type==="countdown"?15:24}}),i.type==="countdown"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(ui,{form:e,elementSettings:i,handleChangeValues:ye}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),pe.mergeTagsShow&&h&&(0,o.jsx)(t.ui_kit$Col,{span:24,id:"merge_tags_wrapper",children:(0,o.jsxs)(t.ui_kit$Form.Item,{style:{marginBottom:24},children:[(0,o.jsx)(t.ui_kit$Button,{id:"merge_tags_button",icon:(0,o.jsx)(r.EmIcons,{icon:"MergeTags",component:t.icons$MergeTags}),style:{width:"100%",display:T?"none":"inline-flex"},onClick:()=>_(!0),children:Q("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:E,classNames:{popup:{root:"merge-tags"}},options:h,placeholder:Q("Start typing the title"),showSearch:{filter:de,render:De},spellCheck:"false",getPopupContainer:ee=>ee.closest(".email-pane__collapse-wrapper"),onChange:ve,style:{display:T?"block":"none"},open:T,onKeyDown:ee=>{ee.key==="Escape"&&_(!1)}})]})}),i.type==="video"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(mi,{form:e,elementSettings:i}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),(i.type==="img"||i.type==="video")&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,o.jsx)(No,{form:e,label:Q("Image path"),name:"src",placeholder:Q("Image path"),elementSettings:i,tooltipTitle:""})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,style:{marginBottom:!x&&!f&&!k&&!b?be.formItemMarginBottomMD+4:be.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:x||Q("Alternative text"),placement:"bottom",getPopupContainer:ee=>ee.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":!!x}),onClick:G,ref:j,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),pe.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:k||Q("Tooltip text"),placement:"bottom",getPopupContainer:ee=>ee.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":!!k}),onClick:te,ref:P,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:f||Q("Hyperlink URL"),placement:"bottom",getPopupContainer:ee=>ee.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":!!f}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:y,ref:v})}),pe.formImageFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:Q("Image replacer"),placement:"bottom",getPopupContainer:ee=>ee.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":b}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:me,ref:z})})]}),(!!f||!!x||!!k||!!b)&&(0,o.jsxs)("div",{style:{marginBottom:be.formItemMarginBottomMD+4},children:[!!f&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(et,{show:$==="#",__:Q,style:{marginBottom:be.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Q("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:be.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Zo,{linkProtocol:$,handleLinkProtocolsChange:O,__:Q}),placeholder:Q("Hyperlink URL"),allowClear:!0,ref:w,onChange:oe,onSelect:_e,prefix:(0,o.jsx)(Qo,{linkProtocol:$})})})})]}),!!x&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Q("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:be.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:Q("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:q,ref:A,onSelect:_e})})}),pe.formFieldImageTitleEnabled&&!!k&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Q("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:be.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:Q("Enter the title of the image"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:ue,ref:C,onSelect:_e})})}),!!b&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Q("Image src"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"imgReplacer",className:"selected-image-form__alt",style:{marginBottom:be.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:Q("Code that will replace the image `src`"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:Q("Image src")}),onChange:se,ref:Y,onSelect:_e})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:Q("Size"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:i.maxWidth,showHeight:pe.formImageFieldHeightEnabled,showMinMax:!1,gutter:be.marginSM,rowStyle:{marginBottom:pe.formImageFieldHeightEnabled?4:24},labels:{width:Q("Width"),height:Q("Height"),minWidth:Q("Minimum width"),maxWidth:Q("Maximum width")}})}),pe.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Q("Borders"),collapsible:!0,open:s,onToggle:re,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),pe.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Q("Border radius"),collapsible:!0,open:a,onToggle:ke,dividerTop:!0,children:(0,o.jsx)(So,{form:e,oneBorderRadiusValue:c,setOneBorderRadiusValue:p,elementSettings:i})}),pe.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Q("Box shadow"),collapsible:!0,open:d,onToggle:ae,dividerTop:!0,children:(0,o.jsx)(jo,{})}),pe.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Q("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})}),pe.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:Q("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};Lr.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,hasLink:g.default.string,hasAlt:g.default.string,hasTitle:g.default.string,isOpenSrcReplacer:g.default.oneOfType([g.default.bool,g.default.number]),mergeTagItems:g.default.array,mergeMenuOpen:g.default.bool,setMergeMenuOpen:g.default.func,cascaderRef:g.default.object,linkInputRef:g.default.object,linkButtonRef:g.default.object,altInputRef:g.default.object,altButtonRef:g.default.object,titleInputRef:g.default.object,titleButtonRef:g.default.object,srcReplacerInputRef:g.default.object,srcReplacerButtonRef:g.default.object,linkProtocol:g.default.string,handleLinkProtocolsChange:g.default.func,linkButtonHandler:g.default.func,linkInputHandler:g.default.func,altButtonHandler:g.default.func,altInputHandler:g.default.func,titleButtonHandler:g.default.func,titleInputHandler:g.default.func,srcReplacerButtonHandler:g.default.func,srcInputHandler:g.default.func,handleSelect:g.default.func,onChange:g.default.func,filter:g.default.func,renderSearchOption:g.default.func,handleChangeValues:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func};var zo=({form:e,name:i,elementSettings:l,isPicture:s,tooltipTitle:a})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),p=(0,n.useRef)(),[f,x]=(0,n.useState)(l[i]?.value==="auto"),{token:k}=(0,t.ui_kit$useToken)(),[b,h]=(0,n.useState)(""),T=E=>{e.setFieldsValue({[i]:"",[i+"Dim"]:"px"}),x(w=>!w),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{[i]:{classNamePrefix:"em-mob-width-",value:f?null:"auto",dim:""}}})},_=E=>{x(!1),h(e.getFieldsValue(!0)[i+"Dim"]==="%"?100:"")};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:a,placement:"bottom",children:(0,o.jsx)("div",{children:(0,o.jsx)(t.ui_kit$Form.Item,{name:i,style:{marginBottom:k.formItemMarginBottomXS/2},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{ref:p,min:0,max:b,placeholder:d("Width"),onChange:_,prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:(0,o.jsx)(t.ui_kit$Form.Item,{name:i+"Dim",noStyle:!0,children:$o})})})})}),!s&&(0,o.jsx)(t.ui_kit$Switch,{id:"auto-width",label:d("Auto"),labelSize:"small",size:"small",checked:f,onChange:T})]})};zo.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string};var tt=({form:e,name:i,elementSettings:l,isPicture:s,tooltipTitle:a})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),p=(0,n.useRef)(),[f,x]=(0,n.useState)(l.mobileHeight?.value==="auto"),{token:k}=(0,t.ui_kit$useToken)(),b=T=>{e.setFieldsValue({mobileHeight:"",mobileHeightDim:"px"}),x(_=>!_),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{mobileHeight:{classNamePrefix:"em-mob-height-",value:f?null:"auto",dim:""}}})},h=T=>{x(!1)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:a,placement:"bottom",children:(0,o.jsx)("div",{children:(0,o.jsx)(t.ui_kit$Form.Item,{name:i,style:{marginBottom:k.formItemMarginBottomXS/2},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{ref:p,min:0,placeholder:d("Height"),onChange:h,prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})}),!s&&(0,o.jsx)(t.ui_kit$Switch,{id:"auto-height",label:d("Auto"),labelSize:"small",size:"small",checked:f,onChange:b})]})};tt.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string};var Or=({form:e,elementSettings:i,handleChangeValues:l,boxShadow:s,mobileBordersShow:a,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:p,oneMobileBorderRadiusValue:f,setOneMobileBorderRadiusValue:x,hasLink:k,hasAlt:b,hasTitle:h,linkInputRef:T,linkButtonRef:_,altInputRef:E,altButtonRef:w,titleInputRef:v,titleButtonRef:A,linkInputHandler:j,altButtonHandler:C,altInputHandler:P,titleButtonHandler:Y,titleInputHandler:z,linkButtonHandler:$,toggleShowMobileBorderHandler:O,toggleShowMobileBorderRadiusHandler:y,toggleShowMobileBoxShadowHandler:oe,toggleShowMobileSizeHandler:G})=>{const{__:q}=r.useI18n(),{token:te}=(0,t.ui_kit$useToken)(),ue=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:30,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Uo,{form:e,elementSettings:i,imgParent:!0,typeOfForm:"mobile"})}),ue.formImageFieldVerticalAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,align:"right",children:(0,o.jsx)(Mo,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:i.type==="countdown"?15:24}}),i.type==="countdown"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(ui,{form:e,elementSettings:i,handleChangeValues:l}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),i.type==="video"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(mi,{form:e,elementSettings:i}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),(i.type==="img"||i.type==="video")&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,o.jsx)(No,{form:e,label:q("Image path"),name:"src",placeholder:q("Image path"),elementSettings:i,tooltipTitle:""})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,style:{marginBottom:!b&&!k&&!h?te.formItemMarginBottomMD+4:te.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:b||q("Alternative text"),placement:"bottom",getPopupContainer:me=>me.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":!!b}),onClick:C,ref:w,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),ue.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:h||q("Tooltip text"),placement:"bottom",getPopupContainer:me=>me.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":!!h}),onClick:Y,ref:A,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:k||q("Hyperlink URL"),placement:"bottom",getPopupContainer:me=>me.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":!!k}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:$,ref:_})})]}),(!!k||!!b||!!h)&&(0,o.jsxs)("div",{style:{marginBottom:te.formItemMarginBottomMD+4},children:[!!k&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:q("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:te.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{ref:T,allowClear:!0,placeholder:q("Hyperlink URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined}),onChange:j})})}),!!b&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:q("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:te.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:q("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:P,ref:E})})}),ue.formFieldImageTitleEnabled&&!!h&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:q("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:te.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:q("Tooltip text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:z,ref:v})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:q("Size"),collapsible:!0,open:p,onToggle:G,dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:24},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(zo,{form:e,name:"mobileWidth",elementSettings:i,isPicture:"true",tooltipTitle:q("Width")})}),ue.formImageFieldHeightEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(tt,{form:e,name:"mobileHeight",elementSettings:i,isPicture:"true",tooltipTitle:q("Height")})})]})}),ue.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:q("Borders"),collapsible:!0,open:a,onToggle:O,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),ue.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:q("Border radius"),collapsible:!0,open:d,onToggle:y,dividerTop:!0,children:(0,o.jsx)(So,{form:e,oneBorderRadiusValue:f,setOneBorderRadiusValue:x,elementSettings:i,typeOfForm:"mobile"})}),ue.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:q("Box shadow"),collapsible:!0,open:c,onToggle:oe,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile"})}),ue.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:q("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})}),ue.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:q("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};Or.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,handleChangeValues:g.default.func,boxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,hasLink:g.default.string,hasAlt:g.default.string,hasTitle:g.default.string,linkInputRef:g.default.object,linkButtonRef:g.default.object,altInputRef:g.default.object,altButtonRef:g.default.object,titleInputRef:g.default.object,titleButtonRef:g.default.object,linkInputHandler:g.default.func,altButtonHandler:g.default.func,altInputHandler:g.default.func,titleButtonHandler:g.default.func,titleInputHandler:g.default.func,linkButtonHandler:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func};var nn=e=>typeof e=="object"&&e!==null?e.path:void 0;function Fo(){const e=(0,n.useRef)(!1),i=(0,n.useRef)(null),l=(0,n.useCallback)(a=>{e.current=!a},[]),s=(0,n.useCallback)((a,d)=>{const c=JSON.stringify(nn(a)??null);return i.current!==c&&(i.current=c,e.current=!1),d?e.current:(e.current=!1,!1)},[]);return(0,n.useMemo)(()=>({markBorderToggled:l,isStaleBorderSnapshot:s}),[l,s])}function st(e){const i=(0,n.useRef)(null),l=(0,n.useRef)(e);return l.current=e,{remember:(0,n.useCallback)(s=>{i.current=s},[]),fillFields:(0,n.useCallback)((s,a)=>{l.current!==i.current&&s.setFieldsValue(a)},[])}}var dn=1e3,cn=2e4,$r="https://useblocks.io/app/",Fr=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm(),s=Fo(),a=Fo();let d=r.useDispatch();const c=r.useAppConfig(),p=r.useEditorProjectId(),f=r.useNotification(),x=r.useSendPostMessage(),k=r.useSendPostMessageEx(),{openImagePicker:b}=r.useImagePicker(),h=r.useSelector(r.selectEmailViewType),T=r.useSelector(r.selectMobileViewActive),_=r.useCurrentUser(),E=r.useSelector(r.selectIsCodeMode),w=r.useSelector(r.selectCodeModeDirection),[v]=r.useUploadImageMutation(),[A,j]=r.useSendShortLinkMutation(),[C,P]=(0,n.useState)({name:"",counter:0}),Y=(0,n.useRef)(null),z=(0,n.useRef)(null),$=(0,n.useRef)(null),O=(0,n.useRef)(null),y=(0,n.useRef)(null),oe=(0,n.useRef)(null),G=(0,n.useRef)(null),q=(0,n.useRef)(null),te=(0,n.useRef)(null),[ue,me]=(0,n.useState)({}),[se,_e]=(0,n.useState)(!0),[ve,de]=(0,n.useState)(!0),[De,ye]=(0,n.useState)(""),[re,ke]=(0,n.useState)(""),[ae,Q]=(0,n.useState)(""),[be,pe]=(0,n.useState)(!1),[ee,J]=(0,n.useState)(!1),[U,X]=(0,n.useState)(!1),[ce,xe]=(0,n.useState)(!1),[ne,Ae]=(0,n.useState)(!1),[we,$e]=(0,n.useState)(!1),[K,ie]=(0,n.useState)(!1),[je,V]=(0,n.useState)(!1),[Se,Ie]=(0,n.useState)("https://"),Ne=(0,n.useRef)(!1),Fe=(0,n.useRef)(),Ve=e,Ue=(0,n.useRef)(Ve);Ue.current=Ve;const le=(0,n.useCallback)(()=>l.getFieldsValue(!0).video,[l]),[Te,I]=(0,n.useState)(),[Z,Be]=(0,n.useState)(!1),[Ce,Me]=(0,n.useState)(null),[Ge,Ye]=(0,n.useState)({start:0,end:0}),[D,L]=(0,n.useState)(!1),[R,F]=(0,n.useState)(!1),[he,Le]=(0,n.useState)(!1),[eo,Xe]=(0,n.useState)(!1),lo=(0,n.useRef)(void 0),Qe=(0,n.useRef)(null),uo=(0,n.useRef)(null),Eo=eo||he||je;(0,n.useEffect)(()=>()=>clearTimeout(lo.current),[]);const B=(0,n.useRef)(null);(0,n.useEffect)(()=>{const N=B.current,Pe=N?.firstElementChild??null;if(!Eo||!N||!Pe)return;const Ee=[];for(let oo=N.parentElement;oo;oo=oo.parentElement)getComputedStyle(oo).overflowY!=="visible"&&Ee.push(oo);let ge=0,Oe="";const Ke=()=>{const oo=N.getBoundingClientRect(),Je=N.offsetHeight>0?oo.height/N.offsetHeight:1;let ho=Math.max(oo.top,0),ao=Math.min(oo.bottom,window.innerHeight);Ee.forEach(Jo=>{const bt=Jo.getBoundingClientRect();ho=Math.max(ho,bt.top),ao=Math.min(ao,bt.bottom)});const bo=(ho-oo.top)/(Je||1),Po=Math.max(ao-ho,0)/(Je||1),yo=`${Math.round(bo)}/${Math.round(Po)}`;yo!==Oe&&(Oe=yo,Pe.style.top=`${bo}px`,Pe.style.height=`${Po}px`),ge=requestAnimationFrame(Ke)};return Ke(),()=>cancelAnimationFrame(ge)},[Eo]);const S=()=>{const N=Qe.current;uo.current=N?.isConnected&&typeof N.selectionStart=="number"?{element:N,start:N.selectionStart,end:N.selectionEnd??N.selectionStart}:null},m=E&&w!=="bottom",M=r.useElementEntityKind();(0,n.useEffect)(()=>{Z&&te.current&&te.current.focus()},[Z]);const H=(N,Pe)=>{const Ee=document.getElementById(Pe);if(Ee){const ge=Pe.substring(Pe.indexOf("selected_image_form_")+20),Oe=Ee.value?.substring(0,Ge.start),Ke=Ee.value?.substring(Ge.end);x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{...e,[ge]:Oe+N+Ke}}),l.setFieldValue(ge,Oe+N+Ke),Ee.focus(),setTimeout(()=>{Ee.selectionStart=Ge.start,Ee.selectionEnd=Ge.start+N.length},400),L(!0)}},Re=r.useAppConfig().mergeTags;(0,n.useEffect)(()=>{Re?.items?.length&&I(r.mapMargeTags(Re.items,i,(N,Pe)=>{Be(!1),k(r.EVENT_TYPES.SANDBOX_ADD_MERGETAG,N),Pe.stopPropagation(),Pe.preventDefault()}))},[Re,I,i,Be,k]);const fe=(N,Pe)=>{if(Be(!1),N){const Ee=Re.syntax.length>1?Te.findIndex(Oe=>Oe.key===Pe[0].key):0,ge=Re.syntax[Ee].replace("%value%",N[N.length-1]);Ce?.getAttribute("id")==="selected_image_form_title"||Ce?.getAttribute("id")==="selected_image_form_alt"||Ce?.getAttribute("id")==="selected_image_form_link"||Ce?.getAttribute("id")==="selected_image_form_imgReplacer"?H(ge,Ce?.getAttribute("id")):(l.setFieldValue("imgReplacer",ge),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:ge}}))}},ze=(N,Pe)=>Pe.some(Ee=>Ee.label.toLowerCase().indexOf(N.toLowerCase())>-1),co=(N,Pe)=>{const Ee=Pe.map((ge,Oe)=>{const Ke=ge.label.split(new RegExp(`(${N})`,"gi"));return(0,o.jsxs)("span",{children:[Oe!==0&&(0,o.jsx)("span",{children:" / "}),Ke.map((oo,Je)=>oo.toLowerCase()===N.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:oo},Je):oo)]},ge.value)});return(0,o.jsx)("div",{title:Pe.map(ge=>ge.label).join(" / "),children:Ee})},so=r.useRootElement();(0,n.useEffect)(()=>{const N=({target:ge})=>{ge.closest('[id="merge_tags_wrapper"]')||(Qe.current=ge,Me(ge))},Pe=({target:ge})=>{!ge.closest(".merge-tags")&&!ge.closest("#merge_tags_button")&&Be(!1)},Ee=new xo.Disposable;return Ee.addDisposable(r.addWindowListenerFromShadow(so,"focusin",N)),Ee.addDisposable(r.addWindowListenerFromShadow(so,"click",Pe)),()=>{Ee.dispose()}},[so]);const mo=({target:N})=>{if(N&&!D){const{selectionStart:Pe,selectionEnd:Ee}=N;Ye({start:Pe,end:Ee})}L(!1)},ko=e.border,qo=e.mobileBorder,Co=Object.keys(ko).find(N=>ko[N]?.width||ko[N]?.style||ko[N]?.color),Bo=Object.keys(qo).find(N=>qo[N]?.width||qo[N]?.style||qo[N]?.color),ro=N=>N&&(N?.width||N?.style||N?.color)?N:"",{remember:Ro,fillFields:Vo}=st(e);(0,n.useEffect)(()=>{if(e){e.src!==Fe.current&&(Fe.current=e.src,Ne.current=!1);const N=e.boxShadow;if(me(N),e.link&&Ie(Mt(e.link,"https://")),Vo(l,{...e,link:e.link==null?"https://":e.link,width:e.width?.value,widthDim:e.width?.dim,height:e.height?.value,heightDim:e.height?.dim,borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),mobileBorderAll:ro(e.mobileBorder.all)||!(ro(e.mobileBorder.top)||ro(e.mobileBorder.bottom)||ro(e.mobileBorder.right)||ro(e.mobileBorder.left))&&ro(e.border.all),mobileBorderTop:ro(e.mobileBorder.top)||!ro(e.mobileBorder.all)&&ro(e.border.top),mobileBorderBottom:ro(e.mobileBorder.bottom)||!ro(e.mobileBorder.all)&&ro(e.border.bottom),mobileBorderRight:ro(e.mobileBorder.right)||!ro(e.mobileBorder.all)&&ro(e.border.right),mobileBorderLeft:ro(e.mobileBorder.left)||!ro(e.mobileBorder.all)&&ro(e.border.left),borderRadiusAll:u(e.borderRadius.all),borderRadiusTopLeft:u(e.borderRadius.topLeft),borderRadiusBottomLeft:u(e.borderRadius.bottomLeft),borderRadiusTopRight:u(e.borderRadius.topRight),borderRadiusBottomRight:u(e.borderRadius.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:po(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:po(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:po(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:po(e.mobileHeight?.value)?e.mobileHeight?.dim:e.height?.dim,mobileBorderRadiusAll:u(e.mobileBorderRadius.all)||u(e.borderRadius.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius?.topLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topLeft)||u(e.borderRadius?.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius?.bottomLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomLeft)||u(e.borderRadius?.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius?.topRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topRight)||u(e.borderRadius?.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius?.bottomRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomRight)||u(e.borderRadius?.all),mobileBoxShadowInset:e.mobileBoxShadow?.inset!=null?e.mobileBoxShadow.inset:e.boxShadow?.inset||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset)||u(e.boxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset)||u(e.boxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius)||u(e.boxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius)||u(e.boxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color||e.boxShadow?.color),mobileAlign:u(e.mobileAlign?.value)||e.align,mobileVerticalAlign:u(e.mobileVerticalAlign?.value||e.valign),show:e.show?e.show:"all",altSrc:e.src,video:{source:"",playButton:"youtube_red",...Ve.video}}),e.countdown){let ge=new URL("https://emailmaker.ru/?"+e.countdown),Oe=ge.searchParams.get("font1"),Ke=!1,oo=!1;Oe.endsWith("-b")?(Oe=Oe.substring(0,Oe.length-2),Ke=!0):Oe.endsWith("-i")?(Oe=Oe.substring(0,Oe.length-2),oo=!0):Oe.endsWith("-bi")&&(Oe=Oe.substring(0,Oe.length-3),Ke=!0,oo=!0);let Je=ge.searchParams.get("font2"),ho=!1,ao=!1;Je.endsWith("-b")?(Je=Je.substring(0,Je.length-2),ho=!0):Je.endsWith("-i")?(Je=Je.substring(0,Je.length-2),ao=!0):Je.endsWith("-bi")&&(Je=Je.substring(0,Je.length-3),ho=!0,ao=!0),Vo(l,{countdownTime:(0,Oo.default)(new Date(Date.parse(ge.searchParams.get("time"))+ge.searchParams.get("timezone")*36e5+new Date().getTimezoneOffset()/60*36e5).toISOString()),countdownDuration:ge.searchParams.get("frames")||20,countdownTimeZone:ge.searchParams.get("timezone"),countdownLanguage:ge.searchParams.get("locale").replace("-","_"),countdownBackgroundColor:"#"+ge.searchParams.get("bg"),countdownTransparency:ge.searchParams.get("tp")==="true"?"checked":"",countdownNumbersFont:Oe,countdownNumbersFontSize:ge.searchParams.get("size1")/2,countdownNumbersFontSizeDim:"px",countdownNumbersColor:"#"+ge.searchParams.get("color1"),countdownLabelsFont:Je,countdownLabelsFontSize:ge.searchParams.get("size2")/2,countdownLabelsFontSizeDim:"px",countdownLabelsColor:"#"+ge.searchParams.get("color2"),countdownNumbersStrong:Ke,countdownNumbersItalic:oo,countdownLabelsStrong:ho,countdownLabelsItalic:ao})}!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?_e(!1):_e(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||!u(e.borderRadius.all)&&!u(e.mobileBorderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?de(!1):de(!0);const Pe=s.isStaleBorderSnapshot(e,!!Co),Ee=a.isStaleBorderSnapshot(e,!!Bo);Pe&&l.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Ee||Pe&&!Bo)&&l.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),pe(ge=>Co&&!Pe?!0:ge),J(ge=>Co&&!Pe||Bo&&!Ee?!0:ge),X(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),xe(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight||!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),Ae(!!e.boxShadow),$e(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),ie(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value||!!e.height.value),e.link?ye(e.link):ye(Ne.current?"...":""),ke(e.alt),Q(e.title),F(e.imgReplacer?.length)}},[l,e,Vo,Ve,Co,Bo,s,a]),(0,n.useEffect)(()=>{if(Eo)return;const N=uo.current;uo.current=null,!(!N||!N.element.isConnected||N.element.disabled)&&Qe.current===N.element&&(N.element.focus(),N.element.setSelectionRange(N.start,N.end))},[Eo]);const _o=async(N,Pe,Ee)=>{const ge={};ge.user_id=_.id,ge.folder=N,Pe&&(Pe=await r.prepareImageForEditorUpload(Pe,c),ge.file=Pe),Ee&&(ge.page_url=Ee);const Oe=await v(ge);if(Oe.error)f.fromError("IMAGE_UPLOAD_ERROR",Pe,Oe.error,!0);else{const Ke=La.extractUploadResult(Oe.data);if(Ke.error)return;if(Ke.file_url)return Ke.file_url}},Ho=(N,Pe)=>new Promise((Ee,ge)=>{const Oe=new Image,Ke=new Image;Oe.crossOrigin="Anonymous",Ke.crossOrigin="Anonymous";let oo=Pe?2:1;const Je=()=>{clearTimeout(ao),ge(new Error("video preview images are not loaded"))},ho=()=>{oo-=1,oo===0&&(clearTimeout(ao),Ee({frame:Oe,button:Pe?Ke:null}))},ao=setTimeout(Je,cn);Oe.onload=ho,Oe.onerror=Je,Oe.src=N,Pe&&(Ke.onload=ho,Ke.onerror=Je,Ke.src=Pe)}),vt=(N,Pe,Ee,ge)=>{const Oe=document.createElement("canvas"),Ke=Oe.getContext("2d");if(Oe.width=N.width,Oe.height=N.height,Ke.clearRect(0,0,Oe.width,Oe.height),Ke.drawImage(N,0,0,N.width,N.height),!Pe)return Oe;const oo=Math.min(Oe.width,Oe.height);let Je;if(N.height>N.width)Je=.3;else{const bt=N.width/N.height;Je=Math.min(ge,.3+(bt-1)/(Ee-1)*.1)}const ho=oo*Je,ao=Pe.width/Pe.height;let bo,Po;ao>=1?(bo=ho,Po=ho/ao):(Po=ho,bo=ho*ao);const yo=(Oe.width-bo)/2,Jo=(Oe.height-Po)/2;return Ke.drawImage(Pe,yo,Jo,bo,Po),Oe},Lo=N=>new Promise(Pe=>{N.toBlob(Ee=>Pe(Ee?new File([Ee],"image.jpeg",{type:"image/jpeg"}):null),"image/jpg",1)}),It=async N=>{const Pe=l.getFieldsValue(!0).video?.playButton||e.video?.playButton;if(!(!N||!Pe||Pe==="none"||he)){S(),Le(!0);try{const{frame:Ee,button:ge}=await Ho(N,`${$r}${Pe}.png`),Oe=await Lo(vt(Ee,ge,2,.4)),Ke=Oe&&await _o(p,Oe);if(!Ke)return;x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Ue.current.type,settings:{src:Ke}}),Pt({...Ue.current,src:Ke,video:le()||Ue.current.video,activateSection:null,changeKey:"src"}),setTimeout(()=>{l.setFieldValue("src",Ke)},100)}catch{}finally{Le(!1)}}},Er=async()=>{const N=le(),Pe=N?.source,Ee=N?.playButton;if(!Pe)return;const ge=()=>le()?.source!==Pe;S(),Xe(!0);try{const Oe=await _o("tmp",null,Pe);if(!Oe||ge())return;const{frame:Ke,button:oo}=await Ho(Oe,Ee&&Ee!=="none"?`${$r}${Ee}.png`:null);if(ge())return;const Je=await Lo(vt(Ke,oo,2.5,.35)),ho=Je&&await _o(p,Je);ho&&!ge()&&Br(ho)}catch{}finally{Xe(!1)}},Ct=N=>{clearTimeout(lo.current),lo.current=setTimeout(()=>{N()},dn)},ni=()=>{const N=l.getFieldsValue(!0);let Pe=new URL("https://cdt3.useblocks.io/rndt?"+e.countdown),Ee=N.countdownNumbersFont;N.countdownNumbersStrong&&N.countdownNumbersItalic?Ee+="-bi":N.countdownNumbersStrong?Ee+="-b":N.countdownNumbersItalic&&(Ee+="-i");let ge=N.countdownLabelsFont;N.countdownLabelsStrong&&N.countdownLabelsItalic?ge+="-bi":N.countdownLabelsStrong?ge+="-b":N.countdownLabelsItalic&&(ge+="-i"),Pe.searchParams.set("time",new Date(N.countdownTime.$d-N.countdownTimeZone*36e5-new Date().getTimezoneOffset()/60*36e5).toISOString()),Pe.searchParams.set("bg",N.countdownBackgroundColor.substring(1)||"#FFFFFF"),Pe.searchParams.set("tp",!!N.countdownTransparency),Pe.searchParams.set("font1",Ee),Pe.searchParams.set("size1",N.countdownNumbersFontSize*2||12),Pe.searchParams.set("color1",N.countdownNumbersColor.substring(1)||"#000000"),Pe.searchParams.set("font2",ge),Pe.searchParams.set("size2",N.countdownLabelsFontSize*2||8),Pe.searchParams.set("color2",N.countdownLabelsColor.substring(1)||"#959595"),Pe.searchParams.set("spacing",Math.round(N.countdownNumbersFontSize*.4)||5),Pe.searchParams.set("locale",N.countdownLanguage.replace("_","-")),Pe.searchParams.set("timezone",N.countdownTimeZone),Pe.searchParams.set("frames",N.countdownDuration),A({link:JSON.stringify({target:Pe.href})}),S(),V(!0)},Pt=(0,n.useCallback)(N=>{Ro(N),d(M==="email"?r.setElementSettings$1(N):r.setElementSettings(N))},[d,M,Ro]),Br=(0,n.useCallback)((N,Pe)=>{const Ee=Ue.current,ge=r.stripEmVersionFromUrlString(Ee.src||"")===r.stripEmVersionFromUrlString(N||"");(!ge||N!==Ee.src)&&(x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Ee.type,settings:{src:N}}),Pt({...Ee,src:N,...Ee.type==="video"?{video:le()||Ee.video}:{},activateSection:null,changeKey:"src"}),l.setFieldValue("src",N)),Pe?.mode==="save"&&ge&&(P(Oe=>({name:"src",counter:Oe.counter+1})),k(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(N)}))},[l,le,Pt,x,k]),At=(0,n.useCallback)(async N=>{const Pe=e.src||"",Ee=r.stripEmVersionFromUrlString(Pe),ge=await b({kind:"img",currentUrl:$t(Ee)?"":Ee,entryModal:N});ge?.url&&Br(ge.url,ge.meta)},[Br,e.src,b]),Sr=(N,...Pe)=>{const Ee=l.getFieldsValue(!0),ge=Object.keys(N)[0];let Oe;switch(ge){case"link":let Ke=ot(N[ge]);Ke!==N[ge]&&l.setFieldValue("link",Ke),Oe={link:Ke};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Oe={boxShadow:{hOffset:Ee.boxShadowHOffset,vOffset:Ee.boxShadowVOffset,blurRadius:Ee.boxShadowBlurRadius,spreadRadius:Ee.boxShadowSpreadRadius,color:Ee.boxShadowColor,inset:Ee.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":Ee.borderPosition==="borderAll"?(Oe={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...Ee.borderAll}}},l.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):Ee.borderAll?.width||Ee.borderAll?.style||Ee.borderAll?.color?(Oe={border:{all:null,left:Ee.borderAll,right:Ee.borderAll,top:Ee.borderAll,bottom:Ee.borderAll,[W.REVERSE_BORDER_POSITIONS[ge]]:{...Ee[ge],...N[ge]}}},l.setFieldsValue({borderAll:null,borderLeft:Ee.borderAll,borderRight:Ee.borderAll,borderTop:Ee.borderAll,borderBottom:Ee.borderAll,[ge]:{...Ee[ge],...N[ge]}})):(Oe={border:{all:null,left:Ee.borderLeft,right:Ee.borderRight,top:Ee.borderTop,bottom:Ee.borderBottom,[W.REVERSE_BORDER_POSITIONS[ge]]:{...Ee[ge],...N[ge]}}},l.setFieldsValue({border:Oe.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(Ee.mobileBorderPosition==="mobileBorderAll")Oe={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...Ee.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[ge]+"-"}}},l.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const ao=W.MOBILE_REVERSE_BORDER_POSITIONS[ge],bo={...Ee[ge],...N[ge]},Po=!bo?.width&&!bo?.style&&!bo?.color;if(Ee.mobileBorder?.all?.width||Ee.mobileBorder?.all?.style||Ee.mobileBorder?.all?.color){const yo=Ee.mobileBorderAll;Oe={mobileBorder:{all:null,left:yo,right:yo,top:yo,bottom:yo,[ao]:Po?null:{...bo,classNamePrefix:"em-mob-border_"+ao+"-"}}},l.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:yo,mobileBorderRight:yo,mobileBorderTop:yo,mobileBorderBottom:yo,[ge]:bo})}else{const yo=e.mobileBorder||{},Jo=bt=>{const Nt=yo[bt];return Nt&&(Nt?.width||Nt?.style||Nt?.color)?Nt:null};Oe={mobileBorder:{all:null,left:ao==="left"?Po?null:{...bo,classNamePrefix:"em-mob-border_left-"}:Jo("left"),right:ao==="right"?Po?null:{...bo,classNamePrefix:"em-mob-border_right-"}:Jo("right"),top:ao==="top"?Po?null:{...bo,classNamePrefix:"em-mob-border_top-"}:Jo("top"),bottom:ao==="bottom"?Po?null:{...bo,classNamePrefix:"em-mob-border_bottom-"}:Jo("bottom")}},l.setFieldsValue({[ge]:bo})}}break;case"width":Oe={[ge]:{value:N[ge],dim:Ee.widthDim}};break;case"widthDim":Oe={width:{value:Ee.width,dim:N[ge]}};break;case"height":Oe={[ge]:{value:N[ge],dim:Ee.heightDim}};break;case"heightDim":Oe={height:{value:Ee.height,dim:N[ge]}};break;case"borderRadiusAll":Oe={borderRadius:{[W.BORDER_RADIUS_POSITION[ge]]:+N[ge]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Oe={borderRadius:{topLeft:Ee.borderRadiusTopLeft,bottomLeft:Ee.borderRadiusBottomLeft,topRight:Ee.borderRadiusTopRight,bottomRight:Ee.borderRadiusBottomRight,[W.BORDER_RADIUS_POSITION[ge]]:+N[ge]}};break;case"mobileWidth":Oe={[ge]:{classNamePrefix:"em-mob-width-",value:N[ge],dim:Ee.mobileWidthDim}};break;case"mobileWidthDim":Oe={mobileWidth:{classNamePrefix:"em-mob-width-",value:Ee.mobileWidth||100,dim:N[ge]}};break;case"mobileHeight":Oe={[ge]:{classNamePrefix:"em-mob-height-",value:N[ge],dim:Ee.mobileHeightDim}};break;case"mobileHeightDim":Oe={mobileHeight:{classNamePrefix:"em-mob-height-",value:Ee.mobileHeight,dim:N[ge]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Oe={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[ge]]:N[ge],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[ge]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Oe={mobileBoxShadow:{hOffset:Ee.mobileBoxShadowHOffset,vOffset:Ee.mobileBoxShadowVOffset,blurRadius:Ee.mobileBoxShadowBlurRadius,spreadRadius:Ee.mobileBoxShadowSpreadRadius,color:Ee.mobileBoxShadowColor,inset:Ee.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":Oe={[ge]:{classNamePrefix:"em-mob-text_align-",value:N[ge]}};break;case"mobileVerticalAlign":Oe={[ge]:{classNamePrefix:"em-mob-vertical_align-",value:N[ge]}};break;case"countdownTime":case"countdownTimeZone":case"countdownBackgroundColor":case"countdownNumbersFont":case"countdownNumbersFontSize":case"countdownNumbersColor":case"countdownLabelsFont":case"countdownLabelsFontSize":case"countdownLabelsColor":case"countdownLanguage":case"countdownDuration":case"countdownTransparency":case"countdownNumbersStrong":case"countdownNumbersItalic":case"countdownLabelsStrong":case"countdownLabelsItalic":Ct(ni);break;case"video":{const ao={...e.video,...Ee.video,...N.video},bo=ao.source??Ee.link;Ct(Er),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"video",settings:{video:ao,link:bo}}),Pt({...e,video:ao,link:bo,activateSection:null,changeKey:"video"});break}case"src":const oo=N[ge],Je=e.src,ho=Ee.video?.playButton||e.video?.playButton;if(e.type==="video"&&ho&&ho!=="none"&&!he&&oo&&(!Je||oo!==Je)){Ct(()=>It(oo));return}Oe=N;break;default:Oe=N}ge!=="borderPosition"&&ge!=="mobileBorderPosition"&&ge.indexOf("countdown")===-1&&ge!=="video"&&(x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Oe}),ge!=="video"&&ge.indexOf("countdown")===-1&&ge!=="mobileBorderRadiusAll"&&ge!=="mobileBorderRadiusTopLeft"&&ge!=="mobileBorderRadiusTopRight"&&ge!=="mobileBorderRadiusBottomLeft"&&ge!=="mobileBorderRadiusBottomRight"&&Pt({...e,...Oe,mobileBorderRadius:{...e.mobileBorderRadius,...Oe?.mobileBorderRadius},activateSection:null,changeKey:ge}))};(0,n.useEffect)(()=>{j.isError&&(f.error(j),V(!1))},[j]),(0,n.useEffect)(()=>{if(j.isSuccess&&je){if(j.data.data?.status===400)f.error({title:j.data.code,description:j.data.message});else{let N=new URL(j.data.target),Pe={countdown:{link:j.data.link,params:N.search.substring(1)}};x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Pe})}V(!1)}},[j,je,e,f,x]);const Rm=N=>{N.data.operation===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(d(r.closeSecondModal()),d(r.closeModal$1()))};r.useListenPostMessage(Rm),r.useImageControlRequest(e.src,N=>{N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?At(r.MODALS.UPLOAD_IMAGE_MODAL_AI):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?At(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?At(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?At(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP&&At(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK)});const ym=()=>{const N=l.getFieldsValue(!0);s.markBorderToggled(!be),setTimeout(()=>{pe(Pe=>!Pe),be?(N.borderAll=W.NULL_BORDER,N.borderTop=W.NULL_BORDER,N.borderBottom=W.NULL_BORDER,N.borderRight=W.NULL_BORDER,N.borderLeft=W.NULL_BORDER):N.borderAll={width:1,color:"#E5E5E5",style:"solid"},x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:N.borderAll.color,style:N.borderAll.style,width:N.borderAll.width}}}})})},wm=()=>{const N=l.getFieldsValue(!0);a.markBorderToggled(!ee),setTimeout(()=>{J(Pe=>!Pe),ee?(N.mobileBorderAll=W.NULL_BORDER,N.mobileBorderTop=W.NULL_BORDER,N.mobileBorderBottom=W.NULL_BORDER,N.mobileBorderRight=W.NULL_BORDER,N.mobileBorderLeft=W.NULL_BORDER):N.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:N.mobileBorderAll.color,style:N.mobileBorderAll.style,width:N.mobileBorderAll.width}}}})})},jm=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{X(Pe=>!Pe),U?(N.borderRadiusAll=0,_e(!0)):N.borderRadiusAll=5,x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:N.borderRadiusAll}}})})},vm=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{xe(Pe=>!Pe),ce?(N.mobileBorderRadiusAll=null,de(!0)):N.mobileBorderRadiusAll=5,x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:N.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},Im=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{Ae(Pe=>!Pe),ne?(N.boxShadowInset=!1,N.boxShadowHOffset=null,N.boxShadowVOffset=null,N.boxShadowBlurRadius=null,N.boxShadowSpreadRadius=null,N.boxShadowColor=""):(N.boxShadowInset=!1,N.boxShadowHOffset=5,N.boxShadowVOffset=5,N.boxShadowBlurRadius=10,N.boxShadowSpreadRadius=-5,N.boxShadowColor="#000000"),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:N.boxShadowBlurRadius,color:N.boxShadowColor,hOffset:N.boxShadowHOffset,inset:N.boxShadowInset,spreadRadius:N.boxShadowSpreadRadius,vOffset:N.boxShadowVOffset}}})})},Cm=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{$e(Pe=>!Pe),we?(N.mobileBoxShadowInset=!1,N.mobileBoxShadowHOffset=null,N.mobileBoxShadowVOffset=null,N.mobileBoxShadowBlurRadius=null,N.mobileBoxShadowSpreadRadius=null,N.mobileBoxShadowColor=""):(N.mobileBoxShadowInset=!1,N.mobileBoxShadowHOffset=5,N.mobileBoxShadowVOffset=5,N.mobileBoxShadowBlurRadius=10,N.mobileBoxShadowSpreadRadius=-5,N.mobileBoxShadowColor="#000000"),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:N.mobileBoxShadowBlurRadius,color:N.mobileBoxShadowColor,hOffset:N.mobileBoxShadowHOffset,inset:N.mobileBoxShadowInset,spreadRadius:N.mobileBoxShadowSpreadRadius,vOffset:N.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Pm=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{ie(Pe=>!Pe),K&&(N.mobileWidth="",N.mobileHeight="",x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"},mobileHeight:{value:null,dim:"px",classNamePrefix:"em-mob-height-"}}}))})},va=()=>{De?(Ne.current=!1,ye(""),l.setFieldValue("link",""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{link:""}})):(Ne.current=!0,ye(Y.current&&Y.current.input.value?Y.current.input.value:"..."),setTimeout(()=>{Y.current.focus()}))},Ia=N=>{N.target.value===""?ye("..."):(z.current.classList.add("selected-td-form__button--active"),ye(N.target.value)),Wo(N.target.value,Ie)},Ca=()=>{const N=l.getFieldsValue(!0);re?(ke(""),N.alt="",x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{alt:""}})):(ke($.current&&$.current.input.value?$.current.input.value:"..."),setTimeout(()=>{$.current.focus()}))},Pa=N=>{N.target.value===""?ke("..."):(O.current.classList.add("selected-td-form__button--active"),ke(N.target.value))},Aa=()=>{const N=l.getFieldsValue(!0);ae?(Q(""),N.title="",x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{title:""}})):(Q(y.current&&y.current.input.value?y.current.input.value:"..."),setTimeout(()=>{y.current.focus()}))},Am=()=>{F(!R),R?(l.setFieldValue("imgReplacer",""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:""}})):setTimeout(()=>G.current.focus())},Nm=N=>{N.target.value!==""&&q.current.classList.add("selected-td-form__button--active")},Na=N=>{N.target.value===""?Q("..."):(oe.current.classList.add("selected-td-form__button--active"),Q(N.target.value))},Lm=N=>{l.setFieldValue("link",N!=="mergetag"?N:""),Ie(N)};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_image_form",initialValues:{src:"",width:"",height:"",widthDim:"",heightDim:"",alt:"",align:"left",border:"",boxShadow:"",show:"all",borderPosition:W.BORDER_POSITIONS[Co]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[Bo]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileAlign:"left",mobileVerticalAlign:"",link:"https://",imgReplacer:"",countdownNumbersStrong:!1,countdownNumbersItalic:!1,countdownLabelsStrong:!1,countdownLabelsItalic:!1,video:{source:"",playButton:"youtube_red"}},onValuesChange:Sr,autoComplete:"off",disabled:Eo,className:Eo?"element-controls selected-image-form_busy":"element-controls",children:[Eo&&(0,o.jsx)("div",{className:"selected-image-form__loader",ref:B,children:(0,o.jsxs)("div",{className:"selected-image-form__loader-body",children:[(0,o.jsx)(t.ui_kit$Spin,{size:"large"}),(0,o.jsx)("div",{className:"selected-image-form__loader-title",children:Ve.type==="countdown"?i("Preparing countdown preview…"):i("Preparing video preview…")})]})}),!m&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),h==="mobile"&&T.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(Or,{form:l,elementSettings:e,handleChangeValues:Sr,boxShadow:ue,mobileBordersShow:ee,mobileBorderRadiusShow:ce,mobileBoxShadowShow:we,mobileSizeShow:K,oneMobileBorderRadiusValue:ve,setOneMobileBorderRadiusValue:de,hasLink:De,hasAlt:re,hasTitle:ae,linkInputRef:Y,linkButtonRef:z,altInputRef:$,altButtonRef:O,titleInputRef:y,titleButtonRef:oe,linkInputHandler:Ia,altButtonHandler:Ca,altInputHandler:Pa,titleButtonHandler:Aa,titleInputHandler:Na,linkButtonHandler:va,toggleShowMobileBorderHandler:wm,toggleShowMobileBorderRadiusHandler:vm,toggleShowMobileBoxShadowHandler:Cm,toggleShowMobileSizeHandler:Pm})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Lr,{form:l,elementSettings:e,boxShadow:ue,bordersShow:be,borderRadiusShow:U,boxShadowShow:ne,oneBorderRadiusValue:se,setOneBorderRadiusValue:_e,hasLink:De,hasAlt:re,hasTitle:ae,isOpenSrcReplacer:R,mergeTagItems:Te,mergeMenuOpen:Z,setMergeMenuOpen:Be,cascaderRef:te,linkInputRef:Y,linkButtonRef:z,altInputRef:$,altButtonRef:O,titleInputRef:y,titleButtonRef:oe,srcReplacerInputRef:G,srcReplacerButtonRef:q,linkProtocol:Se,handleLinkProtocolsChange:Lm,linkButtonHandler:va,linkInputHandler:Ia,altButtonHandler:Ca,altInputHandler:Pa,titleButtonHandler:Aa,titleInputHandler:Na,srcReplacerButtonHandler:Am,srcInputHandler:Nm,handleSelect:mo,onChange:fe,filter:ze,renderSearchOption:co,handleChangeValues:Sr,toggleShowBorderHandler:ym,toggleShowBorderRadiusHandler:jm,toggleShowBoxShadowHandler:Im})})]})};Fr.propTypes={elementSettings:g.default.object.isRequired};var Mr=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:e("The font-size CSS property sets the size of the font."),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileFontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:e("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})},it=({form:e,elementSettings:i,imgParent:l=!1,name:s="align",setAlignStateHandle:a=()=>{},withHotKeys:d=!0})=>{const{__:c}=r.useI18n(),p=r.useSendPostMessage(),f=r.useAppConfig(),[x,k]=(0,n.useState)(null);(0,n.useEffect)(()=>{globalThis?.navigator?.userAgent.includes("Macintosh")&&k(!0)},[]);const b=v=>{a(v),e.setFieldsValue({[s]:v}),p({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[s]:v}})},h=d?{alignLeft:c("Text align left ( ⌘+Shift+L )"),alignCenter:c("Text align center ( ⌘+Shift+E )"),alignRight:c("Text align right ( ⌘+Shift+R )"),alignJustify:c("Text align justify ( ⌘+Shift+J )")}:void 0,T=d?{alignLeft:c("Text align left ( Ctrl+Shift+L )"),alignCenter:c("Text align center ( Ctrl+Shift+E )"),alignRight:c("Text align right ( Ctrl+Shift+R )"),alignJustify:c("Text align justify ( Ctrl+Shift+J )")}:void 0,_=d?x?h:T:void 0,E=i[s],w=typeof E=="string"?E:"";return(0,o.jsx)(t.ui_kit$Form.Item,{name:s,children:(0,o.jsx)(t.ui_kit$FormAlignTextControl,{value:w,onChange:b,disabled:l&&!i.parent,strokeWidth:f?.iconStrokeWidth,labels:_})})},qe=({form:e,elementSettings:i,name:l,icon:s,tooltipTitle:a=null,showTooltip:d=!0,forceInactive:c=!1})=>{const{__:p}=r.useI18n(),f=e.getFieldValue(l),x=r.useSendPostMessage(),[k,b]=(0,n.useState)(i[l]);(0,n.useEffect)(()=>{i[l]!==e.getFieldValue(l)&&(e.setFieldValue(l,i[l]),b(i[l]))},[i,e,l]),(0,n.useEffect)(()=>{k!==f&&b(f)},[f,k,l]);const h=()=>{const T={[l]:!k};e.setFieldValue(l,!k),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:T}),l==="textSuperscript"?e.setFieldValue("textSubscript",!1):l==="textSubscript"&&e.setFieldValue("textSuperscript",!1),b(_=>!_)};return(0,o.jsx)(t.ui_kit$Form.Item,{name:l,children:d?(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:a||p(l.substring(4)),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":k&&!c}),onClick:h,children:s})}):(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":k&&!c}),onClick:h,children:s})})};qe.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,tooltipTitle:g.default.string,imgParent:g.default.bool};var Dr=()=>{const{__:e}=r.useI18n();return[{symbol:"•",code:"•",description:e("Bullet")},{symbol:"+",code:"+",description:e("Plus")},{symbol:"»",code:"»",description:e("Double quotation")},{symbol:"×",code:"×",description:e("Cross")},{symbol:"–",code:"—",description:e("Dash")},{symbol:"›",code:"›",description:e("Single quotation")},{symbol:"→",code:"→",description:e("Arrow")},{symbol:"⇒",code:"⇒",description:e("Double arrow")},{symbol:"►",code:"▸",description:e("Pointer")},{symbol:"−",code:"−",description:e("Minus")},{symbol:"∗",code:"∗",description:e("Star")},{symbol:"♦",code:"♦",description:e("Diamond")}]},un=(e,i="#c6c3c3",l={},s)=>{const{symbolSize:a="25px",marginRight:d="5px",marginBottom:c="5px",textStyle:p={whiteSpace:"normal",lineHeight:"1.2"}}=l;return e.map(f=>({value:f.code,label:(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,o.jsx)("span",{style:{color:i||"#c6c3c3",marginRight:d,marginBottom:c,fontSize:a,lineHeight:"0.7",width:a,textAlign:"center",...p},children:f.symbol}),(0,o.jsx)("span",{style:p,children:f.description})]})}))},gt=({form:e,fillFields:i,elementSettings:l,showAddParagraph:s=!0,isButton:a=!1,linkProtocol:d,setLinkProtocol:c,linkTarget:p,isBulletFontColorChecked:f=!1,setIsBulletFontColorChecked:x=()=>{},showTopDivider:k=!0})=>{const{__:b}=r.useI18n(),h=W.useGoogleFontsLoader(),{token:T}=(0,t.ui_kit$useToken)(),_=r.useNotification(),E=r.useSendPostMessage(),w=r.useSendPostMessageEx(),v=r.useAppConfig(),A=(0,n.useRef)(),j=(0,n.useRef)(null),C=(0,n.useRef)(null),P=(0,n.useRef)(null),Y=(0,n.useRef)(!1),z=l,[$,O]=(0,n.useState)(!!z.textReplacer?.length),[y,oe]=(0,n.useState)(!!z.textAnchor?.length),[G,q]=(0,n.useState)(null),[te,ue]=(0,n.useState)({start:0,end:0}),[me,se]=(0,n.useState)(!1),[_e,ve]=(0,n.useState)([]),[de,De]=(0,n.useState)(z.list?.bulletsColor),[ye,re]=(0,n.useState)(l);l!==ye&&(re(l),De(z.list?.bulletsColor),O(!!z.textReplacer?.length),oe(!!z.textAnchor?.length));const[ke,ae]=(0,n.useState)(!1),[Q,be]=(0,n.useState)(!1),pe=(0,n.useRef)(null),ee=(0,n.useRef)(""),J=Dr(),U=(0,n.useMemo)(()=>J,[]),X={textColor:t.ui_kit$Form.useWatch("textColor",e),textLink:t.ui_kit$Form.useWatch("textLink",e),linkHref:t.ui_kit$Form.useWatch("linkHref",e),listUL:t.ui_kit$Form.useWatch("listUL",e),listOL:t.ui_kit$Form.useWatch("listOL",e)};(0,n.useEffect)(()=>{a&&l?.textColor!==void 0&&e.setFieldValue("textColor",l.textColor)},[a,l?.textColor,e]);let ce=null;(0,n.useEffect)(()=>{if(X?.textColor&&f){const L=e.getFieldValue("textColor");E({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{ColorBullets:L}})}},[X?.textColor]),(0,n.useEffect)(()=>{const L=e.getFieldValue("textLink");typeof l.linkHref=="string"&&ae(!0),pe&&!L&&(ae(!1),e.setFieldsValue({linkHref:null})),pe.current=L||null},[X?.textLink,X?.linkHref,l.linkHref,e]),(0,n.useEffect)(()=>{const L=e.getFieldValue("listUL"),R=e.getFieldValue("listOL");L&&ee.current!=="listUL"?(e.setFieldValue("listOL",!1),ee.current="listUL"):R&&ee.current!=="listOL"&&(e.setFieldValue("listUL",!1),ee.current="listOL"),!L&&!R&&(ee.current="")},[X?.listUL,X?.listOL,e]);const xe=L=>{L.data.operation===r.EVENT_TYPES.APPLICATION_FOCUS_IN_IFRAME&&q(null)};r.useListenPostMessage(xe);const[ne,Ae]=(0,n.useState)(null);(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&Ae(!0)},[]);const we=(0,n.useRef)(null);function $e(L){const R=L.key.toLowerCase();let F=!1;return((ce==="control"||ce==="meta")&&(R==="a"||R==="A")||(ce==="a"||ce==="A")&&(R==="control"||R==="meta"))&&(F=!0),ce=R,R!=="control"&&R!=="a"&&R!=="A"&&R!=="meta"&&(ce=null),F}const K=L=>{E({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:L,locale:"en_US"}),_.success({title:b("It`s done!")})},ie=[{key:"1",label:b("This element"),onClick:()=>K("typograf")},{key:"2",label:b("The whole email"),onClick:()=>K("typograf_all")}],[je,V]=(0,n.useState)(),[Se,Ie]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const L=un(U,de,{});ve(L)},[U,de]),(0,n.useEffect)(()=>{const L=l.linkHref||l.href;L&&Wo(L,c);const R=l.linkHref||l.href,F=R&&Bi(R)?R.slice(1):R||"https://";(i??((he,Le)=>he.setFieldsValue(Le)))(e,{linkHref:F})},[e,l,c,i]);const Ne=r.useAppConfig().mergeTags;(0,n.useEffect)(()=>{Ne?.items?.length&&V(r.mapMargeTags(Ne.items,b,(L,R)=>{Ie(!1),w(r.EVENT_TYPES.SANDBOX_ADD_MERGETAG,L),R.stopPropagation(),R.preventDefault()}))},[Ne,V,b,Ie,w]);const Fe=L=>{e.setFieldValue("linkHref",L!=="mergetag"?L:""),c(L)},Ve=(L,R)=>{if(Ie(!1),L){const F=Ne.syntax.length>1?je.findIndex(Le=>Le.key===R[0].key):0,he=Ne.syntax[F].replace("%value%",L[L.length-1]);if(G?.getAttribute("id")==="selected_button_form_href"||G?.getAttribute("id")==="selected_text_form_linkHref"||G?.getAttribute("id")==="selected_text_form_textReplacer")Be(he,G?.getAttribute("id"));else{e.setFieldValue("textReplacer",he);const Le=Date.now();E({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:`${he}~~${Le}`}})}}},Ue=(L,R)=>R.some(F=>F.label.toLowerCase().indexOf(L.toLowerCase())>-1),le=(L,R)=>{const F=R.map((he,Le)=>{const eo=he.label.split(new RegExp(`(${L})`,"gi"));return(0,o.jsxs)("span",{children:[Le!==0&&(0,o.jsx)("span",{children:" / "}),eo.map((Xe,lo)=>Xe.toLowerCase()===L.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:Xe},lo):Xe)]},he.value)});return(0,o.jsx)("div",{title:R.map(he=>he.label).join(" / "),children:F})};(0,n.useEffect)(()=>{Se&&we.current&&we.current.focus()},[Se]);const Te=r.useRootElement();(0,n.useEffect)(()=>{const L=({target:he})=>{he.closest('[id="merge_tags_wrapper"]')||q(he)},R=({target:he})=>{!he.closest(".merge-tags")&&!he.closest("#merge_tags_button")&&Ie(!1)},F=new xo.Disposable;return F.addDisposable(r.addWindowListenerFromShadow(Te,"focusin",L)),F.addDisposable(r.addWindowListenerFromShadow(Te,"click",R)),()=>{F.dispose()}},[Te]);const I=(0,n.useCallback)(()=>{const L=window.getSelection();L&&L.toString().length>0&&(Y.current=!0)},[]),Z=(0,n.useCallback)(({target:L})=>{if(L&&!me){const{selectionStart:R,selectionEnd:F}=L;ue(he=>he?.start===R&&he?.end===F?he:{start:R,end:F})}se(!1)},[me]);(0,n.useEffect)(()=>Z({target:p?.target}),[p,Z]);const Be=(L,R)=>{const F=document.getElementById(R);if(F){const he=F.value?.substring(0,te.start),Le=F.value?.substring(te.end),eo=R.substring(R.lastIndexOf("_")+1);E({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{[eo]:he+L+Le}}),e.setFieldValue(eo,he+L+Le),F.focus(),setTimeout(()=>{F.selectionStart=te.start,F.selectionEnd=te.start+L.length},400),se(!0)}},Ce=()=>{O(!$),$?(e.setFieldValue("textReplacer",""),E({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:""}})):setTimeout(()=>j.current.focus())},Me=L=>{L.target.value!==""&&C.current?.classList.add("selected-td-form__button--active")},Ge=(L="unknown")=>{oe(!y),y?(e.setFieldValue("textAnchor",""),E({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textAnchor:""}})):setTimeout(()=>P.current?.focus())},Ye=L=>{const R=L.target,F=R.value,he=R.selectionStart,Le=$e(L);if(Y.current&&he===0&&E({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:`${F}~`}}),Y.current=Le,he===0&&L.key===" "){L.preventDefault();return}if(L.key===" "){if(he!==F.length){L.preventDefault();return}F.endsWith(" ")&&L.preventDefault()}},D=L=>{De(L),f&&x(!1)};return(0,o.jsxs)(o.Fragment,{children:[s&&!l.showOnMobile&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Row,{gutter:20,style:{paddingBottom:4},children:(0,o.jsx)(t.ui_kit$Col,{span:12,gutter:20,children:(0,o.jsx)(it,{form:e,elementSettings:l,name:"textAlign"})})})}),v.formTextFieldTypografEnabled&&!a||v.mergeTagsShow&&je?(0,o.jsx)(t.ui_kit$FormSection,{title:null,dividerTop:k,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginTop:4},children:[v.formTextFieldTypografEnabled&&!a&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"AddImage",style:{marginBottom:T.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"AddImage",component:t.icons$AddImage}),onClick:()=>K("add_img"),style:{width:"100%"},children:b("Add image")})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"Typography",style:{marginBottom:T.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,menu:{items:ie},trigger:["hover"],placement:"bottom",getPopupContainer:L=>L.closest(".selected-element-panel"),children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Typograf",component:t.icons$Typograf}),onClick:()=>K("typograf"),style:{width:"100%"},children:b("Typography")})})})})]}),v.mergeTagsShow&&je&&(0,o.jsxs)(t.ui_kit$Col,{span:24,id:"merge_tags_wrapper",style:{marginBottom:T.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Button,{id:"merge_tags_button",icon:(0,o.jsx)(r.EmIcons,{icon:"MergeTags",component:t.icons$MergeTags}),style:{width:"100%",display:Se?"none":"inline-flex"},onClick:()=>Ie(!0),children:b("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:we,classNames:{popup:{root:"merge-tags"}},options:je,placeholder:b("Start typing the title"),showSearch:{filter:Ue,render:le},spellCheck:"false",getPopupContainer:L=>L.closest(".email-pane__collapse-wrapper"),onChange:Ve,style:{display:Se?"block":"none",width:"100%"},open:Se,onKeyDown:L=>{L.key==="Escape"&&Ie(!1)}})]})]})}):null,(0,o.jsxs)(t.ui_kit$FormSection,{title:null,dividerTop:k||v.formTextFieldTypografEnabled&&!a,bodyStyle:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Text font"),placement:"bottom",zIndex:1,getPopupContainer:L=>L.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:h,getPopupContainer:L=>L.closest(".email-pane__collapse-wrapper")})})}),!l.showOnMobile&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:b("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:b("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{marginBottom:10,marginTop:5},children:(0,o.jsxs)(t.ui_kit$Col,{span:24,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:-10},children:[a&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsxs)("div",{className:"selected-text-common-form__format-toolbar",children:[(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textStrong",tooltipTitle:b(ne?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})}),(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textItalic",tooltipTitle:b(ne?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})}),(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textUnderline",tooltipTitle:b(ne?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})}),(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:b(ne?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Text color"),placement:"bottom",zIndex:1,getPopupContainer:L=>L.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:b("Please set the font color")}],className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:b("Color"),usedColors:l.usedColors})})})})]}),!a&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textStrong",tooltipTitle:b(ne?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textItalic",tooltipTitle:b(ne?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textUnderline",tooltipTitle:b(ne?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})}),l?.list?.isList&&(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:b(ne?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]}),!l?.list?.isList&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:l,name:"listUL",tooltipTitle:b("Unordered list"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnorderedListOutlined",component:t.icons$UnorderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:Z})}),!l?.list?.isList&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:l,name:"listOL",tooltipTitle:b("Ordered list"),icon:(0,o.jsx)(r.EmIcons,{icon:"OrderedListOutlined",component:t.icons$OrderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:Z})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textSuperscript",tooltipTitle:b("Text superscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Superscript",component:t.icons$Superscript})})}),l?.list?.isList&&(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textSubscript",tooltipTitle:b("Text subscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Subscript",component:t.icons$Subscript})})]}),s&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,className:(0,He.default)("selected-text-common-form__button selected-text-common-form__button_style",{"selected-text-common-form__button--active":typeof l.linkHref=="string"}),elementSettings:l,name:"textLink",forceInactive:!!l.textAnchor,tooltipTitle:b("Link"),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"}),onSelect:Z})}),l?.list?.isList&&v.formTextFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:b("Text replacer"),placement:"bottom",getPopupContainer:L=>L.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":$}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:Ce,ref:C})})}),(!l?.list?.isList||s&&l?.list?.isList)&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:b("More options"),placement:"bottom",getPopupContainer:L=>L.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":Q||y}),icon:(0,o.jsx)(r.EmIcons,{icon:"DotsHoriz",component:t.icons$DotsHoriz,className:"selected-td-form__icon-radius"}),onClick:()=>be(!Q)})})})]})]}),!a&&Q&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[!l?.list?.isList&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:b(ne?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]}),(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(qe,{form:e,elementSettings:l,name:"textSubscript",tooltipTitle:b("Text subscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Subscript",component:t.icons$Subscript})})]}),v.formTextFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:b("Text replacer"),placement:"bottom",getPopupContainer:L=>L.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":$}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:Ce,ref:C})})})]}),s&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:b("Anchor"),placement:"bottom",getPopupContainer:L=>L.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":y}),icon:(0,o.jsx)(r.EmIcons,{icon:"Anchor",component:t.icons$Anchor,className:"selected-text-common-form__icon-radius"}),onMouseDown:L=>{L.preventDefault(),Ge("mouseDown")}})})})]}),s&&typeof l.linkHref=="string"&&ke&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(et,{show:d==="#",__:b,style:{marginBottom:T.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b(d==="#"?"Anchor name":"The URL that the hyperlink directs to."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkHref",style:{marginBottom:d==="mailto:"?T.formItemMarginBottomXS:""},children:(0,o.jsx)(t.ui_kit$Input,{ref:A,addonBefore:(0,o.jsx)(Zo,{linkProtocol:d,handleLinkProtocolsChange:Fe,__:b}),allowClear:!0,placeholder:b(d==="#"?"Anchor name":"Hyperlink URL"),autoFocus:l?.isNewLink,onSelect:Z,prefix:(0,o.jsx)(Qo,{linkProtocol:d})})})}),d==="mailto:"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"subject",style:{marginBottom:T.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:b("Subject"),onSelect:Z})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:T.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:b("Body"),onSelect:Z})})]})]}),s&&y&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Anchor name"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textAnchor",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:b("Anchor name"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content addon-text-content--icon",title:b("Anchor"),"aria-hidden":!0,children:(0,o.jsx)(r.EmIcons,{icon:"Anchor",component:t.icons$Anchor,className:"selected-text-common-form__icon-radius",size:18})}),ref:P,onSelect:Z,onBlur:()=>{e.getFieldValue("textAnchor")?.trim()||oe(!1)}})})}),!a&&$&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textReplacer",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:b("The code that will replace this text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:b("Text")}),onChange:Me,onKeyDown:Ye,onDoubleClick:I,ref:j,onSelect:Z})})})]})}),!a&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Text color"),placement:"bottom",zIndex:1,getPopupContainer:L=>L.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:b("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:b("Color"),usedColors:l.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Text background"),placement:"bottom",zIndex:1,getPopupContainer:L=>L.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:b("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:b("Background color"),usedColors:l.usedColors})})})})]})]}),!a&&l?.list?.isList&&(0,o.jsxs)(t.ui_kit$FormSection,{title:b("List settings"),dividerTop:!0,children:[l?.list?.listType==="OL"&&(0,o.jsx)(t.ui_kit$Row,{children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets font"),placement:"bottom",zIndex:1,getPopupContainer:L=>L.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"BulletsFontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:h,getPopupContainer:L=>L.closest(".email-pane__collapse-wrapper"),style:{marginTop:"-9px"}})})})})}),(0,o.jsx)(t.ui_kit$Row,{gutter:[10],children:l?.list?.listType==="UL"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets type"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"BulletType",className:"bullet-type",children:(0,o.jsx)(t.ui_kit$Select,{size:"medium",placeholder:b("Bullets type"),onClick:L=>L.stopPropagation(),options:_e})})})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:[10],children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets color"),placement:"bottom",zIndex:1,getPopupContainer:L=>L.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"ColorBullets",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:b("Bullets color"),usedColors:l.usedColors,disabled:f,onChange:D,externalValue:f?X?.textColor:void 0})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"BulletsSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,defaultValue:l?.list?.bulletFontSize,placeholder:b("Bullets size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})})]}),l?.list?.listType==="OL"&&(0,o.jsxs)(t.ui_kit$Row,{children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:l,name:"BulletTextStrong",tooltipTitle:b(ne?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:l,name:"BulletTextItalic",tooltipTitle:b(ne?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:l,name:"BulletTextStrikethrough",tooltipTitle:b(ne?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:l,name:"BulletTextUnderline",tooltipTitle:b(ne?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:[10],style:{marginTop:"-8px"},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Between list items"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"SpacingBetweenParagraphs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:5,max:100,placeholder:b("Between list items"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Between bullets and text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"SpacingBetweenBulletsAndText",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:1,max:100,placeholder:b("Between bullets and text"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px"})})})})]})]})]})},Ri=({form:e,elementSettings:i,showAddParagraph:l=!0,isButton:s=!1})=>{const{__:a}=r.useI18n(),d=W.useGoogleFontsLoader(),c=r.useSendPostMessage(),p=r.useDispatch(),f=r.useElementEntityKind(),x=r.useAppConfig(),[k,b]=(0,n.useState)(null);(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&b(!0)},[]);const h=A=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:A,locale:"en_US"})},[T,_]=(0,n.useState)(i.textAlign),[E,w]=(0,n.useState)(i.linkHref),v=A=>_(A);return(0,n.useEffect)(()=>{_(i.textAlign),w(i.linkHref)},[i]),(0,o.jsx)("div",{className:"selected_text_common_form_mobile",children:(0,o.jsxs)(t.ui_kit$Space,{size:"8",separator:(0,o.jsx)(t.ui_kit$Divider,{orientation:"vertical"}),children:[(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,o.jsx)("div",{style:{width:190},children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Text font"),placement:"bottom",zIndex:1,getPopupContainer:A=>A.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:d,getPopupContainer:A=>A.closest(".selected_text_common_form_mobile")})})})}),(0,o.jsx)("div",{style:{width:90},children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:a("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)("div",{style:{width:90},children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:a("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,o.jsx)(qe,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:a(k?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-td-form__icon-radius"})}),(0,o.jsx)(qe,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:a(k?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})}),(0,o.jsx)(qe,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:a(k?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-td-form__icon-radius"})}),(0,o.jsx)(qe,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:a(k?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-td-form__icon-radius"})})]}),(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Text color"),placement:"bottom",zIndex:1,getPopupContainer:A=>A.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:a("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:a("Color"),usedColors:i.usedColors,getPopupContainer:A=>A.closest(".selected_text_common_form_mobile")})})}),!s&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Text background"),placement:"bottom",zIndex:1,getPopupContainer:A=>A.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:a("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:a("Background color"),usedColors:i.usedColors})})})})]}),l&&(0,o.jsx)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:(0,o.jsxs)(o.Fragment,{children:[typeof E=="string"?(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,popupRender:()=>(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("The URL that the hyperlink directs to."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkHref",children:(0,o.jsx)(t.ui_kit$Input,{allowClear:!0,placeholder:a("Hyperlink URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined}),autoFocus:i?.isNewLink})})}),classNames:{root:"codemode-textalign-dropdown"},styles:{root:{left:520,top:52,transform:"translateX(0)",marginLeft:57}},trigger:["hover"],placement:"bottom",getPopupContainer:A=>A.closest(".selected_text_common_form_mobile"),children:(0,o.jsx)("div",{children:(0,o.jsx)(qe,{form:e,className:"selected-td-form__button selected-td-form__button_style selected-td-form__button--active",elementSettings:i,name:"textLink",icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),showTooltip:!1})})}):(0,o.jsx)(qe,{form:e,className:"selected-td-form__button selected-td-form__button_style",elementSettings:i,name:"textLink",tooltipTitle:a("Link"),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"})}),(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,popupRender:()=>(0,o.jsx)(it,{form:e,elementSettings:i,name:"textAlign",setAlignStateHandle:v}),classNames:{root:"codemode-textalign-dropdown"},styles:{root:{left:615,top:52,transform:"translateX(0)",marginLeft:57}},trigger:["hover"],placement:"bottom",getPopupContainer:A=>A.closest(".selected_text_common_form_mobile"),children:(0,o.jsx)(t.ui_kit$Button,{icon:T==="right"?(0,o.jsx)(r.EmIcons,{icon:"AlignRightOutlined",component:t.icons$AlignRightOutlined,size:18,strokeWidth:x.iconStrokeWidth}):T==="center"?(0,o.jsx)(r.EmIcons,{icon:"AlignCenterOutlined",component:t.icons$AlignCenterOutlined,size:18,strokeWidth:x.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"AlignLeftOutlined",component:t.icons$AlignLeftOutlined,size:18,strokeWidth:x.iconStrokeWidth}),className:"selected-td-form__button"})})]})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[l&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Add paragraph"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Paragraph",component:t.icons$Paragraph}),onClick:()=>h("add_p"),className:"selected-td-form__button"})}),!s&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Add inline image"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"ImageAdd",component:t.icons$ImageAdd,size:16,strokeWidth:x.iconStrokeWidth}),onClick:()=>h("add_img"),className:"selected-td-form__button"})}),(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Typograf",component:t.icons$Typograf}),className:"selected-td-form__button"})]}),(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"CloseOutlined",component:t.icons$CloseOutlined}),type:"icon",style:{marginLeft:26},onClick:()=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),p(r.resetToLastActiveSettingsTab()),setTimeout(()=>{p(f==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300)}})]})]})})},Dt=({elementSettings:e,imgParent:i=!1,name:l="mobileAlign"})=>{const{__:s}=r.useI18n(),a=r.useAppConfig();return(0,o.jsx)(t.ui_kit$Form.Item,{name:l,children:(0,o.jsx)(t.ui_kit$FormAlignTextControl,{disabled:i&&!e.parent,strokeWidth:a?.iconStrokeWidth,labels:{alignLeft:s("Text align left"),alignCenter:s("Text align center"),alignRight:s("Text align right"),alignJustify:s("Text align justify")}})})};Dt.propTypes={elementSettings:g.default.object.isRequired,imgParent:g.default.bool,name:g.default.string};var mn=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useDispatch(),s=r.useSendPostMessage(),[a]=t.ui_kit$Form.useForm(),d=r.useSelector(r.selectEmailViewType),c=r.useSelector(r.selectMobileViewActive),p=r.useSelector(r.selectIsCodeMode),f=r.useSelector(r.selectCodeModeDirection),x=p&&f!=="bottom",[k,b]=(0,n.useState)("https://"),[h,T]=(0,n.useState)(!1),_=Dr(),E=(0,n.useMemo)(()=>_,[]),w=r.useElementEntityKind(),{remember:v,fillFields:A}=st(e),j=(0,n.useCallback)(P=>{v(P),l(w==="email"?r.setElementSettings$1(P):r.setElementSettings(P))},[l,w,v]);(0,n.useEffect)(()=>{if(e){const{subject:P,body:Y,baseEmail:z}=Pr(e.linkHref),$=e.linkHref,O=typeof $=="string"&&Bi($),y=typeof $=="string"&&$.startsWith("mailto:")?z:O?$.slice(1):typeof $=="string"?$:"https://";b(Mt($||"","https://")),A(a,{...e,lineHeight:u(e.lineHeight),linkHref:y,subject:P,body:Y,mobileFontSize:u(e.mobileFontSize?.value||e.fontSize),mobileFontSizeDim:e.mobileFontSize?.dim||e.fontSizeDim,mobileLineHeight:u(e.mobileLineHeight?.value??e.lineHeight),mobileLineHeightDim:e.mobileLineHeight?.dim||e.lineHeightDim,mobileTextAlign:Ar(e.mobileTextAlign,e.textAlign),SpacingBetweenBulletsAndText:e?.list?.betweenRowCell,SpacingBetweenParagraphs:e?.list?.betweenParagraphs,BulletsSize:e?.list?.bulletFontSize,ColorBullets:e?.list?.bulletsColor,BulletTextStrong:e?.list?.bulletFontBold,BulletTextItalic:e?.list?.bulletFontItalic,CheckboxColor:h,BulletsFontFamily:e?.list?.bulletFontFamily,BulletTextUnderline:e?.list?.bulletFontUnderline,BulletTextStrikethrough:e?.list?.bulletFontStrikethrough,BulletType:E.find(oe=>oe.symbol===e?.list?.bulletType)?.code??E[0].code,textSuperscript:e?.textSuperscript,textSubscript:e?.textSubscript,listOL:e?.standardList?.listTypeOL,listUL:e?.standardList?.listTypeUL})}},[a,e]);const C=P=>{const Y=a.getFieldsValue(!0),z=Object.keys(P)[0];let $;switch(z){case"mobileFontSize":$={[z]:{classNamePrefix:"em-mob-font_size-",value:P[z],dim:Y.mobileFontSizeDim}};break;case"mobileLineHeight":$={[z]:{classNamePrefix:"em-mob-line_height-",value:P[z],dim:Y.mobileLineHeightDim}};break;case"mobileTextAlign":$={[z]:{classNamePrefix:"em-mob-text_align-",value:P[z]}};break;case"linkHref":let O=ot(P[z]);if(O!==P[z]&&a.setFieldValue("linkHref",O),k==="#"&&O&&!O.startsWith("#")&&(O="#"+O),O.startsWith("mailto:")){const oe=a.getFieldValue("subject"),G=a.getFieldValue("body");$={[z]:Si(O,oe,G)}}else $={[z]:O};Wo(O,b);break;case"subject":case"body":const y=a.getFieldValue("linkHref")||"";if(y.substring(0,7)==="mailto:"){const oe=y.split("?")[0],G=z==="subject"?P[z]:a.getFieldValue("subject"),q=z==="body"?P[z]:a.getFieldValue("body"),te=[];G&&te.push(`subject=${encodeURIComponent(G)}`),q&&te.push(`body=${encodeURIComponent(q)}`),$={linkHref:te.length>0?`${oe}?${te.join("&")}`:oe}}else return;break;default:$=P}s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:$}),j({...e,list:{...e.list,bulletsColor:a.getFieldValue("ColorBullets"),bulletFontFamily:a.getFieldValue("BulletsFontFamily"),bulletFontSize:a.getFieldValue("BulletsSize"),betweenParagraphs:a.getFieldValue("SpacingBetweenParagraphs"),betweenRowCell:a.getFieldValue("SpacingBetweenBulletsAndText"),bulletType:E.find(O=>O.code===a.getFieldValue("BulletType"))?.symbol??E[0].symbol},...$,activateSection:null,changeKey:z})};return(0,o.jsxs)(t.ui_kit$Form,{form:a,layout:"vertical",name:"selected_text_form",autoComplete:"off",onValuesChange:C,className:"element-controls",initialValues:{textAlign:"left",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1,textColor:"",textBackgroundColor:"",textLink:!1,textReplacer:"",textAnchor:"",subject:"",body:"",SpacingBetweenBulletsAndText:0,SpacingBetweenParagraphs:0,BulletsSize:0,ColorBullets:"",BulletTextStrong:!1,BulletTextItalic:!1,CheckboxColor:!1,BulletsFontFamily:"",BulletTextUnderline:!1,BulletTextStrikethrough:!1,BulletType:"",textSuperscript:!1,textSubscript:!1,listOL:!1,listUL:!1},children:[!x&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),!(d==="mobile"&&!x&&c.styles)&&(0,o.jsx)("div",{id:"selected_element_form_desktop_props",style:{paddingRight:0},children:x?(0,o.jsx)(Ri,{form:a,elementSettings:e}):(0,o.jsx)(gt,{form:a,fillFields:A,elementSettings:e,linkProtocol:k,setLinkProtocol:b,isBulletFontColorChecked:h,setIsBulletFontColorChecked:T})}),!x&&(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:d==="mobile"&&c.styles?"block":"none"},children:[(0,o.jsx)(t.ui_kit$Row,{gutter:20,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Dt,{form:a,elementSettings:e,name:"mobileTextAlign"})})}),!!e.showOnMobile&&(0,o.jsx)(gt,{form:a,fillFields:A,elementSettings:e,linkProtocol:k,setLinkProtocol:b}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Mr,{})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileLineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})]})]})]})},yi=(e,i)=>{const{__:l}=r.useI18n();return(0,o.jsx)(t.ui_kit$Tooltip,{title:l("During export, the element is converted into an image."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"exportAsPicture",valuePropName:"checked",className:"form-item-margin-xs",style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$Switch,{id:"convert-in-image",label:l("Convert into an image"),size:"small",labelStyle:{position:"relative",top:2}})})},"exportAsPicture")},Vr={marginBottom:10},Hr={position:"relative",top:2};function pn(e){return Array.isArray(e)?!!e[0]?.value:typeof e=="string"?e.trim()!=="":!!e}var rt=({form:e,showRounding:i=!1,showBackground:l=!1})=>{const{__:s}=r.useI18n(),a=pn(t.ui_kit$Form.useWatch("backgroundImage",e));return(0,o.jsxs)(o.Fragment,{children:[i&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Adds bulletproof VML markup so the button keeps rounded corners in Outlook."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"outlookRounding",valuePropName:"checked",className:"form-item-margin-xs",style:Vr,children:(0,o.jsx)(t.ui_kit$Switch,{id:"outlook-rounding",label:s("Rounded corners in Outlook (VML)"),size:"small",labelStyle:Hr})})},"outlookRounding"),l&&a&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Adds VML markup so the background image is visible in Outlook."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"outlookBackground",valuePropName:"checked",className:"form-item-margin-xs",style:Vr,children:(0,o.jsx)(t.ui_kit$Switch,{id:"outlook-background",label:s("Background image in Outlook (VML)"),size:"small",labelStyle:Hr})})},"outlookBackground")]})};rt.propTypes={form:g.default.object,showRounding:g.default.bool,showBackground:g.default.bool};var Ur=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:a,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:p,backgroundRepeatOptions:f,backgroundSizeOptions:x,sizeShow:k,modificationShow:b,oneBorderRadiusValue:h,setOneBorderRadiusValue:T,toggleShowBorderHandler:_,toggleShowBorderRadiusHandler:E,toggleShowBoxShadowHandler:w,toggleShowSizeHandler:v,toggleShowBackgroundHandler:A,toggleShowModificationHandler:j})=>{const{__:C}=r.useI18n(),P=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(Uo,{form:e,elementSettings:i,tooltipTitle:C("The align attribute sets the horizontal alignment of the table.")})}),(0,o.jsx)(t.ui_kit$FormSection,{title:C("Size"),collapsible:!0,open:k,onToggle:v,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{showHeight:!1,showMinMax:!0,columnsPerRow:2,dimensionSelect:$o,minWidthDimensionSelect:$o,maxWidthDimensionSelect:$o,rowStyle:{marginBottom:4},labels:{width:C("Width"),height:C("Height"),minWidth:C("Minimum width"),maxWidth:C("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:C("Background"),collapsible:!0,open:c,onToggle:A,dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{imageEnabled:P.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:p,usedColors:i.usedColors,colorPlaceholder:C("Background color"),horizontalPositionPlaceholder:C("Horizontal position"),horizontalPositionTooltip:C("Horizontal position"),verticalPositionPlaceholder:C("Vertical position"),verticalPositionTooltip:C("Vertical position"),backgroundRepeatTooltip:C("Background image repeat"),backgroundSizeTooltip:C("Background image size"),selectPlaceholder:C("Please choose"),backgroundRepeatOptions:f,backgroundSizeOptions:x,imageUploadSlot:P.formTableFieldBackgroundImageEnabled?(0,o.jsx)(No,{form:e,label:C("Background image"),name:"backgroundImage",tooltipTitle:C("Background image"),placeholder:C("Background image link/route")}):void 0}),(0,o.jsx)(rt,{form:e,showBackground:!0})]}),P.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("Borders"),collapsible:!0,open:s,onToggle:_,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),P.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("Border radius"),collapsible:!0,open:a,onToggle:E,dividerTop:!0,children:(0,o.jsx)(So,{form:e,oneBorderRadiusValue:h,setOneBorderRadiusValue:T,elementSettings:i})}),P.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("Box shadow"),collapsible:!0,open:d,onToggle:w,dividerTop:!0,children:(0,o.jsx)(jo,{})}),P.formFieldExportAsPictureEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("Export settings"),collapsible:!0,open:b,onToggle:j,dividerTop:!0,children:(0,o.jsx)(yi,{form:e,elementSettings:i})}),P.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})}),P.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};Ur.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,backgroundShow:g.default.bool,backgroundImageEmpty:g.default.bool,backgroundRepeatOptions:g.default.array,backgroundSizeOptions:g.default.array,sizeShow:g.default.bool,modificationShow:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func,toggleShowSizeHandler:g.default.func,toggleShowBackgroundHandler:g.default.func,toggleShowModificationHandler:g.default.func};var Wr=({form:e,elementSettings:i,label:l})=>{const{__:s}=r.useI18n();(0,n.useRef)();const[a,d]=(0,n.useState)(i.mobileBackgroundColor?.value==="none"),{token:c}=(0,t.ui_kit$useToken)(),p=r.useSendPostMessage(),f=k=>{e.setFieldsValue({mobileBackgroundColor:""}),d(b=>!b),p({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:a?"":"none"}}})},x=k=>{d(!1)};return(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)(t.ui_kit$Tooltip,{trigger:["hover"],title:s("Background color"),placement:"left",children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundColor",style:{marginBottom:c.formItemMarginBottomXS/2},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{onChange:x,placeholder:l,usedColors:i.usedColors})}),(0,o.jsx)(t.ui_kit$Switch,{id:"without-background-color",label:s("Without background color"),labelSize:"small",size:"small",checked:a,onChange:f})]})})};Wr.propTypes={form:g.default.shape({setFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired};var Vt={horizontal:[{value:"left",label:"left"},{value:"center",label:"center"},{value:"right",label:"right"}],vertical:[{value:"top",label:"top"},{value:"center",label:"center"},{value:"bottom",label:"bottom"}]},wi={mobileBackgroundColor:"em-mob-background_color-",mobileBackgroundImage:"em-mob-background_image-",mobileBackgroundPositionX:"em-mob-background_position_x-",mobileBackgroundPositionY:"em-mob-background_position_y-",mobileBackgroundRepeat:"em-mob-background_repeat-",mobileBackgroundSize:"em-mob-background_size-"},at="none",hn=/^(https?:)?\/\//i,bn=/^(\d*\.?\d+)(%|px)$/;function fn(e){return e in wi}function zr(e){return hn.test(e.trim())}function ji(e,i){const l=wi[e],s=typeof i=="string"?i:"";return e==="mobileBackgroundImage"?s&&s!==at&&!zr(s)?null:{[e]:[{classNamePrefix:l,value:s,type:"url"}]}:e==="mobileBackgroundRepeat"?{[e]:{classNamePrefix:l,value:s||at}}:{[e]:{classNamePrefix:l,value:s}}}function _t(e){const[i]=Object.keys(e??{});return!i||!fn(i)?null:ji(i,e[i])}function gn(){return Object.keys(wi).reduce((e,i)=>({...e,...ji(i,"")}),{})}function Gr(e){const i=(e??"").trim(),l=i.match(bn);return l?{position:l[1],unit:l[2]}:{position:i,unit:"px"}}function Yr(e,i){return e?isNaN(parseFloat(e))?e:e+i:""}function Go(e){const i=e??{},l=i.customTable??i;return{type:i.type,usedColors:i.usedColors,mobileBackgroundColor:l.mobileBackgroundColor,mobileBackgroundImage:l.mobileBackgroundImage,mobileBackgroundPositionX:l.mobileBackgroundPositionX,mobileBackgroundPositionY:l.mobileBackgroundPositionY,mobileBackgroundRepeat:l.mobileBackgroundRepeat,mobileBackgroundSize:l.mobileBackgroundSize}}function xt(e){const i=e??{},l=i.customTable??i,s=l.backgroundSize??"";return{image:l.backgroundImage?.[0]?.value??"",positionX:l.backgroundPositionX??"",positionY:l.backgroundPositionY??"",repeat:l.backgroundRepeat??"",size:s==="auto"?"":s}}function nt(e){const i=Go(e),l=i.mobileBackgroundImage?.[0]?.value??"";return{mobileBackgroundImage:l===at?"":l,mobileBackgroundPositionX:i.mobileBackgroundPositionX?.value??"",mobileBackgroundPositionY:i.mobileBackgroundPositionY?.value??"",mobileBackgroundRepeat:i.mobileBackgroundRepeat?.value||at,mobileBackgroundSize:i.mobileBackgroundSize?.value??""}}function kt(e){const i=Go(e),l=i.mobileBackgroundRepeat?.value;return!!i.mobileBackgroundColor?.value||!!i.mobileBackgroundImage?.[0]?.value||!!i.mobileBackgroundPositionX?.value||!!i.mobileBackgroundPositionY?.value||!!l&&l!==at||!!i.mobileBackgroundSize?.value}function _n(e,i){return e===at?!1:!!e||!!i}function Et(e,i,l){e.setFieldsValue({...nt({}),mobileBackgroundColor:""}),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Go(i).type,settings:gn()})}var xn=/^\d*\.?\d+$/,kn={bottom:"auto"},Xr={marginBottom:0},En=(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal}),Bn=(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical}),Sn=e=>e.closest(".email-pane__collapse-wrapper")??e.parentNode,Kr=({value:e,onChange:i,inheritedValue:l,options:s,placeholder:a,prefix:d})=>{const c=e||l,[p,f]=(0,n.useState)(()=>Gr(c));(0,n.useEffect)(()=>{f(h=>Yr(h.position,h.unit)===c?h:Gr(c))},[c]);const x=(0,n.useCallback)((h,T)=>{f({position:h,unit:T});const _=s.some(E=>E.value===h);(h===""||_||xn.test(h))&&i?.(Yr(h,T))},[i,s]),k=(0,n.useCallback)(h=>x(h,p.unit),[x,p.unit]),b=(0,n.useCallback)(h=>x(p.position,h),[x,p.position]);return(0,o.jsx)(t.ui_kit$InputSelect,{options:s,position:p.position,setPosition:k,unit:p.unit,setUnit:b,placeholder:a,prefix:d,dropdownStyle:kn,tooltipTitle:a,getTooltipPopupContainer:Sn})},Tn=({desktopPositionX:e,desktopPositionY:i})=>{const{__:l}=r.useI18n(),{token:s}=(0,t.ui_kit$useToken)(),a=s.formItemMarginBottomXS,d=(0,n.useMemo)(()=>({marginBottom:a}),[a]);return(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:d,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundPositionX",style:Xr,children:(0,o.jsx)(Kr,{inheritedValue:e,options:Vt.horizontal,placeholder:l("Horizontal position"),prefix:En})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundPositionY",style:Xr,children:(0,o.jsx)(Kr,{inheritedValue:i,options:Vt.vertical,placeholder:l("Vertical position"),prefix:Bn})})})]})},qr=["hover"],Jr=e=>document.querySelector(".email-properties__collapse-panel")??e.parentNode,Qr=({value:e,emptyValue:i,inheritedValue:l,...s})=>{const a=!!e&&e!==i,d=s.options.some(c=>c.value===l)?l:i;return(0,o.jsx)(t.ui_kit$Select,{...s,value:a?e:d})},Rn=({desktopPositionX:e,desktopPositionY:i,desktopRepeat:l,desktopSize:s,backgroundRepeatOptions:a,backgroundSizeOptions:d})=>{const{__:c}=r.useI18n(),{token:p}=(0,t.ui_kit$useToken)(),f=p.formItemMarginBottomXS,x=(0,n.useMemo)(()=>({marginBottom:f}),[f]),k=(0,n.useMemo)(()=>({marginBottom:(f??0)*1.5}),[f]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Tn,{desktopPositionX:e,desktopPositionY:i}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:k,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:qr,title:c("Background image repeat"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundRepeat",style:x,children:(0,o.jsx)(Qr,{emptyValue:"none",inheritedValue:l,options:a,placeholder:c("Please choose"),getPopupContainer:Jr})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:qr,title:c("Background image size"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundSize",style:x,children:(0,o.jsx)(Qr,{emptyValue:"",inheritedValue:s,options:d,placeholder:c("Please choose"),getPopupContainer:Jr})})})})]})]})},yn=ci,wn=({value:e,inheritedImage:i,...l})=>(0,o.jsx)(yn,{...l,value:e||i}),jn=e=>/^https?:\/\//i.test(e.trim()),vn=({form:e,name:i="mobileBackgroundImage",placeholder:l="",disabled:s=!1,elementSettings:a,inheritedImage:d="",isImageNone:c=!1,onImageNoneChange:p})=>{const{__:f}=r.useI18n(),{token:x}=(0,t.ui_kit$useToken)(),k=t.ui_kit$Form.useWatch(i,e),[b,h]=(0,n.useState)(""),T=k||d,_=x.formItemMarginBottomXS??0,E=(0,n.useMemo)(()=>({marginBottom:_/2}),[_]);(0,n.useEffect)(()=>{if(!T){h("");return}h(jn(T)?"validating":"success")},[T]);const w=!!k&&!zr(k),v=w?"error":b;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:i,className:"mobile-background-image-field",validateStatus:v,help:w?f("Enter a URL starting with http:// or https://"):void 0,style:E,children:(0,o.jsx)(wn,{inheritedImage:d,validateStatus:v,placeholder:l,name:i,disabled:s,elementSettings:a,imageInfo:a,onRemotePreviewValidate:h})}),(0,o.jsx)(t.ui_kit$Switch,{label:f("Without image"),labelSize:"small",size:"small",checked:c,onChange:p})]})},In={image:"",positionX:"",positionY:"",repeat:"",size:""},Bt=({elementSettings:e,imageEnabled:i=!1,desktopBackground:l=In})=>{const{__:s}=r.useI18n(),{token:a}=(0,t.ui_kit$useToken)(),d=t.ui_kit$Form.useFormInstance(),c=a.formItemMarginBottomMD,p=r.useSendPostMessage(),f=e.mobileBackgroundImage?.[0]?.value,[x,k]=(0,n.useState)(f==="none"),b=t.ui_kit$Form.useWatch("mobileBackgroundImage",d);(0,n.useEffect)(()=>{k(f==="none")},[f]),(0,n.useEffect)(()=>{b&&k(!1)},[b]);const h=(0,n.useCallback)(C=>{k(C),d.setFieldsValue({mobileBackgroundImage:""}),p({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:ji("mobileBackgroundImage",C?"none":"")})},[e.type,d,p]),T=(0,n.useMemo)(()=>[{label:s("Not defined"),value:"none"},{label:s("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:s("Repeat background (repeat)"),value:"repeat"},{label:s("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:s("Repeat background vertically (repeat-y)"),value:"repeat-y"}],[s]),_=(0,n.useMemo)(()=>[{label:s("Not defined"),value:""},{label:s("Contain"),value:"contain"},{label:s("Cover"),value:"cover"}],[s]),E=_n(x?"none":b,l.image),w=(0,n.useMemo)(()=>({marginBottom:E?c:0}),[c,E]),v=(0,n.useMemo)(()=>(0,o.jsx)("div",{style:w,children:(0,o.jsx)(Wr,{form:d,elementSettings:e,label:s("Background color")})}),[s,e,d,w]),A=(0,n.useMemo)(()=>(0,o.jsx)("div",{style:w,children:(0,o.jsx)(vn,{form:d,placeholder:s("Background image"),elementSettings:e,inheritedImage:x?"":l.image,isImageNone:x,onImageNoneChange:h})}),[s,l.image,e,d,h,x,w]),j=(0,n.useMemo)(()=>(0,o.jsx)(Rn,{desktopPositionX:l.positionX,desktopPositionY:l.positionY,desktopRepeat:l.repeat,desktopSize:l.size,backgroundRepeatOptions:T,backgroundSizeOptions:_}),[T,_,l.positionX,l.positionY,l.repeat,l.size]);return(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{colorFieldName:"mobileBackgroundColor",colorSlot:v,imageEnabled:i,backgroundImageEmpty:!E,imageUploadSlot:A,imageControlsSlot:j,usedColors:e.usedColors})},Zr=({form:e,elementSettings:i,mobileBoxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:a,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:p,oneMobileBorderRadiusValue:f,setOneMobileBorderRadiusValue:x,toggleShowMobileBorderHandler:k,toggleShowMobileBorderRadiusHandler:b,toggleShowMobileBoxShadowHandler:h,toggleShowMobileSizeHandler:T,toggleShowMobileBackgroundHandler:_})=>{const{__:E}=r.useI18n(),{token:w}=(0,t.ui_kit$useToken)(),v=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(Uo,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,o.jsx)(t.ui_kit$FormSection,{title:E("Size"),collapsible:!0,open:c,onToggle:T,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:E("Table width"),placement:"left",children:(0,o.jsx)("div",{style:{marginBottom:w.formItemMarginBottomMD+4},children:(0,o.jsx)(zo,{form:e,name:"mobileWidth",elementSettings:i})})})})})}),(0,o.jsx)(t.ui_kit$FormSection,{title:E("Background"),collapsible:!0,open:p,onToggle:_,dividerTop:!0,children:(0,o.jsx)(Bt,{elementSettings:Go(i),imageEnabled:v.formTableFieldBackgroundImageEnabled,desktopBackground:xt(i)})}),v.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Borders"),collapsible:!0,open:s,onToggle:k,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),v.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Border radius"),collapsible:!0,open:a,onToggle:b,dividerTop:!0,children:(0,o.jsx)(So,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:f,setOneBorderRadiusValue:x,elementSettings:i})}),v.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Box shadow"),collapsible:!0,open:d,onToggle:h,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile",form:e,elementSettings:i})}),v.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})}),v.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};Zr.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,mobileBoxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func,toggleShowMobileBackgroundHandler:g.default.func};var el=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),a=Fo(),d=Fo(),c=r.useDispatch(),p=r.useElementEntityKind(),[f,x]=(0,n.useState)({}),[k,b]=(0,n.useState)(!0),[h,T]=(0,n.useState)({}),[_,E]=(0,n.useState)(!0),w=r.useSelector(r.selectEmailViewType),v=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[A,j]=(0,n.useState)(e.backgroundImage[0].value===""),C=r.useSelector(r.selectIsCodeMode),P=r.useSelector(r.selectCodeModeDirection),Y=C&&P!=="bottom",[z,$]=(0,n.useState)(!1),[O,y]=(0,n.useState)(!1),[oe,G]=(0,n.useState)(!1),[q,te]=(0,n.useState)(!1),[ue,me]=(0,n.useState)(!1),[se,_e]=(0,n.useState)(!1),[ve,de]=(0,n.useState)(!1),[De,ye]=(0,n.useState)(!1),[re,ke]=(0,n.useState)(!1),[ae,Q]=(0,n.useState)(!1),[be,pe]=(0,n.useState)(!1),ee=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],J=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}],U=I=>I&&(I?.width||I?.style||I?.color)?I:"",X=e.border,ce=e.mobileBorder,xe=Object.keys(X).find(I=>X[I]?.width||X[I]?.style||X[I]?.color),ne=Object.keys(ce).find(I=>ce[I]?.width||ce[I]?.style||ce[I]?.color),{remember:Ae,fillFields:we}=st(e);(0,n.useEffect)(()=>{if(e){const I=e.boxShadow,Z=e.mobileBoxShadow;x(I),T(Z),we(s,{...e,width:e.width?.value,widthDim:e.width?.dim,maxWidth:e.maxWidth?.value,maxWidthDim:e.maxWidth?.dim,minWidth:e.minWidth?.value,minWidthDim:e.minWidth?.dim,backgroundImage:e.backgroundImage[0].value,show:e.show?e.show:"all",borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),borderRadiusAll:u(e.borderRadius.all),borderRadiusTopLeft:u(e.borderRadius.topLeft),borderRadiusBottomLeft:u(e.borderRadius.bottomLeft),borderRadiusTopRight:u(e.borderRadius.topRight),borderRadiusBottomRight:u(e.borderRadius.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:po(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileAlign:e.mobileAlign?.value,mobileBorderAll:U(e.mobileBorder.all)||!(U(e.mobileBorder.top)||U(e.mobileBorder.bottom)||U(e.mobileBorder.right)||U(e.mobileBorder.left))&&U(e.border.all),mobileBorderTop:U(e.mobileBorder.top)||!U(e.mobileBorder.all)&&U(e.border.top),mobileBorderBottom:U(e.mobileBorder.bottom)||!U(e.mobileBorder.all)&&U(e.border.bottom),mobileBorderRight:U(e.mobileBorder.right)||!U(e.mobileBorder.all)&&U(e.border.right),mobileBorderLeft:U(e.mobileBorder.left)||!U(e.mobileBorder.all)&&U(e.border.left),mobileBorderRadiusAll:u(e.mobileBorderRadius.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius.topLeft!==null?e.mobileBorderRadius.topLeft:e.mobileBorderRadius.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius.bottomLeft!==null?e.mobileBorderRadius.bottomLeft:e.mobileBorderRadius.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius.topRight!==null?e.mobileBorderRadius.topRight:e.mobileBorderRadius.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius.bottomRight!==null?e.mobileBorderRadius.bottomRight:e.mobileBorderRadius.all),mobileBoxShadowInset:u(e.mobileBoxShadow?.inset)||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color),mobileBackgroundColor:u(e.mobileBackgroundColor?.value!=="none"?e.mobileBackgroundColor?.value:""),...nt(e),exportAsPicture:e?.exportAsPicture}),!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?b(!1):b(!0),u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight)?E(!1):E(!0),j(e.backgroundImage[0].value==="");const Be=a.isStaleBorderSnapshot(e,!!xe),Ce=d.isStaleBorderSnapshot(e,!!ne);Be&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Ce||Be&&!ne)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),$(Me=>xe&&!Be?!0:Me),y(Me=>xe&&!Be||ne&&!Ce?!0:Me),G(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),te(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),me(!!e.boxShadow),_e(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),de(!!e.width?.value||!!e.minWidth?.value||!!e.maxWidth?.value),ye(!!e.mobileWidth.value),ke(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Q(kt(e)),pe(!!e.exportAsPicture)}},[s,e,xe,ne,a,d,we]);const $e=(0,n.useCallback)(I=>{Ae(I),c(p==="email"?r.setElementSettings$1(I):r.setElementSettings(I))},[c,p,Ae]),K=I=>{const Z=s.getFieldsValue(!0),Be=Object.keys(I)[0];let Ce;switch(Be){case"exportAsPicture":Ce={exportAsPicture:Z.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Ce={boxShadow:{hOffset:Z.boxShadowHOffset,vOffset:Z.boxShadowVOffset,blurRadius:Z.boxShadowBlurRadius,spreadRadius:Z.boxShadowSpreadRadius,color:Z.boxShadowColor,inset:Z.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":Z.borderPosition==="borderAll"?(Ce={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...Z.borderAll}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):Z.borderAll?.width||Z.borderAll?.style||Z.borderAll?.color?(Ce={border:{all:null,left:Z.borderAll,right:Z.borderAll,top:Z.borderAll,bottom:Z.borderAll,[W.REVERSE_BORDER_POSITIONS[Be]]:{...Z[Be],...I[Be]}}},s.setFieldsValue({borderAll:null,borderLeft:Z.borderAll,borderRight:Z.borderAll,borderTop:Z.borderAll,borderBottom:Z.borderAll,[Be]:{...Z[Be],...I[Be]}})):(Ce={border:{all:null,left:Z.borderLeft,right:Z.borderRight,top:Z.borderTop,bottom:Z.borderBottom,[W.REVERSE_BORDER_POSITIONS[Be]]:{...Z[Be],...I[Be]}}},s.setFieldsValue({border:Ce.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(Z.mobileBorderPosition==="mobileBorderAll")Ce={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...Z.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[Be]+"-"}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const Me=W.MOBILE_REVERSE_BORDER_POSITIONS[Be],Ge={...Z[Be],...I[Be]},Ye=!Ge?.width&&!Ge?.style&&!Ge?.color;if(Z.mobileBorder?.all?.width||Z.mobileBorder?.all?.style||Z.mobileBorder?.all?.color){const D=Z.mobileBorderAll;Ce={mobileBorder:{all:null,left:D,right:D,top:D,bottom:D,[Me]:Ye?null:{...Ge,classNamePrefix:"em-mob-border_"+Me+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:D,mobileBorderRight:D,mobileBorderTop:D,mobileBorderBottom:D,[Be]:Ge})}else{const D=e.mobileBorder||{},L=R=>{const F=D[R];return F&&(F?.width||F?.style||F?.color)?F:null};Ce={mobileBorder:{all:null,left:Me==="left"?Ye?null:{...Ge,classNamePrefix:"em-mob-border_left-"}:L("left"),right:Me==="right"?Ye?null:{...Ge,classNamePrefix:"em-mob-border_right-"}:L("right"),top:Me==="top"?Ye?null:{...Ge,classNamePrefix:"em-mob-border_top-"}:L("top"),bottom:Me==="bottom"?Ye?null:{...Ge,classNamePrefix:"em-mob-border_bottom-"}:L("bottom")}},s.setFieldsValue({[Be]:Ge})}}break;case"width":Ce={[Be]:{value:I[Be],dim:Z.widthDim}};break;case"widthDim":Ce={width:{value:Z.width,dim:I[Be]}};break;case"maxWidth":Ce={[Be]:{value:I[Be],dim:Z.maxWidthDim}};break;case"maxWidthDim":Ce={maxWidth:{value:Z.maxWidth,dim:I[Be]}};break;case"minWidth":Ce={[Be]:{value:I[Be],dim:Z.minWidthDim}};break;case"minWidthDim":Ce={minWidth:{value:Z.minWidth,dim:I[Be]}};break;case"backgroundImage":j(I[Be]===""),Ce={[Be]:[{...e.backgroundImage[0],value:I[Be]}],backgroundSize:"cover"};break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Ce={borderRadius:{[W.BORDER_RADIUS_POSITION[Be]]:+I[Be]}};break;case"mobileWidth":Ce={[Be]:{classNamePrefix:"em-mob-width-",value:I[Be],dim:Z.mobileWidthDim}};break;case"mobileWidthDim":Ce={mobileWidth:{classNamePrefix:"em-mob-width-",value:Z.mobileWidth||100,dim:I[Be]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Ce={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[Be]]:I[Be],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[Be]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Ce={mobileBoxShadow:{hOffset:Z.mobileBoxShadowHOffset,vOffset:Z.mobileBoxShadowVOffset,blurRadius:Z.mobileBoxShadowBlurRadius,spreadRadius:Z.mobileBoxShadowSpreadRadius,color:Z.mobileBoxShadowColor,inset:Z.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Ce=_t(I),!Ce)return;break;case"mobileAlign":Ce={[Be]:{classNamePrefix:"em-mob-table_align-",value:I[Be]}};break;default:Ce=I}Be!=="borderPosition"&&Be!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ce}),Be!=="mobileBorderRadiusAll"&&Be!=="mobileBorderRadiusTopLeft"&&Be!=="mobileBorderRadiusTopRight"&&Be!=="mobileBorderRadiusBottomLeft"&&Be!=="mobileBorderRadiusBottomRight"&&$e({...e,...Ce,mobileBorderRadius:{...e.mobileBorderRadius,...Ce?.mobileBorderRadius},activateSection:null,changeKey:Be}))},ie=()=>{const I=s.getFieldsValue(!0);a.markBorderToggled(!z),setTimeout(()=>{$(Z=>!Z),z?(I.borderAll=W.NULL_BORDER,I.borderTop=W.NULL_BORDER,I.borderBottom=W.NULL_BORDER,I.borderRight=W.NULL_BORDER,I.borderLeft=W.NULL_BORDER):I.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:I.borderAll.color,style:I.borderAll.style,width:I.borderAll.width}}}})})},je=()=>{const I=s.getFieldsValue(!0);d.markBorderToggled(!O),setTimeout(()=>{y(Z=>!Z),O?(I.mobileBorderAll=W.NULL_BORDER,I.mobileBorderTop=W.NULL_BORDER,I.mobileBorderBottom=W.NULL_BORDER,I.mobileBorderRight=W.NULL_BORDER,I.mobileBorderLeft=W.NULL_BORDER):I.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:I.mobileBorderAll.color,style:I.mobileBorderAll.style,width:I.mobileBorderAll.width}}}})})},V=()=>{const I=s.getFieldsValue(!0);setTimeout(()=>{G(Z=>!Z),oe?(I.borderRadiusAll=0,b(!0)):I.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:I.borderRadiusAll}}})})},Se=()=>{const I=s.getFieldsValue(!0);setTimeout(()=>{te(Z=>!Z),q?(I.mobileBorderRadiusAll=null,E(!0)):I.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:I.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},Ie=()=>{const I=s.getFieldsValue(!0);setTimeout(()=>{me(Z=>!Z),ue?(I.boxShadowInset=!1,I.boxShadowHOffset=null,I.boxShadowVOffset=null,I.boxShadowBlurRadius=null,I.boxShadowSpreadRadius=null,I.boxShadowColor=""):(I.boxShadowInset=!1,I.boxShadowHOffset=5,I.boxShadowVOffset=5,I.boxShadowBlurRadius=10,I.boxShadowSpreadRadius=-5,I.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:I.boxShadowBlurRadius,color:I.boxShadowColor,hOffset:I.boxShadowHOffset,inset:I.boxShadowInset,spreadRadius:I.boxShadowSpreadRadius,vOffset:I.boxShadowVOffset}}})})},Ne=()=>{const I=s.getFieldsValue(!0);setTimeout(()=>{_e(Z=>!Z),se?(I.mobileBoxShadowInset=!1,I.mobileBoxShadowHOffset=null,I.mobileBoxShadowVOffset=null,I.mobileBoxShadowBlurRadius=null,I.mobileBoxShadowSpreadRadius=null,I.mobileBoxShadowColor=""):(I.mobileBoxShadowInset=!1,I.mobileBoxShadowHOffset=5,I.mobileBoxShadowVOffset=5,I.mobileBoxShadowBlurRadius=10,I.mobileBoxShadowSpreadRadius=-5,I.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:I.mobileBoxShadowBlurRadius,color:I.mobileBoxShadowColor,hOffset:I.mobileBoxShadowHOffset,inset:I.mobileBoxShadowInset,spreadRadius:I.mobileBoxShadowSpreadRadius,vOffset:I.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Fe=()=>{const I=s.getFieldsValue(!0);setTimeout(()=>{de(Z=>!Z),ve&&(I.width="",I.minWidth="",I.maxWidth="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{width:{value:null,dim:"px"},minWidth:{value:null,dim:"px"},maxWidth:{value:null,dim:"px"}}}))})},Ve=()=>{const I=s.getFieldsValue(!0);setTimeout(()=>{ye(Z=>!Z),De&&(I.mobileWidth="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"}}}))})},Ue=()=>{const I=s.getFieldsValue(!0);setTimeout(()=>{ke(Z=>!Z),re?(I.backgroundColor="",I.backgroundImage="",I.backgroundPositionX="",I.backgroundPositionY="",I.backgroundRepeat="none",I.backgroundSize="",j(!0)):(I.backgroundColor="#E5E5E5",I.backgroundSize="",I.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:I.backgroundColor,backgroundImage:[{type:"url",value:I.backgroundImage}],backgroundPositionX:I.backgroundPositionX,backgroundPositionY:I.backgroundPositionY,backgroundRepeat:I.backgroundRepeat,backgroundSize:I.backgroundSize}})})},le=()=>{const I=s.getFieldsValue(!0);setTimeout(()=>{Q(Z=>!Z),ae?I.mobileBackgroundColor="":I.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:I.mobileBackgroundColor}}}),ae&&Et(s,e,l)})},Te=()=>{const I=s.getFieldsValue(!0);setTimeout(()=>{pe(Z=>!Z),be&&(I.exportAsPicture=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_table_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,show:"all",width:{value:"",dim:""},maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",mobileAlign:"",border:"",boxShadow:"",borderPosition:W.BORDER_POSITIONS[xe]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[ne]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileBackgroundColor:"",mobileBackgroundImage:""},onValuesChange:K,autoComplete:"off",className:"element-controls",children:[!Y&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),w==="mobile"&&v.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(Zr,{form:s,elementSettings:e,mobileBoxShadow:h,mobileBordersShow:O,mobileBorderRadiusShow:q,mobileBoxShadowShow:se,mobileSizeShow:De,mobileBackgroundShow:ae,oneMobileBorderRadiusValue:_,setOneMobileBorderRadiusValue:E,toggleShowMobileBorderHandler:je,toggleShowMobileBorderRadiusHandler:Se,toggleShowMobileBoxShadowHandler:Ne,toggleShowMobileSizeHandler:Ve,toggleShowMobileBackgroundHandler:le})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Ur,{form:s,elementSettings:e,boxShadow:f,bordersShow:z,borderRadiusShow:oe,boxShadowShow:ue,backgroundShow:re,backgroundImageEmpty:A,backgroundRepeatOptions:ee,backgroundSizeOptions:J,sizeShow:ve,modificationShow:be,oneBorderRadiusValue:k,setOneBorderRadiusValue:b,toggleShowBorderHandler:ie,toggleShowBorderRadiusHandler:V,toggleShowBoxShadowHandler:Ie,toggleShowSizeHandler:Fe,toggleShowBackgroundHandler:Ue,toggleShowModificationHandler:Te})})]})};el.propTypes={elementSettings:g.default.object.isRequired};var ol=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),a=r.useAppConfig(),d=r.useSelector(r.selectIsCodeMode),c=r.useSelector(r.selectCodeModeDirection),[p,f]=(0,n.useState)({}),[x,k]=(0,n.useState)("https://"),b=({target:_})=>{const{selectionStart:E,selectionEnd:w}=_;_&&f({target:_,selection:{start:E,end:w}})};(0,n.useEffect)(()=>{if(e){let _="",E="",w=e.href==null?"https://":e.href;if(w&&w.substring(0,7)==="mailto:"){const v=new URL(e.href);_=v.searchParams.get("subject")||"",E=v.searchParams.get("body")||"",w=e.href.split("?")[0],k("mailto:")}else e.href&&(e.href.substring(0,8)==="https://"||e.href.substring(0,7)==="http://"?k("https://"):e.href.substring(0,4)==="tel:"?k("tel:"):e.href.substring(0,4)==="sms:"?k("sms:"):e.href.substring(0,6)==="ftp://"?k("ftp://"):k(""));s.setFieldsValue({...e,href:w,subject:_,body:E})}},[s,e]);const h=_=>{const E=Object.keys(_)[0];let w=_;if(E==="href"){const v=ot(_[E]);if(v!==_[E]&&s.setFieldValue("href",v),v.substring(0,7)==="mailto:"){const A=s.getFieldValue("subject"),j=s.getFieldValue("body"),C=[];A&&C.push(`subject=${encodeURIComponent(A)}`),j&&C.push(`body=${encodeURIComponent(j)}`),w={href:C.length>0?`${v}?${C.join("&")}`:v}}else w={href:v}}if(E==="subject"||E==="body"){const v=s.getFieldValue("href")||"";if(v.substring(0,7)==="mailto:"){const A=v.split("?")[0],j=E==="subject"?_[E]:s.getFieldValue("subject"),C=E==="body"?_[E]:s.getFieldValue("body"),P=[];j&&P.push(`subject=${encodeURIComponent(j)}`),C&&P.push(`body=${encodeURIComponent(C)}`),w={href:P.length>0?`${A}?${P.join("&")}`:A}}else return}l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:w})},T=_=>{l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:_})};return(0,o.jsx)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_link_form",initialValues:{href:"https://",target:"",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1,textReplacer:"",subject:"",body:""},onValuesChange:h,autoComplete:"off",className:"element-controls",children:!d||c==="bottom"?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Hyperlink URL"),placement:"left",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:24,paddingRight:10},children:(0,o.jsx)(t.ui_kit$Input,{allowClear:!0,placeholder:i("Hyperlink URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined}),onSelect:b})})}),a.formLinkFieldInsertImageEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:i("Actions with the chosen text"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$Form.Item,{children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"PicLeftOutlined",component:t.icons$PicLeftOutlined}),onClick:()=>T("add_img"),children:i("Add inline image")})})}),(0,o.jsx)(gt,{form:s,elementSettings:e,showAddParagraph:!1,linkTarget:p,linkProtocol:x,setLinkProtocol:k})]}):(0,o.jsx)(Ri,{form:s,elementSettings:e,showAddParagraph:!1})})};ol.propTypes={elementSettings:g.default.object.isRequired};var tl=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:14,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"height",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:e("Indent height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})})};tl.propTypes={};var il=({form:e,elementSettings:i})=>(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{marginBottom:20},children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(tt,{form:e,name:"mobileHeight",elementSettings:i})})});il.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired};var rl=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm(),s=r.useDispatch(),a=r.useSendPostMessage(),d=r.useSelector(r.selectEmailViewType),c=r.useSelector(r.selectMobileViewActive),p=r.useSelector(r.selectIsCodeMode),f=r.useSelector(r.selectCodeModeDirection),x=p&&f!=="bottom",k=r.useElementEntityKind(),{remember:b,fillFields:h}=st(e);(0,n.useEffect)(()=>{e&&h(l,{...e,height:e.height?.value,heightDim:e.height?.dim,mobileHeight:po(e.mobileHeight?.value||e.height?.value),mobileHeightDim:e.mobileHeight?.dim||e.height?.dim})},[l,e,h]);const T=(0,n.useCallback)(E=>{b(E),s(k==="email"?r.setElementSettings$1(E):r.setElementSettings(E))},[s,k,b]),_=E=>{const w=l.getFieldsValue(!0),v=Object.keys(E)[0];let A;switch(v){case"height":A={[v]:{value:E[v],dim:w.heightDim}};break;case"heightDim":A={height:{value:w.height,dim:E[v]}};break;case"mobileHeight":A={[v]:{classNamePrefix:"em-mob-height-",value:E[v],dim:w.mobileHeightDim}};break;case"mobileHeightDim":A={mobileHeight:{classNamePrefix:"em-mob-height-",value:w.mobileHeight,dim:E[v]}};break;default:A=E}a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:A}),T({...e,...A,activateSection:null,changeKey:v})};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_vindent_form",initialValues:{height:"",heightDim:"",mobileHeight:"",mobileHeightDim:""},onValuesChange:_,autoComplete:"off",children:[!x&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),d==="mobile"&&c.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:d==="mobile"&&c.styles?"block":"none",marginBottom:10},children:(0,o.jsx)(il,{form:l,elementSettings:e})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",style:{display:d==="mobile"&&c.styles?"none":"block"},children:(0,o.jsx)(tl,{})})]})};rl.propTypes={elementSettings:g.default.object.isRequired};var Ht=({form:e,elementSettings:i,typeOfForm:l="desktop"})=>{const s=r.useSendPostMessage(),a=l==="mobile",d=a?"mobileDirection":"direction",c=f=>{e.setFieldsValue({[d]:f}),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[d]:f}})},p=a?i.mobileDirection?.value??"":i.direction??"";return(0,o.jsx)(t.ui_kit$Form.Item,{name:d,className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$FormDirectionControl,{value:p,onChange:c})})},Ut=e=>e.closest(".email-pane__collapse-wrapper")||e.parentNode,vi=({form:e,backgroundImageEmpty:i,appConfig:l,token:s,elementSettings:a,backgroundRepeatOptions:d,handleChangeValues:c})=>{const{__:p}=r.useI18n(),[f,x]=(0,n.useState)(""),[k,b]=(0,n.useState)("px"),[h,T]=(0,n.useState)(""),[_,E]=(0,n.useState)("px"),w=[{label:p("Not defined"),value:""},{label:p("Contain"),value:"contain"},{label:p("Cover"),value:"cover"}],v=C=>{if(!C||typeof C!="string")return{value:"",unit:"px"};C=C.trim();const P=C.match(/^(\d*\.?\d+)(%|px)$/);return P?{value:P[1],unit:P[2]}:{value:C,unit:"px"}};(0,n.useEffect)(()=>{const C=e.getFieldValue("backgroundPositionX"),P=e.getFieldValue("backgroundPositionY"),Y=v(C),z=v(P);x(String(Y.value)),b(Y.unit),T(String(z.value)),E(z.unit)},[e]);const A=(C,P)=>{x(String(C)),b(P),c&&c({backgroundPositionX:{position:C,unit:P}})},j=(C,P)=>{T(String(C)),E(P),c&&c({backgroundPositionY:{position:C,unit:P}})};return(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:8},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:p("Background color"),placement:"bottom",getPopupContainer:Ut,children:(0,o.jsx)("div",{children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"backgroundColor",style:{marginBottom:s.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:p("Background color"),usedColors:a.usedColors,placement:"bottomLeft"})})})})}),l.formCellFieldBackgroundImageEnabled&&(0,o.jsxs)(t.ui_kit$Col,{span:i?12:24,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:p("Background image"),placement:"bottom",getPopupContainer:Ut,children:(0,o.jsx)("div",{children:(0,o.jsx)(No,{form:e,label:p("Background image"),name:"backgroundImage",tooltipTitle:p("Background image"),placeholder:p("Background image link/route")})})}),!i&&(0,o.jsxs)(t.ui_kit$Form.Item,{style:{marginBottom:"0"},children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:s.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$InputSelect,{options:Vt.horizontal,position:f,setPosition:C=>A(C,k),unit:k,setUnit:C=>A(f,C),placeholder:p("Horizontal position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal}),dropdownStyle:{bottom:"auto"},tooltipTitle:p("Horizontal position"),getTooltipPopupContainer:Ut})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$InputSelect,{options:Vt.vertical,position:h,setPosition:C=>j(C,_),unit:_,setUnit:C=>j(h,C),placeholder:p("Vertical position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical}),dropdownStyle:{bottom:"auto"},tooltipTitle:p("Vertical position"),getTooltipPopupContainer:Ut})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:p("Background image repeat"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"backgroundRepeat",style:{marginBottom:s.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{placeholder:p("Please choose"),options:d,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:p("Background image size"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"backgroundSize",style:{marginBottom:s.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{placeholder:p("Please choose"),options:w,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})})]})]})]})]})},Cn=({form:e,elementSettings:i,__:l,appConfig:s})=>{const a=W.useGoogleFontsLoader(),[d,c]=(0,n.useState)(null);return(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&c(!0)},[]),(0,o.jsxs)("div",{style:{marginBottom:"-15px"},children:[s.formTextFieldTypografEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Text font"),placement:"bottom",zIndex:1,getPopupContainer:p=>p.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:a,getPopupContainer:p=>p.closest(".email-pane__collapse-wrapper")})})}),!i.showOnMobile&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:l("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:l("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:l(d?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:l(d?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:l(d?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:l(d?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Text color"),placement:"bottom",zIndex:2,getPopupContainer:p=>p.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:l("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l("Color"),usedColors:i.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Text background"),placement:"bottom",zIndex:2,getPopupContainer:p=>p.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:l("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l("Background color"),usedColors:i.usedColors})})})})]})]})},ll=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:a,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:p,backgroundRepeatOptions:f,sizeShow:x,maxWidthValue:k,modificationShow:b,paddingsExt:h,oneBorderRadiusValue:T,setOneBorderRadiusValue:_,elementListShow:E,togglePaddingHandler:w,toggleShowBorderHandler:v,toggleShowBorderRadiusHandler:A,toggleShowBoxShadowHandler:j,toggleShowSizeHandler:C,toggleShowBackgroundHandler:P,toggleShowModificationHandler:Y,handleChangeValues:z})=>{const{__:$}=r.useI18n(),{token:O}=(0,t.ui_kit$useToken)(),y=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(it,{form:e,elementSettings:i})}),y.formCellFieldVerticalAlignEnabled&&i.type!=="group"&&(i.type!=="structure"||i.type==="structure"&&i.floatBlocks.items.length===1)&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Mo,{form:e,elementSettings:i})})]}),y.formCellFieldPaddingsEnabled&&(0,o.jsxs)(o.Fragment,{children:[E&&(0,o.jsx)("div",{style:{marginTop:"15px"},children:(0,o.jsx)(Cn,{form:e,elementSettings:i,appConfig:y,__:$})}),(0,o.jsx)(t.ui_kit$FormSection,{title:$("Padding"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:h,onToggleExtended:w,showHorizontal:i.type!=="group"&&i.type!=="column",rowStyle:{paddingBottom:4},labels:{horizontal:$("Horizontal padding"),vertical:$("Vertical padding"),left:$("Left padding"),right:$("Right padding"),top:$("Top padding"),bottom:$("Bottom padding"),individual:$("Individual padding")}})})]}),i.type!=="group"&&y.formCellFieldSizeEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Size"),collapsible:!0,open:x,onToggle:C,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{showWidth:i.type!=="structure"&&i.type!=="column",maxWidth:k,dimensionSelect:$o,rowStyle:{paddingBottom:4},labels:{width:$("Width"),height:$("Height"),minWidth:$("Minimum width"),maxWidth:$("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:$("Background"),collapsible:!0,open:c,onToggle:P,dividerTop:!0,children:[(0,o.jsx)(vi,{form:e,backgroundImageEmpty:p,appConfig:y,token:O,elementSettings:i,backgroundRepeatOptions:f,handleChangeValues:z}),(0,o.jsx)(rt,{form:e,showBackground:!0})]}),y.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Borders"),collapsible:!0,open:s,onToggle:v,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),y.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Border radius"),collapsible:!0,open:a,onToggle:A,dividerTop:!0,children:(0,o.jsx)(So,{form:e,oneBorderRadiusValue:T,setOneBorderRadiusValue:_,elementSettings:i})}),y.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Box shadow"),collapsible:!0,open:d,onToggle:j,dividerTop:!0,children:(0,o.jsx)(jo,{})}),y.formFieldExportAsPictureEnabled&&i.type!=="group"&&(0,o.jsxs)(t.ui_kit$FormSection,{title:$("Settings"),collapsible:!0,open:b,onToggle:Y,dividerTop:!0,children:[i.type==="structure"&&(0,o.jsx)(t.ui_kit$Tooltip,{title:$("The block will change its colors to contrasting colors. You can change them in the Content Styles section."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"isContrastBlock",valuePropName:"checked",style:{marginBottom:0},children:(0,o.jsx)(t.ui_kit$Switch,{id:"contrast-colors",label:$("Contrast block"),size:"small",labelStyle:{position:"relative",top:2}})})},"isContrastBlock"),(0,o.jsx)(yi,{form:e,elementSettings:i})]}),y.formFieldVisibilityEnabled&&i.type!=="column"&&(0,o.jsx)(t.ui_kit$FormSection,{title:$(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,o.jsx)(Ht,{elementSettings:i,form:e}):void 0})}),y.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};ll.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,backgroundShow:g.default.bool,backgroundImageEmpty:g.default.bool,backgroundRepeatOptions:g.default.array,sizeShow:g.default.bool,maxWidthValue:g.default.oneOfType([g.default.string,g.default.number]),modificationShow:g.default.bool,paddingsExt:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,elementListShow:g.default.bool,togglePaddingHandler:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func,toggleShowSizeHandler:g.default.func,toggleShowBackgroundHandler:g.default.func,toggleShowModificationHandler:g.default.func,handleChangeValues:g.default.func};var Wt=({form:e,elementSettings:i,mobilePaddingsExt:l,setMobilePaddingsExt:s,rowStyle:a})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),p=()=>{s(x=>!x);const f=e.getFieldsValue(!0);l||(f.mobilePaddingLeftRight=f.mobilePaddingLeft,f.mobilePaddingTopBottom=f.mobilePaddingTop,f.mobilePaddingRight=f.mobilePaddingLeft,f.mobilePaddingBottom=f.mobilePaddingTop,c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobilePadding:{top:f.mobilePaddingTop!==""?f.mobilePaddingTop:null,bottom:f.mobilePaddingTopBottom!==""?f.mobilePaddingTopBottom:null,left:f.mobilePaddingLeft!==""?f.mobilePaddingLeft:null,right:f.mobilePaddingRight!==""?f.mobilePaddingRight:null,classNamePrefix:"em-mob-padding_"}}}))};return(0,o.jsx)(t.ui_kit$FormPaddingInputs,{typeOfForm:"mobile",extended:l,onToggleExtended:p,showHorizontal:!0,gutter:10,rowStyle:a,labels:{horizontal:d("Horizontal padding"),vertical:d("Vertical padding"),left:d("Left padding"),right:d("Right padding"),top:d("Top padding"),bottom:d("Bottom padding"),individual:d("Individual padding")}})};Wt.propTypes={form:g.default.shape({getFieldsValue:g.default.func.isRequired}).isRequired,elementSettings:g.default.object.isRequired,mobilePaddingsExt:g.default.bool.isRequired,setMobilePaddingsExt:g.default.func.isRequired,rowStyle:g.default.object};var sl=({form:e,elementSettings:i,boxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:a,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:p,mobilePaddingShow:f,mobilePaddingsExt:x,setMobilePaddingsExt:k,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:h,toggleShowMobileBorderHandler:T,toggleShowMobileBorderRadiusHandler:_,toggleShowMobileBoxShadowHandler:E,toggleShowMobileSizeHandler:w,toggleShowMobileBackgroundHandler:v,toggleShowMobilePaddingHandler:A})=>{const{__:j}=r.useI18n(),C=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Uo,{form:e,elementSettings:i,imgParent:!0,typeOfForm:"mobile"})}),C.formCellFieldVerticalAlignEnabled&&i.type!=="group"&&(i.type!=="structure"||i.type==="structure"&&i.floatBlocks.items.length===1)&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Mo,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),C.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Padding"),collapsible:!0,open:f,onToggle:A,dividerTop:!0,children:(0,o.jsx)(Wt,{form:e,elementSettings:i,mobilePaddingsExt:x,setMobilePaddingsExt:k,rowStyle:{paddingBottom:4}})}),i.type!=="group"&&C.formCellFieldSizeEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Size"),collapsible:!0,open:c,onToggle:w,dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:9},children:[i.type!=="structure"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:15},children:(0,o.jsx)(zo,{form:e,name:"mobileWidth",elementSettings:i})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:15},children:(0,o.jsx)(tt,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:j("Background"),collapsible:!0,open:p,onToggle:v,dividerTop:!0,children:(0,o.jsx)(Bt,{elementSettings:Go(i),imageEnabled:C.formCellFieldBackgroundImageEnabled,desktopBackground:xt(i)})}),C.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Borders"),collapsible:!0,open:s,onToggle:T,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),C.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Border radius"),collapsible:!0,open:a,onToggle:_,dividerTop:!0,children:(0,o.jsx)(So,{form:e,oneBorderRadiusValue:b,setOneBorderRadiusValue:h,elementSettings:i,typeOfForm:"mobile"})}),C.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Box shadow"),collapsible:!0,open:d,onToggle:E,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile"})}),C.formFieldVisibilityEnabled&&i.type!=="column"&&(0,o.jsx)(t.ui_kit$FormSection,{title:j(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,o.jsx)(Ht,{elementSettings:i,form:e,typeOfForm:"mobile"}):void 0})}),C.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};sl.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,mobilePaddingShow:g.default.bool,mobilePaddingsExt:g.default.bool,setMobilePaddingsExt:g.default.func,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func,toggleShowMobileBackgroundHandler:g.default.func,toggleShowMobilePaddingHandler:g.default.func};var al=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),s=r.useDispatch(),[a]=t.ui_kit$Form.useForm(),d=Fo(),c=Fo(),[p,f]=(0,n.useState)(""),[x,k]=(0,n.useState)({}),[b,h]=(0,n.useState)(!0),[T,_]=(0,n.useState)(!0),E=r.useSelector(r.selectEmailViewType),w=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[v,A]=(0,n.useState)(e.backgroundImage[0].value===""),j=r.useSelector(r.selectIsCodeMode),C=r.useSelector(r.selectCodeModeDirection),P=j&&C!=="bottom",[Y,z]=(0,n.useState)(!1),[$,O]=(0,n.useState)(!1),[y,oe]=(0,n.useState)(!1),[G,q]=(0,n.useState)(!1),[te,ue]=(0,n.useState)(!1),[me,se]=(0,n.useState)(!1),[_e,ve]=(0,n.useState)(!1),[de,De]=(0,n.useState)(!1),[ye,re]=(0,n.useState)(!1),[ke,ae]=(0,n.useState)(!1),[Q,be]=(0,n.useState)(!1),[pe,ee]=(0,n.useState)(!1),[J,U]=(0,n.useState)(!1),[X,ce]=(0,n.useState)(!1),[xe,ne]=(0,n.useState)(!1),Ae=r.useElementEntityKind(),we=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],$e=e.border,K=e.mobileBorder,ie=Object.keys($e).find(R=>$e[R]?.width||$e[R]?.style||$e[R]?.color),je=Object.keys(K).find(R=>K[R]?.width||K[R]?.style||K[R]?.color),V=R=>R&&(R?.width||R?.style||R?.color)?R:"",{remember:Se,fillFields:Ie}=st(e);(0,n.useEffect)(()=>{if(e){const R=e.boxShadow;k(R),Ie(a,{...e,width:e.width?.value,widthDim:e.width?.dim,height:e.height?.value,heightDim:e.height?.dim,backgroundImage:e.backgroundImage[0].value,show:e.show?e.show:"all",isContrastBlock:e.isContrastBlock,borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),mobileBorderAll:V(e.mobileBorder.all)||!(V(e.mobileBorder.top)||V(e.mobileBorder.bottom)||V(e.mobileBorder.right)||V(e.mobileBorder.left))&&V(e.border.all),mobileBorderTop:V(e.mobileBorder.top)||!V(e.mobileBorder.all)&&V(e.border.top),mobileBorderBottom:V(e.mobileBorder.bottom)||!V(e.mobileBorder.all)&&V(e.border.bottom),mobileBorderRight:V(e.mobileBorder.right)||!V(e.mobileBorder.all)&&V(e.border.right),mobileBorderLeft:V(e.mobileBorder.left)||!V(e.mobileBorder.all)&&V(e.border.left),paddingTop:u(e.padding?.all)||u(e.padding?.top),paddingLeft:u(e.padding?.all)||u(e.padding?.left),paddingRight:u(e.padding?.all)||u(e.padding?.right),paddingBottom:u(e.padding?.all)||u(e.padding?.bottom),paddingLeftRight:u(e.padding?.left)||u(e.padding?.right),paddingTopBottom:u(e.padding?.top)||u(e.padding?.bottom),borderRadiusAll:u(e.borderRadius.all),borderRadiusTopLeft:u(e.borderRadius.topLeft),borderRadiusBottomLeft:u(e.borderRadius.bottomLeft),borderRadiusTopRight:u(e.borderRadius.topRight),borderRadiusBottomRight:u(e.borderRadius.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:po(e.mobileWidth?.value)||po(e.width?.value),mobileWidthDim:po(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:po(e.mobileHeight?.value)||po(e.height?.value),mobileHeightDim:po(e.mobileHeight?.value)?e.mobileHeight?.dim:e.height?.dim,mobileBorderRadiusAll:u(e.mobileBorderRadius?.all)||u(e.borderRadius?.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius?.topLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topLeft)||u(e.borderRadius?.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius?.bottomLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomLeft)||u(e.borderRadius?.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius?.topRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topRight)||u(e.borderRadius?.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius?.bottomRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomRight)||u(e.borderRadius?.all),mobileBoxShadowInset:e.mobileBoxShadow?.inset!=null?e.mobileBoxShadow.inset:e.boxShadow?.inset||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset)||u(e.boxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset)||u(e.boxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius)||u(e.boxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius)||u(e.boxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color)||u(e.boxShadow?.color),mobileAlign:u(e.mobileAlign?.value)||e.align,mobileVerticalAlign:u(e.mobileVerticalAlign?.value||e.valign),mobileDirection:u(e.mobileDirection?.value),mobileBackgroundColor:u(e.mobileBackgroundColor?.value||e.backgroundColor||""),...nt(e),mobilePaddingTop:u(e.mobilePadding.all)||u(e.mobilePadding.top)||u(e.padding?.all)||u(e.padding?.top),mobilePaddingLeft:u(e.mobilePadding.all)||u(e.mobilePadding.left)||u(e.padding?.all)||u(e.padding?.left),mobilePaddingRight:u(e.mobilePadding.all)||u(e.mobilePadding.right)||u(e.padding?.all)||u(e.padding?.right),mobilePaddingBottom:u(e.mobilePadding.all)||u(e.mobilePadding.bottom)||u(e.padding?.all)||u(e.padding?.bottom),mobilePaddingTopBottom:u(e.mobilePadding.top)||u(e.mobilePadding.bottom)||u(e.padding?.top)||u(e.padding?.bottom),mobilePaddingLeftRight:u(e.mobilePadding.left)||u(e.mobilePadding.right)||u(e.padding?.left)||u(e.padding?.right),exportAsPicture:e?.exportAsPicture}),!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?h(!1):h(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||!u(e.borderRadius.all)&&!u(e.mobileBorderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?_(!1):_(!0),A(e.backgroundImage[0].value===""),!u(e.padding.all)&&(u(e.padding.top)||u(e.padding.right)||u(e.padding.bottom)||u(e.padding.left))&&(e.padding.top!==e.padding.bottom||e.padding.right!==e.padding.left)?z(!1):z(!0),!u(e.mobilePadding.all)&&(u(e.mobilePadding.top)||u(e.mobilePadding.right)||u(e.mobilePadding.bottom)||u(e.mobilePadding.left))&&(e.mobilePadding.top!==e.mobilePadding.bottom||e.mobilePadding.right!==e.mobilePadding.left)||!u(e.padding?.all)&&(u(e.padding?.top)||u(e.padding?.right)||u(e.padding?.bottom)||u(e.padding?.left))&&(e.padding?.top!==e.padding?.bottom||e.padding?.right!==e.padding?.left)?O(!1):O(!0);const F=d.isStaleBorderSnapshot(e,!!ie),he=c.isStaleBorderSnapshot(e,!!je);F&&a.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(he||F&&!je)&&a.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),oe(Le=>ie&&!F?!0:Le),q(Le=>ie&&!F||je&&!he?!0:Le),ue(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),se(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight||!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),ve(!!e.boxShadow),De(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),re(!!e.width.value&&e.type!=="column"||!!e.height.value),ae(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value&&e.type!=="column"||!!e.height.value),be(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),ee(!!e.mobileBackgroundColor.value||!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),kt(e)&&ee(!0),U(!!e.exportAsPicture||!!e.isContrastBlock),ce(!!e.mobilePadding.all||e.mobilePadding.all===0||!!e.mobilePadding.top||e.mobilePadding.top===0||!!e.mobilePadding.bottom||e.mobilePadding.bottom===0||!!e.mobilePadding.left||e.mobilePadding.left===0||!!e.mobilePadding.right||e.mobilePadding.right===0||!!e.padding.all||e.padding.all===0||!!e.padding.top||e.padding.top===0||!!e.padding.bottom||e.padding.bottom===0||!!e.padding.left||e.padding.left===0||!!e.padding.right||e.padding.right===0),e.elementName==="List"?ne(!0):ne(!1)}},[a,e,ie,je,d,c,Ie]);const Ne=(0,n.useCallback)(R=>{Se(R),s(Ae==="email"?r.setElementSettings$1(R):r.setElementSettings(R))},[s,Ae,Se]),Fe=R=>{const F=a.getFieldsValue(!0),he=Object.keys(R)[0];let Le;switch(f(a.getFieldsValue(!0).widthDim==="%"?100:""),he){case"exportAsPicture":Le={exportAsPicture:F.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Le={boxShadow:{hOffset:F.boxShadowHOffset,vOffset:F.boxShadowVOffset,blurRadius:F.boxShadowBlurRadius,spreadRadius:F.boxShadowSpreadRadius,color:F.boxShadowColor,inset:F.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":F.borderPosition==="borderAll"?(Le={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...F.borderAll}}},a.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):F.borderAll?.width||F.borderAll?.style||F.borderAll?.color?(Le={border:{all:null,left:F.borderAll,right:F.borderAll,top:F.borderAll,bottom:F.borderAll,[W.REVERSE_BORDER_POSITIONS[he]]:{...F[he],...R[he]}}},a.setFieldsValue({borderAll:null,borderLeft:F.borderAll,borderRight:F.borderAll,borderTop:F.borderAll,borderBottom:F.borderAll,[he]:{...F[he],...R[he]}})):(Le={border:{all:null,left:F.borderLeft,right:F.borderRight,top:F.borderTop,bottom:F.borderBottom,[W.REVERSE_BORDER_POSITIONS[he]]:{...F[he],...R[he]}}},a.setFieldsValue({border:Le.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(F.mobileBorderPosition==="mobileBorderAll")Le={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...F.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[he]+"-"}}},a.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const eo=W.MOBILE_REVERSE_BORDER_POSITIONS[he],Xe={...F[he],...R[he]},lo=!Xe?.width&&!Xe?.style&&!Xe?.color;if(F.mobileBorder?.all?.width||F.mobileBorder?.all?.style||F.mobileBorder?.all?.color){const Qe=F.mobileBorderAll;Le={mobileBorder:{all:null,left:Qe,right:Qe,top:Qe,bottom:Qe,[eo]:lo?null:{...Xe,classNamePrefix:"em-mob-border_"+eo+"-"}}},a.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:Qe,mobileBorderRight:Qe,mobileBorderTop:Qe,mobileBorderBottom:Qe,[he]:Xe})}else{const Qe=e.mobileBorder||{},uo=Eo=>{const B=Qe[Eo];return B&&(B?.width||B?.style||B?.color)?B:null};Le={mobileBorder:{all:null,left:eo==="left"?lo?null:{...Xe,classNamePrefix:"em-mob-border_left-"}:uo("left"),right:eo==="right"?lo?null:{...Xe,classNamePrefix:"em-mob-border_right-"}:uo("right"),top:eo==="top"?lo?null:{...Xe,classNamePrefix:"em-mob-border_top-"}:uo("top"),bottom:eo==="bottom"?lo?null:{...Xe,classNamePrefix:"em-mob-border_bottom-"}:uo("bottom")}},a.setFieldsValue({[he]:Xe})}}break;case"width":Le={[he]:{value:R[he],dim:F.widthDim}};break;case"height":Le={[he]:{value:R[he],dim:F.heightDim}};break;case"widthDim":Le={width:{value:F.width,dim:R[he]}};break;case"heightDim":Le={height:{value:F.height,dim:R[he]}};break;case"backgroundImage":A(R[he]===""),Le={[he]:[{...e.backgroundImage[0],value:R[he]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":Le={padding:{left:F.paddingLeft,right:F.paddingRight,top:F.paddingTop,bottom:F.paddingBottom,[W.PADDING_POSITION[he]]:+R[he]}};break;case"paddingTopBottom":Le={padding:{left:F.paddingLeft,right:F.paddingRight,top:+R[he],bottom:+R[he]}},F.paddingTop=F.paddingBottom=+R[he];break;case"paddingLeftRight":Le={padding:{top:F.paddingTop,bottom:F.paddingBottom,left:+R[he],right:+R[he]}},F.paddingLeft=F.paddingRight=+R[he];break;case"borderRadiusAll":Le={borderRadius:{[W.BORDER_RADIUS_POSITION[he]]:+R[he]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Le={borderRadius:{topLeft:F.borderRadiusTopLeft,bottomLeft:F.borderRadiusBottomLeft,topRight:F.borderRadiusTopRight,bottomRight:F.borderRadiusBottomRight,[W.BORDER_RADIUS_POSITION[he]]:+R[he]}};break;case"mobileWidth":Le={[he]:{classNamePrefix:"em-mob-width-",value:R[he],dim:F.mobileWidthDim}};break;case"mobileWidthDim":Le={mobileWidth:{classNamePrefix:"em-mob-width-",value:F.mobileWidth||100,dim:R[he]}};break;case"mobileHeight":Le={[he]:{classNamePrefix:"em-mob-height-",value:R[he],dim:F.mobileHeightDim}};break;case"mobileHeightDim":Le={mobileHeight:{classNamePrefix:"em-mob-height-",value:F.mobileHeight,dim:R[he]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Le={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[he]]:R[he],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[he]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Le={mobileBoxShadow:{hOffset:F.mobileBoxShadowHOffset,vOffset:F.mobileBoxShadowVOffset,blurRadius:F.mobileBoxShadowBlurRadius,spreadRadius:F.mobileBoxShadowSpreadRadius,color:F.mobileBoxShadowColor,inset:F.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":Le={[he]:{classNamePrefix:"em-mob-text_align-",value:R[he]}};break;case"mobileVerticalAlign":Le={[he]:{classNamePrefix:"em-mob-vertical_align-",value:R[he]}};break;case"mobileDirection":Le={[he]:{classNamePrefix:"em-mob-direction-",value:R[he]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Le=_t(R),!Le)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":Le={mobilePadding:{all:null,top:F.mobilePaddingTop!==""?F.mobilePaddingTop:null,right:F.mobilePaddingRight!==""?F.mobilePaddingRight:null,bottom:F.mobilePaddingBottom!==""?F.mobilePaddingBottom:null,left:F.mobilePaddingLeft!==""?F.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":F.mobilePaddingTop=F.mobilePaddingBottom=R[he],Le={mobilePadding:{all:null,top:F.mobilePaddingTop!==""?F.mobilePaddingTop:null,right:F.mobilePaddingRight!==""?F.mobilePaddingRight:null,bottom:F.mobilePaddingBottom!==""?F.mobilePaddingBottom:null,left:F.mobilePaddingLeft!==""?F.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":F.mobilePaddingLeft=F.mobilePaddingRight=R[he],Le={mobilePadding:{all:null,top:F.mobilePaddingTop!==""?F.mobilePaddingTop:null,right:F.mobilePaddingRight!==""?F.mobilePaddingRight:null,bottom:F.mobilePaddingBottom!==""?F.mobilePaddingBottom:null,left:F.mobilePaddingLeft!==""?F.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"backgroundPositionX":case"backgroundPositionY":Le={[he]:isNaN(parseFloat(R[he].position))?R[he].position:R[he].position+R[he].unit};break;default:Le=R}he!=="borderPosition"&&he!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Le}),he!=="mobileBorderRadiusAll"&&he!=="mobileBorderRadiusTopLeft"&&he!=="mobileBorderRadiusTopRight"&&he!=="mobileBorderRadiusBottomLeft"&&he!=="mobileBorderRadiusBottomRight"&&Ne({...e,...Le,mobileBorderRadius:{...e.mobileBorderRadius,...Le?.mobileBorderRadius},activateSection:null,changeKey:he}))},Ve=()=>{z(F=>!F);const R=a.getFieldsValue(!0);Y||(R.paddingLeftRight=R.paddingLeft,R.paddingTopBottom=R.paddingTop,R.paddingRight=R.paddingLeft,R.paddingBottom=R.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:R.paddingTopBottom,bottom:R.paddingTopBottom,left:R.paddingLeftRight,right:R.paddingLeftRight}}}))},Ue=()=>{const R=a.getFieldsValue(!0);d.markBorderToggled(!y),setTimeout(()=>{oe(F=>!F),y?(R.borderAll=W.NULL_BORDER,R.borderTop=W.NULL_BORDER,R.borderBottom=W.NULL_BORDER,R.borderRight=W.NULL_BORDER,R.borderLeft=W.NULL_BORDER):R.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:R.borderAll.color,style:R.borderAll.style,width:R.borderAll.width}}}})})},le=()=>{const R=a.getFieldsValue(!0);c.markBorderToggled(!G),setTimeout(()=>{q(F=>!F),G?(R.mobileBorderAll=W.NULL_BORDER,R.mobileBorderTop=W.NULL_BORDER,R.mobileBorderBottom=W.NULL_BORDER,R.mobileBorderRight=W.NULL_BORDER,R.mobileBorderLeft=W.NULL_BORDER):R.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:R.mobileBorderAll.color,style:R.mobileBorderAll.style,width:R.mobileBorderAll.width}}}})})},Te=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{ue(F=>!F),te?(R.borderRadiusAll=0,h(!0)):R.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:R.borderRadiusAll}}})})},I=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{se(F=>!F),me?(R.mobileBorderRadiusAll=null,_(!0)):R.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:R.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},Z=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{ve(F=>!F),_e?(R.boxShadowInset=!1,R.boxShadowHOffset=null,R.boxShadowVOffset=null,R.boxShadowBlurRadius=null,R.boxShadowSpreadRadius=null,R.boxShadowColor=""):(R.boxShadowInset=!1,R.boxShadowHOffset=5,R.boxShadowVOffset=5,R.boxShadowBlurRadius=10,R.boxShadowSpreadRadius=-5,R.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:R.boxShadowBlurRadius,color:R.boxShadowColor,hOffset:R.boxShadowHOffset,inset:R.boxShadowInset,spreadRadius:R.boxShadowSpreadRadius,vOffset:R.boxShadowVOffset}}})})},Be=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{De(F=>!F),de?(R.mobileBoxShadowInset=!1,R.mobileBoxShadowHOffset=null,R.mobileBoxShadowVOffset=null,R.mobileBoxShadowBlurRadius=null,R.mobileBoxShadowSpreadRadius=null,R.mobileBoxShadowColor=""):(R.mobileBoxShadowInset=!1,R.mobileBoxShadowHOffset=5,R.mobileBoxShadowVOffset=5,R.mobileBoxShadowBlurRadius=10,R.mobileBoxShadowSpreadRadius=-5,R.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:R.mobileBoxShadowBlurRadius,color:R.mobileBoxShadowColor,hOffset:R.mobileBoxShadowHOffset,inset:R.mobileBoxShadowInset,spreadRadius:R.mobileBoxShadowSpreadRadius,vOffset:R.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Ce=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{re(F=>!F),ye&&(R.width="",R.height="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{width:{value:null,dim:"px"},height:{value:null,dim:"px"}}}))})},Me=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{ae(F=>!F),ke&&(R.mobileWidth="",R.mobileHeight="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"},mobileHeight:{value:null,dim:"px",classNamePrefix:"em-mob-height-"}}}))})},Ge=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{be(F=>!F),Q?(R.backgroundColor="",R.backgroundImage="",R.backgroundPositionX="",R.backgroundPositionY="",R.backgroundRepeat="none",R.backgroundSize="",A(!0)):(R.backgroundColor="#E5E5E5",R.backgroundSize="",R.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:R.backgroundColor,backgroundImage:[{type:"url",value:R.backgroundImage}],backgroundPositionX:R.backgroundPositionX,backgroundPositionY:R.backgroundPositionY,backgroundRepeat:R.backgroundRepeat,backgroundSize:R.backgroundSize}})})},Ye=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{ee(F=>!F),pe?R.mobileBackgroundColor="":R.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:R.mobileBackgroundColor}}}),pe&&Et(a,e,l)})},D=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{U(F=>!F),J&&(R.exportAsPicture=!1,R.isContrastBlock=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1,isContrastBlock:!1}}))})},L=()=>{const R=a.getFieldsValue(!0);setTimeout(()=>{ce(F=>!F),X&&(R.mobilePaddingLeftRight="",R.mobilePaddingLeft="",R.mobilePaddingRight="",R.mobilePaddingTopBottom="",R.mobilePaddingTop="",R.mobilePaddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobilePadding:{all:null,top:null,right:null,bottom:null,left:null,classNamePrefix:"em-mob-padding_"}}}))})};return(0,o.jsx)(t.ui_kit$Form,{form:a,layout:"vertical",name:"selected_td_form",initialValues:{horizontalPosition:"",horizontalUnit:"px",backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",align:"",valign:"",border:"",show:"all",borderPosition:W.BORDER_POSITIONS[ie]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[je]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",borderRadiusAll:"",borderRadiusTopLeft:"",borderRadiusBottomLeft:"",borderRadiusTopRight:"",borderRadiusBottomRight:"",direction:"",boxShadowInset:"",boxShadowHOffset:"",boxShadowVOffset:"",boxShadowBlurRadius:"",boxShadowSpreadRadius:"",boxShadowColor:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileAlign:"",mobileDirection:"",mobileVerticalAlign:"",mobileBackgroundColor:"",mobileBackgroundImage:"",mobilePaddingTop:"",mobilePaddingLeft:"",mobilePaddingRight:"",mobilePaddingBottom:"",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1},onValuesChange:Fe,autoComplete:"off",className:"element-controls",children:E==="mobile"&&w.styles?(0,o.jsxs)("div",{className:"selected_form-mobile-props-wrapper",style:{display:E==="mobile"&&w.styles?"flex":"none"},children:[(0,o.jsx)("div",{className:"selected_form-mobile-props-header",children:!P&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})})}),(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(sl,{form:a,elementSettings:e,boxShadow:x,mobileBordersShow:G,mobileBorderRadiusShow:me,mobileBoxShadowShow:de,mobileSizeShow:ke,mobileBackgroundShow:pe,mobilePaddingShow:X,mobilePaddingsExt:$,setMobilePaddingsExt:O,oneMobileBorderRadiusValue:T,setOneMobileBorderRadiusValue:_,toggleShowMobileBorderHandler:le,toggleShowMobileBorderRadiusHandler:I,toggleShowMobileBoxShadowHandler:Be,toggleShowMobileSizeHandler:Me,toggleShowMobileBackgroundHandler:Ye,toggleShowMobilePaddingHandler:L})})]}):(0,o.jsxs)(o.Fragment,{children:[!P&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(ll,{form:a,elementSettings:e,boxShadow:x,bordersShow:y,borderRadiusShow:te,boxShadowShow:_e,backgroundShow:Q,backgroundImageEmpty:v,backgroundRepeatOptions:we,sizeShow:ye,maxWidthValue:p,modificationShow:J,paddingsExt:Y,oneBorderRadiusValue:b,setOneBorderRadiusValue:h,elementListShow:xe,togglePaddingHandler:Ve,toggleShowBorderHandler:Ue,toggleShowBorderRadiusHandler:Te,toggleShowBoxShadowHandler:Z,toggleShowSizeHandler:Ce,toggleShowBackgroundHandler:Ge,toggleShowModificationHandler:D,handleChangeValues:Fe})})]})})};al.propTypes={elementSettings:g.default.object.isRequired};var nl=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:a,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:p,backgroundRepeatOptions:f,sizeShow:x,maxWidthValue:k,modificationShow:b,paddingShow:h,paddingsExt:T,oneBorderRadiusValue:_,setOneBorderRadiusValue:E,togglePaddingHandler:w,toggleShowPaddingHandler:v,toggleShowBorderHandler:A,toggleShowBorderRadiusHandler:j,toggleShowBoxShadowHandler:C,toggleShowSizeHandler:P,toggleShowBackgroundHandler:Y,toggleShowModificationHandler:z,handleChangeValues:$})=>{const{__:O}=r.useI18n(),{token:y}=(0,t.ui_kit$useToken)(),oe=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:O("Appearance on mobile devices"),type:"info"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(it,{form:e,elementSettings:i})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Mo,{form:e,elementSettings:i})})]}),oe.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("Padding"),collapsible:!0,open:h,onToggle:v,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:T,onToggleExtended:w,labels:{horizontal:O("Horizontal padding"),vertical:O("Vertical padding"),left:O("Left padding"),right:O("Right padding"),top:O("Top padding"),bottom:O("Bottom padding"),individual:O("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:O("Size"),collapsible:!0,open:x,onToggle:P,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:k,dimensionSelect:$o,showMinMax:!0,minWidthDimensionSelect:$o,maxWidthDimensionSelect:$o,labels:{width:O("Width"),height:O("Height"),minWidth:O("Minimum width"),maxWidth:O("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:O("Background"),collapsible:!0,open:c,onToggle:Y,dividerTop:!0,children:[(0,o.jsx)(vi,{form:e,backgroundImageEmpty:p,appConfig:oe,token:y,elementSettings:i,backgroundRepeatOptions:f,handleChangeValues:$}),(0,o.jsx)(rt,{form:e,showBackground:!0})]}),oe.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("Borders"),collapsible:!0,open:s,onToggle:A,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),oe.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("Border radius"),collapsible:!0,open:a,onToggle:j,dividerTop:!0,children:(0,o.jsx)(So,{form:e,oneBorderRadiusValue:_,setOneBorderRadiusValue:E,elementSettings:i})}),oe.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("Box shadow"),collapsible:!0,open:d,onToggle:C,dividerTop:!0,children:(0,o.jsx)(jo,{})}),oe.formFieldExportAsPictureEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("Export settings"),collapsible:!0,open:b,onToggle:z,dividerTop:!0,children:(0,o.jsx)(yi,{form:e,elementSettings:i})}),oe.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("Display control & Direction"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e,directionControl:(0,o.jsx)(Ht,{elementSettings:i,form:e})})}),oe.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};nl.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,backgroundShow:g.default.bool,backgroundImageEmpty:g.default.bool,backgroundRepeatOptions:g.default.array,sizeShow:g.default.bool,maxWidthValue:g.default.oneOfType([g.default.string,g.default.number]),modificationShow:g.default.bool,paddingShow:g.default.bool,paddingsExt:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,togglePaddingHandler:g.default.func,toggleShowPaddingHandler:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func,toggleShowSizeHandler:g.default.func,toggleShowBackgroundHandler:g.default.func,toggleShowModificationHandler:g.default.func,handleChangeValues:g.default.func};var dl=({form:e,elementSettings:i,mobileBoxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:a,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:p,mobilePaddingShow:f,mobilePaddingsExt:x,setMobilePaddingsExt:k,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:h,toggleShowMobileBorderHandler:T,toggleShowMobileBorderRadiusHandler:_,toggleShowMobileBoxShadowHandler:E,toggleShowMobileSizeHandler:w,toggleShowMobileBackgroundHandler:v,toggleShowMobilePaddingHandler:A})=>{const{__:j}=r.useI18n(),{token:C}=(0,t.ui_kit$useToken)(),P=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Dt,{form:e,elementSettings:i,imgParent:!0})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Mo,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),P.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Padding"),collapsible:!0,open:f,onToggle:A,dividerTop:!0,children:(0,o.jsx)(Wt,{form:e,elementSettings:i,mobilePaddingsExt:x,setMobilePaddingsExt:k})}),(0,o.jsx)(t.ui_kit$FormSection,{title:j("Size"),collapsible:!0,open:c,onToggle:w,dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:8},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:C.formItemMarginBottomXS*2},children:(0,o.jsx)(zo,{form:e,name:"mobileWidth",elementSettings:i})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:C.formItemMarginBottomXS},children:(0,o.jsx)(tt,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:j("Background"),collapsible:!0,open:p,onToggle:v,dividerTop:!0,children:(0,o.jsx)(Bt,{elementSettings:Go(i),imageEnabled:P.formDivFieldBackgroundImageEnabled,desktopBackground:xt(i)})}),P.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Borders"),collapsible:!0,open:s,onToggle:T,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),P.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Border radius"),collapsible:!0,open:a,onToggle:_,dividerTop:!0,children:(0,o.jsx)(So,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:b,setOneBorderRadiusValue:h,elementSettings:i})}),P.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Box shadow"),collapsible:!0,open:d,onToggle:E,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile",form:e,elementSettings:i})}),P.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Display control & Direction"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e,directionControl:(0,o.jsx)(Ht,{elementSettings:i,form:e,typeOfForm:"mobile"})})}),P.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};dl.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,mobileBoxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,mobilePaddingShow:g.default.bool,mobilePaddingsExt:g.default.bool,setMobilePaddingsExt:g.default.func,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func,toggleShowMobileBackgroundHandler:g.default.func,toggleShowMobilePaddingHandler:g.default.func};var cl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),a=Fo(),d=Fo(),[c,p]=(0,n.useState)({}),[f,x]=(0,n.useState)(!0),[k,b]=(0,n.useState)({}),[h,T]=(0,n.useState)(!0),_=r.useSelector(r.selectEmailViewType),E=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[w,v]=(0,n.useState)(e.backgroundImage[0].value===""),A=r.useSelector(r.selectIsCodeMode),j=r.useSelector(r.selectCodeModeDirection),C=A&&j!=="bottom",[P,Y]=(0,n.useState)(!1),[z,$]=(0,n.useState)(!1),[O,y]=(0,n.useState)(!1),[oe,G]=(0,n.useState)(!1),[q,te]=(0,n.useState)(!1),[ue,me]=(0,n.useState)(!1),[se,_e]=(0,n.useState)(!1),[ve,de]=(0,n.useState)(!1),[De,ye]=(0,n.useState)(!1),[re,ke]=(0,n.useState)(!1),[ae,Q]=(0,n.useState)(!1),[be,pe]=(0,n.useState)(!1),[ee,J]=(0,n.useState)(!1),[U,X]=(0,n.useState)(!1),[ce,xe]=(0,n.useState)(!1),[ne,Ae]=(0,n.useState)(""),we=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}];i("Not defined"),i("Contain"),i("Cover");const $e=e.border,K=e.mobileBorder,ie=Object.keys($e).find(D=>$e[D]?.width||$e[D]?.style||$e[D]?.color),je=Object.keys(K).find(D=>K[D]?.width||K[D]?.style||K[D]?.color),V=D=>D&&(D?.width||D?.style||D?.color)?D:"";(0,n.useEffect)(()=>{if(e){const D=e.boxShadow,L=e.mobileBoxShadow;p(D),b(L),s.setFieldsValue({...e,width:e.width?.value,widthDim:e.width?.dim,height:e.height?.value,heightDim:e.height?.dim,maxWidth:e.maxWidth?.value,maxWidthDim:e.maxWidth?.dim,minWidth:e.minWidth?.value,minWidthDim:e.minWidth?.dim,backgroundImage:e.backgroundImage[0].value,show:e.show?e.show:"all",borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),mobileBorderAll:V(e.mobileBorder.all)||!(V(e.mobileBorder.top)||V(e.mobileBorder.bottom)||V(e.mobileBorder.right)||V(e.mobileBorder.left))&&V(e.border.all),mobileBorderTop:V(e.mobileBorder.top)||!V(e.mobileBorder.all)&&V(e.border.top),mobileBorderBottom:V(e.mobileBorder.bottom)||!V(e.mobileBorder.all)&&V(e.border.bottom),mobileBorderRight:V(e.mobileBorder.right)||!V(e.mobileBorder.all)&&V(e.border.right),mobileBorderLeft:V(e.mobileBorder.left)||!V(e.mobileBorder.all)&&V(e.border.left),paddingTop:u(e.padding.all)||u(e.padding.top),paddingLeft:u(e.padding.all)||u(e.padding.left),paddingRight:u(e.padding.all)||u(e.padding.right),paddingBottom:u(e.padding.all)||u(e.padding.bottom),paddingLeftRight:u(e.padding?.left)||u(e.padding?.right),paddingTopBottom:u(e.padding?.top)||u(e.padding?.bottom),borderRadiusAll:u(e.borderRadius.all),borderRadiusTopLeft:u(e.borderRadius.topLeft),borderRadiusBottomLeft:u(e.borderRadius.bottomLeft),borderRadiusTopRight:u(e.borderRadius.topRight),borderRadiusBottomRight:u(e.borderRadius.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:po(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileHeight:po(e.mobileHeight?.value),mobileHeightDim:e.mobileHeight?.dim,mobileBorderRadiusAll:u(e.mobileBorderRadius.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius.topLeft!==null?e.mobileBorderRadius.topLeft:e.mobileBorderRadius.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius.bottomLeft!==null?e.mobileBorderRadius.bottomLeft:e.mobileBorderRadius.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius.topRight!==null?e.mobileBorderRadius.topRight:e.mobileBorderRadius.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius.bottomRight!==null?e.mobileBorderRadius.bottomRight:e.mobileBorderRadius.all),mobileBoxShadowInset:u(e.mobileBoxShadow?.inset)||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color),mobileAlign:u(e.mobileAlign?.value),mobileVerticalAlign:u(e.mobileVerticalAlign?.value),mobileDirection:u(e.mobileDirection?.value),mobileBackgroundColor:u(e.mobileBackgroundColor?.value!=="none"?e.mobileBackgroundColor?.value:""),...nt(e),mobilePaddingTop:u(e.mobilePadding.all)||u(e.mobilePadding.top),mobilePaddingLeft:u(e.mobilePadding.all)||u(e.mobilePadding.left),mobilePaddingRight:u(e.mobilePadding.all)||u(e.mobilePadding.right),mobilePaddingBottom:u(e.mobilePadding.all)||u(e.mobilePadding.bottom),mobilePaddingTopBottom:u(e.mobilePadding.top)||u(e.mobilePadding.bottom),mobilePaddingLeftRight:u(e.mobilePadding.left)||u(e.mobilePadding.right),exportAsPicture:e?.exportAsPicture}),!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?x(!1):x(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))?T(!1):T(!0),v(e.backgroundImage[0].value===""),!u(e.padding.all)&&(u(e.padding.top)||u(e.padding.right)||u(e.padding.bottom)||u(e.padding.left))&&(e.padding.top!==e.padding.bottom||e.padding.right!==e.padding.left)?Y(!1):Y(!0),!u(e.mobilePadding.all)&&(u(e.mobilePadding.top)||u(e.mobilePadding.right)||u(e.mobilePadding.bottom)||u(e.mobilePadding.left))&&(e.mobilePadding.top!==e.mobilePadding.bottom||e.mobilePadding.right!==e.mobilePadding.left)?$(!1):$(!0);const R=a.isStaleBorderSnapshot(e,!!ie),F=d.isStaleBorderSnapshot(e,!!je);R&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(F||R&&!je)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),y(he=>ie&&!R?!0:he),G(he=>ie&&!R||je&&!F?!0:he),te(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),me(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),_e(!!e.boxShadow),de(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),ye(!!e.width.value||!!e.height.value||!!e.minWidth.value||!!e.maxWidth.value),ke(!!e.mobileWidth.value||!!e.mobileHeight.value),Q(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),pe(kt(e)),J(!!e.exportAsPicture),X(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),xe(!!e.mobilePadding.all||!!e.mobilePadding.top||!!e.mobilePadding.bottom||!!e.mobilePadding.left||!!e.mobilePadding.right)}},[s,e,ie,je,a,d]);const Se=D=>{const L=s.getFieldsValue(!0),R=Object.keys(D)[0];let F;switch(Ae(s.getFieldsValue(!0).widthDim==="%"?100:""),R){case"exportAsPicture":F={exportAsPicture:L.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":F={boxShadow:{hOffset:L.boxShadowHOffset,vOffset:L.boxShadowVOffset,blurRadius:L.boxShadowBlurRadius,spreadRadius:L.boxShadowSpreadRadius,color:L.boxShadowColor,inset:L.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":L.borderPosition==="borderAll"?(F={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...L.borderAll}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):L.borderAll?.width||L.borderAll?.style||L.borderAll?.color?(F={border:{all:null,left:L.borderAll,right:L.borderAll,top:L.borderAll,bottom:L.borderAll,[W.REVERSE_BORDER_POSITIONS[R]]:{...L[R],...D[R]}}},s.setFieldsValue({borderAll:null,borderLeft:L.borderAll,borderRight:L.borderAll,borderTop:L.borderAll,borderBottom:L.borderAll,[R]:{...L[R],...D[R]}})):(F={border:{all:null,left:L.borderLeft,right:L.borderRight,top:L.borderTop,bottom:L.borderBottom,[W.REVERSE_BORDER_POSITIONS[R]]:{...L[R],...D[R]}}},s.setFieldsValue({border:F.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(L.mobileBorderPosition==="mobileBorderAll")F={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...L.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[R]+"-"}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const he=W.MOBILE_REVERSE_BORDER_POSITIONS[R],Le={...L[R],...D[R]},eo=!Le?.width&&!Le?.style&&!Le?.color;if(L.mobileBorder?.all?.width||L.mobileBorder?.all?.style||L.mobileBorder?.all?.color){const Xe=L.mobileBorderAll;F={mobileBorder:{all:null,left:Xe,right:Xe,top:Xe,bottom:Xe,[he]:eo?null:{...Le,classNamePrefix:"em-mob-border_"+he+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:Xe,mobileBorderRight:Xe,mobileBorderTop:Xe,mobileBorderBottom:Xe,[R]:Le})}else{const Xe=e.mobileBorder||{},lo=Qe=>{const uo=Xe[Qe];return uo&&(uo?.width||uo?.style||uo?.color)?uo:null};F={mobileBorder:{all:null,left:he==="left"?eo?null:{...Le,classNamePrefix:"em-mob-border_left-"}:lo("left"),right:he==="right"?eo?null:{...Le,classNamePrefix:"em-mob-border_right-"}:lo("right"),top:he==="top"?eo?null:{...Le,classNamePrefix:"em-mob-border_top-"}:lo("top"),bottom:he==="bottom"?eo?null:{...Le,classNamePrefix:"em-mob-border_bottom-"}:lo("bottom")}},s.setFieldsValue({[R]:Le})}}break;case"width":F={[R]:{value:D[R],dim:L.widthDim}};break;case"height":F={[R]:{value:D[R],dim:L.heightDim}};break;case"widthDim":F={width:{value:L.width,dim:D[R]}};break;case"heightDim":F={height:{value:L.height,dim:D[R]}};break;case"maxWidth":F={[R]:{value:D[R],dim:L.maxWidthDim}};break;case"maxWidthDim":F={maxWidth:{value:L.maxWidth,dim:D[R]}};break;case"minWidth":F={[R]:{value:D[R],dim:L.minWidthDim}};break;case"minWidthDim":F={minWidth:{value:L.minWidth,dim:D[R]}};break;case"backgroundImage":v(D[R]===""),F={[R]:[{...e.backgroundImage[0],value:D[R]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":F={padding:{[W.PADDING_POSITION[R]]:+D[R]}};break;case"paddingTopBottom":F={padding:{top:+D[R],bottom:+D[R]}},L.paddingTop=L.paddingBottom=+D[R];break;case"paddingLeftRight":F={padding:{left:+D[R],right:+D[R]}},L.paddingLeft=L.paddingRight=+D[R];break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":F={borderRadius:{[W.BORDER_RADIUS_POSITION[R]]:+D[R]}};break;case"mobileWidth":F={[R]:{classNamePrefix:"em-mob-width-",value:D[R],dim:L.mobileWidthDim}};break;case"mobileWidthDim":F={mobileWidth:{classNamePrefix:"em-mob-width-",value:L.mobileWidth||100,dim:D[R]}};break;case"mobileHeight":F={[R]:{classNamePrefix:"em-mob-height-",value:D[R],dim:L.mobileHeightDim}};break;case"mobileHeightDim":F={mobileHeight:{classNamePrefix:"em-mob-height-",value:L.mobileHeight,dim:D[R]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":F={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[R]]:D[R],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[R]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":F={mobileBoxShadow:{hOffset:L.mobileBoxShadowHOffset,vOffset:L.mobileBoxShadowVOffset,blurRadius:L.mobileBoxShadowBlurRadius,spreadRadius:L.mobileBoxShadowSpreadRadius,color:L.mobileBoxShadowColor,inset:L.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":F={[R]:{classNamePrefix:"em-mob-text_align-",value:D[R]}};break;case"mobileVerticalAlign":F={[R]:{classNamePrefix:"em-mob-vertical_align-",value:D[R]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(F=_t(D),!F)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":F={mobilePadding:{all:null,top:L.mobilePaddingTop!==""?L.mobilePaddingTop:null,right:L.mobilePaddingRight!==""?L.mobilePaddingRight:null,bottom:L.mobilePaddingBottom!==""?L.mobilePaddingBottom:null,left:L.mobilePaddingLeft!==""?L.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":L.mobilePaddingTop=L.mobilePaddingBottom=D[R],F={mobilePadding:{all:null,top:L.mobilePaddingTop!==""?L.mobilePaddingTop:null,right:L.mobilePaddingRight!==""?L.mobilePaddingRight:null,bottom:L.mobilePaddingBottom!==""?L.mobilePaddingBottom:null,left:L.mobilePaddingLeft!==""?L.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":L.mobilePaddingLeft=L.mobilePaddingRight=D[R],F={mobilePadding:{all:null,top:L.mobilePaddingTop!==""?L.mobilePaddingTop:null,right:L.mobilePaddingRight!==""?L.mobilePaddingRight:null,bottom:L.mobilePaddingBottom!==""?L.mobilePaddingBottom:null,left:L.mobilePaddingLeft!==""?L.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileDirection":F={[R]:{classNamePrefix:"em-mob-direction-",value:D[R]}};break;case"backgroundPositionX":case"backgroundPositionY":F={[R]:isNaN(parseFloat(D[R].position))?D[R].position:D[R].position+D[R].unit};break;default:F=D}R!=="borderPosition"&&R!=="mobileBorderPosition"&&l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:F})},Ie=()=>{Y(L=>!L);const D=s.getFieldsValue(!0);P||(D.paddingLeftRight=D.paddingLeft,D.paddingTopBottom=D.paddingTop,D.paddingRight=D.paddingLeft,D.paddingBottom=D.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:D.paddingTopBottom,bottom:D.paddingTopBottom,left:D.paddingLeftRight,right:D.paddingLeftRight}}}))},Ne=()=>{const D=s.getFieldsValue(!0);a.markBorderToggled(!O),setTimeout(()=>{y(L=>!L),O?(D.borderAll=W.NULL_BORDER,D.borderTop=W.NULL_BORDER,D.borderBottom=W.NULL_BORDER,D.borderRight=W.NULL_BORDER,D.borderLeft=W.NULL_BORDER):D.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:D.borderAll.color,style:D.borderAll.style,width:D.borderAll.width}}}})})},Fe=()=>{const D=s.getFieldsValue(!0);d.markBorderToggled(!oe),setTimeout(()=>{G(L=>!L),oe?(D.mobileBorderAll=W.NULL_BORDER,D.mobileBorderTop=W.NULL_BORDER,D.mobileBorderBottom=W.NULL_BORDER,D.mobileBorderRight=W.NULL_BORDER,D.mobileBorderLeft=W.NULL_BORDER):D.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:D.mobileBorderAll.color,style:D.mobileBorderAll.style,width:D.mobileBorderAll.width}}}})})},Ve=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{te(L=>!L),q?(D.borderRadiusAll=0,x(!0)):D.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:D.borderRadiusAll}}})})},Ue=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{me(L=>!L),ue?(D.mobileBorderRadiusAll=null,T(!0)):D.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:D.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},le=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{_e(L=>!L),se?(D.boxShadowInset=!1,D.boxShadowHOffset=null,D.boxShadowVOffset=null,D.boxShadowBlurRadius=null,D.boxShadowSpreadRadius=null,D.boxShadowColor=""):(D.boxShadowInset=!1,D.boxShadowHOffset=5,D.boxShadowVOffset=5,D.boxShadowBlurRadius=10,D.boxShadowSpreadRadius=-5,D.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:D.boxShadowBlurRadius,color:D.boxShadowColor,hOffset:D.boxShadowHOffset,inset:D.boxShadowInset,spreadRadius:D.boxShadowSpreadRadius,vOffset:D.boxShadowVOffset}}})})},Te=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{de(L=>!L),ve?(D.mobileBoxShadowInset=!1,D.mobileBoxShadowHOffset=null,D.mobileBoxShadowVOffset=null,D.mobileBoxShadowBlurRadius=null,D.mobileBoxShadowSpreadRadius=null,D.mobileBoxShadowColor=""):(D.mobileBoxShadowInset=!1,D.mobileBoxShadowHOffset=5,D.mobileBoxShadowVOffset=5,D.mobileBoxShadowBlurRadius=10,D.mobileBoxShadowSpreadRadius=-5,D.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:D.mobileBoxShadowBlurRadius,color:D.mobileBoxShadowColor,hOffset:D.mobileBoxShadowHOffset,inset:D.mobileBoxShadowInset,spreadRadius:D.mobileBoxShadowSpreadRadius,vOffset:D.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},I=()=>{setTimeout(()=>{ye(D=>!D)})},Z=()=>{setTimeout(()=>{ke(D=>!D)})},Be=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{Q(L=>!L),ae?(D.backgroundColor="",D.backgroundImage="",D.backgroundPositionX="",D.backgroundPositionY="",D.backgroundRepeat="none",D.backgroundSize="",v(!0)):(D.backgroundColor="#E5E5E5",D.backgroundSize="",D.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:D.backgroundColor,backgroundImage:[{type:"url",value:D.backgroundImage}],backgroundPositionX:D.backgroundPositionX,backgroundPositionY:D.backgroundPositionY,backgroundRepeat:D.backgroundRepeat,backgroundSize:D.backgroundSize}})})},Ce=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{pe(L=>!L),be?D.mobileBackgroundColor="":D.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:D.mobileBackgroundColor}}}),be&&Et(s,e,l)})},Me=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{J(L=>!L),ee&&(D.exportAsPicture=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})},Ge=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{X(L=>!L),U&&(D.paddingLeftRight="",D.paddingLeft="",D.paddingRight="",D.paddingTopBottom="",D.paddingTop="",D.paddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},Ye=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{xe(L=>!L),ce&&(D.mobilePaddingLeftRight="",D.mobilePaddingLeft="",D.mobilePaddingRight="",D.mobilePaddingTopBottom="",D.mobilePaddingTop="",D.mobilePaddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobilePadding:{all:null,top:null,right:null,bottom:null,left:null,classNamePrefix:"em-mob-padding_"}}}))})};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_div_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",valign:"",border:"",boxShadow:"",show:"all",borderPosition:W.BORDER_POSITIONS[ie]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[je]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",borderRadiusAll:"",borderRadiusTopLeft:"",borderRadiusBottomLeft:"",borderRadiusTopRight:"",borderRadiusBottomRight:"",direction:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileAlign:"",mobileDirection:"",mobileVerticalAlign:"",mobileBackgroundColor:"",mobileBackgroundImage:"",mobilePaddingTop:"",mobilePaddingLeft:"",mobilePaddingRight:"",mobilePaddingBottom:""},onValuesChange:Se,autoComplete:"off",className:"element-controls",children:[!C&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),_==="mobile"&&E.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(dl,{form:s,elementSettings:e,mobileBoxShadow:k,mobileBordersShow:oe,mobileBorderRadiusShow:ue,mobileBoxShadowShow:ve,mobileSizeShow:re,mobileBackgroundShow:be,mobilePaddingShow:ce,mobilePaddingsExt:z,setMobilePaddingsExt:$,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:T,toggleShowMobileBorderHandler:Fe,toggleShowMobileBorderRadiusHandler:Ue,toggleShowMobileBoxShadowHandler:Te,toggleShowMobileSizeHandler:Z,toggleShowMobileBackgroundHandler:Ce,toggleShowMobilePaddingHandler:Ye})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(nl,{form:s,elementSettings:e,boxShadow:c,bordersShow:O,borderRadiusShow:q,boxShadowShow:se,backgroundShow:ae,backgroundImageEmpty:w,backgroundRepeatOptions:we,sizeShow:De,maxWidthValue:ne,modificationShow:ee,paddingShow:U,paddingsExt:P,oneBorderRadiusValue:f,setOneBorderRadiusValue:x,togglePaddingHandler:Ie,toggleShowPaddingHandler:Ge,toggleShowBorderHandler:Ne,toggleShowBorderRadiusHandler:Ve,toggleShowBoxShadowHandler:le,toggleShowSizeHandler:I,toggleShowBackgroundHandler:Be,toggleShowModificationHandler:Me,handleChangeValues:Se})})]})};cl.propTypes={elementSettings:g.default.object.isRequired};var ul=({form:e,elementSettings:i})=>{const{__:l}=r.useI18n(),s=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:"0"},children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Float block width"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"width",children:(0,o.jsx)(t.ui_kit$InputNumber,{min:0,placeholder:l("Float block width"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:(0,o.jsx)(t.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:$o})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Column gap"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gap",children:(0,o.jsx)(t.ui_kit$InputNumber,{min:0,placeholder:l("Column gap"),prefix:(0,o.jsx)(r.EmIcons,{icon:"SplitCellsOutlined",component:t.icons$SplitCellsOutlined}),addonAfter:(0,o.jsx)(t.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:an})})})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Vertical alignment"),dividerTop:!0,children:(0,o.jsx)(Mo,{form:e,elementSettings:i})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})}),s.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:l("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};ul.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired};var ml=({form:e,elementSettings:i})=>{const{__:l}=r.useI18n(),s=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:l("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:l("Appearance on mobile devices"),type:"info"})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:20},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(zo,{form:e,name:"mobileWidth",elementSettings:i})}),(0,o.jsx)(t.ui_kit$Col,{span:12})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Alignments"),dividerTop:!0,children:(0,o.jsx)(Mo,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})}),s.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:l("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};ml.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired};var Ii=0,pl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),a=r.useSelector(r.selectEmailViewType),d=r.useSelector(r.selectMobileViewActive),c=r.useSelector(r.selectIsCodeMode),p=r.useSelector(r.selectCodeModeDirection),f=c&&p!=="bottom";(0,n.useEffect)(()=>{e&&(s.setFieldsValue({...e,width:e.width?.value,widthDim:e.width?.dim,gap:e.gap?.value,gapDim:e.gap?.dim,maxWidth:e.maxWidth?.value,maxWidthDim:e.maxWidth?.dim,minWidth:e.minWidth?.value,minWidthDim:e.minWidth?.dim,show:e.show?e.show:"all",mobileWidth:po(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileContentWidth:po(e.mobileContentWidth?.value),mobileContentWidthDim:e.mobileContentWidth?.dim,mobileVerticalAlign:u(e.mobileVerticalAlign?.value)}),Ii=e.width.value+e.gap.value)},[s,e]);const x=k=>{const b=s.getFieldsValue(!0),h=Object.keys(k)[0];let T;switch(h){case"width":Ii=k[h]+b.gap,T={[h]:{value:k[h],dim:b.widthDim},gap:{value:b.gap}};break;case"widthDim":T={width:{value:b.width,dim:k[h]},gap:{value:b.gap}};break;case"gap":b.width=Ii-k[h],T={[h]:{value:k[h],dim:"px"}};break;case"mobileWidth":T={[h]:{classNamePrefix:"em-mob-width-",value:k[h],dim:b.mobileWidthDim}};break;case"mobileWidthDim":T={mobileWidth:{classNamePrefix:"em-mob-width-",value:b.mobileWidth||100,dim:k[h]}};break;case"mobileContentWidth":T={[h]:{classNamePrefix:"em-mob-width-",value:k[h],dim:b.mobileContentWidthDim}};break;case"mobileContentWidthDim":T={mobileContentWidth:{classNamePrefix:"em-mob-width-",value:100,dim:k[h]}};break;case"mobileVerticalAlign":T={[h]:{classNamePrefix:"em-mob-vertical_align-",value:k[h]}};break;default:T=k}l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:T})};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_float_block_form",initialValues:{width:{value:"",dim:""},gap:{value:"",dim:"px"},valign:"",show:"all",mobileWidth:"",mobileWidthDim:"",mobileContentWidth:"",mobileContentWidthDim:"",mobileVerticalAlign:""},onValuesChange:x,autoComplete:"off",className:"element-controls",children:[f&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),a==="mobile"&&d.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:a==="mobile"&&d.styles?"block":"none"},children:(0,o.jsx)(ml,{form:s,elementSettings:e})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(ul,{form:s,elementSettings:e})})]})};pl.propTypes={elementSettings:g.default.object.isRequired};var hl=({form:e,fillFields:i,elementSettings:l,boxShadow:s,bordersShow:a,borderRadiusShow:d,boxShadowShow:c,backgroundShow:p,backgroundImageEmpty:f,backgroundRepeatOptions:x,paddingShow:k,paddingsExt:b,maxWidthValue:h,oneBorderRadiusValue:T,setOneBorderRadiusValue:_,linkProtocol:E,linkTarget:w,isOpenTextReplacer:v,textReplacerButtonRef:A,textReplacerInputRef:j,handleLinkProtocolsChange:C,handleSelect:P,textReplacerInputHandler:Y,handleTextReplacerKeyDown:z,srcButtonHandler:$,togglePaddingHandler:O,toggleShowPaddingHandler:y,toggleShowBackgroundHandler:oe,toggleShowBorderHandler:G,toggleShowBorderRadiusHandler:q,toggleShowBoxShadowHandler:te,setLinkProtocol:ue,handleChangeValues:me})=>{const{__:se}=r.useI18n(),{token:_e}=(0,t.ui_kit$useToken)(),ve=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:se("Appearance on mobile devices"),type:"info"}),(0,o.jsxs)("div",{className:"selected_form-props-wrapper",children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Uo,{form:e,elementSettings:l})}),ve.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(it,{form:e,name:"textAlign",elementSettings:l})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}}),(0,o.jsx)(et,{show:E==="#",__:se,style:{marginBottom:_e.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:se("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:ve.formButtonFieldReplacerEnabled?_e.formItemMarginBottomXS:_e.formItemMarginBottomMD+4},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Zo,{linkProtocol:E,handleLinkProtocolsChange:C,__:se}),placeholder:se("Hyperlink URL"),allowClear:!0,onSelect:P,prefix:(0,o.jsx)(Qo,{linkProtocol:E})})})}),E==="mailto:"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"subject",style:{marginBottom:_e.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:se("Subject")})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:_e.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:se("Body")})})]}),ve.formButtonFieldReplacerEnabled&&(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:se("Text replacer"),placement:"bottom",getPopupContainer:de=>de.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":v}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:$,ref:A})})}),(0,o.jsx)(t.ui_kit$Col,{span:21,children:v&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:se("Text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textReplacer",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:se("The code that will replace this text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:se("Text")}),onChange:Y,onKeyDown:z,ref:j,onSelect:P})})})})]})}),ve.formButtonFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:se("Padding"),collapsible:!0,open:k,onToggle:y,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:b,onToggleExtended:O,gutter:_e.marginSM,labels:{horizontal:se("Horizontal padding"),vertical:se("Vertical padding"),left:se("Left padding"),right:se("Right padding"),top:se("Top padding"),bottom:se("Bottom padding"),individual:se("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:se("Size"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:h,dimensionSelect:$o,gutter:_e.marginSM,labels:{width:se("Width"),height:se("Height"),minWidth:se("Minimum width"),maxWidth:se("Maximum width")}})}),(0,o.jsx)(gt,{form:e,fillFields:i,elementSettings:l,showAddParagraph:!1,isButton:!0,setLinkProtocol:ue,linkProtocol:E,linkTarget:w}),(0,o.jsxs)(t.ui_kit$FormSection,{title:se("Background"),collapsible:!0,open:p,onToggle:oe,dividerTop:!0,children:[(0,o.jsx)(vi,{form:e,backgroundImageEmpty:f,appConfig:ve,token:_e,elementSettings:l,backgroundRepeatOptions:x,handleChangeValues:me}),(0,o.jsx)(rt,{form:e,showBackground:!0})]}),ve.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:se("Borders"),collapsible:!0,open:a,onToggle:G,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:l})}),ve.formFieldBorderRadiusEnabled&&(0,o.jsxs)(t.ui_kit$FormSection,{title:se("Border radius"),collapsible:!0,open:d,onToggle:q,dividerTop:!0,children:[(0,o.jsx)(So,{form:e,oneBorderRadiusValue:T,setOneBorderRadiusValue:_,elementSettings:l}),(0,o.jsx)(rt,{form:e,showRounding:!0})]}),ve.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:se("Box shadow"),collapsible:!0,open:c,onToggle:te,dividerTop:!0,children:(0,o.jsx)(jo,{})}),ve.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:se("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:l,form:e})}),ve.formFieldAmpVisibilityEnabled&&l.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:se("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})]})};hl.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,backgroundShow:g.default.bool,backgroundImageEmpty:g.default.bool,backgroundRepeatOptions:g.default.array,paddingShow:g.default.bool,paddingsExt:g.default.bool,maxWidthValue:g.default.oneOfType([g.default.string,g.default.number]),oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,linkProtocol:g.default.string,linkTarget:g.default.object,isOpenTextReplacer:g.default.bool,textReplacerButtonRef:g.default.object,textReplacerInputRef:g.default.object,handleLinkProtocolsChange:g.default.func,handleSelect:g.default.func,textReplacerInputHandler:g.default.func,handleTextReplacerKeyDown:g.default.func,srcButtonHandler:g.default.func,togglePaddingHandler:g.default.func,toggleShowPaddingHandler:g.default.func,toggleShowBackgroundHandler:g.default.func,toggleShowBorderHandler:g.default.func,toggleShowBorderRadiusHandler:g.default.func,toggleShowBoxShadowHandler:g.default.func,setLinkProtocol:g.default.func,handleChangeValues:g.default.func};var bl=({form:e,fillFields:i,elementSettings:l,boxShadow:s,mobileBordersShow:a,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:p,mobileBackgroundShow:f,mobilePaddingShow:x,mobilePaddingsExt:k,setMobilePaddingsExt:b,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:T,linkProtocol:_,handleLinkProtocolsChange:E,setLinkProtocol:w,toggleShowMobileBorderHandler:v,toggleShowMobileBorderRadiusHandler:A,toggleShowMobileBoxShadowHandler:j,toggleShowMobileSizeHandler:C,toggleShowMobileBackgroundHandler:P,toggleShowMobilePaddingHandler:Y})=>{const{__:z}=r.useI18n(),{token:$}=(0,t.ui_kit$useToken)(),O=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Uo,{form:e,elementSettings:l,imgParent:!0,typeOfForm:"mobile"})}),O.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Dt,{form:e,name:"mobileTextAlign",elementSettings:l,imgParent:!0})})]}),!!l.showOnMobile&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}}),(0,o.jsx)(et,{show:_==="#",__:z,style:{marginBottom:$.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:z("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:_==="mailto:"?$.formItemMarginBottomXS:$.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Zo,{linkProtocol:_,handleLinkProtocolsChange:E,__:z}),placeholder:z("Hyperlink URL"),allowClear:!0,prefix:(0,o.jsx)(Qo,{linkProtocol:_})})})}),_==="mailto:"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"subject",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:z("Subject")})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:$.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:z("Body")})})]})]}),!!l.showOnMobile&&(0,o.jsx)(gt,{form:e,fillFields:i,elementSettings:l,setLinkProtocol:w,linkProtocol:_,showAddParagraph:!1,isButton:!0}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Mr,{})})}),O.formButtonFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:z("Padding"),collapsible:!0,open:x,onToggle:Y,dividerTop:!0,children:(0,o.jsx)(Wt,{form:e,elementSettings:l,mobilePaddingsExt:k,setMobilePaddingsExt:b})}),(0,o.jsx)(t.ui_kit$FormSection,{title:z("Size"),collapsible:!0,open:p,onToggle:C,dividerTop:!0,bodyStyle:{paddingBottom:$.formItemMarginBottomMD},children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:z("Width"),placement:"bottom",children:(0,o.jsx)(zo,{form:e,name:"mobileWidth",elementSettings:l})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:z("Height"),placement:"bottom",children:(0,o.jsx)(tt,{form:e,name:"mobileHeight",elementSettings:l})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:z("Background"),collapsible:!0,open:f,onToggle:P,dividerTop:!0,bodyStyle:{paddingBottom:$.formItemMarginBottomMD},children:(0,o.jsx)(Bt,{elementSettings:Go(l),imageEnabled:O.formButtonFieldBackgroundImageEnabled,desktopBackground:xt(l)})}),O.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:z("Borders"),collapsible:!0,open:a,onToggle:v,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),O.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:z("Border radius"),collapsible:!0,open:d,onToggle:A,dividerTop:!0,children:(0,o.jsx)(So,{form:e,oneBorderRadiusValue:h,setOneBorderRadiusValue:T,elementSettings:l,typeOfForm:"mobile"})}),O.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:z("Box shadow"),collapsible:!0,open:c,onToggle:j,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile"})}),O.formFieldAmpVisibilityEnabled&&l.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:z("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})}),O.formFieldAmpVisibilityEnabled&&l.isAmp&&(0,o.jsx)(t.ui_kit$FormSection,{title:z("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Io,{})})]})};bl.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,boxShadow:g.default.object,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,mobilePaddingShow:g.default.bool,mobilePaddingsExt:g.default.bool,setMobilePaddingsExt:g.default.func,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,linkProtocol:g.default.string,handleLinkProtocolsChange:g.default.func,setLinkProtocol:g.default.func,toggleShowMobileBorderHandler:g.default.func,toggleShowMobileBorderRadiusHandler:g.default.func,toggleShowMobileBoxShadowHandler:g.default.func,toggleShowMobileSizeHandler:g.default.func,toggleShowMobileBackgroundHandler:g.default.func,toggleShowMobilePaddingHandler:g.default.func};var Pn=Object.freeze({}),fl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),a=Fo(),d=Fo(),c=r.useDispatch(),[p,f]=(0,n.useState)({}),[x,k]=(0,n.useState)(!0),[b,h]=(0,n.useState)(!0),T=r.useSelector(r.selectEmailViewType),_=r.useSelector(r.selectMobileViewActive),[E,w]=(0,n.useState)(e.backgroundImage?.[0].value===""),v=r.useSelector(r.selectIsCodeMode),A=r.useSelector(r.selectCodeModeDirection),j=v&&A!=="bottom",C=(0,n.useRef)(null),P=(0,n.useRef)(null),[Y,z]=(0,n.useState)(!1),[$,O]=(0,n.useState)(!1),[y,oe]=(0,n.useState)(!1),[G,q]=(0,n.useState)(!1),[te,ue]=(0,n.useState)(!1),[me,se]=(0,n.useState)(!1),[_e,ve]=(0,n.useState)(!1),[de,De]=(0,n.useState)(!1),[ye,re]=(0,n.useState)(!1),[ke,ae]=(0,n.useState)(!1),[Q,be]=(0,n.useState)(!1),[pe,ee]=(0,n.useState)(!1),[J,U]=(0,n.useState)(!1),[X,ce]=(0,n.useState)(""),[xe,ne]=(0,n.useState)("https://"),[Ae,we]=(0,n.useState)({}),$e=e,[K,ie]=(0,n.useState)(!!$e.textReplacer?.length),[je,V]=(0,n.useState)(e);e!==je&&(V(e),ie(!!$e.textReplacer?.length));const Se=r.useElementEntityKind(),Ie=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],Ne=e.border,Fe=e.mobileBorder,Ve=Object.keys(Ne).find(S=>Ne[S]?.width||Ne[S]?.style||Ne[S]?.color),Ue=Object.keys(Fe).find(S=>Fe[S]?.width||Fe[S]?.style||Fe[S]?.color),le=S=>S&&(S?.width||S?.style||S?.color)?S:"",{remember:Te,fillFields:I}=st(e);(0,n.useEffect)(()=>{if(e){const S=e.boxShadow||Pn,m=e.mobilePadding||{},M=e.mobileAlign||{};f(S);let H="",Re="",fe=e.href||"https://";if(e.href){if(e.href.startsWith("mailto:")){const so=Pr(e.href);H=so.subject,Re=so.body,fe=so.baseEmail}Wo(e.href,ne)}I(s,{...e,href:fe,subject:H,body:Re,width:e.width?.value,widthDim:e.width?.dim,height:e.height?.value,heightDim:e.height?.dim,backgroundImage:e.backgroundImage?.[0].value,show:e.show?e.show:"all",textAlign:e.textAlign,borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),mobileBorderAll:le(e.mobileBorder.all)||!(le(e.mobileBorder.top)||le(e.mobileBorder.bottom)||le(e.mobileBorder.right)||le(e.mobileBorder.left))&&le(e.border.all),mobileBorderTop:le(e.mobileBorder.top)||!le(e.mobileBorder.all)&&le(e.border.top),mobileBorderBottom:le(e.mobileBorder.bottom)||!le(e.mobileBorder.all)&&le(e.border.bottom),mobileBorderRight:le(e.mobileBorder.right)||!le(e.mobileBorder.all)&&le(e.border.right),mobileBorderLeft:le(e.mobileBorder.left)||!le(e.mobileBorder.all)&&le(e.border.left),paddingTop:u(e.padding?.all)||u(e.padding?.top),paddingLeft:u(e.padding?.all)||u(e.padding?.left),paddingRight:u(e.padding?.all)||u(e.padding?.right),paddingBottom:u(e.padding?.all)||u(e.padding?.bottom),paddingLeftRight:u(e.padding?.left)||u(e.padding?.right),paddingTopBottom:u(e.padding?.top)||u(e.padding?.bottom),borderRadiusAll:u(e.borderRadius?.all),borderRadiusTopLeft:u(e.borderRadius?.topLeft),borderRadiusBottomLeft:u(e.borderRadius?.bottomLeft),borderRadiusTopRight:u(e.borderRadius?.topRight),borderRadiusBottomRight:u(e.borderRadius?.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:po(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:po(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:po(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:po(e.mobileHeight?.value)?e.mobileHeight?.dim:e.height?.dim,mobileBorderRadiusAll:u(e.mobileBorderRadius?.all)||u(e.borderRadius?.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius?.topLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topLeft)||u(e.borderRadius?.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius?.bottomLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomLeft)||u(e.borderRadius?.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius?.topRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topRight)||u(e.borderRadius?.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius?.bottomRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomRight)||u(e.borderRadius?.all),mobileBoxShadowInset:e.mobileBoxShadow?.inset!=null?e.mobileBoxShadow.inset:e.boxShadow?.inset||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset)||u(e.boxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset)||u(e.boxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius)||u(e.boxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius)||u(e.boxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color)||u(e.boxShadow?.color),mobileAlign:u(M?.value)||e.align,mobileVerticalAlign:u(e.mobileVerticalAlign?.value||e.valign),mobileBackgroundColor:u(e.mobileBackgroundColor?.value||e.backgroundColor||""),...nt(e),mobilePaddingTop:u(m.all)||u(m.top)||u(e.padding?.all)||u(e.padding?.top),mobilePaddingLeft:u(m.all)||u(m.left)||u(e.padding?.all)||u(e.padding?.left),mobilePaddingRight:u(m.all)||u(m.right)||u(e.padding?.all)||u(e.padding?.right),mobilePaddingBottom:u(m.all)||u(m.bottom)||u(e.padding?.all)||u(e.padding?.bottom),mobilePaddingTopBottom:u(m.top)||u(m.bottom)||u(e.padding?.top)||u(e.padding?.bottom),mobilePaddingLeftRight:u(m.left)||u(m.right)||u(e.padding?.left)||u(e.padding?.right),mobileTextAlign:Ar(e.mobileTextAlign,e.textAlign),exportAsPicture:e?.exportAsPicture,mobileFontSize:u(e.mobileFontSize?.value||e.fontSize)}),!u(e.borderRadius?.all)&&(u(e.borderRadius?.topLeft)||u(e.borderRadius?.bottomLeft)||u(e.borderRadius?.topRight)||u(e.borderRadius?.bottomRight))?k(!1):k(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||!u(e.borderRadius.all)&&!u(e.mobileBorderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?h(!1):h(!0),w(e.backgroundImage?.[0].value===""),!u(e.padding?.all)&&(u(e.padding?.top)||u(e.padding?.right)||u(e.padding?.bottom)||u(e.padding?.left))&&(e.padding?.top!==e.padding?.bottom||e.padding?.right!==e.padding?.left)?z(!1):z(!0),!u(m.all)&&(u(m.top)||u(m.right)||u(m.bottom)||u(m.left))&&(m.top!==m.bottom||m.right!==m.left)||!u(e.padding?.all)&&(u(e.padding?.top)||u(e.padding?.right)||u(e.padding?.bottom)||u(e.padding?.left))&&(e.padding?.top!==e.padding?.bottom||e.padding?.right!==e.padding?.left)?O(!1):O(!0);const ze=a.isStaleBorderSnapshot(e,!!Ve),co=d.isStaleBorderSnapshot(e,!!Ue);ze&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(co||ze&&!Ue)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),oe(so=>Ve&&!ze?!0:so),q(so=>Ve&&!ze||Ue&&!co?!0:so),ue(!!e.borderRadius?.all||!!e.borderRadius?.topLeft||!!e.borderRadius?.bottomLeft||!!e.borderRadius?.topRight||!!e.borderRadius?.bottomRight),se(!!e.mobileBorderRadius?.all||!!e.mobileBorderRadius?.topLeft||!!e.mobileBorderRadius?.bottomLeft||!!e.mobileBorderRadius?.topRight||!!e.mobileBorderRadius?.bottomRight||!!e.borderRadius?.all||!!e.borderRadius?.topLeft||!!e.borderRadius?.bottomLeft||!!e.borderRadius?.topRight||!!e.borderRadius?.bottomRight),ve(!!e.boxShadow),De(!!e.mobileBoxShadow?.blurRadius||!!e.mobileBoxShadow?.color||!!e.mobileBoxShadow?.hOffset||!!e.mobileBoxShadow?.inset||!!e.mobileBoxShadow?.spreadRadius||!!e.mobileBoxShadow?.vOffset||!!e.boxShadow),re(!!e.mobileWidth?.value||!!e.mobileHeight?.value||!!e.width.value||!!e.height.value),ae(!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),be(!!e.mobileBackgroundColor?.value||!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),kt(e)&&be(!0),ee(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),U(!!e.mobilePadding?.all||!!e.mobilePadding?.top||!!e.mobilePadding?.bottom||!!e.mobilePadding?.left||!!e.mobilePadding?.right||!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right)}},[s,e,j,Ve,Ue,a,d,I]);const Z=(0,n.useCallback)(S=>{Te(S),c(Se==="email"?r.setElementSettings$1(S):r.setElementSettings(S))},[c,Se,Te]),Be=S=>{const m=s.getFieldsValue(!0),M=Object.keys(S)[0];let H;switch(ce(s.getFieldsValue(!0).widthDim==="%"?100:""),M){case"exportAsPicture":H={exportAsPicture:m.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":H={boxShadow:{hOffset:m.boxShadowHOffset,vOffset:m.boxShadowVOffset,blurRadius:m.boxShadowBlurRadius,spreadRadius:m.boxShadowSpreadRadius,color:m.boxShadowColor,inset:m.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":m.borderPosition==="borderAll"?(H={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...m.borderAll}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):m.borderAll?.width||m.borderAll?.style||m.borderAll?.color?(H={border:{all:null,left:m.borderAll,right:m.borderAll,top:m.borderAll,bottom:m.borderAll,[W.REVERSE_BORDER_POSITIONS[M]]:{...m[M],...S[M]}}},s.setFieldsValue({borderAll:null,borderLeft:m.borderAll,borderRight:m.borderAll,borderTop:m.borderAll,borderBottom:m.borderAll,[M]:{...m[M],...S[M]}})):(H={border:{all:null,left:m.borderLeft,right:m.borderRight,top:m.borderTop,bottom:m.borderBottom,[W.REVERSE_BORDER_POSITIONS[M]]:{...m[M],...S[M]}}},s.setFieldsValue({border:H.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(m.mobileBorderPosition==="mobileBorderAll")H={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...m.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[M]+"-"}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const ze=W.MOBILE_REVERSE_BORDER_POSITIONS[M],co={...m[M],...S[M]},so=!co?.width&&!co?.style&&!co?.color;if(m.mobileBorder?.all?.width||m.mobileBorder?.all?.style||m.mobileBorder?.all?.color){const mo=m.mobileBorderAll;H={mobileBorder:{all:null,left:mo,right:mo,top:mo,bottom:mo,[ze]:so?null:{...co,classNamePrefix:"em-mob-border_"+ze+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:mo,mobileBorderRight:mo,mobileBorderTop:mo,mobileBorderBottom:mo,[M]:co})}else{const mo=e.mobileBorder||{},ko=qo=>{const Co=mo[qo];return Co&&(Co?.width||Co?.style||Co?.color)?Co:null};H={mobileBorder:{all:null,left:ze==="left"?so?null:{...co,classNamePrefix:"em-mob-border_left-"}:ko("left"),right:ze==="right"?so?null:{...co,classNamePrefix:"em-mob-border_right-"}:ko("right"),top:ze==="top"?so?null:{...co,classNamePrefix:"em-mob-border_top-"}:ko("top"),bottom:ze==="bottom"?so?null:{...co,classNamePrefix:"em-mob-border_bottom-"}:ko("bottom")}},s.setFieldsValue({[M]:co})}}break;case"width":H={[M]:{value:S[M],dim:m.widthDim}};break;case"height":H={[M]:{value:S[M],dim:m.heightDim}};break;case"widthDim":H={width:{value:m.width,dim:S[M]}};break;case"heightDim":H={height:{value:m.height,dim:S[M]}};break;case"backgroundImage":w(S[M]===""),H={[M]:[{...e.backgroundImage[0],value:S[M]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":H={padding:{left:m.paddingLeft,right:m.paddingRight,top:m.paddingTop,bottom:m.paddingBottom,[W.PADDING_POSITION[M]]:+S[M]}};break;case"paddingTopBottom":H={padding:{left:m.paddingLeft,right:m.paddingRight,top:+S[M],bottom:+S[M]}},m.paddingTop=m.paddingBottom=+S[M];break;case"paddingLeftRight":H={padding:{top:m.paddingTop,bottom:m.paddingBottom,left:+S[M],right:+S[M]}},m.paddingLeft=m.paddingRight=+S[M];break;case"borderRadiusAll":H={borderRadius:{[W.BORDER_RADIUS_POSITION[M]]:+S[M]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":H={borderRadius:{topLeft:m.borderRadiusTopLeft,bottomLeft:m.borderRadiusBottomLeft,topRight:m.borderRadiusTopRight,bottomRight:m.borderRadiusBottomRight,[W.BORDER_RADIUS_POSITION[M]]:+S[M]}};break;case"mobileWidth":H={[M]:{classNamePrefix:"em-mob-width-",value:S[M],dim:m.mobileWidthDim}};break;case"mobileWidthDim":H={mobileWidth:{classNamePrefix:"em-mob-width-",value:m.mobileWidth||100,dim:S[M]}};break;case"mobileHeight":H={[M]:{classNamePrefix:"em-mob-height-",value:S[M],dim:m.mobileHeightDim},mobileLineHeight:{classNamePrefix:"em-mob-line_height-",value:S[M],dim:m.mobileHeightDim}};break;case"mobileHeightDim":H={mobileHeight:{classNamePrefix:"em-mob-height-",value:m.mobileHeight,dim:S[M]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":H={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[M]]:S[M],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[M]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":H={mobileBoxShadow:{hOffset:m.mobileBoxShadowHOffset,vOffset:m.mobileBoxShadowVOffset,blurRadius:m.mobileBoxShadowBlurRadius,spreadRadius:m.mobileBoxShadowSpreadRadius,color:m.mobileBoxShadowColor,inset:m.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":H={[M]:{classNamePrefix:"em-mob-table_align-",value:S[M]}};break;case"mobileTextAlign":H={[M]:{classNamePrefix:"em-mob-text_align-",value:S[M]}};break;case"mobileVerticalAlign":H={[M]:{classNamePrefix:"em-mob-vertical_align-",value:S[M]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(H=_t(S),!H)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":H={mobilePadding:{all:null,top:m.mobilePaddingTop!==""?m.mobilePaddingTop:null,right:m.mobilePaddingRight!==""?m.mobilePaddingRight:null,bottom:m.mobilePaddingBottom!==""?m.mobilePaddingBottom:null,left:m.mobilePaddingLeft!==""?m.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":m.mobilePaddingTop=m.mobilePaddingBottom=S[M],H={mobilePadding:{all:null,top:m.mobilePaddingTop!==""?m.mobilePaddingTop:null,right:m.mobilePaddingRight!==""?m.mobilePaddingRight:null,bottom:m.mobilePaddingBottom!==""?m.mobilePaddingBottom:null,left:m.mobilePaddingLeft!==""?m.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":m.mobilePaddingLeft=m.mobilePaddingRight=S[M],H={mobilePadding:{all:null,top:m.mobilePaddingTop!==""?m.mobilePaddingTop:null,right:m.mobilePaddingRight!==""?m.mobilePaddingRight:null,bottom:m.mobilePaddingBottom!==""?m.mobilePaddingBottom:null,left:m.mobilePaddingLeft!==""?m.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileFontSize":H={[M]:{classNamePrefix:"em-mob-font_size-",value:S[M],dim:m.mobileFontSizeDim}};break;case"href":let Re=ot(S[M]);Re!==S[M]&&(s.setFieldValue("href",Re),m.href=Re),Re.startsWith("mailto:")?H={[M]:Si(Re,m.subject,m.body)}:H={[M]:Re},Wo(S[M],ne);break;case"subject":case"body":const fe=m.href||"";if(fe.startsWith("mailto:")){const ze=M==="subject"?S[M]:m.subject,co=M==="body"?S[M]:m.body;H={href:Si(fe,ze,co)}}else return;break;case"backgroundPositionX":case"backgroundPositionY":H={[M]:isNaN(parseFloat(S[M].position))?S[M].position:S[M].position+S[M].unit};break;default:H=S}M!=="borderPosition"&&M!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:H}),M!=="mobileBorderRadiusAll"&&M!=="mobileBorderRadiusTopLeft"&&M!=="mobileBorderRadiusTopRight"&&M!=="mobileBorderRadiusBottomLeft"&&M!=="mobileBorderRadiusBottomRight"&&Z({...e,...H,mobileBorderRadius:{...e.mobileBorderRadius,...H?.mobileBorderRadius},activateSection:null,changeKey:M}))},Ce=()=>{z(m=>!m);const S=s.getFieldsValue(!0);Y||(S.paddingLeftRight=S.paddingLeft,S.paddingTopBottom=S.paddingTop,S.paddingRight=S.paddingLeft,S.paddingBottom=S.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:S.paddingTopBottom,bottom:S.paddingTopBottom,left:S.paddingLeftRight,right:S.paddingLeftRight}}}))},Me=()=>{const S=s.getFieldsValue(!0);a.markBorderToggled(!y),setTimeout(()=>{oe(m=>!m),y?(S.borderAll=W.NULL_BORDER,S.borderTop=W.NULL_BORDER,S.borderBottom=W.NULL_BORDER,S.borderRight=W.NULL_BORDER,S.borderLeft=W.NULL_BORDER):S.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:S.borderAll.color,style:S.borderAll.style,width:S.borderAll.width}}}})})},Ge=()=>{const S=s.getFieldsValue(!0);d.markBorderToggled(!G),setTimeout(()=>{q(m=>!m),G?(S.mobileBorderAll=W.NULL_BORDER,S.mobileBorderTop=W.NULL_BORDER,S.mobileBorderBottom=W.NULL_BORDER,S.mobileBorderRight=W.NULL_BORDER,S.mobileBorderLeft=W.NULL_BORDER):S.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:S.mobileBorderAll.color,style:S.mobileBorderAll.style,width:S.mobileBorderAll.width}}}})})},Ye=()=>{const S=s.getFieldsValue(!0);setTimeout(()=>{ue(m=>!m),te?(S.borderRadiusAll=0,k(!0)):S.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:S.borderRadiusAll}}})})},D=()=>{const S=s.getFieldsValue(!0);setTimeout(()=>{se(m=>!m),me?(S.mobileBorderRadiusAll=null,h(!0)):S.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:S.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},L=()=>{const S=s.getFieldsValue(!0);setTimeout(()=>{ve(m=>!m),_e?(S.boxShadowInset=!1,S.boxShadowHOffset=null,S.boxShadowVOffset=null,S.boxShadowBlurRadius=null,S.boxShadowSpreadRadius=null,S.boxShadowColor=""):(S.boxShadowInset=!1,S.boxShadowHOffset=5,S.boxShadowVOffset=5,S.boxShadowBlurRadius=10,S.boxShadowSpreadRadius=-5,S.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:S.boxShadowBlurRadius,color:S.boxShadowColor,hOffset:S.boxShadowHOffset,inset:S.boxShadowInset,spreadRadius:S.boxShadowSpreadRadius,vOffset:S.boxShadowVOffset}}})})},R=()=>{const S=s.getFieldsValue(!0);setTimeout(()=>{De(m=>!m),de?(S.mobileBoxShadowInset=!1,S.mobileBoxShadowHOffset=null,S.mobileBoxShadowVOffset=null,S.mobileBoxShadowBlurRadius=null,S.mobileBoxShadowSpreadRadius=null,S.mobileBoxShadowColor=""):(S.mobileBoxShadowInset=!1,S.mobileBoxShadowHOffset=5,S.mobileBoxShadowVOffset=5,S.mobileBoxShadowBlurRadius=10,S.mobileBoxShadowSpreadRadius=-5,S.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:S.mobileBoxShadowBlurRadius,color:S.mobileBoxShadowColor,hOffset:S.mobileBoxShadowHOffset,inset:S.mobileBoxShadowInset,spreadRadius:S.mobileBoxShadowSpreadRadius,vOffset:S.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},F=()=>{const S=s.getFieldsValue(!0);setTimeout(()=>{re(m=>!m),ye&&(S.mobileWidth="",S.mobileHeight="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"},mobileHeight:{value:null,dim:"px",classNamePrefix:"em-mob-height-"}}}))})},he=()=>{const S=s.getFieldsValue(!0);setTimeout(()=>{ae(m=>!m),ke?(S.backgroundColor="",S.backgroundImage="",S.backgroundPositionX="",S.backgroundPositionY="",S.backgroundRepeat="none",S.backgroundSize="",w(!0)):(S.backgroundColor="#E5E5E5",S.backgroundSize="",S.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:S.backgroundColor,backgroundImage:[{type:"url",value:S.backgroundImage}],backgroundPositionX:S.backgroundPositionX,backgroundPositionY:S.backgroundPositionY,backgroundRepeat:S.backgroundRepeat,backgroundSize:S.backgroundSize}})})},Le=()=>{const S=s.getFieldsValue(!0);setTimeout(()=>{be(m=>!m),Q?S.mobileBackgroundColor="":S.mobileBackgroundColor=e.commonStyles.buttons.backgroundColor||"#1C52DC",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:S.mobileBackgroundColor}}}),Q&&Et(s,e,l)})},eo=()=>{const S=s.getFieldsValue(!0);setTimeout(()=>{ee(m=>!m),pe&&(S.paddingLeftRight="",S.paddingLeft="",S.paddingRight="",S.paddingTopBottom="",S.paddingTop="",S.paddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},Xe=()=>{const S=s.getFieldsValue(!0);setTimeout(()=>{U(m=>!m),J&&(S.mobilePaddingLeftRight="",S.mobilePaddingLeft="",S.mobilePaddingRight="",S.mobilePaddingTopBottom="",S.mobilePaddingTop="",S.mobilePaddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobilePadding:{all:null,top:null,right:null,bottom:null,left:null,classNamePrefix:"em-mob-padding_"}}}))})},lo=S=>{s.setFieldValue("href",S!=="mergetag"?S:""),ne(S)},Qe=(0,n.useCallback)(({target:S})=>{if(!S)return;const{selectionStart:m,selectionEnd:M}=S;we(H=>H.target===S&&H.selection?.start===m&&H.selection?.end===M?H:{target:S,selection:{start:m,end:M}})},[]),uo=S=>{S.target.value!==""&&P.current.classList.add("selected-td-form__button--active")},Eo=()=>{ie(!K),K?(s.setFieldValue("textReplacer",""),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{textReplacer:""}})):setTimeout(()=>C.current.focus())},B=S=>{const m=S.target,M=m.value,H=m.selectionStart;if(H===0&&S.key===" "){S.preventDefault();return}if(S.key===" "){if(H!==M.length){S.preventDefault();return}M.endsWith(" ")&&S.preventDefault()}};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_button_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",align:"",valign:"",border:"",boxShadow:"",show:"all",borderPosition:W.BORDER_POSITIONS[Ve]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[Ue]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileAlign:"",mobileVerticalAlign:"",mobileBackgroundColor:"",mobileBackgroundImage:"",mobilePaddingTop:"",mobilePaddingLeft:"",mobilePaddingRight:"",mobilePaddingBottom:"",borderRadiusTopLeft:"",borderRadiusBottomLeft:"",borderRadiusTopRight:"",borderRadiusBottomRight:"",href:"https://",subject:"",body:""},onValuesChange:Be,autoComplete:"off",className:"element-controls",children:[!j&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),j?(0,o.jsx)(Ri,{form:s,elementSettings:e,showAddParagraph:!1,isButton:!0}):(0,o.jsx)(o.Fragment,{children:T==="mobile"&&_.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(bl,{form:s,fillFields:I,elementSettings:e,boxShadow:p,mobileBordersShow:G,mobileBorderRadiusShow:me,mobileBoxShadowShow:de,mobileSizeShow:ye,mobileBackgroundShow:Q,mobilePaddingShow:J,mobilePaddingsExt:$,setMobilePaddingsExt:O,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:h,linkProtocol:xe,handleLinkProtocolsChange:lo,setLinkProtocol:ne,toggleShowMobileBorderHandler:Ge,toggleShowMobileBorderRadiusHandler:D,toggleShowMobileBoxShadowHandler:R,toggleShowMobileSizeHandler:F,toggleShowMobileBackgroundHandler:Le,toggleShowMobilePaddingHandler:Xe})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(hl,{form:s,fillFields:I,elementSettings:e,boxShadow:p,bordersShow:y,borderRadiusShow:te,boxShadowShow:_e,backgroundShow:ke,backgroundImageEmpty:E,backgroundRepeatOptions:Ie,paddingShow:pe,paddingsExt:Y,maxWidthValue:X,oneBorderRadiusValue:x,setOneBorderRadiusValue:k,linkProtocol:xe,linkTarget:Ae,isOpenTextReplacer:K,textReplacerButtonRef:P,textReplacerInputRef:C,handleLinkProtocolsChange:lo,handleSelect:Qe,textReplacerInputHandler:uo,handleTextReplacerKeyDown:B,srcButtonHandler:Eo,togglePaddingHandler:Ce,toggleShowPaddingHandler:eo,toggleShowBackgroundHandler:he,toggleShowBorderHandler:Me,toggleShowBorderRadiusHandler:Ye,toggleShowBoxShadowHandler:L,setLinkProtocol:ne,handleChangeValues:Be})})})]})};fl.propTypes={elementSettings:g.default.object.isRequired};var gl=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm(),s=r.useSendPostMessage();(0,n.useEffect)(()=>{e&&l.setFieldsValue({...e})},[l,e]);const a=d=>{s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:d})};return(0,o.jsx)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_variable_form",initialValues:{value:""},onValuesChange:a,autoComplete:"off",children:(0,o.jsx)(t.ui_kit$Form.Item,{label:i("Variable value"),name:"value",tooltip:{title:i("Type the output parameters of your platform. E.g., ")+"${Recipient.FirstName}",icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},style:{marginBottom:35},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:4,placeholder:i("Variable value")})})})};gl.propTypes={elementSettings:g.default.object.isRequired};var _l=({elementSettings:e,setElementSettings:i,postfix:l="",form:s,handleSelect:a,previewReloadSignal:d})=>{const{__:c}=r.useI18n(),{token:p}=(0,t.ui_kit$useToken)(),f=r.useAppConfig(),x=r.useSendPostMessage(),k="src"+l,b="title"+l,h="alt"+l,T="link"+l,_="imgReplacer"+l,E=(0,n.useRef)(null),w=(0,n.useRef)(null),v=(0,n.useRef)(null),A=(0,n.useRef)(null),j=(0,n.useRef)(null),C=(0,n.useRef)(null),P=(0,n.useRef)(null),Y=(0,n.useRef)(null),[z,$]=(0,n.useState)(""),[O,y]=(0,n.useState)(""),[oe,G]=(0,n.useState)(""),[q,te]=(0,n.useState)(!1),[ue,me]=(0,n.useState)("https://"),se=(0,n.useRef)(!1),_e=(0,n.useRef)(l);(0,n.useEffect)(()=>{l!==_e.current&&(_e.current=l,se.current=!1),y(e.images?.[h]),G(e.images?.[b]);const ee=e.images?.[T];$(ee||(se.current?"...":""))},[e,h,b,T,l]);const ve=()=>{z?(se.current=!1,$(""),s.setFieldValue(T,""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[T]:""}})):(se.current=!0,$(E.current&&E.current.input.value?E.current.input.value:"..."),setTimeout(()=>{E.current.focus()}))},de=ee=>{ee.target.value===""?$("..."):(w.current.classList.add("selected-td-form__button--active"),$(ee.target.value));const J=ee.target.value;Wo(J,me)},De=()=>{O?(y(""),s.setFieldValue("alt",""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[h]:""}})):(y(v.current&&v.current.input.value?v.current.input.value:"..."),setTimeout(()=>{v.current.focus()}))},ye=ee=>{ee.target.value===""?y("..."):(A.current.classList.add("selected-td-form__button--active"),y(ee.target.value))},re=()=>{oe?(G(!1),s.setFieldValue("title",""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[b]:""}})):(G(j.current&&j.current.input.value?j.current.input.value:"..."),setTimeout(()=>{j.current.focus()}))},ke=()=>{te(!q),q?(s.setFieldValue(_,""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[_]:""}})):setTimeout(()=>P.current.focus())},ae=ee=>{ee.target.value!==""&&Y.current.classList.add("selected-td-form__button--active")},Q=ee=>{ee.target.value===""?G("..."):(C.current.classList.add("selected-td-form__button--active"),G(ee.target.value))},be=ee=>{s.setFieldValue("LinkName",ee!=="mergetag"?ee:""),me(ee)},pe=ee=>{const J=s.getFieldsValue(!0),U=+l.substring(1),X=Object.keys(J?.images).reduce((xe,ne)=>(ne.includes(l)||(xe[ne]=J[ne]),xe),{}),ce=e.carouselImages?.filter((xe,ne)=>ne!==U);i(xe=>({...xe,settings:{...xe.settings,carouselImages:ce}})),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:e.caption,settings:{...e,carouselImages:ce}}),s.setFieldsValue({images:X})};return(0,o.jsxs)(o.Fragment,{children:[(e.type==="img"||e.type==="video"||e.type==="carousel")&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,o.jsx)(No,{form:s,label:c("Image path"),name:k,placeholder:c("Image path"),elementSettings:e,previewReloadSignal:d,tooltipTitle:""})}),(0,o.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:O||c("Alternative text"),placement:"bottom",getPopupContainer:ee=>ee.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":!!O}),onClick:De,ref:A,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),f.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:oe||c("Tooltip text"),placement:"bottom",getPopupContainer:ee=>ee.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":!!oe}),onClick:re,ref:C,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:z||c("Hyperlink URL"),placement:"bottom",getPopupContainer:ee=>ee.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":!!z}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:ve,ref:w})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:c("Image replacer"),placement:"bottom",getPopupContainer:ee=>ee.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":q}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:ke,ref:Y})})]}),(0,o.jsx)(t.ui_kit$Space,{size:8,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:c("Remove slide"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{type:"text",onClick:pe,icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16})})})})]}),(!!z||!!O||!!oe||!!q)&&(0,o.jsxs)("div",{children:[!!z&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(et,{show:ue==="#",__:c,style:{marginBottom:p.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:T,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Zo,{linkProtocol:ue,handleLinkProtocolsChange:be,__:c}),placeholder:c("Hyperlink URL"),allowClear:!0,ref:E,onChange:de,onSelect:a,prefix:(0,o.jsx)(Qo,{linkProtocol:ue})})})})]}),!!O&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:h,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:c("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:ye,ref:v,onSelect:a})})}),f.formFieldImageTitleEnabled&&!!oe&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:b,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:c("Enter the title of the image"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:Q,ref:j,onSelect:a})})}),!!q&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Image src"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:_,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:c("Code that will replace the image `src`"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:c("Image src")}),onChange:ae,ref:P,onSelect:a})})})]})]})};_l.propTypes={};var xl=({form:e,elementSettings:i,formFields:l,setElementSettings:s,borderRadiusShow:a,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,linkProtocol:p,mergeTagItems:f,mergeMenuOpen:x,setMergeMenuOpen:k,cascaderRef:b,handleLinkProtocolsChange:h,handleSelect:T,onChange:_,filter:E,renderSearchOption:w,toggleShowBorderRadiusHandler:v,setNewSlide:A})=>{const{__:j}=r.useI18n(),{token:C}=(0,t.ui_kit$useToken)(),P=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(et,{show:p==="#",__:j,style:{marginBottom:C.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:j("Link for all slides"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Zo,{linkProtocol:p,handleLinkProtocolsChange:h,__:j}),placeholder:j("Link for all slides"),allowClear:!0,onSelect:T,prefix:(0,o.jsx)(Qo,{linkProtocol:p})})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),P.mergeTagsShow&&f&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Col,{span:24,id:"merge_tags_wrapper",children:(0,o.jsxs)(t.ui_kit$Form.Item,{style:{marginBottom:C.formItemMarginBottomMD,marginTop:C.formItemMarginBottomMD},children:[(0,o.jsx)(t.ui_kit$Button,{id:"merge_tags_button",icon:(0,o.jsx)(r.EmIcons,{icon:"MergeTags",component:t.icons$MergeTags}),style:{width:"100%",display:x?"none":"inline-flex"},onClick:()=>k(!0),children:j("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:b,classNames:{popup:{root:"merge-tags"}},options:f,placeholder:j("Start typing the title"),showSearch:{filter:E,render:w},spellCheck:"false",getPopupContainer:Y=>Y.closest(".email-pane__collapse-wrapper"),onChange:_,style:{display:x?"block":"none"},open:x,onKeyDown:Y=>{Y.key==="Escape"&&k(!1)}})]})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"})]}),(0,o.jsx)(t.ui_kit$Form.List,{name:"images",initialValue:l?.images,children:()=>(0,o.jsx)("div",{style:{paddingTop:C.formItemMarginBottomMD+4},children:i?.settings?.carouselImages?.map((Y,z)=>(0,o.jsx)("div",{className:"carousel__slide",children:(0,o.jsx)(_l,{elementSettings:l,setElementSettings:s,postfix:"_"+z,form:e,handleSelect:T})},z))})}),(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:C.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Button,{id:"add_slide_button",icon:(0,o.jsx)(r.EmIcons,{icon:"AddSlide",component:t.icons$AddSlide}),style:{width:"100%"},onClick:()=>A(),children:j("Add slide")})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{marginTop:C.formItemMarginBottomMD-10},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"loop",valuePropName:"checked",style:{marginBottom:C.formItemMarginBottomMD-6},children:(0,o.jsx)(t.ui_kit$Switch,{id:"Loop",label:j("Loop"),size:"small",labelStyle:{position:"relative",top:2}})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"autoplay",valuePropName:"checked",style:{marginBottom:C.formItemMarginBottomMD-6},children:(0,o.jsx)(t.ui_kit$Switch,{id:"Autoplay",label:j("Autoplay"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),P.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Border radius"),collapsible:!0,open:a,onToggle:v,dividerTop:!0,children:(0,o.jsx)(So,{form:e,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,elementSettings:i.settings})})]})};xl.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,formFields:g.default.object,setElementSettings:g.default.func,borderRadiusShow:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,linkProtocol:g.default.string,mergeTagItems:g.default.array,mergeMenuOpen:g.default.bool,setMergeMenuOpen:g.default.func,cascaderRef:g.default.object,handleLinkProtocolsChange:g.default.func,handleSelect:g.default.func,onChange:g.default.func,filter:g.default.func,renderSearchOption:g.default.func,toggleShowBorderRadiusHandler:g.default.func,setNewSlide:g.default.func};var kl=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("p",{children:e("No properties to edit.")})})};kl.propTypes={};var El=2e3;function An(e){const i=(0,n.useRef)([]),l=(0,n.useRef)(e);return l.current=e,{remember:(0,n.useCallback)(s=>{const a=Date.now(),d=i.current.filter(c=>a-c.at<El);d.push({key:JSON.stringify(l.current(s)),at:a}),i.current=d.slice(-10)},[]),isOwnEcho:(0,n.useCallback)(s=>{if(!s)return!1;const a=Date.now(),d=JSON.stringify(l.current(s));return i.current.some(c=>a-c.at<El&&c.key===d)},[])}}function Nn(e,i){const l=`selected_${e}_form_images_`,s=i.startsWith(l)?l:`selected_${e}_form_`;return i.startsWith(s)?i.slice(s.length):i}function Ln(e){const i=/^(.+)_(\d+)$/.exec(e);return i?{key:i[1],index:Number(i[2])}:void 0}function On(e,i,l){return(e??[]).map((s,a)=>a===i.index?{...s,[i.key]:l}:s)}var $n={loop:!1,autoplay:!1,borderRadiusAll:0,borderRadiusTopLeft:0,borderRadiusBottomLeft:0,borderRadiusTopRight:0,borderRadiusBottomRight:0,link:"https://",images:{},src_0:"",renderedHeight_0:0,renderedWidth_0:0,imgReplacer_0:"",title_0:"",alt_0:""};function Fn(e){const i={...Ti(e)};return delete i.parent,delete i.path,i}var Bl=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm();let s=r.useDispatch();r.useAppConfig();const a=r.useSendPostMessageEx(),d=r.useSendPostMessage(),{openImagePicker:c}=r.useImagePicker(),p=r.useSelector(r.selectEmailViewType),f=r.useSelector(r.selectMobileViewActive),[x,k]=(0,n.useState)(!0),[b,h]=(0,n.useState)(!0),[T,_]=(0,n.useState)(!1),[E,w]=(0,n.useState)(!1),[v,A]=(0,n.useState)("https://"),[j,C]=(0,n.useState)(l?.getFieldsValue(!0)),[P,Y]=(0,n.useState)(e),{remember:z,isOwnEcho:$}=An(Fn),[O,y]=(0,n.useState)(e);e!==O&&(y(e),$(e?.settings)||Y(e));const[oe,G]=(0,n.useState)({name:"",counter:0}),[q,te]=(0,n.useState)(null),[ue,me]=(0,n.useState)(),[se,_e]=(0,n.useState)(!1),[ve,de]=(0,n.useState)(!1),[De,ye]=(0,n.useState)({start:0,end:0}),re=(0,n.useRef)(null),ke=`selected_${P.type}_form_link`,ae=r.useSelector(r.selectIsCodeMode),Q=r.useSelector(r.selectCodeModeDirection),be=ae&&Q!=="bottom";(0,n.useEffect)(()=>{se&&re.current&&re.current.focus()},[se]);const pe=(V,Se)=>{const Ie=document.getElementById(Se);if(Ie){const Ne=P,Fe=Nn(Ne.type,Se),Ve=Ln(Fe),Ue=Ie.value?.substring(0,De.start),le=Ie.value?.substring(De.end);let Te={[Fe]:Ue+V+le};Ve?Te={carouselImages:On(Ne.settings?.carouselImages,Ve,Ue+V+le)}:P.type===r.ELEMENT_TYPES.CAROUSEL&&ke===Se&&(Te={[Fe]:Ue+V+le,carouselImages:[...P.settings?.carouselImages.map(I=>({...I,link:Ue+V+le}))||[]]}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...P.settings,...Te}}),Y(I=>({...I,settings:{...I.settings,...Te}})),l.setFieldValue(Fe,Ue+V+le),Ie.focus(),setTimeout(()=>{Ie.selectionStart=De.start,Ie.selectionEnd=De.start+V.length},400),de(!0)}},ee=r.useAppConfig().mergeTags;(0,n.useEffect)(()=>{ee?.items?.length&&me(r.mapMargeTags(ee.items,i,(V,Se)=>{_e(!1),a(r.EVENT_TYPES.SANDBOX_ADD_MERGETAG,V),Se.stopPropagation(),Se.preventDefault()}))},[ee,me,i,_e,a]);const J=(V,Se)=>{if(_e(!1),V){const Ie=ee.syntax.length>1?ue.findIndex(Ve=>Ve.key===Se[0].key):0,Ne=ee.syntax[Ie].replace("%value%",V[V.length-1]),Fe=`selected_${P.type}_form${P.type==="carousel"?"_images":""}`;["imgReplacer","title","alt","src","link"].some(Ve=>q?.getAttribute("id").includes(`${Fe}_${Ve}`))||q?.getAttribute("id").includes(ke)?pe(Ne,q?.getAttribute("id")):(l.setFieldValue("imgReplacer",Ne),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...P.settings,imgReplacer:Ne}}),Y(Ve=>({...Ve,settings:{...Ve.settings,imgReplacer:Ne}})))}},U=r.useRootElement();(0,n.useEffect)(()=>{const V=({target:Ne})=>{Ne.closest('[id="merge_tags_wrapper"]')||te(Ne)},Se=({target:Ne})=>{!Ne.closest(".merge-tags")&&!Ne.closest("#merge_tags_button")&&_e(!1)},Ie=new xo.Disposable;return Ie.addDisposable(r.addWindowListenerFromShadow(U,"focusin",V)),Ie.addDisposable(r.addWindowListenerFromShadow(U,"click",Se)),()=>{Ie.dispose()}},[U]);const X=(V,Se)=>Se.some(Ie=>Ie.label.toLowerCase().indexOf(V.toLowerCase())>-1),ce=(V,Se)=>{const Ie=Se.map((Ne,Fe)=>{const Ve=Ne.label.split(new RegExp(`(${V})`,"gi"));return(0,o.jsxs)("span",{children:[Fe!==0&&(0,o.jsx)("span",{children:" / "}),Ve.map((Ue,le)=>Ue.toLowerCase()===V.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:Ue},le):Ue)]},Ne.value)});return(0,o.jsx)("div",{title:Se.map(Ne=>Ne.label).join(" / "),children:Ie})};(0,n.useEffect)(()=>{const V=l?.getFieldsValue(!0);C(V)},[l]);const xe=({target:V})=>{if(V&&!ve){const{selectionStart:Se,selectionEnd:Ie}=V;ye({start:Se,end:Ie})}de(!1)};(0,n.useEffect)(()=>{if(P.settings){const V=P.settings,Se=Ti(V);l?.setFieldsValue(Se),C(Se),V.link&&A(Mt(V.link,"https://")),u(V.borderRadius?.all)||(u(V.borderRadius?.topLeft)||u(V.borderRadius?.bottomLeft)||u(V.borderRadius?.topRight)||u(V.borderRadius?.bottomRight)?k(!1):u(V.borderRadius?.all)||k(!0)),u(V.mobileBorderRadius?.topLeft)||u(V.mobileBorderRadius?.bottomLeft)||u(V.mobileBorderRadius?.topRight)||u(V.mobileBorderRadius?.bottomRight)?h(!1):h(!0),_(!!V.borderRadius?.all||!!V.borderRadius?.topLeft||!!V.borderRadius?.bottomLeft||!!V.borderRadius?.topRight||!!V.borderRadius?.bottomRight),w(!!V.mobileBorderRadius?.all||!!V.mobileBorderRadius?.topLeft||!!V.mobileBorderRadius?.bottomLeft||!!V.mobileBorderRadius?.topRight||!!V.mobileBorderRadius?.bottomRight)}},[l,P]);const ne=V=>{const Se=Nr(P.settings,l,V);d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:Se.caption,settings:Se}),z({...P.settings,...Se}),Y(Ie=>({...Ie,settings:{...Ie.settings,...Se}}))},Ae=(V,Se)=>{const Ie=r.stripEmVersionFromUrlString(P.settings?.src||"")===r.stripEmVersionFromUrlString(V||"");(!Ie||V!==P.settings?.src)&&ne({src:V}),Se?.mode==="save"&&Ie&&(G(Ne=>({name:"src",counter:Ne.counter+1})),a(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(V)}))},we=async V=>{const Se=P.settings?.src||"",Ie=r.stripEmVersionFromUrlString(Se),Ne=await c({kind:"img",currentUrl:$t(Ie)?"":Ie,entryModal:V});Ne?.url&&Ae(Ne.url,Ne.meta)},$e=V=>{const Se=V.data.operation;Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_AI):Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK):Se===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(s(r.closeSecondModal()),s(r.closeModal$1()))};r.useListenPostMessage($e);const K=()=>{setTimeout(()=>{_(V=>!V),l.setFieldValue("borderRadiusAll",T?0:5),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...P.settings,borderRadius:{all:T?"":5}}}),Y(V=>({...V,settings:{...V.settings,borderRadius:{all:T?null:5}}}))})},ie=V=>{l.setFieldValue("link",V!=="mergetag"?V:""),A(V)},je=()=>{const{width:V,height:Se,renderedWidth:Ie,renderedHeight:Ne}=P?.settings?.carouselImages[0]||{width:{value:600},height:{value:600},renderedWidth:600,renderedHeight:600},Fe={src:"https://emcdn.ru/1865/231031_17_BGU9Mso.png",width:{value:V.value,dim:"px"},height:{value:Se.value,dim:"px"},alt:"",title:"",link:null,renderedWidth:Ie,renderedHeight:Ne,imgReplacer:"",mobileWidth:{value:null,dim:"px"},mobileHeight:{value:null,dim:"px"},mobileBorderRadius:{all:null,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}},Ve=[...P?.settings?.carouselImages,Fe];d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...P.settings,carouselImages:Ve}}),Y(Ue=>({...Ue,settings:{...Ue.settings,carouselImages:Ve}}))};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_carousel_form",initialValues:$n,onValuesChange:ne,autoComplete:"off",className:"element-controls",children:[!be&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),p==="mobile"&&f.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(kl,{})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(xl,{form:l,elementSettings:P,formFields:j,setElementSettings:Y,borderRadiusShow:T,oneBorderRadiusValue:x,setOneBorderRadiusValue:k,linkProtocol:v,mergeTagItems:ue,mergeMenuOpen:se,setMergeMenuOpen:_e,cascaderRef:re,handleLinkProtocolsChange:ie,handleSelect:xe,onChange:J,filter:X,renderSearchOption:ce,toggleShowBorderRadiusHandler:K,setNewSlide:je})})]})};Bl.propTypes={};var Mn={animate:!0,expandSingleSection:!0,sections:[{expanded:!1,index:0}]},Sl=({elementSettings:e})=>{const{__:i}=r.useI18n(),{token:l}=(0,t.ui_kit$useToken)(),[s]=t.ui_kit$Form.useForm(),a=r.useSendPostMessage(),d=r.useAppConfig(),[c,p]=(0,n.useState)(e),[f,x]=(0,n.useState)(e);e!==f&&(x(e),p(e)),(0,n.useEffect)(()=>{if(c.settings){const T=c.settings,_=Ti(T);s?.setFieldsValue(_)}},[s,c]);const k=T=>{const _=Nr(c.settings,s,T);a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:c.type,caption:_.caption,settings:_}),p(E=>({...E,settings:{...E.settings,..._}}))},b=()=>{p(T=>({...T,sections:c?.settings?.sections.push({expanded:!1})})),a({operation:r.EVENT_TYPES.SANDBOX_ACCORDION_ADD_SECTION,settings:{section:i("Section title"),text:i("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")}})},h=T=>{p(_=>({..._,settings:{..._.settings,sections:c.settings.sections?.filter((E,w)=>w!==T)}})),a({operation:r.EVENT_TYPES.SANDBOX_ACCORDION_REMOVE_SECTION,settings:{index:T}})};return(0,o.jsx)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_carousel_form",initialValues:Mn,onValuesChange:k,autoComplete:"off",className:"element-controls",children:(0,o.jsxs)("div",{id:"selected_element_form_desktop_props",children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,children:[(0,o.jsx)(t.ui_kit$Col,{span:15,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"expandSingleSection",valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:"ExpandSingleSection",label:i("Expand only one section"),size:"small",labelStyle:{position:"relative",top:2}})})}),(0,o.jsx)(t.ui_kit$Col,{span:9,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"animate",valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:"Animate",label:i("Animate"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,o.jsx)(t.ui_kit$Form.List,{name:"sections",children:()=>(0,o.jsx)("div",{style:{paddingTop:l.formItemMarginBottomMD+4},children:c?.settings?.sections?.map((T,_)=>(0,o.jsxs)(t.ui_kit$Row,{gutter:24,children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsxs)(t.ui_kit$Space,{size:10,align:"baseline",children:[(0,o.jsx)("span",{style:{position:"relative",top:2},children:i("Section ")+(_+1)}),(0,o.jsx)(t.ui_kit$Form.Item,{name:`expanded_${_}`,valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:`expanded_${_}`,label:i("expanded"),labelSize:"small",size:"small"})})]})}),(0,o.jsx)(t.ui_kit$Col,{children:c?.settings?.sections?.length>1&&(0,o.jsx)(t.ui_kit$Button,{type:"text",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16}),style:{marginRight:"auto"},onClick:()=>h(_)})})]},`expanded_${_}`))})}),(0,o.jsx)(t.ui_kit$Row,{gutter:20,children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:l.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Button,{style:{display:"inline-flex",alignItems:"center",width:"100%"},icon:(0,o.jsx)(r.EmIcons,{icon:"PlusCircleOutlined",component:t.icons$PlusCircleOutlined,size:16,strokeWidth:d.iconStrokeWidth}),onClick:()=>b(),children:i(" Add section")})})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"})]})})};Sl.propTypes={};var{Text:Dn}=t.ui_kit$Typography,Vn="blocks",Tl="text/plain",Hn=(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),Un=(0,o.jsx)("span",{className:"addon-text-content",children:"Title"});function Ao(e){return e.closest(".email-pane__collapse-wrapper")}function zt({form:e,name:i,placeholder:l,usedColors:s,onColorChange:a}){const d=t.ui_kit$Form.useWatch(i,e);return(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l,usedColors:s,value:typeof d=="string"?d:"",onChange:c=>a(i,c)})}var Wn=/^[a-z][a-z0-9+.-]*:/i;function Rl(e){const i=ot(typeof e=="string"?e:String(e??""));return i?Wn.test(i)?i:`https://${i}`:""}function zn(e){const i=typeof e=="string"?e.trim():String(e??"").trim();if(!i)return"";if(/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(i))return i;try{return new URL(i,typeof window<"u"&&window.location?window.location.origin:"http://localhost").href}catch{return i}}function Gn(e){const i=Rl(e);if(!i)return!1;try{const l=new URL(i);return!(l.protocol!=="http:"&&l.protocol!=="https:"||!l.hostname)}catch{return!1}}async function yl(e,i){if(i===r.MODALS.UPLOAD_IMAGE_MODAL_EDIT&&$t(e)){try{const l=new URL(e,typeof window<"u"&&window.location?window.location.origin:"http://localhost").href,s=await fetch(l);if(s.ok){const a=await s.blob();return{entryModal:i,currentUrl:"",imageDataUrl:await new Promise((d,c)=>{const p=new FileReader;p.onload=()=>d(p.result),p.onerror=c,p.readAsDataURL(a)})}}}catch{}return{entryModal:r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,currentUrl:""}}return{entryModal:i,currentUrl:e}}function Yn(){const e=r.useSelector(r.selectEditorThemeColor$1),[i,l]=(0,n.useState)(()=>typeof document<"u"&&document.body.classList.contains("dark"));return(0,n.useEffect)(()=>{const s=()=>l(document.body.classList.contains("dark"));s();const a=new MutationObserver(s);return a.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>a.disconnect()},[]),e==="vs-dark"||i?"dark":"light"}function Xn(e){const i=String(e?.bgColor??"").trim();return{blockBgEnabled:!!(e?.bgEnabled&&i),blockBgColor:i}}function Gt(e,i,l){return{...e,buttonBgColor:i,hostCellBgForIconLuminance:String(l??"").trim()}}function wl(e){const i=e?.settings||{};return JSON.stringify({type:e?.type??null,caption:e?.caption??null,parent:e?.parent??i.parent??null,path:i.path??null,blockIndex:i.blockIndex??null})}function jl(e){if(!Array.isArray(e)||e.length===0)return"";const i=e.map(s=>s.customIcon?"":String(s?.itemBorderColor??"").trim()),l=i[0];return i.every(s=>s===l)?l:""}function Yt(e,i){const l=String(e??"").trim(),s=String(i??"").trim();return s||l}function Kn(e,i){const l=String(e??"").trim(),s=String(i??"").trim();return!s||l&&s===l?"":s}function qn(e,i,l){const s=String(e??"").trim(),a=String(i??"").trim(),d=String(l??"").trim();return d&&(!s||d!==s)?d:a}function Jn(e,i){return(e||[]).map(l=>({...l,itemBorderColor:l.customIcon?"":i}))}function Qn(e,i,l){return(e||[]).map(s=>({...s,buttonBgColor:s.customIcon?"":qn(i,l,s.buttonBgColor)}))}function Zn(e,i){if(e==null)return;const l=(s,a)=>{if(!a||!Object.prototype.hasOwnProperty.call(a,"platform"))return;const d=a.platform;d==null||d===""||i(s,d)};if(Array.isArray(e))e.forEach((s,a)=>{l(a,s)});else if(typeof e=="object")for(const s of Object.keys(e)){const a=Number.parseInt(s,10);Number.isNaN(a)||l(a,e[s])}}function vl({__:e,form:i,fieldName:l,pushSettingsToIframe:s,onMetaActiveChange:a}){const{token:d}=(0,t.ui_kit$useToken)(),c=t.ui_kit$Form.useWatch(["items",l],i),p=c&&typeof c=="object"?c:{},f=typeof p.alt=="string"?p.alt:"",x=typeof p.title=="string"?p.title:"",[k,b]=(0,n.useState)(!1),[h,T]=(0,n.useState)(!1),_=(0,n.useRef)(null),E=(0,n.useRef)(null),w=(0,n.useMemo)(()=>({clearIcon:(0,o.jsx)(t.ui_kit$ColorPickerClearGlyph,{})}),[]);(0,n.useEffect)(()=>{f.trim()&&b(!0)},[f]);const v=!!(f.trim()||k),A=!!(x.trim()||h),j=v||A;(0,n.useLayoutEffect)(()=>{a(l,{alt:v,title:A})},[v,l,a,A]);const C=(0,n.useMemo)(()=>({marginBottom:j?d.formItemMarginBottomXS:0}),[j,d.formItemMarginBottomXS]),P=(0,n.useMemo)(()=>[l,"alt"],[l]),Y=(0,n.useMemo)(()=>[l,"title"],[l]),z=j?"selected-social-form__meta-fields":"selected-social-form__meta-fields is-hidden",$=v?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",O=A?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",y=(0,n.useMemo)(()=>f.trim()?f.trim():e("Alternative text"),[e,f]),oe=(0,n.useMemo)(()=>x.trim()?x.trim():e("Tooltip text"),[e,x]),G=(0,n.useMemo)(()=>(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":v}),[v]),q=(0,n.useMemo)(()=>(0,He.default)("selected-td-form__button",{"selected-td-form__button--active":A}),[A]),te=(0,n.useCallback)(se=>{setTimeout(()=>{const _e=se.current;if(_e){if(typeof _e.focus=="function"){_e.focus();return}_e.input&&typeof _e.input.focus=="function"&&_e.input.focus()}},0)},[]),ue=(0,n.useCallback)(()=>{v?(b(!1),f.trim()&&(i.setFieldValue(["items",l,"alt"],""),setTimeout(()=>s(),0))):(b(!0),te(_))},[v,f,l,te,i,s]),me=(0,n.useCallback)(()=>{if(A)a(l,{title:!1}),T(!1),x.trim()&&(i.setFieldValue(["items",l,"title"],""),setTimeout(()=>s(),0));else{T(!0),a(l,{title:!0});const se=f.trim();i.setFieldValue(["items",l,"title"],se),setTimeout(()=>s(),0),te(E)}},[f,l,te,i,a,s,A,x]);return(0,o.jsxs)("div",{className:"selected-social-form__meta-block",children:[(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected-social-form__meta-toggle-row",style:C,children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:y,placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Button,{type:"default",className:G,onClick:ue,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:oe,placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Button,{type:"default",className:q,onClick:me,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})})]}),(0,o.jsxs)("div",{className:z,children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:P,className:$,children:(0,o.jsx)(t.ui_kit$Input,{ref:_,placeholder:e("Alternative text"),allowClear:w,prefix:Hn})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:Y,className:O,children:(0,o.jsx)(t.ui_kit$Input,{ref:E,placeholder:e("Social network name"),allowClear:w,prefix:Un})})]})]})}vl.propTypes={__:g.default.func.isRequired,form:g.default.object.isRequired,fieldName:g.default.oneOfType([g.default.number,g.default.string]).isRequired,pushSettingsToIframe:g.default.func.isRequired,onMetaActiveChange:g.default.func.isRequired};function ed(e,i){if(!Array.isArray(e)||e.length===0)return i;let l=null;for(const s of e){const a=s.iconWidth;if(a==null||Number.isNaN(a)||a<=0)return i;if(l===null)l=a;else if(a!==l)return i}return l??i}function od(e){if(!e)return{align:"center",iconSize:40,borderRadius:0,gap:8,globalBgColor:"",globalItemBorderColor:"",buttonBorderWidth:0,showLabel:!1,items:[]};const i=Xn(e),l=String(e?.hostCellBgForIconLuminance??"").trim(),s=ed(e.items,e.iconSize??40),a=typeof e.buttonBorderWidth=="number"&&!Number.isNaN(e.buttonBorderWidth)?e.buttonBorderWidth:0,d=e.bgEnabled&&e.bgColor?String(e.bgColor).trim():"";return{align:e.align??"center",iconSize:s,borderRadius:e.borderRadius??0,gap:e.gap??8,globalBgColor:d,globalItemBorderColor:jl(e.items),buttonBorderWidth:a,showLabel:e.showLabel??!1,items:Array.isArray(e.items)?e.items.map(c=>{const p=!!c.customIcon,f=p?"":Yt(d,c.buttonBgColor),x=c.platform&&!p?r.getSocialIconForBlockCell(c.platform,Gt(i,f,l)):null;return{...c,customIcon:p,title:String(c.title??"").trim(),...x?{iconSrc:x}:{},iconWidth:null,iconHeight:null,buttonBgColor:f,itemBorderColor:p?"":String(c.itemBorderColor??"").trim()}}):[]}}var Il=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useAppConfig(),s=r.useDispatch(),[a]=t.ui_kit$Form.useForm(),d=r.useSendPostMessage(),c=r.useSendPostMessageEx(),{openImagePicker:p}=r.useImagePicker(),[f,x]=(0,n.useState)(e),[k,b]=(0,n.useState)(null),[h,T]=(0,n.useState)(null),_=(0,n.useRef)(null),E=(0,n.useRef)(null),w=(0,n.useRef)(null),v=(0,n.useRef)(wl(e)),A=r.useSelector(r.selectEmailSettings),j=(0,n.useRef)(null),C=(0,n.useRef)(!1),P=(0,n.useRef)(""),Y=(0,n.useRef)({}),z=Yn(),$=A?.usedColors??[],O=t.ui_kit$Form.useWatch("items",a)||[],y=(0,n.useCallback)(()=>{j.current&&(document.removeEventListener("dragover",j.current,!0),j.current=null)},[]),oe=(0,n.useCallback)(()=>{if(j.current)return;const K=ie=>{ie.preventDefault(),ie.dataTransfer&&(ie.dataTransfer.dropEffect="move")};document.addEventListener("dragover",K,!0),j.current=K},[]),G=(0,n.useMemo)(()=>r.getSocialPresetsForBrand(Vn).filter(K=>r.SOCIAL_ICON_ORIGINAL_BY_PLATFORM[K.id]),[]),q=(0,n.useMemo)(()=>G.map(K=>({value:K.id,label:(0,o.jsxs)("span",{className:"selected-social-form__platform-option",children:[(0,o.jsx)("img",{src:r.getSocialIcon(K.id,z),alt:""}),(0,o.jsx)("span",{className:"selected-social-form__platform-option-text",children:i(K.labelMsgid)})]})})),[i,G,z]),te=(0,n.useCallback)((K,ie)=>{Y.current={...Y.current,[K]:{...Y.current[K],...ie}}},[]);(0,n.useEffect)(()=>{const K=wl(e);v.current!==K&&(v.current=K,Y.current={},x(e))},[e]);const ue=(0,n.useRef)(!1);(0,n.useEffect)(()=>{if(f?.settings){if(ue.current){ue.current=!1;return}const K=f.settings;P.current=K.bgEnabled&&K.bgColor?String(K.bgColor).trim():"",a.setFieldsValue(od(f.settings))}},[f,a]),(0,n.useEffect)(()=>()=>y(),[y]);const me=(0,n.useCallback)(()=>{const K=a.getFieldsValue(!0),ie=f.settings||{},je=String(ie.hostCellBgForIconLuminance??"").trim(),V=(K.globalBgColor||"").trim(),Se=typeof K.iconSize=="number"&&!Number.isNaN(K.iconSize)?K.iconSize:ie.iconSize??40,Ie=typeof K.borderRadius=="number"&&!Number.isNaN(K.borderRadius)?K.borderRadius:ie.borderRadius??0,Ne=typeof K.gap=="number"&&!Number.isNaN(K.gap)?K.gap:ie.gap??8,Fe={blockBgEnabled:!!V,blockBgColor:V},Ve=(K.globalItemBorderColor||"").trim();let Ue=typeof K.buttonBorderWidth=="number"&&!Number.isNaN(K.buttonBorderWidth)?K.buttonBorderWidth:0;Ue=Math.max(0,Math.min(24,Math.round(Ue)));const le={...ie,type:"social",align:K.align??ie.align??"center",iconSize:Se,borderRadius:Ie,gap:Ne,bgEnabled:!!V,bgColor:V,hostCellBgForIconLuminance:je,borderWidth:typeof ie.borderWidth=="number"?ie.borderWidth:0,borderColor:typeof ie.borderColor=="string"?ie.borderColor:"",buttonBorderColor:"",buttonBorderWidth:Ue,showLabel:K.showLabel,items:(K.items||[]).filter(Boolean).map((Te,I)=>{const Z=!!Te.customIcon,Be=Y.current[I]||{},Ce=Z?"":Kn(V,(Te.buttonBgColor||"").trim()),Me=typeof Te.href=="string"?Rl(Te.href):Te.href,Ge=Z?"":Yt(V,Ce),Ye=!Z&&Te.platform?r.getSocialIconForBlockCell(Te.platform,Gt(Fe,Ge,je)):null,D=Z?"":Ve||String(Te.itemBorderColor??"").trim(),L=zn(Z?Te.iconSrc||"":Ye||Te.iconSrc||"");return{...Te,customIcon:Z,href:Me,iconSrc:L,iconWidth:null,iconHeight:null,buttonBgColor:Ce,itemBorderColor:D,title:Be.title?String(Te.title??"").trim():""}})};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.SOCIAL,caption:f.caption,settings:le}),P.current=V,ue.current=!0,x(Te=>({...Te,settings:le}))},[f.caption,f.settings,a,d]),se=(0,n.useCallback)(K=>{if(K==null||K==="")return-1;const ie=r.stripEmVersionFromUrlString(String(K));return(a.getFieldValue("items")||[]).findIndex(je=>r.stripEmVersionFromUrlString(je&&je.iconSrc||"")===ie)},[a]),_e=(0,n.useCallback)((K,ie,je,V)=>{const Se=[...a.getFieldValue("items")||[]];if(K<0||K>=Se.length)return;const Ie=r.stripEmVersionFromUrlString(String(V||""))===r.stripEmVersionFromUrlString(String(ie||""));(!Ie||ie!==Se[K]?.iconSrc)&&(Se[K]={...Se[K],iconSrc:ie,customIcon:!0,buttonBgColor:"",itemBorderColor:""},a.setFieldValue("items",Se),setTimeout(()=>me(),0)),je?.mode==="save"&&Ie&&c(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(ie)})},[a,me,c]),ve=(0,n.useCallback)(async(K,ie)=>{const je=r.stripEmVersionFromUrlString(String(ie||"")),V=se(ie);if(V<0)return;const Se=(a.getFieldValue("items")||[])[V]?.iconSrc,{entryModal:Ie,currentUrl:Ne,imageDataUrl:Fe}=await yl(je,K),Ve=await p({kind:"img",currentUrl:Ne,entryModal:Ie,imageDataUrl:Fe});Ve?.url&&_e(V,Ve.url,Ve.meta,Se)},[_e,se,a,p]),de=(0,n.useCallback)(async K=>{const ie=(a.getFieldValue("items")||[])[K];if(!ie)return;const{entryModal:je,currentUrl:V,imageDataUrl:Se}=await yl(r.stripEmVersionFromUrlString(String(ie.iconSrc||"")),r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD),Ie=ie.iconSrc,Ne=await p({kind:"img",currentUrl:V,entryModal:je,imageDataUrl:Se});Ne?.url&&_e(K,Ne.url,Ne.meta,Ie)},[_e,a,p]),De=(0,n.useCallback)(K=>{const ie=parseInt(K.currentTarget.dataset.socialEditIndex??"",10);Number.isNaN(ie)||de(ie)},[de]),ye=(0,n.useCallback)(K=>{const ie=K.data?.operation,je=K.data?.src;ie===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?ve(r.MODALS.UPLOAD_IMAGE_MODAL_AI,je):ie===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?ve(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,je):ie===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?ve(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT,je):ie===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?ve(r.MODALS.UPLOAD_IMAGE_MODAL_GIF,je):ie===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?ve(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK,je):ie===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(s(r.closeSecondModal()),s(r.closeModal$1()))},[s,ve]);r.useListenPostMessage(ye);const re=(0,n.useCallback)(()=>{const K=a.getFieldValue("items")||[],ie=G[0],je=(a.getFieldValue("globalItemBorderColor")||"").trim(),V=(a.getFieldValue("globalBgColor")||"").trim();if(!ie)a.setFieldsValue({items:[...K,{platform:void 0,customIcon:!1,href:"",alt:"",title:"",iconSrc:"",iconWidth:null,iconHeight:null,buttonBgColor:V,itemBorderColor:je}]});else{const Se=String(f?.settings?.hostCellBgForIconLuminance??"").trim(),Ie=Yt(V,V),Ne=r.getSocialIconForBlockCell(ie.id,Gt({blockBgEnabled:!!V,blockBgColor:V},Ie,Se)),Fe=i(ie.labelMsgid);a.setFieldsValue({items:[...K,{platform:ie.id,customIcon:!1,href:"",alt:Fe,title:"",iconSrc:Ne,iconWidth:null,iconHeight:null,buttonBgColor:V,itemBorderColor:je}]})}setTimeout(()=>me(),0)},[i,f?.settings?.hostCellBgForIconLuminance,a,G,me]),ke=(0,n.useCallback)((K,ie)=>{K.dataTransfer.setData(Tl,String(ie)),K.dataTransfer.setData(r.DND_SOCIAL_LIST_REORDER_MIME,String(ie)),K.dataTransfer.effectAllowed="move",_.current=ie,b(ie),oe()},[oe]),ae=(0,n.useCallback)(()=>{y(),_.current=null,b(null),T(null)},[y]),Q=(0,n.useCallback)((K,ie,je)=>{if(je<2)return;K.preventDefault(),K.dataTransfer.dropEffect="move";const V=_.current;V!==null&&V!==ie&&T(ie)},[]),be=(0,n.useCallback)((K,ie)=>{K.currentTarget.contains(K.relatedTarget)||T(je=>je===ie?null:je)},[]),pe=(0,n.useCallback)((K,ie,je)=>{K.preventDefault(),T(null);const V=K.dataTransfer.getData(Tl),Se=parseInt(V,10);if(Number.isNaN(Se)||Se===ie){y();return}je(Se,ie),y(),setTimeout(()=>me(),0)},[y,me]),ee=(0,n.useCallback)(K=>{const ie=K.currentTarget,je=parseInt(ie.dataset.itemIndex??"",10);Number.isNaN(je)||ke(K,je)},[ke]),J=(0,n.useCallback)(K=>{const ie=K.currentTarget,je=parseInt(ie.dataset.itemIndex??"",10),V=parseInt(ie.dataset.listLength??"",10);Number.isNaN(je)||Number.isNaN(V)||V<2||(K.preventDefault(),K.dataTransfer&&(K.dataTransfer.dropEffect="move"))},[]),U=(0,n.useCallback)(K=>{const ie=K.currentTarget,je=parseInt(ie.dataset.itemIndex??"",10),V=parseInt(ie.dataset.listLength??"",10);Number.isNaN(je)||Number.isNaN(V)||Q(K,je,V)},[Q]),X=(0,n.useCallback)(K=>{const ie=parseInt(K.currentTarget.dataset.itemIndex??"",10);Number.isNaN(ie)||be(K,ie)},[be]),ce=(0,n.useCallback)(K=>{const ie=parseInt(K.currentTarget.dataset.itemIndex??"",10),je=E.current;Number.isNaN(ie)||typeof je!="function"||pe(K,ie,je)},[pe]),xe=(0,n.useCallback)(K=>{K.stopPropagation();const ie=parseInt(K.currentTarget.dataset.fieldName??"",10),je=w.current;Number.isNaN(ie)||typeof je!="function"||(je(ie),queueMicrotask(me))},[me]),ne=(0,n.useCallback)((K,ie)=>{const je=G.find(le=>le.id===ie);if(!je)return;const V=i(je.labelMsgid),Se=Y.current[K]||{},Ie=String(a.getFieldValue(["items",K,"alt"])??"").trim();(Se.alt||Ie)&&a.setFieldValue(["items",K,"alt"],V),Se.title&&a.setFieldValue(["items",K,"title"],V);const Ne=(a.getFieldValue("globalBgColor")||"").trim(),Fe=Yt(Ne,(a.getFieldValue(["items",K,"buttonBgColor"])||"").trim()),Ve=String(f?.settings?.hostCellBgForIconLuminance??"").trim(),Ue=r.getSocialIconForBlockCell(ie,Gt({blockBgEnabled:!!Ne,blockBgColor:Ne},Fe,Ve));Ue&&(a.setFieldValue(["items",K,"customIcon"],!1),a.setFieldValue(["items",K,"iconSrc"],Ue))},[i,f?.settings?.hostCellBgForIconLuminance,a,G]),Ae=(0,n.useCallback)(K=>{if(Object.prototype.hasOwnProperty.call(K,"globalItemBorderColor")){if(!C.current){const ie=String(K.globalItemBorderColor??"").trim(),je=a.getFieldValue("items")||[];a.setFieldsValue({items:Jn(je,ie)})}}else if(Object.prototype.hasOwnProperty.call(K,"globalBgColor")){const ie=P.current,je=String(K.globalBgColor??"").trim(),V=a.getFieldValue("items")||[];a.setFieldsValue({items:Qn(V,ie,je)})}else if(K?.items!=null){const ie=a.getFieldValue("items")||[],je=jl(ie);je!==(a.getFieldValue("globalItemBorderColor")||"").trim()&&(C.current=!0,a.setFieldValue("globalItemBorderColor",je),queueMicrotask(()=>{C.current=!1}));const V=f.settings?.items||[];ie.forEach((Se,Ie)=>{const Ne=Se?.platform,Fe=V[Ie]?.platform;Ne&&Ne!==Fe&&ne(Ie,Ne)})}Zn(K?.items,ne),me()},[f.settings?.items,a,me,ne]),we=(0,n.useCallback)((K,ie)=>{if(a.setFieldValue(K,ie),Array.isArray(K)&&K[0]==="items"){Ae({items:{[K[1]]:{[K[2]]:ie}}});return}Ae({[K]:ie})},[a,Ae]),$e=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"selected-social-form__section",children:[(0,o.jsx)("div",{className:"selected-social-form__section-title",children:i("General settings")}),(0,o.jsx)("div",{className:"selected-social-form__align-block",children:(0,o.jsx)(Uo,{form:a,elementSettings:{...f,type:r.ELEMENT_TYPES.SOCIAL}})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Button size"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"iconSize",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:16,max:64,prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px",placeholder:i("Button size"),className:"selected-social-form__input-full"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Corner radius"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"borderRadius",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,max:48,prefix:(0,o.jsx)(r.EmIcons,{icon:"BorderRadius",component:t.icons$BorderRadius,className:"selected-td-form__icon-radius"}),addonAfter:"px",placeholder:i("Corner radius"),className:"selected-social-form__input-full"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Spacing"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gap",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,max:48,prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingLeftRight",component:t.icons$PaddingLeftRight}),addonAfter:"px",placeholder:i("Spacing"),className:"selected-social-form__input-full"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"globalBgColor",className:"form-item-margin-xs",children:(0,o.jsx)(zt,{form:a,name:"globalBgColor",placeholder:i("Background color"),usedColors:$,onColorChange:we})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Border"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonBorderWidth",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,max:24,prefix:(0,o.jsx)(r.EmIcons,{icon:"BorderOuterOutlined",component:t.icons$BorderOuterOutlined}),addonAfter:"px",placeholder:i("Border"),className:"selected-social-form__input-full"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Border color"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"globalItemBorderColor",className:"form-item-margin-xs",children:(0,o.jsx)(zt,{form:a,name:"globalItemBorderColor",placeholder:i("Border color"),usedColors:$,onColorChange:we})})})})]})]}),(0,o.jsxs)("div",{className:"selected-social-form__section selected-social-form__section--bordered",children:[(0,o.jsx)("div",{className:"selected-social-form__section-title",children:i("Social buttons")}),(0,o.jsx)(t.ui_kit$Form.List,{name:"items",children:(K,{remove:ie,move:je})=>(E.current=je,w.current=ie,(0,o.jsx)("div",{className:"selected-social-form__items",children:K.map((V,Se)=>{const Ie=!!(O[Se]?.customIcon??O[V.name]?.customIcon);return(0,o.jsxs)("div",{className:(0,He.default)("selected-social-form__card",k===Se&&"selected-social-form__card--dragging",h===Se&&k!==Se&&"selected-social-form__card--drag-over"),"data-item-index":Se,"data-list-length":K.length,onDragEnterCapture:J,onDragOverCapture:U,onDragLeave:X,onDropCapture:ce,children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head",children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head-main",children:[K.length>1?(0,o.jsx)("span",{className:"selected-social-form__drag-handle",draggable:!0,"data-item-index":Se,onDragStart:ee,onDragEnd:ae,role:"button",tabIndex:0,"aria-label":i("Drag to reorder"),children:(0,o.jsx)(r.EmIcons,{icon:"HolderOutlined",component:t.icons$HolderOutlined})}):null,(0,o.jsxs)(Dn,{className:"selected-social-form__card-title",children:[i("Button")," ",Se+1]})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Delete"),placement:"top",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"selected-social-form__card-head-remove",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:18,strokeWidth:l.iconStrokeWidth}),"aria-label":i("Delete"),"data-field-name":V.name,onClick:xe})})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[V.name,"iconSrc"],hidden:!0,children:(0,o.jsx)(t.ui_kit$Input,{})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[V.name,"customIcon"],valuePropName:"checked",hidden:!0,children:(0,o.jsx)(t.ui_kit$Checkbox,{})}),(0,o.jsxs)("div",{className:"selected-social-form__platform-row",children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:[V.name,"platform"],className:"selected-social-form__platform-field selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:q,className:"selected-social-form__platform-select",classNames:{popup:{root:"selected-social-form__platform-dropdown"}},placeholder:i("Select"),suffixIcon:(0,o.jsx)(r.EmIcons,{icon:"ChevronDownCustom",component:t.icons$ChevronDownCustom,className:"ant-select-suffix"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Edit icon"),placement:"top",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"selected-social-form__platform-edit","data-social-edit-index":Se,icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,size:18,strokeWidth:l.iconStrokeWidth}),"aria-label":i("Edit icon"),onClick:De})})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[V.name,"href"],className:"selected-social-form__card-field",rules:[{required:!0,whitespace:!0,message:i("Please enter the URL.")},{validator:async(Ne,Fe)=>{const Ve=typeof Fe=="string"?Fe.trim():String(Fe??"").trim();if(Ve&&!Gn(Ve))throw new Error(i("Please enter the correct URL."))}}],children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Link03",component:t.icons$Link03,className:"selected-social-form__field-icon"}),placeholder:i("Enter link"),allowClear:{clearIcon:(0,o.jsx)(t.ui_kit$ColorPickerClearGlyph,{})}})}),Ie?null:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__card-field selected-social-form__bg-color-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:[V.name,"buttonBgColor"],className:"selected-social-form__card-field",children:(0,o.jsx)(zt,{form:a,name:["items",V.name,"buttonBgColor"],placeholder:i("Background color"),usedColors:$,onColorChange:we})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Border color"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:[V.name,"itemBorderColor"],className:"selected-social-form__card-field",children:(0,o.jsx)(zt,{form:a,name:["items",V.name,"itemBorderColor"],placeholder:i("Border color"),usedColors:$,onColorChange:we})})})})]}),(0,o.jsx)(vl,{__:i,form:a,fieldName:V.name,pushSettingsToIframe:me,onMetaActiveChange:te})]},V.key)})}))}),(0,o.jsx)(t.ui_kit$Button,{type:"text",block:!0,className:"selected-social-form__add-bar",icon:(0,o.jsx)(r.EmIcons,{icon:"PlusSquareOutlined",component:t.icons$PlusSquareOutlined}),onClick:re,children:i("Add button")})]})]});return(0,o.jsx)("div",{className:"selected-social-form",children:(0,o.jsx)(t.ui_kit$Form,{form:a,layout:"vertical",className:"selected-social-form__form element-controls",onValuesChange:Ae,autoComplete:"off",children:(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:$e})})})};Il.propTypes={elementSettings:g.default.shape({settings:g.default.object,type:g.default.string,caption:g.default.string})};var Cl=r.BASIC_BORDER_COLOR,td=(e,i,l,s,a,d,c="")=>{const p=e.getFieldsValue(!0),f=i?"cell_":c;setTimeout(()=>{i?s(x=>!x):l(x=>!x),a&&(p[f+"borderWidth"]=null,p[f+"borderColor"]="",p[f+"borderStyle"]=""),d(x=>({...r.RESET_BORDER_PARAMS,[p[f+"borderPosition"]]:{...x[p[f+"borderPosition"]],width:p[f+"borderWidth"],color:p[f+"borderColor"],style:p[f+"borderStyle"]}}))})},id=(e,i,l,s,a,d,c)=>{const p=e.getFieldsValue(!0);setTimeout(()=>{i(f=>!f),!l&&!s[p?.mobileBorderPosition]?.color&&(p.mobileBorderStyle="solid",p.mobileBorderWidth=1,p.mobileBorderColor=Cl,a(f=>({...s,[p?.mobileBorderPosition]:{color:Cl,style:"solid",width:1}}))),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:c.type,settings:{mobileBorder:{...s,[p?.mobileBorderPosition]:{color:p.mobileBorderColor,style:p.mobileBorderStyle,width:p.mobileBorderWidth}}}})})},rd=(e,i,l,s,a,d,c="")=>{const p=e.getFieldsValue(!0);setTimeout(()=>{i(f=>!f),l?(p[c+"borderRadiusAll"]=0,s(!0)):p[c+"borderRadiusAll"]||(p[c+"borderRadiusAll"]=0),a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:d.type,settings:{borderRadius:{all:p[c+"borderRadiusAll"]}}})})},ld=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!l&&!d.mobileBorderRadiusAll&&!d.mobileBorderRadiusTopLeft&&!d.mobileBorderRadiusTopRight&&!d.mobileBorderRadiusBottomRight&&!d.mobileBorderRadiusBottomLeft&&(d.mobileBorderRadiusAll=0),["all","topLeft","topRight","bottomRight","bottomLeft"].forEach(c=>{if(!d.mobileBorderRadius?.[c])return;const p=`mobileBorderRadius${c[0].toUpperCase()}${c.slice(1)}`;s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{mobileBorderRadius:{[c]:d[p],classNamePrefix:`em-mob-border_radius_${c}-`}}})})})},sd=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!l&&!d.boxShadowColor?(d.boxShadowInset=!1,d.boxShadowHOffset=5,d.boxShadowVOffset=5,d.boxShadowBlurRadius=10,d.boxShadowSpreadRadius=-5,d.boxShadowColor="#000000"):l&&(d.boxShadowInset=!1,d.boxShadowHOffset=null,d.boxShadowVOffset=null,d.boxShadowBlurRadius=null,d.boxShadowSpreadRadius=null,d.boxShadowColor=""),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{boxShadow:{blurRadius:d.boxShadowBlurRadius,color:d.boxShadowColor,hOffset:d.boxShadowHOffset,inset:d.boxShadowInset,spreadRadius:d.boxShadowSpreadRadius,vOffset:d.boxShadowVOffset}}})})},ad=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!l&&!d.mobileBoxShadowColor&&(d.mobileBoxShadowInset=!1,d.mobileBoxShadowHOffset=5,d.mobileBoxShadowVOffset=5,d.mobileBoxShadowBlurRadius=10,d.mobileBoxShadowSpreadRadius=-5,d.mobileBoxShadowColor="#000000"),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{mobileBoxShadow:{blurRadius:d.mobileBoxShadowBlurRadius,color:d.mobileBoxShadowColor,hOffset:d.mobileBoxShadowHOffset,inset:d.mobileBoxShadowInset,spreadRadius:d.mobileBoxShadowSpreadRadius,vOffset:d.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},nd=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!l&&!d.mobileWidth&&(d.mobileWidth=""),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{mobileWidth:{value:d.mobileWidth,dim:d.mobileWidthDim,classNamePrefix:"em-mob-width-"}}})})},dd=e=>{setTimeout(()=>{e(i=>!i)})},cd=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!l&&!d.mobileBackgroundColor&&(d.mobileBackgroundColor="#E5E5E5"),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:d.mobileBackgroundColor}}}),l&&Et(e,a,s)})},ud=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),l&&(d.paddingLeftRight="",d.paddingLeft="",d.paddingRight="",d.paddingTopBottom="",d.paddingTop="",d.paddingBottom="",s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{padding:{all:0}}}))})},md=(e,i,l,s,a)=>{i(c=>!c);const d=e.getFieldsValue(!0);l||(d.paddingLeftRight=d.paddingLeft,d.paddingTopBottom=d.paddingTop,d.paddingRight=d.paddingLeft,d.paddingBottom=d.paddingTop,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{padding:{top:d.paddingTopBottom,bottom:d.paddingTopBottom,left:d.paddingLeftRight,right:d.paddingLeftRight}}}))},pd=e=>{setTimeout(()=>{e(i=>!i)})},hd=(e,i,l,s,a)=>{i(c=>!c);const d=e.getFieldsValue(!0);l||(d.cell_paddingLeftRight=d.cell_paddingLeft,d.cell_paddingTopBottom=d.cell_paddingTop,d.cell_paddingRight=d.cell_paddingLeft,d.cell_paddingBottom=d.cell_paddingTop,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{cell_padding:{top:d.cell_paddingTopBottom,bottom:d.cell_paddingTopBottom,left:d.cell_paddingLeftRight,right:d.cell_paddingLeftRight}}})),(l&&d.cell_paddingLeftRight||d.cell_paddingLeftRight===0)&&(d.cell_paddingLeft=d.cell_paddingLeftRight,d.cell_paddingRight=d.cell_paddingLeftRight),(l&&d.cell_paddingTopBottom||d.cell_paddingTopBottom===0)&&(d.cell_paddingTop=d.cell_paddingTopBottom,d.cell_paddingBottom=d.cell_paddingTopBottom)},bd=({form:e,onBorderSideClear:i,formName:l,elementSettings:s,formValues:a,isMacOS:d,__:c,token:p,appConfig:f,typografItems:x,backgroundRepeatOptions:k,backgroundSizeOptions:b,sendAction:h,handleToggleShowPaddingCell:T,handleTogglePaddingCell:_,handleToggleBackground:E,handleToggleBorder:w,handleToggleBorderRadius:v,paddingCellShow:A,paddingsExt:j,backgroundShow:C,cellBordersShow:P,borderRadiusShow:Y,oneBorderRadiusValue:z,setOneBorderRadiusValue:$,textInputRef:O,linkProtocol:y,handleLinkProtocolsChange:oe,backgroundImageEmpty:G})=>{const q=W.useGoogleFontsLoader();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$FormSection,{title:c("Text"),dividerTop:!1,children:[f.formTextFieldTypografEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"AddImage",style:{marginBottom:p.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"AddImage",component:t.icons$AddImage}),onClick:()=>h("add_img"),style:{width:"100%"},children:c("Add image")})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"Typography",style:{marginBottom:p.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,menu:{items:x},trigger:["hover"],placement:"bottom",getPopupContainer:te=>te.closest(".selected-element-panel"),children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Typograf",component:t.icons$Typograf}),onClick:()=>h("typograf"),style:{width:"100%"},children:c("Typography")})})})})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Text font"),placement:"bottom",zIndex:1,getPopupContainer:te=>te.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:q,getPopupContainer:te=>te.closest(".email-pane__collapse-wrapper")})})}),!s.showOnMobile&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:c("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:c("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:s,name:"textStrong",tooltipTitle:c(d?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:s,name:"textItalic",tooltipTitle:c(d?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:s,name:"textStrikethrough",tooltipTitle:c(d?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,elementSettings:s,name:"textUnderline",tooltipTitle:c(d?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(qe,{form:e,className:(0,He.default)("selected-text-common-form__button selected-text-common-form__button_style",{"selected-text-common-form__button--active":typeof s.linkHref=="string"}),elementSettings:s,name:"textLink",tooltipTitle:c("Link"),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"})})})]}),a?.textLink&&(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsxs)(t.ui_kit$Col,{span:24,children:[(0,o.jsx)(et,{show:y==="#",__:c,style:{marginBottom:p.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("The URL that the hyperlink directs to."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkHref",children:(0,o.jsx)(t.ui_kit$Input,{ref:O,addonBefore:(0,o.jsx)(Zo,{linkProtocol:y,handleLinkProtocolsChange:oe,__:c}),allowClear:!0,placeholder:c("Hyperlink URL"),autoFocus:s?.customTable?.isNewLink,prefix:(0,o.jsx)(Qo,{linkProtocol:y})})})})]})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Text color"),placement:"bottom",zIndex:2,getPopupContainer:te=>te.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:c("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:c("Color"),usedColors:s.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Text background"),placement:"bottom",zIndex:2,getPopupContainer:te=>te.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:c("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:c("Background color"),usedColors:s.usedColors})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(it,{form:e,elementSettings:s,name:"textAlign"})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Mo,{form:e,elementSettings:s,name:"valign",isNewIconType:!0})})]})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:c("Padding"),collapsible:!0,open:A,onToggle:T,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{namePrefix:"cell_",extended:j,onToggleExtended:_,gutter:p.marginSM,rowStyle:{paddingBottom:4},labels:{horizontal:c("Horizontal padding"),vertical:c("Vertical padding"),left:c("Left padding"),right:c("Right padding"),top:c("Top padding"),bottom:c("Bottom padding"),individual:c("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:c("Background"),collapsible:!0,open:C,onToggle:E,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{colorFieldName:"cellBackgroundColor",imageEnabled:f.formTableFieldBackgroundImageEnabled&&!1,backgroundImageEmpty:G,usedColors:s.usedColors,colorPlaceholder:c("Background color"),horizontalPositionPlaceholder:c("Horizontal position"),horizontalPositionTooltip:c("Horizontal position"),verticalPositionPlaceholder:c("Vertical position"),verticalPositionTooltip:c("Vertical position"),backgroundRepeatTooltip:c("Background image repeat"),backgroundSizeTooltip:c("Background image size"),selectPlaceholder:c("Please choose"),backgroundRepeatOptions:k,backgroundSizeOptions:b,imageUploadSlot:(f.formTableFieldBackgroundImageEnabled,void 0)})}),(0,o.jsx)(t.ui_kit$FormSection,{title:c("Borders"),collapsible:!0,open:P,onToggle:w,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,namePrefix:"cell_"})}),f.formFieldBorderRadiusEnabled&&!1]})},Pl=({form:e,onBorderSideClear:i,elementSettings:l,paddingShow:s,paddingsExt:a,backgroundShow:d,bordersShow:c,borderRadiusShow:p,boxShadowShow:f,handleToggleShowPadding:x,handleTogglePadding:k,handleToggleBackground:b,handleToggleBorder:h,handleToggleBorderRadius:T,handleToggleBoxShadow:_,backgroundRepeatOptions:E,backgroundSizeOptions:w,backgroundImageEmpty:v,oneBorderRadiusValue:A,setOneBorderRadiusValue:j,boxShadow:C})=>{const{__:P}=r.useI18n(),Y=r.useAppConfig(),{token:z}=(0,t.ui_kit$useToken)();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$FormSection,{title:P("Padding"),collapsible:!0,open:s,onToggle:x,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:a,onToggleExtended:k,gutter:z.marginSM,labels:{horizontal:P("Horizontal padding"),vertical:P("Vertical padding"),left:P("Left padding"),right:P("Right padding"),top:P("Top padding"),bottom:P("Bottom padding"),individual:P("Individual padding")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:P("Background"),collapsible:!0,open:d,onToggle:b,dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{imageEnabled:Y.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:v,usedColors:l.usedColors,colorPlaceholder:P("Background color"),horizontalPositionPlaceholder:P("Horizontal position"),horizontalPositionTooltip:P("Horizontal position"),verticalPositionPlaceholder:P("Vertical position"),verticalPositionTooltip:P("Vertical position"),backgroundRepeatTooltip:P("Background image repeat"),backgroundSizeTooltip:P("Background image size"),selectPlaceholder:P("Please choose"),backgroundRepeatOptions:E,backgroundSizeOptions:w,imageUploadSlot:Y.formTableFieldBackgroundImageEnabled?(0,o.jsx)(No,{form:e,label:P("Background image"),name:"backgroundImage",tooltipTitle:P("Background image"),placeholder:P("Background image link/route")}):void 0}),(0,o.jsx)(rt,{form:e,showBackground:!0})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:P("Borders"),collapsible:!0,open:c,onToggle:h,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,onBorderSideClear:i})}),Y.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("Border radius"),collapsible:!0,open:p,onToggle:T,dividerTop:!0,children:(0,o.jsx)(So,{form:e,oneBorderRadiusValue:A,setOneBorderRadiusValue:j,elementSettings:l})}),Y.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("Box shadow"),collapsible:!0,open:f,onToggle:_,dividerTop:!0,children:(0,o.jsx)(jo,{})}),Y.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:l,form:e})})]})};Pl.propTypes={form:g.default.object.isRequired,onBorderSideClear:g.default.func,elementSettings:g.default.object.isRequired,paddingShow:g.default.bool,paddingsExt:g.default.bool,backgroundShow:g.default.bool,bordersShow:g.default.bool,borderRadiusShow:g.default.bool,boxShadowShow:g.default.bool,handleToggleShowPadding:g.default.func,handleTogglePadding:g.default.func,handleToggleBackground:g.default.func,handleToggleBorder:g.default.func,handleToggleBorderRadius:g.default.func,handleToggleBoxShadow:g.default.func,backgroundRepeatOptions:g.default.array,backgroundSizeOptions:g.default.array,backgroundImageEmpty:g.default.bool,oneBorderRadiusValue:g.default.bool,setOneBorderRadiusValue:g.default.func,boxShadow:g.default.object};var Al=({form:e,elementSettings:i,mobileSizeShow:l,mobileBackgroundShow:s,mobileBordersShow:a,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,handleToggleMobileSize:p,handleToggleMobileBackground:f,handleToggleMobileBorder:x,handleToggleMobileBorderRadius:k,handleToggleMobileBoxShadow:b,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:T,mobileBorders:_,mobileBoxShadow:E})=>{const{__:w,_x:v}=r.useI18n(),A=r.useAppConfig(),{token:j}=(0,t.ui_kit$useToken)(),C=r.useSelector(r.selectEmailSettings);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$FormSection,{title:w("Size"),collapsible:!0,open:l,onToggle:p,dividerTop:!0,children:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:w("Table width"),placement:"left",children:(0,o.jsx)("div",{style:{marginBottom:j.formItemMarginBottomMD+4},children:(0,o.jsx)(zo,{form:e,name:"mobileWidth",elementSettings:i})})})})}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:j.formItemMarginBottomXS*2},children:(0,o.jsx)(t.ui_kit$Tooltip,{title:w("Height"),placement:"bottom",children:(0,o.jsx)(tt,{form:e,name:"mobileHeight",elementSettings:i})})})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:w("Background"),collapsible:!0,open:s,onToggle:f,dividerTop:!0,children:(0,o.jsx)(Bt,{elementSettings:Go(i),imageEnabled:A.formTableFieldBackgroundImageEnabled,desktopBackground:xt(i)})}),A.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Borders"),collapsible:!0,open:a,onToggle:x,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormBorderInputs,{form:e,fieldStructure:"flat",borderValues:_,usedColors:C.usedColors,labels:{color:w("Color"),width:v("Width","border"),none:w("None"),solid:w("Solid"),dashed:w("Dashed"),dotted:w("Dotted"),above:w("Above"),below:w("Below"),onLeft:w("On the left"),onRight:w("On the right"),around:w("Around"),usedColors:w("Used"),recommendedColors:w("Recommended")}})}),A.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Border radius"),collapsible:!0,open:d,onToggle:k,dividerTop:!0,children:(0,o.jsx)(So,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:h,setOneBorderRadiusValue:T,elementSettings:i})}),A.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Box shadow"),collapsible:!0,open:c,onToggle:b,dividerTop:!0,children:(0,o.jsx)(jo,{typeOfForm:"mobile",form:e,elementSettings:i,enableSwitch:!1})}),A.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Display control"),dividerTop:!0,children:(0,o.jsx)(vo,{elementSettings:i,form:e})})]})};Al.propTypes={form:g.default.object.isRequired,elementSettings:g.default.object.isRequired,mobileSizeShow:g.default.bool,mobileBackgroundShow:g.default.bool,mobileBordersShow:g.default.bool,mobileBorderRadiusShow:g.default.bool,mobileBoxShadowShow:g.default.bool,handleToggleMobileSize:g.default.func,handleToggleMobileBackground:g.default.func,handleToggleMobileBorder:g.default.func,handleToggleMobileBorderRadius:g.default.func,handleToggleMobileBoxShadow:g.default.func,oneMobileBorderRadiusValue:g.default.bool,setOneMobileBorderRadiusValue:g.default.func,mobileBorders:g.default.object,mobileBoxShadow:g.default.object};var fd=({form:e,onBorderSideClear:i,elementViewType:l,mobileViewActive:s,elementSettings:a,paddingShow:d,paddingsExt:c,backgroundShow:p,bordersShow:f,borderRadiusShow:x,boxShadowShow:k,mobileSizeShow:b,mobileBackgroundShow:h,mobileBordersShow:T,mobileBorderRadiusShow:_,mobileBoxShadowShow:E,handleToggleShowPadding:w,handleTogglePadding:v,handleToggleBackground:A,handleToggleBorder:j,handleToggleBorderRadius:C,handleToggleBoxShadow:P,handleToggleMobileSize:Y,handleToggleMobileBackground:z,handleToggleMobileBorder:$,handleToggleMobileBorderRadius:O,handleToggleMobileBoxShadow:y,backgroundRepeatOptions:oe,backgroundSizeOptions:G,backgroundImageEmpty:q,oneBorderRadiusValue:te,setOneBorderRadiusValue:ue,oneMobileBorderRadiusValue:me,setOneMobileBorderRadiusValue:se,boxShadow:_e,mobileBorders:ve,mobileBoxShadow:de})=>(0,o.jsx)(o.Fragment,{children:l==="mobile"&&s.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(Al,{form:e,elementSettings:a,mobileSizeShow:b,mobileBackgroundShow:h,mobileBordersShow:T,mobileBorderRadiusShow:_,mobileBoxShadowShow:E,handleToggleMobileSize:Y,handleToggleMobileBackground:z,handleToggleMobileBorder:$,handleToggleMobileBorderRadius:O,handleToggleMobileBoxShadow:y,oneMobileBorderRadiusValue:me,setOneMobileBorderRadiusValue:se,mobileBorders:ve,mobileBoxShadow:de})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Pl,{form:e,onBorderSideClear:i,elementSettings:a,paddingShow:d,paddingsExt:c,backgroundShow:p,bordersShow:f,borderRadiusShow:x,boxShadowShow:k,handleToggleShowPadding:w,handleTogglePadding:v,handleToggleBackground:A,handleToggleBorder:j,handleToggleBorderRadius:C,handleToggleBoxShadow:P,backgroundRepeatOptions:oe,backgroundSizeOptions:G,backgroundImageEmpty:q,oneBorderRadiusValue:te,setOneBorderRadiusValue:ue,boxShadow:_e})})}),gd=["borderTop","borderBottom","borderLeft","borderRight"],Nl=({elementSettings:e,formName:i})=>{const{__:l}=r.useI18n(),s=r.useSendPostMessage(),[a]=t.ui_kit$Form.useForm(),{token:d}=(0,t.ui_kit$useToken)(),c=r.useAppConfig(),p=r.useSelector(r.selectEmailViewType),f=r.useSelector(r.selectMobileViewActive),x=r.useSelector(r.selectIsCodeMode),k=r.useSelector(r.selectCodeModeDirection),[b,h]=(0,n.useState)({}),[T,_]=(0,n.useState)(!0),[E,w]=(0,n.useState)({}),[v,A]=(0,n.useState)({}),[j,C]=(0,n.useState)(!0),[P,Y]=(0,n.useState)(e.customTable?.backgroundImage[0].value===""),[z,$]=(0,n.useState)(),[O,y]=(0,n.useState)(!1),[oe,G]=(0,n.useState)(!1),[q,te]=(0,n.useState)(!1),[ue,me]=(0,n.useState)(!1),[se,_e]=(0,n.useState)(!1),[ve,de]=(0,n.useState)(!1),[De,ye]=(0,n.useState)(!1),[re,ke]=(0,n.useState)(!1),[ae,Q]=(0,n.useState)(!0),[be,pe]=(0,n.useState)(!0),[ee,J]=(0,n.useState)(!0),[U,X]=(0,n.useState)(!1),[ce,xe]=(0,n.useState)("https://"),[ne,Ae]=(0,n.useState)({}),[we,$e]=(0,n.useState)(!1),[K,ie]=(0,n.useState)(!1),[je,V]=(0,n.useState)(!1),[Se,Ie]=(0,n.useState)({}),Ne=(0,n.useRef)(null),Fe=(0,n.useRef)(),Ve=t.ui_kit$Form.useWatch([],a),Ue=[{label:l("Not defined"),value:"none"},{label:l("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:l("Repeat background (repeat)"),value:"repeat"},{label:l("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:l("Repeat background vertically (repeat-y)"),value:"repeat-y"}],le=[{label:l("Not defined"),value:""},{label:l("Contain"),value:"contain"},{label:l("Cover"),value:"cover"}],Te={width:"",style:"",color:""},I=x&&k!=="bottom",Z=r.BASIC_BORDER_COLOR,Be=i==="Edit selected table cells"||!1,[Ce,Me]=(0,n.useState)(null);(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&Me(!0)},[]);const Ge=H=>{s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:H,locale:"en_US"})},Ye=[{key:"1",label:l("This element"),onClick:()=>Ge("typograf")},{key:"2",label:l("The whole email"),onClick:()=>Ge("typograf_all")}];let D="";(0,n.useEffect)(()=>{if(e){kt(e)&&ke(!0);const H=e.border,Re=e.boxShadow,fe=e.customTable?.mobileBorder,ze=e.customTable?.mobileBoxShadow,co=e.customTable?.cellBorders;Ie(H),h(Re),w(fe),A(ze),Ae(co);const so=Be?e?.customTable?.cell_borderPosition:e?.customTable?.borderPosition,mo=Object.keys(fe).find(ko=>fe[ko]?.width||fe[ko]?.style||fe[ko]?.color);a.setFieldsValue({...e,width:e.width?.value,widthDim:e.width?.dim,maxWidth:e.maxWidth?.value,maxWidthDim:e.maxWidth?.dim,minWidth:e.minWidth?.value,minWidthDim:e.minWidth?.dim,show:e.show?e.show:"all",mobileAlign:e.mobileAlign?.value,mobileBorderPosition:mo||"all",mobileBorderWidth:fe[mo]?.width!==null?fe[mo]?.width:"",mobileBorderColor:fe[mo]?.color||"",mobileBorderStyle:fe[mo]?.style||"",...nt(e),exportAsPicture:e?.exportAsPicture,paddingLeftRight:u(e.customTable?.paddingLeftRight.replace(/px$/,"")),paddingTopBottom:u(e.customTable?.paddingTopBottom.replace(/px$/,"")),paddingRight:u(e.customTable?.paddingRight.replace(/px$/,"")),paddingLeft:u(e.customTable?.paddingLeft.replace(/px$/,"")),paddingTop:u(e.customTable?.paddingTop.replace(/px$/,"")),paddingBottom:u(e.customTable?.paddingBottom.replace(/px$/,"")),backgroundColor:u(e.customTable?.backgroundColor),backgroundImage:u(e.customTable?.backgroundImage[0].value),backgroundPositionX:u(e.customTable?.backgroundPositionX),backgroundPositionY:u(e.customTable?.backgroundPositionY),backgroundRepeat:u(e.customTable?.backgroundRepeat),backgroundSize:u(e.customTable?.backgroundSize),borderAll:u(e.customTable?.borderAll),borderRadiusAll:u(e.customTable?.borderRadius.all),borderRadiusTopLeft:u(e.customTable?.borderRadius.topLeft),borderRadiusBottomLeft:u(e.customTable?.borderRadius.bottomLeft),borderRadiusTopRight:u(e.customTable?.borderRadius.topRight),borderRadiusBottomRight:u(e.customTable?.borderRadius.bottomRight),borderRadius:{all:u(e.customTable?.borderRadius.all),topLeft:u(e.customTable?.borderRadius.topLeft),topRight:u(e.customTable?.borderRadius.topRight),bottomLeft:u(e.customTable?.borderRadius.bottomLeft),bottomRight:u(e.customTable?.borderRadius.bottomRight)},borderTop:u(e.customTable?.borderTop),borderBottom:u(e.customTable?.borderBottom),borderLeft:u(e.customTable?.borderLeft),borderRight:u(e.customTable?.borderRight),borderPosition:so||"borderAll",boxShadowInset:u(e.customTable?.boxShadow?.inset)||!1,boxShadowHOffset:u(e.customTable?.boxShadow?.hOffset),boxShadowVOffset:u(e.customTable?.boxShadow?.vOffset),boxShadowBlurRadius:u(e.customTable?.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.customTable?.boxShadow?.spreadRadius),boxShadowColor:u(e.customTable?.boxShadow?.color),mobileBoxShadowInset:u(e.customTable?.mobileBoxShadow?.inset)||!1,mobileBoxShadowHOffset:u(e.customTable?.mobileBoxShadow?.hOffset),mobileBoxShadowVOffset:u(e.customTable?.mobileBoxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.customTable?.mobileBoxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.customTable?.mobileBoxShadow?.spreadRadius),mobileBoxShadowColor:u(e.customTable?.mobileBoxShadow?.color),mobileBackgroundColor:u(e.customTable?.mobileBackgroundColor?.value!=="none"?e.customTable?.mobileBackgroundColor?.value:""),mobileWidth:po(e.customTable?.mobileWidth?.value),mobileWidthDim:e.customTable?.mobileWidth?.dim,mobileHeight:po(e.customTable?.mobileHeight?.value),mobileHeightDim:e.customTable?.mobileHeight?.dim,mobileBorderRadiusAll:u(e.customTable?.mobileBorderRadius.all),mobileBorderRadiusTopLeft:u(e.customTable?.mobileBorderRadius.topLeft!==null?e.customTable?.mobileBorderRadius.topLeft:e.customTable?.mobileBorderRadius.all),mobileBorderRadiusBottomLeft:u(e.customTable?.mobileBorderRadius.bottomLeft!==null?e.customTable?.mobileBorderRadius.bottomLeft:e.customTable?.mobileBorderRadius.all),mobileBorderRadiusTopRight:u(e.customTable?.mobileBorderRadius.topRight!==null?e.customTable?.mobileBorderRadius.topRight:e.customTable?.mobileBorderRadius.all),mobileBorderRadiusBottomRight:u(e.customTable?.mobileBorderRadius.bottomRight!==null?e.customTable?.mobileBorderRadius.bottomRight:e.customTable?.mobileBorderRadius.all),cellBackgroundColor:u(e.customTable?.cellBackgroundColor),cell_borderPosition:u("cell_borderAll"),cell_borderAll:u(e.customTable?.cell_borderAll),cell_borderTop:u(e.customTable?.cell_borderTop),cell_borderBottom:u(e.customTable?.cell_borderBottom),cell_borderLeft:u(e.customTable?.cell_borderLeft),cell_borderRight:u(e.customTable?.cell_borderRight),cell_paddingLeftRight:u(e.customTable?.cell_paddingLeftRight?.replace(/px$/,"")),cell_paddingTopBottom:u(e.customTable?.cell_paddingTopBottom?.replace(/px$/,"")),cell_paddingRight:u(e.customTable?.cell_paddingRight?.replace(/px$/,"")),cell_paddingLeft:u(e.customTable?.cell_paddingLeft?.replace(/px$/,"")),cell_paddingTop:u(e.customTable?.cell_paddingTop?.replace(/px$/,"")),cell_paddingBottom:u(e.customTable?.cell_paddingBottom?.replace(/px$/,"")),fontFamily:u(e.customTable?.fontFamily),fontSize:u(e.customTable?.fontSize),lineHeight:u(e.customTable?.lineHeight),textStrong:u(e.customTable?.textStrong),textItalic:u(e.customTable?.textItalic),textStrikethrough:u(e.customTable?.textStrikethrough),textUnderline:u(e.customTable?.textUnderline),textLink:u(e.customTable?.textLink),linkHref:u(e.customTable?.linkHref),linkTarget:u(e.customTable?.linkTarget),textColor:u(e.customTable?.textColor),textBackgroundColor:u(e.customTable?.textBackgroundColor),textAlign:u(e.customTable?.textAlign),valign:u(e.customTable?.textValign)}),!u(e.customTable?.borderRadius.all)&&(u(e.customTable?.borderRadius.topLeft)||u(e.customTable?.borderRadius.bottomLeft)||u(e.customTable?.borderRadius.topRight)||u(e.customTable?.borderRadius.bottomRight))?_(!1):_(!0),!u(e.customTable?.mobileBorderRadius.all)&&u(e.customTable?.mobileBorderRadius.topLeft)||u(e.customTable?.mobileBorderRadius.bottomLeft)||u(e.customTable?.mobileBorderRadius.topRight)||u(e.customTable?.mobileBorderRadius.bottomRight)?C(!1):C(!0),Y(e.customTable?.backgroundImage[0].value===""),$(ko=>H[so]?.width||H[so]?.style||H[so]?.color?!0:ko),G(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),me(!!e.boxShadow),V(!!e.width?.value||!!e.minWidth?.value||!!e.maxWidth?.value),de(!!e.customTable?.mobileWidth.value),ie(!!e.exportAsPicture)}},[a,e]),(0,n.useEffect)(()=>{const H=a.getFieldValue("linkHref");typeof e.customTable?.linkHref=="string"&&$e(!0),Ne&&!H&&($e(!1),a.setFieldsValue({linkHref:null})),Ne.current=H||null},[Ve?.textLink,Ve?.linkHref,e.customTable?.linkHref,a]),(0,n.useEffect)(()=>{e.customTable?.linkHref&&Wo(e.customTable?.linkHref||"",xe),a.setFieldsValue({linkHref:typeof e.customTable?.linkHref=="string"?e.customTable.linkHref:"https://"})},[a,e,xe]);const L=H=>{a.setFieldValue("linkHref",H!=="mergetag"?H:""),xe(H)},R=H=>{const Re=a.getFieldsValue(!0),fe=Object.keys(H)[0];let ze;const co=gd.includes(fe)&&Re[fe]?{...Re[fe],width:Re[fe].width===""?Re.borderAll?.width||"1":Re[fe].width,color:Re[fe].color===""?Re.borderAll?.color||Z:Re[fe].color,style:Re[fe].style===""?Re.borderAll?.style||"solid":Re[fe].style}:null,so=["top","right","bottom","left"],mo="em-mob-border_",ko=Bo=>({...r.RESET_BORDER_PARAMS[Bo],classNamePrefix:`${mo}${Bo}-`}),qo=(Bo,ro,Ro,Vo)=>so.reduce((_o,Ho)=>(_o[Ho]={...Bo,[Ro]:Ho===ro?Vo:Bo[Ro],classNamePrefix:`${mo}${Ho}-`},_o),{}),Co=(Bo,ro,Ro,Vo)=>{const _o=Vo.mobileBorderPosition,Ho=_o==="all",vt=ro===""||ro==null;let Lo;Ho?Lo={all:{...Ro.all,[Bo]:vt?null:ro,classNamePrefix:`${mo}all-`},...so.reduce((Ct,ni)=>({...Ct,[ni]:ko(ni)}),{})}:vt?Lo={...Ro,[_o]:ko(_o),all:{...r.RESET_BORDER_PARAMS.all}}:Ro.all?.color!=null&&Ro.all?.width!=null&&Ro.all?.style!=null?Lo={...qo(Ro.all,_o,Bo,ro),all:{...r.RESET_BORDER_PARAMS.all}}:Lo={...Ro,[_o]:{...Ro[_o],[Bo]:ro,classNamePrefix:`${mo}${_o}-`},all:{...r.RESET_BORDER_PARAMS.all}};const It=Ho?Lo.all:Lo[_o],Er={mobileBorderColor:It?.color??Z,mobileBorderWidth:It?.width??1,mobileBorderStyle:It?.style??"solid"};return{newBorders:Lo,sending:{mobileBorder:Lo},formUpdates:Er}};switch(fe){case"exportAsPicture":ze={exportAsPicture:Re.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":ze={boxShadow:{hOffset:Re.boxShadowHOffset,vOffset:Re.boxShadowVOffset,blurRadius:Re.boxShadowBlurRadius,spreadRadius:Re.boxShadowSpreadRadius,color:Re.boxShadowColor,inset:Re.boxShadowInset}};break;case"width":ze={[fe]:{value:H[fe],dim:Re.widthDim}};break;case"widthDim":ze={width:{value:Re.width,dim:H[fe]}};break;case"maxWidth":ze={[fe]:{value:H[fe],dim:Re.maxWidthDim}};break;case"maxWidthDim":ze={maxWidth:{value:Re.maxWidth,dim:H[fe]}};break;case"minWidth":ze={[fe]:{value:H[fe],dim:Re.minWidthDim}};break;case"minWidthDim":ze={minWidth:{value:Re.minWidth,dim:H[fe]}};break;case"backgroundImage":Y(H[fe]===""),ze={[fe]:[{...e.customTable?.backgroundImage[0],value:H[fe]}],backgroundSize:"cover"},a.setFieldsValue({backgroundColor:""});break;case"backgroundColor":Y(!0),ze=H,a.setFieldsValue({backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:""});break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":ze={borderRadius:{[W.BORDER_RADIUS_POSITION[fe]]:+H[fe]}};break;case"mobileWidth":ze={[fe]:{classNamePrefix:"em-mob-width-",value:H[fe],dim:Re.mobileWidthDim}};break;case"mobileWidthDim":ze={mobileWidth:{classNamePrefix:"em-mob-width-",value:Re.mobileWidth||100,dim:H[fe]}};break;case"mobileHeight":ze={[fe]:{classNamePrefix:"em-mob-height-",value:H[fe],dim:Re.mobileHeightDim}};break;case"mobileBorderStyle":case"mobileBorderColor":case"mobileBorderWidth":const Bo={mobileBorderStyle:"style",mobileBorderColor:"color",mobileBorderWidth:"width"}[fe],{newBorders:ro,sending:Ro,formUpdates:Vo}=Co(Bo,H[fe],E,Re);Object.assign(Re,Vo),w(ro),ze=Ro;break;case"mobileBorderPosition":a.setFieldsValue({mobileBorderWidth:E[H[fe]].width||"",mobileBorderColor:E[H[fe]].color||"",mobileBorderStyle:E[H[fe]].style||""});break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":ze={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[fe]]:H[fe],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[fe]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":ze={mobileBoxShadow:{hOffset:Re.mobileBoxShadowHOffset,vOffset:Re.mobileBoxShadowVOffset,blurRadius:Re.mobileBoxShadowBlurRadius,spreadRadius:Re.mobileBoxShadowSpreadRadius,color:Re.mobileBoxShadowColor,inset:Re.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(ze=_t(H),!ze)return;break;case"mobileAlign":ze={[fe]:{classNamePrefix:"em-mob-table_align-",value:H[fe]}};break;case"borderPosition":ze=H,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:ze});break;case"borderAll":H[fe]?.style===""?a.setFieldsValue({borderAll:Te}):a.setFieldsValue({borderTop:Te,borderBottom:Te,borderLeft:Te,borderRight:Te}),ze=H;break;case"borderTop":a.setFieldsValue({borderTop:co}),H[fe]?.style===""?a.setFieldsValue({borderTop:Te}):a.setFieldsValue({borderAll:Te}),ze=H;break;case"borderBottom":a.setFieldsValue({borderBottom:co}),H[fe]?.style===""?a.setFieldsValue({borderBottom:Te}):a.setFieldsValue({borderAll:Te}),ze=H;break;case"borderLeft":a.setFieldsValue({borderLeft:co}),H[fe]?.style===""?a.setFieldsValue({borderLeft:Te}):a.setFieldsValue({borderAll:Te}),ze=H;break;case"borderRight":a.setFieldsValue({borderRight:co}),H[fe]?.style===""?a.setFieldsValue({borderRight:Te}):a.setFieldsValue({borderAll:Te}),ze=H;break;case"cell_borderPosition":ze=H,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:ze});break;case"fontSize":case"lineHeight":if(H[fe]===null||H[fe]===""||H[fe]===void 0)return;ze=H;break;case"linkHref":{const _o=ot(H[fe]);_o!==H[fe]&&a.setFieldValue("linkHref",_o),ze={linkHref:_o},Wo(_o,xe);break}default:ze=H}fe!=="borderPosition"&&s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:ze})},F=(0,n.useCallback)(()=>{td(a,Be,$,X,z,Ie,D)},[a,Be,z,D]),he=(0,n.useCallback)(()=>{id(a,y,O,E,w,s,e)},[a,O,E,s,e]),Le=(0,n.useCallback)(()=>{rd(a,G,oe,_,s,e,D)},[a,oe,_,s,e,D]),eo=(0,n.useCallback)(()=>{ld(a,te,q,s,e)},[a,q,s,e]),Xe=(0,n.useCallback)(()=>{sd(a,me,ue,s,e)},[a,ue,s,e]),lo=(0,n.useCallback)(()=>{ad(a,_e,se,s,e)},[a,se,s,e]),Qe=(0,n.useCallback)(()=>{nd(a,de,ve,s,e)},[a,ve,s,e]),uo=(0,n.useCallback)(()=>{dd(ye)},[ye]),Eo=(0,n.useCallback)(()=>{cd(a,ke,re,s,e)},[a,re,s,e]),B=(0,n.useCallback)(()=>{ud(a,Q,ae,s,e)},[a,ae,s,e]),S=(0,n.useCallback)(()=>{md(a,pe,be,s,e)},[a,be,s,e]),m=(0,n.useCallback)(()=>{pd(J)},[J]),M=(0,n.useCallback)(()=>{hd(a,pe,be,s,e)},[a,be,s,e]);return(0,o.jsxs)(t.ui_kit$Form,{form:a,layout:"vertical",name:i,initialValues:{paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",cell_paddingTop:"",cell_paddingLeft:"",cell_paddingRight:"",cell_paddingBottom:"",cell_paddingLeftRight:"",cell_paddingTopBottom:"",borderAll:{width:"",style:"",color:""},borderTop:{width:"",style:"",color:""},borderBottom:{width:"",style:"",color:""},borderLeft:{width:"",style:"",color:""},borderRight:{width:"",style:"",color:""},cellBackgroundColor:"",backgroundImageForCell:"",cellBackgroundPositionX:"",cellBackgroundPositionY:"",cellBackgroundRepeat:"",cellBackgroundSize:"",backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,show:"all",width:{value:"",dim:""},maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",mobileAlign:"",border:"",boxShadow:"",borderPosition:"",borderColor:"",borderWidth:"",borderStyle:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"px",mobileBorder:"",mobileBorderPosition:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBorderAll:"",mobileBorderTop:"",mobileBorderBottom:"",mobileBorderLeft:"",mobileBorderRight:"",mobileBoxShadow:"",mobileBackgroundColor:"",mobileBackgroundImage:"",cell_border:"",cell_borderColor:"",cell_borderWidth:"",cell_borderStyle:"",cell_borderPosition:"cell_borderAll",cell_borderAll:{color:"",width:"",style:""},cell_borderTop:{color:"",width:"",style:""},cell_borderBottom:{color:"",width:"",style:""},cell_borderLeft:{color:"",width:"",style:""},cell_borderRight:{color:"",width:"",style:""},cell_borderRadiusAll:"",cell_RadiusTopLeft:"",cell_RadiusBottomLeft:"",cell_RadiusTopRight:"",cell_RadiusBottomRight:"",fontFamily:"",fontSize:"",lineHeight:"",textStrong:"",textItalic:"",textStrikethrough:"",textUnderline:"",textLink:"",linkHref:"",textColor:"",textAlign:"",verticalAlign:"",textBackgroundColor:"",valign:""},onValuesChange:R,autoComplete:"off",className:"element-controls",style:{padding:0,display:"flex",flexDirection:"column"},children:[!I&&(0,o.jsx)(t.ui_kit$Tooltip,{title:l("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:l("Appearance on mobile devices"),type:"info"})}),Be?(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(bd,{form:a,onBorderSideClear:R,formValues:Ve,elementSettings:e,appConfig:c,token:d,isMacOS:Ce,__:l,handleToggleShowPaddingCell:m,handleTogglePaddingCell:M,handleToggleBackground:uo,handleToggleBorder:F,handleToggleBorderRadius:Le,paddingCellShow:ee,paddingsExt:be,backgroundShow:De,cellBordersShow:U,borderRadiusShow:oe,oneBorderRadiusValue:T,setOneBorderRadiusValue:_,backgroundImageEmpty:P,backgroundRepeatOptions:Ue,backgroundSizeOptions:le,sendAction:Ge,typografItems:Ye,textInputRef:Fe,linkProtocol:ce,handleLinkProtocolsChange:L,isCodeVision:I})}):(0,o.jsx)(fd,{form:a,onBorderSideClear:R,elementSettings:e,handleToggleShowPadding:B,handleTogglePadding:S,handleToggleBackground:uo,handleToggleBorder:F,handleToggleBorderRadius:Le,handleToggleBoxShadow:Xe,handleToggleMobileSize:Qe,handleToggleMobileBackground:Eo,handleToggleMobileBorder:he,handleToggleMobileBorderRadius:eo,handleToggleMobileBoxShadow:lo,paddingShow:ae,paddingsExt:be,backgroundShow:De,bordersShow:z,borderRadiusShow:oe,boxShadowShow:ue,mobileSizeShow:ve,mobileBackgroundShow:re,mobileBordersShow:O,mobileBorderRadiusShow:q,mobileBoxShadowShow:se,oneBorderRadiusValue:T,setOneBorderRadiusValue:_,oneMobileBorderRadiusValue:j,setOneMobileBorderRadiusValue:C,backgroundImageEmpty:P,backgroundRepeatOptions:Ue,backgroundSizeOptions:le,boxShadow:b,mobileBorders:E,mobileBoxShadow:v,elementViewType:p,mobileViewActive:f})," "]})};Nl.propTypes={elementSettings:g.default.object.isRequired};var dt=({className:e=null,formSettings:i,emailElementType:l,formName:s})=>{const a=r.useDispatch(),d=wo.useSendStyleToggleToIframe(),c=(0,n.useRef)(),p=r.useSelector(r.selectActiveSettingsTab),f=r.useSelector(r.selectElementSettings$1),x=r.useSelector(r.selectElementSettings),k=r.useContainer(),b=r.getComponentRegistry(k),h=l==="email"?f:x,T=h.type,_=T===r.ELEMENT_TYPES.CAROUSEL||T===r.ELEMENT_TYPES.IMG?i.settings:h,[E,w]=(0,n.useState)(_),[v,A]=(0,n.useState)(_);_!==v&&(A(_),w(_));const j=C=>{const P=C.data.operation,Y=C.data.action;if(P===r.EVENT_TYPES.APPLICATION_ACTION){let $=function(O,y=null){const oe={[O]:y||!E[O]};d(oe,E.type),a(r.setEmailSettings(oe)),w(G=>({...G,...oe}))};var z=$;Y==="toggle_strong"&&$("textStrong"),Y==="toggle_italic"&&$("textItalic"),Y==="toggle_underline"&&$("textUnderline"),Y==="toggle_strikethrough"&&$("textStrikethrough"),Y==="textAlign_left"&&$("textAlign","left"),Y==="textAlign_right"&&$("textAlign","right"),Y==="textAlign_center"&&$("textAlign","center")}};return r.useListenPostMessage(j),(0,o.jsx)("div",{className:"selected-element-panel",children:(0,o.jsx)(r.CSSTransition,{nodeRef:c,in:p===r.PROPERTIES,timeout:300,classNames:"transition",children:(0,o.jsxs)("div",{ref:c,className:(0,He.default)("selected-element-panel-content",{[e]:e}),children:[i?.type==="advanced"&&i?.content?(0,o.jsx)(n.Fragment,{children:b.getReactElement(i.content)},i.instanceKey):null,(h.type===r.ELEMENT_TYPES.IMG||h.type===r.ELEMENT_TYPES.COUNTDOWN||h.type===r.ELEMENT_TYPES.VIDEO)&&(0,o.jsx)(Fr,{elementSettings:h}),h.type===r.ELEMENT_TYPES.TEXT&&(0,o.jsx)(mn,{elementSettings:h}),h.type===r.ELEMENT_TYPES.LINK&&(0,o.jsx)(ol,{elementSettings:h}),h.type===r.ELEMENT_TYPES.TABLE&&(0,o.jsx)(el,{elementSettings:h}),h.type===r.ELEMENT_TYPES.CUSTOM_TABLE&&(0,o.jsx)(Nl,{elementSettings:h,formName:s}),(h.type===r.ELEMENT_TYPES.TD||h.type===r.ELEMENT_TYPES.STRUCTURE||h.type===r.ELEMENT_TYPES.GROUP||h.type===r.ELEMENT_TYPES.COLUMN)&&(0,o.jsx)(al,{elementSettings:h}),h.type===r.ELEMENT_TYPES.VAR&&(0,o.jsx)(gl,{elementSettings:h}),h.type===r.ELEMENT_TYPES.BUTTON&&(0,o.jsx)(fl,{elementSettings:h}),h.type===r.ELEMENT_TYPES.DIV&&(0,o.jsx)(cl,{elementSettings:h}),h.type===r.ELEMENT_TYPES.VINDENT&&(0,o.jsx)(rl,{elementSettings:h}),h.type===r.ELEMENT_TYPES.FLOAT_BLOCK&&(0,o.jsx)(pl,{elementSettings:h}),i.type===r.ELEMENT_TYPES.CAROUSEL&&(0,o.jsx)(Bl,{elementSettings:i}),i.type===r.ELEMENT_TYPES.ACCORDION&&(0,o.jsx)(Sl,{elementSettings:i}),i.type===r.ELEMENT_TYPES.SOCIAL&&(0,o.jsx)(Il,{elementSettings:i})]})})})};dt.propTypes={className:g.default.string,formName:g.default.string};function Yo(){return!!document.querySelector(".selected-element-panel__columns-settings__links__add")?.closest(".selected-element-panel")}var Ll=({emailElementType:e,isSelectedElement:i=!1,selectedElement:l={parent:!1}})=>{const{__:s}=r.useI18n(),a=r.useDispatch(),d=r.useSendPostMessage(),[c]=t.ui_kit$Form.useForm(),p=(0,n.useRef)(),f=(0,n.useRef)(),x=r.useSelector(r.selectElementSettings$1),k=r.useSelector(r.selectElementSettings),b=r.useAppConfig(),h=l||(e==="email"?x:k),[T,_]=(0,n.useState)(h.floatBlocks?.wrap),[E,w]=(0,n.useState)(h.floatBlocks?.dirRevers),[v,A]=(0,n.useState)(null),[j,C]=(0,n.useState)(0),[P,Y]=(0,n.useState)([]),z=r.useSelector(r.selectEmailViewType),$=(0,n.useCallback)(re=>{a(e==="email"?r.setElementSettings$1(re):r.setElementSettings(re))},[a,e]);(0,n.useEffect)(()=>{if(h&&JSON.stringify(h)!=="{}"&&c._init){if(c.resetFields(),c.setFieldsValue({gap:h.floatBlocks?.gap,gapMobile:h.floatBlocks?.gapMobile,gapDim:"px",valign:h.floatBlocks?.valign}),h.floatBlocks?.items.length>0){let Q=function(be,pe){if(be.length!==pe.length)return!1;for(let ee=0;ee<be.length;ee++)if(be[ee]!==pe[ee])return!1;return!0};var re=Q;const ke=h.floatBlocks.items.reduce((be,pe)=>be+pe.width,0),ae=h.floatBlocks.items.map(be=>((be.width||0)/ke*100).toFixed(1));C(ke),!Q(ae,P)&&h.changeKey!=="gap"&&Y(ae),h.floatBlocks.items.forEach((be,pe)=>c.setFieldsValue({["width-"+pe]:be.width||0})),h.floatBlocks.items.length>=8?document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.add("noactive"):document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.contains("noactive")&&document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.remove("noactive")}_(h.floatBlocks?.wrap)}},[c,h,v,P]);let O=0;h.floatBlocks?.items.length>0&&(O=h.floatBlocks.items.length);const y=(re,ke)=>{Object.keys(ke).forEach(ae=>{if(ae.includes("width")){const Q=parseInt(ae.match(/\d+/));c.setFieldsValue({[ae]:re.items[Q]})}})},[oe,G]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const re=()=>G(!0),ke=()=>G(!1);return document.addEventListener("keyup",ke),document.addEventListener("keydown",re),()=>{document.removeEventListener("keyup",ke),document.removeEventListener("keydown",re)}},[]);const q=re=>{f.current&&oe&&clearTimeout(f.current),f.current=setTimeout(()=>ke(re),50);function ke(ae){const Q=c.getFieldsValue(!0),be=Object.keys(ae)[0];if(A(be),be.includes("width")){if(Q[be]&&Q[be]>=30){let pe={items:[],gap:Q.gap,valign:Q.valign,activateSection:i?void 0:"structure"},ee=0;if(document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").length>1){ee=parseFloat(Object.keys(ae)[0].substring(Object.keys(ae)[0].length-1));const J=Q["width-"+(ee+1)]?ee+1:0;let U=j;Object.keys(Q).forEach(X=>{X.includes("width")&&X.indexOf("width-"+J)===-1&&(U-=Q[X])}),Q["width-"+J]=U}Object.keys(Q).forEach(J=>{J.includes("width")&&pe.items.push(Q[J])}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:pe}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...pe,items:h.floatBlocks.items.map((J,U)=>({...h.floatBlocks.items[U],width:pe.items[U]}))},changeKey:be})}}else if(be==="gap"){const pe={items:h.floatBlocks.items.map(X=>X.width),gap:h.floatBlocks.gap},ee=pe.items.reduce((X,ce)=>X+ce,0)+(pe.items.length-1)*pe.gap,J=Q.gap,U=ee-(pe.items.length-1)*J;if(U>pe.items.length*30||h.floatBlocks.gap-ae>=0){const X=(Ae,we)=>Math.round(we*Ae/100);let ce=pe.items.map((Ae,we)=>X(P[we],U));const xe=ee-(ce.reduce((Ae,we)=>Ae+we,0)+(pe.items.length-1)*J);if(xe!==0){const Ae=ce.length-Math.abs(xe);ce=ce.map((we,$e)=>Ae<=$e?we+(xe>0?1:-1):we)}let ne={items:ce,gap:J||0};y(ne,Q),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGap",settings:ne,editFromStructure:Yo()}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...ne,items:h.floatBlocks.items.map((Ae,we)=>({...Ae,width:ne.items[we]}))},changeKey:be})}}else if(be==="valign"){let pe={valign:Q.valign};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksValign",settings:pe,editFromStructure:Yo()}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...pe},changeKey:be})}else if(be==="gapMobile"){let pe={mobileHeight:{classNamePrefix:"em-mob-height-",value:ae[be],dim:"px"}};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGapMobile",settings:pe}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,gapMobile:pe.mobileHeight.value},changeKey:be})}setTimeout(()=>p?.current&&p.current.focus({cursor:"end"}),600)}},te=()=>{const re=c.getFieldsValue(!0),ke=h.floatBlocks.items.map(U=>U.width);let ae={items:[],gap:re.gap};const Q=ke.reduce((U,X)=>U+X,0),be=ke.length,pe=Math.ceil(j/be)*be,ee=pe/be,J=Q-pe;if(ae.items=Array(be).fill(ee),J!==0){const U=ke.length-Math.abs(J);ae.items=ae.items.map((X,ce)=>U<=ce?X+(J>0?1:-1):X)}y(ae,re),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:ae,editFromStructure:Yo()}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...ae,items:h.floatBlocks.items.map((U,X)=>({...U,width:ae.items[X]}))},changeKey:"width"})},ue=re=>{const ke=c.getFieldsValue(!0),ae=h.floatBlocks.items.map(ne=>ne.width),Q=h.floatBlocks.gap||20,be=re.cols-ae.length;let pe=[],ee=ae.reduce((ne,Ae)=>ne+Ae,0);re.cols>=ae.length?ee-=Q*be:ee+=Q*Math.abs(be);const J=Math.round(ee/re.cols);function U(ne,Ae){const we=[];for(let $e=0;$e<ne;$e++)we.push(re.width?.[$e]?Math.round(ee/100*re.width?.[$e]):Ae);return we}pe=U(re.cols,J);const X=ee-pe.reduce((ne,Ae)=>ne+Ae,0);if(X!==0){let ne=pe.map((we,$e)=>[$e,we]).filter(we=>we[1]>30);const Ae=ne.length-Math.abs(X);ne=ne.map((we,$e)=>{const K=Ae<=$e?we[1]+(X>0?1:-1):we[1];return[we[0],K]}),ne.map(we=>(pe[we[0]]=we[1],we))}let ce={items:pe,gap:ke.gap||20};const xe=pe.reduce((ne,Ae)=>ne+Ae,0);Y(pe.map(ne=>(ne/xe*100).toFixed(1))),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksPreset",settings:ce,editFromStructure:Yo()}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...ce,items:ce.items.map((ne,Ae)=>({width:ne,current:!1}))},changeKey:"width"})},me=()=>{const re=c.getFieldsValue(!0);if(O<8){const ke=h.floatBlocks.items.map(U=>U.width),ae=h.floatBlocks.gap,Q=ke.reduce((U,X)=>U+(X>30?X:0),0),be=(Q-30-ae)/Q,pe=ke.map(U=>U>30?Math.round(U*be):U).reduce((U,X)=>U+(X>30?X:0),0);let ee=ke.map(U=>U>30?Math.round(U*be):U);ee.push(30);const J=Q-pe-30-ae;if(J!==0){let U=ee.map((ce,xe)=>[xe,ce]).filter(ce=>ce[1]>30);const X=U.length-Math.abs(J);U=U.map((ce,xe)=>{const ne=X<=xe?ce[1]+(J>0?1:-1):ce[1];return[ce[0],ne]}),U.map(ce=>(ee[ce[0]]=ce[1],ce))}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_ADD,settings:{gap:re.gap,gapMobile:re.gapMobile,minWidth:30},editFromStructure:Yo()}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,items:ee.map((U,X)=>({width:U,current:h.floatBlocks.items[X]?.current||!1}))},changeKey:"width"})}else document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.add("noactive")},se=re=>{const ke=c.getFieldsValue(!0);let ae=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((ne,Ae)=>{ne===re.target.closest(".selected-element-panel__columns-settings__controls__column")&&(ae=Ae)});const Q=+h.floatBlocks.gap,be=+h.floatBlocks.items[ae].width+Q,pe=h.floatBlocks.items.map(ne=>+ne.width),ee=(pe.length-1)*Q,J=pe.reduce((ne,Ae)=>ne+Ae,0)+ee,U=pe.length-1,X=Math.floor(be/U);let ce=pe.filter((ne,Ae)=>Ae!==ae).map(ne=>ne+X);const xe=J-(ce.reduce((ne,Ae)=>ne+Ae,0)+(pe.length-2)*Q);if(xe!==0){const ne=ce.length-Math.abs(xe);ce=ce.map((Ae,we)=>ne<=we?Ae+(xe>0?1:-1):Ae)}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_REMOVE,settings:{removedBlockIndex:ae,gap:ke.gap},editFromStructure:Yo()}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,items:ce.map((ne,Ae)=>({width:ne,current:h.floatBlocks.items.filter((we,$e)=>$e!==ae)[Ae].current}))},changeKey:"width"})},_e=re=>{if(O>=8)return;const ke=c.getFieldsValue(!0);let ae=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((we,$e)=>{we===re.target.closest(".selected-element-panel__columns-settings__controls__column")&&(ae=$e)});const Q=parseFloat(ke.gap)||0,be=h.floatBlocks.items.map(we=>+we.width),pe=be[ae],ee=be.reduce((we,$e)=>we+$e,0),J=ee-Q,U=ee+pe,X=U>0?J/U:1;let ce=[];const xe=[];be.forEach((we,$e)=>{ce.push(Math.max(30,Math.round(we*X))),xe.push(h.floatBlocks.items[$e]?.current||!1),$e===ae&&(ce.push(Math.max(30,Math.round(pe*X))),xe.push(!1))});const ne=J-ce.reduce((we,$e)=>we+$e,0);if(ne!==0){let we=ce.map((K,ie)=>[ie,K]).filter(K=>K[1]>30);const $e=we.length-Math.abs(ne);we=we.map((K,ie)=>[K[0],$e<=ie?K[1]+(ne>0?1:-1):K[1]]),we.forEach(K=>ce[K[0]]=K[1])}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_COPY,settings:{copiedBlockIndex:ae,gap:ke.gap,widths:ce},editFromStructure:Yo()});const Ae=ce.reduce((we,$e)=>we+$e,0);Y(ce.map(we=>(we/Ae*100).toFixed(1))),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,items:ce.map((we,$e)=>({width:we,current:xe[$e]||!1}))},changeKey:"width"})},ve=(0,n.useCallback)(re=>{const ke=".selected-element-panel__columns-settings__controls__column",ae=Array.from(document.querySelectorAll(ke)).indexOf(re.target.closest(ke)),Q=ae-1;if(Q<0)return;const be=h.floatBlocks,pe=be.items.map(({width:ee,current:J})=>({width:ee,current:J||!1}));[pe[Q],pe[ae]]=[pe[ae],pe[Q]],d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_SWAP,settings:{indexA:Q,indexB:ae},editFromStructure:Yo()}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...be,items:pe},changeKey:"width"})},[h,$,i,d]),de=re=>{_(re),d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_WRAP,settings:{wrap:!T}}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,wrap:!T},changeKey:"wrap"})},De=re=>{w(re),d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_DIR,settings:{dirRevert:!E}}),$({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,dirRevert:!E},changeKey:"dir"})},ye=()=>setTimeout(()=>p?.current&&p.current.focus({cursor:"end"}),300);return h.floatBlocks&&h.floatBlocks.items.length>0&&(0,o.jsx)(t.ui_kit$Form,{layout:"vertical",form:c,name:"float_blocks_settings_form",autoComplete:"off",initialValues:{gap:h.floatBlocks?.gap||0,gapDim:"px",gapMobile:h.floatBlocks?.gapMobile||0,valign:h.floatBlocks?.valign||"top",...h.floatBlocks?.items.reduce((re,{width:ke},ae)=>(re[`width-${ae}`]=ke,re),{})},onValuesChange:q,onFieldsChange:ye,className:"element-controls",children:(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings",style:{paddingTop:b.switchDesktopMobilePropsEnabled||b.stepToOtherElementEnabled||b.deleteButtonEnabled||h.type==="structure"?0:24},children:[h.floatBlocks.items.length===1&&(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:10},title:s('The selected element is in the block that supports a multicolumn structure. To add a new column, click the "Add a column" button.'),type:"info"}),z!=="mobile"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__header",children:[(0,o.jsx)("span",{className:"selected-element-panel__columns-settings__header-title",children:s("Columns")}),(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__links",children:[(0,o.jsxs)("span",{className:"selected-element-panel__columns-settings__links__add",onClick:me,children:[(0,o.jsx)(r.EmIcons,{icon:"PlusCircleOutlined",component:t.icons$PlusCircleOutlined,size:16,strokeWidth:b.iconStrokeWidth})," ",s("Add column")]}),h.floatBlocks.items.length>1&&(0,o.jsx)("span",{onClick:te,children:(0,o.jsxs)(t.ui_kit$Tooltip,{title:s("Make columns the same width."),children:[(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined})," ",s("Equalize")]})})]})]}),h.floatBlocks.items.length>1&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:16},children:(0,o.jsx)("div",{className:"selected-element-panel__columns-settings__controls",children:h.floatBlocks.items.map((re,ke)=>(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__controls__column "+(re.current?"current":""),style:{width:re.width/j*100+"%"},children:[ke>0&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Swap columns"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__swap",onClick:ve,children:(0,o.jsx)(r.EmIcons,{icon:"SwapHorizontalIcon",component:t.icons$SwapHorizontalIcon,size:15,strokeWidth:b.iconStrokeWidth})})}),h.floatBlocks.items.length>1&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Delete column"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__remove",onClick:se,children:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:15,strokeWidth:b.iconStrokeWidth,style:{color:"#ff4d4f"}})})}),h.floatBlocks.items.length<8&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Copy column"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__copy",onClick:_e,children:(0,o.jsx)(r.EmIcons,{icon:"CopyOutlined",component:t.icons$CopyOutlined,size:15,strokeWidth:b.iconStrokeWidth})})}),(0,o.jsx)("div",{className:"selected-element-panel__columns-settings__controls__field",children:(0,o.jsx)(t.ui_kit$Form.Item,{label:"",name:"width-"+ke,children:(0,o.jsx)(t.ui_kit$InputNumber,{min:30,value:re.width||0,placeholder:s("Width"),ref:v==="width-"+ke&&p})})})]},"floatblock-"+ke))})}),(0,o.jsxs)("div",{className:"columns-presets",children:[(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{ue({cols:1})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol1",component:t.icons$LayoutCol1})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{ue({cols:2})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol2",component:t.icons$LayoutCol2})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{ue({cols:2,width:[66,34]})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol2WideLeft",component:t.icons$LayoutCol2WideLeft})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{ue({cols:2,width:[34,66]})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol2WideRight",component:t.icons$LayoutCol2WideRight})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{ue({cols:3})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol3",component:t.icons$LayoutCol3})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{ue({cols:4})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol4",component:t.icons$LayoutCol4})})]})]}),h.floatBlocks.items.length>1&&(0,o.jsxs)(o.Fragment,{children:[z==="mobile"&&(0,o.jsx)("div",{style:{marginBottom:24},children:(0,o.jsx)(t.ui_kit$Switch,{id:"column-wrap",label:s("Line break on mobile devices"),size:"small",disabled:h.floatBlocks?.wrap===void 0,checked:T,onChange:de,labelStyle:{position:"relative",top:2}})}),z!=="mobile"&&(0,o.jsx)("div",{style:{marginBottom:24},children:(0,o.jsx)(t.ui_kit$Switch,{id:"column-dir-revers",label:s("Reverse order on desktop"),size:"small",disabled:h.floatBlocks?.wrap===void 0,checked:E,onChange:De,labelStyle:{position:"relative",top:2}})})]}),h.floatBlocks.items.length>1&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:s("Vertical alignment"),titleStyle:{paddingTop:20},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"valign",style:{marginBottom:0},children:(0,o.jsx)(t.ui_kit$FormVerticalAlignControl,{disabled:h.floatBlocks.items.length<=1,strokeWidth:b.iconStrokeWidth,labels:{alignTop:s("Align top"),alignMiddle:s("Center vertically"),alignBottom:s("Align bottom")}})})})}),(0,o.jsxs)(o.Fragment,{children:[z!=="mobile"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:s("Indent between columns"),titleStyle:{paddingTop:20},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gap",style:{marginBottom:20},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,disabled:h.floatBlocks.items.length<=1,placeholder:s("Indent between columns"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px",ref:v==="gap"&&p})})})}),z==="mobile"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:s("Indent in mobile"),titleStyle:{paddingTop:20},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gapMobile",style:{marginBottom:20},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,disabled:h.floatBlocks.items.length<=1,placeholder:s("Indent in mobile"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})})]})]})]})]})})};Ll.propTypes={selectedElement:g.default.shape({parent:g.default.string})};var _d=()=>{},Ol=({email:e,formSettings:i={},onClosePanel:l=_d})=>{const{__:s}=r.useI18n(),a=r.useRootElement(),d=r.useDispatch(),c=r.useSendPostMessage(),p=Object.prototype.hasOwnProperty.call(e,"type")?r.BLOCK:r.EMAIL,f=r.useSelector(r.selectElementSettings$1),x=r.useSelector(r.selectElementSettings),k=r.useSelector(r.selectPropertiesPanelKey),b=p==="email"?f:x,h=Object.keys(i).length>0?i.settings:b,T=i?.type==="advanced"&&!!i?.content,_=!!i?.extraTabs?.length,E=r.useAppConfig(),w=h.type==="customTable",v=!!h.type&&!!h.floatBlocks?.items.length>0&&!!h.floatBlocks?.items.filter(y=>!!y.width).length>0,A=(0,n.useRef)(null);(0,n.useEffect)(()=>{const y=Object.values(r.ELEMENT_TYPES),oe=h.type&&y.includes(h.type)?`${h.type}-${JSON.stringify(h.path||[])}`:null;if(T||_){const G=a.querySelector(".email-pane .panel-form__body");G&&(G.scrollTop=0),d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else if(h.type&&y.includes(h.type)){const G=A.current!==oe;if(A.current=oe,h.activateSection!=="structure"){if(G){const q=a.querySelector(".email-pane .panel-form__body");q&&(q.scrollTop=0)}d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else d(r.setPropertiesPanelKey(r.STRUCTURE))}else JSON.stringify(h)!=="{}"&&(A.current=null,d(r.setPropertiesPanelKey("")))},[h,d,a,T,_]);const j=(0,n.useMemo)(()=>{const y=[{key:r.EDIT_SELECTED_ELEMENT,label:(0,o.jsx)("span",{style:{textTransform:"capitalize"},children:h.caption?h.caption:s("Edit element")})}];return v&&y.push({key:r.STRUCTURE,label:s("Columns")}),y},[h.caption,v,s]),C=(0,n.useMemo)(()=>[{key:r.EDIT_SELECTED_ELEMENT,label:s("Cell")},{key:r.TABLE_PROPERTIES,label:s("Table")}],[s]),P=y=>{y.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_REMOVE}),d(p==="email"?r.setElementSettings$1({}):r.setElementSettings({}))},Y=y=>{y.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_PARENT_GET})},z=()=>{l(h),d(r.resetToLastActiveSettingsTab()),setTimeout(()=>{d(p==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET})},$=(0,o.jsxs)(o.Fragment,{children:[E.deleteButtonEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Remove element by Delete Key"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{type:"text",onClick:P,disabled:!h.deletable,icon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:18,strokeWidth:E.iconStrokeWidth})})}),E.stepToOtherElementEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Up to parent element"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{type:"text",onClick:Y,disabled:!h.parent,icon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"GoToParent",component:t.icons$GoToParent,size:18,strokeWidth:E.iconStrokeWidth})})})]}),O=E.switchDesktopMobilePropsEnabled||E.stepToOtherElementEnabled||E.deleteButtonEnabled;return(0,o.jsxs)(t.ui_kit$PanelForm,{children:[(0,o.jsx)(t.ui_kit$PanelForm.Header,{onClose:z,closeIcon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"Close",component:t.icons$Close,size:24,strokeWidth:E.iconStrokeWidth}),extra:O?$:void 0,children:(0,o.jsx)(t.ui_kit$Tabs,{items:w?C:j,activeKey:k,onChange:y=>d(r.setPropertiesPanelKey(y||""))})}),(0,o.jsx)(t.ui_kit$PanelForm.Body,{children:w?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{display:k==="Edit selected element"?void 0:"none"},children:(0,o.jsx)(dt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:p,formName:`${r.EDIT_SELECTED_TABLE_CELLS}`})}),(0,o.jsx)("div",{style:{display:k==="Table properties"?void 0:"none"},children:(0,o.jsx)(dt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:p,formName:`${r.TABLE_PROPERTIES}`})})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{display:k==="Edit selected element"?void 0:"none"},children:(0,o.jsx)(dt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:p})}),v&&(0,o.jsx)("div",{style:{display:k==="Structure"?void 0:"none"},children:(0,o.jsx)(Ll,{selectedElement:h,emailElementType:p,isSelectedElement:!1})})]})})]})},xd=({taxonomy:e})=>{const{__:i,_x:l}=r.useI18n(),s=r.useDispatch(),[a]=t.ui_kit$Form.useForm(),d=(0,n.useRef)(null),c=r.useSelector(r.selectActiveModal$1)===r.MODALS.ADD_NEW_GROUP_MODAL,p=r.useNotification(),f=r.useProjectData(),x=(0,n.useCallback)(()=>{a.resetFields(),setTimeout(()=>d.current?.focus({cursor:"start"}),0)},[a]);(0,n.useEffect)(()=>{c&&x()},[c,x]);const k=()=>s(r.closeModal$1()),[b,h]=r.useAddTermMutation(),[T,_]=(0,n.useState)(!1),E=()=>{a.validateFields().then(({name:w})=>(_(!0),b({project:f,kind:"group",name:w}).then(v=>{if("error"in v){p.error(v);return}p.success({title:i("The group “")+v.data.name+l("” was successfully created.",e)}),k()}))).catch(w=>{}).finally(()=>_(!1))};return(0,o.jsx)(t.ui_kit$Modal,{title:i("Add a new group"),open:c,onOk:E,onCancel:k,className:"new-group-modal",footer:[(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"large",loading:h.isLoading||T,onClick:E,children:i("Create group")},"submit")],children:(0,o.jsx)(t.ui_kit$Form,{form:a,layout:"vertical",name:"add_new_group_form",onFinish:E,initialValues:{remember:!1,name:""},autoComplete:"off",style:{paddingTop:10},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"name",rules:[{required:!0,message:i("Please enter the group name")}],children:(0,o.jsx)(t.ui_kit$Input,{disabled:h.isLoading,size:"large",placeholder:i("Enter the group name"),ref:d,style:{marginBottom:5}})})})})},kd=({group:e,refetch:i})=>{const{__:l,_x:s}=r.useI18n(),a=r.useDispatch(),[d]=t.ui_kit$Form.useForm(),c=(0,n.useRef)(null),p=r.useSelector(r.selectActiveModal$1)===r.MODALS.EDIT_GROUP_NAME_MODAL,f=r.useNotification(),{id:x=null,name:k=""}=e,b=()=>a(r.closeModal$1()),[h,T]=r.useEditTermMutation();(0,n.useEffect)(()=>{p&&d.setFieldsValue({name:k})},[p,k,d]);const _=()=>{d.validateFields().then(({name:E})=>{h({kind:"group",id:x,name:E}).then(({data:w,error:v})=>{v?(f.error({error:v}),d.setFieldValue("name",E)):(i().then(({data:A})=>{if(A){const j=A[0]?.children?.find(C=>C.id===x)?.name;d.setFieldValue("name",j)}}),b(),f.success({title:l("The group “")+E+s("” was successfully changed to “","group")+w.name+l("”.")}))})})};return(0,o.jsx)(t.ui_kit$Modal,{title:l("Change group name"),open:p,onOk:_,onCancel:b,className:"new-group-name-modal",footer:[(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"large",loading:T.isLoading,onClick:_,children:l("Change name")},"submit")],children:(0,o.jsx)(t.ui_kit$Form,{form:d,layout:"vertical",name:"rename_group_form",onFinish:_,initialValues:{remember:!1,name:k},autoComplete:"off",style:{paddingTop:10},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"name",rules:[{required:!0,message:l("Please enter the group name")}],children:(0,o.jsx)(t.ui_kit$Input,{disabled:T.isLoading,size:"large",placeholder:l("Enter the group name"),ref:c,style:{marginBottom:5}})})})})},Ed=({className:e,refetchProjectGroups:i,isLoading:l})=>{const{__:s,_x:a}=r.useI18n(),d=r.useDispatch(),c=r.useNotification(),{modal:p}=t.ui_kit$App.useApp(),{confirm:f}=p,{token:x}=(0,t.ui_kit$useToken)(),k=r.useSelector(r.selectProjectGroups),[b]=r.useDeleteTermMutation(),h=(A,j)=>{b({kind:"group",id:Number(A)}).unwrap().then(C=>{C?.deleted&&c.success({title:s("The group “")+j+a("” was successfully deleted.","recovery")})}).catch(C=>{c.error({error:C})})},T=(A,j)=>{f({mask:{closable:!0},centered:!0,title:a("Are you sure to delete “","group")+j+s("” group and all nested groups?"),icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:22,style:{color:t.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0}}),okText:s("Yes"),cancelText:s("No"),onOk:()=>h(String(A),j)})},_=(A,j)=>{d(r.openModal$1(r.MODALS.EDIT_GROUP_NAME_MODAL)),v({id:A,name:j})},E=A=>[{label:s("Rename"),key:"Rename",icon:(0,o.jsx)(r.EmIcons,{icon:"CopyOutlined",component:t.icons$CopyOutlined,size:16}),onClick:()=>_(A.id,A.name)},{label:s("Remove"),icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16}),key:"Remove",style:{color:"#ff4d4f"},onClick:()=>T(A.id,A.name)}],[w,v]=(0,n.useState)({id:null,name:""});return(0,o.jsxs)("div",{className:(0,He.default)("groups-management",{[e]:e}),children:[l?(0,o.jsx)(t.ui_kit$Skeleton,{active:!0}):(0,o.jsxs)(t.ui_kit$Row,{children:[!!k?.length&&k?.map((A,j)=>(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:`group_${A.id}`,style:{marginBottom:x.formItemMarginBottomMD},label:(0,o.jsxs)(t.ui_kit$Flex,{justify:"space-between",align:"center",style:{width:"100%"},children:[(0,o.jsx)("span",{children:A.name}),(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"groups-management__group_menu","data-group-id":A.id,size:"large",children:(0,o.jsx)(t.ui_kit$Dropdown,{className:"groups-management__group_menu-inner",placement:"bottomLeft",menu:{items:E(A)},trigger:["hover"],children:(0,o.jsx)("span",{className:"groups-management__actions",children:(0,o.jsx)(r.EmIcons,{icon:"MoreOutlined",component:t.icons$MoreOutlined})})})})]}),className:"groups-management__group-select",rules:[{message:"Please input category name!",type:"array"}],children:(0,o.jsx)(t.ui_kit$Select,{mode:"tags",style:{width:"100%"},placeholder:s("Type category here"),options:A.children?.map(C=>({label:C.name,value:String(C.id)})),tagRender:C=>{const{label:P,closable:Y,onClose:z}=C,$=O=>{O.preventDefault(),O.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:x.colorPrimary,onMouseDown:$,closable:Y,onClose:z,style:{borderRadius:6},children:P})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})},A.id)),(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:x.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Button,{id:"add_group_button",icon:(0,o.jsx)(r.EmIcons,{icon:"AddSlide",component:t.icons$AddSlide}),style:{width:"100%"},onClick:()=>d(r.openModal$1(r.MODALS.ADD_NEW_GROUP_MODAL)),children:s("Add group")})})})]}),(0,o.jsx)(xd,{taxonomy:r.ELEMENT_TYPES.GROUP}),(0,o.jsx)(kd,{group:w,refetch:i})]})},{title:Ci,description:Xt,tags:Kt,type:Pi,is_template:Bd,group:Sd}={title:"title",description:"description",tags:"tags",type:"type",is_template:"is_template",group:"group"},Td={[Ci]:"",[Xt]:"",[Kt]:[],[Bd]:!1},Rd={[Xt]:"",[Kt]:[],[Pi]:""};function yd(e){const i=new Set;return e?.filter(l=>i.has(l.name)?!1:(i.add(l.name),!0))}var wd=e=>Array.isArray(e)&&e.length>0,$l=({className:e="",element:i})=>{const{__:l}=r.useI18n(),s=r.useDispatch(),a=r.useEmailAttributesWriter(),[d]=t.ui_kit$Form.useForm(),{token:c}=(0,t.ui_kit$useToken)(),p=r.useAppConfig(),f=r.useSelector(r.selectProjectGroups),{data:x}=r.useGetBlocksSchemaQuery(),k=r.useProjectData(),b=i.hasOwnProperty("type")?r.BLOCK:r.EMAIL,h=i.hasOwnProperty("type")?r.BLOCK_TAGS:r.EMAIL_TAGS,{data:T,refetch:_,isLoading:E,isFetching:w,isUninitialized:v,isSuccess:A}=r.useGetTermsQuery({project:k,kind:"group"},{skip:!k?.id});(0,n.useEffect)(()=>{T&&s(r.projectGroupsLoaded(T,b==="email"?i.group??[]:void 0))},[s,T,b,i.group]),(0,n.useEffect)(()=>{!v&&_()},[v,_]);const[j,C]=(0,n.useState)([]),[P,Y]=(0,n.useState)([]),[z,$]=(0,n.useState)(i.is_template||!1),O=r.useProjectData();(0,n.useEffect)(()=>{!v&&_()},[i.group,_,v]),(0,n.useEffect)(()=>{if(A&&i.is_template&&wd(i.group)){const q=i.group;let te={};q.length&&f.length&&q?.forEach(me=>{f?.forEach(se=>{let _e=se.children.find(ve=>ve.id===me);_e&&(te.hasOwnProperty(se.id)||(te[se.id]=[]),te[se.id].push({label:_e.name,value:_e.id}))})});let ue={};for(let me in te)te.hasOwnProperty(+me)&&(ue[`group_${me}`]=te[me].map(se=>({...se,value:String(se.value)})));d.setFieldsValue(ue)}},[d,f,i.is_template,i.group,A]);const{data:y}=r.useGetTermsQuery({project:O,kind:h},{skip:!O?.id});(0,n.useEffect)(()=>{Y(yd(y)?.map(q=>({value:q.name,key:q.id})))},[y]),(0,n.useEffect)(()=>{if(i){const q=wo.getTaxonomy(i,h)?.map(me=>me.name),te=i.emailtags||i.blocktags,ue=wo.getTaxonomy(i,h)?.filter(me=>te.includes(me.id)).map(me=>me.name);d.setFieldsValue({title:i.title,description:i.description,tags:i.tags||ue||q,type:i.type})}},[d,i,h]);const oe=q=>{const te=Object.keys(q)[0],ue=q,me=te.split("_")[0];if(me===Ci)a({title:ue[te]});else if(me===Xt)a({description:ue[te]});else if(me===Kt){const se=ue[te];a({tags:se?.map(_e=>_e.trim())})}else me==="is"&&b==="email"&&a({is_template:ue[te]});switch(te.split("_")[0]){case Sd:s(r.setEmailGroups({[te.split("_")[1]]:q[te]}));break;case Pi:s(r.blocksApi.util.updateQueryData("getBlock",i.id,se=>{Object.assign(se,{type:q[te]})}));break;default:return}};(0,n.useEffect)(()=>{if(x){const q=x.schema.properties.acf.properties.type.items.enum;let te=[];const ue={Applications:l("Apps"),Articles:l("Article"),Banners:l("Banners"),Buttons:l("Buttons"),"Call to Action":l("Call to Action"),Contacts:l("Contacts"),Content:l("Content"),"E-Commerce":l("E-Commerce"),Feature:l("Features"),Footer:l("Footers"),Header:l("Headers"),Lists:l("Lists"),Menu:l("Menus"),Other:l("Others"),Polls:l("Polls"),Promocodes:l("Promocodes"),Separators:l("Separators")};for(let me in q)te.push({label:ue[q[me]],value:q[me]});C(te)}},[x,l]);const G=q=>{$(q)};return(0,o.jsx)("div",{className:(0,He.default)("settings-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"settings_panel_form",initialValues:b==="email"?{EmailInitialValues:Td}:Rd,onValuesChange:oe,autoComplete:"off",children:[p.subjectEnabled&&b==="email"&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Title"),name:Ci,tooltip:{title:l("The title of the email is displayed in the list of the templates and usually matches the subject line, but you can change it."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$TextArea,{placeholder:l("Type title here"),autoSize:{minRows:1}})}),p.descriptionEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Description"),name:Xt,tooltip:{title:l("Description is used in other sections of the service."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$TextArea,{placeholder:l("Type your description here"),autoSize:{minRows:2}})}),p.tagsEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Tags"),name:Kt,tooltip:{title:l("Tags help you find the block in the list."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},rules:[{message:l("Please input tags!"),type:"array"}],children:(0,o.jsx)(t.ui_kit$Select,{mode:"tags",style:{width:"100%"},placeholder:l("Type your tags here"),options:P,tagRender:q=>{const{label:te,closable:ue,onClose:me}=q,se=_e=>{_e.preventDefault(),_e.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:c.colorPrimary,onMouseDown:se,closable:ue,onClose:me,style:{borderRadius:6},children:te})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})}),b==="email"&&p.isTemplateEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:16}}),(0,o.jsx)(t.ui_kit$Tooltip,{title:i.isNew?l("Save email first."):l("Use this email as a template for creating future emails."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"is_template",valuePropName:"checked",initialValue:z,children:(0,o.jsx)(t.ui_kit$Switch,{id:"setIsTemplate",label:l("Is a template"),size:"small",onChange:G,disabled:i.isNew,labelStyle:{position:"relative",top:2,fontSize:14,color:c.colorText}})})},"isTemplate")]}),z&&(0,o.jsx)(Ed,{element:i,refetchProjectGroups:_,isLoading:E||w}),b==="block"&&(0,o.jsx)(t.ui_kit$Form.Item,{name:Pi,label:l("Type"),tooltip:{title:l("Select the block type to find any block on the list faster."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},rules:[{message:l("Please input type!")}],children:(0,o.jsx)(t.ui_kit$Select,{placeholder:l("Choose block type"),options:j,getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})]})})};$l.propTypes={className:g.default.string,email:g.default.object};var{utm_source:Fl,utm_medium:Ml,utm_campaign:Dl,utm_term:Vl,utm_content:Hl}={utm_source:"utm_source",utm_medium:"utm_medium",utm_campaign:"utm_campaign",utm_term:"utm_term",utm_content:"utm_content"},jd={[Fl]:"",[Ml]:"",[Dl]:"",[Vl]:"",[Hl]:""},Ul=({className:e="",email:i=void 0})=>{const{__:l}=r.useI18n(),s=r.useEmailAttributesWriter(),[a]=t.ui_kit$Form.useForm();(0,n.useEffect)(()=>{i&&a.setFieldsValue({utm_source:i.utm_parameters?.utm_source||"",utm_medium:i.utm_parameters?.utm_medium||"",utm_campaign:i.utm_parameters?.utm_campaign||"",utm_term:i.utm_parameters?.utm_term||"",utm_content:i.utm_parameters?.utm_content||""})},[a,i]);const d=c=>{const p=Object.keys(c)[0],f=c;s({utm_parameters:{...i?.utm_parameters,[p]:f[p]}})};return(0,o.jsx)("div",{className:(0,He.default)("settings-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:a,layout:"vertical",name:"settings_panel_form_utm",initialValues:jd,onValuesChange:d,autoComplete:"off",children:[(0,o.jsx)(t.ui_kit$Alert,{title:l("The specified parameters will be added to all links when exporting the email."),type:"info",showIcon:!0,style:{marginBottom:20}}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("utm_source"),name:Fl,tooltip:{title:l("Mandatory. Indicates the traffic source. Example: utm_source=google"),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:l("google")})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("utm_medium"),name:Ml,tooltip:{title:l("Identifies what type of link was used, such as cost per click or email. For example: utm_medium=cpc"),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:l("cpc")})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("utm_campaign"),name:Dl,tooltip:{title:l("Indicates a specific product promotion or a marketing campaign. Example: utm_campaign=spring_sale"),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:l("spring_sale")})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("utm_term"),name:Vl,tooltip:{title:l("Identifies search terms. For example: utm_term=running+shoes"),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:l("running+shoes")})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("utm_content"),name:Hl,tooltip:{title:l("Indicates what user clicked to get to the site: a banner or a text link. It is often used for A/B testing and ad campaigns. Example: utm_content=logolink or utm_content=textlink"),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:l("textlink")})})]})})};Ul.propTypes={className:g.default.string,email:g.default.object};var We={PRODUCT_CAROUSEL:"productCarousel",SINGLE_IMAGE_PREVIEW:"singleImagePreview",DEAL_ANNOTATION:"dealAnnotation",DEAL_CARD:"dealCard"},Wl="emailmaker-gmail-annotations";function Ai(e){return/^[A-Za-z]{3}$/.test((e??"").trim())}function vd(e){return typeof e=="object"&&e!==null}function qt(e,i){const l=e[i];return typeof l=="string"?l:""}var Id=new Set(["PromotionCard","DiscountOffer","Organization"]);function zl(e){let i;try{i=JSON.parse(e)}catch{return!1}const l=Array.isArray(i)?i:[i];return l.length===0?!1:l.every(s=>typeof s=="object"&&s!==null&&Id.has(String(s["@type"])))}function Cd(){let e=new Date().getTime(),i=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,l=>{let s=Math.random()*16;return e>0?(s=(e+s)%16|0,e=Math.floor(e/16)):(s=(i+s)%16|0,i=Math.floor(i/16)),(l==="x"?s:s&3|8).toString(16)})}function Jt(e){return e.annotationType||We.PRODUCT_CAROUSEL}function ct(e){return!!(e?.image||e?.url||e?.headline||e?.price||e?.priceCurrency||e?.discountValue)}function Ni(e){return!e.description&&!e.discountCode&&!e.availabilityStarts&&!e.availabilityEnds}function Qt(e){return typeof e=="string"&&e.trim().length>0}function Li(e){return Qt(e)?/^https?:\/\//i.test(e.trim()):!1}function Gl(e){return Qt(e?.image)&&Li(e?.url)}function Pd(e){switch(Jt(e)){case We.SINGLE_IMAGE_PREVIEW:return Gl(e.cards?.[0]);case We.DEAL_ANNOTATION:return!Ni(e);case We.DEAL_CARD:return Qt(e.description)&&(Li(e.offerPageUrl)||Li(e.merchantHomepageUrl));case We.PRODUCT_CAROUSEL:default:return!!e.cards?.some(Gl)}}function Ad(e){switch(Jt(e)){case We.SINGLE_IMAGE_PREVIEW:return!ct(e.cards?.[0])&&!Qt(e.discountCode);case We.DEAL_ANNOTATION:return Ni(e);case We.DEAL_CARD:return Ni(e)&&!e.offerPageUrl&&!e.merchantHomepageUrl;case We.PRODUCT_CAROUSEL:default:return!e.cards?.some(ct)}}function Nd(e){switch(Jt(e)){case We.DEAL_ANNOTATION:case We.DEAL_CARD:return!!(e.description||e.discountCode||e.availabilityStarts||e.availabilityEnds||e.offerPageUrl||e.merchantHomepageUrl);case We.SINGLE_IMAGE_PREVIEW:return ct(e.cards?.[0]);case We.PRODUCT_CAROUSEL:default:return e.logo?!0:!!e.cards?.some(ct)}}function Ld(e){let i=typeof e.price=="string"||typeof e.price=="number"?String(e.price):"",l=typeof e.discountValue=="string"||typeof e.discountValue=="number"?String(e.discountValue):"";const s=typeof e.em_regularPrice=="string"||typeof e.em_regularPrice=="number"?String(e.em_regularPrice):"",a=typeof e.em_price=="string"||typeof e.em_price=="number"?String(e.em_price):"";if(!i&&s&&(i=s),!l&&i&&a){const d=parseFloat(i),c=parseFloat(a);!isNaN(d)&&!isNaN(c)&&d>=c&&(l=String(d-c))}return{id:Cd(),image:typeof e.image=="string"?e.image:"",url:typeof e.url=="string"?e.url:"",headline:typeof e.headline=="string"?e.headline:"",price:i,priceCurrency:typeof e.priceCurrency=="string"?e.priceCurrency:"",discountValue:l}}function Yl(e,i){const l={"@context":"http://schema.org/","@type":"PromotionCard",image:e.image};if(e.url&&(l.url=e.url),e.headline&&(l.headline=e.headline),e.price&&(l.price=e.price),e.priceCurrency){const s=e.priceCurrency.trim();l.priceCurrency=Ai(s)?s.toUpperCase():s}return e.discountValue&&(l.discountValue=e.discountValue),i&&(l.position=i),l}function Oi(e){const i={"@context":"http://schema.org/","@type":"DiscountOffer"};for(const l of["description","discountCode","availabilityStarts","availabilityEnds","offerPageUrl","merchantHomepageUrl"]){const s=e[l];s&&(i[l]=s)}return i}function Xl(e){return{"@context":"http://schema.org/","@type":"Organization",logo:e}}function Od(e){const i=Jt(e),l=[];if(i===We.DEAL_CARD)return[Oi(e)];if(i===We.DEAL_ANNOTATION){const s=[];return e.logo&&s.push(Xl(e.logo)),s.push(Oi(e)),s}if(e.logo&&l.push(Xl(e.logo)),i===We.SINGLE_IMAGE_PREVIEW){const s=e.cards?.[0];return e.discountCode?.trim()&&l.push(Oi(e)),s&&ct(s)&&l.push(Yl(s)),l}return(e.cards||[]).filter(ct).forEach((s,a)=>{l.push(Yl(s,a+1))}),l}function $d(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Fd(e){if(Ad(e))return null;const i=$d(JSON.stringify(Od(e),null,2));return`<script type="application/ld+json" id="${Wl}">
|
|
10
10
|
${i}
|
|
11
|
-
<\/script>`}function Kl(e,i){const l=e.toLowerCase().indexOf("<\/script>",i);return l===-1?-1:l+9}function ql(e,i,l,s){return{range:{start:i,end:s},contentRange:{start:l,end:s-9}}}function $i(e){const i=new RegExp(`<script\\b[^>]*\\bid=["']${Wl}["']`,"i").exec(e);if(i?.index!==void 0){const a=e.indexOf(">",i.index)+1;if(a<=0)return null;const d=Kl(e,a);if(d!==-1)return ql(e,i.index,a,d)}const l=/<script\b[^>]*type=["']application\/ld\+json["'][^>]*>/gi;let s;for(;(s=l.exec(e))!==null;){const a=s.index+s[0].length,d=Kl(e,a);if(d!==-1&&zl(e.slice(a,d-9)))return ql(e,s.index,a,d)}return null}function
|
|
11
|
+
<\/script>`}function Kl(e,i){const l=e.toLowerCase().indexOf("<\/script>",i);return l===-1?-1:l+9}function ql(e,i,l,s){return{range:{start:i,end:s},contentRange:{start:l,end:s-9}}}function $i(e){const i=new RegExp(`<script\\b[^>]*\\bid=["']${Wl}["']`,"i").exec(e);if(i?.index!==void 0){const a=e.indexOf(">",i.index)+1;if(a<=0)return null;const d=Kl(e,a);if(d!==-1)return ql(e,i.index,a,d)}const l=/<script\b[^>]*type=["']application\/ld\+json["'][^>]*>/gi;let s;for(;(s=l.exec(e))!==null;){const a=s.index+s[0].length,d=Kl(e,a);if(d!==-1&&zl(e.slice(a,d-9)))return ql(e,s.index,a,d)}return null}function Md(e){const i=e.indexOf(">")+1,l=e.toLowerCase().lastIndexOf("<\/script>");return i<=0||l===-1?e:e.slice(i,l)}function Dd(e){const i=/<\/head>/i.exec(e);if(i?.index!==void 0)return i.index;const l=/<head\b[^>]*>/i.exec(e);if(l?.index!==void 0)return l.index+l[0].length;const s=/<body\b[^>]*>/i.exec(e);return s?.index!==void 0?s.index:e.length}function Jl(e,i){let{start:l,end:s}=i;return l>0&&e[l-1]===`
|
|
12
12
|
`?l-=1:s<e.length&&e[s]===`
|
|
13
|
-
`&&(s+=1),{start:l,end:s}}function
|
|
13
|
+
`&&(s+=1),{start:l,end:s}}function Vd(e,i){const l=$i(e),s=Fd(i);if(!s&&!l)return null;if(l&&!s){const c=Jl(e,l.range);return e.slice(c.start,c.end)?{range:c,text:""}:null}if(l&&s){const c=Md(s);return e.slice(l.contentRange.start,l.contentRange.end)===c?null:{range:l.contentRange,text:c}}if(!s)return null;const a=Dd(e),d=`${a>0&&e[a-1]!==`
|
|
14
14
|
`?`
|
|
15
15
|
`:""}${s}
|
|
16
|
-
`;return{range:{start:a,end:a},text:d}}function Ql(e){const i=$i(e);return i?e.slice(i.contentRange.start,i.contentRange.end):null}function Vd(e){let i=e;for(let l=0;l<50;l++){const s=$i(i);if(!s)return i;const{start:a,end:d}=Jl(i,s.range);i=i.slice(0,a)+i.slice(d)}return i}function Hd(e){try{const i=new DOMParser().parseFromString(e,"text/html").querySelectorAll('script[type="application/ld+json"]');for(let l=0;l<i.length;l++){const s=i[l];if(s.id==="emailmaker-gmail-annotations"||zl(s.textContent||"")){const a=JSON.parse(s.textContent||"[]"),d=(Array.isArray(a)?a:[a]).filter(jd),c={cards:[]};let p=!1,f=!1,x=!1;return d.forEach(k=>{const b=qt(k,"@type");if(b==="Organization"){const h=qt(k,"logo");h&&(c.logo=h);return}if(b==="DiscountOffer"){f=!0;for(const h of["description","discountCode","availabilityStarts","availabilityEnds"]){const T=qt(k,h);T&&(c[h]=T)}for(const h of["offerPageUrl","merchantHomepageUrl"]){const T=qt(k,h);T&&(c[h]=T,p=!0)}return}b==="PromotionCard"&&(k.position!==void 0&&(x=!0),c.cards.push(Nd(k)))}),c.cards.length>1?c.annotationType=We.PRODUCT_CAROUSEL:c.cards.length===1?c.annotationType=x?We.PRODUCT_CAROUSEL:We.SINGLE_IMAGE_PREVIEW:f&&(c.annotationType=p?We.DEAL_CARD:We.DEAL_ANNOTATION),c}}}catch{}return null}var Ud={USD:"$",EUR:"€",GBP:"£",RUB:"₽",JPY:"¥",CNY:"¥",INR:"₹",KRW:"₩",AUD:"A$",CAD:"C$",CHF:"CHF",BRL:"R$",MXN:"MX$",UAH:"₴",KZT:"₸",PLN:"zł",TRY:"₺",CZK:"Kč",ILS:"₪",SGD:"S$",HKD:"HK$",NZD:"NZ$",ZAR:"R"};function Wd(e){return Number.isInteger(e)?String(e):e.toFixed(2)}function Zl(e){const i=e?.trim();return i?Ud[i.toUpperCase()]??i:"$"}function Fi(e,i){return`${Zl(i)}${Wd(e)}`}function zd(e){const i=parseFloat(e.price??""),l=parseFloat(e.discountValue??"");return!Number.isNaN(i)&&!Number.isNaN(l)&&l>0?{sale:Fi(i-l,e.priceCurrency),original:Fi(i,e.priceCurrency)}:Number.isNaN(i)?{}:{sale:Fi(i,e.priceCurrency)}}var io=({variant:e="line",width:i,height:l,className:s})=>{const a=(0,n.useMemo)(()=>({width:i,height:l}),[i,l]);return(0,o.jsx)("span",{className:(0,He.default)("preview-skeleton",`preview-skeleton--${e}`,s),style:a,"aria-hidden":"true"})};function Mi({className:e}){return(0,o.jsx)("svg",{className:e,width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:(0,o.jsx)("path",{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})})}function es({className:e}){return(0,o.jsxs)("svg",{className:e,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,o.jsx)("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),(0,o.jsx)("circle",{cx:"7",cy:"7",r:"1.5",fill:"currentColor"})]})}function Gd({className:e}){return(0,o.jsxs)("svg",{className:e,width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,o.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"1.5"}),(0,o.jsx)("path",{d:"M12 12V7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,o.jsx)("path",{d:"M12 12L15.5 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,o.jsx)("path",{d:"M12 3a9 9 0 0 1 7.5 4",fill:"currentColor",fillOpacity:"0.18"})]})}var Yd=2;function Xd({card:e}){const i=zd(e),l=(0,n.useMemo)(()=>({backgroundImage:`url(${e.image})`}),[e.image]),s=!!e.headline?.trim(),a=!!e.image?.trim(),d=!i.sale&&!i.original;return(0,o.jsxs)("div",{className:"product-carousel-preview__card",children:[a?(0,o.jsx)("div",{className:"product-carousel-preview__card-image",style:l}):(0,o.jsx)(io,{variant:"block",className:"product-carousel-preview__card-image-skeleton"}),(0,o.jsxs)("div",{className:"product-carousel-preview__card-body",children:[s?(0,o.jsx)("div",{className:"product-carousel-preview__card-headline",children:e.headline}):(0,o.jsxs)("div",{className:"product-carousel-preview__card-headline-skeleton",children:[(0,o.jsx)(io,{height:12}),(0,o.jsx)(io,{height:12,width:"75%"})]}),d?(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,o.jsx)(io,{width:48,height:14}),(0,o.jsx)(io,{width:40,height:12})]}):(i.sale||i.original)&&(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[i.sale&&(0,o.jsx)("span",{className:"product-carousel-preview__card-sale-price",children:i.sale}),i.original&&(0,o.jsx)("span",{className:"product-carousel-preview__card-original-price",children:i.original})]})]})]})}function Kd(){return(0,o.jsxs)("div",{className:"product-carousel-preview__card",children:[(0,o.jsx)(io,{variant:"block",className:"product-carousel-preview__card-image-skeleton"}),(0,o.jsxs)("div",{className:"product-carousel-preview__card-body",children:[(0,o.jsxs)("div",{className:"product-carousel-preview__card-headline-skeleton",children:[(0,o.jsx)(io,{height:12}),(0,o.jsx)(io,{height:12,width:"75%"})]}),(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,o.jsx)(io,{width:48,height:14}),(0,o.jsx)(io,{width:40,height:12})]})]})]})}var qd=({data:e,subjectLine:i,cards:l})=>{const{__:s}=r.useI18n(),a=!!e.logo?.trim(),d=!!i?.trim();return(0,o.jsxs)("div",{className:"product-carousel-preview",children:[(0,o.jsx)("div",{className:"product-carousel-preview__header",children:(0,o.jsxs)("div",{className:"product-carousel-preview__header-main",children:[a?(0,o.jsx)("img",{src:e.logo,alt:"",className:"product-carousel-preview__logo"}):(0,o.jsx)(io,{variant:"circle",width:40,height:40,className:"product-carousel-preview__logo-skeleton"}),(0,o.jsxs)("div",{className:"product-carousel-preview__header-text",children:[(0,o.jsxs)("div",{className:"product-carousel-preview__header-row",children:[(0,o.jsx)("div",{className:"product-carousel-preview__brand-name",children:s("Your company")}),(0,o.jsx)("div",{className:"product-carousel-preview__time",children:"10:10 AM"})]}),(0,o.jsxs)("div",{className:"product-carousel-preview__header-row product-carousel-preview__header-row--subject",children:[d?(0,o.jsx)("div",{className:"product-carousel-preview__subject-line",children:i}):(0,o.jsx)(io,{height:14,className:"product-carousel-preview__subject-skeleton"}),(0,o.jsx)(Mi,{className:"product-carousel-preview__star-icon"})]})]})]})}),(0,o.jsx)("div",{className:"product-carousel-preview__carousel",children:l.length>0?l.map((c,p)=>(0,o.jsx)(Xd,{card:c},c.id||p)):Array.from({length:Yd},(c,p)=>(0,o.jsx)(Kd,{},`skeleton-${p}`))})]})};function Jd(e){const i=parseFloat(e?.price??""),l=parseFloat(e?.discountValue??"");if(!Number.isNaN(i)&&i>0&&!Number.isNaN(l)&&l>0){const a=Math.round(l/i*100);if(a>0)return`${a}% Off`}const s=e?.discountValue?.trim();return s?/off/i.test(s)||s.includes("%")?s:`${s} Off`:null}function os(e){const i=e?.trim();return i?/^code\s/i.test(i)?i:`Code ${i}`:null}var Qd=({data:e,subjectLine:i,card:l})=>{const{__:s}=r.useI18n(),a=!!e.logo?.trim(),d=!!i?.trim(),c=!!l?.image?.trim(),p=!!l?.headline?.trim(),f=Jd(l),x=os(e.discountCode),k=!!(f||x),b=(0,n.useMemo)(()=>({backgroundImage:`url(${l?.image})`}),[l?.image]);return(0,o.jsxs)("div",{className:"single-image-preview",children:[(0,o.jsx)("div",{className:"single-image-preview__header",children:(0,o.jsxs)("div",{className:"single-image-preview__header-main",children:[a?(0,o.jsx)("img",{src:e.logo,alt:"",className:"single-image-preview__logo"}):(0,o.jsx)(io,{variant:"circle",width:40,height:40,className:"single-image-preview__logo-skeleton"}),(0,o.jsxs)("div",{className:"single-image-preview__header-text",children:[(0,o.jsxs)("div",{className:"single-image-preview__header-row",children:[(0,o.jsx)("div",{className:"single-image-preview__brand-name",children:s("Your company")}),(0,o.jsx)("div",{className:"single-image-preview__time",children:"10:10 AM"})]}),d?(0,o.jsx)("div",{className:"single-image-preview__subject-line",children:i}):(0,o.jsx)(io,{height:14,className:"single-image-preview__subject-skeleton"}),(0,o.jsxs)("div",{className:"single-image-preview__promo-row",children:[(0,o.jsxs)("div",{className:"single-image-preview__promo-content",children:[f?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(es,{className:"single-image-preview__promo-icon"}),(0,o.jsx)("span",{className:"single-image-preview__promo-badge",children:f})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(io,{width:16,height:16,className:"single-image-preview__promo-icon-skeleton"}),(0,o.jsx)(io,{width:72,height:14})]}),k&&(0,o.jsx)("span",{className:"single-image-preview__promo-separator",children:"·"}),x?(0,o.jsx)("span",{className:"single-image-preview__promo-code",children:x}):(0,o.jsx)(io,{width:96,height:14,className:"single-image-preview__promo-skeleton"})]}),(0,o.jsx)(Mi,{className:"single-image-preview__star-icon"})]})]})]})}),(0,o.jsxs)("div",{className:"single-image-preview__card",children:[c?(0,o.jsx)("div",{className:"single-image-preview__card-image",style:b}):(0,o.jsx)(io,{variant:"block",className:"single-image-preview__card-image-skeleton"}),(0,o.jsx)("div",{className:"single-image-preview__card-body",children:p?(0,o.jsx)("div",{className:"single-image-preview__card-description",children:l?.headline}):(0,o.jsxs)("div",{className:"single-image-preview__card-description-skeleton",children:[(0,o.jsx)(io,{height:12}),(0,o.jsx)(io,{height:12,width:"92%"})]})})]})]})};function Zd(e){const i=e?.trim();if(!i)return null;const l=(0,Oo.default)(i);if(!l.isValid())return null;const s=(0,Oo.default)().startOf("day"),a=l.startOf("day").diff(s,"day");return a===0?"Today":a===1?"Tomorrow":a>1&&a<=7?l.format("MMM D"):l.format("MMM D, YYYY")}function Di(e){const i=e?.trim();return i||null}function ec(e,i){return e?e==="Today"?i("Today"):e==="Tomorrow"?i("Tomorrow"):e:null}function oc(e,i){return ec(Zd(e),i)}var tc=({data:e,subjectLine:i})=>{const{__:l}=r.useI18n(),s=!!e.logo?.trim(),a=!!i?.trim(),d=Di(e.description),c=os(e.discountCode),p=!!(d||c);return(0,o.jsx)("div",{className:"deal-annotation-preview",children:(0,o.jsxs)("div",{className:"deal-annotation-preview__header-main",children:[s?(0,o.jsx)("img",{src:e.logo,alt:"",className:"deal-annotation-preview__logo"}):(0,o.jsx)(io,{variant:"circle",width:40,height:40,className:"deal-annotation-preview__logo-skeleton"}),(0,o.jsxs)("div",{className:"deal-annotation-preview__header-text",children:[(0,o.jsxs)("div",{className:"deal-annotation-preview__header-row",children:[(0,o.jsx)("div",{className:"deal-annotation-preview__brand-name",children:l("Your company")}),(0,o.jsx)("div",{className:"deal-annotation-preview__time",children:"10:10 AM"})]}),a?(0,o.jsx)("div",{className:"deal-annotation-preview__subject-line",children:i}):(0,o.jsx)(io,{height:14,className:"deal-annotation-preview__subject-skeleton"}),(0,o.jsxs)("div",{className:"deal-annotation-preview__promo-row",children:[(0,o.jsxs)("div",{className:"deal-annotation-preview__promo-content",children:[d?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(es,{className:"deal-annotation-preview__promo-icon"}),(0,o.jsx)("span",{className:"deal-annotation-preview__promo-badge",children:d})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(io,{width:16,height:16,className:"deal-annotation-preview__promo-icon-skeleton"}),(0,o.jsx)(io,{width:72,height:14})]}),p&&(0,o.jsx)("span",{className:"deal-annotation-preview__promo-separator",children:"·"}),c?(0,o.jsx)("span",{className:"deal-annotation-preview__promo-code",children:c}):(0,o.jsx)(io,{width:96,height:14,className:"deal-annotation-preview__promo-skeleton"})]}),(0,o.jsx)(Mi,{className:"deal-annotation-preview__star-icon"})]})]})]})})},ic=({data:e})=>{const{__:i}=r.useI18n(),l=Di(e.description),s=oc(e.availabilityEnds,i),a=Di(e.discountCode);return(0,o.jsxs)("div",{className:"deal-card-preview",children:[(0,o.jsx)("div",{className:"deal-card-preview__sender",children:i("Your company")}),l?(0,o.jsx)("div",{className:"deal-card-preview__headline",children:l}):(0,o.jsx)(io,{height:24,className:"deal-card-preview__headline-skeleton"}),(0,o.jsxs)("div",{className:"deal-card-preview__details",children:[(0,o.jsxs)("div",{className:"deal-card-preview__expires",children:[(0,o.jsx)(Gd,{className:"deal-card-preview__clock-icon"}),(0,o.jsxs)("div",{className:"deal-card-preview__detail-text",children:[(0,o.jsx)("div",{className:"deal-card-preview__detail-label",children:i("Expires")}),s?(0,o.jsx)("div",{className:"deal-card-preview__detail-value",children:s}):(0,o.jsx)(io,{width:72,height:14,className:"deal-card-preview__detail-skeleton"})]})]}),(0,o.jsx)("div",{className:"deal-card-preview__code",children:(0,o.jsxs)("div",{className:"deal-card-preview__detail-text",children:[(0,o.jsx)("div",{className:"deal-card-preview__detail-label",children:i("Code")}),a?(0,o.jsx)("div",{className:"deal-card-preview__detail-value",children:a}):(0,o.jsx)(io,{width:56,height:14,className:"deal-card-preview__detail-skeleton"})]})})]}),(0,o.jsxs)("div",{className:"deal-card-preview__actions",children:[(0,o.jsx)("span",{className:"deal-card-preview__button",children:i("Visit site")}),(0,o.jsx)("span",{className:"deal-card-preview__button",children:i("Copy code")})]})]})};function rc(e){return e.annotationType===We.SINGLE_IMAGE_PREVIEW?e.cards?.[0]?[e.cards[0]]:[]:e.annotationType===We.PRODUCT_CAROUSEL?e.cards||[]:[]}function lc(e,i){switch(e){case We.SINGLE_IMAGE_PREVIEW:return i("Single image preview");case We.DEAL_ANNOTATION:return i("Deal Annotation");case We.DEAL_CARD:return i("Deal Card");default:return i("Product carousel")}}var Vi=300,Xo=16;function sc(e){if(!e||e.offsetParent===null)return!1;const i=e.getBoundingClientRect();return i.width>0&&i.height>0}function ac(e){const i=Array.from(document.querySelectorAll(e));for(const l of i){if(!(l instanceof HTMLElement))continue;const s=l.getBoundingClientRect(),a=window.getComputedStyle(l);if(s.width>0&&s.height>0&&a.display!=="none"&&a.visibility!=="hidden")return l}return null}var nc=({data:e,subjectLine:i,parentRef:l,overlayTargetSelector:s,onApply:a,applyDisabled:d=!1,applyBlockers:c=[],onRemove:p,visible:f=!0})=>{const{__:x}=r.useI18n(),[k,b]=(0,n.useState)(null),[h,T]=(0,n.useState)(null);(0,n.useEffect)(()=>{if(!f){b(null),T(null);return}const j=()=>{if(!sc(l?.current)){b(null),T(null);return}if(s){const q=l?.current?.closest(".email-pane__col_settings-inner")||ac(".email-pane__col_settings-inner");if(q){T(q),b({type:"popover"});return}}if(!l?.current)return;let y=l.current.getBoundingClientRect();if(y.width===0&&y.height===0){const q=l.current.closest(".email-pane__col");q&&(y=q.getBoundingClientRect())}const oe=Math.max(Xo,Math.min(y.top,window.innerHeight-Xo));let G=y.left-Vi-Xo;G<Xo&&(G=y.right+Xo),G+Vi>window.innerWidth-Xo&&(G=window.innerWidth-Vi-Xo),T(document.body),b({type:"side",top:oe,left:Math.max(Xo,G)})};j();const C=window.requestAnimationFrame(j),P=[window],Y=l?.current?.closest(".email-pane__collapse-wrapper"),z=l?.current?.closest(".email-pane__col");Y&&P.push(Y),z&&P.push(z),P.forEach(y=>{y.addEventListener("scroll",j,{passive:!0})}),window.addEventListener("resize",j);const $=l?.current,O=$&&typeof ResizeObserver<"u"?new ResizeObserver(j):null;return O?.observe($),()=>{window.cancelAnimationFrame(C),O?.disconnect(),P.forEach(y=>{y.removeEventListener("scroll",j)}),window.removeEventListener("resize",j)}},[l,e,s,f]);const _=(0,n.useMemo)(()=>k?.type==="side"?{position:"fixed",top:k.top,left:k.left}:void 0,[k]);if(!f||!e||!Ad(e)&&!a||!k)return null;const E=rc(e),w=e.annotationType||We.PRODUCT_CAROUSEL,v=(()=>{switch(w){case We.PRODUCT_CAROUSEL:return(0,o.jsx)(qd,{data:e,subjectLine:i,cards:E});case We.SINGLE_IMAGE_PREVIEW:return(0,o.jsx)(Qd,{data:e,subjectLine:i,card:E[0]});case We.DEAL_ANNOTATION:return(0,o.jsx)(tc,{data:e,subjectLine:i});case We.DEAL_CARD:return(0,o.jsx)(ic,{data:e});default:return null}})(),A=(0,o.jsxs)("div",{className:`annotations-preview${k.type==="popover"?" annotations-preview--popover":""}`,style:_,children:[(0,o.jsxs)("div",{className:"annotations-preview__content",children:[(0,o.jsxs)("div",{className:"annotations-preview__type",children:[x("Preview"),": ",lc(w,x)]}),v]}),(a||p)&&(0,o.jsxs)("div",{className:"annotations-preview__footer",children:[p&&(0,o.jsx)(t.ui_kit$Button,{type:"text",size:"small",danger:!0,onClick:p,children:x("Remove annotations")}),a&&(0,o.jsx)(t.ui_kit$Tooltip,{title:d&&c.length?c.join(". "):"",children:(0,o.jsx)("span",{className:"annotations-preview__apply-wrap",children:(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"small",onClick:a,disabled:d,children:x("Apply")})})})]})]});return(0,Oa.createPortal)(A,h||document.body)};function dc(e){return e.replaceAll(`\r
|
|
16
|
+
`;return{range:{start:a,end:a},text:d}}function Ql(e){const i=$i(e);return i?e.slice(i.contentRange.start,i.contentRange.end):null}function Hd(e){let i=e;for(let l=0;l<50;l++){const s=$i(i);if(!s)return i;const{start:a,end:d}=Jl(i,s.range);i=i.slice(0,a)+i.slice(d)}return i}function Ud(e){try{const i=new DOMParser().parseFromString(e,"text/html").querySelectorAll('script[type="application/ld+json"]');for(let l=0;l<i.length;l++){const s=i[l];if(s.id==="emailmaker-gmail-annotations"||zl(s.textContent||"")){const a=JSON.parse(s.textContent||"[]"),d=(Array.isArray(a)?a:[a]).filter(vd),c={cards:[]};let p=!1,f=!1,x=!1;return d.forEach(k=>{const b=qt(k,"@type");if(b==="Organization"){const h=qt(k,"logo");h&&(c.logo=h);return}if(b==="DiscountOffer"){f=!0;for(const h of["description","discountCode","availabilityStarts","availabilityEnds"]){const T=qt(k,h);T&&(c[h]=T)}for(const h of["offerPageUrl","merchantHomepageUrl"]){const T=qt(k,h);T&&(c[h]=T,p=!0)}return}b==="PromotionCard"&&(k.position!==void 0&&(x=!0),c.cards.push(Ld(k)))}),c.cards.length>1?c.annotationType=We.PRODUCT_CAROUSEL:c.cards.length===1?c.annotationType=x?We.PRODUCT_CAROUSEL:We.SINGLE_IMAGE_PREVIEW:f&&(c.annotationType=p?We.DEAL_CARD:We.DEAL_ANNOTATION),c}}}catch{}return null}var Wd={USD:"$",EUR:"€",GBP:"£",RUB:"₽",JPY:"¥",CNY:"¥",INR:"₹",KRW:"₩",AUD:"A$",CAD:"C$",CHF:"CHF",BRL:"R$",MXN:"MX$",UAH:"₴",KZT:"₸",PLN:"zł",TRY:"₺",CZK:"Kč",ILS:"₪",SGD:"S$",HKD:"HK$",NZD:"NZ$",ZAR:"R"};function zd(e){return Number.isInteger(e)?String(e):e.toFixed(2)}function Zl(e){const i=e?.trim();return i?Wd[i.toUpperCase()]??i:"$"}function Fi(e,i){return`${Zl(i)}${zd(e)}`}function Gd(e){const i=parseFloat(e.price??""),l=parseFloat(e.discountValue??"");return!Number.isNaN(i)&&!Number.isNaN(l)&&l>0?{sale:Fi(i-l,e.priceCurrency),original:Fi(i,e.priceCurrency)}:Number.isNaN(i)?{}:{sale:Fi(i,e.priceCurrency)}}var io=({variant:e="line",width:i,height:l,className:s})=>{const a=(0,n.useMemo)(()=>({width:i,height:l}),[i,l]);return(0,o.jsx)("span",{className:(0,He.default)("preview-skeleton",`preview-skeleton--${e}`,s),style:a,"aria-hidden":"true"})};function Mi({className:e}){return(0,o.jsx)("svg",{className:e,width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:(0,o.jsx)("path",{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})})}function es({className:e}){return(0,o.jsxs)("svg",{className:e,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,o.jsx)("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),(0,o.jsx)("circle",{cx:"7",cy:"7",r:"1.5",fill:"currentColor"})]})}function Yd({className:e}){return(0,o.jsxs)("svg",{className:e,width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,o.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"1.5"}),(0,o.jsx)("path",{d:"M12 12V7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,o.jsx)("path",{d:"M12 12L15.5 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,o.jsx)("path",{d:"M12 3a9 9 0 0 1 7.5 4",fill:"currentColor",fillOpacity:"0.18"})]})}var Xd=2;function Kd({card:e}){const i=Gd(e),l=(0,n.useMemo)(()=>({backgroundImage:`url(${e.image})`}),[e.image]),s=!!e.headline?.trim(),a=!!e.image?.trim(),d=!i.sale&&!i.original;return(0,o.jsxs)("div",{className:"product-carousel-preview__card",children:[a?(0,o.jsx)("div",{className:"product-carousel-preview__card-image",style:l}):(0,o.jsx)(io,{variant:"block",className:"product-carousel-preview__card-image-skeleton"}),(0,o.jsxs)("div",{className:"product-carousel-preview__card-body",children:[s?(0,o.jsx)("div",{className:"product-carousel-preview__card-headline",children:e.headline}):(0,o.jsxs)("div",{className:"product-carousel-preview__card-headline-skeleton",children:[(0,o.jsx)(io,{height:12}),(0,o.jsx)(io,{height:12,width:"75%"})]}),d?(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,o.jsx)(io,{width:48,height:14}),(0,o.jsx)(io,{width:40,height:12})]}):(i.sale||i.original)&&(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[i.sale&&(0,o.jsx)("span",{className:"product-carousel-preview__card-sale-price",children:i.sale}),i.original&&(0,o.jsx)("span",{className:"product-carousel-preview__card-original-price",children:i.original})]})]})]})}function qd(){return(0,o.jsxs)("div",{className:"product-carousel-preview__card",children:[(0,o.jsx)(io,{variant:"block",className:"product-carousel-preview__card-image-skeleton"}),(0,o.jsxs)("div",{className:"product-carousel-preview__card-body",children:[(0,o.jsxs)("div",{className:"product-carousel-preview__card-headline-skeleton",children:[(0,o.jsx)(io,{height:12}),(0,o.jsx)(io,{height:12,width:"75%"})]}),(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,o.jsx)(io,{width:48,height:14}),(0,o.jsx)(io,{width:40,height:12})]})]})]})}var Jd=({data:e,subjectLine:i,cards:l})=>{const{__:s}=r.useI18n(),a=!!e.logo?.trim(),d=!!i?.trim();return(0,o.jsxs)("div",{className:"product-carousel-preview",children:[(0,o.jsx)("div",{className:"product-carousel-preview__header",children:(0,o.jsxs)("div",{className:"product-carousel-preview__header-main",children:[a?(0,o.jsx)("img",{src:e.logo,alt:"",className:"product-carousel-preview__logo"}):(0,o.jsx)(io,{variant:"circle",width:40,height:40,className:"product-carousel-preview__logo-skeleton"}),(0,o.jsxs)("div",{className:"product-carousel-preview__header-text",children:[(0,o.jsxs)("div",{className:"product-carousel-preview__header-row",children:[(0,o.jsx)("div",{className:"product-carousel-preview__brand-name",children:s("Your company")}),(0,o.jsx)("div",{className:"product-carousel-preview__time",children:"10:10 AM"})]}),(0,o.jsxs)("div",{className:"product-carousel-preview__header-row product-carousel-preview__header-row--subject",children:[d?(0,o.jsx)("div",{className:"product-carousel-preview__subject-line",children:i}):(0,o.jsx)(io,{height:14,className:"product-carousel-preview__subject-skeleton"}),(0,o.jsx)(Mi,{className:"product-carousel-preview__star-icon"})]})]})]})}),(0,o.jsx)("div",{className:"product-carousel-preview__carousel",children:l.length>0?l.map((c,p)=>(0,o.jsx)(Kd,{card:c},c.id||p)):Array.from({length:Xd},(c,p)=>(0,o.jsx)(qd,{},`skeleton-${p}`))})]})};function Qd(e){const i=parseFloat(e?.price??""),l=parseFloat(e?.discountValue??"");if(!Number.isNaN(i)&&i>0&&!Number.isNaN(l)&&l>0){const a=Math.round(l/i*100);if(a>0)return`${a}% Off`}const s=e?.discountValue?.trim();return s?/off/i.test(s)||s.includes("%")?s:`${s} Off`:null}function os(e){const i=e?.trim();return i?/^code\s/i.test(i)?i:`Code ${i}`:null}var Zd=({data:e,subjectLine:i,card:l})=>{const{__:s}=r.useI18n(),a=!!e.logo?.trim(),d=!!i?.trim(),c=!!l?.image?.trim(),p=!!l?.headline?.trim(),f=Qd(l),x=os(e.discountCode),k=!!(f||x),b=(0,n.useMemo)(()=>({backgroundImage:`url(${l?.image})`}),[l?.image]);return(0,o.jsxs)("div",{className:"single-image-preview",children:[(0,o.jsx)("div",{className:"single-image-preview__header",children:(0,o.jsxs)("div",{className:"single-image-preview__header-main",children:[a?(0,o.jsx)("img",{src:e.logo,alt:"",className:"single-image-preview__logo"}):(0,o.jsx)(io,{variant:"circle",width:40,height:40,className:"single-image-preview__logo-skeleton"}),(0,o.jsxs)("div",{className:"single-image-preview__header-text",children:[(0,o.jsxs)("div",{className:"single-image-preview__header-row",children:[(0,o.jsx)("div",{className:"single-image-preview__brand-name",children:s("Your company")}),(0,o.jsx)("div",{className:"single-image-preview__time",children:"10:10 AM"})]}),d?(0,o.jsx)("div",{className:"single-image-preview__subject-line",children:i}):(0,o.jsx)(io,{height:14,className:"single-image-preview__subject-skeleton"}),(0,o.jsxs)("div",{className:"single-image-preview__promo-row",children:[(0,o.jsxs)("div",{className:"single-image-preview__promo-content",children:[f?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(es,{className:"single-image-preview__promo-icon"}),(0,o.jsx)("span",{className:"single-image-preview__promo-badge",children:f})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(io,{width:16,height:16,className:"single-image-preview__promo-icon-skeleton"}),(0,o.jsx)(io,{width:72,height:14})]}),k&&(0,o.jsx)("span",{className:"single-image-preview__promo-separator",children:"·"}),x?(0,o.jsx)("span",{className:"single-image-preview__promo-code",children:x}):(0,o.jsx)(io,{width:96,height:14,className:"single-image-preview__promo-skeleton"})]}),(0,o.jsx)(Mi,{className:"single-image-preview__star-icon"})]})]})]})}),(0,o.jsxs)("div",{className:"single-image-preview__card",children:[c?(0,o.jsx)("div",{className:"single-image-preview__card-image",style:b}):(0,o.jsx)(io,{variant:"block",className:"single-image-preview__card-image-skeleton"}),(0,o.jsx)("div",{className:"single-image-preview__card-body",children:p?(0,o.jsx)("div",{className:"single-image-preview__card-description",children:l?.headline}):(0,o.jsxs)("div",{className:"single-image-preview__card-description-skeleton",children:[(0,o.jsx)(io,{height:12}),(0,o.jsx)(io,{height:12,width:"92%"})]})})]})]})};function ec(e){const i=e?.trim();if(!i)return null;const l=(0,Oo.default)(i);if(!l.isValid())return null;const s=(0,Oo.default)().startOf("day"),a=l.startOf("day").diff(s,"day");return a===0?"Today":a===1?"Tomorrow":a>1&&a<=7?l.format("MMM D"):l.format("MMM D, YYYY")}function Di(e){const i=e?.trim();return i||null}function oc(e,i){return e?e==="Today"?i("Today"):e==="Tomorrow"?i("Tomorrow"):e:null}function tc(e,i){return oc(ec(e),i)}var ic=({data:e,subjectLine:i})=>{const{__:l}=r.useI18n(),s=!!e.logo?.trim(),a=!!i?.trim(),d=Di(e.description),c=os(e.discountCode),p=!!(d||c);return(0,o.jsx)("div",{className:"deal-annotation-preview",children:(0,o.jsxs)("div",{className:"deal-annotation-preview__header-main",children:[s?(0,o.jsx)("img",{src:e.logo,alt:"",className:"deal-annotation-preview__logo"}):(0,o.jsx)(io,{variant:"circle",width:40,height:40,className:"deal-annotation-preview__logo-skeleton"}),(0,o.jsxs)("div",{className:"deal-annotation-preview__header-text",children:[(0,o.jsxs)("div",{className:"deal-annotation-preview__header-row",children:[(0,o.jsx)("div",{className:"deal-annotation-preview__brand-name",children:l("Your company")}),(0,o.jsx)("div",{className:"deal-annotation-preview__time",children:"10:10 AM"})]}),a?(0,o.jsx)("div",{className:"deal-annotation-preview__subject-line",children:i}):(0,o.jsx)(io,{height:14,className:"deal-annotation-preview__subject-skeleton"}),(0,o.jsxs)("div",{className:"deal-annotation-preview__promo-row",children:[(0,o.jsxs)("div",{className:"deal-annotation-preview__promo-content",children:[d?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(es,{className:"deal-annotation-preview__promo-icon"}),(0,o.jsx)("span",{className:"deal-annotation-preview__promo-badge",children:d})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(io,{width:16,height:16,className:"deal-annotation-preview__promo-icon-skeleton"}),(0,o.jsx)(io,{width:72,height:14})]}),p&&(0,o.jsx)("span",{className:"deal-annotation-preview__promo-separator",children:"·"}),c?(0,o.jsx)("span",{className:"deal-annotation-preview__promo-code",children:c}):(0,o.jsx)(io,{width:96,height:14,className:"deal-annotation-preview__promo-skeleton"})]}),(0,o.jsx)(Mi,{className:"deal-annotation-preview__star-icon"})]})]})]})})},rc=({data:e})=>{const{__:i}=r.useI18n(),l=Di(e.description),s=tc(e.availabilityEnds,i),a=Di(e.discountCode);return(0,o.jsxs)("div",{className:"deal-card-preview",children:[(0,o.jsx)("div",{className:"deal-card-preview__sender",children:i("Your company")}),l?(0,o.jsx)("div",{className:"deal-card-preview__headline",children:l}):(0,o.jsx)(io,{height:24,className:"deal-card-preview__headline-skeleton"}),(0,o.jsxs)("div",{className:"deal-card-preview__details",children:[(0,o.jsxs)("div",{className:"deal-card-preview__expires",children:[(0,o.jsx)(Yd,{className:"deal-card-preview__clock-icon"}),(0,o.jsxs)("div",{className:"deal-card-preview__detail-text",children:[(0,o.jsx)("div",{className:"deal-card-preview__detail-label",children:i("Expires")}),s?(0,o.jsx)("div",{className:"deal-card-preview__detail-value",children:s}):(0,o.jsx)(io,{width:72,height:14,className:"deal-card-preview__detail-skeleton"})]})]}),(0,o.jsx)("div",{className:"deal-card-preview__code",children:(0,o.jsxs)("div",{className:"deal-card-preview__detail-text",children:[(0,o.jsx)("div",{className:"deal-card-preview__detail-label",children:i("Code")}),a?(0,o.jsx)("div",{className:"deal-card-preview__detail-value",children:a}):(0,o.jsx)(io,{width:56,height:14,className:"deal-card-preview__detail-skeleton"})]})})]}),(0,o.jsxs)("div",{className:"deal-card-preview__actions",children:[(0,o.jsx)("span",{className:"deal-card-preview__button",children:i("Visit site")}),(0,o.jsx)("span",{className:"deal-card-preview__button",children:i("Copy code")})]})]})};function lc(e){return e.annotationType===We.SINGLE_IMAGE_PREVIEW?e.cards?.[0]?[e.cards[0]]:[]:e.annotationType===We.PRODUCT_CAROUSEL?e.cards||[]:[]}function sc(e,i){switch(e){case We.SINGLE_IMAGE_PREVIEW:return i("Single image preview");case We.DEAL_ANNOTATION:return i("Deal Annotation");case We.DEAL_CARD:return i("Deal Card");default:return i("Product carousel")}}var Vi=300,Xo=16;function ac(e){if(!e||e.offsetParent===null)return!1;const i=e.getBoundingClientRect();return i.width>0&&i.height>0}function nc(e){const i=Array.from(document.querySelectorAll(e));for(const l of i){if(!(l instanceof HTMLElement))continue;const s=l.getBoundingClientRect(),a=window.getComputedStyle(l);if(s.width>0&&s.height>0&&a.display!=="none"&&a.visibility!=="hidden")return l}return null}var dc=({data:e,subjectLine:i,parentRef:l,overlayTargetSelector:s,onApply:a,applyDisabled:d=!1,applyBlockers:c=[],onRemove:p,visible:f=!0})=>{const{__:x}=r.useI18n(),[k,b]=(0,n.useState)(null),[h,T]=(0,n.useState)(null);(0,n.useEffect)(()=>{if(!f){b(null),T(null);return}const j=()=>{if(!ac(l?.current)){b(null),T(null);return}if(s){const q=l?.current?.closest(".email-pane__col_settings-inner")||nc(".email-pane__col_settings-inner");if(q){T(q),b({type:"popover"});return}}if(!l?.current)return;let y=l.current.getBoundingClientRect();if(y.width===0&&y.height===0){const q=l.current.closest(".email-pane__col");q&&(y=q.getBoundingClientRect())}const oe=Math.max(Xo,Math.min(y.top,window.innerHeight-Xo));let G=y.left-Vi-Xo;G<Xo&&(G=y.right+Xo),G+Vi>window.innerWidth-Xo&&(G=window.innerWidth-Vi-Xo),T(document.body),b({type:"side",top:oe,left:Math.max(Xo,G)})};j();const C=window.requestAnimationFrame(j),P=[window],Y=l?.current?.closest(".email-pane__collapse-wrapper"),z=l?.current?.closest(".email-pane__col");Y&&P.push(Y),z&&P.push(z),P.forEach(y=>{y.addEventListener("scroll",j,{passive:!0})}),window.addEventListener("resize",j);const $=l?.current,O=$&&typeof ResizeObserver<"u"?new ResizeObserver(j):null;return O?.observe($),()=>{window.cancelAnimationFrame(C),O?.disconnect(),P.forEach(y=>{y.removeEventListener("scroll",j)}),window.removeEventListener("resize",j)}},[l,e,s,f]);const _=(0,n.useMemo)(()=>k?.type==="side"?{position:"fixed",top:k.top,left:k.left}:void 0,[k]);if(!f||!e||!Nd(e)&&!a||!k)return null;const E=lc(e),w=e.annotationType||We.PRODUCT_CAROUSEL,v=(()=>{switch(w){case We.PRODUCT_CAROUSEL:return(0,o.jsx)(Jd,{data:e,subjectLine:i,cards:E});case We.SINGLE_IMAGE_PREVIEW:return(0,o.jsx)(Zd,{data:e,subjectLine:i,card:E[0]});case We.DEAL_ANNOTATION:return(0,o.jsx)(ic,{data:e,subjectLine:i});case We.DEAL_CARD:return(0,o.jsx)(rc,{data:e});default:return null}})(),A=(0,o.jsxs)("div",{className:`annotations-preview${k.type==="popover"?" annotations-preview--popover":""}`,style:_,children:[(0,o.jsxs)("div",{className:"annotations-preview__content",children:[(0,o.jsxs)("div",{className:"annotations-preview__type",children:[x("Preview"),": ",sc(w,x)]}),v]}),(a||p)&&(0,o.jsxs)("div",{className:"annotations-preview__footer",children:[p&&(0,o.jsx)(t.ui_kit$Button,{type:"text",size:"small",danger:!0,onClick:p,children:x("Remove annotations")}),a&&(0,o.jsx)(t.ui_kit$Tooltip,{title:d&&c.length?c.join(". "):"",children:(0,o.jsx)("span",{className:"annotations-preview__apply-wrap",children:(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"small",onClick:a,disabled:d,children:x("Apply")})})})]})]});return(0,Oa.createPortal)(A,h||document.body)};function cc(e){return e.replaceAll(`\r
|
|
17
17
|
`,`
|
|
18
|
-
`)}function cc(e){if(!e)return"";const i=document.createElement("textarea");return i.innerHTML=e,i.value.replace(/\u00A0/g," ").trim()}var uc=["USD","EUR","GBP","JPY","CNY","CAD","AUD","CHF","INR","BRL","MXN","KRW","RUB","UAH","KZT","PLN","TRY","SEK","NOK","DKK","CZK","ILS","AED","SGD","HKD","NZD","ZAR"];function ut(e){let i=(e??"").replace(/[\s\u00A0%]/g,"");return i=i.includes(".")?i.replace(/,/g,""):i.replace(",","."),/^\d+(\.\d+)?$/.test(i)?Number(i):null}function St(e,i=2){return String(Number(e.toFixed(i)))}function Tt(e){const i=ut(e);return i!==null&&i>0&&i<=100?i:null}function ts(e,i){const l=ut(e),s=Tt(i);return l===null||l<=0||s===null?"":St(l*s/100)}function mc(e,i){if(i?.includes("%")){const c=Tt(i);return c===null?"":St(c)}const l=ut(e),s=ut(i);if(l===null||l<=0||s===null||s<=0)return"";const a=s/l*100,d=St(s);for(const c of[0,1,2]){const p=St(a,c);if(ts(e,p)===d)return p}return St(a)}function Zt(){return{id:xo.generateUUID(),image:"",url:"",headline:"",price:"",priceCurrency:"",discountPercent:""}}function pc({discountValue:e,...i}){return{...i,discountPercent:mc(i.price,e)}}function is(e,i){return i?.length?i.map(pc):e===We.PRODUCT_CAROUSEL||e===We.SINGLE_IMAGE_PREVIEW?[Zt()]:[]}function rs(e=We.PRODUCT_CAROUSEL){return{annotationType:e,annotationLogo:"",description:"",discountCode:"",availabilityStarts:null,availabilityEnds:null,offerPageUrl:"",merchantHomepageUrl:"",cards:is(e)}}function hc(e){const i=e.annotationType||We.PRODUCT_CAROUSEL;return{annotationType:i,annotationLogo:e.logo||"",description:e.description||"",discountCode:e.discountCode||"",availabilityStarts:e.availabilityStarts?(0,Oo.default)(e.availabilityStarts):null,availabilityEnds:e.availabilityEnds?(0,Oo.default)(e.availabilityEnds):null,offerPageUrl:e.offerPageUrl||"",merchantHomepageUrl:e.merchantHomepageUrl||"",cards:is(i,e.cards)}}function ls(e){const i=e.cards||[];return{annotationType:typeof e.annotationType=="string"?e.annotationType:We.PRODUCT_CAROUSEL,logo:typeof e.annotationLogo=="string"?e.annotationLogo:"",description:typeof e.description=="string"?e.description:"",discountCode:typeof e.discountCode=="string"?e.discountCode:"",availabilityStarts:e.availabilityStarts&&Oo.default.isDayjs(e.availabilityStarts)?e.availabilityStarts.toISOString():void 0,availabilityEnds:e.availabilityEnds&&Oo.default.isDayjs(e.availabilityEnds)?e.availabilityEnds.toISOString():void 0,offerPageUrl:typeof e.offerPageUrl=="string"?e.offerPageUrl:"",merchantHomepageUrl:typeof e.merchantHomepageUrl=="string"?e.merchantHomepageUrl:"",cards:i.map(l=>({id:l.id||xo.generateUUID(),image:l.image||"",url:l.url||"",headline:l.headline||"",price:l.price||"",priceCurrency:l.priceCurrency||"",discountValue:ts(l.price,l.discountPercent)}))}}function bc(e,i){const l=e.getContent();if(!l)return!1;const s=Dd(l,i);if(!s||l.slice(s.range.start,s.range.end)===s.text)return!1;const a=l.slice(s.range.start,s.range.end);return e.mutate({changes:[new r.TextChange(s.range.start,a,s.range.start,s.text)]},{source:"user"}),!0}function fc(e,i){return e?e.emailId!==i.emailId||e.markup!==i.markup:!0}function gc(e){const i=e.getContent(),l=Vd(i);return l===i?!1:(e.mutate({changes:[new r.TextChange(0,i,0,l)]},{source:"user"}),!0)}function Hi(e){return!!e&&/^https?:\/\//i.test(e.trim())}function _c(e,i){const l=e.annotationType??We.PRODUCT_CAROUSEL,s=[];return l===We.PRODUCT_CAROUSEL||l===We.SINGLE_IMAGE_PREVIEW?(e.cards?.some(a=>!!a.image&&Hi(a.url))||s.push(i("At least one card needs an image and a link starting with https://")),e.cards?.some(a=>!!a.priceCurrency?.trim()&&!Ai(a.priceCurrency))&&s.push(i("Price currency must be a three-letter ISO 4217 code, for example USD")),s):l===We.DEAL_CARD?(e.description?.trim()||s.push(i("Discount description is required")),!Hi(e.offerPageUrl)&&!Hi(e.merchantHomepageUrl)&&s.push(i("Offer page or merchant homepage link starting with https:// is required")),s):(!e.description&&!e.discountCode&&!e.availabilityStarts&&!e.availabilityEnds&&s.push(i("Fill in at least one offer field")),s)}function xc(e,i){const l=[],s=e.filter(a=>!!a.discountPercent?.trim());return s.some(a=>Tt(a.discountPercent)===null)&&l.push(i("Discount must be a percentage greater than 0 and up to 100")),s.some(a=>{const d=ut(a.price);return Tt(a.discountPercent)!==null&&(d===null||d<=0)})&&l.push(i("Enter the price as a number to calculate the discount")),l}var{Text:kc}=t.ui_kit$Typography,Ec=10,Bc=1,ss={width:"100%"},Sc="https://developers.google.com/workspace/gmail/promotab",To=["hover"],Tc=["annotationLogo"],as=["cards",0,"price"],Rc=["cards",0,"discountPercent"],yc=["cards",0,"priceCurrency"];function go(e){return e.closest(".email-pane__collapse-wrapper")??document.body}var Do={clearIcon:(0,o.jsx)(t.ui_kit$ColorPickerClearGlyph,{})},wc={optionFilterProp:"label"};function jc(e){return{value:e||void 0}}var vc=uc.map(e=>{const i=Zl(e);return{value:e,label:i===e?e:`${e} (${i})`}}),ns=({name:e,pricePath:i,iconStrokeWidth:l})=>{const{__:s}=r.useI18n(),a=(0,n.useMemo)(()=>[i],[i]),d=(0,n.useMemo)(()=>[({getFieldValue:c})=>({validator:async(p,f)=>{const x=typeof f=="string"?f.trim():"";if(!x)return;if(Tt(x)===null)throw new Error(s("Discount must be a percentage greater than 0 and up to 100"));const k=ut(c(i));if(k===null||k<=0)throw new Error(s("Enter the price as a number to calculate the discount"))}})],[s,i]);return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:s("Discount, %"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:e,dependencies:a,rules:d,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Percent02Icon",component:t.icons$Percent02Icon,size:16,strokeWidth:l}),placeholder:s("Discount, %"),inputMode:"decimal",allowClear:Do})})})},ds=({name:e,iconStrokeWidth:i})=>{const{__:l}=r.useI18n(),s=(0,n.useMemo)(()=>[{validator:async(a,d)=>{const c=typeof d=="string"?d.trim():"";if(c&&!Ai(c))throw new Error(l("Price currency must be a three-letter ISO 4217 code, for example USD"))}}],[l]);return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:l("Price currency"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:e,rules:s,getValueProps:jc,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:vc,placeholder:l("Price currency"),prefix:(0,o.jsx)(r.EmIcons,{icon:"Globe02Icon",component:t.icons$Globe02Icon,size:16,strokeWidth:i}),showSearch:wc,allowClear:!0,getPopupContainer:go})})})},Ic=({onAdd:e})=>{const{__:i}=r.useI18n(),l=(0,n.useCallback)(()=>e(Zt()),[e]);return(0,o.jsx)(t.ui_kit$Button,{type:"text",block:!0,className:"selected-social-form__add-bar",icon:(0,o.jsx)(r.EmIcons,{icon:"AddSlide",component:t.icons$AddSlide}),onClick:l,children:i("Add card")})},Cc=({field:e,index:i,form:l,isSingleImagePreview:s,onRemove:a})=>{const{__:d}=r.useI18n(),c=r.useAppConfig(),p=(0,n.useMemo)(()=>[e.name,"image"],[e.name]),f=(0,n.useMemo)(()=>["cards",e.name,"image"],[e.name]),x=(0,n.useMemo)(()=>[e.name,"headline"],[e.name]),k=(0,n.useMemo)(()=>[e.name,"url"],[e.name]),b=(0,n.useMemo)(()=>[e.name,"price"],[e.name]),h=(0,n.useMemo)(()=>["cards",e.name,"price"],[e.name]),T=(0,n.useMemo)(()=>[e.name,"discountPercent"],[e.name]),_=(0,n.useMemo)(()=>[e.name,"priceCurrency"],[e.name]),E=(0,n.useMemo)(()=>[e.name,"id"],[e.name]),w=(0,n.useMemo)(()=>[{validator:async(A,j)=>{const C=typeof j=="string"?j.trim():"";if(C&&!/^https?:\/\//i.test(C))throw new Error(d("Please enter the correct URL."))}}],[d]),v=(0,n.useCallback)(()=>a(e.name),[a,e.name]);return(0,o.jsxs)("div",{className:"selected-social-form__card",children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head",children:[(0,o.jsx)(kc,{className:"selected-social-form__card-title",children:s?d("Single image preview"):`${d("Card")} ${i+1}`}),!s&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:d("Delete"),placement:"top",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"selected-social-form__card-head-remove",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:18,strokeWidth:c.iconStrokeWidth}),"aria-label":d("Delete"),onClick:v})})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:d("Image"),placement:"top",getPopupContainer:go,children:(0,o.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,o.jsx)(No,{form:l,label:d("Image"),name:p,watchPath:f})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:d("Headline"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:x,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"ElementTitle",component:t.icons$ElementTitle,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Headline"),allowClear:Do})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:d("Link"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:k,className:"selected-social-form__card-field",rules:w,children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Link03",component:t.icons$Link03,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Enter link"),allowClear:Do})})}),!s&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:d("Price"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:b,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"CreditCard02Icon",component:t.icons$CreditCard02Icon,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Price"),allowClear:Do})})}),(0,o.jsx)(ns,{name:T,pricePath:h,iconStrokeWidth:c.iconStrokeWidth}),(0,o.jsx)(ds,{name:_,iconStrokeWidth:c.iconStrokeWidth})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:E,hidden:!0,children:(0,o.jsx)(t.ui_kit$Input,{})})]})};function cs({iconStrokeWidth:e}){const{__:i}=r.useI18n();return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:i("Discount code"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"discountCode",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Sale04Icon",component:t.icons$Sale04Icon,size:16,strokeWidth:e}),placeholder:i("Discount code"),allowClear:Do})})})}var Pc=({className:e="",isActive:i=!0,email:l})=>{const{__:s}=r.useI18n(),a=r.useAppConfig(),{document:d}=r.useDocumentSessionContext(),c=r.useNotification(),[p]=t.ui_kit$Form.useForm(),f=(0,n.useRef)(null),x=(0,n.useRef)(!1),k=(0,n.useRef)(null),[b,h]=(0,n.useState)(!1),T=t.ui_kit$Form.useWatch("annotationType",p),_=t.ui_kit$Form.useWatch("annotationLogo",p),E=t.ui_kit$Form.useWatch("description",p),w=t.ui_kit$Form.useWatch("discountCode",p),v=t.ui_kit$Form.useWatch("availabilityStarts",p),A=t.ui_kit$Form.useWatch("availabilityEnds",p),j=t.ui_kit$Form.useWatch("offerPageUrl",p),C=t.ui_kit$Form.useWatch("merchantHomepageUrl",p),P=t.ui_kit$Form.useWatch("cards",p),Y=JSON.stringify(P??[]),z=(0,n.useMemo)(()=>JSON.parse(Y)??[],[Y]),$=T||We.PRODUCT_CAROUSEL,O=$===We.PRODUCT_CAROUSEL||$===We.SINGLE_IMAGE_PREVIEW,y=$===We.DEAL_ANNOTATION||$===We.DEAL_CARD,oe=$===We.DEAL_CARD,G=$===We.DEAL_ANNOTATION,q=$===We.SINGLE_IMAGE_PREVIEW,te=$===We.SINGLE_IMAGE_PREVIEW?Bc:Ec,ue=(0,n.useMemo)(()=>[{value:We.PRODUCT_CAROUSEL,label:s("Product carousel")},{value:We.SINGLE_IMAGE_PREVIEW,label:s("Single image preview")},{value:We.DEAL_ANNOTATION,label:s("Deal Annotation")},{value:We.DEAL_CARD,label:s("Deal Card")}],[s]),me=(0,n.useMemo)(()=>{let ae="";d&&(ae=d.getContent()),!ae&&l?.html&&(ae=l.html);const Q=ae.match(/<title[^>]*>([\s\S]*?)<\/title>/i),he=Q?Q[1].trim():l?.title||l?.subject||"";return cc(he)},[d,l?.html,l?.title,l?.subject]),se=(0,n.useMemo)(()=>ls({annotationType:$,annotationLogo:_,description:E,discountCode:w,availabilityStarts:v,availabilityEnds:A,offerPageUrl:j,merchantHomepageUrl:C,cards:z}),[$,_,E,w,v,A,j,C,z]),_e=(0,n.useMemo)(()=>O?xc(z,s):[],[O,z,s]),ve=(0,n.useMemo)(()=>Cd(se)&&_e.length===0,[se,_e]),de=(0,n.useMemo)(()=>[..._c(se,s),..._e],[se,_e,s]),De=(0,n.useMemo)(()=>s("Learn more about %s").split("%s"),[s]),ye=(0,n.useCallback)(()=>{!d||!gc(d)||(p.setFieldsValue(rs($)),k.current={emailId:l?.id,markup:null},h(!1),c.success(s("Gmail annotations were removed from the template code.")))},[d,p,$,l?.id,c,s]);(0,n.useEffect)(()=>{if(!O)return;const ae=p.getFieldValue("cards")??[];if($===We.SINGLE_IMAGE_PREVIEW){if(ae.length>1){p.setFieldsValue({cards:[ae[0]]});return}ae.length===0&&p.setFieldsValue({cards:[Zt()]});return}ae.length===0&&p.setFieldsValue({cards:[Zt()]})},[p,O,$,z]);const re=(0,n.useCallback)(ae=>{if(!ae||!x.current||!d)return!1;const Q=bc(d,ls(ae));if(Q){const he=Ql(d.getContent());k.current={emailId:l?.id,markup:he},h(he!==null)}return Q},[d,l?.id]),ke=(0,n.useCallback)(()=>{re(p.getFieldsValue(!0))&&c.success(s("Gmail annotation was successfully applied to the template code."))},[re,p,c,s]);return(0,n.useEffect)(()=>{if(!i)return;const ae=dc(d?.getContent()||l?.html||""),Q={emailId:l?.id,markup:ae?Ql(ae):null};if(h(Q.markup!==null),!fc(k.current,Q))return;k.current=Q,x.current=!1;const he=ae?Hd(ae):null;p.setFieldsValue(he?hc(he):rs()),x.current=!0},[i,l?.id,l?.html,d,p]),(0,o.jsxs)("div",{className:(0,He.default)("selected-social-form","annotations-panel",e),ref:f,children:[(0,o.jsx)(nc,{data:se,subjectLine:me,parentRef:f,overlayTargetSelector:"#pane-content-iframe",onApply:ke,applyDisabled:!ve,applyBlockers:de,onRemove:b?ye:void 0,visible:i}),(0,o.jsxs)(t.ui_kit$Form,{form:p,layout:"vertical",className:"selected-social-form__form element-controls",autoComplete:"off",children:[(0,o.jsxs)("div",{className:"selected-social-form__section",children:[(0,o.jsx)("div",{className:"selected-social-form__section-title",children:s("General settings")}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:s("Annotation type"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"annotationType",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:ue,placeholder:s("Annotation type"),getPopupContainer:go})})}),!oe&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:s("Organization logo"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,o.jsx)(No,{form:p,label:s("Organization logo"),name:"annotationLogo",watchPath:Tc})})}),(q||G)&&(0,o.jsx)(cs,{iconStrokeWidth:a.iconStrokeWidth}),q&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:s("Price"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:as,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"CreditCard02Icon",component:t.icons$CreditCard02Icon,size:16,strokeWidth:a.iconStrokeWidth}),placeholder:s("Price"),allowClear:Do})})}),(0,o.jsx)(ns,{name:Rc,pricePath:as,iconStrokeWidth:a.iconStrokeWidth}),(0,o.jsx)(ds,{name:yc,iconStrokeWidth:a.iconStrokeWidth})]}),y&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:s("Discount description"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"description",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"CommentOutlined",component:t.icons$CommentOutlined,size:16,strokeWidth:a.iconStrokeWidth}),placeholder:s("Discount description"),allowClear:Do})})}),oe&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(cs,{iconStrokeWidth:a.iconStrokeWidth}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:s("Offer page URL"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"offerPageUrl",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Link03",component:t.icons$Link03,size:16,strokeWidth:a.iconStrokeWidth}),placeholder:s("Offer page URL"),allowClear:Do})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:s("Merchant homepage URL"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"merchantHomepageUrl",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Link03",component:t.icons$Link03,size:16,strokeWidth:a.iconStrokeWidth}),placeholder:s("Merchant homepage URL"),allowClear:Do})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:s("Starts"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"availabilityStarts",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DatePicker,{showTime:!0,placeholder:s("Starts"),style:ss,getPopupContainer:go})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:s("Ends"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"availabilityEnds",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DatePicker,{showTime:!0,placeholder:s("Ends"),style:ss,getPopupContainer:go})})})})]})]})]}),O&&(0,o.jsxs)("div",{className:(0,He.default)("selected-social-form__section",{"selected-social-form__section--bordered":!q,"annotations-panel__cards-section":q}),children:[$===We.PRODUCT_CAROUSEL&&(0,o.jsxs)("div",{className:"selected-social-form__section-title",children:[s("Promotion cards"),(0,o.jsx)("span",{className:"annotations-panel__section-hint",children:s("max 10")})]}),(0,o.jsx)(t.ui_kit$Form.List,{name:"cards",children:(ae,{add:Q,remove:he})=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"selected-social-form__items",children:ae.map((pe,ee)=>(0,o.jsx)(Cc,{field:pe,index:ee,form:p,isSingleImagePreview:q,onRemove:he},pe.key))}),!q&&z.length<te&&(0,o.jsx)(Ic,{onAdd:Q})]})})]}),(0,o.jsxs)("div",{className:"annotations-panel__docs-hint",children:[De[0],(0,o.jsx)("a",{href:Sc,target:"_blank",rel:"noopener noreferrer",children:s("Gmail annotations")}),De[1]]})]})]})},Ui=({email:e})=>{const{__:i}=r.useI18n(),l=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,[s,a]=(0,n.useState)(r.SETTINGS),d=r.useAppConfig(),c=T=>a(T||""),p=d.settingsTabEnabled,f=d.UTMEnabled&&l==="email",x=d.annotationsEnabled&&l==="email",k=[p&&"Settings",f&&"UTM parameters",x&&"Annotations parameters"].filter(Boolean),b=k.includes(s)?s:k[0],h=(0,n.useMemo)(()=>{const T=[];return p&&T.push({label:(0,o.jsx)(o.Fragment,{children:i("Settings")}),key:r.SETTINGS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)($l,{className:"email-settings__collapse-panel-content",element:e})}),f&&T.push({label:(0,o.jsx)(o.Fragment,{children:i("UTM parameters")}),key:r.UTM_PARAMETERS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(Ul,{className:"email-settings__collapse-panel-content",email:e})}),x&&T.push({label:(0,o.jsx)(o.Fragment,{children:i("Annotations")}),key:r.ANNOTATIONS_PARAMETERS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(Pc,{className:"email-settings__collapse-panel-content",email:e,isActive:b===r.ANNOTATIONS_PARAMETERS})}),T},[i,e,p,f,x,b]);return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse",size:"large",activeKey:b,onChange:c,items:h})})};Ui.propTypes={};var us=320,Ac=1200,Nc=350,{backgroundColor:ms,backgroundImage:Wi,backgroundPositionX:zi,backgroundPositionY:Gi,backgroundRepeat:ei,backgroundSize:Yi,responsive:Lc,backgroundColorContent:Oc,width:Xi}={backgroundColor:"backgroundColor",backgroundImage:"backgroundImage",backgroundPositionX:"backgroundPositionX",backgroundPositionY:"backgroundPositionY",backgroundRepeat:"backgroundRepeat",backgroundSize:"backgroundSize",responsive:"responsive",backgroundColorContent:"backgroundColorContent",width:"width"},$c={[ms]:"",[Wi]:"",[zi]:"",[Gi]:"",[ei]:"checked",[Yi]:"",[Oc]:"",[Xi]:""};function Ki(e){const i=Number(e);return Number.isNaN(i)?null:{value:i,dim:"px"}}var ps=({className:e=""})=>{const{__:i}=r.useI18n(),{token:l}=(0,t.ui_kit$useToken)(),s=r.useDispatch(),a=r.useAppConfig(),[d]=t.ui_kit$Form.useForm(),c=r.useSendPostMessage(),p=r.useEmailAttribute("common_styles"),f=r.useSelector(r.selectEmailSettings),x=r.useSelector(r.selectIsSettingsDisabled$1),k=r.useSelector(r.selectActiveSettingsTab),b=r.useSelector(r.selectIsNeedUpdateAppearance),[h,T]=(0,n.useState)(!0),_=(0,n.useRef)(!1),E=(0,n.useRef)(null),w=i("Email not yet loaded or global container not found.");(0,n.useEffect)(()=>{b&&(s(r.setIsNeedUpdateAppearance(!1)),c({operation:r.EVENT_TYPES.INIT_PREVIEW}))},[d,b,s,c,p]),(0,n.useEffect)(()=>()=>{E.current&&clearTimeout(E.current)},[]);const v=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],A=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}];(0,n.useEffect)(()=>{const{width:y,...oe}=f,G={...oe,backgroundImage:f.backgroundImage?f.backgroundImage[0]?.value:"",backgroundRepeat:f[ei]===""?"repeat":f[ei],backgroundSize:f[Yi],responsive:f.responsive?.shutdown};_.current||(G.width=y?.value,G.widthDim=y?.dim),d.setFieldsValue(G),T(!f.backgroundImage)},[f,d]);const j=(0,n.useCallback)(y=>{const oe=Ki(y);!oe||oe.value<us||c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{width:oe}})},[c]),C=(0,n.useCallback)(y=>{const oe=Ki(y);oe&&s(r.setEmailSettings({...f,width:oe}))},[s,f]),P=(0,n.useCallback)(y=>{E.current&&clearTimeout(E.current),C(y),E.current=setTimeout(()=>{j(y)},Nc)},[j,C]),Y=y=>{const oe=d.getFieldsValue(!0),G=Object.keys(y)[0];switch(G){case Xi:P(y[G]);break;case zi:case Gi:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[G]:y[G]===""?"none":y[G]}});break;case Wi:T(y[G]===""),c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[G]:[{...f?.backgroundImage?.[0],type:"url",value:y[G]}],backgroundSize:"cover"}});break;case Lc:{const q=Ki(oe.width);c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{responsive:{shutdown:y[G],styles:y[G]},...q?{width:q}:{}}});break}default:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:y})}},z=y=>{s(r.setMobileViewActive({shutdown:y,styles:y})),c({operation:r.EVENT_TYPES.SANDBOX_IFRAME_SETSIZE,settings:{iframeWidth:document.querySelector(".email-pane__iframe").getBoundingClientRect().width}})},$=()=>{_.current=!0},O=()=>{E.current&&(clearTimeout(E.current),E.current=null);const y=d.getFieldValue(Xi);C(y),j(y),requestAnimationFrame(()=>{_.current=!1})};return(0,o.jsx)("div",{className:(0,He.default)("appearance-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"appearance_panel_form",initialValues:{remember:!1,...$c},onValuesChange:Y,autoComplete:"off",className:"element-controls",children:[x?(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:"24px"},title:w,type:"error"}):null,(0,o.jsx)(t.ui_kit$FormSection,{title:i("Email layout width"),dividerTop:!1,children:(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:f.width?.value?i("This field sets the width of the email."):i("Couldn`t determine the email width"),placement:"right",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"width",style:{marginBottom:l.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$InputNumber,{min:us,max:Ac,placeholder:i("Width"),disabled:!f.width?.value,addonAfter:"px",onFocus:$,onBlur:O})})})})})}),a.emailResponsiveControlEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{gutter:20,children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"responsive",valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:"responsive",label:i("Responsive email"),size:"small",name:"responsive",disabled:f.responsive?.shutdown===void 0,onChange:z})})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:i("Email background color"),dividerTop:!a.emailResponsiveControlEnabled,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:h?16:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:ms,style:{marginBottom:l.formItemMarginBottomXS},rules:[{message:i("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:f.usedColors,disabled:x})})})}),(0,o.jsx)(t.ui_kit$Col,{span:h?12:24,children:a.formEmailFieldBackgroundImageEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(No,{form:d,label:i("Background image"),name:Wi,tooltipTitle:i("Background image"),disabled:x||k!=="Styles",elementSettings:f}),!h&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:"0"},children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Horizontal position"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:zi,style:{marginBottom:l.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:i("Horizontal position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Vertical position"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:Gi,style:{marginBottom:l.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:i("Vertical position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical})})})})})]})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background image repeat"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:ei,children:(0,o.jsx)(t.ui_kit$Select,{placeholder:i("Please select"),disabled:x,options:v})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background image size"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:Yi,children:(0,o.jsx)(t.ui_kit$Select,{placeholder:i("Please select"),disabled:x,options:A})})})})]})]})]})})]})})]})})};ps.propTypes={className:g.default.string};var{Option:hs}=t.ui_kit$Select,{width:bs,widthDim:Fc}={width:"width",widthDim:"widthDim"},Mc={[bs]:"",[Fc]:""},fs=({className:e=""})=>{const{__:i}=r.useI18n(),l=r.useSelector(r.selectBlockSettings),s=r.useSelector(r.selectIsSettingsDisabled),[a]=t.ui_kit$Form.useForm(),d=r.useSendPostMessage(),c=i("Block not yet loaded or global container not found.");(0,n.useEffect)(()=>{a.setFieldsValue({width:l.width.value,widthDim:l.width.dim})},[l,a]);const p=f=>{const x=a.getFieldsValue(!0),k=Object.keys(f)[0];let b;switch(k){case"width":b={[k]:{value:f[k],dim:x.widthDim}};break;case"widthDim":b={width:{value:x.width,dim:f[k]}};break;default:return}d({operation:r.EVENT_TYPES.SANDBOX_BLOCK_SETTINGS_SET,settings:b})};return(0,o.jsx)("div",{className:(0,He.default)("block-appearance-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:a,layout:"vertical",name:"block_appearance_panel_form",initialValues:{remember:!1,...Mc},onValuesChange:p,autoComplete:"off",children:[s?(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:"24px"},title:c,type:"error"}):null,(0,o.jsx)(t.ui_kit$Form.Item,{label:i("Container width"),name:bs,tooltip:{title:i("Specifies the block width."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},rules:[{message:i("Please input container width")}],children:(0,o.jsx)(t.ui_kit$Input,{disabled:s,placeholder:i("Container width"),addonAfter:(0,o.jsx)(t.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:(0,o.jsxs)(t.ui_kit$Select,{className:"select-after",children:[(0,o.jsx)(hs,{value:"px",children:"px"}),(0,o.jsx)(hs,{value:"%",children:"%"})]})})})})]})})};fs.propTypes={className:g.default.string};var Dc=()=>{};function gs(){const e=r.useContainer(),i=(0,n.useCallback)(s=>{if(!e)return Dc;const a=r.provideDefaultCommonStyles(e).watch(s);return()=>a.dispose()},[e]),l=(0,n.useCallback)(()=>r.getDefaultCommonStyles(e),[e]);return(0,n.useSyncExternalStore)(i,l,l)}function _s(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function qi(e,i){const l={...e};for(const s of Object.keys(i)){const a=i[s],d=e[s];_s(a)&&_s(d)?l[s]=qi(d,a):a!==void 0&&(l[s]=a)}return l}function xs(e,i){const l=r.COMMON_STYLES;if(typeof e=="string"){const s=e.trim();if(s.startsWith("{"))try{const a=JSON.parse(s);if(a&&typeof a=="object"&&!Array.isArray(a)&&Object.keys(a).length>0)return qi(l,a)}catch{}}return i&&typeof i=="object"&&!Array.isArray(i)?qi(l,i):l}var ks=e=>({textFontFamily:e.text.fontFamily,textFontSize:e.text.fontSize,textFontSizeDim:e.text.fontSizeDim,textLineHeight:e.text.lineHeight,textLineHeightDim:e.text.lineHeightDim,textColor:e.text.color,textContrastColor:e.text.contrastColor||"#FFFFFF",textAlign:e.text.textAlign,textPaddingBottom:e.text.paddingBottom,textPaddingBottomDim:e.text.paddingBottomDim,headingFontFamily:e.headings.fontFamily,headingFontSize:e.headings.fontSize,headingFontSizeDim:e.headings.fontSizeDim,headingLineHeight:e.headings.lineHeight,headingLineHeightDim:e.headings.lineHeightDim,headingColor:e.headings.color,headingContrastColor:e.headings.contrastColor||"#FFFFFF",headingAlign:e.headings.textAlign,headingPaddingTop:e.headings.paddingTop,headingPaddingTopDim:e.headings.paddingTopDim,headingPaddingBottom:e.headings.paddingBottom,headingPaddingBottomDim:e.headings.paddingBottomDim,headingLetterSpacing:e.headings.letterSpacing,headingLetterSpacingDim:e.headings.letterSpacingDim,headingBold:e.headings.bold,headingItalic:e.headings.italic,linkColor:e.links.color,linkContrastColor:e.links.contrastColor||"#FFFFFF",linkUnderline:e.links.underline,buttonsFontFamily:e.buttons.fontFamily,buttonsFontSize:e.buttons.fontSize,buttonsFontSizeDim:e.buttons.fontSizeDim,buttonsLetterSpacing:e.buttons.letterSpacing,buttonsLetterSpacingDim:e.buttons.letterSpacingDim,buttonsColor:e.buttons.color,buttonsContrastColor:e.buttons.contrastColor||"#1890ff",buttonsBold:e.buttons.bold,buttonsItalic:e.buttons.italic,buttonsBackgroundColor:e.buttons.backgroundColor,buttonsContrastBackgroundColor:e.buttons.contrastBackgroundColor||"#FFFFFF",buttonsMarginTop:e.buttons.marginTop,buttonsMarginTopDim:e.buttons.marginTopDim,buttonsMarginBottom:e.buttons.marginBottom,buttonsMarginBottomDim:e.buttons.marginBottomDim,buttonsBorder:e.buttons.border,buttonsAlign:e.buttons.textAlign,buttonsBorderRadius:e.buttons.borderRadius,buttonsPadding:e.buttons.padding,cardsContrastBackgroundColor:e.cards?.contrastBackgroundColor||"#1890ff",cardsBaseBackgroundColor:e.cards?.baseBackgroundColor||"#F8F8F8",cardsContrastTextColor:e.cards?.contrastTextColor||"#FFFFFF",cardsBaseTextColor:e.cards?.baseTextColor||"#5A5A5A",cardsBorder:e.cards?.border||{all:null,top:null,right:null,bottom:null,left:null},cardsBorderRadius:e.cards?.borderRadius||{all:10,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},blockBackgroundColor:e.block?.backgroundColor||"",blockContrastBackgroundColor:e.block?.contrastBackgroundColor||"#1890ff",blockPaddingAll:e.block?.padding?.all,blockPaddingTop:e.block?.padding?.top,blockPaddingRight:e.block?.padding?.right,blockPaddingBottom:e.block?.padding?.bottom,blockPaddingLeft:e.block?.padding?.left}),Vc={buttons_borderRadiusAll:"all",buttons_borderRadiusTopLeft:"topLeft",buttons_borderRadiusBottomLeft:"bottomLeft",buttons_borderRadiusTopRight:"topRight",buttons_borderRadiusBottomRight:"bottomRight"},Hc={cards_borderRadiusAll:"all",cards_borderRadiusTopLeft:"topLeft",cards_borderRadiusBottomLeft:"bottomLeft",cards_borderRadiusTopRight:"topRight",cards_borderRadiusBottomRight:"bottomRight"},Uc={blockPaddingTop:"top",blockPaddingLeft:"left",blockPaddingRight:"right",blockPaddingBottom:"bottom"},Wc=({className:e})=>{const{__:i}=r.useI18n(),l=W.useGoogleFontsLoader(),s=r.useDispatch(),a=r.useSendPostMessage(),[d]=t.ui_kit$Form.useForm(),c=r.useSelector(r.selectEmailSettings),p=r.useSelector(r.selectIsNeedUpdateContentAppearance),f=gs(),x=r.useEmailAttribute("common_styles"),k=r.useAppConfig(),{token:b}=(0,t.ui_kit$useToken)(),[h,T]=(0,n.useState)({}),[_,E]=(0,n.useState)({}),[w,v]=(0,n.useState)(!0),[A,j]=(0,n.useState)(!0),[C,P]=(0,n.useState)(!1),[Y,z]=(0,n.useState)(!1),$={buttonsPaddingTop:"top",buttonsPaddingLeft:"left",buttonsPaddingRight:"right",buttonsPaddingBottom:"bottom"},O=xs(x,f),[y,oe]=(0,n.useState)(O.headings.bold),[G,q]=(0,n.useState)(O.headings.italic),[te,ue]=(0,n.useState)(O.links.underline),[me,se]=(0,n.useState)(O.buttons.bold),[_e,ve]=(0,n.useState)(O.buttons.italic),[de,De]=(0,n.useState)(null),ye=r.useSelector(r.selectIsPanelHistoryCollapsed);(0,n.useEffect)(()=>{ye||De(null)},[O,De,ye]),(0,n.useEffect)(()=>{ye&&!de&&De(ks(O))},[O,de,ye]),(0,n.useEffect)(()=>{p&&(s(r.setIsNeedUpdateContentAppearance(!1)),d.setFieldsValue(ks(O)))},[d,p,s,O]);const[re,ke]=(0,n.useState)(Math.min(O.headings.fontSize-1,19)),[ae,Q]=(0,n.useState)(Math.max(O.text.fontSize+1,20));(0,n.useEffect)(()=>{if(de){const J=de.buttonsBorder;T(J);const H=Object.keys(J).find(xe=>J[xe]?.width||J[xe]?.style||J[xe]?.color),X=de.cardsBorder;E(X);const ce=Object.keys(X).find(xe=>X[xe]?.width||X[xe]?.style||X[xe]?.color);d.setFieldsValue({buttons_borderPosition:H||"all",buttons_borderWidth:J[H]?.width!==null?J[H]?.width:"",buttons_borderColor:J[H]?.color||"",buttons_borderStyle:J[H]?.style||"",cards_borderPosition:ce||"all",cards_borderWidth:X[ce]?.width!==null?X[ce]?.width:"",cards_borderColor:X[ce]?.color||"",cards_borderStyle:X[ce]?.style||"",buttons_borderRadiusAll:u(de.buttonsBorderRadius.all),buttons_borderRadiusTopLeft:u(de.buttonsBorderRadius.topLeft),buttons_borderRadiusBottomLeft:u(de.buttonsBorderRadius.bottomLeft),buttons_borderRadiusTopRight:u(de.buttonsBorderRadius.topRight),buttons_borderRadiusBottomRight:u(de.buttonsBorderRadius.bottomRight),cards_borderRadiusAll:u(de.cardsBorderRadius.all),cards_borderRadiusTopLeft:u(de.cardsBorderRadius.topLeft),cards_borderRadiusBottomLeft:u(de.cardsBorderRadius.bottomLeft),cards_borderRadiusTopRight:u(de.cardsBorderRadius.topRight),cards_borderRadiusBottomRight:u(de.cardsBorderRadius.bottomRight),blockPaddingAll:u(de.blockPaddingAll),blockPaddingTop:u(de.blockPaddingTop),blockPaddingRight:u(de.blockPaddingRight),blockPaddingBottom:u(de.blockPaddingBottom),blockPaddingLeft:u(de.blockPaddingLeft),blockPaddingLeftRight:u(de.blockPaddingRight)||u(de.blockPaddingLeft),blockPaddingTopBottom:u(de.blockPaddingTop)||u(de.blockPaddingBottom)}),!u(de.blockPaddingAll)&&(u(de.blockPaddingTop)||u(de.blockPaddingRight)||u(de.blockPaddingBottom)||u(de.blockPaddingLeft))&&(de.blockPaddingTop!==de.blockPaddingBottom||de.blockPaddingRight!==de.blockPaddingLeft)?z(!1):z(!0),!u(de.buttonsBorderRadius.all)&&(u(de.buttonsBorderRadius.topLeft)||u(de.buttonsBorderRadius.bottomLeft)||u(de.buttonsBorderRadius.topRight)||u(de.buttonsBorderRadius.bottomRight))?v(!1):v(!0),de.buttonsPadding&&!u(de.buttonsPadding.all)&&(u(de.buttonsPadding.bottom)||u(de.buttonsPadding.right)||u(de.buttonsPadding.left)||u(de.buttonsPadding.top))&&P(!1),!u(de.cardsBorderRadius?.all)&&(u(de.cardsBorderRadius?.topLeft)||u(de.cardsBorderRadius?.bottomLeft)||u(de.cardsBorderRadius?.topRight)||u(de.cardsBorderRadius?.bottomRight))?j(!1):j(!0)}},[d,de]);const he=()=>{z(H=>!H);const J=d.getFieldsValue(!0);if(!Y){J.blockPaddingLeftRight=J.blockPaddingLeft,J.blockPaddingTopBottom=J.blockPaddingTop,J.blockPaddingRight=J.blockPaddingLeft,J.blockPaddingBottom=J.blockPaddingTop;const H=Number(J.blockPaddingTopBottom),X=Number(J.blockPaddingLeftRight);a({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{blockPadding:{top:Number.isFinite(H)?H:0,bottom:Number.isFinite(H)?H:0,left:Number.isFinite(X)?X:0,right:Number.isFinite(X)?X:0}}})}},pe=J=>{const H=J.target.closest("button");if(!H)return;const X=H.name,ce=H.classList.contains("selected-td-form__button--active");H.className=ce?"ant-btn ant-btn-default":"ant-btn ant-btn-default selected-td-form__button--active";try{H.blur()}catch{}X==="headingBold"?oe(!ce):X==="headingItalic"?q(!ce):X==="linkUnderline"?ue(!ce):X==="buttonsBold"?se(!ce):X==="buttonsItalic"&&ve(!ce),a({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[X]:!ce}})},ee=J=>{const H=d.getFieldsValue(!0),X=Object.keys(J)[0];let ce={};switch(X){case"headingFontSize":ke(Math.min(H.headingFontSize-1,19)),ce=J;break;case"textFontSize":Q(Math.max(H.textFontSize+1,20)),ce=J;break;case"buttons_borderStyle":ce={buttonsBorder:{[H.buttons_borderPosition]:{...h[H.buttons_borderPosition],style:J[X]}}},H.buttons_borderPosition==="all"?T(xe=>({...r.RESET_BORDER_PARAMS,[H.buttons_borderPosition]:{...xe[H.buttons_borderPosition],style:J[X]}})):T(xe=>({...xe,[H.buttons_borderPosition]:{...xe[H.buttons_borderPosition],style:J[X]}}));break;case"buttons_borderColor":ce={buttonsBorder:{[H.buttons_borderPosition]:{...h[H.buttonsBorderPosition],color:J[X]}}},H.buttons_borderPosition==="all"?T(xe=>({...r.RESET_BORDER_PARAMS,[H.buttons_borderPosition]:{...xe[H.buttons_borderPosition],color:J[X]}})):T(xe=>({...xe,[H.buttons_borderPosition]:{...xe[H.buttons_borderPosition],color:J[X]}}));break;case"buttons_borderWidth":ce={buttonsBorder:{[H.buttons_borderPosition]:{...h[H.buttons_borderPosition],width:J[X]}}},H.buttonsBorderPosition==="all"?T(xe=>({...r.RESET_BORDER_PARAMS,[H.buttons_borderPosition]:{...xe[H.buttons_borderPosition],width:J[X]}})):T(xe=>({...xe,[H.buttons_borderPosition]:{...xe[H.buttons_borderPosition],width:J[X]}}));break;case"buttons_borderPosition":d.setFieldsValue({buttons_borderWidth:h[J[X]]?.width||"",buttons_borderColor:h[J[X]]?.color||"",buttons_borderStyle:h[J[X]]?.style||""});break;case"cards_borderStyle":ce={cardsBorder:{[H.cards_borderPosition]:{..._[H.cards_borderPosition],style:J[X]}}},H.cards_borderPosition==="all"?E(xe=>({...r.RESET_BORDER_PARAMS,[H.cards_borderPosition]:{...xe[H.cards_borderPosition],style:J[X]}})):E(xe=>({...xe,[H.cards_borderPosition]:{...xe[H.cards_borderPosition],style:J[X]}}));break;case"cards_borderColor":ce={cardsBorder:{[H.cards_borderPosition]:{..._[H.cardsBorderPosition],color:J[X]}}},H.cards_borderPosition==="all"?E(xe=>({...r.RESET_BORDER_PARAMS,[H.cards_borderPosition]:{...xe[H.cards_borderPosition],color:J[X]}})):E(xe=>({...xe,[H.cards_borderPosition]:{...xe[H.cards_borderPosition],color:J[X]}}));break;case"cards_borderWidth":ce={cardsBorder:{[H.cards_borderPosition]:{..._[H.cards_borderPosition],width:J[X]}}},H.cardsBorderPosition==="all"?E(xe=>({...r.RESET_BORDER_PARAMS,[H.cards_borderPosition]:{...xe[H.cards_borderPosition],width:J[X]}})):E(xe=>({...xe,[H.cards_borderPosition]:{...xe[H.cards_borderPosition],width:J[X]}}));break;case"cards_borderPosition":d.setFieldsValue({cards_borderWidth:_[J[X]]?.width||"",cards_borderColor:_[J[X]]?.color||"",cards_borderStyle:_[J[X]]?.style||""});break;case"buttons_borderRadiusAll":case"buttons_borderRadiusTopLeft":case"buttons_borderRadiusBottomLeft":case"buttons_borderRadiusTopRight":case"buttons_borderRadiusBottomRight":ce={buttonsBorderRadius:{[Vc[X]]:+J[X]}};break;case"cards_borderRadiusAll":case"cards_borderRadiusTopLeft":case"cards_borderRadiusBottomLeft":case"cards_borderRadiusTopRight":case"cards_borderRadiusBottomRight":ce={cardsBorderRadius:{[Hc[X]]:+J[X]}};break;case"buttonsPaddingTop":case"buttonsPaddingLeft":case"buttonsPaddingRight":case"buttonsPaddingBottom":C?(ce={padding:{all:+J[X]}},d.setFieldsValue({paddingTop:J[X],paddingLeft:J[X],paddingRight:J[X],paddingBottom:J[X]})):ce={buttonsPadding:{[$[X]]:+J[X]}};break;case"blockPaddingTop":case"blockPaddingLeft":case"blockPaddingRight":case"blockPaddingBottom":ce={blockPadding:{[Uc[X]]:+J[X]}};break;case"blockPaddingTopBottom":ce={blockPadding:{top:+J[X],bottom:+J[X]}},H.blockPaddingTop=H.blockPaddingBottom=+J[X];break;case"blockPaddingLeftRight":ce={blockPadding:{left:+J[X],right:+J[X]}},H.blockPaddingLeft=H.blockPaddingRight=+J[X];break;default:ce=J}X!=="buttons_borderPosition"&&a({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:ce})};return de&&(0,o.jsx)("div",{className:(0,He.default)("appearance-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"content_appearance_panel_form",initialValues:de,onValuesChange:ee,autoComplete:"off",className:"element-controls",children:[null,(0,o.jsxs)(t.ui_kit$FormSection,{title:i("Blocks"),dividerTop:!1,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Blocks background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"blockBackgroundColor",style:{marginBottom:b.formItemMarginBottomMD+4},rules:[{message:i("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color of the contrast blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"blockContrastBackgroundColor",style:{marginBottom:b.formItemMarginBottomMD+4},rules:[{message:i("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})})]}),(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:Y,onToggleExtended:he,fieldNames:{paddingLeftRight:"blockPaddingLeftRight",paddingLeft:"blockPaddingLeft",paddingRight:"blockPaddingRight",paddingTopBottom:"blockPaddingTopBottom",paddingTop:"blockPaddingTop",paddingBottom:"blockPaddingBottom"},labels:{horizontal:i("Horizontal padding"),vertical:i("Vertical padding"),left:i("Left padding"),right:i("Right padding"),top:i("Top padding"),bottom:i("Bottom padding"),individual:i("Individual padding")},gutter:10,rowStyle:{paddingBottom:4}})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:i("General text"),dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Font of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textFontFamily",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{loadGoogleFonts:l,getPopupContainer:J=>J.closest(".email-pane__content-col")})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Font size of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textFontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:15,max:re,placeholder:i("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Line height of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textLineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Color of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrast block text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textContrastColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Text color"),usedColors:c.usedColors})})})})]}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom padding of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textPaddingBottom",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom padding"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingBottom",component:t.icons$PaddingBottom}),addonAfter:"px"})})})})})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:i("Headings"),dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading font"),placement:"left",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingFontFamily",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{loadGoogleFonts:l,getPopupContainer:J=>J.closest(".email-pane__content-col")})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingFontSize",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:ae,max:40,placeholder:i("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingLineHeight",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading letter spacing"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingLetterSpacing",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Letter spacing"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsxs)(t.ui_kit$Space,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Strong"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)({"selected-td-form__button--active":y}),type:"default",name:"headingBold",onClick:pe,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined})})}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Italic"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)({"selected-td-form__button--active":G}),type:"default",name:"headingItalic",onClick:pe,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined})})})]})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Heading color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrast block header color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingContrastColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Heading color"),usedColors:c.usedColors})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Top padding"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingPaddingTop",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Top padding"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingTop",component:t.icons$PaddingTop}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom padding"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingPaddingBottom",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom padding"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingBottom",component:t.icons$PaddingBottom}),addonAfter:"px"})})})})]})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:i("Links"),dividerTop:!0,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Link color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkColor",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Link color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Underline"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)({"selected-td-form__button--active":te}),type:"default",name:"linkUnderline",onClick:pe,children:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined})})})})]}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Link color in contrasting blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkContrastColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Link color"),usedColors:c.usedColors})})})})})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Text & background")]}),dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons font"),placement:"left",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsFontFamily",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{loadGoogleFonts:l,getPopupContainer:J=>J.closest(".email-pane__content-col")})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsFontSize",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons letter spacing"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsLetterSpacing",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Letter spacing"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsColor",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Buttons text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Button text color in contrasting blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsContrastColor",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Buttons text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsBackgroundColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Button background color in contrasting blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsContrastBackgroundColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),k.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(it,{form:d,elementSettings:{textAlign:"",type:"email"},imgParent:!1,name:"buttonsAlign",withHotKeys:!1})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsxs)(t.ui_kit$Space,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Strong"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)({"selected-td-form__button--active":me}),type:"default",name:"buttonsBold",onClick:pe,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined})})}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Italic"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)({"selected-td-form__button--active":_e}),type:"default",name:"buttonsItalic",onClick:pe,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined})})})]})})]})]}),k.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Borders")]}),dividerTop:!0,children:(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(W.SelectedElementFormBorder,{form:d,borders:h,namePrefix:"buttons_"})})}),k.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Border radius")]}),dividerTop:!0,children:(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(So,{form:d,oneBorderRadiusValue:w,setOneBorderRadiusValue:v,elementSettings:de,namePrefix:"buttons_"})})}),(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Margins")]}),dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Top margin"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsMarginTop",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Top margin"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingTop",component:t.icons$PaddingTop}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom margin"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsMarginBottom",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom margin"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingBottom",component:t.icons$PaddingBottom}),addonAfter:"px"})})})})]})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Cards")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Colors")]}),dividerTop:!0,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:i("Base colors"),compact:!0,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Base background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsBaseBackgroundColor",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Base background color"),usedColors:c.usedColors})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:i("Contrasting colors"),compact:!0,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrasting background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsContrastBackgroundColor",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Contrasting background color"),usedColors:c.usedColors})})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Base text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsBaseTextColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Base text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrasting text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsContrastTextColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Contrasting text color"),usedColors:c.usedColors})})})})]})]}),k.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Cards")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Borders")]}),dividerTop:!0,children:(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(W.SelectedElementFormBorder,{form:d,borders:_,namePrefix:"cards_"})})}),k.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Cards")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Border radius")]}),dividerTop:!0,children:(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(So,{form:d,oneBorderRadiusValue:A,setOneBorderRadiusValue:j,elementSettings:de,namePrefix:"cards_"})})})]})})},Ji=({email:e})=>{const{__:i}=r.useI18n(),l=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,[s,a]=(0,n.useState)(r.APPEARANCE),d=r.useAppConfig(),c=x=>a(x||"");e.common_styles&&e.common_styles;const p=l==="email"&&d.commonStylesEnabled&&!0;let f=[{label:(0,o.jsx)(o.Fragment,{children:i(l==="email"?"Global styles":"Block styles")}),key:r.APPEARANCE,forceRender:!0,className:"email-settings__collapse-panel",children:l==="email"?(0,o.jsx)(ps,{className:"email-settings__collapse-panel-content"}):(0,o.jsx)(fs,{className:"email-settings__collapse-panel-content"})}];return p&&f.push({label:(0,o.jsx)(o.Fragment,{children:i("Content styles")}),key:"contentStyles",forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(Wc,{className:"email-settings__collapse-panel-content"})}),(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse appearance-panel__content-styles",size:"large",activeKey:s,onChange:c,items:f})})};Ji.propTypes={};var zc=to.__commonJSMin((e=>{var i=["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"].reduce((l,s)=>(l[s.toLowerCase()]=s,l),{});e.CASE_SENSITIVE_TAG_NAMES_MAP=i}));function Gc(e){return e.type===Ze.Tag||e.type===Ze.Script||e.type===Ze.Style}var Ze,Yc,Xc,Kc,qc,Jc,Qc,Zc,eu,ou,Es=to.__esmMin((()=>{(function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"})(Ze||(Ze={})),Yc=Ze.Root,Xc=Ze.Text,Kc=Ze.Directive,qc=Ze.Comment,Jc=Ze.Script,Qc=Ze.Style,Zc=Ze.Tag,eu=Ze.CDATA,ou=Ze.Doctype}));function Bs(e){return Gc(e)}function Ss(e){return e.type===Ze.CDATA}function Ts(e){return e.type===Ze.Text}function Rs(e){return e.type===Ze.Comment}function ys(e){return e.type===Ze.Directive}function ws(e){return e.type===Ze.Root}function tu(e){return Object.hasOwn(e,"children")}function Qi(e,i=!1){let l;if(Ts(e))l=new yt(e.data);else if(Rs(e))l=new ti(e.data);else if(Bs(e)){const s=i?Zi(e.children):[],a=new li(e.name,{...e.attribs},s);for(const d of s)d.parent=a;e.namespace!=null&&(a.namespace=e.namespace),e["x-attribsNamespace"]&&(a["x-attribsNamespace"]={...e["x-attribsNamespace"]}),e["x-attribsPrefix"]&&(a["x-attribsPrefix"]={...e["x-attribsPrefix"]}),l=a}else if(Ss(e)){const s=i?Zi(e.children):[],a=new ri(s);for(const d of s)d.parent=a;l=a}else if(ws(e)){const s=i?Zi(e.children):[],a=new jt(s);for(const d of s)d.parent=a;e["x-mode"]&&(a["x-mode"]=e["x-mode"]),l=a}else if(ys(e)){const s=new ii(e.name,e.data);e["x-name"]!=null&&(s["x-name"]=e["x-name"],s["x-publicId"]=e["x-publicId"],s["x-systemId"]=e["x-systemId"]),l=s}else throw new Error(`Not implemented yet: ${e.type}`);return l.startIndex=e.startIndex,l.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(l.sourceCodeLocation=e.sourceCodeLocation),l}function Zi(e){const i=e.map(l=>Qi(l,!0));for(let l=1;l<i.length;l++)i[l].prev=i[l-1],i[l-1].next=i[l];return i}var oi,Rt,yt,ti,ii,wt,ri,jt,li,js=to.__esmMin((()=>{Es(),oi=class{parent=null;prev=null;next=null;startIndex=null;endIndex=null;get parentNode(){return this.parent}set parentNode(e){this.parent=e}get previousSibling(){return this.prev}set previousSibling(e){this.prev=e}get nextSibling(){return this.next}set nextSibling(e){this.next=e}cloneNode(e=!1){return Qi(this,e)}},Rt=class extends oi{data;constructor(e){super(),this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}},yt=class extends Rt{type=Ze.Text;get nodeType(){return 3}},ti=class extends Rt{type=Ze.Comment;get nodeType(){return 8}},ii=class extends Rt{type=Ze.Directive;name;constructor(e,i){super(i),this.name=e}get nodeType(){return 1}"x-name";"x-publicId";"x-systemId"},wt=class extends oi{children;constructor(e){super(),this.children=e}get firstChild(){return this.children[0]??null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(e){this.children=e}},ri=class extends wt{type=Ze.CDATA;get nodeType(){return 4}},jt=class extends wt{type=Ze.Root;get nodeType(){return 9}},li=class extends wt{name;attribs;type;constructor(e,i,l=[],s=e==="script"?Ze.Script:e==="style"?Ze.Style:Ze.Tag){super(l),this.name=e,this.attribs=i,this.type=s}get nodeType(){return 1}get tagName(){return this.name}set tagName(e){this.name=e}get attributes(){return Object.keys(this.attribs).map(e=>({name:e,value:this.attribs[e],namespace:this["x-attribsNamespace"]?.[e],prefix:this["x-attribsPrefix"]?.[e]}))}namespace;"x-attribsNamespace";"x-attribsPrefix"}})),er=to.__exportAll({CDATA:()=>ri,Comment:()=>ti,DataNode:()=>Rt,Document:()=>jt,DomHandler:()=>tr,Element:()=>li,Node:()=>oi,NodeWithChildren:()=>wt,ProcessingInstruction:()=>ii,Text:()=>yt,cloneNode:()=>Qi,default:()=>tr,hasChildren:()=>tu,isCDATA:()=>Ss,isComment:()=>Rs,isDirective:()=>ys,isDocument:()=>ws,isTag:()=>Bs,isText:()=>Ts}),or,tr,ir=to.__esmMin((()=>{Es(),js(),js(),or={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},tr=class{dom=[];root=new jt(this.dom);callback;options;elementCB;done=!1;tagStack=[this.root];lastNode=null;parser=null;constructor(e,i,l){typeof i=="function"&&(l=i,i=or),typeof e=="object"&&(i=e,e=void 0),this.callback=e??null,this.options=i??or,this.elementCB=l??null}onparserinit(e){this.parser=e}onreset(){this.dom=[],this.root=new jt(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null}onend(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))}onerror(e){this.handleCallback(e)}onclosetag(){this.lastNode=null;const e=this.tagStack.pop();this.options.withEndIndices&&this.parser&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)}onopentag(e,i){const l=this.options.xmlMode?Ze.Tag:void 0,s=new li(e,i,void 0,l);this.addNode(s),this.tagStack.push(s)}ontext(e){const{lastNode:i}=this;if(i&&i.type===Ze.Text)i.data+=e,this.options.withEndIndices&&this.parser&&(i.endIndex=this.parser.endIndex);else{const l=new yt(e);this.addNode(l),this.lastNode=l}}oncomment(e){if(this.lastNode&&this.lastNode.type===Ze.Comment){this.lastNode.data+=e;return}const i=new ti(e);this.addNode(i),this.lastNode=i}oncommentend(){this.lastNode=null}oncdatastart(){const e=new yt(""),i=new ri([e]);this.addNode(i),e.parent=i,this.lastNode=e}oncdataend(){this.lastNode=null}onprocessinginstruction(e,i){const l=new ii(e,i);this.addNode(l)}handleCallback(e){if(typeof this.callback=="function")this.callback(e,this.dom);else if(e)throw e}addNode(e){const i=this.tagStack[this.tagStack.length-1],l=i.children[i.children.length-1];this.options.withStartIndices&&this.parser&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&this.parser&&(e.endIndex=this.parser.endIndex),i.children.push(e),l&&(e.prev=l,l.next=e),e.parent=i,this.lastNode=null}}})),vs=to.__commonJSMin((e=>{var i=zc(),l=(ir(),to.__toCommonJS(er)),s="\r",a=new RegExp(s,"g"),d=`__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_${Date.now().toString()}__`,c=new RegExp(d,"g");function p(_){return i.CASE_SENSITIVE_TAG_NAMES_MAP[_]}function f(_){const E={};let w=0;const v=_.length;for(;w<v;w++){const A=_[w];E[A.name]=A.value}return E}function x(_){_=_.toLowerCase();const E=p(_);return E||_}function k(_,E){const w="<"+E,v=_.toLowerCase().indexOf(w);if(v===-1)return!1;const A=_[v+w.length];return A===">"||A===" "||A===" "||A===`
|
|
19
|
-
`||A==="\r"||A==="/"}function b(_){return _.replace(a,d)}function h(_){return _.replace(c,s)}function T(_,E=null,w){const v=[];let A,j=0;const C=_.length;for(;j<C;j++){const P=_[j];switch(P.nodeType){case 1:{const z=x(P.nodeName);A=new l.Element(z,f(P.attributes)),A.children=T(z==="template"?P.content.childNodes:P.childNodes,A);break}case 3:A=new l.Text(h(P.nodeValue??""));break;case 8:A=new l.Comment(P.nodeValue??"");break;default:continue}const Y=v[j-1]??null;Y&&(Y.next=A),A.parent=E,A.prev=Y,A.next=null,v.push(A)}return w&&(A=new l.ProcessingInstruction(w.substring(0,w.indexOf(" ")).toLowerCase(),w),A.next=v[0]??null,A.parent=E,v.unshift(A),v[1]&&(v[1].prev=v[0])),v}e.escapeSpecialCharacters=b,e.formatDOM=T,e.hasOpenTag=k})),iu=to.__commonJSMin((e=>{var i=vs(),l="html",s="head",a="body",d=/<([a-zA-Z]+[0-9]?)/;function c(_,E){return E?E.createHTML(_):_}var p=(_,E,w)=>{throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},f=(_,E,w)=>{throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},x=typeof window=="object"&&window.DOMParser;if(typeof x=="function"){const _=new x,E="text/html";f=(w,v,A)=>(v&&(w=`<${v}>${w}</${v}>`),_.parseFromString(w,E)),p=f}if(typeof document=="object"&&document.implementation){const _=document.implementation.createHTMLDocument();p=function(E,w,v){if(w){const A=_.documentElement.querySelector(w);return A&&(A.innerHTML=c(E,v)),_}return _.documentElement.innerHTML=c(E,v),_}}var k=typeof document=="object"&&document.createElement("template"),b;k&&k.content&&(b=(_,E)=>(k.innerHTML=c(_,E),k.content.childNodes));var h=()=>document.createDocumentFragment().childNodes;function T(_,E){_=i.escapeSpecialCharacters(_);const w=d.exec(_)?.[1]?.toLowerCase();switch(w){case l:{const v=f(_);if(!i.hasOpenTag(_,s)){const A=v.querySelector(s);A?.parentNode?.removeChild(A)}if(!i.hasOpenTag(_,a)){const A=v.querySelector(a);A?.parentNode?.removeChild(A)}return v.querySelectorAll(l)}case s:case a:{const v=p(_,void 0,E).querySelectorAll(w);return i.hasOpenTag(_,a)&&i.hasOpenTag(_,s)?v[0].parentNode?.childNodes??h():v}default:return b?b(_,E):p(_,a,E).querySelector(a)?.childNodes??h()}}e.default=T})),ru=to.__commonJSMin((e=>{Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var i=vs(),l=iu(),s=/<(![a-zA-Z\s]+)>/;function a(d,c){if(typeof d!="string")throw new TypeError("First argument must be a string");if(!d)return[];const p=s.exec(d),f=p?p[1]:void 0;return i.formatDOM(l.default(d,c?.trustedTypePolicy),null,f)}e.default=a})),lu=to.__commonJSMin((e=>{var i=0;e.SAME=i;var l=1;e.CAMELCASE=l,e.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1}})),su=to.__commonJSMin((e=>{var i=0,l=1,s=2,a=3,d=4,c=5,p=6;function f(j){return k.hasOwnProperty(j)?k[j]:null}function x(j,C,P,Y,z,$,O){this.acceptsBooleans=C===s||C===a||C===d,this.attributeName=Y,this.attributeNamespace=z,this.mustUseProperty=P,this.propertyName=j,this.type=C,this.sanitizeURL=$,this.removeEmptyString=O}var k={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(j=>{k[j]=new x(j,i,!1,j,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([j,C])=>{k[j]=new x(j,l,!1,C,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(j=>{k[j]=new x(j,s,!1,j.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(j=>{k[j]=new x(j,s,!1,j,null,!1,!1)}),["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach(j=>{k[j]=new x(j,a,!1,j.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(j=>{k[j]=new x(j,a,!0,j,null,!1,!1)}),["capture","download"].forEach(j=>{k[j]=new x(j,d,!1,j,null,!1,!1)}),["cols","rows","size","span"].forEach(j=>{k[j]=new x(j,p,!1,j,null,!1,!1)}),["rowSpan","start"].forEach(j=>{k[j]=new x(j,c,!1,j.toLowerCase(),null,!1,!1)});var b=/[\-\:]([a-z])/g,h=j=>j[1].toUpperCase();["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach(j=>{const C=j.replace(b,h);k[C]=new x(C,l,!1,j,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(j=>{const C=j.replace(b,h);k[C]=new x(C,l,!1,j,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(j=>{const C=j.replace(b,h);k[C]=new x(C,l,!1,j,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(j=>{k[j]=new x(j,l,!1,j.toLowerCase(),null,!1,!1)});var T="xlinkHref";k[T]=new x("xlinkHref",l,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(j=>{k[j]=new x(j,l,!1,j.toLowerCase(),null,!0,!0)});var{CAMELCASE:_,SAME:E,possibleStandardNames:w}=lu(),v=RegExp.prototype.test.bind(new RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$")),A=Object.keys(w).reduce((j,C)=>{const P=w[C];return P===E?j[C]=C:P===_?j[C.toLowerCase()]=C:j[C]=P,j},{});e.BOOLEAN=a,e.BOOLEANISH_STRING=s,e.NUMERIC=c,e.OVERLOADED_BOOLEAN=d,e.POSITIVE_NUMERIC=p,e.RESERVED=i,e.STRING=l,e.getPropertyInfo=f,e.isCustomAttribute=v,e.possibleStandardNames=A}));function au(e,i){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];i=i||{};var l=1,s=1;function a(_){var E=_.match(Cs);E&&(l+=E.length);var w=_.lastIndexOf(Fs);s=~w?_.length-w:s+_.length}function d(){var _={line:l,column:s};return function(E){return E.position=new c(_),x(),E}}function c(_){this.start=_,this.end={line:l,column:s},this.source=i.source}c.prototype.content=e;function p(_){var E=new Error(i.source+":"+l+":"+s+": "+_);if(E.reason=_,E.filename=i.source,E.line=l,E.column=s,E.source=e,!i.silent)throw E}function f(_){var E=_.exec(e);if(E){var w=E[0];return a(w),e=e.slice(w.length),E}}function x(){f(Ps)}function k(_){var E;for(_=_||[];E=b();)E!==!1&&_.push(E);return _}function b(){var _=d();if(!(lr!=e.charAt(0)||sr!=e.charAt(1))){for(var E=2;Ko!=e.charAt(E)&&(sr!=e.charAt(E)||lr!=e.charAt(E+1));)++E;if(E+=2,Ko===e.charAt(E-1))return p("End of comment missing");var w=e.slice(2,E-2);return s+=2,a(w),e=e.slice(E),s+=2,_({type:Ms,comment:w})}}function h(){var _=d(),E=f(As);if(E){if(b(),!f(Ns))return p("property missing ':'");var w=f(Ls),v=_({type:Ds,property:Is(E[0].replace(rr,Ko)),value:w?Is(w[0].replace(rr,Ko)):Ko});return f(Os),v}}function T(){var _=[];k(_);for(var E;E=h();)E!==!1&&(_.push(E),k(_));return _}return x(),T()}function Is(e){return e?e.replace($s,Ko):Ko}var rr,Cs,Ps,As,Ns,Ls,Os,$s,Fs,lr,sr,Ko,Ms,Ds,nu=to.__esmMin((()=>{rr=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Cs=/\n/g,Ps=/^\s*/,As=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Ns=/^:\s*/,Ls=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Os=/^[;\s]*/,$s=/^\s+|\s+$/g,Fs=`
|
|
20
|
-
`,lr="/",sr="*",Ko="",Ms="comment",Ds="declaration"}));function
|
|
21
|
-
`:""}${s.documentElement.outerHTML}`}}catch{}return i}var _u=e=>{const{__:i}=r.useI18n();return[{key:"📧",label:(0,o.jsxs)("div",{onClick:()=>{e("theme-and-preheader-generator")},children:["📧 ",i("Subject line & preheader generator")]})},{key:"🌎",label:(0,o.jsxs)("div",{onClick:()=>{e("translator")},children:["🌎 ",i("Translator")]})},{key:"📄",label:(0,o.jsxs)("div",{onClick:()=>{e("writer")},children:["📄 ",i("Copywriter")]})},{key:"🔎",label:(0,o.jsxs)("div",{onClick:()=>{e("corrector")},children:["🔎 ",i("Proofreader")]})},{key:"🧠",label:(0,o.jsxs)("div",{onClick:()=>{e("psychologist")},children:["🧠 ",i("Psychologist")]})},{key:"📈",label:(0,o.jsxs)("div",{onClick:()=>{e("marketolog")},children:["📈 ",i("Marketer")]})},{key:"✨",label:(0,o.jsxs)("div",{onClick:()=>{e("email-generator")},children:["✨ ",i("Email generator")]})}]},xu={background:r.emCssVar("colorInfo"),color:"#ffffff"},ea=({messages:e,newEmailAiGeneratorRef:i})=>{const l=r.useElementEntityKind(),{document:s}=r.useDocumentSessionContext(),a=r.useContentReader(),d=r.useContentReplacer(),{__:c,_n:p}=r.useI18n(),f=r.useDispatch(),x=r.useAppNavigate(),k=(0,n.useRef)(null),b=r.useAppConfig(),h=r.useNotification(),T=r.useEditorProjectId(),_=r.useOpenEmailId(),E=r.usePushToDataLayer(),w={document:s,pushToDataLayer:E,entityType:l==="block"?"block":"email",entityId:_,projectId:T},v=r.useEventEmitter(xo.events.ON_LIMIT_ID),[A,j]=(0,n.useState)(null),[C,P]=(0,n.useState)(0),[Y,z]=(0,n.useState)(!1),[$,O]=(0,n.useState)(""),[y,oe]=(0,n.useState)([]),[G,q]=(0,n.useState)(!1),[te,ue]=(0,n.useState)(!1),[me,se]=(0,n.useState)(null),[_e,ve]=(0,n.useState)(0),[de,De]=(0,n.useState)(null),ye=r.useEmailAttribute("subject"),re=r.useEmailAttribute("preheader"),ke=r.useCurrentUser(),ae=r.toLanguageCode(r.useInterfaceLocale()),Q=ke.avatar_url||ke.avatar_urls?.[24],he=[ke.first_name,ke.last_name].filter(Boolean).join(" ")||ke.username,pe=r.useMessageService(),[ee]=r.useLazyGetDialogQuery(),J=r.useSendPostMessage(),[H,X]=r.useSendMessageMutation(),[ce,{reset:xe}]=r.useGetAiGenerateStatusMutation(),[ne,{data:Ae=[]}]=r.useLazyGetGeneratedContentQuery(),[we]=r.useLazyGetLimitsStatsByTypeQuery(),$e={cursor:Y?"not-allowed":"default",pointerEvents:Y?"none":"auto"};(0,n.useEffect)(()=>{de&&G&&(i.current=!0),G||(i.current=!1)},[de,G]);const K=!!(b.limits&&b.counters)&&!0,{limits:ie}=b.limits?b:{limits:{ai_limit:0,ai_generator_limit:0}},{ai_limit:je,ai_generator_limit:V}=ie,Se=r.useEventEmitter(xo.events.AI_TEXT_REQUEST_ID).hasListeners(),Ie=nr({limitsInPlugin:K,hostedAiActive:Se}),Ne=Qs({limitsInPlugin:K,hostedAiActive:Se,counter:C,limit:je}),Fe=Qs({limitsInPlugin:K,hostedAiActive:Se,counter:_e,limit:V}),Ve=(0,n.useCallback)(()=>{v.fire({name:"AiChatCount",count:C+1})},[v,C]),Ue=(0,n.useCallback)(()=>{v.fire({name:"AiGeneratorCount",count:_e+1})},[v,_e]),le=(0,n.useCallback)(async B=>!0,[c,we,h]);(0,n.useEffect)(()=>{K&&(P(b?.counters?.ai_counter||0),ve(b?.counters?.ai_generator_counter||0))},[b,K]),(0,n.useEffect)(()=>{De(y.length<=0?!1:y.toReversed().find(S=>S.data?.context)?.data.context==="email-generator")},[y]);const Te=(0,n.useCallback)(async()=>await pe.sendAsync(r.EVENT_TYPES.SANDBOX_IS_EMAIL_EMPTY),[pe]),I=(0,n.useCallback)(()=>{const B=k.current?.closest(".ant-tabs-content.ant-tabs-content-top");setTimeout(()=>{B?.scrollTo({top:B.scrollHeight,behavior:"smooth"})},0)},[k]),Z=(0,n.useCallback)(()=>{r.swallowPromiseRejection(ee({entity_id:_}).then(B=>{oe(B.data.documents),I()}))},[_,ee,oe,I]),Be=(0,n.useCallback)(B=>{if(!B?.data?._eventResult)return!1;const{aiMessage:S,aiHtml:m}=B.data;if(oe(M=>{const U=[...M];for(let Re=U.length-1;Re>=0;Re--)if(U[Re]?.data?.isLoading&&U[Re]?.data?.role==="assistant"){U[Re]={data:{role:"assistant",message:S,isLoading:!1}};break}return U}),m){const M=Zs(a(),String(m));d(M,{undoable:!0})}return I(),!0},[a,d,I]),Ce=(0,n.useCallback)(B=>{oe(S=>{for(let m=S.length-1;m>=0;m--)if(S[m]?.data?.isLoading&&S[m]?.data?.role==="assistant"){const M=[...S];return B?M[m]={data:{role:"assistant",message:B}}:M.splice(m,1),M}return S})},[]),Me=(0,n.useCallback)(B=>{const S=B?.message==="ERROR"?void 0:B?.message;return[B?.data?.message,S].find(m=>typeof m=="string"&&m)||c("Something went wrong.")},[c]),Ge=r.useEventEmitter(xo.events.AI_TEXT_PROGRESS_ID);(0,n.useEffect)(()=>{const B=Ge.event(({progress:S,status:m})=>{const M=m||`${Math.round(S)}%`;oe(U=>{const Re=[...U];for(let be=Re.length-1;be>=0;be--)if(Re[be]?.data?.isLoading&&Re[be]?.data?.role==="assistant"){Re[be]={data:{...Re[be].data,message:M}};break}return Re})});return()=>B.dispose()},[Ge]);const Ye=r.useEventEmitter(xo.events.AI_TEXT_STREAM_ID);(0,n.useEffect)(()=>{const B=Ye.event(({partialHtml:S})=>{const m=Zs(a(),String(S));d(m,{undoable:!0})});return()=>B.dispose()},[Ye,a,d,f]);const D=(0,n.useCallback)(B=>{q(!0),z(!0),r.swallowPromiseRejection(ce({task_id:B||A,entity_id:_,status:"started"}).then(()=>{Z()}))},[_,ce,A,Z]),L=(0,n.useCallback)(()=>{ce({task_id:A,entity_id:_,status:"completed"}).then(B=>{B.data.status===403&&xe(),Z()}).catch(B=>{}),z(!1),q(!1)},[_,ce,A,Z,xe]);(0,n.useEffect)(()=>{let B;if(G){const S=Ae[Ae.length-1]?.processing?.email;if(S){let m=Ae[Ae.length-1].status;d(String(S),{undoable:!0}),m===0&&L()}me&&(clearInterval(B),q(!1),se(!1))}return()=>{clearInterval(B)}},[d,me,f,Ae,G,ye,re,_,A,Z,ce,X,L]),(0,n.useEffect)(I,[I]),(0,n.useEffect)(()=>{e?.length>0&&oe(e),J({operation:r.EVENT_TYPES.SANDBOX_EMAIL_CONTENT_GET})},[e,J]),(0,n.useEffect)(()=>{const B=pe.onInit(()=>{pe.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:Y}),pe.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_DISCUSS,value:Y})});return()=>B.dispose()},[Y,pe]);const R=async()=>{if($){const B=$.replaceAll(/\n/g,"<br>"),S={project_id:T,connection:"chat",entity_id:_,message:B,locale:ae,subject:ye||"",preheader:re||"",textContent:di.extractDocumentTextContent(a())};if(de&&Fe||Ne){h.error({title:c(de?"You have reached the limit of AI generator usage.":"You have reached the limit of AI chat usage."),description:c("Please upgrade your plan.")});const m={data:{role:"assistant",message:c(de?"You have reached the limit of AI generator usage.":"You have reached the limit of AI chat usage.")}};oe(M=>[...M,m])}else{if(!await le(de?"email_generate":"ai")){O("");return}Ie&&(de&&_e!==V?(Ue(),ve(M=>M+1)):C!==je&&(Ve(),P(M=>M+1))),E({event:"submit_form",action:"chat_whit_ai_assistant",entity_id:S.entity_id,project_id:S.project_id});const m=[{data:{role:"user",message:B,userInfo:{display_name:he,avatar_url:Q}}},{data:{role:"assistant",message:c("Typing..."),isLoading:!0}}];oe(M=>[...M,...m]),H({body:S}).then(M=>{if(M?.error)throw M.error;if(!M?.data||M.data.status===401)throw new Error(r.ERROR);if(!Be(M)){if(E({event:"submit",action:"send_discussion_chat_message",entity_type:l==="block"?"block":"email",entity_id:_,project_id:T,context:"editor"}),M.data.task_id){let U=M.data.task_id;j(U),ne({id:U,setError:se}),r.swallowPromiseRejection(Te().then(Re=>{Re?D(U):ue(!0)}))}Z()}}).catch(M=>{const U=Me(M);h.error({title:M?.data?.code||c("Error"),description:U}),Ce(U)})}O("")}},F=async B=>{const S={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};oe(M=>[...M,S]);const m={project_id:T,connection:"chat",entity_id:_,context:B,locale:ae,subject:ye||"",preheader:re||"",textContent:di.extractDocumentTextContent(a())};if(Ie&&(de&&_e!==V?(Ue(),ve(M=>M+1)):C!==je&&(Ve(),P(M=>M+1))),Ne)h.error({title:c("You have reached the limit of AI chat usage."),description:c("Please upgrade your plan.")}),Ce(c("You have reached the limit of AI chat usage."));else{if(!await le("ai")){Ce();return}E({event:"select",action:"select_ai_assistant_role",context:m.context,entity_id:m.entity_id,project_id:m.project_id}),H({body:m}).then(M=>{if(M?.error)throw M.error;if(!M?.data||M.data.status===401)throw new Error(r.ERROR);Be(M)||Z()}).catch(M=>{const U=Me(M);h.error({title:M?.data?.code||c("Error"),description:U}),Ce(U)})}},fe=(0,n.useCallback)(async B=>{const S={data:{role:"user",message:B,userInfo:{display_name:he,avatar_url:Q}}},m={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};oe(U=>[...U,S,m]);const M={project_id:T,connection:"chat",entity_id:_,message:B,locale:ae,subject:ye||"",preheader:re||"",textContent:di.extractDocumentTextContent(a())};if(Fe)h.error({title:c("You have reached the limit of AI generator usage."),description:c("Please upgrade your plan.")}),Ce(c("You have reached the limit of AI chat usage."));else{if(!await le(de?"email_generate":"ai")){Ce();return}H({body:M}).then(U=>{if(U?.error)throw U.error;if(!U?.data||U.data.status===401)throw new Error(r.ERROR);if(!Be(U)){if(E({event:"submit",action:"send_discussion_chat_message",entity_type:l==="block"?"block":"email",entity_id:_,project_id:T,context:"editor"}),U.data.task_id){let Re=U.data.task_id;j(Re),ne({id:Re,setError:se}),r.swallowPromiseRejection(Te().then(be=>{be?D(Re):ue(!0)}))}Ie&&(de&&_e!==V?(Ue(),ve(Re=>Re+1)):C!==je&&(Ve(),P(Re=>Re+1))),Z()}}).catch(U=>{const Re=Me(U);h.error({title:U?.data?.code||c("Error"),description:Re}),Ce(Re)})}},[c,C,_e,Q,Te,Ce,D,Me,he,je,V,ke,ye,re,_,de,Fe,ae,Ve,Ue,Ie,a,h,le,T,H,ne,Z]);(0,n.useEffect)(()=>{const B=new xo.Disposable,S=window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings);if((!e?.length||e.length===1&&e[0]?.data?.role==="assistant")&&S&&_){const m={project_id:T,connection:"chat",entity_id:_,context:"email-generator",locale:ae};r.runOnceInFlight(`discuss-ai-generator-context:${_}`,()=>{if(Se){window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),fe(S);return}r.swallowPromiseRejection(H({body:m}).then(()=>{window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),B.isDisposed()||fe(S)}))})}return()=>B.dispose()},[e,fe,_,ae,T,H,Se]);const Le=B=>{typeof B.target.className=="string"&&B.target.className.includes("ai-response-change-context")&&(X.isLoading||F(B.target.role))},eo=B=>{const S=B.children[0].data??"";Js("subject",S,w),h.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Title copied to email settings"),data:S})},Xe=B=>{const S=B.children[0].data??"";Js("preheader",S,w),h.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Preheader copied to email settings"),data:S,duration:300})},lo=B=>{const S=B.children[0].data;navigator.clipboard.writeText(S).then(()=>{h.success({id:"TEXT_COPIED_TO_CLIPBOARD",title:c("Text copied to clipboard"),data:S})}).catch(m=>{})},Qe={replace:B=>{if(B.attribs?.class?.split(" ").includes("ai-response-title"))return(0,o.jsx)(t.ui_kit$Tooltip,{placement:"left",title:c("Replace the title"),children:(0,o.jsx)("div",{onClick:()=>eo(B),children:(0,o.jsx)("span",{className:"ai-response-title",children:(0,mt.domToReact)(B.children,Qe)})})});if(B.attribs?.class?.split(" ").includes("ai-response-preheader"))return(0,o.jsx)(t.ui_kit$Tooltip,{placement:"left",title:c("Replace the preheader"),children:(0,o.jsx)("div",{onClick:()=>Xe(B),children:(0,o.jsx)("span",{className:"ai-response-preheader",children:(0,mt.domToReact)(B.children,Qe)})})});if(B.attribs?.class?.split(" ").includes("ai-response-copy"))return(0,o.jsx)(t.ui_kit$Tooltip,{placement:"left",title:c("Copy to clipboard"),children:(0,o.jsx)("div",{onClick:()=>lo(B),children:(0,o.jsx)("span",{className:"ai-response-copy",children:(0,mt.domToReact)(B.children,Qe)})})});if(B.attribs?.class?.split(" ").includes("ai-response-user-message")){const S=B.attribs?.data||B.children?.[0]?.data;return(0,o.jsx)("li",{className:B.attribs?.class,data:B.attribs?.data,onClick:()=>fe(S),children:(0,mt.domToReact)(B.children,Qe)})}}},uo=()=>{D(),ue(!1)},Eo=()=>{L(),ue(!1)};return(0,o.jsxs)("div",{ref:k,className:"discuss-main",children:[y.length>0&&(0,o.jsx)(t.ui_kit$List,{onClick:Le,className:"comment-list",itemLayout:"horizontal",dataSource:y,renderItem:B=>(0,o.jsx)("li",{id:B._id,children:(0,o.jsx)(t.ui_kit$Comment,{className:B.data.userInfo?"":"ai-comment",avatar:B.data.role==="assistant"?(0,o.jsx)(r.EmIcons,{icon:"ChatGpt",component:t.icons$ChatGpt,className:"anticon-robot",style:{color:"#ffffff",fontSize:16,width:24,height:24,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"}}):B.data.userInfo&&B.data._modified?B.data.userInfo.avatar_url:Q||(0,o.jsx)(r.EmIcons,{icon:"UserOutlined",component:t.icons$UserOutlined,className:"anticon-user",style:{color:"#ffffff",fontSize:16,width:24,height:24,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"}}),author:(0,o.jsx)("div",{style:$e,children:B?.data?.role==="user"?ke?.username||c("User"):c("AI Assistant")}),datetime:B._created?(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:wo.formatDate(r.parseISO(B._created),p,!0)}}):null,content:B.data.isLoading?(0,o.jsx)("div",{className:"spin",children:(0,o.jsx)(r.EmIcons,{icon:"LoadingOutlined",component:t.icons$LoadingOutlined,style:{fontSize:24},spin:!0})}):(0,o.jsx)("div",{style:$e,children:fu(B.data.message,Qe)})})},B._id)}),K&&(de?(0,o.jsx)(t.ui_kit$LimitsCounter,{text:`${_e} ${c("of")} ${V>0?V:"∞"} ${c("mail generator")} ${p("was used","were used",_e)}`,exceeded:V>0&&_e>=V,style:{marginTop:-25},extra:(0,o.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>x(b.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})}):(0,o.jsx)(t.ui_kit$LimitsCounter,{text:`${C} ${c("of")} ${je>0?je:"∞"} ${c("messeges")} ${p("was used","were used",C)}`,exceeded:je>0&&C>=je,style:{marginTop:-25},extra:(0,o.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>x(b.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})})),(0,o.jsxs)(t.ui_kit$Form,{onFinish:R,className:"addMode",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{disabled:Y,value:$,onChange:B=>O(B.target.value),rows:4,placeholder:c("Type your request"),className:"textarea-comment",onPressEnter:B=>B.key==="Enter"&&B.ctrlKey&&R(),spellCheck:"false"})}),(0,o.jsx)(t.ui_kit$Form.Item,{children:(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Button,{disabled:X.isLoading||Y,type:"default",style:xu,className:"button-target",children:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"top",disabled:Y,arrow:{pointAtCenter:!0},menu:{items:_u(F)},children:(0,o.jsxs)("div",{disabled:Y,style:{margin:0,padding:0,color:"#ffffff",display:"inline-flex",alignItems:"center"},children:[(0,o.jsx)(r.EmIcons,{icon:"ChatGpt",component:t.icons$ChatGpt,style:{marginRight:5}}),c("Role")]})},"Export")}),(0,o.jsxs)(t.ui_kit$Button,{disabled:X.isLoading||Y,className:"button-add",type:"primary",htmlType:"submit",children:[c("Send")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:b.iconStrokeWidth})]})]})})]}),(0,o.jsx)(t.ui_kit$Modal,{title:c("Warning"),open:te,onOk:uo,onCancel:Eo,children:(0,o.jsx)("p",{children:c("The current template will be changed to the generated one, are you sure about this?")})})]})},ku=[r.VALID,r.ERRORS,r.WARNINGS],oa=({summary:e,__:i,selectedTags:l,setSelectedTags:s})=>{const a=(0,n.useCallback)((c,p)=>{s(p?l.length===2?[]:[...l,c]:l.filter(f=>f!==c))},[l,s]),d=(0,n.useCallback)(c=>i(c==="valid"?"Valid":c==="warnings"?"Warnings":"Errors"),[i]);return(0,o.jsx)(t.ui_kit$Title,{level:5,className:"optimise__valid-title",children:(0,o.jsx)(t.ui_kit$Space,{className:"optimise__valid-title-space",size:8,children:ku.map((c,p)=>(0,o.jsxs)(t.ui_kit$CheckableTag,{checked:l?.includes(c),onChange:f=>a(c,f),className:(0,He.default)(`${c} optimise__button`,{[`${c}_active`]:l.includes(c)}),children:[d(c),": ",e?.[c]||0]},c+p))})})},{LINKS:Eu}=r.OPTIMISE_TABS,ta=(0,n.memo)(({__:e,activeTab:i,validateLinksResult:l,validateLinks:s,selectedTags:a,setSelectedTags:d,isLoading:c,disabled:p,iconStrokeWidth:f,onValidate:x,goToLinkHandler:k})=>i!==Eu||!l?.links?null:l.links.length===0?(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,o.jsx)(t.ui_kit$Alert,{title:e("No links found."),type:"info"})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-14",children:(0,o.jsxs)("div",{className:"optimise__title-wrapper",children:[(0,o.jsx)(oa,{__:e,summary:l.summary,setSelectedTags:d,selectedTags:a}),(0,o.jsx)(t.ui_kit$Button,{disabled:p,loading:c,onClick:x,icon:(0,o.jsx)(r.EmIcons,{icon:"SyncOutlined",component:t.icons$SyncOutlined,size:16,strokeWidth:f}),children:e("Refresh")})]})}),(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$List,{itemLayout:"horizontal",dataSource:s,renderItem:(b,h)=>(0,o.jsx)(t.ui_kit$List.Item,{className:t.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{avatar:b.status==="valid"?(0,o.jsx)(r.EmIcons,{icon:"CheckCircleFilled",component:t.icons$CheckCircleFilled,className:r.VALID}):b.status==="warnings"?(0,o.jsx)(r.EmIcons,{icon:"CheckCircleFilled",component:t.icons$CheckCircleFilled,className:r.WARNINGS}):(0,o.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:t.icons$CloseCircleFilled,className:r.ERRORS}),title:(0,o.jsx)(t.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>k(b.linkId,600>(b.statusCode||0)&&(b.statusCode||0)>399||!b.statusCode),children:b.url===""?e("empty link"):b.url}),description:(0,o.jsxs)(o.Fragment,{children:[!!b.text?.length&&(0,o.jsx)(t.ui_kit$Text,{type:"secondary",children:b.text}),b.page?.title&&b.page.title,b.page?.secure&&b.status==="valid"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)("span",{className:"valid",children:e("secure")})]}),!b.resolvedUrl&&!b.statusCode&&b.type==="url"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)(t.ui_kit$Text,{type:"secondary",children:e("Failed to load")})]})]})})},h+"_"+b.linkId)})})})]}));ta.displayName="LinksSection";var{IMAGES:Bu}=r.OPTIMISE_TABS,ia=(0,n.memo)(({__:e,activeTab:i,validateImagesResult:l,validateImages:s,selectedTags:a,setSelectedTags:d,isLoading:c,disabled:p,iconStrokeWidth:f,onValidate:x,goToImageHandler:k,showImgPreviewHandler:b,hideBlockPreviewHandler:h})=>i!==Bu||!l?.images?null:l.images.length===0?(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,o.jsx)(t.ui_kit$Alert,{title:e("No images found."),type:"info"})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-16",children:(0,o.jsx)(t.ui_kit$Alert,{className:"optimise__alert-custom",title:(0,o.jsxs)("div",{className:"optimise__summary",children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)(t.ui_kit$Title,{level:4,className:"optimise__summary-title",children:[l.images.length," "]}),(0,o.jsx)("span",{className:"optimise__summary-label",children:e("images")})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)(t.ui_kit$Title,{level:4,className:"optimise__summary-title",children:[l.summaryTime?.value,l.summaryTime?.name]}),(0,o.jsx)("span",{className:"optimise__summary-label",children:e("total size")})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)(t.ui_kit$Title,{level:4,className:"optimise__summary-title",children:(Math.max(...l.images.map(T=>T.image.responseTime))/1e3).toFixed(2)+e("s")}),(0,o.jsx)("span",{className:"optimise__summary-label",children:e("time to load")})]})]}),type:"warning"})}),(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-12",children:(0,o.jsxs)("div",{className:"optimise__title-wrapper",children:[(0,o.jsx)(oa,{__:e,summary:l.summary,setSelectedTags:d,selectedTags:a}),(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"SyncOutlined",component:t.icons$SyncOutlined,size:16,strokeWidth:f}),disabled:p,loading:c,onClick:x,children:e("Refresh")})]})}),(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-12",children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$List,{className:"optimise__result-list",itemLayout:"horizontal",dataSource:s,renderItem:(T,_)=>(0,o.jsx)(t.ui_kit$List.Item,{className:`optimise__image-item image-item ${t.ui_kit$LIST_ITEM_BORDERLESS_CLASS}`,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{className:(0,He.default)("image-item__meta",{"image-item__meta_fail":!T.resolvedUrl&&!T.statusCode}),avatar:(0,o.jsx)(t.ui_kit$Image,{className:(0,He.default)("image-item__image optimise__image-auto-height",{"image-item__image_fail":!T.resolvedUrl||!T.valid}),width:92,height:"auto",src:T.resolvedUrl||"",preview:!1,onMouseEnter:()=>b(T.url,T.image.dimensions?.width),onMouseLeave:()=>h()}),title:T.url?(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:T.message,children:(0,o.jsx)(t.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>k(T.imageId,600>(T.statusCode||0)&&(T.statusCode||0)>399||!T.statusCode),children:T?.url===""?e("empty src"):T.url})}):T.message,description:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"image-size",children:[T.image.dimensions&&(0,o.jsxs)(o.Fragment,{children:[T.image.dimensions.width+" × "+T.image.dimensions.height,(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsxs)("span",{children:[Math.round(T.image.bytes/1024),e("kB")]}),(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsxs)("span",{children:[T.image.responseTime,e("ms")]}),(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)("span",{className:"image-size-format",children:Ft(T.image.contentType)})]}),T.image.secure&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)("span",{className:"valid",children:e("secure")})]}),T.resolvedUrl&&!T.valid&&(0,o.jsx)(t.ui_kit$Text,{type:"danger",children:e("not valid")})]}),!T.resolvedUrl&&!T.statusCode&&(0,o.jsx)(t.ui_kit$Text,{type:"danger",children:e("Failed to load")})]})})},_)})})})]}));ia.displayName="ImagesSection";var{SPAM_ASSASSIN:Su}=r.OPTIMISE_TABS,ra=(0,n.memo)(({__:e,activeTab:i,validateSpamResult:l,isLoading:s,disabled:a,iconStrokeWidth:d,onValidate:c})=>{const p=l?.report?.length||Object.prototype.hasOwnProperty.call(l,"spamScore");if(i!==Su||!p)return null;const f=l.spamScore||0,x=l.baseSpamScore||0,k=f<2||!l.spamScore||f<=x-1?"success":f<x-1?"warning":"danger";return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{className:"optimise__row-mb-8",children:[(0,o.jsxs)("div",{className:"optimise__title-wrapper optimise__title-wrapper_spam",children:[(0,o.jsxs)(t.ui_kit$Title,{level:1,className:"optimise__spam-score-title",type:k,children:[(0,o.jsx)("span",{className:"optimise__spam-score-value",children:f}),(0,o.jsx)(t.ui_kit$Text,{className:"optimise__spam-score-text",children:"Score"})]}),(0,o.jsx)(t.ui_kit$Button,{disabled:a,icon:(0,o.jsx)(r.EmIcons,{icon:"SyncOutlined",component:t.icons$SyncOutlined,size:16,strokeWidth:d}),loading:s,onClick:c,children:e("Refresh")})]}),f>x-1&&(0,o.jsx)(t.ui_kit$Text,{children:e("Lower scores are better. Aim for a score less than ")+(x-1)+"."})]}),(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-8",children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(l.report?.length||0)>0?(0,o.jsx)(t.ui_kit$List,{itemLayout:"horizontal",dataSource:l.report,renderItem:b=>(0,o.jsx)(t.ui_kit$List.Item,{className:t.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{title:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Text,{className:"optimise__spam-report-score",children:b.score}),(0,o.jsx)("span",{className:"optimise__spam-report-description",children:b.description})]})})})}):(0,o.jsx)(o.Fragment,{children:l.spamScore===0&&e("Your email doesn't look like spam.")})})})]})});ra.displayName="SpamSection";var{PROBLEMS:Tu}=r.OPTIMISE_TABS,la=(0,n.memo)(({__:e,activeTab:i,problemsList:l,onSetMonacoPosition:s})=>i!==Tu?null:l?.length?(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-8",children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$List,{itemLayout:"horizontal",dataSource:l,renderItem:a=>(0,o.jsx)(t.ui_kit$List.Item,{className:t.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{avatar:a.severity<6?(0,o.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:t.icons$CloseCircleFilled,className:r.WARNINGS}):(0,o.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:t.icons$CloseCircleFilled,className:r.ERRORS}),title:(0,o.jsxs)(t.ui_kit$Text,{onClick:()=>s(a),className:(0,He.default)("optimise__text-clickable",{warning:a.severity<6,error:a.severity>=6}),children:["Line: ",a.startLineNumber," ",a.startLineNumber!==a.endLineNumber&&" – "+a.endLineNumber]}),description:(0,o.jsx)(t.ui_kit$Text,{children:a.message})})})})})}):(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,o.jsx)(t.ui_kit$Alert,{title:e("No problems found."),type:"info"})}));la.displayName="ProblemsSection";var Ru={activeTab:"",selectedTags:[],validateLinks:[],validateImages:[],validateSpamResult:{},optimisationCounter:0,linkCheckCounter:0,imageCheckCounter:0,spamCheckCounter:0,validateLinksResult:{},validateImagesResult:{}},yu=(e,i)=>{switch(i.type){case"SET_ACTIVE_TAB":return{...e,activeTab:i.payload!==e.activeTab?i.payload:""};case"SET_SELECTED_TAGS":return{...e,selectedTags:i.payload};case"SET_VALIDATE_LINKS":return{...e,validateLinks:i.payload};case"SET_VALIDATE_IMAGES":return{...e,validateImages:i.payload};case"SET_VALIDATE_SPAM_RESULT":return{...e,validateSpamResult:i.payload};case"SET_OPTIMISATION_COUNTER":return{...e,optimisationCounter:i.payload};case"INCREMENT_OPTIMISATION_COUNTER":return{...e,optimisationCounter:e.optimisationCounter+1};case"SET_LINK_CHECK_COUNTER":return{...e,linkCheckCounter:i.payload};case"INCREMENT_LINK_CHECK_COUNTER":return{...e,linkCheckCounter:e.linkCheckCounter+1};case"SET_IMAGE_CHECK_COUNTER":return{...e,imageCheckCounter:i.payload};case"INCREMENT_IMAGE_CHECK_COUNTER":return{...e,imageCheckCounter:e.imageCheckCounter+1};case"SET_SPAM_CHECK_COUNTER":return{...e,spamCheckCounter:i.payload};case"INCREMENT_SPAM_CHECK_COUNTER":return{...e,spamCheckCounter:e.spamCheckCounter+1};case"SET_VALIDATE_LINKS_RESULT":return{...e,validateLinksResult:i.payload};case"SET_VALIDATE_IMAGES_RESULT":return{...e,validateImagesResult:i.payload};case"RESET_SELECTED_TAGS":return{...e,selectedTags:[]};default:return e}},si={link_check:"link_check_counter",image_check:"image_check_counter",spam_check:"spam_check_counter"},dr={link_check:"link_check_limit",image_check:"image_check_limit",spam_check:"spam_check_limit"},wu=(e,i)=>{const l=Object.values(si),s=Object.values(dr);return l.some(a=>e?.[a]!==void 0)||s.some(a=>i?.[a]!==void 0)||l.some(a=>i?.[a]!==void 0)||s.some(a=>e?.[a]!==void 0)},pt=(e,i,l=0)=>{const s=e?.[i];return typeof s=="number"&&!Number.isNaN(s)?s:l},ju=(e,i)=>({counter:e,limit:i,disabled:i>0&&e>=i}),vu=({appConfig:e,data:i,isSuccess:l,optimisationCounter:s,linkCheckCounter:a,imageCheckCounter:d,spamCheckCounter:c,setOptimisationCounter:p,setLinkCheckCounter:f,setImageCheckCounter:x,setSpamCheckCounter:k})=>{const b=(0,n.useMemo)(()=>!!(e.limits&&e.counters)&&!0,[e]),h=(0,n.useMemo)(()=>e.counters,[e,i]),T=(0,n.useMemo)(()=>e.limits,[e,i]),_=(0,n.useMemo)(()=>b&&wu(h,T),[b,h,T]),E=(0,n.useMemo)(()=>pt(T,"optimization_limit",0),[T]),w=(0,n.useMemo)(()=>!_&&s>=E&&E>0,[_,s,E]),v=(0,n.useMemo)(()=>{const j={link_check:a,image_check:d,spam_check:c};return Object.keys(dr).reduce((C,P)=>{const Y=dr[P],z=_?pt(T,Y,0):E,$=_?j[P]:s;return C[P]=ju($,z),C},{})},[_,T,E,a,d,c,s]),A=j=>_?v[j].disabled:w;return(0,n.useEffect)(()=>{if(!b){const j=i?.counters;l&&j?.optimization_counter&&p(j.optimization_counter);return}p(pt(h,"optimization_counter",0)),_&&(f(pt(h,si.link_check,0)),x(pt(h,si.image_check,0)),k(pt(h,si.spam_check,0)))},[b,_,i,l,h,p,f,x,k]),{limitsInPlugin:b,perTypeAvailable:_,currentBillingOptimisationLimits:E,disableFields:w,typeLimits:v,isTypeDisabled:A}},Iu=()=>{const e=(0,n.useRef)(null);return{showImgPreviewHandler:(0,n.useCallback)((i,l)=>{e.current&&clearTimeout(e.current);let s=document.querySelector(".img-preview"),a=document.querySelector(".img-preview-content");document.querySelector(".img-preview")||(s=document.createElement("div"),s.classList.add("img-preview"),a=document.createElement("div"),a.classList.add("img-preview-content"),s.append(a),document.querySelector(".email-pane__col_settings-inner")?.append(s)),a&&(a.innerHTML=`<table cellspacing="0" cellpadding="0" border="0" width="100%"><img height="auto" width=${(l||0)+"px"} alt="" style="max-width: 100%; object-fit: contain" src=${i}></table>`),s&&s.style.opacity!=="1"&&setTimeout(()=>{s&&(s.style.opacity="1",s.style.transform="translateX(-100%)")},10)},[]),hideBlockPreviewHandler:(0,n.useCallback)(()=>{const i=document.querySelector(".img-preview");i&&(e.current=setTimeout(()=>{i&&(i.style.opacity="0",i.style.transform="translateX(-99%)",setTimeout(()=>{i?.remove()},300))},300))},[])}},{LINKS:Cu,IMAGES:Pu}=r.OPTIMISE_TABS,Au=({activeTab:e,selectedTags:i,validateLinksResult:l,validateImagesResult:s,setValidateLinks:a,setValidateImages:d})=>{(0,n.useEffect)(()=>{e===Cu&&l.links&&a(i.length>0?l.links.filter(c=>i.includes(c.status)):l.links),e===Pu&&s.images&&d(i.length>0?s.images.filter(c=>i.includes(c.status)):s.images)},[l.links,s.images,i,e,a,d])},Nu=e=>(e.statusCode!==null?e.statusCode<300&&(e.page?.secure??!0):e.type!=="invalid")?r.VALID:(e.statusCode&&e.statusCode<400||e.statusCode===200&&(e.page?.secure??!0))&&e.type!=="invalid"?r.WARNINGS:r.ERRORS,sa=e=>e.statusCode!==null&&e.statusCode<300?r.VALID:e.statusCode<400&&e.statusCode>=300||e.statusCode===200&&!e.valid?r.WARNINGS:r.ERRORS,aa=e=>({valid:e.filter(i=>i.status===r.VALID).length,warnings:e.filter(i=>i.status===r.WARNINGS).length,errors:e.filter(i=>i.status===r.ERRORS).length}),Lu={ai:(0,o.jsx)(r.EmIcons,{icon:"AIRequests",component:t.icons$AIRequests}),email_generate:(0,o.jsx)(r.EmIcons,{icon:"EmailEnvelope",component:t.icons$EmailEnvelope}),image_generate:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image}),optimization:(0,o.jsx)(r.EmIcons,{icon:"Optimization",component:t.icons$Optimization}),preview:(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined}),test_sends:(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined}),link_check:(0,o.jsx)(r.EmIcons,{icon:"Web",component:t.icons$Web}),image_check:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image}),spam_check:(0,o.jsx)(r.EmIcons,{icon:"Block",component:t.icons$Block}),projects:(0,o.jsx)(r.EmIcons,{icon:"FolderOpen",component:t.icons$FolderOpen}),emails:(0,o.jsx)(r.EmIcons,{icon:"EmailEnvelope",component:t.icons$EmailEnvelope}),blocks:(0,o.jsx)(r.EmIcons,{icon:"Block",component:t.icons$Block}),users:(0,o.jsx)(r.EmIcons,{icon:"SliderGroup",component:t.icons$SliderGroup})};function na(e,i){if(e==null)return null;if(typeof e=="number"||typeof e=="string"){const l=e==="∞"||typeof e=="string"&&e.toLowerCase()==="infinity";return(0,o.jsx)("span",{className:i==="old"?"limit-upgrade-modal__limit-old":`limit-upgrade-modal__limit-new${l?" limit-upgrade-modal__limit-new--infinity":""}`,children:l?"∞":e})}return e}var ai=({open:e,onClose:i,title:l,subtitle:s,usageResource:a,icon:d,previousDisplay:c,nextDisplay:p,onChangePlan:f,secondaryAction:x,changePlanLabel:k})=>{const{__:b}=r.useI18n(),h=k??b("Change plan"),T=!!x,_=a!=null?Lu[a]:d??null;return(0,o.jsx)(t.ui_kit$Modal,{open:e,onCancel:i,footer:null,closable:!1,width:400,centered:!0,className:"limit-upgrade-modal",destroyOnHidden:!0,mask:{closable:!0},children:(0,o.jsxs)("div",{className:"limit-upgrade-modal__wrap",children:[(0,o.jsx)("div",{className:"limit-upgrade-modal__header",children:(0,o.jsx)("button",{type:"button",className:"limit-upgrade-modal__close",onClick:i,"aria-label":b("Close"),children:(0,o.jsx)(r.EmIcons,{icon:"CloseOutlined",component:t.icons$CloseOutlined})})}),(0,o.jsxs)("div",{className:"limit-upgrade-modal__body",children:[(0,o.jsx)("h1",{className:"limit-upgrade-modal__title",children:l}),(0,o.jsx)("p",{className:"limit-upgrade-modal__subtitle",children:s}),(0,o.jsxs)("div",{className:"limit-upgrade-modal__limits-row",children:[(0,o.jsx)("div",{className:"limit-upgrade-modal__icon-circle","aria-hidden":!0,children:_}),na(c,"old"),(0,o.jsx)("div",{className:"limit-upgrade-modal__arrow-btn","aria-hidden":!0,children:(0,o.jsx)(r.EmIcons,{icon:"ArrowUpOutlined",component:t.icons$ArrowUpOutlined,className:"limit-upgrade-modal__arrow-icon"})}),na(p,"new")]})]}),(0,o.jsx)("hr",{className:"limit-upgrade-modal__divider"}),(0,o.jsx)("div",{className:T?"limit-upgrade-modal__footer limit-upgrade-modal__footer--dual":"limit-upgrade-modal__footer",children:x?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Button,{className:"limit-upgrade-modal__cta-secondary",onClick:x.onClick,children:x.label}),(0,o.jsx)(t.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:f,children:h})]}):(0,o.jsx)(t.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:f,children:h})})]})})},{LINKS:cr,IMAGES:ur,SPAM_ASSASSIN:da,PROBLEMS:mr}=r.OPTIMISE_TABS,ca={textDecoration:"underline",cursor:"pointer",background:"none",border:"none",padding:0,font:"inherit",color:"inherit"},Ou={link_check:"LinkCheckCount",image_check:"ImageCheckCount",spam_check:"SpamCheckCount"},$u={link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"},ua=(e,i,l,s)=>`${e} ${l("of")} ${i>0?i:"∞"} ${s("test","tests",i>0?i:e)} ${s("was used","were used",e)}`,ma=()=>{const{__:e,_n:i}=r.useI18n(),l=r.useDispatch(),s=r.useOpenPlanCatalog(),a=r.useAppNavigate(),d=r.useNotification(),c=r.useContentReader(),p=r.useAppConfig(),f=r.useEditorProjectId(),x=r.useRouteEmailId(),{document:k}=r.useDocumentSessionContext(),b=r.useEmailOfDocument(k,void 0),h=x||(b?.id!=null?String(b.id):void 0),T=h||b?.renderGuid,_=f||(b?.project!=null?String(b.project):void 0),[E,w]=(0,n.useState)(null),v=(0,n.useRef)(!1),A=(0,n.useRef)({link_check:!1,image_check:!1,spam_check:!1}),j=r.useProjectPlanLimitPreflight(),C=(0,n.useCallback)(I=>{w(I)},[]),P=(0,n.useCallback)((I,Z)=>I?.status===401&&I?.data?.code==="usage_limit_exceeded"?(C({presetId:{link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"}[Z],previousDisplay:e("—"),nextDisplay:r.presetLimitDisplay("infinity")}),l(r.limitsApi.util.invalidateTags(["LimitsStats","LimitsWarnings"])),!0):!1,[l,e,C]),Y=(0,n.useCallback)((I,Z)=>{P(I,Z)||d.error({error:I})},[P,d]),z=(0,n.useCallback)(async I=>!0,[l,j,C]),$=r.useMessageService(),O=r.useSelector(r.selectProblemsList),y=r.useEventEmitter(xo.events.ON_LIMIT_ID),oe=r.usePushToDataLayer(),[G,q]=(0,n.useReducer)(yu,Ru),[te,ue]=r.useEditSpamMutation(),[me,se]=r.useEditLinksMutation(),[_e,ve]=r.useEditImagesMutation(),{data:de,isSuccess:De}=r.useGetProjectQuery(+(_||0),{skip:!0}),ye=r.useInvalidateProject(),re=(0,n.useCallback)(I=>q({type:"SET_OPTIMISATION_COUNTER",payload:I}),[]),ke=(0,n.useCallback)(I=>q({type:"SET_LINK_CHECK_COUNTER",payload:I}),[]),ae=(0,n.useCallback)(I=>q({type:"SET_IMAGE_CHECK_COUNTER",payload:I}),[]),Q=(0,n.useCallback)(I=>q({type:"SET_SPAM_CHECK_COUNTER",payload:I}),[]),he=(0,n.useCallback)(I=>q({type:"SET_VALIDATE_LINKS",payload:I}),[]),pe=(0,n.useCallback)(I=>q({type:"SET_VALIDATE_IMAGES",payload:I}),[]),ee=(0,n.useCallback)(I=>q({type:"SET_SELECTED_TAGS",payload:I}),[]),{limitsInPlugin:J,perTypeAvailable:H,currentBillingOptimisationLimits:X,disableFields:ce,typeLimits:xe,isTypeDisabled:ne}=vu({appConfig:p,data:de,isSuccess:De,optimisationCounter:G.optimisationCounter,linkCheckCounter:G.linkCheckCounter,imageCheckCounter:G.imageCheckCounter,spamCheckCounter:G.spamCheckCounter,setOptimisationCounter:re,setLinkCheckCounter:ke,setImageCheckCounter:ae,setSpamCheckCounter:Q});Au({activeTab:G.activeTab,selectedTags:G.selectedTags,validateLinksResult:G.validateLinksResult,validateImagesResult:G.validateImagesResult,setValidateLinks:he,setValidateImages:pe});const{showImgPreviewHandler:Ae,hideBlockPreviewHandler:we}=Iu(),$e=(0,n.useCallback)(I=>I==="link_check"?G.linkCheckCounter:I==="image_check"?G.imageCheckCounter:G.spamCheckCounter,[G.linkCheckCounter,G.imageCheckCounter,G.spamCheckCounter]),K=(0,n.useCallback)(I=>{if(J){if(H){q({type:{link_check:"INCREMENT_LINK_CHECK_COUNTER",image_check:"INCREMENT_IMAGE_CHECK_COUNTER",spam_check:"INCREMENT_SPAM_CHECK_COUNTER"}[I]}),y.fire({name:Ou[I],count:$e(I)+1});return}q({type:"INCREMENT_OPTIMISATION_COUNTER"}),y.fire({name:"OptimizationCount",count:G.optimisationCounter+1})}},[J,H,y,$e,G.optimisationCounter]),ie=(0,n.useCallback)(I=>{if(H){const{limit:Z}=xe[I];C({presetId:$u[I],previousDisplay:Z>0?Z:r.presetLimitDisplay("infinity"),nextDisplay:r.presetLimitDisplay("infinity")});return}C({presetId:"optimization_exceeded",previousDisplay:X,nextDisplay:r.presetLimitDisplay("infinity")})},[H,xe,C,X]),je=(0,n.useCallback)(()=>{a(p.billingPageUrl||r.APP_ROUTES.billing)},[p.billingPageUrl,a]),V=I=>{if(!J||!H)return null;const{counter:Z,limit:Be,disabled:Ce}=xe[I];return(0,o.jsx)(t.ui_kit$LimitsCounter,{text:ua(Z,Be,e,i),exceeded:Ce,extra:(0,o.jsx)("button",{type:"button",style:ca,onClick:je,children:e("Need more?")})})},Se=(0,n.useCallback)((I,Z)=>{$.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_LINK,settings:{elementId:I,isError:Z}})},[$]),Ie=(0,n.useCallback)((I,Z)=>{$.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_IMG,settings:{elementId:I,isError:Z}})},[$]),Ne=(0,n.useCallback)(I=>{const Z={startColumn:I.startColumn,startLineNumber:I.startLineNumber,endColumn:I.endColumn,endLineNumber:I.endLineNumber};l(r.setActiveProblemRange(Z))},[l]),Fe=(0,n.useCallback)(I=>{q({type:"SET_ACTIVE_TAB",payload:I}),q({type:"RESET_SELECTED_TAGS"}),I===mr&&O?.length>0&&oe({event:"check",action:"check_email_code",email_id:h,project_id:_,problems_count:O?.length||0})},[O,oe,h,_]),Ve=(0,n.useCallback)(async()=>{if(!T){d.error({title:"Save the mail first."});return}if(ne("link_check")){ie("link_check");return}if(!await z("link_check"))return;K("link_check");const I=c(),Z=new DOMParser().parseFromString(I,"text/html"),Be={},Ce={};Z.querySelectorAll("a[href]").forEach((Me,Ge)=>{Be[`link_${Ge}`]=Me.getAttribute("href"),Ce[`link_${Ge}`]=Me.textContent||""}),$.send({operation:"sandbox_set_attr_to_links"}),me({entity_id:T,data:Be}).then(({data:Me,error:Ge})=>{if(Ge)Y(Ge,"link_check");else if(Me?.result){const Ye=[...Me.result];Ye?.sort((R,F)=>R.linkId-F.linkId);const D=Ye.map(R=>({...R,text:Ce[R.linkId],status:Nu(R)})),L={links:D,summary:aa(D)};q({type:"SET_VALIDATE_LINKS_RESULT",payload:L}),d.success(e("Links validation was successfully completed")),Me.limit_warning&&Me.limit_remaining!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${Me.limit_remaining}`}),oe({event:"check",action:"check_email_links",email_id:h,project_id:_,links_count:L.links?.length||0})}else Me.statusCode>300||!Me.success?d.error({error:{data:Me}}):d.error({title:e("Something went wrong.")}),!G.validateLinksResult.links&&Fe("")}).catch(Me=>{Y(Me,"link_check")})},[h,T,ne,ie,z,K,c,$,me,d,e,oe,_,ye,G.validateLinksResult.links,Y,Fe]),Ue=(0,n.useCallback)(async()=>{if(!T){d.error({title:"Save the mail first."});return}if(ne("image_check")){ie("image_check");return}if(!await z("image_check"))return;K("image_check");const I=c(),Z=new DOMParser().parseFromString(I,"text/html"),Be={};Z.querySelectorAll("img").forEach((Ce,Me)=>Be[`image_${Me}`]=Ce.src),$.send({operation:"sandbox_set_attr_to_images"}),_e({entity_id:T,data:Be}).then(({data:Ce,error:Me})=>{let Ge;if(Me)Y(Me,"image_check");else if(Ce?.result){const Ye=Object.values(Ce.result);Ye.sort((L,R)=>L.imageId-R.imageId);const D=Ye.reduce((L,R)=>L+Math.round(R.image.bytes/1024),0);Ge={images:Ye.map(L=>({...L,status:sa(L)}))||[],summary:aa(Ye.map(L=>({...L,status:sa(L)}))),summaryTime:{value:(D>1200?D/1e3:D).toFixed(1),name:D>1200?e("MB"):e("KB")}},Ge&&q({type:"SET_VALIDATE_IMAGES_RESULT",payload:Ge}),d.success(e("Images validation was successfully completed")),Ce.limit_warning&&Ce.limit_remaining!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${Ce.limit_remaining}`}),oe({event:"check",action:"check_email_images",email_id:h,project_id:_,images_count:Ge.images?.length||0})}else Ce.statusCode>300||!Ce.success?d.error({error:{data:Ce}}):d.error({title:e("Something went wrong.")}),!G.validateImagesResult?.images?.length&&Fe("")}).catch(Ce=>{Y(Ce,"image_check")})},[h,T,ne,ie,z,K,c,$,_e,d,e,oe,_,ye,G.validateImagesResult,Y,Fe]),le=(0,n.useCallback)(async()=>{if(!T){d.error({title:"Save the mail first."});return}if(ne("spam_check")){ie("spam_check");return}await z("spam_check")&&(K("spam_check"),te({entity_id:T,data:{html:c()}}).then(({data:I,error:Z})=>{if(Z)Y(Z,"spam_check");else if(I&&I.success){const Be=!!I.result.report&&Object.values(I.result.report);Be?(Be.sort((Ce,Me)=>Ce.score-Me.score),q({type:"SET_VALIDATE_SPAM_RESULT",payload:{...I.result,report:Be}})):I.result&&q({type:"SET_VALIDATE_SPAM_RESULT",payload:{...I.result,report:Be}}),d.success(e("Spam validation was successfully completed")),I.limit_warning&&I.limit_remaining!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${I.limit_remaining}`}),oe({event:"check",action:"check_email_spam",email_id:h,project_id:_,spam_score:I.result?.spamScore||0})}else I.statusCode>300||!I.success?d.error({error:{data:I}}):d.error({title:e("Something went wrong.")}),!G.validateSpamResult?.report?.length&&Fe("")}).catch(I=>{Y(I,"spam_check")}))},[h,T,ne,ie,z,K,c,te,d,e,oe,_,ye,G.validateSpamResult,Y,Fe]);(0,n.useEffect)(()=>{if(J){if(H){["link_check","image_check","spam_check"].forEach(I=>{const{limit:Z,counter:Be,disabled:Ce}=xe[I];if(!Ce){A.current[I]=!1;return}A.current[I]||Z>0&&Be>=Z&&(A.current[I]=!0,ie(I))});return}if(!(X>0&&G.optimisationCounter>=X)){v.current=!1;return}v.current||(v.current=!0,ie("link_check"))}},[J,H,xe,G.optimisationCounter,X,ie]);const Te=E?r.getLimitUpgradePresetDefinition(E.presetId):null;return(0,o.jsxs)("div",{className:"optimise selected_form-props-wrapper selected_form-props-wrapper_optimize",children:[Te&&E?(0,o.jsx)(ai,{open:!0,onClose:()=>w(null),title:e(Te.titleKey),subtitle:e(Te.subtitleKey),usageResource:Te.usageResource,previousDisplay:E.previousDisplay,nextDisplay:E.nextDisplay,onChangePlan:()=>{w(null),s()}}):null,J&&!H&&(0,o.jsx)(t.ui_kit$LimitsCounter,{text:ua(G.optimisationCounter,X,e,i),exceeded:ce,extra:(0,o.jsx)("button",{type:"button",style:ca,onClick:je,children:e("Need more?")})}),p.optimizeLinksEnabled&&(0,o.jsxs)(o.Fragment,{children:[V("link_check"),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,align:"middle",children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsx)("div",{style:{padding:"15px 0"},children:e("Links validation")})}),(0,o.jsx)(t.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,o.jsx)(t.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:I=>I.preventDefault(),onClick:()=>{Fe(cr),!G.validateLinksResult?.links?.length&&G.activeTab!==cr&&Ve()},loading:se.isLoading,disabled:ne("link_check")&&!G.validateLinksResult?.links?.length,children:!se.isLoading&&(G.activeTab===cr?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth}))})})]}),(0,o.jsx)(ta,{__:e,activeTab:G.activeTab,validateLinksResult:G.validateLinksResult,validateLinks:G.validateLinks,selectedTags:G.selectedTags,setSelectedTags:ee,isLoading:se.isLoading,disabled:ne("link_check"),iconStrokeWidth:p.iconStrokeWidth,onValidate:Ve,goToLinkHandler:Se})]}),p.optimizeImagesEnabled&&(0,o.jsxs)(o.Fragment,{children:[V("image_check"),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,align:"middle",children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsx)("div",{style:{padding:"15px 0"},children:e("Images validation")})}),(0,o.jsx)(t.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,o.jsx)(t.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:I=>I.preventDefault(),onClick:()=>{Fe(ur),!G.validateImagesResult?.images?.length&&G.activeTab!==ur&&Ue()},loading:ve.isLoading,children:!ve.isLoading&&(G.activeTab===ur?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth}))})})]}),(0,o.jsx)(ia,{__:e,activeTab:G.activeTab,validateImagesResult:G.validateImagesResult,validateImages:G.validateImages,selectedTags:G.selectedTags,setSelectedTags:ee,isLoading:ve.isLoading,disabled:ne("image_check"),iconStrokeWidth:p.iconStrokeWidth,onValidate:Ue,goToImageHandler:Ie,showImgPreviewHandler:Ae,hideBlockPreviewHandler:we})]}),p.optimizeSpamAssassinEnabled&&(0,o.jsxs)(o.Fragment,{children:[V("spam_check"),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,align:"middle",children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsx)("div",{style:{padding:"15px 0"},children:e("SpamAssassin")})}),(0,o.jsx)(t.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,o.jsx)(t.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:I=>I.preventDefault(),loading:ue.isLoading,onClick:()=>{Fe(da),G.validateSpamResult.report?.length||Object.prototype.hasOwnProperty.call(G.validateSpamResult,"spamScore")||le()},disabled:ne("spam_check")&&!(G.validateSpamResult?.report?.length||Object.prototype.hasOwnProperty.call(G.validateSpamResult,"spamScore")),children:!ue.isLoading&&(G.activeTab===da?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth}))})})]}),(0,o.jsx)(ra,{__:e,activeTab:G.activeTab,validateSpamResult:G.validateSpamResult,isLoading:ue.isLoading,disabled:ne("spam_check"),iconStrokeWidth:p.iconStrokeWidth,onValidate:le})]}),p.optimizeCheckCodeEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,align:"middle",children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsx)("div",{style:{padding:"15px 0"},children:e("Source code validation")})}),(0,o.jsx)(t.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,o.jsx)(t.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:I=>I.preventDefault(),onClick:()=>Fe(mr),children:G.activeTab===mr?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth})})})]}),(0,o.jsx)(la,{__:e,activeTab:G.activeTab,problemsList:O,onSetMonacoPosition:Ne})]})]})},Fu=({state:e,onCancel:i,onRetry:l,onDismiss:s})=>{const{__:a}=r.useI18n();return e.kind==="hidden"?null:(0,o.jsx)("div",{className:"indexing-tray",role:"status","aria-live":"polite",children:(0,o.jsx)(t.ui_kit$Card,{size:"small",variant:"borderless",className:"indexing-tray__card",children:(0,o.jsxs)(t.ui_kit$Flex,{vertical:!0,gap:8,children:[Mu(e,a),(0,o.jsx)(t.ui_kit$Flex,{justify:"flex-end",children:Du(e,{onCancel:i,onRetry:l,onDismiss:s},a)})]})})})};function Mu(e,i){switch(e.kind){case"scanning":return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Flex,{align:"center",gap:8,children:[(0,o.jsx)(t.ui_kit$Spin,{size:"small"}),(0,o.jsx)(t.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Moving files from old storage…")})]}),(0,o.jsx)(t.ui_kit$Text,{type:"secondary",children:i("Found so far: %s").replace("%s",String(e.scanned))}),(0,o.jsx)(t.ui_kit$Progress,{percent:100,status:"active",showInfo:!1,strokeColor:r.emCssVar("colorPrimary")})]});case"indexing":{const l=e.total>0?Math.min(100,Math.round(e.scanned/e.total*100)):0;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Indexing files…")}),(0,o.jsx)(t.ui_kit$Text,{type:"secondary",children:`${e.scanned} / ${e.total}`}),(0,o.jsx)(t.ui_kit$Progress,{percent:l,status:"active",strokeColor:r.emCssVar("colorPrimary")})]})}case"done":return(0,o.jsx)(t.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Files ready: %s").replace("%s",String(e.files+e.folders+e.trashed))});case"failed":return(0,o.jsx)(t.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Could not move files from old storage")});case"cancelled":return(0,o.jsx)(t.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Move stopped")});default:return null}}function Du(e,i,l){switch(e.kind){case"scanning":case"indexing":return(0,o.jsx)(t.ui_kit$Button,{type:"link",size:"small",onClick:i.onCancel,disabled:e.cancelling,children:e.cancelling?l("Stopping…"):l("Cancel")});case"failed":return(0,o.jsx)(t.ui_kit$Button,{type:"link",size:"small",onClick:i.onRetry,children:l("Retry")});case"cancelled":return(0,o.jsx)(t.ui_kit$Button,{type:"link",size:"small",onClick:i.onRetry,children:l("Resume")});case"done":return(0,o.jsx)(t.ui_kit$Button,{type:"link",size:"small",onClick:i.onDismiss,children:l("Close")});default:return null}}var Vu=2500,pa=48,Hu=4e3;function Uu(e){switch(e.status){case"running":return e.phase==="indexing"?{kind:"indexing",scanned:e.scanned??0,total:e.total??0,cancelling:!!e.cancelling}:{kind:"scanning",scanned:e.scanned??0,cancelling:!!e.cancelling};case"done":return{kind:"done",files:e.files??0,folders:e.folders??0,trashed:e.trashed??0};case"failed":return{kind:"failed"};case"cancelled":return{kind:"cancelled"};default:return{kind:"hidden"}}}function Wu(e){return e.kind==="done"||e.kind==="failed"||e.kind==="cancelled"}function zu({projectId:e,api:i,triggered:l,onCompleted:s}){const[a,d]=(0,n.useState)({kind:"hidden"}),c=(0,n.useRef)(!1),p=(0,n.useRef)(!0),f=(0,n.useRef)(e);f.current=e;const x=(0,n.useRef)(l);x.current=l;const k=(0,n.useRef)(s);k.current=s,(0,n.useEffect)(()=>(p.current=!0,()=>{p.current=!1}),[]),(0,n.useEffect)(()=>{d({kind:"hidden"})},[e]);const b=(0,n.useCallback)(async()=>{try{const T=await i.files.backfillList({project_id:e});return!T.ok||T.error?null:Uu(T.data)}catch{return null}},[i,e]),h=(0,n.useCallback)(async()=>{if(c.current)return;c.current=!0;const T=f.current;let _=0;try{for(;p.current&&f.current===T&&x.current;){const E=await b();if(!p.current)break;if(E)if(E.kind==="hidden"){if(_+=1,_>=pa){d({kind:"failed"});break}}else{if(_=0,d(E),E.kind==="done")try{await k.current?.()}catch{}if(Wu(E))break}else if(_+=1,_>=pa){d({kind:"failed"});break}await new Promise(w=>setTimeout(w,Vu))}}finally{c.current=!1}},[b]);return(0,n.useEffect)(()=>{l&&h()},[l,h]),(0,n.useEffect)(()=>{if(a.kind!=="done")return;const T=setTimeout(()=>{p.current&&d({kind:"hidden"})},Hu);return()=>clearTimeout(T)},[a.kind]),{state:a,cancel:(0,n.useCallback)(()=>{d(T=>T.kind==="scanning"||T.kind==="indexing"?{...T,cancelling:!0}:T),i.files.backfillCancelCreate({project_id:e})},[i,e]),retry:(0,n.useCallback)(()=>{x.current=!0,i.files.backfillCreate({project_id:e}),h()},[i,e,h]),dismiss:(0,n.useCallback)(()=>d({kind:"hidden"}),[])}}var Gu=r.lazyRoute(()=>(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>fo("./ca4dad9b.js")),void 0,{}.url)),Yu=r.lazyRoute(()=>(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>fo("./edf450a1.js")),void 0,{}.url)),ha={height:"100%"};function Xu(e){(e?(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>fo("./d7666ad0.js")),void 0,{}.url):(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>fo("./91e07171.js")),void 0,{}.url)).catch(()=>{})}var Ku=({storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,contentKey:a})=>{const d=r.useAppConfig(),c=r.isImageEditModal(r.useSelector(r.selectActiveModal$1)),p=!!d.imageCenterFileManagerView;(0,n.useEffect)(()=>{c&&Xu(p)},[c,p]);let f=(0,o.jsx)(t.ui_kit$PageLoader,{style:ha});return e&&i&&d.imageCenterFileManagerView?f=(0,o.jsx)(Gu,{storageProvider:e,dataProvider:i,pathProxy:l},a):e&&i&&(f=(0,o.jsx)(Yu,{dataProvider:i,usesBuiltInStorage:s},a)),(0,o.jsx)(n.Suspense,{fallback:(0,o.jsx)(t.ui_kit$PageLoader,{style:ha}),children:f})};function qu(){const e=r.useAppConfig(),i=r.useIsStandalone(),l=r.useStorageProvider(),s=r.useProjectData(),a=r.useRestClient(r.EM_FILES_MODULES),d=r.useStore(),c=(0,n.useMemo)(()=>r.createRestClientV2(d),[d]),p=r.useI18n(),f=r.useCurrentUser(),x=s?.id?String(s.id):"",k=f?.id!=="0"?String(f.id):"",b=r.isFileManagerV2Enabled(e),[h,T]=(0,n.useState)(null),_=b&&!!x&&h===x,[E,w]=(0,n.useState)(0),[v,A]=(0,n.useState)(0),j=(0,n.useRef)(x);(0,n.useEffect)(()=>{j.current!==x&&(j.current=x,T(null))},[x]);const C=(0,n.useCallback)($=>{$&&x&&T(x)},[x]),P=(0,n.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:l,projectId:x,restApi:a,restApiV2:c,i18n:p,pathPostfix:k,appConfig:e,isStandalone:i,onIndexingStateChange:C}),[e,C,p,i,x,E,a,c,l,k]),Y=(0,n.useCallback)(async()=>{try{typeof P.dataProvider?.clearCache=="function"&&await P.dataProvider.clearCache()}catch{}T(null),w($=>$+1),A($=>$+1)},[P.dataProvider]),z=(0,n.useCallback)(()=>{x&&T(x)},[x]);return{...P,projectId:x,restApiV2:c,v2Enabled:b,backfillTriggered:_,contentKey:`${x}:${v}`,handleIndexingCompleted:Y,markIndexingStarted:z}}var Ju={height:"100%"},ba=()=>{const{storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,projectId:a,restApiV2:d,v2Enabled:c,backfillTriggered:p,contentKey:f,handleIndexingCompleted:x,markIndexingStarted:k}=qu(),b=r.useSelector(r.selectActiveModal$1),h=r.isImageCenterModal(b),{state:T,cancel:_,retry:E,dismiss:w}=zu({projectId:a,api:d,triggered:p,onCompleted:x}),v=n.default.useCallback(()=>{k(),E()},[k,E]);return(0,o.jsxs)(o.Fragment,{children:[h&&(0,o.jsx)(n.Suspense,{fallback:(0,o.jsx)(t.ui_kit$PageLoader,{style:Ju}),children:(0,o.jsx)(Ku,{storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,contentKey:f})}),c&&(0,o.jsx)(Fu,{state:T,onCancel:_,onRetry:v,onDismiss:w})]})},Qu=(function(){var e=window.__useblocks__;if(e&&e.assetUrl)return e.assetUrl("icon-menu-block-welcome.1c534a003522feadd2e7.png");if(e&&e.publicPath)try{return new URL("static/media/icon-menu-block-welcome.1c534a003522feadd2e7.png",e.publicPath).href}catch{}try{return new URL("/static/media/icon-menu-block-welcome.1c534a003522feadd2e7.png",typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"").href}catch{return"/static/media/icon-menu-block-welcome.1c534a003522feadd2e7.png"}})();function Zu(e){return!!(e?.global_block??e?.acf?.global_block)}var em=({className:e,size:i=16})=>{const l=r.useAppConfig(),{__:s}=r.useI18n(),a=s("Global block");return(0,o.jsx)(t.ui_kit$Tooltip,{title:a,placement:"top",trigger:["hover"],children:(0,o.jsx)("span",{className:(0,He.default)("block-global-badge",e),"aria-label":a,role:"img",children:(0,o.jsx)(r.EmIcons,{icon:"Globe02Icon",component:t.icons$Globe02Icon,size:i,strokeWidth:l.iconStrokeWidth})})})},fa=new Map;function ga(e){return`<table cellspacing="0" cellpadding="0" border="0" width="100%">${e}</table>`}function pr(e,i){const l=i??"";if(e===void 0)return r.sanitizeHtml(ga(l));const s=String(e),a=fa.get(s);if(a&&a.source===l)return a.markup;const d=r.sanitizeHtml(ga(l));return fa.set(s,{source:l,markup:d}),d}var{name:hr,type:_a,tags:xa}={name:"name",type:"type",tags:"tags"},ka={[hr]:"",[_a]:[],[xa]:[]},ht={Header:10,Menu:20,Banners:30,Content:40,Lists:50,Buttons:60,Promocodes:70,"E-Commerce":80,Transactional:80,Articles:90,Polls:100,Applications:110,Feature:120,Separators:130,Contacts:140,Footer:150},br=({parentEmailId:e,blocksTab:i,search:l,reloadBlockScreens:s,setIsShowAddAllBlocksModal:a})=>{const d=r.parentEmailSource(e),c=r.useEditorProjectId(),p=wo.useSetHtmlElementInIframeHandler(),f=wo.useDragStartBlockToIframeHandler(),[x]=t.ui_kit$Form.useForm(),{data:k}=r.useGetBlocksSchemaQuery(),{token:b}=(0,t.ui_kit$useToken)(),{__:h,_x:T}=r.useI18n(),_=r.useNotification(),{modal:E}=t.ui_kit$App.useApp(),{confirm:w}=E;r.useRoutePathname();const v=r.useSelector(r.selectParentBlocks),A=gs(),j=(0,n.useRef)(null),C=(0,n.useRef)(null),P=r.useRootElement(),Y=640,z=207/Y,$=B=>Zu(B)?(0,o.jsx)("div",{className:"blocks-search__result-global-mark",children:(0,o.jsx)(em,{className:"block-global-badge--tile",size:14})}):null,O=r.useEmailAttribute("common_styles"),y=(0,n.useMemo)(()=>xs(O,A),[O,A]),oe=(0,n.useRef)(null),G=(0,n.useRef)(null),q=(0,n.useRef)(null),te=r.useStore();(0,n.useEffect)(()=>{C.current?.scrollTo({top:0})},[i,l]);const ue=r.useProjectData(),{data:me}=r.useGetTermsQuery({project:ue,kind:r.BLOCK_TAGS},{skip:!ue?.id}),[se,_e]=(0,n.useState)(()=>r.projectBlocksArgs(c));(0,n.useEffect)(()=>{l||(x.setFieldsValue(ka),le({type:null,name:null}),s())},[l,x,s]),(0,n.useEffect)(()=>{if(k){const B=k.schema.properties.acf.properties.type.items.enum;let S=[];for(let m in B)S.push({label:h(r.TYPES_TRANSLATE[B[m]]),value:B[m]})}},[k,h]);const{isSuccess:ve,isError:de,isLoading:De,isFetching:ye,data:re,refetch:ke,error:ae}=r.useGetBlocksQuery({...se,page:1}),Q=(0,n.useMemo)(()=>{if(ve&&re)return[...re].sort((B,S)=>ht[B.type]-ht[S.type])},[ve,re]),[he,pe]=(0,n.useState)([]);r.usePrevious(B=>{B!==de&&_.fromError("BLOCK_GET_ERROR",{},ae,!0)},[de,ae,_]);const[ee,J]=(0,n.useState)(()=>r.parentEmailBlocksArgs(d)),{isSuccess:H,isError:X,isLoading:ce,isFetching:xe}=r.useGetParentEmailBlocksQuery({...ee,emailId:d,page:1},{skip:!d||v.length}),ne=(0,n.useMemo)(()=>{if(H||v.length)return[...v].sort((B,S)=>ht[B.type]-ht[S.type])},[H,v]),[Ae,we]=(0,n.useState)([]);(0,n.useEffect)(()=>{const B=new Set;if(v.length&&ne){for(const S of ne)S.type&&B.add(S.type);we(Array.from(B))}else we([])},[v,ne]);const[$e,K]=(0,n.useState)(r.templateBlocksArgs),{isSuccess:ie,isError:je,isLoading:V,isFetching:Se,data:Ie=[]}=r.useGetTemplateBlocksQuery({...$e,page:1}),Ne=(0,n.useMemo)(()=>{if(Ie.length)return[...Ie].sort((B,S)=>ht[B.type]-ht[S.type])},[Ie]),[Fe,Ve]=(0,n.useState)([]);(0,n.useEffect)(()=>{const B=new Set;if(Ne&&Ie.length){for(const S of Ne)S.type&&B.add(S.type);Ve(Array.from(B))}},[Ie.length,Ne]);const Ue=(0,n.useMemo)(()=>{const B=new Set;for(const S of he)B.add(S);for(const S of Ae)B.add(S);for(const S of Fe)B.add(S);return Array.from(B)},[Fe,Ae,he]),le=B=>{_e(S=>({...S,...B,page:1})),J(S=>({...S,...B,page:1})),K(S=>({...S,...B,page:1}))},Te=r.useFitBlockPreviewHeight(z),I=(0,n.useCallback)(()=>{P.querySelector(".blocks-search__result-wrapper.is_search")&&(P.querySelector(".blocks-search__result-wrapper").style.removeProperty("transition"),P.querySelector(".blocks-search__result-wrapper").style.opacity=0,r.measureBlockPreviews(P,207/Y),P.querySelector(".blocks-search__result-wrapper").style.transition="opacity 0.2s",P.querySelectorAll(".blocks-search__result-wrapper").forEach(B=>B.style.opacity=1))},[Y,P]);(0,n.useEffect)(()=>{!(Se||V)&&ie&&i!=="template"&&(l?I():s())},[Se,V,ie,I,se.name,s,l,i]),(0,n.useEffect)(()=>{const B=new Set;if(ve&&Q){for(const S of Q)S.type&&B.add(S.type);pe(Array.from(B))}},[ve,Q]);const Z=B=>{const S=Object.keys(B)[0],m=x.getFieldsValue(!0);switch(S){case xa:const M=(me||[]).filter(U=>B[S].includes(U.name)).map(U=>U.id)||null;le({tags:M});break;case _a:le({type:m.type||null});break;case hr:j.current&&window.clearTimeout(j.current),j.current=window.setTimeout(function(){le({name:m.name||null})},300)}},Be=B=>{s(),B.target.getAttribute("data-type")?(B.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(S=>S.style.display="none"),B.target.closest(".blocks-search").querySelectorAll(`[data-type="${B.target.getAttribute("data-type")}"]`).forEach(S=>S.style.display="block")):B.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(S=>S.style.display="block"),B.target.parentElement.querySelector(".active").classList.remove("active"),B.target.classList.add("active")};let Ce=null;const Me=B=>{clearTimeout(Ce);let S=P.querySelector(".block-search__preview")?P.querySelector(".block-search__preview"):null,m=P.querySelector(".block-search__preview-title")?P.querySelector(".block-search__preview-title"):null,M=P.querySelector(".block-search__preview-content")?P.querySelector(".block-search__preview-content"):null;P.querySelector(".block-search__preview")||(S=document.createElement("div"),S.classList.add("block-search__preview"),m=document.createElement("div"),m.classList.add("block-search__preview-title"),M=document.createElement("div"),M.classList.add("block-search__preview-content"),S.append(M),S.append(m),P.querySelector(".email-pane__col_settings-inner").append(S)),m.innerHTML="",M.innerHTML="",m.innerHTML=B.title;let U=B.html.replaceAll(/<style((.|\n|\r)*?)<\/style>/gi,"").trim();M.innerHTML=r.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+U+"</table>"),S.style.opacity!=="1"&&setTimeout(function(){S.style.opacity="1",S.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(100%)":"translateX(-100%)"},10)},Ge=()=>{let B=P.querySelector(".block-search__preview");B&&(Ce=setTimeout(()=>{B.style.opacity="0",B.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(99%)":"translateX(-99%)",setTimeout(function(){B.remove()},300)},300))};(0,n.useEffect)(()=>{P.querySelectorAll(".blocks-search__result").forEach(B=>{B.style.display="block"})},[i]);const Ye=!re?.length&&(!d||!v?.length)&&!Ie?.length&&(se.tags||se.name||se.type)&&!(De||ye),D=B=>te.dispatch(r.blocksApi.endpoints.deleteBlock.initiate(B.id)).then(S=>{S.error&&_.fromError("BLOCK_REMOVING_ERROR",r.getBlockDesc(B),S.error),_.success({id:"BLOCK_REMOVING_SUCCESS",data:r.getBlockDesc(B),title:h('The block "')+S.data.title+T('" was successfully removed.',"block")}),ke()});(0,n.useEffect)(()=>{!De&&!ye&&s()},[De,ye,s]),(0,n.useEffect)(()=>{(i==="common"||l)&&setTimeout(s,50)},[re,s,i,l]);const L=B=>{w({mask:{closable:!0},centered:!0,title:T("Are you sure you want to delete the “","block")+B.title+h("” block?"),icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:22,style:{color:t.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0}}),okText:h("Yes"),cancelText:h("No"),onOk:()=>D(B)})},R=B=>[{key:"Delete block",className:"blocks-search__result__menu-item",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16,style:{margin:0}}),style:{color:b.colorError},onClick:()=>L(B)}],F=B=>{let S=B.html.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");if(S.replaceChildren(...r.parseFromString(B.html)),Object.keys(y).length!==0&&(S.querySelectorAll(".em-contrast-card").forEach(m=>{y.cards?.contrastBackgroundColor&&(m.getAttribute("bgcolor")?y.cards.contrastBackgroundColor?m.setAttribute("bgcolor",y.cards.contrastBackgroundColor):m.removeAttribute("bgcolor"):y.cards.contrastBackgroundColor?m.style.backgroundColor=y.cards.contrastBackgroundColor:m.style.removeProperty("background-color")),y.cards?.contrastTextColor&&m.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(M=>{if(Le(M.style.color).toLowerCase()!=="#ffffff"){let U=M.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.cards.contrastTextColor};`);M.setAttribute("style",U)}})}),S.querySelectorAll(".em-card").forEach(m=>{y.cards?.baseBackgroundColor&&(m.getAttribute("bgcolor")?y.cards.baseBackgroundColor?m.setAttribute("bgcolor",y.cards.baseBackgroundColor):m.removeAttribute("bgcolor"):y.cards.baseBackgroundColor?m.style.backgroundColor=y.cards.baseBackgroundColor:m.style.removeProperty("background-color")),y.cards?.baseTextColor&&m.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(M=>{if(Le(M.style.color).toLowerCase()!=="#ffffff"){let U=M.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.cards.baseTextColor};`);M.setAttribute("style",U)}})}),S.querySelectorAll(".em-card, .em-contrast-card").forEach(m=>{y.cards?.border&&Xe({settings:{border:y.cards?.border},elem:m}),y.cards?.borderRadius?.all?(m.style.borderBottomLeftRadius&&m.style.borderBottomLeftRadius!=="0px"&&(m.style.borderBottomLeftRadius=y.cards?.borderRadius.all+"px"),m.style.borderBottomRightRadius&&m.style.borderBottomRightRadius!=="0px"&&(m.style.borderBottomRightRadius=y.cards?.borderRadius.all+"px"),m.style.borderTopLeftRadius&&m.style.borderTopLeftRadius!=="0px"&&(m.style.borderTopLeftRadius=y.cards?.borderRadius.all+"px"),m.style.borderTopRightRadius&&m.style.borderTopRightRadius!=="0px"&&(m.style.borderTopRightRadius=y.cards?.borderRadius.all+"px")):y.cards?.borderRadius?.all===""?m.style.removeProperty("border-radius"):(y.cards?.borderRadius?.topLeft&&m.style.borderTopLeftRadius&&m.style.borderTopLeftRadius!=="0px"?m.style.borderTopLeftRadius=y.cards?.borderRadius.topLeft+"px":y.cards?.borderRadius?.topLeft===""&&m.style.removeProperty("border-top-left-radius"),y.cards?.borderRadius?.topRight&&m.style.borderTopRightRadius&&m.style.borderTopRightRadius!=="0px"?m.style.borderTopRightRadius=y.cards?.borderRadius.topRight+"px":y.cards?.borderRadius?.topRight===""&&m.style.removeProperty("border-top-right-radius"),y.cards?.borderRadius?.bottomRight&&m.style.borderBottomRightRadius&&m.style.borderBottomRightRadius!=="0px"?m.style.borderBottomRightRadius=y.cards?.borderRadius.bottomRight+"px":y.cards?.borderRadius?.bottomRight===""&&m.style.removeProperty("border-bottom-right-radius"),y.cards?.borderRadius?.bottomLeft&&m.style.borderBottomLeftRadius&&m.style.borderBottomLeftRadius!=="0px"?m.style.borderBottomLeftRadius=y.cards?.borderRadius.bottomLeft+"px":y.cards?.borderRadius?.bottomLeft===""&&m.style.removeProperty("border-bottom-left-radius"))}),S.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(m=>{if(!m.style.display&&parseFloat(m.style.fontSize)<=20){let M="",U=y.text.fontFamily;if(parseFloat(m.style.fontSize)>14&&(M=m.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${y.text.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${y.text.lineHeight}px`),m.setAttribute("style",M)),!m.closest(".em-contrast-card, .em-card")&&Le(m.style.color).toLowerCase()!=="#ffffff"&&(M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.text.color};`),m.setAttribute("style",M)),m.closest(".em-contrast-block")&&!m.closest(".em-contrast-card, .em-card")&&(M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.text.contrastColor};`),m.setAttribute("style",M)),U[0]==="Safe Fonts"?(m.style.fontFamily=U[1],fe({elem:S})):U[0]==="Google Fonts"&&(U[1]==="Sans Serif"?m.style.fontFamily="Helvetica, Arial, sans-serif":U[1]==="Serif"&&(m.style.fontFamily='"Times New Roman", Times, serif'),m.classList.remove(...[...m.classList].filter(Re=>Re.startsWith("em-font"))),m.classList.add(`em-font-${U[2].replace(/\s/g,"")}-${U[3].replace(/\s/g,"")}`),eo({elem:S,fontFamilyArray:U})),m.closest('[em="atom"] > tr > td')&&m.closest('[em="atom"] > tr > td').style.paddingBottom)m.closest('[em="atom"] > tr > td').style.paddingBottom=y.text.paddingBottom+"px";else if(m.nextElementSibling||m.closest("table")&&m.closest("table").nextElementSibling){let Re=m.nextElementSibling??m.closest("table").nextElementSibling;Re&&Re.tagName==="TABLE"&&(Re.classList.contains("em-vindent-table")||Re.querySelector("td").innerHTML==="")&&Re.querySelector("td").setAttribute("height",y.text.paddingBottom)}}else if(!m.style.display&&parseFloat(m.style.fontSize)>=20&&Le(m.style.color).toLowerCase()!=="#eb3737"){let M="",U=y.headings.fontFamily;parseFloat(m.style.fontSize)<40&&(M=m.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${y.headings.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${y.headings.lineHeight}px`),m.setAttribute("style",M)),!m.closest(".em-contrast-card, .em-card")&&Le(m.style.color).toLowerCase()!=="#ffffff"&&(M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.headings.color};`),m.setAttribute("style",M)),m.closest(".em-contrast-block")&&!m.closest(".em-contrast-card, .em-card")&&(M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.headings.contrastColor};`),m.setAttribute("style",M)),U[0]==="Safe Fonts"?(m.style.fontFamily=U[1],fe({elem:S})):U[0]==="Google Fonts"&&(U[1]==="Sans Serif"?m.style.fontFamily="Helvetica, Arial, sans-serif":U[1]==="Serif"&&(m.style.fontFamily='"Times New Roman", Times, serif'),m.classList.remove(...[...m.classList].filter(be=>be.startsWith("em-font"))),m.classList.add(`em-font-${U[2].replace(/\s/g,"")}-${U[3].replace(/\s/g,"")}`),eo({elem:S,fontFamilyArray:U}));let Re="";if(y.headings.letterSpacing>0?Re=m.style.letterSpacing?m.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${y.headings.letterSpacing}px`):m.getAttribute("style")+` letter-spacing: ${y.headings.letterSpacing}px;`:Re=m.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),m.setAttribute("style",Re),y.headings.bold?m.querySelector("b")?m.querySelector("b").replaceWith(...m.querySelector("b").childNodes):m.querySelector("strong")||(m.innerHTML="<strong>"+m.innerHTML+"</strong>"):m.querySelector("strong")?m.querySelector("strong").replaceWith(...m.querySelector("strong").childNodes):m.querySelector("b")&&m.querySelector("b").replaceWith(...m.querySelector("b").childNodes),m.style.fontWeight){let be=m.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");m.setAttribute("style",be)}if(y.headings.italic?m.querySelector("i")?m.querySelector("i").replaceWith(...m.querySelector("i").childNodes):m.querySelector("em")||(m.innerHTML="<em>"+m.innerHTML+"</em>"):m.querySelector("em")?m.querySelector("em").replaceWith(...m.querySelector("em").childNodes):m.querySelector("i")&&m.querySelector("i").replaceWith(...m.querySelector("i").childNodes),m.style.fontStyle){let be=m.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");m.setAttribute("style",be)}if(m.closest('[em="atom"] > tr > td')&&m.closest('[em="atom"] > tr > td').style.paddingTop)m.closest('[em="atom"] > tr > td').style.paddingTop=y.headings.paddingTop+"px";else if(m.previousElementSibling){let be=m.previousElementSibling;be&&be.tagName==="TABLE"&&(be.classList.contains("em-vindent-table")||be.querySelector("td").innerHTML==="")&&be.querySelector("td").setAttribute("height",y.headings.paddingTop)}if(m.closest('[em="atom"] > tr > td')&&m.closest('[em="atom"] > tr > td').style.paddingBottom)m.closest('[em="atom"] > tr > td').style.paddingBottom=y.headings.paddingBottom+"px";else if(m.nextElementSibling){let be=m.nextElementSibling;be&&be.tagName==="TABLE"&&(be.classList.contains("em-vindent-table")||be.querySelector("td").innerHTML==="")&&be.querySelector("td").setAttribute("height",y.headings.paddingBottom)}}}),S.querySelectorAll('a[style*="color"]').forEach(m=>{if(m.style.display){if(m.style.display&&m.style.display==="block"){let M="";if(M=m.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${y.buttons.fontSize}px`),m.setAttribute("style",M),m.closest("td").style.backgroundColor&&!m.closest("td").style.borderWidth&&!m.closest(".em-contrast-card"))if(m.closest(".em-contrast-block")?M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.buttons.contrastColor};`):M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.buttons.color};`),m.setAttribute("style",M),m.closest(".em-contrast-block"))if(y.buttons.contrastBackgroundColor){let be=m.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${y.buttons.contrastBackgroundColor};`);m.closest("td").setAttribute("style",be)}else m.closest("td").style.removeProperty("background-color");else if(y.buttons.backgroundColor){let be=m.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${y.buttons.backgroundColor};`);m.closest("td").setAttribute("style",be)}else m.closest("td").style.removeProperty("background-color");else if(m.closest("td").style.borderWidth)if(Object.values(y.buttons.border).every(be=>be===null)){if(m.closest(".em-contrast-block")){if(y.buttons.contrastBackgroundColor){let be=m.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,ze=>ze.replace(/#[A-Fa-f0-9]{6}/,`${y.buttons.contrastBackgroundColor}`));m.closest("td").setAttribute("style",be),M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.buttons.contrastBackgroundColor};`),m.setAttribute("style",M)}}else if(y.buttons.backgroundColor){let be=m.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,ze=>ze.replace(/#[A-Fa-f0-9]{6}/,`${y.buttons.backgroundColor}`));m.closest("td").setAttribute("style",be),M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.buttons.backgroundColor};`),m.setAttribute("style",M)}}else for(const be in y.buttons.border)y.buttons.border[be]&&y.buttons.border[be].color!==void 0&&(M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.buttons.border[be].color};`),m.setAttribute("style",M));else m.closest(".em-contrast-block")?y.buttons.contrastBackgroundColor&&(M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.buttons.contrastBackgroundColor};`),m.setAttribute("style",M)):y.buttons.backgroundColor&&(M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.buttons.backgroundColor};`),m.setAttribute("style",M));let U=y.buttons.fontFamily;U[0]==="Safe Fonts"?(m.style.fontFamily=U[1],fe({elem:S})):U[0]==="Google Fonts"&&(U[1]==="Sans Serif"?m.style.fontFamily="Helvetica, Arial, sans-serif":U[1]==="Serif"&&(m.style.fontFamily='"Times New Roman", Times, serif'),m.classList.remove(...[...m.classList].filter(be=>be.startsWith("em-font"))),m.classList.add(`em-font-${U[2].replace(/\s/g,"")}-${U[3].replace(/\s/g,"")}`),eo({elem:S,fontFamilyArray:U})),m.closest("td").setAttribute("align",y.buttons.textAlign);let Re="";if(y.buttons.letterSpacing>0?Re=m.style.letterSpacing?m.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${y.buttons.letterSpacing}px`):m.getAttribute("style")+` letter-spacing: ${y.buttons.letterSpacing}px;`:Re=m.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),m.setAttribute("style",Re),y.buttons.bold?m.querySelector("b")?m.querySelector("b").replaceWith(...m.querySelector("b").childNodes):m.querySelector("strong")||(m.innerHTML="<strong>"+m.innerHTML+"</strong>"):m.querySelector("strong")?m.querySelector("strong").replaceWith(...m.querySelector("strong").childNodes):m.querySelector("b")&&m.querySelector("b").replaceWith(...m.querySelector("b").childNodes),m.style.fontWeight){let be=m.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");m.setAttribute("style",be)}if(y.buttons.italic?m.querySelector("i")?m.querySelector("i").replaceWith(...m.querySelector("i").childNodes):m.querySelector("em")||(m.innerHTML="<em>"+m.innerHTML+"</em>"):m.querySelector("em")?m.querySelector("em").replaceWith(...m.querySelector("em").childNodes):m.querySelector("i")&&m.querySelector("i").replaceWith(...m.querySelector("i").childNodes),m.style.fontStyle){let be=m.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");m.setAttribute("style",be)}if(m.closest('[em="atom"] > tr > td')&&m.closest('[em="atom"] > tr > td').style.paddingTop)m.closest('[em="atom"] > tr > td').style.paddingTop=y.buttons.marginTop+"px";else if(m.closest("table").previousElementSibling){let be=m.closest("table").previousElementSibling;be&&be.tagName==="TABLE"&&(be.classList.contains("em-vindent-table")||be.querySelector("td").innerHTML==="")&&be.querySelector("td").setAttribute("height",y.buttons.marginTop)}if(m.closest('[em="atom"] > tr > td')&&m.closest('[em="atom"] > tr > td').style.paddingBottom)m.closest('[em="atom"] > tr > td').style.paddingBottom=y.buttons.marginBottom+"px";else if(m.closest("table").previousElementSibling){let be=m.closest("table").nextElementSibling;be&&be.tagName==="TABLE"&&(be.classList.contains("em-vindent-table")||be.querySelector("td").innerHTML==="")&&be.querySelector("td").setAttribute("height",y.buttons.marginBottom)}y.buttons.padding.all&&(m.style.padding=y.buttons.padding.all+"px"),y.buttons.padding.top&&(m.style.paddingTop=y.buttons.padding.top+"px"),y.buttons.padding.right&&(m.style.paddingRight=y.buttons.padding.right+"px"),y.buttons.padding.bottom&&(m.style.paddingBottom=y.buttons.padding.bottom+"px"),y.buttons.padding.left&&(m.style.paddingLeft=y.buttons.padding.left+"px"),Xe({settings:{border:y.buttons.border},elem:m.closest("td")}),lo({settings:{borderRadius:y.buttons.borderRadius},elem:m.closest("td")})}}else{let M=y.text.fontFamily;if(Le(m.style.color).toLowerCase()==="#1c52dc"){let Re=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.links.color};`);m.setAttribute("style",Re)}else{let Re=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.text.color};`);m.setAttribute("style",Re)}if(m.closest(".em-contrast-block")){let Re=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.links.contrastColor};`);m.setAttribute("style",Re)}let U="";y.links.underline?U=m.style.textDecoration?m.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: underline;"):m.getAttribute("style")+" text-decoration: underline;":U=m.style.textDecoration?m.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: none;"):m.getAttribute("style")+" text-decoration: none;",m.setAttribute("style",U),M[0]==="Safe Fonts"?(m.style.fontFamily=M[1],fe({elem:S})):M[0]==="Google Fonts"&&(M[1]==="Sans Serif"?m.style.fontFamily="Helvetica, Arial, sans-serif":M[1]==="Serif"&&(m.style.fontFamily='"Times New Roman", Times, serif'),m.classList.remove(...[...m.classList].filter(Re=>Re.startsWith("em-font"))),m.classList.add(`em-font-${M[2].replace(/\s/g,"")}-${M[3].replace(/\s/g,"")}`),eo({elem:S,fontFamilyArray:M}))}}),S.querySelector('[em="block"]'))){const m=S.querySelectorAll('[em="block"]');y.block?.backgroundColor&&m.forEach(M=>{M.querySelectorAll(":scope > td").forEach(U=>{U.setAttribute("bgcolor",y.block.backgroundColor)})}),y.block?.padding&&m.forEach(M=>{M.querySelectorAll(":scope > td").forEach(U=>{U.style.paddingTop=y.block.padding.top+"px",U.style.paddingRight=y.block.padding.right+"px",U.style.paddingBottom=y.block.padding.bottom+"px",U.style.paddingLeft=y.block.padding.left+"px"})})}return S.tagName==="DIV"?r.getElementInnerHTML(S):r.getElementInnerHTML(S.querySelector("tbody")||S)},fe=B=>{B.elem.querySelectorAll("link[em-class]").forEach(S=>{B.elem.querySelector("."+S.getAttribute("em-class"))||S.remove()})};function Le(B){if(B&&B.charAt(0)==="r"){if(B.charAt(3)==="a")return B=B.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i),B&&B.length===4?"#"+("0"+parseInt(B[1],10).toString(16)).slice(-2)+("0"+parseInt(B[2],10).toString(16)).slice(-2)+("0"+parseInt(B[3],10).toString(16)).slice(-2):"";{B=B.replace("rgb(","").replace(")","").split(",");let S=parseInt(B[0],10).toString(16),m=parseInt(B[1],10).toString(16),M=parseInt(B[2],10).toString(16);return S=S.length===1?"0"+S:S,m=m.length===1?"0"+m:m,M=M.length===1?"0"+M:M,"#"+S+m+M}}else if(B&&B.charAt(0)==="#")return B}const eo=B=>{const S=B.elem.querySelectorAll("link"),m=`em-font-${B.fontFamilyArray[2].replace(/\s/g,"")}-${B.fontFamilyArray[3].replace(/\s/g,"")}`;if(!Array.from(S)?.find(U=>U.getAttribute("em-class")===m)){let U=document.createElement("link");U.setAttribute("rel","stylesheet"),U.setAttribute("href",`https://fonts.googleapis.com/css2?family=${B.fontFamilyArray[2]}:ital,wght@${Qe[B.fontFamilyArray[3]].indexOf("i")>-1?"1":"0"},${Qe[B.fontFamilyArray[3]].replaceAll("i","")}&display=swap`),U.setAttribute("em-class",m),B.elem.insertAdjacentElement("afterbegin",U)}Eo({elem:B.elem});let M=`font-family: '${B.fontFamilyArray[2]}', ${uo[B.fontFamilyArray[1]]}!important;`;M+=` font-weight: ${Qe[B.fontFamilyArray[3]].replaceAll("i","")}!important;`,Qe[B.fontFamilyArray[3]].indexOf("i")>-1&&(M+=" font-style: italic!important;"),B.elem.querySelector('style[em="styles"]').insertAdjacentHTML("beforeend",`
|
|
22
|
-
.em-font-${B.fontFamilyArray[2].replace(/\s/g,"")}-${B.fontFamilyArray[3].replace(/\s/g,"")} { ${M} }`),setTimeout(()=>fe({elem:B.elem}),0)},Xe=B=>{B.settings.border.all?B.settings.border.all.width!=null&&(B.settings.border.all.style||B.settings.border.all.color)?(B.elem.style.borderWidth=B.settings.border.all.width+"px",B.elem.style.borderStyle=B.settings.border.all.style,B.elem.style.borderColor=B.settings.border.all.color):B.elem.style.removeProperty("border"):(B.settings.border.top&&(B.settings.border.top.width!=null&&(B.settings.border.top.style||B.settings.border.top.color)?(B.elem.style.borderTopWidth=B.settings.border.top.width+"px",B.elem.style.borderTopStyle=B.settings.border.top.style,B.elem.style.borderTopColor=B.settings.border.top.color):B.elem.style.removeProperty("border-top")),B.settings.border.right&&(B.settings.border.right.width!=null&&(B.settings.border.right.style||B.settings.border.right.color)?(B.elem.style.borderRightWidth=B.settings.border.right.width+"px",B.elem.style.borderRightStyle=B.settings.border.right.style,B.elem.style.borderRightColor=B.settings.border.right.color):B.elem.style.removeProperty("border-right")),B.settings.border.bottom&&(B.settings.border.bottom.width!=null&&(B.settings.border.bottom.style||B.settings.border.bottom.color)?(B.elem.style.borderBottomWidth=B.settings.border.bottom.width+"px",B.elem.style.borderBottomStyle=B.settings.border.bottom.style,B.elem.style.borderBottomColor=B.settings.border.bottom.color):B.elem.style.removeProperty("border-bottom")),B.settings.border.left&&(B.settings.border.left.width!=null&&(B.settings.border.left.style||B.settings.border.left.color)?(B.elem.style.borderLeftWidth=B.settings.border.left.width+"px",B.elem.style.borderLeftStyle=B.settings.border.left.style,B.elem.style.borderLeftColor=B.settings.border.left.color):B.elem.style.removeProperty("border-left")))},lo=B=>{B.settings.borderRadius.all?B.elem.style.borderRadius=B.settings.borderRadius.all+"px":B.settings.borderRadius.all===""?B.elem.style.removeProperty("border-radius"):(B.settings.borderRadius.topLeft?B.elem.style.borderTopLeftRadius=B.settings.borderRadius.topLeft+"px":B.settings.borderRadius.topLeft===""&&B.elem.style.removeProperty("border-top-left-radius"),B.settings.borderRadius.topRight?B.elem.style.borderTopRightRadius=B.settings.borderRadius.topRight+"px":B.settings.borderRadius.topRight===""&&B.elem.style.removeProperty("border-top-right-radius"),B.settings.borderRadius.bottomRight?B.elem.style.borderBottomRightRadius=B.settings.borderRadius.bottomRight+"px":B.settings.borderRadius.bottomRight===""&&B.elem.style.removeProperty("border-bottom-right-radius"),B.settings.borderRadius.bottomLeft?B.elem.style.borderBottomLeftRadius=B.settings.borderRadius.bottomLeft+"px":B.settings.borderRadius.bottomLeft===""&&B.elem.style.removeProperty("border-bottom-left-radius"))},Qe={Thin:"100","Thin Italic":"100i",ExtraLight:"200","ExtraLight Italic":"200i",Light:"300","Light Italic":"300i",Regular:"400","Regular Italic":"400i",Medium:"500","Medium Italic":"500i",SemiBold:"600","SemiBold Italic":"600i",Bold:"700","Bold Italic":"700i",ExtraBold:"800","ExtraBold Italic":"800i",Black:"900","Black Italic":"900i"},uo={"Sans Serif":"sans-serif",Serif:"serif"};function Eo(B){if(!B.elem.querySelector('style[em="styles"]')){let S=document.createElement("style");S.setAttribute("em","styles"),B.elem.append(S)}}return(0,o.jsxs)("div",{className:(0,He.default)("blocks-search",{is_search:l}),children:[(0,o.jsx)(t.ui_kit$Form,{className:(0,He.default)("blocks-search__form",{is_search:l}),form:x,layout:"vertical",name:"blocks_search_form",initialValues:{...ka},onValuesChange:Z,autoComplete:"off",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:hr,children:(0,o.jsx)(t.ui_kit$SearchInput,{placeholder:h("Search by title"),allowClear:!0,enterButton:!1})})}),(de||X||je)&&(0,o.jsx)(t.ui_kit$Alert,{title:h("Error"),description:h("Error when receiving data. Try again (reload page) or contact support."),type:"error",showIcon:!0}),l&&!Ye&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:Be,children:h("All")},"search_All"),Ue.map(B=>(0,o.jsx)("li",{"data-type":B,onClick:Be,children:h(r.TYPES_TRANSLATE[B])},"search_"+B))]})}),(0,o.jsxs)("div",{ref:C,className:(0,He.default)("blocks-search__result-wrapper",{is_search:l}),children:[(i==="project"||l)&&(0,o.jsxs)(o.Fragment,{children:[!!he.length&&!l&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:Be,children:h("All")},"blocksSections_All"),he.map(B=>(0,o.jsx)("li",{"data-type":B,onClick:Be,children:h(r.TYPES_TRANSLATE[B])},"blocksSections_"+B))]})}),(0,o.jsxs)("div",{className:(0,He.default)("blocks-search__blocks-wrapper",{is_search:l}),ref:oe,children:[(0,o.jsx)("div",{className:"blocks-search__result-holder project",children:!(De||ye)&&(Q?.length?Q.map((B,S)=>{const m=pr(B.id,B.html);return(0,o.jsx)("div",{className:"blocks-search__result","data-type":B.type,children:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"leftTop",menu:{items:R(B)},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:M=>p(M,B.html,"project",B.title,B),onDragStart:M=>f(M,B.html,"project",B.title,B),onMouseEnter:()=>Me({html:B.html,title:B.title}),onMouseLeave:Ge,children:[$(B),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:m,onContentLoad:Te,style:{transform:`scale(${z})`}})]})},"commenMenu")},B.id+S.toString())}):!(se.tags||se.name||se.type)&&ve&&!(De||ye)&&!l&&(0,o.jsxs)("div",{style:{padding:"10px 0 20px",display:"flex",flexDirection:"row",justifyContent:"space-between"},children:[(0,o.jsxs)("div",{style:{width:"110%"},children:[(0,o.jsx)("h3",{style:{lineHeight:"1.2"},children:h("You don`t have any saved blocks yet.")}),h("To add a block from the dashboard click the"),' "',h("Save to Blocks button."),'" ',(0,o.jsx)(r.EmIcons,{icon:"SaveBlock",component:t.icons$SaveBlock,style:{position:"relative",top:"2px"}}),(0,o.jsx)("br",{}),(0,o.jsx)("br",{}),h("You can also save all blocks at once. The AI assistant will automatically determine the type and create a name for each block when saving."),(0,o.jsx)("br",{}),(0,o.jsx)("br",{}),(0,o.jsx)(t.ui_kit$Flex,{justify:"left",children:(0,o.jsx)(t.ui_kit$Button,{type:"primary",onClick:()=>a(!0),style:{cursor:"pointer"},children:h("Save all blocks")})})]}),(0,o.jsx)("div",{style:{width:"80px",height:"200px"},children:(0,o.jsx)("img",{src:Qu,style:{display:"block",width:80,position:"absolute",right:5}})})]}))}),(De||ye)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),l&&re?.length>0&&v?.length>0&&(0,o.jsx)(t.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="template"||l)&&(0,o.jsxs)(o.Fragment,{children:[!!Ae.length&&!l&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:Be,children:h("All")},"templateBlocksSections_All"),Ae.map(B=>(0,o.jsx)("li",{"data-type":B,onClick:Be,children:h(r.TYPES_TRANSLATE[B])},"templateBlocksSections_"+B))]})}),(0,o.jsxs)("div",{className:(0,He.default)("blocks-search__blocks-wrapper",{is_search:l}),ref:G,children:[(0,o.jsxs)("div",{className:"blocks-search__result-holder template",children:[v&&!(ce||xe)&&ne?.length?(0,o.jsx)(o.Fragment,{children:ne.map((B,S)=>{const m=pr(B.id,B.html);return(0,o.jsx)("div",{className:"blocks-search__result","data-type":B.type,children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:M=>p(M,B.html,"template",B.title,B),onDragStart:M=>f(M,B.html,"template",B.title,B),onMouseEnter:()=>Me({html:B.html,title:B.title}),onMouseLeave:()=>Ge(),children:[$(B),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:m,onContentLoad:Te,style:{transform:`scale(${z})`}})]})},B.id+S.toString())})}):!l&&!V&&!xe&&(0,o.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:h("No related blocks found.")})," "]}),(ce||xe)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),l&&v?.length>0&&Ie?.length>0&&(0,o.jsx)(t.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="common"||l)&&(0,o.jsxs)(o.Fragment,{children:[!!Fe?.length&&!l&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:Be,children:h("All")},"commonBlocksSections_All"),Fe.map(B=>(0,o.jsx)("li",{"data-type":B,onClick:Be,children:h(r.TYPES_TRANSLATE[B])},"commonBlocksSections_"+B))]})}),(0,o.jsxs)("div",{className:(0,He.default)("blocks-search__blocks-wrapper",{is_search:l}),ref:q,children:[(0,o.jsxs)("div",{className:"blocks-search__result-holder common",children:[ie&&!!Ne?.length&&!(Se||V)&&(0,o.jsx)(o.Fragment,{children:Ne.map((B,S)=>{const m=F({html:pr(B.id,B.html)});return(0,o.jsx)("div",{className:"blocks-search__result","data-type":B.type,children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:M=>p(M,F({html:B.html}),"common",B.title,B),onDragStart:M=>f(M,F({html:B.html}),"common",B.title,B),onMouseEnter:()=>Me({html:F({html:r.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+B.html+"</table>")}),title:B.title}),onMouseLeave:()=>Ge(),children:[$(B),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:m,onContentLoad:Te,style:{transform:`scale(${z})`}})]})},B.id+S.toString())})})," "]}),(V||Se)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),Ye&&(0,o.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:h("There are no blocks for this request.")})]})]})};br.propTypes={};var Ea=({comments:e,subjectId:i,isLoggedIn:l,projectTitle:s="",emailElementType:a,email:d})=>{const{__:c,_n:p}=r.useI18n(),f=r.useSendPostMessage(),x=r.useNotification(),{token:k}=(0,t.ui_kit$useToken)(),b=r.useAppConfig(),h=r.usePushToDataLayer(),T=(0,n.useRef)(null),[_,E]=(0,n.useState)(""),[w,v]=(0,n.useState)("ADD"),[A,j]=(0,n.useState)(!1),[C,P]=(0,n.useState)(null),[Y,z]=(0,n.useState)(null),[$,O]=(0,n.useState)(""),[y,oe]=(0,n.useState)(""),[G,q]=(0,n.useState)(!1),[te,ue]=(0,n.useState)(""),[me,se]=r.useAddCommentMutation(),[_e,ve]=r.useDeleteCommentMutation(),[de,De]=r.useEditCommentMutation(),[ye,re]=r.useDeleteTargetMutation(),[ke]=r.useAutoSaveBlockMutation(),ae=r.useDispatch(),Q=r.useStore(),he=r.useCurrentUser(),pe=r.useCurrentProjectRequested(),ee=r.useContentReader(),J=le=>{const Te=r.getEmailDocuments(xo.getContainer(Q));Te.save("anchor",{project:le}).then(I=>{const Z=I?Te.revisionFacts()?.lastRevisionAt:void 0;Z!==void 0&&d?.id!=null&&ae(r.rememberAutosaveTime({emailId:d.id,modified:new Date(Z).toISOString()}))})},H=()=>{const le=pe;if(a==="email"){J(le);return}const Te={...d?.meta!==void 0?{meta:d.meta}:{},title:d?.title,emailId:d?.id,project:le,html:ee(),excerpt:d?.date_gmt};ke({blockId:d?.id,body:Te}).catch(I=>{})};function X(le){q(!1),ue(""),f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:te}),j(!0),f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!0})}function ce(){z(C),e.filter(le=>le.parent===C).length?de({commentId:C,status:"deleted"}).unwrap():_e(C),document.querySelector('.discuss-main li[id="'+C+'"] .comment-icon-target')?.getAttribute("target-id")&&f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:document.querySelector('.discuss-main li[id="'+C+'"] .comment-icon-target')?.getAttribute("target-id")}),H(),ue("")}function xe(le){z(C);const Te=e.find(Z=>Z.id?.toString()===C),I=Te?.target_id?.toString()||"";q(!!I),ue(I),oe(Te?.content?.slice(3,-5)?.toString()),v("EDIT")}function ne(le){z(C),O(""),v("REPLY")}const Ae=()=>{x.error({mask:{closable:!0},centered:!0,title:c("Please log in"),content:(r.isUseBlocksBuild()?c("To leave comments you must be logged into Blocks and added to the project "):c("To leave comments you must be logged into EmailMaker and added to the project "))+`${s}.`,okText:c("Okay. I'll log in.")})};async function we(){l?(await de({commentId:Y,content:y,targetId:te}).unwrap(),v("ADD"),oe(""),z(0),q(!1),j(!1),ue(""),f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Ae()}const $e=le=>{v("ADD"),oe(""),z(0),q(!1),j(!1),ue(""),f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})},K=async()=>{l?((_||$)&&await me({subjectId:i,author:he.id,parent:w==="ADD"?"0":Y,content:_||$,author_name:he.name,author_email:he.email,targetId:te}).then(le=>{le.error?x.error({title:le.error.data.code,description:le.error.data.message}):h({event:"submit",action:"send_discussion_chat_message",entity_type:a==="block"?"block":"email",entity_id:d?.id,project_id:d?.project,context:"editor"})}),ue(""),v("ADD"),O(""),E(""),z(0),q(!1),j(!1),f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Ae()};function ie(){G?(j(!1),q(!1),f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:te})):(j(!A),f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!A}),A&&q(!1))}function je(le){let Te=JSON.parse(JSON.stringify(le));if(!Te||!Te.length)return[];let I=[],Z=new Map;for(let Be=0,Ce=Te.length;Be<Ce;++Be){let Me=Te[Be],Ge=Z.get(Me.id);if((!Ge||Array.isArray(Ge))&&(Ge&&(Me.children=Ge),Z.set(Me.id,Me)),String(Me.parent)==="0")I.push(Me);else{let Ye=Z.get(Me.parent);Ye?(Array.isArray(Ye)?Ye:Ye.children=Ye.children||[]).push(Me):Z.set(Me.parent,[Me])}}return I.forEach(Be=>{Be.status==="deleted"&&!Be.children&&(ve.isUninitialized||ve.isSuccess)&&_e(Be.id).unwrap().catch(Ce=>{})}),I}const V=le=>{const Te=le.data.operation;if(Te===r.EVENT_TYPES.APPLICATION_DISCUSS_SET_ID&&(ue(le.data.settings.value),le.data.settings.value!==""?(q(!0),j(!1)):(q(!1),j(!0))),Te===r.EVENT_TYPES.APPLICATION_DISCUSS_SAVE_TARGET&&H(),Te===r.EVENT_TYPES.APPLICATION_DISCUSS_GET_COMMENT)if(document.querySelector('.comment-icon-target[target-id="'+le.data.settings.targetId+'"]')){let I=document.querySelector('.comment-icon-target[target-id="'+le.data.settings.targetId+'"]').closest(".ant-comment");document.querySelector(".comment-block")?document.querySelector(".comment-block").scrollTo(0,I.offsetTop):document.querySelector(".em-analytics__email-tab-discuss .ant-tabs-content").scrollTo(0,I.offsetTop),I.classList.add("active"),setTimeout(()=>{I.classList.remove("active")},2e3)}else f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:le.data.settings.targetId}),x.error({title:c("There's no such comment.")});Te===r.EVENT_TYPES.APPLICATION_DISCUSS_NO_COMMENT&&x.error({title:c("There's no such element in the email.")})};r.useListenPostMessage(V);const Se=le=>{f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_GET_TARGET,value:le})},Ie=le=>(le?.sort((Te,I)=>Te.date>I.date?1:-1),(0,o.jsx)(o.Fragment,{children:le&&!!le.length&&(0,o.jsx)(t.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:le,renderItem:Te=>(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("li",{id:Te.id,children:(0,o.jsxs)(o.Fragment,{children:[Te.status==="deleted"&&Te.clildren&&(0,o.jsx)(t.ui_kit$Comment,{className:"deletedComment",content:(0,o.jsx)(t.ui_kit$Alert,{description:c("Comment was removed."),type:"info"}),children:Ie(Te.children)}),Te.status!=="deleted"&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Comment,{author_id:Te.author_id,author:Te.author_name,avatar:Te.author_avatar_urls&&Te.author_avatar_urls[48]||"",className:(0,He.default)(Te.target_id&&"targetted-comment-item",(!Te.author_avatar_urls||!Te.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>P(Te.id),menu:{items:Te.author===he.id?Ve:Ue},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,o.jsx)("div",{onClick:()=>Te.target_id&&Se(Te.target_id),dangerouslySetInnerHTML:{__html:Te.content}})},"commenMenu"),datetime:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:Te.date&&wo.formatDate(wo.tryParseISO(Te.date),p,!0)}}),Te.target_id&&(0,o.jsx)("span",{className:"comment-icon-target","target-id":Te.target_id,onClick:()=>Se(Te.target_id),children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,style:{color:k.colorInfo,top:-2,position:"relative"}})})]}),children:(0,o.jsxs)(o.Fragment,{children:[w==="REPLY"&&Y===Te.id&&Fe,w==="EDIT"&&Y===Te.id&&Ne,Ie(Te.children)]})})})]})})})})})),Ne=(0,o.jsxs)(t.ui_kit$Form,{onFinish:we,className:"commentForm",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{className:"textarea-reply",value:y,onChange:le=>oe(le.target.value),rows:4,placeholder:c("Editing comments"),onKeyDown:le=>le.key==="Escape"&&$e(),onPressEnter:le=>le.key==="Enter"&&le.ctrlKey&&we(),ref:T})}),(0,o.jsx)(t.ui_kit$Form.Item,{className:"buttons",children:(0,o.jsxs)(t.ui_kit$Space,{children:[G?(0,o.jsx)(t.ui_kit$Popconfirm,{title:c("Are you sure?"),okText:c("Yes"),cancelText:c("No"),onConfirm:X,children:(0,o.jsx)(t.ui_kit$Button,{loading:re.isLoading,type:A||G&&w==="EDIT"&&te!==""?"primary":"default",className:"button-target "+(A&&!G?"button-target_choose":""),style:G&&w==="EDIT"&&te!==""?{background:k.colorInfo}:{},children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,className:"icon-target"})})}):(0,o.jsx)(t.ui_kit$Button,{onClick:ie,loading:re.isLoading,type:A||G&&w==="EDIT"&&te!==""?"primary":"default",className:"button-target "+(A&&!G?"button-target_choose":""),style:G&&w==="EDIT"&&te!==""?{background:k.colorInfo}:{},children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,className:"icon-target"})}),(0,o.jsxs)(t.ui_kit$Button,{className:"button-reply",type:"primary",loading:De.isLoading,htmlType:"submit",children:[c("Save")," ",(0,o.jsx)(r.EmIcons,{icon:"SaveOutlined",component:t.icons$SaveOutlined,size:16,strokeWidth:b.iconStrokeWidth})]}),(0,o.jsx)(t.ui_kit$Button,{onClick:$e,className:"button-reply",children:c("Cancel")})]})})]}),Fe=(0,o.jsxs)(t.ui_kit$Form,{name:"reply",className:"commentForm",onFinish:K,children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{className:"textarea-reply",value:$,onChange:le=>O(le.target.value),rows:4,placeholder:c("Reply to the comment"),onKeyDown:le=>le.key==="Escape"&&$e(),onPressEnter:le=>le.key==="Enter"&&le.ctrlKey&&K(),ref:T})}),(0,o.jsx)(t.ui_kit$Form.Item,{hidden:!0,name:"targetId",children:(0,o.jsx)(t.ui_kit$Input,{type:"hidden"})}),(0,o.jsx)(t.ui_kit$Form.Item,{className:"buttons",children:(0,o.jsxs)(t.ui_kit$Space,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:c("Add a note"),styles:{body:{maxWidth:"150px"}},children:(0,o.jsx)(t.ui_kit$Button,{onClick:ie,type:A||G&&w==="REPLY"&&te!==""?"primary":"default",className:"button-target "+(A&&!G?"button-target_choose":""),style:G&&w==="REPLY"&&te!==""?{background:k.colorInfo}:{},children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,className:"icon-target"})})}),(0,o.jsxs)(t.ui_kit$Button,{className:"button-reply",type:"primary",loading:w==="REPLY"&&se.isLoading,htmlType:"submit",children:[c("Reply")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:b.iconStrokeWidth})]}),(0,o.jsx)(t.ui_kit$Button,{onClick:$e,className:"button-reply",ghost:!0,type:"primary",children:c("Cancel")})]})})]});(0,n.useEffect)(()=>{w==="REPLY"&&T.current.focus({cursor:"start"}),w==="EDIT"&&T.current.focus({cursor:"end"})},[w]);let Ve=[];Ve.push({key:"Reply to comment",icon:(0,o.jsx)(r.EmIcons,{icon:"RollbackOutlined",component:t.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:ne},{key:"Edit comment",icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,style:{fontSize:"16px"}}),label:c("Edit"),onClick:xe},{key:"Delete comment",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16}),label:c("Delete"),style:{color:k.colorError},onClick:ce});let Ue=[];return Ue.push({key:"Reply to comment",icon:(0,o.jsx)(r.EmIcons,{icon:"RollbackOutlined",component:t.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:ne}),(0,o.jsxs)("div",{className:"discuss-main",children:[e.length>0&&(0,o.jsx)(t.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:je(e),renderItem:le=>(0,o.jsxs)("li",{id:le.id,children:[le.comment_status==="deleted"&&(0,o.jsx)(t.ui_kit$Comment,{className:"deletedComment",content:(0,o.jsx)(t.ui_kit$Alert,{description:c("Comment was removed."),type:"info"}),children:Ie(le.children)}),le.comment_status!=="deleted"&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Comment,{author_id:le.author_id,author:le.author_name,avatar:le.author_avatar_urls&&le.author_avatar_urls[48]||"",className:(0,He.default)(le.target_id&&"targetted-comment-item",(!le.author_avatar_urls||!le.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>P(le.id),menu:{items:le.author===he.id?Ve:Ue},styles:{root:{minWidth:"auto"}},children:(0,o.jsx)("div",{onClick:()=>le.target_id&&Se(le.target_id),dangerouslySetInnerHTML:{__html:le.content}})},"commenMenu"),datetime:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:le.date&&wo.formatDate(wo.tryParseISO(le.date),p,!0)}}),le.target_id&&(0,o.jsx)("span",{className:"comment-icon-target","target-id":le.target_id,onClick:()=>Se(le.target_id),children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,style:{color:k.colorInfo,top:-2,position:"relative"}})})]}),children:(0,o.jsxs)(o.Fragment,{children:[w==="REPLY"&&Y===le.id&&Fe,w==="EDIT"&&Y===le.id&&Ne,Ie(le.children)]})})})]})}),(0,o.jsxs)(t.ui_kit$Form,{onFinish:K,className:w==="ADD"?"addMode":"replyEditMode",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{value:_,onChange:le=>E(le.target.value),rows:4,placeholder:c("Leave your comment"),className:"textarea-comment",onPressEnter:le=>le.key==="Enter"&&le.ctrlKey&&K()})}),(0,o.jsx)(t.ui_kit$Form.Item,{children:(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:c("Add a note"),styles:{body:{maxWidth:"150px"}},children:(0,o.jsx)(t.ui_kit$Button,{onClick:ie,type:A||G&&w==="ADD"&&te!==""?"primary":"default",className:"button-target "+(A&&!G?"button-target_choose":""),style:G&&w==="ADD"&&te!==""?{background:k.colorInfo}:{},icon:(0,o.jsx)(r.EmIcons,{icon:"Target",component:t.icons$Target,size:16,strokeWidth:b.iconStrokeWidth,className:"icon-target"})})}),(0,o.jsxs)(t.ui_kit$Button,{className:"button-add",type:"primary",loading:w==="ADD"&&se.isLoading,htmlType:"submit",children:[c("Send")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:b.iconStrokeWidth})]})]})})]})]})},om=["common_styles","subject","preheader","meta"];function tm(e,i){r.writeSourceReport(e,r.fromRevision(i))}function im(e){if(!e)return null;const i=e.get().attributes??{},l={};for(const s of om)i[s]!==void 0&&(l[s]=i[s]);return{content:e.getContent(),attributes:l}}function Ba(e,i){i&&r.writeSourceReport(e,{content:i.content,attributes:i.attributes})}var Sa=(e,i)=>({key:e.id,author:e.author,date:wo.formatDate(wo.tryParseISO(e.date||e.modified),i),title:e.title,html:e.html,common_styles:e.common_styles,loading:!1,isAutosave:e.isAutosave===!0}),fr=({emailElement:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),s=r.useDispatch(),a=r.useEditorProjectId(),d=r.useEmailAttributesWriter(),c=r.useContentReplacer(),{document:p}=r.useDocumentSessionContext(),f=r.useSelector(r.selectHistoryData),x=r.useDocumentHistoryReader(),k=r.useSelector(r.selectElementHistoryHasMore),b=r.useSelector(r.selectIsPanelHistoryCollapsed),[h,T]=(0,n.useState)(!0),[_,E]=(0,n.useState)(!1),[w,v]=(0,n.useState)([]),[A,j]=(0,n.useState)([]),C=ye=>s(r.switchIsPanelHistoryCollapsed(ye)),P=(0,n.useCallback)(ye=>{if(!ye?.html)return;const re=r.fromRevision(ye);re?.attributes&&d(re.attributes),s(r.markAppearanceNeedsUpdate());const ke=p?.get().version;c(ye.html,{undoable:!0}),p&&p.get().version===ke&&p.markUnsaved()},[c,s,d,p]),Y=(0,n.useCallback)(ye=>{tm(p,ye),s(r.markAppearanceNeedsUpdate())},[p,s]),{data:z}=r.projectsApi.useGetProjectQuery(Number(a),{skip:!a}),[$,O]=(0,n.useState)([]);(0,n.useEffect)(()=>{if(z){const{owner:ye,admins:re,users:ke}=z?.members;O([ye&&{...ye},re&&Array.isArray(re)&&re.map(ae=>({...ae})),ke&&Array.isArray(ke)&&ke.map(ae=>({...ae}))].filter(ae=>ae).flat(1).map(ae=>({id:ae.ID,display_name:ae.display_name})))}},[z,z?.members,i]);const[y,oe]=(0,n.useState)(1),[G,q]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const ye=Array.isArray(f)&&f.length&&f?.map(re=>Sa(re,i));j(ye||[]),v(ye),T(!1),k||q(!0)},[f,k,i]);const te=()=>{E(!0),j(w.concat([...new Array(3)].map(()=>({loading:!0})))),x(e.id,y+1).then(ye=>{const{data:re,hasMore:ke}=ye.data,ae=Array.isArray(re)&&re?.map(he=>Sa(he,i)),Q=w.concat(ae);j(Q),v(Q),E(!1),window.dispatchEvent(new Event("resize")),ke||q(!0),oe(y+1)})},ue=!h&&!_&&!G?(0,o.jsx)("div",{style:{textAlign:"center",marginTop:24,marginBottom:24,height:32,lineHeight:"32px"},children:(0,o.jsx)(t.ui_kit$Button,{onClick:te,children:i("loading more")})}):null,[me,se]=(0,n.useState)(),[_e,ve]=(0,n.useState)(null),de=(0,n.useCallback)(ye=>{P(ye),se(null),ve(null),l({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),s(r.resetToLastActiveSettingsTab())},[P,l,s]);(0,n.useEffect)(()=>{!b&&!_e&&ve(im(p))},[b,ve,p,_e]),(0,n.useEffect)(()=>{b&&_e&&(Ba(p,_e),s(r.markAppearanceNeedsUpdate()),ve(null))},[b,_e,p,s]);const De=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse secondary-tabs_unset_scroll",size:"large",activeKey:r.HISTORY,items:[{label:(0,o.jsx)(o.Fragment,{children:i("Version history")}),key:r.HISTORY,forceRender:!0,className:"email-settings__collapse-panel",style:{height:"100%"},children:(0,o.jsx)(t.ui_kit$List,{className:"history-panel__list",loading:h,itemLayout:"horizontal",loadMore:ue,dataSource:A,header:(0,o.jsxs)("div",{className:"history-panel__list-header",children:[(0,o.jsx)("div",{className:"history-panel__list-date",children:i("Time")}),(0,o.jsx)("div",{className:"history-panel__list-author",children:i("Author")}),(0,o.jsx)("div",{className:"history-panel__restore",children:"Set"})]}),renderItem:(ye,re)=>(0,o.jsx)(t.ui_kit$List.Item,{onClick:()=>{re!==me&&(se(re),Y(w[re])),s(r.setBlockSettingsDisable(!0))},className:(0,He.default)("history-panel__item",{"history-panel__item_active":re===me}),children:(0,o.jsxs)(t.ui_kit$Skeleton,{title:!1,loading:ye.loading||!1,active:!0,children:[(0,o.jsx)("div",{className:"history-panel__list-date",children:ye.date}),(0,o.jsx)("div",{className:"history-panel__list-author",children:De.revisionService?ye.author:$.find(ke=>ke.id?.toString()===ye.author?.toString())?.display_name||"–"}),ye.isAutosave&&me!==re&&(0,o.jsx)("div",{style:{opacity:.45},className:"history-panel__list-autosave",children:i("Auto")}),!ye.isAutosave&&(0,o.jsx)(t.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",onClick:ke=>{me===re&&ke.stopPropagation(),de(w[re])},children:i("Set")}),ye.isAutosave&&me===re&&(0,o.jsx)(t.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",onClick:ke=>{me===re&&ke.stopPropagation(),de(w[re])},children:i("Set")})]})})})}]}),(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"ant-modal-close","aria-label":"Close",onClick:()=>{s(r.resetToLastActiveSettingsTab()),_e&&Ba(p,_e),ve(null),C(!0),l({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1})},children:(0,o.jsx)(r.EmIcons,{icon:"Close",component:t.icons$Close})})]})};fr.propTypes={};var Ta=async({blockTags:e,projectTagsArray:i,addTerm:l,project:s,notification:a})=>{if(!e||e.length===0)return[];const d=e.map(c=>{const p=i.find(f=>f.name===c);return p?Promise.resolve(p.id):l({project:s,kind:r.BLOCK_TAGS,name:c}).then(({error:f,data:x})=>{if(f?.status===400)return r.existingTermIdFromError(f);if(x)return x.id;if(f)return a.fromError("TAG_CREATING_ERROR",c,f),null})});return(await Promise.all(d)).filter(c=>c!=null)},Ra=()=>{document.querySelector(".blocks-search__blocks-wrapper")&&(document.querySelector(".blocks-search__blocks-wrapper").style.removeProperty("transition"),document.querySelector(".blocks-search__blocks-wrapper").style.opacity=0,document.querySelectorAll(".blocks-search__result-body").forEach(e=>e.style.removeProperty("height")),setTimeout(()=>{document.querySelectorAll(".blocks-search__result-body").forEach(e=>{e.style.height=e.offsetHeight*207/640+"px"}),document.querySelector(".blocks-search__blocks-wrapper")&&(document.querySelector(".blocks-search__blocks-wrapper").style.transition="opacity 0.2s",document.querySelectorAll(".blocks-search__blocks-wrapper").forEach(e=>e.style.opacity=1))},1500))},rm=async e=>{const{block:i,form:l,projectData:s,projectTagsArray:a,projectId:d,addBlock:c,editBlock:p,editProject:f,addTerm:x,notification:k,__:b,handleCloseModal:h,htmlContent:T,refetchBlocks:_,reloadBlockScreens:E,onGlobalBlockTemplateSynced:w}=e;try{const{valid:v,values:A,blockTags:j}=await ya({form:l,notification:k,__:b});if(!v)return;const C=await Ta({blockTags:j,projectTagsArray:a,addTerm:x,project:s,notification:k});await ja({block:i,form:l,projectId:d,htmlContent:T,values:A,tagIds:C,addBlock:c,editBlock:p,editProject:f,notification:k,refetchBlocks:_,reloadBlockScreens:E,projectTagsArray:a,__:b,handleCloseModal:h,onGlobalBlockTemplateSynced:w})}catch{}},ya=async({form:e,notification:i,__:l})=>{let s=!0;const a=await e.validateFields(),d=a.tags;return d?.length>10&&(i.error({id:"BLOCK_TOO_MANY_TAGS_ERROR",data:r.getBlockDesc(a),title:l("Maximum 10 tags available.")}),s=!1),{valid:s,values:a,blockTags:d}};function wa(e){if(e!==null&&typeof e=="object"&&"data"in e){const i=e.data;return{code:i?.code,message:i?.message}}return{}}async function lm(e){const{created:i,blockData:l,editBlock:s,onGlobalBlockTemplateSynced:a}=e;if(!i.id)return;const d=new Date,c=r.formatEmBlockVersion(d);if(s){const p=i.html??l.html??"",f=r.injectEmBlockIdIntoBlockHtml(p,String(i.id),d);f!==p&&await s({blockId:String(i.id),html:f})}a?.(String(i.id),c)}function sm(e){const{block:i,projectId:l,htmlContent:s,values:a}=e;return i?{title:i.blockTitle,project:i.projectId,html:i.htmlContent,type:i.blockType||"Other",global_block:!1}:{title:a?.title??"",project:l,html:s||"",type:a?.type||"Other",...a?.global_block===!0?{global_block:!0}:{}}}var ja=async({block:e,form:i,projectId:l,htmlContent:s,values:a,tagIds:d,addBlock:c,editBlock:p,editProject:f,notification:x,refetchBlocks:k,reloadBlockScreens:b,projectTagsArray:h,__:T,handleCloseModal:_,onGlobalBlockTemplateSynced:E})=>{const w=sm({block:e,projectId:l,htmlContent:s,values:a}),v=await c({...w,blocktags:d.join(",")});if(v.error){const P=wa(v.error);throw x.error({id:"BLOCK_CREATING_ERROR",data:{title:w.title,code:w.html},innerException:v.error,message:P.code,description:P.message}),i.resetFields(),_(),new Error("Ошибка создания блока")}const A=v.data;!e&&a?.global_block===!0&&A?.id&&await lm({created:A,blockData:w,editBlock:p,onGlobalBlockTemplateSynced:E}),e||(i.resetFields(),_());const j=h.map(P=>P.id),C=await f({projectId:l,blocktags:[...new Set([...j,...d])].join(",")});if(C.error){const P=wa(C.error);x.error({message:P.message,code:P.code})}else!e&&k&&(x.success({id:"BLOCK_CREATING_SUCCESS",data:r.getBlockDesc(v.data),message:T("The block “")+String(v.data?.title??"")+T("” was successfully created.")}),k());return!e&&b&&b(),v.data},gr=({isModalVisible:e,htmlContent:i,projectId:l,setIsShowAddAllBlocksModal:s,setIsShowAddAllBlocksModalForNewEmail:a})=>{const{__:d}=r.useI18n(),c=r.useDispatch(),[p]=t.ui_kit$Form.useForm(),[f,x]=(0,n.useState)([]),[k,b]=r.useAddBlockMutation(),[h]=r.useEditBlockMutation(),{data:T}=r.useGetBlocksSchemaQuery(),_=r.useNotification(),E=r.useAppConfig(),[w,v]=(0,n.useState)([]),A=r.useProjectData(),{refetch:j}=r.useGetBlocksQuery(r.projectBlocksArgs(l)),[C,P]=r.useAddTermMutation(),[Y,z]=r.useEditProjectMutation(),$=r.useSendPostMessage(),O=(0,n.useCallback)((te,ue)=>{$({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:te,...ue?{emBlockVersion:ue}:{}}})},[$]),{data:y}=r.useGetTermsQuery({project:A,kind:r.BLOCK_TAGS},{skip:!A?.id});(0,n.useEffect)(()=>{v((y||[]).map(te=>({value:te.name})))},[y]),(0,n.useEffect)(()=>{if(T){const te=T.schema.properties.acf.properties.type.items.enum;let ue=[];for(let me in te)ue.push({label:d(r.TYPES_TRANSLATE[te[me]]),value:te[me]});x(ue)}},[T,d]);const oe=()=>{c(r.closeModal())},G=()=>{s(!0),a(!1),oe()},q=async()=>{await rm({form:p,projectData:A,projectTagsArray:y||[],projectId:l,addBlock:k,editBlock:h,editProject:Y,addTerm:C,notification:_,__:d,handleCloseModal:oe,htmlContent:i,refetchBlocks:j,reloadBlockScreens:Ra,onGlobalBlockTemplateSynced:O})};return(0,o.jsx)(t.ui_kit$Modal,{title:(0,o.jsx)("div",{className:"ant-modal-title",children:d("Save block")}),open:e,onOk:()=>G(),onCancel:oe,footer:(0,o.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",padding:"8px 0"},children:[(0,o.jsx)(t.ui_kit$Button,{size:"large",onClick:G,children:d("Save all blocks")},"create-all-blocks"),(0,o.jsx)(t.ui_kit$Button,{className:"add-new-block-modal__save-btn",size:"large",type:"primary",loading:b.isLoading,onClick:q,icon:(0,o.jsx)(r.EmIcons,{icon:"CreateBlock",component:t.icons$CreateBlock,style:{fontSize:22}}),children:d("Save block")},"submit")]}),children:(0,o.jsxs)(t.ui_kit$Form,{form:p,layout:"vertical",name:"add_new_block_form",onFinish:q,initialValues:{title:"",type:"",tags:[],global_block:!1},autoComplete:"off",children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:16,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Block name"),name:"title",rules:[{required:!0,message:d("Please input block name")}],style:{marginBottom:15},children:(0,o.jsx)(t.ui_kit$Input,{disabled:b.isLoading||P.isLoading||z.isLoading,size:"large",placeholder:d("Enter block name"),spellCheck:"false"})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Type"),name:"type",rules:[{required:!0,message:d("Please choose block type")}],style:{marginBottom:15},children:(0,o.jsx)(t.ui_kit$Select,{disabled:b.isLoading||P.isLoading||z.isLoading,size:"large",placeholder:d("Choose block type"),options:f})})})]}),E.tagsEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Tags"),name:"tags",children:(0,o.jsx)(t.ui_kit$Select,{size:"large",mode:"tags",placeholder:d("Add some tags"),tooltip:{title:d("Tags help you find the block in the list."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},disabled:b.isLoading||P.isLoading||z.isLoading,options:w})}),E.globalBlockCheckboxEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{name:"global_block",valuePropName:"checked",style:{marginBottom:15},children:(0,o.jsx)(t.ui_kit$Switch,{label:d("Global block"),disabled:b.isLoading||P.isLoading||z.isLoading})})]})})};gr.propTypes={};var am="https://app.useblocks.io/api".replace(/\/+$/,""),nm=`${am}/wp-json/ai-generator/v1/identificate_blocks`,dm=["Menu","Header","Content","Banners","Lists","Buttons","Promocodes","Feature","Call to Action","E-Commerce","Articles","Polls","Applications","Separators","Contacts","Footer","Other"];async function cm(e){return await e.getInstance(xo.TOKEN_ID)}async function um(e,i,l,s,a){const d={blocks:s,types:dm,locale:i};l.current=d;try{const c=await cm(a),p=await fetch(nm,{method:"POST",headers:{"Content-Type":"application/json",...c?{Authorization:`Bearer ${c}`}:{}},body:JSON.stringify(d)});if(!p.ok||p.status!==200)throw new Error(`${p.statusText}`);return await p.json()}catch(c){throw c}}var mm=(e,i="block")=>{const l=new DOMParser,s=l.parseFromString(e,"text/html"),a=s.querySelectorAll(`[em="${i}"]`),d=s.querySelectorAll("link");return{parser:l,document:s,blockElements:a,styleElement:s.querySelector('[em="styles"]'),linksElements:d}};function pm(e){return Array.from(e).map(i=>i.outerHTML).join("")}var hm=(e,i="block",l=!1)=>{if(!e?.html)return[];const{document:s,blockElements:a,styleElement:d,linksElements:c}=mm(e.html,i),p=pm(c);if(!(a instanceof NodeList))return[];const f=s.querySelector("head"),x=f?f.innerHTML:"";return Array.from(a).map((k,b)=>{if(!(k instanceof Element)||!k.outerHTML)return null;const h=d?d.outerHTML:"";return{id:`${e.id}-${b}`,html:l?`<!DOCTYPE html>
|
|
18
|
+
`)}function uc(e){if(!e)return"";const i=document.createElement("textarea");return i.innerHTML=e,i.value.replace(/\u00A0/g," ").trim()}var mc=["USD","EUR","GBP","JPY","CNY","CAD","AUD","CHF","INR","BRL","MXN","KRW","RUB","UAH","KZT","PLN","TRY","SEK","NOK","DKK","CZK","ILS","AED","SGD","HKD","NZD","ZAR"];function ut(e){let i=(e??"").replace(/[\s\u00A0%]/g,"");return i=i.includes(".")?i.replace(/,/g,""):i.replace(",","."),/^\d+(\.\d+)?$/.test(i)?Number(i):null}function St(e,i=2){return String(Number(e.toFixed(i)))}function Tt(e){const i=ut(e);return i!==null&&i>0&&i<=100?i:null}function ts(e,i){const l=ut(e),s=Tt(i);return l===null||l<=0||s===null?"":St(l*s/100)}function pc(e,i){if(i?.includes("%")){const c=Tt(i);return c===null?"":St(c)}const l=ut(e),s=ut(i);if(l===null||l<=0||s===null||s<=0)return"";const a=s/l*100,d=St(s);for(const c of[0,1,2]){const p=St(a,c);if(ts(e,p)===d)return p}return St(a)}function Zt(){return{id:xo.generateUUID(),image:"",url:"",headline:"",price:"",priceCurrency:"",discountPercent:""}}function hc({discountValue:e,...i}){return{...i,discountPercent:pc(i.price,e)}}function is(e,i){return i?.length?i.map(hc):e===We.PRODUCT_CAROUSEL||e===We.SINGLE_IMAGE_PREVIEW?[Zt()]:[]}function rs(e=We.PRODUCT_CAROUSEL){return{annotationType:e,annotationLogo:"",description:"",discountCode:"",availabilityStarts:null,availabilityEnds:null,offerPageUrl:"",merchantHomepageUrl:"",cards:is(e)}}function bc(e){const i=e.annotationType||We.PRODUCT_CAROUSEL;return{annotationType:i,annotationLogo:e.logo||"",description:e.description||"",discountCode:e.discountCode||"",availabilityStarts:e.availabilityStarts?(0,Oo.default)(e.availabilityStarts):null,availabilityEnds:e.availabilityEnds?(0,Oo.default)(e.availabilityEnds):null,offerPageUrl:e.offerPageUrl||"",merchantHomepageUrl:e.merchantHomepageUrl||"",cards:is(i,e.cards)}}function ls(e){const i=e.cards||[];return{annotationType:typeof e.annotationType=="string"?e.annotationType:We.PRODUCT_CAROUSEL,logo:typeof e.annotationLogo=="string"?e.annotationLogo:"",description:typeof e.description=="string"?e.description:"",discountCode:typeof e.discountCode=="string"?e.discountCode:"",availabilityStarts:e.availabilityStarts&&Oo.default.isDayjs(e.availabilityStarts)?e.availabilityStarts.toISOString():void 0,availabilityEnds:e.availabilityEnds&&Oo.default.isDayjs(e.availabilityEnds)?e.availabilityEnds.toISOString():void 0,offerPageUrl:typeof e.offerPageUrl=="string"?e.offerPageUrl:"",merchantHomepageUrl:typeof e.merchantHomepageUrl=="string"?e.merchantHomepageUrl:"",cards:i.map(l=>({id:l.id||xo.generateUUID(),image:l.image||"",url:l.url||"",headline:l.headline||"",price:l.price||"",priceCurrency:l.priceCurrency||"",discountValue:ts(l.price,l.discountPercent)}))}}function fc(e,i){const l=e.getContent();if(!l)return!1;const s=Vd(l,i);if(!s||l.slice(s.range.start,s.range.end)===s.text)return!1;const a=l.slice(s.range.start,s.range.end);return e.mutate({changes:[new r.TextChange(s.range.start,a,s.range.start,s.text)]},{source:"user"}),!0}function gc(e,i){return e?e.emailId!==i.emailId||e.markup!==i.markup:!0}function _c(e){const i=e.getContent(),l=Hd(i);return l===i?!1:(e.mutate({changes:[new r.TextChange(0,i,0,l)]},{source:"user"}),!0)}function Hi(e){return!!e&&/^https?:\/\//i.test(e.trim())}function xc(e,i){const l=e.annotationType??We.PRODUCT_CAROUSEL,s=[];return l===We.PRODUCT_CAROUSEL||l===We.SINGLE_IMAGE_PREVIEW?(e.cards?.some(a=>!!a.image&&Hi(a.url))||s.push(i("At least one card needs an image and a link starting with https://")),e.cards?.some(a=>!!a.priceCurrency?.trim()&&!Ai(a.priceCurrency))&&s.push(i("Price currency must be a three-letter ISO 4217 code, for example USD")),s):l===We.DEAL_CARD?(e.description?.trim()||s.push(i("Discount description is required")),!Hi(e.offerPageUrl)&&!Hi(e.merchantHomepageUrl)&&s.push(i("Offer page or merchant homepage link starting with https:// is required")),s):(!e.description&&!e.discountCode&&!e.availabilityStarts&&!e.availabilityEnds&&s.push(i("Fill in at least one offer field")),s)}function kc(e,i){const l=[],s=e.filter(a=>!!a.discountPercent?.trim());return s.some(a=>Tt(a.discountPercent)===null)&&l.push(i("Discount must be a percentage greater than 0 and up to 100")),s.some(a=>{const d=ut(a.price);return Tt(a.discountPercent)!==null&&(d===null||d<=0)})&&l.push(i("Enter the price as a number to calculate the discount")),l}var{Text:Ec}=t.ui_kit$Typography,Bc=10,Sc=1,ss={width:"100%"},Tc="https://developers.google.com/workspace/gmail/promotab",To=["hover"],Rc=["annotationLogo"],as=["cards",0,"price"],yc=["cards",0,"discountPercent"],wc=["cards",0,"priceCurrency"];function go(e){return e.closest(".email-pane__collapse-wrapper")??document.body}var Do={clearIcon:(0,o.jsx)(t.ui_kit$ColorPickerClearGlyph,{})},jc={optionFilterProp:"label"};function vc(e){return{value:e||void 0}}var Ic=mc.map(e=>{const i=Zl(e);return{value:e,label:i===e?e:`${e} (${i})`}}),ns=({name:e,pricePath:i,iconStrokeWidth:l})=>{const{__:s}=r.useI18n(),a=(0,n.useMemo)(()=>[i],[i]),d=(0,n.useMemo)(()=>[({getFieldValue:c})=>({validator:async(p,f)=>{const x=typeof f=="string"?f.trim():"";if(!x)return;if(Tt(x)===null)throw new Error(s("Discount must be a percentage greater than 0 and up to 100"));const k=ut(c(i));if(k===null||k<=0)throw new Error(s("Enter the price as a number to calculate the discount"))}})],[s,i]);return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:s("Discount, %"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:e,dependencies:a,rules:d,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Percent02Icon",component:t.icons$Percent02Icon,size:16,strokeWidth:l}),placeholder:s("Discount, %"),inputMode:"decimal",allowClear:Do})})})},ds=({name:e,iconStrokeWidth:i})=>{const{__:l}=r.useI18n(),s=(0,n.useMemo)(()=>[{validator:async(a,d)=>{const c=typeof d=="string"?d.trim():"";if(c&&!Ai(c))throw new Error(l("Price currency must be a three-letter ISO 4217 code, for example USD"))}}],[l]);return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:l("Price currency"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:e,rules:s,getValueProps:vc,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:Ic,placeholder:l("Price currency"),prefix:(0,o.jsx)(r.EmIcons,{icon:"Globe02Icon",component:t.icons$Globe02Icon,size:16,strokeWidth:i}),showSearch:jc,allowClear:!0,getPopupContainer:go})})})},Cc=({onAdd:e})=>{const{__:i}=r.useI18n(),l=(0,n.useCallback)(()=>e(Zt()),[e]);return(0,o.jsx)(t.ui_kit$Button,{type:"text",block:!0,className:"selected-social-form__add-bar",icon:(0,o.jsx)(r.EmIcons,{icon:"AddSlide",component:t.icons$AddSlide}),onClick:l,children:i("Add card")})},Pc=({field:e,index:i,form:l,isSingleImagePreview:s,onRemove:a})=>{const{__:d}=r.useI18n(),c=r.useAppConfig(),p=(0,n.useMemo)(()=>[e.name,"image"],[e.name]),f=(0,n.useMemo)(()=>["cards",e.name,"image"],[e.name]),x=(0,n.useMemo)(()=>[e.name,"headline"],[e.name]),k=(0,n.useMemo)(()=>[e.name,"url"],[e.name]),b=(0,n.useMemo)(()=>[e.name,"price"],[e.name]),h=(0,n.useMemo)(()=>["cards",e.name,"price"],[e.name]),T=(0,n.useMemo)(()=>[e.name,"discountPercent"],[e.name]),_=(0,n.useMemo)(()=>[e.name,"priceCurrency"],[e.name]),E=(0,n.useMemo)(()=>[e.name,"id"],[e.name]),w=(0,n.useMemo)(()=>[{validator:async(A,j)=>{const C=typeof j=="string"?j.trim():"";if(C&&!/^https?:\/\//i.test(C))throw new Error(d("Please enter the correct URL."))}}],[d]),v=(0,n.useCallback)(()=>a(e.name),[a,e.name]);return(0,o.jsxs)("div",{className:"selected-social-form__card",children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head",children:[(0,o.jsx)(Ec,{className:"selected-social-form__card-title",children:s?d("Single image preview"):`${d("Card")} ${i+1}`}),!s&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:d("Delete"),placement:"top",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"selected-social-form__card-head-remove",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:18,strokeWidth:c.iconStrokeWidth}),"aria-label":d("Delete"),onClick:v})})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:d("Image"),placement:"top",getPopupContainer:go,children:(0,o.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,o.jsx)(No,{form:l,label:d("Image"),name:p,watchPath:f})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:d("Headline"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:x,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"ElementTitle",component:t.icons$ElementTitle,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Headline"),allowClear:Do})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:d("Link"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:k,className:"selected-social-form__card-field",rules:w,children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Link03",component:t.icons$Link03,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Enter link"),allowClear:Do})})}),!s&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:d("Price"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:b,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"CreditCard02Icon",component:t.icons$CreditCard02Icon,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Price"),allowClear:Do})})}),(0,o.jsx)(ns,{name:T,pricePath:h,iconStrokeWidth:c.iconStrokeWidth}),(0,o.jsx)(ds,{name:_,iconStrokeWidth:c.iconStrokeWidth})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:E,hidden:!0,children:(0,o.jsx)(t.ui_kit$Input,{})})]})};function cs({iconStrokeWidth:e}){const{__:i}=r.useI18n();return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:i("Discount code"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"discountCode",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Sale04Icon",component:t.icons$Sale04Icon,size:16,strokeWidth:e}),placeholder:i("Discount code"),allowClear:Do})})})}var Ac=({className:e="",isActive:i=!0,email:l})=>{const{__:s}=r.useI18n(),a=r.useAppConfig(),{document:d}=r.useDocumentSessionContext(),c=r.useNotification(),[p]=t.ui_kit$Form.useForm(),f=(0,n.useRef)(null),x=(0,n.useRef)(!1),k=(0,n.useRef)(null),[b,h]=(0,n.useState)(!1),T=t.ui_kit$Form.useWatch("annotationType",p),_=t.ui_kit$Form.useWatch("annotationLogo",p),E=t.ui_kit$Form.useWatch("description",p),w=t.ui_kit$Form.useWatch("discountCode",p),v=t.ui_kit$Form.useWatch("availabilityStarts",p),A=t.ui_kit$Form.useWatch("availabilityEnds",p),j=t.ui_kit$Form.useWatch("offerPageUrl",p),C=t.ui_kit$Form.useWatch("merchantHomepageUrl",p),P=t.ui_kit$Form.useWatch("cards",p),Y=JSON.stringify(P??[]),z=(0,n.useMemo)(()=>JSON.parse(Y)??[],[Y]),$=T||We.PRODUCT_CAROUSEL,O=$===We.PRODUCT_CAROUSEL||$===We.SINGLE_IMAGE_PREVIEW,y=$===We.DEAL_ANNOTATION||$===We.DEAL_CARD,oe=$===We.DEAL_CARD,G=$===We.DEAL_ANNOTATION,q=$===We.SINGLE_IMAGE_PREVIEW,te=$===We.SINGLE_IMAGE_PREVIEW?Sc:Bc,ue=(0,n.useMemo)(()=>[{value:We.PRODUCT_CAROUSEL,label:s("Product carousel")},{value:We.SINGLE_IMAGE_PREVIEW,label:s("Single image preview")},{value:We.DEAL_ANNOTATION,label:s("Deal Annotation")},{value:We.DEAL_CARD,label:s("Deal Card")}],[s]),me=(0,n.useMemo)(()=>{let ae="";d&&(ae=d.getContent()),!ae&&l?.html&&(ae=l.html);const Q=ae.match(/<title[^>]*>([\s\S]*?)<\/title>/i),be=Q?Q[1].trim():l?.title||l?.subject||"";return uc(be)},[d,l?.html,l?.title,l?.subject]),se=(0,n.useMemo)(()=>ls({annotationType:$,annotationLogo:_,description:E,discountCode:w,availabilityStarts:v,availabilityEnds:A,offerPageUrl:j,merchantHomepageUrl:C,cards:z}),[$,_,E,w,v,A,j,C,z]),_e=(0,n.useMemo)(()=>O?kc(z,s):[],[O,z,s]),ve=(0,n.useMemo)(()=>Pd(se)&&_e.length===0,[se,_e]),de=(0,n.useMemo)(()=>[...xc(se,s),..._e],[se,_e,s]),De=(0,n.useMemo)(()=>s("Learn more about %s").split("%s"),[s]),ye=(0,n.useCallback)(()=>{!d||!_c(d)||(p.setFieldsValue(rs($)),k.current={emailId:l?.id,markup:null},h(!1),c.success(s("Gmail annotations were removed from the template code.")))},[d,p,$,l?.id,c,s]);(0,n.useEffect)(()=>{if(!O)return;const ae=p.getFieldValue("cards")??[];if($===We.SINGLE_IMAGE_PREVIEW){if(ae.length>1){p.setFieldsValue({cards:[ae[0]]});return}ae.length===0&&p.setFieldsValue({cards:[Zt()]});return}ae.length===0&&p.setFieldsValue({cards:[Zt()]})},[p,O,$,z]);const re=(0,n.useCallback)(ae=>{if(!ae||!x.current||!d)return!1;const Q=fc(d,ls(ae));if(Q){const be=Ql(d.getContent());k.current={emailId:l?.id,markup:be},h(be!==null)}return Q},[d,l?.id]),ke=(0,n.useCallback)(()=>{re(p.getFieldsValue(!0))&&c.success(s("Gmail annotation was successfully applied to the template code."))},[re,p,c,s]);return(0,n.useEffect)(()=>{if(!i)return;const ae=cc(d?.getContent()||l?.html||""),Q={emailId:l?.id,markup:ae?Ql(ae):null};if(h(Q.markup!==null),!gc(k.current,Q))return;k.current=Q,x.current=!1;const be=ae?Ud(ae):null;p.setFieldsValue(be?bc(be):rs()),x.current=!0},[i,l?.id,l?.html,d,p]),(0,o.jsxs)("div",{className:(0,He.default)("selected-social-form","annotations-panel",e),ref:f,children:[(0,o.jsx)(dc,{data:se,subjectLine:me,parentRef:f,overlayTargetSelector:"#pane-content-iframe",onApply:ke,applyDisabled:!ve,applyBlockers:de,onRemove:b?ye:void 0,visible:i}),(0,o.jsxs)(t.ui_kit$Form,{form:p,layout:"vertical",className:"selected-social-form__form element-controls",autoComplete:"off",children:[(0,o.jsxs)("div",{className:"selected-social-form__section",children:[(0,o.jsx)("div",{className:"selected-social-form__section-title",children:s("General settings")}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:s("Annotation type"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"annotationType",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:ue,placeholder:s("Annotation type"),getPopupContainer:go})})}),!oe&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:s("Organization logo"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,o.jsx)(No,{form:p,label:s("Organization logo"),name:"annotationLogo",watchPath:Rc})})}),(q||G)&&(0,o.jsx)(cs,{iconStrokeWidth:a.iconStrokeWidth}),q&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:s("Price"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:as,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"CreditCard02Icon",component:t.icons$CreditCard02Icon,size:16,strokeWidth:a.iconStrokeWidth}),placeholder:s("Price"),allowClear:Do})})}),(0,o.jsx)(ns,{name:yc,pricePath:as,iconStrokeWidth:a.iconStrokeWidth}),(0,o.jsx)(ds,{name:wc,iconStrokeWidth:a.iconStrokeWidth})]}),y&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:s("Discount description"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"description",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"CommentOutlined",component:t.icons$CommentOutlined,size:16,strokeWidth:a.iconStrokeWidth}),placeholder:s("Discount description"),allowClear:Do})})}),oe&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(cs,{iconStrokeWidth:a.iconStrokeWidth}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:s("Offer page URL"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"offerPageUrl",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Link03",component:t.icons$Link03,size:16,strokeWidth:a.iconStrokeWidth}),placeholder:s("Offer page URL"),allowClear:Do})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:s("Merchant homepage URL"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"merchantHomepageUrl",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Link03",component:t.icons$Link03,size:16,strokeWidth:a.iconStrokeWidth}),placeholder:s("Merchant homepage URL"),allowClear:Do})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:s("Starts"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"availabilityStarts",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DatePicker,{showTime:!0,placeholder:s("Starts"),style:ss,getPopupContainer:go})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:To,title:s("Ends"),placement:"bottom",getPopupContainer:go,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"availabilityEnds",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DatePicker,{showTime:!0,placeholder:s("Ends"),style:ss,getPopupContainer:go})})})})]})]})]}),O&&(0,o.jsxs)("div",{className:(0,He.default)("selected-social-form__section",{"selected-social-form__section--bordered":!q,"annotations-panel__cards-section":q}),children:[$===We.PRODUCT_CAROUSEL&&(0,o.jsxs)("div",{className:"selected-social-form__section-title",children:[s("Promotion cards"),(0,o.jsx)("span",{className:"annotations-panel__section-hint",children:s("max 10")})]}),(0,o.jsx)(t.ui_kit$Form.List,{name:"cards",children:(ae,{add:Q,remove:be})=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"selected-social-form__items",children:ae.map((pe,ee)=>(0,o.jsx)(Pc,{field:pe,index:ee,form:p,isSingleImagePreview:q,onRemove:be},pe.key))}),!q&&z.length<te&&(0,o.jsx)(Cc,{onAdd:Q})]})})]}),(0,o.jsxs)("div",{className:"annotations-panel__docs-hint",children:[De[0],(0,o.jsx)("a",{href:Tc,target:"_blank",rel:"noopener noreferrer",children:s("Gmail annotations")}),De[1]]})]})]})},Ui=({email:e})=>{const{__:i}=r.useI18n(),l=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,[s,a]=(0,n.useState)(r.SETTINGS),d=r.useAppConfig(),c=T=>a(T||""),p=d.settingsTabEnabled,f=d.UTMEnabled&&l==="email",x=d.annotationsEnabled&&l==="email",k=[p&&"Settings",f&&"UTM parameters",x&&"Annotations parameters"].filter(Boolean),b=k.includes(s)?s:k[0],h=(0,n.useMemo)(()=>{const T=[];return p&&T.push({label:(0,o.jsx)(o.Fragment,{children:i("Settings")}),key:r.SETTINGS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)($l,{className:"email-settings__collapse-panel-content",element:e})}),f&&T.push({label:(0,o.jsx)(o.Fragment,{children:i("UTM parameters")}),key:r.UTM_PARAMETERS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(Ul,{className:"email-settings__collapse-panel-content",email:e})}),x&&T.push({label:(0,o.jsx)(o.Fragment,{children:i("Annotations")}),key:r.ANNOTATIONS_PARAMETERS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(Ac,{className:"email-settings__collapse-panel-content",email:e,isActive:b===r.ANNOTATIONS_PARAMETERS})}),T},[i,e,p,f,x,b]);return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse",size:"large",activeKey:b,onChange:c,items:h})})};Ui.propTypes={};var us=320,Nc=1200,Lc=350,{backgroundColor:ms,backgroundImage:Wi,backgroundPositionX:zi,backgroundPositionY:Gi,backgroundRepeat:ei,backgroundSize:Yi,responsive:Oc,backgroundColorContent:$c,width:Xi}={backgroundColor:"backgroundColor",backgroundImage:"backgroundImage",backgroundPositionX:"backgroundPositionX",backgroundPositionY:"backgroundPositionY",backgroundRepeat:"backgroundRepeat",backgroundSize:"backgroundSize",responsive:"responsive",backgroundColorContent:"backgroundColorContent",width:"width"},Fc={[ms]:"",[Wi]:"",[zi]:"",[Gi]:"",[ei]:"checked",[Yi]:"",[$c]:"",[Xi]:""};function Ki(e){const i=Number(e);return Number.isNaN(i)?null:{value:i,dim:"px"}}var ps=({className:e=""})=>{const{__:i}=r.useI18n(),{token:l}=(0,t.ui_kit$useToken)(),s=r.useDispatch(),a=r.useAppConfig(),[d]=t.ui_kit$Form.useForm(),c=r.useSendPostMessage(),p=r.useEmailAttribute("common_styles"),f=r.useSelector(r.selectEmailSettings),x=r.useSelector(r.selectIsSettingsDisabled$1),k=r.useSelector(r.selectActiveSettingsTab),b=r.useSelector(r.selectIsNeedUpdateAppearance),[h,T]=(0,n.useState)(!0),_=(0,n.useRef)(!1),E=(0,n.useRef)(null),w=i("Email not yet loaded or global container not found.");(0,n.useEffect)(()=>{b&&(s(r.setIsNeedUpdateAppearance(!1)),c({operation:r.EVENT_TYPES.INIT_PREVIEW}))},[d,b,s,c,p]),(0,n.useEffect)(()=>()=>{E.current&&clearTimeout(E.current)},[]);const v=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],A=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}];(0,n.useEffect)(()=>{const{width:y,...oe}=f,G={...oe,backgroundImage:f.backgroundImage?f.backgroundImage[0]?.value:"",backgroundRepeat:f[ei]===""?"repeat":f[ei],backgroundSize:f[Yi],responsive:f.responsive?.shutdown};_.current||(G.width=y?.value,G.widthDim=y?.dim),d.setFieldsValue(G),T(!f.backgroundImage)},[f,d]);const j=(0,n.useCallback)(y=>{const oe=Ki(y);!oe||oe.value<us||c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{width:oe}})},[c]),C=(0,n.useCallback)(y=>{const oe=Ki(y);oe&&s(r.setEmailSettings({...f,width:oe}))},[s,f]),P=(0,n.useCallback)(y=>{E.current&&clearTimeout(E.current),C(y),E.current=setTimeout(()=>{j(y)},Lc)},[j,C]),Y=y=>{const oe=d.getFieldsValue(!0),G=Object.keys(y)[0];switch(G){case Xi:P(y[G]);break;case zi:case Gi:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[G]:y[G]===""?"none":y[G]}});break;case Wi:T(y[G]===""),c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[G]:[{...f?.backgroundImage?.[0],type:"url",value:y[G]}],backgroundSize:"cover"}});break;case Oc:{const q=Ki(oe.width);c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{responsive:{shutdown:y[G],styles:y[G]},...q?{width:q}:{}}});break}default:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:y})}},z=y=>{s(r.setMobileViewActive({shutdown:y,styles:y})),c({operation:r.EVENT_TYPES.SANDBOX_IFRAME_SETSIZE,settings:{iframeWidth:document.querySelector(".email-pane__iframe").getBoundingClientRect().width}})},$=()=>{_.current=!0},O=()=>{E.current&&(clearTimeout(E.current),E.current=null);const y=d.getFieldValue(Xi);C(y),j(y),requestAnimationFrame(()=>{_.current=!1})};return(0,o.jsx)("div",{className:(0,He.default)("appearance-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"appearance_panel_form",initialValues:{remember:!1,...Fc},onValuesChange:Y,autoComplete:"off",className:"element-controls",children:[x?(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:"24px"},title:w,type:"error"}):null,(0,o.jsx)(t.ui_kit$FormSection,{title:i("Email layout width"),dividerTop:!1,children:(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:f.width?.value?i("This field sets the width of the email."):i("Couldn`t determine the email width"),placement:"right",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"width",style:{marginBottom:l.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$InputNumber,{min:us,max:Nc,placeholder:i("Width"),disabled:!f.width?.value,addonAfter:"px",onFocus:$,onBlur:O})})})})})}),a.emailResponsiveControlEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{gutter:20,children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"responsive",valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:"responsive",label:i("Responsive email"),size:"small",name:"responsive",disabled:f.responsive?.shutdown===void 0,onChange:z})})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:i("Email background color"),dividerTop:!a.emailResponsiveControlEnabled,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:h?16:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:ms,style:{marginBottom:l.formItemMarginBottomXS},rules:[{message:i("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:f.usedColors,disabled:x})})})}),(0,o.jsx)(t.ui_kit$Col,{span:h?12:24,children:a.formEmailFieldBackgroundImageEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(No,{form:d,label:i("Background image"),name:Wi,tooltipTitle:i("Background image"),disabled:x||k!=="Styles",elementSettings:f}),!h&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:"0"},children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Horizontal position"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:zi,style:{marginBottom:l.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:i("Horizontal position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Vertical position"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:Gi,style:{marginBottom:l.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:i("Vertical position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical})})})})})]})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background image repeat"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:ei,children:(0,o.jsx)(t.ui_kit$Select,{placeholder:i("Please select"),disabled:x,options:v})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background image size"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:Yi,children:(0,o.jsx)(t.ui_kit$Select,{placeholder:i("Please select"),disabled:x,options:A})})})})]})]})]})})]})})]})})};ps.propTypes={className:g.default.string};var{Option:hs}=t.ui_kit$Select,{width:bs,widthDim:Mc}={width:"width",widthDim:"widthDim"},Dc={[bs]:"",[Mc]:""},fs=({className:e=""})=>{const{__:i}=r.useI18n(),l=r.useSelector(r.selectBlockSettings),s=r.useSelector(r.selectIsSettingsDisabled),[a]=t.ui_kit$Form.useForm(),d=r.useSendPostMessage(),c=i("Block not yet loaded or global container not found.");(0,n.useEffect)(()=>{a.setFieldsValue({width:l.width.value,widthDim:l.width.dim})},[l,a]);const p=f=>{const x=a.getFieldsValue(!0),k=Object.keys(f)[0];let b;switch(k){case"width":b={[k]:{value:f[k],dim:x.widthDim}};break;case"widthDim":b={width:{value:x.width,dim:f[k]}};break;default:return}d({operation:r.EVENT_TYPES.SANDBOX_BLOCK_SETTINGS_SET,settings:b})};return(0,o.jsx)("div",{className:(0,He.default)("block-appearance-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:a,layout:"vertical",name:"block_appearance_panel_form",initialValues:{remember:!1,...Dc},onValuesChange:p,autoComplete:"off",children:[s?(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:"24px"},title:c,type:"error"}):null,(0,o.jsx)(t.ui_kit$Form.Item,{label:i("Container width"),name:bs,tooltip:{title:i("Specifies the block width."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},rules:[{message:i("Please input container width")}],children:(0,o.jsx)(t.ui_kit$Input,{disabled:s,placeholder:i("Container width"),addonAfter:(0,o.jsx)(t.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:(0,o.jsxs)(t.ui_kit$Select,{className:"select-after",children:[(0,o.jsx)(hs,{value:"px",children:"px"}),(0,o.jsx)(hs,{value:"%",children:"%"})]})})})})]})})};fs.propTypes={className:g.default.string};var Vc=()=>{};function gs(){const e=r.useContainer(),i=(0,n.useCallback)(s=>{if(!e)return Vc;const a=r.provideDefaultCommonStyles(e).watch(s);return()=>a.dispose()},[e]),l=(0,n.useCallback)(()=>r.getDefaultCommonStyles(e),[e]);return(0,n.useSyncExternalStore)(i,l,l)}function _s(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function qi(e,i){const l={...e};for(const s of Object.keys(i)){const a=i[s],d=e[s];_s(a)&&_s(d)?l[s]=qi(d,a):a!==void 0&&(l[s]=a)}return l}function xs(e,i){const l=r.COMMON_STYLES;if(typeof e=="string"){const s=e.trim();if(s.startsWith("{"))try{const a=JSON.parse(s);if(a&&typeof a=="object"&&!Array.isArray(a)&&Object.keys(a).length>0)return qi(l,a)}catch{}}return i&&typeof i=="object"&&!Array.isArray(i)?qi(l,i):l}var ks=e=>({textFontFamily:e.text.fontFamily,textFontSize:e.text.fontSize,textFontSizeDim:e.text.fontSizeDim,textLineHeight:e.text.lineHeight,textLineHeightDim:e.text.lineHeightDim,textColor:e.text.color,textContrastColor:e.text.contrastColor||"#FFFFFF",textAlign:e.text.textAlign,textPaddingBottom:e.text.paddingBottom,textPaddingBottomDim:e.text.paddingBottomDim,headingFontFamily:e.headings.fontFamily,headingFontSize:e.headings.fontSize,headingFontSizeDim:e.headings.fontSizeDim,headingLineHeight:e.headings.lineHeight,headingLineHeightDim:e.headings.lineHeightDim,headingColor:e.headings.color,headingContrastColor:e.headings.contrastColor||"#FFFFFF",headingAlign:e.headings.textAlign,headingPaddingTop:e.headings.paddingTop,headingPaddingTopDim:e.headings.paddingTopDim,headingPaddingBottom:e.headings.paddingBottom,headingPaddingBottomDim:e.headings.paddingBottomDim,headingLetterSpacing:e.headings.letterSpacing,headingLetterSpacingDim:e.headings.letterSpacingDim,headingBold:e.headings.bold,headingItalic:e.headings.italic,linkColor:e.links.color,linkContrastColor:e.links.contrastColor||"#FFFFFF",linkUnderline:e.links.underline,buttonsFontFamily:e.buttons.fontFamily,buttonsFontSize:e.buttons.fontSize,buttonsFontSizeDim:e.buttons.fontSizeDim,buttonsLetterSpacing:e.buttons.letterSpacing,buttonsLetterSpacingDim:e.buttons.letterSpacingDim,buttonsColor:e.buttons.color,buttonsContrastColor:e.buttons.contrastColor||"#1890ff",buttonsBold:e.buttons.bold,buttonsItalic:e.buttons.italic,buttonsBackgroundColor:e.buttons.backgroundColor,buttonsContrastBackgroundColor:e.buttons.contrastBackgroundColor||"#FFFFFF",buttonsMarginTop:e.buttons.marginTop,buttonsMarginTopDim:e.buttons.marginTopDim,buttonsMarginBottom:e.buttons.marginBottom,buttonsMarginBottomDim:e.buttons.marginBottomDim,buttonsBorder:e.buttons.border,buttonsAlign:e.buttons.textAlign,buttonsBorderRadius:e.buttons.borderRadius,buttonsPadding:e.buttons.padding,cardsContrastBackgroundColor:e.cards?.contrastBackgroundColor||"#1890ff",cardsBaseBackgroundColor:e.cards?.baseBackgroundColor||"#F8F8F8",cardsContrastTextColor:e.cards?.contrastTextColor||"#FFFFFF",cardsBaseTextColor:e.cards?.baseTextColor||"#5A5A5A",cardsBorder:e.cards?.border||{all:null,top:null,right:null,bottom:null,left:null},cardsBorderRadius:e.cards?.borderRadius||{all:10,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},blockBackgroundColor:e.block?.backgroundColor||"",blockContrastBackgroundColor:e.block?.contrastBackgroundColor||"#1890ff",blockPaddingAll:e.block?.padding?.all,blockPaddingTop:e.block?.padding?.top,blockPaddingRight:e.block?.padding?.right,blockPaddingBottom:e.block?.padding?.bottom,blockPaddingLeft:e.block?.padding?.left}),Hc={buttons_borderRadiusAll:"all",buttons_borderRadiusTopLeft:"topLeft",buttons_borderRadiusBottomLeft:"bottomLeft",buttons_borderRadiusTopRight:"topRight",buttons_borderRadiusBottomRight:"bottomRight"},Uc={cards_borderRadiusAll:"all",cards_borderRadiusTopLeft:"topLeft",cards_borderRadiusBottomLeft:"bottomLeft",cards_borderRadiusTopRight:"topRight",cards_borderRadiusBottomRight:"bottomRight"},Wc={blockPaddingTop:"top",blockPaddingLeft:"left",blockPaddingRight:"right",blockPaddingBottom:"bottom"},zc=({className:e})=>{const{__:i}=r.useI18n(),l=W.useGoogleFontsLoader(),s=r.useDispatch(),a=r.useSendPostMessage(),[d]=t.ui_kit$Form.useForm(),c=r.useSelector(r.selectEmailSettings),p=r.useSelector(r.selectIsNeedUpdateContentAppearance),f=gs(),x=r.useEmailAttribute("common_styles"),k=r.useAppConfig(),{token:b}=(0,t.ui_kit$useToken)(),[h,T]=(0,n.useState)({}),[_,E]=(0,n.useState)({}),[w,v]=(0,n.useState)(!0),[A,j]=(0,n.useState)(!0),[C,P]=(0,n.useState)(!1),[Y,z]=(0,n.useState)(!1),$={buttonsPaddingTop:"top",buttonsPaddingLeft:"left",buttonsPaddingRight:"right",buttonsPaddingBottom:"bottom"},O=xs(x,f),[y,oe]=(0,n.useState)(O.headings.bold),[G,q]=(0,n.useState)(O.headings.italic),[te,ue]=(0,n.useState)(O.links.underline),[me,se]=(0,n.useState)(O.buttons.bold),[_e,ve]=(0,n.useState)(O.buttons.italic),[de,De]=(0,n.useState)(null),ye=r.useSelector(r.selectIsPanelHistoryCollapsed);(0,n.useEffect)(()=>{ye||De(null)},[O,De,ye]),(0,n.useEffect)(()=>{ye&&!de&&De(ks(O))},[O,de,ye]),(0,n.useEffect)(()=>{p&&(s(r.setIsNeedUpdateContentAppearance(!1)),d.setFieldsValue(ks(O)))},[d,p,s,O]);const[re,ke]=(0,n.useState)(Math.min(O.headings.fontSize-1,19)),[ae,Q]=(0,n.useState)(Math.max(O.text.fontSize+1,20));(0,n.useEffect)(()=>{if(de){const J=de.buttonsBorder;T(J);const U=Object.keys(J).find(xe=>J[xe]?.width||J[xe]?.style||J[xe]?.color),X=de.cardsBorder;E(X);const ce=Object.keys(X).find(xe=>X[xe]?.width||X[xe]?.style||X[xe]?.color);d.setFieldsValue({buttons_borderPosition:U||"all",buttons_borderWidth:J[U]?.width!==null?J[U]?.width:"",buttons_borderColor:J[U]?.color||"",buttons_borderStyle:J[U]?.style||"",cards_borderPosition:ce||"all",cards_borderWidth:X[ce]?.width!==null?X[ce]?.width:"",cards_borderColor:X[ce]?.color||"",cards_borderStyle:X[ce]?.style||"",buttons_borderRadiusAll:u(de.buttonsBorderRadius.all),buttons_borderRadiusTopLeft:u(de.buttonsBorderRadius.topLeft),buttons_borderRadiusBottomLeft:u(de.buttonsBorderRadius.bottomLeft),buttons_borderRadiusTopRight:u(de.buttonsBorderRadius.topRight),buttons_borderRadiusBottomRight:u(de.buttonsBorderRadius.bottomRight),cards_borderRadiusAll:u(de.cardsBorderRadius.all),cards_borderRadiusTopLeft:u(de.cardsBorderRadius.topLeft),cards_borderRadiusBottomLeft:u(de.cardsBorderRadius.bottomLeft),cards_borderRadiusTopRight:u(de.cardsBorderRadius.topRight),cards_borderRadiusBottomRight:u(de.cardsBorderRadius.bottomRight),blockPaddingAll:u(de.blockPaddingAll),blockPaddingTop:u(de.blockPaddingTop),blockPaddingRight:u(de.blockPaddingRight),blockPaddingBottom:u(de.blockPaddingBottom),blockPaddingLeft:u(de.blockPaddingLeft),blockPaddingLeftRight:u(de.blockPaddingRight)||u(de.blockPaddingLeft),blockPaddingTopBottom:u(de.blockPaddingTop)||u(de.blockPaddingBottom)}),!u(de.blockPaddingAll)&&(u(de.blockPaddingTop)||u(de.blockPaddingRight)||u(de.blockPaddingBottom)||u(de.blockPaddingLeft))&&(de.blockPaddingTop!==de.blockPaddingBottom||de.blockPaddingRight!==de.blockPaddingLeft)?z(!1):z(!0),!u(de.buttonsBorderRadius.all)&&(u(de.buttonsBorderRadius.topLeft)||u(de.buttonsBorderRadius.bottomLeft)||u(de.buttonsBorderRadius.topRight)||u(de.buttonsBorderRadius.bottomRight))?v(!1):v(!0),de.buttonsPadding&&!u(de.buttonsPadding.all)&&(u(de.buttonsPadding.bottom)||u(de.buttonsPadding.right)||u(de.buttonsPadding.left)||u(de.buttonsPadding.top))&&P(!1),!u(de.cardsBorderRadius?.all)&&(u(de.cardsBorderRadius?.topLeft)||u(de.cardsBorderRadius?.bottomLeft)||u(de.cardsBorderRadius?.topRight)||u(de.cardsBorderRadius?.bottomRight))?j(!1):j(!0)}},[d,de]);const be=()=>{z(U=>!U);const J=d.getFieldsValue(!0);if(!Y){J.blockPaddingLeftRight=J.blockPaddingLeft,J.blockPaddingTopBottom=J.blockPaddingTop,J.blockPaddingRight=J.blockPaddingLeft,J.blockPaddingBottom=J.blockPaddingTop;const U=Number(J.blockPaddingTopBottom),X=Number(J.blockPaddingLeftRight);a({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{blockPadding:{top:Number.isFinite(U)?U:0,bottom:Number.isFinite(U)?U:0,left:Number.isFinite(X)?X:0,right:Number.isFinite(X)?X:0}}})}},pe=J=>{const U=J.target.closest("button");if(!U)return;const X=U.name,ce=U.classList.contains("selected-td-form__button--active");U.className=ce?"ant-btn ant-btn-default":"ant-btn ant-btn-default selected-td-form__button--active";try{U.blur()}catch{}X==="headingBold"?oe(!ce):X==="headingItalic"?q(!ce):X==="linkUnderline"?ue(!ce):X==="buttonsBold"?se(!ce):X==="buttonsItalic"&&ve(!ce),a({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[X]:!ce}})},ee=J=>{const U=d.getFieldsValue(!0),X=Object.keys(J)[0];let ce={};switch(X){case"headingFontSize":ke(Math.min(U.headingFontSize-1,19)),ce=J;break;case"textFontSize":Q(Math.max(U.textFontSize+1,20)),ce=J;break;case"buttons_borderStyle":ce={buttonsBorder:{[U.buttons_borderPosition]:{...h[U.buttons_borderPosition],style:J[X]}}},U.buttons_borderPosition==="all"?T(xe=>({...r.RESET_BORDER_PARAMS,[U.buttons_borderPosition]:{...xe[U.buttons_borderPosition],style:J[X]}})):T(xe=>({...xe,[U.buttons_borderPosition]:{...xe[U.buttons_borderPosition],style:J[X]}}));break;case"buttons_borderColor":ce={buttonsBorder:{[U.buttons_borderPosition]:{...h[U.buttonsBorderPosition],color:J[X]}}},U.buttons_borderPosition==="all"?T(xe=>({...r.RESET_BORDER_PARAMS,[U.buttons_borderPosition]:{...xe[U.buttons_borderPosition],color:J[X]}})):T(xe=>({...xe,[U.buttons_borderPosition]:{...xe[U.buttons_borderPosition],color:J[X]}}));break;case"buttons_borderWidth":ce={buttonsBorder:{[U.buttons_borderPosition]:{...h[U.buttons_borderPosition],width:J[X]}}},U.buttonsBorderPosition==="all"?T(xe=>({...r.RESET_BORDER_PARAMS,[U.buttons_borderPosition]:{...xe[U.buttons_borderPosition],width:J[X]}})):T(xe=>({...xe,[U.buttons_borderPosition]:{...xe[U.buttons_borderPosition],width:J[X]}}));break;case"buttons_borderPosition":d.setFieldsValue({buttons_borderWidth:h[J[X]]?.width||"",buttons_borderColor:h[J[X]]?.color||"",buttons_borderStyle:h[J[X]]?.style||""});break;case"cards_borderStyle":ce={cardsBorder:{[U.cards_borderPosition]:{..._[U.cards_borderPosition],style:J[X]}}},U.cards_borderPosition==="all"?E(xe=>({...r.RESET_BORDER_PARAMS,[U.cards_borderPosition]:{...xe[U.cards_borderPosition],style:J[X]}})):E(xe=>({...xe,[U.cards_borderPosition]:{...xe[U.cards_borderPosition],style:J[X]}}));break;case"cards_borderColor":ce={cardsBorder:{[U.cards_borderPosition]:{..._[U.cardsBorderPosition],color:J[X]}}},U.cards_borderPosition==="all"?E(xe=>({...r.RESET_BORDER_PARAMS,[U.cards_borderPosition]:{...xe[U.cards_borderPosition],color:J[X]}})):E(xe=>({...xe,[U.cards_borderPosition]:{...xe[U.cards_borderPosition],color:J[X]}}));break;case"cards_borderWidth":ce={cardsBorder:{[U.cards_borderPosition]:{..._[U.cards_borderPosition],width:J[X]}}},U.cardsBorderPosition==="all"?E(xe=>({...r.RESET_BORDER_PARAMS,[U.cards_borderPosition]:{...xe[U.cards_borderPosition],width:J[X]}})):E(xe=>({...xe,[U.cards_borderPosition]:{...xe[U.cards_borderPosition],width:J[X]}}));break;case"cards_borderPosition":d.setFieldsValue({cards_borderWidth:_[J[X]]?.width||"",cards_borderColor:_[J[X]]?.color||"",cards_borderStyle:_[J[X]]?.style||""});break;case"buttons_borderRadiusAll":case"buttons_borderRadiusTopLeft":case"buttons_borderRadiusBottomLeft":case"buttons_borderRadiusTopRight":case"buttons_borderRadiusBottomRight":ce={buttonsBorderRadius:{[Hc[X]]:+J[X]}};break;case"cards_borderRadiusAll":case"cards_borderRadiusTopLeft":case"cards_borderRadiusBottomLeft":case"cards_borderRadiusTopRight":case"cards_borderRadiusBottomRight":ce={cardsBorderRadius:{[Uc[X]]:+J[X]}};break;case"buttonsPaddingTop":case"buttonsPaddingLeft":case"buttonsPaddingRight":case"buttonsPaddingBottom":C?(ce={padding:{all:+J[X]}},d.setFieldsValue({paddingTop:J[X],paddingLeft:J[X],paddingRight:J[X],paddingBottom:J[X]})):ce={buttonsPadding:{[$[X]]:+J[X]}};break;case"blockPaddingTop":case"blockPaddingLeft":case"blockPaddingRight":case"blockPaddingBottom":ce={blockPadding:{[Wc[X]]:+J[X]}};break;case"blockPaddingTopBottom":ce={blockPadding:{top:+J[X],bottom:+J[X]}},U.blockPaddingTop=U.blockPaddingBottom=+J[X];break;case"blockPaddingLeftRight":ce={blockPadding:{left:+J[X],right:+J[X]}},U.blockPaddingLeft=U.blockPaddingRight=+J[X];break;default:ce=J}X!=="buttons_borderPosition"&&a({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:ce})};return de&&(0,o.jsx)("div",{className:(0,He.default)("appearance-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"content_appearance_panel_form",initialValues:de,onValuesChange:ee,autoComplete:"off",className:"element-controls",children:[null,(0,o.jsxs)(t.ui_kit$FormSection,{title:i("Blocks"),dividerTop:!1,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Blocks background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"blockBackgroundColor",style:{marginBottom:b.formItemMarginBottomMD+4},rules:[{message:i("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color of the contrast blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"blockContrastBackgroundColor",style:{marginBottom:b.formItemMarginBottomMD+4},rules:[{message:i("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})})]}),(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:Y,onToggleExtended:be,fieldNames:{paddingLeftRight:"blockPaddingLeftRight",paddingLeft:"blockPaddingLeft",paddingRight:"blockPaddingRight",paddingTopBottom:"blockPaddingTopBottom",paddingTop:"blockPaddingTop",paddingBottom:"blockPaddingBottom"},labels:{horizontal:i("Horizontal padding"),vertical:i("Vertical padding"),left:i("Left padding"),right:i("Right padding"),top:i("Top padding"),bottom:i("Bottom padding"),individual:i("Individual padding")},gutter:10,rowStyle:{paddingBottom:4}})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:i("General text"),dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Font of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textFontFamily",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{loadGoogleFonts:l,getPopupContainer:J=>J.closest(".email-pane__content-col")})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Font size of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textFontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:15,max:re,placeholder:i("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Line height of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textLineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Color of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrast block text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textContrastColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Text color"),usedColors:c.usedColors})})})})]}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom padding of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textPaddingBottom",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom padding"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingBottom",component:t.icons$PaddingBottom}),addonAfter:"px"})})})})})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:i("Headings"),dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading font"),placement:"left",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingFontFamily",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{loadGoogleFonts:l,getPopupContainer:J=>J.closest(".email-pane__content-col")})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingFontSize",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:ae,max:40,placeholder:i("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingLineHeight",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading letter spacing"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingLetterSpacing",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Letter spacing"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsxs)(t.ui_kit$Space,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Strong"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)({"selected-td-form__button--active":y}),type:"default",name:"headingBold",onClick:pe,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined})})}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Italic"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)({"selected-td-form__button--active":G}),type:"default",name:"headingItalic",onClick:pe,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined})})})]})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Heading color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrast block header color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingContrastColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Heading color"),usedColors:c.usedColors})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Top padding"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingPaddingTop",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Top padding"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingTop",component:t.icons$PaddingTop}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom padding"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingPaddingBottom",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom padding"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingBottom",component:t.icons$PaddingBottom}),addonAfter:"px"})})})})]})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:i("Links"),dividerTop:!0,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Link color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkColor",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Link color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Underline"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)({"selected-td-form__button--active":te}),type:"default",name:"linkUnderline",onClick:pe,children:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined})})})})]}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Link color in contrasting blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkContrastColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Link color"),usedColors:c.usedColors})})})})})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Text & background")]}),dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons font"),placement:"left",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsFontFamily",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{loadGoogleFonts:l,getPopupContainer:J=>J.closest(".email-pane__content-col")})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsFontSize",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons letter spacing"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsLetterSpacing",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Letter spacing"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsColor",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Buttons text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Button text color in contrasting blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsContrastColor",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Buttons text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsBackgroundColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Button background color in contrasting blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsContrastBackgroundColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),k.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(it,{form:d,elementSettings:{textAlign:"",type:"email"},imgParent:!1,name:"buttonsAlign",withHotKeys:!1})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsxs)(t.ui_kit$Space,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Strong"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)({"selected-td-form__button--active":me}),type:"default",name:"buttonsBold",onClick:pe,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined})})}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Italic"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,He.default)({"selected-td-form__button--active":_e}),type:"default",name:"buttonsItalic",onClick:pe,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined})})})]})})]})]}),k.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Borders")]}),dividerTop:!0,children:(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(W.SelectedElementFormBorder,{form:d,borders:h,namePrefix:"buttons_"})})}),k.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Border radius")]}),dividerTop:!0,children:(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(So,{form:d,oneBorderRadiusValue:w,setOneBorderRadiusValue:v,elementSettings:de,namePrefix:"buttons_"})})}),(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Margins")]}),dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Top margin"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsMarginTop",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Top margin"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingTop",component:t.icons$PaddingTop}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom margin"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsMarginBottom",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom margin"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingBottom",component:t.icons$PaddingBottom}),addonAfter:"px"})})})})]})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Cards")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Colors")]}),dividerTop:!0,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:i("Base colors"),compact:!0,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Base background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsBaseBackgroundColor",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Base background color"),usedColors:c.usedColors})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:i("Contrasting colors"),compact:!0,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrasting background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsContrastBackgroundColor",style:{marginBottom:b.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Contrasting background color"),usedColors:c.usedColors})})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Base text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsBaseTextColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Base text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrasting text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsContrastTextColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Contrasting text color"),usedColors:c.usedColors})})})})]})]}),k.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Cards")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Borders")]}),dividerTop:!0,children:(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(W.SelectedElementFormBorder,{form:d,borders:_,namePrefix:"cards_"})})}),k.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Cards")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Border radius")]}),dividerTop:!0,children:(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(So,{form:d,oneBorderRadiusValue:A,setOneBorderRadiusValue:j,elementSettings:de,namePrefix:"cards_"})})})]})})},Ji=({email:e})=>{const{__:i}=r.useI18n(),l=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,[s,a]=(0,n.useState)(r.APPEARANCE),d=r.useAppConfig(),c=x=>a(x||"");e.common_styles&&e.common_styles;const p=l==="email"&&d.commonStylesEnabled&&!0;let f=[{label:(0,o.jsx)(o.Fragment,{children:i(l==="email"?"Global styles":"Block styles")}),key:r.APPEARANCE,forceRender:!0,className:"email-settings__collapse-panel",children:l==="email"?(0,o.jsx)(ps,{className:"email-settings__collapse-panel-content"}):(0,o.jsx)(fs,{className:"email-settings__collapse-panel-content"})}];return p&&f.push({label:(0,o.jsx)(o.Fragment,{children:i("Content styles")}),key:"contentStyles",forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(zc,{className:"email-settings__collapse-panel-content"})}),(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse appearance-panel__content-styles",size:"large",activeKey:s,onChange:c,items:f})})};Ji.propTypes={};var Gc=to.__commonJSMin((e=>{var i=["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"].reduce((l,s)=>(l[s.toLowerCase()]=s,l),{});e.CASE_SENSITIVE_TAG_NAMES_MAP=i}));function Yc(e){return e.type===Ze.Tag||e.type===Ze.Script||e.type===Ze.Style}var Ze,Xc,Kc,qc,Jc,Qc,Zc,eu,ou,tu,Es=to.__esmMin((()=>{(function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"})(Ze||(Ze={})),Xc=Ze.Root,Kc=Ze.Text,qc=Ze.Directive,Jc=Ze.Comment,Qc=Ze.Script,Zc=Ze.Style,eu=Ze.Tag,ou=Ze.CDATA,tu=Ze.Doctype}));function Bs(e){return Yc(e)}function Ss(e){return e.type===Ze.CDATA}function Ts(e){return e.type===Ze.Text}function Rs(e){return e.type===Ze.Comment}function ys(e){return e.type===Ze.Directive}function ws(e){return e.type===Ze.Root}function iu(e){return Object.hasOwn(e,"children")}function Qi(e,i=!1){let l;if(Ts(e))l=new yt(e.data);else if(Rs(e))l=new ti(e.data);else if(Bs(e)){const s=i?Zi(e.children):[],a=new li(e.name,{...e.attribs},s);for(const d of s)d.parent=a;e.namespace!=null&&(a.namespace=e.namespace),e["x-attribsNamespace"]&&(a["x-attribsNamespace"]={...e["x-attribsNamespace"]}),e["x-attribsPrefix"]&&(a["x-attribsPrefix"]={...e["x-attribsPrefix"]}),l=a}else if(Ss(e)){const s=i?Zi(e.children):[],a=new ri(s);for(const d of s)d.parent=a;l=a}else if(ws(e)){const s=i?Zi(e.children):[],a=new jt(s);for(const d of s)d.parent=a;e["x-mode"]&&(a["x-mode"]=e["x-mode"]),l=a}else if(ys(e)){const s=new ii(e.name,e.data);e["x-name"]!=null&&(s["x-name"]=e["x-name"],s["x-publicId"]=e["x-publicId"],s["x-systemId"]=e["x-systemId"]),l=s}else throw new Error(`Not implemented yet: ${e.type}`);return l.startIndex=e.startIndex,l.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(l.sourceCodeLocation=e.sourceCodeLocation),l}function Zi(e){const i=e.map(l=>Qi(l,!0));for(let l=1;l<i.length;l++)i[l].prev=i[l-1],i[l-1].next=i[l];return i}var oi,Rt,yt,ti,ii,wt,ri,jt,li,js=to.__esmMin((()=>{Es(),oi=class{parent=null;prev=null;next=null;startIndex=null;endIndex=null;get parentNode(){return this.parent}set parentNode(e){this.parent=e}get previousSibling(){return this.prev}set previousSibling(e){this.prev=e}get nextSibling(){return this.next}set nextSibling(e){this.next=e}cloneNode(e=!1){return Qi(this,e)}},Rt=class extends oi{data;constructor(e){super(),this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}},yt=class extends Rt{type=Ze.Text;get nodeType(){return 3}},ti=class extends Rt{type=Ze.Comment;get nodeType(){return 8}},ii=class extends Rt{type=Ze.Directive;name;constructor(e,i){super(i),this.name=e}get nodeType(){return 1}"x-name";"x-publicId";"x-systemId"},wt=class extends oi{children;constructor(e){super(),this.children=e}get firstChild(){return this.children[0]??null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(e){this.children=e}},ri=class extends wt{type=Ze.CDATA;get nodeType(){return 4}},jt=class extends wt{type=Ze.Root;get nodeType(){return 9}},li=class extends wt{name;attribs;type;constructor(e,i,l=[],s=e==="script"?Ze.Script:e==="style"?Ze.Style:Ze.Tag){super(l),this.name=e,this.attribs=i,this.type=s}get nodeType(){return 1}get tagName(){return this.name}set tagName(e){this.name=e}get attributes(){return Object.keys(this.attribs).map(e=>({name:e,value:this.attribs[e],namespace:this["x-attribsNamespace"]?.[e],prefix:this["x-attribsPrefix"]?.[e]}))}namespace;"x-attribsNamespace";"x-attribsPrefix"}})),er=to.__exportAll({CDATA:()=>ri,Comment:()=>ti,DataNode:()=>Rt,Document:()=>jt,DomHandler:()=>tr,Element:()=>li,Node:()=>oi,NodeWithChildren:()=>wt,ProcessingInstruction:()=>ii,Text:()=>yt,cloneNode:()=>Qi,default:()=>tr,hasChildren:()=>iu,isCDATA:()=>Ss,isComment:()=>Rs,isDirective:()=>ys,isDocument:()=>ws,isTag:()=>Bs,isText:()=>Ts}),or,tr,ir=to.__esmMin((()=>{Es(),js(),js(),or={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},tr=class{dom=[];root=new jt(this.dom);callback;options;elementCB;done=!1;tagStack=[this.root];lastNode=null;parser=null;constructor(e,i,l){typeof i=="function"&&(l=i,i=or),typeof e=="object"&&(i=e,e=void 0),this.callback=e??null,this.options=i??or,this.elementCB=l??null}onparserinit(e){this.parser=e}onreset(){this.dom=[],this.root=new jt(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null}onend(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))}onerror(e){this.handleCallback(e)}onclosetag(){this.lastNode=null;const e=this.tagStack.pop();this.options.withEndIndices&&this.parser&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)}onopentag(e,i){const l=this.options.xmlMode?Ze.Tag:void 0,s=new li(e,i,void 0,l);this.addNode(s),this.tagStack.push(s)}ontext(e){const{lastNode:i}=this;if(i&&i.type===Ze.Text)i.data+=e,this.options.withEndIndices&&this.parser&&(i.endIndex=this.parser.endIndex);else{const l=new yt(e);this.addNode(l),this.lastNode=l}}oncomment(e){if(this.lastNode&&this.lastNode.type===Ze.Comment){this.lastNode.data+=e;return}const i=new ti(e);this.addNode(i),this.lastNode=i}oncommentend(){this.lastNode=null}oncdatastart(){const e=new yt(""),i=new ri([e]);this.addNode(i),e.parent=i,this.lastNode=e}oncdataend(){this.lastNode=null}onprocessinginstruction(e,i){const l=new ii(e,i);this.addNode(l)}handleCallback(e){if(typeof this.callback=="function")this.callback(e,this.dom);else if(e)throw e}addNode(e){const i=this.tagStack[this.tagStack.length-1],l=i.children[i.children.length-1];this.options.withStartIndices&&this.parser&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&this.parser&&(e.endIndex=this.parser.endIndex),i.children.push(e),l&&(e.prev=l,l.next=e),e.parent=i,this.lastNode=null}}})),vs=to.__commonJSMin((e=>{var i=Gc(),l=(ir(),to.__toCommonJS(er)),s="\r",a=new RegExp(s,"g"),d=`__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_${Date.now().toString()}__`,c=new RegExp(d,"g");function p(_){return i.CASE_SENSITIVE_TAG_NAMES_MAP[_]}function f(_){const E={};let w=0;const v=_.length;for(;w<v;w++){const A=_[w];E[A.name]=A.value}return E}function x(_){_=_.toLowerCase();const E=p(_);return E||_}function k(_,E){const w="<"+E,v=_.toLowerCase().indexOf(w);if(v===-1)return!1;const A=_[v+w.length];return A===">"||A===" "||A===" "||A===`
|
|
19
|
+
`||A==="\r"||A==="/"}function b(_){return _.replace(a,d)}function h(_){return _.replace(c,s)}function T(_,E=null,w){const v=[];let A,j=0;const C=_.length;for(;j<C;j++){const P=_[j];switch(P.nodeType){case 1:{const z=x(P.nodeName);A=new l.Element(z,f(P.attributes)),A.children=T(z==="template"?P.content.childNodes:P.childNodes,A);break}case 3:A=new l.Text(h(P.nodeValue??""));break;case 8:A=new l.Comment(P.nodeValue??"");break;default:continue}const Y=v[j-1]??null;Y&&(Y.next=A),A.parent=E,A.prev=Y,A.next=null,v.push(A)}return w&&(A=new l.ProcessingInstruction(w.substring(0,w.indexOf(" ")).toLowerCase(),w),A.next=v[0]??null,A.parent=E,v.unshift(A),v[1]&&(v[1].prev=v[0])),v}e.escapeSpecialCharacters=b,e.formatDOM=T,e.hasOpenTag=k})),ru=to.__commonJSMin((e=>{var i=vs(),l="html",s="head",a="body",d=/<([a-zA-Z]+[0-9]?)/;function c(_,E){return E?E.createHTML(_):_}var p=(_,E,w)=>{throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},f=(_,E,w)=>{throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},x=typeof window=="object"&&window.DOMParser;if(typeof x=="function"){const _=new x,E="text/html";f=(w,v,A)=>(v&&(w=`<${v}>${w}</${v}>`),_.parseFromString(w,E)),p=f}if(typeof document=="object"&&document.implementation){const _=document.implementation.createHTMLDocument();p=function(E,w,v){if(w){const A=_.documentElement.querySelector(w);return A&&(A.innerHTML=c(E,v)),_}return _.documentElement.innerHTML=c(E,v),_}}var k=typeof document=="object"&&document.createElement("template"),b;k&&k.content&&(b=(_,E)=>(k.innerHTML=c(_,E),k.content.childNodes));var h=()=>document.createDocumentFragment().childNodes;function T(_,E){_=i.escapeSpecialCharacters(_);const w=d.exec(_)?.[1]?.toLowerCase();switch(w){case l:{const v=f(_);if(!i.hasOpenTag(_,s)){const A=v.querySelector(s);A?.parentNode?.removeChild(A)}if(!i.hasOpenTag(_,a)){const A=v.querySelector(a);A?.parentNode?.removeChild(A)}return v.querySelectorAll(l)}case s:case a:{const v=p(_,void 0,E).querySelectorAll(w);return i.hasOpenTag(_,a)&&i.hasOpenTag(_,s)?v[0].parentNode?.childNodes??h():v}default:return b?b(_,E):p(_,a,E).querySelector(a)?.childNodes??h()}}e.default=T})),lu=to.__commonJSMin((e=>{Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var i=vs(),l=ru(),s=/<(![a-zA-Z\s]+)>/;function a(d,c){if(typeof d!="string")throw new TypeError("First argument must be a string");if(!d)return[];const p=s.exec(d),f=p?p[1]:void 0;return i.formatDOM(l.default(d,c?.trustedTypePolicy),null,f)}e.default=a})),su=to.__commonJSMin((e=>{var i=0;e.SAME=i;var l=1;e.CAMELCASE=l,e.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1}})),au=to.__commonJSMin((e=>{var i=0,l=1,s=2,a=3,d=4,c=5,p=6;function f(j){return k.hasOwnProperty(j)?k[j]:null}function x(j,C,P,Y,z,$,O){this.acceptsBooleans=C===s||C===a||C===d,this.attributeName=Y,this.attributeNamespace=z,this.mustUseProperty=P,this.propertyName=j,this.type=C,this.sanitizeURL=$,this.removeEmptyString=O}var k={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(j=>{k[j]=new x(j,i,!1,j,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([j,C])=>{k[j]=new x(j,l,!1,C,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(j=>{k[j]=new x(j,s,!1,j.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(j=>{k[j]=new x(j,s,!1,j,null,!1,!1)}),["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach(j=>{k[j]=new x(j,a,!1,j.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(j=>{k[j]=new x(j,a,!0,j,null,!1,!1)}),["capture","download"].forEach(j=>{k[j]=new x(j,d,!1,j,null,!1,!1)}),["cols","rows","size","span"].forEach(j=>{k[j]=new x(j,p,!1,j,null,!1,!1)}),["rowSpan","start"].forEach(j=>{k[j]=new x(j,c,!1,j.toLowerCase(),null,!1,!1)});var b=/[\-\:]([a-z])/g,h=j=>j[1].toUpperCase();["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach(j=>{const C=j.replace(b,h);k[C]=new x(C,l,!1,j,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(j=>{const C=j.replace(b,h);k[C]=new x(C,l,!1,j,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(j=>{const C=j.replace(b,h);k[C]=new x(C,l,!1,j,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(j=>{k[j]=new x(j,l,!1,j.toLowerCase(),null,!1,!1)});var T="xlinkHref";k[T]=new x("xlinkHref",l,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(j=>{k[j]=new x(j,l,!1,j.toLowerCase(),null,!0,!0)});var{CAMELCASE:_,SAME:E,possibleStandardNames:w}=su(),v=RegExp.prototype.test.bind(new RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$")),A=Object.keys(w).reduce((j,C)=>{const P=w[C];return P===E?j[C]=C:P===_?j[C.toLowerCase()]=C:j[C]=P,j},{});e.BOOLEAN=a,e.BOOLEANISH_STRING=s,e.NUMERIC=c,e.OVERLOADED_BOOLEAN=d,e.POSITIVE_NUMERIC=p,e.RESERVED=i,e.STRING=l,e.getPropertyInfo=f,e.isCustomAttribute=v,e.possibleStandardNames=A}));function nu(e,i){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];i=i||{};var l=1,s=1;function a(_){var E=_.match(Cs);E&&(l+=E.length);var w=_.lastIndexOf(Fs);s=~w?_.length-w:s+_.length}function d(){var _={line:l,column:s};return function(E){return E.position=new c(_),x(),E}}function c(_){this.start=_,this.end={line:l,column:s},this.source=i.source}c.prototype.content=e;function p(_){var E=new Error(i.source+":"+l+":"+s+": "+_);if(E.reason=_,E.filename=i.source,E.line=l,E.column=s,E.source=e,!i.silent)throw E}function f(_){var E=_.exec(e);if(E){var w=E[0];return a(w),e=e.slice(w.length),E}}function x(){f(Ps)}function k(_){var E;for(_=_||[];E=b();)E!==!1&&_.push(E);return _}function b(){var _=d();if(!(lr!=e.charAt(0)||sr!=e.charAt(1))){for(var E=2;Ko!=e.charAt(E)&&(sr!=e.charAt(E)||lr!=e.charAt(E+1));)++E;if(E+=2,Ko===e.charAt(E-1))return p("End of comment missing");var w=e.slice(2,E-2);return s+=2,a(w),e=e.slice(E),s+=2,_({type:Ms,comment:w})}}function h(){var _=d(),E=f(As);if(E){if(b(),!f(Ns))return p("property missing ':'");var w=f(Ls),v=_({type:Ds,property:Is(E[0].replace(rr,Ko)),value:w?Is(w[0].replace(rr,Ko)):Ko});return f(Os),v}}function T(){var _=[];k(_);for(var E;E=h();)E!==!1&&(_.push(E),k(_));return _}return x(),T()}function Is(e){return e?e.replace($s,Ko):Ko}var rr,Cs,Ps,As,Ns,Ls,Os,$s,Fs,lr,sr,Ko,Ms,Ds,du=to.__esmMin((()=>{rr=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Cs=/\n/g,Ps=/^\s*/,As=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Ns=/^:\s*/,Ls=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Os=/^[;\s]*/,$s=/^\s+|\s+$/g,Fs=`
|
|
20
|
+
`,lr="/",sr="*",Ko="",Ms="comment",Ds="declaration"}));function cu(e,i){let l=null;if(!e||typeof e!="string")return l;const s=nu(e),a=typeof i=="function";return s.forEach(d=>{if(d.type!=="declaration")return;const{property:c,value:p}=d;a?i(c,p,d):p&&(l=l??{},l[c]=p)}),l}var uu=to.__esmMin((()=>{du()})),mu=to.__exportAll({default:()=>pu});function pu(e,i){const l={};return!e||typeof e!="string"||cu(e,(s,a)=>{s&&a&&(l[Xs(s,i)]=a)}),l}var Vs,Hs,Us,Ws,zs,Gs,Ys,ar,Xs,hu=to.__esmMin((()=>{uu(),Vs=/^--[a-zA-Z0-9_-]+$/,Hs=/-([a-z])/g,Us=/^[^-]+$/,Ws=/^-(webkit|moz|ms|o|khtml)-/,zs=/^-(ms)-/,Gs=e=>!e||Us.test(e)||Vs.test(e),Ys=(e,i)=>i.toUpperCase(),ar=(e,i)=>`${i}-`,Xs=(e,i={})=>Gs(e)?e:(e=e.toLowerCase(),i.reactCompat?e=e.replace(zs,ar):e=e.replace(Ws,ar),e.replace(Hs,Ys))})),Ks=to.__commonJSMin((e=>{var i=e&&e.__importDefault||function(k){return k&&k.__esModule?k:{default:k}};Object.defineProperty(e,"__esModule",{value:!0}),e.returnFirstArg=e.canTextBeChildOfNode=e.ELEMENTS_WITH_NO_TEXT_CHILDREN=e.PRESERVE_CUSTOM_ATTRIBUTES=void 0,e.isCustomComponent=d,e.setStyleProp=p;var l=fo("react"),s=i((hu(),to.__toCommonJS(mu))),a=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function d(k,b){return k.includes("-")?!a.has(k):!!(b&&typeof b.is=="string")}var c={reactCompat:!0};function p(k,b){if(typeof k=="string"){if(!k.trim()){b.style={};return}try{b.style=(0,s.default)(k,c)}catch{b.style={}}}}e.PRESERVE_CUSTOM_ATTRIBUTES=Number(l.version.split(".")[0])>=16,e.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var f=k=>!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(k.name);e.canTextBeChildOfNode=f;var x=k=>k;e.returnFirstArg=x})),qs=to.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var i=au(),l=Ks(),s=["checked","value"],a=["input","select","textarea"],d={reset:!0,submit:!0};function c(f={},x){const k={},b=!!(f.type&&d[f.type]);for(const h in f){const T=f[h];if((0,i.isCustomAttribute)(h)){k[h]=T;continue}const _=h.toLowerCase();let E=p(_);if(E){const w=(0,i.getPropertyInfo)(E);switch(s.includes(E)&&a.includes(x)&&!b&&(E=p("default"+_)),k[E]=T,w?.type){case i.BOOLEAN:k[E]=!0;break;case i.OVERLOADED_BOOLEAN:T===""&&(k[E]=!0)}continue}l.PRESERVE_CUSTOM_ATTRIBUTES&&(k[h]=T)}return(0,l.setStyleProp)(f.style,k),k}function p(f){return i.possibleStandardNames[f]}})),bu=to.__commonJSMin((e=>{var i=e&&e.__importDefault||function(k){return k&&k.__esModule?k:{default:k}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=p;var l=(ir(),to.__toCommonJS(er)),s=fo("react"),a=i(qs()),d=Ks(),c={cloneElement:s.cloneElement,createElement:s.createElement,isValidElement:s.isValidElement};function p(k,b={}){var h,T,_,E,w;const v=[],A=typeof b.replace=="function",j=(h=b.transform)!==null&&h!==void 0?h:d.returnFirstArg,{cloneElement:C,createElement:P,isValidElement:Y}=(T=b.library)!==null&&T!==void 0?T:c,z=k.length;f(k);for(let $=0;$<z;$++){const O=k[$];if(A){let q=(_=b.replace)===null||_===void 0?void 0:_.call(b,O,$);if(Y(q)){z>1&&(q=C(q,{key:(E=q.key)!==null&&E!==void 0?E:$})),v.push(j(q,O,$));continue}}if(O.type==="text"){const q=!O.data.trim().length;if(q&&O.parent&&!(0,d.canTextBeChildOfNode)(O.parent)||b.trim&&q)continue;v.push(j(O.data,O,$));continue}const y=O;let oe={};x(y)?((0,d.setStyleProp)(y.attribs.style,y.attribs),oe=y.attribs):y.attribs&&(oe=(0,a.default)(y.attribs,y.name));let G;switch(O.type){case"script":case"style":O.children[0]&&(oe.dangerouslySetInnerHTML={__html:O.children[0].data});break;case"tag":O.name==="textarea"&&O.children[0]?oe.defaultValue=O.children[0].data:!((w=O.children)===null||w===void 0)&&w.length&&(G=p(O.children,b));break;default:continue}z>1&&(oe.key=$),v.push(j(P(O.name,oe,G),O,$))}return v.length===1?v[0]:v}function f(k){for(const b of k)(b.type==="tag"||b.type==="script"||b.type==="style")&&(Object.setPrototypeOf(b,l.Element.prototype),f(b.children))}function x(k){return d.PRESERVE_CUSTOM_ATTRIBUTES&&k.type==="tag"&&(0,d.isCustomComponent)(k.name,k.attribs)}})),fu=to.__commonJSMin((e=>{var i=e&&e.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(e,"__esModule",{value:!0}),e.htmlToDOM=e.domToReact=e.attributesToProps=e.Text=e.ProcessingInstruction=e.Element=e.Comment=void 0,e.default=p;var l=i(lu());e.htmlToDOM=l.default;var s=i(qs());e.attributesToProps=s.default;var a=i(bu());e.domToReact=a.default;var d=(ir(),to.__toCommonJS(er));Object.defineProperty(e,"Comment",{enumerable:!0,get:function(){return d.Comment}}),Object.defineProperty(e,"Element",{enumerable:!0,get:function(){return d.Element}}),Object.defineProperty(e,"ProcessingInstruction",{enumerable:!0,get:function(){return d.ProcessingInstruction}}),Object.defineProperty(e,"Text",{enumerable:!0,get:function(){return d.Text}});var c={lowerCaseAttributeNames:!1};function p(f,x){var k;if(typeof f!="string")throw new TypeError("First argument must be a string");if(!f)return[];const b=Object.assign(Object.assign({},(k=x?.htmlparser2)!==null&&k!==void 0?k:c),{trustedTypePolicy:x?.trustedTypePolicy});return(0,a.default)((0,l.default)(f,b),x)}})),mt=to.__toESM(fu(),1),gu=mt.default.default||mt.default,_u={subject:"insert_generated_subject",preheader:"insert_generated_preheader"};function Js(e,i,l){l.document&&(r.writeEmailAttributes(l.document,{[e]:i}),l.pushToDataLayer({event:"submit",action:_u[e],entity_type:l.entityType,entity_id:l.entityId,project_id:l.projectId,context:"editor"}))}function nr({limitsInPlugin:e,hostedAiActive:i}){return e&&!i}function Qs({limitsInPlugin:e,hostedAiActive:i,counter:l,limit:s}){return nr({limitsInPlugin:e,hostedAiActive:i})?s>0&&l>=s:!1}function Zs(e,i){if(!i||typeof e!="string")return i||e;const l=i.trim();if(!l)return e;if(/^\s*<!DOCTYPE/i.test(l)||/^\s*<\s*html[\s>]/i.test(l))return i;try{const s=new DOMParser().parseFromString(e,"text/html"),a=s.querySelector("editor");if(a){a.innerHTML=i;const d=e.match(/^[\s\uFEFF]*<!DOCTYPE[^>]*>/i);return`${d?`${d[0]}
|
|
21
|
+
`:""}${s.documentElement.outerHTML}`}}catch{}return i}var xu=e=>{const{__:i}=r.useI18n();return[{key:"📧",label:(0,o.jsxs)("div",{onClick:()=>{e("theme-and-preheader-generator")},children:["📧 ",i("Subject line & preheader generator")]})},{key:"🌎",label:(0,o.jsxs)("div",{onClick:()=>{e("translator")},children:["🌎 ",i("Translator")]})},{key:"📄",label:(0,o.jsxs)("div",{onClick:()=>{e("writer")},children:["📄 ",i("Copywriter")]})},{key:"🔎",label:(0,o.jsxs)("div",{onClick:()=>{e("corrector")},children:["🔎 ",i("Proofreader")]})},{key:"🧠",label:(0,o.jsxs)("div",{onClick:()=>{e("psychologist")},children:["🧠 ",i("Psychologist")]})},{key:"📈",label:(0,o.jsxs)("div",{onClick:()=>{e("marketolog")},children:["📈 ",i("Marketer")]})},{key:"✨",label:(0,o.jsxs)("div",{onClick:()=>{e("email-generator")},children:["✨ ",i("Email generator")]})}]},ku={background:r.emCssVar("colorInfo"),color:"#ffffff"},ea=({messages:e,newEmailAiGeneratorRef:i})=>{const l=r.useElementEntityKind(),{document:s}=r.useDocumentSessionContext(),a=r.useContentReader(),d=r.useContentReplacer(),{__:c,_n:p}=r.useI18n(),f=r.useDispatch(),x=r.useAppNavigate(),k=(0,n.useRef)(null),b=r.useAppConfig(),h=r.useNotification(),T=r.useEditorProjectId(),_=r.useOpenEmailId(),E=r.usePushToDataLayer(),w={document:s,pushToDataLayer:E,entityType:l==="block"?"block":"email",entityId:_,projectId:T},v=r.useEventEmitter(xo.events.ON_LIMIT_ID),[A,j]=(0,n.useState)(null),[C,P]=(0,n.useState)(0),[Y,z]=(0,n.useState)(!1),[$,O]=(0,n.useState)(""),[y,oe]=(0,n.useState)([]),[G,q]=(0,n.useState)(!1),[te,ue]=(0,n.useState)(!1),[me,se]=(0,n.useState)(null),[_e,ve]=(0,n.useState)(0),[de,De]=(0,n.useState)(null),ye=r.useEmailAttribute("subject"),re=r.useEmailAttribute("preheader"),ke=r.useCurrentUser(),ae=r.toLanguageCode(r.useInterfaceLocale()),Q=ke.avatar_url||ke.avatar_urls?.[24],be=[ke.first_name,ke.last_name].filter(Boolean).join(" ")||ke.username,pe=r.useMessageService(),[ee]=r.useLazyGetDialogQuery(),J=r.useSendPostMessage(),[U,X]=r.useSendMessageMutation(),[ce,{reset:xe}]=r.useGetAiGenerateStatusMutation(),[ne,{data:Ae=[]}]=r.useLazyGetGeneratedContentQuery(),[we]=r.useLazyGetLimitsStatsByTypeQuery(),$e={cursor:Y?"not-allowed":"default",pointerEvents:Y?"none":"auto"};(0,n.useEffect)(()=>{de&&G&&(i.current=!0),G||(i.current=!1)},[de,G]);const K=!!(b.limits&&b.counters)&&!0,{limits:ie}=b.limits?b:{limits:{ai_limit:0,ai_generator_limit:0}},{ai_limit:je,ai_generator_limit:V}=ie,Se=r.useEventEmitter(xo.events.AI_TEXT_REQUEST_ID).hasListeners(),Ie=nr({limitsInPlugin:K,hostedAiActive:Se}),Ne=Qs({limitsInPlugin:K,hostedAiActive:Se,counter:C,limit:je}),Fe=Qs({limitsInPlugin:K,hostedAiActive:Se,counter:_e,limit:V}),Ve=(0,n.useCallback)(()=>{v.fire({name:"AiChatCount",count:C+1})},[v,C]),Ue=(0,n.useCallback)(()=>{v.fire({name:"AiGeneratorCount",count:_e+1})},[v,_e]),le=(0,n.useCallback)(async B=>!0,[c,we,h]);(0,n.useEffect)(()=>{K&&(P(b?.counters?.ai_counter||0),ve(b?.counters?.ai_generator_counter||0))},[b,K]),(0,n.useEffect)(()=>{De(y.length<=0?!1:y.toReversed().find(S=>S.data?.context)?.data.context==="email-generator")},[y]);const Te=(0,n.useCallback)(async()=>await pe.sendAsync(r.EVENT_TYPES.SANDBOX_IS_EMAIL_EMPTY),[pe]),I=(0,n.useCallback)(()=>{const B=k.current?.closest(".ant-tabs-content.ant-tabs-content-top");setTimeout(()=>{B?.scrollTo({top:B.scrollHeight,behavior:"smooth"})},0)},[k]),Z=(0,n.useCallback)(()=>{r.swallowPromiseRejection(ee({entity_id:_}).then(B=>{oe(B.data.documents),I()}))},[_,ee,oe,I]),Be=(0,n.useCallback)(B=>{if(!B?.data?._eventResult)return!1;const{aiMessage:S,aiHtml:m}=B.data;if(oe(M=>{const H=[...M];for(let Re=H.length-1;Re>=0;Re--)if(H[Re]?.data?.isLoading&&H[Re]?.data?.role==="assistant"){H[Re]={data:{role:"assistant",message:S,isLoading:!1}};break}return H}),m){const M=Zs(a(),String(m));d(M,{undoable:!0})}return I(),!0},[a,d,I]),Ce=(0,n.useCallback)(B=>{oe(S=>{for(let m=S.length-1;m>=0;m--)if(S[m]?.data?.isLoading&&S[m]?.data?.role==="assistant"){const M=[...S];return B?M[m]={data:{role:"assistant",message:B}}:M.splice(m,1),M}return S})},[]),Me=(0,n.useCallback)(B=>{const S=B?.message==="ERROR"?void 0:B?.message;return[B?.data?.message,S].find(m=>typeof m=="string"&&m)||c("Something went wrong.")},[c]),Ge=r.useEventEmitter(xo.events.AI_TEXT_PROGRESS_ID);(0,n.useEffect)(()=>{const B=Ge.event(({progress:S,status:m})=>{const M=m||`${Math.round(S)}%`;oe(H=>{const Re=[...H];for(let fe=Re.length-1;fe>=0;fe--)if(Re[fe]?.data?.isLoading&&Re[fe]?.data?.role==="assistant"){Re[fe]={data:{...Re[fe].data,message:M}};break}return Re})});return()=>B.dispose()},[Ge]);const Ye=r.useEventEmitter(xo.events.AI_TEXT_STREAM_ID);(0,n.useEffect)(()=>{const B=Ye.event(({partialHtml:S})=>{const m=Zs(a(),String(S));d(m,{undoable:!0})});return()=>B.dispose()},[Ye,a,d,f]);const D=(0,n.useCallback)(B=>{q(!0),z(!0),r.swallowPromiseRejection(ce({task_id:B||A,entity_id:_,status:"started"}).then(()=>{Z()}))},[_,ce,A,Z]),L=(0,n.useCallback)(()=>{ce({task_id:A,entity_id:_,status:"completed"}).then(B=>{B.data.status===403&&xe(),Z()}).catch(B=>{}),z(!1),q(!1)},[_,ce,A,Z,xe]);(0,n.useEffect)(()=>{let B;if(G){const S=Ae[Ae.length-1]?.processing?.email;if(S){let m=Ae[Ae.length-1].status;d(String(S),{undoable:!0}),m===0&&L()}me&&(clearInterval(B),q(!1),se(!1))}return()=>{clearInterval(B)}},[d,me,f,Ae,G,ye,re,_,A,Z,ce,X,L]),(0,n.useEffect)(I,[I]),(0,n.useEffect)(()=>{e?.length>0&&oe(e),J({operation:r.EVENT_TYPES.SANDBOX_EMAIL_CONTENT_GET})},[e,J]),(0,n.useEffect)(()=>{const B=pe.onInit(()=>{pe.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:Y}),pe.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_DISCUSS,value:Y})});return()=>B.dispose()},[Y,pe]);const R=async()=>{if($){const B=$.replaceAll(/\n/g,"<br>"),S={project_id:T,connection:"chat",entity_id:_,message:B,locale:ae,subject:ye||"",preheader:re||"",textContent:di.extractDocumentTextContent(a())};if(de&&Fe||Ne){h.error({title:c(de?"You have reached the limit of AI generator usage.":"You have reached the limit of AI chat usage."),description:c("Please upgrade your plan.")});const m={data:{role:"assistant",message:c(de?"You have reached the limit of AI generator usage.":"You have reached the limit of AI chat usage.")}};oe(M=>[...M,m])}else{if(!await le(de?"email_generate":"ai")){O("");return}Ie&&(de&&_e!==V?(Ue(),ve(M=>M+1)):C!==je&&(Ve(),P(M=>M+1))),E({event:"submit_form",action:"chat_whit_ai_assistant",entity_id:S.entity_id,project_id:S.project_id});const m=[{data:{role:"user",message:B,userInfo:{display_name:be,avatar_url:Q}}},{data:{role:"assistant",message:c("Typing..."),isLoading:!0}}];oe(M=>[...M,...m]),U({body:S}).then(M=>{if(M?.error)throw M.error;if(!M?.data||M.data.status===401)throw new Error(r.ERROR);if(!Be(M)){if(E({event:"submit",action:"send_discussion_chat_message",entity_type:l==="block"?"block":"email",entity_id:_,project_id:T,context:"editor"}),M.data.task_id){let H=M.data.task_id;j(H),ne({id:H,setError:se}),r.swallowPromiseRejection(Te().then(Re=>{Re?D(H):ue(!0)}))}Z()}}).catch(M=>{const H=Me(M);h.error({title:M?.data?.code||c("Error"),description:H}),Ce(H)})}O("")}},F=async B=>{const S={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};oe(M=>[...M,S]);const m={project_id:T,connection:"chat",entity_id:_,context:B,locale:ae,subject:ye||"",preheader:re||"",textContent:di.extractDocumentTextContent(a())};if(Ie&&(de&&_e!==V?(Ue(),ve(M=>M+1)):C!==je&&(Ve(),P(M=>M+1))),Ne)h.error({title:c("You have reached the limit of AI chat usage."),description:c("Please upgrade your plan.")}),Ce(c("You have reached the limit of AI chat usage."));else{if(!await le("ai")){Ce();return}E({event:"select",action:"select_ai_assistant_role",context:m.context,entity_id:m.entity_id,project_id:m.project_id}),U({body:m}).then(M=>{if(M?.error)throw M.error;if(!M?.data||M.data.status===401)throw new Error(r.ERROR);Be(M)||Z()}).catch(M=>{const H=Me(M);h.error({title:M?.data?.code||c("Error"),description:H}),Ce(H)})}},he=(0,n.useCallback)(async B=>{const S={data:{role:"user",message:B,userInfo:{display_name:be,avatar_url:Q}}},m={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};oe(H=>[...H,S,m]);const M={project_id:T,connection:"chat",entity_id:_,message:B,locale:ae,subject:ye||"",preheader:re||"",textContent:di.extractDocumentTextContent(a())};if(Fe)h.error({title:c("You have reached the limit of AI generator usage."),description:c("Please upgrade your plan.")}),Ce(c("You have reached the limit of AI chat usage."));else{if(!await le(de?"email_generate":"ai")){Ce();return}U({body:M}).then(H=>{if(H?.error)throw H.error;if(!H?.data||H.data.status===401)throw new Error(r.ERROR);if(!Be(H)){if(E({event:"submit",action:"send_discussion_chat_message",entity_type:l==="block"?"block":"email",entity_id:_,project_id:T,context:"editor"}),H.data.task_id){let Re=H.data.task_id;j(Re),ne({id:Re,setError:se}),r.swallowPromiseRejection(Te().then(fe=>{fe?D(Re):ue(!0)}))}Ie&&(de&&_e!==V?(Ue(),ve(Re=>Re+1)):C!==je&&(Ve(),P(Re=>Re+1))),Z()}}).catch(H=>{const Re=Me(H);h.error({title:H?.data?.code||c("Error"),description:Re}),Ce(Re)})}},[c,C,_e,Q,Te,Ce,D,Me,be,je,V,ke,ye,re,_,de,Fe,ae,Ve,Ue,Ie,a,h,le,T,U,ne,Z]);(0,n.useEffect)(()=>{const B=new xo.Disposable,S=window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings);if((!e?.length||e.length===1&&e[0]?.data?.role==="assistant")&&S&&_){const m={project_id:T,connection:"chat",entity_id:_,context:"email-generator",locale:ae};r.runOnceInFlight(`discuss-ai-generator-context:${_}`,()=>{if(Se){window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),he(S);return}r.swallowPromiseRejection(U({body:m}).then(()=>{window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),B.isDisposed()||he(S)}))})}return()=>B.dispose()},[e,he,_,ae,T,U,Se]);const Le=B=>{typeof B.target.className=="string"&&B.target.className.includes("ai-response-change-context")&&(X.isLoading||F(B.target.role))},eo=B=>{const S=B.children[0].data??"";Js("subject",S,w),h.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Title copied to email settings"),data:S})},Xe=B=>{const S=B.children[0].data??"";Js("preheader",S,w),h.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Preheader copied to email settings"),data:S,duration:300})},lo=B=>{const S=B.children[0].data;navigator.clipboard.writeText(S).then(()=>{h.success({id:"TEXT_COPIED_TO_CLIPBOARD",title:c("Text copied to clipboard"),data:S})}).catch(m=>{})},Qe={replace:B=>{if(B.attribs?.class?.split(" ").includes("ai-response-title"))return(0,o.jsx)(t.ui_kit$Tooltip,{placement:"left",title:c("Replace the title"),children:(0,o.jsx)("div",{onClick:()=>eo(B),children:(0,o.jsx)("span",{className:"ai-response-title",children:(0,mt.domToReact)(B.children,Qe)})})});if(B.attribs?.class?.split(" ").includes("ai-response-preheader"))return(0,o.jsx)(t.ui_kit$Tooltip,{placement:"left",title:c("Replace the preheader"),children:(0,o.jsx)("div",{onClick:()=>Xe(B),children:(0,o.jsx)("span",{className:"ai-response-preheader",children:(0,mt.domToReact)(B.children,Qe)})})});if(B.attribs?.class?.split(" ").includes("ai-response-copy"))return(0,o.jsx)(t.ui_kit$Tooltip,{placement:"left",title:c("Copy to clipboard"),children:(0,o.jsx)("div",{onClick:()=>lo(B),children:(0,o.jsx)("span",{className:"ai-response-copy",children:(0,mt.domToReact)(B.children,Qe)})})});if(B.attribs?.class?.split(" ").includes("ai-response-user-message")){const S=B.attribs?.data||B.children?.[0]?.data;return(0,o.jsx)("li",{className:B.attribs?.class,data:B.attribs?.data,onClick:()=>he(S),children:(0,mt.domToReact)(B.children,Qe)})}}},uo=()=>{D(),ue(!1)},Eo=()=>{L(),ue(!1)};return(0,o.jsxs)("div",{ref:k,className:"discuss-main",children:[y.length>0&&(0,o.jsx)(t.ui_kit$List,{onClick:Le,className:"comment-list",itemLayout:"horizontal",dataSource:y,renderItem:B=>(0,o.jsx)("li",{id:B._id,children:(0,o.jsx)(t.ui_kit$Comment,{className:B.data.userInfo?"":"ai-comment",avatar:B.data.role==="assistant"?(0,o.jsx)(r.EmIcons,{icon:"ChatGpt",component:t.icons$ChatGpt,className:"anticon-robot",style:{color:"#ffffff",fontSize:16,width:24,height:24,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"}}):B.data.userInfo&&B.data._modified?B.data.userInfo.avatar_url:Q||(0,o.jsx)(r.EmIcons,{icon:"UserOutlined",component:t.icons$UserOutlined,className:"anticon-user",style:{color:"#ffffff",fontSize:16,width:24,height:24,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"}}),author:(0,o.jsx)("div",{style:$e,children:B?.data?.role==="user"?ke?.username||c("User"):c("AI Assistant")}),datetime:B._created?(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:wo.formatDate(r.parseISO(B._created),p,!0)}}):null,content:B.data.isLoading?(0,o.jsx)("div",{className:"spin",children:(0,o.jsx)(r.EmIcons,{icon:"LoadingOutlined",component:t.icons$LoadingOutlined,style:{fontSize:24},spin:!0})}):(0,o.jsx)("div",{style:$e,children:gu(B.data.message,Qe)})})},B._id)}),K&&(de?(0,o.jsx)(t.ui_kit$LimitsCounter,{text:`${_e} ${c("of")} ${V>0?V:"∞"} ${c("mail generator")} ${p("was used","were used",_e)}`,exceeded:V>0&&_e>=V,style:{marginTop:-25},extra:(0,o.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>x(b.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})}):(0,o.jsx)(t.ui_kit$LimitsCounter,{text:`${C} ${c("of")} ${je>0?je:"∞"} ${c("messeges")} ${p("was used","were used",C)}`,exceeded:je>0&&C>=je,style:{marginTop:-25},extra:(0,o.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>x(b.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})})),(0,o.jsxs)(t.ui_kit$Form,{onFinish:R,className:"addMode",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{disabled:Y,value:$,onChange:B=>O(B.target.value),rows:4,placeholder:c("Type your request"),className:"textarea-comment",onPressEnter:B=>B.key==="Enter"&&B.ctrlKey&&R(),spellCheck:"false"})}),(0,o.jsx)(t.ui_kit$Form.Item,{children:(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Button,{disabled:X.isLoading||Y,type:"default",style:ku,className:"button-target",children:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"top",disabled:Y,arrow:{pointAtCenter:!0},menu:{items:xu(F)},children:(0,o.jsxs)("div",{disabled:Y,style:{margin:0,padding:0,color:"#ffffff",display:"inline-flex",alignItems:"center"},children:[(0,o.jsx)(r.EmIcons,{icon:"ChatGpt",component:t.icons$ChatGpt,style:{marginRight:5}}),c("Role")]})},"Export")}),(0,o.jsxs)(t.ui_kit$Button,{disabled:X.isLoading||Y,className:"button-add",type:"primary",htmlType:"submit",children:[c("Send")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:b.iconStrokeWidth})]})]})})]}),(0,o.jsx)(t.ui_kit$Modal,{title:c("Warning"),open:te,onOk:uo,onCancel:Eo,children:(0,o.jsx)("p",{children:c("The current template will be changed to the generated one, are you sure about this?")})})]})},Eu=[r.VALID,r.ERRORS,r.WARNINGS],oa=({summary:e,__:i,selectedTags:l,setSelectedTags:s})=>{const a=(0,n.useCallback)((c,p)=>{s(p?l.length===2?[]:[...l,c]:l.filter(f=>f!==c))},[l,s]),d=(0,n.useCallback)(c=>i(c==="valid"?"Valid":c==="warnings"?"Warnings":"Errors"),[i]);return(0,o.jsx)(t.ui_kit$Title,{level:5,className:"optimise__valid-title",children:(0,o.jsx)(t.ui_kit$Space,{className:"optimise__valid-title-space",size:8,children:Eu.map((c,p)=>(0,o.jsxs)(t.ui_kit$CheckableTag,{checked:l?.includes(c),onChange:f=>a(c,f),className:(0,He.default)(`${c} optimise__button`,{[`${c}_active`]:l.includes(c)}),children:[d(c),": ",e?.[c]||0]},c+p))})})},{LINKS:Bu}=r.OPTIMISE_TABS,ta=(0,n.memo)(({__:e,activeTab:i,validateLinksResult:l,validateLinks:s,selectedTags:a,setSelectedTags:d,isLoading:c,disabled:p,iconStrokeWidth:f,onValidate:x,goToLinkHandler:k})=>i!==Bu||!l?.links?null:l.links.length===0?(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,o.jsx)(t.ui_kit$Alert,{title:e("No links found."),type:"info"})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-14",children:(0,o.jsxs)("div",{className:"optimise__title-wrapper",children:[(0,o.jsx)(oa,{__:e,summary:l.summary,setSelectedTags:d,selectedTags:a}),(0,o.jsx)(t.ui_kit$Button,{disabled:p,loading:c,onClick:x,icon:(0,o.jsx)(r.EmIcons,{icon:"SyncOutlined",component:t.icons$SyncOutlined,size:16,strokeWidth:f}),children:e("Refresh")})]})}),(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$List,{itemLayout:"horizontal",dataSource:s,renderItem:(b,h)=>(0,o.jsx)(t.ui_kit$List.Item,{className:t.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{avatar:b.status==="valid"?(0,o.jsx)(r.EmIcons,{icon:"CheckCircleFilled",component:t.icons$CheckCircleFilled,className:r.VALID}):b.status==="warnings"?(0,o.jsx)(r.EmIcons,{icon:"CheckCircleFilled",component:t.icons$CheckCircleFilled,className:r.WARNINGS}):(0,o.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:t.icons$CloseCircleFilled,className:r.ERRORS}),title:(0,o.jsx)(t.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>k(b.linkId,600>(b.statusCode||0)&&(b.statusCode||0)>399||!b.statusCode),children:b.url===""?e("empty link"):b.url}),description:(0,o.jsxs)(o.Fragment,{children:[!!b.text?.length&&(0,o.jsx)(t.ui_kit$Text,{type:"secondary",children:b.text}),b.page?.title&&b.page.title,b.page?.secure&&b.status==="valid"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)("span",{className:"valid",children:e("secure")})]}),!b.resolvedUrl&&!b.statusCode&&b.type==="url"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)(t.ui_kit$Text,{type:"secondary",children:e("Failed to load")})]})]})})},h+"_"+b.linkId)})})})]}));ta.displayName="LinksSection";var{IMAGES:Su}=r.OPTIMISE_TABS,ia=(0,n.memo)(({__:e,activeTab:i,validateImagesResult:l,validateImages:s,selectedTags:a,setSelectedTags:d,isLoading:c,disabled:p,iconStrokeWidth:f,onValidate:x,goToImageHandler:k,showImgPreviewHandler:b,hideBlockPreviewHandler:h})=>i!==Su||!l?.images?null:l.images.length===0?(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,o.jsx)(t.ui_kit$Alert,{title:e("No images found."),type:"info"})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-16",children:(0,o.jsx)(t.ui_kit$Alert,{className:"optimise__alert-custom",title:(0,o.jsxs)("div",{className:"optimise__summary",children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)(t.ui_kit$Title,{level:4,className:"optimise__summary-title",children:[l.images.length," "]}),(0,o.jsx)("span",{className:"optimise__summary-label",children:e("images")})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)(t.ui_kit$Title,{level:4,className:"optimise__summary-title",children:[l.summaryTime?.value,l.summaryTime?.name]}),(0,o.jsx)("span",{className:"optimise__summary-label",children:e("total size")})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)(t.ui_kit$Title,{level:4,className:"optimise__summary-title",children:(Math.max(...l.images.map(T=>T.image.responseTime))/1e3).toFixed(2)+e("s")}),(0,o.jsx)("span",{className:"optimise__summary-label",children:e("time to load")})]})]}),type:"warning"})}),(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-12",children:(0,o.jsxs)("div",{className:"optimise__title-wrapper",children:[(0,o.jsx)(oa,{__:e,summary:l.summary,setSelectedTags:d,selectedTags:a}),(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"SyncOutlined",component:t.icons$SyncOutlined,size:16,strokeWidth:f}),disabled:p,loading:c,onClick:x,children:e("Refresh")})]})}),(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-12",children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$List,{className:"optimise__result-list",itemLayout:"horizontal",dataSource:s,renderItem:(T,_)=>(0,o.jsx)(t.ui_kit$List.Item,{className:`optimise__image-item image-item ${t.ui_kit$LIST_ITEM_BORDERLESS_CLASS}`,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{className:(0,He.default)("image-item__meta",{"image-item__meta_fail":!T.resolvedUrl&&!T.statusCode}),avatar:(0,o.jsx)(t.ui_kit$Image,{className:(0,He.default)("image-item__image optimise__image-auto-height",{"image-item__image_fail":!T.resolvedUrl||!T.valid}),width:92,height:"auto",src:T.resolvedUrl||"",preview:!1,onMouseEnter:()=>b(T.url,T.image.dimensions?.width),onMouseLeave:()=>h()}),title:T.url?(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:T.message,children:(0,o.jsx)(t.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>k(T.imageId,600>(T.statusCode||0)&&(T.statusCode||0)>399||!T.statusCode),children:T?.url===""?e("empty src"):T.url})}):T.message,description:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"image-size",children:[T.image.dimensions&&(0,o.jsxs)(o.Fragment,{children:[T.image.dimensions.width+" × "+T.image.dimensions.height,(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsxs)("span",{children:[Math.round(T.image.bytes/1024),e("kB")]}),(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsxs)("span",{children:[T.image.responseTime,e("ms")]}),(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)("span",{className:"image-size-format",children:Ft(T.image.contentType)})]}),T.image.secure&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)("span",{className:"valid",children:e("secure")})]}),T.resolvedUrl&&!T.valid&&(0,o.jsx)(t.ui_kit$Text,{type:"danger",children:e("not valid")})]}),!T.resolvedUrl&&!T.statusCode&&(0,o.jsx)(t.ui_kit$Text,{type:"danger",children:e("Failed to load")})]})})},_)})})})]}));ia.displayName="ImagesSection";var{SPAM_ASSASSIN:Tu}=r.OPTIMISE_TABS,ra=(0,n.memo)(({__:e,activeTab:i,validateSpamResult:l,isLoading:s,disabled:a,iconStrokeWidth:d,onValidate:c})=>{const p=l?.report?.length||Object.prototype.hasOwnProperty.call(l,"spamScore");if(i!==Tu||!p)return null;const f=l.spamScore||0,x=l.baseSpamScore||0,k=f<2||!l.spamScore||f<=x-1?"success":f<x-1?"warning":"danger";return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{className:"optimise__row-mb-8",children:[(0,o.jsxs)("div",{className:"optimise__title-wrapper optimise__title-wrapper_spam",children:[(0,o.jsxs)(t.ui_kit$Title,{level:1,className:"optimise__spam-score-title",type:k,children:[(0,o.jsx)("span",{className:"optimise__spam-score-value",children:f}),(0,o.jsx)(t.ui_kit$Text,{className:"optimise__spam-score-text",children:"Score"})]}),(0,o.jsx)(t.ui_kit$Button,{disabled:a,icon:(0,o.jsx)(r.EmIcons,{icon:"SyncOutlined",component:t.icons$SyncOutlined,size:16,strokeWidth:d}),loading:s,onClick:c,children:e("Refresh")})]}),f>x-1&&(0,o.jsx)(t.ui_kit$Text,{children:e("Lower scores are better. Aim for a score less than ")+(x-1)+"."})]}),(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-8",children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(l.report?.length||0)>0?(0,o.jsx)(t.ui_kit$List,{itemLayout:"horizontal",dataSource:l.report,renderItem:b=>(0,o.jsx)(t.ui_kit$List.Item,{className:t.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{title:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Text,{className:"optimise__spam-report-score",children:b.score}),(0,o.jsx)("span",{className:"optimise__spam-report-description",children:b.description})]})})})}):(0,o.jsx)(o.Fragment,{children:l.spamScore===0&&e("Your email doesn't look like spam.")})})})]})});ra.displayName="SpamSection";var{PROBLEMS:Ru}=r.OPTIMISE_TABS,la=(0,n.memo)(({__:e,activeTab:i,problemsList:l,onSetMonacoPosition:s})=>i!==Ru?null:l?.length?(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-8",children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$List,{itemLayout:"horizontal",dataSource:l,renderItem:a=>(0,o.jsx)(t.ui_kit$List.Item,{className:t.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{avatar:a.severity<6?(0,o.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:t.icons$CloseCircleFilled,className:r.WARNINGS}):(0,o.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:t.icons$CloseCircleFilled,className:r.ERRORS}),title:(0,o.jsxs)(t.ui_kit$Text,{onClick:()=>s(a),className:(0,He.default)("optimise__text-clickable",{warning:a.severity<6,error:a.severity>=6}),children:["Line: ",a.startLineNumber," ",a.startLineNumber!==a.endLineNumber&&" – "+a.endLineNumber]}),description:(0,o.jsx)(t.ui_kit$Text,{children:a.message})})})})})}):(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,o.jsx)(t.ui_kit$Alert,{title:e("No problems found."),type:"info"})}));la.displayName="ProblemsSection";var yu={activeTab:"",selectedTags:[],validateLinks:[],validateImages:[],validateSpamResult:{},optimisationCounter:0,linkCheckCounter:0,imageCheckCounter:0,spamCheckCounter:0,validateLinksResult:{},validateImagesResult:{}},wu=(e,i)=>{switch(i.type){case"SET_ACTIVE_TAB":return{...e,activeTab:i.payload!==e.activeTab?i.payload:""};case"SET_SELECTED_TAGS":return{...e,selectedTags:i.payload};case"SET_VALIDATE_LINKS":return{...e,validateLinks:i.payload};case"SET_VALIDATE_IMAGES":return{...e,validateImages:i.payload};case"SET_VALIDATE_SPAM_RESULT":return{...e,validateSpamResult:i.payload};case"SET_OPTIMISATION_COUNTER":return{...e,optimisationCounter:i.payload};case"INCREMENT_OPTIMISATION_COUNTER":return{...e,optimisationCounter:e.optimisationCounter+1};case"SET_LINK_CHECK_COUNTER":return{...e,linkCheckCounter:i.payload};case"INCREMENT_LINK_CHECK_COUNTER":return{...e,linkCheckCounter:e.linkCheckCounter+1};case"SET_IMAGE_CHECK_COUNTER":return{...e,imageCheckCounter:i.payload};case"INCREMENT_IMAGE_CHECK_COUNTER":return{...e,imageCheckCounter:e.imageCheckCounter+1};case"SET_SPAM_CHECK_COUNTER":return{...e,spamCheckCounter:i.payload};case"INCREMENT_SPAM_CHECK_COUNTER":return{...e,spamCheckCounter:e.spamCheckCounter+1};case"SET_VALIDATE_LINKS_RESULT":return{...e,validateLinksResult:i.payload};case"SET_VALIDATE_IMAGES_RESULT":return{...e,validateImagesResult:i.payload};case"RESET_SELECTED_TAGS":return{...e,selectedTags:[]};default:return e}},si={link_check:"link_check_counter",image_check:"image_check_counter",spam_check:"spam_check_counter"},dr={link_check:"link_check_limit",image_check:"image_check_limit",spam_check:"spam_check_limit"},ju=(e,i)=>{const l=Object.values(si),s=Object.values(dr);return l.some(a=>e?.[a]!==void 0)||s.some(a=>i?.[a]!==void 0)||l.some(a=>i?.[a]!==void 0)||s.some(a=>e?.[a]!==void 0)},pt=(e,i,l=0)=>{const s=e?.[i];return typeof s=="number"&&!Number.isNaN(s)?s:l},vu=(e,i)=>({counter:e,limit:i,disabled:i>0&&e>=i}),Iu=({appConfig:e,data:i,isSuccess:l,optimisationCounter:s,linkCheckCounter:a,imageCheckCounter:d,spamCheckCounter:c,setOptimisationCounter:p,setLinkCheckCounter:f,setImageCheckCounter:x,setSpamCheckCounter:k})=>{const b=(0,n.useMemo)(()=>!!(e.limits&&e.counters)&&!0,[e]),h=(0,n.useMemo)(()=>e.counters,[e,i]),T=(0,n.useMemo)(()=>e.limits,[e,i]),_=(0,n.useMemo)(()=>b&&ju(h,T),[b,h,T]),E=(0,n.useMemo)(()=>pt(T,"optimization_limit",0),[T]),w=(0,n.useMemo)(()=>!_&&s>=E&&E>0,[_,s,E]),v=(0,n.useMemo)(()=>{const j={link_check:a,image_check:d,spam_check:c};return Object.keys(dr).reduce((C,P)=>{const Y=dr[P],z=_?pt(T,Y,0):E,$=_?j[P]:s;return C[P]=vu($,z),C},{})},[_,T,E,a,d,c,s]),A=j=>_?v[j].disabled:w;return(0,n.useEffect)(()=>{if(!b){const j=i?.counters;l&&j?.optimization_counter&&p(j.optimization_counter);return}p(pt(h,"optimization_counter",0)),_&&(f(pt(h,si.link_check,0)),x(pt(h,si.image_check,0)),k(pt(h,si.spam_check,0)))},[b,_,i,l,h,p,f,x,k]),{limitsInPlugin:b,perTypeAvailable:_,currentBillingOptimisationLimits:E,disableFields:w,typeLimits:v,isTypeDisabled:A}},Cu=()=>{const e=(0,n.useRef)(null);return{showImgPreviewHandler:(0,n.useCallback)((i,l)=>{e.current&&clearTimeout(e.current);let s=document.querySelector(".img-preview"),a=document.querySelector(".img-preview-content");document.querySelector(".img-preview")||(s=document.createElement("div"),s.classList.add("img-preview"),a=document.createElement("div"),a.classList.add("img-preview-content"),s.append(a),document.querySelector(".email-pane__col_settings-inner")?.append(s)),a&&(a.innerHTML=`<table cellspacing="0" cellpadding="0" border="0" width="100%"><img height="auto" width=${(l||0)+"px"} alt="" style="max-width: 100%; object-fit: contain" src=${i}></table>`),s&&s.style.opacity!=="1"&&setTimeout(()=>{s&&(s.style.opacity="1",s.style.transform="translateX(-100%)")},10)},[]),hideBlockPreviewHandler:(0,n.useCallback)(()=>{const i=document.querySelector(".img-preview");i&&(e.current=setTimeout(()=>{i&&(i.style.opacity="0",i.style.transform="translateX(-99%)",setTimeout(()=>{i?.remove()},300))},300))},[])}},{LINKS:Pu,IMAGES:Au}=r.OPTIMISE_TABS,Nu=({activeTab:e,selectedTags:i,validateLinksResult:l,validateImagesResult:s,setValidateLinks:a,setValidateImages:d})=>{(0,n.useEffect)(()=>{e===Pu&&l.links&&a(i.length>0?l.links.filter(c=>i.includes(c.status)):l.links),e===Au&&s.images&&d(i.length>0?s.images.filter(c=>i.includes(c.status)):s.images)},[l.links,s.images,i,e,a,d])},Lu=e=>(e.statusCode!==null?e.statusCode<300&&(e.page?.secure??!0):e.type!=="invalid")?r.VALID:(e.statusCode&&e.statusCode<400||e.statusCode===200&&(e.page?.secure??!0))&&e.type!=="invalid"?r.WARNINGS:r.ERRORS,sa=e=>e.statusCode!==null&&e.statusCode<300?r.VALID:e.statusCode<400&&e.statusCode>=300||e.statusCode===200&&!e.valid?r.WARNINGS:r.ERRORS,aa=e=>({valid:e.filter(i=>i.status===r.VALID).length,warnings:e.filter(i=>i.status===r.WARNINGS).length,errors:e.filter(i=>i.status===r.ERRORS).length}),Ou={ai:(0,o.jsx)(r.EmIcons,{icon:"AIRequests",component:t.icons$AIRequests}),email_generate:(0,o.jsx)(r.EmIcons,{icon:"EmailEnvelope",component:t.icons$EmailEnvelope}),image_generate:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image}),optimization:(0,o.jsx)(r.EmIcons,{icon:"Optimization",component:t.icons$Optimization}),preview:(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined}),test_sends:(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined}),link_check:(0,o.jsx)(r.EmIcons,{icon:"Web",component:t.icons$Web}),image_check:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image}),spam_check:(0,o.jsx)(r.EmIcons,{icon:"Block",component:t.icons$Block}),projects:(0,o.jsx)(r.EmIcons,{icon:"FolderOpen",component:t.icons$FolderOpen}),emails:(0,o.jsx)(r.EmIcons,{icon:"EmailEnvelope",component:t.icons$EmailEnvelope}),blocks:(0,o.jsx)(r.EmIcons,{icon:"Block",component:t.icons$Block}),users:(0,o.jsx)(r.EmIcons,{icon:"SliderGroup",component:t.icons$SliderGroup})};function na(e,i){if(e==null)return null;if(typeof e=="number"||typeof e=="string"){const l=e==="∞"||typeof e=="string"&&e.toLowerCase()==="infinity";return(0,o.jsx)("span",{className:i==="old"?"limit-upgrade-modal__limit-old":`limit-upgrade-modal__limit-new${l?" limit-upgrade-modal__limit-new--infinity":""}`,children:l?"∞":e})}return e}var ai=({open:e,onClose:i,title:l,subtitle:s,usageResource:a,icon:d,previousDisplay:c,nextDisplay:p,onChangePlan:f,secondaryAction:x,changePlanLabel:k})=>{const{__:b}=r.useI18n(),h=k??b("Change plan"),T=!!x,_=a!=null?Ou[a]:d??null;return(0,o.jsx)(t.ui_kit$Modal,{open:e,onCancel:i,footer:null,closable:!1,width:400,centered:!0,className:"limit-upgrade-modal",destroyOnHidden:!0,mask:{closable:!0},children:(0,o.jsxs)("div",{className:"limit-upgrade-modal__wrap",children:[(0,o.jsx)("div",{className:"limit-upgrade-modal__header",children:(0,o.jsx)("button",{type:"button",className:"limit-upgrade-modal__close",onClick:i,"aria-label":b("Close"),children:(0,o.jsx)(r.EmIcons,{icon:"CloseOutlined",component:t.icons$CloseOutlined})})}),(0,o.jsxs)("div",{className:"limit-upgrade-modal__body",children:[(0,o.jsx)("h1",{className:"limit-upgrade-modal__title",children:l}),(0,o.jsx)("p",{className:"limit-upgrade-modal__subtitle",children:s}),(0,o.jsxs)("div",{className:"limit-upgrade-modal__limits-row",children:[(0,o.jsx)("div",{className:"limit-upgrade-modal__icon-circle","aria-hidden":!0,children:_}),na(c,"old"),(0,o.jsx)("div",{className:"limit-upgrade-modal__arrow-btn","aria-hidden":!0,children:(0,o.jsx)(r.EmIcons,{icon:"ArrowUpOutlined",component:t.icons$ArrowUpOutlined,className:"limit-upgrade-modal__arrow-icon"})}),na(p,"new")]})]}),(0,o.jsx)("hr",{className:"limit-upgrade-modal__divider"}),(0,o.jsx)("div",{className:T?"limit-upgrade-modal__footer limit-upgrade-modal__footer--dual":"limit-upgrade-modal__footer",children:x?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Button,{className:"limit-upgrade-modal__cta-secondary",onClick:x.onClick,children:x.label}),(0,o.jsx)(t.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:f,children:h})]}):(0,o.jsx)(t.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:f,children:h})})]})})},{LINKS:cr,IMAGES:ur,SPAM_ASSASSIN:da,PROBLEMS:mr}=r.OPTIMISE_TABS,ca={textDecoration:"underline",cursor:"pointer",background:"none",border:"none",padding:0,font:"inherit",color:"inherit"},$u={link_check:"LinkCheckCount",image_check:"ImageCheckCount",spam_check:"SpamCheckCount"},Fu={link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"},ua=(e,i,l,s)=>`${e} ${l("of")} ${i>0?i:"∞"} ${s("test","tests",i>0?i:e)} ${s("was used","were used",e)}`,ma=()=>{const{__:e,_n:i}=r.useI18n(),l=r.useDispatch(),s=r.useOpenPlanCatalog(),a=r.useAppNavigate(),d=r.useNotification(),c=r.useContentReader(),p=r.useAppConfig(),f=r.useEditorProjectId(),x=r.useRouteEmailId(),{document:k}=r.useDocumentSessionContext(),b=r.useEmailOfDocument(k,void 0),h=x||(b?.id!=null?String(b.id):void 0),T=h||b?.renderGuid,_=f||(b?.project!=null?String(b.project):void 0),[E,w]=(0,n.useState)(null),v=(0,n.useRef)(!1),A=(0,n.useRef)({link_check:!1,image_check:!1,spam_check:!1}),j=r.useProjectPlanLimitPreflight(),C=(0,n.useCallback)(I=>{w(I)},[]),P=(0,n.useCallback)((I,Z)=>I?.status===401&&I?.data?.code==="usage_limit_exceeded"?(C({presetId:{link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"}[Z],previousDisplay:e("—"),nextDisplay:r.presetLimitDisplay("infinity")}),l(r.limitsApi.util.invalidateTags(["LimitsStats","LimitsWarnings"])),!0):!1,[l,e,C]),Y=(0,n.useCallback)((I,Z)=>{P(I,Z)||d.error({error:I})},[P,d]),z=(0,n.useCallback)(async I=>!0,[l,j,C]),$=r.useMessageService(),O=r.useSelector(r.selectProblemsList),y=r.useEventEmitter(xo.events.ON_LIMIT_ID),oe=r.usePushToDataLayer(),[G,q]=(0,n.useReducer)(wu,yu),[te,ue]=r.useEditSpamMutation(),[me,se]=r.useEditLinksMutation(),[_e,ve]=r.useEditImagesMutation(),{data:de,isSuccess:De}=r.useGetProjectQuery(+(_||0),{skip:!0}),ye=r.useInvalidateProject(),re=(0,n.useCallback)(I=>q({type:"SET_OPTIMISATION_COUNTER",payload:I}),[]),ke=(0,n.useCallback)(I=>q({type:"SET_LINK_CHECK_COUNTER",payload:I}),[]),ae=(0,n.useCallback)(I=>q({type:"SET_IMAGE_CHECK_COUNTER",payload:I}),[]),Q=(0,n.useCallback)(I=>q({type:"SET_SPAM_CHECK_COUNTER",payload:I}),[]),be=(0,n.useCallback)(I=>q({type:"SET_VALIDATE_LINKS",payload:I}),[]),pe=(0,n.useCallback)(I=>q({type:"SET_VALIDATE_IMAGES",payload:I}),[]),ee=(0,n.useCallback)(I=>q({type:"SET_SELECTED_TAGS",payload:I}),[]),{limitsInPlugin:J,perTypeAvailable:U,currentBillingOptimisationLimits:X,disableFields:ce,typeLimits:xe,isTypeDisabled:ne}=Iu({appConfig:p,data:de,isSuccess:De,optimisationCounter:G.optimisationCounter,linkCheckCounter:G.linkCheckCounter,imageCheckCounter:G.imageCheckCounter,spamCheckCounter:G.spamCheckCounter,setOptimisationCounter:re,setLinkCheckCounter:ke,setImageCheckCounter:ae,setSpamCheckCounter:Q});Nu({activeTab:G.activeTab,selectedTags:G.selectedTags,validateLinksResult:G.validateLinksResult,validateImagesResult:G.validateImagesResult,setValidateLinks:be,setValidateImages:pe});const{showImgPreviewHandler:Ae,hideBlockPreviewHandler:we}=Cu(),$e=(0,n.useCallback)(I=>I==="link_check"?G.linkCheckCounter:I==="image_check"?G.imageCheckCounter:G.spamCheckCounter,[G.linkCheckCounter,G.imageCheckCounter,G.spamCheckCounter]),K=(0,n.useCallback)(I=>{if(J){if(U){q({type:{link_check:"INCREMENT_LINK_CHECK_COUNTER",image_check:"INCREMENT_IMAGE_CHECK_COUNTER",spam_check:"INCREMENT_SPAM_CHECK_COUNTER"}[I]}),y.fire({name:$u[I],count:$e(I)+1});return}q({type:"INCREMENT_OPTIMISATION_COUNTER"}),y.fire({name:"OptimizationCount",count:G.optimisationCounter+1})}},[J,U,y,$e,G.optimisationCounter]),ie=(0,n.useCallback)(I=>{if(U){const{limit:Z}=xe[I];C({presetId:Fu[I],previousDisplay:Z>0?Z:r.presetLimitDisplay("infinity"),nextDisplay:r.presetLimitDisplay("infinity")});return}C({presetId:"optimization_exceeded",previousDisplay:X,nextDisplay:r.presetLimitDisplay("infinity")})},[U,xe,C,X]),je=(0,n.useCallback)(()=>{a(p.billingPageUrl||r.APP_ROUTES.billing)},[p.billingPageUrl,a]),V=I=>{if(!J||!U)return null;const{counter:Z,limit:Be,disabled:Ce}=xe[I];return(0,o.jsx)(t.ui_kit$LimitsCounter,{text:ua(Z,Be,e,i),exceeded:Ce,extra:(0,o.jsx)("button",{type:"button",style:ca,onClick:je,children:e("Need more?")})})},Se=(0,n.useCallback)((I,Z)=>{$.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_LINK,settings:{elementId:I,isError:Z}})},[$]),Ie=(0,n.useCallback)((I,Z)=>{$.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_IMG,settings:{elementId:I,isError:Z}})},[$]),Ne=(0,n.useCallback)(I=>{const Z={startColumn:I.startColumn,startLineNumber:I.startLineNumber,endColumn:I.endColumn,endLineNumber:I.endLineNumber};l(r.setActiveProblemRange(Z))},[l]),Fe=(0,n.useCallback)(I=>{q({type:"SET_ACTIVE_TAB",payload:I}),q({type:"RESET_SELECTED_TAGS"}),I===mr&&O?.length>0&&oe({event:"check",action:"check_email_code",email_id:h,project_id:_,problems_count:O?.length||0})},[O,oe,h,_]),Ve=(0,n.useCallback)(async()=>{if(!T){d.error({title:"Save the mail first."});return}if(ne("link_check")){ie("link_check");return}if(!await z("link_check"))return;K("link_check");const I=c(),Z=new DOMParser().parseFromString(I,"text/html"),Be={},Ce={};Z.querySelectorAll("a[href]").forEach((Me,Ge)=>{Be[`link_${Ge}`]=Me.getAttribute("href"),Ce[`link_${Ge}`]=Me.textContent||""}),$.send({operation:"sandbox_set_attr_to_links"}),me({entity_id:T,data:Be}).then(({data:Me,error:Ge})=>{if(Ge)Y(Ge,"link_check");else if(Me?.result){const Ye=[...Me.result];Ye?.sort((R,F)=>R.linkId-F.linkId);const D=Ye.map(R=>({...R,text:Ce[R.linkId],status:Lu(R)})),L={links:D,summary:aa(D)};q({type:"SET_VALIDATE_LINKS_RESULT",payload:L}),d.success(e("Links validation was successfully completed")),Me.limit_warning&&Me.limit_remaining!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${Me.limit_remaining}`}),oe({event:"check",action:"check_email_links",email_id:h,project_id:_,links_count:L.links?.length||0})}else Me.statusCode>300||!Me.success?d.error({error:{data:Me}}):d.error({title:e("Something went wrong.")}),!G.validateLinksResult.links&&Fe("")}).catch(Me=>{Y(Me,"link_check")})},[h,T,ne,ie,z,K,c,$,me,d,e,oe,_,ye,G.validateLinksResult.links,Y,Fe]),Ue=(0,n.useCallback)(async()=>{if(!T){d.error({title:"Save the mail first."});return}if(ne("image_check")){ie("image_check");return}if(!await z("image_check"))return;K("image_check");const I=c(),Z=new DOMParser().parseFromString(I,"text/html"),Be={};Z.querySelectorAll("img").forEach((Ce,Me)=>Be[`image_${Me}`]=Ce.src),$.send({operation:"sandbox_set_attr_to_images"}),_e({entity_id:T,data:Be}).then(({data:Ce,error:Me})=>{let Ge;if(Me)Y(Me,"image_check");else if(Ce?.result){const Ye=Object.values(Ce.result);Ye.sort((L,R)=>L.imageId-R.imageId);const D=Ye.reduce((L,R)=>L+Math.round(R.image.bytes/1024),0);Ge={images:Ye.map(L=>({...L,status:sa(L)}))||[],summary:aa(Ye.map(L=>({...L,status:sa(L)}))),summaryTime:{value:(D>1200?D/1e3:D).toFixed(1),name:D>1200?e("MB"):e("KB")}},Ge&&q({type:"SET_VALIDATE_IMAGES_RESULT",payload:Ge}),d.success(e("Images validation was successfully completed")),Ce.limit_warning&&Ce.limit_remaining!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${Ce.limit_remaining}`}),oe({event:"check",action:"check_email_images",email_id:h,project_id:_,images_count:Ge.images?.length||0})}else Ce.statusCode>300||!Ce.success?d.error({error:{data:Ce}}):d.error({title:e("Something went wrong.")}),!G.validateImagesResult?.images?.length&&Fe("")}).catch(Ce=>{Y(Ce,"image_check")})},[h,T,ne,ie,z,K,c,$,_e,d,e,oe,_,ye,G.validateImagesResult,Y,Fe]),le=(0,n.useCallback)(async()=>{if(!T){d.error({title:"Save the mail first."});return}if(ne("spam_check")){ie("spam_check");return}await z("spam_check")&&(K("spam_check"),te({entity_id:T,data:{html:c()}}).then(({data:I,error:Z})=>{if(Z)Y(Z,"spam_check");else if(I&&I.success){const Be=!!I.result.report&&Object.values(I.result.report);Be?(Be.sort((Ce,Me)=>Ce.score-Me.score),q({type:"SET_VALIDATE_SPAM_RESULT",payload:{...I.result,report:Be}})):I.result&&q({type:"SET_VALIDATE_SPAM_RESULT",payload:{...I.result,report:Be}}),d.success(e("Spam validation was successfully completed")),I.limit_warning&&I.limit_remaining!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${I.limit_remaining}`}),oe({event:"check",action:"check_email_spam",email_id:h,project_id:_,spam_score:I.result?.spamScore||0})}else I.statusCode>300||!I.success?d.error({error:{data:I}}):d.error({title:e("Something went wrong.")}),!G.validateSpamResult?.report?.length&&Fe("")}).catch(I=>{Y(I,"spam_check")}))},[h,T,ne,ie,z,K,c,te,d,e,oe,_,ye,G.validateSpamResult,Y,Fe]);(0,n.useEffect)(()=>{if(J){if(U){["link_check","image_check","spam_check"].forEach(I=>{const{limit:Z,counter:Be,disabled:Ce}=xe[I];if(!Ce){A.current[I]=!1;return}A.current[I]||Z>0&&Be>=Z&&(A.current[I]=!0,ie(I))});return}if(!(X>0&&G.optimisationCounter>=X)){v.current=!1;return}v.current||(v.current=!0,ie("link_check"))}},[J,U,xe,G.optimisationCounter,X,ie]);const Te=E?r.getLimitUpgradePresetDefinition(E.presetId):null;return(0,o.jsxs)("div",{className:"optimise selected_form-props-wrapper selected_form-props-wrapper_optimize",children:[Te&&E?(0,o.jsx)(ai,{open:!0,onClose:()=>w(null),title:e(Te.titleKey),subtitle:e(Te.subtitleKey),usageResource:Te.usageResource,previousDisplay:E.previousDisplay,nextDisplay:E.nextDisplay,onChangePlan:()=>{w(null),s()}}):null,J&&!U&&(0,o.jsx)(t.ui_kit$LimitsCounter,{text:ua(G.optimisationCounter,X,e,i),exceeded:ce,extra:(0,o.jsx)("button",{type:"button",style:ca,onClick:je,children:e("Need more?")})}),p.optimizeLinksEnabled&&(0,o.jsxs)(o.Fragment,{children:[V("link_check"),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,align:"middle",children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsx)("div",{style:{padding:"15px 0"},children:e("Links validation")})}),(0,o.jsx)(t.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,o.jsx)(t.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:I=>I.preventDefault(),onClick:()=>{Fe(cr),!G.validateLinksResult?.links?.length&&G.activeTab!==cr&&Ve()},loading:se.isLoading,disabled:ne("link_check")&&!G.validateLinksResult?.links?.length,children:!se.isLoading&&(G.activeTab===cr?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth}))})})]}),(0,o.jsx)(ta,{__:e,activeTab:G.activeTab,validateLinksResult:G.validateLinksResult,validateLinks:G.validateLinks,selectedTags:G.selectedTags,setSelectedTags:ee,isLoading:se.isLoading,disabled:ne("link_check"),iconStrokeWidth:p.iconStrokeWidth,onValidate:Ve,goToLinkHandler:Se})]}),p.optimizeImagesEnabled&&(0,o.jsxs)(o.Fragment,{children:[V("image_check"),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,align:"middle",children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsx)("div",{style:{padding:"15px 0"},children:e("Images validation")})}),(0,o.jsx)(t.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,o.jsx)(t.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:I=>I.preventDefault(),onClick:()=>{Fe(ur),!G.validateImagesResult?.images?.length&&G.activeTab!==ur&&Ue()},loading:ve.isLoading,children:!ve.isLoading&&(G.activeTab===ur?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth}))})})]}),(0,o.jsx)(ia,{__:e,activeTab:G.activeTab,validateImagesResult:G.validateImagesResult,validateImages:G.validateImages,selectedTags:G.selectedTags,setSelectedTags:ee,isLoading:ve.isLoading,disabled:ne("image_check"),iconStrokeWidth:p.iconStrokeWidth,onValidate:Ue,goToImageHandler:Ie,showImgPreviewHandler:Ae,hideBlockPreviewHandler:we})]}),p.optimizeSpamAssassinEnabled&&(0,o.jsxs)(o.Fragment,{children:[V("spam_check"),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,align:"middle",children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsx)("div",{style:{padding:"15px 0"},children:e("SpamAssassin")})}),(0,o.jsx)(t.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,o.jsx)(t.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:I=>I.preventDefault(),loading:ue.isLoading,onClick:()=>{Fe(da),G.validateSpamResult.report?.length||Object.prototype.hasOwnProperty.call(G.validateSpamResult,"spamScore")||le()},disabled:ne("spam_check")&&!(G.validateSpamResult?.report?.length||Object.prototype.hasOwnProperty.call(G.validateSpamResult,"spamScore")),children:!ue.isLoading&&(G.activeTab===da?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth}))})})]}),(0,o.jsx)(ra,{__:e,activeTab:G.activeTab,validateSpamResult:G.validateSpamResult,isLoading:ue.isLoading,disabled:ne("spam_check"),iconStrokeWidth:p.iconStrokeWidth,onValidate:le})]}),p.optimizeCheckCodeEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,align:"middle",children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsx)("div",{style:{padding:"15px 0"},children:e("Source code validation")})}),(0,o.jsx)(t.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,o.jsx)(t.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:I=>I.preventDefault(),onClick:()=>Fe(mr),children:G.activeTab===mr?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth})})})]}),(0,o.jsx)(la,{__:e,activeTab:G.activeTab,problemsList:O,onSetMonacoPosition:Ne})]})]})},Mu=({state:e,onCancel:i,onRetry:l,onDismiss:s})=>{const{__:a}=r.useI18n();return e.kind==="hidden"?null:(0,o.jsx)("div",{className:"indexing-tray",role:"status","aria-live":"polite",children:(0,o.jsx)(t.ui_kit$Card,{size:"small",variant:"borderless",className:"indexing-tray__card",children:(0,o.jsxs)(t.ui_kit$Flex,{vertical:!0,gap:8,children:[Du(e,a),(0,o.jsx)(t.ui_kit$Flex,{justify:"flex-end",children:Vu(e,{onCancel:i,onRetry:l,onDismiss:s},a)})]})})})};function Du(e,i){switch(e.kind){case"scanning":return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Flex,{align:"center",gap:8,children:[(0,o.jsx)(t.ui_kit$Spin,{size:"small"}),(0,o.jsx)(t.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Moving files from old storage…")})]}),(0,o.jsx)(t.ui_kit$Text,{type:"secondary",children:i("Found so far: %s").replace("%s",String(e.scanned))}),(0,o.jsx)(t.ui_kit$Progress,{percent:100,status:"active",showInfo:!1,strokeColor:r.emCssVar("colorPrimary")})]});case"indexing":{const l=e.total>0?Math.min(100,Math.round(e.scanned/e.total*100)):0;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Indexing files…")}),(0,o.jsx)(t.ui_kit$Text,{type:"secondary",children:`${e.scanned} / ${e.total}`}),(0,o.jsx)(t.ui_kit$Progress,{percent:l,status:"active",strokeColor:r.emCssVar("colorPrimary")})]})}case"done":return(0,o.jsx)(t.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Files ready: %s").replace("%s",String(e.files+e.folders+e.trashed))});case"failed":return(0,o.jsx)(t.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Could not move files from old storage")});case"cancelled":return(0,o.jsx)(t.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Move stopped")});default:return null}}function Vu(e,i,l){switch(e.kind){case"scanning":case"indexing":return(0,o.jsx)(t.ui_kit$Button,{type:"link",size:"small",onClick:i.onCancel,disabled:e.cancelling,children:e.cancelling?l("Stopping…"):l("Cancel")});case"failed":return(0,o.jsx)(t.ui_kit$Button,{type:"link",size:"small",onClick:i.onRetry,children:l("Retry")});case"cancelled":return(0,o.jsx)(t.ui_kit$Button,{type:"link",size:"small",onClick:i.onRetry,children:l("Resume")});case"done":return(0,o.jsx)(t.ui_kit$Button,{type:"link",size:"small",onClick:i.onDismiss,children:l("Close")});default:return null}}var Hu=2500,pa=48,Uu=4e3;function Wu(e){switch(e.status){case"running":return e.phase==="indexing"?{kind:"indexing",scanned:e.scanned??0,total:e.total??0,cancelling:!!e.cancelling}:{kind:"scanning",scanned:e.scanned??0,cancelling:!!e.cancelling};case"done":return{kind:"done",files:e.files??0,folders:e.folders??0,trashed:e.trashed??0};case"failed":return{kind:"failed"};case"cancelled":return{kind:"cancelled"};default:return{kind:"hidden"}}}function zu(e){return e.kind==="done"||e.kind==="failed"||e.kind==="cancelled"}function Gu({projectId:e,api:i,triggered:l,onCompleted:s}){const[a,d]=(0,n.useState)({kind:"hidden"}),c=(0,n.useRef)(!1),p=(0,n.useRef)(!0),f=(0,n.useRef)(e);f.current=e;const x=(0,n.useRef)(l);x.current=l;const k=(0,n.useRef)(s);k.current=s,(0,n.useEffect)(()=>(p.current=!0,()=>{p.current=!1}),[]),(0,n.useEffect)(()=>{d({kind:"hidden"})},[e]);const b=(0,n.useCallback)(async()=>{try{const T=await i.files.backfillList({project_id:e});return!T.ok||T.error?null:Wu(T.data)}catch{return null}},[i,e]),h=(0,n.useCallback)(async()=>{if(c.current)return;c.current=!0;const T=f.current;let _=0;try{for(;p.current&&f.current===T&&x.current;){const E=await b();if(!p.current)break;if(E)if(E.kind==="hidden"){if(_+=1,_>=pa){d({kind:"failed"});break}}else{if(_=0,d(E),E.kind==="done")try{await k.current?.()}catch{}if(zu(E))break}else if(_+=1,_>=pa){d({kind:"failed"});break}await new Promise(w=>setTimeout(w,Hu))}}finally{c.current=!1}},[b]);return(0,n.useEffect)(()=>{l&&h()},[l,h]),(0,n.useEffect)(()=>{if(a.kind!=="done")return;const T=setTimeout(()=>{p.current&&d({kind:"hidden"})},Uu);return()=>clearTimeout(T)},[a.kind]),{state:a,cancel:(0,n.useCallback)(()=>{d(T=>T.kind==="scanning"||T.kind==="indexing"?{...T,cancelling:!0}:T),i.files.backfillCancelCreate({project_id:e})},[i,e]),retry:(0,n.useCallback)(()=>{x.current=!0,i.files.backfillCreate({project_id:e}),h()},[i,e,h]),dismiss:(0,n.useCallback)(()=>d({kind:"hidden"}),[])}}var Yu=r.lazyRoute(()=>(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>fo("./6b904901.js")),void 0,{}.url)),Xu=r.lazyRoute(()=>(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>fo("./348ec5fd.js")),void 0,{}.url)),ha={height:"100%"};function Ku(e){(e?(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>fo("./fd8197a8.js")),void 0,{}.url):(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>fo("./a013bc08.js")),void 0,{}.url)).catch(()=>{})}var qu=({storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,contentKey:a})=>{const d=r.useAppConfig(),c=r.isImageEditModal(r.useSelector(r.selectActiveModal$1)),p=!!d.imageCenterFileManagerView;(0,n.useEffect)(()=>{c&&Ku(p)},[c,p]);let f=(0,o.jsx)(t.ui_kit$PageLoader,{style:ha});return e&&i&&d.imageCenterFileManagerView?f=(0,o.jsx)(Yu,{storageProvider:e,dataProvider:i,pathProxy:l},a):e&&i&&(f=(0,o.jsx)(Xu,{dataProvider:i,usesBuiltInStorage:s},a)),(0,o.jsx)(n.Suspense,{fallback:(0,o.jsx)(t.ui_kit$PageLoader,{style:ha}),children:f})};function Ju(){const e=r.useAppConfig(),i=r.useIsStandalone(),l=r.useStorageProvider(),s=r.useProjectData(),a=r.useRestClient(r.EM_FILES_MODULES),d=r.useStore(),c=(0,n.useMemo)(()=>r.createRestClientV2(d),[d]),p=r.useI18n(),f=r.useCurrentUser(),x=s?.id?String(s.id):"",k=f?.id!=="0"?String(f.id):"",b=r.isFileManagerV2Enabled(e),[h,T]=(0,n.useState)(null),_=b&&!!x&&h===x,[E,w]=(0,n.useState)(0),[v,A]=(0,n.useState)(0),j=(0,n.useRef)(x);(0,n.useEffect)(()=>{j.current!==x&&(j.current=x,T(null))},[x]);const C=(0,n.useCallback)($=>{$&&x&&T(x)},[x]),P=(0,n.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:l,projectId:x,restApi:a,restApiV2:c,i18n:p,pathPostfix:k,appConfig:e,isStandalone:i,onIndexingStateChange:C}),[e,C,p,i,x,E,a,c,l,k]),Y=(0,n.useCallback)(async()=>{try{typeof P.dataProvider?.clearCache=="function"&&await P.dataProvider.clearCache()}catch{}T(null),w($=>$+1),A($=>$+1)},[P.dataProvider]),z=(0,n.useCallback)(()=>{x&&T(x)},[x]);return{...P,projectId:x,restApiV2:c,v2Enabled:b,backfillTriggered:_,contentKey:`${x}:${v}`,handleIndexingCompleted:Y,markIndexingStarted:z}}var Qu={height:"100%"},ba=()=>{const{storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,projectId:a,restApiV2:d,v2Enabled:c,backfillTriggered:p,contentKey:f,handleIndexingCompleted:x,markIndexingStarted:k}=Ju(),b=r.useSelector(r.selectActiveModal$1),h=r.isImageCenterModal(b),{state:T,cancel:_,retry:E,dismiss:w}=Gu({projectId:a,api:d,triggered:p,onCompleted:x}),v=n.default.useCallback(()=>{k(),E()},[k,E]);return(0,o.jsxs)(o.Fragment,{children:[h&&(0,o.jsx)(n.Suspense,{fallback:(0,o.jsx)(t.ui_kit$PageLoader,{style:Qu}),children:(0,o.jsx)(qu,{storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,contentKey:f})}),c&&(0,o.jsx)(Mu,{state:T,onCancel:_,onRetry:v,onDismiss:w})]})},Zu=(function(){var e=window.__useblocks__;if(e&&e.assetUrl)return e.assetUrl("icon-menu-block-welcome.1c534a003522feadd2e7.png");if(e&&e.publicPath)try{return new URL("static/media/icon-menu-block-welcome.1c534a003522feadd2e7.png",e.publicPath).href}catch{}try{return new URL("/static/media/icon-menu-block-welcome.1c534a003522feadd2e7.png",typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"").href}catch{return"/static/media/icon-menu-block-welcome.1c534a003522feadd2e7.png"}})();function em(e){return!!(e?.global_block??e?.acf?.global_block)}var om=({className:e,size:i=16})=>{const l=r.useAppConfig(),{__:s}=r.useI18n(),a=s("Global block");return(0,o.jsx)(t.ui_kit$Tooltip,{title:a,placement:"top",trigger:["hover"],children:(0,o.jsx)("span",{className:(0,He.default)("block-global-badge",e),"aria-label":a,role:"img",children:(0,o.jsx)(r.EmIcons,{icon:"Globe02Icon",component:t.icons$Globe02Icon,size:i,strokeWidth:l.iconStrokeWidth})})})},fa=new Map;function ga(e){return`<table cellspacing="0" cellpadding="0" border="0" width="100%">${e}</table>`}function pr(e,i){const l=i??"";if(e===void 0)return r.sanitizeHtml(ga(l));const s=String(e),a=fa.get(s);if(a&&a.source===l)return a.markup;const d=r.sanitizeHtml(ga(l));return fa.set(s,{source:l,markup:d}),d}var{name:hr,type:_a,tags:xa}={name:"name",type:"type",tags:"tags"},ka={[hr]:"",[_a]:[],[xa]:[]},ht={Header:10,Menu:20,Banners:30,Content:40,Lists:50,Buttons:60,Promocodes:70,"E-Commerce":80,Transactional:80,Articles:90,Polls:100,Applications:110,Feature:120,Separators:130,Contacts:140,Footer:150},br=({parentEmailId:e,blocksTab:i,search:l,reloadBlockScreens:s,setIsShowAddAllBlocksModal:a})=>{const d=r.parentEmailSource(e),c=r.useEditorProjectId(),p=wo.useSetHtmlElementInIframeHandler(),f=wo.useDragStartBlockToIframeHandler(),[x]=t.ui_kit$Form.useForm(),{data:k}=r.useGetBlocksSchemaQuery(),{token:b}=(0,t.ui_kit$useToken)(),{__:h,_x:T}=r.useI18n(),_=r.useNotification(),{modal:E}=t.ui_kit$App.useApp(),{confirm:w}=E;r.useRoutePathname();const v=r.useSelector(r.selectParentBlocks),A=gs(),j=(0,n.useRef)(null),C=(0,n.useRef)(null),P=r.useRootElement(),Y=640,z=207/Y,$=B=>em(B)?(0,o.jsx)("div",{className:"blocks-search__result-global-mark",children:(0,o.jsx)(om,{className:"block-global-badge--tile",size:14})}):null,O=r.useEmailAttribute("common_styles"),y=(0,n.useMemo)(()=>xs(O,A),[O,A]),oe=(0,n.useRef)(null),G=(0,n.useRef)(null),q=(0,n.useRef)(null),te=r.useStore();(0,n.useEffect)(()=>{C.current?.scrollTo({top:0})},[i,l]);const ue=r.useProjectData(),{data:me}=r.useGetTermsQuery({project:ue,kind:r.BLOCK_TAGS},{skip:!ue?.id}),[se,_e]=(0,n.useState)(()=>r.projectBlocksArgs(c));(0,n.useEffect)(()=>{l||(x.setFieldsValue(ka),le({type:null,name:null}),s())},[l,x,s]),(0,n.useEffect)(()=>{if(k){const B=k.schema.properties.acf.properties.type.items.enum;let S=[];for(let m in B)S.push({label:h(r.TYPES_TRANSLATE[B[m]]),value:B[m]})}},[k,h]);const{isSuccess:ve,isError:de,isLoading:De,isFetching:ye,data:re,refetch:ke,error:ae}=r.useGetBlocksQuery({...se,page:1}),Q=(0,n.useMemo)(()=>{if(ve&&re)return[...re].sort((B,S)=>ht[B.type]-ht[S.type])},[ve,re]),[be,pe]=(0,n.useState)([]);r.usePrevious(B=>{B!==de&&_.fromError("BLOCK_GET_ERROR",{},ae,!0)},[de,ae,_]);const[ee,J]=(0,n.useState)(()=>r.parentEmailBlocksArgs(d)),{isSuccess:U,isError:X,isLoading:ce,isFetching:xe}=r.useGetParentEmailBlocksQuery({...ee,emailId:d,page:1},{skip:!d||v.length}),ne=(0,n.useMemo)(()=>{if(U||v.length)return[...v].sort((B,S)=>ht[B.type]-ht[S.type])},[U,v]),[Ae,we]=(0,n.useState)([]);(0,n.useEffect)(()=>{const B=new Set;if(v.length&&ne){for(const S of ne)S.type&&B.add(S.type);we(Array.from(B))}else we([])},[v,ne]);const[$e,K]=(0,n.useState)(r.templateBlocksArgs),{isSuccess:ie,isError:je,isLoading:V,isFetching:Se,data:Ie=[]}=r.useGetTemplateBlocksQuery({...$e,page:1}),Ne=(0,n.useMemo)(()=>{if(Ie.length)return[...Ie].sort((B,S)=>ht[B.type]-ht[S.type])},[Ie]),[Fe,Ve]=(0,n.useState)([]);(0,n.useEffect)(()=>{const B=new Set;if(Ne&&Ie.length){for(const S of Ne)S.type&&B.add(S.type);Ve(Array.from(B))}},[Ie.length,Ne]);const Ue=(0,n.useMemo)(()=>{const B=new Set;for(const S of be)B.add(S);for(const S of Ae)B.add(S);for(const S of Fe)B.add(S);return Array.from(B)},[Fe,Ae,be]),le=B=>{_e(S=>({...S,...B,page:1})),J(S=>({...S,...B,page:1})),K(S=>({...S,...B,page:1}))},Te=r.useFitBlockPreviewHeight(z),I=(0,n.useCallback)(()=>{P.querySelector(".blocks-search__result-wrapper.is_search")&&(P.querySelector(".blocks-search__result-wrapper").style.removeProperty("transition"),P.querySelector(".blocks-search__result-wrapper").style.opacity=0,r.measureBlockPreviews(P,207/Y),P.querySelector(".blocks-search__result-wrapper").style.transition="opacity 0.2s",P.querySelectorAll(".blocks-search__result-wrapper").forEach(B=>B.style.opacity=1))},[Y,P]);(0,n.useEffect)(()=>{!(Se||V)&&ie&&i!=="template"&&(l?I():s())},[Se,V,ie,I,se.name,s,l,i]),(0,n.useEffect)(()=>{const B=new Set;if(ve&&Q){for(const S of Q)S.type&&B.add(S.type);pe(Array.from(B))}},[ve,Q]);const Z=B=>{const S=Object.keys(B)[0],m=x.getFieldsValue(!0);switch(S){case xa:const M=(me||[]).filter(H=>B[S].includes(H.name)).map(H=>H.id)||null;le({tags:M});break;case _a:le({type:m.type||null});break;case hr:j.current&&window.clearTimeout(j.current),j.current=window.setTimeout(function(){le({name:m.name||null})},300)}},Be=B=>{s(),B.target.getAttribute("data-type")?(B.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(S=>S.style.display="none"),B.target.closest(".blocks-search").querySelectorAll(`[data-type="${B.target.getAttribute("data-type")}"]`).forEach(S=>S.style.display="block")):B.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(S=>S.style.display="block"),B.target.parentElement.querySelector(".active").classList.remove("active"),B.target.classList.add("active")};let Ce=null;const Me=B=>{clearTimeout(Ce);let S=P.querySelector(".block-search__preview")?P.querySelector(".block-search__preview"):null,m=P.querySelector(".block-search__preview-title")?P.querySelector(".block-search__preview-title"):null,M=P.querySelector(".block-search__preview-content")?P.querySelector(".block-search__preview-content"):null;P.querySelector(".block-search__preview")||(S=document.createElement("div"),S.classList.add("block-search__preview"),m=document.createElement("div"),m.classList.add("block-search__preview-title"),M=document.createElement("div"),M.classList.add("block-search__preview-content"),S.append(M),S.append(m),P.querySelector(".email-pane__col_settings-inner").append(S)),m.innerHTML="",M.innerHTML="",m.innerHTML=B.title;let H=B.html.replaceAll(/<style((.|\n|\r)*?)<\/style>/gi,"").trim();M.innerHTML=r.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+H+"</table>"),S.style.opacity!=="1"&&setTimeout(function(){S.style.opacity="1",S.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(100%)":"translateX(-100%)"},10)},Ge=()=>{let B=P.querySelector(".block-search__preview");B&&(Ce=setTimeout(()=>{B.style.opacity="0",B.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(99%)":"translateX(-99%)",setTimeout(function(){B.remove()},300)},300))};(0,n.useEffect)(()=>{P.querySelectorAll(".blocks-search__result").forEach(B=>{B.style.display="block"})},[i]);const Ye=!re?.length&&(!d||!v?.length)&&!Ie?.length&&(se.tags||se.name||se.type)&&!(De||ye),D=B=>te.dispatch(r.blocksApi.endpoints.deleteBlock.initiate(B.id)).then(S=>{S.error&&_.fromError("BLOCK_REMOVING_ERROR",r.getBlockDesc(B),S.error),_.success({id:"BLOCK_REMOVING_SUCCESS",data:r.getBlockDesc(B),title:h('The block "')+S.data.title+T('" was successfully removed.',"block")}),ke()});(0,n.useEffect)(()=>{!De&&!ye&&s()},[De,ye,s]),(0,n.useEffect)(()=>{(i==="common"||l)&&setTimeout(s,50)},[re,s,i,l]);const L=B=>{w({mask:{closable:!0},centered:!0,title:T("Are you sure you want to delete the “","block")+B.title+h("” block?"),icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:22,style:{color:t.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0}}),okText:h("Yes"),cancelText:h("No"),onOk:()=>D(B)})},R=B=>[{key:"Delete block",className:"blocks-search__result__menu-item",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16,style:{margin:0}}),style:{color:b.colorError},onClick:()=>L(B)}],F=B=>{let S=B.html.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");if(S.replaceChildren(...r.parseFromString(B.html)),Object.keys(y).length!==0&&(S.querySelectorAll(".em-contrast-card").forEach(m=>{y.cards?.contrastBackgroundColor&&(m.getAttribute("bgcolor")?y.cards.contrastBackgroundColor?m.setAttribute("bgcolor",y.cards.contrastBackgroundColor):m.removeAttribute("bgcolor"):y.cards.contrastBackgroundColor?m.style.backgroundColor=y.cards.contrastBackgroundColor:m.style.removeProperty("background-color")),y.cards?.contrastTextColor&&m.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(M=>{if(Le(M.style.color).toLowerCase()!=="#ffffff"){let H=M.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.cards.contrastTextColor};`);M.setAttribute("style",H)}})}),S.querySelectorAll(".em-card").forEach(m=>{y.cards?.baseBackgroundColor&&(m.getAttribute("bgcolor")?y.cards.baseBackgroundColor?m.setAttribute("bgcolor",y.cards.baseBackgroundColor):m.removeAttribute("bgcolor"):y.cards.baseBackgroundColor?m.style.backgroundColor=y.cards.baseBackgroundColor:m.style.removeProperty("background-color")),y.cards?.baseTextColor&&m.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(M=>{if(Le(M.style.color).toLowerCase()!=="#ffffff"){let H=M.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.cards.baseTextColor};`);M.setAttribute("style",H)}})}),S.querySelectorAll(".em-card, .em-contrast-card").forEach(m=>{y.cards?.border&&Xe({settings:{border:y.cards?.border},elem:m}),y.cards?.borderRadius?.all?(m.style.borderBottomLeftRadius&&m.style.borderBottomLeftRadius!=="0px"&&(m.style.borderBottomLeftRadius=y.cards?.borderRadius.all+"px"),m.style.borderBottomRightRadius&&m.style.borderBottomRightRadius!=="0px"&&(m.style.borderBottomRightRadius=y.cards?.borderRadius.all+"px"),m.style.borderTopLeftRadius&&m.style.borderTopLeftRadius!=="0px"&&(m.style.borderTopLeftRadius=y.cards?.borderRadius.all+"px"),m.style.borderTopRightRadius&&m.style.borderTopRightRadius!=="0px"&&(m.style.borderTopRightRadius=y.cards?.borderRadius.all+"px")):y.cards?.borderRadius?.all===""?m.style.removeProperty("border-radius"):(y.cards?.borderRadius?.topLeft&&m.style.borderTopLeftRadius&&m.style.borderTopLeftRadius!=="0px"?m.style.borderTopLeftRadius=y.cards?.borderRadius.topLeft+"px":y.cards?.borderRadius?.topLeft===""&&m.style.removeProperty("border-top-left-radius"),y.cards?.borderRadius?.topRight&&m.style.borderTopRightRadius&&m.style.borderTopRightRadius!=="0px"?m.style.borderTopRightRadius=y.cards?.borderRadius.topRight+"px":y.cards?.borderRadius?.topRight===""&&m.style.removeProperty("border-top-right-radius"),y.cards?.borderRadius?.bottomRight&&m.style.borderBottomRightRadius&&m.style.borderBottomRightRadius!=="0px"?m.style.borderBottomRightRadius=y.cards?.borderRadius.bottomRight+"px":y.cards?.borderRadius?.bottomRight===""&&m.style.removeProperty("border-bottom-right-radius"),y.cards?.borderRadius?.bottomLeft&&m.style.borderBottomLeftRadius&&m.style.borderBottomLeftRadius!=="0px"?m.style.borderBottomLeftRadius=y.cards?.borderRadius.bottomLeft+"px":y.cards?.borderRadius?.bottomLeft===""&&m.style.removeProperty("border-bottom-left-radius"))}),S.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(m=>{if(!m.style.display&&parseFloat(m.style.fontSize)<=20){let M="",H=y.text.fontFamily;if(parseFloat(m.style.fontSize)>14&&(M=m.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${y.text.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${y.text.lineHeight}px`),m.setAttribute("style",M)),!m.closest(".em-contrast-card, .em-card")&&Le(m.style.color).toLowerCase()!=="#ffffff"&&(M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.text.color};`),m.setAttribute("style",M)),m.closest(".em-contrast-block")&&!m.closest(".em-contrast-card, .em-card")&&(M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.text.contrastColor};`),m.setAttribute("style",M)),H[0]==="Safe Fonts"?(m.style.fontFamily=H[1],he({elem:S})):H[0]==="Google Fonts"&&(H[1]==="Sans Serif"?m.style.fontFamily="Helvetica, Arial, sans-serif":H[1]==="Serif"&&(m.style.fontFamily='"Times New Roman", Times, serif'),m.classList.remove(...[...m.classList].filter(Re=>Re.startsWith("em-font"))),m.classList.add(`em-font-${H[2].replace(/\s/g,"")}-${H[3].replace(/\s/g,"")}`),eo({elem:S,fontFamilyArray:H})),m.closest('[em="atom"] > tr > td')&&m.closest('[em="atom"] > tr > td').style.paddingBottom)m.closest('[em="atom"] > tr > td').style.paddingBottom=y.text.paddingBottom+"px";else if(m.nextElementSibling||m.closest("table")&&m.closest("table").nextElementSibling){let Re=m.nextElementSibling??m.closest("table").nextElementSibling;Re&&Re.tagName==="TABLE"&&(Re.classList.contains("em-vindent-table")||Re.querySelector("td").innerHTML==="")&&Re.querySelector("td").setAttribute("height",y.text.paddingBottom)}}else if(!m.style.display&&parseFloat(m.style.fontSize)>=20&&Le(m.style.color).toLowerCase()!=="#eb3737"){let M="",H=y.headings.fontFamily;parseFloat(m.style.fontSize)<40&&(M=m.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${y.headings.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${y.headings.lineHeight}px`),m.setAttribute("style",M)),!m.closest(".em-contrast-card, .em-card")&&Le(m.style.color).toLowerCase()!=="#ffffff"&&(M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.headings.color};`),m.setAttribute("style",M)),m.closest(".em-contrast-block")&&!m.closest(".em-contrast-card, .em-card")&&(M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.headings.contrastColor};`),m.setAttribute("style",M)),H[0]==="Safe Fonts"?(m.style.fontFamily=H[1],he({elem:S})):H[0]==="Google Fonts"&&(H[1]==="Sans Serif"?m.style.fontFamily="Helvetica, Arial, sans-serif":H[1]==="Serif"&&(m.style.fontFamily='"Times New Roman", Times, serif'),m.classList.remove(...[...m.classList].filter(fe=>fe.startsWith("em-font"))),m.classList.add(`em-font-${H[2].replace(/\s/g,"")}-${H[3].replace(/\s/g,"")}`),eo({elem:S,fontFamilyArray:H}));let Re="";if(y.headings.letterSpacing>0?Re=m.style.letterSpacing?m.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${y.headings.letterSpacing}px`):m.getAttribute("style")+` letter-spacing: ${y.headings.letterSpacing}px;`:Re=m.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),m.setAttribute("style",Re),y.headings.bold?m.querySelector("b")?m.querySelector("b").replaceWith(...m.querySelector("b").childNodes):m.querySelector("strong")||(m.innerHTML="<strong>"+m.innerHTML+"</strong>"):m.querySelector("strong")?m.querySelector("strong").replaceWith(...m.querySelector("strong").childNodes):m.querySelector("b")&&m.querySelector("b").replaceWith(...m.querySelector("b").childNodes),m.style.fontWeight){let fe=m.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");m.setAttribute("style",fe)}if(y.headings.italic?m.querySelector("i")?m.querySelector("i").replaceWith(...m.querySelector("i").childNodes):m.querySelector("em")||(m.innerHTML="<em>"+m.innerHTML+"</em>"):m.querySelector("em")?m.querySelector("em").replaceWith(...m.querySelector("em").childNodes):m.querySelector("i")&&m.querySelector("i").replaceWith(...m.querySelector("i").childNodes),m.style.fontStyle){let fe=m.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");m.setAttribute("style",fe)}if(m.closest('[em="atom"] > tr > td')&&m.closest('[em="atom"] > tr > td').style.paddingTop)m.closest('[em="atom"] > tr > td').style.paddingTop=y.headings.paddingTop+"px";else if(m.previousElementSibling){let fe=m.previousElementSibling;fe&&fe.tagName==="TABLE"&&(fe.classList.contains("em-vindent-table")||fe.querySelector("td").innerHTML==="")&&fe.querySelector("td").setAttribute("height",y.headings.paddingTop)}if(m.closest('[em="atom"] > tr > td')&&m.closest('[em="atom"] > tr > td').style.paddingBottom)m.closest('[em="atom"] > tr > td').style.paddingBottom=y.headings.paddingBottom+"px";else if(m.nextElementSibling){let fe=m.nextElementSibling;fe&&fe.tagName==="TABLE"&&(fe.classList.contains("em-vindent-table")||fe.querySelector("td").innerHTML==="")&&fe.querySelector("td").setAttribute("height",y.headings.paddingBottom)}}}),S.querySelectorAll('a[style*="color"]').forEach(m=>{if(m.style.display){if(m.style.display&&m.style.display==="block"){let M="";if(M=m.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${y.buttons.fontSize}px`),m.setAttribute("style",M),m.closest("td").style.backgroundColor&&!m.closest("td").style.borderWidth&&!m.closest(".em-contrast-card"))if(m.closest(".em-contrast-block")?M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.buttons.contrastColor};`):M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.buttons.color};`),m.setAttribute("style",M),m.closest(".em-contrast-block"))if(y.buttons.contrastBackgroundColor){let fe=m.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${y.buttons.contrastBackgroundColor};`);m.closest("td").setAttribute("style",fe)}else m.closest("td").style.removeProperty("background-color");else if(y.buttons.backgroundColor){let fe=m.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${y.buttons.backgroundColor};`);m.closest("td").setAttribute("style",fe)}else m.closest("td").style.removeProperty("background-color");else if(m.closest("td").style.borderWidth)if(Object.values(y.buttons.border).every(fe=>fe===null)){if(m.closest(".em-contrast-block")){if(y.buttons.contrastBackgroundColor){let fe=m.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,ze=>ze.replace(/#[A-Fa-f0-9]{6}/,`${y.buttons.contrastBackgroundColor}`));m.closest("td").setAttribute("style",fe),M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.buttons.contrastBackgroundColor};`),m.setAttribute("style",M)}}else if(y.buttons.backgroundColor){let fe=m.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,ze=>ze.replace(/#[A-Fa-f0-9]{6}/,`${y.buttons.backgroundColor}`));m.closest("td").setAttribute("style",fe),M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.buttons.backgroundColor};`),m.setAttribute("style",M)}}else for(const fe in y.buttons.border)y.buttons.border[fe]&&y.buttons.border[fe].color!==void 0&&(M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.buttons.border[fe].color};`),m.setAttribute("style",M));else m.closest(".em-contrast-block")?y.buttons.contrastBackgroundColor&&(M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.buttons.contrastBackgroundColor};`),m.setAttribute("style",M)):y.buttons.backgroundColor&&(M=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.buttons.backgroundColor};`),m.setAttribute("style",M));let H=y.buttons.fontFamily;H[0]==="Safe Fonts"?(m.style.fontFamily=H[1],he({elem:S})):H[0]==="Google Fonts"&&(H[1]==="Sans Serif"?m.style.fontFamily="Helvetica, Arial, sans-serif":H[1]==="Serif"&&(m.style.fontFamily='"Times New Roman", Times, serif'),m.classList.remove(...[...m.classList].filter(fe=>fe.startsWith("em-font"))),m.classList.add(`em-font-${H[2].replace(/\s/g,"")}-${H[3].replace(/\s/g,"")}`),eo({elem:S,fontFamilyArray:H})),m.closest("td").setAttribute("align",y.buttons.textAlign);let Re="";if(y.buttons.letterSpacing>0?Re=m.style.letterSpacing?m.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${y.buttons.letterSpacing}px`):m.getAttribute("style")+` letter-spacing: ${y.buttons.letterSpacing}px;`:Re=m.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),m.setAttribute("style",Re),y.buttons.bold?m.querySelector("b")?m.querySelector("b").replaceWith(...m.querySelector("b").childNodes):m.querySelector("strong")||(m.innerHTML="<strong>"+m.innerHTML+"</strong>"):m.querySelector("strong")?m.querySelector("strong").replaceWith(...m.querySelector("strong").childNodes):m.querySelector("b")&&m.querySelector("b").replaceWith(...m.querySelector("b").childNodes),m.style.fontWeight){let fe=m.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");m.setAttribute("style",fe)}if(y.buttons.italic?m.querySelector("i")?m.querySelector("i").replaceWith(...m.querySelector("i").childNodes):m.querySelector("em")||(m.innerHTML="<em>"+m.innerHTML+"</em>"):m.querySelector("em")?m.querySelector("em").replaceWith(...m.querySelector("em").childNodes):m.querySelector("i")&&m.querySelector("i").replaceWith(...m.querySelector("i").childNodes),m.style.fontStyle){let fe=m.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");m.setAttribute("style",fe)}if(m.closest('[em="atom"] > tr > td')&&m.closest('[em="atom"] > tr > td').style.paddingTop)m.closest('[em="atom"] > tr > td').style.paddingTop=y.buttons.marginTop+"px";else if(m.closest("table").previousElementSibling){let fe=m.closest("table").previousElementSibling;fe&&fe.tagName==="TABLE"&&(fe.classList.contains("em-vindent-table")||fe.querySelector("td").innerHTML==="")&&fe.querySelector("td").setAttribute("height",y.buttons.marginTop)}if(m.closest('[em="atom"] > tr > td')&&m.closest('[em="atom"] > tr > td').style.paddingBottom)m.closest('[em="atom"] > tr > td').style.paddingBottom=y.buttons.marginBottom+"px";else if(m.closest("table").previousElementSibling){let fe=m.closest("table").nextElementSibling;fe&&fe.tagName==="TABLE"&&(fe.classList.contains("em-vindent-table")||fe.querySelector("td").innerHTML==="")&&fe.querySelector("td").setAttribute("height",y.buttons.marginBottom)}y.buttons.padding.all&&(m.style.padding=y.buttons.padding.all+"px"),y.buttons.padding.top&&(m.style.paddingTop=y.buttons.padding.top+"px"),y.buttons.padding.right&&(m.style.paddingRight=y.buttons.padding.right+"px"),y.buttons.padding.bottom&&(m.style.paddingBottom=y.buttons.padding.bottom+"px"),y.buttons.padding.left&&(m.style.paddingLeft=y.buttons.padding.left+"px"),Xe({settings:{border:y.buttons.border},elem:m.closest("td")}),lo({settings:{borderRadius:y.buttons.borderRadius},elem:m.closest("td")})}}else{let M=y.text.fontFamily;if(Le(m.style.color).toLowerCase()==="#1c52dc"){let Re=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.links.color};`);m.setAttribute("style",Re)}else{let Re=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.text.color};`);m.setAttribute("style",Re)}if(m.closest(".em-contrast-block")){let Re=m.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${y.links.contrastColor};`);m.setAttribute("style",Re)}let H="";y.links.underline?H=m.style.textDecoration?m.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: underline;"):m.getAttribute("style")+" text-decoration: underline;":H=m.style.textDecoration?m.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: none;"):m.getAttribute("style")+" text-decoration: none;",m.setAttribute("style",H),M[0]==="Safe Fonts"?(m.style.fontFamily=M[1],he({elem:S})):M[0]==="Google Fonts"&&(M[1]==="Sans Serif"?m.style.fontFamily="Helvetica, Arial, sans-serif":M[1]==="Serif"&&(m.style.fontFamily='"Times New Roman", Times, serif'),m.classList.remove(...[...m.classList].filter(Re=>Re.startsWith("em-font"))),m.classList.add(`em-font-${M[2].replace(/\s/g,"")}-${M[3].replace(/\s/g,"")}`),eo({elem:S,fontFamilyArray:M}))}}),S.querySelector('[em="block"]'))){const m=S.querySelectorAll('[em="block"]');y.block?.backgroundColor&&m.forEach(M=>{M.querySelectorAll(":scope > td").forEach(H=>{H.setAttribute("bgcolor",y.block.backgroundColor)})}),y.block?.padding&&m.forEach(M=>{M.querySelectorAll(":scope > td").forEach(H=>{H.style.paddingTop=y.block.padding.top+"px",H.style.paddingRight=y.block.padding.right+"px",H.style.paddingBottom=y.block.padding.bottom+"px",H.style.paddingLeft=y.block.padding.left+"px"})})}return S.tagName==="DIV"?r.getElementInnerHTML(S):r.getElementInnerHTML(S.querySelector("tbody")||S)},he=B=>{B.elem.querySelectorAll("link[em-class]").forEach(S=>{B.elem.querySelector("."+S.getAttribute("em-class"))||S.remove()})};function Le(B){if(B&&B.charAt(0)==="r"){if(B.charAt(3)==="a")return B=B.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i),B&&B.length===4?"#"+("0"+parseInt(B[1],10).toString(16)).slice(-2)+("0"+parseInt(B[2],10).toString(16)).slice(-2)+("0"+parseInt(B[3],10).toString(16)).slice(-2):"";{B=B.replace("rgb(","").replace(")","").split(",");let S=parseInt(B[0],10).toString(16),m=parseInt(B[1],10).toString(16),M=parseInt(B[2],10).toString(16);return S=S.length===1?"0"+S:S,m=m.length===1?"0"+m:m,M=M.length===1?"0"+M:M,"#"+S+m+M}}else if(B&&B.charAt(0)==="#")return B}const eo=B=>{const S=B.elem.querySelectorAll("link"),m=`em-font-${B.fontFamilyArray[2].replace(/\s/g,"")}-${B.fontFamilyArray[3].replace(/\s/g,"")}`;if(!Array.from(S)?.find(H=>H.getAttribute("em-class")===m)){let H=document.createElement("link");H.setAttribute("rel","stylesheet"),H.setAttribute("href",`https://fonts.googleapis.com/css2?family=${B.fontFamilyArray[2]}:ital,wght@${Qe[B.fontFamilyArray[3]].indexOf("i")>-1?"1":"0"},${Qe[B.fontFamilyArray[3]].replaceAll("i","")}&display=swap`),H.setAttribute("em-class",m),B.elem.insertAdjacentElement("afterbegin",H)}Eo({elem:B.elem});let M=`font-family: '${B.fontFamilyArray[2]}', ${uo[B.fontFamilyArray[1]]}!important;`;M+=` font-weight: ${Qe[B.fontFamilyArray[3]].replaceAll("i","")}!important;`,Qe[B.fontFamilyArray[3]].indexOf("i")>-1&&(M+=" font-style: italic!important;"),B.elem.querySelector('style[em="styles"]').insertAdjacentHTML("beforeend",`
|
|
22
|
+
.em-font-${B.fontFamilyArray[2].replace(/\s/g,"")}-${B.fontFamilyArray[3].replace(/\s/g,"")} { ${M} }`),setTimeout(()=>he({elem:B.elem}),0)},Xe=B=>{B.settings.border.all?B.settings.border.all.width!=null&&(B.settings.border.all.style||B.settings.border.all.color)?(B.elem.style.borderWidth=B.settings.border.all.width+"px",B.elem.style.borderStyle=B.settings.border.all.style,B.elem.style.borderColor=B.settings.border.all.color):B.elem.style.removeProperty("border"):(B.settings.border.top&&(B.settings.border.top.width!=null&&(B.settings.border.top.style||B.settings.border.top.color)?(B.elem.style.borderTopWidth=B.settings.border.top.width+"px",B.elem.style.borderTopStyle=B.settings.border.top.style,B.elem.style.borderTopColor=B.settings.border.top.color):B.elem.style.removeProperty("border-top")),B.settings.border.right&&(B.settings.border.right.width!=null&&(B.settings.border.right.style||B.settings.border.right.color)?(B.elem.style.borderRightWidth=B.settings.border.right.width+"px",B.elem.style.borderRightStyle=B.settings.border.right.style,B.elem.style.borderRightColor=B.settings.border.right.color):B.elem.style.removeProperty("border-right")),B.settings.border.bottom&&(B.settings.border.bottom.width!=null&&(B.settings.border.bottom.style||B.settings.border.bottom.color)?(B.elem.style.borderBottomWidth=B.settings.border.bottom.width+"px",B.elem.style.borderBottomStyle=B.settings.border.bottom.style,B.elem.style.borderBottomColor=B.settings.border.bottom.color):B.elem.style.removeProperty("border-bottom")),B.settings.border.left&&(B.settings.border.left.width!=null&&(B.settings.border.left.style||B.settings.border.left.color)?(B.elem.style.borderLeftWidth=B.settings.border.left.width+"px",B.elem.style.borderLeftStyle=B.settings.border.left.style,B.elem.style.borderLeftColor=B.settings.border.left.color):B.elem.style.removeProperty("border-left")))},lo=B=>{B.settings.borderRadius.all?B.elem.style.borderRadius=B.settings.borderRadius.all+"px":B.settings.borderRadius.all===""?B.elem.style.removeProperty("border-radius"):(B.settings.borderRadius.topLeft?B.elem.style.borderTopLeftRadius=B.settings.borderRadius.topLeft+"px":B.settings.borderRadius.topLeft===""&&B.elem.style.removeProperty("border-top-left-radius"),B.settings.borderRadius.topRight?B.elem.style.borderTopRightRadius=B.settings.borderRadius.topRight+"px":B.settings.borderRadius.topRight===""&&B.elem.style.removeProperty("border-top-right-radius"),B.settings.borderRadius.bottomRight?B.elem.style.borderBottomRightRadius=B.settings.borderRadius.bottomRight+"px":B.settings.borderRadius.bottomRight===""&&B.elem.style.removeProperty("border-bottom-right-radius"),B.settings.borderRadius.bottomLeft?B.elem.style.borderBottomLeftRadius=B.settings.borderRadius.bottomLeft+"px":B.settings.borderRadius.bottomLeft===""&&B.elem.style.removeProperty("border-bottom-left-radius"))},Qe={Thin:"100","Thin Italic":"100i",ExtraLight:"200","ExtraLight Italic":"200i",Light:"300","Light Italic":"300i",Regular:"400","Regular Italic":"400i",Medium:"500","Medium Italic":"500i",SemiBold:"600","SemiBold Italic":"600i",Bold:"700","Bold Italic":"700i",ExtraBold:"800","ExtraBold Italic":"800i",Black:"900","Black Italic":"900i"},uo={"Sans Serif":"sans-serif",Serif:"serif"};function Eo(B){if(!B.elem.querySelector('style[em="styles"]')){let S=document.createElement("style");S.setAttribute("em","styles"),B.elem.append(S)}}return(0,o.jsxs)("div",{className:(0,He.default)("blocks-search",{is_search:l}),children:[(0,o.jsx)(t.ui_kit$Form,{className:(0,He.default)("blocks-search__form",{is_search:l}),form:x,layout:"vertical",name:"blocks_search_form",initialValues:{...ka},onValuesChange:Z,autoComplete:"off",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:hr,children:(0,o.jsx)(t.ui_kit$SearchInput,{placeholder:h("Search by title"),allowClear:!0,enterButton:!1})})}),(de||X||je)&&(0,o.jsx)(t.ui_kit$Alert,{title:h("Error"),description:h("Error when receiving data. Try again (reload page) or contact support."),type:"error",showIcon:!0}),l&&!Ye&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:Be,children:h("All")},"search_All"),Ue.map(B=>(0,o.jsx)("li",{"data-type":B,onClick:Be,children:h(r.TYPES_TRANSLATE[B])},"search_"+B))]})}),(0,o.jsxs)("div",{ref:C,className:(0,He.default)("blocks-search__result-wrapper",{is_search:l}),children:[(i==="project"||l)&&(0,o.jsxs)(o.Fragment,{children:[!!be.length&&!l&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:Be,children:h("All")},"blocksSections_All"),be.map(B=>(0,o.jsx)("li",{"data-type":B,onClick:Be,children:h(r.TYPES_TRANSLATE[B])},"blocksSections_"+B))]})}),(0,o.jsxs)("div",{className:(0,He.default)("blocks-search__blocks-wrapper",{is_search:l}),ref:oe,children:[(0,o.jsx)("div",{className:"blocks-search__result-holder project",children:!(De||ye)&&(Q?.length?Q.map((B,S)=>{const m=pr(B.id,B.html);return(0,o.jsx)("div",{className:"blocks-search__result","data-type":B.type,children:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"leftTop",menu:{items:R(B)},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:M=>p(M,B.html,"project",B.title,B),onDragStart:M=>f(M,B.html,"project",B.title,B),onMouseEnter:()=>Me({html:B.html,title:B.title}),onMouseLeave:Ge,children:[$(B),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:m,onContentLoad:Te,style:{transform:`scale(${z})`}})]})},"commenMenu")},B.id+S.toString())}):!(se.tags||se.name||se.type)&&ve&&!(De||ye)&&!l&&(0,o.jsxs)("div",{style:{padding:"10px 0 20px",display:"flex",flexDirection:"row",justifyContent:"space-between"},children:[(0,o.jsxs)("div",{style:{width:"110%"},children:[(0,o.jsx)("h3",{style:{lineHeight:"1.2"},children:h("You don`t have any saved blocks yet.")}),h("To add a block from the dashboard click the"),' "',h("Save to Blocks button."),'" ',(0,o.jsx)(r.EmIcons,{icon:"SaveBlock",component:t.icons$SaveBlock,style:{position:"relative",top:"2px"}}),(0,o.jsx)("br",{}),(0,o.jsx)("br",{}),h("You can also save all blocks at once. The AI assistant will automatically determine the type and create a name for each block when saving."),(0,o.jsx)("br",{}),(0,o.jsx)("br",{}),(0,o.jsx)(t.ui_kit$Flex,{justify:"left",children:(0,o.jsx)(t.ui_kit$Button,{type:"primary",onClick:()=>a(!0),style:{cursor:"pointer"},children:h("Save all blocks")})})]}),(0,o.jsx)("div",{style:{width:"80px",height:"200px"},children:(0,o.jsx)("img",{src:Zu,style:{display:"block",width:80,position:"absolute",right:5}})})]}))}),(De||ye)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),l&&re?.length>0&&v?.length>0&&(0,o.jsx)(t.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="template"||l)&&(0,o.jsxs)(o.Fragment,{children:[!!Ae.length&&!l&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:Be,children:h("All")},"templateBlocksSections_All"),Ae.map(B=>(0,o.jsx)("li",{"data-type":B,onClick:Be,children:h(r.TYPES_TRANSLATE[B])},"templateBlocksSections_"+B))]})}),(0,o.jsxs)("div",{className:(0,He.default)("blocks-search__blocks-wrapper",{is_search:l}),ref:G,children:[(0,o.jsxs)("div",{className:"blocks-search__result-holder template",children:[v&&!(ce||xe)&&ne?.length?(0,o.jsx)(o.Fragment,{children:ne.map((B,S)=>{const m=pr(B.id,B.html);return(0,o.jsx)("div",{className:"blocks-search__result","data-type":B.type,children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:M=>p(M,B.html,"template",B.title,B),onDragStart:M=>f(M,B.html,"template",B.title,B),onMouseEnter:()=>Me({html:B.html,title:B.title}),onMouseLeave:()=>Ge(),children:[$(B),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:m,onContentLoad:Te,style:{transform:`scale(${z})`}})]})},B.id+S.toString())})}):!l&&!V&&!xe&&(0,o.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:h("No related blocks found.")})," "]}),(ce||xe)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),l&&v?.length>0&&Ie?.length>0&&(0,o.jsx)(t.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="common"||l)&&(0,o.jsxs)(o.Fragment,{children:[!!Fe?.length&&!l&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:Be,children:h("All")},"commonBlocksSections_All"),Fe.map(B=>(0,o.jsx)("li",{"data-type":B,onClick:Be,children:h(r.TYPES_TRANSLATE[B])},"commonBlocksSections_"+B))]})}),(0,o.jsxs)("div",{className:(0,He.default)("blocks-search__blocks-wrapper",{is_search:l}),ref:q,children:[(0,o.jsxs)("div",{className:"blocks-search__result-holder common",children:[ie&&!!Ne?.length&&!(Se||V)&&(0,o.jsx)(o.Fragment,{children:Ne.map((B,S)=>{const m=F({html:pr(B.id,B.html)});return(0,o.jsx)("div",{className:"blocks-search__result","data-type":B.type,children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:M=>p(M,F({html:B.html}),"common",B.title,B),onDragStart:M=>f(M,F({html:B.html}),"common",B.title,B),onMouseEnter:()=>Me({html:F({html:r.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+B.html+"</table>")}),title:B.title}),onMouseLeave:()=>Ge(),children:[$(B),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:m,onContentLoad:Te,style:{transform:`scale(${z})`}})]})},B.id+S.toString())})})," "]}),(V||Se)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),Ye&&(0,o.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:h("There are no blocks for this request.")})]})]})};br.propTypes={};var Ea=({comments:e,subjectId:i,isLoggedIn:l,projectTitle:s="",emailElementType:a,email:d})=>{const{__:c,_n:p}=r.useI18n(),f=r.useSendPostMessage(),x=r.useNotification(),{token:k}=(0,t.ui_kit$useToken)(),b=r.useAppConfig(),h=r.usePushToDataLayer(),T=(0,n.useRef)(null),[_,E]=(0,n.useState)(""),[w,v]=(0,n.useState)("ADD"),[A,j]=(0,n.useState)(!1),[C,P]=(0,n.useState)(null),[Y,z]=(0,n.useState)(null),[$,O]=(0,n.useState)(""),[y,oe]=(0,n.useState)(""),[G,q]=(0,n.useState)(!1),[te,ue]=(0,n.useState)(""),[me,se]=r.useAddCommentMutation(),[_e,ve]=r.useDeleteCommentMutation(),[de,De]=r.useEditCommentMutation(),[ye,re]=r.useDeleteTargetMutation(),[ke]=r.useAutoSaveBlockMutation(),ae=r.useDispatch(),Q=r.useStore(),be=r.useCurrentUser(),pe=r.useCurrentProjectRequested(),ee=r.useContentReader(),J=le=>{const Te=r.getEmailDocuments(xo.getContainer(Q));Te.save("anchor",{project:le}).then(I=>{const Z=I?Te.revisionFacts()?.lastRevisionAt:void 0;Z!==void 0&&d?.id!=null&&ae(r.rememberAutosaveTime({emailId:d.id,modified:new Date(Z).toISOString()}))})},U=()=>{const le=pe;if(a==="email"){J(le);return}const Te={...d?.meta!==void 0?{meta:d.meta}:{},title:d?.title,emailId:d?.id,project:le,html:ee(),excerpt:d?.date_gmt};ke({blockId:d?.id,body:Te}).catch(I=>{})};function X(le){q(!1),ue(""),f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:te}),j(!0),f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!0})}function ce(){z(C),e.filter(le=>le.parent===C).length?de({commentId:C,status:"deleted"}).unwrap():_e(C),document.querySelector('.discuss-main li[id="'+C+'"] .comment-icon-target')?.getAttribute("target-id")&&f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:document.querySelector('.discuss-main li[id="'+C+'"] .comment-icon-target')?.getAttribute("target-id")}),U(),ue("")}function xe(le){z(C);const Te=e.find(Z=>Z.id?.toString()===C),I=Te?.target_id?.toString()||"";q(!!I),ue(I),oe(Te?.content?.slice(3,-5)?.toString()),v("EDIT")}function ne(le){z(C),O(""),v("REPLY")}const Ae=()=>{x.error({mask:{closable:!0},centered:!0,title:c("Please log in"),content:(r.isUseBlocksBuild()?c("To leave comments you must be logged into Blocks and added to the project "):c("To leave comments you must be logged into EmailMaker and added to the project "))+`${s}.`,okText:c("Okay. I'll log in.")})};async function we(){l?(await de({commentId:Y,content:y,targetId:te}).unwrap(),v("ADD"),oe(""),z(0),q(!1),j(!1),ue(""),f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Ae()}const $e=le=>{v("ADD"),oe(""),z(0),q(!1),j(!1),ue(""),f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})},K=async()=>{l?((_||$)&&await me({subjectId:i,author:be.id,parent:w==="ADD"?"0":Y,content:_||$,author_name:be.name,author_email:be.email,targetId:te}).then(le=>{le.error?x.error({title:le.error.data.code,description:le.error.data.message}):h({event:"submit",action:"send_discussion_chat_message",entity_type:a==="block"?"block":"email",entity_id:d?.id,project_id:d?.project,context:"editor"})}),ue(""),v("ADD"),O(""),E(""),z(0),q(!1),j(!1),f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Ae()};function ie(){G?(j(!1),q(!1),f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:te})):(j(!A),f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!A}),A&&q(!1))}function je(le){let Te=JSON.parse(JSON.stringify(le));if(!Te||!Te.length)return[];let I=[],Z=new Map;for(let Be=0,Ce=Te.length;Be<Ce;++Be){let Me=Te[Be],Ge=Z.get(Me.id);if((!Ge||Array.isArray(Ge))&&(Ge&&(Me.children=Ge),Z.set(Me.id,Me)),String(Me.parent)==="0")I.push(Me);else{let Ye=Z.get(Me.parent);Ye?(Array.isArray(Ye)?Ye:Ye.children=Ye.children||[]).push(Me):Z.set(Me.parent,[Me])}}return I.forEach(Be=>{Be.status==="deleted"&&!Be.children&&(ve.isUninitialized||ve.isSuccess)&&_e(Be.id).unwrap().catch(Ce=>{})}),I}const V=le=>{const Te=le.data.operation;if(Te===r.EVENT_TYPES.APPLICATION_DISCUSS_SET_ID&&(ue(le.data.settings.value),le.data.settings.value!==""?(q(!0),j(!1)):(q(!1),j(!0))),Te===r.EVENT_TYPES.APPLICATION_DISCUSS_SAVE_TARGET&&U(),Te===r.EVENT_TYPES.APPLICATION_DISCUSS_GET_COMMENT)if(document.querySelector('.comment-icon-target[target-id="'+le.data.settings.targetId+'"]')){let I=document.querySelector('.comment-icon-target[target-id="'+le.data.settings.targetId+'"]').closest(".ant-comment");document.querySelector(".comment-block")?document.querySelector(".comment-block").scrollTo(0,I.offsetTop):document.querySelector(".em-analytics__email-tab-discuss .ant-tabs-content").scrollTo(0,I.offsetTop),I.classList.add("active"),setTimeout(()=>{I.classList.remove("active")},2e3)}else f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:le.data.settings.targetId}),x.error({title:c("There's no such comment.")});Te===r.EVENT_TYPES.APPLICATION_DISCUSS_NO_COMMENT&&x.error({title:c("There's no such element in the email.")})};r.useListenPostMessage(V);const Se=le=>{f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_GET_TARGET,value:le})},Ie=le=>(le?.sort((Te,I)=>Te.date>I.date?1:-1),(0,o.jsx)(o.Fragment,{children:le&&!!le.length&&(0,o.jsx)(t.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:le,renderItem:Te=>(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("li",{id:Te.id,children:(0,o.jsxs)(o.Fragment,{children:[Te.status==="deleted"&&Te.clildren&&(0,o.jsx)(t.ui_kit$Comment,{className:"deletedComment",content:(0,o.jsx)(t.ui_kit$Alert,{description:c("Comment was removed."),type:"info"}),children:Ie(Te.children)}),Te.status!=="deleted"&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Comment,{author_id:Te.author_id,author:Te.author_name,avatar:Te.author_avatar_urls&&Te.author_avatar_urls[48]||"",className:(0,He.default)(Te.target_id&&"targetted-comment-item",(!Te.author_avatar_urls||!Te.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>P(Te.id),menu:{items:Te.author===be.id?Ve:Ue},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,o.jsx)("div",{onClick:()=>Te.target_id&&Se(Te.target_id),dangerouslySetInnerHTML:{__html:Te.content}})},"commenMenu"),datetime:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:Te.date&&wo.formatDate(wo.tryParseISO(Te.date),p,!0)}}),Te.target_id&&(0,o.jsx)("span",{className:"comment-icon-target","target-id":Te.target_id,onClick:()=>Se(Te.target_id),children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,style:{color:k.colorInfo,top:-2,position:"relative"}})})]}),children:(0,o.jsxs)(o.Fragment,{children:[w==="REPLY"&&Y===Te.id&&Fe,w==="EDIT"&&Y===Te.id&&Ne,Ie(Te.children)]})})})]})})})})})),Ne=(0,o.jsxs)(t.ui_kit$Form,{onFinish:we,className:"commentForm",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{className:"textarea-reply",value:y,onChange:le=>oe(le.target.value),rows:4,placeholder:c("Editing comments"),onKeyDown:le=>le.key==="Escape"&&$e(),onPressEnter:le=>le.key==="Enter"&&le.ctrlKey&&we(),ref:T})}),(0,o.jsx)(t.ui_kit$Form.Item,{className:"buttons",children:(0,o.jsxs)(t.ui_kit$Space,{children:[G?(0,o.jsx)(t.ui_kit$Popconfirm,{title:c("Are you sure?"),okText:c("Yes"),cancelText:c("No"),onConfirm:X,children:(0,o.jsx)(t.ui_kit$Button,{loading:re.isLoading,type:A||G&&w==="EDIT"&&te!==""?"primary":"default",className:"button-target "+(A&&!G?"button-target_choose":""),style:G&&w==="EDIT"&&te!==""?{background:k.colorInfo}:{},children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,className:"icon-target"})})}):(0,o.jsx)(t.ui_kit$Button,{onClick:ie,loading:re.isLoading,type:A||G&&w==="EDIT"&&te!==""?"primary":"default",className:"button-target "+(A&&!G?"button-target_choose":""),style:G&&w==="EDIT"&&te!==""?{background:k.colorInfo}:{},children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,className:"icon-target"})}),(0,o.jsxs)(t.ui_kit$Button,{className:"button-reply",type:"primary",loading:De.isLoading,htmlType:"submit",children:[c("Save")," ",(0,o.jsx)(r.EmIcons,{icon:"SaveOutlined",component:t.icons$SaveOutlined,size:16,strokeWidth:b.iconStrokeWidth})]}),(0,o.jsx)(t.ui_kit$Button,{onClick:$e,className:"button-reply",children:c("Cancel")})]})})]}),Fe=(0,o.jsxs)(t.ui_kit$Form,{name:"reply",className:"commentForm",onFinish:K,children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{className:"textarea-reply",value:$,onChange:le=>O(le.target.value),rows:4,placeholder:c("Reply to the comment"),onKeyDown:le=>le.key==="Escape"&&$e(),onPressEnter:le=>le.key==="Enter"&&le.ctrlKey&&K(),ref:T})}),(0,o.jsx)(t.ui_kit$Form.Item,{hidden:!0,name:"targetId",children:(0,o.jsx)(t.ui_kit$Input,{type:"hidden"})}),(0,o.jsx)(t.ui_kit$Form.Item,{className:"buttons",children:(0,o.jsxs)(t.ui_kit$Space,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:c("Add a note"),styles:{body:{maxWidth:"150px"}},children:(0,o.jsx)(t.ui_kit$Button,{onClick:ie,type:A||G&&w==="REPLY"&&te!==""?"primary":"default",className:"button-target "+(A&&!G?"button-target_choose":""),style:G&&w==="REPLY"&&te!==""?{background:k.colorInfo}:{},children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,className:"icon-target"})})}),(0,o.jsxs)(t.ui_kit$Button,{className:"button-reply",type:"primary",loading:w==="REPLY"&&se.isLoading,htmlType:"submit",children:[c("Reply")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:b.iconStrokeWidth})]}),(0,o.jsx)(t.ui_kit$Button,{onClick:$e,className:"button-reply",ghost:!0,type:"primary",children:c("Cancel")})]})})]});(0,n.useEffect)(()=>{w==="REPLY"&&T.current.focus({cursor:"start"}),w==="EDIT"&&T.current.focus({cursor:"end"})},[w]);let Ve=[];Ve.push({key:"Reply to comment",icon:(0,o.jsx)(r.EmIcons,{icon:"RollbackOutlined",component:t.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:ne},{key:"Edit comment",icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,style:{fontSize:"16px"}}),label:c("Edit"),onClick:xe},{key:"Delete comment",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16}),label:c("Delete"),style:{color:k.colorError},onClick:ce});let Ue=[];return Ue.push({key:"Reply to comment",icon:(0,o.jsx)(r.EmIcons,{icon:"RollbackOutlined",component:t.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:ne}),(0,o.jsxs)("div",{className:"discuss-main",children:[e.length>0&&(0,o.jsx)(t.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:je(e),renderItem:le=>(0,o.jsxs)("li",{id:le.id,children:[le.comment_status==="deleted"&&(0,o.jsx)(t.ui_kit$Comment,{className:"deletedComment",content:(0,o.jsx)(t.ui_kit$Alert,{description:c("Comment was removed."),type:"info"}),children:Ie(le.children)}),le.comment_status!=="deleted"&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Comment,{author_id:le.author_id,author:le.author_name,avatar:le.author_avatar_urls&&le.author_avatar_urls[48]||"",className:(0,He.default)(le.target_id&&"targetted-comment-item",(!le.author_avatar_urls||!le.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>P(le.id),menu:{items:le.author===be.id?Ve:Ue},styles:{root:{minWidth:"auto"}},children:(0,o.jsx)("div",{onClick:()=>le.target_id&&Se(le.target_id),dangerouslySetInnerHTML:{__html:le.content}})},"commenMenu"),datetime:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:le.date&&wo.formatDate(wo.tryParseISO(le.date),p,!0)}}),le.target_id&&(0,o.jsx)("span",{className:"comment-icon-target","target-id":le.target_id,onClick:()=>Se(le.target_id),children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,style:{color:k.colorInfo,top:-2,position:"relative"}})})]}),children:(0,o.jsxs)(o.Fragment,{children:[w==="REPLY"&&Y===le.id&&Fe,w==="EDIT"&&Y===le.id&&Ne,Ie(le.children)]})})})]})}),(0,o.jsxs)(t.ui_kit$Form,{onFinish:K,className:w==="ADD"?"addMode":"replyEditMode",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{value:_,onChange:le=>E(le.target.value),rows:4,placeholder:c("Leave your comment"),className:"textarea-comment",onPressEnter:le=>le.key==="Enter"&&le.ctrlKey&&K()})}),(0,o.jsx)(t.ui_kit$Form.Item,{children:(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:c("Add a note"),styles:{body:{maxWidth:"150px"}},children:(0,o.jsx)(t.ui_kit$Button,{onClick:ie,type:A||G&&w==="ADD"&&te!==""?"primary":"default",className:"button-target "+(A&&!G?"button-target_choose":""),style:G&&w==="ADD"&&te!==""?{background:k.colorInfo}:{},icon:(0,o.jsx)(r.EmIcons,{icon:"Target",component:t.icons$Target,size:16,strokeWidth:b.iconStrokeWidth,className:"icon-target"})})}),(0,o.jsxs)(t.ui_kit$Button,{className:"button-add",type:"primary",loading:w==="ADD"&&se.isLoading,htmlType:"submit",children:[c("Send")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:b.iconStrokeWidth})]})]})})]})]})},tm=["common_styles","subject","preheader","meta"];function im(e,i){r.writeSourceReport(e,r.fromRevision(i))}function rm(e){if(!e)return null;const i=e.get().attributes??{},l={};for(const s of tm)i[s]!==void 0&&(l[s]=i[s]);return{content:e.getContent(),attributes:l}}function Ba(e,i){i&&r.writeSourceReport(e,{content:i.content,attributes:i.attributes})}var Sa=(e,i)=>({key:e.id,author:e.author,date:wo.formatDate(wo.tryParseISO(e.date||e.modified),i),title:e.title,html:e.html,common_styles:e.common_styles,loading:!1,isAutosave:e.isAutosave===!0}),fr=({emailElement:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),s=r.useDispatch(),a=r.useEditorProjectId(),d=r.useEmailAttributesWriter(),c=r.useContentReplacer(),{document:p}=r.useDocumentSessionContext(),f=r.useSelector(r.selectHistoryData),x=r.useDocumentHistoryReader(),k=r.useSelector(r.selectElementHistoryHasMore),b=r.useSelector(r.selectIsPanelHistoryCollapsed),[h,T]=(0,n.useState)(!0),[_,E]=(0,n.useState)(!1),[w,v]=(0,n.useState)([]),[A,j]=(0,n.useState)([]),C=ye=>s(r.switchIsPanelHistoryCollapsed(ye)),P=(0,n.useCallback)(ye=>{if(!ye?.html)return;const re=r.fromRevision(ye);re?.attributes&&d(re.attributes),s(r.markAppearanceNeedsUpdate());const ke=p?.get().version;c(ye.html,{undoable:!0}),p&&p.get().version===ke&&p.markUnsaved()},[c,s,d,p]),Y=(0,n.useCallback)(ye=>{im(p,ye),s(r.markAppearanceNeedsUpdate())},[p,s]),{data:z}=r.projectsApi.useGetProjectQuery(Number(a),{skip:!a}),[$,O]=(0,n.useState)([]);(0,n.useEffect)(()=>{if(z){const{owner:ye,admins:re,users:ke}=z?.members;O([ye&&{...ye},re&&Array.isArray(re)&&re.map(ae=>({...ae})),ke&&Array.isArray(ke)&&ke.map(ae=>({...ae}))].filter(ae=>ae).flat(1).map(ae=>({id:ae.ID,display_name:ae.display_name})))}},[z,z?.members,i]);const[y,oe]=(0,n.useState)(1),[G,q]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const ye=Array.isArray(f)&&f.length&&f?.map(re=>Sa(re,i));j(ye||[]),v(ye),T(!1),k||q(!0)},[f,k,i]);const te=()=>{E(!0),j(w.concat([...new Array(3)].map(()=>({loading:!0})))),x(e.id,y+1).then(ye=>{const{data:re,hasMore:ke}=ye.data,ae=Array.isArray(re)&&re?.map(be=>Sa(be,i)),Q=w.concat(ae);j(Q),v(Q),E(!1),window.dispatchEvent(new Event("resize")),ke||q(!0),oe(y+1)})},ue=!h&&!_&&!G?(0,o.jsx)("div",{style:{textAlign:"center",marginTop:24,marginBottom:24,height:32,lineHeight:"32px"},children:(0,o.jsx)(t.ui_kit$Button,{onClick:te,children:i("loading more")})}):null,[me,se]=(0,n.useState)(),[_e,ve]=(0,n.useState)(null),de=(0,n.useCallback)(ye=>{P(ye),se(null),ve(null),l({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),s(r.resetToLastActiveSettingsTab())},[P,l,s]);(0,n.useEffect)(()=>{!b&&!_e&&ve(rm(p))},[b,ve,p,_e]),(0,n.useEffect)(()=>{b&&_e&&(Ba(p,_e),s(r.markAppearanceNeedsUpdate()),ve(null))},[b,_e,p,s]);const De=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse secondary-tabs_unset_scroll",size:"large",activeKey:r.HISTORY,items:[{label:(0,o.jsx)(o.Fragment,{children:i("Version history")}),key:r.HISTORY,forceRender:!0,className:"email-settings__collapse-panel",style:{height:"100%"},children:(0,o.jsx)(t.ui_kit$List,{className:"history-panel__list",loading:h,itemLayout:"horizontal",loadMore:ue,dataSource:A,header:(0,o.jsxs)("div",{className:"history-panel__list-header",children:[(0,o.jsx)("div",{className:"history-panel__list-date",children:i("Time")}),(0,o.jsx)("div",{className:"history-panel__list-author",children:i("Author")}),(0,o.jsx)("div",{className:"history-panel__restore",children:"Set"})]}),renderItem:(ye,re)=>(0,o.jsx)(t.ui_kit$List.Item,{onClick:()=>{re!==me&&(se(re),Y(w[re])),s(r.setBlockSettingsDisable(!0))},className:(0,He.default)("history-panel__item",{"history-panel__item_active":re===me}),children:(0,o.jsxs)(t.ui_kit$Skeleton,{title:!1,loading:ye.loading||!1,active:!0,children:[(0,o.jsx)("div",{className:"history-panel__list-date",children:ye.date}),(0,o.jsx)("div",{className:"history-panel__list-author",children:De.revisionService?ye.author:$.find(ke=>ke.id?.toString()===ye.author?.toString())?.display_name||"–"}),ye.isAutosave&&me!==re&&(0,o.jsx)("div",{style:{opacity:.45},className:"history-panel__list-autosave",children:i("Auto")}),!ye.isAutosave&&(0,o.jsx)(t.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",onClick:ke=>{me===re&&ke.stopPropagation(),de(w[re])},children:i("Set")}),ye.isAutosave&&me===re&&(0,o.jsx)(t.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",onClick:ke=>{me===re&&ke.stopPropagation(),de(w[re])},children:i("Set")})]})})})}]}),(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"ant-modal-close","aria-label":"Close",onClick:()=>{s(r.resetToLastActiveSettingsTab()),_e&&Ba(p,_e),ve(null),C(!0),l({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1})},children:(0,o.jsx)(r.EmIcons,{icon:"Close",component:t.icons$Close})})]})};fr.propTypes={};var Ta=async({blockTags:e,projectTagsArray:i,addTerm:l,project:s,notification:a})=>{if(!e||e.length===0)return[];const d=e.map(c=>{const p=i.find(f=>f.name===c);return p?Promise.resolve(p.id):l({project:s,kind:r.BLOCK_TAGS,name:c}).then(({error:f,data:x})=>{if(f?.status===400)return r.existingTermIdFromError(f);if(x)return x.id;if(f)return a.fromError("TAG_CREATING_ERROR",c,f),null})});return(await Promise.all(d)).filter(c=>c!=null)},Ra=()=>{document.querySelector(".blocks-search__blocks-wrapper")&&(document.querySelector(".blocks-search__blocks-wrapper").style.removeProperty("transition"),document.querySelector(".blocks-search__blocks-wrapper").style.opacity=0,document.querySelectorAll(".blocks-search__result-body").forEach(e=>e.style.removeProperty("height")),setTimeout(()=>{document.querySelectorAll(".blocks-search__result-body").forEach(e=>{e.style.height=e.offsetHeight*207/640+"px"}),document.querySelector(".blocks-search__blocks-wrapper")&&(document.querySelector(".blocks-search__blocks-wrapper").style.transition="opacity 0.2s",document.querySelectorAll(".blocks-search__blocks-wrapper").forEach(e=>e.style.opacity=1))},1500))},lm=async e=>{const{block:i,form:l,projectData:s,projectTagsArray:a,projectId:d,addBlock:c,editBlock:p,editProject:f,addTerm:x,notification:k,__:b,handleCloseModal:h,htmlContent:T,refetchBlocks:_,reloadBlockScreens:E,onGlobalBlockTemplateSynced:w}=e;try{const{valid:v,values:A,blockTags:j}=await ya({form:l,notification:k,__:b});if(!v)return;const C=await Ta({blockTags:j,projectTagsArray:a,addTerm:x,project:s,notification:k});await ja({block:i,form:l,projectId:d,htmlContent:T,values:A,tagIds:C,addBlock:c,editBlock:p,editProject:f,notification:k,refetchBlocks:_,reloadBlockScreens:E,projectTagsArray:a,__:b,handleCloseModal:h,onGlobalBlockTemplateSynced:w})}catch{}},ya=async({form:e,notification:i,__:l})=>{let s=!0;const a=await e.validateFields(),d=a.tags;return d?.length>10&&(i.error({id:"BLOCK_TOO_MANY_TAGS_ERROR",data:r.getBlockDesc(a),title:l("Maximum 10 tags available.")}),s=!1),{valid:s,values:a,blockTags:d}};function wa(e){if(e!==null&&typeof e=="object"&&"data"in e){const i=e.data;return{code:i?.code,message:i?.message}}return{}}async function sm(e){const{created:i,blockData:l,editBlock:s,onGlobalBlockTemplateSynced:a}=e;if(!i.id)return;const d=new Date,c=r.formatEmBlockVersion(d);if(s){const p=i.html??l.html??"",f=r.injectEmBlockIdIntoBlockHtml(p,String(i.id),d);f!==p&&await s({blockId:String(i.id),html:f})}a?.(String(i.id),c)}function am(e){const{block:i,projectId:l,htmlContent:s,values:a}=e;return i?{title:i.blockTitle,project:i.projectId,html:i.htmlContent,type:i.blockType||"Other",global_block:!1}:{title:a?.title??"",project:l,html:s||"",type:a?.type||"Other",...a?.global_block===!0?{global_block:!0}:{}}}var ja=async({block:e,form:i,projectId:l,htmlContent:s,values:a,tagIds:d,addBlock:c,editBlock:p,editProject:f,notification:x,refetchBlocks:k,reloadBlockScreens:b,projectTagsArray:h,__:T,handleCloseModal:_,onGlobalBlockTemplateSynced:E})=>{const w=am({block:e,projectId:l,htmlContent:s,values:a}),v=await c({...w,blocktags:d.join(",")});if(v.error){const P=wa(v.error);throw x.error({id:"BLOCK_CREATING_ERROR",data:{title:w.title,code:w.html},innerException:v.error,message:P.code,description:P.message}),i.resetFields(),_(),new Error("Ошибка создания блока")}const A=v.data;!e&&a?.global_block===!0&&A?.id&&await sm({created:A,blockData:w,editBlock:p,onGlobalBlockTemplateSynced:E}),e||(i.resetFields(),_());const j=h.map(P=>P.id),C=await f({projectId:l,blocktags:[...new Set([...j,...d])].join(",")});if(C.error){const P=wa(C.error);x.error({message:P.message,code:P.code})}else!e&&k&&(x.success({id:"BLOCK_CREATING_SUCCESS",data:r.getBlockDesc(v.data),message:T("The block “")+String(v.data?.title??"")+T("” was successfully created.")}),k());return!e&&b&&b(),v.data},gr=({isModalVisible:e,htmlContent:i,projectId:l,setIsShowAddAllBlocksModal:s,setIsShowAddAllBlocksModalForNewEmail:a})=>{const{__:d}=r.useI18n(),c=r.useDispatch(),[p]=t.ui_kit$Form.useForm(),[f,x]=(0,n.useState)([]),[k,b]=r.useAddBlockMutation(),[h]=r.useEditBlockMutation(),{data:T}=r.useGetBlocksSchemaQuery(),_=r.useNotification(),E=r.useAppConfig(),[w,v]=(0,n.useState)([]),A=r.useProjectData(),{refetch:j}=r.useGetBlocksQuery(r.projectBlocksArgs(l)),[C,P]=r.useAddTermMutation(),[Y,z]=r.useEditProjectMutation(),$=r.useSendPostMessage(),O=(0,n.useCallback)((te,ue)=>{$({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:te,...ue?{emBlockVersion:ue}:{}}})},[$]),{data:y}=r.useGetTermsQuery({project:A,kind:r.BLOCK_TAGS},{skip:!A?.id});(0,n.useEffect)(()=>{v((y||[]).map(te=>({value:te.name})))},[y]),(0,n.useEffect)(()=>{if(T){const te=T.schema.properties.acf.properties.type.items.enum;let ue=[];for(let me in te)ue.push({label:d(r.TYPES_TRANSLATE[te[me]]),value:te[me]});x(ue)}},[T,d]);const oe=()=>{c(r.closeModal())},G=()=>{s(!0),a(!1),oe()},q=async()=>{await lm({form:p,projectData:A,projectTagsArray:y||[],projectId:l,addBlock:k,editBlock:h,editProject:Y,addTerm:C,notification:_,__:d,handleCloseModal:oe,htmlContent:i,refetchBlocks:j,reloadBlockScreens:Ra,onGlobalBlockTemplateSynced:O})};return(0,o.jsx)(t.ui_kit$Modal,{title:(0,o.jsx)("div",{className:"ant-modal-title",children:d("Save block")}),open:e,onOk:()=>G(),onCancel:oe,footer:(0,o.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",padding:"8px 0"},children:[(0,o.jsx)(t.ui_kit$Button,{size:"large",onClick:G,children:d("Save all blocks")},"create-all-blocks"),(0,o.jsx)(t.ui_kit$Button,{className:"add-new-block-modal__save-btn",size:"large",type:"primary",loading:b.isLoading,onClick:q,icon:(0,o.jsx)(r.EmIcons,{icon:"CreateBlock",component:t.icons$CreateBlock,style:{fontSize:22}}),children:d("Save block")},"submit")]}),children:(0,o.jsxs)(t.ui_kit$Form,{form:p,layout:"vertical",name:"add_new_block_form",onFinish:q,initialValues:{title:"",type:"",tags:[],global_block:!1},autoComplete:"off",children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:16,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Block name"),name:"title",rules:[{required:!0,message:d("Please input block name")}],style:{marginBottom:15},children:(0,o.jsx)(t.ui_kit$Input,{disabled:b.isLoading||P.isLoading||z.isLoading,size:"large",placeholder:d("Enter block name"),spellCheck:"false"})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Type"),name:"type",rules:[{required:!0,message:d("Please choose block type")}],style:{marginBottom:15},children:(0,o.jsx)(t.ui_kit$Select,{disabled:b.isLoading||P.isLoading||z.isLoading,size:"large",placeholder:d("Choose block type"),options:f})})})]}),E.tagsEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Tags"),name:"tags",children:(0,o.jsx)(t.ui_kit$Select,{size:"large",mode:"tags",placeholder:d("Add some tags"),tooltip:{title:d("Tags help you find the block in the list."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},disabled:b.isLoading||P.isLoading||z.isLoading,options:w})}),E.globalBlockCheckboxEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{name:"global_block",valuePropName:"checked",style:{marginBottom:15},children:(0,o.jsx)(t.ui_kit$Switch,{label:d("Global block"),disabled:b.isLoading||P.isLoading||z.isLoading})})]})})};gr.propTypes={};var nm="https://app.useblocks.io/api".replace(/\/+$/,""),dm=`${nm}/wp-json/ai-generator/v1/identificate_blocks`,cm=["Menu","Header","Content","Banners","Lists","Buttons","Promocodes","Feature","Call to Action","E-Commerce","Articles","Polls","Applications","Separators","Contacts","Footer","Other"];async function um(e){return await e.getInstance(xo.TOKEN_ID)}async function mm(e,i,l,s,a){const d={blocks:s,types:cm,locale:i};l.current=d;try{const c=await um(a),p=await fetch(dm,{method:"POST",headers:{"Content-Type":"application/json",...c?{Authorization:`Bearer ${c}`}:{}},body:JSON.stringify(d)});if(!p.ok||p.status!==200)throw new Error(`${p.statusText}`);return await p.json()}catch(c){throw c}}var pm=(e,i="block")=>{const l=new DOMParser,s=l.parseFromString(e,"text/html"),a=s.querySelectorAll(`[em="${i}"]`),d=s.querySelectorAll("link");return{parser:l,document:s,blockElements:a,styleElement:s.querySelector('[em="styles"]'),linksElements:d}};function hm(e){return Array.from(e).map(i=>i.outerHTML).join("")}var bm=(e,i="block",l=!1)=>{if(!e?.html)return[];const{document:s,blockElements:a,styleElement:d,linksElements:c}=pm(e.html,i),p=hm(c);if(!(a instanceof NodeList))return[];const f=s.querySelector("head"),x=f?f.innerHTML:"";return Array.from(a).map((k,b)=>{if(!(k instanceof Element)||!k.outerHTML)return null;const h=d?d.outerHTML:"";return{id:`${e.id}-${b}`,html:l?`<!DOCTYPE html>
|
|
23
23
|
<html>
|
|
24
24
|
<head>${x}</head>
|
|
25
25
|
<body>
|
|
26
26
|
<table>${k.outerHTML}</table>
|
|
27
27
|
</body>
|
|
28
|
-
</html>`:r.minifyHtml(`${p}${h}${k.outerHTML.replace(/class="em-structure"/,'class=""')}`)}}).filter(Boolean)};function bm(e,i,l){const{images:s}=e,{blocks:a}=i;return s?.map(d=>{const c=a.find(p=>p.id===d.block_id);return{blockType:d.classification,blockTitle:d.name,htmlContent:c?.html||"",projectId:l}})}var fm=e=>e.replace(/<div\s+[^>]*style="font-family:[^>]*>(.*?)<\/div>/gs,i=>i.replace(/>(.*?)<\/div>/s,"></div>")),gm=e=>e.replace(/src="[^"]*"/g,'src=""'),_m=e=>/<div\s+[^>]*style="font-family:/i.test(e),xm=e=>{const i=new Set,l=[];for(const s of e)if(_m(s.html)){const a=gm(fm(s.html));i.has(a)||(i.add(a),l.push(s))}else l.push(s);return l},km=async e=>{const{block:i,form:l,projectData:s,projectId:a,addBlock:d,editProject:c,notification:p,__:f,handleCloseModal:x,htmlContent:k,refetchBlocks:b,reloadBlockScreens:h,values:T,tagIds:_,projectTagsArray:E}=e;try{await ja({block:i,form:l,projectId:a,htmlContent:k,values:T,tagIds:_,addBlock:d,editProject:c,notification:p,refetchBlocks:b,reloadBlockScreens:h,projectTagsArray:E,__:f,handleCloseModal:x})}catch(w){throw w}},Em=({projectData:e,addTerm:i,addBlock:l,editProject:s,reloadBlockScreens:a,notification:d,__:c,handleCloseModal:p,setTriggerOpenSavedBlocksTab:f,setTagsOptions:x,form:k,projectId:b})=>{const[h,T]=(0,n.useState)(!1),_=r.useInvalidateProject(),{data:E}=r.useGetTermsQuery({project:e,kind:r.BLOCK_TAGS},{skip:!e?.id});return(0,n.useEffect)(()=>{x((E||[]).map(v=>({value:v.name})))},[E,x]),{bulkSave:async(v,A,j,C)=>{T(!0);try{if(!A)return;const P=await Ta({blockTags:C,projectTagsArray:E||[],addTerm:i,project:e,notification:d});let Y=!0,z=0;for(const $ of v)try{await km({block:$,form:k,projectData:e,projectId:b,addBlock:l,editProject:s,notification:d,__:c,handleCloseModal:p,values:j,tagIds:P,projectTagsArray:E||[]})}catch{Y=!1,z++}if(Y&&d.success({id:"BULK_SAVE_SUCCESS",title:c("All blocks saved successfully."),placement:"bottomRight"}),!Y){if(z===v.length)throw new Error;d.warning({id:"BULK_SAVE_PARTIAL_SUCCESS",title:c("Some blocks were not saved successfully."),placement:"bottomRight"})}f(!0),_(b),a()}catch(P){throw P}finally{T(!1),k.resetFields(),p()}},confirmSavingBlocksLoading:h}},_r=({isModalVisible:e,currentEmail:i,setIsShowAddAllBlocksModal:l,setTriggerOpenSavedBlocksTab:s,projectId:a})=>{const{__:d,_n:c,sprintf:p}=r.useI18n(),f=r.useContainer(),x=r.useProjectData(),{tagsEnabled:k}=r.useAppConfig(),[b,h]=(0,n.useState)(!1),[T]=t.ui_kit$Form.useForm(),[_,E]=(0,n.useState)([]),[w,v]=(0,n.useState)([]),A=(0,n.useRef)({}),[j]=r.useAddTermMutation(),[C]=r.useEditProjectMutation(),[P,Y]=r.useAddBlockMutation(),z=r.useEditorLocale()||void 0,$=hm(i),O=xm($).map(me=>me),y=O.length,oe=r.useNotification(),G=()=>{b||te||l(!1)},{bulkSave:q,confirmSavingBlocksLoading:te}=Em({projectData:x,addTerm:j,addBlock:P,editProject:C,reloadBlockScreens:Ra,notification:oe,__:d,handleCloseModal:G,setTriggerOpenSavedBlocksTab:s,setTagsOptions:v,form:T,projectId:a}),ue=async()=>{try{const{valid:me,values:se,blockTags:_e}=await ya({form:T,notification:oe,__:d});s(!1),h(!0);const ve=await um(i,z,A,O,f),de=bm(ve,A.current,i.project.toString());h(!1),await q(de,me,se,_e)}catch{h(!1),l(!1),oe.error({title:d("Failed to save blocks."),placement:"bottomRight"})}};return(0,o.jsxs)(t.ui_kit$Modal,{title:(0,o.jsx)("div",{className:"ant-modal-title",children:d("Bulk saving of blocks")}),open:e,onOk:ue,onCancel:G,footer:(0,o.jsx)("div",{className:"modal-footer",children:!(b||te)&&(0,o.jsx)(t.ui_kit$Button,{size:"large",type:"primary",disabled:b||te,onClick:ue,children:p(c("Save %d block","Save %d blocks",y),y)},"submit")}),children:[b||te?(0,o.jsx)("div",{children:d("All blocks saved at this point can be found in the “Saved Blocks” section in the sidebar.")}):(0,o.jsx)("div",{children:p(c("Your letter contains %d block that can be saved for future use.","Your letter contains %d blocks that can be saved for future use.",y),y)}),!(b||te)&&k&&(0,o.jsx)(t.ui_kit$Form,{form:T,name:"add_all_blocks_form",layout:"vertical",onFinish:ue,style:{paddingTop:24},children:(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Tags"),name:"tags",labelCol:{span:24},wrapperCol:{span:24},style:{display:"block",marginBottom:0},children:(0,o.jsx)(t.ui_kit$Select,{size:"large",mode:"tags",placeholder:d("Add some tags"),style:{width:"100%"},value:_,onChange:E,disabled:Y.isLoading,options:w})})}),(te||b)&&(0,o.jsx)("div",{className:"modal-spinner",children:(0,o.jsx)(t.ui_kit$Spin,{size:"large"})})]})};_r.propTypes={};var Bm=e=>e.replace(/[\\]/g,"\\\\").replace(/["]/g,'\\"').replace(/[/]/g,"\\/").replace(/[\b]/g,"\\b").replace(/[\f]/g,"\\f").replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r").replace(/[\t]/g,"\\t"),xr=({isModalVisible:e=!1,email:i=null})=>{const{__:l}=r.useI18n(),[s]=t.ui_kit$Form.useForm(),a=r.useDispatch(),d=r.useRouteEmailId(),c=r.useNotification(),p=r.useCurrentUser(),f=r.useProjectData()?.projects_test_emails,[x,k]=r.useSendTestEmailMutation(),{token:b}=(0,t.ui_kit$useToken)(),[h,T]=(0,n.useState)(!1);r.useAppConfig(),r.useCookieManager();const _=i.project,{data:E}=r.useGetProjectTestRecipientsQuery(_??0,{skip:!0}),[w,v]=r.useEditProjectMutation(),[A]=r.usePutProjectTestRecipientsMutation(),j=r.useProjectData(),{testEmails:C}=r.useAppConfig(),P=r.usePushToDataLayer(),[Y,z]=(0,n.useState)([]),[$,O]=(0,n.useState)(!1),y=r.useEventEmitter(xo.events.ON_SEND_EMAIL_MODAL_ID);(0,n.useEffect)(()=>{e?y.fire(i).then(ue=>{ue.some(me=>me===!1)?a(r.closeModal$1()):T(e)}):T(e)},[e,a,T,i,y]),(0,n.useEffect)(()=>{},[j,_,E]),(0,n.useEffect)(()=>{z(C.map(ue=>({value:ue})))},[C]),(0,n.useEffect)(()=>{const ue=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails);if(ue&&h&&s.getFieldValue("recipients")?.length===0){const me=JSON.parse(ue);me?.[_]&&s.setFieldsValue({recipients:me[_]})}},[_,h,s]),(0,n.useEffect)(()=>{s.setFieldsValue({subject:i.subject})},[s,i.subject]);const oe=()=>{a(r.closeModal$1()),s.resetFields()},G=r.useContentReader(),q=()=>{s.validateFields().then(()=>{const ue={user_id:p.id,project_id:_,email_id:d,subject:s.getFieldValue("subject"),email:s.getFieldValue("recipients").join(","),html:Bm(G())};x(ue).unwrap().catch(me=>{c.error({error:{data:{code:me?.data?.code,message:me?.data?.message}}})}),O(!0),P({event:"submit",action:"send_test_email",entity_id:d,project_id:_,recipients_count:s.getFieldValue("recipients").length})}).catch(ue=>{})},te=n.default.useRef(f);return te.current=f,(0,n.useEffect)(()=>{const ue=te.current;if(k.isSuccess&&$){k.data?.status;{const me=[...new Set([...Y.map(ye=>ye.value),...s.getFieldValue("recipients")])],se=me.map(ye=>({projects_test_email:ye}));((ye,re)=>{if(!ye||!re)return ye===re;if(ye.length!==re.length)return!1;const ke=ye.map(Q=>Q.projects_test_email).sort(),ae=re.map(Q=>Q.projects_test_email).sort();return ke.every((Q,he)=>Q===ae[he])})(se,r.isProjectsV2Enabled()?(E||[]).map(ye=>({projects_test_email:ye})):ue)||(r.isProjectsV2Enabled()?A({projectId:_,emails:me}):w({projectId:_,projects_test_emails:se}));const ve=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails)?JSON.parse(localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails)):[];let de=s.getFieldValue("recipients");localStorage.setItem(r.LOCAL_STORAGE_ITEMS.em_test_emails,JSON.stringify({...ve,[_]:[...new Set(de)]}));const De=i.title||i.subject||l("Untitled email.").replace(/\.$/,"");c.success(l("The email “")+De+l("” was successfully sent."))}O(!1),s.resetFields(),a(r.closeModal$1())}},[k,s,_,w,A,E,Y,$,a,i.title,i.subject,c,v,l]),(0,n.useEffect)(()=>{v.isError&&(c.error(v),O(!1),s.resetFields(),a(r.closeModal$1()))},[a,v,s]),(0,n.useEffect)(()=>{s.setFieldsValue({subject:i.subject||i.title})},[i,s]),(0,o.jsx)(t.ui_kit$Modal,{width:572,title:(0,o.jsxs)("div",{style:{paddingBottom:8},children:[(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:20,strokeWidth:2})," ",l("Send a test email")]}),open:h,onCancel:oe,footer:[(0,o.jsx)(t.ui_kit$Button,{size:"large",className:"em-analytics__email-send-test",type:"primary",htmlType:"submit",form:"Send mail",loading:v.isLoading,icon:(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:18,strokeWidth:2,className:"email-preview-menu__list-item-icon"}),onClick:q,disabled:k.isLoading,children:l("Send")},"submit")],forceRender:!0,children:(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"send_mail_form",initialValues:{subject:i.subject||i.title,recipients:[]},autoComplete:"off",children:[(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Subject"),name:"subject",rules:[{required:!1,message:l("Please type subject")}],children:(0,o.jsx)(t.ui_kit$Input,{size:"large",placeholder:l("Type subject")})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Recipients"),name:"recipients",tooltip:{title:l("The test email will be sent to the specified addresses."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},rules:[{required:!0,validator:(ue,me)=>me.length>10?Promise.reject(new Error(l("A test email can be sent to a maximum of 10 addresses."))):me.length!==0?me.every(se=>wo.emailValidation.test(se.toLowerCase()))?Promise.resolve():Promise.reject(new Error(l("Please type correct emails"))):Promise.reject(new Error(l("Please type emails")))}],children:(0,o.jsx)(t.ui_kit$Select,{size:"large",mode:"tags",placeholder:l("Add up to 10 recipients"),tooltip:{title:"Tooltip with customize icon",icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},options:Y,tagRender:ue=>{const{label:me,closable:se,onClose:_e}=ue,ve=de=>{de.preventDefault(),de.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:b.colorPrimary,onMouseDown:ve,closable:se,onClose:_e,style:{borderRadius:6},children:me})},getPopupContainer:()=>document.getElementById("send_mail_form")})})]})})};xr.propTypes={isModalVisible:g.default.bool,email:g.default.shape({html:g.default.string,subject:g.default.string})};var kr=({block:e=null,isEditableRights:i,rightCol:l,autoSaveBlockResult:s,disabled:a})=>{const{__:d}=r.useI18n(),{blockId:c}=r.useRouteParams(),p=r.useEditorProjectId();let f=r.useSelector(r.selectIsCodeMode$1),x=r.useSelector(r.selectIsCodeMode$1),k=r.useDispatch();const b=r.useNotification(),h=r.useContentReader(),T=r.useStore(),_=r.useSendPostMessage(),[E,w]=(0,n.useState)(!1),[v,A]=(0,n.useState)(null),[j,C]=(0,n.useState)(!1),[P,Y]=(0,n.useState)(!1),z=r.usePushToDataLayer();(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&A(!0)},[]);const{data:$,refetch:O}=r.useGetProjectQuery(+p,{skip:!+p}),[y]=r.useAddTermMutation(),[oe,G]=r.useEditBlockMutation(),[q,te]=r.useAddBlockMutation(),[ue]=r.useEditProjectMutation(),{data:me}=r.useGetTermsQuery({project:$,kind:r.BLOCK_TAGS},{skip:!$?.id}),se=(0,n.useCallback)(re=>{if(C(!0),!i&&e.lock&&P){b.error({id:"BLOCK_ACCESS_TO_LOCKED_ERROR",title:d("No access to edit the letter."),data:r.getBlockDesc(e)}),C(!1);return}if((e.tags?.length||e.blocktags?.length)>10&&P){b.error({id:"BLOCK_TOO_MANY_TAGS_ERROR",title:d("Maximum 10 tags available."),data:r.getBlockDesc(e)}),C(!1);return}if(e.type===""){b.error({title:d("Set the type"),description:d("Please set the 'Type' field in the Settings section.")}),C(!1);return}const ke=ae=>{const Q=e.tags?.map(pe=>{const ee=me?.find(J=>J.name===pe);return ee?ee.id:y({project:$,kind:r.BLOCK_TAGS,name:pe,parent:ae}).then(({error:J,data:H})=>{if(J?.status===400)return r.existingTermIdFromError(J);if(H)return H.id;J&&(b.fromError("TAG_CREATING_ERROR",pe,J),C(!1))})}),he=(pe=null)=>{let ee=null;const J=X=>{T.dispatch(r.taxonomiesApi.endpoints.getTerms.initiate({project:$,kind:r.BLOCK_TAGS})),O(),X.global_block&&X.id&&_({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:String(X.id),...ee?{emBlockVersion:ee}:{}}}),P&&(b.success({id:"BLOCK_EDITING_SUCCESS",title:d("The block was successfully saved."),data:r.getBlockDesc(e)}),C(!1)),fetch(r.blockPreviewHref(r.BLOCK,p,X.id,X.modified),{mode:"no-cors"}).then(()=>{})},H=wo.getTaxonomy(e,r.EMAIL_TAGS).filter(X=>(pe||e.blocktags).includes(X.id)).map(X=>X.name);if(e.isNew)te.status!=="pending"&&q({source:re,title:e.title===null?d("New block title"):e.title,project:e.project,type:e.type?e.type:"Other",description:e.description,html:h(),blocktags:pe?pe.join(","):e.blocktags,tags:H,...r.hasOwnMeta(e)?{meta:e.meta}:{}}).then(async({data:X,error:ce})=>{if(ce)b.fromError("BLOCK_CREATING_ERROR",{title:e.title,html:h()},ce),C(!1);else{let xe=X;const ne=h();if(X?.global_block&&X?.id&&ne){const Ae=new Date,we=r.injectEmBlockIdIntoBlockHtml(ne,String(X.id),Ae);if(ee=r.formatEmBlockVersion(Ae),we!==ne){const $e=await oe({blockId:X.id,html:we});!$e.error&&$e.data&&(xe=$e.data)}}J(xe)}});else if(G.status!=="pending"){const X=h(),ce=new Date,xe=e.global_block?r.injectEmBlockIdIntoBlockHtml(X,String(e.id),ce):X;e.global_block&&(ee=r.formatEmBlockVersion(ce)),oe({blockId:e.id,source:re,title:e.title,project:e.project,type:e.type?e.type:"Other",description:e.description,html:xe,blocktags:pe||e.blocktags,tags:H,...r.hasOwnMeta(e)?{meta:e.meta}:{}}).then(({data:ne,error:Ae})=>{Ae&&P?(b.fromError("BLOCK_EDITING_ERROR",r.getBlockDesc(e),Ae),C(!1)):J(ne)})}};Q?Promise.all(Q).then(pe=>he(pe)):he(null)};C(!0),ke(void 0)},[te.status,q,G.status,oe,e,i,y,ue,p,d,P,h,b,me,O,T,_]);(0,n.useEffect)(()=>{P&&(se(),Y(!1))},[P,se]);const _e=(0,n.useCallback)(re=>{(re.ctrlKey||re.metaKey)&&re.keyCode===83&&(re.preventDefault(),Y(!0))},[]);(0,n.useEffect)(()=>(document.addEventListener("keydown",_e),()=>{document.removeEventListener("keydown",_e)}),[_e]);const ve=(0,n.useCallback)(re=>{const ke=re.data.operation,ae=re.data.action;ke===r.EVENT_TYPES.APPLICATION_ACTION&&ae==="save_email"&&Y(!0)},[]);r.useListenPostMessage(ve),(0,n.useEffect)(()=>{te.isError&&(C(!1),b.error(te))},[k,te]),(0,n.useEffect)(()=>{const re=setTimeout(()=>{w(!0)},1e4);return()=>{clearTimeout(re)}},[]),(0,n.useEffect)(()=>{e.isNew&&!c&&E&&(se(),w(!1))},[E,e,se,c]);const de=G.isLoading||ue.isLoading||te.isLoading||j,De=!!s?.isLoading,ye=de||De;return(0,o.jsx)(t.ui_kit$Tooltip,{title:d(v?"Save by ⌘S":"Save by Ctrl+S"),placement:l?"right":"bottomRight",children:(0,o.jsx)("span",{className:"em-analytics__block-save-tooltip-target",children:(0,o.jsx)(t.ui_kit$Button,{type:"primary",block:l,disabled:a||De,className:"em-analytics__block-save",icon:(0,o.jsx)(r.EmIcons,{icon:"SaveOutlined",component:t.icons$SaveOutlined}),onClick:re=>{const ke=re.currentTarget;z({event:"click",action:"save_block"}),Y(!0);try{ke?.blur?.()}catch{}},loading:ye,children:l||f||x?"":d("Save")})})})};kr.propTypes={block:g.default.shape({id:g.default.string,isNew:g.default.bool,lock:g.default.bool,type:g.default.string,html:g.default.string,description:g.default.string,project:g.default.number,title:g.default.string}),isEditableRights:g.default.bool.isRequired};var Sm=to.__exportAll({AddAllBlocksModal:()=>_r,AddNewBlockModal:()=>gr,BlocksSearch:()=>br,Discuss:()=>Ea,DiscussAi:()=>ea,EmailProperties:()=>Ol,EmailSettings:()=>Ui,EmailStyles:()=>Ji,FileManagerDataLayer:()=>ba,HistoryPanel:()=>fr,LimitUpgradeModal:()=>ai,Optimise:()=>ma,SaveBlockBtn:()=>kr,SelectedElementPanel:()=>dt,SendTestEmailModal:()=>xr});no.AddAllBlocksModal=_r,no.AddNewBlockModal=gr,no.BlocksSearch=br,no.Discuss=Ea,no.DiscussAi=ea,no.EmailProperties=Ol,no.EmailSettings=Ui,no.EmailStyles=Ji,no.FileManagerDataLayer=ba,no.HistoryPanel=fr,no.LimitUpgradeModal=ai,no.LimitUpgradeModal$1=ai,no.Optimise=ma,no.SaveBlockBtn=kr,no.SelectedElementPanel=dt,no.SendTestEmailModal=xr,no.canonicalImageUrlKey=ft,no.getImageDimensionsFromBlob=Tr,no.normalizeImageFormatForDisplay=Ft,Object.defineProperty(no,"panels_exports",{enumerable:!0,get:function(){return Sm}}),no.resolveDataProviderPreview=yr,no.shouldCountAiUsage=nr,no.useImageBlobFetch=wr,no.useImageBlobResolver=jr});
|
|
28
|
+
</html>`:r.minifyHtml(`${p}${h}${k.outerHTML.replace(/class="em-structure"/,'class=""')}`)}}).filter(Boolean)};function fm(e,i,l){const{images:s}=e,{blocks:a}=i;return s?.map(d=>{const c=a.find(p=>p.id===d.block_id);return{blockType:d.classification,blockTitle:d.name,htmlContent:c?.html||"",projectId:l}})}var gm=e=>e.replace(/<div\s+[^>]*style="font-family:[^>]*>(.*?)<\/div>/gs,i=>i.replace(/>(.*?)<\/div>/s,"></div>")),_m=e=>e.replace(/src="[^"]*"/g,'src=""'),xm=e=>/<div\s+[^>]*style="font-family:/i.test(e),km=e=>{const i=new Set,l=[];for(const s of e)if(xm(s.html)){const a=_m(gm(s.html));i.has(a)||(i.add(a),l.push(s))}else l.push(s);return l},Em=async e=>{const{block:i,form:l,projectData:s,projectId:a,addBlock:d,editProject:c,notification:p,__:f,handleCloseModal:x,htmlContent:k,refetchBlocks:b,reloadBlockScreens:h,values:T,tagIds:_,projectTagsArray:E}=e;try{await ja({block:i,form:l,projectId:a,htmlContent:k,values:T,tagIds:_,addBlock:d,editProject:c,notification:p,refetchBlocks:b,reloadBlockScreens:h,projectTagsArray:E,__:f,handleCloseModal:x})}catch(w){throw w}},Bm=({projectData:e,addTerm:i,addBlock:l,editProject:s,reloadBlockScreens:a,notification:d,__:c,handleCloseModal:p,setTriggerOpenSavedBlocksTab:f,setTagsOptions:x,form:k,projectId:b})=>{const[h,T]=(0,n.useState)(!1),_=r.useInvalidateProject(),{data:E}=r.useGetTermsQuery({project:e,kind:r.BLOCK_TAGS},{skip:!e?.id});return(0,n.useEffect)(()=>{x((E||[]).map(v=>({value:v.name})))},[E,x]),{bulkSave:async(v,A,j,C)=>{T(!0);try{if(!A)return;const P=await Ta({blockTags:C,projectTagsArray:E||[],addTerm:i,project:e,notification:d});let Y=!0,z=0;for(const $ of v)try{await Em({block:$,form:k,projectData:e,projectId:b,addBlock:l,editProject:s,notification:d,__:c,handleCloseModal:p,values:j,tagIds:P,projectTagsArray:E||[]})}catch{Y=!1,z++}if(Y&&d.success({id:"BULK_SAVE_SUCCESS",title:c("All blocks saved successfully."),placement:"bottomRight"}),!Y){if(z===v.length)throw new Error;d.warning({id:"BULK_SAVE_PARTIAL_SUCCESS",title:c("Some blocks were not saved successfully."),placement:"bottomRight"})}f(!0),_(b),a()}catch(P){throw P}finally{T(!1),k.resetFields(),p()}},confirmSavingBlocksLoading:h}},_r=({isModalVisible:e,currentEmail:i,setIsShowAddAllBlocksModal:l,setTriggerOpenSavedBlocksTab:s,projectId:a})=>{const{__:d,_n:c,sprintf:p}=r.useI18n(),f=r.useContainer(),x=r.useProjectData(),{tagsEnabled:k}=r.useAppConfig(),[b,h]=(0,n.useState)(!1),[T]=t.ui_kit$Form.useForm(),[_,E]=(0,n.useState)([]),[w,v]=(0,n.useState)([]),A=(0,n.useRef)({}),[j]=r.useAddTermMutation(),[C]=r.useEditProjectMutation(),[P,Y]=r.useAddBlockMutation(),z=r.useEditorLocale()||void 0,$=bm(i),O=km($).map(me=>me),y=O.length,oe=r.useNotification(),G=()=>{b||te||l(!1)},{bulkSave:q,confirmSavingBlocksLoading:te}=Bm({projectData:x,addTerm:j,addBlock:P,editProject:C,reloadBlockScreens:Ra,notification:oe,__:d,handleCloseModal:G,setTriggerOpenSavedBlocksTab:s,setTagsOptions:v,form:T,projectId:a}),ue=async()=>{try{const{valid:me,values:se,blockTags:_e}=await ya({form:T,notification:oe,__:d});s(!1),h(!0);const ve=await mm(i,z,A,O,f),de=fm(ve,A.current,i.project.toString());h(!1),await q(de,me,se,_e)}catch{h(!1),l(!1),oe.error({title:d("Failed to save blocks."),placement:"bottomRight"})}};return(0,o.jsxs)(t.ui_kit$Modal,{title:(0,o.jsx)("div",{className:"ant-modal-title",children:d("Bulk saving of blocks")}),open:e,onOk:ue,onCancel:G,footer:(0,o.jsx)("div",{className:"modal-footer",children:!(b||te)&&(0,o.jsx)(t.ui_kit$Button,{size:"large",type:"primary",disabled:b||te,onClick:ue,children:p(c("Save %d block","Save %d blocks",y),y)},"submit")}),children:[b||te?(0,o.jsx)("div",{children:d("All blocks saved at this point can be found in the “Saved Blocks” section in the sidebar.")}):(0,o.jsx)("div",{children:p(c("Your letter contains %d block that can be saved for future use.","Your letter contains %d blocks that can be saved for future use.",y),y)}),!(b||te)&&k&&(0,o.jsx)(t.ui_kit$Form,{form:T,name:"add_all_blocks_form",layout:"vertical",onFinish:ue,style:{paddingTop:24},children:(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Tags"),name:"tags",labelCol:{span:24},wrapperCol:{span:24},style:{display:"block",marginBottom:0},children:(0,o.jsx)(t.ui_kit$Select,{size:"large",mode:"tags",placeholder:d("Add some tags"),style:{width:"100%"},value:_,onChange:E,disabled:Y.isLoading,options:w})})}),(te||b)&&(0,o.jsx)("div",{className:"modal-spinner",children:(0,o.jsx)(t.ui_kit$Spin,{size:"large"})})]})};_r.propTypes={};var Sm=e=>e.replace(/[\\]/g,"\\\\").replace(/["]/g,'\\"').replace(/[/]/g,"\\/").replace(/[\b]/g,"\\b").replace(/[\f]/g,"\\f").replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r").replace(/[\t]/g,"\\t"),xr=({isModalVisible:e=!1,email:i=null})=>{const{__:l}=r.useI18n(),[s]=t.ui_kit$Form.useForm(),a=r.useDispatch(),d=r.useRouteEmailId(),c=r.useNotification(),p=r.useCurrentUser(),f=r.useProjectData()?.projects_test_emails,[x,k]=r.useSendTestEmailMutation(),{token:b}=(0,t.ui_kit$useToken)(),[h,T]=(0,n.useState)(!1);r.useAppConfig(),r.useCookieManager();const _=i.project,{data:E}=r.useGetProjectTestRecipientsQuery(_??0,{skip:!0}),[w,v]=r.useEditProjectMutation(),[A]=r.usePutProjectTestRecipientsMutation(),j=r.useProjectData(),{testEmails:C}=r.useAppConfig(),P=r.usePushToDataLayer(),[Y,z]=(0,n.useState)([]),[$,O]=(0,n.useState)(!1),y=r.useEventEmitter(xo.events.ON_SEND_EMAIL_MODAL_ID);(0,n.useEffect)(()=>{e?y.fire(i).then(ue=>{ue.some(me=>me===!1)?a(r.closeModal$1()):T(e)}):T(e)},[e,a,T,i,y]),(0,n.useEffect)(()=>{},[j,_,E]),(0,n.useEffect)(()=>{z(C.map(ue=>({value:ue})))},[C]),(0,n.useEffect)(()=>{const ue=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails);if(ue&&h&&s.getFieldValue("recipients")?.length===0){const me=JSON.parse(ue);me?.[_]&&s.setFieldsValue({recipients:me[_]})}},[_,h,s]),(0,n.useEffect)(()=>{s.setFieldsValue({subject:i.subject})},[s,i.subject]);const oe=()=>{a(r.closeModal$1()),s.resetFields()},G=r.useContentReader(),q=()=>{s.validateFields().then(()=>{const ue={user_id:p.id,project_id:_,email_id:d,subject:s.getFieldValue("subject"),email:s.getFieldValue("recipients").join(","),html:Sm(G())};x(ue).unwrap().catch(me=>{c.error({error:{data:{code:me?.data?.code,message:me?.data?.message}}})}),O(!0),P({event:"submit",action:"send_test_email",entity_id:d,project_id:_,recipients_count:s.getFieldValue("recipients").length})}).catch(ue=>{})},te=n.default.useRef(f);return te.current=f,(0,n.useEffect)(()=>{const ue=te.current;if(k.isSuccess&&$){k.data?.status;{const me=[...new Set([...Y.map(ye=>ye.value),...s.getFieldValue("recipients")])],se=me.map(ye=>({projects_test_email:ye}));((ye,re)=>{if(!ye||!re)return ye===re;if(ye.length!==re.length)return!1;const ke=ye.map(Q=>Q.projects_test_email).sort(),ae=re.map(Q=>Q.projects_test_email).sort();return ke.every((Q,be)=>Q===ae[be])})(se,r.isProjectsV2Enabled()?(E||[]).map(ye=>({projects_test_email:ye})):ue)||(r.isProjectsV2Enabled()?A({projectId:_,emails:me}):w({projectId:_,projects_test_emails:se}));const ve=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails)?JSON.parse(localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails)):[];let de=s.getFieldValue("recipients");localStorage.setItem(r.LOCAL_STORAGE_ITEMS.em_test_emails,JSON.stringify({...ve,[_]:[...new Set(de)]}));const De=i.title||i.subject||l("Untitled email.").replace(/\.$/,"");c.success(l("The email “")+De+l("” was successfully sent."))}O(!1),s.resetFields(),a(r.closeModal$1())}},[k,s,_,w,A,E,Y,$,a,i.title,i.subject,c,v,l]),(0,n.useEffect)(()=>{v.isError&&(c.error(v),O(!1),s.resetFields(),a(r.closeModal$1()))},[a,v,s]),(0,n.useEffect)(()=>{s.setFieldsValue({subject:i.subject||i.title})},[i,s]),(0,o.jsx)(t.ui_kit$Modal,{width:572,title:(0,o.jsxs)("div",{style:{paddingBottom:8},children:[(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:20,strokeWidth:2})," ",l("Send a test email")]}),open:h,onCancel:oe,footer:[(0,o.jsx)(t.ui_kit$Button,{size:"large",className:"em-analytics__email-send-test",type:"primary",htmlType:"submit",form:"Send mail",loading:v.isLoading,icon:(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:18,strokeWidth:2,className:"email-preview-menu__list-item-icon"}),onClick:q,disabled:k.isLoading,children:l("Send")},"submit")],forceRender:!0,children:(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"send_mail_form",initialValues:{subject:i.subject||i.title,recipients:[]},autoComplete:"off",children:[(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Subject"),name:"subject",rules:[{required:!1,message:l("Please type subject")}],children:(0,o.jsx)(t.ui_kit$Input,{size:"large",placeholder:l("Type subject")})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Recipients"),name:"recipients",tooltip:{title:l("The test email will be sent to the specified addresses."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},rules:[{required:!0,validator:(ue,me)=>me.length>10?Promise.reject(new Error(l("A test email can be sent to a maximum of 10 addresses."))):me.length!==0?me.every(se=>wo.emailValidation.test(se.toLowerCase()))?Promise.resolve():Promise.reject(new Error(l("Please type correct emails"))):Promise.reject(new Error(l("Please type emails")))}],children:(0,o.jsx)(t.ui_kit$Select,{size:"large",mode:"tags",placeholder:l("Add up to 10 recipients"),tooltip:{title:"Tooltip with customize icon",icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},options:Y,tagRender:ue=>{const{label:me,closable:se,onClose:_e}=ue,ve=de=>{de.preventDefault(),de.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:b.colorPrimary,onMouseDown:ve,closable:se,onClose:_e,style:{borderRadius:6},children:me})},getPopupContainer:()=>document.getElementById("send_mail_form")})})]})})};xr.propTypes={isModalVisible:g.default.bool,email:g.default.shape({html:g.default.string,subject:g.default.string})};var kr=({block:e=null,isEditableRights:i,rightCol:l,autoSaveBlockResult:s,disabled:a})=>{const{__:d}=r.useI18n(),{blockId:c}=r.useRouteParams(),p=r.useEditorProjectId();let f=r.useSelector(r.selectIsCodeMode$1),x=r.useSelector(r.selectIsCodeMode$1),k=r.useDispatch();const b=r.useNotification(),h=r.useContentReader(),T=r.useStore(),_=r.useSendPostMessage(),[E,w]=(0,n.useState)(!1),[v,A]=(0,n.useState)(null),[j,C]=(0,n.useState)(!1),[P,Y]=(0,n.useState)(!1),z=r.usePushToDataLayer();(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&A(!0)},[]);const{data:$,refetch:O}=r.useGetProjectQuery(+p,{skip:!+p}),[y]=r.useAddTermMutation(),[oe,G]=r.useEditBlockMutation(),[q,te]=r.useAddBlockMutation(),[ue]=r.useEditProjectMutation(),{data:me}=r.useGetTermsQuery({project:$,kind:r.BLOCK_TAGS},{skip:!$?.id}),se=(0,n.useCallback)(re=>{if(C(!0),!i&&e.lock&&P){b.error({id:"BLOCK_ACCESS_TO_LOCKED_ERROR",title:d("No access to edit the letter."),data:r.getBlockDesc(e)}),C(!1);return}if((e.tags?.length||e.blocktags?.length)>10&&P){b.error({id:"BLOCK_TOO_MANY_TAGS_ERROR",title:d("Maximum 10 tags available."),data:r.getBlockDesc(e)}),C(!1);return}if(e.type===""){b.error({title:d("Set the type"),description:d("Please set the 'Type' field in the Settings section.")}),C(!1);return}const ke=ae=>{const Q=e.tags?.map(pe=>{const ee=me?.find(J=>J.name===pe);return ee?ee.id:y({project:$,kind:r.BLOCK_TAGS,name:pe,parent:ae}).then(({error:J,data:U})=>{if(J?.status===400)return r.existingTermIdFromError(J);if(U)return U.id;J&&(b.fromError("TAG_CREATING_ERROR",pe,J),C(!1))})}),be=(pe=null)=>{let ee=null;const J=X=>{T.dispatch(r.taxonomiesApi.endpoints.getTerms.initiate({project:$,kind:r.BLOCK_TAGS})),O(),X.global_block&&X.id&&_({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:String(X.id),...ee?{emBlockVersion:ee}:{}}}),P&&(b.success({id:"BLOCK_EDITING_SUCCESS",title:d("The block was successfully saved."),data:r.getBlockDesc(e)}),C(!1)),fetch(r.blockPreviewHref(r.BLOCK,p,X.id,X.modified),{mode:"no-cors"}).then(()=>{})},U=wo.getTaxonomy(e,r.EMAIL_TAGS).filter(X=>(pe||e.blocktags).includes(X.id)).map(X=>X.name);if(e.isNew)te.status!=="pending"&&q({source:re,title:e.title===null?d("New block title"):e.title,project:e.project,type:e.type?e.type:"Other",description:e.description,html:h(),blocktags:pe?pe.join(","):e.blocktags,tags:U,...r.hasOwnMeta(e)?{meta:e.meta}:{}}).then(async({data:X,error:ce})=>{if(ce)b.fromError("BLOCK_CREATING_ERROR",{title:e.title,html:h()},ce),C(!1);else{let xe=X;const ne=h();if(X?.global_block&&X?.id&&ne){const Ae=new Date,we=r.injectEmBlockIdIntoBlockHtml(ne,String(X.id),Ae);if(ee=r.formatEmBlockVersion(Ae),we!==ne){const $e=await oe({blockId:X.id,html:we});!$e.error&&$e.data&&(xe=$e.data)}}J(xe)}});else if(G.status!=="pending"){const X=h(),ce=new Date,xe=e.global_block?r.injectEmBlockIdIntoBlockHtml(X,String(e.id),ce):X;e.global_block&&(ee=r.formatEmBlockVersion(ce)),oe({blockId:e.id,source:re,title:e.title,project:e.project,type:e.type?e.type:"Other",description:e.description,html:xe,blocktags:pe||e.blocktags,tags:U,...r.hasOwnMeta(e)?{meta:e.meta}:{}}).then(({data:ne,error:Ae})=>{Ae&&P?(b.fromError("BLOCK_EDITING_ERROR",r.getBlockDesc(e),Ae),C(!1)):J(ne)})}};Q?Promise.all(Q).then(pe=>be(pe)):be(null)};C(!0),ke(void 0)},[te.status,q,G.status,oe,e,i,y,ue,p,d,P,h,b,me,O,T,_]);(0,n.useEffect)(()=>{P&&(se(),Y(!1))},[P,se]);const _e=(0,n.useCallback)(re=>{(re.ctrlKey||re.metaKey)&&re.keyCode===83&&(re.preventDefault(),Y(!0))},[]);(0,n.useEffect)(()=>(document.addEventListener("keydown",_e),()=>{document.removeEventListener("keydown",_e)}),[_e]);const ve=(0,n.useCallback)(re=>{const ke=re.data.operation,ae=re.data.action;ke===r.EVENT_TYPES.APPLICATION_ACTION&&ae==="save_email"&&Y(!0)},[]);r.useListenPostMessage(ve),(0,n.useEffect)(()=>{te.isError&&(C(!1),b.error(te))},[k,te]),(0,n.useEffect)(()=>{const re=setTimeout(()=>{w(!0)},1e4);return()=>{clearTimeout(re)}},[]),(0,n.useEffect)(()=>{e.isNew&&!c&&E&&(se(),w(!1))},[E,e,se,c]);const de=G.isLoading||ue.isLoading||te.isLoading||j,De=!!s?.isLoading,ye=de||De;return(0,o.jsx)(t.ui_kit$Tooltip,{title:d(v?"Save by ⌘S":"Save by Ctrl+S"),placement:l?"right":"bottomRight",children:(0,o.jsx)("span",{className:"em-analytics__block-save-tooltip-target",children:(0,o.jsx)(t.ui_kit$Button,{type:"primary",block:l,disabled:a||De,className:"em-analytics__block-save",icon:(0,o.jsx)(r.EmIcons,{icon:"SaveOutlined",component:t.icons$SaveOutlined}),onClick:re=>{const ke=re.currentTarget;z({event:"click",action:"save_block"}),Y(!0);try{ke?.blur?.()}catch{}},loading:ye,children:l||f||x?"":d("Save")})})})};kr.propTypes={block:g.default.shape({id:g.default.string,isNew:g.default.bool,lock:g.default.bool,type:g.default.string,html:g.default.string,description:g.default.string,project:g.default.number,title:g.default.string}),isEditableRights:g.default.bool.isRequired};var Tm=to.__exportAll({AddAllBlocksModal:()=>_r,AddNewBlockModal:()=>gr,BlocksSearch:()=>br,Discuss:()=>Ea,DiscussAi:()=>ea,EmailProperties:()=>Ol,EmailSettings:()=>Ui,EmailStyles:()=>Ji,FileManagerDataLayer:()=>ba,HistoryPanel:()=>fr,LimitUpgradeModal:()=>ai,Optimise:()=>ma,SaveBlockBtn:()=>kr,SelectedElementPanel:()=>dt,SendTestEmailModal:()=>xr});no.AddAllBlocksModal=_r,no.AddNewBlockModal=gr,no.BlocksSearch=br,no.Discuss=Ea,no.DiscussAi=ea,no.EmailProperties=Ol,no.EmailSettings=Ui,no.EmailStyles=Ji,no.FileManagerDataLayer=ba,no.HistoryPanel=fr,no.LimitUpgradeModal=ai,no.LimitUpgradeModal$1=ai,no.Optimise=ma,no.SaveBlockBtn=kr,no.SelectedElementPanel=dt,no.SendTestEmailModal=xr,no.canonicalImageUrlKey=ft,no.getImageDimensionsFromBlob=Tr,no.normalizeImageFormatForDisplay=Ft,Object.defineProperty(no,"panels_exports",{enumerable:!0,get:function(){return Tm}}),no.resolveDataProviderPreview=yr,no.shouldCountAiUsage=nr,no.useImageBlobFetch=wr,no.useImageBlobResolver=jr});
|