@emailmaker/emailmaker 1.3.2 → 1.3.4
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/emailmaker-core.87ebe001.js +859 -0
- package/emailmaker-esm.js +11 -11
- package/{emailmaker-po.b63d7b8b.js → emailmaker-po.87ebe001.js} +1 -1
- package/emailmaker.d.ts +4 -1
- package/emailmaker.js +12 -12
- package/iframe/.vite/manifest.json +4 -4
- package/iframe/{iframe-eblock.b63d7b8b.html → iframe-eblock.87ebe001.html} +2 -2
- package/iframe/{iframe.b63d7b8b.html → iframe.87ebe001.html} +2 -2
- package/iframe/js/{elMarkupHelper.C4wWAApZ.js → elMarkupHelper.CO37NCd9.js} +74 -74
- package/iframe/js/{iframe-eblock.body.b63d7b8b.js → iframe-eblock.body.87ebe001.js} +1 -1
- package/iframe/js/iframe-eblock.js +2 -2
- package/iframe/js/{iframe.body.b63d7b8b.js → iframe.body.87ebe001.js} +10 -10
- package/iframe/js/iframe.js +2 -2
- package/package.json +1 -1
- package/runtime/react/index.js +1 -1
- package/static/core/{89fb48c9.js → 122c5ed9.js} +1 -1
- package/static/core/{86e5503b.js → 2269bf04.js} +1 -1
- package/static/core/{66a5de32.js → 27599903.js} +1 -1
- package/static/core/{fa6f5198.js → 27986c36.js} +1 -1
- package/static/core/{69842511.js → 312fb954.js} +1 -1
- package/static/core/32e15918.js +1 -0
- package/static/core/{9f6b8cdd.js → 489390a3.js} +1 -1
- package/static/core/{d402573d.js → 4cdd6e6c.js} +1 -1
- package/static/core/{5e13bbc1.js → 5afad425.js} +1 -1
- package/static/core/{4f63baad.js → 5ebf9f1e.js} +1 -1
- package/static/core/{f85176c7.js → 67cc6cb2.js} +1 -1
- package/static/core/{8fdd9471.js → 75a2537a.js} +1 -1
- package/static/core/{6319e32c.js → 7601732d.js} +1 -1
- package/static/core/76163cc7.js +2 -0
- package/static/core/{cd715a88.js → 78916fed.js} +1 -1
- package/static/core/{4fef179c.js → 79e13595.js} +1 -1
- package/static/core/{7a9faff8.js → 81a16991.js} +1 -1
- package/static/core/{d0d2525d.js → 81c0d133.js} +1 -1
- package/static/core/{40574d12.js → 81cc5690.js} +1 -1
- package/static/core/{e2694475.js → 87c47034.js} +2 -2
- package/static/core/{85accd9c.js → 8cebeef2.js} +1 -1
- package/static/core/{a6518f19.js → 9a7e933e.js} +1 -1
- package/static/core/{aea50cd5.js → a15ab3fe.js} +1 -1
- package/static/core/{253d6f68.js → afb0d556.js} +2 -2
- package/static/core/{bb58b8a1.js → b8941eda.js} +14 -14
- package/static/core/{32a14159.js → c8c233fb.js} +1 -1
- package/static/core/{3a876cdd.js → d8175c7f.js} +1 -1
- package/static/core/{a9d62c49.js → d833a29f.js} +1 -1
- package/static/esm/9610f2de.js +1 -0
- package/static/esm/f76c9d9d.js +1 -1
- package/static/umd-runtime/{runtime.9w1dxMVc.js → runtime.BHEKxbjr.js} +1 -1
- package/vendor/@emailmaker/ui-kit/package.json +1 -1
- package/vite/pluginDev/index.cjs +10 -2
- package/vite/pluginDev/index.js +10 -2
- package/webpack/pluginDev/index.cjs +10 -1
- package/webpack/pluginDev/index.js +10 -1
- package/emailmaker-core.b63d7b8b.js +0 -859
- package/static/core/c266ad76.js +0 -1
- package/static/core/e8edbf21.js +0 -2
- package/static/esm/74f083c2.js +0 -1
|
@@ -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(--em-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(--em-borderRadius) * 1px);border:1px solid var(--em-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(--em-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(--em-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(--em-colorBorderSecondary);border-radius:calc(var(--em-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(--em-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(--em-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(--em-colorBorderSecondary);border-radius:calc(var(--em-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(--em-colorTextQuaternary,var(--em-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(--em-colorBorderSecondary);border-radius:calc(var(--em-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(--em-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(--em-colorBorderSecondary);border-radius:calc(var(--em-borderRadius) * 1px);box-sizing:border-box;padding:10px}.blocks-app .form-editor-input__preview-input{border-radius:calc(var(--em-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(--em-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(--em-colorBorderSecondary);border-radius:calc(var(--em-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(--em-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(--em-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(--em-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(--em-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.__emailmaker_styles__||(window.__emailmaker_styles__={sheets:{},order:[]}),t=r;if(!o.sheets[t]){var i=null;try{typeof CSSStyleSheet=="function"&&"replaceSync"in CSSStyleSheet.prototype&&(i=new CSSStyleSheet,i.replaceSync(r))}catch{i=null}if(i){if(!o.host||!o.host.isConnected||!o.host.sheet){var e=document.createElement("style");e.setAttribute("data-emailmaker","true"),document.head.appendChild(e),o.host=e}for(var d=o.host.sheet,a=0;a<i.cssRules.length;a++)try{d.insertRule(i.cssRules[a].cssText,d.cssRules.length)}catch{}(o.texts||(o.texts=[])).push(r),(o.listeners||[]).forEach(function(p){try{p(r)}catch{}})}else{var e=document.createElement("style");e.setAttribute("data-emailmaker","true"),e.appendChild(document.createTextNode(r)),document.head.appendChild(e)}o.sheets[t]=!0,o.order.push(t)}}}catch(p){console.error("vite-plugin-css-injected-by-js",p)}})();
|
|
2
|
-
__emailmaker__.define("static/core/bb03ea6d.js",["require","exports","module","static/core/5dc34752.js","static/core/5c3dd765.js","static/core/29af64b8.js","react","react/jsx-runtime","__delivery__/libs","classnames"],function(B,I,De){const J=B("./5dc34752.js"),r=B("./5c3dd765.js"),u=B("./29af64b8.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
|
+
__emailmaker__.define("static/core/d158e284.js",["require","exports","module","static/core/5dc34752.js","static/core/281afc68.js","static/core/d2024dc2.js","react","react/jsx-runtime","__delivery__/libs","classnames"],function(B,I,De){const J=B("./5dc34752.js"),r=B("./281afc68.js"),u=B("./d2024dc2.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
|
-
__emailmaker__.define("static/core/
|
|
4
|
+
__emailmaker__.define("static/core/98d702c3.js",["require","exports","module","static/core/5dc34752.js","static/core/281afc68.js","static/core/f7a36b67.js","vite/preload-helper"],function(h,I,B){const D=h("./5dc34752.js"),n=h("./281afc68.js"),p=h("./f7a36b67.js");let R=h("vite/preload-helper");var b=D.__exportAll({IMPORT_UPLOAD_CONCURRENCY:()=>15,createDocumentProcessor:()=>W,createFileProcessor:()=>T,createImportFileNamer:()=>_,ensureFileExtension:()=>$,extractUploadResult:()=>F,fetchFileData:()=>U,getExt:()=>C,handleUploadResult:()=>j,importEmail:()=>L,importHtml:()=>x,importZip:()=>P,splitFileName:()=>M,uploadFile:()=>n.uploadFile});function C(e){const t=e.split(".");return t[t.length-1].toLowerCase()}function M(e){const t=e.split(".");return t[t.length-1].toLowerCase()}var w="index.html";function H(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=`-${H(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("/")+"/",f=n.zipEntryToText(s[i]),{html:N,hasBrowserExtensionArtifacts:m}=n.prepareEmailHtmlForEditor(f),g=l.slice(0,l.length-1).join("/"),v=_();return{html:await p.changeHtml(N,async c=>{const y=c.document;await p.replaceImagesInDocument(y,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)),g&&!o.match("^(ht|f)tp(s?)://")&&(o=`${g}/${o}`);const A=s[o];return A?t(n.zipEntryToBlob(A),o):t(o,v(o,p.getFileNameWithExt(o)))}),r&&r(c)}),hasBrowserExtensionArtifacts:m,sourceHtml:f}}}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,sourceHtml:e}}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,R.__vitePreload)(async()=>{const{default:l}=await Promise.resolve().then(()=>h("./43a8b244.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 z=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 T=(e,t,r,s,a)=>{const{maxSizeMB:i,maxWidthOrHeight:l}=n.resolveImageCompressionLimits(a),d=n.getBrowserImageCompressionLibUrl(),u=O(15);return(f,N)=>u(async()=>{try{const m=await U(f,e);if(!m)return typeof f=="string"?f:"";const g=await $(N,m.type),v=m.type?.trim()||n.inferImageMimeFromFileName(g)||"";let c=new File([m],g.toLowerCase(),{type:v});if(n.isAllowedImageUploadFile(c)){const y=c.type?.trim()||n.inferImageMimeFromFileName(c.name)||m.type||"";try{c=await n.prepareImageForUpload(c,{maxSizeMB:i,maxWidthOrHeight:l,mimeType:y||m.type,fileName:c.name,libURL:d,enableCompression:n.shouldEnableImageCompression(a,y),convertSvgToPng:!0})}catch{}}return j(await t({user_id:r.id,folder:s.id,file:c}),f)}catch{return typeof f=="string"?f:""}})},W=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 b}})});
|
|
5
5
|
|
|
6
|
-
__emailmaker__.define("static/core/
|
|
6
|
+
__emailmaker__.define("static/core/d2024dc2.js",["require","exports","module","static/core/5dc34752.js","static/core/281afc68.js","react","react/jsx-runtime","__delivery__/libs"],function(t,e,S){const i=t("./5dc34752.js"),r=t("./281afc68.js");let o=t("react");o=i.__toESM(o);let l=t("react/jsx-runtime"),d=t("__delivery__/libs");function n(){return r.usePlanFeatureGate("google_fonts").isLocked?void 0:r.loadGFonts}var u=c=>{const{form:g,namePrefix:I="",typeOfForm:s="desktop"}=c,E=r.useSelector(r.selectEmailSettings).usedColors;return(0,l.jsx)(d.ui_kit$FormBorderInputs,{form:g,namePrefix:I,typeOfForm:s,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"},a={mobileBorderRadiusAll:"all",mobileBorderRadiusTopLeft:"topLeft",mobileBorderRadiusBottomLeft:"bottomLeft",mobileBorderRadiusTopRight:"topRight",mobileBorderRadiusBottomRight:"bottomRight"},R={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 R}}),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 a}}),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(--em-formItemMarginBottomXS) * 1px)}.blocks-app .upload-bg-image__inner-wrap{border:calc(var(--em-borderWidth) * 1px) solid var(--em-colorFillSecondaryDarken);border-radius:calc(var(--em-borderRadius) * 1px);cursor:pointer;background-color:var(--em-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(--em-borderColorHover)}.blocks-app .upload-bg-image__uploader{width:calc((var(--em-formControlHeight) - var(--em-borderWidth) * 2 + 1) * 1px);height:calc((var(--em-formControlHeight) - var(--em-borderWidth) * 2) * 1px);border-radius:calc(var(--em-borderRadius) * .8px);border:none;border-right:1px solid var(--em-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(--em-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(--em-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(--em-colorTextQuaternary)}.blocks-app .upload-bg-image__edit,.blocks-app .upload-bg-image__edit-menu{color:var(--em-colorLink);right:calc((var(--em-borderWidth) + 2) * 1px);padding:6px;line-height:1;position:absolute}.blocks-app .upload-bg-image__edit{right:calc((var(--em-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(--em-colorFillSecondary);border-radius:calc(var(--em-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(--em-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(--em-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(--em-colorBgContainer) 60%, transparent);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);box-shadow:28px 0 0 0 color-mix(in srgb, var(--em-colorBgContainer) 60%, transparent), -28px 0 0 0 color-mix(in srgb, var(--em-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(--em-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(--em-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(--em-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(--em-colorFillSecondaryDarken);color:inherit;border-color:#0000}.blocks-app .selected_text_common_form_mobile .selected-td-form__button--active{background:var(--em-colorPrimaryBg);color:var(--em-colorPrimary);border-color:#0000}.blocks-app .selected_text_common_form_mobile .selected-td-form__button--active:hover{background:var(--em-colorPrimaryBgHover)!important;color:var(--em-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(--em-colorFillSecondaryDarken);width:34px;height:34px;top:0;left:0}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper{background:var(--em-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(--em-colorFillSecondaryDarken)}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper.ant-radio-button-wrapper-checked{background:var(--em-colorPrimaryBg);color:var(--em-colorPrimary)}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper.ant-radio-button-wrapper-checked:hover{background:var(--em-colorPrimaryBgHover);color:var(--em-colorPrimaryTextHover)}.blocks-app .selected_text_common_form_mobile .codemode-textalign-dropdown{background-color:var(--em-colorBgContainer);border-radius:calc(var(--em-borderRadius) * 1px);box-shadow:var(--em-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(--em-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(--em-colorTextSecondary);background-color:var(--em-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(--em-colorError)}.blocks-app .selected-td-form__border-radio:after{content:"·";border:3px solid var(--em-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(--em-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(--em-colorFillQuaternary);border-radius:calc(var(--em-borderRadius) * 1px);margin-bottom:calc(var(--em-formItemMarginBottomXS) * 1px);border:calc(var(--em-borderWidth) * 1px) solid var(--em-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(--em-colorBorderSecondary,#f0f0f0);margin-top:16px;padding-top:16px}.blocks-app .selected-social-form .selected-social-form__section-title{color:var(--em-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(--em-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(--em-colorBorderSecondary,#f0f0f0);background:var(--em-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(--em-colorPrimary);box-shadow:0 0 0 1px var(--em-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(--em-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(--em-colorText,#000000e0);background:var(--em-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(--em-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(--em-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(--em-colorText,#000000e0);background:var(--em-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(--em-colorPrimary);outline-offset:1px}.blocks-app .selected-social-form .selected-social-form__card-title{min-width:0;color:var(--em-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(--em-formControlHeight) * 1px);min-width:calc(var(--em-formControlHeight) * 1px);max-width:calc(var(--em-formControlHeight) * 1px);height:calc(var(--em-formControlHeight) * 1px);min-height:calc(var(--em-formControlHeight) * 1px);max-height:calc(var(--em-formControlHeight) * 1px);line-height:calc((var(--em-formControlHeight) - 2) * 1px);color:var(--em-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(--em-colorText,#000000e0);background:var(--em-colorFillSecondary,#f0f0f0)}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn:focus-visible{outline:2px solid var(--em-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(--em-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(--em-colorFillTertiary,#f8f8f8);height:32px;color:var(--em-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(--em-colorFillSecondary,#f0f0f0);color:var(--em-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(--em-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(--em-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(--em-boxShadowSecondary);border-radius:calc(var(--em-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(--em-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(--em-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(--em-colorBorder);z-index:100;background-color:var(--em-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(--em-colorPrimary)}.blocks-app .selected-element-panel__mobile-switch.ant-switch-checked{background-color:var(--em-colorInfo)}.blocks-app #selected_element_form_desktop_props .ant-alert-info .ant-alert-title{color:var(--em-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{--em-colorPrimaryBorder:var(--em-colorInfo);--em-controlOutline:var(--em-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(--em-colorInfo);box-shadow:0 0 0 calc(var(--em-controlOutlineWidth) * 1px) var(--em-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(--em-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(--em-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(--em-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(--em-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(--em-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-btn-background-ghost.ant-btn-primary{color:var(--em-colorInfo);border-color:var(--em-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(--em-colorInfoBg)!important;color:var(--em-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(--em-colorInfoTextActive)}.blocks-app .ant-app .selected_form-mobile-props .ant-switch.ant-switch-checked:hover:not(.ant-switch-disabled){background-color:var(--em-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(--em-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-alert-info{background-color:var(--em-colorInfoBg);border:none}.blocks-app .ant-app .selected_form-mobile-props .ant-alert-info .ant-alert-title{color:var(--em-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(--em-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(--em-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(--em-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(--em-colorTextSecondary,#8c8c8c);margin-top:16px;font-size:12px;font-weight:300;line-height:1.4}.blocks-app .annotations-panel__section-hint{color:var(--em-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(--em-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(--em-colorInfo)}.blocks-app .ant-comment .ant-comment-avatar .anticon-user{background:var(--em-colorPrimary)}.blocks-app .ant-comment.ai-comment .ant-comment-avatar .anticon-robot{background:var(--em-colorInfo)}.blocks-app .ant-comment.ai-comment .ant-comment-avatar .anticon-user{background:var(--em-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(--em-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(--em-colorBgContainer);width:34px;height:34px;color:var(--em-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(--em-colorFillTertiary);color:var(--em-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(--em-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(--em-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(--em-colorText);width:34px;height:34px;color:var(--em-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(--em-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(--em-colorBorder);min-width:147px;height:32px;color:var(--em-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(--em-colorBorderSecondary);background:linear-gradient(180deg, var(--em-colorBgContainerDisabled), transparent 40%);width:calc(100% + 50px);margin:26px -25px}.blocks-app .optimise.ant-collapse>.ant-collapse-item{border-bottom:1px solid var(--em-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(--em-colorSuccessText)}.blocks-app .optimise .error{white-space:nowrap;color:var(--em-colorErrorText)}.blocks-app .optimise .warning{white-space:nowrap;color:var(--em-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(--em-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(--em-colorBorder) 25%, transparent 0, transparent 75%, var(--em-colorBorder) 0), linear-gradient(45deg, var(--em-colorBorder) 25%, transparent 0, transparent 75%, var(--em-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(--em-borderRadius) * 1px);background:linear-gradient(45deg, var(--em-colorBorder) 25%, transparent 0, transparent 75%, var(--em-colorBorder) 0), linear-gradient(45deg, var(--em-colorBorder) 25%, transparent 0, transparent 75%, var(--em-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(--em-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(--em-colorWarningText)}.blocks-app .optimise .errors{color:var(--em-colorErrorText)}.blocks-app .optimise .valid{color:var(--em-colorSuccessText)}.blocks-app .optimise__button.warnings{border-color:var(--em-colorWarningBorder);background:var(--em-colorWarningBg)}.blocks-app .optimise__button.warnings:not(.ant-tag-checkable-checked):hover{border-color:var(--em-colorWarningBorderHover);color:var(--em-colorWarningTextHover);background:var(--em-colorWarningBgHover)}.blocks-app .optimise__button.warnings_active{color:#fff;background-color:var(--em-colorWarningActive);border-color:var(--em-colorWarningActive)}.blocks-app .optimise__button.errors{border-color:var(--em-colorErrorBorder);background:var(--em-colorErrorBg)}.blocks-app .optimise__button.errors:not(.ant-tag-checkable-checked):hover{border-color:var(--em-colorErrorBorderHover);color:var(--em-colorErrorTextHover);background:var(--em-colorErrorBgHover)}.blocks-app .optimise__button.errors_active{color:#fff;background-color:var(--em-colorErrorActive);border-color:var(--em-colorErrorActive)}.blocks-app .optimise__button.valid{border-color:var(--em-colorSuccessBorder);background:var(--em-colorSuccessBg)}.blocks-app .optimise__button.valid:not(.ant-tag-checkable-checked):hover{border-color:var(--em-colorSuccessBorderHover);color:var(--em-colorSuccessTextHover);background:var(--em-colorSuccessBgHover)}.blocks-app .optimise__button.valid_active{color:#fff;background-color:var(--em-colorSuccessActive);border-color:var(--em-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(--em-colorBgContainer);border-radius:calc(var(--em-borderRadiusXL) * 1px);box-shadow:var(--em-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(--em-colorBorderSecondary);border-radius:calc(var(--em-borderRadiusLG) * 1px);background:linear-gradient(45deg, var(--em-colorBorder) 25%, transparent 25%, transparent 75%, var(--em-colorBorder) 75%), linear-gradient(45deg, var(--em-colorBorder) 25%, transparent 25%, transparent 75%, var(--em-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(--em-colorTextSecondary);text-align:left;margin-bottom:12px;line-height:1.2;list-style:none}.blocks-app .blocks-search__type-wrapper li.active{color:var(--em-colorLink)}.blocks-app .blocks-search__type-wrapper li:hover{color:var(--em-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(--em-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(--em-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(--em-colorBgElevated);border:1px solid var(--em-colorBorder);border-radius:calc(var(--em-borderRadiusSM) * 1px);text-align:center;cursor:grab;background-color:var(--em-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(--em-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(--em-controlTmpOutline)}.blocks-app .blocks-search .em-ghost-element{border-radius:calc(var(--em-borderRadiusXL) * 1px);overflow:hidden;background-color:var(--em-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(--em-colorBgContainer);border-radius:calc(var(--em-borderRadiusXL) * 1px);box-shadow:var(--em-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(--em-colorTextSecondary);padding:8px 15px;font-size:14px}.blocks-app .block-search__preview-content{border:1px solid var(--em-colorBorderSecondary);border-radius:calc(var(--em-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(--em-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(--em-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(--em-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(--em-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(--em-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(--em-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(--em-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(--em-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(--em-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(--em-colorBgContainerDisabled), transparent 40%);border-top:1px solid var(--em-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(--em-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(--em-colorFillQuaternary)}.blocks-app .history-panel__list .ant-btn.ant-btn-sm{--ant-btn-border-width:0;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(--em-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.__emailmaker_styles__||(window.__emailmaker_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-emailmaker","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-emailmaker","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
|
-
__emailmaker__.define("static/core/bb58b8a1.js",["require","exports","module","static/core/5dc34752.js","static/core/ee980948.js","static/core/5c3dd765.js","static/core/f6b71452.js","static/core/bc15a359.js","static/core/29af64b8.js","static/core/c266ad76.js","react","react/jsx-runtime","__delivery__/libs","react-dom","vite/preload-helper","classnames","dayjs"],function(_t,mt,wh){const at=_t("./5dc34752.js"),ht=_t("./ee980948.js"),r=_t("./5c3dd765.js"),fi=_t("./f6b71452.js"),$n=_t("./bc15a359.js"),W=_t("./29af64b8.js"),Ur=_t("./c266ad76.js");let n=_t("react");n=at.__toESM(n);let t=_t("react/jsx-runtime"),o=_t("__delivery__/libs"),Fn=_t("react-dom"),No=_t("vite/preload-helper"),We=_t("classnames");We=at.__toESM(We);let At=_t("dayjs");At=at.__toESM(At);var _=at.__toESM(r.require_prop_types());async function Wr(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,s)=>{const l=URL.createObjectURL(e),a=new Image;a.onload=()=>{URL.revokeObjectURL(l);const d=a.naturalWidth||a.width,c=a.naturalHeight||a.height;d>0&&c>0?i({width:d,height:c}):s(new Error("Could not read image dimensions"))},a.onerror=()=>{URL.revokeObjectURL(l),s(new Error("Could not decode image"))},a.src=l})}function ho(e){return e.trim()}var Mn=67108864,Dn=2e3;function Lo(e){e.abandonTimer!==void 0&&(clearTimeout(e.abandonTimer),e.abandonTimer=void 0)}function zr(e,i){return i?new Promise((s,l)=>{if(i.aborted){l(new DOMException("Aborted","AbortError"));return}const a=()=>{l(new DOMException("Aborted","AbortError"))};i.addEventListener("abort",a,{once:!0}),e.then(d=>{i.removeEventListener("abort",a),s(d)},d=>{i.removeEventListener("abort",a),l(d)})}):e}function Vn(e={}){const i=e.maxCacheBytes??Mn,s=e.abandonDelayMs??Dn,l=new Map,a=new Map;let d=0;function c(k){const f=l.get(k);f&&(d-=f.size,l.delete(k))}function h(k,f){if(c(k),!(f.size>i)){l.set(k,f),d+=f.size;for(const y of l.keys()){if(d<=i)break;c(y)}}}function g(k){const f=a.get(k);f&&(Lo(f),a.delete(k))}function b(k,f){f.waiters-=1,!(f.waiters>0||f.abandonTimer!==void 0||a.get(k)!==f)&&(f.abandonTimer=setTimeout(()=>{f.abandonTimer=void 0,!(a.get(k)!==f||f.waiters>0)&&(a.delete(k),f.controller.abort())},s))}function x(k,f,y){return f.waiters+=1,Lo(f),y.then(()=>b(k,f),()=>b(k,f)),y}async function p(k,f,y){const v=ho(k);if(!v)throw new Error("Empty image URL");const N=l.get(v);if(N){if(f?.aborted)throw new DOMException("Aborted","AbortError");return l.delete(v),l.set(v,N),N}const R=a.get(v);if(R)return x(v,R,zr(R.promise,f));const C=new AbortController,F={promise:y(v,C.signal).then(U=>(g(v),h(v,U),U)).catch(U=>{throw g(v),U}),controller:C,waiters:0,abandonTimer:void 0};return a.set(v,F),x(v,F,zr(F.promise,f))}function m(k){const f=ho(k);if(!f)return;const y=a.get(f);y&&(Lo(y),y.controller.abort(),a.delete(f)),c(f)}function S(){for(const[,k]of a)Lo(k),k.controller.abort();a.clear(),l.clear(),d=0}return{resolve:p,abandonKey:m,invalidateAll:S}}async function Gr(e,i){if(!e||typeof e.findFileByUrl!="function")return null;const s=await e.findFileByUrl(i);if(!s)return null;const l=typeof e.getFileById=="function"&&s.id&&await e.getFileById(s.id)||s,a=l.url||i,d=l.thumbnailUrl||l.thumbnail||a||(typeof e.getThumbnailUrl=="function"?await e.getThumbnailUrl(l):"")||"";return d?{file:l,previewUrl:d}:null}function bo(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 Hn(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 Un(e,i){const s=await fetch(e,i);if(!s.ok)throw new Error(`Server returned ${s.status}`);return s.blob()}async function Wn(e,i,s){const l=s?{signal:s}:void 0,{blob:a}=await r.ue(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,h)=>ht.fetchWithResourceProxy(d,{config:i.appConfig,standalone:i.isStandalone,intent:h?.intent||"downloadBlob",validateBlob:async g=>!g.type||g.type.startsWith("image/"),init:c})},d=>Un(d,l),Hn,{fetchInit:l});return a}function Yr(){const e=r.useAppConfig(),i=r.useIsStandalone(),s=r.useProjectData(),l=r.useEditorProjectId(),a=s?.id!==void 0?String(s.id):l||"",d=r.useEventEmitter(ht.events.FILE_PROXY_EVENT_ID),c=r.useEventEmitter(ht.events.PROXY_URL_EVENT_ID);return(0,n.useCallback)(async(h,g)=>Wn(h,{appConfig:e,isStandalone:i,fireFileProxy:b=>d.fire({url:b,project:a}),fireProxyUrl:b=>c.fire({url:b,project:a})},g),[e,a,i,d,c])}function zn(e){return ht.getContainer(e).getOrCreateInstance(ht.IMAGE_BLOB_RESOLVER_ID,()=>Vn())}function Xr(){const e=r.useStore();return(0,n.useMemo)(()=>zn(e),[e])}function Oo(e){const i=String(e??"").split(";")[0].trim();if(!i)return"";const s=i.toLowerCase(),l=s.indexOf("/");if(l===-1)return s;const a=s.slice(l+1);return a==="svg+xml"?"svg":a}var Kr=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),_i=({onChange:e,value:i,validateStatus:s,placeholder:l,disabled:a,name:d,elementSettings:c,imageInfo:h,previewReloadSignal:g,onRemotePreviewValidate:b})=>{const x=r.useCurrentUser(),p=r.useProjectData(),m=r.useAppConfig(),S=r.useIsStandalone(),{__:k}=r.useI18n();r.useSendPostMessage();const f=r.useSendPostMessageEx(),{openImagePicker:y}=r.useImagePicker(),v=r.useStorageProvider(),N=r.useRestClient(),R=p?.id!==void 0?String(p?.id):"",C=x?.id!=="0"?String(x.id):"",{dataProvider:F}=(0,n.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:v,projectId:R,restApi:N,i18n:{__:k},pathPostfix:C,appConfig:m,isStandalone:S}),[m,S,R,N,v,C,k]),U=Yr(),[$]=r.useLazyGetImageInfoQuery(),[L,P]=(0,n.useState)({width:"",height:"",size:""}),[V,ne]=(0,n.useState)(!1),[T,oe]=(0,n.useState)(0),[xe,be]=(0,n.useState)(""),Se=(0,n.useRef)(""),me=(0,n.useRef)(g?.counter||0),he=Xr(),ke=(0,n.useRef)(""),ce=(0,n.useRef)(""),[ze,Oe]=(0,n.useState)(0),ve=r.usePlanFeatureGate("image_editor"),Ee=()=>{ke.current&&(URL.revokeObjectURL(ke.current),ke.current="")};(0,n.useEffect)(()=>{if(!i){P({width:"",height:"",size:"",format:""}),Se.current="",be(""),Ee();return}if(i.startsWith("data:")||i.startsWith("blob:")){Ee(),Se.current=i,be(i),P({width:"",height:"",size:"",format:""});return}const H=r.stripEmVersionFromUrlString(i);ce.current=H;const M=ho(H),Y=new AbortController;let K=!1;const te=async Te=>{Ee();const Re=ze?r.appendEmVersionForPreviewReload(Te):Te;Se.current=Re,be(Re);try{const{data:$e}=await $(H);return K||!$e?!1:(P({width:$e?.width,height:$e?.height,size:$e?.fileSize!=null?($e.fileSize/1024).toFixed(0):"",format:Oo($e?.format)}),!0)}catch{return!1}},le=async()=>{const Te=await he.resolve(M,Y.signal,U);if(K)return;const{width:Re,height:$e}=await Wr(Te);if(K)return;Ee();const z=URL.createObjectURL(Te);ke.current=z,Se.current=z,be(z),P({width:Re,height:$e,size:(Te.size/1024).toFixed(0),format:Oo(Te.type)})};return(async()=>{try{if(!S){const Te=await Gr(F,H);if(Te?.previewUrl&&await te(Te.previewUrl))return}await le()}catch{K||(Ee(),Se.current="",be(""),P({width:"",height:"",size:"",format:""}))}})(),()=>{K=!0,Y.abort()}},[i,F,U,$,S,he,ze]);const pe=(0,n.useCallback)(()=>{const H=ce.current;H&&he.abandonKey(ho(H)),Oe(Date.now())},[he]);(0,n.useEffect)(()=>{!g?.counter||g.name!==d||g.counter!==me.current&&(me.current=g.counter,pe())},[d,g,pe]),(0,n.useEffect)(()=>()=>Ee(),[]);const Q=!!i&&!bo(r.stripEmVersionFromUrlString(String(i))),X=async(H=null)=>{const M=d.startsWith("src"),Y=H||(M?r.MODALS.UPLOAD_IMAGE_MODAL:r.MODALS.UPLOAD_BACKGROUND_MODAL),K=r.stripEmVersionFromUrlString(i||""),te=await y({kind:M?"img":"background",currentUrl:bo(K)?"":K,entryModal:Y});if(!te?.url)return;const le=K===r.stripEmVersionFromUrlString(te.url);(!le||te.url!==i)&&e(te.url),te.meta?.mode==="save"&&le&&(pe(),M&&f(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(te.url)}))},Z=[{label:k("Upload"),key:"Upload",onClick:()=>X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}];m.imageCenterStockEnabled&&Z.push({label:k("Stock"),key:"Stock",onClick:()=>X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_STOCK:r.MODALS.UPLOAD_BACKGROUND_MODAL_STOCK)}),m.imageCenterGifEnabled&&Z.push({label:k("GIF"),key:"GIF",onClick:()=>X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_GIF:r.MODALS.UPLOAD_BACKGROUND_MODAL_GIF)}),m.elementAIimageEnabled&&Z.push({label:k("AI"),key:"AI",onClick:()=>X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_AI:r.MODALS.UPLOAD_BACKGROUND_MODAL_AI)});const J=()=>{ne(!1)};return(0,t.jsxs)("div",{className:(0,We.default)("upload-bg-image",{"upload-bg-image_disabled":a}),children:[i?(0,t.jsxs)("div",{className:"ant-input-file-uploader upload-bg-image__inner-wrap",onClick:H=>{H.target?.closest(".upload-bg-image__edit")||H.target?.closest(".upload-bg-image__edit-menu")||H.target?.closest(".upload-bg-image__menu")||H.target?.closest(".inputGroup")||X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)},children:[(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,popupRender:()=>m.imagePathDropdownEnabled?(0,t.jsx)("div",{className:"inputGroup",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"Image",component:o.icons$Image,size:20,strokeWidth:m.iconStrokeWidth,style:{verticalAlign:"text-top"}}),allowClear:!0,onChange:e,value:i,placeholder:l,name:d,disabled:a,className:"upload-bg-image__input"})}):(0,t.jsx)(t.Fragment,{}),classNames:{root:"upload-bg-image__dropdown-overlay"},styles:{root:{top:32,marginTop:"8px",width:347,left:0}},trigger:["hover"],placement:"bottom",getPopupContainer:H=>H.closest(".upload-bg-image__inner-wrap"),children:(0,t.jsxs)("div",{className:"upload-bg-image__hover-container",style:{display:"flex",alignItems:"center"},children:[(0,t.jsx)("div",{className:"upload-bg-image__uploader",children:(0,t.jsx)("div",{className:"upload-bg-image__uploader-content",children:(0,t.jsxs)("div",{className:"upload-bg-image__uploader-content-inner",children:[(0,t.jsx)("div",{className:"upload-bg-image__uploader-img-wrap",children:xe?(0,t.jsx)("img",{className:"upload-bg-image__uploader-img",src:xe,alt:"",onLoad:()=>{b&&Kr(r.stripEmVersionFromUrlString(i||""))&&b("success")},onError:()=>{const H=ce.current,M=r.stripEmVersionFromUrlString(xe||""),Y=r.stripEmVersionFromUrlString(H||"");if(H&&M!==Y){Se.current=H,be(H);return}b&&Kr(Y)&&b("error")}}):(0,t.jsx)("div",{className:"upload-bg-image__uploader-img-placeholder","aria-hidden":!0})}),(0,t.jsx)("div",{className:"upload-bg-image__uploader-icons-wrap",children:(0,t.jsx)("div",{className:"upload-bg-image__uploader-content"})})]})})}),L.width&&L.height?(0,t.jsxs)("div",{className:"image-size",children:[L.width," × ",L.height,!!c&&(c.type===r.ELEMENT_TYPES.IMG||c.type===r.ELEMENT_TYPES.CAROUSEL)&&" → "+h.renderedWidth+" × "+h.renderedHeight,(0,t.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,t.jsxs)("span",{children:[L.size," ",k("kB")]}),L.format&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,t.jsx)("span",{className:"image-size-format",children:L.format})]})]}):(0,t.jsx)(o.ui_kit$Text,{type:"secondary",className:"image-empty-text",children:l})]})}),(0,t.jsx)("div",{style:{flexGrow:1}}),L.format!=="gif"&&m.imageCenterEditorEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:k("Edit"),children:(0,t.jsx)(o.ui_kit$Text,{type:"link",className:"upload-bg-image__edit",children:(0,t.jsx)(r.EmIcons,{icon:"Edit",component:o.icons$Edit,size:16,strokeWidth:m.iconStrokeWidth,onClick:()=>{ve.isLocked&&Q?(ne(!0),oe(r.FEATURE_UPSELL_SLIDE.image_editor)):X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_EDIT:r.MODALS.UPLOAD_BACKGROUND_MODAL_EDIT)}})})}),(0,t.jsx)(o.ui_kit$Dropdown,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:Z},classNames:{root:"upload-bg-image__menu"},children:(0,t.jsx)(o.ui_kit$Text,{type:"link",className:"upload-bg-image__edit-menu image-change",children:i?(0,t.jsx)(r.EmIcons,{size:16,strokeWidth:m.iconStrokeWidth,icon:"SyncOutlined",component:o.icons$SyncOutlined,onClick:()=>X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}):k("Upload")})},"Actions")]}):(0,t.jsx)(o.ui_kit$Button,{type:"default",block:!0,onClick:()=>X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD),icon:(0,t.jsx)(r.EmIcons,{icon:"Image",component:o.icons$Image,size:16,strokeWidth:m.iconStrokeWidth}),children:k("Add image")}),V&&(0,t.jsx)(r.PlanUpgradePrompt,{open:!0,onCancel:J,initialSlide:T})]})};_i.propTypes={};var Gn=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),Yn=(e,i,s)=>i||(s?.type===r.ELEMENT_TYPES.CAROUSEL?["images",e]:Array.isArray(e)?e:[e]),qr=e=>Array.isArray(e)?e.join("_"):e,Pt=({form:e,label:i,name:s,watchPath:l,disabled:a=!1,elementSettings:d,previewReloadSignal:c=void 0})=>{const{token:h}=(0,o.ui_kit$useToken)(),[g,b]=(0,n.useState)("success"),x=(0,n.useMemo)(()=>({marginBottom:h.formItemMarginBottomXS}),[h.formItemMarginBottomXS]),p=o.ui_kit$Form.useWatch(Yn(s,l,d),e);return(0,n.useEffect)(()=>{if(!p){b("");return}if(typeof p=="string"&&(p.startsWith("data:")||p.startsWith("blob:"))){b("success");return}if(Gn(p)){b("validating");return}b("success")},[p]),(0,t.jsx)(o.ui_kit$Form.Item,{name:s,validateStatus:g,style:x,children:(0,t.jsx)(_i,{validateStatus:g,placeholder:i,name:qr(s),disabled:a,elementSettings:d,imageInfo:d?.type===r.ELEMENT_TYPES.CAROUSEL?d?.carouselImages?.[qr(s).split("_")[1]]:d,previewReloadSignal:c,onRemotePreviewValidate:b})})};Pt.propTypes={label:_.default.string.isRequired,name:_.default.oneOfType([_.default.string,_.default.arrayOf(_.default.oneOfType([_.default.string,_.default.number]))]).isRequired,watchPath:_.default.arrayOf(_.default.oneOfType([_.default.string,_.default.number])),tooltipTitle:_.default.string,disabled:_.default.bool,previewReloadSignal:_.default.shape({name:_.default.string,counter:_.default.number}),form:_.default.shape({getFieldValue:_.default.func.isRequired}).isRequired},Pt.defaulProps={disabled:!1,previewReloadSignal:null};var Rt=({form:e,oneBorderRadiusValue:i,setOneBorderRadiusValue:s,elementSettings:l,namePrefix:a="",typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),h=d==="mobile",g=h?"mobileBorderRadius":"borderRadius",b=h?"mobileBorderRadiusAll":"borderRadiusAll",x=h?"mobileBorderRadiusTopLeft":"borderRadiusTopLeft",p=h?"mobileBorderRadiusTopRight":"borderRadiusTopRight",m=h?"mobileBorderRadiusBottomRight":"borderRadiusBottomRight",S=h?"mobileBorderRadiusBottomLeft":"borderRadiusBottomLeft",k=h?W.MOBILE_BORDER_RADIUS_POSITION:W.BORDER_RADIUS_POSITION,f=()=>{const y=e.getFieldsValue(!0);let v;i?(e.setFieldsValue({[x]:y[b]||null,[S]:y[b]||null,[p]:y[b]||null,[m]:y[b]||null}),v={[g]:{[k[x]]:y[b]||0,[k[S]]:y[b]||0,[k[p]]:y[b]||0,[k[m]]:y[b]||0}}):y[x]===y[S]&&y[x]===y[p]&&y[x]===y[m]?(e.setFieldsValue({[b]:y[x]}),v={[g]:{[k[b]]:y[x]}}):(e.setFieldsValue({[x]:null,[S]:null,[p]:null,[m]:null}),v={[g]:{[k[b]]:0,[k[x]]:0,[k[S]]:0,[k[p]]:0,[k[m]]:0}});const N=h?{mobileBorderRadius:{all:y.mobileBorderRadiusAll||null,classNamePrefix:"em-mob-border_radius_all-"}}:{[`${a}${g}`]:{...l[`${a}${g}`],...v[`${a}${g}`]}};c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:N}),s(R=>!R)};return(0,t.jsx)(o.ui_kit$FormBorderRadiusInputs,{namePrefix:a,typeOfForm:d,oneBorderRadiusValue:i,onToggle:f,borderRadiusIcon:(0,t.jsx)(o.ui_kit$EmIcons,{icon:"BorderRadius",component:o.icons$BorderRadius,className:"selected-td-form__icon-radius"})})};Rt.displayName="SelectedElementFormBorderRadius";var Xn="em-mob-text_align-",Kn=({value:e,onChange:i,onSync:s,fieldName:l,...a})=>{const d=(typeof e=="object"?e?.value:e)??"",c=h=>{const g={classNamePrefix:Xn,value:h};i?.(g),s?.({[l]:g})};return(0,t.jsx)(o.ui_kit$FormAlignControl,{value:d,onChange:c,...a})},Mt=({form:e,elementSettings:i,imgParent:s=!1,name:l="align",tooltipTitle:a,typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),h=r.useAppConfig(),g=d==="mobile",b=g?"mobileAlign":l;if(g){const x=p=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:p})};return(0,t.jsx)(o.ui_kit$Form.Item,{name:b,children:(0,t.jsx)(Kn,{fieldName:b,onSync:x,disabled:s&&!i.parent,strokeWidth:h.iconStrokeWidth,tooltipTitle:a})})}return(0,t.jsx)(o.ui_kit$Form.Item,{name:b,children:(0,t.jsx)(o.ui_kit$FormAlignControl,{disabled:s&&!i.parent,strokeWidth:h.iconStrokeWidth,tooltipTitle:a})})},Ot=({form:e,elementSettings:i,tooltipTitle:s,disabled:l=!1,isNewIconType:a=!1,typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),h=r.useAppConfig(),g=d==="mobile",b=g?"mobileVerticalAlign":"valign",x=p=>{e.setFieldsValue({[b]:p}),g||c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[b]:p}})};return(0,t.jsx)(o.ui_kit$Form.Item,{name:b,children:(0,t.jsx)(o.ui_kit$FormVerticalAlignControl,{...!g&&{value:i.valign,onChange:x},disabled:l,isNewIconType:a,strokeWidth:h.iconStrokeWidth})})},qn=["mobileBoxShadowHOffset","mobileBoxShadowVOffset","mobileBoxShadowBlurRadius","mobileBoxShadowSpreadRadius","mobileBoxShadowColor","mobileBoxShadowInset"],Jn=({form:e,elementSettings:i,enableSwitch:s,usedColors:l,withoutShadowLabel:a})=>{const d=r.useSendPostMessage(),c=i.mobileBoxShadow,[h,g]=(0,n.useState)(!c||c.hOffset===0&&c.vOffset===0&&c.blurRadius===0&&c.spreadRadius===0),b=o.ui_kit$Form.useWatch(qn,e);(0,n.useEffect)(()=>{if(!b)return;const[p,m,S,k,f,y]=b;(p===0||p===void 0||p===null)&&(m===0||m===void 0||m===null)&&(S===0||S===void 0||S===null)&&(k===0||k===void 0||k===null)&&(f===""||f===void 0||f===null)&&(y===!1||y===void 0)||g(!1)},[b]);const x=()=>{g(p=>!p),e.setFieldsValue({mobileBoxShadowHOffset:h?"":0,mobileBoxShadowVOffset:h?"":0,mobileBoxShadowBlurRadius:h?"":0,mobileBoxShadowSpreadRadius:h?"":0,mobileBoxShadowColor:"",mobileBoxShadowInset:!1}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBoxShadow:{classNamePrefix:"em-mob-box_shadow-",hOffset:h?null:0,vOffset:h?null:0,blurRadius:h?null:0,spreadRadius:h?null:0,color:null,inset:!1}}})};return(0,t.jsxs)(t.Fragment,{children:[s&&(0,t.jsx)("div",{style:{float:"right",marginTop:-9,marginRight:50},children:(0,t.jsx)(o.ui_kit$Switch,{id:"without-shadow",label:a,labelSize:"small",size:"small",checked:h,onChange:x})}),(0,t.jsx)("p",{style:{paddingBottom:"8px",margin:"-30px 0 0"},children:" "}),(0,t.jsx)(o.ui_kit$FormBoxShadowInputs,{typeOfForm:"mobile",usedColors:l})]})},wt=({typeOfForm:e="desktop",form:i,elementSettings:s,enableSwitch:l=!0})=>{const{__:a}=r.useI18n(),d=r.useSelector(r.selectEmailSettings).usedColors;return e==="mobile"&&i&&s?(0,t.jsx)(Jn,{form:i,elementSettings:s,enableSwitch:l,usedColors:d,withoutShadowLabel:a("Without shadow")}):(0,t.jsx)(o.ui_kit$FormBoxShadowInputs,{typeOfForm:e,usedColors:d})};wt.displayName="SelectedElementFormBoxShadow";var jt=({form:e,elementSettings:i,directionControl:s})=>{const{__:l}=r.useI18n();return(0,t.jsx)(o.ui_kit$FormDisplayControl,{directionControl:s,className:"selected-element-form-show",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"show",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$Radio.Group,{children:(0,t.jsxs)(o.ui_kit$Space,{size:8,children:[(0,t.jsx)(o.ui_kit$Radio.Button,{value:"all",children:l("Both")}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:l("Desktop"),children:(0,t.jsx)(o.ui_kit$Radio.Button,{value:"desktop",children:(0,t.jsx)(r.EmIcons,{icon:"DesktopOutlined",component:o.icons$DesktopOutlined})})}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:l("Mobile"),children:(0,t.jsx)(o.ui_kit$Radio.Button,{value:"mobile",children:(0,t.jsx)(r.EmIcons,{icon:"MobileOutlined",component:o.icons$MobileOutlined})})})]})})})})},xi=({form:e,elementSettings:i,handleChangeValues:s})=>{const{__:l}=r.useI18n(),a=(0,n.useRef)(),{token:d}=(0,o.ui_kit$useToken)(),[c,h]=(0,n.useState)(!1),[g,b]=(0,n.useState)(!1),[x,p]=(0,n.useState)(!1),[m,S]=(0,n.useState)(!1),[k,f]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let P=new URL("https://emailmaker.ru/?"+i.countdown);h(P.searchParams.get("font1").endsWith("-b")||P.searchParams.get("font1").endsWith("-bi")),b(P.searchParams.get("font1").endsWith("-i")||P.searchParams.get("font1").endsWith("-bi")),p(P.searchParams.get("font2").endsWith("-b")||P.searchParams.get("font2").endsWith("-bi")),S(P.searchParams.get("font2").endsWith("-i")||P.searchParams.get("font2").endsWith("-bi")),f(P.searchParams.get("tp")==="true")},[i]);const y=[{value:"-12",label:l("-12:00 Apia")},{value:"-11",label:l("-11:00 Pago Pago, Midway Atoll")},{value:"-10",label:l("-10:00 Honolulu, Anchorage")},{value:"-9",label:l("-9:00 Anchorage, Yukon")},{value:"-8",label:l("-8:00 Los Angeles, Vancouver")},{value:"-7",label:l("-7:00 Denver, Phoenix")},{value:"-6",label:l("-6:00 Mexico City, Guadalajara")},{value:"-5",label:l("-5:00 New York, Toronto, Havana")},{value:"-4",label:l("-4:00 Caracas, Santo Domingo")},{value:"-3",label:l("-3:00 Buenos Aires, Santiago, Montevideo")},{value:"-2",label:l("-2:00 South Georgia, Saint Helena")},{value:"-1",label:l("-1:00 Azores, Cape Verde")},{value:"0",label:l("+0:00 London, Lisbon, Dublin")},{value:"1",label:l("+1:00 Paris, Berlin, Rome")},{value:"2",label:l("+2:00 Athens, Kiev, Istanbul")},{value:"3",label:l("+3:00 Istanbul, Doha, Baghdad")},{value:"4",label:l("+4:00 Baku, Dubai, Tbilisi")},{value:"5",label:l("+5:00 Karachi, Tashkent, Islamabad")},{value:"6",label:l("+6:00 Almaty, Dhaka, Bishkek")},{value:"7",label:l("+7:00 Bangkok, Ho Chi Minh City, Jakarta")},{value:"8",label:l("+8:00 Beijing, Hong Kong, Singapore")},{value:"9",label:l("+9:00 Tokyo, Seoul, Jayapura")},{value:"10",label:l("+10:00 Sydney, Melbourne, Port Moresby")},{value:"11",label:l("+11:00 Honiara, Nuku'alofa, Apia")}],v=[{value:"20",label:l("20 s")},{value:"40",label:l("40 s")},{value:"60",label:l("60 s")}],N=[{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"}],R=P=>P&&P<(0,At.default)().endOf("day")-864e5,C=P=>{f(P)},F=()=>{const P=!c;e.setFieldValue("countdownNumbersStrong",P),s({countdownNumbersStrong:P}),h(P)},U=()=>{const P=!g;e.setFieldValue("countdownNumbersItalic",P),s({countdownNumbersItalic:P}),b(P)},$=()=>{const P=!x;e.setFieldValue("countdownLabelsStrong",P),s({countdownLabelsStrong:P}),p(P)},L=()=>{const P=!m;e.setFieldValue("countdownLabelsItalic",P),s({countdownLabelsItalic:P}),S(P)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:l("End time"),name:"countdownTime",children:(0,t.jsx)(o.ui_kit$DatePicker,{ref:a,format:"DD.MM.YYYY HH:mm",disabledDate:R,showTime:!0,placement:"bottomRight",getPopupContainer:P=>{const V=P?.closest(".blocks-app");return V||(P?.ownerDocument?.body??document.body)},allowClear:!1,allowEmpty:!1})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:l("Time zone"),name:"countdownTimeZone",style:{width:"100%"},children:(0,t.jsx)(o.ui_kit$Select,{placeholder:l("Select the time zone"),getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),children:y.map(P=>(0,t.jsx)(o.ui_kit$Select.Option,{value:P.value,children:P.label},P.value))})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:20,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:l("Background color"),name:"countdownBackgroundColor",className:"countdown-color",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:l("Background color"),usedColors:i.usedColors})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownTransparency",valuePropName:"checked",style:{paddingTop:29},children:(0,t.jsx)(o.ui_kit$Switch,{id:"countdownTransparency",label:l("Transparency"),labelSize:"small",size:"small",onChange:C})})})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:l("Countdown font settings"),compact:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownNumbersFont",style:{marginBottom:d.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:N})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownNumbersColor",className:"countdown-color",style:{marginBottom:d.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{usedColors:i.usedColors})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownNumbersFontSize",children:(0,t.jsx)(o.ui_kit$InputNumber,{min:12,placeholder:l("Font size"),prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:l("Strong"),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownNumbersStrong",children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":c}),onClick:F,children:(0,t.jsx)(r.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-td-form__icon-radius"})})})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:l("Italic"),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownNumbersItalic",children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":g}),onClick:U,children:(0,t.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})})})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:l("Time units font settings"),compact:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownLabelsFont",style:{marginBottom:d.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:N})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownLabelsColor",className:"countdown-color",style:{marginBottom:d.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{usedColors:i.usedColors})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownLabelsFontSize",children:(0,t.jsx)(o.ui_kit$InputNumber,{min:8,placeholder:l("Font size"),addonAfter:"px",prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined})})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:l("Strong"),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownLabelsStrong",children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":x}),onClick:$,children:(0,t.jsx)(r.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-td-form__icon-radius"})})})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:l("Italic"),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownLabelsItalic",children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":m}),onClick:L,children:(0,t.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})})})})})]})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:l("Language"),name:"countdownLanguage",style:{width:"100%"},children:(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:l("Duration"),name:"countdownDuration",style:{width:"100%"},children:(0,t.jsx)(o.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:v})})})]})]})};xi.propTypes={form:_.default.shape({setFieldsValue:_.default.func.isRequired}).isRequired,elementSettings:_.default.object.isRequired,tooltipTitle:_.default.string};var ki=({form:e,elementSettings:i})=>{const{__:s}=r.useI18n(),{token:l}=(0,o.ui_kit$useToken)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:s("URL of the video clip."),placement:"right",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:["video","source"],className:"selected-image-form__alt",children:(0,t.jsx)(o.ui_kit$Input,{allowClear:!0,placeholder:s("Video URL"),prefix:(0,t.jsx)(r.EmIcons,{icon:"VideoCameraOutlined",component:o.icons$VideoCameraOutlined})})})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:s("Play button"),name:["video","playButton"],style:{width:"100%",marginBottom:l.formItemMarginBottomMD+4},children:(0,t.jsxs)(o.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),children:[(0,t.jsxs)(o.ui_kit$Select.Option,{value:"youtube_red",children:[(0,t.jsx)(r.EmIcons,{icon:"YoutubeOutlined",component:o.icons$YoutubeOutlined,style:{color:"#FF0000"}})," ",s("Youtube Red")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"youtube_black",children:[(0,t.jsx)(r.EmIcons,{icon:"YoutubeOutlined",component:o.icons$YoutubeOutlined})," ",s("Youtube Black")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"youtube_white",children:[(0,t.jsx)(r.EmIcons,{icon:"YoutubeOutlined",component:o.icons$YoutubeOutlined,style:{color:"#aaa"}})," ",s("Youtube White")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"vimeo",children:[(0,t.jsx)(r.EmIcons,{icon:"Vimeo",component:o.icons$Vimeo})," ",s("Vimeo")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"white_circle",children:[(0,t.jsx)(r.EmIcons,{icon:"PlayCircleOutlined",component:o.icons$PlayCircleOutlined,style:{color:"#aaa"}})," ",s("White circle")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"black_circle",children:[(0,t.jsx)(r.EmIcons,{icon:"PlayCircleOutlined",component:o.icons$PlayCircleOutlined})," ",s("Black circle")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"white_circle_outlined",children:[(0,t.jsx)(r.EmIcons,{icon:"RightCircleOutlined",component:o.icons$RightCircleOutlined,style:{color:"#aaa"}})," ",s("White circle outlined")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"black_circle_outlined",children:[(0,t.jsx)(r.EmIcons,{icon:"RightCircleOutlined",component:o.icons$RightCircleOutlined})," ",s("Black circle outlined")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"none",children:[" ",s("Without button")]})]})})]})};ki.propTypes={form:_.default.shape({setFieldsValue:_.default.func.isRequired}).isRequired,elementSettings:_.default.object.isRequired,tooltipTitle:_.default.string};var Qn={marginBottom:10},vt=()=>{const{__:e}=r.useI18n();return(0,t.jsx)(o.ui_kit$Row,{gutter:20,style:Qn,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"ampShow",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$Radio.Group,{children:(0,t.jsxs)(o.ui_kit$Space,{size:8,children:[(0,t.jsx)(o.ui_kit$Radio.Button,{value:"all",children:e("Both")}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:e("AMP"),children:(0,t.jsx)(o.ui_kit$Radio.Button,{value:"amp",children:"AMP"})}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:e("HTML"),children:(0,t.jsx)(o.ui_kit$Radio.Button,{value:"html",children:"HTML"})})]})})})})})},{Option:Ei}=o.ui_kit$Select,{mobileBorderRadiusAll:Zn,mobileBorderRadiusTopLeft:Si,mobileBorderRadiusBottomLeft:Bi,mobileBorderRadiusTopRight:Ri,mobileBorderRadiusBottomRight:Ti,borderRadiusBottomRight:yi,borderRadiusTopRight:wi,borderRadiusBottomLeft:ji,borderRadiusTopLeft:vi,alt:ed,src:td,title:od,link:io,borderRadiusAll:Jr,imgReplacer:id,expanded:rd}={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"},Xt=({linkProtocol:e})=>{switch(e){case"https://":return(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined});case"mailto:":return(0,t.jsx)(r.EmIcons,{icon:"MailOutlined",component:o.icons$MailOutlined});case"tel:":return(0,t.jsx)(r.EmIcons,{icon:"PhoneOutlined",component:o.icons$PhoneOutlined});case"sms:":return(0,t.jsx)(r.EmIcons,{icon:"CommentOutlined",component:o.icons$CommentOutlined});case"ftp://":return(0,t.jsx)(r.EmIcons,{icon:"FileOutlined",component:o.icons$FileOutlined});case"#":return(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined});default:return(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined})}},sd=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")}],Kt=({handleLinkProtocolsChange:e,linkProtocol:i,__:s})=>{const l=n.default.useMemo(()=>sd(s),[s]);return(0,t.jsx)(o.ui_kit$Select,{style:{width:90,textAlign:"left"},value:i,onChange:e,options:l,popupMatchSelectWidth:!1,listHeight:320})},qt=({show:e,__:i,style:s,className:l})=>{const a=n.default.useMemo(()=>({marginBottom:8,...s}),[s]);return e?(0,t.jsx)(o.ui_kit$Alert,{className:l,title:i("Anchor links do not work in Outlook, Gmail, and several other email clients."),type:"warning",showIcon:!0,style:a}):null},Ii=e=>!(!e.startsWith("#")||e.indexOf("#",1)!==-1),ld=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*(["'])((?:\\.|(?!\1).)*?)\1(?:\s*\/?>)?\s*$/i,ad=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*([^\s/>]+)(?:\s*\/?>)?\s*$/i;function Jt(e){if(typeof e!="string")return e;let i=e.trim();if(!i)return i;const s=i.match(ld);if(s)i=s[2];else{const l=i.match(ad);l&&(i=l[1])}return i.startsWith("https://http")&&(i=i.substring(8)),i}var $o=(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://":Ii(e)?"#":"":i,Dt=(e,i)=>{const s=$o(e,"");return i(s),s},Qr=e=>{if(!e||!e.startsWith("mailto:"))return{subject:"",body:"",baseEmail:e||""};try{const i=new URL(e),s=e.split("?")[0];return{subject:i.searchParams.get("subject")||"",body:i.searchParams.get("body")||"",baseEmail:s}}catch{return{subject:"",body:"",baseEmail:e.split("?")[0]}}},Ci=(e,i,s)=>{if(!e||!e.startsWith("mailto:"))return e;const l=e.split("?")[0],a=[];return i&&a.push(`subject=${encodeURIComponent(i)}`),s&&a.push(`body=${encodeURIComponent(s)}`),a.length>0?`${l}?${a.join("&")}`:l},u=e=>e||(e===0?"0":""),bt=e=>e&&e!=="auto"?e:e===0?"0":"",Zr=(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 Pi(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 s={};e.carouselImages?.map((l,a)=>(Object.keys(l).forEach(d=>{s[d+"_"+a]=l[d]}),!0)),i.images=s}if(e.sections?.length>0){const s=[];e.sections?.map((l,a)=>(s.push({[`expanded_${a}`]:l.expanded}),!0)),i.sections=s}return i}function es(e,i,s){const l=s.hasOwnProperty("images"),a=s.hasOwnProperty("sections"),d=Object.keys(l?s.images:a?s.sections:s)[0],c=l?s.images:a?s.sections:s;let h={};const g=i.getFieldsValue(!0);switch(d.split("_")[0]){case od:case td:case ed:case id:if(l){const x=[...e.carouselImages];x[d.split("_")[1]][d.split("_")[0]]=c[d],h={carouselImages:x}}else h=c;break;case rd:if(a){const x=[...e.sections];x[d.split("_")[1]][d.split("_")[0]]=c[d],h={sections:x}}break;case io:let b=Jt(c[d]);e.type===r.ELEMENT_TYPES.CAROUSEL?(h.carouselImages=e.carouselImages,l?(i.setFieldValue(["images",[io+"_"+d.split("_")[1]]],b),h.carouselImages[d.split("_")[1]].link=b,h.link="",i.setFieldValue(io,"")):(e.carouselImages.forEach((x,p)=>{i.setFieldValue(["images",io+"_"+p],b),h.carouselImages[p].link=b,h.link=b}),i.setFieldValue(io,b))):(i.setFieldValue(io,b),h.link=b);break;case Jr:h={borderRadius:{...e.borderRadius,[W.BORDER_RADIUS_POSITION[vi]]:g[vi],[W.BORDER_RADIUS_POSITION[ji]]:g[ji],[W.BORDER_RADIUS_POSITION[wi]]:g[wi],[W.BORDER_RADIUS_POSITION[yi]]:g[yi],[W.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case vi:case ji:case wi:case yi:h={borderRadius:{...e.borderRadius,[W.BORDER_RADIUS_POSITION[Jr]]:null,[W.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case Zn:case Si:case Bi:case Ri:case Ti:h={mobileBorderRadius:{...e.mobileBorderRadius,[W.MOBILE_BORDER_RADIUS_POSITION[Si]]:g[Si],[W.MOBILE_BORDER_RADIUS_POSITION[Bi]]:g[Bi],[W.MOBILE_BORDER_RADIUS_POSITION[Ri]]:g[Ri],[W.MOBILE_BORDER_RADIUS_POSITION[Ti]]:g[Ti],[W.MOBILE_BORDER_RADIUS_POSITION[d]]:c[d],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[d]+"-"}};break;default:h=c}return{...e,...h}}var Nt=(0,t.jsxs)(o.ui_kit$Select,{className:"select-after",children:[(0,t.jsx)(Ei,{value:"px",children:"px"}),(0,t.jsx)(Ei,{value:"%",children:"%"})]}),nd=(0,t.jsx)(o.ui_kit$Select,{className:"select-after",children:(0,t.jsx)(Ei,{value:"px",children:"px"})}),ts=({form:e,elementSettings:i,boxShadow:s,bordersShow:l,borderRadiusShow:a,boxShadowShow:d,oneBorderRadiusValue:c,setOneBorderRadiusValue:h,hasLink:g,hasAlt:b,hasTitle:x,isOpenSrcReplacer:p,mergeTagItems:m,mergeMenuOpen:S,setMergeMenuOpen:k,cascaderRef:f,linkInputRef:y,linkButtonRef:v,altInputRef:N,altButtonRef:R,titleInputRef:C,titleButtonRef:F,srcReplacerInputRef:U,srcReplacerButtonRef:$,linkProtocol:L,handleLinkProtocolsChange:P,linkButtonHandler:V,linkInputHandler:ne,altButtonHandler:T,altInputHandler:oe,titleButtonHandler:xe,titleInputHandler:be,srcReplacerButtonHandler:Se,srcInputHandler:me,handleSelect:he,onChange:ke,filter:ce,renderSearchOption:ze,handleChangeValues:Oe,toggleShowBorderHandler:ve,toggleShowBorderRadiusHandler:Ee,toggleShowBoxShadowHandler:pe})=>{const{__:Q}=r.useI18n(),{token:X}=(0,o.ui_kit$useToken)(),Z=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Mt,{form:e,elementSettings:i,imgParent:!0})}),Z.formImageFieldVerticalAlignEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,align:"right",children:(0,t.jsx)(Ot,{form:e,elementSettings:i})})]}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:i.type==="countdown"?15:24}}),i.type==="countdown"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(xi,{form:e,elementSettings:i,handleChangeValues:Oe}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),Z.mergeTagsShow&&m&&(0,t.jsx)(o.ui_kit$Col,{span:24,id:"merge_tags_wrapper",children:(0,t.jsxs)(o.ui_kit$Form.Item,{style:{marginBottom:24},children:[(0,t.jsx)(o.ui_kit$Button,{id:"merge_tags_button",icon:(0,t.jsx)(r.EmIcons,{icon:"MergeTags",component:o.icons$MergeTags}),style:{width:"100%",display:S?"none":"inline-flex"},onClick:()=>k(!0),children:Q("Merge tags")}),(0,t.jsx)(o.ui_kit$Cascader,{ref:f,classNames:{popup:{root:"merge-tags"}},options:m,placeholder:Q("Start typing the title"),showSearch:{filter:ce,render:ze},spellCheck:"false",getPopupContainer:J=>J.closest(".email-pane__collapse-wrapper"),onChange:ke,style:{display:S?"block":"none"},open:S,onKeyDown:J=>{J.key==="Escape"&&k(!1)}})]})}),i.type==="video"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ki,{form:e,elementSettings:i}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),(i.type==="img"||i.type==="video")&&(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,t.jsx)(Pt,{form:e,label:Q("Image path"),name:"src",placeholder:Q("Image path"),elementSettings:i,tooltipTitle:""})}),(0,t.jsxs)(o.ui_kit$Space,{size:8,style:{marginBottom:!b&&!g&&!x&&!p?X.formItemMarginBottomMD+4:X.formItemMarginBottomXS},children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:b||Q("Alternative text"),placement:"bottom",getPopupContainer:J=>J.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!b}),onClick:T,ref:R,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),Z.formFieldImageTitleEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:x||Q("Tooltip text"),placement:"bottom",getPopupContainer:J=>J.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!x}),onClick:xe,ref:F,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:g||Q("Hyperlink URL"),placement:"bottom",getPopupContainer:J=>J.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!g}),icon:(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:V,ref:v})}),Z.formImageFieldReplacerEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:Q("Image replacer"),placement:"bottom",getPopupContainer:J=>J.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":p}),icon:(0,t.jsx)(r.EmIcons,{icon:"Replacer",component:o.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:Se,ref:$})})]}),(!!g||!!b||!!x||!!p)&&(0,t.jsxs)("div",{style:{marginBottom:X.formItemMarginBottomMD+4},children:[!!g&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(qt,{show:L==="#",__:Q,style:{marginBottom:X.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:Q("Hyperlink URL"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:X.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{addonBefore:(0,t.jsx)(Kt,{linkProtocol:L,handleLinkProtocolsChange:P,__:Q}),placeholder:Q("Hyperlink URL"),allowClear:!0,ref:y,onChange:ne,onSelect:he,prefix:(0,t.jsx)(Xt,{linkProtocol:L})})})})]}),!!b&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:Q("Alternative text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:X.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:Q("Alternative text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:oe,ref:N,onSelect:he})})}),Z.formFieldImageTitleEnabled&&!!x&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:Q("Tooltip text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:X.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:Q("Enter the title of the image"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:be,ref:C,onSelect:he})})}),!!p&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:Q("Image src"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"imgReplacer",className:"selected-image-form__alt",style:{marginBottom:X.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:Q("Code that will replace the image `src`"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:Q("Image src")}),onChange:me,ref:U,onSelect:he})})})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:Q("Size"),dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormSizeInputs,{maxWidth:i.maxWidth,showHeight:Z.formImageFieldHeightEnabled,showMinMax:!1,gutter:X.marginSM,rowStyle:{marginBottom:Z.formImageFieldHeightEnabled?4:24},labels:{width:Q("Width"),height:Q("Height"),minWidth:Q("Minimum width"),maxWidth:Q("Maximum width")}})}),Z.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:Q("Borders"),collapsible:!0,open:l,onToggle:ve,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),Z.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:Q("Border radius"),collapsible:!0,open:a,onToggle:Ee,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:c,setOneBorderRadiusValue:h,elementSettings:i})}),Z.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:Q("Box shadow"),collapsible:!0,open:d,onToggle:pe,dividerTop:!0,children:(0,t.jsx)(wt,{})}),Z.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:Q("Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e})}),Z.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:Q("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};ts.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,boxShadow:_.default.object,bordersShow:_.default.bool,borderRadiusShow:_.default.bool,boxShadowShow:_.default.bool,oneBorderRadiusValue:_.default.bool,setOneBorderRadiusValue:_.default.func,hasLink:_.default.string,hasAlt:_.default.string,hasTitle:_.default.string,isOpenSrcReplacer:_.default.oneOfType([_.default.bool,_.default.number]),mergeTagItems:_.default.array,mergeMenuOpen:_.default.bool,setMergeMenuOpen:_.default.func,cascaderRef:_.default.object,linkInputRef:_.default.object,linkButtonRef:_.default.object,altInputRef:_.default.object,altButtonRef:_.default.object,titleInputRef:_.default.object,titleButtonRef:_.default.object,srcReplacerInputRef:_.default.object,srcReplacerButtonRef:_.default.object,linkProtocol:_.default.string,handleLinkProtocolsChange:_.default.func,linkButtonHandler:_.default.func,linkInputHandler:_.default.func,altButtonHandler:_.default.func,altInputHandler:_.default.func,titleButtonHandler:_.default.func,titleInputHandler:_.default.func,srcReplacerButtonHandler:_.default.func,srcInputHandler:_.default.func,handleSelect:_.default.func,onChange:_.default.func,filter:_.default.func,renderSearchOption:_.default.func,handleChangeValues:_.default.func,toggleShowBorderHandler:_.default.func,toggleShowBorderRadiusHandler:_.default.func,toggleShowBoxShadowHandler:_.default.func};var Vt=({form:e,name:i,elementSettings:s,isPicture:l,tooltipTitle:a})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),h=(0,n.useRef)(),[g,b]=(0,n.useState)(s[i]?.value==="auto"),{token:x}=(0,o.ui_kit$useToken)(),[p,m]=(0,n.useState)(""),S=f=>{e.setFieldsValue({[i]:"",[i+"Dim"]:"px"}),b(y=>!y),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:{[i]:{classNamePrefix:"em-mob-width-",value:g?null:"auto",dim:""}}})},k=f=>{b(!1),m(e.getFieldsValue(!0)[i+"Dim"]==="%"?100:"")};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:a,placement:"bottom",children:(0,t.jsx)("div",{children:(0,t.jsx)(o.ui_kit$Form.Item,{name:i,style:{marginBottom:x.formItemMarginBottomXS/2},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{ref:h,min:0,max:p,placeholder:d("Width"),onChange:k,prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:(0,t.jsx)(o.ui_kit$Form.Item,{name:i+"Dim",noStyle:!0,children:Nt})})})})}),!l&&(0,t.jsx)(o.ui_kit$Switch,{id:"auto-width",label:d("Auto"),labelSize:"small",size:"small",checked:g,onChange:S})]})};Vt.propTypes={form:_.default.shape({setFieldsValue:_.default.func.isRequired}).isRequired,elementSettings:_.default.object.isRequired,tooltipTitle:_.default.string};var Qt=({form:e,name:i,elementSettings:s,isPicture:l,tooltipTitle:a})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),h=(0,n.useRef)(),[g,b]=(0,n.useState)(s.mobileHeight?.value==="auto"),{token:x}=(0,o.ui_kit$useToken)(),p=S=>{e.setFieldsValue({mobileHeight:"",mobileHeightDim:"px"}),b(k=>!k),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:{mobileHeight:{classNamePrefix:"em-mob-height-",value:g?null:"auto",dim:""}}})},m=S=>{b(!1)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:a,placement:"bottom",children:(0,t.jsx)("div",{children:(0,t.jsx)(o.ui_kit$Form.Item,{name:i,style:{marginBottom:x.formItemMarginBottomXS/2},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{ref:h,min:0,placeholder:d("Height"),onChange:m,prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:o.icons$ColumnHeightOutlined}),addonAfter:"px"})})})}),!l&&(0,t.jsx)(o.ui_kit$Switch,{id:"auto-height",label:d("Auto"),labelSize:"small",size:"small",checked:g,onChange:p})]})};Qt.propTypes={form:_.default.shape({setFieldsValue:_.default.func.isRequired}).isRequired,elementSettings:_.default.object.isRequired,tooltipTitle:_.default.string};var os=({form:e,elementSettings:i,handleChangeValues:s,boxShadow:l,mobileBordersShow:a,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:h,oneMobileBorderRadiusValue:g,setOneMobileBorderRadiusValue:b,hasLink:x,hasAlt:p,hasTitle:m,linkInputRef:S,linkButtonRef:k,altInputRef:f,altButtonRef:y,titleInputRef:v,titleButtonRef:N,linkInputHandler:R,altButtonHandler:C,altInputHandler:F,titleButtonHandler:U,titleInputHandler:$,linkButtonHandler:L,toggleShowMobileBorderHandler:P,toggleShowMobileBorderRadiusHandler:V,toggleShowMobileBoxShadowHandler:ne,toggleShowMobileSizeHandler:T})=>{const{__:oe}=r.useI18n(),{token:xe}=(0,o.ui_kit$useToken)(),be=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:30,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Mt,{form:e,elementSettings:i,imgParent:!0,typeOfForm:"mobile"})}),be.formImageFieldVerticalAlignEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,align:"right",children:(0,t.jsx)(Ot,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:i.type==="countdown"?15:24}}),i.type==="countdown"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(xi,{form:e,elementSettings:i,handleChangeValues:s}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),i.type==="video"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ki,{form:e,elementSettings:i}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),(i.type==="img"||i.type==="video")&&(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,t.jsx)(Pt,{form:e,label:oe("Image path"),name:"src",placeholder:oe("Image path"),elementSettings:i,tooltipTitle:""})}),(0,t.jsxs)(o.ui_kit$Space,{size:8,style:{marginBottom:!p&&!x&&!m?xe.formItemMarginBottomMD+4:xe.formItemMarginBottomXS},children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:p||oe("Alternative text"),placement:"bottom",getPopupContainer:Se=>Se.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!p}),onClick:C,ref:y,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),be.formFieldImageTitleEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:m||oe("Tooltip text"),placement:"bottom",getPopupContainer:Se=>Se.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!m}),onClick:U,ref:N,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:x||oe("Hyperlink URL"),placement:"bottom",getPopupContainer:Se=>Se.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!x}),icon:(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:L,ref:k})})]}),(!!x||!!p||!!m)&&(0,t.jsxs)("div",{style:{marginBottom:xe.formItemMarginBottomMD+4},children:[!!x&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:oe("Hyperlink URL"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:xe.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{ref:S,allowClear:!0,placeholder:oe("Hyperlink URL"),prefix:(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined}),onChange:R})})}),!!p&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:oe("Alternative text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:xe.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:oe("Alternative text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:F,ref:f})})}),be.formFieldImageTitleEnabled&&!!m&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:oe("Tooltip text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:xe.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:oe("Tooltip text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:$,ref:v})})})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:oe("Size"),collapsible:!0,open:h,onToggle:T,dividerTop:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:24},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Vt,{form:e,name:"mobileWidth",elementSettings:i,isPicture:"true",tooltipTitle:oe("Width")})}),be.formImageFieldHeightEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Qt,{form:e,name:"mobileHeight",elementSettings:i,isPicture:"true",tooltipTitle:oe("Height")})})]})}),be.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:oe("Borders"),collapsible:!0,open:a,onToggle:P,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),be.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:oe("Border radius"),collapsible:!0,open:d,onToggle:V,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:g,setOneBorderRadiusValue:b,elementSettings:i,typeOfForm:"mobile"})}),be.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:oe("Box shadow"),collapsible:!0,open:c,onToggle:ne,dividerTop:!0,children:(0,t.jsx)(wt,{typeOfForm:"mobile"})}),be.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:oe("Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e})}),be.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:oe("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};os.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,handleChangeValues:_.default.func,boxShadow:_.default.object,mobileBordersShow:_.default.bool,mobileBorderRadiusShow:_.default.bool,mobileBoxShadowShow:_.default.bool,mobileSizeShow:_.default.bool,oneMobileBorderRadiusValue:_.default.bool,setOneMobileBorderRadiusValue:_.default.func,hasLink:_.default.string,hasAlt:_.default.string,hasTitle:_.default.string,linkInputRef:_.default.object,linkButtonRef:_.default.object,altInputRef:_.default.object,altButtonRef:_.default.object,titleInputRef:_.default.object,titleButtonRef:_.default.object,linkInputHandler:_.default.func,altButtonHandler:_.default.func,altInputHandler:_.default.func,titleButtonHandler:_.default.func,titleInputHandler:_.default.func,linkButtonHandler:_.default.func,toggleShowMobileBorderHandler:_.default.func,toggleShowMobileBorderRadiusHandler:_.default.func,toggleShowMobileBoxShadowHandler:_.default.func,toggleShowMobileSizeHandler:_.default.func};var dd=e=>typeof e=="object"&&e!==null?e.path:void 0;function Lt(){const e=(0,n.useRef)(!1),i=(0,n.useRef)(null),s=(0,n.useCallback)(a=>{e.current=!a},[]),l=(0,n.useCallback)((a,d)=>{const c=JSON.stringify(dd(a)??null);return i.current!==c&&(i.current=c,e.current=!1),d?e.current:(e.current=!1,!1)},[]);return(0,n.useMemo)(()=>({markBorderToggled:s,isStaleBorderSnapshot:l}),[s,l])}function ro(e){const i=(0,n.useRef)(null),s=(0,n.useRef)(e);return s.current=e,{remember:(0,n.useCallback)(l=>{i.current=l},[]),fillFields:(0,n.useCallback)((l,a)=>{s.current!==i.current&&l.setFieldsValue(a)},[])}}var is=2e3;function rs(e,{ordered:i=!1}={}){const s=(0,n.useRef)([]),l=(0,n.useRef)(new WeakMap),a=(0,n.useRef)(e);return a.current=e,{remember:(0,n.useCallback)(d=>{const c=Date.now(),h=s.current.filter(g=>c-g.at<is);h.push({key:JSON.stringify(a.current(d)),at:c}),s.current=h.slice(-10),i&&d&&typeof d=="object"&&l.current.set(d,!1)},[i]),isOwnEcho:(0,n.useCallback)(d=>{if(!d)return!1;const c=Date.now(),h=JSON.stringify(a.current(d)),g=s.current.filter(p=>c-p.at<is);if(!i)return g.some(p=>p.key===h);const b=l.current.get(d);if(b!==void 0)return b;const x=g.findIndex(p=>p.key===h);return x>=0&&(s.current=g.slice(x)),l.current.set(d,x>=0),x>=0},[i]),forget:(0,n.useCallback)(()=>{s.current=[],l.current=new WeakMap},[])}}var cd=1e3,ud=2e4,ss="https://useblocks.io/app/",md=["activateSection","changeKey","parent","path","nextElem","prevElem"];function Ai(e){if(Array.isArray(e))return e.map(Ai);if(e&&typeof e=="object"){const i=e;return Object.fromEntries(Object.keys(i).sort().map(s=>[s,Ai(i[s])]))}return e}function pd(e){const i={...e};return md.forEach(s=>delete i[s]),Ai(i)}var ls=({elementSettings:e})=>{const{__:i}=r.useI18n(),[s]=o.ui_kit$Form.useForm(),l=Lt(),a=Lt();let d=r.useDispatch();const c=r.useAppConfig(),h=r.useEditorProjectId(),g=r.useNotification(),b=r.useSendPostMessage(),x=r.useSendPostMessageEx(),{openImagePicker:p}=r.useImagePicker(),m=r.useSelector(r.selectEmailViewType),S=r.useSelector(r.selectMobileViewActive),k=r.useCurrentUser(),f=r.useSelector(r.selectIsCodeMode),y=r.useSelector(r.selectCodeModeDirection),[v]=r.useUploadImageMutation(),[N,R]=r.useSendShortLinkMutation(),[C,F]=(0,n.useState)({name:"",counter:0}),U=(0,n.useRef)(null),$=(0,n.useRef)(null),L=(0,n.useRef)(null),P=(0,n.useRef)(null),V=(0,n.useRef)(null),ne=(0,n.useRef)(null),T=(0,n.useRef)(null),oe=(0,n.useRef)(null),xe=(0,n.useRef)(null),[be,Se]=(0,n.useState)({}),[me,he]=(0,n.useState)(!0),[ke,ce]=(0,n.useState)(!0),[ze,Oe]=(0,n.useState)(""),[ve,Ee]=(0,n.useState)(""),[pe,Q]=(0,n.useState)(""),[X,Z]=(0,n.useState)(!1),[J,H]=(0,n.useState)(!1),[M,Y]=(0,n.useState)(!1),[K,te]=(0,n.useState)(!1),[le,Te]=(0,n.useState)(!1),[Re,$e]=(0,n.useState)(!1),[z,re]=(0,n.useState)(!1),[Ce,G]=(0,n.useState)(!1),[Be,Fe]=(0,n.useState)("https://"),Ae=(0,n.useRef)(!1),Ve=(0,n.useRef)(),Ue=e,Xe=(0,n.useRef)(Ue);Xe.current=Ue;const de=(0,n.useCallback)(()=>s.getFieldsValue(!0).video,[s]),[ye,I]=(0,n.useState)(),[se,je]=(0,n.useState)(!1),[Ne,He]=(0,n.useState)(null),[Ke,tt]=(0,n.useState)({start:0,end:0}),[O,ie]=(0,n.useState)(!1),[j,w]=(0,n.useState)(!1),[ue,Ie]=(0,n.useState)(!1),[qe,Ze]=(0,n.useState)(!1),dt=(0,n.useRef)(void 0),st=(0,n.useRef)(null),ct=(0,n.useRef)(null),kt=qe||ue||Ce;(0,n.useEffect)(()=>()=>clearTimeout(dt.current),[]);const St=(0,n.useRef)(null);(0,n.useEffect)(()=>{const A=St.current,Le=A?.firstElementChild??null;if(!kt||!A||!Le)return;const ge=[];for(let et=A.parentElement;et;et=et.parentElement)getComputedStyle(et).overflowY!=="visible"&&ge.push(et);let fe=0,Me="";const Je=()=>{const et=A.getBoundingClientRect(),gt=A.offsetHeight>0?et.height/A.offsetHeight:1;let ft=Math.max(et.top,0),rt=Math.min(et.bottom,window.innerHeight);ge.forEach(Yt=>{const po=Yt.getBoundingClientRect();ft=Math.max(ft,po.top),rt=Math.min(rt,po.bottom)});const ut=(ft-et.top)/(gt||1),Bt=Math.max(rt-ft,0)/(gt||1),yt=`${Math.round(ut)}/${Math.round(Bt)}`;yt!==Me&&(Me=yt,Le.style.top=`${ut}px`,Le.style.height=`${Bt}px`),fe=requestAnimationFrame(Je)};return Je(),()=>cancelAnimationFrame(fe)},[kt]);const D=()=>{const A=st.current;ct.current=A?.isConnected&&typeof A.selectionStart=="number"?{element:A,start:A.selectionStart,end:A.selectionEnd??A.selectionStart}:null},q=f&&y!=="bottom",we=r.useElementEntityKind();(0,n.useEffect)(()=>{se&&xe.current&&xe.current.focus()},[se]);const Ge=(A,Le)=>{const ge=document.getElementById(Le);if(ge){const fe=Le.substring(Le.indexOf("selected_image_form_")+20),Me=ge.value?.substring(0,Ke.start),Je=ge.value?.substring(Ke.end);b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{...e,[fe]:Me+A+Je}}),s.setFieldValue(fe,Me+A+Je),ge.focus(),setTimeout(()=>{ge.selectionStart=Ke.start,ge.selectionEnd=Ke.start+A.length},400),ie(!0)}},_e=r.useAppConfig().mergeTags;(0,n.useEffect)(()=>{_e?.items?.length&&I(r.mapMargeTags(_e.items))},[_e,I]);const B=(A,Le)=>{if(je(!1),A){const ge=_e.syntax.length>1?ye.findIndex(Me=>Me.key===Le[0].key):0,fe=_e.syntax[ge].replace("%value%",A[A.length-1]);Ne?.getAttribute("id")==="selected_image_form_title"||Ne?.getAttribute("id")==="selected_image_form_alt"||Ne?.getAttribute("id")==="selected_image_form_link"||Ne?.getAttribute("id")==="selected_image_form_imgReplacer"?Ge(fe,Ne?.getAttribute("id")):(s.setFieldValue("imgReplacer",fe),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:fe}}))}},ee=(A,Le)=>Le.some(ge=>ge.label.toLowerCase().indexOf(A.toLowerCase())>-1),E=(A,Le)=>{const ge=Le.map((fe,Me)=>{const Je=fe.label.split(new RegExp(`(${A})`,"gi"));return(0,t.jsxs)("span",{children:[Me!==0&&(0,t.jsx)("span",{children:" / "}),Je.map((et,gt)=>et.toLowerCase()===A.toLowerCase()?(0,t.jsx)("span",{style:{color:"red"},children:et},gt):et)]},fe.value)});return(0,t.jsx)("div",{title:Le.map(fe=>fe.label).join(" / "),children:ge})},ae=r.useRootElement();(0,n.useEffect)(()=>{const A=({target:fe})=>{fe.closest('[id="merge_tags_wrapper"]')||(st.current=fe,He(fe))},Le=({target:fe})=>{!fe.closest(".merge-tags")&&!fe.closest("#merge_tags_button")&&je(!1)},ge=new ht.Disposable;return ge.addDisposable(r.addWindowListenerFromShadow(ae,"focusin",A)),ge.addDisposable(r.addWindowListenerFromShadow(ae,"click",Le)),()=>{ge.dispose()}},[ae]);const Pe=({target:A})=>{if(A&&!O){const{selectionStart:Le,selectionEnd:ge}=A;tt({start:Le,end:ge})}ie(!1)},Qe=e.border,De=e.mobileBorder,Et=Object.keys(Qe).find(A=>Qe[A]?.width||Qe[A]?.style||Qe[A]?.color),Gt=Object.keys(De).find(A=>De[A]?.width||De[A]?.style||De[A]?.color),pt=A=>A&&(A?.width||A?.style||A?.color)?A:"",{remember:Sn,fillFields:Bn}=ro(e),{remember:Rn,isOwnEcho:Tn,forget:yn}=rs(pd,{ordered:!0}),wn=(0,n.useRef)(void 0);(0,n.useEffect)(()=>{if(e){const A=e.path;A!==wn.current&&(wn.current=A,yn());const Le=Tn(e)?()=>{}:Bn;e.src!==Ve.current&&(Ve.current=e.src,Ae.current=!1);const ge=e.boxShadow;if(Se(ge),e.link&&Fe($o(e.link,"https://")),Le(s,{...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:pt(e.mobileBorder.all)||!(pt(e.mobileBorder.top)||pt(e.mobileBorder.bottom)||pt(e.mobileBorder.right)||pt(e.mobileBorder.left))&&pt(e.border.all),mobileBorderTop:pt(e.mobileBorder.top)||!pt(e.mobileBorder.all)&&pt(e.border.top),mobileBorderBottom:pt(e.mobileBorder.bottom)||!pt(e.mobileBorder.all)&&pt(e.border.bottom),mobileBorderRight:pt(e.mobileBorder.right)||!pt(e.mobileBorder.all)&&pt(e.border.right),mobileBorderLeft:pt(e.mobileBorder.left)||!pt(e.mobileBorder.all)&&pt(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:bt(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:bt(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:bt(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:bt(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",...Ue.video}}),e.countdown){let Je=new URL("https://emailmaker.ru/?"+e.countdown),et=Je.searchParams.get("font1"),gt=!1,ft=!1;et.endsWith("-b")?(et=et.substring(0,et.length-2),gt=!0):et.endsWith("-i")?(et=et.substring(0,et.length-2),ft=!0):et.endsWith("-bi")&&(et=et.substring(0,et.length-3),gt=!0,ft=!0);let rt=Je.searchParams.get("font2"),ut=!1,Bt=!1;rt.endsWith("-b")?(rt=rt.substring(0,rt.length-2),ut=!0):rt.endsWith("-i")?(rt=rt.substring(0,rt.length-2),Bt=!0):rt.endsWith("-bi")&&(rt=rt.substring(0,rt.length-3),ut=!0,Bt=!0),Le(s,{countdownTime:(0,At.default)(new Date(Date.parse(Je.searchParams.get("time"))+Je.searchParams.get("timezone")*36e5+new Date().getTimezoneOffset()/60*36e5).toISOString()),countdownDuration:Je.searchParams.get("frames")||20,countdownTimeZone:Je.searchParams.get("timezone"),countdownLanguage:Je.searchParams.get("locale").replace("-","_"),countdownBackgroundColor:"#"+Je.searchParams.get("bg"),countdownTransparency:Je.searchParams.get("tp")==="true"?"checked":"",countdownNumbersFont:et,countdownNumbersFontSize:Je.searchParams.get("size1")/2,countdownNumbersFontSizeDim:"px",countdownNumbersColor:"#"+Je.searchParams.get("color1"),countdownLabelsFont:rt,countdownLabelsFontSize:Je.searchParams.get("size2")/2,countdownLabelsFontSizeDim:"px",countdownLabelsColor:"#"+Je.searchParams.get("color2"),countdownNumbersStrong:gt,countdownNumbersItalic:ft,countdownLabelsStrong:ut,countdownLabelsItalic:Bt})}!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?he(!1):he(!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))?ce(!1):ce(!0);const fe=l.isStaleBorderSnapshot(e,!!Et),Me=a.isStaleBorderSnapshot(e,!!Gt);fe&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Me||fe&&!Gt)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),Z(Je=>Et&&!fe?!0:Je),H(Je=>Et&&!fe||Gt&&!Me?!0:Je),Y(!!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||!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),Te(!!e.boxShadow),$e(!!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),e.link?Oe(e.link):Oe(Ae.current?"...":""),Ee(e.alt),Q(e.title),w(e.imgReplacer?.length)}},[s,e,Bn,Tn,yn,Ue,Et,Gt,l,a]),(0,n.useEffect)(()=>{if(kt)return;const A=ct.current;ct.current=null,!(!A||!A.element.isConnected||A.element.disabled)&&st.current===A.element&&(A.element.focus(),A.element.setSelectionRange(A.start,A.end))},[kt]);const Mr=async(A,Le,ge)=>{const fe={};fe.user_id=k.id,fe.folder=A,Le&&(Le=await r.prepareImageForEditorUpload(Le,c),fe.file=Le),ge&&(fe.page_url=ge);const Me=await v(fe);if(Me.error)g.fromError("IMAGE_UPLOAD_ERROR",Le,Me.error,!0);else{const Je=$n.extractUploadResult(Me.data);if(Je.error)return;if(Je.file_url)return Je.file_url}},jn=(A,Le)=>new Promise((ge,fe)=>{const Me=new Image,Je=new Image;Me.crossOrigin="Anonymous",Je.crossOrigin="Anonymous";let et=Le?2:1;const gt=()=>{clearTimeout(rt),fe(new Error("video preview images are not loaded"))},ft=()=>{et-=1,et===0&&(clearTimeout(rt),ge({frame:Me,button:Le?Je:null}))},rt=setTimeout(gt,ud);Me.onload=ft,Me.onerror=gt,Me.src=A,Le&&(Je.onload=ft,Je.onerror=gt,Je.src=Le)}),vn=(A,Le,ge,fe)=>{const Me=document.createElement("canvas"),Je=Me.getContext("2d");if(Me.width=A.width,Me.height=A.height,Je.clearRect(0,0,Me.width,Me.height),Je.drawImage(A,0,0,A.width,A.height),!Le)return Me;const et=Math.min(Me.width,Me.height);let gt;if(A.height>A.width)gt=.3;else{const po=A.width/A.height;gt=Math.min(fe,.3+(po-1)/(ge-1)*.1)}const ft=et*gt,rt=Le.width/Le.height;let ut,Bt;rt>=1?(ut=ft,Bt=ft/rt):(Bt=ft,ut=ft*rt);const yt=(Me.width-ut)/2,Yt=(Me.height-Bt)/2;return Je.drawImage(Le,yt,Yt,ut,Bt),Me},In=A=>new Promise(Le=>{A.toBlob(ge=>Le(ge?new File([ge],"image.jpeg",{type:"image/jpeg"}):null),"image/jpg",1)}),ph=async A=>{const Le=s.getFieldsValue(!0).video?.playButton||e.video?.playButton;if(!(!A||!Le||Le==="none"||ue)){D(),Ie(!0);try{const{frame:ge,button:fe}=await jn(A,`${ss}${Le}.png`),Me=await In(vn(ge,fe,2,.4)),Je=Me&&await Mr(h,Me);if(!Je)return;b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Xe.current.type,settings:{src:Je}}),Co({...Xe.current,src:Je,video:de()||Xe.current.video,activateSection:null,changeKey:"src"}),setTimeout(()=>{s.setFieldValue("src",Je)},100)}catch{}finally{Ie(!1)}}},hh=async()=>{const A=de(),Le=A?.source,ge=A?.playButton;if(!Le)return;const fe=()=>de()?.source!==Le;D(),Ze(!0);try{const Me=await Mr("tmp",null,Le);if(!Me||fe())return;const{frame:Je,button:et}=await jn(Me,ge&&ge!=="none"?`${ss}${ge}.png`:null);if(fe())return;const gt=await In(vn(Je,et,2.5,.35)),ft=gt&&await Mr(h,gt);ft&&!fe()&&Vr(ft)}catch{}finally{Ze(!1)}},Dr=A=>{clearTimeout(dt.current),dt.current=setTimeout(()=>{A()},cd)},bh=()=>{const A=s.getFieldsValue(!0);let Le=new URL("https://cdt3.emcdn.ru/rndt?"+e.countdown),ge=A.countdownNumbersFont;A.countdownNumbersStrong&&A.countdownNumbersItalic?ge+="-bi":A.countdownNumbersStrong?ge+="-b":A.countdownNumbersItalic&&(ge+="-i");let fe=A.countdownLabelsFont;A.countdownLabelsStrong&&A.countdownLabelsItalic?fe+="-bi":A.countdownLabelsStrong?fe+="-b":A.countdownLabelsItalic&&(fe+="-i"),Le.searchParams.set("time",new Date(A.countdownTime.$d-A.countdownTimeZone*36e5-new Date().getTimezoneOffset()/60*36e5).toISOString()),Le.searchParams.set("bg",A.countdownBackgroundColor.substring(1)||"#FFFFFF"),Le.searchParams.set("tp",!!A.countdownTransparency),Le.searchParams.set("font1",ge),Le.searchParams.set("size1",A.countdownNumbersFontSize*2||12),Le.searchParams.set("color1",A.countdownNumbersColor.substring(1)||"#000000"),Le.searchParams.set("font2",fe),Le.searchParams.set("size2",A.countdownLabelsFontSize*2||8),Le.searchParams.set("color2",A.countdownLabelsColor.substring(1)||"#959595"),Le.searchParams.set("spacing",Math.round(A.countdownNumbersFontSize*.4)||5),Le.searchParams.set("locale",A.countdownLanguage.replace("_","-")),Le.searchParams.set("timezone",A.countdownTimeZone),Le.searchParams.set("frames",A.countdownDuration),N({link:JSON.stringify({target:Le.href})}),D(),G(!0)},Co=(0,n.useCallback)(A=>{Sn(A),Rn(A),d(we==="email"?r.setElementSettings$1(A):r.setElementSettings(A))},[d,we,Sn,Rn]),Vr=(0,n.useCallback)((A,Le)=>{const ge=Xe.current,fe=r.stripEmVersionFromUrlString(ge.src||"")===r.stripEmVersionFromUrlString(A||"");(!fe||A!==ge.src)&&(b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:ge.type,settings:{src:A}}),Co({...ge,src:A,...ge.type==="video"?{video:de()||ge.video}:{},activateSection:null,changeKey:"src"}),s.setFieldValue("src",A)),Le?.mode==="save"&&fe&&(F(Me=>({name:"src",counter:Me.counter+1})),x(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(A)}))},[s,de,Co,b,x]),Po=(0,n.useCallback)(async A=>{const Le=e.src||"",ge=r.stripEmVersionFromUrlString(Le),fe=await p({kind:"img",currentUrl:bo(ge)?"":ge,entryModal:A});fe?.url&&Vr(fe.url,fe.meta)},[Vr,e.src,p]),Hr=(A,...Le)=>{const ge=s.getFieldsValue(!0),fe=Object.keys(A)[0];let Me;switch(fe){case"link":let Je=Jt(A[fe]);Je!==A[fe]&&s.setFieldValue("link",Je),Me={link:Je};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Me={boxShadow:{hOffset:ge.boxShadowHOffset,vOffset:ge.boxShadowVOffset,blurRadius:ge.boxShadowBlurRadius,spreadRadius:ge.boxShadowSpreadRadius,color:ge.boxShadowColor,inset:ge.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":ge.borderPosition==="borderAll"?(Me={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...ge.borderAll}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):ge.borderAll?.width||ge.borderAll?.style||ge.borderAll?.color?(Me={border:{all:null,left:ge.borderAll,right:ge.borderAll,top:ge.borderAll,bottom:ge.borderAll,[W.REVERSE_BORDER_POSITIONS[fe]]:{...ge[fe],...A[fe]}}},s.setFieldsValue({borderAll:null,borderLeft:ge.borderAll,borderRight:ge.borderAll,borderTop:ge.borderAll,borderBottom:ge.borderAll,[fe]:{...ge[fe],...A[fe]}})):(Me={border:{all:null,left:ge.borderLeft,right:ge.borderRight,top:ge.borderTop,bottom:ge.borderBottom,[W.REVERSE_BORDER_POSITIONS[fe]]:{...ge[fe],...A[fe]}}},s.setFieldsValue({border:Me.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(ge.mobileBorderPosition==="mobileBorderAll")Me={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...ge.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[fe]+"-"}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const rt=W.MOBILE_REVERSE_BORDER_POSITIONS[fe],ut={...ge[fe],...A[fe]},Bt=!ut?.width&&!ut?.style&&!ut?.color;if(ge.mobileBorder?.all?.width||ge.mobileBorder?.all?.style||ge.mobileBorder?.all?.color){const yt=ge.mobileBorderAll;Me={mobileBorder:{all:null,left:yt,right:yt,top:yt,bottom:yt,[rt]:Bt?null:{...ut,classNamePrefix:"em-mob-border_"+rt+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:yt,mobileBorderRight:yt,mobileBorderTop:yt,mobileBorderBottom:yt,[fe]:ut})}else{const yt=e.mobileBorder||{},Yt=po=>{const Ao=yt[po];return Ao&&(Ao?.width||Ao?.style||Ao?.color)?Ao:null};Me={mobileBorder:{all:null,left:rt==="left"?Bt?null:{...ut,classNamePrefix:"em-mob-border_left-"}:Yt("left"),right:rt==="right"?Bt?null:{...ut,classNamePrefix:"em-mob-border_right-"}:Yt("right"),top:rt==="top"?Bt?null:{...ut,classNamePrefix:"em-mob-border_top-"}:Yt("top"),bottom:rt==="bottom"?Bt?null:{...ut,classNamePrefix:"em-mob-border_bottom-"}:Yt("bottom")}},s.setFieldsValue({[fe]:ut})}}break;case"width":Me={[fe]:{value:A[fe],dim:ge.widthDim}};break;case"widthDim":Me={width:{value:ge.width,dim:A[fe]}};break;case"height":Me={[fe]:{value:A[fe],dim:ge.heightDim}};break;case"heightDim":Me={height:{value:ge.height,dim:A[fe]}};break;case"borderRadiusAll":Me={borderRadius:{[W.BORDER_RADIUS_POSITION[fe]]:+A[fe]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Me={borderRadius:{topLeft:ge.borderRadiusTopLeft,bottomLeft:ge.borderRadiusBottomLeft,topRight:ge.borderRadiusTopRight,bottomRight:ge.borderRadiusBottomRight,[W.BORDER_RADIUS_POSITION[fe]]:+A[fe]}};break;case"mobileWidth":Me={[fe]:{classNamePrefix:"em-mob-width-",value:A[fe],dim:ge.mobileWidthDim}};break;case"mobileWidthDim":Me={mobileWidth:{classNamePrefix:"em-mob-width-",value:ge.mobileWidth||100,dim:A[fe]}};break;case"mobileHeight":Me={[fe]:{classNamePrefix:"em-mob-height-",value:A[fe],dim:ge.mobileHeightDim}};break;case"mobileHeightDim":Me={mobileHeight:{classNamePrefix:"em-mob-height-",value:ge.mobileHeight,dim:A[fe]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Me={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[fe]]:A[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":Me={mobileBoxShadow:{hOffset:ge.mobileBoxShadowHOffset,vOffset:ge.mobileBoxShadowVOffset,blurRadius:ge.mobileBoxShadowBlurRadius,spreadRadius:ge.mobileBoxShadowSpreadRadius,color:ge.mobileBoxShadowColor,inset:ge.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":Me={[fe]:{classNamePrefix:"em-mob-text_align-",value:A[fe]}};break;case"mobileVerticalAlign":Me={[fe]:{classNamePrefix:"em-mob-vertical_align-",value:A[fe]}};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":Dr(bh);break;case"video":{const rt={...e.video,...ge.video,...A.video},ut=rt.source??ge.link;Dr(hh),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"video",settings:{video:rt,link:ut}}),Co({...e,video:rt,link:ut,activateSection:null,changeKey:"video"});break}case"src":const et=A[fe],gt=e.src,ft=ge.video?.playButton||e.video?.playButton;if(e.type==="video"&&ft&&ft!=="none"&&!ue&&et&&(!gt||et!==gt)){Dr(()=>ph(et));return}Me=A;break;default:Me=A}fe!=="borderPosition"&&fe!=="mobileBorderPosition"&&fe.indexOf("countdown")===-1&&fe!=="video"&&(b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Me}),fe!=="video"&&fe.indexOf("countdown")===-1&&fe!=="mobileBorderRadiusAll"&&fe!=="mobileBorderRadiusTopLeft"&&fe!=="mobileBorderRadiusTopRight"&&fe!=="mobileBorderRadiusBottomLeft"&&fe!=="mobileBorderRadiusBottomRight"&&Co({...e,...Me,mobileBorderRadius:{...e.mobileBorderRadius,...Me?.mobileBorderRadius},activateSection:null,changeKey:fe}))};(0,n.useEffect)(()=>{R.isError&&(g.error(R),G(!1))},[R]),(0,n.useEffect)(()=>{if(R.isSuccess&&Ce){if(R.data.data?.status===400)g.error({title:R.data.code,description:R.data.message});else{let A=new URL(R.data.target),Le={countdown:{link:R.data.link,params:A.search.substring(1)}};b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Le})}G(!1)}},[R,Ce,e,g,b]);const gh=A=>{A.data.operation===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(d(r.closeSecondModal()),d(r.closeModal$1()))};r.useListenPostMessage(gh),r.useImageControlRequest(e.src,A=>{A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?Po(r.MODALS.UPLOAD_IMAGE_MODAL_AI):A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?Po(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?Po(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?Po(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP&&Po(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK)});const fh=()=>{const A=s.getFieldsValue(!0);l.markBorderToggled(!X),setTimeout(()=>{Z(Le=>!Le),X?(A.borderAll=W.NULL_BORDER,A.borderTop=W.NULL_BORDER,A.borderBottom=W.NULL_BORDER,A.borderRight=W.NULL_BORDER,A.borderLeft=W.NULL_BORDER):A.borderAll={width:1,color:"#E5E5E5",style:"solid"},b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:A.borderAll.color,style:A.borderAll.style,width:A.borderAll.width}}}})})},_h=()=>{const A=s.getFieldsValue(!0);a.markBorderToggled(!J),setTimeout(()=>{H(Le=>!Le),J?(A.mobileBorderAll=W.NULL_BORDER,A.mobileBorderTop=W.NULL_BORDER,A.mobileBorderBottom=W.NULL_BORDER,A.mobileBorderRight=W.NULL_BORDER,A.mobileBorderLeft=W.NULL_BORDER):A.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:A.mobileBorderAll.color,style:A.mobileBorderAll.style,width:A.mobileBorderAll.width}}}})})},xh=()=>{const A=s.getFieldsValue(!0);setTimeout(()=>{Y(Le=>!Le),M?(A.borderRadiusAll=0,he(!0)):A.borderRadiusAll=5,b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:A.borderRadiusAll}}})})},kh=()=>{const A=s.getFieldsValue(!0);setTimeout(()=>{te(Le=>!Le),K?(A.mobileBorderRadiusAll=null,ce(!0)):A.mobileBorderRadiusAll=5,b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:A.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},Eh=()=>{const A=s.getFieldsValue(!0);setTimeout(()=>{Te(Le=>!Le),le?(A.boxShadowInset=!1,A.boxShadowHOffset=null,A.boxShadowVOffset=null,A.boxShadowBlurRadius=null,A.boxShadowSpreadRadius=null,A.boxShadowColor=""):(A.boxShadowInset=!1,A.boxShadowHOffset=5,A.boxShadowVOffset=5,A.boxShadowBlurRadius=10,A.boxShadowSpreadRadius=-5,A.boxShadowColor="#000000"),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:A.boxShadowBlurRadius,color:A.boxShadowColor,hOffset:A.boxShadowHOffset,inset:A.boxShadowInset,spreadRadius:A.boxShadowSpreadRadius,vOffset:A.boxShadowVOffset}}})})},Sh=()=>{const A=s.getFieldsValue(!0);setTimeout(()=>{$e(Le=>!Le),Re?(A.mobileBoxShadowInset=!1,A.mobileBoxShadowHOffset=null,A.mobileBoxShadowVOffset=null,A.mobileBoxShadowBlurRadius=null,A.mobileBoxShadowSpreadRadius=null,A.mobileBoxShadowColor=""):(A.mobileBoxShadowInset=!1,A.mobileBoxShadowHOffset=5,A.mobileBoxShadowVOffset=5,A.mobileBoxShadowBlurRadius=10,A.mobileBoxShadowSpreadRadius=-5,A.mobileBoxShadowColor="#000000"),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:A.mobileBoxShadowBlurRadius,color:A.mobileBoxShadowColor,hOffset:A.mobileBoxShadowHOffset,inset:A.mobileBoxShadowInset,spreadRadius:A.mobileBoxShadowSpreadRadius,vOffset:A.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Bh=()=>{const A=s.getFieldsValue(!0);setTimeout(()=>{re(Le=>!Le),z&&(A.mobileWidth="",A.mobileHeight="",b({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-"}}}))})},Cn=()=>{ze?(Ae.current=!1,Oe(""),s.setFieldValue("link",""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{link:""}})):(Ae.current=!0,Oe(U.current&&U.current.input.value?U.current.input.value:"..."),setTimeout(()=>{U.current.focus()}))},Pn=A=>{A.target.value===""?Oe("..."):($.current.classList.add("selected-td-form__button--active"),Oe(A.target.value)),Dt(A.target.value,Fe)},An=()=>{const A=s.getFieldsValue(!0);ve?(Ee(""),A.alt="",b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{alt:""}})):(Ee(L.current&&L.current.input.value?L.current.input.value:"..."),setTimeout(()=>{L.current.focus()}))},Nn=A=>{A.target.value===""?Ee("..."):(P.current.classList.add("selected-td-form__button--active"),Ee(A.target.value))},Ln=()=>{const A=s.getFieldsValue(!0);pe?(Q(""),A.title="",b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{title:""}})):(Q(V.current&&V.current.input.value?V.current.input.value:"..."),setTimeout(()=>{V.current.focus()}))},Rh=()=>{w(!j),j?(s.setFieldValue("imgReplacer",""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:""}})):setTimeout(()=>T.current.focus())},Th=A=>{A.target.value!==""&&oe.current.classList.add("selected-td-form__button--active")},On=A=>{A.target.value===""?Q("..."):(ne.current.classList.add("selected-td-form__button--active"),Q(A.target.value))},yh=A=>{s.setFieldValue("link",A!=="mergetag"?A:""),Fe(A)};return(0,t.jsxs)(o.ui_kit$Form,{form:s,layout:"vertical",name:"selected_image_form",initialValues:{src:"",width:"",height:"",widthDim:"",heightDim:"",alt:"",align:"left",border:"",boxShadow:"",show:"all",borderPosition:W.BORDER_POSITIONS[Et]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[Gt]||"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:Hr,autoComplete:"off",disabled:kt,className:kt?"element-controls selected-image-form_busy":"element-controls",children:[kt&&(0,t.jsx)("div",{className:"selected-image-form__loader",ref:St,children:(0,t.jsxs)("div",{className:"selected-image-form__loader-body",children:[(0,t.jsx)(o.ui_kit$Spin,{size:"large"}),(0,t.jsx)("div",{className:"selected-image-form__loader-title",children:Ue.type==="countdown"?i("Preparing countdown preview…"):i("Preparing video preview…")})]})}),!q&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),m==="mobile"&&S.styles?(0,t.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,t.jsx)(os,{form:s,elementSettings:e,handleChangeValues:Hr,boxShadow:be,mobileBordersShow:J,mobileBorderRadiusShow:K,mobileBoxShadowShow:Re,mobileSizeShow:z,oneMobileBorderRadiusValue:ke,setOneMobileBorderRadiusValue:ce,hasLink:ze,hasAlt:ve,hasTitle:pe,linkInputRef:U,linkButtonRef:$,altInputRef:L,altButtonRef:P,titleInputRef:V,titleButtonRef:ne,linkInputHandler:Pn,altButtonHandler:An,altInputHandler:Nn,titleButtonHandler:Ln,titleInputHandler:On,linkButtonHandler:Cn,toggleShowMobileBorderHandler:_h,toggleShowMobileBorderRadiusHandler:kh,toggleShowMobileBoxShadowHandler:Sh,toggleShowMobileSizeHandler:Bh})," "]}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(ts,{form:s,elementSettings:e,boxShadow:be,bordersShow:X,borderRadiusShow:M,boxShadowShow:le,oneBorderRadiusValue:me,setOneBorderRadiusValue:he,hasLink:ze,hasAlt:ve,hasTitle:pe,isOpenSrcReplacer:j,mergeTagItems:ye,mergeMenuOpen:se,setMergeMenuOpen:je,cascaderRef:xe,linkInputRef:U,linkButtonRef:$,altInputRef:L,altButtonRef:P,titleInputRef:V,titleButtonRef:ne,srcReplacerInputRef:T,srcReplacerButtonRef:oe,linkProtocol:Be,handleLinkProtocolsChange:yh,linkButtonHandler:Cn,linkInputHandler:Pn,altButtonHandler:An,altInputHandler:Nn,titleButtonHandler:Ln,titleInputHandler:On,srcReplacerButtonHandler:Rh,srcInputHandler:Th,handleSelect:Pe,onChange:B,filter:ee,renderSearchOption:E,handleChangeValues:Hr,toggleShowBorderHandler:fh,toggleShowBorderRadiusHandler:xh,toggleShowBoxShadowHandler:Eh})})]})};ls.propTypes={elementSettings:_.default.object.isRequired};var as=()=>{const{__:e}=r.useI18n();return(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:e("The font-size CSS property sets the size of the font."),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileFontSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:e("Font size"),prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})},Zt=({form:e,elementSettings:i,imgParent:s=!1,name:l="align",setAlignStateHandle:a=()=>{},withHotKeys:d=!0})=>{const{__:c}=r.useI18n(),h=r.useSendPostMessage(),g=r.useAppConfig(),[b,x]=(0,n.useState)(null);(0,n.useEffect)(()=>{globalThis?.navigator?.userAgent.includes("Macintosh")&&x(!0)},[]);const p=v=>{a(v),e.setFieldsValue({[l]:v}),h({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[l]:v}})},m=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,S=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,k=d?b?m:S:void 0,f=i[l],y=typeof f=="string"?f:"";return(0,t.jsx)(o.ui_kit$Form.Item,{name:l,children:(0,t.jsx)(o.ui_kit$FormAlignTextControl,{value:y,onChange:p,disabled:s&&!i.parent,strokeWidth:g?.iconStrokeWidth,labels:k})})},it=({form:e,elementSettings:i,name:s,icon:l,tooltipTitle:a=null,showTooltip:d=!0,forceInactive:c=!1})=>{const{__:h}=r.useI18n(),g=e.getFieldValue(s),b=r.useSendPostMessage(),[x,p]=(0,n.useState)(i[s]);(0,n.useEffect)(()=>{i[s]!==e.getFieldValue(s)&&(e.setFieldValue(s,i[s]),p(i[s]))},[i,e,s]),(0,n.useEffect)(()=>{x!==g&&p(g)},[g,x,s]);const m=()=>{const S={[s]:!x};e.setFieldValue(s,!x),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:S}),s==="textSuperscript"?e.setFieldValue("textSubscript",!1):s==="textSubscript"&&e.setFieldValue("textSuperscript",!1),p(k=>!k)};return(0,t.jsx)(o.ui_kit$Form.Item,{name:s,children:d?(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:a||h(s.substring(4)),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":x&&!c}),onClick:m,children:l})}):(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":x&&!c}),onClick:m,children:l})})};it.propTypes={form:_.default.shape({setFieldsValue:_.default.func.isRequired}).isRequired,elementSettings:_.default.object.isRequired,tooltipTitle:_.default.string,imgParent:_.default.bool};var hd=["email","block"];function bd(e){const i=r.getMessageService(e).getTarget(),s=r.getCanvasService(e);hd.map(l=>s?.peek(l)?.element).find(l=>!!i&&l?.contentWindow===i)?.focus({preventScroll:!0})}var ns=()=>{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")}]},gd=(e,i="#c6c3c3",s={},l)=>{const{symbolSize:a="25px",marginRight:d="5px",marginBottom:c="5px",textStyle:h={whiteSpace:"normal",lineHeight:"1.2"}}=s;return e.map(g=>({value:g.code,label:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,t.jsx)("span",{style:{color:i||"#c6c3c3",marginRight:d,marginBottom:c,fontSize:a,lineHeight:"0.7",width:a,textAlign:"center",...h},children:g.symbol}),(0,t.jsx)("span",{style:h,children:g.description})]})}))},go=({form:e,fillFields:i,elementSettings:s,showAddParagraph:l=!0,isButton:a=!1,linkProtocol:d,setLinkProtocol:c,linkTarget:h,isBulletFontColorChecked:g=!1,setIsBulletFontColorChecked:b=()=>{},showTopDivider:x=!0})=>{const{__:p}=r.useI18n(),m=W.useGoogleFontsLoader(),{token:S}=(0,o.ui_kit$useToken)(),k=r.useNotification(),f=r.useSendPostMessage(),y=r.useContainer(),v=r.useAppConfig(),N=(0,n.useRef)(),R=(0,n.useRef)(null),C=(0,n.useRef)(null),F=(0,n.useRef)(null),U=(0,n.useRef)(!1),$=s,[L,P]=(0,n.useState)(!!$.textReplacer?.length),[V,ne]=(0,n.useState)(!!$.textAnchor?.length),[T,oe]=(0,n.useState)(null),[xe,be]=(0,n.useState)({start:0,end:0}),[Se,me]=(0,n.useState)(!1),[he,ke]=(0,n.useState)([]),[ce,ze]=(0,n.useState)($.list?.bulletsColor),[Oe,ve]=(0,n.useState)(s);s!==Oe&&(ve(s),ze($.list?.bulletsColor),P(!!$.textReplacer?.length),ne(!!$.textAnchor?.length));const[Ee,pe]=(0,n.useState)(!1),[Q,X]=(0,n.useState)(!1),Z=(0,n.useRef)(null),J=(0,n.useRef)(""),H=ns(),M=(0,n.useMemo)(()=>H,[]),Y={textColor:o.ui_kit$Form.useWatch("textColor",e),textLink:o.ui_kit$Form.useWatch("textLink",e),linkHref:o.ui_kit$Form.useWatch("linkHref",e),listUL:o.ui_kit$Form.useWatch("listUL",e),listOL:o.ui_kit$Form.useWatch("listOL",e)};(0,n.useEffect)(()=>{a&&s?.textColor!==void 0&&e.setFieldValue("textColor",s.textColor)},[a,s?.textColor,e]);let K=null;(0,n.useEffect)(()=>{if(Y?.textColor&&g){const w=e.getFieldValue("textColor");f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:{ColorBullets:w}})}},[Y?.textColor]),(0,n.useEffect)(()=>{const w=e.getFieldValue("textLink");typeof s.linkHref=="string"&&pe(!0),Z&&!w&&(pe(!1),e.setFieldsValue({linkHref:null})),Z.current=w||null},[Y?.textLink,Y?.linkHref,s.linkHref,e]),(0,n.useEffect)(()=>{const w=e.getFieldValue("listUL"),ue=e.getFieldValue("listOL");w&&J.current!=="listUL"?(e.setFieldValue("listOL",!1),J.current="listUL"):ue&&J.current!=="listOL"&&(e.setFieldValue("listUL",!1),J.current="listOL"),!w&&!ue&&(J.current="")},[Y?.listUL,Y?.listOL,e]);const te=w=>{w.data.operation===r.EVENT_TYPES.APPLICATION_FOCUS_IN_IFRAME&&oe(null)};r.useListenPostMessage(te);const[le,Te]=(0,n.useState)(null);(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&Te(!0)},[]);const Re=(0,n.useRef)(null);function $e(w){const ue=w.key.toLowerCase();let Ie=!1;return((K==="control"||K==="meta")&&(ue==="a"||ue==="A")||(K==="a"||K==="A")&&(ue==="control"||ue==="meta"))&&(Ie=!0),K=ue,ue!=="control"&&ue!=="a"&&ue!=="A"&&ue!=="meta"&&(K=null),Ie}const z=w=>{f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:w,locale:"ru_RU"}),k.success({title:p("It`s done!")})},re=[{key:"1",label:p("This element"),onClick:()=>z("typograf")},{key:"2",label:p("The whole email"),onClick:()=>z("typograf_all")}],[Ce,G]=(0,n.useState)(),[Be,Fe]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const w=gd(M,ce,{});ke(w)},[M,ce]),(0,n.useEffect)(()=>{const w=s.linkHref||s.href;w&&Dt(w,c);const ue=s.linkHref||s.href,Ie=ue&&Ii(ue)?ue.slice(1):ue||"https://";(i??((qe,Ze)=>qe.setFieldsValue(Ze)))(e,{linkHref:Ie})},[e,s,c,i]);const Ae=r.useAppConfig().mergeTags;(0,n.useEffect)(()=>{Ae?.items?.length&&G(r.mapMargeTags(Ae.items))},[Ae,G]);const Ve=w=>{e.setFieldValue("linkHref",w!=="mergetag"?w:""),c(w)},Ue=(w,ue)=>{if(Fe(!1),w){const Ie=Ae.syntax.length>1?Ce.findIndex(Ze=>Ze.key===ue[0].key):0,qe=Ae.syntax[Ie].replace("%value%",w[w.length-1]);if(T?.getAttribute("id")==="selected_button_form_href"||T?.getAttribute("id")==="selected_text_form_linkHref"||T?.getAttribute("id")==="selected_text_form_textReplacer")je(qe,T?.getAttribute("id"));else{e.setFieldValue("textReplacer",qe);const Ze=Date.now();f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:{textReplacer:`${qe}~~${Ze}`}}),y&&setTimeout(()=>bd(y))}}},Xe=(w,ue)=>ue.some(Ie=>Ie.label.toLowerCase().indexOf(w.toLowerCase())>-1),de=(w,ue)=>{const Ie=ue.map((qe,Ze)=>{const dt=qe.label.split(new RegExp(`(${w})`,"gi"));return(0,t.jsxs)("span",{children:[Ze!==0&&(0,t.jsx)("span",{children:" / "}),dt.map((st,ct)=>st.toLowerCase()===w.toLowerCase()?(0,t.jsx)("span",{style:{color:"red"},children:st},ct):st)]},qe.value)});return(0,t.jsx)("div",{title:ue.map(qe=>qe.label).join(" / "),children:Ie})};(0,n.useEffect)(()=>{Be&&Re.current&&Re.current.focus()},[Be]);const ye=r.useRootElement();(0,n.useEffect)(()=>{const w=({target:qe})=>{qe.closest('[id="merge_tags_wrapper"]')||oe(qe)},ue=({target:qe})=>{!qe.closest(".merge-tags")&&!qe.closest("#merge_tags_button")&&Fe(!1)},Ie=new ht.Disposable;return Ie.addDisposable(r.addWindowListenerFromShadow(ye,"focusin",w)),Ie.addDisposable(r.addWindowListenerFromShadow(ye,"click",ue)),()=>{Ie.dispose()}},[ye]);const I=(0,n.useCallback)(()=>{const w=window.getSelection();w&&w.toString().length>0&&(U.current=!0)},[]),se=(0,n.useCallback)(({target:w})=>{if(w&&!Se){const{selectionStart:ue,selectionEnd:Ie}=w;be(qe=>qe?.start===ue&&qe?.end===Ie?qe:{start:ue,end:Ie})}me(!1)},[Se]);(0,n.useEffect)(()=>se({target:h?.target}),[h,se]);const je=(w,ue)=>{const Ie=document.getElementById(ue);if(Ie){const qe=Ie.value?.substring(0,xe.start),Ze=Ie.value?.substring(xe.end),dt=ue.substring(ue.lastIndexOf("_")+1);f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:{[dt]:qe+w+Ze}}),e.setFieldValue(dt,qe+w+Ze),Ie.focus(),setTimeout(()=>{Ie.selectionStart=xe.start,Ie.selectionEnd=xe.start+w.length},400),me(!0)}},Ne=()=>{P(!L),L?(e.setFieldValue("textReplacer",""),f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:{textReplacer:""}})):setTimeout(()=>R.current.focus())},He=w=>{w.target.value!==""&&C.current?.classList.add("selected-td-form__button--active")},Ke=(w="unknown")=>{ne(!V),V?(e.setFieldValue("textAnchor",""),f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:{textAnchor:""}})):setTimeout(()=>F.current?.focus())},tt=w=>{const ue=w.target,Ie=ue.value,qe=ue.selectionStart,Ze=$e(w);if(U.current&&qe===0&&f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:{textReplacer:`${Ie}~`}}),U.current=Ze,qe===0&&w.key===" "){w.preventDefault();return}if(w.key===" "){if(qe!==Ie.length){w.preventDefault();return}Ie.endsWith(" ")&&w.preventDefault()}},O=w=>{ze(w),g&&b(!1)},ie=a?v.formButtonFieldInsertImageEnabled:v.formTextFieldTypografEnabled,j=v.formTextFieldTypografEnabled&&!a;return(0,t.jsxs)(t.Fragment,{children:[l&&!s.showOnMobile&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Row,{gutter:20,style:{paddingBottom:4},children:(0,t.jsx)(o.ui_kit$Col,{span:12,gutter:20,children:(0,t.jsx)(Zt,{form:e,elementSettings:s,name:"textAlign"})})})}),ie||j||v.mergeTagsShow&&Ce?(0,t.jsx)(o.ui_kit$FormSection,{title:null,dividerTop:x,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginTop:4},children:[ie&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Col,{span:j?12:24,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"AddImage",style:{marginBottom:S.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(r.EmIcons,{icon:"AddImage",component:o.icons$AddImage}),onClick:()=>z("add_img"),style:{width:"100%"},children:p("Add image")})})})}),j&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"Typography",style:{marginBottom:S.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,menu:{items:re},trigger:["hover"],placement:"bottom",getPopupContainer:w=>w.closest(".selected-element-panel"),children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(r.EmIcons,{icon:"Typograf",component:o.icons$Typograf}),onClick:()=>z("typograf"),style:{width:"100%"},children:p("Typography")})})})})}),v.mergeTagsShow&&Ce&&(0,t.jsxs)(o.ui_kit$Col,{span:24,id:"merge_tags_wrapper",style:{marginBottom:S.formItemMarginBottomXS},children:[(0,t.jsx)(o.ui_kit$Button,{id:"merge_tags_button",icon:(0,t.jsx)(r.EmIcons,{icon:"MergeTags",component:o.icons$MergeTags}),style:{width:"100%",display:Be?"none":"inline-flex"},onClick:()=>Fe(!0),children:p("Merge tags")}),(0,t.jsx)(o.ui_kit$Cascader,{ref:Re,classNames:{popup:{root:"merge-tags"}},options:Ce,placeholder:p("Start typing the title"),showSearch:{filter:Xe,render:de},spellCheck:"false",getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper"),onChange:Ue,style:{display:Be?"block":"none",width:"100%"},open:Be,onKeyDown:w=>{w.key==="Escape"&&Fe(!1)}})]})]})}):null,(0,t.jsxs)(o.ui_kit$FormSection,{title:null,dividerTop:x||ie||j,bodyStyle:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:p("Text font"),placement:"bottom",zIndex:1,getPopupContainer:w=>w.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:m,getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper")})})}),!s.showOnMobile&&(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:p("Font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontSize",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:p("Font size"),prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:p("Line height"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"lineHeight",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:p("Line height"),prefix:(0,t.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,t.jsx)(o.ui_kit$Row,{gutter:10,style:{marginBottom:10,marginTop:5},children:(0,t.jsxs)(o.ui_kit$Col,{span:24,children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:-10},children:[a&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsxs)("div",{className:"selected-text-common-form__format-toolbar",children:[(0,t.jsx)(it,{form:e,elementSettings:s,name:"textStrong",tooltipTitle:p(le?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(r.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})}),(0,t.jsx)(it,{form:e,elementSettings:s,name:"textItalic",tooltipTitle:p(le?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})}),(0,t.jsx)(it,{form:e,elementSettings:s,name:"textUnderline",tooltipTitle:p(le?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})}),(0,t.jsx)(it,{form:e,elementSettings:s,name:"textStrikethrough",tooltipTitle:p(le?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:p("Text color"),placement:"bottom",zIndex:1,getPopupContainer:w=>w.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",rules:[{message:p("Please set the font color")}],className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:p("Color"),usedColors:s.usedColors})})})})]}),!a&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:s,name:"textStrong",tooltipTitle:p(le?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(r.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:s,name:"textItalic",tooltipTitle:p(le?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:s,name:"textUnderline",tooltipTitle:p(le?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})}),s?.list?.isList&&(0,t.jsxs)(o.ui_kit$Col,{span:3,children:[" ",(0,t.jsx)(it,{form:e,elementSettings:s,name:"textStrikethrough",tooltipTitle:p(le?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]}),!s?.list?.isList&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:s,name:"listUL",tooltipTitle:p("Unordered list"),icon:(0,t.jsx)(r.EmIcons,{icon:"UnorderedListOutlined",component:o.icons$UnorderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:se})}),!s?.list?.isList&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:s,name:"listOL",tooltipTitle:p("Ordered list"),icon:(0,t.jsx)(r.EmIcons,{icon:"OrderedListOutlined",component:o.icons$OrderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:se})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:s,name:"textSuperscript",tooltipTitle:p("Text superscript"),icon:(0,t.jsx)(r.EmIcons,{icon:"Superscript",component:o.icons$Superscript})})}),s?.list?.isList&&(0,t.jsxs)(o.ui_kit$Col,{span:3,children:[" ",(0,t.jsx)(it,{form:e,elementSettings:s,name:"textSubscript",tooltipTitle:p("Text subscript"),icon:(0,t.jsx)(r.EmIcons,{icon:"Subscript",component:o.icons$Subscript})})]}),l&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,className:(0,We.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",forceInactive:!!s.textAnchor,tooltipTitle:p("Link"),icon:(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"}),onSelect:se})}),s?.list?.isList&&v.formTextFieldReplacerEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:p("Text replacer"),placement:"bottom",getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":L}),icon:(0,t.jsx)(r.EmIcons,{icon:"Replacer",component:o.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:Ne,ref:C})})}),(!s?.list?.isList||l&&s?.list?.isList)&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:p("More options"),placement:"bottom",getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":Q||V}),icon:(0,t.jsx)(r.EmIcons,{icon:"DotsHoriz",component:o.icons$DotsHoriz,className:"selected-td-form__icon-radius"}),onClick:()=>X(!Q)})})})]})]}),!a&&Q&&(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[!s?.list?.isList&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Col,{span:3,children:[" ",(0,t.jsx)(it,{form:e,elementSettings:s,name:"textStrikethrough",tooltipTitle:p(le?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]}),(0,t.jsxs)(o.ui_kit$Col,{span:3,children:[" ",(0,t.jsx)(it,{form:e,elementSettings:s,name:"textSubscript",tooltipTitle:p("Text subscript"),icon:(0,t.jsx)(r.EmIcons,{icon:"Subscript",component:o.icons$Subscript})})]}),v.formTextFieldReplacerEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:p("Text replacer"),placement:"bottom",getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":L}),icon:(0,t.jsx)(r.EmIcons,{icon:"Replacer",component:o.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:Ne,ref:C})})})]}),l&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:p("Anchor"),placement:"bottom",getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":V}),icon:(0,t.jsx)(r.EmIcons,{icon:"Anchor",component:o.icons$Anchor,className:"selected-text-common-form__icon-radius"}),onMouseDown:w=>{w.preventDefault(),Ke("mouseDown")}})})})]}),l&&typeof s.linkHref=="string"&&Ee&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(qt,{show:d==="#",__:p,style:{marginBottom:S.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:p(d==="#"?"Anchor name":"The URL that the hyperlink directs to."),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"linkHref",style:{marginBottom:d==="mailto:"?S.formItemMarginBottomXS:""},children:(0,t.jsx)(o.ui_kit$Input,{ref:N,addonBefore:(0,t.jsx)(Kt,{linkProtocol:d,handleLinkProtocolsChange:Ve,__:p}),allowClear:!0,placeholder:p(d==="#"?"Anchor name":"Hyperlink URL"),autoFocus:s?.isNewLink,onSelect:se,prefix:(0,t.jsx)(Xt,{linkProtocol:d})})})}),d==="mailto:"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:"subject",style:{marginBottom:S.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:p("Subject"),onSelect:se})}),(0,t.jsx)(o.ui_kit$Form.Item,{name:"body",style:{marginBottom:S.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$TextArea,{rows:3,placeholder:p("Body"),onSelect:se})})]})]}),l&&V&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:p("Anchor name"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textAnchor",children:(0,t.jsx)(o.ui_kit$Input,{placeholder:p("Anchor name"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content addon-text-content--icon",title:p("Anchor"),"aria-hidden":!0,children:(0,t.jsx)(r.EmIcons,{icon:"Anchor",component:o.icons$Anchor,className:"selected-text-common-form__icon-radius",size:18})}),ref:F,onSelect:se,onBlur:()=>{e.getFieldValue("textAnchor")?.trim()||ne(!1)}})})}),!a&&L&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:p("Text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textReplacer",children:(0,t.jsx)(o.ui_kit$Input,{placeholder:p("The code that will replace this text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:p("Text")}),onChange:He,onKeyDown:tt,onDoubleClick:I,ref:R,onSelect:se})})})]})}),!a&&(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:p("Text color"),placement:"bottom",zIndex:1,getPopupContainer:w=>w.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",rules:[{message:p("Please set the font color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:p("Color"),usedColors:s.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:p("Text background"),placement:"bottom",zIndex:1,getPopupContainer:w=>w.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:p("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:p("Background color"),usedColors:s.usedColors})})})})]})]}),!a&&s?.list?.isList&&(0,t.jsxs)(o.ui_kit$FormSection,{title:p("List settings"),dividerTop:!0,children:[s?.list?.listType==="OL"&&(0,t.jsx)(o.ui_kit$Row,{children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:p("Bullets font"),placement:"bottom",zIndex:1,getPopupContainer:w=>w.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"BulletsFontFamily",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:m,getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper"),style:{marginTop:"-9px"}})})})})}),(0,t.jsx)(o.ui_kit$Row,{gutter:[10],children:s?.list?.listType==="UL"&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:p("Bullets type"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"BulletType",className:"bullet-type",children:(0,t.jsx)(o.ui_kit$Select,{size:"medium",placeholder:p("Bullets type"),onClick:w=>w.stopPropagation(),options:he})})})})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:[10],children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:p("Bullets color"),placement:"bottom",zIndex:1,getPopupContainer:w=>w.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"ColorBullets",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:p("Bullets color"),usedColors:s.usedColors,disabled:g,onChange:O,externalValue:g?Y?.textColor:void 0})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:p("Bullets size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"BulletsSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,defaultValue:s?.list?.bulletFontSize,placeholder:p("Bullets size"),prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})})]}),s?.list?.listType==="OL"&&(0,t.jsxs)(o.ui_kit$Row,{children:[(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:s,name:"BulletTextStrong",tooltipTitle:p(le?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(r.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:s,name:"BulletTextItalic",tooltipTitle:p(le?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:s,name:"BulletTextStrikethrough",tooltipTitle:p(le?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:s,name:"BulletTextUnderline",tooltipTitle:p(le?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:[10],style:{marginTop:"-8px"},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:p("Between list items"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"SpacingBetweenParagraphs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:5,max:100,placeholder:p("Between list items"),prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:o.icons$ColumnHeightOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:p("Between bullets and text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"SpacingBetweenBulletsAndText",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:1,max:100,placeholder:p("Between bullets and text"),prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:"px"})})})})]})]})]})},Ni=({form:e,elementSettings:i,showAddParagraph:s=!0,isButton:l=!1})=>{const{__:a}=r.useI18n(),d=W.useGoogleFontsLoader(),c=r.useSendPostMessage(),h=r.useDispatch(),g=r.useElementEntityKind(),b=r.useAppConfig(),[x,p]=(0,n.useState)(null);(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&p(!0)},[]);const m=N=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:N,locale:"ru_RU"})},[S,k]=(0,n.useState)(i.textAlign),[f,y]=(0,n.useState)(i.linkHref),v=N=>k(N);return(0,n.useEffect)(()=>{k(i.textAlign),y(i.linkHref)},[i]),(0,t.jsx)("div",{className:"selected_text_common_form_mobile",children:(0,t.jsxs)(o.ui_kit$Space,{size:"8",separator:(0,t.jsx)(o.ui_kit$Divider,{orientation:"vertical"}),children:[(0,t.jsxs)(o.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,t.jsx)("div",{style:{width:190},children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:a("Text font"),placement:"bottom",zIndex:1,getPopupContainer:N=>N.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontFamily",children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:d,getPopupContainer:N=>N.closest(".selected_text_common_form_mobile")})})})}),(0,t.jsx)("div",{style:{width:90},children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:a("Font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:a("Font size"),prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)("div",{style:{width:90},children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:a("Line height"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"lineHeight",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:a("Line height"),prefix:(0,t.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,t.jsxs)(o.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,t.jsx)(it,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:a(x?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(r.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-td-form__icon-radius"})}),(0,t.jsx)(it,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:a(x?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})}),(0,t.jsx)(it,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:a(x?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-td-form__icon-radius"})}),(0,t.jsx)(it,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:a(x?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-td-form__icon-radius"})})]}),(0,t.jsxs)(o.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:a("Text color"),placement:"bottom",zIndex:1,getPopupContainer:N=>N.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",rules:[{message:a("Please set the font color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:a("Color"),usedColors:i.usedColors,getPopupContainer:N=>N.closest(".selected_text_common_form_mobile")})})}),!l&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:a("Text background"),placement:"bottom",zIndex:1,getPopupContainer:N=>N.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:a("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:a("Background color"),usedColors:i.usedColors})})})})]}),s&&(0,t.jsx)(o.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:(0,t.jsxs)(t.Fragment,{children:[typeof f=="string"?(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,popupRender:()=>(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:a("The URL that the hyperlink directs to."),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"linkHref",children:(0,t.jsx)(o.ui_kit$Input,{allowClear:!0,placeholder:a("Hyperlink URL"),prefix:(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.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:N=>N.closest(".selected_text_common_form_mobile"),children:(0,t.jsx)("div",{children:(0,t.jsx)(it,{form:e,className:"selected-td-form__button selected-td-form__button_style selected-td-form__button--active",elementSettings:i,name:"textLink",icon:(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),showTooltip:!1})})}):(0,t.jsx)(it,{form:e,className:"selected-td-form__button selected-td-form__button_style",elementSettings:i,name:"textLink",tooltipTitle:a("Link"),icon:(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-td-form__icon-radius"})}),(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,popupRender:()=>(0,t.jsx)(Zt,{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:N=>N.closest(".selected_text_common_form_mobile"),children:(0,t.jsx)(o.ui_kit$Button,{icon:S==="right"?(0,t.jsx)(r.EmIcons,{icon:"AlignRightOutlined",component:o.icons$AlignRightOutlined,size:18,strokeWidth:b.iconStrokeWidth}):S==="center"?(0,t.jsx)(r.EmIcons,{icon:"AlignCenterOutlined",component:o.icons$AlignCenterOutlined,size:18,strokeWidth:b.iconStrokeWidth}):(0,t.jsx)(r.EmIcons,{icon:"AlignLeftOutlined",component:o.icons$AlignLeftOutlined,size:18,strokeWidth:b.iconStrokeWidth}),className:"selected-td-form__button"})})]})}),(0,t.jsxs)(o.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[s&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:a("Add paragraph"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(r.EmIcons,{icon:"Paragraph",component:o.icons$Paragraph}),onClick:()=>m("add_p"),className:"selected-td-form__button"})}),(!l||b.formButtonFieldInsertImageEnabled)&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:a("Add inline image"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(r.EmIcons,{icon:"ImageAdd",component:o.icons$ImageAdd,size:16,strokeWidth:b.iconStrokeWidth}),onClick:()=>m("add_img"),className:"selected-td-form__button"})})}),!l&&(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(r.EmIcons,{icon:"Typograf",component:o.icons$Typograf}),className:"selected-td-form__button"}),(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(r.EmIcons,{icon:"CloseOutlined",component:o.icons$CloseOutlined}),type:"icon",style:{marginLeft:26},onClick:()=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),h(r.resetToLastActiveSettingsTab()),setTimeout(()=>{h(g==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300)}})]})]})})},Fo=({elementSettings:e,imgParent:i=!1,name:s="mobileAlign"})=>{const{__:l}=r.useI18n(),a=r.useAppConfig();return(0,t.jsx)(o.ui_kit$Form.Item,{name:s,children:(0,t.jsx)(o.ui_kit$FormAlignTextControl,{disabled:i&&!e.parent,strokeWidth:a?.iconStrokeWidth,labels:{alignLeft:l("Text align left"),alignCenter:l("Text align center"),alignRight:l("Text align right"),alignJustify:l("Text align justify")}})})};Fo.propTypes={elementSettings:_.default.object.isRequired,imgParent:_.default.bool,name:_.default.string};var fd=({elementSettings:e})=>{const{__:i}=r.useI18n(),s=r.useDispatch(),l=r.useSendPostMessage(),[a]=o.ui_kit$Form.useForm(),d=r.useSelector(r.selectEmailViewType),c=r.useSelector(r.selectMobileViewActive),h=r.useSelector(r.selectIsCodeMode),g=r.useSelector(r.selectCodeModeDirection),b=h&&g!=="bottom",[x,p]=(0,n.useState)("https://"),[m,S]=(0,n.useState)(!1),k=ns(),f=(0,n.useMemo)(()=>k,[]),y=r.useElementEntityKind(),{remember:v,fillFields:N}=ro(e),R=(0,n.useCallback)(F=>{v(F),s(y==="email"?r.setElementSettings$1(F):r.setElementSettings(F))},[s,y,v]);(0,n.useEffect)(()=>{if(e){const{subject:F,body:U,baseEmail:$}=Qr(e.linkHref),L=e.linkHref,P=typeof L=="string"&&Ii(L),V=typeof L=="string"&&L.startsWith("mailto:")?$:P?L.slice(1):typeof L=="string"?L:"https://";p($o(L||"","https://")),N(a,{...e,lineHeight:u(e.lineHeight),linkHref:V,subject:F,body:U,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:Zr(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:m,BulletsFontFamily:e?.list?.bulletFontFamily,BulletTextUnderline:e?.list?.bulletFontUnderline,BulletTextStrikethrough:e?.list?.bulletFontStrikethrough,BulletType:f.find(ne=>ne.symbol===e?.list?.bulletType)?.code??f[0].code,textSuperscript:e?.textSuperscript,textSubscript:e?.textSubscript,listOL:e?.standardList?.listTypeOL,listUL:e?.standardList?.listTypeUL})}},[a,e]);const C=F=>{const U=a.getFieldsValue(!0),$=Object.keys(F)[0];let L;switch($){case"mobileFontSize":L={[$]:{classNamePrefix:"em-mob-font_size-",value:F[$],dim:U.mobileFontSizeDim}};break;case"mobileLineHeight":L={[$]:{classNamePrefix:"em-mob-line_height-",value:F[$],dim:U.mobileLineHeightDim}};break;case"mobileTextAlign":L={[$]:{classNamePrefix:"em-mob-text_align-",value:F[$]}};break;case"linkHref":let P=Jt(F[$]);if(P!==F[$]&&a.setFieldValue("linkHref",P),x==="#"&&P&&!P.startsWith("#")&&(P="#"+P),P.startsWith("mailto:")){const ne=a.getFieldValue("subject"),T=a.getFieldValue("body");L={[$]:Ci(P,ne,T)}}else L={[$]:P};Dt(P,p);break;case"subject":case"body":const V=a.getFieldValue("linkHref")||"";if(V.substring(0,7)==="mailto:"){const ne=V.split("?")[0],T=$==="subject"?F[$]:a.getFieldValue("subject"),oe=$==="body"?F[$]:a.getFieldValue("body"),xe=[];T&&xe.push(`subject=${encodeURIComponent(T)}`),oe&&xe.push(`body=${encodeURIComponent(oe)}`),L={linkHref:xe.length>0?`${ne}?${xe.join("&")}`:ne}}else return;break;default:L=F}l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:L}),R({...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:f.find(P=>P.code===a.getFieldValue("BulletType"))?.symbol??f[0].symbol},...L,activateSection:null,changeKey:$})};return(0,t.jsxs)(o.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:[!b&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),!(d==="mobile"&&!b&&c.styles)&&(0,t.jsx)("div",{id:"selected_element_form_desktop_props",style:{paddingRight:0},children:b?(0,t.jsx)(Ni,{form:a,elementSettings:e}):(0,t.jsx)(go,{form:a,fillFields:N,elementSettings:e,linkProtocol:x,setLinkProtocol:p,isBulletFontColorChecked:m,setIsBulletFontColorChecked:S})}),!b&&(0,t.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:d==="mobile"&&c.styles?"block":"none"},children:[(0,t.jsx)(o.ui_kit$Row,{gutter:20,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Fo,{form:a,elementSettings:e,name:"mobileTextAlign"})})}),!!e.showOnMobile&&(0,t.jsx)(go,{form:a,fillFields:N,elementSettings:e,linkProtocol:x,setLinkProtocol:p}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(as,{})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileLineHeight",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,t.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})]})]})]})},Li=(e,i)=>{const{__:s}=r.useI18n();return(0,t.jsx)(o.ui_kit$Tooltip,{title:s("During export, the element is converted into an image."),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"exportAsPicture",valuePropName:"checked",className:"form-item-margin-xs",style:{marginBottom:10},children:(0,t.jsx)(o.ui_kit$Switch,{id:"convert-in-image",label:s("Convert into an image"),size:"small",labelStyle:{position:"relative",top:2}})})},"exportAsPicture")},ds={marginBottom:10},cs={position:"relative",top:2};function _d(e){return Array.isArray(e)?!!e[0]?.value:typeof e=="string"?e.trim()!=="":!!e}var eo=({form:e,showRounding:i=!1,showBackground:s=!1})=>{const{__:l}=r.useI18n(),a=_d(o.ui_kit$Form.useWatch("backgroundImage",e));return(0,t.jsxs)(t.Fragment,{children:[i&&(0,t.jsx)(o.ui_kit$Tooltip,{title:l("Adds bulletproof VML markup so the button keeps rounded corners in Outlook."),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"outlookRounding",valuePropName:"checked",className:"form-item-margin-xs",style:ds,children:(0,t.jsx)(o.ui_kit$Switch,{id:"outlook-rounding",label:l("Rounded corners in Outlook (VML)"),size:"small",labelStyle:cs})})},"outlookRounding"),s&&a&&(0,t.jsx)(o.ui_kit$Tooltip,{title:l("Adds VML markup so the background image is visible in Outlook."),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"outlookBackground",valuePropName:"checked",className:"form-item-margin-xs",style:ds,children:(0,t.jsx)(o.ui_kit$Switch,{id:"outlook-background",label:l("Background image in Outlook (VML)"),size:"small",labelStyle:cs})})},"outlookBackground")]})};eo.propTypes={form:_.default.object,showRounding:_.default.bool,showBackground:_.default.bool};var us=({form:e,elementSettings:i,boxShadow:s,bordersShow:l,borderRadiusShow:a,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:h,backgroundRepeatOptions:g,backgroundSizeOptions:b,sizeShow:x,modificationShow:p,oneBorderRadiusValue:m,setOneBorderRadiusValue:S,toggleShowBorderHandler:k,toggleShowBorderRadiusHandler:f,toggleShowBoxShadowHandler:y,toggleShowSizeHandler:v,toggleShowBackgroundHandler:N,toggleShowModificationHandler:R})=>{const{__:C}=r.useI18n(),F=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{style:{paddingBottom:4},children:(0,t.jsx)(Mt,{form:e,elementSettings:i,tooltipTitle:C("The align attribute sets the horizontal alignment of the table.")})}),(0,t.jsx)(o.ui_kit$FormSection,{title:C("Size"),collapsible:!0,open:x,onToggle:v,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormSizeInputs,{showHeight:!1,showMinMax:!0,columnsPerRow:2,dimensionSelect:Nt,minWidthDimensionSelect:Nt,maxWidthDimensionSelect:Nt,rowStyle:{marginBottom:4},labels:{width:C("Width"),height:C("Height"),minWidth:C("Minimum width"),maxWidth:C("Maximum width")}})}),(0,t.jsxs)(o.ui_kit$FormSection,{title:C("Background"),collapsible:!0,open:c,onToggle:N,dividerTop:!0,children:[(0,t.jsx)(o.ui_kit$FormBackgroundSettings,{imageEnabled:F.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:h,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:g,backgroundSizeOptions:b,imageUploadSlot:F.formTableFieldBackgroundImageEnabled?(0,t.jsx)(Pt,{form:e,label:C("Background image"),name:"backgroundImage",tooltipTitle:C("Background image"),placeholder:C("Background image link/route")}):void 0}),(0,t.jsx)(eo,{form:e,showBackground:!0})]}),F.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:C("Borders"),collapsible:!0,open:l,onToggle:k,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),F.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:C("Border radius"),collapsible:!0,open:a,onToggle:f,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:m,setOneBorderRadiusValue:S,elementSettings:i})}),F.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:C("Box shadow"),collapsible:!0,open:d,onToggle:y,dividerTop:!0,children:(0,t.jsx)(wt,{})}),F.formFieldExportAsPictureEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:C("Export settings"),collapsible:!0,open:p,onToggle:R,dividerTop:!0,children:(0,t.jsx)(Li,{form:e,elementSettings:i})}),F.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:C("Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e})}),F.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:C("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};us.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,boxShadow:_.default.object,bordersShow:_.default.bool,borderRadiusShow:_.default.bool,boxShadowShow:_.default.bool,backgroundShow:_.default.bool,backgroundImageEmpty:_.default.bool,backgroundRepeatOptions:_.default.array,backgroundSizeOptions:_.default.array,sizeShow:_.default.bool,modificationShow:_.default.bool,oneBorderRadiusValue:_.default.bool,setOneBorderRadiusValue:_.default.func,toggleShowBorderHandler:_.default.func,toggleShowBorderRadiusHandler:_.default.func,toggleShowBoxShadowHandler:_.default.func,toggleShowSizeHandler:_.default.func,toggleShowBackgroundHandler:_.default.func,toggleShowModificationHandler:_.default.func};var ms=({form:e,elementSettings:i,label:s})=>{const{__:l}=r.useI18n();(0,n.useRef)();const[a,d]=(0,n.useState)(i.mobileBackgroundColor?.value==="none"),{token:c}=(0,o.ui_kit$useToken)(),h=r.useSendPostMessage(),g=x=>{e.setFieldsValue({mobileBackgroundColor:""}),d(p=>!p),h({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:a?"":"none"}}})},b=x=>{d(!1)};return(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(o.ui_kit$Tooltip,{trigger:["hover"],title:l("Background color"),placement:"left",children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileBackgroundColor",style:{marginBottom:c.formItemMarginBottomXS/2},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{onChange:b,placeholder:s,usedColors:i.usedColors})}),(0,t.jsx)(o.ui_kit$Switch,{id:"without-background-color",label:l("Without background color"),labelSize:"small",size:"small",checked:a,onChange:g})]})})};ms.propTypes={form:_.default.shape({setFieldsValue:_.default.func.isRequired}).isRequired,elementSettings:_.default.object.isRequired};var Mo={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"}]},Oi={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-"},so="none",xd=/^(https?:)?\/\//i,kd=/^(\d*\.?\d+)(%|px)$/;function Ed(e){return e in Oi}function ps(e){return xd.test(e.trim())}function $i(e,i){const s=Oi[e],l=typeof i=="string"?i:"";return e==="mobileBackgroundImage"?l&&l!==so&&!ps(l)?null:{[e]:[{classNamePrefix:s,value:l,type:"url"}]}:e==="mobileBackgroundRepeat"?{[e]:{classNamePrefix:s,value:l||so}}:{[e]:{classNamePrefix:s,value:l}}}function fo(e){const[i]=Object.keys(e??{});return!i||!Ed(i)?null:$i(i,e[i])}function hs(){return Object.keys(Oi).reduce((e,i)=>({...e,...$i(i,"")}),{})}function bs(e){const i=(e??"").trim(),s=i.match(kd);return s?{position:s[1],unit:s[2]}:{position:i,unit:"px"}}function gs(e,i){return e?isNaN(parseFloat(e))?e:e+i:""}function Ht(e){const i=e??{},s=i.customTable??i;return{type:i.type,usedColors:i.usedColors,mobileBackgroundColor:s.mobileBackgroundColor,mobileBackgroundImage:s.mobileBackgroundImage,mobileBackgroundPositionX:s.mobileBackgroundPositionX,mobileBackgroundPositionY:s.mobileBackgroundPositionY,mobileBackgroundRepeat:s.mobileBackgroundRepeat,mobileBackgroundSize:s.mobileBackgroundSize}}function _o(e){const i=e??{},s=i.customTable??i,l=s.backgroundSize??"";return{image:s.backgroundImage?.[0]?.value??"",positionX:s.backgroundPositionX??"",positionY:s.backgroundPositionY??"",repeat:s.backgroundRepeat??"",size:l==="auto"?"":l}}function to(e){const i=Ht(e),s=i.mobileBackgroundImage?.[0]?.value??"";return{mobileBackgroundImage:s===so?"":s,mobileBackgroundPositionX:i.mobileBackgroundPositionX?.value??"",mobileBackgroundPositionY:i.mobileBackgroundPositionY?.value??"",mobileBackgroundRepeat:i.mobileBackgroundRepeat?.value||so,mobileBackgroundSize:i.mobileBackgroundSize?.value??""}}function Do(e){const i=Ht(e),s=i.mobileBackgroundRepeat?.value;return!!i.mobileBackgroundColor?.value||!!i.mobileBackgroundImage?.[0]?.value||!!i.mobileBackgroundPositionX?.value||!!i.mobileBackgroundPositionY?.value||!!s&&s!==so||!!i.mobileBackgroundSize?.value}function Sd(e,i){return e===so?!1:!!e||!!i}function Vo(e,i,s){e.setFieldsValue({...to({}),mobileBackgroundColor:""}),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Ht(i).type,settings:hs()})}var Bd=/^\d*\.?\d+$/,Rd={bottom:"auto"},fs={marginBottom:0},Td=(0,t.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:o.icons$BgPositionHorizontal}),yd=(0,t.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:o.icons$BgPositionVertical}),wd=e=>e.closest(".email-pane__collapse-wrapper")??e.parentNode,_s=({value:e,onChange:i,inheritedValue:s,options:l,placeholder:a,prefix:d})=>{const c=e||s,[h,g]=(0,n.useState)(()=>bs(c));(0,n.useEffect)(()=>{g(m=>gs(m.position,m.unit)===c?m:bs(c))},[c]);const b=(0,n.useCallback)((m,S)=>{g({position:m,unit:S});const k=l.some(f=>f.value===m);(m===""||k||Bd.test(m))&&i?.(gs(m,S))},[i,l]),x=(0,n.useCallback)(m=>b(m,h.unit),[b,h.unit]),p=(0,n.useCallback)(m=>b(h.position,m),[b,h.position]);return(0,t.jsx)(o.ui_kit$InputSelect,{options:l,position:h.position,setPosition:x,unit:h.unit,setUnit:p,placeholder:a,prefix:d,dropdownStyle:Rd,tooltipTitle:a,getTooltipPopupContainer:wd})},jd=({desktopPositionX:e,desktopPositionY:i})=>{const{__:s}=r.useI18n(),{token:l}=(0,o.ui_kit$useToken)(),a=l.formItemMarginBottomXS,d=(0,n.useMemo)(()=>({marginBottom:a}),[a]);return(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:d,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileBackgroundPositionX",style:fs,children:(0,t.jsx)(_s,{inheritedValue:e,options:Mo.horizontal,placeholder:s("Horizontal position"),prefix:Td})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileBackgroundPositionY",style:fs,children:(0,t.jsx)(_s,{inheritedValue:i,options:Mo.vertical,placeholder:s("Vertical position"),prefix:yd})})})]})},xs=["hover"],ks=e=>document.querySelector(".email-properties__collapse-panel")??e.parentNode,Es=({value:e,emptyValue:i,inheritedValue:s,...l})=>{const a=!!e&&e!==i,d=l.options.some(c=>c.value===s)?s:i;return(0,t.jsx)(o.ui_kit$Select,{...l,value:a?e:d})},vd=({desktopPositionX:e,desktopPositionY:i,desktopRepeat:s,desktopSize:l,backgroundRepeatOptions:a,backgroundSizeOptions:d})=>{const{__:c}=r.useI18n(),{token:h}=(0,o.ui_kit$useToken)(),g=h.formItemMarginBottomXS,b=(0,n.useMemo)(()=>({marginBottom:g}),[g]),x=(0,n.useMemo)(()=>({marginBottom:(g??0)*1.5}),[g]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(jd,{desktopPositionX:e,desktopPositionY:i}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:x,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:xs,title:c("Background image repeat"),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileBackgroundRepeat",style:b,children:(0,t.jsx)(Es,{emptyValue:"none",inheritedValue:s,options:a,placeholder:c("Please choose"),getPopupContainer:ks})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:xs,title:c("Background image size"),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileBackgroundSize",style:b,children:(0,t.jsx)(Es,{emptyValue:"",inheritedValue:l,options:d,placeholder:c("Please choose"),getPopupContainer:ks})})})})]})]})},Id=_i,Cd=({value:e,inheritedImage:i,...s})=>(0,t.jsx)(Id,{...s,value:e||i}),Pd=e=>/^https?:\/\//i.test(e.trim()),Ad=({form:e,name:i="mobileBackgroundImage",placeholder:s="",disabled:l=!1,elementSettings:a,inheritedImage:d="",isImageNone:c=!1,onImageNoneChange:h})=>{const{__:g}=r.useI18n(),{token:b}=(0,o.ui_kit$useToken)(),x=o.ui_kit$Form.useWatch(i,e),[p,m]=(0,n.useState)(""),S=x||d,k=b.formItemMarginBottomXS??0,f=(0,n.useMemo)(()=>({marginBottom:k/2}),[k]);(0,n.useEffect)(()=>{if(!S){m("");return}m(Pd(S)?"validating":"success")},[S]);const y=!!x&&!ps(x),v=y?"error":p;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:i,className:"mobile-background-image-field",validateStatus:v,help:y?g("Enter a URL starting with http:// or https://"):void 0,style:f,children:(0,t.jsx)(Cd,{inheritedImage:d,validateStatus:v,placeholder:s,name:i,disabled:l,elementSettings:a,imageInfo:a,onRemotePreviewValidate:m})}),(0,t.jsx)(o.ui_kit$Switch,{label:g("Without image"),labelSize:"small",size:"small",checked:c,onChange:h})]})},Nd={image:"",positionX:"",positionY:"",repeat:"",size:""},xo=({elementSettings:e,imageEnabled:i=!1,desktopBackground:s=Nd})=>{const{__:l}=r.useI18n(),{token:a}=(0,o.ui_kit$useToken)(),d=o.ui_kit$Form.useFormInstance(),c=a.formItemMarginBottomMD,h=r.useSendPostMessage(),g=e.mobileBackgroundImage?.[0]?.value,[b,x]=(0,n.useState)(g==="none"),p=o.ui_kit$Form.useWatch("mobileBackgroundImage",d);(0,n.useEffect)(()=>{x(g==="none")},[g]),(0,n.useEffect)(()=>{p&&x(!1)},[p]);const m=(0,n.useCallback)(C=>{x(C),d.setFieldsValue({mobileBackgroundImage:""}),h({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:$i("mobileBackgroundImage",C?"none":"")})},[e.type,d,h]),S=(0,n.useMemo)(()=>[{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"}],[l]),k=(0,n.useMemo)(()=>[{label:l("Not defined"),value:""},{label:l("Contain"),value:"contain"},{label:l("Cover"),value:"cover"}],[l]),f=Sd(b?"none":p,s.image),y=(0,n.useMemo)(()=>({marginBottom:f?c:0}),[c,f]),v=(0,n.useMemo)(()=>(0,t.jsx)("div",{style:y,children:(0,t.jsx)(ms,{form:d,elementSettings:e,label:l("Background color")})}),[l,e,d,y]),N=(0,n.useMemo)(()=>(0,t.jsx)("div",{style:y,children:(0,t.jsx)(Ad,{form:d,placeholder:l("Background image"),elementSettings:e,inheritedImage:b?"":s.image,isImageNone:b,onImageNoneChange:m})}),[l,s.image,e,d,m,b,y]),R=(0,n.useMemo)(()=>(0,t.jsx)(vd,{desktopPositionX:s.positionX,desktopPositionY:s.positionY,desktopRepeat:s.repeat,desktopSize:s.size,backgroundRepeatOptions:S,backgroundSizeOptions:k}),[S,k,s.positionX,s.positionY,s.repeat,s.size]);return(0,t.jsx)(o.ui_kit$FormBackgroundSettings,{colorFieldName:"mobileBackgroundColor",colorSlot:v,imageEnabled:i,backgroundImageEmpty:!f,imageUploadSlot:N,imageControlsSlot:R,usedColors:e.usedColors})},Ss=({form:e,elementSettings:i,mobileBoxShadow:s,mobileBordersShow:l,mobileBorderRadiusShow:a,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:h,oneMobileBorderRadiusValue:g,setOneMobileBorderRadiusValue:b,toggleShowMobileBorderHandler:x,toggleShowMobileBorderRadiusHandler:p,toggleShowMobileBoxShadowHandler:m,toggleShowMobileSizeHandler:S,toggleShowMobileBackgroundHandler:k})=>{const{__:f}=r.useI18n(),{token:y}=(0,o.ui_kit$useToken)(),v=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{style:{paddingBottom:4},children:(0,t.jsx)(Mt,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,t.jsx)(o.ui_kit$FormSection,{title:f("Size"),collapsible:!0,open:c,onToggle:S,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:f("Table width"),placement:"left",children:(0,t.jsx)("div",{style:{marginBottom:y.formItemMarginBottomMD+4},children:(0,t.jsx)(Vt,{form:e,name:"mobileWidth",elementSettings:i})})})})})}),(0,t.jsx)(o.ui_kit$FormSection,{title:f("Background"),collapsible:!0,open:h,onToggle:k,dividerTop:!0,children:(0,t.jsx)(xo,{elementSettings:Ht(i),imageEnabled:v.formTableFieldBackgroundImageEnabled,desktopBackground:_o(i)})}),v.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:f("Borders"),collapsible:!0,open:l,onToggle:x,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),v.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:f("Border radius"),collapsible:!0,open:a,onToggle:p,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:g,setOneBorderRadiusValue:b,elementSettings:i})}),v.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:f("Box shadow"),collapsible:!0,open:d,onToggle:m,dividerTop:!0,children:(0,t.jsx)(wt,{typeOfForm:"mobile",form:e,elementSettings:i})}),v.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:f("Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e})}),v.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:f("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};Ss.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,mobileBoxShadow:_.default.object,mobileBordersShow:_.default.bool,mobileBorderRadiusShow:_.default.bool,mobileBoxShadowShow:_.default.bool,mobileSizeShow:_.default.bool,mobileBackgroundShow:_.default.bool,oneMobileBorderRadiusValue:_.default.bool,setOneMobileBorderRadiusValue:_.default.func,toggleShowMobileBorderHandler:_.default.func,toggleShowMobileBorderRadiusHandler:_.default.func,toggleShowMobileBoxShadowHandler:_.default.func,toggleShowMobileSizeHandler:_.default.func,toggleShowMobileBackgroundHandler:_.default.func};var Bs=({elementSettings:e})=>{const{__:i}=r.useI18n(),s=r.useSendPostMessage(),[l]=o.ui_kit$Form.useForm(),a=Lt(),d=Lt(),c=r.useDispatch(),h=r.useElementEntityKind(),[g,b]=(0,n.useState)({}),[x,p]=(0,n.useState)(!0),[m,S]=(0,n.useState)({}),[k,f]=(0,n.useState)(!0),y=r.useSelector(r.selectEmailViewType),v=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[N,R]=(0,n.useState)(e.backgroundImage[0].value===""),C=r.useSelector(r.selectIsCodeMode),F=r.useSelector(r.selectCodeModeDirection),U=C&&F!=="bottom",[$,L]=(0,n.useState)(!1),[P,V]=(0,n.useState)(!1),[ne,T]=(0,n.useState)(!1),[oe,xe]=(0,n.useState)(!1),[be,Se]=(0,n.useState)(!1),[me,he]=(0,n.useState)(!1),[ke,ce]=(0,n.useState)(!1),[ze,Oe]=(0,n.useState)(!1),[ve,Ee]=(0,n.useState)(!1),[pe,Q]=(0,n.useState)(!1),[X,Z]=(0,n.useState)(!1),J=[{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"}],H=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}],M=I=>I&&(I?.width||I?.style||I?.color)?I:"",Y=e.border,K=e.mobileBorder,te=Object.keys(Y).find(I=>Y[I]?.width||Y[I]?.style||Y[I]?.color),le=Object.keys(K).find(I=>K[I]?.width||K[I]?.style||K[I]?.color),{remember:Te,fillFields:Re}=ro(e);(0,n.useEffect)(()=>{if(e){const I=e.boxShadow,se=e.mobileBoxShadow;b(I),S(se),Re(l,{...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:bt(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileAlign:e.mobileAlign?.value,mobileBorderAll:M(e.mobileBorder.all)||!(M(e.mobileBorder.top)||M(e.mobileBorder.bottom)||M(e.mobileBorder.right)||M(e.mobileBorder.left))&&M(e.border.all),mobileBorderTop:M(e.mobileBorder.top)||!M(e.mobileBorder.all)&&M(e.border.top),mobileBorderBottom:M(e.mobileBorder.bottom)||!M(e.mobileBorder.all)&&M(e.border.bottom),mobileBorderRight:M(e.mobileBorder.right)||!M(e.mobileBorder.all)&&M(e.border.right),mobileBorderLeft:M(e.mobileBorder.left)||!M(e.mobileBorder.all)&&M(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:""),...to(e),exportAsPicture:e?.exportAsPicture}),!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?p(!1):p(!0),u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight)?f(!1):f(!0),R(e.backgroundImage[0].value==="");const je=a.isStaleBorderSnapshot(e,!!te),Ne=d.isStaleBorderSnapshot(e,!!le);je&&l.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Ne||je&&!le)&&l.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),L(He=>te&&!je?!0:He),V(He=>te&&!je||le&&!Ne?!0:He),T(!!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),Se(!!e.boxShadow),he(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),ce(!!e.width?.value||!!e.minWidth?.value||!!e.maxWidth?.value),Oe(!!e.mobileWidth.value),Ee(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Q(Do(e)),Z(!!e.exportAsPicture)}},[l,e,te,le,a,d,Re]);const $e=(0,n.useCallback)(I=>{Te(I),c(h==="email"?r.setElementSettings$1(I):r.setElementSettings(I))},[c,h,Te]),z=I=>{const se=l.getFieldsValue(!0),je=Object.keys(I)[0];let Ne;switch(je){case"exportAsPicture":Ne={exportAsPicture:se.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Ne={boxShadow:{hOffset:se.boxShadowHOffset,vOffset:se.boxShadowVOffset,blurRadius:se.boxShadowBlurRadius,spreadRadius:se.boxShadowSpreadRadius,color:se.boxShadowColor,inset:se.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":se.borderPosition==="borderAll"?(Ne={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...se.borderAll}}},l.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):se.borderAll?.width||se.borderAll?.style||se.borderAll?.color?(Ne={border:{all:null,left:se.borderAll,right:se.borderAll,top:se.borderAll,bottom:se.borderAll,[W.REVERSE_BORDER_POSITIONS[je]]:{...se[je],...I[je]}}},l.setFieldsValue({borderAll:null,borderLeft:se.borderAll,borderRight:se.borderAll,borderTop:se.borderAll,borderBottom:se.borderAll,[je]:{...se[je],...I[je]}})):(Ne={border:{all:null,left:se.borderLeft,right:se.borderRight,top:se.borderTop,bottom:se.borderBottom,[W.REVERSE_BORDER_POSITIONS[je]]:{...se[je],...I[je]}}},l.setFieldsValue({border:Ne.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(se.mobileBorderPosition==="mobileBorderAll")Ne={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...se.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[je]+"-"}}},l.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[je],Ke={...se[je],...I[je]},tt=!Ke?.width&&!Ke?.style&&!Ke?.color;if(se.mobileBorder?.all?.width||se.mobileBorder?.all?.style||se.mobileBorder?.all?.color){const O=se.mobileBorderAll;Ne={mobileBorder:{all:null,left:O,right:O,top:O,bottom:O,[He]:tt?null:{...Ke,classNamePrefix:"em-mob-border_"+He+"-"}}},l.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:O,mobileBorderRight:O,mobileBorderTop:O,mobileBorderBottom:O,[je]:Ke})}else{const O=e.mobileBorder||{},ie=j=>{const w=O[j];return w&&(w?.width||w?.style||w?.color)?w:null};Ne={mobileBorder:{all:null,left:He==="left"?tt?null:{...Ke,classNamePrefix:"em-mob-border_left-"}:ie("left"),right:He==="right"?tt?null:{...Ke,classNamePrefix:"em-mob-border_right-"}:ie("right"),top:He==="top"?tt?null:{...Ke,classNamePrefix:"em-mob-border_top-"}:ie("top"),bottom:He==="bottom"?tt?null:{...Ke,classNamePrefix:"em-mob-border_bottom-"}:ie("bottom")}},l.setFieldsValue({[je]:Ke})}}break;case"width":Ne={[je]:{value:I[je],dim:se.widthDim}};break;case"widthDim":Ne={width:{value:se.width,dim:I[je]}};break;case"maxWidth":Ne={[je]:{value:I[je],dim:se.maxWidthDim}};break;case"maxWidthDim":Ne={maxWidth:{value:se.maxWidth,dim:I[je]}};break;case"minWidth":Ne={[je]:{value:I[je],dim:se.minWidthDim}};break;case"minWidthDim":Ne={minWidth:{value:se.minWidth,dim:I[je]}};break;case"backgroundImage":R(I[je]===""),Ne={[je]:[{...e.backgroundImage[0],value:I[je]}],backgroundSize:"cover"};break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Ne={borderRadius:{[W.BORDER_RADIUS_POSITION[je]]:+I[je]}};break;case"mobileWidth":Ne={[je]:{classNamePrefix:"em-mob-width-",value:I[je],dim:se.mobileWidthDim}};break;case"mobileWidthDim":Ne={mobileWidth:{classNamePrefix:"em-mob-width-",value:se.mobileWidth||100,dim:I[je]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Ne={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[je]]:I[je],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[je]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Ne={mobileBoxShadow:{hOffset:se.mobileBoxShadowHOffset,vOffset:se.mobileBoxShadowVOffset,blurRadius:se.mobileBoxShadowBlurRadius,spreadRadius:se.mobileBoxShadowSpreadRadius,color:se.mobileBoxShadowColor,inset:se.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Ne=fo(I),!Ne)return;break;case"mobileAlign":Ne={[je]:{classNamePrefix:"em-mob-table_align-",value:I[je]}};break;default:Ne=I}je!=="borderPosition"&&je!=="mobileBorderPosition"&&(s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ne}),je!=="mobileBorderRadiusAll"&&je!=="mobileBorderRadiusTopLeft"&&je!=="mobileBorderRadiusTopRight"&&je!=="mobileBorderRadiusBottomLeft"&&je!=="mobileBorderRadiusBottomRight"&&$e({...e,...Ne,mobileBorderRadius:{...e.mobileBorderRadius,...Ne?.mobileBorderRadius},activateSection:null,changeKey:je}))},re=()=>{const I=l.getFieldsValue(!0);a.markBorderToggled(!$),setTimeout(()=>{L(se=>!se),$?(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"},s({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}}}})})},Ce=()=>{const I=l.getFieldsValue(!0);d.markBorderToggled(!P),setTimeout(()=>{V(se=>!se),P?(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"},s({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}}}})})},G=()=>{const I=l.getFieldsValue(!0);setTimeout(()=>{T(se=>!se),ne?(I.borderRadiusAll=0,p(!0)):I.borderRadiusAll=5,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:I.borderRadiusAll}}})})},Be=()=>{const I=l.getFieldsValue(!0);setTimeout(()=>{xe(se=>!se),oe?(I.mobileBorderRadiusAll=null,f(!0)):I.mobileBorderRadiusAll=5,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:I.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},Fe=()=>{const I=l.getFieldsValue(!0);setTimeout(()=>{Se(se=>!se),be?(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"),s({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}}})})},Ae=()=>{const I=l.getFieldsValue(!0);setTimeout(()=>{he(se=>!se),me?(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"),s({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-"}}})})},Ve=()=>{const I=l.getFieldsValue(!0);setTimeout(()=>{ce(se=>!se),ke&&(I.width="",I.minWidth="",I.maxWidth="",s({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"}}}))})},Ue=()=>{const I=l.getFieldsValue(!0);setTimeout(()=>{Oe(se=>!se),ze&&(I.mobileWidth="",s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"}}}))})},Xe=()=>{const I=l.getFieldsValue(!0);setTimeout(()=>{Ee(se=>!se),ve?(I.backgroundColor="",I.backgroundImage="",I.backgroundPositionX="",I.backgroundPositionY="",I.backgroundRepeat="none",I.backgroundSize="",R(!0)):(I.backgroundColor="#E5E5E5",I.backgroundSize="",I.backgroundRepeat="none"),s({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}})})},de=()=>{const I=l.getFieldsValue(!0);setTimeout(()=>{Q(se=>!se),pe?I.mobileBackgroundColor="":I.mobileBackgroundColor="#E5E5E5",s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:I.mobileBackgroundColor}}}),pe&&Vo(l,e,s)})},ye=()=>{const I=l.getFieldsValue(!0);setTimeout(()=>{Z(se=>!se),X&&(I.exportAsPicture=!1,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})};return(0,t.jsxs)(o.ui_kit$Form,{form:l,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[te]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[le]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileBackgroundColor:"",mobileBackgroundImage:""},onValuesChange:z,autoComplete:"off",className:"element-controls",children:[!U&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),y==="mobile"&&v.styles?(0,t.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,t.jsx)(Ss,{form:l,elementSettings:e,mobileBoxShadow:m,mobileBordersShow:P,mobileBorderRadiusShow:oe,mobileBoxShadowShow:me,mobileSizeShow:ze,mobileBackgroundShow:pe,oneMobileBorderRadiusValue:k,setOneMobileBorderRadiusValue:f,toggleShowMobileBorderHandler:Ce,toggleShowMobileBorderRadiusHandler:Be,toggleShowMobileBoxShadowHandler:Ae,toggleShowMobileSizeHandler:Ue,toggleShowMobileBackgroundHandler:de})," "]}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(us,{form:l,elementSettings:e,boxShadow:g,bordersShow:$,borderRadiusShow:ne,boxShadowShow:be,backgroundShow:ve,backgroundImageEmpty:N,backgroundRepeatOptions:J,backgroundSizeOptions:H,sizeShow:ke,modificationShow:X,oneBorderRadiusValue:x,setOneBorderRadiusValue:p,toggleShowBorderHandler:re,toggleShowBorderRadiusHandler:G,toggleShowBoxShadowHandler:Fe,toggleShowSizeHandler:Ve,toggleShowBackgroundHandler:Xe,toggleShowModificationHandler:ye})})]})};Bs.propTypes={elementSettings:_.default.object.isRequired};var Rs=({elementSettings:e})=>{const{__:i}=r.useI18n(),s=r.useSendPostMessage(),[l]=o.ui_kit$Form.useForm(),a=r.useAppConfig(),d=r.useSelector(r.selectIsCodeMode),c=r.useSelector(r.selectCodeModeDirection),[h,g]=(0,n.useState)({}),[b,x]=(0,n.useState)("https://"),p=({target:k})=>{const{selectionStart:f,selectionEnd:y}=k;k&&g({target:k,selection:{start:f,end:y}})};(0,n.useEffect)(()=>{if(e){let k="",f="",y=e.href==null?"https://":e.href;if(y&&y.substring(0,7)==="mailto:"){const v=new URL(e.href);k=v.searchParams.get("subject")||"",f=v.searchParams.get("body")||"",y=e.href.split("?")[0],x("mailto:")}else e.href&&(e.href.substring(0,8)==="https://"||e.href.substring(0,7)==="http://"?x("https://"):e.href.substring(0,4)==="tel:"?x("tel:"):e.href.substring(0,4)==="sms:"?x("sms:"):e.href.substring(0,6)==="ftp://"?x("ftp://"):x(""));l.setFieldsValue({...e,href:y,subject:k,body:f})}},[l,e]);const m=k=>{const f=Object.keys(k)[0];let y=k;if(f==="href"){const v=Jt(k[f]);if(v!==k[f]&&l.setFieldValue("href",v),v.substring(0,7)==="mailto:"){const N=l.getFieldValue("subject"),R=l.getFieldValue("body"),C=[];N&&C.push(`subject=${encodeURIComponent(N)}`),R&&C.push(`body=${encodeURIComponent(R)}`),y={href:C.length>0?`${v}?${C.join("&")}`:v}}else y={href:v}}if(f==="subject"||f==="body"){const v=l.getFieldValue("href")||"";if(v.substring(0,7)==="mailto:"){const N=v.split("?")[0],R=f==="subject"?k[f]:l.getFieldValue("subject"),C=f==="body"?k[f]:l.getFieldValue("body"),F=[];R&&F.push(`subject=${encodeURIComponent(R)}`),C&&F.push(`body=${encodeURIComponent(C)}`),y={href:F.length>0?`${N}?${F.join("&")}`:N}}else return}s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:y})},S=k=>{s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:k})};return(0,t.jsx)(o.ui_kit$Form,{form:l,layout:"vertical",name:"selected_link_form",initialValues:{href:"https://",target:"",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1,textReplacer:"",subject:"",body:""},onValuesChange:m,autoComplete:"off",className:"element-controls",children:!d||c==="bottom"?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Hyperlink URL"),placement:"left",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"href",style:{marginBottom:24,paddingRight:10},children:(0,t.jsx)(o.ui_kit$Input,{allowClear:!0,placeholder:i("Hyperlink URL"),prefix:(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined}),onSelect:p})})}),a.formLinkFieldInsertImageEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:i("Actions with the chosen text"),dividerTop:!0,children:(0,t.jsx)(o.ui_kit$Form.Item,{children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(r.EmIcons,{icon:"PicLeftOutlined",component:o.icons$PicLeftOutlined}),onClick:()=>S("add_img"),children:i("Add inline image")})})}),(0,t.jsx)(go,{form:l,elementSettings:e,showAddParagraph:!1,linkTarget:h,linkProtocol:b,setLinkProtocol:x})]}):(0,t.jsx)(Ni,{form:l,elementSettings:e,showAddParagraph:!1})})};Rs.propTypes={elementSettings:_.default.object.isRequired};var Ts=()=>{const{__:e}=r.useI18n();return(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:14,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"height",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:e("Indent height"),prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:o.icons$ColumnHeightOutlined}),addonAfter:"px"})})})})};Ts.propTypes={};var ys=({form:e,elementSettings:i})=>(0,t.jsx)(o.ui_kit$Row,{gutter:10,style:{marginBottom:20},children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Qt,{form:e,name:"mobileHeight",elementSettings:i})})});ys.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired};var ws=({elementSettings:e})=>{const{__:i}=r.useI18n(),[s]=o.ui_kit$Form.useForm(),l=r.useDispatch(),a=r.useSendPostMessage(),d=r.useSelector(r.selectEmailViewType),c=r.useSelector(r.selectMobileViewActive),h=r.useSelector(r.selectIsCodeMode),g=r.useSelector(r.selectCodeModeDirection),b=h&&g!=="bottom",x=r.useElementEntityKind(),{remember:p,fillFields:m}=ro(e);(0,n.useEffect)(()=>{e&&m(s,{...e,height:e.height?.value,heightDim:e.height?.dim,mobileHeight:bt(e.mobileHeight?.value||e.height?.value),mobileHeightDim:e.mobileHeight?.dim||e.height?.dim})},[s,e,m]);const S=(0,n.useCallback)(f=>{p(f),l(x==="email"?r.setElementSettings$1(f):r.setElementSettings(f))},[l,x,p]),k=f=>{const y=s.getFieldsValue(!0),v=Object.keys(f)[0];let N;switch(v){case"height":N={[v]:{value:f[v],dim:y.heightDim}};break;case"heightDim":N={height:{value:y.height,dim:f[v]}};break;case"mobileHeight":N={[v]:{classNamePrefix:"em-mob-height-",value:f[v],dim:y.mobileHeightDim}};break;case"mobileHeightDim":N={mobileHeight:{classNamePrefix:"em-mob-height-",value:y.mobileHeight,dim:f[v]}};break;default:N=f}a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:N}),S({...e,...N,activateSection:null,changeKey:v})};return(0,t.jsxs)(o.ui_kit$Form,{form:s,layout:"vertical",name:"selected_vindent_form",initialValues:{height:"",heightDim:"",mobileHeight:"",mobileHeightDim:""},onValuesChange:k,autoComplete:"off",children:[!b&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),d==="mobile"&&c.styles?(0,t.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,t.jsx)(ys,{form:s,elementSettings:e})}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",style:{display:d==="mobile"&&c.styles?"none":"block"},children:(0,t.jsx)(Ts,{})})]})};ws.propTypes={elementSettings:_.default.object.isRequired};var Ho=({form:e,elementSettings:i,typeOfForm:s="desktop"})=>{const l=r.useSendPostMessage(),a=s==="mobile",d=a?"mobileDirection":"direction",c=g=>{e.setFieldsValue({[d]:g}),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[d]:g}})},h=a?i.mobileDirection?.value??"":i.direction??"";return(0,t.jsx)(o.ui_kit$Form.Item,{name:d,className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$FormDirectionControl,{value:h,onChange:c})})},Uo=e=>e.closest(".email-pane__collapse-wrapper")||e.parentNode,Fi=({form:e,backgroundImageEmpty:i,appConfig:s,token:l,elementSettings:a,backgroundRepeatOptions:d,handleChangeValues:c})=>{const{__:h}=r.useI18n(),[g,b]=(0,n.useState)(""),[x,p]=(0,n.useState)("px"),[m,S]=(0,n.useState)(""),[k,f]=(0,n.useState)("px"),y=[{label:h("Not defined"),value:""},{label:h("Contain"),value:"contain"},{label:h("Cover"),value:"cover"}],v=C=>{if(!C||typeof C!="string")return{value:"",unit:"px"};C=C.trim();const F=C.match(/^(\d*\.?\d+)(%|px)$/);return F?{value:F[1],unit:F[2]}:{value:C,unit:"px"}};(0,n.useEffect)(()=>{const C=e.getFieldValue("backgroundPositionX"),F=e.getFieldValue("backgroundPositionY"),U=v(C),$=v(F);b(String(U.value)),p(U.unit),S(String($.value)),f($.unit)},[e]);const N=(C,F)=>{b(String(C)),p(F),c&&c({backgroundPositionX:{position:C,unit:F}})},R=(C,F)=>{S(String(C)),f(F),c&&c({backgroundPositionY:{position:C,unit:F}})};return(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:8},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:h("Background color"),placement:"bottom",getPopupContainer:Uo,children:(0,t.jsx)("div",{children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"backgroundColor",style:{marginBottom:l.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:h("Background color"),usedColors:a.usedColors,placement:"bottomLeft"})})})})}),s.formCellFieldBackgroundImageEnabled&&(0,t.jsxs)(o.ui_kit$Col,{span:i?12:24,children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:h("Background image"),placement:"bottom",getPopupContainer:Uo,children:(0,t.jsx)("div",{children:(0,t.jsx)(Pt,{form:e,label:h("Background image"),name:"backgroundImage",tooltipTitle:h("Background image"),placeholder:h("Background image link/route")})})}),!i&&(0,t.jsxs)(o.ui_kit$Form.Item,{style:{marginBottom:"0"},children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:l.formItemMarginBottomXS},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$InputSelect,{options:Mo.horizontal,position:g,setPosition:C=>N(C,x),unit:x,setUnit:C=>N(g,C),placeholder:h("Horizontal position"),prefix:(0,t.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:o.icons$BgPositionHorizontal}),dropdownStyle:{bottom:"auto"},tooltipTitle:h("Horizontal position"),getTooltipPopupContainer:Uo})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$InputSelect,{options:Mo.vertical,position:m,setPosition:C=>R(C,k),unit:k,setUnit:C=>R(m,C),placeholder:h("Vertical position"),prefix:(0,t.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:o.icons$BgPositionVertical}),dropdownStyle:{bottom:"auto"},tooltipTitle:h("Vertical position"),getTooltipPopupContainer:Uo})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:h("Background image repeat"),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"backgroundRepeat",style:{marginBottom:l.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Select,{placeholder:h("Please choose"),options:d,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:h("Background image size"),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"backgroundSize",style:{marginBottom:l.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Select,{placeholder:h("Please choose"),options:y,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})})]})]})]})]})},Ld=({form:e,elementSettings:i,__:s,appConfig:l})=>{const a=W.useGoogleFontsLoader(),[d,c]=(0,n.useState)(null);return(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&c(!0)},[]),(0,t.jsxs)("div",{style:{marginBottom:"-15px"},children:[l.formTextFieldTypografEnabled&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:s("Text font"),placement:"bottom",zIndex:1,getPopupContainer:h=>h.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:a,getPopupContainer:h=>h.closest(".email-pane__collapse-wrapper")})})}),!i.showOnMobile&&(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:s("Font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:s("Font size"),prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:s("Line height"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"lineHeight",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:s("Line height"),prefix:(0,t.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:s(d?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(r.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:s(d?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:s(d?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:s(d?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:s("Text color"),placement:"bottom",zIndex:2,getPopupContainer:h=>h.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",rules:[{message:s("Please set the font color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:s("Color"),usedColors:i.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:s("Text background"),placement:"bottom",zIndex:2,getPopupContainer:h=>h.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:s("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:s("Background color"),usedColors:i.usedColors})})})})]})]})},js=({form:e,elementSettings:i,boxShadow:s,bordersShow:l,borderRadiusShow:a,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:h,backgroundRepeatOptions:g,sizeShow:b,maxWidthValue:x,modificationShow:p,paddingsExt:m,oneBorderRadiusValue:S,setOneBorderRadiusValue:k,elementListShow:f,togglePaddingHandler:y,toggleShowBorderHandler:v,toggleShowBorderRadiusHandler:N,toggleShowBoxShadowHandler:R,toggleShowSizeHandler:C,toggleShowBackgroundHandler:F,toggleShowModificationHandler:U,handleChangeValues:$})=>{const{__:L}=r.useI18n(),{token:P}=(0,o.ui_kit$useToken)(),V=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Zt,{form:e,elementSettings:i})}),V.formCellFieldVerticalAlignEnabled&&i.type!=="group"&&(i.type!=="structure"||i.type==="structure"&&i.floatBlocks.items.length===1)&&(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Ot,{form:e,elementSettings:i})})]}),V.formCellFieldPaddingsEnabled&&(0,t.jsxs)(t.Fragment,{children:[f&&(0,t.jsx)("div",{style:{marginTop:"15px"},children:(0,t.jsx)(Ld,{form:e,elementSettings:i,appConfig:V,__:L})}),(0,t.jsx)(o.ui_kit$FormSection,{title:L("Padding"),dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormPaddingInputs,{extended:m,onToggleExtended:y,showHorizontal:i.type!=="group"&&i.type!=="column",rowStyle:{paddingBottom:4},labels:{horizontal:L("Horizontal padding"),vertical:L("Vertical padding"),left:L("Left padding"),right:L("Right padding"),top:L("Top padding"),bottom:L("Bottom padding"),individual:L("Individual padding")}})})]}),i.type!=="group"&&V.formCellFieldSizeEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:L("Size"),collapsible:!0,open:b,onToggle:C,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormSizeInputs,{showWidth:i.type!=="structure"&&i.type!=="column",maxWidth:x,dimensionSelect:Nt,rowStyle:{paddingBottom:4},labels:{width:L("Width"),height:L("Height"),minWidth:L("Minimum width"),maxWidth:L("Maximum width")}})}),(0,t.jsxs)(o.ui_kit$FormSection,{title:L("Background"),collapsible:!0,open:c,onToggle:F,dividerTop:!0,children:[(0,t.jsx)(Fi,{form:e,backgroundImageEmpty:h,appConfig:V,token:P,elementSettings:i,backgroundRepeatOptions:g,handleChangeValues:$}),(0,t.jsx)(eo,{form:e,showBackground:!0})]}),V.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:L("Borders"),collapsible:!0,open:l,onToggle:v,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),V.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:L("Border radius"),collapsible:!0,open:a,onToggle:N,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:S,setOneBorderRadiusValue:k,elementSettings:i})}),V.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:L("Box shadow"),collapsible:!0,open:d,onToggle:R,dividerTop:!0,children:(0,t.jsx)(wt,{})}),V.formFieldExportAsPictureEnabled&&i.type!=="group"&&(0,t.jsxs)(o.ui_kit$FormSection,{title:L("Settings"),collapsible:!0,open:p,onToggle:U,dividerTop:!0,children:[i.type==="structure"&&(0,t.jsx)(o.ui_kit$Tooltip,{title:L("The block will change its colors to contrasting colors. You can change them in the Content Styles section."),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"isContrastBlock",valuePropName:"checked",style:{marginBottom:0},children:(0,t.jsx)(o.ui_kit$Switch,{id:"contrast-colors",label:L("Contrast block"),size:"small",labelStyle:{position:"relative",top:2}})})},"isContrastBlock"),(0,t.jsx)(Li,{form:e,elementSettings:i})]}),V.formFieldVisibilityEnabled&&i.type!=="column"&&(0,t.jsx)(o.ui_kit$FormSection,{title:L(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,t.jsx)(Ho,{elementSettings:i,form:e}):void 0})}),V.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:L("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};js.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,boxShadow:_.default.object,bordersShow:_.default.bool,borderRadiusShow:_.default.bool,boxShadowShow:_.default.bool,backgroundShow:_.default.bool,backgroundImageEmpty:_.default.bool,backgroundRepeatOptions:_.default.array,sizeShow:_.default.bool,maxWidthValue:_.default.oneOfType([_.default.string,_.default.number]),modificationShow:_.default.bool,paddingsExt:_.default.bool,oneBorderRadiusValue:_.default.bool,setOneBorderRadiusValue:_.default.func,elementListShow:_.default.bool,togglePaddingHandler:_.default.func,toggleShowBorderHandler:_.default.func,toggleShowBorderRadiusHandler:_.default.func,toggleShowBoxShadowHandler:_.default.func,toggleShowSizeHandler:_.default.func,toggleShowBackgroundHandler:_.default.func,toggleShowModificationHandler:_.default.func,handleChangeValues:_.default.func};var Wo=({form:e,elementSettings:i,mobilePaddingsExt:s,setMobilePaddingsExt:l,rowStyle:a})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),h=()=>{l(b=>!b);const g=e.getFieldsValue(!0);s||(g.mobilePaddingLeftRight=g.mobilePaddingLeft,g.mobilePaddingTopBottom=g.mobilePaddingTop,g.mobilePaddingRight=g.mobilePaddingLeft,g.mobilePaddingBottom=g.mobilePaddingTop,c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobilePadding:{top:g.mobilePaddingTop!==""?g.mobilePaddingTop:null,bottom:g.mobilePaddingTopBottom!==""?g.mobilePaddingTopBottom:null,left:g.mobilePaddingLeft!==""?g.mobilePaddingLeft:null,right:g.mobilePaddingRight!==""?g.mobilePaddingRight:null,classNamePrefix:"em-mob-padding_"}}}))};return(0,t.jsx)(o.ui_kit$FormPaddingInputs,{typeOfForm:"mobile",extended:s,onToggleExtended:h,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")}})};Wo.propTypes={form:_.default.shape({getFieldsValue:_.default.func.isRequired}).isRequired,elementSettings:_.default.object.isRequired,mobilePaddingsExt:_.default.bool.isRequired,setMobilePaddingsExt:_.default.func.isRequired,rowStyle:_.default.object};var vs=({form:e,elementSettings:i,boxShadow:s,mobileBordersShow:l,mobileBorderRadiusShow:a,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:h,mobilePaddingShow:g,mobilePaddingsExt:b,setMobilePaddingsExt:x,oneMobileBorderRadiusValue:p,setOneMobileBorderRadiusValue:m,toggleShowMobileBorderHandler:S,toggleShowMobileBorderRadiusHandler:k,toggleShowMobileBoxShadowHandler:f,toggleShowMobileSizeHandler:y,toggleShowMobileBackgroundHandler:v,toggleShowMobilePaddingHandler:N})=>{const{__:R}=r.useI18n(),C=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:20,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Mt,{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,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Ot,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),C.formCellFieldPaddingsEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:R("Padding"),collapsible:!0,open:g,onToggle:N,dividerTop:!0,children:(0,t.jsx)(Wo,{form:e,elementSettings:i,mobilePaddingsExt:b,setMobilePaddingsExt:x,rowStyle:{paddingBottom:4}})}),i.type!=="group"&&C.formCellFieldSizeEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:R("Size"),collapsible:!0,open:c,onToggle:y,dividerTop:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:9},children:[i.type!=="structure"&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)("div",{style:{marginBottom:15},children:(0,t.jsx)(Vt,{form:e,name:"mobileWidth",elementSettings:i})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)("div",{style:{marginBottom:15},children:(0,t.jsx)(Qt,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:R("Background"),collapsible:!0,open:h,onToggle:v,dividerTop:!0,children:(0,t.jsx)(xo,{elementSettings:Ht(i),imageEnabled:C.formCellFieldBackgroundImageEnabled,desktopBackground:_o(i)})}),C.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:R("Borders"),collapsible:!0,open:l,onToggle:S,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),C.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:R("Border radius"),collapsible:!0,open:a,onToggle:k,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:p,setOneBorderRadiusValue:m,elementSettings:i,typeOfForm:"mobile"})}),C.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:R("Box shadow"),collapsible:!0,open:d,onToggle:f,dividerTop:!0,children:(0,t.jsx)(wt,{typeOfForm:"mobile"})}),C.formFieldVisibilityEnabled&&i.type!=="column"&&(0,t.jsx)(o.ui_kit$FormSection,{title:R(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,t.jsx)(Ho,{elementSettings:i,form:e,typeOfForm:"mobile"}):void 0})}),C.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:R("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};vs.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,boxShadow:_.default.object,mobileBordersShow:_.default.bool,mobileBorderRadiusShow:_.default.bool,mobileBoxShadowShow:_.default.bool,mobileSizeShow:_.default.bool,mobileBackgroundShow:_.default.bool,mobilePaddingShow:_.default.bool,mobilePaddingsExt:_.default.bool,setMobilePaddingsExt:_.default.func,oneMobileBorderRadiusValue:_.default.bool,setOneMobileBorderRadiusValue:_.default.func,toggleShowMobileBorderHandler:_.default.func,toggleShowMobileBorderRadiusHandler:_.default.func,toggleShowMobileBoxShadowHandler:_.default.func,toggleShowMobileSizeHandler:_.default.func,toggleShowMobileBackgroundHandler:_.default.func,toggleShowMobilePaddingHandler:_.default.func};var Is=({elementSettings:e})=>{const{__:i}=r.useI18n(),s=r.useSendPostMessage(),l=r.useDispatch(),[a]=o.ui_kit$Form.useForm(),d=Lt(),c=Lt(),[h,g]=(0,n.useState)(""),[b,x]=(0,n.useState)({}),[p,m]=(0,n.useState)(!0),[S,k]=(0,n.useState)(!0),f=r.useSelector(r.selectEmailViewType),y=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[v,N]=(0,n.useState)(e.backgroundImage[0].value===""),R=r.useSelector(r.selectIsCodeMode),C=r.useSelector(r.selectCodeModeDirection),F=R&&C!=="bottom",[U,$]=(0,n.useState)(!1),[L,P]=(0,n.useState)(!1),[V,ne]=(0,n.useState)(!1),[T,oe]=(0,n.useState)(!1),[xe,be]=(0,n.useState)(!1),[Se,me]=(0,n.useState)(!1),[he,ke]=(0,n.useState)(!1),[ce,ze]=(0,n.useState)(!1),[Oe,ve]=(0,n.useState)(!1),[Ee,pe]=(0,n.useState)(!1),[Q,X]=(0,n.useState)(!1),[Z,J]=(0,n.useState)(!1),[H,M]=(0,n.useState)(!1),[Y,K]=(0,n.useState)(!1),[te,le]=(0,n.useState)(!1),Te=r.useElementEntityKind(),Re=[{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,z=e.mobileBorder,re=Object.keys($e).find(j=>$e[j]?.width||$e[j]?.style||$e[j]?.color),Ce=Object.keys(z).find(j=>z[j]?.width||z[j]?.style||z[j]?.color),G=j=>j&&(j?.width||j?.style||j?.color)?j:"",{remember:Be,fillFields:Fe}=ro(e);(0,n.useEffect)(()=>{if(e){const j=e.boxShadow;x(j),Fe(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:G(e.mobileBorder.all)||!(G(e.mobileBorder.top)||G(e.mobileBorder.bottom)||G(e.mobileBorder.right)||G(e.mobileBorder.left))&&G(e.border.all),mobileBorderTop:G(e.mobileBorder.top)||!G(e.mobileBorder.all)&&G(e.border.top),mobileBorderBottom:G(e.mobileBorder.bottom)||!G(e.mobileBorder.all)&&G(e.border.bottom),mobileBorderRight:G(e.mobileBorder.right)||!G(e.mobileBorder.all)&&G(e.border.right),mobileBorderLeft:G(e.mobileBorder.left)||!G(e.mobileBorder.all)&&G(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:bt(e.mobileWidth?.value)||bt(e.width?.value),mobileWidthDim:bt(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:bt(e.mobileHeight?.value)||bt(e.height?.value),mobileHeightDim:bt(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||""),...to(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))?m(!1):m(!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))?k(!1):k(!0),N(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)?$(!1):$(!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)?P(!1):P(!0);const w=d.isStaleBorderSnapshot(e,!!re),ue=c.isStaleBorderSnapshot(e,!!Ce);w&&a.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(ue||w&&!Ce)&&a.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),ne(Ie=>re&&!w?!0:Ie),oe(Ie=>re&&!w||Ce&&!ue?!0:Ie),be(!!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.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),ke(!!e.boxShadow),ze(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),ve(!!e.width.value&&e.type!=="column"||!!e.height.value),pe(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value&&e.type!=="column"||!!e.height.value),X(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),J(!!e.mobileBackgroundColor.value||!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Do(e)&&J(!0),M(!!e.exportAsPicture||!!e.isContrastBlock),K(!!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"?le(!0):le(!1)}},[a,e,re,Ce,d,c,Fe]);const Ae=(0,n.useCallback)(j=>{Be(j),l(Te==="email"?r.setElementSettings$1(j):r.setElementSettings(j))},[l,Te,Be]),Ve=j=>{const w=a.getFieldsValue(!0),ue=Object.keys(j)[0];let Ie;switch(g(a.getFieldsValue(!0).widthDim==="%"?100:""),ue){case"exportAsPicture":Ie={exportAsPicture:w.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Ie={boxShadow:{hOffset:w.boxShadowHOffset,vOffset:w.boxShadowVOffset,blurRadius:w.boxShadowBlurRadius,spreadRadius:w.boxShadowSpreadRadius,color:w.boxShadowColor,inset:w.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":w.borderPosition==="borderAll"?(Ie={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...w.borderAll}}},a.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):w.borderAll?.width||w.borderAll?.style||w.borderAll?.color?(Ie={border:{all:null,left:w.borderAll,right:w.borderAll,top:w.borderAll,bottom:w.borderAll,[W.REVERSE_BORDER_POSITIONS[ue]]:{...w[ue],...j[ue]}}},a.setFieldsValue({borderAll:null,borderLeft:w.borderAll,borderRight:w.borderAll,borderTop:w.borderAll,borderBottom:w.borderAll,[ue]:{...w[ue],...j[ue]}})):(Ie={border:{all:null,left:w.borderLeft,right:w.borderRight,top:w.borderTop,bottom:w.borderBottom,[W.REVERSE_BORDER_POSITIONS[ue]]:{...w[ue],...j[ue]}}},a.setFieldsValue({border:Ie.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(w.mobileBorderPosition==="mobileBorderAll")Ie={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...w.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[ue]+"-"}}},a.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const qe=W.MOBILE_REVERSE_BORDER_POSITIONS[ue],Ze={...w[ue],...j[ue]},dt=!Ze?.width&&!Ze?.style&&!Ze?.color;if(w.mobileBorder?.all?.width||w.mobileBorder?.all?.style||w.mobileBorder?.all?.color){const st=w.mobileBorderAll;Ie={mobileBorder:{all:null,left:st,right:st,top:st,bottom:st,[qe]:dt?null:{...Ze,classNamePrefix:"em-mob-border_"+qe+"-"}}},a.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:st,mobileBorderRight:st,mobileBorderTop:st,mobileBorderBottom:st,[ue]:Ze})}else{const st=e.mobileBorder||{},ct=kt=>{const St=st[kt];return St&&(St?.width||St?.style||St?.color)?St:null};Ie={mobileBorder:{all:null,left:qe==="left"?dt?null:{...Ze,classNamePrefix:"em-mob-border_left-"}:ct("left"),right:qe==="right"?dt?null:{...Ze,classNamePrefix:"em-mob-border_right-"}:ct("right"),top:qe==="top"?dt?null:{...Ze,classNamePrefix:"em-mob-border_top-"}:ct("top"),bottom:qe==="bottom"?dt?null:{...Ze,classNamePrefix:"em-mob-border_bottom-"}:ct("bottom")}},a.setFieldsValue({[ue]:Ze})}}break;case"width":Ie={[ue]:{value:j[ue],dim:w.widthDim}};break;case"height":Ie={[ue]:{value:j[ue],dim:w.heightDim}};break;case"widthDim":Ie={width:{value:w.width,dim:j[ue]}};break;case"heightDim":Ie={height:{value:w.height,dim:j[ue]}};break;case"backgroundImage":N(j[ue]===""),Ie={[ue]:[{...e.backgroundImage[0],value:j[ue]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":Ie={padding:{left:w.paddingLeft,right:w.paddingRight,top:w.paddingTop,bottom:w.paddingBottom,[W.PADDING_POSITION[ue]]:+j[ue]}};break;case"paddingTopBottom":Ie={padding:{left:w.paddingLeft,right:w.paddingRight,top:+j[ue],bottom:+j[ue]}},w.paddingTop=w.paddingBottom=+j[ue];break;case"paddingLeftRight":Ie={padding:{top:w.paddingTop,bottom:w.paddingBottom,left:+j[ue],right:+j[ue]}},w.paddingLeft=w.paddingRight=+j[ue];break;case"borderRadiusAll":Ie={borderRadius:{[W.BORDER_RADIUS_POSITION[ue]]:+j[ue]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Ie={borderRadius:{topLeft:w.borderRadiusTopLeft,bottomLeft:w.borderRadiusBottomLeft,topRight:w.borderRadiusTopRight,bottomRight:w.borderRadiusBottomRight,[W.BORDER_RADIUS_POSITION[ue]]:+j[ue]}};break;case"mobileWidth":Ie={[ue]:{classNamePrefix:"em-mob-width-",value:j[ue],dim:w.mobileWidthDim}};break;case"mobileWidthDim":Ie={mobileWidth:{classNamePrefix:"em-mob-width-",value:w.mobileWidth||100,dim:j[ue]}};break;case"mobileHeight":Ie={[ue]:{classNamePrefix:"em-mob-height-",value:j[ue],dim:w.mobileHeightDim}};break;case"mobileHeightDim":Ie={mobileHeight:{classNamePrefix:"em-mob-height-",value:w.mobileHeight,dim:j[ue]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Ie={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[ue]]:j[ue],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[ue]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Ie={mobileBoxShadow:{hOffset:w.mobileBoxShadowHOffset,vOffset:w.mobileBoxShadowVOffset,blurRadius:w.mobileBoxShadowBlurRadius,spreadRadius:w.mobileBoxShadowSpreadRadius,color:w.mobileBoxShadowColor,inset:w.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":Ie={[ue]:{classNamePrefix:"em-mob-text_align-",value:j[ue]}};break;case"mobileVerticalAlign":Ie={[ue]:{classNamePrefix:"em-mob-vertical_align-",value:j[ue]}};break;case"mobileDirection":Ie={[ue]:{classNamePrefix:"em-mob-direction-",value:j[ue]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Ie=fo(j),!Ie)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":Ie={mobilePadding:{all:null,top:w.mobilePaddingTop!==""?w.mobilePaddingTop:null,right:w.mobilePaddingRight!==""?w.mobilePaddingRight:null,bottom:w.mobilePaddingBottom!==""?w.mobilePaddingBottom:null,left:w.mobilePaddingLeft!==""?w.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":w.mobilePaddingTop=w.mobilePaddingBottom=j[ue],Ie={mobilePadding:{all:null,top:w.mobilePaddingTop!==""?w.mobilePaddingTop:null,right:w.mobilePaddingRight!==""?w.mobilePaddingRight:null,bottom:w.mobilePaddingBottom!==""?w.mobilePaddingBottom:null,left:w.mobilePaddingLeft!==""?w.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":w.mobilePaddingLeft=w.mobilePaddingRight=j[ue],Ie={mobilePadding:{all:null,top:w.mobilePaddingTop!==""?w.mobilePaddingTop:null,right:w.mobilePaddingRight!==""?w.mobilePaddingRight:null,bottom:w.mobilePaddingBottom!==""?w.mobilePaddingBottom:null,left:w.mobilePaddingLeft!==""?w.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"backgroundPositionX":case"backgroundPositionY":Ie={[ue]:isNaN(parseFloat(j[ue].position))?j[ue].position:j[ue].position+j[ue].unit};break;default:Ie=j}ue!=="borderPosition"&&ue!=="mobileBorderPosition"&&(s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ie}),ue!=="mobileBorderRadiusAll"&&ue!=="mobileBorderRadiusTopLeft"&&ue!=="mobileBorderRadiusTopRight"&&ue!=="mobileBorderRadiusBottomLeft"&&ue!=="mobileBorderRadiusBottomRight"&&Ae({...e,...Ie,mobileBorderRadius:{...e.mobileBorderRadius,...Ie?.mobileBorderRadius},activateSection:null,changeKey:ue}))},Ue=()=>{$(w=>!w);const j=a.getFieldsValue(!0);U||(j.paddingLeftRight=j.paddingLeft,j.paddingTopBottom=j.paddingTop,j.paddingRight=j.paddingLeft,j.paddingBottom=j.paddingTop,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:j.paddingTopBottom,bottom:j.paddingTopBottom,left:j.paddingLeftRight,right:j.paddingLeftRight}}}))},Xe=()=>{const j=a.getFieldsValue(!0);d.markBorderToggled(!V),setTimeout(()=>{ne(w=>!w),V?(j.borderAll=W.NULL_BORDER,j.borderTop=W.NULL_BORDER,j.borderBottom=W.NULL_BORDER,j.borderRight=W.NULL_BORDER,j.borderLeft=W.NULL_BORDER):j.borderAll={width:1,color:"#E5E5E5",style:"solid"},s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:j.borderAll.color,style:j.borderAll.style,width:j.borderAll.width}}}})})},de=()=>{const j=a.getFieldsValue(!0);c.markBorderToggled(!T),setTimeout(()=>{oe(w=>!w),T?(j.mobileBorderAll=W.NULL_BORDER,j.mobileBorderTop=W.NULL_BORDER,j.mobileBorderBottom=W.NULL_BORDER,j.mobileBorderRight=W.NULL_BORDER,j.mobileBorderLeft=W.NULL_BORDER):j.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:j.mobileBorderAll.color,style:j.mobileBorderAll.style,width:j.mobileBorderAll.width}}}})})},ye=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{be(w=>!w),xe?(j.borderRadiusAll=0,m(!0)):j.borderRadiusAll=5,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:j.borderRadiusAll}}})})},I=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{me(w=>!w),Se?(j.mobileBorderRadiusAll=null,k(!0)):j.mobileBorderRadiusAll=5,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:j.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},se=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{ke(w=>!w),he?(j.boxShadowInset=!1,j.boxShadowHOffset=null,j.boxShadowVOffset=null,j.boxShadowBlurRadius=null,j.boxShadowSpreadRadius=null,j.boxShadowColor=""):(j.boxShadowInset=!1,j.boxShadowHOffset=5,j.boxShadowVOffset=5,j.boxShadowBlurRadius=10,j.boxShadowSpreadRadius=-5,j.boxShadowColor="#000000"),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:j.boxShadowBlurRadius,color:j.boxShadowColor,hOffset:j.boxShadowHOffset,inset:j.boxShadowInset,spreadRadius:j.boxShadowSpreadRadius,vOffset:j.boxShadowVOffset}}})})},je=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{ze(w=>!w),ce?(j.mobileBoxShadowInset=!1,j.mobileBoxShadowHOffset=null,j.mobileBoxShadowVOffset=null,j.mobileBoxShadowBlurRadius=null,j.mobileBoxShadowSpreadRadius=null,j.mobileBoxShadowColor=""):(j.mobileBoxShadowInset=!1,j.mobileBoxShadowHOffset=5,j.mobileBoxShadowVOffset=5,j.mobileBoxShadowBlurRadius=10,j.mobileBoxShadowSpreadRadius=-5,j.mobileBoxShadowColor="#000000"),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:j.mobileBoxShadowBlurRadius,color:j.mobileBoxShadowColor,hOffset:j.mobileBoxShadowHOffset,inset:j.mobileBoxShadowInset,spreadRadius:j.mobileBoxShadowSpreadRadius,vOffset:j.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Ne=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{ve(w=>!w),Oe&&(j.width="",j.height="",s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{width:{value:null,dim:"px"},height:{value:null,dim:"px"}}}))})},He=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{pe(w=>!w),Ee&&(j.mobileWidth="",j.mobileHeight="",s({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-"}}}))})},Ke=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{X(w=>!w),Q?(j.backgroundColor="",j.backgroundImage="",j.backgroundPositionX="",j.backgroundPositionY="",j.backgroundRepeat="none",j.backgroundSize="",N(!0)):(j.backgroundColor="#E5E5E5",j.backgroundSize="",j.backgroundRepeat="none"),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:j.backgroundColor,backgroundImage:[{type:"url",value:j.backgroundImage}],backgroundPositionX:j.backgroundPositionX,backgroundPositionY:j.backgroundPositionY,backgroundRepeat:j.backgroundRepeat,backgroundSize:j.backgroundSize}})})},tt=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{J(w=>!w),Z?j.mobileBackgroundColor="":j.mobileBackgroundColor="#E5E5E5",s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:j.mobileBackgroundColor}}}),Z&&Vo(a,e,s)})},O=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{M(w=>!w),H&&(j.exportAsPicture=!1,j.isContrastBlock=!1,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1,isContrastBlock:!1}}))})},ie=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{K(w=>!w),Y&&(j.mobilePaddingLeftRight="",j.mobilePaddingLeft="",j.mobilePaddingRight="",j.mobilePaddingTopBottom="",j.mobilePaddingTop="",j.mobilePaddingBottom="",s({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,t.jsx)(o.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[re]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[Ce]||"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:Ve,autoComplete:"off",className:"element-controls",children:f==="mobile"&&y.styles?(0,t.jsxs)("div",{className:"selected_form-mobile-props-wrapper",style:{display:f==="mobile"&&y.styles?"flex":"none"},children:[(0,t.jsx)("div",{className:"selected_form-mobile-props-header",children:!F&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})})}),(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,t.jsx)(vs,{form:a,elementSettings:e,boxShadow:b,mobileBordersShow:T,mobileBorderRadiusShow:Se,mobileBoxShadowShow:ce,mobileSizeShow:Ee,mobileBackgroundShow:Z,mobilePaddingShow:Y,mobilePaddingsExt:L,setMobilePaddingsExt:P,oneMobileBorderRadiusValue:S,setOneMobileBorderRadiusValue:k,toggleShowMobileBorderHandler:de,toggleShowMobileBorderRadiusHandler:I,toggleShowMobileBoxShadowHandler:je,toggleShowMobileSizeHandler:He,toggleShowMobileBackgroundHandler:tt,toggleShowMobilePaddingHandler:ie})})]}):(0,t.jsxs)(t.Fragment,{children:[!F&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(js,{form:a,elementSettings:e,boxShadow:b,bordersShow:V,borderRadiusShow:xe,boxShadowShow:he,backgroundShow:Q,backgroundImageEmpty:v,backgroundRepeatOptions:Re,sizeShow:Oe,maxWidthValue:h,modificationShow:H,paddingsExt:U,oneBorderRadiusValue:p,setOneBorderRadiusValue:m,elementListShow:te,togglePaddingHandler:Ue,toggleShowBorderHandler:Xe,toggleShowBorderRadiusHandler:ye,toggleShowBoxShadowHandler:se,toggleShowSizeHandler:Ne,toggleShowBackgroundHandler:Ke,toggleShowModificationHandler:O,handleChangeValues:Ve})})]})})};Is.propTypes={elementSettings:_.default.object.isRequired};var Cs=({form:e,elementSettings:i,boxShadow:s,bordersShow:l,borderRadiusShow:a,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:h,backgroundRepeatOptions:g,sizeShow:b,maxWidthValue:x,modificationShow:p,paddingShow:m,paddingsExt:S,oneBorderRadiusValue:k,setOneBorderRadiusValue:f,togglePaddingHandler:y,toggleShowPaddingHandler:v,toggleShowBorderHandler:N,toggleShowBorderRadiusHandler:R,toggleShowBoxShadowHandler:C,toggleShowSizeHandler:F,toggleShowBackgroundHandler:U,toggleShowModificationHandler:$,handleChangeValues:L})=>{const{__:P}=r.useI18n(),{token:V}=(0,o.ui_kit$useToken)(),ne=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:P("Appearance on mobile devices"),type:"info"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Zt,{form:e,elementSettings:i})}),(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Ot,{form:e,elementSettings:i})})]}),ne.formCellFieldPaddingsEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Padding"),collapsible:!0,open:m,onToggle:v,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormPaddingInputs,{extended:S,onToggleExtended:y,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,t.jsx)(o.ui_kit$FormSection,{title:P("Size"),collapsible:!0,open:b,onToggle:F,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormSizeInputs,{maxWidth:x,dimensionSelect:Nt,showMinMax:!0,minWidthDimensionSelect:Nt,maxWidthDimensionSelect:Nt,labels:{width:P("Width"),height:P("Height"),minWidth:P("Minimum width"),maxWidth:P("Maximum width")}})}),(0,t.jsxs)(o.ui_kit$FormSection,{title:P("Background"),collapsible:!0,open:c,onToggle:U,dividerTop:!0,children:[(0,t.jsx)(Fi,{form:e,backgroundImageEmpty:h,appConfig:ne,token:V,elementSettings:i,backgroundRepeatOptions:g,handleChangeValues:L}),(0,t.jsx)(eo,{form:e,showBackground:!0})]}),ne.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Borders"),collapsible:!0,open:l,onToggle:N,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),ne.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Border radius"),collapsible:!0,open:a,onToggle:R,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:k,setOneBorderRadiusValue:f,elementSettings:i})}),ne.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Box shadow"),collapsible:!0,open:d,onToggle:C,dividerTop:!0,children:(0,t.jsx)(wt,{})}),ne.formFieldExportAsPictureEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Export settings"),collapsible:!0,open:p,onToggle:$,dividerTop:!0,children:(0,t.jsx)(Li,{form:e,elementSettings:i})}),ne.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Display control & Direction"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e,directionControl:(0,t.jsx)(Ho,{elementSettings:i,form:e})})}),ne.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};Cs.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,boxShadow:_.default.object,bordersShow:_.default.bool,borderRadiusShow:_.default.bool,boxShadowShow:_.default.bool,backgroundShow:_.default.bool,backgroundImageEmpty:_.default.bool,backgroundRepeatOptions:_.default.array,sizeShow:_.default.bool,maxWidthValue:_.default.oneOfType([_.default.string,_.default.number]),modificationShow:_.default.bool,paddingShow:_.default.bool,paddingsExt:_.default.bool,oneBorderRadiusValue:_.default.bool,setOneBorderRadiusValue:_.default.func,togglePaddingHandler:_.default.func,toggleShowPaddingHandler:_.default.func,toggleShowBorderHandler:_.default.func,toggleShowBorderRadiusHandler:_.default.func,toggleShowBoxShadowHandler:_.default.func,toggleShowSizeHandler:_.default.func,toggleShowBackgroundHandler:_.default.func,toggleShowModificationHandler:_.default.func,handleChangeValues:_.default.func};var Ps=({form:e,elementSettings:i,mobileBoxShadow:s,mobileBordersShow:l,mobileBorderRadiusShow:a,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:h,mobilePaddingShow:g,mobilePaddingsExt:b,setMobilePaddingsExt:x,oneMobileBorderRadiusValue:p,setOneMobileBorderRadiusValue:m,toggleShowMobileBorderHandler:S,toggleShowMobileBorderRadiusHandler:k,toggleShowMobileBoxShadowHandler:f,toggleShowMobileSizeHandler:y,toggleShowMobileBackgroundHandler:v,toggleShowMobilePaddingHandler:N})=>{const{__:R}=r.useI18n(),{token:C}=(0,o.ui_kit$useToken)(),F=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:20,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Fo,{form:e,elementSettings:i,imgParent:!0})}),(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Ot,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),F.formCellFieldPaddingsEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:R("Padding"),collapsible:!0,open:g,onToggle:N,dividerTop:!0,children:(0,t.jsx)(Wo,{form:e,elementSettings:i,mobilePaddingsExt:b,setMobilePaddingsExt:x})}),(0,t.jsx)(o.ui_kit$FormSection,{title:R("Size"),collapsible:!0,open:c,onToggle:y,dividerTop:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:8},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)("div",{style:{marginBottom:C.formItemMarginBottomXS*2},children:(0,t.jsx)(Vt,{form:e,name:"mobileWidth",elementSettings:i})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)("div",{style:{marginBottom:C.formItemMarginBottomXS},children:(0,t.jsx)(Qt,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:R("Background"),collapsible:!0,open:h,onToggle:v,dividerTop:!0,children:(0,t.jsx)(xo,{elementSettings:Ht(i),imageEnabled:F.formDivFieldBackgroundImageEnabled,desktopBackground:_o(i)})}),F.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:R("Borders"),collapsible:!0,open:l,onToggle:S,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),F.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:R("Border radius"),collapsible:!0,open:a,onToggle:k,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:p,setOneBorderRadiusValue:m,elementSettings:i})}),F.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:R("Box shadow"),collapsible:!0,open:d,onToggle:f,dividerTop:!0,children:(0,t.jsx)(wt,{typeOfForm:"mobile",form:e,elementSettings:i})}),F.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:R("Display control & Direction"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e,directionControl:(0,t.jsx)(Ho,{elementSettings:i,form:e,typeOfForm:"mobile"})})}),F.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:R("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};Ps.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,mobileBoxShadow:_.default.object,mobileBordersShow:_.default.bool,mobileBorderRadiusShow:_.default.bool,mobileBoxShadowShow:_.default.bool,mobileSizeShow:_.default.bool,mobileBackgroundShow:_.default.bool,mobilePaddingShow:_.default.bool,mobilePaddingsExt:_.default.bool,setMobilePaddingsExt:_.default.func,oneMobileBorderRadiusValue:_.default.bool,setOneMobileBorderRadiusValue:_.default.func,toggleShowMobileBorderHandler:_.default.func,toggleShowMobileBorderRadiusHandler:_.default.func,toggleShowMobileBoxShadowHandler:_.default.func,toggleShowMobileSizeHandler:_.default.func,toggleShowMobileBackgroundHandler:_.default.func,toggleShowMobilePaddingHandler:_.default.func};var As=({elementSettings:e})=>{const{__:i}=r.useI18n(),s=r.useSendPostMessage(),[l]=o.ui_kit$Form.useForm(),a=Lt(),d=Lt(),[c,h]=(0,n.useState)({}),[g,b]=(0,n.useState)(!0),[x,p]=(0,n.useState)({}),[m,S]=(0,n.useState)(!0),k=r.useSelector(r.selectEmailViewType),f=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[y,v]=(0,n.useState)(e.backgroundImage[0].value===""),N=r.useSelector(r.selectIsCodeMode),R=r.useSelector(r.selectCodeModeDirection),C=N&&R!=="bottom",[F,U]=(0,n.useState)(!1),[$,L]=(0,n.useState)(!1),[P,V]=(0,n.useState)(!1),[ne,T]=(0,n.useState)(!1),[oe,xe]=(0,n.useState)(!1),[be,Se]=(0,n.useState)(!1),[me,he]=(0,n.useState)(!1),[ke,ce]=(0,n.useState)(!1),[ze,Oe]=(0,n.useState)(!1),[ve,Ee]=(0,n.useState)(!1),[pe,Q]=(0,n.useState)(!1),[X,Z]=(0,n.useState)(!1),[J,H]=(0,n.useState)(!1),[M,Y]=(0,n.useState)(!1),[K,te]=(0,n.useState)(!1),[le,Te]=(0,n.useState)(""),Re=[{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,z=e.mobileBorder,re=Object.keys($e).find(O=>$e[O]?.width||$e[O]?.style||$e[O]?.color),Ce=Object.keys(z).find(O=>z[O]?.width||z[O]?.style||z[O]?.color),G=O=>O&&(O?.width||O?.style||O?.color)?O:"";(0,n.useEffect)(()=>{if(e){const O=e.boxShadow,ie=e.mobileBoxShadow;h(O),p(ie),l.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:G(e.mobileBorder.all)||!(G(e.mobileBorder.top)||G(e.mobileBorder.bottom)||G(e.mobileBorder.right)||G(e.mobileBorder.left))&&G(e.border.all),mobileBorderTop:G(e.mobileBorder.top)||!G(e.mobileBorder.all)&&G(e.border.top),mobileBorderBottom:G(e.mobileBorder.bottom)||!G(e.mobileBorder.all)&&G(e.border.bottom),mobileBorderRight:G(e.mobileBorder.right)||!G(e.mobileBorder.all)&&G(e.border.right),mobileBorderLeft:G(e.mobileBorder.left)||!G(e.mobileBorder.all)&&G(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:bt(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileHeight:bt(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:""),...to(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))?b(!1):b(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))?S(!1):S(!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)?U(!1):U(!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)?L(!1):L(!0);const j=a.isStaleBorderSnapshot(e,!!re),w=d.isStaleBorderSnapshot(e,!!Ce);j&&l.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(w||j&&!Ce)&&l.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),V(ue=>re&&!j?!0:ue),T(ue=>re&&!j||Ce&&!w?!0:ue),xe(!!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),he(!!e.boxShadow),ce(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),Oe(!!e.width.value||!!e.height.value||!!e.minWidth.value||!!e.maxWidth.value),Ee(!!e.mobileWidth.value||!!e.mobileHeight.value),Q(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Z(Do(e)),H(!!e.exportAsPicture),Y(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),te(!!e.mobilePadding.all||!!e.mobilePadding.top||!!e.mobilePadding.bottom||!!e.mobilePadding.left||!!e.mobilePadding.right)}},[l,e,re,Ce,a,d]);const Be=O=>{const ie=l.getFieldsValue(!0),j=Object.keys(O)[0];let w;switch(Te(l.getFieldsValue(!0).widthDim==="%"?100:""),j){case"exportAsPicture":w={exportAsPicture:ie.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":w={boxShadow:{hOffset:ie.boxShadowHOffset,vOffset:ie.boxShadowVOffset,blurRadius:ie.boxShadowBlurRadius,spreadRadius:ie.boxShadowSpreadRadius,color:ie.boxShadowColor,inset:ie.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":ie.borderPosition==="borderAll"?(w={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...ie.borderAll}}},l.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):ie.borderAll?.width||ie.borderAll?.style||ie.borderAll?.color?(w={border:{all:null,left:ie.borderAll,right:ie.borderAll,top:ie.borderAll,bottom:ie.borderAll,[W.REVERSE_BORDER_POSITIONS[j]]:{...ie[j],...O[j]}}},l.setFieldsValue({borderAll:null,borderLeft:ie.borderAll,borderRight:ie.borderAll,borderTop:ie.borderAll,borderBottom:ie.borderAll,[j]:{...ie[j],...O[j]}})):(w={border:{all:null,left:ie.borderLeft,right:ie.borderRight,top:ie.borderTop,bottom:ie.borderBottom,[W.REVERSE_BORDER_POSITIONS[j]]:{...ie[j],...O[j]}}},l.setFieldsValue({border:w.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(ie.mobileBorderPosition==="mobileBorderAll")w={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...ie.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[j]+"-"}}},l.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const ue=W.MOBILE_REVERSE_BORDER_POSITIONS[j],Ie={...ie[j],...O[j]},qe=!Ie?.width&&!Ie?.style&&!Ie?.color;if(ie.mobileBorder?.all?.width||ie.mobileBorder?.all?.style||ie.mobileBorder?.all?.color){const Ze=ie.mobileBorderAll;w={mobileBorder:{all:null,left:Ze,right:Ze,top:Ze,bottom:Ze,[ue]:qe?null:{...Ie,classNamePrefix:"em-mob-border_"+ue+"-"}}},l.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:Ze,mobileBorderRight:Ze,mobileBorderTop:Ze,mobileBorderBottom:Ze,[j]:Ie})}else{const Ze=e.mobileBorder||{},dt=st=>{const ct=Ze[st];return ct&&(ct?.width||ct?.style||ct?.color)?ct:null};w={mobileBorder:{all:null,left:ue==="left"?qe?null:{...Ie,classNamePrefix:"em-mob-border_left-"}:dt("left"),right:ue==="right"?qe?null:{...Ie,classNamePrefix:"em-mob-border_right-"}:dt("right"),top:ue==="top"?qe?null:{...Ie,classNamePrefix:"em-mob-border_top-"}:dt("top"),bottom:ue==="bottom"?qe?null:{...Ie,classNamePrefix:"em-mob-border_bottom-"}:dt("bottom")}},l.setFieldsValue({[j]:Ie})}}break;case"width":w={[j]:{value:O[j],dim:ie.widthDim}};break;case"height":w={[j]:{value:O[j],dim:ie.heightDim}};break;case"widthDim":w={width:{value:ie.width,dim:O[j]}};break;case"heightDim":w={height:{value:ie.height,dim:O[j]}};break;case"maxWidth":w={[j]:{value:O[j],dim:ie.maxWidthDim}};break;case"maxWidthDim":w={maxWidth:{value:ie.maxWidth,dim:O[j]}};break;case"minWidth":w={[j]:{value:O[j],dim:ie.minWidthDim}};break;case"minWidthDim":w={minWidth:{value:ie.minWidth,dim:O[j]}};break;case"backgroundImage":v(O[j]===""),w={[j]:[{...e.backgroundImage[0],value:O[j]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":w={padding:{[W.PADDING_POSITION[j]]:+O[j]}};break;case"paddingTopBottom":w={padding:{top:+O[j],bottom:+O[j]}},ie.paddingTop=ie.paddingBottom=+O[j];break;case"paddingLeftRight":w={padding:{left:+O[j],right:+O[j]}},ie.paddingLeft=ie.paddingRight=+O[j];break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":w={borderRadius:{[W.BORDER_RADIUS_POSITION[j]]:+O[j]}};break;case"mobileWidth":w={[j]:{classNamePrefix:"em-mob-width-",value:O[j],dim:ie.mobileWidthDim}};break;case"mobileWidthDim":w={mobileWidth:{classNamePrefix:"em-mob-width-",value:ie.mobileWidth||100,dim:O[j]}};break;case"mobileHeight":w={[j]:{classNamePrefix:"em-mob-height-",value:O[j],dim:ie.mobileHeightDim}};break;case"mobileHeightDim":w={mobileHeight:{classNamePrefix:"em-mob-height-",value:ie.mobileHeight,dim:O[j]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":w={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[j]]:O[j],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[j]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":w={mobileBoxShadow:{hOffset:ie.mobileBoxShadowHOffset,vOffset:ie.mobileBoxShadowVOffset,blurRadius:ie.mobileBoxShadowBlurRadius,spreadRadius:ie.mobileBoxShadowSpreadRadius,color:ie.mobileBoxShadowColor,inset:ie.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":w={[j]:{classNamePrefix:"em-mob-text_align-",value:O[j]}};break;case"mobileVerticalAlign":w={[j]:{classNamePrefix:"em-mob-vertical_align-",value:O[j]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(w=fo(O),!w)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":w={mobilePadding:{all:null,top:ie.mobilePaddingTop!==""?ie.mobilePaddingTop:null,right:ie.mobilePaddingRight!==""?ie.mobilePaddingRight:null,bottom:ie.mobilePaddingBottom!==""?ie.mobilePaddingBottom:null,left:ie.mobilePaddingLeft!==""?ie.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":ie.mobilePaddingTop=ie.mobilePaddingBottom=O[j],w={mobilePadding:{all:null,top:ie.mobilePaddingTop!==""?ie.mobilePaddingTop:null,right:ie.mobilePaddingRight!==""?ie.mobilePaddingRight:null,bottom:ie.mobilePaddingBottom!==""?ie.mobilePaddingBottom:null,left:ie.mobilePaddingLeft!==""?ie.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":ie.mobilePaddingLeft=ie.mobilePaddingRight=O[j],w={mobilePadding:{all:null,top:ie.mobilePaddingTop!==""?ie.mobilePaddingTop:null,right:ie.mobilePaddingRight!==""?ie.mobilePaddingRight:null,bottom:ie.mobilePaddingBottom!==""?ie.mobilePaddingBottom:null,left:ie.mobilePaddingLeft!==""?ie.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileDirection":w={[j]:{classNamePrefix:"em-mob-direction-",value:O[j]}};break;case"backgroundPositionX":case"backgroundPositionY":w={[j]:isNaN(parseFloat(O[j].position))?O[j].position:O[j].position+O[j].unit};break;default:w=O}j!=="borderPosition"&&j!=="mobileBorderPosition"&&s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:w})},Fe=()=>{U(ie=>!ie);const O=l.getFieldsValue(!0);F||(O.paddingLeftRight=O.paddingLeft,O.paddingTopBottom=O.paddingTop,O.paddingRight=O.paddingLeft,O.paddingBottom=O.paddingTop,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:O.paddingTopBottom,bottom:O.paddingTopBottom,left:O.paddingLeftRight,right:O.paddingLeftRight}}}))},Ae=()=>{const O=l.getFieldsValue(!0);a.markBorderToggled(!P),setTimeout(()=>{V(ie=>!ie),P?(O.borderAll=W.NULL_BORDER,O.borderTop=W.NULL_BORDER,O.borderBottom=W.NULL_BORDER,O.borderRight=W.NULL_BORDER,O.borderLeft=W.NULL_BORDER):O.borderAll={width:1,color:"#E5E5E5",style:"solid"},s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:O.borderAll.color,style:O.borderAll.style,width:O.borderAll.width}}}})})},Ve=()=>{const O=l.getFieldsValue(!0);d.markBorderToggled(!ne),setTimeout(()=>{T(ie=>!ie),ne?(O.mobileBorderAll=W.NULL_BORDER,O.mobileBorderTop=W.NULL_BORDER,O.mobileBorderBottom=W.NULL_BORDER,O.mobileBorderRight=W.NULL_BORDER,O.mobileBorderLeft=W.NULL_BORDER):O.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:O.mobileBorderAll.color,style:O.mobileBorderAll.style,width:O.mobileBorderAll.width}}}})})},Ue=()=>{const O=l.getFieldsValue(!0);setTimeout(()=>{xe(ie=>!ie),oe?(O.borderRadiusAll=0,b(!0)):O.borderRadiusAll=5,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:O.borderRadiusAll}}})})},Xe=()=>{const O=l.getFieldsValue(!0);setTimeout(()=>{Se(ie=>!ie),be?(O.mobileBorderRadiusAll=null,S(!0)):O.mobileBorderRadiusAll=5,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:O.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},de=()=>{const O=l.getFieldsValue(!0);setTimeout(()=>{he(ie=>!ie),me?(O.boxShadowInset=!1,O.boxShadowHOffset=null,O.boxShadowVOffset=null,O.boxShadowBlurRadius=null,O.boxShadowSpreadRadius=null,O.boxShadowColor=""):(O.boxShadowInset=!1,O.boxShadowHOffset=5,O.boxShadowVOffset=5,O.boxShadowBlurRadius=10,O.boxShadowSpreadRadius=-5,O.boxShadowColor="#000000"),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:O.boxShadowBlurRadius,color:O.boxShadowColor,hOffset:O.boxShadowHOffset,inset:O.boxShadowInset,spreadRadius:O.boxShadowSpreadRadius,vOffset:O.boxShadowVOffset}}})})},ye=()=>{const O=l.getFieldsValue(!0);setTimeout(()=>{ce(ie=>!ie),ke?(O.mobileBoxShadowInset=!1,O.mobileBoxShadowHOffset=null,O.mobileBoxShadowVOffset=null,O.mobileBoxShadowBlurRadius=null,O.mobileBoxShadowSpreadRadius=null,O.mobileBoxShadowColor=""):(O.mobileBoxShadowInset=!1,O.mobileBoxShadowHOffset=5,O.mobileBoxShadowVOffset=5,O.mobileBoxShadowBlurRadius=10,O.mobileBoxShadowSpreadRadius=-5,O.mobileBoxShadowColor="#000000"),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:O.mobileBoxShadowBlurRadius,color:O.mobileBoxShadowColor,hOffset:O.mobileBoxShadowHOffset,inset:O.mobileBoxShadowInset,spreadRadius:O.mobileBoxShadowSpreadRadius,vOffset:O.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},I=()=>{setTimeout(()=>{Oe(O=>!O)})},se=()=>{setTimeout(()=>{Ee(O=>!O)})},je=()=>{const O=l.getFieldsValue(!0);setTimeout(()=>{Q(ie=>!ie),pe?(O.backgroundColor="",O.backgroundImage="",O.backgroundPositionX="",O.backgroundPositionY="",O.backgroundRepeat="none",O.backgroundSize="",v(!0)):(O.backgroundColor="#E5E5E5",O.backgroundSize="",O.backgroundRepeat="none"),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:O.backgroundColor,backgroundImage:[{type:"url",value:O.backgroundImage}],backgroundPositionX:O.backgroundPositionX,backgroundPositionY:O.backgroundPositionY,backgroundRepeat:O.backgroundRepeat,backgroundSize:O.backgroundSize}})})},Ne=()=>{const O=l.getFieldsValue(!0);setTimeout(()=>{Z(ie=>!ie),X?O.mobileBackgroundColor="":O.mobileBackgroundColor="#E5E5E5",s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:O.mobileBackgroundColor}}}),X&&Vo(l,e,s)})},He=()=>{const O=l.getFieldsValue(!0);setTimeout(()=>{H(ie=>!ie),J&&(O.exportAsPicture=!1,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})},Ke=()=>{const O=l.getFieldsValue(!0);setTimeout(()=>{Y(ie=>!ie),M&&(O.paddingLeftRight="",O.paddingLeft="",O.paddingRight="",O.paddingTopBottom="",O.paddingTop="",O.paddingBottom="",s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},tt=()=>{const O=l.getFieldsValue(!0);setTimeout(()=>{te(ie=>!ie),K&&(O.mobilePaddingLeftRight="",O.mobilePaddingLeft="",O.mobilePaddingRight="",O.mobilePaddingTopBottom="",O.mobilePaddingTop="",O.mobilePaddingBottom="",s({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,t.jsxs)(o.ui_kit$Form,{form:l,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[re]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[Ce]||"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:Be,autoComplete:"off",className:"element-controls",children:[!C&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),k==="mobile"&&f.styles?(0,t.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,t.jsx)(Ps,{form:l,elementSettings:e,mobileBoxShadow:x,mobileBordersShow:ne,mobileBorderRadiusShow:be,mobileBoxShadowShow:ke,mobileSizeShow:ve,mobileBackgroundShow:X,mobilePaddingShow:K,mobilePaddingsExt:$,setMobilePaddingsExt:L,oneMobileBorderRadiusValue:m,setOneMobileBorderRadiusValue:S,toggleShowMobileBorderHandler:Ve,toggleShowMobileBorderRadiusHandler:Xe,toggleShowMobileBoxShadowHandler:ye,toggleShowMobileSizeHandler:se,toggleShowMobileBackgroundHandler:Ne,toggleShowMobilePaddingHandler:tt})," "]}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(Cs,{form:l,elementSettings:e,boxShadow:c,bordersShow:P,borderRadiusShow:oe,boxShadowShow:me,backgroundShow:pe,backgroundImageEmpty:y,backgroundRepeatOptions:Re,sizeShow:ze,maxWidthValue:le,modificationShow:J,paddingShow:M,paddingsExt:F,oneBorderRadiusValue:g,setOneBorderRadiusValue:b,togglePaddingHandler:Fe,toggleShowPaddingHandler:Ke,toggleShowBorderHandler:Ae,toggleShowBorderRadiusHandler:Ue,toggleShowBoxShadowHandler:de,toggleShowSizeHandler:I,toggleShowBackgroundHandler:je,toggleShowModificationHandler:He,handleChangeValues:Be})})]})};As.propTypes={elementSettings:_.default.object.isRequired};var Ns=({form:e,elementSettings:i})=>{const{__:s}=r.useI18n(),l=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:"0"},children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:s("Float block width"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"width",children:(0,t.jsx)(o.ui_kit$InputNumber,{min:0,placeholder:s("Float block width"),prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:(0,t.jsx)(o.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:Nt})})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:s("Column gap"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"gap",children:(0,t.jsx)(o.ui_kit$InputNumber,{min:0,placeholder:s("Column gap"),prefix:(0,t.jsx)(r.EmIcons,{icon:"SplitCellsOutlined",component:o.icons$SplitCellsOutlined}),addonAfter:(0,t.jsx)(o.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:nd})})})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:s("Vertical alignment"),dividerTop:!0,children:(0,t.jsx)(Ot,{form:e,elementSettings:i})}),(0,t.jsx)(o.ui_kit$FormSection,{title:s("Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e})}),l.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:s("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};Ns.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired};var Ls=({form:e,elementSettings:i})=>{const{__:s}=r.useI18n(),l=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:20},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Vt,{form:e,name:"mobileWidth",elementSettings:i})}),(0,t.jsx)(o.ui_kit$Col,{span:12})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:s("Alignments"),dividerTop:!0,children:(0,t.jsx)(Ot,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,t.jsx)(o.ui_kit$FormSection,{title:s("Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e})}),l.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:s("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};Ls.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired};var Mi=0,Os=({elementSettings:e})=>{const{__:i}=r.useI18n(),s=r.useSendPostMessage(),[l]=o.ui_kit$Form.useForm(),a=r.useSelector(r.selectEmailViewType),d=r.useSelector(r.selectMobileViewActive),c=r.useSelector(r.selectIsCodeMode),h=r.useSelector(r.selectCodeModeDirection),g=c&&h!=="bottom";(0,n.useEffect)(()=>{e&&(l.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:bt(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileContentWidth:bt(e.mobileContentWidth?.value),mobileContentWidthDim:e.mobileContentWidth?.dim,mobileVerticalAlign:u(e.mobileVerticalAlign?.value)}),Mi=e.width.value+e.gap.value)},[l,e]);const b=x=>{const p=l.getFieldsValue(!0),m=Object.keys(x)[0];let S;switch(m){case"width":Mi=x[m]+p.gap,S={[m]:{value:x[m],dim:p.widthDim},gap:{value:p.gap}};break;case"widthDim":S={width:{value:p.width,dim:x[m]},gap:{value:p.gap}};break;case"gap":p.width=Mi-x[m],S={[m]:{value:x[m],dim:"px"}};break;case"mobileWidth":S={[m]:{classNamePrefix:"em-mob-width-",value:x[m],dim:p.mobileWidthDim}};break;case"mobileWidthDim":S={mobileWidth:{classNamePrefix:"em-mob-width-",value:p.mobileWidth||100,dim:x[m]}};break;case"mobileContentWidth":S={[m]:{classNamePrefix:"em-mob-width-",value:x[m],dim:p.mobileContentWidthDim}};break;case"mobileContentWidthDim":S={mobileContentWidth:{classNamePrefix:"em-mob-width-",value:100,dim:x[m]}};break;case"mobileVerticalAlign":S={[m]:{classNamePrefix:"em-mob-vertical_align-",value:x[m]}};break;default:S=x}s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:S})};return(0,t.jsxs)(o.ui_kit$Form,{form:l,layout:"vertical",name:"selected_float_block_form",initialValues:{width:{value:"",dim:""},gap:{value:"",dim:"px"},valign:"",show:"all",mobileWidth:"",mobileWidthDim:"",mobileContentWidth:"",mobileContentWidthDim:"",mobileVerticalAlign:""},onValuesChange:b,autoComplete:"off",className:"element-controls",children:[!g&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),a==="mobile"&&d.styles?(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:a==="mobile"&&d.styles?"block":"none"},children:(0,t.jsx)(Ls,{form:l,elementSettings:e})}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(Ns,{form:l,elementSettings:e})})]})};Os.propTypes={elementSettings:_.default.object.isRequired};var $s=({form:e,fillFields:i,elementSettings:s,boxShadow:l,bordersShow:a,borderRadiusShow:d,boxShadowShow:c,backgroundShow:h,backgroundImageEmpty:g,backgroundRepeatOptions:b,paddingShow:x,paddingsExt:p,maxWidthValue:m,oneBorderRadiusValue:S,setOneBorderRadiusValue:k,linkProtocol:f,linkTarget:y,isOpenTextReplacer:v,textReplacerButtonRef:N,textReplacerInputRef:R,handleLinkProtocolsChange:C,handleSelect:F,textReplacerInputHandler:U,handleTextReplacerKeyDown:$,srcButtonHandler:L,togglePaddingHandler:P,toggleShowPaddingHandler:V,toggleShowBackgroundHandler:ne,toggleShowBorderHandler:T,toggleShowBorderRadiusHandler:oe,toggleShowBoxShadowHandler:xe,setLinkProtocol:be,handleChangeValues:Se})=>{const{__:me}=r.useI18n(),{token:he}=(0,o.ui_kit$useToken)(),ke=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:me("Appearance on mobile devices"),type:"info"}),(0,t.jsxs)("div",{className:"selected_form-props-wrapper",children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Mt,{form:e,elementSettings:s})}),ke.formButtonFieldTextAlignEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Zt,{form:e,name:"textAlign",elementSettings:s})})]}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}}),(0,t.jsx)(qt,{show:f==="#",__:me,style:{marginBottom:he.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:me("Hyperlink URL"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"href",style:{marginBottom:ke.formButtonFieldReplacerEnabled?he.formItemMarginBottomXS:he.formItemMarginBottomMD+4},children:(0,t.jsx)(o.ui_kit$Input,{addonBefore:(0,t.jsx)(Kt,{linkProtocol:f,handleLinkProtocolsChange:C,__:me}),placeholder:me("Hyperlink URL"),allowClear:!0,onSelect:F,prefix:(0,t.jsx)(Xt,{linkProtocol:f})})})}),f==="mailto:"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:"subject",style:{marginBottom:he.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:me("Subject")})}),(0,t.jsx)(o.ui_kit$Form.Item,{name:"body",style:{marginBottom:he.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$TextArea,{rows:3,placeholder:me("Body")})})]}),ke.formButtonFieldReplacerEnabled&&(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:me("Text replacer"),placement:"bottom",getPopupContainer:ce=>ce.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":v}),icon:(0,t.jsx)(r.EmIcons,{icon:"Replacer",component:o.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:L,ref:N})})}),(0,t.jsx)(o.ui_kit$Col,{span:21,children:v&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:me("Text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textReplacer",children:(0,t.jsx)(o.ui_kit$Input,{placeholder:me("The code that will replace this text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:me("Text")}),onChange:U,onKeyDown:$,ref:R,onSelect:F})})})})]})}),ke.formButtonFieldPaddingsEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:me("Padding"),collapsible:!0,open:x,onToggle:V,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormPaddingInputs,{extended:p,onToggleExtended:P,gutter:he.marginSM,labels:{horizontal:me("Horizontal padding"),vertical:me("Vertical padding"),left:me("Left padding"),right:me("Right padding"),top:me("Top padding"),bottom:me("Bottom padding"),individual:me("Individual padding")}})}),(0,t.jsx)(o.ui_kit$FormSection,{title:me("Size"),dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormSizeInputs,{maxWidth:m,dimensionSelect:Nt,gutter:he.marginSM,labels:{width:me("Width"),height:me("Height"),minWidth:me("Minimum width"),maxWidth:me("Maximum width")}})}),(0,t.jsx)(go,{form:e,fillFields:i,elementSettings:s,showAddParagraph:!1,isButton:!0,setLinkProtocol:be,linkProtocol:f,linkTarget:y}),(0,t.jsxs)(o.ui_kit$FormSection,{title:me("Background"),collapsible:!0,open:h,onToggle:ne,dividerTop:!0,children:[(0,t.jsx)(Fi,{form:e,backgroundImageEmpty:g,appConfig:ke,token:he,elementSettings:s,backgroundRepeatOptions:b,handleChangeValues:Se}),(0,t.jsx)(eo,{form:e,showBackground:!0})]}),ke.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:me("Borders"),collapsible:!0,open:a,onToggle:T,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:s})}),ke.formFieldBorderRadiusEnabled&&(0,t.jsxs)(o.ui_kit$FormSection,{title:me("Border radius"),collapsible:!0,open:d,onToggle:oe,dividerTop:!0,children:[(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:S,setOneBorderRadiusValue:k,elementSettings:s}),(0,t.jsx)(eo,{form:e,showRounding:!0})]}),ke.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:me("Box shadow"),collapsible:!0,open:c,onToggle:xe,dividerTop:!0,children:(0,t.jsx)(wt,{})}),ke.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:me("Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:s,form:e})}),ke.formFieldAmpVisibilityEnabled&&s.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:me("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})]})};$s.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,boxShadow:_.default.object,bordersShow:_.default.bool,borderRadiusShow:_.default.bool,boxShadowShow:_.default.bool,backgroundShow:_.default.bool,backgroundImageEmpty:_.default.bool,backgroundRepeatOptions:_.default.array,paddingShow:_.default.bool,paddingsExt:_.default.bool,maxWidthValue:_.default.oneOfType([_.default.string,_.default.number]),oneBorderRadiusValue:_.default.bool,setOneBorderRadiusValue:_.default.func,linkProtocol:_.default.string,linkTarget:_.default.object,isOpenTextReplacer:_.default.bool,textReplacerButtonRef:_.default.object,textReplacerInputRef:_.default.object,handleLinkProtocolsChange:_.default.func,handleSelect:_.default.func,textReplacerInputHandler:_.default.func,handleTextReplacerKeyDown:_.default.func,srcButtonHandler:_.default.func,togglePaddingHandler:_.default.func,toggleShowPaddingHandler:_.default.func,toggleShowBackgroundHandler:_.default.func,toggleShowBorderHandler:_.default.func,toggleShowBorderRadiusHandler:_.default.func,toggleShowBoxShadowHandler:_.default.func,setLinkProtocol:_.default.func,handleChangeValues:_.default.func};var Fs=({form:e,fillFields:i,elementSettings:s,boxShadow:l,mobileBordersShow:a,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:h,mobileBackgroundShow:g,mobilePaddingShow:b,mobilePaddingsExt:x,setMobilePaddingsExt:p,oneMobileBorderRadiusValue:m,setOneMobileBorderRadiusValue:S,linkProtocol:k,handleLinkProtocolsChange:f,setLinkProtocol:y,toggleShowMobileBorderHandler:v,toggleShowMobileBorderRadiusHandler:N,toggleShowMobileBoxShadowHandler:R,toggleShowMobileSizeHandler:C,toggleShowMobileBackgroundHandler:F,toggleShowMobilePaddingHandler:U})=>{const{__:$}=r.useI18n(),{token:L}=(0,o.ui_kit$useToken)(),P=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Mt,{form:e,elementSettings:s,imgParent:!0,typeOfForm:"mobile"})}),P.formButtonFieldTextAlignEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Fo,{form:e,name:"mobileTextAlign",elementSettings:s,imgParent:!0})})]}),!!s.showOnMobile&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}}),(0,t.jsx)(qt,{show:k==="#",__:$,style:{marginBottom:L.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:$("Hyperlink URL"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"href",style:{marginBottom:k==="mailto:"?L.formItemMarginBottomXS:L.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$Input,{addonBefore:(0,t.jsx)(Kt,{linkProtocol:k,handleLinkProtocolsChange:f,__:$}),placeholder:$("Hyperlink URL"),allowClear:!0,prefix:(0,t.jsx)(Xt,{linkProtocol:k})})})}),k==="mailto:"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:"subject",children:(0,t.jsx)(o.ui_kit$Input,{placeholder:$("Subject")})}),(0,t.jsx)(o.ui_kit$Form.Item,{name:"body",style:{marginBottom:L.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$TextArea,{rows:3,placeholder:$("Body")})})]})]}),!!s.showOnMobile&&(0,t.jsx)(go,{form:e,fillFields:i,elementSettings:s,setLinkProtocol:y,linkProtocol:k,showAddParagraph:!1,isButton:!0}),(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(as,{})})}),P.formButtonFieldPaddingsEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:$("Padding"),collapsible:!0,open:b,onToggle:U,dividerTop:!0,children:(0,t.jsx)(Wo,{form:e,elementSettings:s,mobilePaddingsExt:x,setMobilePaddingsExt:p})}),(0,t.jsx)(o.ui_kit$FormSection,{title:$("Size"),collapsible:!0,open:h,onToggle:C,dividerTop:!0,bodyStyle:{paddingBottom:L.formItemMarginBottomMD},children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:$("Width"),placement:"bottom",children:(0,t.jsx)(Vt,{form:e,name:"mobileWidth",elementSettings:s})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:$("Height"),placement:"bottom",children:(0,t.jsx)(Qt,{form:e,name:"mobileHeight",elementSettings:s})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:$("Background"),collapsible:!0,open:g,onToggle:F,dividerTop:!0,bodyStyle:{paddingBottom:L.formItemMarginBottomMD},children:(0,t.jsx)(xo,{elementSettings:Ht(s),imageEnabled:P.formButtonFieldBackgroundImageEnabled,desktopBackground:_o(s)})}),P.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:$("Borders"),collapsible:!0,open:a,onToggle:v,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),P.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:$("Border radius"),collapsible:!0,open:d,onToggle:N,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:m,setOneBorderRadiusValue:S,elementSettings:s,typeOfForm:"mobile"})}),P.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:$("Box shadow"),collapsible:!0,open:c,onToggle:R,dividerTop:!0,children:(0,t.jsx)(wt,{typeOfForm:"mobile"})}),P.formFieldAmpVisibilityEnabled&&s.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:$("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})}),P.formFieldAmpVisibilityEnabled&&s.isAmp&&(0,t.jsx)(o.ui_kit$FormSection,{title:$("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};Fs.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,boxShadow:_.default.object,mobileBordersShow:_.default.bool,mobileBorderRadiusShow:_.default.bool,mobileBoxShadowShow:_.default.bool,mobileSizeShow:_.default.bool,mobileBackgroundShow:_.default.bool,mobilePaddingShow:_.default.bool,mobilePaddingsExt:_.default.bool,setMobilePaddingsExt:_.default.func,oneMobileBorderRadiusValue:_.default.bool,setOneMobileBorderRadiusValue:_.default.func,linkProtocol:_.default.string,handleLinkProtocolsChange:_.default.func,setLinkProtocol:_.default.func,toggleShowMobileBorderHandler:_.default.func,toggleShowMobileBorderRadiusHandler:_.default.func,toggleShowMobileBoxShadowHandler:_.default.func,toggleShowMobileSizeHandler:_.default.func,toggleShowMobileBackgroundHandler:_.default.func,toggleShowMobilePaddingHandler:_.default.func};var Od=Object.freeze({}),Ms=({elementSettings:e})=>{const{__:i}=r.useI18n(),s=r.useSendPostMessage(),[l]=o.ui_kit$Form.useForm(),a=Lt(),d=Lt(),c=r.useDispatch(),[h,g]=(0,n.useState)({}),[b,x]=(0,n.useState)(!0),[p,m]=(0,n.useState)(!0),S=r.useSelector(r.selectEmailViewType),k=r.useSelector(r.selectMobileViewActive),[f,y]=(0,n.useState)(e.backgroundImage?.[0].value===""),v=r.useSelector(r.selectIsCodeMode),N=r.useSelector(r.selectCodeModeDirection),R=v&&N!=="bottom",C=(0,n.useRef)(null),F=(0,n.useRef)(null),[U,$]=(0,n.useState)(!1),[L,P]=(0,n.useState)(!1),[V,ne]=(0,n.useState)(!1),[T,oe]=(0,n.useState)(!1),[xe,be]=(0,n.useState)(!1),[Se,me]=(0,n.useState)(!1),[he,ke]=(0,n.useState)(!1),[ce,ze]=(0,n.useState)(!1),[Oe,ve]=(0,n.useState)(!1),[Ee,pe]=(0,n.useState)(!1),[Q,X]=(0,n.useState)(!1),[Z,J]=(0,n.useState)(!1),[H,M]=(0,n.useState)(!1),[Y,K]=(0,n.useState)(""),[te,le]=(0,n.useState)("https://"),[Te,Re]=(0,n.useState)({}),$e=e,[z,re]=(0,n.useState)(!!$e.textReplacer?.length),[Ce,G]=(0,n.useState)(e);e!==Ce&&(G(e),re(!!$e.textReplacer?.length));const Be=r.useElementEntityKind(),Fe=[{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"}],Ae=e.border,Ve=e.mobileBorder,Ue=Object.keys(Ae).find(D=>Ae[D]?.width||Ae[D]?.style||Ae[D]?.color),Xe=Object.keys(Ve).find(D=>Ve[D]?.width||Ve[D]?.style||Ve[D]?.color),de=D=>D&&(D?.width||D?.style||D?.color)?D:"",{remember:ye,fillFields:I}=ro(e);(0,n.useEffect)(()=>{if(e){const D=e.boxShadow||Od,q=e.mobilePadding||{},we=e.mobileAlign||{};g(D);let Ge="",_e="",B=e.href||"https://";if(e.href){if(e.href.startsWith("mailto:")){const ae=Qr(e.href);Ge=ae.subject,_e=ae.body,B=ae.baseEmail}Dt(e.href,le)}I(l,{...e,href:B,subject:Ge,body:_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",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:de(e.mobileBorder.all)||!(de(e.mobileBorder.top)||de(e.mobileBorder.bottom)||de(e.mobileBorder.right)||de(e.mobileBorder.left))&&de(e.border.all),mobileBorderTop:de(e.mobileBorder.top)||!de(e.mobileBorder.all)&&de(e.border.top),mobileBorderBottom:de(e.mobileBorder.bottom)||!de(e.mobileBorder.all)&&de(e.border.bottom),mobileBorderRight:de(e.mobileBorder.right)||!de(e.mobileBorder.all)&&de(e.border.right),mobileBorderLeft:de(e.mobileBorder.left)||!de(e.mobileBorder.all)&&de(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:bt(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:bt(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:bt(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:bt(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(we?.value)||e.align,mobileVerticalAlign:u(e.mobileVerticalAlign?.value||e.valign),mobileBackgroundColor:u(e.mobileBackgroundColor?.value||e.backgroundColor||""),...to(e),mobilePaddingTop:u(q.all)||u(q.top)||u(e.padding?.all)||u(e.padding?.top),mobilePaddingLeft:u(q.all)||u(q.left)||u(e.padding?.all)||u(e.padding?.left),mobilePaddingRight:u(q.all)||u(q.right)||u(e.padding?.all)||u(e.padding?.right),mobilePaddingBottom:u(q.all)||u(q.bottom)||u(e.padding?.all)||u(e.padding?.bottom),mobilePaddingTopBottom:u(q.top)||u(q.bottom)||u(e.padding?.top)||u(e.padding?.bottom),mobilePaddingLeftRight:u(q.left)||u(q.right)||u(e.padding?.left)||u(e.padding?.right),mobileTextAlign:Zr(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))?x(!1):x(!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))?m(!1):m(!0),y(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)?$(!1):$(!0),!u(q.all)&&(u(q.top)||u(q.right)||u(q.bottom)||u(q.left))&&(q.top!==q.bottom||q.right!==q.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)?P(!1):P(!0);const ee=a.isStaleBorderSnapshot(e,!!Ue),E=d.isStaleBorderSnapshot(e,!!Xe);ee&&l.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(E||ee&&!Xe)&&l.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),ne(ae=>Ue&&!ee?!0:ae),oe(ae=>Ue&&!ee||Xe&&!E?!0:ae),be(!!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.borderRadius?.all||!!e.borderRadius?.topLeft||!!e.borderRadius?.bottomLeft||!!e.borderRadius?.topRight||!!e.borderRadius?.bottomRight),ke(!!e.boxShadow),ze(!!e.mobileBoxShadow?.blurRadius||!!e.mobileBoxShadow?.color||!!e.mobileBoxShadow?.hOffset||!!e.mobileBoxShadow?.inset||!!e.mobileBoxShadow?.spreadRadius||!!e.mobileBoxShadow?.vOffset||!!e.boxShadow),ve(!!e.mobileWidth?.value||!!e.mobileHeight?.value||!!e.width.value||!!e.height.value),pe(!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),X(!!e.mobileBackgroundColor?.value||!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Do(e)&&X(!0),J(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),M(!!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)}},[l,e,R,Ue,Xe,a,d,I]);const se=(0,n.useCallback)(D=>{ye(D),c(Be==="email"?r.setElementSettings$1(D):r.setElementSettings(D))},[c,Be,ye]),je=D=>{const q=l.getFieldsValue(!0),we=Object.keys(D)[0];let Ge;switch(K(l.getFieldsValue(!0).widthDim==="%"?100:""),we){case"exportAsPicture":Ge={exportAsPicture:q.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Ge={boxShadow:{hOffset:q.boxShadowHOffset,vOffset:q.boxShadowVOffset,blurRadius:q.boxShadowBlurRadius,spreadRadius:q.boxShadowSpreadRadius,color:q.boxShadowColor,inset:q.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":q.borderPosition==="borderAll"?(Ge={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...q.borderAll}}},l.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):q.borderAll?.width||q.borderAll?.style||q.borderAll?.color?(Ge={border:{all:null,left:q.borderAll,right:q.borderAll,top:q.borderAll,bottom:q.borderAll,[W.REVERSE_BORDER_POSITIONS[we]]:{...q[we],...D[we]}}},l.setFieldsValue({borderAll:null,borderLeft:q.borderAll,borderRight:q.borderAll,borderTop:q.borderAll,borderBottom:q.borderAll,[we]:{...q[we],...D[we]}})):(Ge={border:{all:null,left:q.borderLeft,right:q.borderRight,top:q.borderTop,bottom:q.borderBottom,[W.REVERSE_BORDER_POSITIONS[we]]:{...q[we],...D[we]}}},l.setFieldsValue({border:Ge.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(q.mobileBorderPosition==="mobileBorderAll")Ge={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...q.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[we]+"-"}}},l.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const ee=W.MOBILE_REVERSE_BORDER_POSITIONS[we],E={...q[we],...D[we]},ae=!E?.width&&!E?.style&&!E?.color;if(q.mobileBorder?.all?.width||q.mobileBorder?.all?.style||q.mobileBorder?.all?.color){const Pe=q.mobileBorderAll;Ge={mobileBorder:{all:null,left:Pe,right:Pe,top:Pe,bottom:Pe,[ee]:ae?null:{...E,classNamePrefix:"em-mob-border_"+ee+"-"}}},l.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:Pe,mobileBorderRight:Pe,mobileBorderTop:Pe,mobileBorderBottom:Pe,[we]:E})}else{const Pe=e.mobileBorder||{},Qe=De=>{const Et=Pe[De];return Et&&(Et?.width||Et?.style||Et?.color)?Et:null};Ge={mobileBorder:{all:null,left:ee==="left"?ae?null:{...E,classNamePrefix:"em-mob-border_left-"}:Qe("left"),right:ee==="right"?ae?null:{...E,classNamePrefix:"em-mob-border_right-"}:Qe("right"),top:ee==="top"?ae?null:{...E,classNamePrefix:"em-mob-border_top-"}:Qe("top"),bottom:ee==="bottom"?ae?null:{...E,classNamePrefix:"em-mob-border_bottom-"}:Qe("bottom")}},l.setFieldsValue({[we]:E})}}break;case"width":Ge={[we]:{value:D[we],dim:q.widthDim}};break;case"height":Ge={[we]:{value:D[we],dim:q.heightDim}};break;case"widthDim":Ge={width:{value:q.width,dim:D[we]}};break;case"heightDim":Ge={height:{value:q.height,dim:D[we]}};break;case"backgroundImage":y(D[we]===""),Ge={[we]:[{...e.backgroundImage[0],value:D[we]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":Ge={padding:{left:q.paddingLeft,right:q.paddingRight,top:q.paddingTop,bottom:q.paddingBottom,[W.PADDING_POSITION[we]]:+D[we]}};break;case"paddingTopBottom":Ge={padding:{left:q.paddingLeft,right:q.paddingRight,top:+D[we],bottom:+D[we]}},q.paddingTop=q.paddingBottom=+D[we];break;case"paddingLeftRight":Ge={padding:{top:q.paddingTop,bottom:q.paddingBottom,left:+D[we],right:+D[we]}},q.paddingLeft=q.paddingRight=+D[we];break;case"borderRadiusAll":Ge={borderRadius:{[W.BORDER_RADIUS_POSITION[we]]:+D[we]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Ge={borderRadius:{topLeft:q.borderRadiusTopLeft,bottomLeft:q.borderRadiusBottomLeft,topRight:q.borderRadiusTopRight,bottomRight:q.borderRadiusBottomRight,[W.BORDER_RADIUS_POSITION[we]]:+D[we]}};break;case"mobileWidth":Ge={[we]:{classNamePrefix:"em-mob-width-",value:D[we],dim:q.mobileWidthDim}};break;case"mobileWidthDim":Ge={mobileWidth:{classNamePrefix:"em-mob-width-",value:q.mobileWidth||100,dim:D[we]}};break;case"mobileHeight":Ge={[we]:{classNamePrefix:"em-mob-height-",value:D[we],dim:q.mobileHeightDim},mobileLineHeight:{classNamePrefix:"em-mob-line_height-",value:D[we],dim:q.mobileHeightDim}};break;case"mobileHeightDim":Ge={mobileHeight:{classNamePrefix:"em-mob-height-",value:q.mobileHeight,dim:D[we]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Ge={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[we]]:D[we],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[we]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Ge={mobileBoxShadow:{hOffset:q.mobileBoxShadowHOffset,vOffset:q.mobileBoxShadowVOffset,blurRadius:q.mobileBoxShadowBlurRadius,spreadRadius:q.mobileBoxShadowSpreadRadius,color:q.mobileBoxShadowColor,inset:q.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":Ge={[we]:{classNamePrefix:"em-mob-table_align-",value:D[we]}};break;case"mobileTextAlign":Ge={[we]:{classNamePrefix:"em-mob-text_align-",value:D[we]}};break;case"mobileVerticalAlign":Ge={[we]:{classNamePrefix:"em-mob-vertical_align-",value:D[we]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Ge=fo(D),!Ge)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":Ge={mobilePadding:{all:null,top:q.mobilePaddingTop!==""?q.mobilePaddingTop:null,right:q.mobilePaddingRight!==""?q.mobilePaddingRight:null,bottom:q.mobilePaddingBottom!==""?q.mobilePaddingBottom:null,left:q.mobilePaddingLeft!==""?q.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":q.mobilePaddingTop=q.mobilePaddingBottom=D[we],Ge={mobilePadding:{all:null,top:q.mobilePaddingTop!==""?q.mobilePaddingTop:null,right:q.mobilePaddingRight!==""?q.mobilePaddingRight:null,bottom:q.mobilePaddingBottom!==""?q.mobilePaddingBottom:null,left:q.mobilePaddingLeft!==""?q.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":q.mobilePaddingLeft=q.mobilePaddingRight=D[we],Ge={mobilePadding:{all:null,top:q.mobilePaddingTop!==""?q.mobilePaddingTop:null,right:q.mobilePaddingRight!==""?q.mobilePaddingRight:null,bottom:q.mobilePaddingBottom!==""?q.mobilePaddingBottom:null,left:q.mobilePaddingLeft!==""?q.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileFontSize":Ge={[we]:{classNamePrefix:"em-mob-font_size-",value:D[we],dim:q.mobileFontSizeDim}};break;case"href":let _e=Jt(D[we]);_e!==D[we]&&(l.setFieldValue("href",_e),q.href=_e),_e.startsWith("mailto:")?Ge={[we]:Ci(_e,q.subject,q.body)}:Ge={[we]:_e},Dt(D[we],le);break;case"subject":case"body":const B=q.href||"";if(B.startsWith("mailto:")){const ee=we==="subject"?D[we]:q.subject,E=we==="body"?D[we]:q.body;Ge={href:Ci(B,ee,E)}}else return;break;case"backgroundPositionX":case"backgroundPositionY":Ge={[we]:isNaN(parseFloat(D[we].position))?D[we].position:D[we].position+D[we].unit};break;default:Ge=D}we!=="borderPosition"&&we!=="mobileBorderPosition"&&(s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ge}),we!=="mobileBorderRadiusAll"&&we!=="mobileBorderRadiusTopLeft"&&we!=="mobileBorderRadiusTopRight"&&we!=="mobileBorderRadiusBottomLeft"&&we!=="mobileBorderRadiusBottomRight"&&se({...e,...Ge,mobileBorderRadius:{...e.mobileBorderRadius,...Ge?.mobileBorderRadius},activateSection:null,changeKey:we}))},Ne=()=>{$(q=>!q);const D=l.getFieldsValue(!0);U||(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:e.type,settings:{padding:{top:D.paddingTopBottom,bottom:D.paddingTopBottom,left:D.paddingLeftRight,right:D.paddingLeftRight}}}))},He=()=>{const D=l.getFieldsValue(!0);a.markBorderToggled(!V),setTimeout(()=>{ne(q=>!q),V?(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"},s({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}}}})})},Ke=()=>{const D=l.getFieldsValue(!0);d.markBorderToggled(!T),setTimeout(()=>{oe(q=>!q),T?(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"},s({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}}}})})},tt=()=>{const D=l.getFieldsValue(!0);setTimeout(()=>{be(q=>!q),xe?(D.borderRadiusAll=0,x(!0)):D.borderRadiusAll=5,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:D.borderRadiusAll}}})})},O=()=>{const D=l.getFieldsValue(!0);setTimeout(()=>{me(q=>!q),Se?(D.mobileBorderRadiusAll=null,m(!0)):D.mobileBorderRadiusAll=5,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:D.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},ie=()=>{const D=l.getFieldsValue(!0);setTimeout(()=>{ke(q=>!q),he?(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"),s({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}}})})},j=()=>{const D=l.getFieldsValue(!0);setTimeout(()=>{ze(q=>!q),ce?(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"),s({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-"}}})})},w=()=>{const D=l.getFieldsValue(!0);setTimeout(()=>{ve(q=>!q),Oe&&(D.mobileWidth="",D.mobileHeight="",s({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-"}}}))})},ue=()=>{const D=l.getFieldsValue(!0);setTimeout(()=>{pe(q=>!q),Ee?(D.backgroundColor="",D.backgroundImage="",D.backgroundPositionX="",D.backgroundPositionY="",D.backgroundRepeat="none",D.backgroundSize="",y(!0)):(D.backgroundColor="#E5E5E5",D.backgroundSize="",D.backgroundRepeat="none"),s({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}})})},Ie=()=>{const D=l.getFieldsValue(!0);setTimeout(()=>{X(q=>!q),Q?D.mobileBackgroundColor="":D.mobileBackgroundColor=e.commonStyles.buttons.backgroundColor||"#1C52DC",s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:D.mobileBackgroundColor}}}),Q&&Vo(l,e,s)})},qe=()=>{const D=l.getFieldsValue(!0);setTimeout(()=>{J(q=>!q),Z&&(D.paddingLeftRight="",D.paddingLeft="",D.paddingRight="",D.paddingTopBottom="",D.paddingTop="",D.paddingBottom="",s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},Ze=()=>{const D=l.getFieldsValue(!0);setTimeout(()=>{M(q=>!q),H&&(D.mobilePaddingLeftRight="",D.mobilePaddingLeft="",D.mobilePaddingRight="",D.mobilePaddingTopBottom="",D.mobilePaddingTop="",D.mobilePaddingBottom="",s({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_"}}}))})},dt=D=>{l.setFieldValue("href",D!=="mergetag"?D:""),le(D)},st=(0,n.useCallback)(({target:D})=>{if(!D)return;const{selectionStart:q,selectionEnd:we}=D;Re(Ge=>Ge.target===D&&Ge.selection?.start===q&&Ge.selection?.end===we?Ge:{target:D,selection:{start:q,end:we}})},[]),ct=D=>{D.target.value!==""&&F.current.classList.add("selected-td-form__button--active")},kt=()=>{re(!z),z?(l.setFieldValue("textReplacer",""),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{textReplacer:""}})):setTimeout(()=>C.current.focus())},St=D=>{const q=D.target,we=q.value,Ge=q.selectionStart;if(Ge===0&&D.key===" "){D.preventDefault();return}if(D.key===" "){if(Ge!==we.length){D.preventDefault();return}we.endsWith(" ")&&D.preventDefault()}};return(0,t.jsxs)(o.ui_kit$Form,{form:l,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[Ue]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[Xe]||"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:je,autoComplete:"off",className:"element-controls",children:[!R&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),R?(0,t.jsx)(Ni,{form:l,elementSettings:e,showAddParagraph:!1,isButton:!0}):(0,t.jsx)(t.Fragment,{children:S==="mobile"&&k.styles?(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,t.jsx)(Fs,{form:l,fillFields:I,elementSettings:e,boxShadow:h,mobileBordersShow:T,mobileBorderRadiusShow:Se,mobileBoxShadowShow:ce,mobileSizeShow:Oe,mobileBackgroundShow:Q,mobilePaddingShow:H,mobilePaddingsExt:L,setMobilePaddingsExt:P,oneMobileBorderRadiusValue:p,setOneMobileBorderRadiusValue:m,linkProtocol:te,handleLinkProtocolsChange:dt,setLinkProtocol:le,toggleShowMobileBorderHandler:Ke,toggleShowMobileBorderRadiusHandler:O,toggleShowMobileBoxShadowHandler:j,toggleShowMobileSizeHandler:w,toggleShowMobileBackgroundHandler:Ie,toggleShowMobilePaddingHandler:Ze})}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)($s,{form:l,fillFields:I,elementSettings:e,boxShadow:h,bordersShow:V,borderRadiusShow:xe,boxShadowShow:he,backgroundShow:Ee,backgroundImageEmpty:f,backgroundRepeatOptions:Fe,paddingShow:Z,paddingsExt:U,maxWidthValue:Y,oneBorderRadiusValue:b,setOneBorderRadiusValue:x,linkProtocol:te,linkTarget:Te,isOpenTextReplacer:z,textReplacerButtonRef:F,textReplacerInputRef:C,handleLinkProtocolsChange:dt,handleSelect:st,textReplacerInputHandler:ct,handleTextReplacerKeyDown:St,srcButtonHandler:kt,togglePaddingHandler:Ne,toggleShowPaddingHandler:qe,toggleShowBackgroundHandler:ue,toggleShowBorderHandler:He,toggleShowBorderRadiusHandler:tt,toggleShowBoxShadowHandler:ie,setLinkProtocol:le,handleChangeValues:je})})})]})};Ms.propTypes={elementSettings:_.default.object.isRequired};var Ds=({elementSettings:e})=>{const{__:i}=r.useI18n(),[s]=o.ui_kit$Form.useForm(),l=r.useSendPostMessage();(0,n.useEffect)(()=>{e&&s.setFieldsValue({...e})},[s,e]);const a=d=>{l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:d})};return(0,t.jsx)(o.ui_kit$Form,{form:s,layout:"vertical",name:"selected_variable_form",initialValues:{value:""},onValuesChange:a,autoComplete:"off",children:(0,t.jsx)(o.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,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},style:{marginBottom:35},children:(0,t.jsx)(o.ui_kit$TextArea,{rows:4,placeholder:i("Variable value")})})})};Ds.propTypes={elementSettings:_.default.object.isRequired};function $d(e,i){const s=`selected_${e}_form_images_`,l=i.startsWith(s)?s:`selected_${e}_form_`;return i.startsWith(l)?i.slice(l.length):i}function Fd(e){const i=/^(.+)_(\d+)$/.exec(e);return i?{key:i[1],index:Number(i[2])}:void 0}function Md(e,i,s){return(e??[]).map((l,a)=>a===i.index?{...l,[i.key]:s}:l)}function Vs(e){return(e??[]).map((i,s)=>({...i,slideIndex:s}))}var Hs=({elementSettings:e,setElementSettings:i,postfix:s="",form:l,handleSelect:a,previewReloadSignal:d})=>{const{__:c}=r.useI18n(),{token:h}=(0,o.ui_kit$useToken)(),g=r.useAppConfig(),b=r.useSendPostMessage(),x="src"+s,p="title"+s,m="alt"+s,S="link"+s,k="imgReplacer"+s,f=(0,n.useRef)(null),y=(0,n.useRef)(null),v=(0,n.useRef)(null),N=(0,n.useRef)(null),R=(0,n.useRef)(null),C=(0,n.useRef)(null),F=(0,n.useRef)(null),U=(0,n.useRef)(null),[$,L]=(0,n.useState)(""),[P,V]=(0,n.useState)(""),[ne,T]=(0,n.useState)(""),[oe,xe]=(0,n.useState)(!1),[be,Se]=(0,n.useState)("https://"),me=(0,n.useRef)(!1),he=(0,n.useRef)(s);(0,n.useEffect)(()=>{s!==he.current&&(he.current=s,me.current=!1),V(e.images?.[m]),T(e.images?.[p]);const J=e.images?.[S];L(J||(me.current?"...":""))},[e,m,p,S,s]);const ke=()=>{$?(me.current=!1,L(""),l.setFieldValue(S,""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[S]:""}})):(me.current=!0,L(f.current&&f.current.input.value?f.current.input.value:"..."),setTimeout(()=>{f.current.focus()}))},ce=J=>{J.target.value===""?L("..."):(y.current.classList.add("selected-td-form__button--active"),L(J.target.value));const H=J.target.value;Dt(H,Se)},ze=()=>{P?(V(""),l.setFieldValue("alt",""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[m]:""}})):(V(v.current&&v.current.input.value?v.current.input.value:"..."),setTimeout(()=>{v.current.focus()}))},Oe=J=>{J.target.value===""?V("..."):(N.current.classList.add("selected-td-form__button--active"),V(J.target.value))},ve=()=>{ne?(T(!1),l.setFieldValue("title",""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[p]:""}})):(T(R.current&&R.current.input.value?R.current.input.value:"..."),setTimeout(()=>{R.current.focus()}))},Ee=()=>{xe(!oe),oe?(l.setFieldValue(k,""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[k]:""}})):setTimeout(()=>F.current.focus())},pe=J=>{J.target.value!==""&&U.current.classList.add("selected-td-form__button--active")},Q=J=>{J.target.value===""?T("..."):(C.current.classList.add("selected-td-form__button--active"),T(J.target.value))},X=J=>{l.setFieldValue("LinkName",J!=="mergetag"?J:""),Se(J)},Z=J=>{const H=l.getFieldsValue(!0),M=+s.substring(1),Y=Object.keys(H?.images).reduce((te,le)=>(le.includes(s)||(te[le]=H[le]),te),{}),K=e.carouselImages?.filter((te,le)=>le!==M);i(te=>({...te,settings:{...te.settings,carouselImages:Vs(K)}})),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:e.caption,settings:{...e,carouselImages:K}}),l.setFieldsValue({images:Y})};return(0,t.jsxs)(t.Fragment,{children:[(e.type==="img"||e.type==="video"||e.type==="carousel")&&(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,t.jsx)(Pt,{form:l,label:c("Image path"),name:x,placeholder:c("Image path"),elementSettings:e,previewReloadSignal:d,tooltipTitle:""})}),(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[(0,t.jsxs)(o.ui_kit$Space,{size:8,children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:P||c("Alternative text"),placement:"bottom",getPopupContainer:J=>J.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!P}),onClick:ze,ref:N,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),g.formFieldImageTitleEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:ne||c("Tooltip text"),placement:"bottom",getPopupContainer:J=>J.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!ne}),onClick:ve,ref:C,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:$||c("Hyperlink URL"),placement:"bottom",getPopupContainer:J=>J.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!$}),icon:(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:ke,ref:y})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:c("Image replacer"),placement:"bottom",getPopupContainer:J=>J.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":oe}),icon:(0,t.jsx)(r.EmIcons,{icon:"Replacer",component:o.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:Ee,ref:U})})]}),(0,t.jsx)(o.ui_kit$Space,{size:8,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:c("Remove slide"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{type:"text",onClick:Z,icon:(0,t.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:16})})})})]}),(!!$||!!P||!!ne||!!oe)&&(0,t.jsxs)("div",{children:[!!$&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(qt,{show:be==="#",__:c,style:{marginBottom:h.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Hyperlink URL"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:S,className:"selected-image-form__alt",style:{marginTop:h.formItemMarginBottomXS,marginBottom:0},children:(0,t.jsx)(o.ui_kit$Input,{addonBefore:(0,t.jsx)(Kt,{linkProtocol:be,handleLinkProtocolsChange:X,__:c}),placeholder:c("Hyperlink URL"),allowClear:!0,ref:f,onChange:ce,onSelect:a,prefix:(0,t.jsx)(Xt,{linkProtocol:be})})})})]}),!!P&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Alternative text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:m,className:"selected-image-form__alt",style:{marginTop:h.formItemMarginBottomXS,marginBottom:0},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:c("Alternative text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:Oe,ref:v,onSelect:a})})}),g.formFieldImageTitleEnabled&&!!ne&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Tooltip text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:p,className:"selected-image-form__alt",style:{marginTop:h.formItemMarginBottomXS,marginBottom:0},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:c("Enter the title of the image"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:Q,ref:R,onSelect:a})})}),!!oe&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Image src"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:k,className:"selected-image-form__alt",style:{marginTop:h.formItemMarginBottomXS,marginBottom:0},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:c("Code that will replace the image `src`"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:c("Image src")}),onChange:pe,ref:F,onSelect:a})})})]})]})};Hs.propTypes={};var Us=({form:e,elementSettings:i,formFields:s,setElementSettings:l,borderRadiusShow:a,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,linkProtocol:h,mergeTagItems:g,mergeMenuOpen:b,setMergeMenuOpen:x,cascaderRef:p,handleLinkProtocolsChange:m,handleSelect:S,onChange:k,filter:f,renderSearchOption:y,toggleShowBorderRadiusHandler:v,setNewSlide:N})=>{const{__:R}=r.useI18n(),{token:C}=(0,o.ui_kit$useToken)(),F=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(qt,{show:h==="#",__:R,style:{marginBottom:C.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:R("Link for all slides"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"link",children:(0,t.jsx)(o.ui_kit$Input,{addonBefore:(0,t.jsx)(Kt,{linkProtocol:h,handleLinkProtocolsChange:m,__:R}),placeholder:R("Link for all slides"),allowClear:!0,onSelect:S,prefix:(0,t.jsx)(Xt,{linkProtocol:h})})})}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"}),F.mergeTagsShow&&g&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Col,{span:24,id:"merge_tags_wrapper",children:(0,t.jsxs)(o.ui_kit$Form.Item,{style:{marginBottom:C.formItemMarginBottomMD,marginTop:C.formItemMarginBottomMD},children:[(0,t.jsx)(o.ui_kit$Button,{id:"merge_tags_button",icon:(0,t.jsx)(r.EmIcons,{icon:"MergeTags",component:o.icons$MergeTags}),style:{width:"100%",display:b?"none":"inline-flex"},onClick:()=>x(!0),children:R("Merge tags")}),(0,t.jsx)(o.ui_kit$Cascader,{ref:p,classNames:{popup:{root:"merge-tags"}},options:g,placeholder:R("Start typing the title"),showSearch:{filter:f,render:y},spellCheck:"false",getPopupContainer:U=>U.closest(".email-pane__collapse-wrapper"),onChange:k,style:{display:b?"block":"none"},open:b,onKeyDown:U=>{U.key==="Escape"&&x(!1)}})]})}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"})]}),(0,t.jsx)(o.ui_kit$Form.List,{name:"images",initialValue:s?.images,children:()=>(0,t.jsx)("div",{style:{paddingTop:C.formItemMarginBottomMD+4},children:i?.settings?.carouselImages?.map((U,$)=>(0,t.jsx)("div",{className:"carousel__slide",children:(0,t.jsx)(Hs,{elementSettings:s,setElementSettings:l,postfix:"_"+$,form:e,handleSelect:S})},$))})}),(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:C.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$Button,{id:"add_slide_button",icon:(0,t.jsx)(r.EmIcons,{icon:"AddSlide",component:o.icons$AddSlide}),style:{width:"100%"},onClick:()=>N(),children:R("Add slide")})})}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:20,style:{marginTop:C.formItemMarginBottomMD-10},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"loop",valuePropName:"checked",style:{marginBottom:C.formItemMarginBottomMD-6},children:(0,t.jsx)(o.ui_kit$Switch,{id:"Loop",label:R("Loop"),size:"small",labelStyle:{position:"relative",top:2}})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"autoplay",valuePropName:"checked",style:{marginBottom:C.formItemMarginBottomMD-6},children:(0,t.jsx)(o.ui_kit$Switch,{id:"Autoplay",label:R("Autoplay"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),F.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:R("Border radius"),collapsible:!0,open:a,onToggle:v,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,elementSettings:i.settings})})]})};Us.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,formFields:_.default.object,setElementSettings:_.default.func,borderRadiusShow:_.default.bool,oneBorderRadiusValue:_.default.bool,setOneBorderRadiusValue:_.default.func,linkProtocol:_.default.string,mergeTagItems:_.default.array,mergeMenuOpen:_.default.bool,setMergeMenuOpen:_.default.func,cascaderRef:_.default.object,handleLinkProtocolsChange:_.default.func,handleSelect:_.default.func,onChange:_.default.func,filter:_.default.func,renderSearchOption:_.default.func,toggleShowBorderRadiusHandler:_.default.func,setNewSlide:_.default.func};var Ws=()=>{const{__:e}=r.useI18n();return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("p",{children:e("No properties to edit.")})})};Ws.propTypes={};var Dd={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 Vd(e){const i={...Pi(e)};return delete i.parent,delete i.path,delete i.nextElem,delete i.prevElem,i}var zs=({elementSettings:e})=>{const{__:i}=r.useI18n(),[s]=o.ui_kit$Form.useForm();let l=r.useDispatch();r.useAppConfig();const a=r.useSendPostMessage(),d=r.useSendPostMessageEx(),{openImagePicker:c}=r.useImagePicker(),h=r.useSelector(r.selectEmailViewType),g=r.useSelector(r.selectMobileViewActive),[b,x]=(0,n.useState)(!0),[p,m]=(0,n.useState)(!0),[S,k]=(0,n.useState)(!1),[f,y]=(0,n.useState)(!1),[v,N]=(0,n.useState)("https://"),[R,C]=(0,n.useState)(s?.getFieldsValue(!0)),[F,U]=(0,n.useState)(e),{remember:$,isOwnEcho:L}=rs(Vd),[P,V]=(0,n.useState)(e);e!==P&&(V(e),L(e?.settings)||U(e));const[ne,T]=(0,n.useState)({name:"",counter:0}),[oe,xe]=(0,n.useState)(null),[be,Se]=(0,n.useState)(),[me,he]=(0,n.useState)(!1),[ke,ce]=(0,n.useState)(!1),[ze,Oe]=(0,n.useState)({start:0,end:0}),ve=(0,n.useRef)(null),Ee=`selected_${F.type}_form_link`,pe=r.useSelector(r.selectIsCodeMode),Q=r.useSelector(r.selectCodeModeDirection),X=pe&&Q!=="bottom";(0,n.useEffect)(()=>{me&&ve.current&&ve.current.focus()},[me]);const Z=(G,Be)=>{const Fe=document.getElementById(Be);if(Fe){const Ae=F,Ve=$d(Ae.type,Be),Ue=Fd(Ve),Xe=Fe.value?.substring(0,ze.start),de=Fe.value?.substring(ze.end);let ye={[Ve]:Xe+G+de};Ue?ye={carouselImages:Md(Ae.settings?.carouselImages,Ue,Xe+G+de)}:F.type===r.ELEMENT_TYPES.CAROUSEL&&Ee===Be&&(ye={[Ve]:Xe+G+de,carouselImages:[...F.settings?.carouselImages.map(I=>({...I,link:Xe+G+de}))||[]]}),a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...F.settings,...ye}}),U(I=>({...I,settings:{...I.settings,...ye}})),s.setFieldValue(Ve,Xe+G+de),Fe.focus(),setTimeout(()=>{Fe.selectionStart=ze.start,Fe.selectionEnd=ze.start+G.length},400),ce(!0)}},J=r.useAppConfig().mergeTags;(0,n.useEffect)(()=>{J?.items?.length&&Se(r.mapMargeTags(J.items))},[J,Se]);const H=(G,Be)=>{if(he(!1),G){const Fe=J.syntax.length>1?be.findIndex(Ue=>Ue.key===Be[0].key):0,Ae=J.syntax[Fe].replace("%value%",G[G.length-1]),Ve=`selected_${F.type}_form${F.type==="carousel"?"_images":""}`;["imgReplacer","title","alt","src","link"].some(Ue=>oe?.getAttribute("id").includes(`${Ve}_${Ue}`))||oe?.getAttribute("id").includes(Ee)?Z(Ae,oe?.getAttribute("id")):(s.setFieldValue("imgReplacer",Ae),a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...F.settings,imgReplacer:Ae}}),U(Ue=>({...Ue,settings:{...Ue.settings,imgReplacer:Ae}})))}},M=r.useRootElement();(0,n.useEffect)(()=>{const G=({target:Ae})=>{Ae.closest('[id="merge_tags_wrapper"]')||xe(Ae)},Be=({target:Ae})=>{!Ae.closest(".merge-tags")&&!Ae.closest("#merge_tags_button")&&he(!1)},Fe=new ht.Disposable;return Fe.addDisposable(r.addWindowListenerFromShadow(M,"focusin",G)),Fe.addDisposable(r.addWindowListenerFromShadow(M,"click",Be)),()=>{Fe.dispose()}},[M]);const Y=(G,Be)=>Be.some(Fe=>Fe.label.toLowerCase().indexOf(G.toLowerCase())>-1),K=(G,Be)=>{const Fe=Be.map((Ae,Ve)=>{const Ue=Ae.label.split(new RegExp(`(${G})`,"gi"));return(0,t.jsxs)("span",{children:[Ve!==0&&(0,t.jsx)("span",{children:" / "}),Ue.map((Xe,de)=>Xe.toLowerCase()===G.toLowerCase()?(0,t.jsx)("span",{style:{color:"red"},children:Xe},de):Xe)]},Ae.value)});return(0,t.jsx)("div",{title:Be.map(Ae=>Ae.label).join(" / "),children:Fe})};(0,n.useEffect)(()=>{const G=s?.getFieldsValue(!0);C(G)},[s]);const te=({target:G})=>{if(G&&!ke){const{selectionStart:Be,selectionEnd:Fe}=G;Oe({start:Be,end:Fe})}ce(!1)};(0,n.useEffect)(()=>{if(F.settings){const G=F.settings,Be=Pi(G);s?.setFieldsValue(Be),C(Be),G.link&&N($o(G.link,"https://")),u(G.borderRadius?.all)||(u(G.borderRadius?.topLeft)||u(G.borderRadius?.bottomLeft)||u(G.borderRadius?.topRight)||u(G.borderRadius?.bottomRight)?x(!1):u(G.borderRadius?.all)||x(!0)),u(G.mobileBorderRadius?.topLeft)||u(G.mobileBorderRadius?.bottomLeft)||u(G.mobileBorderRadius?.topRight)||u(G.mobileBorderRadius?.bottomRight)?m(!1):m(!0),k(!!G.borderRadius?.all||!!G.borderRadius?.topLeft||!!G.borderRadius?.bottomLeft||!!G.borderRadius?.topRight||!!G.borderRadius?.bottomRight),y(!!G.mobileBorderRadius?.all||!!G.mobileBorderRadius?.topLeft||!!G.mobileBorderRadius?.bottomLeft||!!G.mobileBorderRadius?.topRight||!!G.mobileBorderRadius?.bottomRight)}},[s,F]);const le=G=>{const Be=es(F.settings,s,G);a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:Be.caption,settings:Be}),$({...F.settings,...Be}),U(Fe=>({...Fe,settings:{...Fe.settings,...Be}}))},Te=(G,Be)=>{const Fe=r.stripEmVersionFromUrlString(F.settings?.src||"")===r.stripEmVersionFromUrlString(G||"");(!Fe||G!==F.settings?.src)&&le({src:G}),Be?.mode==="save"&&Fe&&(T(Ae=>({name:"src",counter:Ae.counter+1})),d(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(G)}))},Re=async G=>{const Be=F.settings?.src||"",Fe=r.stripEmVersionFromUrlString(Be),Ae=await c({kind:"img",currentUrl:bo(Fe)?"":Fe,entryModal:G});Ae?.url&&Te(Ae.url,Ae.meta)},$e=G=>{const Be=G.data.operation;Be===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?Re(r.MODALS.UPLOAD_IMAGE_MODAL_AI):Be===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?Re(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):Be===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?Re(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):Be===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?Re(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):Be===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?Re(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK):Be===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(l(r.closeSecondModal()),l(r.closeModal$1()))};r.useListenPostMessage($e);const z=()=>{setTimeout(()=>{k(G=>!G),s.setFieldValue("borderRadiusAll",S?0:5),a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...F.settings,borderRadius:{all:S?"":5}}}),U(G=>({...G,settings:{...G.settings,borderRadius:{all:S?null:5}}}))})},re=G=>{s.setFieldValue("link",G!=="mergetag"?G:""),N(G)},Ce=()=>{const{width:G,height:Be,renderedWidth:Fe,renderedHeight:Ae}=F?.settings?.carouselImages[0]||{width:{value:600},height:{value:600},renderedWidth:600,renderedHeight:600},Ve={src:"https://emcdn.ru/1865/231031_17_BGU9Mso.png",width:{value:G.value,dim:"px"},height:{value:Be.value,dim:"px"},alt:"",title:"",link:null,renderedWidth:Fe,renderedHeight:Ae,imgReplacer:"",mobileWidth:{value:null,dim:"px"},mobileHeight:{value:null,dim:"px"},mobileBorderRadius:{all:null,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}},Ue=[...F?.settings?.carouselImages,Ve];a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...F.settings,carouselImages:Ue}});const Xe=Vs(Ue);U(de=>({...de,settings:{...de.settings,carouselImages:Xe}}))};return(0,t.jsxs)(o.ui_kit$Form,{form:s,layout:"vertical",name:"selected_carousel_form",initialValues:Dd,onValuesChange:le,autoComplete:"off",className:"element-controls",children:[!X&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),h==="mobile"&&g.styles?(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,t.jsx)(Ws,{})}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(Us,{form:s,elementSettings:F,formFields:R,setElementSettings:U,borderRadiusShow:S,oneBorderRadiusValue:b,setOneBorderRadiusValue:x,linkProtocol:v,mergeTagItems:be,mergeMenuOpen:me,setMergeMenuOpen:he,cascaderRef:ve,handleLinkProtocolsChange:re,handleSelect:te,onChange:H,filter:Y,renderSearchOption:K,toggleShowBorderRadiusHandler:z,setNewSlide:Ce})})]})};zs.propTypes={};var Hd={animate:!0,expandSingleSection:!0,sections:[{expanded:!1,index:0}]},Gs=({elementSettings:e})=>{const{__:i}=r.useI18n(),{token:s}=(0,o.ui_kit$useToken)(),[l]=o.ui_kit$Form.useForm(),a=r.useSendPostMessage(),d=r.useAppConfig(),[c,h]=(0,n.useState)(e),[g,b]=(0,n.useState)(e);e!==g&&(b(e),h(e)),(0,n.useEffect)(()=>{if(c.settings){const S=c.settings,k=Pi(S);l?.setFieldsValue(k)}},[l,c]);const x=S=>{const k=es(c.settings,l,S);a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:c.type,caption:k.caption,settings:k}),h(f=>({...f,settings:{...f.settings,...k}}))},p=()=>{h(S=>({...S,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.")}})},m=S=>{h(k=>({...k,settings:{...k.settings,sections:c.settings.sections?.filter((f,y)=>y!==S)}})),a({operation:r.EVENT_TYPES.SANDBOX_ACCORDION_REMOVE_SECTION,settings:{index:S}})};return(0,t.jsx)(o.ui_kit$Form,{form:l,layout:"vertical",name:"selected_carousel_form",initialValues:Hd,onValuesChange:x,autoComplete:"off",className:"element-controls",children:(0,t.jsxs)("div",{id:"selected_element_form_desktop_props",children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:20,children:[(0,t.jsx)(o.ui_kit$Col,{span:15,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"expandSingleSection",valuePropName:"checked",children:(0,t.jsx)(o.ui_kit$Switch,{id:"ExpandSingleSection",label:i("Expand only one section"),size:"small",labelStyle:{position:"relative",top:2}})})}),(0,t.jsx)(o.ui_kit$Col,{span:9,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"animate",valuePropName:"checked",children:(0,t.jsx)(o.ui_kit$Switch,{id:"Animate",label:i("Animate"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,t.jsx)(o.ui_kit$Form.List,{name:"sections",children:()=>(0,t.jsx)("div",{style:{paddingTop:s.formItemMarginBottomMD+4},children:c?.settings?.sections?.map((S,k)=>(0,t.jsxs)(o.ui_kit$Row,{gutter:24,children:[(0,t.jsx)(o.ui_kit$Col,{span:20,children:(0,t.jsxs)(o.ui_kit$Space,{size:10,align:"baseline",children:[(0,t.jsx)("span",{style:{position:"relative",top:2},children:i("Section ")+(k+1)}),(0,t.jsx)(o.ui_kit$Form.Item,{name:`expanded_${k}`,valuePropName:"checked",children:(0,t.jsx)(o.ui_kit$Switch,{id:`expanded_${k}`,label:i("expanded"),labelSize:"small",size:"small"})})]})}),(0,t.jsx)(o.ui_kit$Col,{children:c?.settings?.sections?.length>1&&(0,t.jsx)(o.ui_kit$Button,{type:"text",icon:(0,t.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:16}),style:{marginRight:"auto"},onClick:()=>m(k)})})]},`expanded_${k}`))})}),(0,t.jsx)(o.ui_kit$Row,{gutter:20,children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:s.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$Button,{style:{display:"inline-flex",alignItems:"center",width:"100%"},icon:(0,t.jsx)(r.EmIcons,{icon:"PlusCircleOutlined",component:o.icons$PlusCircleOutlined,size:16,strokeWidth:d.iconStrokeWidth}),onClick:()=>p(),children:i(" Add section")})})})}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"})]})})};Gs.propTypes={};var{Text:Ud}=o.ui_kit$Typography,Wd="em",Ys="text/plain",zd=(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"}),Gd=(0,t.jsx)("span",{className:"addon-text-content",children:"Title"});function Ct(e){return e.closest(".email-pane__collapse-wrapper")}function zo({form:e,name:i,placeholder:s,usedColors:l,onColorChange:a}){const d=o.ui_kit$Form.useWatch(i,e);return(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:s,usedColors:l,value:typeof d=="string"?d:"",onChange:c=>a(i,c)})}var Yd=/^[a-z][a-z0-9+.-]*:/i;function Xs(e){const i=Jt(typeof e=="string"?e:String(e??""));return i?Yd.test(i)?i:`https://${i}`:""}function Xd(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 Kd(e){const i=Xs(e);if(!i)return!1;try{const s=new URL(i);return!(s.protocol!=="http:"&&s.protocol!=="https:"||!s.hostname)}catch{return!1}}async function Ks(e,i){if(i===r.MODALS.UPLOAD_IMAGE_MODAL_EDIT&&bo(e)){try{const s=new URL(e,typeof window<"u"&&window.location?window.location.origin:"http://localhost").href,l=await fetch(s);if(l.ok){const a=await l.blob();return{entryModal:i,currentUrl:"",imageDataUrl:await new Promise((d,c)=>{const h=new FileReader;h.onload=()=>d(h.result),h.onerror=c,h.readAsDataURL(a)})}}}catch{}return{entryModal:r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,currentUrl:""}}return{entryModal:i,currentUrl:e}}function qd(){const e=r.useSelector(r.selectEditorThemeColor$1),[i,s]=(0,n.useState)(()=>typeof document<"u"&&document.body.classList.contains("dark"));return(0,n.useEffect)(()=>{const l=()=>s(document.body.classList.contains("dark"));l();const a=new MutationObserver(l);return a.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>a.disconnect()},[]),e==="vs-dark"||i?"dark":"light"}function Jd(e){const i=String(e?.bgColor??"").trim();return{blockBgEnabled:!!(e?.bgEnabled&&i),blockBgColor:i}}function Go(e,i,s){return{...e,buttonBgColor:i,hostCellBgForIconLuminance:String(s??"").trim()}}function qs(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 Js(e){if(!Array.isArray(e)||e.length===0)return"";const i=e.map(l=>l.customIcon?"":String(l?.itemBorderColor??"").trim()),s=i[0];return i.every(l=>l===s)?s:""}function Yo(e,i){const s=String(e??"").trim(),l=String(i??"").trim();return l||s}function Qd(e,i){const s=String(e??"").trim(),l=String(i??"").trim();return!l||s&&l===s?"":l}function Zd(e,i,s){const l=String(e??"").trim(),a=String(i??"").trim(),d=String(s??"").trim();return d&&(!l||d!==l)?d:a}function ec(e,i){return(e||[]).map(s=>({...s,itemBorderColor:s.customIcon?"":i}))}function tc(e,i,s){return(e||[]).map(l=>({...l,buttonBgColor:l.customIcon?"":Zd(i,s,l.buttonBgColor)}))}function oc(e,i){if(e==null)return;const s=(l,a)=>{if(!a||!Object.prototype.hasOwnProperty.call(a,"platform"))return;const d=a.platform;d==null||d===""||i(l,d)};if(Array.isArray(e))e.forEach((l,a)=>{s(a,l)});else if(typeof e=="object")for(const l of Object.keys(e)){const a=Number.parseInt(l,10);Number.isNaN(a)||s(a,e[l])}}function Qs({__:e,form:i,fieldName:s,pushSettingsToIframe:l,onMetaActiveChange:a}){const{token:d}=(0,o.ui_kit$useToken)(),c=o.ui_kit$Form.useWatch(["items",s],i),h=c&&typeof c=="object"?c:{},g=typeof h.alt=="string"?h.alt:"",b=typeof h.title=="string"?h.title:"",[x,p]=(0,n.useState)(!1),[m,S]=(0,n.useState)(!1),k=(0,n.useRef)(null),f=(0,n.useRef)(null),y=(0,n.useMemo)(()=>({clearIcon:(0,t.jsx)(o.ui_kit$ColorPickerClearGlyph,{})}),[]);(0,n.useEffect)(()=>{g.trim()&&p(!0)},[g]);const v=!!(g.trim()||x),N=!!(b.trim()||m),R=v||N;(0,n.useLayoutEffect)(()=>{a(s,{alt:v,title:N})},[v,s,a,N]);const C=(0,n.useMemo)(()=>({marginBottom:R?d.formItemMarginBottomXS:0}),[R,d.formItemMarginBottomXS]),F=(0,n.useMemo)(()=>[s,"alt"],[s]),U=(0,n.useMemo)(()=>[s,"title"],[s]),$=R?"selected-social-form__meta-fields":"selected-social-form__meta-fields is-hidden",L=v?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",P=N?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",V=(0,n.useMemo)(()=>g.trim()?g.trim():e("Alternative text"),[e,g]),ne=(0,n.useMemo)(()=>b.trim()?b.trim():e("Tooltip text"),[e,b]),T=(0,n.useMemo)(()=>(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":v}),[v]),oe=(0,n.useMemo)(()=>(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":N}),[N]),xe=(0,n.useCallback)(me=>{setTimeout(()=>{const he=me.current;if(he){if(typeof he.focus=="function"){he.focus();return}he.input&&typeof he.input.focus=="function"&&he.input.focus()}},0)},[]),be=(0,n.useCallback)(()=>{v?(p(!1),g.trim()&&(i.setFieldValue(["items",s,"alt"],""),setTimeout(()=>l(),0))):(p(!0),xe(k))},[v,g,s,xe,i,l]),Se=(0,n.useCallback)(()=>{if(N)a(s,{title:!1}),S(!1),b.trim()&&(i.setFieldValue(["items",s,"title"],""),setTimeout(()=>l(),0));else{S(!0),a(s,{title:!0});const me=g.trim();i.setFieldValue(["items",s,"title"],me),setTimeout(()=>l(),0),xe(f)}},[g,s,xe,i,a,l,N,b]);return(0,t.jsxs)("div",{className:"selected-social-form__meta-block",children:[(0,t.jsxs)(o.ui_kit$Space,{size:8,className:"selected-social-form__meta-toggle-row",style:C,children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:V,placement:"bottom",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Button,{type:"default",className:T,onClick:be,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:ne,placement:"bottom",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Button,{type:"default",className:oe,onClick:Se,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"})})})]}),(0,t.jsxs)("div",{className:$,children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:F,className:L,children:(0,t.jsx)(o.ui_kit$Input,{ref:k,placeholder:e("Alternative text"),allowClear:y,prefix:zd})}),(0,t.jsx)(o.ui_kit$Form.Item,{name:U,className:P,children:(0,t.jsx)(o.ui_kit$Input,{ref:f,placeholder:e("Social network name"),allowClear:y,prefix:Gd})})]})]})}Qs.propTypes={__:_.default.func.isRequired,form:_.default.object.isRequired,fieldName:_.default.oneOfType([_.default.number,_.default.string]).isRequired,pushSettingsToIframe:_.default.func.isRequired,onMetaActiveChange:_.default.func.isRequired};function ic(e,i){if(!Array.isArray(e)||e.length===0)return i;let s=null;for(const l of e){const a=l.iconWidth;if(a==null||Number.isNaN(a)||a<=0)return i;if(s===null)s=a;else if(a!==s)return i}return s??i}function rc(e){if(!e)return{align:"center",iconSize:40,borderRadius:0,gap:8,globalBgColor:"",globalItemBorderColor:"",buttonBorderWidth:0,showLabel:!1,items:[]};const i=Jd(e),s=String(e?.hostCellBgForIconLuminance??"").trim(),l=ic(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:l,borderRadius:e.borderRadius??0,gap:e.gap??8,globalBgColor:d,globalItemBorderColor:Js(e.items),buttonBorderWidth:a,showLabel:e.showLabel??!1,items:Array.isArray(e.items)?e.items.map(c=>{const h=!!c.customIcon,g=h?"":Yo(d,c.buttonBgColor),b=c.platform&&!h?r.getSocialIconForBlockCell(c.platform,Go(i,g,s)):null;return{...c,customIcon:h,title:String(c.title??"").trim(),...b?{iconSrc:b}:{},iconWidth:null,iconHeight:null,buttonBgColor:g,itemBorderColor:h?"":String(c.itemBorderColor??"").trim()}}):[]}}var Zs=({elementSettings:e})=>{const{__:i}=r.useI18n(),s=r.useAppConfig(),l=r.useDispatch(),[a]=o.ui_kit$Form.useForm(),d=r.useSendPostMessage(),c=r.useSendPostMessageEx(),{openImagePicker:h}=r.useImagePicker(),[g,b]=(0,n.useState)(e),[x,p]=(0,n.useState)(null),[m,S]=(0,n.useState)(null),k=(0,n.useRef)(null),f=(0,n.useRef)(null),y=(0,n.useRef)(null),v=(0,n.useRef)(qs(e)),N=r.useSelector(r.selectEmailSettings),R=(0,n.useRef)(null),C=(0,n.useRef)(!1),F=(0,n.useRef)(""),U=(0,n.useRef)({}),$=qd(),L=N?.usedColors??[],P=o.ui_kit$Form.useWatch("items",a)||[],V=(0,n.useCallback)(()=>{R.current&&(document.removeEventListener("dragover",R.current,!0),R.current=null)},[]),ne=(0,n.useCallback)(()=>{if(R.current)return;const z=re=>{re.preventDefault(),re.dataTransfer&&(re.dataTransfer.dropEffect="move")};document.addEventListener("dragover",z,!0),R.current=z},[]),T=(0,n.useMemo)(()=>r.getSocialPresetsForBrand(Wd).filter(z=>r.SOCIAL_ICON_ORIGINAL_BY_PLATFORM[z.id]),[]),oe=(0,n.useMemo)(()=>T.map(z=>({value:z.id,label:(0,t.jsxs)("span",{className:"selected-social-form__platform-option",children:[(0,t.jsx)("img",{src:r.getSocialIcon(z.id,$),alt:""}),(0,t.jsx)("span",{className:"selected-social-form__platform-option-text",children:i(z.labelMsgid)})]})})),[i,T,$]),xe=(0,n.useCallback)((z,re)=>{U.current={...U.current,[z]:{...U.current[z],...re}}},[]);(0,n.useEffect)(()=>{const z=qs(e);v.current!==z&&(v.current=z,U.current={},b(e))},[e]);const be=(0,n.useRef)(!1);(0,n.useEffect)(()=>{if(g?.settings){if(be.current){be.current=!1;return}const z=g.settings;F.current=z.bgEnabled&&z.bgColor?String(z.bgColor).trim():"",a.setFieldsValue(rc(g.settings))}},[g,a]),(0,n.useEffect)(()=>()=>V(),[V]);const Se=(0,n.useCallback)(()=>{const z=a.getFieldsValue(!0),re=g.settings||{},Ce=String(re.hostCellBgForIconLuminance??"").trim(),G=(z.globalBgColor||"").trim(),Be=typeof z.iconSize=="number"&&!Number.isNaN(z.iconSize)?z.iconSize:re.iconSize??40,Fe=typeof z.borderRadius=="number"&&!Number.isNaN(z.borderRadius)?z.borderRadius:re.borderRadius??0,Ae=typeof z.gap=="number"&&!Number.isNaN(z.gap)?z.gap:re.gap??8,Ve={blockBgEnabled:!!G,blockBgColor:G},Ue=(z.globalItemBorderColor||"").trim();let Xe=typeof z.buttonBorderWidth=="number"&&!Number.isNaN(z.buttonBorderWidth)?z.buttonBorderWidth:0;Xe=Math.max(0,Math.min(24,Math.round(Xe)));const de={...re,type:"social",align:z.align??re.align??"center",iconSize:Be,borderRadius:Fe,gap:Ae,bgEnabled:!!G,bgColor:G,hostCellBgForIconLuminance:Ce,borderWidth:typeof re.borderWidth=="number"?re.borderWidth:0,borderColor:typeof re.borderColor=="string"?re.borderColor:"",buttonBorderColor:"",buttonBorderWidth:Xe,showLabel:z.showLabel,items:(z.items||[]).filter(Boolean).map((ye,I)=>{const se=!!ye.customIcon,je=U.current[I]||{},Ne=se?"":Qd(G,(ye.buttonBgColor||"").trim()),He=typeof ye.href=="string"?Xs(ye.href):ye.href,Ke=se?"":Yo(G,Ne),tt=!se&&ye.platform?r.getSocialIconForBlockCell(ye.platform,Go(Ve,Ke,Ce)):null,O=se?"":Ue||String(ye.itemBorderColor??"").trim(),ie=Xd(se?ye.iconSrc||"":tt||ye.iconSrc||"");return{...ye,customIcon:se,href:He,iconSrc:ie,iconWidth:null,iconHeight:null,buttonBgColor:Ne,itemBorderColor:O,title:je.title?String(ye.title??"").trim():""}})};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.SOCIAL,caption:g.caption,settings:de}),F.current=G,be.current=!0,b(ye=>({...ye,settings:de}))},[g.caption,g.settings,a,d]),me=(0,n.useCallback)(z=>{if(z==null||z==="")return-1;const re=r.stripEmVersionFromUrlString(String(z));return(a.getFieldValue("items")||[]).findIndex(Ce=>r.stripEmVersionFromUrlString(Ce&&Ce.iconSrc||"")===re)},[a]),he=(0,n.useCallback)((z,re,Ce,G)=>{const Be=[...a.getFieldValue("items")||[]];if(z<0||z>=Be.length)return;const Fe=r.stripEmVersionFromUrlString(String(G||""))===r.stripEmVersionFromUrlString(String(re||""));(!Fe||re!==Be[z]?.iconSrc)&&(Be[z]={...Be[z],iconSrc:re,customIcon:!0,buttonBgColor:"",itemBorderColor:""},a.setFieldValue("items",Be),setTimeout(()=>Se(),0)),Ce?.mode==="save"&&Fe&&c(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(re)})},[a,Se,c]),ke=(0,n.useCallback)(async(z,re)=>{const Ce=r.stripEmVersionFromUrlString(String(re||"")),G=me(re);if(G<0)return;const Be=(a.getFieldValue("items")||[])[G]?.iconSrc,{entryModal:Fe,currentUrl:Ae,imageDataUrl:Ve}=await Ks(Ce,z),Ue=await h({kind:"img",currentUrl:Ae,entryModal:Fe,imageDataUrl:Ve});Ue?.url&&he(G,Ue.url,Ue.meta,Be)},[he,me,a,h]),ce=(0,n.useCallback)(async z=>{const re=(a.getFieldValue("items")||[])[z];if(!re)return;const{entryModal:Ce,currentUrl:G,imageDataUrl:Be}=await Ks(r.stripEmVersionFromUrlString(String(re.iconSrc||"")),r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD),Fe=re.iconSrc,Ae=await h({kind:"img",currentUrl:G,entryModal:Ce,imageDataUrl:Be});Ae?.url&&he(z,Ae.url,Ae.meta,Fe)},[he,a,h]),ze=(0,n.useCallback)(z=>{const re=parseInt(z.currentTarget.dataset.socialEditIndex??"",10);Number.isNaN(re)||ce(re)},[ce]),Oe=(0,n.useCallback)(z=>{const re=z.data?.operation,Ce=z.data?.src;re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?ke(r.MODALS.UPLOAD_IMAGE_MODAL_AI,Ce):re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?ke(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,Ce):re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?ke(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT,Ce):re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?ke(r.MODALS.UPLOAD_IMAGE_MODAL_GIF,Ce):re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?ke(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK,Ce):re===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(l(r.closeSecondModal()),l(r.closeModal$1()))},[l,ke]);r.useListenPostMessage(Oe);const ve=(0,n.useCallback)(()=>{const z=a.getFieldValue("items")||[],re=T[0],Ce=(a.getFieldValue("globalItemBorderColor")||"").trim(),G=(a.getFieldValue("globalBgColor")||"").trim();if(!re)a.setFieldsValue({items:[...z,{platform:void 0,customIcon:!1,href:"",alt:"",title:"",iconSrc:"",iconWidth:null,iconHeight:null,buttonBgColor:G,itemBorderColor:Ce}]});else{const Be=String(g?.settings?.hostCellBgForIconLuminance??"").trim(),Fe=Yo(G,G),Ae=r.getSocialIconForBlockCell(re.id,Go({blockBgEnabled:!!G,blockBgColor:G},Fe,Be)),Ve=i(re.labelMsgid);a.setFieldsValue({items:[...z,{platform:re.id,customIcon:!1,href:"",alt:Ve,title:"",iconSrc:Ae,iconWidth:null,iconHeight:null,buttonBgColor:G,itemBorderColor:Ce}]})}setTimeout(()=>Se(),0)},[i,g?.settings?.hostCellBgForIconLuminance,a,T,Se]),Ee=(0,n.useCallback)((z,re)=>{z.dataTransfer.setData(Ys,String(re)),z.dataTransfer.setData(r.DND_SOCIAL_LIST_REORDER_MIME,String(re)),z.dataTransfer.effectAllowed="move",k.current=re,p(re),ne()},[ne]),pe=(0,n.useCallback)(()=>{V(),k.current=null,p(null),S(null)},[V]),Q=(0,n.useCallback)((z,re,Ce)=>{if(Ce<2)return;z.preventDefault(),z.dataTransfer.dropEffect="move";const G=k.current;G!==null&&G!==re&&S(re)},[]),X=(0,n.useCallback)((z,re)=>{z.currentTarget.contains(z.relatedTarget)||S(Ce=>Ce===re?null:Ce)},[]),Z=(0,n.useCallback)((z,re,Ce)=>{z.preventDefault(),S(null);const G=z.dataTransfer.getData(Ys),Be=parseInt(G,10);if(Number.isNaN(Be)||Be===re){V();return}Ce(Be,re),V(),setTimeout(()=>Se(),0)},[V,Se]),J=(0,n.useCallback)(z=>{const re=z.currentTarget,Ce=parseInt(re.dataset.itemIndex??"",10);Number.isNaN(Ce)||Ee(z,Ce)},[Ee]),H=(0,n.useCallback)(z=>{const re=z.currentTarget,Ce=parseInt(re.dataset.itemIndex??"",10),G=parseInt(re.dataset.listLength??"",10);Number.isNaN(Ce)||Number.isNaN(G)||G<2||(z.preventDefault(),z.dataTransfer&&(z.dataTransfer.dropEffect="move"))},[]),M=(0,n.useCallback)(z=>{const re=z.currentTarget,Ce=parseInt(re.dataset.itemIndex??"",10),G=parseInt(re.dataset.listLength??"",10);Number.isNaN(Ce)||Number.isNaN(G)||Q(z,Ce,G)},[Q]),Y=(0,n.useCallback)(z=>{const re=parseInt(z.currentTarget.dataset.itemIndex??"",10);Number.isNaN(re)||X(z,re)},[X]),K=(0,n.useCallback)(z=>{const re=parseInt(z.currentTarget.dataset.itemIndex??"",10),Ce=f.current;Number.isNaN(re)||typeof Ce!="function"||Z(z,re,Ce)},[Z]),te=(0,n.useCallback)(z=>{z.stopPropagation();const re=parseInt(z.currentTarget.dataset.fieldName??"",10),Ce=y.current;Number.isNaN(re)||typeof Ce!="function"||(Ce(re),queueMicrotask(Se))},[Se]),le=(0,n.useCallback)((z,re)=>{const Ce=T.find(de=>de.id===re);if(!Ce)return;const G=i(Ce.labelMsgid),Be=U.current[z]||{},Fe=String(a.getFieldValue(["items",z,"alt"])??"").trim();(Be.alt||Fe)&&a.setFieldValue(["items",z,"alt"],G),Be.title&&a.setFieldValue(["items",z,"title"],G);const Ae=(a.getFieldValue("globalBgColor")||"").trim(),Ve=Yo(Ae,(a.getFieldValue(["items",z,"buttonBgColor"])||"").trim()),Ue=String(g?.settings?.hostCellBgForIconLuminance??"").trim(),Xe=r.getSocialIconForBlockCell(re,Go({blockBgEnabled:!!Ae,blockBgColor:Ae},Ve,Ue));Xe&&(a.setFieldValue(["items",z,"customIcon"],!1),a.setFieldValue(["items",z,"iconSrc"],Xe))},[i,g?.settings?.hostCellBgForIconLuminance,a,T]),Te=(0,n.useCallback)(z=>{if(Object.prototype.hasOwnProperty.call(z,"globalItemBorderColor")){if(!C.current){const re=String(z.globalItemBorderColor??"").trim(),Ce=a.getFieldValue("items")||[];a.setFieldsValue({items:ec(Ce,re)})}}else if(Object.prototype.hasOwnProperty.call(z,"globalBgColor")){const re=F.current,Ce=String(z.globalBgColor??"").trim(),G=a.getFieldValue("items")||[];a.setFieldsValue({items:tc(G,re,Ce)})}else if(z?.items!=null){const re=a.getFieldValue("items")||[],Ce=Js(re);Ce!==(a.getFieldValue("globalItemBorderColor")||"").trim()&&(C.current=!0,a.setFieldValue("globalItemBorderColor",Ce),queueMicrotask(()=>{C.current=!1}));const G=g.settings?.items||[];re.forEach((Be,Fe)=>{const Ae=Be?.platform,Ve=G[Fe]?.platform;Ae&&Ae!==Ve&&le(Fe,Ae)})}oc(z?.items,le),Se()},[g.settings?.items,a,Se,le]),Re=(0,n.useCallback)((z,re)=>{if(a.setFieldValue(z,re),Array.isArray(z)&&z[0]==="items"){Te({items:{[z[1]]:{[z[2]]:re}}});return}Te({[z]:re})},[a,Te]),$e=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"selected-social-form__section",children:[(0,t.jsx)("div",{className:"selected-social-form__section-title",children:i("General settings")}),(0,t.jsx)("div",{className:"selected-social-form__align-block",children:(0,t.jsx)(Mt,{form:a,elementSettings:{...g,type:r.ELEMENT_TYPES.SOCIAL}})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Button size"),placement:"bottom",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"iconSize",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:16,max:64,prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:"px",placeholder:i("Button size"),className:"selected-social-form__input-full"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Corner radius"),placement:"bottom",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"borderRadius",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,max:48,prefix:(0,t.jsx)(r.EmIcons,{icon:"BorderRadius",component:o.icons$BorderRadius,className:"selected-td-form__icon-radius"}),addonAfter:"px",placeholder:i("Corner radius"),className:"selected-social-form__input-full"})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Spacing"),placement:"bottom",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"gap",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,max:48,prefix:(0,t.jsx)(r.EmIcons,{icon:"PaddingLeftRight",component:o.icons$PaddingLeftRight}),addonAfter:"px",placeholder:i("Spacing"),className:"selected-social-form__input-full"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"globalBgColor",className:"form-item-margin-xs",children:(0,t.jsx)(zo,{form:a,name:"globalBgColor",placeholder:i("Background color"),usedColors:L,onColorChange:Re})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Border"),placement:"bottom",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonBorderWidth",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,max:24,prefix:(0,t.jsx)(r.EmIcons,{icon:"BorderOuterOutlined",component:o.icons$BorderOuterOutlined}),addonAfter:"px",placeholder:i("Border"),className:"selected-social-form__input-full"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Border color"),placement:"bottom",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"globalItemBorderColor",className:"form-item-margin-xs",children:(0,t.jsx)(zo,{form:a,name:"globalItemBorderColor",placeholder:i("Border color"),usedColors:L,onColorChange:Re})})})})]})]}),(0,t.jsxs)("div",{className:"selected-social-form__section selected-social-form__section--bordered",children:[(0,t.jsx)("div",{className:"selected-social-form__section-title",children:i("Social buttons")}),(0,t.jsx)(o.ui_kit$Form.List,{name:"items",children:(z,{remove:re,move:Ce})=>(f.current=Ce,y.current=re,(0,t.jsx)("div",{className:"selected-social-form__items",children:z.map((G,Be)=>{const Fe=!!(P[Be]?.customIcon??P[G.name]?.customIcon);return(0,t.jsxs)("div",{className:(0,We.default)("selected-social-form__card",x===Be&&"selected-social-form__card--dragging",m===Be&&x!==Be&&"selected-social-form__card--drag-over"),"data-item-index":Be,"data-list-length":z.length,onDragEnterCapture:H,onDragOverCapture:M,onDragLeave:Y,onDropCapture:K,children:[(0,t.jsxs)("div",{className:"selected-social-form__card-head",children:[(0,t.jsxs)("div",{className:"selected-social-form__card-head-main",children:[z.length>1?(0,t.jsx)("span",{className:"selected-social-form__drag-handle",draggable:!0,"data-item-index":Be,onDragStart:J,onDragEnd:pe,role:"button",tabIndex:0,"aria-label":i("Drag to reorder"),children:(0,t.jsx)(r.EmIcons,{icon:"HolderOutlined",component:o.icons$HolderOutlined})}):null,(0,t.jsxs)(Ud,{className:"selected-social-form__card-title",children:[i("Button")," ",Be+1]})]}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Delete"),placement:"top",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Button,{type:"text",className:"selected-social-form__card-head-remove",icon:(0,t.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:18,strokeWidth:s.iconStrokeWidth}),"aria-label":i("Delete"),"data-field-name":G.name,onClick:te})})]}),(0,t.jsx)(o.ui_kit$Form.Item,{name:[G.name,"iconSrc"],hidden:!0,children:(0,t.jsx)(o.ui_kit$Input,{})}),(0,t.jsx)(o.ui_kit$Form.Item,{name:[G.name,"customIcon"],valuePropName:"checked",hidden:!0,children:(0,t.jsx)(o.ui_kit$Checkbox,{})}),(0,t.jsxs)("div",{className:"selected-social-form__platform-row",children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:[G.name,"platform"],className:"selected-social-form__platform-field selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Select,{options:oe,className:"selected-social-form__platform-select",classNames:{popup:{root:"selected-social-form__platform-dropdown"}},placeholder:i("Select"),suffixIcon:(0,t.jsx)(r.EmIcons,{icon:"ChevronDownCustom",component:o.icons$ChevronDownCustom,className:"ant-select-suffix"})})}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Edit icon"),placement:"top",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Button,{type:"text",className:"selected-social-form__platform-edit","data-social-edit-index":Be,icon:(0,t.jsx)(r.EmIcons,{icon:"EditOutlined",component:o.icons$EditOutlined,size:18,strokeWidth:s.iconStrokeWidth}),"aria-label":i("Edit icon"),onClick:ze})})]}),(0,t.jsx)(o.ui_kit$Form.Item,{name:[G.name,"href"],className:"selected-social-form__card-field",rules:[{required:!0,whitespace:!0,message:i("Please enter the URL.")},{validator:async(Ae,Ve)=>{const Ue=typeof Ve=="string"?Ve.trim():String(Ve??"").trim();if(Ue&&!Kd(Ue))throw new Error(i("Please enter the correct URL."))}}],children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"Link03",component:o.icons$Link03,className:"selected-social-form__field-icon"}),placeholder:i("Enter link"),allowClear:{clearIcon:(0,t.jsx)(o.ui_kit$ColorPickerClearGlyph,{})}})}),Fe?null:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,className:"selected-social-form__card-field selected-social-form__bg-color-row",children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:[G.name,"buttonBgColor"],className:"selected-social-form__card-field",children:(0,t.jsx)(zo,{form:a,name:["items",G.name,"buttonBgColor"],placeholder:i("Background color"),usedColors:L,onColorChange:Re})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Border color"),placement:"bottom",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:[G.name,"itemBorderColor"],className:"selected-social-form__card-field",children:(0,t.jsx)(zo,{form:a,name:["items",G.name,"itemBorderColor"],placeholder:i("Border color"),usedColors:L,onColorChange:Re})})})})]}),(0,t.jsx)(Qs,{__:i,form:a,fieldName:G.name,pushSettingsToIframe:Se,onMetaActiveChange:xe})]},G.key)})}))}),(0,t.jsx)(o.ui_kit$Button,{type:"text",block:!0,className:"selected-social-form__add-bar",icon:(0,t.jsx)(r.EmIcons,{icon:"PlusSquareOutlined",component:o.icons$PlusSquareOutlined}),onClick:ve,children:i("Add button")})]})]});return(0,t.jsx)("div",{className:"selected-social-form",children:(0,t.jsx)(o.ui_kit$Form,{form:a,layout:"vertical",className:"selected-social-form__form element-controls",onValuesChange:Te,autoComplete:"off",children:(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:$e})})})};Zs.propTypes={elementSettings:_.default.shape({settings:_.default.object,type:_.default.string,caption:_.default.string})};var ko=["borderAll","borderTop","borderRight","borderBottom","borderLeft"],el=["all","top","right","bottom","left"],Di={width:1,style:"solid",color:"#E5E5E5"},tl=["All","TopLeft","TopRight","BottomRight","BottomLeft"],ot=e=>u(e),It=e=>e!==""&&e!==null&&e!==void 0;function Eo(e,i=""){return typeof e=="number"?String(e):typeof e=="string"&&e?e:i}function Xo(e){return It(e?.width)||!!e?.style||!!e?.color}function ol(e){const i=ko.find(s=>e[s]?.style);return i?e[i]:null}function Vi(e){return ol(e)??Di}function Hi(e,i){const s=el.find(a=>Xo(i[a]))??"all",l=Xo(i[s])?i[s]:ol(e)??{};return{mobileBorderPosition:s,mobileBorderWidth:l.width??"",mobileBorderColor:l.color??"",mobileBorderStyle:l.style??""}}var sc=e=>ot(e?.replace(/px$/,""));function il(e,i){return Object.fromEntries(["LeftRight","TopBottom","Left","Right","Top","Bottom"].map(s=>{const l=`${i}padding${s}`;return[l,sc(e[l])]}))}function lc(e){return{borderRadiusAll:ot(e.all),borderRadiusTopLeft:ot(e.topLeft),borderRadiusTopRight:ot(e.topRight),borderRadiusBottomRight:ot(e.bottomRight),borderRadiusBottomLeft:ot(e.bottomLeft)}}function ac(e){const i=s=>ot(s!==null?s:e.all);return{mobileBorderRadiusAll:ot(e.all),mobileBorderRadiusTopLeft:i(e.topLeft),mobileBorderRadiusTopRight:i(e.topRight),mobileBorderRadiusBottomRight:i(e.bottomRight),mobileBorderRadiusBottomLeft:i(e.bottomLeft)}}function rl(e,i){return{[`${i}Inset`]:ot(e?.inset)||!1,[`${i}HOffset`]:ot(e?.hOffset),[`${i}VOffset`]:ot(e?.vOffset),[`${i}BlurRadius`]:ot(e?.blurRadius),[`${i}SpreadRadius`]:ot(e?.spreadRadius),[`${i}Color`]:ot(e?.color)}}function sl(e,i){return Object.fromEntries(ko.map(s=>[`${i}${s}`,e[`${i}${s}`]]))}function nc(e){return{fontFamily:ot(e.fontFamily),fontSize:ot(e.fontSize),lineHeight:ot(e.lineHeight),textStrong:ot(e.textStrong),textItalic:ot(e.textItalic),textStrikethrough:ot(e.textStrikethrough),textUnderline:ot(e.textUnderline),textLink:ot(e.textLink),linkHref:ot(e.linkHref),linkTarget:ot(e.linkTarget),textColor:ot(e.textColor),textBackgroundColor:ot(e.textBackgroundColor),textAlign:ot(e.textAlign),valign:ot(e.textValign)}}function ll(e){const i=e.customTable,s=i.mobileBackgroundColor;return{show:e.show||"all",outlookBackground:e.outlookBackground,...to(e),mobileBackgroundColor:ot(s?.value!=="none"?s?.value:""),...il(i,""),...il(i,"cell_"),backgroundColor:ot(i.backgroundColor),backgroundImage:ot(i.backgroundImage?.[0]?.value),backgroundPositionX:ot(i.backgroundPositionX),backgroundPositionY:ot(i.backgroundPositionY),backgroundRepeat:ot(i.backgroundRepeat),backgroundSize:ot(i.backgroundSize),...sl(i,""),borderPosition:i.borderPosition||"borderAll",...sl(i,"cell_"),cell_borderPosition:i.cell_borderPosition||"cell_borderAll",cellBackgroundColor:ot(i.cellBackgroundColor),...lc(i.borderRadius),...rl(i.boxShadow,"boxShadow"),...rl(i.mobileBoxShadow,"mobileBoxShadow"),mobileWidth:bt(i.mobileWidth?.value),mobileWidthDim:i.mobileWidth?.dim,mobileHeight:bt(i.mobileHeight?.value),mobileHeightDim:i.mobileHeight?.dim,...ac(i.mobileBorderRadius),...Hi(i,i.mobileBorder),...nc(i)}}function al(e,i){return tl.some(s=>Number(e[`${i}Radius${s}`])>0)}function nl(e,i){return["Color","HOffset","VOffset"].some(s=>It(e[`${i}${s}`]))}function dc(e){const i=e.mobileBackgroundRepeat;return["mobileBackgroundColor","mobileBackgroundImage","mobileBackgroundPositionX","mobileBackgroundPositionY"].some(s=>It(e[s]))||It(i)&&i!=="none"||It(e.mobileBackgroundSize)}function dl(e,i,s,l){switch(e){case"border":return ko.some(a=>!!i[`${l?"cell_":""}${a}`]?.style);case"background":return l?It(i.cellBackgroundColor):It(i.backgroundColor)||It(i.backgroundImage);case"borderRadius":return al(i,"border");case"boxShadow":return nl(i,"boxShadow");case"mobileSize":return It(i.mobileWidth)||It(i.mobileHeight);case"mobileBackground":return dc(i);case"mobileBorder":return el.some(a=>Xo(s[a]));case"mobileBorderRadius":return al(i,"mobileBorder");case"mobileBoxShadow":return nl(i,"mobileBoxShadow");default:return!1}}var cl=["background","border","borderRadius","boxShadow","mobileSize","mobileBackground","mobileBorder","mobileBorderRadius","mobileBoxShadow"];function ul(e,i,s){const l={padding:!0,cellPadding:!0,background:!1,border:!1,borderRadius:!1,boxShadow:!1,mobileSize:!1,mobileBackground:!1,mobileBorder:!1,mobileBorderRadius:!1,mobileBoxShadow:!1};return cl.forEach(a=>{l[a]=dl(a,e,i,s)}),l}function cc(e,i){const s={...e};return cl.forEach(l=>{s[l]=e[l]||i[l]}),s}function Ko(e,i){const s=i==="mobile"?"mobileBorderRadius":"borderRadius",[l,...a]=tl.map(d=>e[`${s}${d}`]);return!!l||!a.some(d=>!!d)}var uc=["borderRadius","mobileWidth","mobileHeight","mobileBoxShadow","mobileBorder","mobileBorderRadius"],mc=["textStrong","textItalic","textStrikethrough","textUnderline","textLink","linkHref","textAlign"];function ml(e,i){return Object.fromEntries(i.map(s=>[s,e[s]]))}function pc(e){return{...e,...ml(e.customTable,uc)}}function hc(e){return{...e,...ml(e.customTable,mc),valign:e.customTable.textValign}}var qo={hOffset:5,vOffset:5,blurRadius:10,spreadRadius:-5,color:"#000000",inset:!1},Jo={hOffset:null,vOffset:null,blurRadius:null,spreadRadius:null,inset:!1},Qo=5,Zo="#E5E5E5",pl="em-mob-box_shadow-",hl="em-mob-border_radius_all-",bc={width:"",style:"",color:""},gc=["LeftRight","TopBottom","Left","Right","Top","Bottom"],bl=["All","TopLeft","TopRight","BottomRight","BottomLeft"],fc=["backgroundColor","backgroundImage","backgroundPositionX","backgroundPositionY","backgroundRepeat","backgroundSize"];function ei(e,i){return{[`${e}Inset`]:i.inset??!1,[`${e}HOffset`]:i.hOffset??null,[`${e}VOffset`]:i.vOffset??null,[`${e}BlurRadius`]:i.blurRadius??null,[`${e}SpreadRadius`]:i.spreadRadius??null,[`${e}Color`]:i.color??""}}var So=(e,i="")=>Object.fromEntries(e.map(s=>[s,i])),_c={padding:{off:()=>({fields:So(gc.map(e=>`padding${e}`)),settings:{padding:{all:0}}})},background:{on:({prefix:e})=>{const i=e?"cellBackgroundColor":"backgroundColor";return{fields:{[i]:Zo},settings:{[i]:Zo}}},off:({prefix:e})=>e?{fields:{cellBackgroundColor:""},settings:{cellBackgroundColor:""}}:{fields:So(fc),backgroundImageEmpty:!0,settings:{backgroundColor:"",backgroundImage:[{type:"url",value:""}],backgroundRepeat:"",backgroundSize:""}}},border:{on:({prefix:e})=>({fields:{[`${e}borderPosition`]:`${e}borderAll`,[`${e}borderAll`]:Di},settings:{[`${e}borderAll`]:Di}}),off:({prefix:e})=>({fields:So(ko.map(i=>`${e}${i}`),bc),settings:{[`${e}borderAll`]:{style:""}}})},borderRadius:{on:()=>({fields:{borderRadiusAll:Qo},settings:{borderRadius:{all:Qo}},uniformRadius:"desktop"}),off:()=>({fields:So(bl.map(e=>`borderRadius${e}`)),settings:{borderRadius:{all:0}},uniformRadius:"desktop"})},boxShadow:{on:()=>({fields:ei("boxShadow",qo),settings:{boxShadow:qo}}),off:()=>({fields:ei("boxShadow",Jo),settings:{boxShadow:{...Jo,color:""}}})},mobileSize:{off:({fields:e})=>({fields:{mobileWidth:"",mobileHeight:""},settings:{mobileWidth:{value:null,dim:Eo(e.mobileWidthDim,"px"),classNamePrefix:"em-mob-width-"},mobileHeight:{value:null,dim:"px",classNamePrefix:"em-mob-height-"}}})},mobileBackground:{on:()=>({fields:{mobileBackgroundColor:Zo},settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:Zo}}}),off:()=>({fields:{...to({}),mobileBackgroundColor:""},settings:hs()})},mobileBorder:{on:({settings:e})=>{const i={...Vi(e.customTable),classNamePrefix:"em-mob-border_all-"},s={...r.RESET_BORDER_PARAMS,all:i};return{fields:Hi(e.customTable,s),settings:{mobileBorder:{all:i}},mobileBorders:s}},off:({settings:e})=>({fields:Hi(e.customTable,r.RESET_BORDER_PARAMS),settings:{mobileBorder:r.RESET_BORDER_PARAMS},mobileBorders:r.RESET_BORDER_PARAMS})},mobileBorderRadius:{on:()=>({fields:{mobileBorderRadiusAll:Qo},settings:{mobileBorderRadius:{all:Qo,classNamePrefix:hl}},uniformRadius:"mobile"}),off:()=>({fields:So(bl.map(e=>`mobileBorderRadius${e}`)),settings:{mobileBorderRadius:{all:null,classNamePrefix:hl}},uniformRadius:"mobile"})},mobileBoxShadow:{on:()=>({fields:ei("mobileBoxShadow",qo),settings:{mobileBoxShadow:{...qo,classNamePrefix:pl}}}),off:()=>({fields:ei("mobileBoxShadow",Jo),settings:{mobileBoxShadow:{...Jo,color:null,classNamePrefix:pl}}})}},xc=["padding","cellPadding","background","border","borderRadius","boxShadow","mobileSize","mobileBackground","mobileBorder","mobileBorderRadius","mobileBoxShadow"];function kc(e,i,s){const l=c=>`${i}padding${c}`;if(s){const[c,h]=[e[l("LeftRight")],e[l("TopBottom")]];return{fields:{[l("Left")]:c,[l("Right")]:c,[l("Top")]:h,[l("Bottom")]:h}}}const[a,d]=[e[l("Left")],e[l("Top")]];return{fields:{[l("LeftRight")]:a,[l("TopBottom")]:d,[l("Right")]:a,[l("Bottom")]:d},settings:{[`${i}padding`]:{top:d,bottom:d,left:a,right:a}}}}function Ec(e){const{form:i,settings:s,send:l,isTableCells:a,mobileBorders:d,setMobileBorders:c,setBackgroundImageEmpty:h}=e,g=(0,n.useMemo)(()=>ll(s),[s]),[b,x]=(0,n.useState)(()=>ul(g,s.customTable.mobileBorder,a)),[p,m]=(0,n.useState)(!0),[S,k]=(0,n.useState)(()=>Ko(g,"desktop")),[f,y]=(0,n.useState)(()=>Ko(g,"mobile"));(0,n.useEffect)(()=>{x(C=>cc(C,ul(g,s.customTable.mobileBorder,a))),k(Ko(g,"desktop")),y(Ko(g,"mobile"))},[g,s,a]);const v=a?"cell_":"",N=(0,n.useMemo)(()=>{const C=U=>{U&&(U.fields&&i.setFieldsValue(U.fields),U.mobileBorders&&c(U.mobileBorders),U.backgroundImageEmpty!==void 0&&h?.(U.backgroundImageEmpty),U.uniformRadius&&(U.uniformRadius==="mobile"?y:k)(!0),U.settings&&l(U.settings))},F=U=>{const $=i.getFieldsValue(!0),L=_c[U],P={fields:$,settings:s,prefix:v};b[U]?C(L?.off?.(P)):dl(U,$,d,a)||C(L?.on?.(P)),x(V=>({...V,[U]:!V[U]}))};return Object.fromEntries(xc.map(U=>[U,()=>F(U)]))},[i,s,l,a,d,c,h,b,v]);return{open:b,toggle:N,paddingsExt:p,togglePaddingMode:()=>{const C=kc(i.getFieldsValue(!0),v,p);i.setFieldsValue(C.fields??{}),C.settings&&l(C.settings),m(!p)},oneBorderRadiusValue:S,setOneBorderRadiusValue:k,oneMobileBorderRadiusValue:f,setOneMobileBorderRadiusValue:y}}var ti={width:"",style:"",color:""},Sc="em-mob-box_shadow-",gl={mobileBorderWidth:"width",mobileBorderStyle:"style",mobileBorderColor:"color"},Bc=(e,i)=>({settings:{[e]:i}});function fl(e,i){return{hOffset:e[`${i}HOffset`],vOffset:e[`${i}VOffset`],blurRadius:e[`${i}BlurRadius`],spreadRadius:e[`${i}SpreadRadius`],color:e[`${i}Color`],inset:e[`${i}Inset`]}}var oi=e=>`em-mob-border_${e}-`,Bo=e=>({...r.RESET_BORDER_PARAMS[e],classNamePrefix:oi(e)});function _l(){return{top:Bo("top"),right:Bo("right"),bottom:Bo("bottom"),left:Bo("left")}}var Rc=e=>e?.width!=null&&e?.style!=null&&e?.color!=null;function Tc(e){const i=s=>({...e,classNamePrefix:oi(s)});return{top:i("top"),right:i("right"),bottom:i("bottom"),left:i("left")}}function yc(e,i,s,l){const a=Vi(l.settings.customTable),d=(c,h)=>{const g=c===i?s:e[h];return It(g)?g:a[c]};return{width:d("width","mobileBorderWidth"),style:d("style","mobileBorderStyle"),color:d("color","mobileBorderColor")}}var wc=(e,i,s,l)=>{const a=s.mobileBorderPosition||"all",d=gl[e],c=l.mobileBorders;if(!It(i)){const b=a==="all"?{..._l(),all:{...c.all,[d]:null,classNamePrefix:oi("all")}}:{...c,[a]:Bo(a),all:{...r.RESET_BORDER_PARAMS.all}};return{settings:{mobileBorder:b},mobileBorders:b}}const h={...yc(s,d,i,l),classNamePrefix:oi(a)},g=a==="all"?{..._l(),all:h}:{...c,...Rc(c.all)?Tc(c.all):{},[a]:h,all:{...r.RESET_BORDER_PARAMS.all}};return{settings:{mobileBorder:g},mobileBorders:g,fields:{mobileBorderWidth:h.width,mobileBorderStyle:h.style,mobileBorderColor:h.color}}},jc=(e,i,s,l)=>{const a=l.mobileBorders[i],d=Xo(a)?a:Vi(l.settings.customTable);return{fields:{mobileBorderWidth:d.width??"",mobileBorderColor:d.color??"",mobileBorderStyle:d.style??""}}},vc=(e,i,s)=>{if(i?.style==="")return{settings:{[e]:i},fields:{[e]:ti}};const l=s[e]??{},a=s.borderAll??{},d={...l,width:l.width===""?a.width||"1":l.width,color:l.color===""?a.color||"#b9b1b1":l.color,style:l.style===""?a.style||"solid":l.style};return{settings:{[e]:i},fields:{[e]:d,borderAll:ti}}},Ic=(e,i)=>{const s=ko.filter(a=>a!=="borderAll"),l=i?.style===""?{borderAll:ti}:Object.fromEntries(s.map(a=>[a,ti]));return{settings:{[e]:i},fields:l}},$t=(e,i)=>Object.fromEntries(e.map(s=>[s,i])),Ui=(e,i)=>i.map(s=>e+s),Cc=["textAlign","valign"],xl=["Inset","HOffset","VOffset","BlurRadius","SpreadRadius","Color"],Pc=["Color","Image","PositionX","PositionY","Repeat","Size"],Ac={...$t(Ui("boxShadow",xl),(e,i,s)=>({settings:{boxShadow:fl(s,"boxShadow")}})),...$t(Ui("mobileBoxShadow",xl),(e,i,s)=>({settings:{mobileBoxShadow:{...fl(s,"mobileBoxShadow"),classNamePrefix:Sc}}})),...$t(Object.keys(W.BORDER_RADIUS_POSITION),(e,i)=>({settings:{borderRadius:{[W.BORDER_RADIUS_POSITION[e]]:+i}}})),...$t(Object.keys(W.MOBILE_BORDER_RADIUS_POSITION),(e,i)=>{const s=W.MOBILE_BORDER_RADIUS_POSITION[e];return{settings:{mobileBorderRadius:{[s]:i,classNamePrefix:`em-mob-border_radius_${s}-`}}}}),...$t(Ui("mobileBackground",Pc),(e,i)=>{const s=fo({[e]:i});return s?{settings:s}:{}}),...$t(Object.keys(gl),wc),...$t(["borderTop","borderRight","borderBottom","borderLeft"],vc),...$t(["fontSize","lineHeight"],(e,i)=>It(i)?{settings:{[e]:i}}:{}),...$t(Cc,()=>({})),borderAll:Ic,borderPosition:()=>({}),mobileBorderPosition:jc,backgroundImage:(e,i,s,l)=>({settings:{backgroundImage:[{...l.settings.customTable.backgroundImage?.[0],type:"url",value:Eo(i)}],...i?{backgroundSize:"cover"}:{}},backgroundImageEmpty:i===""}),mobileWidth:(e,i,s)=>({settings:{mobileWidth:{classNamePrefix:"em-mob-width-",value:i,dim:Eo(s.mobileWidthDim)}}}),mobileWidthDim:(e,i,s)=>({settings:{mobileWidth:{classNamePrefix:"em-mob-width-",value:s.mobileWidth||100,dim:Eo(i)}}}),mobileHeight:(e,i,s)=>({settings:{mobileHeight:{classNamePrefix:"em-mob-height-",value:i,dim:Eo(s.mobileHeightDim)}}}),linkHref:(e,i)=>{const s=Jt(i);return{settings:{linkHref:s},linkHref:s,...s!==i?{fields:{linkHref:s}}:{}}}};function Nc(e,i,s){const[l]=Object.keys(e);return l?(Ac[l]??Bc)(l,e[l],i,s):{}}function Lc(e){const{form:i,settings:s,send:l,mobileBorders:a,setMobileBorders:d,setBackgroundImageEmpty:c,onLinkHref:h}=e;return(0,n.useCallback)(g=>{const b=Nc(g,i.getFieldsValue(!0),{settings:s,mobileBorders:a});b.fields&&i.setFieldsValue(b.fields),b.mobileBorders&&d(b.mobileBorders),b.backgroundImageEmpty!==void 0&&c(b.backgroundImageEmpty),b.linkHref!==void 0&&h(b.linkHref),b.settings&&l(b.settings)},[i,s,l,a,d,c,h])}function Oc(e){const i=e.customTable.mobileBorder,[s,l]=(0,n.useState)(i);return(0,n.useEffect)(()=>l(i),[i]),[s,l]}function $c(e,i){return(0,n.useCallback)(s=>e({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i,settings:s}),[e,i])}var oo=["hover"],kl={width:"100%"},El={paddingBottom:4},Fc={textAlign:"right"},Wi=e=>e.parentNode,Mc=e=>e.closest(".selected-element-panel"),Dc=e=>e.closest(".email-pane__collapse-wrapper"),Vc=({elementSettings:e,__:i,token:s,sendAction:l,typografItems:a})=>{const d=W.useGoogleFontsLoader(),c=(0,n.useMemo)(()=>({marginBottom:s.formItemMarginBottomXS}),[s.formItemMarginBottomXS]),h=(0,n.useMemo)(()=>({items:a}),[a]),g=(0,n.useCallback)(()=>l("add_img"),[l]),b=(0,n.useCallback)(()=>l("typograf"),[l]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"AddImage",style:c,children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(r.EmIcons,{icon:"AddImage",component:o.icons$AddImage}),onClick:g,style:kl,children:i("Add image")})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"Typography",style:c,children:(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,menu:h,trigger:oo,placement:"bottom",getPopupContainer:Mc,children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(r.EmIcons,{icon:"Typograf",component:o.icons$Typograf}),onClick:b,style:kl,children:i("Typography")})})})})]}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:oo,title:i("Text font"),placement:"bottom",zIndex:1,getPopupContainer:Wi,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:d,getPopupContainer:Dc})})}),!e.showOnMobile&&(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:oo,title:i("Font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:i("Font size"),prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:oo,title:i("Line height"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"lineHeight",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:i("Line height"),prefix:(0,t.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]})]})},Hc=({elementSettings:e,__:i,token:s,textInputRef:l,linkProtocol:a,handleLinkProtocolsChange:d})=>{const c=!!e.customTable?.isNewLink,h=(0,n.useMemo)(()=>({marginBottom:s.formItemMarginBottomXS}),[s.formItemMarginBottomXS]);return(0,n.useEffect)(()=>{c&&l.current?.focus()},[c,l]),(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsxs)(o.ui_kit$Col,{span:24,children:[(0,t.jsx)(qt,{show:a==="#",__:i,style:h}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:oo,title:i("The URL that the hyperlink directs to."),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"linkHref",children:(0,t.jsx)(o.ui_kit$Input,{ref:l,addonBefore:(0,t.jsx)(Kt,{linkProtocol:a,handleLinkProtocolsChange:d,__:i}),allowClear:!0,placeholder:i("Hyperlink URL"),prefix:(0,t.jsx)(Xt,{linkProtocol:a})})})})]})})},Uc=({form:e,elementSettings:i,__:s,token:l,isMacOS:a,formValues:d,textInputRef:c,linkProtocol:h,handleLinkProtocolsChange:g})=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:s(a?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(r.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:s(a?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:s(a?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:s(a?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,className:(0,We.default)("selected-text-common-form__button selected-text-common-form__button_style",{"selected-text-common-form__button--active":!!i.textLink}),elementSettings:i,name:"textLink",tooltipTitle:s("Link"),icon:(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"})})})]}),d?.textLink&&(0,t.jsx)(Hc,{elementSettings:i,__:s,token:l,textInputRef:c,linkProtocol:h,handleLinkProtocolsChange:g})]}),Wc=({form:e,elementSettings:i,__:s})=>{const l=(0,n.useMemo)(()=>[{message:s("Please set the font color")}],[s]),a=(0,n.useMemo)(()=>[{message:s("Please set the background color")}],[s]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:El,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:oo,title:s("Text color"),placement:"bottom",zIndex:2,getPopupContainer:Wi,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",rules:l,children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:s("Color"),usedColors:i.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:oo,title:s("Text background"),placement:"bottom",zIndex:2,getPopupContainer:Wi,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textBackgroundColor",rules:a,children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:s("Background color"),usedColors:i.usedColors})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:El,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Zt,{form:e,elementSettings:i,name:"textAlign"})}),(0,t.jsx)(o.ui_kit$Col,{span:12,style:Fc,children:(0,t.jsx)(Ot,{form:e,elementSettings:i,name:"valign",isNewIconType:!0})})]})]})},zc=e=>{const{form:i,elementSettings:s,__:l,token:a,appConfig:d,backgroundRepeatOptions:c,backgroundSizeOptions:h,handleToggleShowPaddingCell:g,handleTogglePaddingCell:b,handleToggleBackground:x,handleToggleBorder:p,handleToggleBorderRadius:m,paddingCellShow:S,paddingsExt:k,backgroundShow:f,cellBordersShow:y,borderRadiusShow:v,oneBorderRadiusValue:N,setOneBorderRadiusValue:R,backgroundImageEmpty:C}=e;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$FormSection,{title:l("Text"),dividerTop:!1,children:[d.formTextFieldTypografEnabled&&(0,t.jsx)(Vc,{...e}),(0,t.jsx)(Uc,{...e}),(0,t.jsx)(Wc,{...e})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:l("Padding"),collapsible:!0,open:S,onToggle:g,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormPaddingInputs,{namePrefix:"cell_",extended:k,onToggleExtended:b,gutter:a.marginSM,rowStyle:{paddingBottom:4},labels:{horizontal:l("Horizontal padding"),vertical:l("Vertical padding"),left:l("Left padding"),right:l("Right padding"),top:l("Top padding"),bottom:l("Bottom padding"),individual:l("Individual padding")}})}),(0,t.jsx)(o.ui_kit$FormSection,{title:l("Background"),collapsible:!0,open:f,onToggle:x,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormBackgroundSettings,{colorFieldName:"cellBackgroundColor",imageEnabled:d.formTableFieldBackgroundImageEnabled&&!1,backgroundImageEmpty:C,usedColors:s.usedColors,colorPlaceholder:l("Background color"),horizontalPositionPlaceholder:l("Horizontal position"),horizontalPositionTooltip:l("Horizontal position"),verticalPositionPlaceholder:l("Vertical position"),verticalPositionTooltip:l("Vertical position"),backgroundRepeatTooltip:l("Background image repeat"),backgroundSizeTooltip:l("Background image size"),selectPlaceholder:l("Please choose"),backgroundRepeatOptions:c,backgroundSizeOptions:h,imageUploadSlot:(d.formTableFieldBackgroundImageEnabled,void 0)})}),(0,t.jsx)(o.ui_kit$FormSection,{title:l("Borders"),collapsible:!0,open:y,onToggle:p,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:i,namePrefix:"cell_"})}),d.formFieldBorderRadiusEnabled&&!1]})},Sl=({form:e,elementSettings:i,paddingShow:s,paddingsExt:l,backgroundShow:a,bordersShow:d,borderRadiusShow:c,boxShadowShow:h,handleToggleShowPadding:g,handleTogglePadding:b,handleToggleBackground:x,handleToggleBorder:p,handleToggleBorderRadius:m,handleToggleBoxShadow:S,backgroundRepeatOptions:k,backgroundSizeOptions:f,backgroundImageEmpty:y,oneBorderRadiusValue:v,setOneBorderRadiusValue:N})=>{const{__:R}=r.useI18n(),C=r.useAppConfig(),{token:F}=(0,o.ui_kit$useToken)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$FormSection,{title:R("Padding"),collapsible:!0,open:s,onToggle:g,children:(0,t.jsx)(o.ui_kit$FormPaddingInputs,{extended:l,onToggleExtended:b,gutter:F.marginSM,labels:{horizontal:R("Horizontal padding"),vertical:R("Vertical padding"),left:R("Left padding"),right:R("Right padding"),top:R("Top padding"),bottom:R("Bottom padding"),individual:R("Individual padding")}})}),(0,t.jsxs)(o.ui_kit$FormSection,{title:R("Background"),collapsible:!0,open:a,onToggle:x,dividerTop:!0,children:[(0,t.jsx)(o.ui_kit$FormBackgroundSettings,{imageEnabled:C.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:y,usedColors:i.usedColors,colorPlaceholder:R("Background color"),horizontalPositionPlaceholder:R("Horizontal position"),horizontalPositionTooltip:R("Horizontal position"),verticalPositionPlaceholder:R("Vertical position"),verticalPositionTooltip:R("Vertical position"),backgroundRepeatTooltip:R("Background image repeat"),backgroundSizeTooltip:R("Background image size"),selectPlaceholder:R("Please choose"),backgroundRepeatOptions:k,backgroundSizeOptions:f,imageUploadSlot:C.formTableFieldBackgroundImageEnabled?(0,t.jsx)(Pt,{form:e,label:R("Background image"),name:"backgroundImage",tooltipTitle:R("Background image"),placeholder:R("Background image link/route")}):void 0}),(0,t.jsx)(eo,{form:e,showBackground:!0})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:R("Borders"),collapsible:!0,open:d,onToggle:p,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e})}),C.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:R("Border radius"),collapsible:!0,open:c,onToggle:m,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:v,setOneBorderRadiusValue:N,elementSettings:i})}),C.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:R("Box shadow"),collapsible:!0,open:h,onToggle:S,dividerTop:!0,children:(0,t.jsx)(wt,{})}),C.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:R("Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e})})]})};Sl.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,paddingShow:_.default.bool,paddingsExt:_.default.bool,backgroundShow:_.default.bool,bordersShow:_.default.bool,borderRadiusShow:_.default.bool,boxShadowShow:_.default.bool,handleToggleShowPadding:_.default.func,handleTogglePadding:_.default.func,handleToggleBackground:_.default.func,handleToggleBorder:_.default.func,handleToggleBorderRadius:_.default.func,handleToggleBoxShadow:_.default.func,backgroundRepeatOptions:_.default.array,backgroundSizeOptions:_.default.array,backgroundImageEmpty:_.default.bool,oneBorderRadiusValue:_.default.bool,setOneBorderRadiusValue:_.default.func};var Bl=({form:e,elementSettings:i,mobileSizeShow:s,mobileBackgroundShow:l,mobileBordersShow:a,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,handleToggleMobileSize:h,handleToggleMobileBackground:g,handleToggleMobileBorder:b,handleToggleMobileBorderRadius:x,handleToggleMobileBoxShadow:p,oneMobileBorderRadiusValue:m,setOneMobileBorderRadiusValue:S,mobileBorders:k})=>{const{__:f,_x:y}=r.useI18n(),v=r.useAppConfig(),{token:N}=(0,o.ui_kit$useToken)(),R=r.useSelector(r.selectEmailSettings);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$FormSection,{title:f("Size"),collapsible:!0,open:s,onToggle:h,dividerTop:!0,children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:f("Table width"),placement:"left",children:(0,t.jsx)("div",{style:{marginBottom:N.formItemMarginBottomMD+4},children:(0,t.jsx)(Vt,{form:e,name:"mobileWidth",elementSettings:i})})})})}),(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)("div",{style:{marginBottom:N.formItemMarginBottomXS*2},children:(0,t.jsx)(o.ui_kit$Tooltip,{title:f("Height"),placement:"bottom",children:(0,t.jsx)(Qt,{form:e,name:"mobileHeight",elementSettings:i})})})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:f("Background"),collapsible:!0,open:l,onToggle:g,dividerTop:!0,children:(0,t.jsx)(xo,{elementSettings:Ht(i),imageEnabled:v.formTableFieldBackgroundImageEnabled,desktopBackground:_o(i)})}),v.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:f("Borders"),collapsible:!0,open:a,onToggle:b,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormBorderInputs,{form:e,fieldStructure:"flat",borderValues:k,usedColors:R.usedColors,labels:{color:f("Color"),width:y("Width","border"),none:f("None"),solid:f("Solid"),dashed:f("Dashed"),dotted:f("Dotted"),above:f("Above"),below:f("Below"),onLeft:f("On the left"),onRight:f("On the right"),around:f("Around"),usedColors:f("Used"),recommendedColors:f("Recommended")}})}),v.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:f("Border radius"),collapsible:!0,open:d,onToggle:x,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:m,setOneBorderRadiusValue:S,elementSettings:i})}),v.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:f("Box shadow"),collapsible:!0,open:c,onToggle:p,dividerTop:!0,children:(0,t.jsx)(wt,{typeOfForm:"mobile",form:e,elementSettings:i,enableSwitch:!1})}),v.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:f("Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e})})]})};Bl.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,mobileSizeShow:_.default.bool,mobileBackgroundShow:_.default.bool,mobileBordersShow:_.default.bool,mobileBorderRadiusShow:_.default.bool,mobileBoxShadowShow:_.default.bool,handleToggleMobileSize:_.default.func,handleToggleMobileBackground:_.default.func,handleToggleMobileBorder:_.default.func,handleToggleMobileBorderRadius:_.default.func,handleToggleMobileBoxShadow:_.default.func,oneMobileBorderRadiusValue:_.default.bool,setOneMobileBorderRadiusValue:_.default.func,mobileBorders:_.default.object};var Gc=({form:e,elementViewType:i,mobileViewActive:s,elementSettings:l,paddingShow:a,paddingsExt:d,backgroundShow:c,bordersShow:h,borderRadiusShow:g,boxShadowShow:b,mobileSizeShow:x,mobileBackgroundShow:p,mobileBordersShow:m,mobileBorderRadiusShow:S,mobileBoxShadowShow:k,handleToggleShowPadding:f,handleTogglePadding:y,handleToggleBackground:v,handleToggleBorder:N,handleToggleBorderRadius:R,handleToggleBoxShadow:C,handleToggleMobileSize:F,handleToggleMobileBackground:U,handleToggleMobileBorder:$,handleToggleMobileBorderRadius:L,handleToggleMobileBoxShadow:P,backgroundRepeatOptions:V,backgroundSizeOptions:ne,backgroundImageEmpty:T,oneBorderRadiusValue:oe,setOneBorderRadiusValue:xe,oneMobileBorderRadiusValue:be,setOneMobileBorderRadiusValue:Se,mobileBorders:me})=>(0,t.jsx)(t.Fragment,{children:i==="mobile"&&s.styles?(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,t.jsx)(Bl,{form:e,elementSettings:l,mobileSizeShow:x,mobileBackgroundShow:p,mobileBordersShow:m,mobileBorderRadiusShow:S,mobileBoxShadowShow:k,handleToggleMobileSize:F,handleToggleMobileBackground:U,handleToggleMobileBorder:$,handleToggleMobileBorderRadius:L,handleToggleMobileBoxShadow:P,oneMobileBorderRadiusValue:be,setOneMobileBorderRadiusValue:Se,mobileBorders:me})}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(Sl,{form:e,elementSettings:l,paddingShow:a,paddingsExt:d,backgroundShow:c,bordersShow:h,borderRadiusShow:g,boxShadowShow:b,handleToggleShowPadding:f,handleTogglePadding:y,handleToggleBackground:v,handleToggleBorder:N,handleToggleBorderRadius:R,handleToggleBoxShadow:C,backgroundRepeatOptions:V,backgroundSizeOptions:ne,backgroundImageEmpty:T,oneBorderRadiusValue:oe,setOneBorderRadiusValue:xe})})}),Rl=e=>e.customTable?.backgroundImage?.[0]?.value==="",Tl=({elementSettings:e,formName:i})=>{const{__:s}=r.useI18n(),l=r.useSendPostMessage(),[a]=o.ui_kit$Form.useForm(),{token:d}=(0,o.ui_kit$useToken)(),c=r.useAppConfig(),h=r.useSelector(r.selectEmailViewType),g=r.useSelector(r.selectMobileViewActive),b=r.useSelector(r.selectIsCodeMode),x=r.useSelector(r.selectCodeModeDirection),p=i===r.EDIT_SELECTED_TABLE_CELLS,m=$c(l,e.type),[S,k]=Oc(e),[f,y]=(0,n.useState)(Rl(e)),[v,N]=(0,n.useState)("https://"),R=Ec({form:a,settings:e,send:m,isTableCells:p,mobileBorders:S,setMobileBorders:k,setBackgroundImageEmpty:y}),C=(0,n.useCallback)(ke=>Dt(ke,N),[]),F=Lc({form:a,settings:e,send:m,mobileBorders:S,setMobileBorders:k,setBackgroundImageEmpty:y,onLinkHref:C}),U=(0,n.useMemo)(()=>({table:pc(e),cell:hc(e)}),[e]),$=(0,n.useRef)(),L=o.ui_kit$Form.useWatch([],a),P=[{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"}],V=[{label:s("Not defined"),value:""},{label:s("Contain"),value:"contain"},{label:s("Cover"),value:"cover"}],ne=b&&x!=="bottom",[T,oe]=(0,n.useState)(null);(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&oe(!0)},[]);const xe=ke=>{l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:ke,locale:"ru_RU"})},be=[{key:"1",label:s("This element"),onClick:()=>xe("typograf")},{key:"2",label:s("The whole email"),onClick:()=>xe("typograf_all")}];(0,n.useEffect)(()=>{a.setFieldsValue(ll(e)),y(Rl(e))},[a,e]),(0,n.useEffect)(()=>{a.getFieldValue("linkHref")||a.setFieldsValue({linkHref:null})},[L?.textLink,L?.linkHref,e.customTable?.linkHref,a]),(0,n.useEffect)(()=>{e.customTable?.linkHref&&Dt(e.customTable?.linkHref||"",N),a.setFieldsValue({linkHref:typeof e.customTable?.linkHref=="string"?e.customTable.linkHref:"https://"})},[a,e,N]);const Se=ke=>{a.setFieldValue("linkHref",ke!=="mergetag"?ke:""),N(ke)},{open:me,toggle:he}=R;return(0,t.jsxs)(o.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:"",backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",show:"all",borderPosition:"",borderRadiusAll:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"px",mobileBorderPosition:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBackgroundColor:"",mobileBackgroundImage:"",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:"",fontFamily:"",fontSize:"",lineHeight:"",textStrong:"",textItalic:"",textStrikethrough:"",textUnderline:"",textLink:"",linkHref:"",textColor:"",textAlign:"",textBackgroundColor:"",valign:""},onValuesChange:F,autoComplete:"off",className:"element-controls",style:{padding:0,display:"flex",flexDirection:"column"},children:[!ne&&(0,t.jsx)(o.ui_kit$Tooltip,{title:s("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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:s("Appearance on mobile devices"),type:"info"})}),p?(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(zc,{form:a,formValues:L,elementSettings:U.cell,appConfig:c,token:d,isMacOS:T,__:s,handleToggleShowPaddingCell:he.cellPadding,handleTogglePaddingCell:R.togglePaddingMode,handleToggleBackground:he.background,handleToggleBorder:he.border,handleToggleBorderRadius:he.borderRadius,paddingCellShow:me.cellPadding,paddingsExt:R.paddingsExt,backgroundShow:me.background,cellBordersShow:me.border,borderRadiusShow:me.borderRadius,oneBorderRadiusValue:R.oneBorderRadiusValue,setOneBorderRadiusValue:R.setOneBorderRadiusValue,backgroundImageEmpty:f,backgroundRepeatOptions:P,backgroundSizeOptions:V,sendAction:xe,typografItems:be,textInputRef:$,linkProtocol:v,handleLinkProtocolsChange:Se})}):(0,t.jsx)(Gc,{form:a,elementSettings:U.table,handleToggleShowPadding:he.padding,handleTogglePadding:R.togglePaddingMode,handleToggleBackground:he.background,handleToggleBorder:he.border,handleToggleBorderRadius:he.borderRadius,handleToggleBoxShadow:he.boxShadow,handleToggleMobileSize:he.mobileSize,handleToggleMobileBackground:he.mobileBackground,handleToggleMobileBorder:he.mobileBorder,handleToggleMobileBorderRadius:he.mobileBorderRadius,handleToggleMobileBoxShadow:he.mobileBoxShadow,paddingShow:me.padding,paddingsExt:R.paddingsExt,backgroundShow:me.background,bordersShow:me.border,borderRadiusShow:me.borderRadius,boxShadowShow:me.boxShadow,mobileSizeShow:me.mobileSize,mobileBackgroundShow:me.mobileBackground,mobileBordersShow:me.mobileBorder,mobileBorderRadiusShow:me.mobileBorderRadius,mobileBoxShadowShow:me.mobileBoxShadow,oneBorderRadiusValue:R.oneBorderRadiusValue,setOneBorderRadiusValue:R.setOneBorderRadiusValue,oneMobileBorderRadiusValue:R.oneMobileBorderRadiusValue,setOneMobileBorderRadiusValue:R.setOneMobileBorderRadiusValue,backgroundImageEmpty:f,backgroundRepeatOptions:P,backgroundSizeOptions:V,mobileBorders:S,elementViewType:h,mobileViewActive:g})," "]})};Tl.propTypes={elementSettings:_.default.object.isRequired,formName:_.default.string};var lo=({className:e=null,formSettings:i,emailElementType:s,formName:l})=>{const a=r.useDispatch(),d=r.useSendStyleToggleToIframe(),c=(0,n.useRef)(),h=r.useSelector(r.selectActiveSettingsTab),g=r.useSelector(r.selectElementSettings$1),b=r.useSelector(r.selectElementSettings),x=r.useContainer(),p=r.getComponentRegistry(x),m=s==="email"?g:b,S=m.type,k=S===r.ELEMENT_TYPES.CAROUSEL||S===r.ELEMENT_TYPES.IMG?i.settings:m,[f,y]=(0,n.useState)(k),[v,N]=(0,n.useState)(k);k!==v&&(N(k),y(k));const R=F=>{const U=F.data.operation,$=F.data.action;if(U===r.EVENT_TYPES.APPLICATION_ACTION){let P=function(V,ne=null){const T={[V]:ne||!f[V]};d(T,f.type),a(r.setEmailSettings(T)),y(oe=>({...oe,...T}))};var L=P;$==="toggle_strong"&&P("textStrong"),$==="toggle_italic"&&P("textItalic"),$==="toggle_underline"&&P("textUnderline"),$==="toggle_strikethrough"&&P("textStrikethrough"),$==="textAlign_left"&&P("textAlign","left"),$==="textAlign_right"&&P("textAlign","right"),$==="textAlign_center"&&P("textAlign","center")}};r.useListenPostMessage(R);const C=m;return(0,t.jsx)("div",{className:"selected-element-panel",children:(0,t.jsx)(r.CSSTransition,{nodeRef:c,in:h===r.PROPERTIES,timeout:300,classNames:"transition",children:(0,t.jsxs)("div",{ref:c,className:(0,We.default)("selected-element-panel-content",{[e]:e}),children:[i?.type==="advanced"&&i?.content?(0,t.jsx)(n.Fragment,{children:p.getReactElement(i.content)},i.instanceKey):null,(m.type===r.ELEMENT_TYPES.IMG||m.type===r.ELEMENT_TYPES.COUNTDOWN||m.type===r.ELEMENT_TYPES.VIDEO)&&(0,t.jsx)(ls,{elementSettings:m}),m.type===r.ELEMENT_TYPES.TEXT&&(0,t.jsx)(fd,{elementSettings:m}),m.type===r.ELEMENT_TYPES.LINK&&(0,t.jsx)(Rs,{elementSettings:m}),m.type===r.ELEMENT_TYPES.TABLE&&(0,t.jsx)(Bs,{elementSettings:m}),m.type===r.ELEMENT_TYPES.CUSTOM_TABLE&&(0,t.jsx)(Tl,{elementSettings:C,formName:l},C.customTable.tableKey),(m.type===r.ELEMENT_TYPES.TD||m.type===r.ELEMENT_TYPES.STRUCTURE||m.type===r.ELEMENT_TYPES.GROUP||m.type===r.ELEMENT_TYPES.COLUMN)&&(0,t.jsx)(Is,{elementSettings:m}),m.type===r.ELEMENT_TYPES.VAR&&(0,t.jsx)(Ds,{elementSettings:m}),m.type===r.ELEMENT_TYPES.BUTTON&&(0,t.jsx)(Ms,{elementSettings:m}),m.type===r.ELEMENT_TYPES.DIV&&(0,t.jsx)(As,{elementSettings:m}),m.type===r.ELEMENT_TYPES.VINDENT&&(0,t.jsx)(ws,{elementSettings:m}),m.type===r.ELEMENT_TYPES.FLOAT_BLOCK&&(0,t.jsx)(Os,{elementSettings:m}),i.type===r.ELEMENT_TYPES.CAROUSEL&&(0,t.jsx)(zs,{elementSettings:i}),i.type===r.ELEMENT_TYPES.ACCORDION&&(0,t.jsx)(Gs,{elementSettings:i}),i.type===r.ELEMENT_TYPES.SOCIAL&&(0,t.jsx)(Zs,{elementSettings:i})]})})})};lo.propTypes={className:_.default.string,formName:_.default.string};function Ut(){return!!document.querySelector(".selected-element-panel__columns-settings__links__add")?.closest(".selected-element-panel")}var yl=({emailElementType:e,isSelectedElement:i=!1,selectedElement:s={parent:!1}})=>{const{__:l}=r.useI18n(),a=r.useDispatch(),d=r.useSendPostMessage(),[c]=o.ui_kit$Form.useForm(),h=(0,n.useRef)(),g=(0,n.useRef)(),b=r.useSelector(r.selectElementSettings$1),x=r.useSelector(r.selectElementSettings),p=r.useAppConfig(),m=s||(e==="email"?b:x),[S,k]=(0,n.useState)(m.floatBlocks?.wrap),[f,y]=(0,n.useState)(m.floatBlocks?.dirRevers),[v,N]=(0,n.useState)(null),[R,C]=(0,n.useState)(0),[F,U]=(0,n.useState)([]),$=r.useSelector(r.selectEmailViewType),L=(0,n.useCallback)(ve=>{a(e==="email"?r.setElementSettings$1(ve):r.setElementSettings(ve))},[a,e]);(0,n.useEffect)(()=>{if(m&&JSON.stringify(m)!=="{}"&&c._init){if(c.resetFields(),c.setFieldsValue({gap:m.floatBlocks?.gap,gapMobile:m.floatBlocks?.gapMobile,gapDim:"px",valign:m.floatBlocks?.valign}),m.floatBlocks?.items.length>0){let Q=function(X,Z){if(X.length!==Z.length)return!1;for(let J=0;J<X.length;J++)if(X[J]!==Z[J])return!1;return!0};var ve=Q;const Ee=m.floatBlocks.items.reduce((X,Z)=>X+Z.width,0),pe=m.floatBlocks.items.map(X=>((X.width||0)/Ee*100).toFixed(1));C(Ee),!Q(pe,F)&&m.changeKey!=="gap"&&U(pe),m.floatBlocks.items.forEach((X,Z)=>c.setFieldsValue({["width-"+Z]:X.width||0})),m.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")}k(m.floatBlocks?.wrap)}},[c,m,v,F]);let P=0;m.floatBlocks?.items.length>0&&(P=m.floatBlocks.items.length);const V=(ve,Ee)=>{Object.keys(Ee).forEach(pe=>{if(pe.includes("width")){const Q=parseInt(pe.match(/\d+/));c.setFieldsValue({[pe]:ve.items[Q]})}})},[ne,T]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const ve=()=>T(!0),Ee=()=>T(!1);return document.addEventListener("keyup",Ee),document.addEventListener("keydown",ve),()=>{document.removeEventListener("keyup",Ee),document.removeEventListener("keydown",ve)}},[]);const oe=ve=>{g.current&&ne&&clearTimeout(g.current),g.current=setTimeout(()=>Ee(ve),50);function Ee(pe){const Q=c.getFieldsValue(!0),X=Object.keys(pe)[0];if(N(X),X.includes("width")){if(Q[X]&&Q[X]>=30){let Z={items:[],gap:Q.gap,valign:Q.valign,activateSection:i?void 0:"structure"},J=0;if(document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").length>1){J=parseFloat(Object.keys(pe)[0].substring(Object.keys(pe)[0].length-1));const H=Q["width-"+(J+1)]?J+1:0;let M=R;Object.keys(Q).forEach(Y=>{Y.includes("width")&&Y.indexOf("width-"+H)===-1&&(M-=Q[Y])}),Q["width-"+H]=M}Object.keys(Q).forEach(H=>{H.includes("width")&&Z.items.push(Q[H])}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:Z}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,...Z,items:m.floatBlocks.items.map((H,M)=>({...m.floatBlocks.items[M],width:Z.items[M]}))},changeKey:X})}}else if(X==="gap"){const Z={items:m.floatBlocks.items.map(Y=>Y.width),gap:m.floatBlocks.gap},J=Z.items.reduce((Y,K)=>Y+K,0)+(Z.items.length-1)*Z.gap,H=Q.gap,M=J-(Z.items.length-1)*H;if(M>Z.items.length*30||m.floatBlocks.gap-pe>=0){const Y=(Te,Re)=>Math.round(Re*Te/100);let K=Z.items.map((Te,Re)=>Y(F[Re],M));const te=J-(K.reduce((Te,Re)=>Te+Re,0)+(Z.items.length-1)*H);if(te!==0){const Te=K.length-Math.abs(te);K=K.map((Re,$e)=>Te<=$e?Re+(te>0?1:-1):Re)}let le={items:K,gap:H||0};V(le,Q),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGap",settings:le,editFromStructure:Ut()}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,...le,items:m.floatBlocks.items.map((Te,Re)=>({...Te,width:le.items[Re]}))},changeKey:X})}}else if(X==="valign"){let Z={valign:Q.valign};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksValign",settings:Z,editFromStructure:Ut()}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,...Z},changeKey:X})}else if(X==="gapMobile"){let Z={mobileHeight:{classNamePrefix:"em-mob-height-",value:pe[X],dim:"px"}};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGapMobile",settings:Z}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,gapMobile:Z.mobileHeight.value},changeKey:X})}setTimeout(()=>h?.current&&h.current.focus({cursor:"end"}),600)}},xe=()=>{const ve=c.getFieldsValue(!0),Ee=m.floatBlocks.items.map(M=>M.width);let pe={items:[],gap:ve.gap};const Q=Ee.reduce((M,Y)=>M+Y,0),X=Ee.length,Z=Math.ceil(R/X)*X,J=Z/X,H=Q-Z;if(pe.items=Array(X).fill(J),H!==0){const M=Ee.length-Math.abs(H);pe.items=pe.items.map((Y,K)=>M<=K?Y+(H>0?1:-1):Y)}V(pe,ve),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:pe,editFromStructure:Ut()}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,...pe,items:m.floatBlocks.items.map((M,Y)=>({...M,width:pe.items[Y]}))},changeKey:"width"})},be=ve=>{const Ee=c.getFieldsValue(!0),pe=m.floatBlocks.items.map(le=>le.width),Q=m.floatBlocks.gap||20,X=ve.cols-pe.length;let Z=[],J=pe.reduce((le,Te)=>le+Te,0);ve.cols>=pe.length?J-=Q*X:J+=Q*Math.abs(X);const H=Math.round(J/ve.cols);function M(le,Te){const Re=[];for(let $e=0;$e<le;$e++)Re.push(ve.width?.[$e]?Math.round(J/100*ve.width?.[$e]):Te);return Re}Z=M(ve.cols,H);const Y=J-Z.reduce((le,Te)=>le+Te,0);if(Y!==0){let le=Z.map((Re,$e)=>[$e,Re]).filter(Re=>Re[1]>30);const Te=le.length-Math.abs(Y);le=le.map((Re,$e)=>{const z=Te<=$e?Re[1]+(Y>0?1:-1):Re[1];return[Re[0],z]}),le.map(Re=>(Z[Re[0]]=Re[1],Re))}let K={items:Z,gap:Ee.gap||20};const te=Z.reduce((le,Te)=>le+Te,0);U(Z.map(le=>(le/te*100).toFixed(1))),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksPreset",settings:K,editFromStructure:Ut()}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,...K,items:K.items.map((le,Te)=>({width:le,current:!1}))},changeKey:"width"})},Se=()=>{const ve=c.getFieldsValue(!0);if(P<8){const Ee=m.floatBlocks.items.map(M=>M.width),pe=m.floatBlocks.gap,Q=Ee.reduce((M,Y)=>M+(Y>30?Y:0),0),X=(Q-30-pe)/Q,Z=Ee.map(M=>M>30?Math.round(M*X):M).reduce((M,Y)=>M+(Y>30?Y:0),0);let J=Ee.map(M=>M>30?Math.round(M*X):M);J.push(30);const H=Q-Z-30-pe;if(H!==0){let M=J.map((K,te)=>[te,K]).filter(K=>K[1]>30);const Y=M.length-Math.abs(H);M=M.map((K,te)=>{const le=Y<=te?K[1]+(H>0?1:-1):K[1];return[K[0],le]}),M.map(K=>(J[K[0]]=K[1],K))}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_ADD,settings:{gap:ve.gap,gapMobile:ve.gapMobile,minWidth:30},editFromStructure:Ut()}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,items:J.map((M,Y)=>({width:M,current:m.floatBlocks.items[Y]?.current||!1}))},changeKey:"width"})}else document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.add("noactive")},me=ve=>{const Ee=c.getFieldsValue(!0);let pe=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((le,Te)=>{le===ve.target.closest(".selected-element-panel__columns-settings__controls__column")&&(pe=Te)});const Q=+m.floatBlocks.gap,X=+m.floatBlocks.items[pe].width+Q,Z=m.floatBlocks.items.map(le=>+le.width),J=(Z.length-1)*Q,H=Z.reduce((le,Te)=>le+Te,0)+J,M=Z.length-1,Y=Math.floor(X/M);let K=Z.filter((le,Te)=>Te!==pe).map(le=>le+Y);const te=H-(K.reduce((le,Te)=>le+Te,0)+(Z.length-2)*Q);if(te!==0){const le=K.length-Math.abs(te);K=K.map((Te,Re)=>le<=Re?Te+(te>0?1:-1):Te)}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_REMOVE,settings:{removedBlockIndex:pe,gap:Ee.gap},editFromStructure:Ut()}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,items:K.map((le,Te)=>({width:le,current:m.floatBlocks.items.filter((Re,$e)=>$e!==pe)[Te].current}))},changeKey:"width"})},he=ve=>{if(P>=8)return;const Ee=c.getFieldsValue(!0);let pe=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((Re,$e)=>{Re===ve.target.closest(".selected-element-panel__columns-settings__controls__column")&&(pe=$e)});const Q=parseFloat(Ee.gap)||0,X=m.floatBlocks.items.map(Re=>+Re.width),Z=X[pe],J=X.reduce((Re,$e)=>Re+$e,0),H=J-Q,M=J+Z,Y=M>0?H/M:1;let K=[];const te=[];X.forEach((Re,$e)=>{K.push(Math.max(30,Math.round(Re*Y))),te.push(m.floatBlocks.items[$e]?.current||!1),$e===pe&&(K.push(Math.max(30,Math.round(Z*Y))),te.push(!1))});const le=H-K.reduce((Re,$e)=>Re+$e,0);if(le!==0){let Re=K.map((z,re)=>[re,z]).filter(z=>z[1]>30);const $e=Re.length-Math.abs(le);Re=Re.map((z,re)=>[z[0],$e<=re?z[1]+(le>0?1:-1):z[1]]),Re.forEach(z=>K[z[0]]=z[1])}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_COPY,settings:{copiedBlockIndex:pe,gap:Ee.gap,widths:K},editFromStructure:Ut()});const Te=K.reduce((Re,$e)=>Re+$e,0);U(K.map(Re=>(Re/Te*100).toFixed(1))),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,items:K.map((Re,$e)=>({width:Re,current:te[$e]||!1}))},changeKey:"width"})},ke=(0,n.useCallback)(ve=>{const Ee=".selected-element-panel__columns-settings__controls__column",pe=Array.from(document.querySelectorAll(Ee)).indexOf(ve.target.closest(Ee)),Q=pe-1;if(Q<0)return;const X=m.floatBlocks,Z=X.items.map(({width:J,current:H})=>({width:J,current:H||!1}));[Z[Q],Z[pe]]=[Z[pe],Z[Q]],d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_SWAP,settings:{indexA:Q,indexB:pe},editFromStructure:Ut()}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...X,items:Z},changeKey:"width"})},[m,L,i,d]),ce=ve=>{k(ve),d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_WRAP,settings:{wrap:!S}}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,wrap:!S},changeKey:"wrap"})},ze=ve=>{y(ve),d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_DIR,settings:{dirRevert:!f}}),L({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,dirRevert:!f},changeKey:"dir"})},Oe=()=>setTimeout(()=>h?.current&&h.current.focus({cursor:"end"}),300);return m.floatBlocks&&m.floatBlocks.items.length>0&&(0,t.jsx)(o.ui_kit$Form,{layout:"vertical",form:c,name:"float_blocks_settings_form",autoComplete:"off",initialValues:{gap:m.floatBlocks?.gap||0,gapDim:"px",gapMobile:m.floatBlocks?.gapMobile||0,valign:m.floatBlocks?.valign||"top",...m.floatBlocks?.items.reduce((ve,{width:Ee},pe)=>(ve[`width-${pe}`]=Ee,ve),{})},onValuesChange:oe,onFieldsChange:Oe,className:"element-controls",children:(0,t.jsxs)("div",{className:"selected-element-panel__columns-settings",style:{paddingTop:p.switchDesktopMobilePropsEnabled||p.stepToOtherElementEnabled||p.deleteButtonEnabled||m.type==="structure"?0:24},children:[m.floatBlocks.items.length===1&&(0,t.jsx)(o.ui_kit$Alert,{style:{marginBottom:10},title:l('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"}),$!=="mobile"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"selected-element-panel__columns-settings__header",children:[(0,t.jsx)("span",{className:"selected-element-panel__columns-settings__header-title",children:l("Columns")}),(0,t.jsxs)("div",{className:"selected-element-panel__columns-settings__links",children:[(0,t.jsxs)("span",{className:"selected-element-panel__columns-settings__links__add",onClick:Se,children:[(0,t.jsx)(r.EmIcons,{icon:"PlusCircleOutlined",component:o.icons$PlusCircleOutlined,size:16,strokeWidth:p.iconStrokeWidth})," ",l("Add column")]}),m.floatBlocks.items.length>1&&(0,t.jsx)("span",{onClick:xe,children:(0,t.jsxs)(o.ui_kit$Tooltip,{title:l("Make columns the same width."),children:[(0,t.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined})," ",l("Equalize")]})})]})]}),m.floatBlocks.items.length>1&&(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:16},children:(0,t.jsx)("div",{className:"selected-element-panel__columns-settings__controls",children:m.floatBlocks.items.map((ve,Ee)=>(0,t.jsxs)("div",{className:"selected-element-panel__columns-settings__controls__column "+(ve.current?"current":""),style:{width:ve.width/R*100+"%"},children:[Ee>0&&(0,t.jsx)(o.ui_kit$Tooltip,{title:l("Swap columns"),children:(0,t.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__swap",onClick:ke,children:(0,t.jsx)(r.EmIcons,{icon:"SwapHorizontalIcon",component:o.icons$SwapHorizontalIcon,size:15,strokeWidth:p.iconStrokeWidth})})}),m.floatBlocks.items.length>1&&(0,t.jsx)(o.ui_kit$Tooltip,{title:l("Delete column"),children:(0,t.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__remove",onClick:me,children:(0,t.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:15,strokeWidth:p.iconStrokeWidth,style:{color:"#ff4d4f"}})})}),m.floatBlocks.items.length<8&&(0,t.jsx)(o.ui_kit$Tooltip,{title:l("Copy column"),children:(0,t.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__copy",onClick:he,children:(0,t.jsx)(r.EmIcons,{icon:"CopyOutlined",component:o.icons$CopyOutlined,size:15,strokeWidth:p.iconStrokeWidth})})}),(0,t.jsx)("div",{className:"selected-element-panel__columns-settings__controls__field",children:(0,t.jsx)(o.ui_kit$Form.Item,{label:"",name:"width-"+Ee,children:(0,t.jsx)(o.ui_kit$InputNumber,{min:30,value:ve.width||0,placeholder:l("Width"),ref:v==="width-"+Ee&&h})})})]},"floatblock-"+Ee))})}),(0,t.jsxs)("div",{className:"columns-presets",children:[(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{be({cols:1})},children:(0,t.jsx)(r.EmIcons,{icon:"LayoutCol1",component:o.icons$LayoutCol1})}),(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{be({cols:2})},children:(0,t.jsx)(r.EmIcons,{icon:"LayoutCol2",component:o.icons$LayoutCol2})}),(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{be({cols:2,width:[66,34]})},children:(0,t.jsx)(r.EmIcons,{icon:"LayoutCol2WideLeft",component:o.icons$LayoutCol2WideLeft})}),(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{be({cols:2,width:[34,66]})},children:(0,t.jsx)(r.EmIcons,{icon:"LayoutCol2WideRight",component:o.icons$LayoutCol2WideRight})}),(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{be({cols:3})},children:(0,t.jsx)(r.EmIcons,{icon:"LayoutCol3",component:o.icons$LayoutCol3})}),(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{be({cols:4})},children:(0,t.jsx)(r.EmIcons,{icon:"LayoutCol4",component:o.icons$LayoutCol4})})]})]}),m.floatBlocks.items.length>1&&(0,t.jsxs)(t.Fragment,{children:[$==="mobile"&&(0,t.jsx)("div",{style:{marginBottom:24},children:(0,t.jsx)(o.ui_kit$Switch,{id:"column-wrap",label:l("Line break on mobile devices"),size:"small",disabled:m.floatBlocks?.wrap===void 0,checked:S,onChange:ce,labelStyle:{position:"relative",top:2}})}),$!=="mobile"&&(0,t.jsx)("div",{style:{marginBottom:24},children:(0,t.jsx)(o.ui_kit$Switch,{id:"column-dir-revers",label:l("Reverse order on desktop"),size:"small",disabled:m.floatBlocks?.wrap===void 0,checked:f,onChange:ze,labelStyle:{position:"relative",top:2}})})]}),m.floatBlocks.items.length>1&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$FormSection,{title:l("Vertical alignment"),titleStyle:{paddingTop:20},children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"valign",style:{marginBottom:0},children:(0,t.jsx)(o.ui_kit$FormVerticalAlignControl,{disabled:m.floatBlocks.items.length<=1,strokeWidth:p.iconStrokeWidth,labels:{alignTop:l("Align top"),alignMiddle:l("Center vertically"),alignBottom:l("Align bottom")}})})})}),(0,t.jsxs)(t.Fragment,{children:[$!=="mobile"&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$FormSection,{title:l("Indent between columns"),titleStyle:{paddingTop:20},children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"gap",style:{marginBottom:20},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,disabled:m.floatBlocks.items.length<=1,placeholder:l("Indent between columns"),prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:"px",ref:v==="gap"&&h})})})}),$==="mobile"&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$FormSection,{title:l("Indent in mobile"),titleStyle:{paddingTop:20},children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"gapMobile",style:{marginBottom:20},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,disabled:m.floatBlocks.items.length<=1,placeholder:l("Indent in mobile"),prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:o.icons$ColumnHeightOutlined}),addonAfter:"px"})})})})]})]})]})]})})};yl.propTypes={selectedElement:_.default.shape({parent:_.default.string})};var Yc=()=>{},wl=({email:e,formSettings:i={},onClosePanel:s=Yc})=>{const{__:l}=r.useI18n(),a=r.useRootElement(),d=r.useDispatch(),c=r.useSendPostMessage(),h=Object.prototype.hasOwnProperty.call(e,"type")?r.BLOCK:r.EMAIL,g=r.useSelector(r.selectElementSettings$1),b=r.useSelector(r.selectElementSettings),x=r.useSelector(r.selectPropertiesPanelKey),p=h==="email"?g:b,m=Object.keys(i).length>0?i.settings:p,S=i?.type==="advanced"&&!!i?.content,k=!!i?.extraTabs?.length,f=r.useAppConfig(),y=m.type==="customTable",v=!!m.type&&!!m.floatBlocks?.items.length>0&&!!m.floatBlocks?.items.filter(V=>!!V.width).length>0,N=(0,n.useRef)(null);(0,n.useEffect)(()=>{const V=Object.values(r.ELEMENT_TYPES),ne=m.type&&V.includes(m.type)?`${m.type}-${JSON.stringify(m.path||[])}`:null;if(S||k){const T=a.querySelector(".email-pane .panel-form__body");T&&(T.scrollTop=0),d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else if(m.type&&V.includes(m.type)){const T=N.current!==ne;if(N.current=ne,m.activateSection!=="structure"){if(T){const oe=a.querySelector(".email-pane .panel-form__body");oe&&(oe.scrollTop=0)}d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else d(r.setPropertiesPanelKey(r.STRUCTURE))}else JSON.stringify(m)!=="{}"&&(N.current=null,d(r.setPropertiesPanelKey("")))},[m,d,a,S,k]);const R=(0,n.useMemo)(()=>{const V=[{key:r.EDIT_SELECTED_ELEMENT,label:(0,t.jsx)("span",{style:{textTransform:"capitalize"},children:m.caption?m.caption:l("Edit element")})}];return v&&V.push({key:r.STRUCTURE,label:l("Columns")}),V},[m.caption,v,l]),C=(0,n.useMemo)(()=>[{key:r.EDIT_SELECTED_ELEMENT,label:l("Cell")},{key:r.TABLE_PROPERTIES,label:l("Table")}],[l]),F=V=>{V.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_REMOVE}),d(h==="email"?r.setElementSettings$1({}):r.setElementSettings({}))},U=V=>{V.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_PARENT_GET})},$=()=>{s(m),d(r.resetToLastActiveSettingsTab()),setTimeout(()=>{d(h==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET})},L=(0,t.jsxs)(t.Fragment,{children:[f.deleteButtonEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:l("Remove element by Delete Key"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{type:"text",onClick:F,disabled:!m.deletable,icon:(0,t.jsx)(o.ui_kit$EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:18,strokeWidth:f.iconStrokeWidth})})}),f.stepToOtherElementEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:l("Up to parent element"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{type:"text",onClick:U,disabled:!m.parent,icon:(0,t.jsx)(o.ui_kit$EmIcons,{icon:"GoToParent",component:o.icons$GoToParent,size:18,strokeWidth:f.iconStrokeWidth})})})]}),P=f.switchDesktopMobilePropsEnabled||f.stepToOtherElementEnabled||f.deleteButtonEnabled;return(0,t.jsxs)(o.ui_kit$PanelForm,{children:[(0,t.jsx)(o.ui_kit$PanelForm.Header,{onClose:$,closeIcon:(0,t.jsx)(o.ui_kit$EmIcons,{icon:"Close",component:o.icons$Close,size:24,strokeWidth:f.iconStrokeWidth}),extra:P?L:void 0,children:(0,t.jsx)(o.ui_kit$Tabs,{items:y?C:R,activeKey:x,onChange:V=>d(r.setPropertiesPanelKey(V||""))})}),(0,t.jsx)(o.ui_kit$PanelForm.Body,{children:y?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{style:{display:x==="Edit selected element"?void 0:"none"},children:(0,t.jsx)(lo,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:h,formName:`${r.EDIT_SELECTED_TABLE_CELLS}`})}),(0,t.jsx)("div",{style:{display:x==="Table properties"?void 0:"none"},children:(0,t.jsx)(lo,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:h,formName:`${r.TABLE_PROPERTIES}`})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{style:{display:x==="Edit selected element"?void 0:"none"},children:(0,t.jsx)(lo,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:h})}),v&&(0,t.jsx)("div",{style:{display:x==="Structure"?void 0:"none"},children:(0,t.jsx)(yl,{selectedElement:m,emailElementType:h,isSelectedElement:!1})})]})})]})},Xc=({taxonomy:e})=>{const{__:i,_x:s}=r.useI18n(),l=r.useDispatch(),[a]=o.ui_kit$Form.useForm(),d=(0,n.useRef)(null),c=r.useSelector(r.selectActiveModal$1)===r.MODALS.ADD_NEW_GROUP_MODAL,h=r.useNotification(),g=r.useProjectData(),b=(0,n.useCallback)(()=>{a.resetFields(),setTimeout(()=>d.current?.focus({cursor:"start"}),0)},[a]);(0,n.useEffect)(()=>{c&&b()},[c,b]);const x=()=>l(r.closeModal$1()),[p,m]=r.useAddTermMutation(),[S,k]=(0,n.useState)(!1),f=()=>{a.validateFields().then(({name:y})=>(k(!0),p({project:g,kind:"group",name:y}).then(v=>{if("error"in v){h.error(v);return}h.success({title:i("The group “")+v.data.name+s("” was successfully created.",e)}),x()}))).catch(y=>{}).finally(()=>k(!1))};return(0,t.jsx)(o.ui_kit$Modal,{title:i("Add a new group"),open:c,onOk:f,onCancel:x,className:"new-group-modal",footer:[(0,t.jsx)(o.ui_kit$Button,{type:"primary",size:"large",loading:m.isLoading||S,onClick:f,children:i("Create group")},"submit")],children:(0,t.jsx)(o.ui_kit$Form,{form:a,layout:"vertical",name:"add_new_group_form",onFinish:f,initialValues:{remember:!1,name:""},autoComplete:"off",style:{paddingTop:10},children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"name",rules:[{required:!0,message:i("Please enter the group name")}],children:(0,t.jsx)(o.ui_kit$Input,{disabled:m.isLoading,size:"large",placeholder:i("Enter the group name"),ref:d,style:{marginBottom:5}})})})})},Kc=({group:e,refetch:i})=>{const{__:s,_x:l}=r.useI18n(),a=r.useDispatch(),[d]=o.ui_kit$Form.useForm(),c=(0,n.useRef)(null),h=r.useSelector(r.selectActiveModal$1)===r.MODALS.EDIT_GROUP_NAME_MODAL,g=r.useNotification(),{id:b=null,name:x=""}=e,p=()=>a(r.closeModal$1()),[m,S]=r.useEditTermMutation();(0,n.useEffect)(()=>{h&&d.setFieldsValue({name:x})},[h,x,d]);const k=()=>{d.validateFields().then(({name:f})=>{m({kind:"group",id:b,name:f}).then(({data:y,error:v})=>{v?(g.error({error:v}),d.setFieldValue("name",f)):(i().then(({data:N})=>{if(N){const R=N[0]?.children?.find(C=>C.id===b)?.name;d.setFieldValue("name",R)}}),p(),g.success({title:s("The group “")+f+l("” was successfully changed to “","group")+y.name+s("”.")}))})})};return(0,t.jsx)(o.ui_kit$Modal,{title:s("Change group name"),open:h,onOk:k,onCancel:p,className:"new-group-name-modal",footer:[(0,t.jsx)(o.ui_kit$Button,{type:"primary",size:"large",loading:S.isLoading,onClick:k,children:s("Change name")},"submit")],children:(0,t.jsx)(o.ui_kit$Form,{form:d,layout:"vertical",name:"rename_group_form",onFinish:k,initialValues:{remember:!1,name:x},autoComplete:"off",style:{paddingTop:10},children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"name",rules:[{required:!0,message:s("Please enter the group name")}],children:(0,t.jsx)(o.ui_kit$Input,{disabled:S.isLoading,size:"large",placeholder:s("Enter the group name"),ref:c,style:{marginBottom:5}})})})})},zi={width:"100%"},qc=["hover"],Jc={color:"#ff4d4f"},Qc={color:o.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0},Zc=({level:e,onRename:i,onRemove:s})=>{const{__:l}=r.useI18n(),a=(0,n.useMemo)(()=>({items:[{label:l("Rename"),key:"Rename",icon:(0,t.jsx)(r.EmIcons,{icon:"CopyOutlined",component:o.icons$CopyOutlined,size:16}),onClick:()=>i(e)},{label:l("Remove"),key:"Remove",icon:(0,t.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:16}),style:Jc,onClick:()=>s(e)}]}),[l,e,s,i]);return(0,t.jsx)(o.ui_kit$Button,{type:"text",className:"groups-management__group_menu","data-group-id":e.id,size:"large",children:(0,t.jsx)(o.ui_kit$Dropdown,{className:"groups-management__group_menu-inner",placement:"bottomLeft",menu:a,trigger:qc,children:(0,t.jsx)("span",{className:"groups-management__actions",children:(0,t.jsx)(r.EmIcons,{icon:"MoreOutlined",component:o.icons$MoreOutlined})})})})},eu=({className:e,levels:i,readOnlyLevels:s=!1,levelsRead:l=!1,refetchProjectGroups:a,isLoading:d})=>{const{__:c,_x:h}=r.useI18n(),g=r.useDispatch(),b=r.useNotification(),{modal:x}=o.ui_kit$App.useApp(),{confirm:p}=x,{token:m}=(0,o.ui_kit$useToken)(),S=r.useSelector(r.selectProjectGroups),k=i??S,[f]=r.useDeleteTermMutation(),[y,v]=(0,n.useState)({id:null,name:""}),N=(0,n.useCallback)(($,L)=>{f({kind:"group",id:Number($)}).unwrap().then(P=>{P?.deleted&&b.success({title:c("The group “")+L+h("” was successfully deleted.","recovery")})}).catch(P=>{b.error({error:P})})},[f,b,c,h]),R=(0,n.useCallback)($=>{const L=$.name??"";p({mask:{closable:!0},centered:!0,title:h("Are you sure to delete “","group")+L+c("” group and all nested groups?"),icon:(0,t.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:22,style:Qc}),okText:c("Yes"),cancelText:c("No"),onOk:()=>N(String($.id),L)})},[p,N,c,h]),C=(0,n.useCallback)($=>{g(r.openModal$1(r.MODALS.EDIT_GROUP_NAME_MODAL)),v({id:$.id,name:$.name??""})},[g]),F=(0,n.useMemo)(()=>({marginBottom:m.formItemMarginBottomMD}),[m]),U=(0,n.useCallback)(()=>{g(r.openModal$1(r.MODALS.ADD_NEW_GROUP_MODAL))},[g]);return(0,t.jsxs)("div",{className:(0,We.default)("groups-management",{[e]:e}),children:[d?(0,t.jsx)(o.ui_kit$Skeleton,{active:!0}):(0,t.jsxs)(o.ui_kit$Row,{children:[!!k?.length&&k?.map(($,L)=>(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:`group_${$.id}`,style:{marginBottom:m.formItemMarginBottomMD},label:(0,t.jsxs)(o.ui_kit$Flex,{justify:"space-between",align:"center",style:zi,children:[(0,t.jsx)("span",{children:$.name}),!s&&(0,t.jsx)(Zc,{level:$,onRename:C,onRemove:R})]}),className:"groups-management__group-select",rules:[{message:"Please input category name!",type:"array"}],children:(0,t.jsx)(o.ui_kit$Select,{mode:s?"multiple":"tags",style:zi,placeholder:c(s?"Select a category":"Type category here"),options:$.children?.map(P=>({label:P.name,value:String(P.id)})),tagRender:P=>{const{label:V,closable:ne,onClose:T}=P,oe=xe=>{xe.preventDefault(),xe.stopPropagation()};return(0,t.jsx)(o.ui_kit$Tag,{variant:"solid",color:m.colorPrimary,onMouseDown:oe,closable:ne,onClose:T,style:{borderRadius:6},children:V})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})},$.id)),s&&l&&!k?.length&&(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Text,{type:"secondary",style:F,children:c("This project has no template sections yet.")})}),!s&&(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Form.Item,{style:F,children:(0,t.jsx)(o.ui_kit$Button,{id:"add_group_button",icon:(0,t.jsx)(r.EmIcons,{icon:"AddSlide",component:o.icons$AddSlide}),style:zi,onClick:U,children:c("Add group")})})})]}),(0,t.jsx)(Xc,{taxonomy:r.ELEMENT_TYPES.GROUP}),(0,t.jsx)(Kc,{group:y,refetch:a})]})};function tu(e,{gallery:i=!1}={}){const s=r.isEmailsV2Enabled(),l=r.useGetTemplateSectionsQuery({scope:"gallery"},{skip:!s||!i}),a=r.useGetTemplateSectionsQuery({scope:"project",projectId:e},{skip:!s||!e});return{emailsOnV2:s,standardSections:l.data,projectSections:a.data,projectSectionsLoading:s&&!!e&&a.isLoading}}var{title:Gi,description:ii,tags:ri,type:Yi,is_template:ou,group:jl}={title:"title",description:"description",tags:"tags",type:"type",is_template:"is_template",group:"group"},iu={[Gi]:"",[ii]:"",[ri]:[],[ou]:!1},ru={[ii]:"",[ri]:[],[Yi]:""};function su(e){const i=new Set;return e?.filter(s=>i.has(s.name)?!1:(i.add(s.name),!0))}var lu=e=>Array.isArray(e)&&e.length>0,vl=({className:e="",element:i})=>{const{__:s}=r.useI18n(),l=r.useDispatch(),a=r.useEmailAttributesWriter(),[d]=o.ui_kit$Form.useForm(),{token:c}=(0,o.ui_kit$useToken)(),h=r.useAppConfig(),g=r.useEditorLocked(),b=r.useEditorLockCheck(),x=r.useSelector(r.selectProjectGroups),{data:p}=r.useGetBlockTypesQuery(),m=r.useProjectData(),S=i.hasOwnProperty("type")?r.BLOCK:r.EMAIL,k=i.hasOwnProperty("type")?r.BLOCK_TAGS:r.EMAIL_TAGS,{emailsOnV2:f,projectSections:y,projectSectionsLoading:v}=tu(m?.id),{data:N,refetch:R,isLoading:C,isFetching:F,isUninitialized:U,isSuccess:$}=r.useGetTermsQuery({project:m,kind:"group"},{skip:f||!m?.id}),L=(0,n.useMemo)(()=>f?y??[]:x,[f,y,x]);(0,n.useEffect)(()=>{N&&l(r.projectGroupsLoaded(N,S==="email"?i.group??[]:void 0))},[l,N,S,i.group]),(0,n.useEffect)(()=>{!U&&R()},[U,R]),(0,n.useEffect)(()=>{if(!f||!i.is_template)return;const Q=new Set(i.projectCategories??[]),X={};let Z=!1;for(const J of y??[]){const H=`group_${J.id}`,M=(J.children??[]).filter(K=>Q.has(String(K.id))).map(K=>String(K.id)),Y=d.getFieldValue(H);(!Y||Y.length!==M.length||M.some((K,te)=>Y[te]!==K))&&(Z=!0),X[H]=M}Z&&d.setFieldsValue(X)},[d,f,i.is_template,i.projectCategories,y]);const[P,V]=(0,n.useState)([]),[ne,T]=(0,n.useState)([]),[oe,xe]=(0,n.useState)(i.is_template||!1),be=r.useProjectData();(0,n.useEffect)(()=>{!U&&R()},[i.group,R,U]),(0,n.useEffect)(()=>{if($&&i.is_template&&lu(i.group)){const Q=i.group;let X={};Q.length&&x.length&&Q?.forEach(J=>{x?.forEach(H=>{let M=H.children.find(Y=>Y.id===J);M&&(X.hasOwnProperty(H.id)||(X[H.id]=[]),X[H.id].push({label:M.name,value:M.id}))})});let Z={};for(let J in X)X.hasOwnProperty(+J)&&(Z[`group_${J}`]=X[J].map(H=>({...H,value:String(H.value)})));d.setFieldsValue(Z)}},[d,x,i.is_template,i.group,$]);const{data:Se,isFetching:me,refetch:he}=r.useGetTermsQuery({project:be,kind:k},{skip:!be?.id});(0,n.useEffect)(()=>{T(su(Se)?.map(Q=>({value:Q.name,key:Q.id})))},[Se]),(0,n.useEffect)(()=>{if(i){const Q=r.getTaxonomy(i,k)??[],X=Se??[],Z=Q.map(M=>M.name??""),J=i.emailtags||i.blocktags||[],H=Q.concat(X).filter(M=>J.some(Y=>r.sameTermId(M.id,Y))).map(M=>M.name??"");d.setFieldsValue({title:i.title,description:i.description,tags:Array.isArray(i.tags)?i.tags:H.length?Array.from(new Set(H)):Z,type:i.type})}},[d,i,k,Se]);const ke=(0,n.useMemo)(()=>{if(!(S==="email"?f:r.isBlocksV2Enabled())||!i)return[];const Q=r.getTaxonomy(i,k)??[],X=Se??[],Z=[...Q,...X];return((S==="email"?i.emailtags:i.blocktags)??[]).filter(J=>!Z.some(H=>H.name&&r.sameTermId(H.id,J)))},[f,S,i,k,Se]),[ce,ze]=(0,n.useState)(void 0),Oe=!Array.isArray(i?.tags);(0,n.useEffect)(()=>{Oe&&ke.length&&be?.id&&!me&&ce!==i?.id&&(ze(i?.id),he())},[Oe,ke.length,be?.id,me,ce,i?.id,he]);const ve=Oe&&ke.length>0&&(Se===void 0||me||ce!==i?.id),Ee=Q=>{if(b())return;const X=Object.keys(Q)[0],Z=Q,J=X.split("_")[0];if(J===Gi)a({title:Z[X]});else if(J===ii)a({description:Z[X]});else if(J===ri){const H=Z[X],M=S==="email"&&(H?.length??0)===0;a({tags:(H??[]).map(Y=>Y.trim()),...M?{emailtags:[]}:{}})}else J==="is"&&S==="email"?a({is_template:Z[X]}):J===Yi&&S==="block"&&a({type:Z[X]});switch(X.split("_")[0]){case jl:if(f){const H=new Set((y??[]).flatMap(te=>(te.children??[]).map(le=>String(le.id)))),M=d.getFieldsValue(!0),Y=Object.keys(M).filter(te=>te.startsWith(`${jl}_`)).flatMap(te=>M[te]??[]).map(String).filter(te=>H.has(te)),K=(i.projectCategories??[]).map(String).filter(te=>!H.has(te));a({projectCategories:[...new Set([...K,...Y])]});break}l(r.setEmailGroups({[X.split("_")[1]]:Q[X]}));break;default:return}};(0,n.useEffect)(()=>{if(p){const Q=p;let X=[];const Z={Applications:s("Apps"),Articles:s("Article"),Banners:s("Banners"),Buttons:s("Buttons"),"Call to Action":s("Call to Action"),Contacts:s("Contacts"),Content:s("Content"),"E-Commerce":s("E-Commerce"),Feature:s("Features"),Footer:s("Footers"),Header:s("Headers"),Lists:s("Lists"),Menu:s("Menus"),Other:s("Others"),Polls:s("Polls"),Promocodes:s("Promocodes"),Separators:s("Separators"),Transactional:s("Transactional")};for(let J in Q)X.push({label:Z[Q[J]],value:Q[J]});V(X)}},[p,s]);const pe=Q=>{xe(Q)};return(0,t.jsx)("div",{className:(0,We.default)("settings-panel",{[e]:e}),children:(0,t.jsxs)(o.ui_kit$Form,{form:d,layout:"vertical",name:"settings_panel_form",initialValues:S==="email"?{EmailInitialValues:iu}:ru,onValuesChange:Ee,autoComplete:"off",disabled:g,children:[h.subjectEnabled&&S==="email"&&(0,t.jsx)(o.ui_kit$Form.Item,{label:s("Title"),name:Gi,tooltip:{title:s("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,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$TextArea,{placeholder:s("Type title here"),autoSize:{minRows:1}})}),h.descriptionEnabled&&(0,t.jsx)(o.ui_kit$Form.Item,{label:s("Description"),name:ii,tooltip:{title:s("Description is used in other sections of the service."),icon:(0,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$TextArea,{placeholder:s("Type your description here"),autoSize:{minRows:2}})}),h.tagsEnabled&&(0,t.jsx)(o.ui_kit$Form.Item,{label:s("Tags"),name:ri,tooltip:{title:s("Tags help you find the block in the list."),icon:(0,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},rules:[{message:s("Please input tags!"),type:"array"}],children:(0,t.jsx)(o.ui_kit$Select,{mode:"tags",style:{width:"100%"},placeholder:s("Type your tags here"),options:ne,disabled:ve||g,loading:ve,tagRender:Q=>{const{label:X,closable:Z,onClose:J}=Q,H=M=>{M.preventDefault(),M.stopPropagation()};return(0,t.jsx)(o.ui_kit$Tag,{variant:"solid",color:c.colorPrimary,onMouseDown:H,closable:Z,onClose:J,style:{borderRadius:6},children:X})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})}),S==="email"&&h.isTemplateEnabled&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:16}}),(0,t.jsx)(o.ui_kit$Tooltip,{title:i.isNew?s("Save email first."):s("Use this email as a template for creating future emails."),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"is_template",valuePropName:"checked",initialValue:oe,children:(0,t.jsx)(o.ui_kit$Switch,{id:"setIsTemplate",label:s("Is a template"),size:"small",onChange:pe,disabled:!!i.isNew||g,labelStyle:{position:"relative",top:2,fontSize:14,color:c.colorText}})})},"isTemplate")]}),oe&&(0,t.jsx)(eu,{element:i,levels:L,readOnlyLevels:f,levelsRead:y!==void 0,refetchProjectGroups:R,isLoading:f?v:C||F}),S==="block"&&(0,t.jsx)(o.ui_kit$Form.Item,{name:Yi,label:s("Type"),tooltip:{title:s("Select the block type to find any block on the list faster."),icon:(0,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},rules:[{message:s("Please input type!")}],children:(0,t.jsx)(o.ui_kit$Select,{placeholder:s("Choose block type"),options:P,getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})]})})};vl.propTypes={className:_.default.string,email:_.default.object};var{utm_source:Il,utm_medium:Cl,utm_campaign:Pl,utm_term:Al,utm_content:Nl}={utm_source:"utm_source",utm_medium:"utm_medium",utm_campaign:"utm_campaign",utm_term:"utm_term",utm_content:"utm_content"},au={[Il]:"",[Cl]:"",[Pl]:"",[Al]:"",[Nl]:""},Ll=({className:e="",email:i=void 0})=>{const{__:s}=r.useI18n(),l=r.useEmailAttributesWriter(),a=r.useEditorLocked(),d=r.useEditorLockCheck(),[c]=o.ui_kit$Form.useForm();(0,n.useEffect)(()=>{i&&c.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||""})},[c,i]);const h=g=>{if(d())return;const b=Object.keys(g)[0],x=g;l({utm_parameters:{...i?.utm_parameters,[b]:x[b]}})};return(0,t.jsx)("div",{className:(0,We.default)("settings-panel",{[e]:e}),children:(0,t.jsxs)(o.ui_kit$Form,{form:c,layout:"vertical",name:"settings_panel_form_utm",initialValues:au,onValuesChange:h,autoComplete:"off",disabled:a,children:[(0,t.jsx)(o.ui_kit$Alert,{title:s("The specified parameters will be added to all links when exporting the email."),type:"info",showIcon:!0,style:{marginBottom:20}}),(0,t.jsx)(o.ui_kit$Form.Item,{label:s("utm_source"),name:Il,tooltip:{title:s("Mandatory. Indicates the traffic source. Example: utm_source=google"),icon:(0,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:s("google")})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:s("utm_medium"),name:Cl,tooltip:{title:s("Identifies what type of link was used, such as cost per click or email. For example: utm_medium=cpc"),icon:(0,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:s("cpc")})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:s("utm_campaign"),name:Pl,tooltip:{title:s("Indicates a specific product promotion or a marketing campaign. Example: utm_campaign=spring_sale"),icon:(0,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:s("spring_sale")})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:s("utm_term"),name:Al,tooltip:{title:s("Identifies search terms. For example: utm_term=running+shoes"),icon:(0,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:s("running+shoes")})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:s("utm_content"),name:Nl,tooltip:{title:s("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,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:s("textlink")})})]})})};Ll.propTypes={className:_.default.string,email:_.default.object};var Ye={PRODUCT_CAROUSEL:"productCarousel",SINGLE_IMAGE_PREVIEW:"singleImagePreview",DEAL_ANNOTATION:"dealAnnotation",DEAL_CARD:"dealCard"},Ol="emailmaker-gmail-annotations";function Xi(e){return/^[A-Za-z]{3}$/.test((e??"").trim())}function nu(e){return typeof e=="object"&&e!==null}function si(e,i){const s=e[i];return typeof s=="string"?s:""}var du=new Set(["PromotionCard","DiscountOffer","Organization"]);function $l(e){let i;try{i=JSON.parse(e)}catch{return!1}const s=Array.isArray(i)?i:[i];return s.length===0?!1:s.every(l=>typeof l=="object"&&l!==null&&du.has(String(l["@type"])))}function cu(){let e=new Date().getTime(),i=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{let l=Math.random()*16;return e>0?(l=(e+l)%16|0,e=Math.floor(e/16)):(l=(i+l)%16|0,i=Math.floor(i/16)),(s==="x"?l:l&3|8).toString(16)})}function li(e){return e.annotationType||Ye.PRODUCT_CAROUSEL}function ao(e){return!!(e?.image||e?.url||e?.headline||e?.price||e?.priceCurrency||e?.discountValue)}function Ki(e){return!e.description&&!e.discountCode&&!e.availabilityStarts&&!e.availabilityEnds}function ai(e){return typeof e=="string"&&e.trim().length>0}function qi(e){return ai(e)?/^https?:\/\//i.test(e.trim()):!1}function Fl(e){return ai(e?.image)&&qi(e?.url)}function uu(e){switch(li(e)){case Ye.SINGLE_IMAGE_PREVIEW:return Fl(e.cards?.[0]);case Ye.DEAL_ANNOTATION:return!Ki(e);case Ye.DEAL_CARD:return ai(e.description)&&(qi(e.offerPageUrl)||qi(e.merchantHomepageUrl));case Ye.PRODUCT_CAROUSEL:default:return!!e.cards?.some(Fl)}}function mu(e){switch(li(e)){case Ye.SINGLE_IMAGE_PREVIEW:return!ao(e.cards?.[0])&&!ai(e.discountCode);case Ye.DEAL_ANNOTATION:return Ki(e);case Ye.DEAL_CARD:return Ki(e)&&!e.offerPageUrl&&!e.merchantHomepageUrl;case Ye.PRODUCT_CAROUSEL:default:return!e.cards?.some(ao)}}function pu(e){switch(li(e)){case Ye.DEAL_ANNOTATION:case Ye.DEAL_CARD:return!!(e.description||e.discountCode||e.availabilityStarts||e.availabilityEnds||e.offerPageUrl||e.merchantHomepageUrl);case Ye.SINGLE_IMAGE_PREVIEW:return ao(e.cards?.[0]);case Ye.PRODUCT_CAROUSEL:default:return e.logo?!0:!!e.cards?.some(ao)}}function hu(e){let i=typeof e.price=="string"||typeof e.price=="number"?String(e.price):"",s=typeof e.discountValue=="string"||typeof e.discountValue=="number"?String(e.discountValue):"";const l=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&&l&&(i=l),!s&&i&&a){const d=parseFloat(i),c=parseFloat(a);!isNaN(d)&&!isNaN(c)&&d>=c&&(s=String(d-c))}return{id:cu(),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:s}}function Ml(e,i){const s={"@context":"http://schema.org/","@type":"PromotionCard",image:e.image};if(e.url&&(s.url=e.url),e.headline&&(s.headline=e.headline),e.price&&(s.price=e.price),e.priceCurrency){const l=e.priceCurrency.trim();s.priceCurrency=Xi(l)?l.toUpperCase():l}return e.discountValue&&(s.discountValue=e.discountValue),i&&(s.position=i),s}function Ji(e){const i={"@context":"http://schema.org/","@type":"DiscountOffer"};for(const s of["description","discountCode","availabilityStarts","availabilityEnds","offerPageUrl","merchantHomepageUrl"]){const l=e[s];l&&(i[s]=l)}return i}function Dl(e){return{"@context":"http://schema.org/","@type":"Organization",logo:e}}function bu(e){const i=li(e),s=[];if(i===Ye.DEAL_CARD)return[Ji(e)];if(i===Ye.DEAL_ANNOTATION){const l=[];return e.logo&&l.push(Dl(e.logo)),l.push(Ji(e)),l}if(e.logo&&s.push(Dl(e.logo)),i===Ye.SINGLE_IMAGE_PREVIEW){const l=e.cards?.[0];return e.discountCode?.trim()&&s.push(Ji(e)),l&&ao(l)&&s.push(Ml(l)),s}return(e.cards||[]).filter(ao).forEach((l,a)=>{s.push(Ml(l,a+1))}),s}function gu(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function fu(e){if(mu(e))return null;const i=gu(JSON.stringify(bu(e),null,2));return`<script type="application/ld+json" id="${Ol}">
|
|
9
|
+
__emailmaker__.define("static/core/b8941eda.js",["require","exports","module","static/core/5dc34752.js","static/core/ee980948.js","static/core/281afc68.js","static/core/f7a36b67.js","static/core/98d702c3.js","static/core/d2024dc2.js","static/core/32e15918.js","react","react/jsx-runtime","__delivery__/libs","react-dom","vite/preload-helper","classnames","dayjs"],function(_t,mt,Rh){const at=_t("./5dc34752.js"),ht=_t("./ee980948.js"),r=_t("./281afc68.js"),gi=_t("./f7a36b67.js"),On=_t("./98d702c3.js"),W=_t("./d2024dc2.js"),Vr=_t("./32e15918.js");let n=_t("react");n=at.__toESM(n);let t=_t("react/jsx-runtime"),o=_t("__delivery__/libs"),$n=_t("react-dom"),Ao=_t("vite/preload-helper"),We=_t("classnames");We=at.__toESM(We);let At=_t("dayjs");At=at.__toESM(At);var _=at.__toESM(r.require_prop_types());async function Hr(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,s)=>{const l=URL.createObjectURL(e),a=new Image;a.onload=()=>{URL.revokeObjectURL(l);const d=a.naturalWidth||a.width,c=a.naturalHeight||a.height;d>0&&c>0?i({width:d,height:c}):s(new Error("Could not read image dimensions"))},a.onerror=()=>{URL.revokeObjectURL(l),s(new Error("Could not decode image"))},a.src=l})}function ho(e){return e.trim()}var Fn=67108864,Mn=2e3;function No(e){e.abandonTimer!==void 0&&(clearTimeout(e.abandonTimer),e.abandonTimer=void 0)}function Ur(e,i){return i?new Promise((s,l)=>{if(i.aborted){l(new DOMException("Aborted","AbortError"));return}const a=()=>{l(new DOMException("Aborted","AbortError"))};i.addEventListener("abort",a,{once:!0}),e.then(d=>{i.removeEventListener("abort",a),s(d)},d=>{i.removeEventListener("abort",a),l(d)})}):e}function Dn(e={}){const i=e.maxCacheBytes??Fn,s=e.abandonDelayMs??Mn,l=new Map,a=new Map;let d=0;function c(x){const f=l.get(x);f&&(d-=f.size,l.delete(x))}function p(x,f){if(c(x),!(f.size>i)){l.set(x,f),d+=f.size;for(const y of l.keys()){if(d<=i)break;c(y)}}}function g(x){const f=a.get(x);f&&(No(f),a.delete(x))}function b(x,f){f.waiters-=1,!(f.waiters>0||f.abandonTimer!==void 0||a.get(x)!==f)&&(f.abandonTimer=setTimeout(()=>{f.abandonTimer=void 0,!(a.get(x)!==f||f.waiters>0)&&(a.delete(x),f.controller.abort())},s))}function k(x,f,y){return f.waiters+=1,No(f),y.then(()=>b(x,f),()=>b(x,f)),y}async function h(x,f,y){const v=ho(x);if(!v)throw new Error("Empty image URL");const N=l.get(v);if(N){if(f?.aborted)throw new DOMException("Aborted","AbortError");return l.delete(v),l.set(v,N),N}const B=a.get(v);if(B)return k(v,B,Ur(B.promise,f));const C=new AbortController,$={promise:y(v,C.signal).then(U=>(g(v),p(v,U),U)).catch(U=>{throw g(v),U}),controller:C,waiters:0,abandonTimer:void 0};return a.set(v,$),k(v,$,Ur($.promise,f))}function m(x){const f=ho(x);if(!f)return;const y=a.get(f);y&&(No(y),y.controller.abort(),a.delete(f)),c(f)}function S(){for(const[,x]of a)No(x),x.controller.abort();a.clear(),l.clear(),d=0}return{resolve:h,abandonKey:m,invalidateAll:S}}async function Wr(e,i){if(!e||typeof e.findFileByUrl!="function")return null;const s=await e.findFileByUrl(i);if(!s)return null;const l=typeof e.getFileById=="function"&&s.id&&await e.getFileById(s.id)||s,a=l.url||i,d=l.thumbnailUrl||l.thumbnail||a||(typeof e.getThumbnailUrl=="function"?await e.getThumbnailUrl(l):"")||"";return d?{file:l,previewUrl:d}:null}function bo(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 Vn(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 Hn(e,i){const s=await fetch(e,i);if(!s.ok)throw new Error(`Server returned ${s.status}`);return s.blob()}async function Un(e,i,s){const l=s?{signal:s}:void 0,{blob:a}=await r.ue(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)=>ht.fetchWithResourceProxy(d,{config:i.appConfig,standalone:i.isStandalone,intent:p?.intent||"downloadBlob",validateBlob:async g=>!g.type||g.type.startsWith("image/"),init:c})},d=>Hn(d,l),Vn,{fetchInit:l});return a}function zr(){const e=r.useAppConfig(),i=r.useIsStandalone(),s=r.useProjectData(),l=r.useEditorProjectId(),a=s?.id!==void 0?String(s.id):l||"",d=r.useEventEmitter(ht.events.FILE_PROXY_EVENT_ID),c=r.useEventEmitter(ht.events.PROXY_URL_EVENT_ID);return(0,n.useCallback)(async(p,g)=>Un(p,{appConfig:e,isStandalone:i,fireFileProxy:b=>d.fire({url:b,project:a}),fireProxyUrl:b=>c.fire({url:b,project:a})},g),[e,a,i,d,c])}function Wn(e){return ht.getContainer(e).getOrCreateInstance(ht.IMAGE_BLOB_RESOLVER_ID,()=>Dn())}function Gr(){const e=r.useStore();return(0,n.useMemo)(()=>Wn(e),[e])}function Lo(e){const i=String(e??"").split(";")[0].trim();if(!i)return"";const s=i.toLowerCase(),l=s.indexOf("/");if(l===-1)return s;const a=s.slice(l+1);return a==="svg+xml"?"svg":a}var Yr=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),fi=({onChange:e,value:i,validateStatus:s,placeholder:l,disabled:a,name:d,elementSettings:c,imageInfo:p,previewReloadSignal:g,onRemotePreviewValidate:b})=>{const k=r.useCurrentUser(),h=r.useProjectData(),m=r.useAppConfig(),S=r.useIsStandalone(),{__:x}=r.useI18n();r.useSendPostMessage();const f=r.useSendPostMessageEx(),{openImagePicker:y}=r.useImagePicker(),v=r.useStorageProvider(),N=r.useRestClient(),B=h?.id!==void 0?String(h?.id):"",C=k?.id!=="0"?String(k.id):"",{dataProvider:$}=(0,n.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:v,projectId:B,restApi:N,i18n:{__:x},pathPostfix:C,appConfig:m,isStandalone:S}),[m,S,B,N,v,C,x]),U=zr(),[L]=r.useLazyGetImageInfoQuery(),[F,P]=(0,n.useState)({width:"",height:"",size:""}),[H,ae]=(0,n.useState)(!1),[T,te]=(0,n.useState)(0),[xe,be]=(0,n.useState)(""),ye=(0,n.useRef)(""),me=(0,n.useRef)(g?.counter||0),he=Gr(),ke=(0,n.useRef)(""),ce=(0,n.useRef)(""),[ze,Oe]=(0,n.useState)(0),ve=r.usePlanFeatureGate("image_editor"),Ee=()=>{ke.current&&(URL.revokeObjectURL(ke.current),ke.current="")};(0,n.useEffect)(()=>{if(!i){P({width:"",height:"",size:"",format:""}),ye.current="",be(""),Ee();return}if(i.startsWith("data:")||i.startsWith("blob:")){Ee(),ye.current=i,be(i),P({width:"",height:"",size:"",format:""});return}const V=r.stripEmVersionFromUrlString(i);ce.current=V;const M=ho(V),Y=new AbortController;let K=!1;const ee=async Re=>{Ee();const Be=ze?r.appendEmVersionForPreviewReload(Re):Re;ye.current=Be,be(Be);try{const{data:$e}=await L(V);return K||!$e?!1:(P({width:$e?.width,height:$e?.height,size:$e?.fileSize!=null?($e.fileSize/1024).toFixed(0):"",format:Lo($e?.format)}),!0)}catch{return!1}},le=async()=>{const Re=await he.resolve(M,Y.signal,U);if(K)return;const{width:Be,height:$e}=await Hr(Re);if(K)return;Ee();const z=URL.createObjectURL(Re);ke.current=z,ye.current=z,be(z),P({width:Be,height:$e,size:(Re.size/1024).toFixed(0),format:Lo(Re.type)})};return(async()=>{try{if(!S){const Re=await Wr($,V);if(Re?.previewUrl&&await ee(Re.previewUrl))return}await le()}catch{K||(Ee(),ye.current="",be(""),P({width:"",height:"",size:"",format:""}))}})(),()=>{K=!0,Y.abort()}},[i,$,U,L,S,he,ze]);const pe=(0,n.useCallback)(()=>{const V=ce.current;V&&he.abandonKey(ho(V)),Oe(Date.now())},[he]);(0,n.useEffect)(()=>{!g?.counter||g.name!==d||g.counter!==me.current&&(me.current=g.counter,pe())},[d,g,pe]),(0,n.useEffect)(()=>()=>Ee(),[]);const Q=!!i&&!bo(r.stripEmVersionFromUrlString(String(i))),X=async(V=null)=>{const M=d.startsWith("src"),Y=V||(M?r.MODALS.UPLOAD_IMAGE_MODAL:r.MODALS.UPLOAD_BACKGROUND_MODAL),K=r.stripEmVersionFromUrlString(i||""),ee=await y({kind:M?"img":"background",currentUrl:bo(K)?"":K,entryModal:Y});if(!ee?.url)return;const le=K===r.stripEmVersionFromUrlString(ee.url);(!le||ee.url!==i)&&e(ee.url),ee.meta?.mode==="save"&&le&&(pe(),M&&f(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(ee.url)}))},Z=[{label:x("Upload"),key:"Upload",onClick:()=>X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}];m.imageCenterStockEnabled&&Z.push({label:x("Stock"),key:"Stock",onClick:()=>X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_STOCK:r.MODALS.UPLOAD_BACKGROUND_MODAL_STOCK)}),m.imageCenterGifEnabled&&Z.push({label:x("GIF"),key:"GIF",onClick:()=>X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_GIF:r.MODALS.UPLOAD_BACKGROUND_MODAL_GIF)}),m.elementAIimageEnabled&&Z.push({label:x("AI"),key:"AI",onClick:()=>X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_AI:r.MODALS.UPLOAD_BACKGROUND_MODAL_AI)});const J=()=>{ae(!1)};return(0,t.jsxs)("div",{className:(0,We.default)("upload-bg-image",{"upload-bg-image_disabled":a}),children:[i?(0,t.jsxs)("div",{className:"ant-input-file-uploader upload-bg-image__inner-wrap",onClick:V=>{V.target?.closest(".upload-bg-image__edit")||V.target?.closest(".upload-bg-image__edit-menu")||V.target?.closest(".upload-bg-image__menu")||V.target?.closest(".inputGroup")||X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)},children:[(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,popupRender:()=>m.imagePathDropdownEnabled?(0,t.jsx)("div",{className:"inputGroup",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"Image",component:o.icons$Image,size:20,strokeWidth:m.iconStrokeWidth,style:{verticalAlign:"text-top"}}),allowClear:!0,onChange:e,value:i,placeholder:l,name:d,disabled:a,className:"upload-bg-image__input"})}):(0,t.jsx)(t.Fragment,{}),classNames:{root:"upload-bg-image__dropdown-overlay"},styles:{root:{top:32,marginTop:"8px",width:347,left:0}},trigger:["hover"],placement:"bottom",getPopupContainer:V=>V.closest(".upload-bg-image__inner-wrap"),children:(0,t.jsxs)("div",{className:"upload-bg-image__hover-container",style:{display:"flex",alignItems:"center"},children:[(0,t.jsx)("div",{className:"upload-bg-image__uploader",children:(0,t.jsx)("div",{className:"upload-bg-image__uploader-content",children:(0,t.jsxs)("div",{className:"upload-bg-image__uploader-content-inner",children:[(0,t.jsx)("div",{className:"upload-bg-image__uploader-img-wrap",children:xe?(0,t.jsx)("img",{className:"upload-bg-image__uploader-img",src:xe,alt:"",onLoad:()=>{b&&Yr(r.stripEmVersionFromUrlString(i||""))&&b("success")},onError:()=>{const V=ce.current,M=r.stripEmVersionFromUrlString(xe||""),Y=r.stripEmVersionFromUrlString(V||"");if(V&&M!==Y){ye.current=V,be(V);return}b&&Yr(Y)&&b("error")}}):(0,t.jsx)("div",{className:"upload-bg-image__uploader-img-placeholder","aria-hidden":!0})}),(0,t.jsx)("div",{className:"upload-bg-image__uploader-icons-wrap",children:(0,t.jsx)("div",{className:"upload-bg-image__uploader-content"})})]})})}),F.width&&F.height?(0,t.jsxs)("div",{className:"image-size",children:[F.width," × ",F.height,!!c&&(c.type===r.ELEMENT_TYPES.IMG||c.type===r.ELEMENT_TYPES.CAROUSEL)&&" → "+p.renderedWidth+" × "+p.renderedHeight,(0,t.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,t.jsxs)("span",{children:[F.size," ",x("kB")]}),F.format&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,t.jsx)("span",{className:"image-size-format",children:F.format})]})]}):(0,t.jsx)(o.ui_kit$Text,{type:"secondary",className:"image-empty-text",children:l})]})}),(0,t.jsx)("div",{style:{flexGrow:1}}),F.format!=="gif"&&m.imageCenterEditorEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:x("Edit"),children:(0,t.jsx)(o.ui_kit$Text,{type:"link",className:"upload-bg-image__edit",children:(0,t.jsx)(r.EmIcons,{icon:"Edit",component:o.icons$Edit,size:16,strokeWidth:m.iconStrokeWidth,onClick:()=>{ve.isLocked&&Q?(ae(!0),te(r.FEATURE_UPSELL_SLIDE.image_editor)):X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_EDIT:r.MODALS.UPLOAD_BACKGROUND_MODAL_EDIT)}})})}),(0,t.jsx)(o.ui_kit$Dropdown,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:Z},classNames:{root:"upload-bg-image__menu"},children:(0,t.jsx)(o.ui_kit$Text,{type:"link",className:"upload-bg-image__edit-menu image-change",children:i?(0,t.jsx)(r.EmIcons,{size:16,strokeWidth:m.iconStrokeWidth,icon:"SyncOutlined",component:o.icons$SyncOutlined,onClick:()=>X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}):x("Upload")})},"Actions")]}):(0,t.jsx)(o.ui_kit$Button,{type:"default",block:!0,onClick:()=>X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD),icon:(0,t.jsx)(r.EmIcons,{icon:"Image",component:o.icons$Image,size:16,strokeWidth:m.iconStrokeWidth}),children:x("Add image")}),H&&(0,t.jsx)(r.PlanUpgradePrompt,{open:!0,onCancel:J,initialSlide:T})]})};fi.propTypes={};var zn=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),Gn=(e,i,s)=>i||(s?.type===r.ELEMENT_TYPES.CAROUSEL?["images",e]:Array.isArray(e)?e:[e]),Xr=e=>Array.isArray(e)?e.join("_"):e,Pt=({form:e,label:i,name:s,watchPath:l,disabled:a=!1,elementSettings:d,previewReloadSignal:c=void 0})=>{const{token:p}=(0,o.ui_kit$useToken)(),[g,b]=(0,n.useState)("success"),k=(0,n.useMemo)(()=>({marginBottom:p.formItemMarginBottomXS}),[p.formItemMarginBottomXS]),h=o.ui_kit$Form.useWatch(Gn(s,l,d),e);return(0,n.useEffect)(()=>{if(!h){b("");return}if(typeof h=="string"&&(h.startsWith("data:")||h.startsWith("blob:"))){b("success");return}if(zn(h)){b("validating");return}b("success")},[h]),(0,t.jsx)(o.ui_kit$Form.Item,{name:s,validateStatus:g,style:k,children:(0,t.jsx)(fi,{validateStatus:g,placeholder:i,name:Xr(s),disabled:a,elementSettings:d,imageInfo:d?.type===r.ELEMENT_TYPES.CAROUSEL?d?.carouselImages?.[Xr(s).split("_")[1]]:d,previewReloadSignal:c,onRemotePreviewValidate:b})})};Pt.propTypes={label:_.default.string.isRequired,name:_.default.oneOfType([_.default.string,_.default.arrayOf(_.default.oneOfType([_.default.string,_.default.number]))]).isRequired,watchPath:_.default.arrayOf(_.default.oneOfType([_.default.string,_.default.number])),tooltipTitle:_.default.string,disabled:_.default.bool,previewReloadSignal:_.default.shape({name:_.default.string,counter:_.default.number}),form:_.default.shape({getFieldValue:_.default.func.isRequired}).isRequired},Pt.defaulProps={disabled:!1,previewReloadSignal:null};var Rt=({form:e,oneBorderRadiusValue:i,setOneBorderRadiusValue:s,elementSettings:l,namePrefix:a="",typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),p=d==="mobile",g=p?"mobileBorderRadius":"borderRadius",b=p?"mobileBorderRadiusAll":"borderRadiusAll",k=p?"mobileBorderRadiusTopLeft":"borderRadiusTopLeft",h=p?"mobileBorderRadiusTopRight":"borderRadiusTopRight",m=p?"mobileBorderRadiusBottomRight":"borderRadiusBottomRight",S=p?"mobileBorderRadiusBottomLeft":"borderRadiusBottomLeft",x=p?W.MOBILE_BORDER_RADIUS_POSITION:W.BORDER_RADIUS_POSITION,f=()=>{const y=e.getFieldsValue(!0);let v;i?(e.setFieldsValue({[k]:y[b]||null,[S]:y[b]||null,[h]:y[b]||null,[m]:y[b]||null}),v={[g]:{[x[k]]:y[b]||0,[x[S]]:y[b]||0,[x[h]]:y[b]||0,[x[m]]:y[b]||0}}):y[k]===y[S]&&y[k]===y[h]&&y[k]===y[m]?(e.setFieldsValue({[b]:y[k]}),v={[g]:{[x[b]]:y[k]}}):(e.setFieldsValue({[k]:null,[S]:null,[h]:null,[m]:null}),v={[g]:{[x[b]]:0,[x[k]]:0,[x[S]]:0,[x[h]]:0,[x[m]]:0}});const N=p?{mobileBorderRadius:{all:y.mobileBorderRadiusAll||null,classNamePrefix:"em-mob-border_radius_all-"}}:{[`${a}${g}`]:{...l[`${a}${g}`],...v[`${a}${g}`]}};c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:N}),s(B=>!B)};return(0,t.jsx)(o.ui_kit$FormBorderRadiusInputs,{namePrefix:a,typeOfForm:d,oneBorderRadiusValue:i,onToggle:f,borderRadiusIcon:(0,t.jsx)(o.ui_kit$EmIcons,{icon:"BorderRadius",component:o.icons$BorderRadius,className:"selected-td-form__icon-radius"})})};Rt.displayName="SelectedElementFormBorderRadius";var Yn="em-mob-text_align-",Xn=({value:e,onChange:i,onSync:s,fieldName:l,...a})=>{const d=(typeof e=="object"?e?.value:e)??"",c=p=>{const g={classNamePrefix:Yn,value:p};i?.(g),s?.({[l]:g})};return(0,t.jsx)(o.ui_kit$FormAlignControl,{value:d,onChange:c,...a})},Dt=({form:e,elementSettings:i,imgParent:s=!1,name:l="align",tooltipTitle:a,typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),p=r.useAppConfig(),g=d==="mobile",b=g?"mobileAlign":l;if(g){const k=h=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:h})};return(0,t.jsx)(o.ui_kit$Form.Item,{name:b,children:(0,t.jsx)(Xn,{fieldName:b,onSync:k,disabled:s&&!i.parent,strokeWidth:p.iconStrokeWidth,tooltipTitle:a})})}return(0,t.jsx)(o.ui_kit$Form.Item,{name:b,children:(0,t.jsx)(o.ui_kit$FormAlignControl,{disabled:s&&!i.parent,strokeWidth:p.iconStrokeWidth,tooltipTitle:a})})},Ot=({form:e,elementSettings:i,tooltipTitle:s,disabled:l=!1,isNewIconType:a=!1,typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),p=r.useAppConfig(),g=d==="mobile",b=g?"mobileVerticalAlign":"valign",k=h=>{e.setFieldsValue({[b]:h}),g||c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[b]:h}})};return(0,t.jsx)(o.ui_kit$Form.Item,{name:b,children:(0,t.jsx)(o.ui_kit$FormVerticalAlignControl,{...!g&&{value:i.valign,onChange:k},disabled:l,isNewIconType:a,strokeWidth:p.iconStrokeWidth})})},Kn=["mobileBoxShadowHOffset","mobileBoxShadowVOffset","mobileBoxShadowBlurRadius","mobileBoxShadowSpreadRadius","mobileBoxShadowColor","mobileBoxShadowInset"],qn=({form:e,elementSettings:i,enableSwitch:s,usedColors:l,withoutShadowLabel:a})=>{const d=r.useSendPostMessage(),c=i.mobileBoxShadow,[p,g]=(0,n.useState)(!c||c.hOffset===0&&c.vOffset===0&&c.blurRadius===0&&c.spreadRadius===0),b=o.ui_kit$Form.useWatch(Kn,e);(0,n.useEffect)(()=>{if(!b)return;const[h,m,S,x,f,y]=b;(h===0||h===void 0||h===null)&&(m===0||m===void 0||m===null)&&(S===0||S===void 0||S===null)&&(x===0||x===void 0||x===null)&&(f===""||f===void 0||f===null)&&(y===!1||y===void 0)||g(!1)},[b]);const k=()=>{g(h=>!h),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,t.jsxs)(t.Fragment,{children:[s&&(0,t.jsx)("div",{style:{float:"right",marginTop:-9,marginRight:50},children:(0,t.jsx)(o.ui_kit$Switch,{id:"without-shadow",label:a,labelSize:"small",size:"small",checked:p,onChange:k})}),(0,t.jsx)("p",{style:{paddingBottom:"8px",margin:"-30px 0 0"},children:" "}),(0,t.jsx)(o.ui_kit$FormBoxShadowInputs,{typeOfForm:"mobile",usedColors:l})]})},wt=({typeOfForm:e="desktop",form:i,elementSettings:s,enableSwitch:l=!0})=>{const{__:a}=r.useI18n(),d=r.useSelector(r.selectEmailSettings).usedColors;return e==="mobile"&&i&&s?(0,t.jsx)(qn,{form:i,elementSettings:s,enableSwitch:l,usedColors:d,withoutShadowLabel:a("Without shadow")}):(0,t.jsx)(o.ui_kit$FormBoxShadowInputs,{typeOfForm:e,usedColors:d})};wt.displayName="SelectedElementFormBoxShadow";var jt=({form:e,elementSettings:i,directionControl:s})=>{const{__:l}=r.useI18n();return(0,t.jsx)(o.ui_kit$FormDisplayControl,{directionControl:s,className:"selected-element-form-show",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"show",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$Radio.Group,{children:(0,t.jsxs)(o.ui_kit$Space,{size:8,children:[(0,t.jsx)(o.ui_kit$Radio.Button,{value:"all",children:l("Both")}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:l("Desktop"),children:(0,t.jsx)(o.ui_kit$Radio.Button,{value:"desktop",children:(0,t.jsx)(r.EmIcons,{icon:"DesktopOutlined",component:o.icons$DesktopOutlined})})}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:l("Mobile"),children:(0,t.jsx)(o.ui_kit$Radio.Button,{value:"mobile",children:(0,t.jsx)(r.EmIcons,{icon:"MobileOutlined",component:o.icons$MobileOutlined})})})]})})})})},_i=({form:e,elementSettings:i,handleChangeValues:s})=>{const{__:l}=r.useI18n(),a=(0,n.useRef)(),{token:d}=(0,o.ui_kit$useToken)(),[c,p]=(0,n.useState)(!1),[g,b]=(0,n.useState)(!1),[k,h]=(0,n.useState)(!1),[m,S]=(0,n.useState)(!1),[x,f]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let P=new URL("https://emailmaker.ru/?"+i.countdown);p(P.searchParams.get("font1").endsWith("-b")||P.searchParams.get("font1").endsWith("-bi")),b(P.searchParams.get("font1").endsWith("-i")||P.searchParams.get("font1").endsWith("-bi")),h(P.searchParams.get("font2").endsWith("-b")||P.searchParams.get("font2").endsWith("-bi")),S(P.searchParams.get("font2").endsWith("-i")||P.searchParams.get("font2").endsWith("-bi")),f(P.searchParams.get("tp")==="true")},[i]);const y=[{value:"-12",label:l("-12:00 Apia")},{value:"-11",label:l("-11:00 Pago Pago, Midway Atoll")},{value:"-10",label:l("-10:00 Honolulu, Anchorage")},{value:"-9",label:l("-9:00 Anchorage, Yukon")},{value:"-8",label:l("-8:00 Los Angeles, Vancouver")},{value:"-7",label:l("-7:00 Denver, Phoenix")},{value:"-6",label:l("-6:00 Mexico City, Guadalajara")},{value:"-5",label:l("-5:00 New York, Toronto, Havana")},{value:"-4",label:l("-4:00 Caracas, Santo Domingo")},{value:"-3",label:l("-3:00 Buenos Aires, Santiago, Montevideo")},{value:"-2",label:l("-2:00 South Georgia, Saint Helena")},{value:"-1",label:l("-1:00 Azores, Cape Verde")},{value:"0",label:l("+0:00 London, Lisbon, Dublin")},{value:"1",label:l("+1:00 Paris, Berlin, Rome")},{value:"2",label:l("+2:00 Athens, Kiev, Istanbul")},{value:"3",label:l("+3:00 Istanbul, Doha, Baghdad")},{value:"4",label:l("+4:00 Baku, Dubai, Tbilisi")},{value:"5",label:l("+5:00 Karachi, Tashkent, Islamabad")},{value:"6",label:l("+6:00 Almaty, Dhaka, Bishkek")},{value:"7",label:l("+7:00 Bangkok, Ho Chi Minh City, Jakarta")},{value:"8",label:l("+8:00 Beijing, Hong Kong, Singapore")},{value:"9",label:l("+9:00 Tokyo, Seoul, Jayapura")},{value:"10",label:l("+10:00 Sydney, Melbourne, Port Moresby")},{value:"11",label:l("+11:00 Honiara, Nuku'alofa, Apia")}],v=[{value:"20",label:l("20 s")},{value:"40",label:l("40 s")},{value:"60",label:l("60 s")}],N=[{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"}],B=P=>P&&P<(0,At.default)().endOf("day")-864e5,C=P=>{f(P)},$=()=>{const P=!c;e.setFieldValue("countdownNumbersStrong",P),s({countdownNumbersStrong:P}),p(P)},U=()=>{const P=!g;e.setFieldValue("countdownNumbersItalic",P),s({countdownNumbersItalic:P}),b(P)},L=()=>{const P=!k;e.setFieldValue("countdownLabelsStrong",P),s({countdownLabelsStrong:P}),h(P)},F=()=>{const P=!m;e.setFieldValue("countdownLabelsItalic",P),s({countdownLabelsItalic:P}),S(P)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:l("End time"),name:"countdownTime",children:(0,t.jsx)(o.ui_kit$DatePicker,{ref:a,format:"DD.MM.YYYY HH:mm",disabledDate:B,showTime:!0,placement:"bottomRight",getPopupContainer:P=>{const H=P?.closest(".blocks-app");return H||(P?.ownerDocument?.body??document.body)},allowClear:!1,allowEmpty:!1})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:l("Time zone"),name:"countdownTimeZone",style:{width:"100%"},children:(0,t.jsx)(o.ui_kit$Select,{placeholder:l("Select the time zone"),getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),children:y.map(P=>(0,t.jsx)(o.ui_kit$Select.Option,{value:P.value,children:P.label},P.value))})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:20,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:l("Background color"),name:"countdownBackgroundColor",className:"countdown-color",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:l("Background color"),usedColors:i.usedColors})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownTransparency",valuePropName:"checked",style:{paddingTop:29},children:(0,t.jsx)(o.ui_kit$Switch,{id:"countdownTransparency",label:l("Transparency"),labelSize:"small",size:"small",onChange:C})})})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:l("Countdown font settings"),compact:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownNumbersFont",style:{marginBottom:d.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:N})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownNumbersColor",className:"countdown-color",style:{marginBottom:d.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{usedColors:i.usedColors})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownNumbersFontSize",children:(0,t.jsx)(o.ui_kit$InputNumber,{min:12,placeholder:l("Font size"),prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:l("Strong"),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownNumbersStrong",children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":c}),onClick:$,children:(0,t.jsx)(r.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-td-form__icon-radius"})})})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:l("Italic"),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownNumbersItalic",children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":g}),onClick:U,children:(0,t.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})})})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:l("Time units font settings"),compact:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownLabelsFont",style:{marginBottom:d.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:N})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownLabelsColor",className:"countdown-color",style:{marginBottom:d.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{usedColors:i.usedColors})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownLabelsFontSize",children:(0,t.jsx)(o.ui_kit$InputNumber,{min:8,placeholder:l("Font size"),addonAfter:"px",prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined})})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:l("Strong"),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownLabelsStrong",children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":k}),onClick:L,children:(0,t.jsx)(r.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-td-form__icon-radius"})})})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:l("Italic"),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"countdownLabelsItalic",children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":m}),onClick:F,children:(0,t.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})})})})})]})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:l("Language"),name:"countdownLanguage",style:{width:"100%"},children:(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:l("Duration"),name:"countdownDuration",style:{width:"100%"},children:(0,t.jsx)(o.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:v})})})]})]})};_i.propTypes={form:_.default.shape({setFieldsValue:_.default.func.isRequired}).isRequired,elementSettings:_.default.object.isRequired,tooltipTitle:_.default.string};var xi=({form:e,elementSettings:i})=>{const{__:s}=r.useI18n(),{token:l}=(0,o.ui_kit$useToken)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:s("URL of the video clip."),placement:"right",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:["video","source"],className:"selected-image-form__alt",children:(0,t.jsx)(o.ui_kit$Input,{allowClear:!0,placeholder:s("Video URL"),prefix:(0,t.jsx)(r.EmIcons,{icon:"VideoCameraOutlined",component:o.icons$VideoCameraOutlined})})})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:s("Play button"),name:["video","playButton"],style:{width:"100%",marginBottom:l.formItemMarginBottomMD+4},children:(0,t.jsxs)(o.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),children:[(0,t.jsxs)(o.ui_kit$Select.Option,{value:"youtube_red",children:[(0,t.jsx)(r.EmIcons,{icon:"YoutubeOutlined",component:o.icons$YoutubeOutlined,style:{color:"#FF0000"}})," ",s("Youtube Red")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"youtube_black",children:[(0,t.jsx)(r.EmIcons,{icon:"YoutubeOutlined",component:o.icons$YoutubeOutlined})," ",s("Youtube Black")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"youtube_white",children:[(0,t.jsx)(r.EmIcons,{icon:"YoutubeOutlined",component:o.icons$YoutubeOutlined,style:{color:"#aaa"}})," ",s("Youtube White")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"vimeo",children:[(0,t.jsx)(r.EmIcons,{icon:"Vimeo",component:o.icons$Vimeo})," ",s("Vimeo")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"white_circle",children:[(0,t.jsx)(r.EmIcons,{icon:"PlayCircleOutlined",component:o.icons$PlayCircleOutlined,style:{color:"#aaa"}})," ",s("White circle")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"black_circle",children:[(0,t.jsx)(r.EmIcons,{icon:"PlayCircleOutlined",component:o.icons$PlayCircleOutlined})," ",s("Black circle")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"white_circle_outlined",children:[(0,t.jsx)(r.EmIcons,{icon:"RightCircleOutlined",component:o.icons$RightCircleOutlined,style:{color:"#aaa"}})," ",s("White circle outlined")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"black_circle_outlined",children:[(0,t.jsx)(r.EmIcons,{icon:"RightCircleOutlined",component:o.icons$RightCircleOutlined})," ",s("Black circle outlined")]}),(0,t.jsxs)(o.ui_kit$Select.Option,{value:"none",children:[" ",s("Without button")]})]})})]})};xi.propTypes={form:_.default.shape({setFieldsValue:_.default.func.isRequired}).isRequired,elementSettings:_.default.object.isRequired,tooltipTitle:_.default.string};var Jn={marginBottom:10},vt=()=>{const{__:e}=r.useI18n();return(0,t.jsx)(o.ui_kit$Row,{gutter:20,style:Jn,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"ampShow",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$Radio.Group,{children:(0,t.jsxs)(o.ui_kit$Space,{size:8,children:[(0,t.jsx)(o.ui_kit$Radio.Button,{value:"all",children:e("Both")}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:e("AMP"),children:(0,t.jsx)(o.ui_kit$Radio.Button,{value:"amp",children:"AMP"})}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:e("HTML"),children:(0,t.jsx)(o.ui_kit$Radio.Button,{value:"html",children:"HTML"})})]})})})})})},{Option:ki}=o.ui_kit$Select,{mobileBorderRadiusAll:Qn,mobileBorderRadiusTopLeft:Ei,mobileBorderRadiusBottomLeft:Si,mobileBorderRadiusTopRight:Bi,mobileBorderRadiusBottomRight:Ri,borderRadiusBottomRight:Ti,borderRadiusTopRight:yi,borderRadiusBottomLeft:wi,borderRadiusTopLeft:ji,alt:Zn,src:ed,title:td,link:io,borderRadiusAll:Kr,imgReplacer:od,expanded:id}={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"},Xt=({linkProtocol:e})=>{switch(e){case"https://":return(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined});case"mailto:":return(0,t.jsx)(r.EmIcons,{icon:"MailOutlined",component:o.icons$MailOutlined});case"tel:":return(0,t.jsx)(r.EmIcons,{icon:"PhoneOutlined",component:o.icons$PhoneOutlined});case"sms:":return(0,t.jsx)(r.EmIcons,{icon:"CommentOutlined",component:o.icons$CommentOutlined});case"ftp://":return(0,t.jsx)(r.EmIcons,{icon:"FileOutlined",component:o.icons$FileOutlined});case"#":return(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined});default:return(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined})}},rd=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")}],Kt=({handleLinkProtocolsChange:e,linkProtocol:i,__:s})=>{const l=n.default.useMemo(()=>rd(s),[s]);return(0,t.jsx)(o.ui_kit$Select,{style:{width:90,textAlign:"left"},value:i,onChange:e,options:l,popupMatchSelectWidth:!1,listHeight:320})},qt=({show:e,__:i,style:s,className:l})=>{const a=n.default.useMemo(()=>({marginBottom:8,...s}),[s]);return e?(0,t.jsx)(o.ui_kit$Alert,{className:l,title:i("Anchor links do not work in Outlook, Gmail, and several other email clients."),type:"warning",showIcon:!0,style:a}):null},vi=e=>!(!e.startsWith("#")||e.indexOf("#",1)!==-1),sd=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*(["'])((?:\\.|(?!\1).)*?)\1(?:\s*\/?>)?\s*$/i,ld=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*([^\s/>]+)(?:\s*\/?>)?\s*$/i;function Jt(e){if(typeof e!="string")return e;let i=e.trim();if(!i)return i;const s=i.match(sd);if(s)i=s[2];else{const l=i.match(ld);l&&(i=l[1])}return i.startsWith("https://http")&&(i=i.substring(8)),i}var Oo=(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://":vi(e)?"#":"":i,Vt=(e,i)=>{const s=Oo(e,"");return i(s),s},qr=e=>{if(!e||!e.startsWith("mailto:"))return{subject:"",body:"",baseEmail:e||""};try{const i=new URL(e),s=e.split("?")[0];return{subject:i.searchParams.get("subject")||"",body:i.searchParams.get("body")||"",baseEmail:s}}catch{return{subject:"",body:"",baseEmail:e.split("?")[0]}}},Ii=(e,i,s)=>{if(!e||!e.startsWith("mailto:"))return e;const l=e.split("?")[0],a=[];return i&&a.push(`subject=${encodeURIComponent(i)}`),s&&a.push(`body=${encodeURIComponent(s)}`),a.length>0?`${l}?${a.join("&")}`:l},u=e=>e||(e===0?"0":""),bt=e=>e&&e!=="auto"?e:e===0?"0":"",Jr=(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 Ci(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 s={};e.carouselImages?.map((l,a)=>(Object.keys(l).forEach(d=>{s[d+"_"+a]=l[d]}),!0)),i.images=s}if(e.sections?.length>0){const s=[];e.sections?.map((l,a)=>(s.push({[`expanded_${a}`]:l.expanded}),!0)),i.sections=s}return i}function Qr(e,i,s){const l=s.hasOwnProperty("images"),a=s.hasOwnProperty("sections"),d=Object.keys(l?s.images:a?s.sections:s)[0],c=l?s.images:a?s.sections:s;let p={};const g=i.getFieldsValue(!0);switch(d.split("_")[0]){case td:case ed:case Zn:case od:if(l){const k=[...e.carouselImages];k[d.split("_")[1]][d.split("_")[0]]=c[d],p={carouselImages:k}}else p=c;break;case id:if(a){const k=[...e.sections];k[d.split("_")[1]][d.split("_")[0]]=c[d],p={sections:k}}break;case io:let b=Jt(c[d]);e.type===r.ELEMENT_TYPES.CAROUSEL?(p.carouselImages=e.carouselImages,l?(i.setFieldValue(["images",[io+"_"+d.split("_")[1]]],b),p.carouselImages[d.split("_")[1]].link=b,p.link="",i.setFieldValue(io,"")):(e.carouselImages.forEach((k,h)=>{i.setFieldValue(["images",io+"_"+h],b),p.carouselImages[h].link=b,p.link=b}),i.setFieldValue(io,b))):(i.setFieldValue(io,b),p.link=b);break;case Kr:p={borderRadius:{...e.borderRadius,[W.BORDER_RADIUS_POSITION[ji]]:g[ji],[W.BORDER_RADIUS_POSITION[wi]]:g[wi],[W.BORDER_RADIUS_POSITION[yi]]:g[yi],[W.BORDER_RADIUS_POSITION[Ti]]:g[Ti],[W.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case ji:case wi:case yi:case Ti:p={borderRadius:{...e.borderRadius,[W.BORDER_RADIUS_POSITION[Kr]]:null,[W.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case Qn:case Ei:case Si:case Bi:case Ri:p={mobileBorderRadius:{...e.mobileBorderRadius,[W.MOBILE_BORDER_RADIUS_POSITION[Ei]]:g[Ei],[W.MOBILE_BORDER_RADIUS_POSITION[Si]]:g[Si],[W.MOBILE_BORDER_RADIUS_POSITION[Bi]]:g[Bi],[W.MOBILE_BORDER_RADIUS_POSITION[Ri]]:g[Ri],[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 Nt=(0,t.jsxs)(o.ui_kit$Select,{className:"select-after",children:[(0,t.jsx)(ki,{value:"px",children:"px"}),(0,t.jsx)(ki,{value:"%",children:"%"})]}),ad=(0,t.jsx)(o.ui_kit$Select,{className:"select-after",children:(0,t.jsx)(ki,{value:"px",children:"px"})}),Zr=({form:e,elementSettings:i,boxShadow:s,bordersShow:l,borderRadiusShow:a,boxShadowShow:d,oneBorderRadiusValue:c,setOneBorderRadiusValue:p,hasLink:g,hasAlt:b,hasTitle:k,isOpenSrcReplacer:h,mergeTagItems:m,mergeMenuOpen:S,setMergeMenuOpen:x,cascaderRef:f,linkInputRef:y,linkButtonRef:v,altInputRef:N,altButtonRef:B,titleInputRef:C,titleButtonRef:$,srcReplacerInputRef:U,srcReplacerButtonRef:L,linkProtocol:F,handleLinkProtocolsChange:P,linkButtonHandler:H,linkInputHandler:ae,altButtonHandler:T,altInputHandler:te,titleButtonHandler:xe,titleInputHandler:be,srcReplacerButtonHandler:ye,srcInputHandler:me,handleSelect:he,onChange:ke,filter:ce,renderSearchOption:ze,handleChangeValues:Oe,toggleShowBorderHandler:ve,toggleShowBorderRadiusHandler:Ee,toggleShowBoxShadowHandler:pe})=>{const{__:Q}=r.useI18n(),{token:X}=(0,o.ui_kit$useToken)(),Z=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Dt,{form:e,elementSettings:i,imgParent:!0})}),Z.formImageFieldVerticalAlignEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,align:"right",children:(0,t.jsx)(Ot,{form:e,elementSettings:i})})]}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:i.type==="countdown"?15:24}}),i.type==="countdown"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(_i,{form:e,elementSettings:i,handleChangeValues:Oe}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),Z.mergeTagsShow&&m&&(0,t.jsx)(o.ui_kit$Col,{span:24,id:"merge_tags_wrapper",children:(0,t.jsxs)(o.ui_kit$Form.Item,{style:{marginBottom:24},children:[(0,t.jsx)(o.ui_kit$Button,{id:"merge_tags_button",icon:(0,t.jsx)(r.EmIcons,{icon:"MergeTags",component:o.icons$MergeTags}),style:{width:"100%",display:S?"none":"inline-flex"},onClick:()=>x(!0),children:Q("Merge tags")}),(0,t.jsx)(o.ui_kit$Cascader,{ref:f,classNames:{popup:{root:"merge-tags"}},options:m,placeholder:Q("Start typing the title"),showSearch:{filter:ce,render:ze},spellCheck:"false",getPopupContainer:J=>J.closest(".email-pane__collapse-wrapper"),onChange:ke,style:{display:S?"block":"none"},open:S,onKeyDown:J=>{J.key==="Escape"&&x(!1)}})]})}),i.type==="video"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(xi,{form:e,elementSettings:i}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),(i.type==="img"||i.type==="video")&&(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,t.jsx)(Pt,{form:e,label:Q("Image path"),name:"src",placeholder:Q("Image path"),elementSettings:i,tooltipTitle:""})}),(0,t.jsxs)(o.ui_kit$Space,{size:8,style:{marginBottom:!b&&!g&&!k&&!h?X.formItemMarginBottomMD+4:X.formItemMarginBottomXS},children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:b||Q("Alternative text"),placement:"bottom",getPopupContainer:J=>J.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!b}),onClick:T,ref:B,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),Z.formFieldImageTitleEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:k||Q("Tooltip text"),placement:"bottom",getPopupContainer:J=>J.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!k}),onClick:xe,ref:$,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:g||Q("Hyperlink URL"),placement:"bottom",getPopupContainer:J=>J.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!g}),icon:(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:H,ref:v})}),Z.formImageFieldReplacerEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:Q("Image replacer"),placement:"bottom",getPopupContainer:J=>J.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":h}),icon:(0,t.jsx)(r.EmIcons,{icon:"Replacer",component:o.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:ye,ref:L})})]}),(!!g||!!b||!!k||!!h)&&(0,t.jsxs)("div",{style:{marginBottom:X.formItemMarginBottomMD+4},children:[!!g&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(qt,{show:F==="#",__:Q,style:{marginBottom:X.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:Q("Hyperlink URL"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:X.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{addonBefore:(0,t.jsx)(Kt,{linkProtocol:F,handleLinkProtocolsChange:P,__:Q}),placeholder:Q("Hyperlink URL"),allowClear:!0,ref:y,onChange:ae,onSelect:he,prefix:(0,t.jsx)(Xt,{linkProtocol:F})})})})]}),!!b&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:Q("Alternative text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:X.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:Q("Alternative text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:te,ref:N,onSelect:he})})}),Z.formFieldImageTitleEnabled&&!!k&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:Q("Tooltip text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:X.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:Q("Enter the title of the image"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:be,ref:C,onSelect:he})})}),!!h&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:Q("Image src"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"imgReplacer",className:"selected-image-form__alt",style:{marginBottom:X.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:Q("Code that will replace the image `src`"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:Q("Image src")}),onChange:me,ref:U,onSelect:he})})})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:Q("Size"),dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormSizeInputs,{maxWidth:i.maxWidth,showHeight:Z.formImageFieldHeightEnabled,showMinMax:!1,gutter:X.marginSM,rowStyle:{marginBottom:Z.formImageFieldHeightEnabled?4:24},labels:{width:Q("Width"),height:Q("Height"),minWidth:Q("Minimum width"),maxWidth:Q("Maximum width")}})}),Z.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:Q("Borders"),collapsible:!0,open:l,onToggle:ve,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),Z.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:Q("Border radius"),collapsible:!0,open:a,onToggle:Ee,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:c,setOneBorderRadiusValue:p,elementSettings:i})}),Z.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:Q("Box shadow"),collapsible:!0,open:d,onToggle:pe,dividerTop:!0,children:(0,t.jsx)(wt,{})}),Z.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:Q("Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e})}),Z.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:Q("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};Zr.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,boxShadow:_.default.object,bordersShow:_.default.bool,borderRadiusShow:_.default.bool,boxShadowShow:_.default.bool,oneBorderRadiusValue:_.default.bool,setOneBorderRadiusValue:_.default.func,hasLink:_.default.string,hasAlt:_.default.string,hasTitle:_.default.string,isOpenSrcReplacer:_.default.oneOfType([_.default.bool,_.default.number]),mergeTagItems:_.default.array,mergeMenuOpen:_.default.bool,setMergeMenuOpen:_.default.func,cascaderRef:_.default.object,linkInputRef:_.default.object,linkButtonRef:_.default.object,altInputRef:_.default.object,altButtonRef:_.default.object,titleInputRef:_.default.object,titleButtonRef:_.default.object,srcReplacerInputRef:_.default.object,srcReplacerButtonRef:_.default.object,linkProtocol:_.default.string,handleLinkProtocolsChange:_.default.func,linkButtonHandler:_.default.func,linkInputHandler:_.default.func,altButtonHandler:_.default.func,altInputHandler:_.default.func,titleButtonHandler:_.default.func,titleInputHandler:_.default.func,srcReplacerButtonHandler:_.default.func,srcInputHandler:_.default.func,handleSelect:_.default.func,onChange:_.default.func,filter:_.default.func,renderSearchOption:_.default.func,handleChangeValues:_.default.func,toggleShowBorderHandler:_.default.func,toggleShowBorderRadiusHandler:_.default.func,toggleShowBoxShadowHandler:_.default.func};var Ht=({form:e,name:i,elementSettings:s,isPicture:l,tooltipTitle:a})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),p=(0,n.useRef)(),[g,b]=(0,n.useState)(s[i]?.value==="auto"),{token:k}=(0,o.ui_kit$useToken)(),[h,m]=(0,n.useState)(""),S=f=>{e.setFieldsValue({[i]:"",[i+"Dim"]:"px"}),b(y=>!y),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:{[i]:{classNamePrefix:"em-mob-width-",value:g?null:"auto",dim:""}}})},x=f=>{b(!1),m(e.getFieldsValue(!0)[i+"Dim"]==="%"?100:"")};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:a,placement:"bottom",children:(0,t.jsx)("div",{children:(0,t.jsx)(o.ui_kit$Form.Item,{name:i,style:{marginBottom:k.formItemMarginBottomXS/2},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{ref:p,min:0,max:h,placeholder:d("Width"),onChange:x,prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:(0,t.jsx)(o.ui_kit$Form.Item,{name:i+"Dim",noStyle:!0,children:Nt})})})})}),!l&&(0,t.jsx)(o.ui_kit$Switch,{id:"auto-width",label:d("Auto"),labelSize:"small",size:"small",checked:g,onChange:S})]})};Ht.propTypes={form:_.default.shape({setFieldsValue:_.default.func.isRequired}).isRequired,elementSettings:_.default.object.isRequired,tooltipTitle:_.default.string};var Qt=({form:e,name:i,elementSettings:s,isPicture:l,tooltipTitle:a})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),p=(0,n.useRef)(),[g,b]=(0,n.useState)(s.mobileHeight?.value==="auto"),{token:k}=(0,o.ui_kit$useToken)(),h=S=>{e.setFieldsValue({mobileHeight:"",mobileHeightDim:"px"}),b(x=>!x),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:{mobileHeight:{classNamePrefix:"em-mob-height-",value:g?null:"auto",dim:""}}})},m=S=>{b(!1)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:a,placement:"bottom",children:(0,t.jsx)("div",{children:(0,t.jsx)(o.ui_kit$Form.Item,{name:i,style:{marginBottom:k.formItemMarginBottomXS/2},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{ref:p,min:0,placeholder:d("Height"),onChange:m,prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:o.icons$ColumnHeightOutlined}),addonAfter:"px"})})})}),!l&&(0,t.jsx)(o.ui_kit$Switch,{id:"auto-height",label:d("Auto"),labelSize:"small",size:"small",checked:g,onChange:h})]})};Qt.propTypes={form:_.default.shape({setFieldsValue:_.default.func.isRequired}).isRequired,elementSettings:_.default.object.isRequired,tooltipTitle:_.default.string};var es=({form:e,elementSettings:i,handleChangeValues:s,boxShadow:l,mobileBordersShow:a,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:p,oneMobileBorderRadiusValue:g,setOneMobileBorderRadiusValue:b,hasLink:k,hasAlt:h,hasTitle:m,linkInputRef:S,linkButtonRef:x,altInputRef:f,altButtonRef:y,titleInputRef:v,titleButtonRef:N,linkInputHandler:B,altButtonHandler:C,altInputHandler:$,titleButtonHandler:U,titleInputHandler:L,linkButtonHandler:F,toggleShowMobileBorderHandler:P,toggleShowMobileBorderRadiusHandler:H,toggleShowMobileBoxShadowHandler:ae,toggleShowMobileSizeHandler:T})=>{const{__:te}=r.useI18n(),{token:xe}=(0,o.ui_kit$useToken)(),be=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:30,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Dt,{form:e,elementSettings:i,imgParent:!0,typeOfForm:"mobile"})}),be.formImageFieldVerticalAlignEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,align:"right",children:(0,t.jsx)(Ot,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:i.type==="countdown"?15:24}}),i.type==="countdown"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(_i,{form:e,elementSettings:i,handleChangeValues:s}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),i.type==="video"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(xi,{form:e,elementSettings:i}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),(i.type==="img"||i.type==="video")&&(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,t.jsx)(Pt,{form:e,label:te("Image path"),name:"src",placeholder:te("Image path"),elementSettings:i,tooltipTitle:""})}),(0,t.jsxs)(o.ui_kit$Space,{size:8,style:{marginBottom:!h&&!k&&!m?xe.formItemMarginBottomMD+4:xe.formItemMarginBottomXS},children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:h||te("Alternative text"),placement:"bottom",getPopupContainer:ye=>ye.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!h}),onClick:C,ref:y,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),be.formFieldImageTitleEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:m||te("Tooltip text"),placement:"bottom",getPopupContainer:ye=>ye.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!m}),onClick:U,ref:N,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:k||te("Hyperlink URL"),placement:"bottom",getPopupContainer:ye=>ye.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!k}),icon:(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:F,ref:x})})]}),(!!k||!!h||!!m)&&(0,t.jsxs)("div",{style:{marginBottom:xe.formItemMarginBottomMD+4},children:[!!k&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:te("Hyperlink URL"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:xe.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{ref:S,allowClear:!0,placeholder:te("Hyperlink URL"),prefix:(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined}),onChange:B})})}),!!h&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:te("Alternative text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:xe.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:te("Alternative text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:$,ref:f})})}),be.formFieldImageTitleEnabled&&!!m&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:te("Tooltip text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:xe.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:te("Tooltip text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:L,ref:v})})})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:te("Size"),collapsible:!0,open:p,onToggle:T,dividerTop:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:24},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Ht,{form:e,name:"mobileWidth",elementSettings:i,isPicture:"true",tooltipTitle:te("Width")})}),be.formImageFieldHeightEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Qt,{form:e,name:"mobileHeight",elementSettings:i,isPicture:"true",tooltipTitle:te("Height")})})]})}),be.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:te("Borders"),collapsible:!0,open:a,onToggle:P,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),be.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:te("Border radius"),collapsible:!0,open:d,onToggle:H,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:g,setOneBorderRadiusValue:b,elementSettings:i,typeOfForm:"mobile"})}),be.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:te("Box shadow"),collapsible:!0,open:c,onToggle:ae,dividerTop:!0,children:(0,t.jsx)(wt,{typeOfForm:"mobile"})}),be.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:te("Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e})}),be.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:te("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};es.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,handleChangeValues:_.default.func,boxShadow:_.default.object,mobileBordersShow:_.default.bool,mobileBorderRadiusShow:_.default.bool,mobileBoxShadowShow:_.default.bool,mobileSizeShow:_.default.bool,oneMobileBorderRadiusValue:_.default.bool,setOneMobileBorderRadiusValue:_.default.func,hasLink:_.default.string,hasAlt:_.default.string,hasTitle:_.default.string,linkInputRef:_.default.object,linkButtonRef:_.default.object,altInputRef:_.default.object,altButtonRef:_.default.object,titleInputRef:_.default.object,titleButtonRef:_.default.object,linkInputHandler:_.default.func,altButtonHandler:_.default.func,altInputHandler:_.default.func,titleButtonHandler:_.default.func,titleInputHandler:_.default.func,linkButtonHandler:_.default.func,toggleShowMobileBorderHandler:_.default.func,toggleShowMobileBorderRadiusHandler:_.default.func,toggleShowMobileBoxShadowHandler:_.default.func,toggleShowMobileSizeHandler:_.default.func};var nd=e=>typeof e=="object"&&e!==null?e.path:void 0;function Lt(){const e=(0,n.useRef)(!1),i=(0,n.useRef)(null),s=(0,n.useCallback)(a=>{e.current=!a},[]),l=(0,n.useCallback)((a,d)=>{const c=JSON.stringify(nd(a)??null);return i.current!==c&&(i.current=c,e.current=!1),d?e.current:(e.current=!1,!1)},[]);return(0,n.useMemo)(()=>({markBorderToggled:s,isStaleBorderSnapshot:l}),[s,l])}function ro(e){const i=(0,n.useRef)(null),s=(0,n.useRef)(e);return s.current=e,{remember:(0,n.useCallback)(l=>{i.current=l},[]),fillFields:(0,n.useCallback)((l,a)=>{s.current!==i.current&&l.setFieldsValue(a)},[])}}var ts=2e3;function os(e,{ordered:i=!1}={}){const s=(0,n.useRef)([]),l=(0,n.useRef)(new WeakMap),a=(0,n.useRef)(e);return a.current=e,{remember:(0,n.useCallback)(d=>{const c=Date.now(),p=s.current.filter(g=>c-g.at<ts);p.push({key:JSON.stringify(a.current(d)),at:c}),s.current=p.slice(-10),i&&d&&typeof d=="object"&&l.current.set(d,!1)},[i]),isOwnEcho:(0,n.useCallback)(d=>{if(!d)return!1;const c=Date.now(),p=JSON.stringify(a.current(d)),g=s.current.filter(h=>c-h.at<ts);if(!i)return g.some(h=>h.key===p);const b=l.current.get(d);if(b!==void 0)return b;const k=g.findIndex(h=>h.key===p);return k>=0&&(s.current=g.slice(k)),l.current.set(d,k>=0),k>=0},[i]),forget:(0,n.useCallback)(()=>{s.current=[],l.current=new WeakMap},[])}}var dd=1e3,cd=2e4,is="https://useblocks.io/app/",ud=["activateSection","changeKey","parent","path","nextElem","prevElem"];function Pi(e){if(Array.isArray(e))return e.map(Pi);if(e&&typeof e=="object"){const i=e;return Object.fromEntries(Object.keys(i).sort().map(s=>[s,Pi(i[s])]))}return e}function md(e){const i={...e};return ud.forEach(s=>delete i[s]),Pi(i)}var rs=({elementSettings:e})=>{const{__:i}=r.useI18n(),[s]=o.ui_kit$Form.useForm(),l=Lt(),a=Lt();let d=r.useDispatch();const c=r.useAppConfig(),p=r.useEditorProjectId(),g=r.useNotification(),b=r.useSendPostMessage(),k=r.useSendPostMessageEx(),{openImagePicker:h}=r.useImagePicker(),m=r.useSelector(r.selectEmailViewType),S=r.useSelector(r.selectMobileViewActive),x=r.useCurrentUser(),f=r.useSelector(r.selectIsCodeMode),y=r.useSelector(r.selectCodeModeDirection),[v]=r.useUploadImageMutation(),[N,B]=r.useSendShortLinkMutation(),[C,$]=(0,n.useState)({name:"",counter:0}),U=(0,n.useRef)(null),L=(0,n.useRef)(null),F=(0,n.useRef)(null),P=(0,n.useRef)(null),H=(0,n.useRef)(null),ae=(0,n.useRef)(null),T=(0,n.useRef)(null),te=(0,n.useRef)(null),xe=(0,n.useRef)(null),[be,ye]=(0,n.useState)({}),[me,he]=(0,n.useState)(!0),[ke,ce]=(0,n.useState)(!0),[ze,Oe]=(0,n.useState)(""),[ve,Ee]=(0,n.useState)(""),[pe,Q]=(0,n.useState)(""),[X,Z]=(0,n.useState)(!1),[J,V]=(0,n.useState)(!1),[M,Y]=(0,n.useState)(!1),[K,ee]=(0,n.useState)(!1),[le,Re]=(0,n.useState)(!1),[Be,$e]=(0,n.useState)(!1),[z,re]=(0,n.useState)(!1),[Pe,G]=(0,n.useState)(!1),[Se,Fe]=(0,n.useState)("https://"),Ae=(0,n.useRef)(!1),Ve=(0,n.useRef)(),Ue=e,Xe=(0,n.useRef)(Ue);Xe.current=Ue;const ne=(0,n.useCallback)(()=>s.getFieldsValue(!0).video,[s]),[Te,I]=(0,n.useState)(),[se,je]=(0,n.useState)(!1),[Ne,He]=(0,n.useState)(null),[Ke,tt]=(0,n.useState)({start:0,end:0}),[O,ie]=(0,n.useState)(!1),[j,w]=(0,n.useState)(!1),[ue,Ie]=(0,n.useState)(!1),[qe,Ze]=(0,n.useState)(!1),dt=(0,n.useRef)(void 0),st=(0,n.useRef)(null),ct=(0,n.useRef)(null),kt=qe||ue||Pe;(0,n.useEffect)(()=>()=>clearTimeout(dt.current),[]);const St=(0,n.useRef)(null);(0,n.useEffect)(()=>{const A=St.current,Le=A?.firstElementChild??null;if(!kt||!A||!Le)return;const ge=[];for(let et=A.parentElement;et;et=et.parentElement)getComputedStyle(et).overflowY!=="visible"&&ge.push(et);let fe=0,De="";const Je=()=>{const et=A.getBoundingClientRect(),gt=A.offsetHeight>0?et.height/A.offsetHeight:1;let ft=Math.max(et.top,0),rt=Math.min(et.bottom,window.innerHeight);ge.forEach(Yt=>{const po=Yt.getBoundingClientRect();ft=Math.max(ft,po.top),rt=Math.min(rt,po.bottom)});const ut=(ft-et.top)/(gt||1),Bt=Math.max(rt-ft,0)/(gt||1),yt=`${Math.round(ut)}/${Math.round(Bt)}`;yt!==De&&(De=yt,Le.style.top=`${ut}px`,Le.style.height=`${Bt}px`),fe=requestAnimationFrame(Je)};return Je(),()=>cancelAnimationFrame(fe)},[kt]);const D=()=>{const A=st.current;ct.current=A?.isConnected&&typeof A.selectionStart=="number"?{element:A,start:A.selectionStart,end:A.selectionEnd??A.selectionStart}:null},q=f&&y!=="bottom",we=r.useElementEntityKind();(0,n.useEffect)(()=>{se&&xe.current&&xe.current.focus()},[se]);const Ge=(A,Le)=>{const ge=document.getElementById(Le);if(ge){const fe=Le.substring(Le.indexOf("selected_image_form_")+20),De=ge.value?.substring(0,Ke.start),Je=ge.value?.substring(Ke.end);b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{...e,[fe]:De+A+Je}}),s.setFieldValue(fe,De+A+Je),ge.focus(),setTimeout(()=>{ge.selectionStart=Ke.start,ge.selectionEnd=Ke.start+A.length},400),ie(!0)}},_e=r.useAppConfig().mergeTags;(0,n.useEffect)(()=>{_e?.items?.length&&I(r.mapMargeTags(_e.items))},[_e,I]);const R=(A,Le)=>{if(je(!1),A){const ge=_e.syntax.length>1?Te.findIndex(De=>De.key===Le[0].key):0,fe=_e.syntax[ge].replace("%value%",A[A.length-1]);Ne?.getAttribute("id")==="selected_image_form_title"||Ne?.getAttribute("id")==="selected_image_form_alt"||Ne?.getAttribute("id")==="selected_image_form_link"||Ne?.getAttribute("id")==="selected_image_form_imgReplacer"?Ge(fe,Ne?.getAttribute("id")):(s.setFieldValue("imgReplacer",fe),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:fe}}))}},oe=(A,Le)=>Le.some(ge=>ge.label.toLowerCase().indexOf(A.toLowerCase())>-1),E=(A,Le)=>{const ge=Le.map((fe,De)=>{const Je=fe.label.split(new RegExp(`(${A})`,"gi"));return(0,t.jsxs)("span",{children:[De!==0&&(0,t.jsx)("span",{children:" / "}),Je.map((et,gt)=>et.toLowerCase()===A.toLowerCase()?(0,t.jsx)("span",{style:{color:"red"},children:et},gt):et)]},fe.value)});return(0,t.jsx)("div",{title:Le.map(fe=>fe.label).join(" / "),children:ge})},de=r.useRootElement();(0,n.useEffect)(()=>{const A=({target:fe})=>{fe.closest('[id="merge_tags_wrapper"]')||(st.current=fe,He(fe))},Le=({target:fe})=>{!fe.closest(".merge-tags")&&!fe.closest("#merge_tags_button")&&je(!1)},ge=new ht.Disposable;return ge.addDisposable(r.addWindowListenerFromShadow(de,"focusin",A)),ge.addDisposable(r.addWindowListenerFromShadow(de,"click",Le)),()=>{ge.dispose()}},[de]);const Ce=({target:A})=>{if(A&&!O){const{selectionStart:Le,selectionEnd:ge}=A;tt({start:Le,end:ge})}ie(!1)},Qe=e.border,Me=e.mobileBorder,Et=Object.keys(Qe).find(A=>Qe[A]?.width||Qe[A]?.style||Qe[A]?.color),Mt=Object.keys(Me).find(A=>Me[A]?.width||Me[A]?.style||Me[A]?.color),pt=A=>A&&(A?.width||A?.style||A?.color)?A:"",{remember:En,fillFields:Sn}=ro(e),{remember:Bn,isOwnEcho:Rn,forget:Tn}=os(md,{ordered:!0}),yn=(0,n.useRef)(void 0);(0,n.useEffect)(()=>{if(e){const A=e.path;A!==yn.current&&(yn.current=A,Tn());const Le=Rn(e)?()=>{}:Sn;e.src!==Ve.current&&(Ve.current=e.src,Ae.current=!1);const ge=e.boxShadow;if(ye(ge),e.link&&Fe(Oo(e.link,"https://")),Le(s,{...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:pt(e.mobileBorder.all)||!(pt(e.mobileBorder.top)||pt(e.mobileBorder.bottom)||pt(e.mobileBorder.right)||pt(e.mobileBorder.left))&&pt(e.border.all),mobileBorderTop:pt(e.mobileBorder.top)||!pt(e.mobileBorder.all)&&pt(e.border.top),mobileBorderBottom:pt(e.mobileBorder.bottom)||!pt(e.mobileBorder.all)&&pt(e.border.bottom),mobileBorderRight:pt(e.mobileBorder.right)||!pt(e.mobileBorder.all)&&pt(e.border.right),mobileBorderLeft:pt(e.mobileBorder.left)||!pt(e.mobileBorder.all)&&pt(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:bt(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:bt(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:bt(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:bt(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",...Ue.video}}),e.countdown){let Je=new URL("https://emailmaker.ru/?"+e.countdown),et=Je.searchParams.get("font1"),gt=!1,ft=!1;et.endsWith("-b")?(et=et.substring(0,et.length-2),gt=!0):et.endsWith("-i")?(et=et.substring(0,et.length-2),ft=!0):et.endsWith("-bi")&&(et=et.substring(0,et.length-3),gt=!0,ft=!0);let rt=Je.searchParams.get("font2"),ut=!1,Bt=!1;rt.endsWith("-b")?(rt=rt.substring(0,rt.length-2),ut=!0):rt.endsWith("-i")?(rt=rt.substring(0,rt.length-2),Bt=!0):rt.endsWith("-bi")&&(rt=rt.substring(0,rt.length-3),ut=!0,Bt=!0),Le(s,{countdownTime:(0,At.default)(new Date(Date.parse(Je.searchParams.get("time"))+Je.searchParams.get("timezone")*36e5+new Date().getTimezoneOffset()/60*36e5).toISOString()),countdownDuration:Je.searchParams.get("frames")||20,countdownTimeZone:Je.searchParams.get("timezone"),countdownLanguage:Je.searchParams.get("locale").replace("-","_"),countdownBackgroundColor:"#"+Je.searchParams.get("bg"),countdownTransparency:Je.searchParams.get("tp")==="true"?"checked":"",countdownNumbersFont:et,countdownNumbersFontSize:Je.searchParams.get("size1")/2,countdownNumbersFontSizeDim:"px",countdownNumbersColor:"#"+Je.searchParams.get("color1"),countdownLabelsFont:rt,countdownLabelsFontSize:Je.searchParams.get("size2")/2,countdownLabelsFontSizeDim:"px",countdownLabelsColor:"#"+Je.searchParams.get("color2"),countdownNumbersStrong:gt,countdownNumbersItalic:ft,countdownLabelsStrong:ut,countdownLabelsItalic:Bt})}!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?he(!1):he(!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))?ce(!1):ce(!0);const fe=l.isStaleBorderSnapshot(e,!!Et),De=a.isStaleBorderSnapshot(e,!!Mt);fe&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(De||fe&&!Mt)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),Z(Je=>Et&&!fe?!0:Je),V(Je=>Et&&!fe||Mt&&!De?!0:Je),Y(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),ee(!!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),Re(!!e.boxShadow),$e(!!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),e.link?Oe(e.link):Oe(Ae.current?"...":""),Ee(e.alt),Q(e.title),w(e.imgReplacer?.length)}},[s,e,Sn,Rn,Tn,Ue,Et,Mt,l,a]),(0,n.useEffect)(()=>{if(kt)return;const A=ct.current;ct.current=null,!(!A||!A.element.isConnected||A.element.disabled)&&st.current===A.element&&(A.element.focus(),A.element.setSelectionRange(A.start,A.end))},[kt]);const $r=async(A,Le,ge)=>{const fe={};fe.user_id=x.id,fe.folder=A,Le&&(Le=await r.prepareImageForEditorUpload(Le,c),fe.file=Le),ge&&(fe.page_url=ge);const De=await v(fe);if(De.error)g.fromError("IMAGE_UPLOAD_ERROR",Le,De.error,!0);else{const Je=On.extractUploadResult(De.data);if(Je.error)return;if(Je.file_url)return Je.file_url}},wn=(A,Le)=>new Promise((ge,fe)=>{const De=new Image,Je=new Image;De.crossOrigin="Anonymous",Je.crossOrigin="Anonymous";let et=Le?2:1;const gt=()=>{clearTimeout(rt),fe(new Error("video preview images are not loaded"))},ft=()=>{et-=1,et===0&&(clearTimeout(rt),ge({frame:De,button:Le?Je:null}))},rt=setTimeout(gt,cd);De.onload=ft,De.onerror=gt,De.src=A,Le&&(Je.onload=ft,Je.onerror=gt,Je.src=Le)}),jn=(A,Le,ge,fe)=>{const De=document.createElement("canvas"),Je=De.getContext("2d");if(De.width=A.width,De.height=A.height,Je.clearRect(0,0,De.width,De.height),Je.drawImage(A,0,0,A.width,A.height),!Le)return De;const et=Math.min(De.width,De.height);let gt;if(A.height>A.width)gt=.3;else{const po=A.width/A.height;gt=Math.min(fe,.3+(po-1)/(ge-1)*.1)}const ft=et*gt,rt=Le.width/Le.height;let ut,Bt;rt>=1?(ut=ft,Bt=ft/rt):(Bt=ft,ut=ft*rt);const yt=(De.width-ut)/2,Yt=(De.height-Bt)/2;return Je.drawImage(Le,yt,Yt,ut,Bt),De},vn=A=>new Promise(Le=>{A.toBlob(ge=>Le(ge?new File([ge],"image.jpeg",{type:"image/jpeg"}):null),"image/jpg",1)}),ch=async A=>{const Le=s.getFieldsValue(!0).video?.playButton||e.video?.playButton;if(!(!A||!Le||Le==="none"||ue)){D(),Ie(!0);try{const{frame:ge,button:fe}=await wn(A,`${is}${Le}.png`),De=await vn(jn(ge,fe,2,.4)),Je=De&&await $r(p,De);if(!Je)return;b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Xe.current.type,settings:{src:Je}}),Io({...Xe.current,src:Je,video:ne()||Xe.current.video,activateSection:null,changeKey:"src"}),setTimeout(()=>{s.setFieldValue("src",Je)},100)}catch{}finally{Ie(!1)}}},uh=async()=>{const A=ne(),Le=A?.source,ge=A?.playButton;if(!Le)return;const fe=()=>ne()?.source!==Le;D(),Ze(!0);try{const De=await $r("tmp",null,Le);if(!De||fe())return;const{frame:Je,button:et}=await wn(De,ge&&ge!=="none"?`${is}${ge}.png`:null);if(fe())return;const gt=await vn(jn(Je,et,2.5,.35)),ft=gt&&await $r(p,gt);ft&&!fe()&&Mr(ft)}catch{}finally{Ze(!1)}},Fr=A=>{clearTimeout(dt.current),dt.current=setTimeout(()=>{A()},dd)},mh=()=>{const A=s.getFieldsValue(!0);let Le=new URL("https://cdt3.emcdn.ru/rndt?"+e.countdown),ge=A.countdownNumbersFont;A.countdownNumbersStrong&&A.countdownNumbersItalic?ge+="-bi":A.countdownNumbersStrong?ge+="-b":A.countdownNumbersItalic&&(ge+="-i");let fe=A.countdownLabelsFont;A.countdownLabelsStrong&&A.countdownLabelsItalic?fe+="-bi":A.countdownLabelsStrong?fe+="-b":A.countdownLabelsItalic&&(fe+="-i"),Le.searchParams.set("time",new Date(A.countdownTime.$d-A.countdownTimeZone*36e5-new Date().getTimezoneOffset()/60*36e5).toISOString()),Le.searchParams.set("bg",A.countdownBackgroundColor.substring(1)||"#FFFFFF"),Le.searchParams.set("tp",!!A.countdownTransparency),Le.searchParams.set("font1",ge),Le.searchParams.set("size1",A.countdownNumbersFontSize*2||12),Le.searchParams.set("color1",A.countdownNumbersColor.substring(1)||"#000000"),Le.searchParams.set("font2",fe),Le.searchParams.set("size2",A.countdownLabelsFontSize*2||8),Le.searchParams.set("color2",A.countdownLabelsColor.substring(1)||"#959595"),Le.searchParams.set("spacing",Math.round(A.countdownNumbersFontSize*.4)||5),Le.searchParams.set("locale",A.countdownLanguage.replace("_","-")),Le.searchParams.set("timezone",A.countdownTimeZone),Le.searchParams.set("frames",A.countdownDuration),N({link:JSON.stringify({target:Le.href})}),D(),G(!0)},Io=(0,n.useCallback)(A=>{En(A),Bn(A),d(we==="email"?r.setElementSettings$1(A):r.setElementSettings(A))},[d,we,En,Bn]),Mr=(0,n.useCallback)((A,Le)=>{const ge=Xe.current,fe=r.stripEmVersionFromUrlString(ge.src||"")===r.stripEmVersionFromUrlString(A||"");(!fe||A!==ge.src)&&(b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:ge.type,settings:{src:A}}),Io({...ge,src:A,...ge.type==="video"?{video:ne()||ge.video}:{},activateSection:null,changeKey:"src"}),s.setFieldValue("src",A)),Le?.mode==="save"&&fe&&($(De=>({name:"src",counter:De.counter+1})),k(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(A)}))},[s,ne,Io,b,k]),Co=(0,n.useCallback)(async A=>{const Le=e.src||"",ge=r.stripEmVersionFromUrlString(Le),fe=await h({kind:"img",currentUrl:bo(ge)?"":ge,entryModal:A});fe?.url&&Mr(fe.url,fe.meta)},[Mr,e.src,h]),Dr=(A,...Le)=>{const ge=s.getFieldsValue(!0),fe=Object.keys(A)[0];let De;switch(fe){case"link":let Je=Jt(A[fe]);Je!==A[fe]&&s.setFieldValue("link",Je),De={link:Je};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":De={boxShadow:{hOffset:ge.boxShadowHOffset,vOffset:ge.boxShadowVOffset,blurRadius:ge.boxShadowBlurRadius,spreadRadius:ge.boxShadowSpreadRadius,color:ge.boxShadowColor,inset:ge.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":ge.borderPosition==="borderAll"?(De={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...ge.borderAll}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):ge.borderAll?.width||ge.borderAll?.style||ge.borderAll?.color?(De={border:{all:null,left:ge.borderAll,right:ge.borderAll,top:ge.borderAll,bottom:ge.borderAll,[W.REVERSE_BORDER_POSITIONS[fe]]:{...ge[fe],...A[fe]}}},s.setFieldsValue({borderAll:null,borderLeft:ge.borderAll,borderRight:ge.borderAll,borderTop:ge.borderAll,borderBottom:ge.borderAll,[fe]:{...ge[fe],...A[fe]}})):(De={border:{all:null,left:ge.borderLeft,right:ge.borderRight,top:ge.borderTop,bottom:ge.borderBottom,[W.REVERSE_BORDER_POSITIONS[fe]]:{...ge[fe],...A[fe]}}},s.setFieldsValue({border:De.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(ge.mobileBorderPosition==="mobileBorderAll")De={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...ge.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[fe]+"-"}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const rt=W.MOBILE_REVERSE_BORDER_POSITIONS[fe],ut={...ge[fe],...A[fe]},Bt=!ut?.width&&!ut?.style&&!ut?.color;if(ge.mobileBorder?.all?.width||ge.mobileBorder?.all?.style||ge.mobileBorder?.all?.color){const yt=ge.mobileBorderAll;De={mobileBorder:{all:null,left:yt,right:yt,top:yt,bottom:yt,[rt]:Bt?null:{...ut,classNamePrefix:"em-mob-border_"+rt+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:yt,mobileBorderRight:yt,mobileBorderTop:yt,mobileBorderBottom:yt,[fe]:ut})}else{const yt=e.mobileBorder||{},Yt=po=>{const Po=yt[po];return Po&&(Po?.width||Po?.style||Po?.color)?Po:null};De={mobileBorder:{all:null,left:rt==="left"?Bt?null:{...ut,classNamePrefix:"em-mob-border_left-"}:Yt("left"),right:rt==="right"?Bt?null:{...ut,classNamePrefix:"em-mob-border_right-"}:Yt("right"),top:rt==="top"?Bt?null:{...ut,classNamePrefix:"em-mob-border_top-"}:Yt("top"),bottom:rt==="bottom"?Bt?null:{...ut,classNamePrefix:"em-mob-border_bottom-"}:Yt("bottom")}},s.setFieldsValue({[fe]:ut})}}break;case"width":De={[fe]:{value:A[fe],dim:ge.widthDim}};break;case"widthDim":De={width:{value:ge.width,dim:A[fe]}};break;case"height":De={[fe]:{value:A[fe],dim:ge.heightDim}};break;case"heightDim":De={height:{value:ge.height,dim:A[fe]}};break;case"borderRadiusAll":De={borderRadius:{[W.BORDER_RADIUS_POSITION[fe]]:+A[fe]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":De={borderRadius:{topLeft:ge.borderRadiusTopLeft,bottomLeft:ge.borderRadiusBottomLeft,topRight:ge.borderRadiusTopRight,bottomRight:ge.borderRadiusBottomRight,[W.BORDER_RADIUS_POSITION[fe]]:+A[fe]}};break;case"mobileWidth":De={[fe]:{classNamePrefix:"em-mob-width-",value:A[fe],dim:ge.mobileWidthDim}};break;case"mobileWidthDim":De={mobileWidth:{classNamePrefix:"em-mob-width-",value:ge.mobileWidth||100,dim:A[fe]}};break;case"mobileHeight":De={[fe]:{classNamePrefix:"em-mob-height-",value:A[fe],dim:ge.mobileHeightDim}};break;case"mobileHeightDim":De={mobileHeight:{classNamePrefix:"em-mob-height-",value:ge.mobileHeight,dim:A[fe]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":De={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[fe]]:A[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":De={mobileBoxShadow:{hOffset:ge.mobileBoxShadowHOffset,vOffset:ge.mobileBoxShadowVOffset,blurRadius:ge.mobileBoxShadowBlurRadius,spreadRadius:ge.mobileBoxShadowSpreadRadius,color:ge.mobileBoxShadowColor,inset:ge.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":De={[fe]:{classNamePrefix:"em-mob-text_align-",value:A[fe]}};break;case"mobileVerticalAlign":De={[fe]:{classNamePrefix:"em-mob-vertical_align-",value:A[fe]}};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":Fr(mh);break;case"video":{const rt={...e.video,...ge.video,...A.video},ut=rt.source??ge.link;Fr(uh),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"video",settings:{video:rt,link:ut}}),Io({...e,video:rt,link:ut,activateSection:null,changeKey:"video"});break}case"src":const et=A[fe],gt=e.src,ft=ge.video?.playButton||e.video?.playButton;if(e.type==="video"&&ft&&ft!=="none"&&!ue&&et&&(!gt||et!==gt)){Fr(()=>ch(et));return}De=A;break;default:De=A}fe!=="borderPosition"&&fe!=="mobileBorderPosition"&&fe.indexOf("countdown")===-1&&fe!=="video"&&(b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:De}),fe!=="video"&&fe.indexOf("countdown")===-1&&fe!=="mobileBorderRadiusAll"&&fe!=="mobileBorderRadiusTopLeft"&&fe!=="mobileBorderRadiusTopRight"&&fe!=="mobileBorderRadiusBottomLeft"&&fe!=="mobileBorderRadiusBottomRight"&&Io({...e,...De,mobileBorderRadius:{...e.mobileBorderRadius,...De?.mobileBorderRadius},activateSection:null,changeKey:fe}))};(0,n.useEffect)(()=>{B.isError&&(g.error(B),G(!1))},[B]),(0,n.useEffect)(()=>{if(B.isSuccess&&Pe){if(B.data.data?.status===400)g.error({title:B.data.code,description:B.data.message});else{let A=new URL(B.data.target),Le={countdown:{link:B.data.link,params:A.search.substring(1)}};b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Le})}G(!1)}},[B,Pe,e,g,b]);const ph=A=>{A.data.operation===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(d(r.closeSecondModal()),d(r.closeModal$1()))};r.useListenPostMessage(ph),r.useImageControlRequest(e.src,A=>{A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?Co(r.MODALS.UPLOAD_IMAGE_MODAL_AI):A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?Co(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?Co(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?Co(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP&&Co(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK)});const hh=()=>{const A=s.getFieldsValue(!0);l.markBorderToggled(!X),setTimeout(()=>{Z(Le=>!Le),X?(A.borderAll=W.NULL_BORDER,A.borderTop=W.NULL_BORDER,A.borderBottom=W.NULL_BORDER,A.borderRight=W.NULL_BORDER,A.borderLeft=W.NULL_BORDER):A.borderAll={width:1,color:"#E5E5E5",style:"solid"},b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:A.borderAll.color,style:A.borderAll.style,width:A.borderAll.width}}}})})},bh=()=>{const A=s.getFieldsValue(!0);a.markBorderToggled(!J),setTimeout(()=>{V(Le=>!Le),J?(A.mobileBorderAll=W.NULL_BORDER,A.mobileBorderTop=W.NULL_BORDER,A.mobileBorderBottom=W.NULL_BORDER,A.mobileBorderRight=W.NULL_BORDER,A.mobileBorderLeft=W.NULL_BORDER):A.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:A.mobileBorderAll.color,style:A.mobileBorderAll.style,width:A.mobileBorderAll.width}}}})})},gh=()=>{const A=s.getFieldsValue(!0);setTimeout(()=>{Y(Le=>!Le),M?(A.borderRadiusAll=0,he(!0)):A.borderRadiusAll=5,b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:A.borderRadiusAll}}})})},fh=()=>{const A=s.getFieldsValue(!0);setTimeout(()=>{ee(Le=>!Le),K?(A.mobileBorderRadiusAll=null,ce(!0)):A.mobileBorderRadiusAll=5,b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:A.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},_h=()=>{const A=s.getFieldsValue(!0);setTimeout(()=>{Re(Le=>!Le),le?(A.boxShadowInset=!1,A.boxShadowHOffset=null,A.boxShadowVOffset=null,A.boxShadowBlurRadius=null,A.boxShadowSpreadRadius=null,A.boxShadowColor=""):(A.boxShadowInset=!1,A.boxShadowHOffset=5,A.boxShadowVOffset=5,A.boxShadowBlurRadius=10,A.boxShadowSpreadRadius=-5,A.boxShadowColor="#000000"),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:A.boxShadowBlurRadius,color:A.boxShadowColor,hOffset:A.boxShadowHOffset,inset:A.boxShadowInset,spreadRadius:A.boxShadowSpreadRadius,vOffset:A.boxShadowVOffset}}})})},xh=()=>{const A=s.getFieldsValue(!0);setTimeout(()=>{$e(Le=>!Le),Be?(A.mobileBoxShadowInset=!1,A.mobileBoxShadowHOffset=null,A.mobileBoxShadowVOffset=null,A.mobileBoxShadowBlurRadius=null,A.mobileBoxShadowSpreadRadius=null,A.mobileBoxShadowColor=""):(A.mobileBoxShadowInset=!1,A.mobileBoxShadowHOffset=5,A.mobileBoxShadowVOffset=5,A.mobileBoxShadowBlurRadius=10,A.mobileBoxShadowSpreadRadius=-5,A.mobileBoxShadowColor="#000000"),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:A.mobileBoxShadowBlurRadius,color:A.mobileBoxShadowColor,hOffset:A.mobileBoxShadowHOffset,inset:A.mobileBoxShadowInset,spreadRadius:A.mobileBoxShadowSpreadRadius,vOffset:A.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},kh=()=>{const A=s.getFieldsValue(!0);setTimeout(()=>{re(Le=>!Le),z&&(A.mobileWidth="",A.mobileHeight="",b({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-"}}}))})},In=()=>{ze?(Ae.current=!1,Oe(""),s.setFieldValue("link",""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{link:""}})):(Ae.current=!0,Oe(U.current&&U.current.input.value?U.current.input.value:"..."),setTimeout(()=>{U.current.focus()}))},Cn=A=>{A.target.value===""?Oe("..."):(L.current.classList.add("selected-td-form__button--active"),Oe(A.target.value)),Vt(A.target.value,Fe)},Pn=()=>{const A=s.getFieldsValue(!0);ve?(Ee(""),A.alt="",b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{alt:""}})):(Ee(F.current&&F.current.input.value?F.current.input.value:"..."),setTimeout(()=>{F.current.focus()}))},An=A=>{A.target.value===""?Ee("..."):(P.current.classList.add("selected-td-form__button--active"),Ee(A.target.value))},Nn=()=>{const A=s.getFieldsValue(!0);pe?(Q(""),A.title="",b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{title:""}})):(Q(H.current&&H.current.input.value?H.current.input.value:"..."),setTimeout(()=>{H.current.focus()}))},Eh=()=>{w(!j),j?(s.setFieldValue("imgReplacer",""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:""}})):setTimeout(()=>T.current.focus())},Sh=A=>{A.target.value!==""&&te.current.classList.add("selected-td-form__button--active")},Ln=A=>{A.target.value===""?Q("..."):(ae.current.classList.add("selected-td-form__button--active"),Q(A.target.value))},Bh=A=>{s.setFieldValue("link",A!=="mergetag"?A:""),Fe(A)};return(0,t.jsxs)(o.ui_kit$Form,{form:s,layout:"vertical",name:"selected_image_form",initialValues:{src:"",width:"",height:"",widthDim:"",heightDim:"",alt:"",align:"left",border:"",boxShadow:"",show:"all",borderPosition:W.BORDER_POSITIONS[Et]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[Mt]||"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:Dr,autoComplete:"off",disabled:kt,className:kt?"element-controls selected-image-form_busy":"element-controls",children:[kt&&(0,t.jsx)("div",{className:"selected-image-form__loader",ref:St,children:(0,t.jsxs)("div",{className:"selected-image-form__loader-body",children:[(0,t.jsx)(o.ui_kit$Spin,{size:"large"}),(0,t.jsx)("div",{className:"selected-image-form__loader-title",children:Ue.type==="countdown"?i("Preparing countdown preview…"):i("Preparing video preview…")})]})}),!q&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),m==="mobile"&&S.styles?(0,t.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,t.jsx)(es,{form:s,elementSettings:e,handleChangeValues:Dr,boxShadow:be,mobileBordersShow:J,mobileBorderRadiusShow:K,mobileBoxShadowShow:Be,mobileSizeShow:z,oneMobileBorderRadiusValue:ke,setOneMobileBorderRadiusValue:ce,hasLink:ze,hasAlt:ve,hasTitle:pe,linkInputRef:U,linkButtonRef:L,altInputRef:F,altButtonRef:P,titleInputRef:H,titleButtonRef:ae,linkInputHandler:Cn,altButtonHandler:Pn,altInputHandler:An,titleButtonHandler:Nn,titleInputHandler:Ln,linkButtonHandler:In,toggleShowMobileBorderHandler:bh,toggleShowMobileBorderRadiusHandler:fh,toggleShowMobileBoxShadowHandler:xh,toggleShowMobileSizeHandler:kh})," "]}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(Zr,{form:s,elementSettings:e,boxShadow:be,bordersShow:X,borderRadiusShow:M,boxShadowShow:le,oneBorderRadiusValue:me,setOneBorderRadiusValue:he,hasLink:ze,hasAlt:ve,hasTitle:pe,isOpenSrcReplacer:j,mergeTagItems:Te,mergeMenuOpen:se,setMergeMenuOpen:je,cascaderRef:xe,linkInputRef:U,linkButtonRef:L,altInputRef:F,altButtonRef:P,titleInputRef:H,titleButtonRef:ae,srcReplacerInputRef:T,srcReplacerButtonRef:te,linkProtocol:Se,handleLinkProtocolsChange:Bh,linkButtonHandler:In,linkInputHandler:Cn,altButtonHandler:Pn,altInputHandler:An,titleButtonHandler:Nn,titleInputHandler:Ln,srcReplacerButtonHandler:Eh,srcInputHandler:Sh,handleSelect:Ce,onChange:R,filter:oe,renderSearchOption:E,handleChangeValues:Dr,toggleShowBorderHandler:hh,toggleShowBorderRadiusHandler:gh,toggleShowBoxShadowHandler:_h})})]})};rs.propTypes={elementSettings:_.default.object.isRequired};var ss=()=>{const{__:e}=r.useI18n();return(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:e("The font-size CSS property sets the size of the font."),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileFontSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:e("Font size"),prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})},Zt=({form:e,elementSettings:i,imgParent:s=!1,name:l="align",setAlignStateHandle:a=()=>{},withHotKeys:d=!0})=>{const{__:c}=r.useI18n(),p=r.useSendPostMessage(),g=r.useAppConfig(),[b,k]=(0,n.useState)(null);(0,n.useEffect)(()=>{globalThis?.navigator?.userAgent.includes("Macintosh")&&k(!0)},[]);const h=v=>{a(v),e.setFieldsValue({[l]:v}),p({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[l]:v}})},m=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,S=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,x=d?b?m:S:void 0,f=i[l],y=typeof f=="string"?f:"";return(0,t.jsx)(o.ui_kit$Form.Item,{name:l,children:(0,t.jsx)(o.ui_kit$FormAlignTextControl,{value:y,onChange:h,disabled:s&&!i.parent,strokeWidth:g?.iconStrokeWidth,labels:x})})},it=({form:e,elementSettings:i,name:s,icon:l,tooltipTitle:a=null,showTooltip:d=!0,forceInactive:c=!1})=>{const{__:p}=r.useI18n(),g=e.getFieldValue(s),b=r.useSendPostMessage(),[k,h]=(0,n.useState)(i[s]);(0,n.useEffect)(()=>{i[s]!==e.getFieldValue(s)&&(e.setFieldValue(s,i[s]),h(i[s]))},[i,e,s]),(0,n.useEffect)(()=>{k!==g&&h(g)},[g,k,s]);const m=()=>{const S={[s]:!k};e.setFieldValue(s,!k),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:S}),s==="textSuperscript"?e.setFieldValue("textSubscript",!1):s==="textSubscript"&&e.setFieldValue("textSuperscript",!1),h(x=>!x)};return(0,t.jsx)(o.ui_kit$Form.Item,{name:s,children:d?(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:a||p(s.substring(4)),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":k&&!c}),onClick:m,children:l})}):(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":k&&!c}),onClick:m,children:l})})};it.propTypes={form:_.default.shape({setFieldsValue:_.default.func.isRequired}).isRequired,elementSettings:_.default.object.isRequired,tooltipTitle:_.default.string,imgParent:_.default.bool};var pd=["email","block"];function hd(e){const i=r.getMessageService(e).getTarget(),s=r.getCanvasService(e);pd.map(l=>s?.peek(l)?.element).find(l=>!!i&&l?.contentWindow===i)?.focus({preventScroll:!0})}var ls=()=>{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")}]},bd=(e,i="#c6c3c3",s={},l)=>{const{symbolSize:a="25px",marginRight:d="5px",marginBottom:c="5px",textStyle:p={whiteSpace:"normal",lineHeight:"1.2"}}=s;return e.map(g=>({value:g.code,label:(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,t.jsx)("span",{style:{color:i||"#c6c3c3",marginRight:d,marginBottom:c,fontSize:a,lineHeight:"0.7",width:a,textAlign:"center",...p},children:g.symbol}),(0,t.jsx)("span",{style:p,children:g.description})]})}))},go=({form:e,fillFields:i,elementSettings:s,showAddParagraph:l=!0,isButton:a=!1,linkProtocol:d,setLinkProtocol:c,linkTarget:p,isBulletFontColorChecked:g=!1,setIsBulletFontColorChecked:b=()=>{},showTopDivider:k=!0})=>{const{__:h}=r.useI18n(),m=W.useGoogleFontsLoader(),{token:S}=(0,o.ui_kit$useToken)(),x=r.useNotification(),f=r.useSendPostMessage(),y=r.useContainer(),v=r.useAppConfig(),N=(0,n.useRef)(),B=(0,n.useRef)(null),C=(0,n.useRef)(null),$=(0,n.useRef)(null),U=(0,n.useRef)(!1),L=s,[F,P]=(0,n.useState)(!!L.textReplacer?.length),[H,ae]=(0,n.useState)(!!L.textAnchor?.length),[T,te]=(0,n.useState)(null),[xe,be]=(0,n.useState)({start:0,end:0}),[ye,me]=(0,n.useState)(!1),[he,ke]=(0,n.useState)([]),[ce,ze]=(0,n.useState)(L.list?.bulletsColor),[Oe,ve]=(0,n.useState)(s);s!==Oe&&(ve(s),ze(L.list?.bulletsColor),P(!!L.textReplacer?.length),ae(!!L.textAnchor?.length));const[Ee,pe]=(0,n.useState)(!1),[Q,X]=(0,n.useState)(!1),Z=(0,n.useRef)(null),J=(0,n.useRef)(""),V=ls(),M=(0,n.useMemo)(()=>V,[]),Y={textColor:o.ui_kit$Form.useWatch("textColor",e),textLink:o.ui_kit$Form.useWatch("textLink",e),linkHref:o.ui_kit$Form.useWatch("linkHref",e),listUL:o.ui_kit$Form.useWatch("listUL",e),listOL:o.ui_kit$Form.useWatch("listOL",e)};(0,n.useEffect)(()=>{a&&s?.textColor!==void 0&&e.setFieldValue("textColor",s.textColor)},[a,s?.textColor,e]);let K=null;(0,n.useEffect)(()=>{if(Y?.textColor&&g){const w=e.getFieldValue("textColor");f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:{ColorBullets:w}})}},[Y?.textColor]),(0,n.useEffect)(()=>{const w=e.getFieldValue("textLink");typeof s.linkHref=="string"&&pe(!0),Z&&!w&&(pe(!1),e.setFieldsValue({linkHref:null})),Z.current=w||null},[Y?.textLink,Y?.linkHref,s.linkHref,e]),(0,n.useEffect)(()=>{const w=e.getFieldValue("listUL"),ue=e.getFieldValue("listOL");w&&J.current!=="listUL"?(e.setFieldValue("listOL",!1),J.current="listUL"):ue&&J.current!=="listOL"&&(e.setFieldValue("listUL",!1),J.current="listOL"),!w&&!ue&&(J.current="")},[Y?.listUL,Y?.listOL,e]);const ee=w=>{w.data.operation===r.EVENT_TYPES.APPLICATION_FOCUS_IN_IFRAME&&te(null)};r.useListenPostMessage(ee);const[le,Re]=(0,n.useState)(null);(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&Re(!0)},[]);const Be=(0,n.useRef)(null);function $e(w){const ue=w.key.toLowerCase();let Ie=!1;return((K==="control"||K==="meta")&&(ue==="a"||ue==="A")||(K==="a"||K==="A")&&(ue==="control"||ue==="meta"))&&(Ie=!0),K=ue,ue!=="control"&&ue!=="a"&&ue!=="A"&&ue!=="meta"&&(K=null),Ie}const z=w=>{f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:w,locale:"ru_RU"}),x.success({title:h("It`s done!")})},re=[{key:"1",label:h("This element"),onClick:()=>z("typograf")},{key:"2",label:h("The whole email"),onClick:()=>z("typograf_all")}],[Pe,G]=(0,n.useState)(),[Se,Fe]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const w=bd(M,ce,{});ke(w)},[M,ce]),(0,n.useEffect)(()=>{const w=s.linkHref||s.href;w&&Vt(w,c);const ue=s.linkHref||s.href,Ie=ue&&vi(ue)?ue.slice(1):ue||"https://";(i??((qe,Ze)=>qe.setFieldsValue(Ze)))(e,{linkHref:Ie})},[e,s,c,i]);const Ae=r.useAppConfig().mergeTags;(0,n.useEffect)(()=>{Ae?.items?.length&&G(r.mapMargeTags(Ae.items))},[Ae,G]);const Ve=w=>{e.setFieldValue("linkHref",w!=="mergetag"?w:""),c(w)},Ue=(w,ue)=>{if(Fe(!1),w){const Ie=Ae.syntax.length>1?Pe.findIndex(Ze=>Ze.key===ue[0].key):0,qe=Ae.syntax[Ie].replace("%value%",w[w.length-1]);if(T?.getAttribute("id")==="selected_button_form_href"||T?.getAttribute("id")==="selected_text_form_linkHref"||T?.getAttribute("id")==="selected_text_form_textReplacer")je(qe,T?.getAttribute("id"));else{e.setFieldValue("textReplacer",qe);const Ze=Date.now();f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:{textReplacer:`${qe}~~${Ze}`}}),y&&setTimeout(()=>hd(y))}}},Xe=(w,ue)=>ue.some(Ie=>Ie.label.toLowerCase().indexOf(w.toLowerCase())>-1),ne=(w,ue)=>{const Ie=ue.map((qe,Ze)=>{const dt=qe.label.split(new RegExp(`(${w})`,"gi"));return(0,t.jsxs)("span",{children:[Ze!==0&&(0,t.jsx)("span",{children:" / "}),dt.map((st,ct)=>st.toLowerCase()===w.toLowerCase()?(0,t.jsx)("span",{style:{color:"red"},children:st},ct):st)]},qe.value)});return(0,t.jsx)("div",{title:ue.map(qe=>qe.label).join(" / "),children:Ie})};(0,n.useEffect)(()=>{Se&&Be.current&&Be.current.focus()},[Se]);const Te=r.useRootElement();(0,n.useEffect)(()=>{const w=({target:qe})=>{qe.closest('[id="merge_tags_wrapper"]')||te(qe)},ue=({target:qe})=>{!qe.closest(".merge-tags")&&!qe.closest("#merge_tags_button")&&Fe(!1)},Ie=new ht.Disposable;return Ie.addDisposable(r.addWindowListenerFromShadow(Te,"focusin",w)),Ie.addDisposable(r.addWindowListenerFromShadow(Te,"click",ue)),()=>{Ie.dispose()}},[Te]);const I=(0,n.useCallback)(()=>{const w=window.getSelection();w&&w.toString().length>0&&(U.current=!0)},[]),se=(0,n.useCallback)(({target:w})=>{if(w&&!ye){const{selectionStart:ue,selectionEnd:Ie}=w;be(qe=>qe?.start===ue&&qe?.end===Ie?qe:{start:ue,end:Ie})}me(!1)},[ye]);(0,n.useEffect)(()=>se({target:p?.target}),[p,se]);const je=(w,ue)=>{const Ie=document.getElementById(ue);if(Ie){const qe=Ie.value?.substring(0,xe.start),Ze=Ie.value?.substring(xe.end),dt=ue.substring(ue.lastIndexOf("_")+1);f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:{[dt]:qe+w+Ze}}),e.setFieldValue(dt,qe+w+Ze),Ie.focus(),setTimeout(()=>{Ie.selectionStart=xe.start,Ie.selectionEnd=xe.start+w.length},400),me(!0)}},Ne=()=>{P(!F),F?(e.setFieldValue("textReplacer",""),f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:{textReplacer:""}})):setTimeout(()=>B.current.focus())},He=w=>{w.target.value!==""&&C.current?.classList.add("selected-td-form__button--active")},Ke=(w="unknown")=>{ae(!H),H?(e.setFieldValue("textAnchor",""),f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:{textAnchor:""}})):setTimeout(()=>$.current?.focus())},tt=w=>{const ue=w.target,Ie=ue.value,qe=ue.selectionStart,Ze=$e(w);if(U.current&&qe===0&&f({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:{textReplacer:`${Ie}~`}}),U.current=Ze,qe===0&&w.key===" "){w.preventDefault();return}if(w.key===" "){if(qe!==Ie.length){w.preventDefault();return}Ie.endsWith(" ")&&w.preventDefault()}},O=w=>{ze(w),g&&b(!1)},ie=a?v.formButtonFieldInsertImageEnabled:v.formTextFieldTypografEnabled,j=v.formTextFieldTypografEnabled&&!a;return(0,t.jsxs)(t.Fragment,{children:[l&&!s.showOnMobile&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Row,{gutter:20,style:{paddingBottom:4},children:(0,t.jsx)(o.ui_kit$Col,{span:12,gutter:20,children:(0,t.jsx)(Zt,{form:e,elementSettings:s,name:"textAlign"})})})}),ie||j||v.mergeTagsShow&&Pe?(0,t.jsx)(o.ui_kit$FormSection,{title:null,dividerTop:k,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginTop:4},children:[ie&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Col,{span:j?12:24,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"AddImage",style:{marginBottom:S.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(r.EmIcons,{icon:"AddImage",component:o.icons$AddImage}),onClick:()=>z("add_img"),style:{width:"100%"},children:h("Add image")})})})}),j&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"Typography",style:{marginBottom:S.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,menu:{items:re},trigger:["hover"],placement:"bottom",getPopupContainer:w=>w.closest(".selected-element-panel"),children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(r.EmIcons,{icon:"Typograf",component:o.icons$Typograf}),onClick:()=>z("typograf"),style:{width:"100%"},children:h("Typography")})})})})}),v.mergeTagsShow&&Pe&&(0,t.jsxs)(o.ui_kit$Col,{span:24,id:"merge_tags_wrapper",style:{marginBottom:S.formItemMarginBottomXS},children:[(0,t.jsx)(o.ui_kit$Button,{id:"merge_tags_button",icon:(0,t.jsx)(r.EmIcons,{icon:"MergeTags",component:o.icons$MergeTags}),style:{width:"100%",display:Se?"none":"inline-flex"},onClick:()=>Fe(!0),children:h("Merge tags")}),(0,t.jsx)(o.ui_kit$Cascader,{ref:Be,classNames:{popup:{root:"merge-tags"}},options:Pe,placeholder:h("Start typing the title"),showSearch:{filter:Xe,render:ne},spellCheck:"false",getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper"),onChange:Ue,style:{display:Se?"block":"none",width:"100%"},open:Se,onKeyDown:w=>{w.key==="Escape"&&Fe(!1)}})]})]})}):null,(0,t.jsxs)(o.ui_kit$FormSection,{title:null,dividerTop:k||ie||j,bodyStyle:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:h("Text font"),placement:"bottom",zIndex:1,getPopupContainer:w=>w.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:m,getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper")})})}),!s.showOnMobile&&(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:h("Font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontSize",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:h("Font size"),prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:h("Line height"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"lineHeight",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:h("Line height"),prefix:(0,t.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,t.jsx)(o.ui_kit$Row,{gutter:10,style:{marginBottom:10,marginTop:5},children:(0,t.jsxs)(o.ui_kit$Col,{span:24,children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:-10},children:[a&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsxs)("div",{className:"selected-text-common-form__format-toolbar",children:[(0,t.jsx)(it,{form:e,elementSettings:s,name:"textStrong",tooltipTitle:h(le?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(r.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})}),(0,t.jsx)(it,{form:e,elementSettings:s,name:"textItalic",tooltipTitle:h(le?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})}),(0,t.jsx)(it,{form:e,elementSettings:s,name:"textUnderline",tooltipTitle:h(le?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})}),(0,t.jsx)(it,{form:e,elementSettings:s,name:"textStrikethrough",tooltipTitle:h(le?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:h("Text color"),placement:"bottom",zIndex:1,getPopupContainer:w=>w.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",rules:[{message:h("Please set the font color")}],className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:h("Color"),usedColors:s.usedColors})})})})]}),!a&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:s,name:"textStrong",tooltipTitle:h(le?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(r.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:s,name:"textItalic",tooltipTitle:h(le?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:s,name:"textUnderline",tooltipTitle:h(le?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})}),s?.list?.isList&&(0,t.jsxs)(o.ui_kit$Col,{span:3,children:[" ",(0,t.jsx)(it,{form:e,elementSettings:s,name:"textStrikethrough",tooltipTitle:h(le?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]}),!s?.list?.isList&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:s,name:"listUL",tooltipTitle:h("Unordered list"),icon:(0,t.jsx)(r.EmIcons,{icon:"UnorderedListOutlined",component:o.icons$UnorderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:se})}),!s?.list?.isList&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:s,name:"listOL",tooltipTitle:h("Ordered list"),icon:(0,t.jsx)(r.EmIcons,{icon:"OrderedListOutlined",component:o.icons$OrderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:se})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:s,name:"textSuperscript",tooltipTitle:h("Text superscript"),icon:(0,t.jsx)(r.EmIcons,{icon:"Superscript",component:o.icons$Superscript})})}),s?.list?.isList&&(0,t.jsxs)(o.ui_kit$Col,{span:3,children:[" ",(0,t.jsx)(it,{form:e,elementSettings:s,name:"textSubscript",tooltipTitle:h("Text subscript"),icon:(0,t.jsx)(r.EmIcons,{icon:"Subscript",component:o.icons$Subscript})})]}),l&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,className:(0,We.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",forceInactive:!!s.textAnchor,tooltipTitle:h("Link"),icon:(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"}),onSelect:se})}),s?.list?.isList&&v.formTextFieldReplacerEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:h("Text replacer"),placement:"bottom",getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":F}),icon:(0,t.jsx)(r.EmIcons,{icon:"Replacer",component:o.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:Ne,ref:C})})}),(!s?.list?.isList||l&&s?.list?.isList)&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:h("More options"),placement:"bottom",getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":Q||H}),icon:(0,t.jsx)(r.EmIcons,{icon:"DotsHoriz",component:o.icons$DotsHoriz,className:"selected-td-form__icon-radius"}),onClick:()=>X(!Q)})})})]})]}),!a&&Q&&(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[!s?.list?.isList&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Col,{span:3,children:[" ",(0,t.jsx)(it,{form:e,elementSettings:s,name:"textStrikethrough",tooltipTitle:h(le?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]}),(0,t.jsxs)(o.ui_kit$Col,{span:3,children:[" ",(0,t.jsx)(it,{form:e,elementSettings:s,name:"textSubscript",tooltipTitle:h("Text subscript"),icon:(0,t.jsx)(r.EmIcons,{icon:"Subscript",component:o.icons$Subscript})})]}),v.formTextFieldReplacerEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:h("Text replacer"),placement:"bottom",getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":F}),icon:(0,t.jsx)(r.EmIcons,{icon:"Replacer",component:o.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:Ne,ref:C})})})]}),l&&(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:h("Anchor"),placement:"bottom",getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":H}),icon:(0,t.jsx)(r.EmIcons,{icon:"Anchor",component:o.icons$Anchor,className:"selected-text-common-form__icon-radius"}),onMouseDown:w=>{w.preventDefault(),Ke("mouseDown")}})})})]}),l&&typeof s.linkHref=="string"&&Ee&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(qt,{show:d==="#",__:h,style:{marginBottom:S.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:h(d==="#"?"Anchor name":"The URL that the hyperlink directs to."),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"linkHref",style:{marginBottom:d==="mailto:"?S.formItemMarginBottomXS:""},children:(0,t.jsx)(o.ui_kit$Input,{ref:N,addonBefore:(0,t.jsx)(Kt,{linkProtocol:d,handleLinkProtocolsChange:Ve,__:h}),allowClear:!0,placeholder:h(d==="#"?"Anchor name":"Hyperlink URL"),autoFocus:s?.isNewLink,onSelect:se,prefix:(0,t.jsx)(Xt,{linkProtocol:d})})})}),d==="mailto:"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:"subject",style:{marginBottom:S.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:h("Subject"),onSelect:se})}),(0,t.jsx)(o.ui_kit$Form.Item,{name:"body",style:{marginBottom:S.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$TextArea,{rows:3,placeholder:h("Body"),onSelect:se})})]})]}),l&&H&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:h("Anchor name"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textAnchor",children:(0,t.jsx)(o.ui_kit$Input,{placeholder:h("Anchor name"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content addon-text-content--icon",title:h("Anchor"),"aria-hidden":!0,children:(0,t.jsx)(r.EmIcons,{icon:"Anchor",component:o.icons$Anchor,className:"selected-text-common-form__icon-radius",size:18})}),ref:$,onSelect:se,onBlur:()=>{e.getFieldValue("textAnchor")?.trim()||ae(!1)}})})}),!a&&F&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:h("Text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textReplacer",children:(0,t.jsx)(o.ui_kit$Input,{placeholder:h("The code that will replace this text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:h("Text")}),onChange:He,onKeyDown:tt,onDoubleClick:I,ref:B,onSelect:se})})})]})}),!a&&(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:h("Text color"),placement:"bottom",zIndex:1,getPopupContainer:w=>w.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",rules:[{message:h("Please set the font color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:h("Color"),usedColors:s.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:h("Text background"),placement:"bottom",zIndex:1,getPopupContainer:w=>w.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:h("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:h("Background color"),usedColors:s.usedColors})})})})]})]}),!a&&s?.list?.isList&&(0,t.jsxs)(o.ui_kit$FormSection,{title:h("List settings"),dividerTop:!0,children:[s?.list?.listType==="OL"&&(0,t.jsx)(o.ui_kit$Row,{children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:h("Bullets font"),placement:"bottom",zIndex:1,getPopupContainer:w=>w.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"BulletsFontFamily",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:m,getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper"),style:{marginTop:"-9px"}})})})})}),(0,t.jsx)(o.ui_kit$Row,{gutter:[10],children:s?.list?.listType==="UL"&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:h("Bullets type"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"BulletType",className:"bullet-type",children:(0,t.jsx)(o.ui_kit$Select,{size:"medium",placeholder:h("Bullets type"),onClick:w=>w.stopPropagation(),options:he})})})})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:[10],children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:h("Bullets color"),placement:"bottom",zIndex:1,getPopupContainer:w=>w.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"ColorBullets",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:h("Bullets color"),usedColors:s.usedColors,disabled:g,onChange:O,externalValue:g?Y?.textColor:void 0})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:h("Bullets size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"BulletsSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,defaultValue:s?.list?.bulletFontSize,placeholder:h("Bullets size"),prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})})]}),s?.list?.listType==="OL"&&(0,t.jsxs)(o.ui_kit$Row,{children:[(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:s,name:"BulletTextStrong",tooltipTitle:h(le?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(r.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:s,name:"BulletTextItalic",tooltipTitle:h(le?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:s,name:"BulletTextStrikethrough",tooltipTitle:h(le?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:s,name:"BulletTextUnderline",tooltipTitle:h(le?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:[10],style:{marginTop:"-8px"},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:h("Between list items"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"SpacingBetweenParagraphs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:5,max:100,placeholder:h("Between list items"),prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:o.icons$ColumnHeightOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:h("Between bullets and text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"SpacingBetweenBulletsAndText",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:1,max:100,placeholder:h("Between bullets and text"),prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:"px"})})})})]})]})]})},Ai=({form:e,elementSettings:i,showAddParagraph:s=!0,isButton:l=!1})=>{const{__:a}=r.useI18n(),d=W.useGoogleFontsLoader(),c=r.useSendPostMessage(),p=r.useDispatch(),g=r.useElementEntityKind(),b=r.useAppConfig(),[k,h]=(0,n.useState)(null);(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&h(!0)},[]);const m=N=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:N,locale:"ru_RU"})},[S,x]=(0,n.useState)(i.textAlign),[f,y]=(0,n.useState)(i.linkHref),v=N=>x(N);return(0,n.useEffect)(()=>{x(i.textAlign),y(i.linkHref)},[i]),(0,t.jsx)("div",{className:"selected_text_common_form_mobile",children:(0,t.jsxs)(o.ui_kit$Space,{size:"8",separator:(0,t.jsx)(o.ui_kit$Divider,{orientation:"vertical"}),children:[(0,t.jsxs)(o.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,t.jsx)("div",{style:{width:190},children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:a("Text font"),placement:"bottom",zIndex:1,getPopupContainer:N=>N.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontFamily",children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:d,getPopupContainer:N=>N.closest(".selected_text_common_form_mobile")})})})}),(0,t.jsx)("div",{style:{width:90},children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:a("Font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:a("Font size"),prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)("div",{style:{width:90},children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:a("Line height"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"lineHeight",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:a("Line height"),prefix:(0,t.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,t.jsxs)(o.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,t.jsx)(it,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:a(k?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(r.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-td-form__icon-radius"})}),(0,t.jsx)(it,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:a(k?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})}),(0,t.jsx)(it,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:a(k?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-td-form__icon-radius"})}),(0,t.jsx)(it,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:a(k?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-td-form__icon-radius"})})]}),(0,t.jsxs)(o.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:a("Text color"),placement:"bottom",zIndex:1,getPopupContainer:N=>N.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",rules:[{message:a("Please set the font color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:a("Color"),usedColors:i.usedColors,getPopupContainer:N=>N.closest(".selected_text_common_form_mobile")})})}),!l&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:a("Text background"),placement:"bottom",zIndex:1,getPopupContainer:N=>N.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:a("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:a("Background color"),usedColors:i.usedColors})})})})]}),s&&(0,t.jsx)(o.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:(0,t.jsxs)(t.Fragment,{children:[typeof f=="string"?(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,popupRender:()=>(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:a("The URL that the hyperlink directs to."),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"linkHref",children:(0,t.jsx)(o.ui_kit$Input,{allowClear:!0,placeholder:a("Hyperlink URL"),prefix:(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.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:N=>N.closest(".selected_text_common_form_mobile"),children:(0,t.jsx)("div",{children:(0,t.jsx)(it,{form:e,className:"selected-td-form__button selected-td-form__button_style selected-td-form__button--active",elementSettings:i,name:"textLink",icon:(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),showTooltip:!1})})}):(0,t.jsx)(it,{form:e,className:"selected-td-form__button selected-td-form__button_style",elementSettings:i,name:"textLink",tooltipTitle:a("Link"),icon:(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-td-form__icon-radius"})}),(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,popupRender:()=>(0,t.jsx)(Zt,{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:N=>N.closest(".selected_text_common_form_mobile"),children:(0,t.jsx)(o.ui_kit$Button,{icon:S==="right"?(0,t.jsx)(r.EmIcons,{icon:"AlignRightOutlined",component:o.icons$AlignRightOutlined,size:18,strokeWidth:b.iconStrokeWidth}):S==="center"?(0,t.jsx)(r.EmIcons,{icon:"AlignCenterOutlined",component:o.icons$AlignCenterOutlined,size:18,strokeWidth:b.iconStrokeWidth}):(0,t.jsx)(r.EmIcons,{icon:"AlignLeftOutlined",component:o.icons$AlignLeftOutlined,size:18,strokeWidth:b.iconStrokeWidth}),className:"selected-td-form__button"})})]})}),(0,t.jsxs)(o.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[s&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:a("Add paragraph"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(r.EmIcons,{icon:"Paragraph",component:o.icons$Paragraph}),onClick:()=>m("add_p"),className:"selected-td-form__button"})}),(!l||b.formButtonFieldInsertImageEnabled)&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:a("Add inline image"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(r.EmIcons,{icon:"ImageAdd",component:o.icons$ImageAdd,size:16,strokeWidth:b.iconStrokeWidth}),onClick:()=>m("add_img"),className:"selected-td-form__button"})})}),!l&&(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(r.EmIcons,{icon:"Typograf",component:o.icons$Typograf}),className:"selected-td-form__button"}),(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(r.EmIcons,{icon:"CloseOutlined",component:o.icons$CloseOutlined}),type:"icon",style:{marginLeft:26},onClick:()=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),p(r.resetToLastActiveSettingsTab()),setTimeout(()=>{p(g==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300)}})]})]})})},$o=({elementSettings:e,imgParent:i=!1,name:s="mobileAlign"})=>{const{__:l}=r.useI18n(),a=r.useAppConfig();return(0,t.jsx)(o.ui_kit$Form.Item,{name:s,children:(0,t.jsx)(o.ui_kit$FormAlignTextControl,{disabled:i&&!e.parent,strokeWidth:a?.iconStrokeWidth,labels:{alignLeft:l("Text align left"),alignCenter:l("Text align center"),alignRight:l("Text align right"),alignJustify:l("Text align justify")}})})};$o.propTypes={elementSettings:_.default.object.isRequired,imgParent:_.default.bool,name:_.default.string};var gd=({elementSettings:e})=>{const{__:i}=r.useI18n(),s=r.useDispatch(),l=r.useSendPostMessage(),[a]=o.ui_kit$Form.useForm(),d=r.useSelector(r.selectEmailViewType),c=r.useSelector(r.selectMobileViewActive),p=r.useSelector(r.selectIsCodeMode),g=r.useSelector(r.selectCodeModeDirection),b=p&&g!=="bottom",[k,h]=(0,n.useState)("https://"),[m,S]=(0,n.useState)(!1),x=ls(),f=(0,n.useMemo)(()=>x,[]),y=r.useElementEntityKind(),{remember:v,fillFields:N}=ro(e),B=(0,n.useCallback)($=>{v($),s(y==="email"?r.setElementSettings$1($):r.setElementSettings($))},[s,y,v]);(0,n.useEffect)(()=>{if(e){const{subject:$,body:U,baseEmail:L}=qr(e.linkHref),F=e.linkHref,P=typeof F=="string"&&vi(F),H=typeof F=="string"&&F.startsWith("mailto:")?L:P?F.slice(1):typeof F=="string"?F:"https://";h(Oo(F||"","https://")),N(a,{...e,lineHeight:u(e.lineHeight),linkHref:H,subject:$,body:U,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:Jr(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:m,BulletsFontFamily:e?.list?.bulletFontFamily,BulletTextUnderline:e?.list?.bulletFontUnderline,BulletTextStrikethrough:e?.list?.bulletFontStrikethrough,BulletType:f.find(ae=>ae.symbol===e?.list?.bulletType)?.code??f[0].code,textSuperscript:e?.textSuperscript,textSubscript:e?.textSubscript,listOL:e?.standardList?.listTypeOL,listUL:e?.standardList?.listTypeUL})}},[a,e]);const C=$=>{const U=a.getFieldsValue(!0),L=Object.keys($)[0];let F;switch(L){case"mobileFontSize":F={[L]:{classNamePrefix:"em-mob-font_size-",value:$[L],dim:U.mobileFontSizeDim}};break;case"mobileLineHeight":F={[L]:{classNamePrefix:"em-mob-line_height-",value:$[L],dim:U.mobileLineHeightDim}};break;case"mobileTextAlign":F={[L]:{classNamePrefix:"em-mob-text_align-",value:$[L]}};break;case"linkHref":let P=Jt($[L]);if(P!==$[L]&&a.setFieldValue("linkHref",P),k==="#"&&P&&!P.startsWith("#")&&(P="#"+P),P.startsWith("mailto:")){const ae=a.getFieldValue("subject"),T=a.getFieldValue("body");F={[L]:Ii(P,ae,T)}}else F={[L]:P};Vt(P,h);break;case"subject":case"body":const H=a.getFieldValue("linkHref")||"";if(H.substring(0,7)==="mailto:"){const ae=H.split("?")[0],T=L==="subject"?$[L]:a.getFieldValue("subject"),te=L==="body"?$[L]:a.getFieldValue("body"),xe=[];T&&xe.push(`subject=${encodeURIComponent(T)}`),te&&xe.push(`body=${encodeURIComponent(te)}`),F={linkHref:xe.length>0?`${ae}?${xe.join("&")}`:ae}}else return;break;default:F=$}l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:F}),B({...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:f.find(P=>P.code===a.getFieldValue("BulletType"))?.symbol??f[0].symbol},...F,activateSection:null,changeKey:L})};return(0,t.jsxs)(o.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:[!b&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),!(d==="mobile"&&!b&&c.styles)&&(0,t.jsx)("div",{id:"selected_element_form_desktop_props",style:{paddingRight:0},children:b?(0,t.jsx)(Ai,{form:a,elementSettings:e}):(0,t.jsx)(go,{form:a,fillFields:N,elementSettings:e,linkProtocol:k,setLinkProtocol:h,isBulletFontColorChecked:m,setIsBulletFontColorChecked:S})}),!b&&(0,t.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:d==="mobile"&&c.styles?"block":"none"},children:[(0,t.jsx)(o.ui_kit$Row,{gutter:20,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)($o,{form:a,elementSettings:e,name:"mobileTextAlign"})})}),!!e.showOnMobile&&(0,t.jsx)(go,{form:a,fillFields:N,elementSettings:e,linkProtocol:k,setLinkProtocol:h}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(ss,{})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileLineHeight",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,t.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})]})]})]})},Ni=(e,i)=>{const{__:s}=r.useI18n();return(0,t.jsx)(o.ui_kit$Tooltip,{title:s("During export, the element is converted into an image."),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"exportAsPicture",valuePropName:"checked",className:"form-item-margin-xs",style:{marginBottom:10},children:(0,t.jsx)(o.ui_kit$Switch,{id:"convert-in-image",label:s("Convert into an image"),size:"small",labelStyle:{position:"relative",top:2}})})},"exportAsPicture")},as={marginBottom:10},ns={position:"relative",top:2};function fd(e){return Array.isArray(e)?!!e[0]?.value:typeof e=="string"?e.trim()!=="":!!e}var eo=({form:e,showRounding:i=!1,showBackground:s=!1})=>{const{__:l}=r.useI18n(),a=fd(o.ui_kit$Form.useWatch("backgroundImage",e));return(0,t.jsxs)(t.Fragment,{children:[i&&(0,t.jsx)(o.ui_kit$Tooltip,{title:l("Adds bulletproof VML markup so the button keeps rounded corners in Outlook."),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"outlookRounding",valuePropName:"checked",className:"form-item-margin-xs",style:as,children:(0,t.jsx)(o.ui_kit$Switch,{id:"outlook-rounding",label:l("Rounded corners in Outlook (VML)"),size:"small",labelStyle:ns})})},"outlookRounding"),s&&a&&(0,t.jsx)(o.ui_kit$Tooltip,{title:l("Adds VML markup so the background image is visible in Outlook."),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"outlookBackground",valuePropName:"checked",className:"form-item-margin-xs",style:as,children:(0,t.jsx)(o.ui_kit$Switch,{id:"outlook-background",label:l("Background image in Outlook (VML)"),size:"small",labelStyle:ns})})},"outlookBackground")]})};eo.propTypes={form:_.default.object,showRounding:_.default.bool,showBackground:_.default.bool};var ds=({form:e,elementSettings:i,boxShadow:s,bordersShow:l,borderRadiusShow:a,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:p,backgroundRepeatOptions:g,backgroundSizeOptions:b,sizeShow:k,modificationShow:h,oneBorderRadiusValue:m,setOneBorderRadiusValue:S,toggleShowBorderHandler:x,toggleShowBorderRadiusHandler:f,toggleShowBoxShadowHandler:y,toggleShowSizeHandler:v,toggleShowBackgroundHandler:N,toggleShowModificationHandler:B})=>{const{__:C}=r.useI18n(),$=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{style:{paddingBottom:4},children:(0,t.jsx)(Dt,{form:e,elementSettings:i,tooltipTitle:C("The align attribute sets the horizontal alignment of the table.")})}),(0,t.jsx)(o.ui_kit$FormSection,{title:C("Size"),collapsible:!0,open:k,onToggle:v,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormSizeInputs,{showHeight:!1,showMinMax:!0,columnsPerRow:2,dimensionSelect:Nt,minWidthDimensionSelect:Nt,maxWidthDimensionSelect:Nt,rowStyle:{marginBottom:4},labels:{width:C("Width"),height:C("Height"),minWidth:C("Minimum width"),maxWidth:C("Maximum width")}})}),(0,t.jsxs)(o.ui_kit$FormSection,{title:C("Background"),collapsible:!0,open:c,onToggle:N,dividerTop:!0,children:[(0,t.jsx)(o.ui_kit$FormBackgroundSettings,{imageEnabled:$.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:g,backgroundSizeOptions:b,imageUploadSlot:$.formTableFieldBackgroundImageEnabled?(0,t.jsx)(Pt,{form:e,label:C("Background image"),name:"backgroundImage",tooltipTitle:C("Background image"),placeholder:C("Background image link/route")}):void 0}),(0,t.jsx)(eo,{form:e,showBackground:!0})]}),$.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:C("Borders"),collapsible:!0,open:l,onToggle:x,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),$.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:C("Border radius"),collapsible:!0,open:a,onToggle:f,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:m,setOneBorderRadiusValue:S,elementSettings:i})}),$.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:C("Box shadow"),collapsible:!0,open:d,onToggle:y,dividerTop:!0,children:(0,t.jsx)(wt,{})}),$.formFieldExportAsPictureEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:C("Export settings"),collapsible:!0,open:h,onToggle:B,dividerTop:!0,children:(0,t.jsx)(Ni,{form:e,elementSettings:i})}),$.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:C("Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e})}),$.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:C("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};ds.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,boxShadow:_.default.object,bordersShow:_.default.bool,borderRadiusShow:_.default.bool,boxShadowShow:_.default.bool,backgroundShow:_.default.bool,backgroundImageEmpty:_.default.bool,backgroundRepeatOptions:_.default.array,backgroundSizeOptions:_.default.array,sizeShow:_.default.bool,modificationShow:_.default.bool,oneBorderRadiusValue:_.default.bool,setOneBorderRadiusValue:_.default.func,toggleShowBorderHandler:_.default.func,toggleShowBorderRadiusHandler:_.default.func,toggleShowBoxShadowHandler:_.default.func,toggleShowSizeHandler:_.default.func,toggleShowBackgroundHandler:_.default.func,toggleShowModificationHandler:_.default.func};var cs=({form:e,elementSettings:i,label:s})=>{const{__:l}=r.useI18n();(0,n.useRef)();const[a,d]=(0,n.useState)(i.mobileBackgroundColor?.value==="none"),{token:c}=(0,o.ui_kit$useToken)(),p=r.useSendPostMessage(),g=k=>{e.setFieldsValue({mobileBackgroundColor:""}),d(h=>!h),p({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:a?"":"none"}}})},b=k=>{d(!1)};return(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(o.ui_kit$Tooltip,{trigger:["hover"],title:l("Background color"),placement:"left",children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileBackgroundColor",style:{marginBottom:c.formItemMarginBottomXS/2},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{onChange:b,placeholder:s,usedColors:i.usedColors})}),(0,t.jsx)(o.ui_kit$Switch,{id:"without-background-color",label:l("Without background color"),labelSize:"small",size:"small",checked:a,onChange:g})]})})};cs.propTypes={form:_.default.shape({setFieldsValue:_.default.func.isRequired}).isRequired,elementSettings:_.default.object.isRequired};var Fo={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"}]},Li={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-"},so="none",_d=/^(https?:)?\/\//i,xd=/^(\d*\.?\d+)(%|px)$/;function kd(e){return e in Li}function us(e){return _d.test(e.trim())}function Oi(e,i){const s=Li[e],l=typeof i=="string"?i:"";return e==="mobileBackgroundImage"?l&&l!==so&&!us(l)?null:{[e]:[{classNamePrefix:s,value:l,type:"url"}]}:e==="mobileBackgroundRepeat"?{[e]:{classNamePrefix:s,value:l||so}}:{[e]:{classNamePrefix:s,value:l}}}function fo(e){const[i]=Object.keys(e??{});return!i||!kd(i)?null:Oi(i,e[i])}function ms(){return Object.keys(Li).reduce((e,i)=>({...e,...Oi(i,"")}),{})}function ps(e){const i=(e??"").trim(),s=i.match(xd);return s?{position:s[1],unit:s[2]}:{position:i,unit:"px"}}function hs(e,i){return e?isNaN(parseFloat(e))?e:e+i:""}function Ut(e){const i=e??{},s=i.customTable??i;return{type:i.type,usedColors:i.usedColors,mobileBackgroundColor:s.mobileBackgroundColor,mobileBackgroundImage:s.mobileBackgroundImage,mobileBackgroundPositionX:s.mobileBackgroundPositionX,mobileBackgroundPositionY:s.mobileBackgroundPositionY,mobileBackgroundRepeat:s.mobileBackgroundRepeat,mobileBackgroundSize:s.mobileBackgroundSize}}function _o(e){const i=e??{},s=i.customTable??i,l=s.backgroundSize??"";return{image:s.backgroundImage?.[0]?.value??"",positionX:s.backgroundPositionX??"",positionY:s.backgroundPositionY??"",repeat:s.backgroundRepeat??"",size:l==="auto"?"":l}}function to(e){const i=Ut(e),s=i.mobileBackgroundImage?.[0]?.value??"";return{mobileBackgroundImage:s===so?"":s,mobileBackgroundPositionX:i.mobileBackgroundPositionX?.value??"",mobileBackgroundPositionY:i.mobileBackgroundPositionY?.value??"",mobileBackgroundRepeat:i.mobileBackgroundRepeat?.value||so,mobileBackgroundSize:i.mobileBackgroundSize?.value??""}}function Mo(e){const i=Ut(e),s=i.mobileBackgroundRepeat?.value;return!!i.mobileBackgroundColor?.value||!!i.mobileBackgroundImage?.[0]?.value||!!i.mobileBackgroundPositionX?.value||!!i.mobileBackgroundPositionY?.value||!!s&&s!==so||!!i.mobileBackgroundSize?.value}function Ed(e,i){return e===so?!1:!!e||!!i}function Do(e,i,s){e.setFieldsValue({...to({}),mobileBackgroundColor:""}),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Ut(i).type,settings:ms()})}var Sd=/^\d*\.?\d+$/,Bd={bottom:"auto"},bs={marginBottom:0},Rd=(0,t.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:o.icons$BgPositionHorizontal}),Td=(0,t.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:o.icons$BgPositionVertical}),yd=e=>e.closest(".email-pane__collapse-wrapper")??e.parentNode,gs=({value:e,onChange:i,inheritedValue:s,options:l,placeholder:a,prefix:d})=>{const c=e||s,[p,g]=(0,n.useState)(()=>ps(c));(0,n.useEffect)(()=>{g(m=>hs(m.position,m.unit)===c?m:ps(c))},[c]);const b=(0,n.useCallback)((m,S)=>{g({position:m,unit:S});const x=l.some(f=>f.value===m);(m===""||x||Sd.test(m))&&i?.(hs(m,S))},[i,l]),k=(0,n.useCallback)(m=>b(m,p.unit),[b,p.unit]),h=(0,n.useCallback)(m=>b(p.position,m),[b,p.position]);return(0,t.jsx)(o.ui_kit$InputSelect,{options:l,position:p.position,setPosition:k,unit:p.unit,setUnit:h,placeholder:a,prefix:d,dropdownStyle:Bd,tooltipTitle:a,getTooltipPopupContainer:yd})},wd=({desktopPositionX:e,desktopPositionY:i})=>{const{__:s}=r.useI18n(),{token:l}=(0,o.ui_kit$useToken)(),a=l.formItemMarginBottomXS,d=(0,n.useMemo)(()=>({marginBottom:a}),[a]);return(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:d,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileBackgroundPositionX",style:bs,children:(0,t.jsx)(gs,{inheritedValue:e,options:Fo.horizontal,placeholder:s("Horizontal position"),prefix:Rd})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileBackgroundPositionY",style:bs,children:(0,t.jsx)(gs,{inheritedValue:i,options:Fo.vertical,placeholder:s("Vertical position"),prefix:Td})})})]})},fs=["hover"],_s=e=>document.querySelector(".email-properties__collapse-panel")??e.parentNode,xs=({value:e,emptyValue:i,inheritedValue:s,...l})=>{const a=!!e&&e!==i,d=l.options.some(c=>c.value===s)?s:i;return(0,t.jsx)(o.ui_kit$Select,{...l,value:a?e:d})},jd=({desktopPositionX:e,desktopPositionY:i,desktopRepeat:s,desktopSize:l,backgroundRepeatOptions:a,backgroundSizeOptions:d})=>{const{__:c}=r.useI18n(),{token:p}=(0,o.ui_kit$useToken)(),g=p.formItemMarginBottomXS,b=(0,n.useMemo)(()=>({marginBottom:g}),[g]),k=(0,n.useMemo)(()=>({marginBottom:(g??0)*1.5}),[g]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(wd,{desktopPositionX:e,desktopPositionY:i}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:k,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:fs,title:c("Background image repeat"),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileBackgroundRepeat",style:b,children:(0,t.jsx)(xs,{emptyValue:"none",inheritedValue:s,options:a,placeholder:c("Please choose"),getPopupContainer:_s})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:fs,title:c("Background image size"),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"mobileBackgroundSize",style:b,children:(0,t.jsx)(xs,{emptyValue:"",inheritedValue:l,options:d,placeholder:c("Please choose"),getPopupContainer:_s})})})})]})]})},vd=fi,Id=({value:e,inheritedImage:i,...s})=>(0,t.jsx)(vd,{...s,value:e||i}),Cd=e=>/^https?:\/\//i.test(e.trim()),Pd=({form:e,name:i="mobileBackgroundImage",placeholder:s="",disabled:l=!1,elementSettings:a,inheritedImage:d="",isImageNone:c=!1,onImageNoneChange:p})=>{const{__:g}=r.useI18n(),{token:b}=(0,o.ui_kit$useToken)(),k=o.ui_kit$Form.useWatch(i,e),[h,m]=(0,n.useState)(""),S=k||d,x=b.formItemMarginBottomXS??0,f=(0,n.useMemo)(()=>({marginBottom:x/2}),[x]);(0,n.useEffect)(()=>{if(!S){m("");return}m(Cd(S)?"validating":"success")},[S]);const y=!!k&&!us(k),v=y?"error":h;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:i,className:"mobile-background-image-field",validateStatus:v,help:y?g("Enter a URL starting with http:// or https://"):void 0,style:f,children:(0,t.jsx)(Id,{inheritedImage:d,validateStatus:v,placeholder:s,name:i,disabled:l,elementSettings:a,imageInfo:a,onRemotePreviewValidate:m})}),(0,t.jsx)(o.ui_kit$Switch,{label:g("Without image"),labelSize:"small",size:"small",checked:c,onChange:p})]})},Ad={image:"",positionX:"",positionY:"",repeat:"",size:""},xo=({elementSettings:e,imageEnabled:i=!1,desktopBackground:s=Ad})=>{const{__:l}=r.useI18n(),{token:a}=(0,o.ui_kit$useToken)(),d=o.ui_kit$Form.useFormInstance(),c=a.formItemMarginBottomMD,p=r.useSendPostMessage(),g=e.mobileBackgroundImage?.[0]?.value,[b,k]=(0,n.useState)(g==="none"),h=o.ui_kit$Form.useWatch("mobileBackgroundImage",d);(0,n.useEffect)(()=>{k(g==="none")},[g]),(0,n.useEffect)(()=>{h&&k(!1)},[h]);const m=(0,n.useCallback)(C=>{k(C),d.setFieldsValue({mobileBackgroundImage:""}),p({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Oi("mobileBackgroundImage",C?"none":"")})},[e.type,d,p]),S=(0,n.useMemo)(()=>[{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"}],[l]),x=(0,n.useMemo)(()=>[{label:l("Not defined"),value:""},{label:l("Contain"),value:"contain"},{label:l("Cover"),value:"cover"}],[l]),f=Ed(b?"none":h,s.image),y=(0,n.useMemo)(()=>({marginBottom:f?c:0}),[c,f]),v=(0,n.useMemo)(()=>(0,t.jsx)("div",{style:y,children:(0,t.jsx)(cs,{form:d,elementSettings:e,label:l("Background color")})}),[l,e,d,y]),N=(0,n.useMemo)(()=>(0,t.jsx)("div",{style:y,children:(0,t.jsx)(Pd,{form:d,placeholder:l("Background image"),elementSettings:e,inheritedImage:b?"":s.image,isImageNone:b,onImageNoneChange:m})}),[l,s.image,e,d,m,b,y]),B=(0,n.useMemo)(()=>(0,t.jsx)(jd,{desktopPositionX:s.positionX,desktopPositionY:s.positionY,desktopRepeat:s.repeat,desktopSize:s.size,backgroundRepeatOptions:S,backgroundSizeOptions:x}),[S,x,s.positionX,s.positionY,s.repeat,s.size]);return(0,t.jsx)(o.ui_kit$FormBackgroundSettings,{colorFieldName:"mobileBackgroundColor",colorSlot:v,imageEnabled:i,backgroundImageEmpty:!f,imageUploadSlot:N,imageControlsSlot:B,usedColors:e.usedColors})},ks=({form:e,elementSettings:i,mobileBoxShadow:s,mobileBordersShow:l,mobileBorderRadiusShow:a,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:p,oneMobileBorderRadiusValue:g,setOneMobileBorderRadiusValue:b,toggleShowMobileBorderHandler:k,toggleShowMobileBorderRadiusHandler:h,toggleShowMobileBoxShadowHandler:m,toggleShowMobileSizeHandler:S,toggleShowMobileBackgroundHandler:x})=>{const{__:f}=r.useI18n(),{token:y}=(0,o.ui_kit$useToken)(),v=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{style:{paddingBottom:4},children:(0,t.jsx)(Dt,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,t.jsx)(o.ui_kit$FormSection,{title:f("Size"),collapsible:!0,open:c,onToggle:S,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:f("Table width"),placement:"left",children:(0,t.jsx)("div",{style:{marginBottom:y.formItemMarginBottomMD+4},children:(0,t.jsx)(Ht,{form:e,name:"mobileWidth",elementSettings:i})})})})})}),(0,t.jsx)(o.ui_kit$FormSection,{title:f("Background"),collapsible:!0,open:p,onToggle:x,dividerTop:!0,children:(0,t.jsx)(xo,{elementSettings:Ut(i),imageEnabled:v.formTableFieldBackgroundImageEnabled,desktopBackground:_o(i)})}),v.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:f("Borders"),collapsible:!0,open:l,onToggle:k,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),v.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:f("Border radius"),collapsible:!0,open:a,onToggle:h,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:g,setOneBorderRadiusValue:b,elementSettings:i})}),v.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:f("Box shadow"),collapsible:!0,open:d,onToggle:m,dividerTop:!0,children:(0,t.jsx)(wt,{typeOfForm:"mobile",form:e,elementSettings:i})}),v.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:f("Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e})}),v.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:f("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};ks.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,mobileBoxShadow:_.default.object,mobileBordersShow:_.default.bool,mobileBorderRadiusShow:_.default.bool,mobileBoxShadowShow:_.default.bool,mobileSizeShow:_.default.bool,mobileBackgroundShow:_.default.bool,oneMobileBorderRadiusValue:_.default.bool,setOneMobileBorderRadiusValue:_.default.func,toggleShowMobileBorderHandler:_.default.func,toggleShowMobileBorderRadiusHandler:_.default.func,toggleShowMobileBoxShadowHandler:_.default.func,toggleShowMobileSizeHandler:_.default.func,toggleShowMobileBackgroundHandler:_.default.func};var Es=({elementSettings:e})=>{const{__:i}=r.useI18n(),s=r.useSendPostMessage(),[l]=o.ui_kit$Form.useForm(),a=Lt(),d=Lt(),c=r.useDispatch(),p=r.useElementEntityKind(),[g,b]=(0,n.useState)({}),[k,h]=(0,n.useState)(!0),[m,S]=(0,n.useState)({}),[x,f]=(0,n.useState)(!0),y=r.useSelector(r.selectEmailViewType),v=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[N,B]=(0,n.useState)(e.backgroundImage[0].value===""),C=r.useSelector(r.selectIsCodeMode),$=r.useSelector(r.selectCodeModeDirection),U=C&&$!=="bottom",[L,F]=(0,n.useState)(!1),[P,H]=(0,n.useState)(!1),[ae,T]=(0,n.useState)(!1),[te,xe]=(0,n.useState)(!1),[be,ye]=(0,n.useState)(!1),[me,he]=(0,n.useState)(!1),[ke,ce]=(0,n.useState)(!1),[ze,Oe]=(0,n.useState)(!1),[ve,Ee]=(0,n.useState)(!1),[pe,Q]=(0,n.useState)(!1),[X,Z]=(0,n.useState)(!1),J=[{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"}],V=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}],M=I=>I&&(I?.width||I?.style||I?.color)?I:"",Y=e.border,K=e.mobileBorder,ee=Object.keys(Y).find(I=>Y[I]?.width||Y[I]?.style||Y[I]?.color),le=Object.keys(K).find(I=>K[I]?.width||K[I]?.style||K[I]?.color),{remember:Re,fillFields:Be}=ro(e);(0,n.useEffect)(()=>{if(e){const I=e.boxShadow,se=e.mobileBoxShadow;b(I),S(se),Be(l,{...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:bt(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileAlign:e.mobileAlign?.value,mobileBorderAll:M(e.mobileBorder.all)||!(M(e.mobileBorder.top)||M(e.mobileBorder.bottom)||M(e.mobileBorder.right)||M(e.mobileBorder.left))&&M(e.border.all),mobileBorderTop:M(e.mobileBorder.top)||!M(e.mobileBorder.all)&&M(e.border.top),mobileBorderBottom:M(e.mobileBorder.bottom)||!M(e.mobileBorder.all)&&M(e.border.bottom),mobileBorderRight:M(e.mobileBorder.right)||!M(e.mobileBorder.all)&&M(e.border.right),mobileBorderLeft:M(e.mobileBorder.left)||!M(e.mobileBorder.all)&&M(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:""),...to(e),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.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight)?f(!1):f(!0),B(e.backgroundImage[0].value==="");const je=a.isStaleBorderSnapshot(e,!!ee),Ne=d.isStaleBorderSnapshot(e,!!le);je&&l.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Ne||je&&!le)&&l.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),F(He=>ee&&!je?!0:He),H(He=>ee&&!je||le&&!Ne?!0:He),T(!!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),ye(!!e.boxShadow),he(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),ce(!!e.width?.value||!!e.minWidth?.value||!!e.maxWidth?.value),Oe(!!e.mobileWidth.value),Ee(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Q(Mo(e)),Z(!!e.exportAsPicture)}},[l,e,ee,le,a,d,Be]);const $e=(0,n.useCallback)(I=>{Re(I),c(p==="email"?r.setElementSettings$1(I):r.setElementSettings(I))},[c,p,Re]),z=I=>{const se=l.getFieldsValue(!0),je=Object.keys(I)[0];let Ne;switch(je){case"exportAsPicture":Ne={exportAsPicture:se.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Ne={boxShadow:{hOffset:se.boxShadowHOffset,vOffset:se.boxShadowVOffset,blurRadius:se.boxShadowBlurRadius,spreadRadius:se.boxShadowSpreadRadius,color:se.boxShadowColor,inset:se.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":se.borderPosition==="borderAll"?(Ne={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...se.borderAll}}},l.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):se.borderAll?.width||se.borderAll?.style||se.borderAll?.color?(Ne={border:{all:null,left:se.borderAll,right:se.borderAll,top:se.borderAll,bottom:se.borderAll,[W.REVERSE_BORDER_POSITIONS[je]]:{...se[je],...I[je]}}},l.setFieldsValue({borderAll:null,borderLeft:se.borderAll,borderRight:se.borderAll,borderTop:se.borderAll,borderBottom:se.borderAll,[je]:{...se[je],...I[je]}})):(Ne={border:{all:null,left:se.borderLeft,right:se.borderRight,top:se.borderTop,bottom:se.borderBottom,[W.REVERSE_BORDER_POSITIONS[je]]:{...se[je],...I[je]}}},l.setFieldsValue({border:Ne.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(se.mobileBorderPosition==="mobileBorderAll")Ne={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...se.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[je]+"-"}}},l.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[je],Ke={...se[je],...I[je]},tt=!Ke?.width&&!Ke?.style&&!Ke?.color;if(se.mobileBorder?.all?.width||se.mobileBorder?.all?.style||se.mobileBorder?.all?.color){const O=se.mobileBorderAll;Ne={mobileBorder:{all:null,left:O,right:O,top:O,bottom:O,[He]:tt?null:{...Ke,classNamePrefix:"em-mob-border_"+He+"-"}}},l.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:O,mobileBorderRight:O,mobileBorderTop:O,mobileBorderBottom:O,[je]:Ke})}else{const O=e.mobileBorder||{},ie=j=>{const w=O[j];return w&&(w?.width||w?.style||w?.color)?w:null};Ne={mobileBorder:{all:null,left:He==="left"?tt?null:{...Ke,classNamePrefix:"em-mob-border_left-"}:ie("left"),right:He==="right"?tt?null:{...Ke,classNamePrefix:"em-mob-border_right-"}:ie("right"),top:He==="top"?tt?null:{...Ke,classNamePrefix:"em-mob-border_top-"}:ie("top"),bottom:He==="bottom"?tt?null:{...Ke,classNamePrefix:"em-mob-border_bottom-"}:ie("bottom")}},l.setFieldsValue({[je]:Ke})}}break;case"width":Ne={[je]:{value:I[je],dim:se.widthDim}};break;case"widthDim":Ne={width:{value:se.width,dim:I[je]}};break;case"maxWidth":Ne={[je]:{value:I[je],dim:se.maxWidthDim}};break;case"maxWidthDim":Ne={maxWidth:{value:se.maxWidth,dim:I[je]}};break;case"minWidth":Ne={[je]:{value:I[je],dim:se.minWidthDim}};break;case"minWidthDim":Ne={minWidth:{value:se.minWidth,dim:I[je]}};break;case"backgroundImage":B(I[je]===""),Ne={[je]:[{...e.backgroundImage[0],value:I[je]}],backgroundSize:"cover"};break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Ne={borderRadius:{[W.BORDER_RADIUS_POSITION[je]]:+I[je]}};break;case"mobileWidth":Ne={[je]:{classNamePrefix:"em-mob-width-",value:I[je],dim:se.mobileWidthDim}};break;case"mobileWidthDim":Ne={mobileWidth:{classNamePrefix:"em-mob-width-",value:se.mobileWidth||100,dim:I[je]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Ne={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[je]]:I[je],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[je]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Ne={mobileBoxShadow:{hOffset:se.mobileBoxShadowHOffset,vOffset:se.mobileBoxShadowVOffset,blurRadius:se.mobileBoxShadowBlurRadius,spreadRadius:se.mobileBoxShadowSpreadRadius,color:se.mobileBoxShadowColor,inset:se.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Ne=fo(I),!Ne)return;break;case"mobileAlign":Ne={[je]:{classNamePrefix:"em-mob-table_align-",value:I[je]}};break;default:Ne=I}je!=="borderPosition"&&je!=="mobileBorderPosition"&&(s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ne}),je!=="mobileBorderRadiusAll"&&je!=="mobileBorderRadiusTopLeft"&&je!=="mobileBorderRadiusTopRight"&&je!=="mobileBorderRadiusBottomLeft"&&je!=="mobileBorderRadiusBottomRight"&&$e({...e,...Ne,mobileBorderRadius:{...e.mobileBorderRadius,...Ne?.mobileBorderRadius},activateSection:null,changeKey:je}))},re=()=>{const I=l.getFieldsValue(!0);a.markBorderToggled(!L),setTimeout(()=>{F(se=>!se),L?(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"},s({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}}}})})},Pe=()=>{const I=l.getFieldsValue(!0);d.markBorderToggled(!P),setTimeout(()=>{H(se=>!se),P?(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"},s({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}}}})})},G=()=>{const I=l.getFieldsValue(!0);setTimeout(()=>{T(se=>!se),ae?(I.borderRadiusAll=0,h(!0)):I.borderRadiusAll=5,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:I.borderRadiusAll}}})})},Se=()=>{const I=l.getFieldsValue(!0);setTimeout(()=>{xe(se=>!se),te?(I.mobileBorderRadiusAll=null,f(!0)):I.mobileBorderRadiusAll=5,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:I.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},Fe=()=>{const I=l.getFieldsValue(!0);setTimeout(()=>{ye(se=>!se),be?(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"),s({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}}})})},Ae=()=>{const I=l.getFieldsValue(!0);setTimeout(()=>{he(se=>!se),me?(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"),s({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-"}}})})},Ve=()=>{const I=l.getFieldsValue(!0);setTimeout(()=>{ce(se=>!se),ke&&(I.width="",I.minWidth="",I.maxWidth="",s({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"}}}))})},Ue=()=>{const I=l.getFieldsValue(!0);setTimeout(()=>{Oe(se=>!se),ze&&(I.mobileWidth="",s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"}}}))})},Xe=()=>{const I=l.getFieldsValue(!0);setTimeout(()=>{Ee(se=>!se),ve?(I.backgroundColor="",I.backgroundImage="",I.backgroundPositionX="",I.backgroundPositionY="",I.backgroundRepeat="none",I.backgroundSize="",B(!0)):(I.backgroundColor="#E5E5E5",I.backgroundSize="",I.backgroundRepeat="none"),s({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}})})},ne=()=>{const I=l.getFieldsValue(!0);setTimeout(()=>{Q(se=>!se),pe?I.mobileBackgroundColor="":I.mobileBackgroundColor="#E5E5E5",s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:I.mobileBackgroundColor}}}),pe&&Do(l,e,s)})},Te=()=>{const I=l.getFieldsValue(!0);setTimeout(()=>{Z(se=>!se),X&&(I.exportAsPicture=!1,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})};return(0,t.jsxs)(o.ui_kit$Form,{form:l,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[ee]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[le]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileBackgroundColor:"",mobileBackgroundImage:""},onValuesChange:z,autoComplete:"off",className:"element-controls",children:[!U&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),y==="mobile"&&v.styles?(0,t.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,t.jsx)(ks,{form:l,elementSettings:e,mobileBoxShadow:m,mobileBordersShow:P,mobileBorderRadiusShow:te,mobileBoxShadowShow:me,mobileSizeShow:ze,mobileBackgroundShow:pe,oneMobileBorderRadiusValue:x,setOneMobileBorderRadiusValue:f,toggleShowMobileBorderHandler:Pe,toggleShowMobileBorderRadiusHandler:Se,toggleShowMobileBoxShadowHandler:Ae,toggleShowMobileSizeHandler:Ue,toggleShowMobileBackgroundHandler:ne})," "]}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(ds,{form:l,elementSettings:e,boxShadow:g,bordersShow:L,borderRadiusShow:ae,boxShadowShow:be,backgroundShow:ve,backgroundImageEmpty:N,backgroundRepeatOptions:J,backgroundSizeOptions:V,sizeShow:ke,modificationShow:X,oneBorderRadiusValue:k,setOneBorderRadiusValue:h,toggleShowBorderHandler:re,toggleShowBorderRadiusHandler:G,toggleShowBoxShadowHandler:Fe,toggleShowSizeHandler:Ve,toggleShowBackgroundHandler:Xe,toggleShowModificationHandler:Te})})]})};Es.propTypes={elementSettings:_.default.object.isRequired};var Ss=({elementSettings:e})=>{const{__:i}=r.useI18n(),s=r.useSendPostMessage(),[l]=o.ui_kit$Form.useForm(),a=r.useAppConfig(),d=r.useSelector(r.selectIsCodeMode),c=r.useSelector(r.selectCodeModeDirection),[p,g]=(0,n.useState)({}),[b,k]=(0,n.useState)("https://"),h=({target:x})=>{const{selectionStart:f,selectionEnd:y}=x;x&&g({target:x,selection:{start:f,end:y}})};(0,n.useEffect)(()=>{if(e){let x="",f="",y=e.href==null?"https://":e.href;if(y&&y.substring(0,7)==="mailto:"){const v=new URL(e.href);x=v.searchParams.get("subject")||"",f=v.searchParams.get("body")||"",y=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(""));l.setFieldsValue({...e,href:y,subject:x,body:f})}},[l,e]);const m=x=>{const f=Object.keys(x)[0];let y=x;if(f==="href"){const v=Jt(x[f]);if(v!==x[f]&&l.setFieldValue("href",v),v.substring(0,7)==="mailto:"){const N=l.getFieldValue("subject"),B=l.getFieldValue("body"),C=[];N&&C.push(`subject=${encodeURIComponent(N)}`),B&&C.push(`body=${encodeURIComponent(B)}`),y={href:C.length>0?`${v}?${C.join("&")}`:v}}else y={href:v}}if(f==="subject"||f==="body"){const v=l.getFieldValue("href")||"";if(v.substring(0,7)==="mailto:"){const N=v.split("?")[0],B=f==="subject"?x[f]:l.getFieldValue("subject"),C=f==="body"?x[f]:l.getFieldValue("body"),$=[];B&&$.push(`subject=${encodeURIComponent(B)}`),C&&$.push(`body=${encodeURIComponent(C)}`),y={href:$.length>0?`${N}?${$.join("&")}`:N}}else return}s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:y})},S=x=>{s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:x})};return(0,t.jsx)(o.ui_kit$Form,{form:l,layout:"vertical",name:"selected_link_form",initialValues:{href:"https://",target:"",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1,textReplacer:"",subject:"",body:""},onValuesChange:m,autoComplete:"off",className:"element-controls",children:!d||c==="bottom"?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Hyperlink URL"),placement:"left",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"href",style:{marginBottom:24,paddingRight:10},children:(0,t.jsx)(o.ui_kit$Input,{allowClear:!0,placeholder:i("Hyperlink URL"),prefix:(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined}),onSelect:h})})}),a.formLinkFieldInsertImageEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:i("Actions with the chosen text"),dividerTop:!0,children:(0,t.jsx)(o.ui_kit$Form.Item,{children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(r.EmIcons,{icon:"PicLeftOutlined",component:o.icons$PicLeftOutlined}),onClick:()=>S("add_img"),children:i("Add inline image")})})}),(0,t.jsx)(go,{form:l,elementSettings:e,showAddParagraph:!1,linkTarget:p,linkProtocol:b,setLinkProtocol:k})]}):(0,t.jsx)(Ai,{form:l,elementSettings:e,showAddParagraph:!1})})};Ss.propTypes={elementSettings:_.default.object.isRequired};var Bs=()=>{const{__:e}=r.useI18n();return(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:14,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"height",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:e("Indent height"),prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:o.icons$ColumnHeightOutlined}),addonAfter:"px"})})})})};Bs.propTypes={};var Rs=({form:e,elementSettings:i})=>(0,t.jsx)(o.ui_kit$Row,{gutter:10,style:{marginBottom:20},children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Qt,{form:e,name:"mobileHeight",elementSettings:i})})});Rs.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired};var Ts=({elementSettings:e})=>{const{__:i}=r.useI18n(),[s]=o.ui_kit$Form.useForm(),l=r.useDispatch(),a=r.useSendPostMessage(),d=r.useSelector(r.selectEmailViewType),c=r.useSelector(r.selectMobileViewActive),p=r.useSelector(r.selectIsCodeMode),g=r.useSelector(r.selectCodeModeDirection),b=p&&g!=="bottom",k=r.useElementEntityKind(),{remember:h,fillFields:m}=ro(e);(0,n.useEffect)(()=>{e&&m(s,{...e,height:e.height?.value,heightDim:e.height?.dim,mobileHeight:bt(e.mobileHeight?.value||e.height?.value),mobileHeightDim:e.mobileHeight?.dim||e.height?.dim})},[s,e,m]);const S=(0,n.useCallback)(f=>{h(f),l(k==="email"?r.setElementSettings$1(f):r.setElementSettings(f))},[l,k,h]),x=f=>{const y=s.getFieldsValue(!0),v=Object.keys(f)[0];let N;switch(v){case"height":N={[v]:{value:f[v],dim:y.heightDim}};break;case"heightDim":N={height:{value:y.height,dim:f[v]}};break;case"mobileHeight":N={[v]:{classNamePrefix:"em-mob-height-",value:f[v],dim:y.mobileHeightDim}};break;case"mobileHeightDim":N={mobileHeight:{classNamePrefix:"em-mob-height-",value:y.mobileHeight,dim:f[v]}};break;default:N=f}a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:N}),S({...e,...N,activateSection:null,changeKey:v})};return(0,t.jsxs)(o.ui_kit$Form,{form:s,layout:"vertical",name:"selected_vindent_form",initialValues:{height:"",heightDim:"",mobileHeight:"",mobileHeightDim:""},onValuesChange:x,autoComplete:"off",children:[!b&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),d==="mobile"&&c.styles?(0,t.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,t.jsx)(Rs,{form:s,elementSettings:e})}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",style:{display:d==="mobile"&&c.styles?"none":"block"},children:(0,t.jsx)(Bs,{})})]})};Ts.propTypes={elementSettings:_.default.object.isRequired};var Vo=({form:e,elementSettings:i,typeOfForm:s="desktop"})=>{const l=r.useSendPostMessage(),a=s==="mobile",d=a?"mobileDirection":"direction",c=g=>{e.setFieldsValue({[d]:g}),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[d]:g}})},p=a?i.mobileDirection?.value??"":i.direction??"";return(0,t.jsx)(o.ui_kit$Form.Item,{name:d,className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$FormDirectionControl,{value:p,onChange:c})})},Ho=e=>e.closest(".email-pane__collapse-wrapper")||e.parentNode,$i=({form:e,backgroundImageEmpty:i,appConfig:s,token:l,elementSettings:a,backgroundRepeatOptions:d,handleChangeValues:c})=>{const{__:p}=r.useI18n(),[g,b]=(0,n.useState)(""),[k,h]=(0,n.useState)("px"),[m,S]=(0,n.useState)(""),[x,f]=(0,n.useState)("px"),y=[{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 $=C.match(/^(\d*\.?\d+)(%|px)$/);return $?{value:$[1],unit:$[2]}:{value:C,unit:"px"}};(0,n.useEffect)(()=>{const C=e.getFieldValue("backgroundPositionX"),$=e.getFieldValue("backgroundPositionY"),U=v(C),L=v($);b(String(U.value)),h(U.unit),S(String(L.value)),f(L.unit)},[e]);const N=(C,$)=>{b(String(C)),h($),c&&c({backgroundPositionX:{position:C,unit:$}})},B=(C,$)=>{S(String(C)),f($),c&&c({backgroundPositionY:{position:C,unit:$}})};return(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:8},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:p("Background color"),placement:"bottom",getPopupContainer:Ho,children:(0,t.jsx)("div",{children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"backgroundColor",style:{marginBottom:l.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:p("Background color"),usedColors:a.usedColors,placement:"bottomLeft"})})})})}),s.formCellFieldBackgroundImageEnabled&&(0,t.jsxs)(o.ui_kit$Col,{span:i?12:24,children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:p("Background image"),placement:"bottom",getPopupContainer:Ho,children:(0,t.jsx)("div",{children:(0,t.jsx)(Pt,{form:e,label:p("Background image"),name:"backgroundImage",tooltipTitle:p("Background image"),placeholder:p("Background image link/route")})})}),!i&&(0,t.jsxs)(o.ui_kit$Form.Item,{style:{marginBottom:"0"},children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:l.formItemMarginBottomXS},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$InputSelect,{options:Fo.horizontal,position:g,setPosition:C=>N(C,k),unit:k,setUnit:C=>N(g,C),placeholder:p("Horizontal position"),prefix:(0,t.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:o.icons$BgPositionHorizontal}),dropdownStyle:{bottom:"auto"},tooltipTitle:p("Horizontal position"),getTooltipPopupContainer:Ho})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$InputSelect,{options:Fo.vertical,position:m,setPosition:C=>B(C,x),unit:x,setUnit:C=>B(m,C),placeholder:p("Vertical position"),prefix:(0,t.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:o.icons$BgPositionVertical}),dropdownStyle:{bottom:"auto"},tooltipTitle:p("Vertical position"),getTooltipPopupContainer:Ho})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:p("Background image repeat"),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"backgroundRepeat",style:{marginBottom:l.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Select,{placeholder:p("Please choose"),options:d,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:p("Background image size"),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"backgroundSize",style:{marginBottom:l.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Select,{placeholder:p("Please choose"),options:y,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})})]})]})]})]})},Nd=({form:e,elementSettings:i,__:s,appConfig:l})=>{const a=W.useGoogleFontsLoader(),[d,c]=(0,n.useState)(null);return(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&c(!0)},[]),(0,t.jsxs)("div",{style:{marginBottom:"-15px"},children:[l.formTextFieldTypografEnabled&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:s("Text font"),placement:"bottom",zIndex:1,getPopupContainer:p=>p.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:a,getPopupContainer:p=>p.closest(".email-pane__collapse-wrapper")})})}),!i.showOnMobile&&(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:s("Font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:s("Font size"),prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:s("Line height"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"lineHeight",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:s("Line height"),prefix:(0,t.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:s(d?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(r.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:s(d?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:s(d?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:s(d?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:s("Text color"),placement:"bottom",zIndex:2,getPopupContainer:p=>p.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",rules:[{message:s("Please set the font color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:s("Color"),usedColors:i.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:s("Text background"),placement:"bottom",zIndex:2,getPopupContainer:p=>p.parentNode,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:s("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:s("Background color"),usedColors:i.usedColors})})})})]})]})},ys=({form:e,elementSettings:i,boxShadow:s,bordersShow:l,borderRadiusShow:a,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:p,backgroundRepeatOptions:g,sizeShow:b,maxWidthValue:k,modificationShow:h,paddingsExt:m,oneBorderRadiusValue:S,setOneBorderRadiusValue:x,elementListShow:f,togglePaddingHandler:y,toggleShowBorderHandler:v,toggleShowBorderRadiusHandler:N,toggleShowBoxShadowHandler:B,toggleShowSizeHandler:C,toggleShowBackgroundHandler:$,toggleShowModificationHandler:U,handleChangeValues:L})=>{const{__:F}=r.useI18n(),{token:P}=(0,o.ui_kit$useToken)(),H=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Zt,{form:e,elementSettings:i})}),H.formCellFieldVerticalAlignEnabled&&i.type!=="group"&&(i.type!=="structure"||i.type==="structure"&&i.floatBlocks.items.length===1)&&(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Ot,{form:e,elementSettings:i})})]}),H.formCellFieldPaddingsEnabled&&(0,t.jsxs)(t.Fragment,{children:[f&&(0,t.jsx)("div",{style:{marginTop:"15px"},children:(0,t.jsx)(Nd,{form:e,elementSettings:i,appConfig:H,__:F})}),(0,t.jsx)(o.ui_kit$FormSection,{title:F("Padding"),dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormPaddingInputs,{extended:m,onToggleExtended:y,showHorizontal:i.type!=="group"&&i.type!=="column",rowStyle:{paddingBottom:4},labels:{horizontal:F("Horizontal padding"),vertical:F("Vertical padding"),left:F("Left padding"),right:F("Right padding"),top:F("Top padding"),bottom:F("Bottom padding"),individual:F("Individual padding")}})})]}),i.type!=="group"&&H.formCellFieldSizeEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:F("Size"),collapsible:!0,open:b,onToggle:C,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormSizeInputs,{showWidth:i.type!=="structure"&&i.type!=="column",maxWidth:k,dimensionSelect:Nt,rowStyle:{paddingBottom:4},labels:{width:F("Width"),height:F("Height"),minWidth:F("Minimum width"),maxWidth:F("Maximum width")}})}),(0,t.jsxs)(o.ui_kit$FormSection,{title:F("Background"),collapsible:!0,open:c,onToggle:$,dividerTop:!0,children:[(0,t.jsx)($i,{form:e,backgroundImageEmpty:p,appConfig:H,token:P,elementSettings:i,backgroundRepeatOptions:g,handleChangeValues:L}),(0,t.jsx)(eo,{form:e,showBackground:!0})]}),H.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:F("Borders"),collapsible:!0,open:l,onToggle:v,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),H.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:F("Border radius"),collapsible:!0,open:a,onToggle:N,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:S,setOneBorderRadiusValue:x,elementSettings:i})}),H.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:F("Box shadow"),collapsible:!0,open:d,onToggle:B,dividerTop:!0,children:(0,t.jsx)(wt,{})}),H.formFieldExportAsPictureEnabled&&i.type!=="group"&&(0,t.jsxs)(o.ui_kit$FormSection,{title:F("Settings"),collapsible:!0,open:h,onToggle:U,dividerTop:!0,children:[i.type==="structure"&&(0,t.jsx)(o.ui_kit$Tooltip,{title:F("The block will change its colors to contrasting colors. You can change them in the Content Styles section."),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"isContrastBlock",valuePropName:"checked",style:{marginBottom:0},children:(0,t.jsx)(o.ui_kit$Switch,{id:"contrast-colors",label:F("Contrast block"),size:"small",labelStyle:{position:"relative",top:2}})})},"isContrastBlock"),(0,t.jsx)(Ni,{form:e,elementSettings:i})]}),H.formFieldVisibilityEnabled&&i.type!=="column"&&(0,t.jsx)(o.ui_kit$FormSection,{title:F(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,t.jsx)(Vo,{elementSettings:i,form:e}):void 0})}),H.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:F("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};ys.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,boxShadow:_.default.object,bordersShow:_.default.bool,borderRadiusShow:_.default.bool,boxShadowShow:_.default.bool,backgroundShow:_.default.bool,backgroundImageEmpty:_.default.bool,backgroundRepeatOptions:_.default.array,sizeShow:_.default.bool,maxWidthValue:_.default.oneOfType([_.default.string,_.default.number]),modificationShow:_.default.bool,paddingsExt:_.default.bool,oneBorderRadiusValue:_.default.bool,setOneBorderRadiusValue:_.default.func,elementListShow:_.default.bool,togglePaddingHandler:_.default.func,toggleShowBorderHandler:_.default.func,toggleShowBorderRadiusHandler:_.default.func,toggleShowBoxShadowHandler:_.default.func,toggleShowSizeHandler:_.default.func,toggleShowBackgroundHandler:_.default.func,toggleShowModificationHandler:_.default.func,handleChangeValues:_.default.func};var Uo=({form:e,elementSettings:i,mobilePaddingsExt:s,setMobilePaddingsExt:l,rowStyle:a})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),p=()=>{l(b=>!b);const g=e.getFieldsValue(!0);s||(g.mobilePaddingLeftRight=g.mobilePaddingLeft,g.mobilePaddingTopBottom=g.mobilePaddingTop,g.mobilePaddingRight=g.mobilePaddingLeft,g.mobilePaddingBottom=g.mobilePaddingTop,c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobilePadding:{top:g.mobilePaddingTop!==""?g.mobilePaddingTop:null,bottom:g.mobilePaddingTopBottom!==""?g.mobilePaddingTopBottom:null,left:g.mobilePaddingLeft!==""?g.mobilePaddingLeft:null,right:g.mobilePaddingRight!==""?g.mobilePaddingRight:null,classNamePrefix:"em-mob-padding_"}}}))};return(0,t.jsx)(o.ui_kit$FormPaddingInputs,{typeOfForm:"mobile",extended:s,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")}})};Uo.propTypes={form:_.default.shape({getFieldsValue:_.default.func.isRequired}).isRequired,elementSettings:_.default.object.isRequired,mobilePaddingsExt:_.default.bool.isRequired,setMobilePaddingsExt:_.default.func.isRequired,rowStyle:_.default.object};var ws=({form:e,elementSettings:i,boxShadow:s,mobileBordersShow:l,mobileBorderRadiusShow:a,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:p,mobilePaddingShow:g,mobilePaddingsExt:b,setMobilePaddingsExt:k,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:m,toggleShowMobileBorderHandler:S,toggleShowMobileBorderRadiusHandler:x,toggleShowMobileBoxShadowHandler:f,toggleShowMobileSizeHandler:y,toggleShowMobileBackgroundHandler:v,toggleShowMobilePaddingHandler:N})=>{const{__:B}=r.useI18n(),C=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:20,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Dt,{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,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Ot,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),C.formCellFieldPaddingsEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:B("Padding"),collapsible:!0,open:g,onToggle:N,dividerTop:!0,children:(0,t.jsx)(Uo,{form:e,elementSettings:i,mobilePaddingsExt:b,setMobilePaddingsExt:k,rowStyle:{paddingBottom:4}})}),i.type!=="group"&&C.formCellFieldSizeEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:B("Size"),collapsible:!0,open:c,onToggle:y,dividerTop:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:9},children:[i.type!=="structure"&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)("div",{style:{marginBottom:15},children:(0,t.jsx)(Ht,{form:e,name:"mobileWidth",elementSettings:i})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)("div",{style:{marginBottom:15},children:(0,t.jsx)(Qt,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:B("Background"),collapsible:!0,open:p,onToggle:v,dividerTop:!0,children:(0,t.jsx)(xo,{elementSettings:Ut(i),imageEnabled:C.formCellFieldBackgroundImageEnabled,desktopBackground:_o(i)})}),C.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:B("Borders"),collapsible:!0,open:l,onToggle:S,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),C.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:B("Border radius"),collapsible:!0,open:a,onToggle:x,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:h,setOneBorderRadiusValue:m,elementSettings:i,typeOfForm:"mobile"})}),C.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:B("Box shadow"),collapsible:!0,open:d,onToggle:f,dividerTop:!0,children:(0,t.jsx)(wt,{typeOfForm:"mobile"})}),C.formFieldVisibilityEnabled&&i.type!=="column"&&(0,t.jsx)(o.ui_kit$FormSection,{title:B(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,t.jsx)(Vo,{elementSettings:i,form:e,typeOfForm:"mobile"}):void 0})}),C.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:B("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};ws.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,boxShadow:_.default.object,mobileBordersShow:_.default.bool,mobileBorderRadiusShow:_.default.bool,mobileBoxShadowShow:_.default.bool,mobileSizeShow:_.default.bool,mobileBackgroundShow:_.default.bool,mobilePaddingShow:_.default.bool,mobilePaddingsExt:_.default.bool,setMobilePaddingsExt:_.default.func,oneMobileBorderRadiusValue:_.default.bool,setOneMobileBorderRadiusValue:_.default.func,toggleShowMobileBorderHandler:_.default.func,toggleShowMobileBorderRadiusHandler:_.default.func,toggleShowMobileBoxShadowHandler:_.default.func,toggleShowMobileSizeHandler:_.default.func,toggleShowMobileBackgroundHandler:_.default.func,toggleShowMobilePaddingHandler:_.default.func};var js=({elementSettings:e})=>{const{__:i}=r.useI18n(),s=r.useSendPostMessage(),l=r.useDispatch(),[a]=o.ui_kit$Form.useForm(),d=Lt(),c=Lt(),[p,g]=(0,n.useState)(""),[b,k]=(0,n.useState)({}),[h,m]=(0,n.useState)(!0),[S,x]=(0,n.useState)(!0),f=r.useSelector(r.selectEmailViewType),y=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[v,N]=(0,n.useState)(e.backgroundImage[0].value===""),B=r.useSelector(r.selectIsCodeMode),C=r.useSelector(r.selectCodeModeDirection),$=B&&C!=="bottom",[U,L]=(0,n.useState)(!1),[F,P]=(0,n.useState)(!1),[H,ae]=(0,n.useState)(!1),[T,te]=(0,n.useState)(!1),[xe,be]=(0,n.useState)(!1),[ye,me]=(0,n.useState)(!1),[he,ke]=(0,n.useState)(!1),[ce,ze]=(0,n.useState)(!1),[Oe,ve]=(0,n.useState)(!1),[Ee,pe]=(0,n.useState)(!1),[Q,X]=(0,n.useState)(!1),[Z,J]=(0,n.useState)(!1),[V,M]=(0,n.useState)(!1),[Y,K]=(0,n.useState)(!1),[ee,le]=(0,n.useState)(!1),Re=r.useElementEntityKind(),Be=[{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,z=e.mobileBorder,re=Object.keys($e).find(j=>$e[j]?.width||$e[j]?.style||$e[j]?.color),Pe=Object.keys(z).find(j=>z[j]?.width||z[j]?.style||z[j]?.color),G=j=>j&&(j?.width||j?.style||j?.color)?j:"",{remember:Se,fillFields:Fe}=ro(e);(0,n.useEffect)(()=>{if(e){const j=e.boxShadow;k(j),Fe(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:G(e.mobileBorder.all)||!(G(e.mobileBorder.top)||G(e.mobileBorder.bottom)||G(e.mobileBorder.right)||G(e.mobileBorder.left))&&G(e.border.all),mobileBorderTop:G(e.mobileBorder.top)||!G(e.mobileBorder.all)&&G(e.border.top),mobileBorderBottom:G(e.mobileBorder.bottom)||!G(e.mobileBorder.all)&&G(e.border.bottom),mobileBorderRight:G(e.mobileBorder.right)||!G(e.mobileBorder.all)&&G(e.border.right),mobileBorderLeft:G(e.mobileBorder.left)||!G(e.mobileBorder.all)&&G(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:bt(e.mobileWidth?.value)||bt(e.width?.value),mobileWidthDim:bt(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:bt(e.mobileHeight?.value)||bt(e.height?.value),mobileHeightDim:bt(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||""),...to(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))?m(!1):m(!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))?x(!1):x(!0),N(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)?L(!1):L(!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)?P(!1):P(!0);const w=d.isStaleBorderSnapshot(e,!!re),ue=c.isStaleBorderSnapshot(e,!!Pe);w&&a.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(ue||w&&!Pe)&&a.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),ae(Ie=>re&&!w?!0:Ie),te(Ie=>re&&!w||Pe&&!ue?!0:Ie),be(!!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.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),ke(!!e.boxShadow),ze(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),ve(!!e.width.value&&e.type!=="column"||!!e.height.value),pe(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value&&e.type!=="column"||!!e.height.value),X(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),J(!!e.mobileBackgroundColor.value||!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Mo(e)&&J(!0),M(!!e.exportAsPicture||!!e.isContrastBlock),K(!!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"?le(!0):le(!1)}},[a,e,re,Pe,d,c,Fe]);const Ae=(0,n.useCallback)(j=>{Se(j),l(Re==="email"?r.setElementSettings$1(j):r.setElementSettings(j))},[l,Re,Se]),Ve=j=>{const w=a.getFieldsValue(!0),ue=Object.keys(j)[0];let Ie;switch(g(a.getFieldsValue(!0).widthDim==="%"?100:""),ue){case"exportAsPicture":Ie={exportAsPicture:w.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Ie={boxShadow:{hOffset:w.boxShadowHOffset,vOffset:w.boxShadowVOffset,blurRadius:w.boxShadowBlurRadius,spreadRadius:w.boxShadowSpreadRadius,color:w.boxShadowColor,inset:w.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":w.borderPosition==="borderAll"?(Ie={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...w.borderAll}}},a.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):w.borderAll?.width||w.borderAll?.style||w.borderAll?.color?(Ie={border:{all:null,left:w.borderAll,right:w.borderAll,top:w.borderAll,bottom:w.borderAll,[W.REVERSE_BORDER_POSITIONS[ue]]:{...w[ue],...j[ue]}}},a.setFieldsValue({borderAll:null,borderLeft:w.borderAll,borderRight:w.borderAll,borderTop:w.borderAll,borderBottom:w.borderAll,[ue]:{...w[ue],...j[ue]}})):(Ie={border:{all:null,left:w.borderLeft,right:w.borderRight,top:w.borderTop,bottom:w.borderBottom,[W.REVERSE_BORDER_POSITIONS[ue]]:{...w[ue],...j[ue]}}},a.setFieldsValue({border:Ie.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(w.mobileBorderPosition==="mobileBorderAll")Ie={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...w.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[ue]+"-"}}},a.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const qe=W.MOBILE_REVERSE_BORDER_POSITIONS[ue],Ze={...w[ue],...j[ue]},dt=!Ze?.width&&!Ze?.style&&!Ze?.color;if(w.mobileBorder?.all?.width||w.mobileBorder?.all?.style||w.mobileBorder?.all?.color){const st=w.mobileBorderAll;Ie={mobileBorder:{all:null,left:st,right:st,top:st,bottom:st,[qe]:dt?null:{...Ze,classNamePrefix:"em-mob-border_"+qe+"-"}}},a.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:st,mobileBorderRight:st,mobileBorderTop:st,mobileBorderBottom:st,[ue]:Ze})}else{const st=e.mobileBorder||{},ct=kt=>{const St=st[kt];return St&&(St?.width||St?.style||St?.color)?St:null};Ie={mobileBorder:{all:null,left:qe==="left"?dt?null:{...Ze,classNamePrefix:"em-mob-border_left-"}:ct("left"),right:qe==="right"?dt?null:{...Ze,classNamePrefix:"em-mob-border_right-"}:ct("right"),top:qe==="top"?dt?null:{...Ze,classNamePrefix:"em-mob-border_top-"}:ct("top"),bottom:qe==="bottom"?dt?null:{...Ze,classNamePrefix:"em-mob-border_bottom-"}:ct("bottom")}},a.setFieldsValue({[ue]:Ze})}}break;case"width":Ie={[ue]:{value:j[ue],dim:w.widthDim}};break;case"height":Ie={[ue]:{value:j[ue],dim:w.heightDim}};break;case"widthDim":Ie={width:{value:w.width,dim:j[ue]}};break;case"heightDim":Ie={height:{value:w.height,dim:j[ue]}};break;case"backgroundImage":N(j[ue]===""),Ie={[ue]:[{...e.backgroundImage[0],value:j[ue]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":Ie={padding:{left:w.paddingLeft,right:w.paddingRight,top:w.paddingTop,bottom:w.paddingBottom,[W.PADDING_POSITION[ue]]:+j[ue]}};break;case"paddingTopBottom":Ie={padding:{left:w.paddingLeft,right:w.paddingRight,top:+j[ue],bottom:+j[ue]}},w.paddingTop=w.paddingBottom=+j[ue];break;case"paddingLeftRight":Ie={padding:{top:w.paddingTop,bottom:w.paddingBottom,left:+j[ue],right:+j[ue]}},w.paddingLeft=w.paddingRight=+j[ue];break;case"borderRadiusAll":Ie={borderRadius:{[W.BORDER_RADIUS_POSITION[ue]]:+j[ue]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Ie={borderRadius:{topLeft:w.borderRadiusTopLeft,bottomLeft:w.borderRadiusBottomLeft,topRight:w.borderRadiusTopRight,bottomRight:w.borderRadiusBottomRight,[W.BORDER_RADIUS_POSITION[ue]]:+j[ue]}};break;case"mobileWidth":Ie={[ue]:{classNamePrefix:"em-mob-width-",value:j[ue],dim:w.mobileWidthDim}};break;case"mobileWidthDim":Ie={mobileWidth:{classNamePrefix:"em-mob-width-",value:w.mobileWidth||100,dim:j[ue]}};break;case"mobileHeight":Ie={[ue]:{classNamePrefix:"em-mob-height-",value:j[ue],dim:w.mobileHeightDim}};break;case"mobileHeightDim":Ie={mobileHeight:{classNamePrefix:"em-mob-height-",value:w.mobileHeight,dim:j[ue]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Ie={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[ue]]:j[ue],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[ue]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Ie={mobileBoxShadow:{hOffset:w.mobileBoxShadowHOffset,vOffset:w.mobileBoxShadowVOffset,blurRadius:w.mobileBoxShadowBlurRadius,spreadRadius:w.mobileBoxShadowSpreadRadius,color:w.mobileBoxShadowColor,inset:w.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":Ie={[ue]:{classNamePrefix:"em-mob-text_align-",value:j[ue]}};break;case"mobileVerticalAlign":Ie={[ue]:{classNamePrefix:"em-mob-vertical_align-",value:j[ue]}};break;case"mobileDirection":Ie={[ue]:{classNamePrefix:"em-mob-direction-",value:j[ue]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Ie=fo(j),!Ie)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":Ie={mobilePadding:{all:null,top:w.mobilePaddingTop!==""?w.mobilePaddingTop:null,right:w.mobilePaddingRight!==""?w.mobilePaddingRight:null,bottom:w.mobilePaddingBottom!==""?w.mobilePaddingBottom:null,left:w.mobilePaddingLeft!==""?w.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":w.mobilePaddingTop=w.mobilePaddingBottom=j[ue],Ie={mobilePadding:{all:null,top:w.mobilePaddingTop!==""?w.mobilePaddingTop:null,right:w.mobilePaddingRight!==""?w.mobilePaddingRight:null,bottom:w.mobilePaddingBottom!==""?w.mobilePaddingBottom:null,left:w.mobilePaddingLeft!==""?w.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":w.mobilePaddingLeft=w.mobilePaddingRight=j[ue],Ie={mobilePadding:{all:null,top:w.mobilePaddingTop!==""?w.mobilePaddingTop:null,right:w.mobilePaddingRight!==""?w.mobilePaddingRight:null,bottom:w.mobilePaddingBottom!==""?w.mobilePaddingBottom:null,left:w.mobilePaddingLeft!==""?w.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"backgroundPositionX":case"backgroundPositionY":Ie={[ue]:isNaN(parseFloat(j[ue].position))?j[ue].position:j[ue].position+j[ue].unit};break;default:Ie=j}ue!=="borderPosition"&&ue!=="mobileBorderPosition"&&(s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ie}),ue!=="mobileBorderRadiusAll"&&ue!=="mobileBorderRadiusTopLeft"&&ue!=="mobileBorderRadiusTopRight"&&ue!=="mobileBorderRadiusBottomLeft"&&ue!=="mobileBorderRadiusBottomRight"&&Ae({...e,...Ie,mobileBorderRadius:{...e.mobileBorderRadius,...Ie?.mobileBorderRadius},activateSection:null,changeKey:ue}))},Ue=()=>{L(w=>!w);const j=a.getFieldsValue(!0);U||(j.paddingLeftRight=j.paddingLeft,j.paddingTopBottom=j.paddingTop,j.paddingRight=j.paddingLeft,j.paddingBottom=j.paddingTop,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:j.paddingTopBottom,bottom:j.paddingTopBottom,left:j.paddingLeftRight,right:j.paddingLeftRight}}}))},Xe=()=>{const j=a.getFieldsValue(!0);d.markBorderToggled(!H),setTimeout(()=>{ae(w=>!w),H?(j.borderAll=W.NULL_BORDER,j.borderTop=W.NULL_BORDER,j.borderBottom=W.NULL_BORDER,j.borderRight=W.NULL_BORDER,j.borderLeft=W.NULL_BORDER):j.borderAll={width:1,color:"#E5E5E5",style:"solid"},s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:j.borderAll.color,style:j.borderAll.style,width:j.borderAll.width}}}})})},ne=()=>{const j=a.getFieldsValue(!0);c.markBorderToggled(!T),setTimeout(()=>{te(w=>!w),T?(j.mobileBorderAll=W.NULL_BORDER,j.mobileBorderTop=W.NULL_BORDER,j.mobileBorderBottom=W.NULL_BORDER,j.mobileBorderRight=W.NULL_BORDER,j.mobileBorderLeft=W.NULL_BORDER):j.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:j.mobileBorderAll.color,style:j.mobileBorderAll.style,width:j.mobileBorderAll.width}}}})})},Te=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{be(w=>!w),xe?(j.borderRadiusAll=0,m(!0)):j.borderRadiusAll=5,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:j.borderRadiusAll}}})})},I=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{me(w=>!w),ye?(j.mobileBorderRadiusAll=null,x(!0)):j.mobileBorderRadiusAll=5,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:j.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},se=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{ke(w=>!w),he?(j.boxShadowInset=!1,j.boxShadowHOffset=null,j.boxShadowVOffset=null,j.boxShadowBlurRadius=null,j.boxShadowSpreadRadius=null,j.boxShadowColor=""):(j.boxShadowInset=!1,j.boxShadowHOffset=5,j.boxShadowVOffset=5,j.boxShadowBlurRadius=10,j.boxShadowSpreadRadius=-5,j.boxShadowColor="#000000"),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:j.boxShadowBlurRadius,color:j.boxShadowColor,hOffset:j.boxShadowHOffset,inset:j.boxShadowInset,spreadRadius:j.boxShadowSpreadRadius,vOffset:j.boxShadowVOffset}}})})},je=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{ze(w=>!w),ce?(j.mobileBoxShadowInset=!1,j.mobileBoxShadowHOffset=null,j.mobileBoxShadowVOffset=null,j.mobileBoxShadowBlurRadius=null,j.mobileBoxShadowSpreadRadius=null,j.mobileBoxShadowColor=""):(j.mobileBoxShadowInset=!1,j.mobileBoxShadowHOffset=5,j.mobileBoxShadowVOffset=5,j.mobileBoxShadowBlurRadius=10,j.mobileBoxShadowSpreadRadius=-5,j.mobileBoxShadowColor="#000000"),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:j.mobileBoxShadowBlurRadius,color:j.mobileBoxShadowColor,hOffset:j.mobileBoxShadowHOffset,inset:j.mobileBoxShadowInset,spreadRadius:j.mobileBoxShadowSpreadRadius,vOffset:j.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Ne=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{ve(w=>!w),Oe&&(j.width="",j.height="",s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{width:{value:null,dim:"px"},height:{value:null,dim:"px"}}}))})},He=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{pe(w=>!w),Ee&&(j.mobileWidth="",j.mobileHeight="",s({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-"}}}))})},Ke=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{X(w=>!w),Q?(j.backgroundColor="",j.backgroundImage="",j.backgroundPositionX="",j.backgroundPositionY="",j.backgroundRepeat="none",j.backgroundSize="",N(!0)):(j.backgroundColor="#E5E5E5",j.backgroundSize="",j.backgroundRepeat="none"),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:j.backgroundColor,backgroundImage:[{type:"url",value:j.backgroundImage}],backgroundPositionX:j.backgroundPositionX,backgroundPositionY:j.backgroundPositionY,backgroundRepeat:j.backgroundRepeat,backgroundSize:j.backgroundSize}})})},tt=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{J(w=>!w),Z?j.mobileBackgroundColor="":j.mobileBackgroundColor="#E5E5E5",s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:j.mobileBackgroundColor}}}),Z&&Do(a,e,s)})},O=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{M(w=>!w),V&&(j.exportAsPicture=!1,j.isContrastBlock=!1,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1,isContrastBlock:!1}}))})},ie=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{K(w=>!w),Y&&(j.mobilePaddingLeftRight="",j.mobilePaddingLeft="",j.mobilePaddingRight="",j.mobilePaddingTopBottom="",j.mobilePaddingTop="",j.mobilePaddingBottom="",s({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,t.jsx)(o.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[re]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[Pe]||"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:Ve,autoComplete:"off",className:"element-controls",children:f==="mobile"&&y.styles?(0,t.jsxs)("div",{className:"selected_form-mobile-props-wrapper",style:{display:f==="mobile"&&y.styles?"flex":"none"},children:[(0,t.jsx)("div",{className:"selected_form-mobile-props-header",children:!$&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})})}),(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,t.jsx)(ws,{form:a,elementSettings:e,boxShadow:b,mobileBordersShow:T,mobileBorderRadiusShow:ye,mobileBoxShadowShow:ce,mobileSizeShow:Ee,mobileBackgroundShow:Z,mobilePaddingShow:Y,mobilePaddingsExt:F,setMobilePaddingsExt:P,oneMobileBorderRadiusValue:S,setOneMobileBorderRadiusValue:x,toggleShowMobileBorderHandler:ne,toggleShowMobileBorderRadiusHandler:I,toggleShowMobileBoxShadowHandler:je,toggleShowMobileSizeHandler:He,toggleShowMobileBackgroundHandler:tt,toggleShowMobilePaddingHandler:ie})})]}):(0,t.jsxs)(t.Fragment,{children:[!$&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(ys,{form:a,elementSettings:e,boxShadow:b,bordersShow:H,borderRadiusShow:xe,boxShadowShow:he,backgroundShow:Q,backgroundImageEmpty:v,backgroundRepeatOptions:Be,sizeShow:Oe,maxWidthValue:p,modificationShow:V,paddingsExt:U,oneBorderRadiusValue:h,setOneBorderRadiusValue:m,elementListShow:ee,togglePaddingHandler:Ue,toggleShowBorderHandler:Xe,toggleShowBorderRadiusHandler:Te,toggleShowBoxShadowHandler:se,toggleShowSizeHandler:Ne,toggleShowBackgroundHandler:Ke,toggleShowModificationHandler:O,handleChangeValues:Ve})})]})})};js.propTypes={elementSettings:_.default.object.isRequired};var vs=({form:e,elementSettings:i,boxShadow:s,bordersShow:l,borderRadiusShow:a,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:p,backgroundRepeatOptions:g,sizeShow:b,maxWidthValue:k,modificationShow:h,paddingShow:m,paddingsExt:S,oneBorderRadiusValue:x,setOneBorderRadiusValue:f,togglePaddingHandler:y,toggleShowPaddingHandler:v,toggleShowBorderHandler:N,toggleShowBorderRadiusHandler:B,toggleShowBoxShadowHandler:C,toggleShowSizeHandler:$,toggleShowBackgroundHandler:U,toggleShowModificationHandler:L,handleChangeValues:F})=>{const{__:P}=r.useI18n(),{token:H}=(0,o.ui_kit$useToken)(),ae=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:P("Appearance on mobile devices"),type:"info"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Zt,{form:e,elementSettings:i})}),(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Ot,{form:e,elementSettings:i})})]}),ae.formCellFieldPaddingsEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Padding"),collapsible:!0,open:m,onToggle:v,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormPaddingInputs,{extended:S,onToggleExtended:y,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,t.jsx)(o.ui_kit$FormSection,{title:P("Size"),collapsible:!0,open:b,onToggle:$,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormSizeInputs,{maxWidth:k,dimensionSelect:Nt,showMinMax:!0,minWidthDimensionSelect:Nt,maxWidthDimensionSelect:Nt,labels:{width:P("Width"),height:P("Height"),minWidth:P("Minimum width"),maxWidth:P("Maximum width")}})}),(0,t.jsxs)(o.ui_kit$FormSection,{title:P("Background"),collapsible:!0,open:c,onToggle:U,dividerTop:!0,children:[(0,t.jsx)($i,{form:e,backgroundImageEmpty:p,appConfig:ae,token:H,elementSettings:i,backgroundRepeatOptions:g,handleChangeValues:F}),(0,t.jsx)(eo,{form:e,showBackground:!0})]}),ae.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Borders"),collapsible:!0,open:l,onToggle:N,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),ae.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Border radius"),collapsible:!0,open:a,onToggle:B,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:x,setOneBorderRadiusValue:f,elementSettings:i})}),ae.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Box shadow"),collapsible:!0,open:d,onToggle:C,dividerTop:!0,children:(0,t.jsx)(wt,{})}),ae.formFieldExportAsPictureEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Export settings"),collapsible:!0,open:h,onToggle:L,dividerTop:!0,children:(0,t.jsx)(Ni,{form:e,elementSettings:i})}),ae.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("Display control & Direction"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e,directionControl:(0,t.jsx)(Vo,{elementSettings:i,form:e})})}),ae.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:P("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};vs.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,boxShadow:_.default.object,bordersShow:_.default.bool,borderRadiusShow:_.default.bool,boxShadowShow:_.default.bool,backgroundShow:_.default.bool,backgroundImageEmpty:_.default.bool,backgroundRepeatOptions:_.default.array,sizeShow:_.default.bool,maxWidthValue:_.default.oneOfType([_.default.string,_.default.number]),modificationShow:_.default.bool,paddingShow:_.default.bool,paddingsExt:_.default.bool,oneBorderRadiusValue:_.default.bool,setOneBorderRadiusValue:_.default.func,togglePaddingHandler:_.default.func,toggleShowPaddingHandler:_.default.func,toggleShowBorderHandler:_.default.func,toggleShowBorderRadiusHandler:_.default.func,toggleShowBoxShadowHandler:_.default.func,toggleShowSizeHandler:_.default.func,toggleShowBackgroundHandler:_.default.func,toggleShowModificationHandler:_.default.func,handleChangeValues:_.default.func};var Is=({form:e,elementSettings:i,mobileBoxShadow:s,mobileBordersShow:l,mobileBorderRadiusShow:a,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:p,mobilePaddingShow:g,mobilePaddingsExt:b,setMobilePaddingsExt:k,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:m,toggleShowMobileBorderHandler:S,toggleShowMobileBorderRadiusHandler:x,toggleShowMobileBoxShadowHandler:f,toggleShowMobileSizeHandler:y,toggleShowMobileBackgroundHandler:v,toggleShowMobilePaddingHandler:N})=>{const{__:B}=r.useI18n(),{token:C}=(0,o.ui_kit$useToken)(),$=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:20,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)($o,{form:e,elementSettings:i,imgParent:!0})}),(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Ot,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),$.formCellFieldPaddingsEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:B("Padding"),collapsible:!0,open:g,onToggle:N,dividerTop:!0,children:(0,t.jsx)(Uo,{form:e,elementSettings:i,mobilePaddingsExt:b,setMobilePaddingsExt:k})}),(0,t.jsx)(o.ui_kit$FormSection,{title:B("Size"),collapsible:!0,open:c,onToggle:y,dividerTop:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:8},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)("div",{style:{marginBottom:C.formItemMarginBottomXS*2},children:(0,t.jsx)(Ht,{form:e,name:"mobileWidth",elementSettings:i})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)("div",{style:{marginBottom:C.formItemMarginBottomXS},children:(0,t.jsx)(Qt,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:B("Background"),collapsible:!0,open:p,onToggle:v,dividerTop:!0,children:(0,t.jsx)(xo,{elementSettings:Ut(i),imageEnabled:$.formDivFieldBackgroundImageEnabled,desktopBackground:_o(i)})}),$.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:B("Borders"),collapsible:!0,open:l,onToggle:S,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),$.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:B("Border radius"),collapsible:!0,open:a,onToggle:x,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:h,setOneBorderRadiusValue:m,elementSettings:i})}),$.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:B("Box shadow"),collapsible:!0,open:d,onToggle:f,dividerTop:!0,children:(0,t.jsx)(wt,{typeOfForm:"mobile",form:e,elementSettings:i})}),$.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:B("Display control & Direction"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e,directionControl:(0,t.jsx)(Vo,{elementSettings:i,form:e,typeOfForm:"mobile"})})}),$.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:B("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};Is.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,mobileBoxShadow:_.default.object,mobileBordersShow:_.default.bool,mobileBorderRadiusShow:_.default.bool,mobileBoxShadowShow:_.default.bool,mobileSizeShow:_.default.bool,mobileBackgroundShow:_.default.bool,mobilePaddingShow:_.default.bool,mobilePaddingsExt:_.default.bool,setMobilePaddingsExt:_.default.func,oneMobileBorderRadiusValue:_.default.bool,setOneMobileBorderRadiusValue:_.default.func,toggleShowMobileBorderHandler:_.default.func,toggleShowMobileBorderRadiusHandler:_.default.func,toggleShowMobileBoxShadowHandler:_.default.func,toggleShowMobileSizeHandler:_.default.func,toggleShowMobileBackgroundHandler:_.default.func,toggleShowMobilePaddingHandler:_.default.func};var Cs=({elementSettings:e})=>{const{__:i}=r.useI18n(),s=r.useSendPostMessage(),[l]=o.ui_kit$Form.useForm(),a=Lt(),d=Lt(),[c,p]=(0,n.useState)({}),[g,b]=(0,n.useState)(!0),[k,h]=(0,n.useState)({}),[m,S]=(0,n.useState)(!0),x=r.useSelector(r.selectEmailViewType),f=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[y,v]=(0,n.useState)(e.backgroundImage[0].value===""),N=r.useSelector(r.selectIsCodeMode),B=r.useSelector(r.selectCodeModeDirection),C=N&&B!=="bottom",[$,U]=(0,n.useState)(!1),[L,F]=(0,n.useState)(!1),[P,H]=(0,n.useState)(!1),[ae,T]=(0,n.useState)(!1),[te,xe]=(0,n.useState)(!1),[be,ye]=(0,n.useState)(!1),[me,he]=(0,n.useState)(!1),[ke,ce]=(0,n.useState)(!1),[ze,Oe]=(0,n.useState)(!1),[ve,Ee]=(0,n.useState)(!1),[pe,Q]=(0,n.useState)(!1),[X,Z]=(0,n.useState)(!1),[J,V]=(0,n.useState)(!1),[M,Y]=(0,n.useState)(!1),[K,ee]=(0,n.useState)(!1),[le,Re]=(0,n.useState)(""),Be=[{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,z=e.mobileBorder,re=Object.keys($e).find(O=>$e[O]?.width||$e[O]?.style||$e[O]?.color),Pe=Object.keys(z).find(O=>z[O]?.width||z[O]?.style||z[O]?.color),G=O=>O&&(O?.width||O?.style||O?.color)?O:"";(0,n.useEffect)(()=>{if(e){const O=e.boxShadow,ie=e.mobileBoxShadow;p(O),h(ie),l.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:G(e.mobileBorder.all)||!(G(e.mobileBorder.top)||G(e.mobileBorder.bottom)||G(e.mobileBorder.right)||G(e.mobileBorder.left))&&G(e.border.all),mobileBorderTop:G(e.mobileBorder.top)||!G(e.mobileBorder.all)&&G(e.border.top),mobileBorderBottom:G(e.mobileBorder.bottom)||!G(e.mobileBorder.all)&&G(e.border.bottom),mobileBorderRight:G(e.mobileBorder.right)||!G(e.mobileBorder.all)&&G(e.border.right),mobileBorderLeft:G(e.mobileBorder.left)||!G(e.mobileBorder.all)&&G(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:bt(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileHeight:bt(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:""),...to(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))?b(!1):b(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))?S(!1):S(!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)?U(!1):U(!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)?F(!1):F(!0);const j=a.isStaleBorderSnapshot(e,!!re),w=d.isStaleBorderSnapshot(e,!!Pe);j&&l.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(w||j&&!Pe)&&l.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),H(ue=>re&&!j?!0:ue),T(ue=>re&&!j||Pe&&!w?!0:ue),xe(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),ye(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),he(!!e.boxShadow),ce(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),Oe(!!e.width.value||!!e.height.value||!!e.minWidth.value||!!e.maxWidth.value),Ee(!!e.mobileWidth.value||!!e.mobileHeight.value),Q(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Z(Mo(e)),V(!!e.exportAsPicture),Y(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),ee(!!e.mobilePadding.all||!!e.mobilePadding.top||!!e.mobilePadding.bottom||!!e.mobilePadding.left||!!e.mobilePadding.right)}},[l,e,re,Pe,a,d]);const Se=O=>{const ie=l.getFieldsValue(!0),j=Object.keys(O)[0];let w;switch(Re(l.getFieldsValue(!0).widthDim==="%"?100:""),j){case"exportAsPicture":w={exportAsPicture:ie.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":w={boxShadow:{hOffset:ie.boxShadowHOffset,vOffset:ie.boxShadowVOffset,blurRadius:ie.boxShadowBlurRadius,spreadRadius:ie.boxShadowSpreadRadius,color:ie.boxShadowColor,inset:ie.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":ie.borderPosition==="borderAll"?(w={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...ie.borderAll}}},l.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):ie.borderAll?.width||ie.borderAll?.style||ie.borderAll?.color?(w={border:{all:null,left:ie.borderAll,right:ie.borderAll,top:ie.borderAll,bottom:ie.borderAll,[W.REVERSE_BORDER_POSITIONS[j]]:{...ie[j],...O[j]}}},l.setFieldsValue({borderAll:null,borderLeft:ie.borderAll,borderRight:ie.borderAll,borderTop:ie.borderAll,borderBottom:ie.borderAll,[j]:{...ie[j],...O[j]}})):(w={border:{all:null,left:ie.borderLeft,right:ie.borderRight,top:ie.borderTop,bottom:ie.borderBottom,[W.REVERSE_BORDER_POSITIONS[j]]:{...ie[j],...O[j]}}},l.setFieldsValue({border:w.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(ie.mobileBorderPosition==="mobileBorderAll")w={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...ie.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[j]+"-"}}},l.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const ue=W.MOBILE_REVERSE_BORDER_POSITIONS[j],Ie={...ie[j],...O[j]},qe=!Ie?.width&&!Ie?.style&&!Ie?.color;if(ie.mobileBorder?.all?.width||ie.mobileBorder?.all?.style||ie.mobileBorder?.all?.color){const Ze=ie.mobileBorderAll;w={mobileBorder:{all:null,left:Ze,right:Ze,top:Ze,bottom:Ze,[ue]:qe?null:{...Ie,classNamePrefix:"em-mob-border_"+ue+"-"}}},l.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:Ze,mobileBorderRight:Ze,mobileBorderTop:Ze,mobileBorderBottom:Ze,[j]:Ie})}else{const Ze=e.mobileBorder||{},dt=st=>{const ct=Ze[st];return ct&&(ct?.width||ct?.style||ct?.color)?ct:null};w={mobileBorder:{all:null,left:ue==="left"?qe?null:{...Ie,classNamePrefix:"em-mob-border_left-"}:dt("left"),right:ue==="right"?qe?null:{...Ie,classNamePrefix:"em-mob-border_right-"}:dt("right"),top:ue==="top"?qe?null:{...Ie,classNamePrefix:"em-mob-border_top-"}:dt("top"),bottom:ue==="bottom"?qe?null:{...Ie,classNamePrefix:"em-mob-border_bottom-"}:dt("bottom")}},l.setFieldsValue({[j]:Ie})}}break;case"width":w={[j]:{value:O[j],dim:ie.widthDim}};break;case"height":w={[j]:{value:O[j],dim:ie.heightDim}};break;case"widthDim":w={width:{value:ie.width,dim:O[j]}};break;case"heightDim":w={height:{value:ie.height,dim:O[j]}};break;case"maxWidth":w={[j]:{value:O[j],dim:ie.maxWidthDim}};break;case"maxWidthDim":w={maxWidth:{value:ie.maxWidth,dim:O[j]}};break;case"minWidth":w={[j]:{value:O[j],dim:ie.minWidthDim}};break;case"minWidthDim":w={minWidth:{value:ie.minWidth,dim:O[j]}};break;case"backgroundImage":v(O[j]===""),w={[j]:[{...e.backgroundImage[0],value:O[j]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":w={padding:{[W.PADDING_POSITION[j]]:+O[j]}};break;case"paddingTopBottom":w={padding:{top:+O[j],bottom:+O[j]}},ie.paddingTop=ie.paddingBottom=+O[j];break;case"paddingLeftRight":w={padding:{left:+O[j],right:+O[j]}},ie.paddingLeft=ie.paddingRight=+O[j];break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":w={borderRadius:{[W.BORDER_RADIUS_POSITION[j]]:+O[j]}};break;case"mobileWidth":w={[j]:{classNamePrefix:"em-mob-width-",value:O[j],dim:ie.mobileWidthDim}};break;case"mobileWidthDim":w={mobileWidth:{classNamePrefix:"em-mob-width-",value:ie.mobileWidth||100,dim:O[j]}};break;case"mobileHeight":w={[j]:{classNamePrefix:"em-mob-height-",value:O[j],dim:ie.mobileHeightDim}};break;case"mobileHeightDim":w={mobileHeight:{classNamePrefix:"em-mob-height-",value:ie.mobileHeight,dim:O[j]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":w={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[j]]:O[j],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[j]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":w={mobileBoxShadow:{hOffset:ie.mobileBoxShadowHOffset,vOffset:ie.mobileBoxShadowVOffset,blurRadius:ie.mobileBoxShadowBlurRadius,spreadRadius:ie.mobileBoxShadowSpreadRadius,color:ie.mobileBoxShadowColor,inset:ie.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":w={[j]:{classNamePrefix:"em-mob-text_align-",value:O[j]}};break;case"mobileVerticalAlign":w={[j]:{classNamePrefix:"em-mob-vertical_align-",value:O[j]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(w=fo(O),!w)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":w={mobilePadding:{all:null,top:ie.mobilePaddingTop!==""?ie.mobilePaddingTop:null,right:ie.mobilePaddingRight!==""?ie.mobilePaddingRight:null,bottom:ie.mobilePaddingBottom!==""?ie.mobilePaddingBottom:null,left:ie.mobilePaddingLeft!==""?ie.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":ie.mobilePaddingTop=ie.mobilePaddingBottom=O[j],w={mobilePadding:{all:null,top:ie.mobilePaddingTop!==""?ie.mobilePaddingTop:null,right:ie.mobilePaddingRight!==""?ie.mobilePaddingRight:null,bottom:ie.mobilePaddingBottom!==""?ie.mobilePaddingBottom:null,left:ie.mobilePaddingLeft!==""?ie.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":ie.mobilePaddingLeft=ie.mobilePaddingRight=O[j],w={mobilePadding:{all:null,top:ie.mobilePaddingTop!==""?ie.mobilePaddingTop:null,right:ie.mobilePaddingRight!==""?ie.mobilePaddingRight:null,bottom:ie.mobilePaddingBottom!==""?ie.mobilePaddingBottom:null,left:ie.mobilePaddingLeft!==""?ie.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileDirection":w={[j]:{classNamePrefix:"em-mob-direction-",value:O[j]}};break;case"backgroundPositionX":case"backgroundPositionY":w={[j]:isNaN(parseFloat(O[j].position))?O[j].position:O[j].position+O[j].unit};break;default:w=O}j!=="borderPosition"&&j!=="mobileBorderPosition"&&s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:w})},Fe=()=>{U(ie=>!ie);const O=l.getFieldsValue(!0);$||(O.paddingLeftRight=O.paddingLeft,O.paddingTopBottom=O.paddingTop,O.paddingRight=O.paddingLeft,O.paddingBottom=O.paddingTop,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:O.paddingTopBottom,bottom:O.paddingTopBottom,left:O.paddingLeftRight,right:O.paddingLeftRight}}}))},Ae=()=>{const O=l.getFieldsValue(!0);a.markBorderToggled(!P),setTimeout(()=>{H(ie=>!ie),P?(O.borderAll=W.NULL_BORDER,O.borderTop=W.NULL_BORDER,O.borderBottom=W.NULL_BORDER,O.borderRight=W.NULL_BORDER,O.borderLeft=W.NULL_BORDER):O.borderAll={width:1,color:"#E5E5E5",style:"solid"},s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:O.borderAll.color,style:O.borderAll.style,width:O.borderAll.width}}}})})},Ve=()=>{const O=l.getFieldsValue(!0);d.markBorderToggled(!ae),setTimeout(()=>{T(ie=>!ie),ae?(O.mobileBorderAll=W.NULL_BORDER,O.mobileBorderTop=W.NULL_BORDER,O.mobileBorderBottom=W.NULL_BORDER,O.mobileBorderRight=W.NULL_BORDER,O.mobileBorderLeft=W.NULL_BORDER):O.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:O.mobileBorderAll.color,style:O.mobileBorderAll.style,width:O.mobileBorderAll.width}}}})})},Ue=()=>{const O=l.getFieldsValue(!0);setTimeout(()=>{xe(ie=>!ie),te?(O.borderRadiusAll=0,b(!0)):O.borderRadiusAll=5,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:O.borderRadiusAll}}})})},Xe=()=>{const O=l.getFieldsValue(!0);setTimeout(()=>{ye(ie=>!ie),be?(O.mobileBorderRadiusAll=null,S(!0)):O.mobileBorderRadiusAll=5,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:O.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},ne=()=>{const O=l.getFieldsValue(!0);setTimeout(()=>{he(ie=>!ie),me?(O.boxShadowInset=!1,O.boxShadowHOffset=null,O.boxShadowVOffset=null,O.boxShadowBlurRadius=null,O.boxShadowSpreadRadius=null,O.boxShadowColor=""):(O.boxShadowInset=!1,O.boxShadowHOffset=5,O.boxShadowVOffset=5,O.boxShadowBlurRadius=10,O.boxShadowSpreadRadius=-5,O.boxShadowColor="#000000"),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:O.boxShadowBlurRadius,color:O.boxShadowColor,hOffset:O.boxShadowHOffset,inset:O.boxShadowInset,spreadRadius:O.boxShadowSpreadRadius,vOffset:O.boxShadowVOffset}}})})},Te=()=>{const O=l.getFieldsValue(!0);setTimeout(()=>{ce(ie=>!ie),ke?(O.mobileBoxShadowInset=!1,O.mobileBoxShadowHOffset=null,O.mobileBoxShadowVOffset=null,O.mobileBoxShadowBlurRadius=null,O.mobileBoxShadowSpreadRadius=null,O.mobileBoxShadowColor=""):(O.mobileBoxShadowInset=!1,O.mobileBoxShadowHOffset=5,O.mobileBoxShadowVOffset=5,O.mobileBoxShadowBlurRadius=10,O.mobileBoxShadowSpreadRadius=-5,O.mobileBoxShadowColor="#000000"),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:O.mobileBoxShadowBlurRadius,color:O.mobileBoxShadowColor,hOffset:O.mobileBoxShadowHOffset,inset:O.mobileBoxShadowInset,spreadRadius:O.mobileBoxShadowSpreadRadius,vOffset:O.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},I=()=>{setTimeout(()=>{Oe(O=>!O)})},se=()=>{setTimeout(()=>{Ee(O=>!O)})},je=()=>{const O=l.getFieldsValue(!0);setTimeout(()=>{Q(ie=>!ie),pe?(O.backgroundColor="",O.backgroundImage="",O.backgroundPositionX="",O.backgroundPositionY="",O.backgroundRepeat="none",O.backgroundSize="",v(!0)):(O.backgroundColor="#E5E5E5",O.backgroundSize="",O.backgroundRepeat="none"),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:O.backgroundColor,backgroundImage:[{type:"url",value:O.backgroundImage}],backgroundPositionX:O.backgroundPositionX,backgroundPositionY:O.backgroundPositionY,backgroundRepeat:O.backgroundRepeat,backgroundSize:O.backgroundSize}})})},Ne=()=>{const O=l.getFieldsValue(!0);setTimeout(()=>{Z(ie=>!ie),X?O.mobileBackgroundColor="":O.mobileBackgroundColor="#E5E5E5",s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:O.mobileBackgroundColor}}}),X&&Do(l,e,s)})},He=()=>{const O=l.getFieldsValue(!0);setTimeout(()=>{V(ie=>!ie),J&&(O.exportAsPicture=!1,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})},Ke=()=>{const O=l.getFieldsValue(!0);setTimeout(()=>{Y(ie=>!ie),M&&(O.paddingLeftRight="",O.paddingLeft="",O.paddingRight="",O.paddingTopBottom="",O.paddingTop="",O.paddingBottom="",s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},tt=()=>{const O=l.getFieldsValue(!0);setTimeout(()=>{ee(ie=>!ie),K&&(O.mobilePaddingLeftRight="",O.mobilePaddingLeft="",O.mobilePaddingRight="",O.mobilePaddingTopBottom="",O.mobilePaddingTop="",O.mobilePaddingBottom="",s({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,t.jsxs)(o.ui_kit$Form,{form:l,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[re]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[Pe]||"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,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),x==="mobile"&&f.styles?(0,t.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,t.jsx)(Is,{form:l,elementSettings:e,mobileBoxShadow:k,mobileBordersShow:ae,mobileBorderRadiusShow:be,mobileBoxShadowShow:ke,mobileSizeShow:ve,mobileBackgroundShow:X,mobilePaddingShow:K,mobilePaddingsExt:L,setMobilePaddingsExt:F,oneMobileBorderRadiusValue:m,setOneMobileBorderRadiusValue:S,toggleShowMobileBorderHandler:Ve,toggleShowMobileBorderRadiusHandler:Xe,toggleShowMobileBoxShadowHandler:Te,toggleShowMobileSizeHandler:se,toggleShowMobileBackgroundHandler:Ne,toggleShowMobilePaddingHandler:tt})," "]}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(vs,{form:l,elementSettings:e,boxShadow:c,bordersShow:P,borderRadiusShow:te,boxShadowShow:me,backgroundShow:pe,backgroundImageEmpty:y,backgroundRepeatOptions:Be,sizeShow:ze,maxWidthValue:le,modificationShow:J,paddingShow:M,paddingsExt:$,oneBorderRadiusValue:g,setOneBorderRadiusValue:b,togglePaddingHandler:Fe,toggleShowPaddingHandler:Ke,toggleShowBorderHandler:Ae,toggleShowBorderRadiusHandler:Ue,toggleShowBoxShadowHandler:ne,toggleShowSizeHandler:I,toggleShowBackgroundHandler:je,toggleShowModificationHandler:He,handleChangeValues:Se})})]})};Cs.propTypes={elementSettings:_.default.object.isRequired};var Ps=({form:e,elementSettings:i})=>{const{__:s}=r.useI18n(),l=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:"0"},children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:s("Float block width"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"width",children:(0,t.jsx)(o.ui_kit$InputNumber,{min:0,placeholder:s("Float block width"),prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:(0,t.jsx)(o.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:Nt})})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:s("Column gap"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"gap",children:(0,t.jsx)(o.ui_kit$InputNumber,{min:0,placeholder:s("Column gap"),prefix:(0,t.jsx)(r.EmIcons,{icon:"SplitCellsOutlined",component:o.icons$SplitCellsOutlined}),addonAfter:(0,t.jsx)(o.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:ad})})})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:s("Vertical alignment"),dividerTop:!0,children:(0,t.jsx)(Ot,{form:e,elementSettings:i})}),(0,t.jsx)(o.ui_kit$FormSection,{title:s("Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e})}),l.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:s("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};Ps.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired};var As=({form:e,elementSettings:i})=>{const{__:s}=r.useI18n(),l=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{marginBottom:20},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Ht,{form:e,name:"mobileWidth",elementSettings:i})}),(0,t.jsx)(o.ui_kit$Col,{span:12})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:s("Alignments"),dividerTop:!0,children:(0,t.jsx)(Ot,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,t.jsx)(o.ui_kit$FormSection,{title:s("Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e})}),l.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:s("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};As.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired};var Fi=0,Ns=({elementSettings:e})=>{const{__:i}=r.useI18n(),s=r.useSendPostMessage(),[l]=o.ui_kit$Form.useForm(),a=r.useSelector(r.selectEmailViewType),d=r.useSelector(r.selectMobileViewActive),c=r.useSelector(r.selectIsCodeMode),p=r.useSelector(r.selectCodeModeDirection),g=c&&p!=="bottom";(0,n.useEffect)(()=>{e&&(l.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:bt(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileContentWidth:bt(e.mobileContentWidth?.value),mobileContentWidthDim:e.mobileContentWidth?.dim,mobileVerticalAlign:u(e.mobileVerticalAlign?.value)}),Fi=e.width.value+e.gap.value)},[l,e]);const b=k=>{const h=l.getFieldsValue(!0),m=Object.keys(k)[0];let S;switch(m){case"width":Fi=k[m]+h.gap,S={[m]:{value:k[m],dim:h.widthDim},gap:{value:h.gap}};break;case"widthDim":S={width:{value:h.width,dim:k[m]},gap:{value:h.gap}};break;case"gap":h.width=Fi-k[m],S={[m]:{value:k[m],dim:"px"}};break;case"mobileWidth":S={[m]:{classNamePrefix:"em-mob-width-",value:k[m],dim:h.mobileWidthDim}};break;case"mobileWidthDim":S={mobileWidth:{classNamePrefix:"em-mob-width-",value:h.mobileWidth||100,dim:k[m]}};break;case"mobileContentWidth":S={[m]:{classNamePrefix:"em-mob-width-",value:k[m],dim:h.mobileContentWidthDim}};break;case"mobileContentWidthDim":S={mobileContentWidth:{classNamePrefix:"em-mob-width-",value:100,dim:k[m]}};break;case"mobileVerticalAlign":S={[m]:{classNamePrefix:"em-mob-vertical_align-",value:k[m]}};break;default:S=k}s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:S})};return(0,t.jsxs)(o.ui_kit$Form,{form:l,layout:"vertical",name:"selected_float_block_form",initialValues:{width:{value:"",dim:""},gap:{value:"",dim:"px"},valign:"",show:"all",mobileWidth:"",mobileWidthDim:"",mobileContentWidth:"",mobileContentWidthDim:"",mobileVerticalAlign:""},onValuesChange:b,autoComplete:"off",className:"element-controls",children:[!g&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),a==="mobile"&&d.styles?(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:a==="mobile"&&d.styles?"block":"none"},children:(0,t.jsx)(As,{form:l,elementSettings:e})}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(Ps,{form:l,elementSettings:e})})]})};Ns.propTypes={elementSettings:_.default.object.isRequired};var Ls=({form:e,fillFields:i,elementSettings:s,boxShadow:l,bordersShow:a,borderRadiusShow:d,boxShadowShow:c,backgroundShow:p,backgroundImageEmpty:g,backgroundRepeatOptions:b,paddingShow:k,paddingsExt:h,maxWidthValue:m,oneBorderRadiusValue:S,setOneBorderRadiusValue:x,linkProtocol:f,linkTarget:y,isOpenTextReplacer:v,textReplacerButtonRef:N,textReplacerInputRef:B,handleLinkProtocolsChange:C,handleSelect:$,textReplacerInputHandler:U,handleTextReplacerKeyDown:L,srcButtonHandler:F,togglePaddingHandler:P,toggleShowPaddingHandler:H,toggleShowBackgroundHandler:ae,toggleShowBorderHandler:T,toggleShowBorderRadiusHandler:te,toggleShowBoxShadowHandler:xe,setLinkProtocol:be,handleChangeValues:ye})=>{const{__:me}=r.useI18n(),{token:he}=(0,o.ui_kit$useToken)(),ke=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:me("Appearance on mobile devices"),type:"info"}),(0,t.jsxs)("div",{className:"selected_form-props-wrapper",children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Dt,{form:e,elementSettings:s})}),ke.formButtonFieldTextAlignEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)(Zt,{form:e,name:"textAlign",elementSettings:s})})]}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}}),(0,t.jsx)(qt,{show:f==="#",__:me,style:{marginBottom:he.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:me("Hyperlink URL"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"href",style:{marginBottom:ke.formButtonFieldReplacerEnabled?he.formItemMarginBottomXS:he.formItemMarginBottomMD+4},children:(0,t.jsx)(o.ui_kit$Input,{addonBefore:(0,t.jsx)(Kt,{linkProtocol:f,handleLinkProtocolsChange:C,__:me}),placeholder:me("Hyperlink URL"),allowClear:!0,onSelect:$,prefix:(0,t.jsx)(Xt,{linkProtocol:f})})})}),f==="mailto:"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:"subject",style:{marginBottom:he.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:me("Subject")})}),(0,t.jsx)(o.ui_kit$Form.Item,{name:"body",style:{marginBottom:he.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$TextArea,{rows:3,placeholder:me("Body")})})]}),ke.formButtonFieldReplacerEnabled&&(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:me("Text replacer"),placement:"bottom",getPopupContainer:ce=>ce.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":v}),icon:(0,t.jsx)(r.EmIcons,{icon:"Replacer",component:o.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:F,ref:N})})}),(0,t.jsx)(o.ui_kit$Col,{span:21,children:v&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:me("Text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textReplacer",children:(0,t.jsx)(o.ui_kit$Input,{placeholder:me("The code that will replace this text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:me("Text")}),onChange:U,onKeyDown:L,ref:B,onSelect:$})})})})]})}),ke.formButtonFieldPaddingsEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:me("Padding"),collapsible:!0,open:k,onToggle:H,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormPaddingInputs,{extended:h,onToggleExtended:P,gutter:he.marginSM,labels:{horizontal:me("Horizontal padding"),vertical:me("Vertical padding"),left:me("Left padding"),right:me("Right padding"),top:me("Top padding"),bottom:me("Bottom padding"),individual:me("Individual padding")}})}),(0,t.jsx)(o.ui_kit$FormSection,{title:me("Size"),dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormSizeInputs,{maxWidth:m,dimensionSelect:Nt,gutter:he.marginSM,labels:{width:me("Width"),height:me("Height"),minWidth:me("Minimum width"),maxWidth:me("Maximum width")}})}),(0,t.jsx)(go,{form:e,fillFields:i,elementSettings:s,showAddParagraph:!1,isButton:!0,setLinkProtocol:be,linkProtocol:f,linkTarget:y}),(0,t.jsxs)(o.ui_kit$FormSection,{title:me("Background"),collapsible:!0,open:p,onToggle:ae,dividerTop:!0,children:[(0,t.jsx)($i,{form:e,backgroundImageEmpty:g,appConfig:ke,token:he,elementSettings:s,backgroundRepeatOptions:b,handleChangeValues:ye}),(0,t.jsx)(eo,{form:e,showBackground:!0})]}),ke.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:me("Borders"),collapsible:!0,open:a,onToggle:T,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:s})}),ke.formFieldBorderRadiusEnabled&&(0,t.jsxs)(o.ui_kit$FormSection,{title:me("Border radius"),collapsible:!0,open:d,onToggle:te,dividerTop:!0,children:[(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:S,setOneBorderRadiusValue:x,elementSettings:s}),(0,t.jsx)(eo,{form:e,showRounding:!0})]}),ke.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:me("Box shadow"),collapsible:!0,open:c,onToggle:xe,dividerTop:!0,children:(0,t.jsx)(wt,{})}),ke.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:me("Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:s,form:e})}),ke.formFieldAmpVisibilityEnabled&&s.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:me("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})]})};Ls.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,boxShadow:_.default.object,bordersShow:_.default.bool,borderRadiusShow:_.default.bool,boxShadowShow:_.default.bool,backgroundShow:_.default.bool,backgroundImageEmpty:_.default.bool,backgroundRepeatOptions:_.default.array,paddingShow:_.default.bool,paddingsExt:_.default.bool,maxWidthValue:_.default.oneOfType([_.default.string,_.default.number]),oneBorderRadiusValue:_.default.bool,setOneBorderRadiusValue:_.default.func,linkProtocol:_.default.string,linkTarget:_.default.object,isOpenTextReplacer:_.default.bool,textReplacerButtonRef:_.default.object,textReplacerInputRef:_.default.object,handleLinkProtocolsChange:_.default.func,handleSelect:_.default.func,textReplacerInputHandler:_.default.func,handleTextReplacerKeyDown:_.default.func,srcButtonHandler:_.default.func,togglePaddingHandler:_.default.func,toggleShowPaddingHandler:_.default.func,toggleShowBackgroundHandler:_.default.func,toggleShowBorderHandler:_.default.func,toggleShowBorderRadiusHandler:_.default.func,toggleShowBoxShadowHandler:_.default.func,setLinkProtocol:_.default.func,handleChangeValues:_.default.func};var Os=({form:e,fillFields:i,elementSettings:s,boxShadow:l,mobileBordersShow:a,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:p,mobileBackgroundShow:g,mobilePaddingShow:b,mobilePaddingsExt:k,setMobilePaddingsExt:h,oneMobileBorderRadiusValue:m,setOneMobileBorderRadiusValue:S,linkProtocol:x,handleLinkProtocolsChange:f,setLinkProtocol:y,toggleShowMobileBorderHandler:v,toggleShowMobileBorderRadiusHandler:N,toggleShowMobileBoxShadowHandler:B,toggleShowMobileSizeHandler:C,toggleShowMobileBackgroundHandler:$,toggleShowMobilePaddingHandler:U})=>{const{__:L}=r.useI18n(),{token:F}=(0,o.ui_kit$useToken)(),P=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Dt,{form:e,elementSettings:s,imgParent:!0,typeOfForm:"mobile"})}),P.formButtonFieldTextAlignEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,t.jsx)($o,{form:e,name:"mobileTextAlign",elementSettings:s,imgParent:!0})})]}),!!s.showOnMobile&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}}),(0,t.jsx)(qt,{show:x==="#",__:L,style:{marginBottom:F.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:L("Hyperlink URL"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"href",style:{marginBottom:x==="mailto:"?F.formItemMarginBottomXS:F.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$Input,{addonBefore:(0,t.jsx)(Kt,{linkProtocol:x,handleLinkProtocolsChange:f,__:L}),placeholder:L("Hyperlink URL"),allowClear:!0,prefix:(0,t.jsx)(Xt,{linkProtocol:x})})})}),x==="mailto:"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:"subject",children:(0,t.jsx)(o.ui_kit$Input,{placeholder:L("Subject")})}),(0,t.jsx)(o.ui_kit$Form.Item,{name:"body",style:{marginBottom:F.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$TextArea,{rows:3,placeholder:L("Body")})})]})]}),!!s.showOnMobile&&(0,t.jsx)(go,{form:e,fillFields:i,elementSettings:s,setLinkProtocol:y,linkProtocol:x,showAddParagraph:!1,isButton:!0}),(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(ss,{})})}),P.formButtonFieldPaddingsEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:L("Padding"),collapsible:!0,open:b,onToggle:U,dividerTop:!0,children:(0,t.jsx)(Uo,{form:e,elementSettings:s,mobilePaddingsExt:k,setMobilePaddingsExt:h})}),(0,t.jsx)(o.ui_kit$FormSection,{title:L("Size"),collapsible:!0,open:p,onToggle:C,dividerTop:!0,bodyStyle:{paddingBottom:F.formItemMarginBottomMD},children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:L("Width"),placement:"bottom",children:(0,t.jsx)(Ht,{form:e,name:"mobileWidth",elementSettings:s})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:L("Height"),placement:"bottom",children:(0,t.jsx)(Qt,{form:e,name:"mobileHeight",elementSettings:s})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:L("Background"),collapsible:!0,open:g,onToggle:$,dividerTop:!0,bodyStyle:{paddingBottom:F.formItemMarginBottomMD},children:(0,t.jsx)(xo,{elementSettings:Ut(s),imageEnabled:P.formButtonFieldBackgroundImageEnabled,desktopBackground:_o(s)})}),P.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:L("Borders"),collapsible:!0,open:a,onToggle:v,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),P.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:L("Border radius"),collapsible:!0,open:d,onToggle:N,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:m,setOneBorderRadiusValue:S,elementSettings:s,typeOfForm:"mobile"})}),P.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:L("Box shadow"),collapsible:!0,open:c,onToggle:B,dividerTop:!0,children:(0,t.jsx)(wt,{typeOfForm:"mobile"})}),P.formFieldAmpVisibilityEnabled&&s.ampShow&&(0,t.jsx)(o.ui_kit$FormSection,{title:L("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})}),P.formFieldAmpVisibilityEnabled&&s.isAmp&&(0,t.jsx)(o.ui_kit$FormSection,{title:L("AMP visibility"),dividerTop:!0,children:(0,t.jsx)(vt,{})})]})};Os.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,boxShadow:_.default.object,mobileBordersShow:_.default.bool,mobileBorderRadiusShow:_.default.bool,mobileBoxShadowShow:_.default.bool,mobileSizeShow:_.default.bool,mobileBackgroundShow:_.default.bool,mobilePaddingShow:_.default.bool,mobilePaddingsExt:_.default.bool,setMobilePaddingsExt:_.default.func,oneMobileBorderRadiusValue:_.default.bool,setOneMobileBorderRadiusValue:_.default.func,linkProtocol:_.default.string,handleLinkProtocolsChange:_.default.func,setLinkProtocol:_.default.func,toggleShowMobileBorderHandler:_.default.func,toggleShowMobileBorderRadiusHandler:_.default.func,toggleShowMobileBoxShadowHandler:_.default.func,toggleShowMobileSizeHandler:_.default.func,toggleShowMobileBackgroundHandler:_.default.func,toggleShowMobilePaddingHandler:_.default.func};var Ld=Object.freeze({}),$s=({elementSettings:e})=>{const{__:i}=r.useI18n(),s=r.useSendPostMessage(),[l]=o.ui_kit$Form.useForm(),a=Lt(),d=Lt(),c=r.useDispatch(),[p,g]=(0,n.useState)({}),[b,k]=(0,n.useState)(!0),[h,m]=(0,n.useState)(!0),S=r.useSelector(r.selectEmailViewType),x=r.useSelector(r.selectMobileViewActive),[f,y]=(0,n.useState)(e.backgroundImage?.[0].value===""),v=r.useSelector(r.selectIsCodeMode),N=r.useSelector(r.selectCodeModeDirection),B=v&&N!=="bottom",C=(0,n.useRef)(null),$=(0,n.useRef)(null),[U,L]=(0,n.useState)(!1),[F,P]=(0,n.useState)(!1),[H,ae]=(0,n.useState)(!1),[T,te]=(0,n.useState)(!1),[xe,be]=(0,n.useState)(!1),[ye,me]=(0,n.useState)(!1),[he,ke]=(0,n.useState)(!1),[ce,ze]=(0,n.useState)(!1),[Oe,ve]=(0,n.useState)(!1),[Ee,pe]=(0,n.useState)(!1),[Q,X]=(0,n.useState)(!1),[Z,J]=(0,n.useState)(!1),[V,M]=(0,n.useState)(!1),[Y,K]=(0,n.useState)(""),[ee,le]=(0,n.useState)("https://"),[Re,Be]=(0,n.useState)({}),$e=e,[z,re]=(0,n.useState)(!!$e.textReplacer?.length),[Pe,G]=(0,n.useState)(e);e!==Pe&&(G(e),re(!!$e.textReplacer?.length));const Se=r.useElementEntityKind(),Fe=[{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"}],Ae=e.border,Ve=e.mobileBorder,Ue=Object.keys(Ae).find(D=>Ae[D]?.width||Ae[D]?.style||Ae[D]?.color),Xe=Object.keys(Ve).find(D=>Ve[D]?.width||Ve[D]?.style||Ve[D]?.color),ne=D=>D&&(D?.width||D?.style||D?.color)?D:"",{remember:Te,fillFields:I}=ro(e);(0,n.useEffect)(()=>{if(e){const D=e.boxShadow||Ld,q=e.mobilePadding||{},we=e.mobileAlign||{};g(D);let Ge="",_e="",R=e.href||"https://";if(e.href){if(e.href.startsWith("mailto:")){const de=qr(e.href);Ge=de.subject,_e=de.body,R=de.baseEmail}Vt(e.href,le)}I(l,{...e,href:R,subject:Ge,body:_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",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:ne(e.mobileBorder.all)||!(ne(e.mobileBorder.top)||ne(e.mobileBorder.bottom)||ne(e.mobileBorder.right)||ne(e.mobileBorder.left))&&ne(e.border.all),mobileBorderTop:ne(e.mobileBorder.top)||!ne(e.mobileBorder.all)&&ne(e.border.top),mobileBorderBottom:ne(e.mobileBorder.bottom)||!ne(e.mobileBorder.all)&&ne(e.border.bottom),mobileBorderRight:ne(e.mobileBorder.right)||!ne(e.mobileBorder.all)&&ne(e.border.right),mobileBorderLeft:ne(e.mobileBorder.left)||!ne(e.mobileBorder.all)&&ne(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:bt(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:bt(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:bt(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:bt(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(we?.value)||e.align,mobileVerticalAlign:u(e.mobileVerticalAlign?.value||e.valign),mobileBackgroundColor:u(e.mobileBackgroundColor?.value||e.backgroundColor||""),...to(e),mobilePaddingTop:u(q.all)||u(q.top)||u(e.padding?.all)||u(e.padding?.top),mobilePaddingLeft:u(q.all)||u(q.left)||u(e.padding?.all)||u(e.padding?.left),mobilePaddingRight:u(q.all)||u(q.right)||u(e.padding?.all)||u(e.padding?.right),mobilePaddingBottom:u(q.all)||u(q.bottom)||u(e.padding?.all)||u(e.padding?.bottom),mobilePaddingTopBottom:u(q.top)||u(q.bottom)||u(e.padding?.top)||u(e.padding?.bottom),mobilePaddingLeftRight:u(q.left)||u(q.right)||u(e.padding?.left)||u(e.padding?.right),mobileTextAlign:Jr(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))?m(!1):m(!0),y(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)?L(!1):L(!0),!u(q.all)&&(u(q.top)||u(q.right)||u(q.bottom)||u(q.left))&&(q.top!==q.bottom||q.right!==q.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)?P(!1):P(!0);const oe=a.isStaleBorderSnapshot(e,!!Ue),E=d.isStaleBorderSnapshot(e,!!Xe);oe&&l.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(E||oe&&!Xe)&&l.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),ae(de=>Ue&&!oe?!0:de),te(de=>Ue&&!oe||Xe&&!E?!0:de),be(!!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.borderRadius?.all||!!e.borderRadius?.topLeft||!!e.borderRadius?.bottomLeft||!!e.borderRadius?.topRight||!!e.borderRadius?.bottomRight),ke(!!e.boxShadow),ze(!!e.mobileBoxShadow?.blurRadius||!!e.mobileBoxShadow?.color||!!e.mobileBoxShadow?.hOffset||!!e.mobileBoxShadow?.inset||!!e.mobileBoxShadow?.spreadRadius||!!e.mobileBoxShadow?.vOffset||!!e.boxShadow),ve(!!e.mobileWidth?.value||!!e.mobileHeight?.value||!!e.width.value||!!e.height.value),pe(!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),X(!!e.mobileBackgroundColor?.value||!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Mo(e)&&X(!0),J(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),M(!!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)}},[l,e,B,Ue,Xe,a,d,I]);const se=(0,n.useCallback)(D=>{Te(D),c(Se==="email"?r.setElementSettings$1(D):r.setElementSettings(D))},[c,Se,Te]),je=D=>{const q=l.getFieldsValue(!0),we=Object.keys(D)[0];let Ge;switch(K(l.getFieldsValue(!0).widthDim==="%"?100:""),we){case"exportAsPicture":Ge={exportAsPicture:q.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Ge={boxShadow:{hOffset:q.boxShadowHOffset,vOffset:q.boxShadowVOffset,blurRadius:q.boxShadowBlurRadius,spreadRadius:q.boxShadowSpreadRadius,color:q.boxShadowColor,inset:q.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":q.borderPosition==="borderAll"?(Ge={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...q.borderAll}}},l.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):q.borderAll?.width||q.borderAll?.style||q.borderAll?.color?(Ge={border:{all:null,left:q.borderAll,right:q.borderAll,top:q.borderAll,bottom:q.borderAll,[W.REVERSE_BORDER_POSITIONS[we]]:{...q[we],...D[we]}}},l.setFieldsValue({borderAll:null,borderLeft:q.borderAll,borderRight:q.borderAll,borderTop:q.borderAll,borderBottom:q.borderAll,[we]:{...q[we],...D[we]}})):(Ge={border:{all:null,left:q.borderLeft,right:q.borderRight,top:q.borderTop,bottom:q.borderBottom,[W.REVERSE_BORDER_POSITIONS[we]]:{...q[we],...D[we]}}},l.setFieldsValue({border:Ge.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(q.mobileBorderPosition==="mobileBorderAll")Ge={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...q.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[we]+"-"}}},l.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const oe=W.MOBILE_REVERSE_BORDER_POSITIONS[we],E={...q[we],...D[we]},de=!E?.width&&!E?.style&&!E?.color;if(q.mobileBorder?.all?.width||q.mobileBorder?.all?.style||q.mobileBorder?.all?.color){const Ce=q.mobileBorderAll;Ge={mobileBorder:{all:null,left:Ce,right:Ce,top:Ce,bottom:Ce,[oe]:de?null:{...E,classNamePrefix:"em-mob-border_"+oe+"-"}}},l.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:Ce,mobileBorderRight:Ce,mobileBorderTop:Ce,mobileBorderBottom:Ce,[we]:E})}else{const Ce=e.mobileBorder||{},Qe=Me=>{const Et=Ce[Me];return Et&&(Et?.width||Et?.style||Et?.color)?Et:null};Ge={mobileBorder:{all:null,left:oe==="left"?de?null:{...E,classNamePrefix:"em-mob-border_left-"}:Qe("left"),right:oe==="right"?de?null:{...E,classNamePrefix:"em-mob-border_right-"}:Qe("right"),top:oe==="top"?de?null:{...E,classNamePrefix:"em-mob-border_top-"}:Qe("top"),bottom:oe==="bottom"?de?null:{...E,classNamePrefix:"em-mob-border_bottom-"}:Qe("bottom")}},l.setFieldsValue({[we]:E})}}break;case"width":Ge={[we]:{value:D[we],dim:q.widthDim}};break;case"height":Ge={[we]:{value:D[we],dim:q.heightDim}};break;case"widthDim":Ge={width:{value:q.width,dim:D[we]}};break;case"heightDim":Ge={height:{value:q.height,dim:D[we]}};break;case"backgroundImage":y(D[we]===""),Ge={[we]:[{...e.backgroundImage[0],value:D[we]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":Ge={padding:{left:q.paddingLeft,right:q.paddingRight,top:q.paddingTop,bottom:q.paddingBottom,[W.PADDING_POSITION[we]]:+D[we]}};break;case"paddingTopBottom":Ge={padding:{left:q.paddingLeft,right:q.paddingRight,top:+D[we],bottom:+D[we]}},q.paddingTop=q.paddingBottom=+D[we];break;case"paddingLeftRight":Ge={padding:{top:q.paddingTop,bottom:q.paddingBottom,left:+D[we],right:+D[we]}},q.paddingLeft=q.paddingRight=+D[we];break;case"borderRadiusAll":Ge={borderRadius:{[W.BORDER_RADIUS_POSITION[we]]:+D[we]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Ge={borderRadius:{topLeft:q.borderRadiusTopLeft,bottomLeft:q.borderRadiusBottomLeft,topRight:q.borderRadiusTopRight,bottomRight:q.borderRadiusBottomRight,[W.BORDER_RADIUS_POSITION[we]]:+D[we]}};break;case"mobileWidth":Ge={[we]:{classNamePrefix:"em-mob-width-",value:D[we],dim:q.mobileWidthDim}};break;case"mobileWidthDim":Ge={mobileWidth:{classNamePrefix:"em-mob-width-",value:q.mobileWidth||100,dim:D[we]}};break;case"mobileHeight":Ge={[we]:{classNamePrefix:"em-mob-height-",value:D[we],dim:q.mobileHeightDim},mobileLineHeight:{classNamePrefix:"em-mob-line_height-",value:D[we],dim:q.mobileHeightDim}};break;case"mobileHeightDim":Ge={mobileHeight:{classNamePrefix:"em-mob-height-",value:q.mobileHeight,dim:D[we]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Ge={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[we]]:D[we],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[we]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Ge={mobileBoxShadow:{hOffset:q.mobileBoxShadowHOffset,vOffset:q.mobileBoxShadowVOffset,blurRadius:q.mobileBoxShadowBlurRadius,spreadRadius:q.mobileBoxShadowSpreadRadius,color:q.mobileBoxShadowColor,inset:q.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":Ge={[we]:{classNamePrefix:"em-mob-table_align-",value:D[we]}};break;case"mobileTextAlign":Ge={[we]:{classNamePrefix:"em-mob-text_align-",value:D[we]}};break;case"mobileVerticalAlign":Ge={[we]:{classNamePrefix:"em-mob-vertical_align-",value:D[we]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Ge=fo(D),!Ge)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":Ge={mobilePadding:{all:null,top:q.mobilePaddingTop!==""?q.mobilePaddingTop:null,right:q.mobilePaddingRight!==""?q.mobilePaddingRight:null,bottom:q.mobilePaddingBottom!==""?q.mobilePaddingBottom:null,left:q.mobilePaddingLeft!==""?q.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":q.mobilePaddingTop=q.mobilePaddingBottom=D[we],Ge={mobilePadding:{all:null,top:q.mobilePaddingTop!==""?q.mobilePaddingTop:null,right:q.mobilePaddingRight!==""?q.mobilePaddingRight:null,bottom:q.mobilePaddingBottom!==""?q.mobilePaddingBottom:null,left:q.mobilePaddingLeft!==""?q.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":q.mobilePaddingLeft=q.mobilePaddingRight=D[we],Ge={mobilePadding:{all:null,top:q.mobilePaddingTop!==""?q.mobilePaddingTop:null,right:q.mobilePaddingRight!==""?q.mobilePaddingRight:null,bottom:q.mobilePaddingBottom!==""?q.mobilePaddingBottom:null,left:q.mobilePaddingLeft!==""?q.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileFontSize":Ge={[we]:{classNamePrefix:"em-mob-font_size-",value:D[we],dim:q.mobileFontSizeDim}};break;case"href":let _e=Jt(D[we]);_e!==D[we]&&(l.setFieldValue("href",_e),q.href=_e),_e.startsWith("mailto:")?Ge={[we]:Ii(_e,q.subject,q.body)}:Ge={[we]:_e},Vt(D[we],le);break;case"subject":case"body":const R=q.href||"";if(R.startsWith("mailto:")){const oe=we==="subject"?D[we]:q.subject,E=we==="body"?D[we]:q.body;Ge={href:Ii(R,oe,E)}}else return;break;case"backgroundPositionX":case"backgroundPositionY":Ge={[we]:isNaN(parseFloat(D[we].position))?D[we].position:D[we].position+D[we].unit};break;default:Ge=D}we!=="borderPosition"&&we!=="mobileBorderPosition"&&(s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ge}),we!=="mobileBorderRadiusAll"&&we!=="mobileBorderRadiusTopLeft"&&we!=="mobileBorderRadiusTopRight"&&we!=="mobileBorderRadiusBottomLeft"&&we!=="mobileBorderRadiusBottomRight"&&se({...e,...Ge,mobileBorderRadius:{...e.mobileBorderRadius,...Ge?.mobileBorderRadius},activateSection:null,changeKey:we}))},Ne=()=>{L(q=>!q);const D=l.getFieldsValue(!0);U||(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:e.type,settings:{padding:{top:D.paddingTopBottom,bottom:D.paddingTopBottom,left:D.paddingLeftRight,right:D.paddingLeftRight}}}))},He=()=>{const D=l.getFieldsValue(!0);a.markBorderToggled(!H),setTimeout(()=>{ae(q=>!q),H?(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"},s({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}}}})})},Ke=()=>{const D=l.getFieldsValue(!0);d.markBorderToggled(!T),setTimeout(()=>{te(q=>!q),T?(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"},s({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}}}})})},tt=()=>{const D=l.getFieldsValue(!0);setTimeout(()=>{be(q=>!q),xe?(D.borderRadiusAll=0,k(!0)):D.borderRadiusAll=5,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:D.borderRadiusAll}}})})},O=()=>{const D=l.getFieldsValue(!0);setTimeout(()=>{me(q=>!q),ye?(D.mobileBorderRadiusAll=null,m(!0)):D.mobileBorderRadiusAll=5,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:D.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},ie=()=>{const D=l.getFieldsValue(!0);setTimeout(()=>{ke(q=>!q),he?(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"),s({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}}})})},j=()=>{const D=l.getFieldsValue(!0);setTimeout(()=>{ze(q=>!q),ce?(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"),s({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-"}}})})},w=()=>{const D=l.getFieldsValue(!0);setTimeout(()=>{ve(q=>!q),Oe&&(D.mobileWidth="",D.mobileHeight="",s({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-"}}}))})},ue=()=>{const D=l.getFieldsValue(!0);setTimeout(()=>{pe(q=>!q),Ee?(D.backgroundColor="",D.backgroundImage="",D.backgroundPositionX="",D.backgroundPositionY="",D.backgroundRepeat="none",D.backgroundSize="",y(!0)):(D.backgroundColor="#E5E5E5",D.backgroundSize="",D.backgroundRepeat="none"),s({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}})})},Ie=()=>{const D=l.getFieldsValue(!0);setTimeout(()=>{X(q=>!q),Q?D.mobileBackgroundColor="":D.mobileBackgroundColor=e.commonStyles.buttons.backgroundColor||"#1C52DC",s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:D.mobileBackgroundColor}}}),Q&&Do(l,e,s)})},qe=()=>{const D=l.getFieldsValue(!0);setTimeout(()=>{J(q=>!q),Z&&(D.paddingLeftRight="",D.paddingLeft="",D.paddingRight="",D.paddingTopBottom="",D.paddingTop="",D.paddingBottom="",s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},Ze=()=>{const D=l.getFieldsValue(!0);setTimeout(()=>{M(q=>!q),V&&(D.mobilePaddingLeftRight="",D.mobilePaddingLeft="",D.mobilePaddingRight="",D.mobilePaddingTopBottom="",D.mobilePaddingTop="",D.mobilePaddingBottom="",s({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_"}}}))})},dt=D=>{l.setFieldValue("href",D!=="mergetag"?D:""),le(D)},st=(0,n.useCallback)(({target:D})=>{if(!D)return;const{selectionStart:q,selectionEnd:we}=D;Be(Ge=>Ge.target===D&&Ge.selection?.start===q&&Ge.selection?.end===we?Ge:{target:D,selection:{start:q,end:we}})},[]),ct=D=>{D.target.value!==""&&$.current.classList.add("selected-td-form__button--active")},kt=()=>{re(!z),z?(l.setFieldValue("textReplacer",""),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{textReplacer:""}})):setTimeout(()=>C.current.focus())},St=D=>{const q=D.target,we=q.value,Ge=q.selectionStart;if(Ge===0&&D.key===" "){D.preventDefault();return}if(D.key===" "){if(Ge!==we.length){D.preventDefault();return}we.endsWith(" ")&&D.preventDefault()}};return(0,t.jsxs)(o.ui_kit$Form,{form:l,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[Ue]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[Xe]||"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:je,autoComplete:"off",className:"element-controls",children:[!B&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),B?(0,t.jsx)(Ai,{form:l,elementSettings:e,showAddParagraph:!1,isButton:!0}):(0,t.jsx)(t.Fragment,{children:S==="mobile"&&x.styles?(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,t.jsx)(Os,{form:l,fillFields:I,elementSettings:e,boxShadow:p,mobileBordersShow:T,mobileBorderRadiusShow:ye,mobileBoxShadowShow:ce,mobileSizeShow:Oe,mobileBackgroundShow:Q,mobilePaddingShow:V,mobilePaddingsExt:F,setMobilePaddingsExt:P,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:m,linkProtocol:ee,handleLinkProtocolsChange:dt,setLinkProtocol:le,toggleShowMobileBorderHandler:Ke,toggleShowMobileBorderRadiusHandler:O,toggleShowMobileBoxShadowHandler:j,toggleShowMobileSizeHandler:w,toggleShowMobileBackgroundHandler:Ie,toggleShowMobilePaddingHandler:Ze})}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(Ls,{form:l,fillFields:I,elementSettings:e,boxShadow:p,bordersShow:H,borderRadiusShow:xe,boxShadowShow:he,backgroundShow:Ee,backgroundImageEmpty:f,backgroundRepeatOptions:Fe,paddingShow:Z,paddingsExt:U,maxWidthValue:Y,oneBorderRadiusValue:b,setOneBorderRadiusValue:k,linkProtocol:ee,linkTarget:Re,isOpenTextReplacer:z,textReplacerButtonRef:$,textReplacerInputRef:C,handleLinkProtocolsChange:dt,handleSelect:st,textReplacerInputHandler:ct,handleTextReplacerKeyDown:St,srcButtonHandler:kt,togglePaddingHandler:Ne,toggleShowPaddingHandler:qe,toggleShowBackgroundHandler:ue,toggleShowBorderHandler:He,toggleShowBorderRadiusHandler:tt,toggleShowBoxShadowHandler:ie,setLinkProtocol:le,handleChangeValues:je})})})]})};$s.propTypes={elementSettings:_.default.object.isRequired};var Fs=({elementSettings:e})=>{const{__:i}=r.useI18n(),[s]=o.ui_kit$Form.useForm(),l=r.useSendPostMessage();(0,n.useEffect)(()=>{e&&s.setFieldsValue({...e})},[s,e]);const a=d=>{l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:d})};return(0,t.jsx)(o.ui_kit$Form,{form:s,layout:"vertical",name:"selected_variable_form",initialValues:{value:""},onValuesChange:a,autoComplete:"off",children:(0,t.jsx)(o.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,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},style:{marginBottom:35},children:(0,t.jsx)(o.ui_kit$TextArea,{rows:4,placeholder:i("Variable value")})})})};Fs.propTypes={elementSettings:_.default.object.isRequired};function Od(e,i){const s=`selected_${e}_form_images_`,l=i.startsWith(s)?s:`selected_${e}_form_`;return i.startsWith(l)?i.slice(l.length):i}function $d(e){const i=/^(.+)_(\d+)$/.exec(e);return i?{key:i[1],index:Number(i[2])}:void 0}function Fd(e,i,s){return(e??[]).map((l,a)=>a===i.index?{...l,[i.key]:s}:l)}function Ms(e){return(e??[]).map((i,s)=>({...i,slideIndex:s}))}var Ds=({elementSettings:e,setElementSettings:i,postfix:s="",form:l,handleSelect:a,previewReloadSignal:d})=>{const{__:c}=r.useI18n(),{token:p}=(0,o.ui_kit$useToken)(),g=r.useAppConfig(),b=r.useSendPostMessage(),k="src"+s,h="title"+s,m="alt"+s,S="link"+s,x="imgReplacer"+s,f=(0,n.useRef)(null),y=(0,n.useRef)(null),v=(0,n.useRef)(null),N=(0,n.useRef)(null),B=(0,n.useRef)(null),C=(0,n.useRef)(null),$=(0,n.useRef)(null),U=(0,n.useRef)(null),[L,F]=(0,n.useState)(""),[P,H]=(0,n.useState)(""),[ae,T]=(0,n.useState)(""),[te,xe]=(0,n.useState)(!1),[be,ye]=(0,n.useState)("https://"),me=(0,n.useRef)(!1),he=(0,n.useRef)(s);(0,n.useEffect)(()=>{s!==he.current&&(he.current=s,me.current=!1),H(e.images?.[m]),T(e.images?.[h]);const J=e.images?.[S];F(J||(me.current?"...":""))},[e,m,h,S,s]);const ke=()=>{L?(me.current=!1,F(""),l.setFieldValue(S,""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[S]:""}})):(me.current=!0,F(f.current&&f.current.input.value?f.current.input.value:"..."),setTimeout(()=>{f.current.focus()}))},ce=J=>{J.target.value===""?F("..."):(y.current.classList.add("selected-td-form__button--active"),F(J.target.value));const V=J.target.value;Vt(V,ye)},ze=()=>{P?(H(""),l.setFieldValue("alt",""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[m]:""}})):(H(v.current&&v.current.input.value?v.current.input.value:"..."),setTimeout(()=>{v.current.focus()}))},Oe=J=>{J.target.value===""?H("..."):(N.current.classList.add("selected-td-form__button--active"),H(J.target.value))},ve=()=>{ae?(T(!1),l.setFieldValue("title",""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[h]:""}})):(T(B.current&&B.current.input.value?B.current.input.value:"..."),setTimeout(()=>{B.current.focus()}))},Ee=()=>{xe(!te),te?(l.setFieldValue(x,""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[x]:""}})):setTimeout(()=>$.current.focus())},pe=J=>{J.target.value!==""&&U.current.classList.add("selected-td-form__button--active")},Q=J=>{J.target.value===""?T("..."):(C.current.classList.add("selected-td-form__button--active"),T(J.target.value))},X=J=>{l.setFieldValue("LinkName",J!=="mergetag"?J:""),ye(J)},Z=J=>{const V=l.getFieldsValue(!0),M=+s.substring(1),Y=Object.keys(V?.images).reduce((ee,le)=>(le.includes(s)||(ee[le]=V[le]),ee),{}),K=e.carouselImages?.filter((ee,le)=>le!==M);i(ee=>({...ee,settings:{...ee.settings,carouselImages:Ms(K)}})),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:e.caption,settings:{...e,carouselImages:K}}),l.setFieldsValue({images:Y})};return(0,t.jsxs)(t.Fragment,{children:[(e.type==="img"||e.type==="video"||e.type==="carousel")&&(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,t.jsx)(Pt,{form:l,label:c("Image path"),name:k,placeholder:c("Image path"),elementSettings:e,previewReloadSignal:d,tooltipTitle:""})}),(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[(0,t.jsxs)(o.ui_kit$Space,{size:8,children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:P||c("Alternative text"),placement:"bottom",getPopupContainer:J=>J.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!P}),onClick:ze,ref:N,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),g.formFieldImageTitleEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:ae||c("Tooltip text"),placement:"bottom",getPopupContainer:J=>J.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!ae}),onClick:ve,ref:C,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:L||c("Hyperlink URL"),placement:"bottom",getPopupContainer:J=>J.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!L}),icon:(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:ke,ref:y})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:c("Image replacer"),placement:"bottom",getPopupContainer:J=>J.closest(".email-pane__collapse-wrapper"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":te}),icon:(0,t.jsx)(r.EmIcons,{icon:"Replacer",component:o.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:Ee,ref:U})})]}),(0,t.jsx)(o.ui_kit$Space,{size:8,children:(0,t.jsx)(o.ui_kit$Tooltip,{title:c("Remove slide"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{type:"text",onClick:Z,icon:(0,t.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:16})})})})]}),(!!L||!!P||!!ae||!!te)&&(0,t.jsxs)("div",{children:[!!L&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(qt,{show:be==="#",__:c,style:{marginBottom:p.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Hyperlink URL"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:S,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,t.jsx)(o.ui_kit$Input,{addonBefore:(0,t.jsx)(Kt,{linkProtocol:be,handleLinkProtocolsChange:X,__:c}),placeholder:c("Hyperlink URL"),allowClear:!0,ref:f,onChange:ce,onSelect:a,prefix:(0,t.jsx)(Xt,{linkProtocol:be})})})})]}),!!P&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Alternative text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:m,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:c("Alternative text"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:Oe,ref:v,onSelect:a})})}),g.formFieldImageTitleEnabled&&!!ae&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Tooltip text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:h,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:c("Enter the title of the image"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:Q,ref:B,onSelect:a})})}),!!te&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:c("Image src"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:x,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:c("Code that will replace the image `src`"),allowClear:!0,prefix:(0,t.jsx)("span",{className:"addon-text-content",children:c("Image src")}),onChange:pe,ref:$,onSelect:a})})})]})]})};Ds.propTypes={};var Vs=({form:e,elementSettings:i,formFields:s,setElementSettings:l,borderRadiusShow:a,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,linkProtocol:p,mergeTagItems:g,mergeMenuOpen:b,setMergeMenuOpen:k,cascaderRef:h,handleLinkProtocolsChange:m,handleSelect:S,onChange:x,filter:f,renderSearchOption:y,toggleShowBorderRadiusHandler:v,setNewSlide:N})=>{const{__:B}=r.useI18n(),{token:C}=(0,o.ui_kit$useToken)(),$=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(qt,{show:p==="#",__:B,style:{marginBottom:C.formItemMarginBottomXS}}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:B("Link for all slides"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"link",children:(0,t.jsx)(o.ui_kit$Input,{addonBefore:(0,t.jsx)(Kt,{linkProtocol:p,handleLinkProtocolsChange:m,__:B}),placeholder:B("Link for all slides"),allowClear:!0,onSelect:S,prefix:(0,t.jsx)(Xt,{linkProtocol:p})})})}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"}),$.mergeTagsShow&&g&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Col,{span:24,id:"merge_tags_wrapper",children:(0,t.jsxs)(o.ui_kit$Form.Item,{style:{marginBottom:C.formItemMarginBottomMD,marginTop:C.formItemMarginBottomMD},children:[(0,t.jsx)(o.ui_kit$Button,{id:"merge_tags_button",icon:(0,t.jsx)(r.EmIcons,{icon:"MergeTags",component:o.icons$MergeTags}),style:{width:"100%",display:b?"none":"inline-flex"},onClick:()=>k(!0),children:B("Merge tags")}),(0,t.jsx)(o.ui_kit$Cascader,{ref:h,classNames:{popup:{root:"merge-tags"}},options:g,placeholder:B("Start typing the title"),showSearch:{filter:f,render:y},spellCheck:"false",getPopupContainer:U=>U.closest(".email-pane__collapse-wrapper"),onChange:x,style:{display:b?"block":"none"},open:b,onKeyDown:U=>{U.key==="Escape"&&k(!1)}})]})}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"})]}),(0,t.jsx)(o.ui_kit$Form.List,{name:"images",initialValue:s?.images,children:()=>(0,t.jsx)("div",{style:{paddingTop:C.formItemMarginBottomMD+4},children:i?.settings?.carouselImages?.map((U,L)=>(0,t.jsx)("div",{className:"carousel__slide",children:(0,t.jsx)(Ds,{elementSettings:s,setElementSettings:l,postfix:"_"+L,form:e,handleSelect:S})},L))})}),(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:C.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$Button,{id:"add_slide_button",icon:(0,t.jsx)(r.EmIcons,{icon:"AddSlide",component:o.icons$AddSlide}),style:{width:"100%"},onClick:()=>N(),children:B("Add slide")})})}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:20,style:{marginTop:C.formItemMarginBottomMD-10},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"loop",valuePropName:"checked",style:{marginBottom:C.formItemMarginBottomMD-6},children:(0,t.jsx)(o.ui_kit$Switch,{id:"Loop",label:B("Loop"),size:"small",labelStyle:{position:"relative",top:2}})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"autoplay",valuePropName:"checked",style:{marginBottom:C.formItemMarginBottomMD-6},children:(0,t.jsx)(o.ui_kit$Switch,{id:"Autoplay",label:B("Autoplay"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),$.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:B("Border radius"),collapsible:!0,open:a,onToggle:v,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,elementSettings:i.settings})})]})};Vs.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,formFields:_.default.object,setElementSettings:_.default.func,borderRadiusShow:_.default.bool,oneBorderRadiusValue:_.default.bool,setOneBorderRadiusValue:_.default.func,linkProtocol:_.default.string,mergeTagItems:_.default.array,mergeMenuOpen:_.default.bool,setMergeMenuOpen:_.default.func,cascaderRef:_.default.object,handleLinkProtocolsChange:_.default.func,handleSelect:_.default.func,onChange:_.default.func,filter:_.default.func,renderSearchOption:_.default.func,toggleShowBorderRadiusHandler:_.default.func,setNewSlide:_.default.func};var Hs=()=>{const{__:e}=r.useI18n();return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("p",{children:e("No properties to edit.")})})};Hs.propTypes={};var Md={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 Dd(e){const i={...Ci(e)};return delete i.parent,delete i.path,delete i.nextElem,delete i.prevElem,i}var Us=({elementSettings:e})=>{const{__:i}=r.useI18n(),[s]=o.ui_kit$Form.useForm();let l=r.useDispatch();r.useAppConfig();const a=r.useSendPostMessage(),d=r.useSendPostMessageEx(),{openImagePicker:c}=r.useImagePicker(),p=r.useSelector(r.selectEmailViewType),g=r.useSelector(r.selectMobileViewActive),[b,k]=(0,n.useState)(!0),[h,m]=(0,n.useState)(!0),[S,x]=(0,n.useState)(!1),[f,y]=(0,n.useState)(!1),[v,N]=(0,n.useState)("https://"),[B,C]=(0,n.useState)(s?.getFieldsValue(!0)),[$,U]=(0,n.useState)(e),{remember:L,isOwnEcho:F}=os(Dd),[P,H]=(0,n.useState)(e);e!==P&&(H(e),F(e?.settings)||U(e));const[ae,T]=(0,n.useState)({name:"",counter:0}),[te,xe]=(0,n.useState)(null),[be,ye]=(0,n.useState)(),[me,he]=(0,n.useState)(!1),[ke,ce]=(0,n.useState)(!1),[ze,Oe]=(0,n.useState)({start:0,end:0}),ve=(0,n.useRef)(null),Ee=`selected_${$.type}_form_link`,pe=r.useSelector(r.selectIsCodeMode),Q=r.useSelector(r.selectCodeModeDirection),X=pe&&Q!=="bottom";(0,n.useEffect)(()=>{me&&ve.current&&ve.current.focus()},[me]);const Z=(G,Se)=>{const Fe=document.getElementById(Se);if(Fe){const Ae=$,Ve=Od(Ae.type,Se),Ue=$d(Ve),Xe=Fe.value?.substring(0,ze.start),ne=Fe.value?.substring(ze.end);let Te={[Ve]:Xe+G+ne};Ue?Te={carouselImages:Fd(Ae.settings?.carouselImages,Ue,Xe+G+ne)}:$.type===r.ELEMENT_TYPES.CAROUSEL&&Ee===Se&&(Te={[Ve]:Xe+G+ne,carouselImages:[...$.settings?.carouselImages.map(I=>({...I,link:Xe+G+ne}))||[]]}),a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...$.settings,...Te}}),U(I=>({...I,settings:{...I.settings,...Te}})),s.setFieldValue(Ve,Xe+G+ne),Fe.focus(),setTimeout(()=>{Fe.selectionStart=ze.start,Fe.selectionEnd=ze.start+G.length},400),ce(!0)}},J=r.useAppConfig().mergeTags;(0,n.useEffect)(()=>{J?.items?.length&&ye(r.mapMargeTags(J.items))},[J,ye]);const V=(G,Se)=>{if(he(!1),G){const Fe=J.syntax.length>1?be.findIndex(Ue=>Ue.key===Se[0].key):0,Ae=J.syntax[Fe].replace("%value%",G[G.length-1]),Ve=`selected_${$.type}_form${$.type==="carousel"?"_images":""}`;["imgReplacer","title","alt","src","link"].some(Ue=>te?.getAttribute("id").includes(`${Ve}_${Ue}`))||te?.getAttribute("id").includes(Ee)?Z(Ae,te?.getAttribute("id")):(s.setFieldValue("imgReplacer",Ae),a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...$.settings,imgReplacer:Ae}}),U(Ue=>({...Ue,settings:{...Ue.settings,imgReplacer:Ae}})))}},M=r.useRootElement();(0,n.useEffect)(()=>{const G=({target:Ae})=>{Ae.closest('[id="merge_tags_wrapper"]')||xe(Ae)},Se=({target:Ae})=>{!Ae.closest(".merge-tags")&&!Ae.closest("#merge_tags_button")&&he(!1)},Fe=new ht.Disposable;return Fe.addDisposable(r.addWindowListenerFromShadow(M,"focusin",G)),Fe.addDisposable(r.addWindowListenerFromShadow(M,"click",Se)),()=>{Fe.dispose()}},[M]);const Y=(G,Se)=>Se.some(Fe=>Fe.label.toLowerCase().indexOf(G.toLowerCase())>-1),K=(G,Se)=>{const Fe=Se.map((Ae,Ve)=>{const Ue=Ae.label.split(new RegExp(`(${G})`,"gi"));return(0,t.jsxs)("span",{children:[Ve!==0&&(0,t.jsx)("span",{children:" / "}),Ue.map((Xe,ne)=>Xe.toLowerCase()===G.toLowerCase()?(0,t.jsx)("span",{style:{color:"red"},children:Xe},ne):Xe)]},Ae.value)});return(0,t.jsx)("div",{title:Se.map(Ae=>Ae.label).join(" / "),children:Fe})};(0,n.useEffect)(()=>{const G=s?.getFieldsValue(!0);C(G)},[s]);const ee=({target:G})=>{if(G&&!ke){const{selectionStart:Se,selectionEnd:Fe}=G;Oe({start:Se,end:Fe})}ce(!1)};(0,n.useEffect)(()=>{if($.settings){const G=$.settings,Se=Ci(G);s?.setFieldsValue(Se),C(Se),G.link&&N(Oo(G.link,"https://")),u(G.borderRadius?.all)||(u(G.borderRadius?.topLeft)||u(G.borderRadius?.bottomLeft)||u(G.borderRadius?.topRight)||u(G.borderRadius?.bottomRight)?k(!1):u(G.borderRadius?.all)||k(!0)),u(G.mobileBorderRadius?.topLeft)||u(G.mobileBorderRadius?.bottomLeft)||u(G.mobileBorderRadius?.topRight)||u(G.mobileBorderRadius?.bottomRight)?m(!1):m(!0),x(!!G.borderRadius?.all||!!G.borderRadius?.topLeft||!!G.borderRadius?.bottomLeft||!!G.borderRadius?.topRight||!!G.borderRadius?.bottomRight),y(!!G.mobileBorderRadius?.all||!!G.mobileBorderRadius?.topLeft||!!G.mobileBorderRadius?.bottomLeft||!!G.mobileBorderRadius?.topRight||!!G.mobileBorderRadius?.bottomRight)}},[s,$]);const le=G=>{const Se=Qr($.settings,s,G);a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:Se.caption,settings:Se}),L({...$.settings,...Se}),U(Fe=>({...Fe,settings:{...Fe.settings,...Se}}))},Re=(G,Se)=>{const Fe=r.stripEmVersionFromUrlString($.settings?.src||"")===r.stripEmVersionFromUrlString(G||"");(!Fe||G!==$.settings?.src)&&le({src:G}),Se?.mode==="save"&&Fe&&(T(Ae=>({name:"src",counter:Ae.counter+1})),d(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(G)}))},Be=async G=>{const Se=$.settings?.src||"",Fe=r.stripEmVersionFromUrlString(Se),Ae=await c({kind:"img",currentUrl:bo(Fe)?"":Fe,entryModal:G});Ae?.url&&Re(Ae.url,Ae.meta)},$e=G=>{const Se=G.data.operation;Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?Be(r.MODALS.UPLOAD_IMAGE_MODAL_AI):Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?Be(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?Be(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?Be(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?Be(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK):Se===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(l(r.closeSecondModal()),l(r.closeModal$1()))};r.useListenPostMessage($e);const z=()=>{setTimeout(()=>{x(G=>!G),s.setFieldValue("borderRadiusAll",S?0:5),a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...$.settings,borderRadius:{all:S?"":5}}}),U(G=>({...G,settings:{...G.settings,borderRadius:{all:S?null:5}}}))})},re=G=>{s.setFieldValue("link",G!=="mergetag"?G:""),N(G)},Pe=()=>{const{width:G,height:Se,renderedWidth:Fe,renderedHeight:Ae}=$?.settings?.carouselImages[0]||{width:{value:600},height:{value:600},renderedWidth:600,renderedHeight:600},Ve={src:"https://emcdn.ru/1865/231031_17_BGU9Mso.png",width:{value:G.value,dim:"px"},height:{value:Se.value,dim:"px"},alt:"",title:"",link:null,renderedWidth:Fe,renderedHeight:Ae,imgReplacer:"",mobileWidth:{value:null,dim:"px"},mobileHeight:{value:null,dim:"px"},mobileBorderRadius:{all:null,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}},Ue=[...$?.settings?.carouselImages,Ve];a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...$.settings,carouselImages:Ue}});const Xe=Ms(Ue);U(ne=>({...ne,settings:{...ne.settings,carouselImages:Xe}}))};return(0,t.jsxs)(o.ui_kit$Form,{form:s,layout:"vertical",name:"selected_carousel_form",initialValues:Md,onValuesChange:le,autoComplete:"off",className:"element-controls",children:[!X&&(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),p==="mobile"&&g.styles?(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,t.jsx)(Hs,{})}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(Vs,{form:s,elementSettings:$,formFields:B,setElementSettings:U,borderRadiusShow:S,oneBorderRadiusValue:b,setOneBorderRadiusValue:k,linkProtocol:v,mergeTagItems:be,mergeMenuOpen:me,setMergeMenuOpen:he,cascaderRef:ve,handleLinkProtocolsChange:re,handleSelect:ee,onChange:V,filter:Y,renderSearchOption:K,toggleShowBorderRadiusHandler:z,setNewSlide:Pe})})]})};Us.propTypes={};var Vd={animate:!0,expandSingleSection:!0,sections:[{expanded:!1,index:0}]},Ws=({elementSettings:e})=>{const{__:i}=r.useI18n(),{token:s}=(0,o.ui_kit$useToken)(),[l]=o.ui_kit$Form.useForm(),a=r.useSendPostMessage(),d=r.useAppConfig(),[c,p]=(0,n.useState)(e),[g,b]=(0,n.useState)(e);e!==g&&(b(e),p(e)),(0,n.useEffect)(()=>{if(c.settings){const S=c.settings,x=Ci(S);l?.setFieldsValue(x)}},[l,c]);const k=S=>{const x=Qr(c.settings,l,S);a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:c.type,caption:x.caption,settings:x}),p(f=>({...f,settings:{...f.settings,...x}}))},h=()=>{p(S=>({...S,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.")}})},m=S=>{p(x=>({...x,settings:{...x.settings,sections:c.settings.sections?.filter((f,y)=>y!==S)}})),a({operation:r.EVENT_TYPES.SANDBOX_ACCORDION_REMOVE_SECTION,settings:{index:S}})};return(0,t.jsx)(o.ui_kit$Form,{form:l,layout:"vertical",name:"selected_carousel_form",initialValues:Vd,onValuesChange:k,autoComplete:"off",className:"element-controls",children:(0,t.jsxs)("div",{id:"selected_element_form_desktop_props",children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:20,children:[(0,t.jsx)(o.ui_kit$Col,{span:15,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"expandSingleSection",valuePropName:"checked",children:(0,t.jsx)(o.ui_kit$Switch,{id:"ExpandSingleSection",label:i("Expand only one section"),size:"small",labelStyle:{position:"relative",top:2}})})}),(0,t.jsx)(o.ui_kit$Col,{span:9,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"animate",valuePropName:"checked",children:(0,t.jsx)(o.ui_kit$Switch,{id:"Animate",label:i("Animate"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,t.jsx)(o.ui_kit$Form.List,{name:"sections",children:()=>(0,t.jsx)("div",{style:{paddingTop:s.formItemMarginBottomMD+4},children:c?.settings?.sections?.map((S,x)=>(0,t.jsxs)(o.ui_kit$Row,{gutter:24,children:[(0,t.jsx)(o.ui_kit$Col,{span:20,children:(0,t.jsxs)(o.ui_kit$Space,{size:10,align:"baseline",children:[(0,t.jsx)("span",{style:{position:"relative",top:2},children:i("Section ")+(x+1)}),(0,t.jsx)(o.ui_kit$Form.Item,{name:`expanded_${x}`,valuePropName:"checked",children:(0,t.jsx)(o.ui_kit$Switch,{id:`expanded_${x}`,label:i("expanded"),labelSize:"small",size:"small"})})]})}),(0,t.jsx)(o.ui_kit$Col,{children:c?.settings?.sections?.length>1&&(0,t.jsx)(o.ui_kit$Button,{type:"text",icon:(0,t.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:16}),style:{marginRight:"auto"},onClick:()=>m(x)})})]},`expanded_${x}`))})}),(0,t.jsx)(o.ui_kit$Row,{gutter:20,children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:s.formItemMarginBottomMD},children:(0,t.jsx)(o.ui_kit$Button,{style:{display:"inline-flex",alignItems:"center",width:"100%"},icon:(0,t.jsx)(r.EmIcons,{icon:"PlusCircleOutlined",component:o.icons$PlusCircleOutlined,size:16,strokeWidth:d.iconStrokeWidth}),onClick:()=>h(),children:i(" Add section")})})})}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"})]})})};Ws.propTypes={};var{Text:Hd}=o.ui_kit$Typography,Ud="em",zs="text/plain",Wd=(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"}),zd=(0,t.jsx)("span",{className:"addon-text-content",children:"Title"});function Ct(e){return e.closest(".email-pane__collapse-wrapper")}function Wo({form:e,name:i,placeholder:s,usedColors:l,onColorChange:a}){const d=o.ui_kit$Form.useWatch(i,e);return(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:s,usedColors:l,value:typeof d=="string"?d:"",onChange:c=>a(i,c)})}var Gd=/^[a-z][a-z0-9+.-]*:/i;function Gs(e){const i=Jt(typeof e=="string"?e:String(e??""));return i?Gd.test(i)?i:`https://${i}`:""}function Yd(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 Xd(e){const i=Gs(e);if(!i)return!1;try{const s=new URL(i);return!(s.protocol!=="http:"&&s.protocol!=="https:"||!s.hostname)}catch{return!1}}async function Ys(e,i){if(i===r.MODALS.UPLOAD_IMAGE_MODAL_EDIT&&bo(e)){try{const s=new URL(e,typeof window<"u"&&window.location?window.location.origin:"http://localhost").href,l=await fetch(s);if(l.ok){const a=await l.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 Kd(){const e=r.useSelector(r.selectEditorThemeColor$1),[i,s]=(0,n.useState)(()=>typeof document<"u"&&document.body.classList.contains("dark"));return(0,n.useEffect)(()=>{const l=()=>s(document.body.classList.contains("dark"));l();const a=new MutationObserver(l);return a.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>a.disconnect()},[]),e==="vs-dark"||i?"dark":"light"}function qd(e){const i=String(e?.bgColor??"").trim();return{blockBgEnabled:!!(e?.bgEnabled&&i),blockBgColor:i}}function zo(e,i,s){return{...e,buttonBgColor:i,hostCellBgForIconLuminance:String(s??"").trim()}}function Xs(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 Ks(e){if(!Array.isArray(e)||e.length===0)return"";const i=e.map(l=>l.customIcon?"":String(l?.itemBorderColor??"").trim()),s=i[0];return i.every(l=>l===s)?s:""}function Go(e,i){const s=String(e??"").trim(),l=String(i??"").trim();return l||s}function Jd(e,i){const s=String(e??"").trim(),l=String(i??"").trim();return!l||s&&l===s?"":l}function Qd(e,i,s){const l=String(e??"").trim(),a=String(i??"").trim(),d=String(s??"").trim();return d&&(!l||d!==l)?d:a}function Zd(e,i){return(e||[]).map(s=>({...s,itemBorderColor:s.customIcon?"":i}))}function ec(e,i,s){return(e||[]).map(l=>({...l,buttonBgColor:l.customIcon?"":Qd(i,s,l.buttonBgColor)}))}function tc(e,i){if(e==null)return;const s=(l,a)=>{if(!a||!Object.prototype.hasOwnProperty.call(a,"platform"))return;const d=a.platform;d==null||d===""||i(l,d)};if(Array.isArray(e))e.forEach((l,a)=>{s(a,l)});else if(typeof e=="object")for(const l of Object.keys(e)){const a=Number.parseInt(l,10);Number.isNaN(a)||s(a,e[l])}}function qs({__:e,form:i,fieldName:s,pushSettingsToIframe:l,onMetaActiveChange:a}){const{token:d}=(0,o.ui_kit$useToken)(),c=o.ui_kit$Form.useWatch(["items",s],i),p=c&&typeof c=="object"?c:{},g=typeof p.alt=="string"?p.alt:"",b=typeof p.title=="string"?p.title:"",[k,h]=(0,n.useState)(!1),[m,S]=(0,n.useState)(!1),x=(0,n.useRef)(null),f=(0,n.useRef)(null),y=(0,n.useMemo)(()=>({clearIcon:(0,t.jsx)(o.ui_kit$ColorPickerClearGlyph,{})}),[]);(0,n.useEffect)(()=>{g.trim()&&h(!0)},[g]);const v=!!(g.trim()||k),N=!!(b.trim()||m),B=v||N;(0,n.useLayoutEffect)(()=>{a(s,{alt:v,title:N})},[v,s,a,N]);const C=(0,n.useMemo)(()=>({marginBottom:B?d.formItemMarginBottomXS:0}),[B,d.formItemMarginBottomXS]),$=(0,n.useMemo)(()=>[s,"alt"],[s]),U=(0,n.useMemo)(()=>[s,"title"],[s]),L=B?"selected-social-form__meta-fields":"selected-social-form__meta-fields is-hidden",F=v?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",P=N?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",H=(0,n.useMemo)(()=>g.trim()?g.trim():e("Alternative text"),[e,g]),ae=(0,n.useMemo)(()=>b.trim()?b.trim():e("Tooltip text"),[e,b]),T=(0,n.useMemo)(()=>(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":v}),[v]),te=(0,n.useMemo)(()=>(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":N}),[N]),xe=(0,n.useCallback)(me=>{setTimeout(()=>{const he=me.current;if(he){if(typeof he.focus=="function"){he.focus();return}he.input&&typeof he.input.focus=="function"&&he.input.focus()}},0)},[]),be=(0,n.useCallback)(()=>{v?(h(!1),g.trim()&&(i.setFieldValue(["items",s,"alt"],""),setTimeout(()=>l(),0))):(h(!0),xe(x))},[v,g,s,xe,i,l]),ye=(0,n.useCallback)(()=>{if(N)a(s,{title:!1}),S(!1),b.trim()&&(i.setFieldValue(["items",s,"title"],""),setTimeout(()=>l(),0));else{S(!0),a(s,{title:!0});const me=g.trim();i.setFieldValue(["items",s,"title"],me),setTimeout(()=>l(),0),xe(f)}},[g,s,xe,i,a,l,N,b]);return(0,t.jsxs)("div",{className:"selected-social-form__meta-block",children:[(0,t.jsxs)(o.ui_kit$Space,{size:8,className:"selected-social-form__meta-toggle-row",style:C,children:[(0,t.jsx)(o.ui_kit$Tooltip,{title:H,placement:"bottom",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Button,{type:"default",className:T,onClick:be,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),(0,t.jsx)(o.ui_kit$Tooltip,{title:ae,placement:"bottom",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Button,{type:"default",className:te,onClick:ye,children:(0,t.jsx)("span",{className:"addon-text-content",children:"Title"})})})]}),(0,t.jsxs)("div",{className:L,children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:$,className:F,children:(0,t.jsx)(o.ui_kit$Input,{ref:x,placeholder:e("Alternative text"),allowClear:y,prefix:Wd})}),(0,t.jsx)(o.ui_kit$Form.Item,{name:U,className:P,children:(0,t.jsx)(o.ui_kit$Input,{ref:f,placeholder:e("Social network name"),allowClear:y,prefix:zd})})]})]})}qs.propTypes={__:_.default.func.isRequired,form:_.default.object.isRequired,fieldName:_.default.oneOfType([_.default.number,_.default.string]).isRequired,pushSettingsToIframe:_.default.func.isRequired,onMetaActiveChange:_.default.func.isRequired};function oc(e,i){if(!Array.isArray(e)||e.length===0)return i;let s=null;for(const l of e){const a=l.iconWidth;if(a==null||Number.isNaN(a)||a<=0)return i;if(s===null)s=a;else if(a!==s)return i}return s??i}function ic(e){if(!e)return{align:"center",iconSize:40,borderRadius:0,gap:8,globalBgColor:"",globalItemBorderColor:"",buttonBorderWidth:0,showLabel:!1,items:[]};const i=qd(e),s=String(e?.hostCellBgForIconLuminance??"").trim(),l=oc(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:l,borderRadius:e.borderRadius??0,gap:e.gap??8,globalBgColor:d,globalItemBorderColor:Ks(e.items),buttonBorderWidth:a,showLabel:e.showLabel??!1,items:Array.isArray(e.items)?e.items.map(c=>{const p=!!c.customIcon,g=p?"":Go(d,c.buttonBgColor),b=c.platform&&!p?r.getSocialIconForBlockCell(c.platform,zo(i,g,s)):null;return{...c,customIcon:p,title:String(c.title??"").trim(),...b?{iconSrc:b}:{},iconWidth:null,iconHeight:null,buttonBgColor:g,itemBorderColor:p?"":String(c.itemBorderColor??"").trim()}}):[]}}var Js=({elementSettings:e})=>{const{__:i}=r.useI18n(),s=r.useAppConfig(),l=r.useDispatch(),[a]=o.ui_kit$Form.useForm(),d=r.useSendPostMessage(),c=r.useSendPostMessageEx(),{openImagePicker:p}=r.useImagePicker(),[g,b]=(0,n.useState)(e),[k,h]=(0,n.useState)(null),[m,S]=(0,n.useState)(null),x=(0,n.useRef)(null),f=(0,n.useRef)(null),y=(0,n.useRef)(null),v=(0,n.useRef)(Xs(e)),N=r.useSelector(r.selectEmailSettings),B=(0,n.useRef)(null),C=(0,n.useRef)(!1),$=(0,n.useRef)(""),U=(0,n.useRef)({}),L=Kd(),F=N?.usedColors??[],P=o.ui_kit$Form.useWatch("items",a)||[],H=(0,n.useCallback)(()=>{B.current&&(document.removeEventListener("dragover",B.current,!0),B.current=null)},[]),ae=(0,n.useCallback)(()=>{if(B.current)return;const z=re=>{re.preventDefault(),re.dataTransfer&&(re.dataTransfer.dropEffect="move")};document.addEventListener("dragover",z,!0),B.current=z},[]),T=(0,n.useMemo)(()=>r.getSocialPresetsForBrand(Ud).filter(z=>r.SOCIAL_ICON_ORIGINAL_BY_PLATFORM[z.id]),[]),te=(0,n.useMemo)(()=>T.map(z=>({value:z.id,label:(0,t.jsxs)("span",{className:"selected-social-form__platform-option",children:[(0,t.jsx)("img",{src:r.getSocialIcon(z.id,L),alt:""}),(0,t.jsx)("span",{className:"selected-social-form__platform-option-text",children:i(z.labelMsgid)})]})})),[i,T,L]),xe=(0,n.useCallback)((z,re)=>{U.current={...U.current,[z]:{...U.current[z],...re}}},[]);(0,n.useEffect)(()=>{const z=Xs(e);v.current!==z&&(v.current=z,U.current={},b(e))},[e]);const be=(0,n.useRef)(!1);(0,n.useEffect)(()=>{if(g?.settings){if(be.current){be.current=!1;return}const z=g.settings;$.current=z.bgEnabled&&z.bgColor?String(z.bgColor).trim():"",a.setFieldsValue(ic(g.settings))}},[g,a]),(0,n.useEffect)(()=>()=>H(),[H]);const ye=(0,n.useCallback)(()=>{const z=a.getFieldsValue(!0),re=g.settings||{},Pe=String(re.hostCellBgForIconLuminance??"").trim(),G=(z.globalBgColor||"").trim(),Se=typeof z.iconSize=="number"&&!Number.isNaN(z.iconSize)?z.iconSize:re.iconSize??40,Fe=typeof z.borderRadius=="number"&&!Number.isNaN(z.borderRadius)?z.borderRadius:re.borderRadius??0,Ae=typeof z.gap=="number"&&!Number.isNaN(z.gap)?z.gap:re.gap??8,Ve={blockBgEnabled:!!G,blockBgColor:G},Ue=(z.globalItemBorderColor||"").trim();let Xe=typeof z.buttonBorderWidth=="number"&&!Number.isNaN(z.buttonBorderWidth)?z.buttonBorderWidth:0;Xe=Math.max(0,Math.min(24,Math.round(Xe)));const ne={...re,type:"social",align:z.align??re.align??"center",iconSize:Se,borderRadius:Fe,gap:Ae,bgEnabled:!!G,bgColor:G,hostCellBgForIconLuminance:Pe,borderWidth:typeof re.borderWidth=="number"?re.borderWidth:0,borderColor:typeof re.borderColor=="string"?re.borderColor:"",buttonBorderColor:"",buttonBorderWidth:Xe,showLabel:z.showLabel,items:(z.items||[]).filter(Boolean).map((Te,I)=>{const se=!!Te.customIcon,je=U.current[I]||{},Ne=se?"":Jd(G,(Te.buttonBgColor||"").trim()),He=typeof Te.href=="string"?Gs(Te.href):Te.href,Ke=se?"":Go(G,Ne),tt=!se&&Te.platform?r.getSocialIconForBlockCell(Te.platform,zo(Ve,Ke,Pe)):null,O=se?"":Ue||String(Te.itemBorderColor??"").trim(),ie=Yd(se?Te.iconSrc||"":tt||Te.iconSrc||"");return{...Te,customIcon:se,href:He,iconSrc:ie,iconWidth:null,iconHeight:null,buttonBgColor:Ne,itemBorderColor:O,title:je.title?String(Te.title??"").trim():""}})};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.SOCIAL,caption:g.caption,settings:ne}),$.current=G,be.current=!0,b(Te=>({...Te,settings:ne}))},[g.caption,g.settings,a,d]),me=(0,n.useCallback)(z=>{if(z==null||z==="")return-1;const re=r.stripEmVersionFromUrlString(String(z));return(a.getFieldValue("items")||[]).findIndex(Pe=>r.stripEmVersionFromUrlString(Pe&&Pe.iconSrc||"")===re)},[a]),he=(0,n.useCallback)((z,re,Pe,G)=>{const Se=[...a.getFieldValue("items")||[]];if(z<0||z>=Se.length)return;const Fe=r.stripEmVersionFromUrlString(String(G||""))===r.stripEmVersionFromUrlString(String(re||""));(!Fe||re!==Se[z]?.iconSrc)&&(Se[z]={...Se[z],iconSrc:re,customIcon:!0,buttonBgColor:"",itemBorderColor:""},a.setFieldValue("items",Se),setTimeout(()=>ye(),0)),Pe?.mode==="save"&&Fe&&c(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(re)})},[a,ye,c]),ke=(0,n.useCallback)(async(z,re)=>{const Pe=r.stripEmVersionFromUrlString(String(re||"")),G=me(re);if(G<0)return;const Se=(a.getFieldValue("items")||[])[G]?.iconSrc,{entryModal:Fe,currentUrl:Ae,imageDataUrl:Ve}=await Ys(Pe,z),Ue=await p({kind:"img",currentUrl:Ae,entryModal:Fe,imageDataUrl:Ve});Ue?.url&&he(G,Ue.url,Ue.meta,Se)},[he,me,a,p]),ce=(0,n.useCallback)(async z=>{const re=(a.getFieldValue("items")||[])[z];if(!re)return;const{entryModal:Pe,currentUrl:G,imageDataUrl:Se}=await Ys(r.stripEmVersionFromUrlString(String(re.iconSrc||"")),r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD),Fe=re.iconSrc,Ae=await p({kind:"img",currentUrl:G,entryModal:Pe,imageDataUrl:Se});Ae?.url&&he(z,Ae.url,Ae.meta,Fe)},[he,a,p]),ze=(0,n.useCallback)(z=>{const re=parseInt(z.currentTarget.dataset.socialEditIndex??"",10);Number.isNaN(re)||ce(re)},[ce]),Oe=(0,n.useCallback)(z=>{const re=z.data?.operation,Pe=z.data?.src;re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?ke(r.MODALS.UPLOAD_IMAGE_MODAL_AI,Pe):re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?ke(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,Pe):re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?ke(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT,Pe):re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?ke(r.MODALS.UPLOAD_IMAGE_MODAL_GIF,Pe):re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?ke(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK,Pe):re===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(l(r.closeSecondModal()),l(r.closeModal$1()))},[l,ke]);r.useListenPostMessage(Oe);const ve=(0,n.useCallback)(()=>{const z=a.getFieldValue("items")||[],re=T[0],Pe=(a.getFieldValue("globalItemBorderColor")||"").trim(),G=(a.getFieldValue("globalBgColor")||"").trim();if(!re)a.setFieldsValue({items:[...z,{platform:void 0,customIcon:!1,href:"",alt:"",title:"",iconSrc:"",iconWidth:null,iconHeight:null,buttonBgColor:G,itemBorderColor:Pe}]});else{const Se=String(g?.settings?.hostCellBgForIconLuminance??"").trim(),Fe=Go(G,G),Ae=r.getSocialIconForBlockCell(re.id,zo({blockBgEnabled:!!G,blockBgColor:G},Fe,Se)),Ve=i(re.labelMsgid);a.setFieldsValue({items:[...z,{platform:re.id,customIcon:!1,href:"",alt:Ve,title:"",iconSrc:Ae,iconWidth:null,iconHeight:null,buttonBgColor:G,itemBorderColor:Pe}]})}setTimeout(()=>ye(),0)},[i,g?.settings?.hostCellBgForIconLuminance,a,T,ye]),Ee=(0,n.useCallback)((z,re)=>{z.dataTransfer.setData(zs,String(re)),z.dataTransfer.setData(r.DND_SOCIAL_LIST_REORDER_MIME,String(re)),z.dataTransfer.effectAllowed="move",x.current=re,h(re),ae()},[ae]),pe=(0,n.useCallback)(()=>{H(),x.current=null,h(null),S(null)},[H]),Q=(0,n.useCallback)((z,re,Pe)=>{if(Pe<2)return;z.preventDefault(),z.dataTransfer.dropEffect="move";const G=x.current;G!==null&&G!==re&&S(re)},[]),X=(0,n.useCallback)((z,re)=>{z.currentTarget.contains(z.relatedTarget)||S(Pe=>Pe===re?null:Pe)},[]),Z=(0,n.useCallback)((z,re,Pe)=>{z.preventDefault(),S(null);const G=z.dataTransfer.getData(zs),Se=parseInt(G,10);if(Number.isNaN(Se)||Se===re){H();return}Pe(Se,re),H(),setTimeout(()=>ye(),0)},[H,ye]),J=(0,n.useCallback)(z=>{const re=z.currentTarget,Pe=parseInt(re.dataset.itemIndex??"",10);Number.isNaN(Pe)||Ee(z,Pe)},[Ee]),V=(0,n.useCallback)(z=>{const re=z.currentTarget,Pe=parseInt(re.dataset.itemIndex??"",10),G=parseInt(re.dataset.listLength??"",10);Number.isNaN(Pe)||Number.isNaN(G)||G<2||(z.preventDefault(),z.dataTransfer&&(z.dataTransfer.dropEffect="move"))},[]),M=(0,n.useCallback)(z=>{const re=z.currentTarget,Pe=parseInt(re.dataset.itemIndex??"",10),G=parseInt(re.dataset.listLength??"",10);Number.isNaN(Pe)||Number.isNaN(G)||Q(z,Pe,G)},[Q]),Y=(0,n.useCallback)(z=>{const re=parseInt(z.currentTarget.dataset.itemIndex??"",10);Number.isNaN(re)||X(z,re)},[X]),K=(0,n.useCallback)(z=>{const re=parseInt(z.currentTarget.dataset.itemIndex??"",10),Pe=f.current;Number.isNaN(re)||typeof Pe!="function"||Z(z,re,Pe)},[Z]),ee=(0,n.useCallback)(z=>{z.stopPropagation();const re=parseInt(z.currentTarget.dataset.fieldName??"",10),Pe=y.current;Number.isNaN(re)||typeof Pe!="function"||(Pe(re),queueMicrotask(ye))},[ye]),le=(0,n.useCallback)((z,re)=>{const Pe=T.find(ne=>ne.id===re);if(!Pe)return;const G=i(Pe.labelMsgid),Se=U.current[z]||{},Fe=String(a.getFieldValue(["items",z,"alt"])??"").trim();(Se.alt||Fe)&&a.setFieldValue(["items",z,"alt"],G),Se.title&&a.setFieldValue(["items",z,"title"],G);const Ae=(a.getFieldValue("globalBgColor")||"").trim(),Ve=Go(Ae,(a.getFieldValue(["items",z,"buttonBgColor"])||"").trim()),Ue=String(g?.settings?.hostCellBgForIconLuminance??"").trim(),Xe=r.getSocialIconForBlockCell(re,zo({blockBgEnabled:!!Ae,blockBgColor:Ae},Ve,Ue));Xe&&(a.setFieldValue(["items",z,"customIcon"],!1),a.setFieldValue(["items",z,"iconSrc"],Xe))},[i,g?.settings?.hostCellBgForIconLuminance,a,T]),Re=(0,n.useCallback)(z=>{if(Object.prototype.hasOwnProperty.call(z,"globalItemBorderColor")){if(!C.current){const re=String(z.globalItemBorderColor??"").trim(),Pe=a.getFieldValue("items")||[];a.setFieldsValue({items:Zd(Pe,re)})}}else if(Object.prototype.hasOwnProperty.call(z,"globalBgColor")){const re=$.current,Pe=String(z.globalBgColor??"").trim(),G=a.getFieldValue("items")||[];a.setFieldsValue({items:ec(G,re,Pe)})}else if(z?.items!=null){const re=a.getFieldValue("items")||[],Pe=Ks(re);Pe!==(a.getFieldValue("globalItemBorderColor")||"").trim()&&(C.current=!0,a.setFieldValue("globalItemBorderColor",Pe),queueMicrotask(()=>{C.current=!1}));const G=g.settings?.items||[];re.forEach((Se,Fe)=>{const Ae=Se?.platform,Ve=G[Fe]?.platform;Ae&&Ae!==Ve&&le(Fe,Ae)})}tc(z?.items,le),ye()},[g.settings?.items,a,ye,le]),Be=(0,n.useCallback)((z,re)=>{if(a.setFieldValue(z,re),Array.isArray(z)&&z[0]==="items"){Re({items:{[z[1]]:{[z[2]]:re}}});return}Re({[z]:re})},[a,Re]),$e=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"selected-social-form__section",children:[(0,t.jsx)("div",{className:"selected-social-form__section-title",children:i("General settings")}),(0,t.jsx)("div",{className:"selected-social-form__align-block",children:(0,t.jsx)(Dt,{form:a,elementSettings:{...g,type:r.ELEMENT_TYPES.SOCIAL}})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Button size"),placement:"bottom",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"iconSize",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:16,max:64,prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:"px",placeholder:i("Button size"),className:"selected-social-form__input-full"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Corner radius"),placement:"bottom",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"borderRadius",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,max:48,prefix:(0,t.jsx)(r.EmIcons,{icon:"BorderRadius",component:o.icons$BorderRadius,className:"selected-td-form__icon-radius"}),addonAfter:"px",placeholder:i("Corner radius"),className:"selected-social-form__input-full"})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Spacing"),placement:"bottom",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"gap",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,max:48,prefix:(0,t.jsx)(r.EmIcons,{icon:"PaddingLeftRight",component:o.icons$PaddingLeftRight}),addonAfter:"px",placeholder:i("Spacing"),className:"selected-social-form__input-full"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"globalBgColor",className:"form-item-margin-xs",children:(0,t.jsx)(Wo,{form:a,name:"globalBgColor",placeholder:i("Background color"),usedColors:F,onColorChange:Be})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Border"),placement:"bottom",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonBorderWidth",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,max:24,prefix:(0,t.jsx)(r.EmIcons,{icon:"BorderOuterOutlined",component:o.icons$BorderOuterOutlined}),addonAfter:"px",placeholder:i("Border"),className:"selected-social-form__input-full"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Border color"),placement:"bottom",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"globalItemBorderColor",className:"form-item-margin-xs",children:(0,t.jsx)(Wo,{form:a,name:"globalItemBorderColor",placeholder:i("Border color"),usedColors:F,onColorChange:Be})})})})]})]}),(0,t.jsxs)("div",{className:"selected-social-form__section selected-social-form__section--bordered",children:[(0,t.jsx)("div",{className:"selected-social-form__section-title",children:i("Social buttons")}),(0,t.jsx)(o.ui_kit$Form.List,{name:"items",children:(z,{remove:re,move:Pe})=>(f.current=Pe,y.current=re,(0,t.jsx)("div",{className:"selected-social-form__items",children:z.map((G,Se)=>{const Fe=!!(P[Se]?.customIcon??P[G.name]?.customIcon);return(0,t.jsxs)("div",{className:(0,We.default)("selected-social-form__card",k===Se&&"selected-social-form__card--dragging",m===Se&&k!==Se&&"selected-social-form__card--drag-over"),"data-item-index":Se,"data-list-length":z.length,onDragEnterCapture:V,onDragOverCapture:M,onDragLeave:Y,onDropCapture:K,children:[(0,t.jsxs)("div",{className:"selected-social-form__card-head",children:[(0,t.jsxs)("div",{className:"selected-social-form__card-head-main",children:[z.length>1?(0,t.jsx)("span",{className:"selected-social-form__drag-handle",draggable:!0,"data-item-index":Se,onDragStart:J,onDragEnd:pe,role:"button",tabIndex:0,"aria-label":i("Drag to reorder"),children:(0,t.jsx)(r.EmIcons,{icon:"HolderOutlined",component:o.icons$HolderOutlined})}):null,(0,t.jsxs)(Hd,{className:"selected-social-form__card-title",children:[i("Button")," ",Se+1]})]}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Delete"),placement:"top",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Button,{type:"text",className:"selected-social-form__card-head-remove",icon:(0,t.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:18,strokeWidth:s.iconStrokeWidth}),"aria-label":i("Delete"),"data-field-name":G.name,onClick:ee})})]}),(0,t.jsx)(o.ui_kit$Form.Item,{name:[G.name,"iconSrc"],hidden:!0,children:(0,t.jsx)(o.ui_kit$Input,{})}),(0,t.jsx)(o.ui_kit$Form.Item,{name:[G.name,"customIcon"],valuePropName:"checked",hidden:!0,children:(0,t.jsx)(o.ui_kit$Checkbox,{})}),(0,t.jsxs)("div",{className:"selected-social-form__platform-row",children:[(0,t.jsx)(o.ui_kit$Form.Item,{name:[G.name,"platform"],className:"selected-social-form__platform-field selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Select,{options:te,className:"selected-social-form__platform-select",classNames:{popup:{root:"selected-social-form__platform-dropdown"}},placeholder:i("Select"),suffixIcon:(0,t.jsx)(r.EmIcons,{icon:"ChevronDownCustom",component:o.icons$ChevronDownCustom,className:"ant-select-suffix"})})}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Edit icon"),placement:"top",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Button,{type:"text",className:"selected-social-form__platform-edit","data-social-edit-index":Se,icon:(0,t.jsx)(r.EmIcons,{icon:"EditOutlined",component:o.icons$EditOutlined,size:18,strokeWidth:s.iconStrokeWidth}),"aria-label":i("Edit icon"),onClick:ze})})]}),(0,t.jsx)(o.ui_kit$Form.Item,{name:[G.name,"href"],className:"selected-social-form__card-field",rules:[{required:!0,whitespace:!0,message:i("Please enter the URL.")},{validator:async(Ae,Ve)=>{const Ue=typeof Ve=="string"?Ve.trim():String(Ve??"").trim();if(Ue&&!Xd(Ue))throw new Error(i("Please enter the correct URL."))}}],children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"Link03",component:o.icons$Link03,className:"selected-social-form__field-icon"}),placeholder:i("Enter link"),allowClear:{clearIcon:(0,t.jsx)(o.ui_kit$ColorPickerClearGlyph,{})}})}),Fe?null:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,className:"selected-social-form__card-field selected-social-form__bg-color-row",children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:[G.name,"buttonBgColor"],className:"selected-social-form__card-field",children:(0,t.jsx)(Wo,{form:a,name:["items",G.name,"buttonBgColor"],placeholder:i("Background color"),usedColors:F,onColorChange:Be})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Border color"),placement:"bottom",getPopupContainer:Ct,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:[G.name,"itemBorderColor"],className:"selected-social-form__card-field",children:(0,t.jsx)(Wo,{form:a,name:["items",G.name,"itemBorderColor"],placeholder:i("Border color"),usedColors:F,onColorChange:Be})})})})]}),(0,t.jsx)(qs,{__:i,form:a,fieldName:G.name,pushSettingsToIframe:ye,onMetaActiveChange:xe})]},G.key)})}))}),(0,t.jsx)(o.ui_kit$Button,{type:"text",block:!0,className:"selected-social-form__add-bar",icon:(0,t.jsx)(r.EmIcons,{icon:"PlusSquareOutlined",component:o.icons$PlusSquareOutlined}),onClick:ve,children:i("Add button")})]})]});return(0,t.jsx)("div",{className:"selected-social-form",children:(0,t.jsx)(o.ui_kit$Form,{form:a,layout:"vertical",className:"selected-social-form__form element-controls",onValuesChange:Re,autoComplete:"off",children:(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:$e})})})};Js.propTypes={elementSettings:_.default.shape({settings:_.default.object,type:_.default.string,caption:_.default.string})};var ko=["borderAll","borderTop","borderRight","borderBottom","borderLeft"],Qs=["all","top","right","bottom","left"],Mi={width:1,style:"solid",color:"#E5E5E5"},Zs=["All","TopLeft","TopRight","BottomRight","BottomLeft"],ot=e=>u(e),It=e=>e!==""&&e!==null&&e!==void 0;function Eo(e,i=""){return typeof e=="number"?String(e):typeof e=="string"&&e?e:i}function Yo(e){return It(e?.width)||!!e?.style||!!e?.color}function el(e){const i=ko.find(s=>e[s]?.style);return i?e[i]:null}function Di(e){return el(e)??Mi}function Vi(e,i){const s=Qs.find(a=>Yo(i[a]))??"all",l=Yo(i[s])?i[s]:el(e)??{};return{mobileBorderPosition:s,mobileBorderWidth:l.width??"",mobileBorderColor:l.color??"",mobileBorderStyle:l.style??""}}var rc=e=>ot(e?.replace(/px$/,""));function tl(e,i){return Object.fromEntries(["LeftRight","TopBottom","Left","Right","Top","Bottom"].map(s=>{const l=`${i}padding${s}`;return[l,rc(e[l])]}))}function sc(e){return{borderRadiusAll:ot(e.all),borderRadiusTopLeft:ot(e.topLeft),borderRadiusTopRight:ot(e.topRight),borderRadiusBottomRight:ot(e.bottomRight),borderRadiusBottomLeft:ot(e.bottomLeft)}}function lc(e){const i=s=>ot(s!==null?s:e.all);return{mobileBorderRadiusAll:ot(e.all),mobileBorderRadiusTopLeft:i(e.topLeft),mobileBorderRadiusTopRight:i(e.topRight),mobileBorderRadiusBottomRight:i(e.bottomRight),mobileBorderRadiusBottomLeft:i(e.bottomLeft)}}function ol(e,i){return{[`${i}Inset`]:ot(e?.inset)||!1,[`${i}HOffset`]:ot(e?.hOffset),[`${i}VOffset`]:ot(e?.vOffset),[`${i}BlurRadius`]:ot(e?.blurRadius),[`${i}SpreadRadius`]:ot(e?.spreadRadius),[`${i}Color`]:ot(e?.color)}}function il(e,i){return Object.fromEntries(ko.map(s=>[`${i}${s}`,e[`${i}${s}`]]))}function ac(e){return{fontFamily:ot(e.fontFamily),fontSize:ot(e.fontSize),lineHeight:ot(e.lineHeight),textStrong:ot(e.textStrong),textItalic:ot(e.textItalic),textStrikethrough:ot(e.textStrikethrough),textUnderline:ot(e.textUnderline),textLink:ot(e.textLink),linkHref:ot(e.linkHref),linkTarget:ot(e.linkTarget),textColor:ot(e.textColor),textBackgroundColor:ot(e.textBackgroundColor),textAlign:ot(e.textAlign),valign:ot(e.textValign)}}function rl(e){const i=e.customTable,s=i.mobileBackgroundColor;return{show:e.show||"all",outlookBackground:e.outlookBackground,...to(e),mobileBackgroundColor:ot(s?.value!=="none"?s?.value:""),...tl(i,""),...tl(i,"cell_"),backgroundColor:ot(i.backgroundColor),backgroundImage:ot(i.backgroundImage?.[0]?.value),backgroundPositionX:ot(i.backgroundPositionX),backgroundPositionY:ot(i.backgroundPositionY),backgroundRepeat:ot(i.backgroundRepeat),backgroundSize:ot(i.backgroundSize),...il(i,""),borderPosition:i.borderPosition||"borderAll",...il(i,"cell_"),cell_borderPosition:i.cell_borderPosition||"cell_borderAll",cellBackgroundColor:ot(i.cellBackgroundColor),...sc(i.borderRadius),...ol(i.boxShadow,"boxShadow"),...ol(i.mobileBoxShadow,"mobileBoxShadow"),mobileWidth:bt(i.mobileWidth?.value),mobileWidthDim:i.mobileWidth?.dim,mobileHeight:bt(i.mobileHeight?.value),mobileHeightDim:i.mobileHeight?.dim,...lc(i.mobileBorderRadius),...Vi(i,i.mobileBorder),...ac(i)}}function sl(e,i){return Zs.some(s=>Number(e[`${i}Radius${s}`])>0)}function ll(e,i){return["Color","HOffset","VOffset"].some(s=>It(e[`${i}${s}`]))}function nc(e){const i=e.mobileBackgroundRepeat;return["mobileBackgroundColor","mobileBackgroundImage","mobileBackgroundPositionX","mobileBackgroundPositionY"].some(s=>It(e[s]))||It(i)&&i!=="none"||It(e.mobileBackgroundSize)}function al(e,i,s,l){switch(e){case"border":return ko.some(a=>!!i[`${l?"cell_":""}${a}`]?.style);case"background":return l?It(i.cellBackgroundColor):It(i.backgroundColor)||It(i.backgroundImage);case"borderRadius":return sl(i,"border");case"boxShadow":return ll(i,"boxShadow");case"mobileSize":return It(i.mobileWidth)||It(i.mobileHeight);case"mobileBackground":return nc(i);case"mobileBorder":return Qs.some(a=>Yo(s[a]));case"mobileBorderRadius":return sl(i,"mobileBorder");case"mobileBoxShadow":return ll(i,"mobileBoxShadow");default:return!1}}var nl=["background","border","borderRadius","boxShadow","mobileSize","mobileBackground","mobileBorder","mobileBorderRadius","mobileBoxShadow"];function dl(e,i,s){const l={padding:!0,cellPadding:!0,background:!1,border:!1,borderRadius:!1,boxShadow:!1,mobileSize:!1,mobileBackground:!1,mobileBorder:!1,mobileBorderRadius:!1,mobileBoxShadow:!1};return nl.forEach(a=>{l[a]=al(a,e,i,s)}),l}function dc(e,i){const s={...e};return nl.forEach(l=>{s[l]=e[l]||i[l]}),s}function Xo(e,i){const s=i==="mobile"?"mobileBorderRadius":"borderRadius",[l,...a]=Zs.map(d=>e[`${s}${d}`]);return!!l||!a.some(d=>!!d)}var cc=["borderRadius","mobileWidth","mobileHeight","mobileBoxShadow","mobileBorder","mobileBorderRadius"],uc=["textStrong","textItalic","textStrikethrough","textUnderline","textLink","linkHref","textAlign"];function cl(e,i){return Object.fromEntries(i.map(s=>[s,e[s]]))}function mc(e){return{...e,...cl(e.customTable,cc)}}function pc(e){return{...e,...cl(e.customTable,uc),valign:e.customTable.textValign}}var Ko={hOffset:5,vOffset:5,blurRadius:10,spreadRadius:-5,color:"#000000",inset:!1},qo={hOffset:null,vOffset:null,blurRadius:null,spreadRadius:null,inset:!1},Jo=5,Qo="#E5E5E5",ul="em-mob-box_shadow-",ml="em-mob-border_radius_all-",hc={width:"",style:"",color:""},bc=["LeftRight","TopBottom","Left","Right","Top","Bottom"],pl=["All","TopLeft","TopRight","BottomRight","BottomLeft"],gc=["backgroundColor","backgroundImage","backgroundPositionX","backgroundPositionY","backgroundRepeat","backgroundSize"];function Zo(e,i){return{[`${e}Inset`]:i.inset??!1,[`${e}HOffset`]:i.hOffset??null,[`${e}VOffset`]:i.vOffset??null,[`${e}BlurRadius`]:i.blurRadius??null,[`${e}SpreadRadius`]:i.spreadRadius??null,[`${e}Color`]:i.color??""}}var So=(e,i="")=>Object.fromEntries(e.map(s=>[s,i])),fc={padding:{off:()=>({fields:So(bc.map(e=>`padding${e}`)),settings:{padding:{all:0}}})},background:{on:({prefix:e})=>{const i=e?"cellBackgroundColor":"backgroundColor";return{fields:{[i]:Qo},settings:{[i]:Qo}}},off:({prefix:e})=>e?{fields:{cellBackgroundColor:""},settings:{cellBackgroundColor:""}}:{fields:So(gc),backgroundImageEmpty:!0,settings:{backgroundColor:"",backgroundImage:[{type:"url",value:""}],backgroundRepeat:"",backgroundSize:""}}},border:{on:({prefix:e})=>({fields:{[`${e}borderPosition`]:`${e}borderAll`,[`${e}borderAll`]:Mi},settings:{[`${e}borderAll`]:Mi}}),off:({prefix:e})=>({fields:So(ko.map(i=>`${e}${i}`),hc),settings:{[`${e}borderAll`]:{style:""}}})},borderRadius:{on:()=>({fields:{borderRadiusAll:Jo},settings:{borderRadius:{all:Jo}},uniformRadius:"desktop"}),off:()=>({fields:So(pl.map(e=>`borderRadius${e}`)),settings:{borderRadius:{all:0}},uniformRadius:"desktop"})},boxShadow:{on:()=>({fields:Zo("boxShadow",Ko),settings:{boxShadow:Ko}}),off:()=>({fields:Zo("boxShadow",qo),settings:{boxShadow:{...qo,color:""}}})},mobileSize:{off:({fields:e})=>({fields:{mobileWidth:"",mobileHeight:""},settings:{mobileWidth:{value:null,dim:Eo(e.mobileWidthDim,"px"),classNamePrefix:"em-mob-width-"},mobileHeight:{value:null,dim:"px",classNamePrefix:"em-mob-height-"}}})},mobileBackground:{on:()=>({fields:{mobileBackgroundColor:Qo},settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:Qo}}}),off:()=>({fields:{...to({}),mobileBackgroundColor:""},settings:ms()})},mobileBorder:{on:({settings:e})=>{const i={...Di(e.customTable),classNamePrefix:"em-mob-border_all-"},s={...r.RESET_BORDER_PARAMS,all:i};return{fields:Vi(e.customTable,s),settings:{mobileBorder:{all:i}},mobileBorders:s}},off:({settings:e})=>({fields:Vi(e.customTable,r.RESET_BORDER_PARAMS),settings:{mobileBorder:r.RESET_BORDER_PARAMS},mobileBorders:r.RESET_BORDER_PARAMS})},mobileBorderRadius:{on:()=>({fields:{mobileBorderRadiusAll:Jo},settings:{mobileBorderRadius:{all:Jo,classNamePrefix:ml}},uniformRadius:"mobile"}),off:()=>({fields:So(pl.map(e=>`mobileBorderRadius${e}`)),settings:{mobileBorderRadius:{all:null,classNamePrefix:ml}},uniformRadius:"mobile"})},mobileBoxShadow:{on:()=>({fields:Zo("mobileBoxShadow",Ko),settings:{mobileBoxShadow:{...Ko,classNamePrefix:ul}}}),off:()=>({fields:Zo("mobileBoxShadow",qo),settings:{mobileBoxShadow:{...qo,color:null,classNamePrefix:ul}}})}},_c=["padding","cellPadding","background","border","borderRadius","boxShadow","mobileSize","mobileBackground","mobileBorder","mobileBorderRadius","mobileBoxShadow"];function xc(e,i,s){const l=c=>`${i}padding${c}`;if(s){const[c,p]=[e[l("LeftRight")],e[l("TopBottom")]];return{fields:{[l("Left")]:c,[l("Right")]:c,[l("Top")]:p,[l("Bottom")]:p}}}const[a,d]=[e[l("Left")],e[l("Top")]];return{fields:{[l("LeftRight")]:a,[l("TopBottom")]:d,[l("Right")]:a,[l("Bottom")]:d},settings:{[`${i}padding`]:{top:d,bottom:d,left:a,right:a}}}}function kc(e){const{form:i,settings:s,send:l,isTableCells:a,mobileBorders:d,setMobileBorders:c,setBackgroundImageEmpty:p}=e,g=(0,n.useMemo)(()=>rl(s),[s]),[b,k]=(0,n.useState)(()=>dl(g,s.customTable.mobileBorder,a)),[h,m]=(0,n.useState)(!0),[S,x]=(0,n.useState)(()=>Xo(g,"desktop")),[f,y]=(0,n.useState)(()=>Xo(g,"mobile"));(0,n.useEffect)(()=>{k(C=>dc(C,dl(g,s.customTable.mobileBorder,a))),x(Xo(g,"desktop")),y(Xo(g,"mobile"))},[g,s,a]);const v=a?"cell_":"",N=(0,n.useMemo)(()=>{const C=U=>{U&&(U.fields&&i.setFieldsValue(U.fields),U.mobileBorders&&c(U.mobileBorders),U.backgroundImageEmpty!==void 0&&p?.(U.backgroundImageEmpty),U.uniformRadius&&(U.uniformRadius==="mobile"?y:x)(!0),U.settings&&l(U.settings))},$=U=>{const L=i.getFieldsValue(!0),F=fc[U],P={fields:L,settings:s,prefix:v};b[U]?C(F?.off?.(P)):al(U,L,d,a)||C(F?.on?.(P)),k(H=>({...H,[U]:!H[U]}))};return Object.fromEntries(_c.map(U=>[U,()=>$(U)]))},[i,s,l,a,d,c,p,b,v]);return{open:b,toggle:N,paddingsExt:h,togglePaddingMode:()=>{const C=xc(i.getFieldsValue(!0),v,h);i.setFieldsValue(C.fields??{}),C.settings&&l(C.settings),m(!h)},oneBorderRadiusValue:S,setOneBorderRadiusValue:x,oneMobileBorderRadiusValue:f,setOneMobileBorderRadiusValue:y}}var ei={width:"",style:"",color:""},Ec="em-mob-box_shadow-",hl={mobileBorderWidth:"width",mobileBorderStyle:"style",mobileBorderColor:"color"},Sc=(e,i)=>({settings:{[e]:i}});function bl(e,i){return{hOffset:e[`${i}HOffset`],vOffset:e[`${i}VOffset`],blurRadius:e[`${i}BlurRadius`],spreadRadius:e[`${i}SpreadRadius`],color:e[`${i}Color`],inset:e[`${i}Inset`]}}var ti=e=>`em-mob-border_${e}-`,Bo=e=>({...r.RESET_BORDER_PARAMS[e],classNamePrefix:ti(e)});function gl(){return{top:Bo("top"),right:Bo("right"),bottom:Bo("bottom"),left:Bo("left")}}var Bc=e=>e?.width!=null&&e?.style!=null&&e?.color!=null;function Rc(e){const i=s=>({...e,classNamePrefix:ti(s)});return{top:i("top"),right:i("right"),bottom:i("bottom"),left:i("left")}}function Tc(e,i,s,l){const a=Di(l.settings.customTable),d=(c,p)=>{const g=c===i?s:e[p];return It(g)?g:a[c]};return{width:d("width","mobileBorderWidth"),style:d("style","mobileBorderStyle"),color:d("color","mobileBorderColor")}}var yc=(e,i,s,l)=>{const a=s.mobileBorderPosition||"all",d=hl[e],c=l.mobileBorders;if(!It(i)){const b=a==="all"?{...gl(),all:{...c.all,[d]:null,classNamePrefix:ti("all")}}:{...c,[a]:Bo(a),all:{...r.RESET_BORDER_PARAMS.all}};return{settings:{mobileBorder:b},mobileBorders:b}}const p={...Tc(s,d,i,l),classNamePrefix:ti(a)},g=a==="all"?{...gl(),all:p}:{...c,...Bc(c.all)?Rc(c.all):{},[a]:p,all:{...r.RESET_BORDER_PARAMS.all}};return{settings:{mobileBorder:g},mobileBorders:g,fields:{mobileBorderWidth:p.width,mobileBorderStyle:p.style,mobileBorderColor:p.color}}},wc=(e,i,s,l)=>{const a=l.mobileBorders[i],d=Yo(a)?a:Di(l.settings.customTable);return{fields:{mobileBorderWidth:d.width??"",mobileBorderColor:d.color??"",mobileBorderStyle:d.style??""}}},jc=(e,i,s)=>{if(i?.style==="")return{settings:{[e]:i},fields:{[e]:ei}};const l=s[e]??{},a=s.borderAll??{},d={...l,width:l.width===""?a.width||"1":l.width,color:l.color===""?a.color||"#b9b1b1":l.color,style:l.style===""?a.style||"solid":l.style};return{settings:{[e]:i},fields:{[e]:d,borderAll:ei}}},vc=(e,i)=>{const s=ko.filter(a=>a!=="borderAll"),l=i?.style===""?{borderAll:ei}:Object.fromEntries(s.map(a=>[a,ei]));return{settings:{[e]:i},fields:l}},$t=(e,i)=>Object.fromEntries(e.map(s=>[s,i])),Hi=(e,i)=>i.map(s=>e+s),Ic=["textAlign","valign"],fl=["Inset","HOffset","VOffset","BlurRadius","SpreadRadius","Color"],Cc=["Color","Image","PositionX","PositionY","Repeat","Size"],Pc={...$t(Hi("boxShadow",fl),(e,i,s)=>({settings:{boxShadow:bl(s,"boxShadow")}})),...$t(Hi("mobileBoxShadow",fl),(e,i,s)=>({settings:{mobileBoxShadow:{...bl(s,"mobileBoxShadow"),classNamePrefix:Ec}}})),...$t(Object.keys(W.BORDER_RADIUS_POSITION),(e,i)=>({settings:{borderRadius:{[W.BORDER_RADIUS_POSITION[e]]:+i}}})),...$t(Object.keys(W.MOBILE_BORDER_RADIUS_POSITION),(e,i)=>{const s=W.MOBILE_BORDER_RADIUS_POSITION[e];return{settings:{mobileBorderRadius:{[s]:i,classNamePrefix:`em-mob-border_radius_${s}-`}}}}),...$t(Hi("mobileBackground",Cc),(e,i)=>{const s=fo({[e]:i});return s?{settings:s}:{}}),...$t(Object.keys(hl),yc),...$t(["borderTop","borderRight","borderBottom","borderLeft"],jc),...$t(["fontSize","lineHeight"],(e,i)=>It(i)?{settings:{[e]:i}}:{}),...$t(Ic,()=>({})),borderAll:vc,borderPosition:()=>({}),mobileBorderPosition:wc,backgroundImage:(e,i,s,l)=>({settings:{backgroundImage:[{...l.settings.customTable.backgroundImage?.[0],type:"url",value:Eo(i)}],...i?{backgroundSize:"cover"}:{}},backgroundImageEmpty:i===""}),mobileWidth:(e,i,s)=>({settings:{mobileWidth:{classNamePrefix:"em-mob-width-",value:i,dim:Eo(s.mobileWidthDim)}}}),mobileWidthDim:(e,i,s)=>({settings:{mobileWidth:{classNamePrefix:"em-mob-width-",value:s.mobileWidth||100,dim:Eo(i)}}}),mobileHeight:(e,i,s)=>({settings:{mobileHeight:{classNamePrefix:"em-mob-height-",value:i,dim:Eo(s.mobileHeightDim)}}}),linkHref:(e,i)=>{const s=Jt(i);return{settings:{linkHref:s},linkHref:s,...s!==i?{fields:{linkHref:s}}:{}}}};function Ac(e,i,s){const[l]=Object.keys(e);return l?(Pc[l]??Sc)(l,e[l],i,s):{}}function Nc(e){const{form:i,settings:s,send:l,mobileBorders:a,setMobileBorders:d,setBackgroundImageEmpty:c,onLinkHref:p}=e;return(0,n.useCallback)(g=>{const b=Ac(g,i.getFieldsValue(!0),{settings:s,mobileBorders:a});b.fields&&i.setFieldsValue(b.fields),b.mobileBorders&&d(b.mobileBorders),b.backgroundImageEmpty!==void 0&&c(b.backgroundImageEmpty),b.linkHref!==void 0&&p(b.linkHref),b.settings&&l(b.settings)},[i,s,l,a,d,c,p])}function Lc(e){const i=e.customTable.mobileBorder,[s,l]=(0,n.useState)(i);return(0,n.useEffect)(()=>l(i),[i]),[s,l]}function Oc(e,i){return(0,n.useCallback)(s=>e({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i,settings:s}),[e,i])}var oo=["hover"],_l={width:"100%"},xl={paddingBottom:4},$c={textAlign:"right"},Ui=e=>e.parentNode,Fc=e=>e.closest(".selected-element-panel"),Mc=e=>e.closest(".email-pane__collapse-wrapper"),Dc=({elementSettings:e,__:i,token:s,sendAction:l,typografItems:a})=>{const d=W.useGoogleFontsLoader(),c=(0,n.useMemo)(()=>({marginBottom:s.formItemMarginBottomXS}),[s.formItemMarginBottomXS]),p=(0,n.useMemo)(()=>({items:a}),[a]),g=(0,n.useCallback)(()=>l("add_img"),[l]),b=(0,n.useCallback)(()=>l("typograf"),[l]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"AddImage",style:c,children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(r.EmIcons,{icon:"AddImage",component:o.icons$AddImage}),onClick:g,style:_l,children:i("Add image")})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"Typography",style:c,children:(0,t.jsx)(o.ui_kit$Dropdown,{arrow:!0,menu:p,trigger:oo,placement:"bottom",getPopupContainer:Fc,children:(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(r.EmIcons,{icon:"Typograf",component:o.icons$Typograf}),onClick:b,style:_l,children:i("Typography")})})})})]}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:oo,title:i("Text font"),placement:"bottom",zIndex:1,getPopupContainer:Ui,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:d,getPopupContainer:Mc})})}),!e.showOnMobile&&(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:oo,title:i("Font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"fontSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:i("Font size"),prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:oo,title:i("Line height"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"lineHeight",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:i("Line height"),prefix:(0,t.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]})]})},Vc=({elementSettings:e,__:i,token:s,textInputRef:l,linkProtocol:a,handleLinkProtocolsChange:d})=>{const c=!!e.customTable?.isNewLink,p=(0,n.useMemo)(()=>({marginBottom:s.formItemMarginBottomXS}),[s.formItemMarginBottomXS]);return(0,n.useEffect)(()=>{c&&l.current?.focus()},[c,l]),(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsxs)(o.ui_kit$Col,{span:24,children:[(0,t.jsx)(qt,{show:a==="#",__:i,style:p}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:oo,title:i("The URL that the hyperlink directs to."),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"linkHref",children:(0,t.jsx)(o.ui_kit$Input,{ref:l,addonBefore:(0,t.jsx)(Kt,{linkProtocol:a,handleLinkProtocolsChange:d,__:i}),allowClear:!0,placeholder:i("Hyperlink URL"),prefix:(0,t.jsx)(Xt,{linkProtocol:a})})})})]})})},Hc=({form:e,elementSettings:i,__:s,token:l,isMacOS:a,formValues:d,textInputRef:c,linkProtocol:p,handleLinkProtocolsChange:g})=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:s(a?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,t.jsx)(r.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:s(a?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,t.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:s(a?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,t.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:o.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:s(a?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,t.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,t.jsx)(o.ui_kit$Col,{span:3,children:(0,t.jsx)(it,{form:e,className:(0,We.default)("selected-text-common-form__button selected-text-common-form__button_style",{"selected-text-common-form__button--active":!!i.textLink}),elementSettings:i,name:"textLink",tooltipTitle:s("Link"),icon:(0,t.jsx)(r.EmIcons,{icon:"LinkOutlined",component:o.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"})})})]}),d?.textLink&&(0,t.jsx)(Vc,{elementSettings:i,__:s,token:l,textInputRef:c,linkProtocol:p,handleLinkProtocolsChange:g})]}),Uc=({form:e,elementSettings:i,__:s})=>{const l=(0,n.useMemo)(()=>[{message:s("Please set the font color")}],[s]),a=(0,n.useMemo)(()=>[{message:s("Please set the background color")}],[s]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:xl,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:oo,title:s("Text color"),placement:"bottom",zIndex:2,getPopupContainer:Ui,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",rules:l,children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:s("Color"),usedColors:i.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:oo,title:s("Text background"),placement:"bottom",zIndex:2,getPopupContainer:Ui,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textBackgroundColor",rules:a,children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:s("Background color"),usedColors:i.usedColors})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:xl,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Zt,{form:e,elementSettings:i,name:"textAlign"})}),(0,t.jsx)(o.ui_kit$Col,{span:12,style:$c,children:(0,t.jsx)(Ot,{form:e,elementSettings:i,name:"valign",isNewIconType:!0})})]})]})},Wc=e=>{const{form:i,elementSettings:s,__:l,token:a,appConfig:d,backgroundRepeatOptions:c,backgroundSizeOptions:p,handleToggleShowPaddingCell:g,handleTogglePaddingCell:b,handleToggleBackground:k,handleToggleBorder:h,handleToggleBorderRadius:m,paddingCellShow:S,paddingsExt:x,backgroundShow:f,cellBordersShow:y,borderRadiusShow:v,oneBorderRadiusValue:N,setOneBorderRadiusValue:B,backgroundImageEmpty:C}=e;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$FormSection,{title:l("Text"),dividerTop:!1,children:[d.formTextFieldTypografEnabled&&(0,t.jsx)(Dc,{...e}),(0,t.jsx)(Hc,{...e}),(0,t.jsx)(Uc,{...e})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:l("Padding"),collapsible:!0,open:S,onToggle:g,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormPaddingInputs,{namePrefix:"cell_",extended:x,onToggleExtended:b,gutter:a.marginSM,rowStyle:{paddingBottom:4},labels:{horizontal:l("Horizontal padding"),vertical:l("Vertical padding"),left:l("Left padding"),right:l("Right padding"),top:l("Top padding"),bottom:l("Bottom padding"),individual:l("Individual padding")}})}),(0,t.jsx)(o.ui_kit$FormSection,{title:l("Background"),collapsible:!0,open:f,onToggle:k,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormBackgroundSettings,{colorFieldName:"cellBackgroundColor",imageEnabled:d.formTableFieldBackgroundImageEnabled&&!1,backgroundImageEmpty:C,usedColors:s.usedColors,colorPlaceholder:l("Background color"),horizontalPositionPlaceholder:l("Horizontal position"),horizontalPositionTooltip:l("Horizontal position"),verticalPositionPlaceholder:l("Vertical position"),verticalPositionTooltip:l("Vertical position"),backgroundRepeatTooltip:l("Background image repeat"),backgroundSizeTooltip:l("Background image size"),selectPlaceholder:l("Please choose"),backgroundRepeatOptions:c,backgroundSizeOptions:p,imageUploadSlot:(d.formTableFieldBackgroundImageEnabled,void 0)})}),(0,t.jsx)(o.ui_kit$FormSection,{title:l("Borders"),collapsible:!0,open:y,onToggle:h,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:i,namePrefix:"cell_"})}),d.formFieldBorderRadiusEnabled&&!1]})},kl=({form:e,elementSettings:i,paddingShow:s,paddingsExt:l,backgroundShow:a,bordersShow:d,borderRadiusShow:c,boxShadowShow:p,handleToggleShowPadding:g,handleTogglePadding:b,handleToggleBackground:k,handleToggleBorder:h,handleToggleBorderRadius:m,handleToggleBoxShadow:S,backgroundRepeatOptions:x,backgroundSizeOptions:f,backgroundImageEmpty:y,oneBorderRadiusValue:v,setOneBorderRadiusValue:N})=>{const{__:B}=r.useI18n(),C=r.useAppConfig(),{token:$}=(0,o.ui_kit$useToken)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$FormSection,{title:B("Padding"),collapsible:!0,open:s,onToggle:g,children:(0,t.jsx)(o.ui_kit$FormPaddingInputs,{extended:l,onToggleExtended:b,gutter:$.marginSM,labels:{horizontal:B("Horizontal padding"),vertical:B("Vertical padding"),left:B("Left padding"),right:B("Right padding"),top:B("Top padding"),bottom:B("Bottom padding"),individual:B("Individual padding")}})}),(0,t.jsxs)(o.ui_kit$FormSection,{title:B("Background"),collapsible:!0,open:a,onToggle:k,dividerTop:!0,children:[(0,t.jsx)(o.ui_kit$FormBackgroundSettings,{imageEnabled:C.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:y,usedColors:i.usedColors,colorPlaceholder:B("Background color"),horizontalPositionPlaceholder:B("Horizontal position"),horizontalPositionTooltip:B("Horizontal position"),verticalPositionPlaceholder:B("Vertical position"),verticalPositionTooltip:B("Vertical position"),backgroundRepeatTooltip:B("Background image repeat"),backgroundSizeTooltip:B("Background image size"),selectPlaceholder:B("Please choose"),backgroundRepeatOptions:x,backgroundSizeOptions:f,imageUploadSlot:C.formTableFieldBackgroundImageEnabled?(0,t.jsx)(Pt,{form:e,label:B("Background image"),name:"backgroundImage",tooltipTitle:B("Background image"),placeholder:B("Background image link/route")}):void 0}),(0,t.jsx)(eo,{form:e,showBackground:!0})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:B("Borders"),collapsible:!0,open:d,onToggle:h,dividerTop:!0,children:(0,t.jsx)(W.SelectedElementFormBorder,{form:e})}),C.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:B("Border radius"),collapsible:!0,open:c,onToggle:m,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,oneBorderRadiusValue:v,setOneBorderRadiusValue:N,elementSettings:i})}),C.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:B("Box shadow"),collapsible:!0,open:p,onToggle:S,dividerTop:!0,children:(0,t.jsx)(wt,{})}),C.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:B("Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e})})]})};kl.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,paddingShow:_.default.bool,paddingsExt:_.default.bool,backgroundShow:_.default.bool,bordersShow:_.default.bool,borderRadiusShow:_.default.bool,boxShadowShow:_.default.bool,handleToggleShowPadding:_.default.func,handleTogglePadding:_.default.func,handleToggleBackground:_.default.func,handleToggleBorder:_.default.func,handleToggleBorderRadius:_.default.func,handleToggleBoxShadow:_.default.func,backgroundRepeatOptions:_.default.array,backgroundSizeOptions:_.default.array,backgroundImageEmpty:_.default.bool,oneBorderRadiusValue:_.default.bool,setOneBorderRadiusValue:_.default.func};var El=({form:e,elementSettings:i,mobileSizeShow:s,mobileBackgroundShow:l,mobileBordersShow:a,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,handleToggleMobileSize:p,handleToggleMobileBackground:g,handleToggleMobileBorder:b,handleToggleMobileBorderRadius:k,handleToggleMobileBoxShadow:h,oneMobileBorderRadiusValue:m,setOneMobileBorderRadiusValue:S,mobileBorders:x})=>{const{__:f,_x:y}=r.useI18n(),v=r.useAppConfig(),{token:N}=(0,o.ui_kit$useToken)(),B=r.useSelector(r.selectEmailSettings);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$FormSection,{title:f("Size"),collapsible:!0,open:s,onToggle:p,dividerTop:!0,children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:f("Table width"),placement:"left",children:(0,t.jsx)("div",{style:{marginBottom:N.formItemMarginBottomMD+4},children:(0,t.jsx)(Ht,{form:e,name:"mobileWidth",elementSettings:i})})})})}),(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)("div",{style:{marginBottom:N.formItemMarginBottomXS*2},children:(0,t.jsx)(o.ui_kit$Tooltip,{title:f("Height"),placement:"bottom",children:(0,t.jsx)(Qt,{form:e,name:"mobileHeight",elementSettings:i})})})})})]})}),(0,t.jsx)(o.ui_kit$FormSection,{title:f("Background"),collapsible:!0,open:l,onToggle:g,dividerTop:!0,children:(0,t.jsx)(xo,{elementSettings:Ut(i),imageEnabled:v.formTableFieldBackgroundImageEnabled,desktopBackground:_o(i)})}),v.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:f("Borders"),collapsible:!0,open:a,onToggle:b,dividerTop:!0,children:(0,t.jsx)(o.ui_kit$FormBorderInputs,{form:e,fieldStructure:"flat",borderValues:x,usedColors:B.usedColors,labels:{color:f("Color"),width:y("Width","border"),none:f("None"),solid:f("Solid"),dashed:f("Dashed"),dotted:f("Dotted"),above:f("Above"),below:f("Below"),onLeft:f("On the left"),onRight:f("On the right"),around:f("Around"),usedColors:f("Used"),recommendedColors:f("Recommended")}})}),v.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:f("Border radius"),collapsible:!0,open:d,onToggle:k,dividerTop:!0,children:(0,t.jsx)(Rt,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:m,setOneBorderRadiusValue:S,elementSettings:i})}),v.formFieldBoxShadowEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:f("Box shadow"),collapsible:!0,open:c,onToggle:h,dividerTop:!0,children:(0,t.jsx)(wt,{typeOfForm:"mobile",form:e,elementSettings:i,enableSwitch:!1})}),v.formFieldVisibilityEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:f("Display control"),dividerTop:!0,children:(0,t.jsx)(jt,{elementSettings:i,form:e})})]})};El.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired,mobileSizeShow:_.default.bool,mobileBackgroundShow:_.default.bool,mobileBordersShow:_.default.bool,mobileBorderRadiusShow:_.default.bool,mobileBoxShadowShow:_.default.bool,handleToggleMobileSize:_.default.func,handleToggleMobileBackground:_.default.func,handleToggleMobileBorder:_.default.func,handleToggleMobileBorderRadius:_.default.func,handleToggleMobileBoxShadow:_.default.func,oneMobileBorderRadiusValue:_.default.bool,setOneMobileBorderRadiusValue:_.default.func,mobileBorders:_.default.object};var zc=({form:e,elementViewType:i,mobileViewActive:s,elementSettings:l,paddingShow:a,paddingsExt:d,backgroundShow:c,bordersShow:p,borderRadiusShow:g,boxShadowShow:b,mobileSizeShow:k,mobileBackgroundShow:h,mobileBordersShow:m,mobileBorderRadiusShow:S,mobileBoxShadowShow:x,handleToggleShowPadding:f,handleTogglePadding:y,handleToggleBackground:v,handleToggleBorder:N,handleToggleBorderRadius:B,handleToggleBoxShadow:C,handleToggleMobileSize:$,handleToggleMobileBackground:U,handleToggleMobileBorder:L,handleToggleMobileBorderRadius:F,handleToggleMobileBoxShadow:P,backgroundRepeatOptions:H,backgroundSizeOptions:ae,backgroundImageEmpty:T,oneBorderRadiusValue:te,setOneBorderRadiusValue:xe,oneMobileBorderRadiusValue:be,setOneMobileBorderRadiusValue:ye,mobileBorders:me})=>(0,t.jsx)(t.Fragment,{children:i==="mobile"&&s.styles?(0,t.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,t.jsx)(El,{form:e,elementSettings:l,mobileSizeShow:k,mobileBackgroundShow:h,mobileBordersShow:m,mobileBorderRadiusShow:S,mobileBoxShadowShow:x,handleToggleMobileSize:$,handleToggleMobileBackground:U,handleToggleMobileBorder:L,handleToggleMobileBorderRadius:F,handleToggleMobileBoxShadow:P,oneMobileBorderRadiusValue:be,setOneMobileBorderRadiusValue:ye,mobileBorders:me})}):(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(kl,{form:e,elementSettings:l,paddingShow:a,paddingsExt:d,backgroundShow:c,bordersShow:p,borderRadiusShow:g,boxShadowShow:b,handleToggleShowPadding:f,handleTogglePadding:y,handleToggleBackground:v,handleToggleBorder:N,handleToggleBorderRadius:B,handleToggleBoxShadow:C,backgroundRepeatOptions:H,backgroundSizeOptions:ae,backgroundImageEmpty:T,oneBorderRadiusValue:te,setOneBorderRadiusValue:xe})})}),Sl=e=>e.customTable?.backgroundImage?.[0]?.value==="",Bl=({elementSettings:e,formName:i})=>{const{__:s}=r.useI18n(),l=r.useSendPostMessage(),[a]=o.ui_kit$Form.useForm(),{token:d}=(0,o.ui_kit$useToken)(),c=r.useAppConfig(),p=r.useSelector(r.selectEmailViewType),g=r.useSelector(r.selectMobileViewActive),b=r.useSelector(r.selectIsCodeMode),k=r.useSelector(r.selectCodeModeDirection),h=i===r.EDIT_SELECTED_TABLE_CELLS,m=Oc(l,e.type),[S,x]=Lc(e),[f,y]=(0,n.useState)(Sl(e)),[v,N]=(0,n.useState)("https://"),B=kc({form:a,settings:e,send:m,isTableCells:h,mobileBorders:S,setMobileBorders:x,setBackgroundImageEmpty:y}),C=(0,n.useCallback)(ke=>Vt(ke,N),[]),$=Nc({form:a,settings:e,send:m,mobileBorders:S,setMobileBorders:x,setBackgroundImageEmpty:y,onLinkHref:C}),U=(0,n.useMemo)(()=>({table:mc(e),cell:pc(e)}),[e]),L=(0,n.useRef)(),F=o.ui_kit$Form.useWatch([],a),P=[{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"}],H=[{label:s("Not defined"),value:""},{label:s("Contain"),value:"contain"},{label:s("Cover"),value:"cover"}],ae=b&&k!=="bottom",[T,te]=(0,n.useState)(null);(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&te(!0)},[]);const xe=ke=>{l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:ke,locale:"ru_RU"})},be=[{key:"1",label:s("This element"),onClick:()=>xe("typograf")},{key:"2",label:s("The whole email"),onClick:()=>xe("typograf_all")}];(0,n.useEffect)(()=>{a.setFieldsValue(rl(e)),y(Sl(e))},[a,e]),(0,n.useEffect)(()=>{a.getFieldValue("linkHref")||a.setFieldsValue({linkHref:null})},[F?.textLink,F?.linkHref,e.customTable?.linkHref,a]),(0,n.useEffect)(()=>{e.customTable?.linkHref&&Vt(e.customTable?.linkHref||"",N),a.setFieldsValue({linkHref:typeof e.customTable?.linkHref=="string"?e.customTable.linkHref:"https://"})},[a,e,N]);const ye=ke=>{a.setFieldValue("linkHref",ke!=="mergetag"?ke:""),N(ke)},{open:me,toggle:he}=B;return(0,t.jsxs)(o.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:"",backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",show:"all",borderPosition:"",borderRadiusAll:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"px",mobileBorderPosition:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBackgroundColor:"",mobileBackgroundImage:"",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:"",fontFamily:"",fontSize:"",lineHeight:"",textStrong:"",textItalic:"",textStrikethrough:"",textUnderline:"",textLink:"",linkHref:"",textColor:"",textAlign:"",textBackgroundColor:"",valign:""},onValuesChange:$,autoComplete:"off",className:"element-controls",style:{padding:0,display:"flex",flexDirection:"column"},children:[!ae&&(0,t.jsx)(o.ui_kit$Tooltip,{title:s("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,t.jsx)(o.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:s("Appearance on mobile devices"),type:"info"})}),h?(0,t.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,t.jsx)(Wc,{form:a,formValues:F,elementSettings:U.cell,appConfig:c,token:d,isMacOS:T,__:s,handleToggleShowPaddingCell:he.cellPadding,handleTogglePaddingCell:B.togglePaddingMode,handleToggleBackground:he.background,handleToggleBorder:he.border,handleToggleBorderRadius:he.borderRadius,paddingCellShow:me.cellPadding,paddingsExt:B.paddingsExt,backgroundShow:me.background,cellBordersShow:me.border,borderRadiusShow:me.borderRadius,oneBorderRadiusValue:B.oneBorderRadiusValue,setOneBorderRadiusValue:B.setOneBorderRadiusValue,backgroundImageEmpty:f,backgroundRepeatOptions:P,backgroundSizeOptions:H,sendAction:xe,typografItems:be,textInputRef:L,linkProtocol:v,handleLinkProtocolsChange:ye})}):(0,t.jsx)(zc,{form:a,elementSettings:U.table,handleToggleShowPadding:he.padding,handleTogglePadding:B.togglePaddingMode,handleToggleBackground:he.background,handleToggleBorder:he.border,handleToggleBorderRadius:he.borderRadius,handleToggleBoxShadow:he.boxShadow,handleToggleMobileSize:he.mobileSize,handleToggleMobileBackground:he.mobileBackground,handleToggleMobileBorder:he.mobileBorder,handleToggleMobileBorderRadius:he.mobileBorderRadius,handleToggleMobileBoxShadow:he.mobileBoxShadow,paddingShow:me.padding,paddingsExt:B.paddingsExt,backgroundShow:me.background,bordersShow:me.border,borderRadiusShow:me.borderRadius,boxShadowShow:me.boxShadow,mobileSizeShow:me.mobileSize,mobileBackgroundShow:me.mobileBackground,mobileBordersShow:me.mobileBorder,mobileBorderRadiusShow:me.mobileBorderRadius,mobileBoxShadowShow:me.mobileBoxShadow,oneBorderRadiusValue:B.oneBorderRadiusValue,setOneBorderRadiusValue:B.setOneBorderRadiusValue,oneMobileBorderRadiusValue:B.oneMobileBorderRadiusValue,setOneMobileBorderRadiusValue:B.setOneMobileBorderRadiusValue,backgroundImageEmpty:f,backgroundRepeatOptions:P,backgroundSizeOptions:H,mobileBorders:S,elementViewType:p,mobileViewActive:g})," "]})};Bl.propTypes={elementSettings:_.default.object.isRequired,formName:_.default.string};var lo=({className:e=null,formSettings:i,emailElementType:s,formName:l})=>{const a=r.useDispatch(),d=r.useSendStyleToggleToIframe(),c=(0,n.useRef)(),p=r.useSelector(r.selectActiveSettingsTab),g=r.useSelector(r.selectElementSettings$1),b=r.useSelector(r.selectElementSettings),k=r.useContainer(),h=r.getComponentRegistry(k),m=s==="email"?g:b,S=m.type,x=S===r.ELEMENT_TYPES.CAROUSEL||S===r.ELEMENT_TYPES.IMG?i.settings:m,[f,y]=(0,n.useState)(x),[v,N]=(0,n.useState)(x);x!==v&&(N(x),y(x));const B=$=>{const U=$.data.operation,L=$.data.action;if(U===r.EVENT_TYPES.APPLICATION_ACTION){let P=function(H,ae=null){const T={[H]:ae||!f[H]};d(T,f.type),a(r.setEmailSettings(T)),y(te=>({...te,...T}))};var F=P;L==="toggle_strong"&&P("textStrong"),L==="toggle_italic"&&P("textItalic"),L==="toggle_underline"&&P("textUnderline"),L==="toggle_strikethrough"&&P("textStrikethrough"),L==="textAlign_left"&&P("textAlign","left"),L==="textAlign_right"&&P("textAlign","right"),L==="textAlign_center"&&P("textAlign","center")}};r.useListenPostMessage(B);const C=m;return(0,t.jsx)("div",{className:"selected-element-panel",children:(0,t.jsx)(r.CSSTransition,{nodeRef:c,in:p===r.PROPERTIES,timeout:300,classNames:"transition",children:(0,t.jsxs)("div",{ref:c,className:(0,We.default)("selected-element-panel-content",{[e]:e}),children:[i?.type==="advanced"&&i?.content?(0,t.jsx)(n.Fragment,{children:h.getReactElement(i.content)},i.instanceKey):null,(m.type===r.ELEMENT_TYPES.IMG||m.type===r.ELEMENT_TYPES.COUNTDOWN||m.type===r.ELEMENT_TYPES.VIDEO)&&(0,t.jsx)(rs,{elementSettings:m}),m.type===r.ELEMENT_TYPES.TEXT&&(0,t.jsx)(gd,{elementSettings:m}),m.type===r.ELEMENT_TYPES.LINK&&(0,t.jsx)(Ss,{elementSettings:m}),m.type===r.ELEMENT_TYPES.TABLE&&(0,t.jsx)(Es,{elementSettings:m}),m.type===r.ELEMENT_TYPES.CUSTOM_TABLE&&(0,t.jsx)(Bl,{elementSettings:C,formName:l},C.customTable.tableKey),(m.type===r.ELEMENT_TYPES.TD||m.type===r.ELEMENT_TYPES.STRUCTURE||m.type===r.ELEMENT_TYPES.GROUP||m.type===r.ELEMENT_TYPES.COLUMN)&&(0,t.jsx)(js,{elementSettings:m}),m.type===r.ELEMENT_TYPES.VAR&&(0,t.jsx)(Fs,{elementSettings:m}),m.type===r.ELEMENT_TYPES.BUTTON&&(0,t.jsx)($s,{elementSettings:m}),m.type===r.ELEMENT_TYPES.DIV&&(0,t.jsx)(Cs,{elementSettings:m}),m.type===r.ELEMENT_TYPES.VINDENT&&(0,t.jsx)(Ts,{elementSettings:m}),m.type===r.ELEMENT_TYPES.FLOAT_BLOCK&&(0,t.jsx)(Ns,{elementSettings:m}),i.type===r.ELEMENT_TYPES.CAROUSEL&&(0,t.jsx)(Us,{elementSettings:i}),i.type===r.ELEMENT_TYPES.ACCORDION&&(0,t.jsx)(Ws,{elementSettings:i}),i.type===r.ELEMENT_TYPES.SOCIAL&&(0,t.jsx)(Js,{elementSettings:i})]})})})};lo.propTypes={className:_.default.string,formName:_.default.string};function Wt(){return!!document.querySelector(".selected-element-panel__columns-settings__links__add")?.closest(".selected-element-panel")}var Rl=({emailElementType:e,isSelectedElement:i=!1,selectedElement:s={parent:!1}})=>{const{__:l}=r.useI18n(),a=r.useDispatch(),d=r.useSendPostMessage(),[c]=o.ui_kit$Form.useForm(),p=(0,n.useRef)(),g=(0,n.useRef)(),b=r.useSelector(r.selectElementSettings$1),k=r.useSelector(r.selectElementSettings),h=r.useAppConfig(),m=s||(e==="email"?b:k),[S,x]=(0,n.useState)(m.floatBlocks?.wrap),[f,y]=(0,n.useState)(m.floatBlocks?.dirRevers),[v,N]=(0,n.useState)(null),[B,C]=(0,n.useState)(0),[$,U]=(0,n.useState)([]),L=r.useSelector(r.selectEmailViewType),F=(0,n.useCallback)(ve=>{a(e==="email"?r.setElementSettings$1(ve):r.setElementSettings(ve))},[a,e]);(0,n.useEffect)(()=>{if(m&&JSON.stringify(m)!=="{}"&&c._init){if(c.resetFields(),c.setFieldsValue({gap:m.floatBlocks?.gap,gapMobile:m.floatBlocks?.gapMobile,gapDim:"px",valign:m.floatBlocks?.valign}),m.floatBlocks?.items.length>0){let Q=function(X,Z){if(X.length!==Z.length)return!1;for(let J=0;J<X.length;J++)if(X[J]!==Z[J])return!1;return!0};var ve=Q;const Ee=m.floatBlocks.items.reduce((X,Z)=>X+Z.width,0),pe=m.floatBlocks.items.map(X=>((X.width||0)/Ee*100).toFixed(1));C(Ee),!Q(pe,$)&&m.changeKey!=="gap"&&U(pe),m.floatBlocks.items.forEach((X,Z)=>c.setFieldsValue({["width-"+Z]:X.width||0})),m.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")}x(m.floatBlocks?.wrap)}},[c,m,v,$]);let P=0;m.floatBlocks?.items.length>0&&(P=m.floatBlocks.items.length);const H=(ve,Ee)=>{Object.keys(Ee).forEach(pe=>{if(pe.includes("width")){const Q=parseInt(pe.match(/\d+/));c.setFieldsValue({[pe]:ve.items[Q]})}})},[ae,T]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const ve=()=>T(!0),Ee=()=>T(!1);return document.addEventListener("keyup",Ee),document.addEventListener("keydown",ve),()=>{document.removeEventListener("keyup",Ee),document.removeEventListener("keydown",ve)}},[]);const te=ve=>{g.current&&ae&&clearTimeout(g.current),g.current=setTimeout(()=>Ee(ve),50);function Ee(pe){const Q=c.getFieldsValue(!0),X=Object.keys(pe)[0];if(N(X),X.includes("width")){if(Q[X]&&Q[X]>=30){let Z={items:[],gap:Q.gap,valign:Q.valign,activateSection:i?void 0:"structure"},J=0;if(document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").length>1){J=parseFloat(Object.keys(pe)[0].substring(Object.keys(pe)[0].length-1));const V=Q["width-"+(J+1)]?J+1:0;let M=B;Object.keys(Q).forEach(Y=>{Y.includes("width")&&Y.indexOf("width-"+V)===-1&&(M-=Q[Y])}),Q["width-"+V]=M}Object.keys(Q).forEach(V=>{V.includes("width")&&Z.items.push(Q[V])}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:Z}),F({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,...Z,items:m.floatBlocks.items.map((V,M)=>({...m.floatBlocks.items[M],width:Z.items[M]}))},changeKey:X})}}else if(X==="gap"){const Z={items:m.floatBlocks.items.map(Y=>Y.width),gap:m.floatBlocks.gap},J=Z.items.reduce((Y,K)=>Y+K,0)+(Z.items.length-1)*Z.gap,V=Q.gap,M=J-(Z.items.length-1)*V;if(M>Z.items.length*30||m.floatBlocks.gap-pe>=0){const Y=(Re,Be)=>Math.round(Be*Re/100);let K=Z.items.map((Re,Be)=>Y($[Be],M));const ee=J-(K.reduce((Re,Be)=>Re+Be,0)+(Z.items.length-1)*V);if(ee!==0){const Re=K.length-Math.abs(ee);K=K.map((Be,$e)=>Re<=$e?Be+(ee>0?1:-1):Be)}let le={items:K,gap:V||0};H(le,Q),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGap",settings:le,editFromStructure:Wt()}),F({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,...le,items:m.floatBlocks.items.map((Re,Be)=>({...Re,width:le.items[Be]}))},changeKey:X})}}else if(X==="valign"){let Z={valign:Q.valign};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksValign",settings:Z,editFromStructure:Wt()}),F({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,...Z},changeKey:X})}else if(X==="gapMobile"){let Z={mobileHeight:{classNamePrefix:"em-mob-height-",value:pe[X],dim:"px"}};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGapMobile",settings:Z}),F({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,gapMobile:Z.mobileHeight.value},changeKey:X})}setTimeout(()=>p?.current&&p.current.focus({cursor:"end"}),600)}},xe=()=>{const ve=c.getFieldsValue(!0),Ee=m.floatBlocks.items.map(M=>M.width);let pe={items:[],gap:ve.gap};const Q=Ee.reduce((M,Y)=>M+Y,0),X=Ee.length,Z=Math.ceil(B/X)*X,J=Z/X,V=Q-Z;if(pe.items=Array(X).fill(J),V!==0){const M=Ee.length-Math.abs(V);pe.items=pe.items.map((Y,K)=>M<=K?Y+(V>0?1:-1):Y)}H(pe,ve),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:pe,editFromStructure:Wt()}),F({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,...pe,items:m.floatBlocks.items.map((M,Y)=>({...M,width:pe.items[Y]}))},changeKey:"width"})},be=ve=>{const Ee=c.getFieldsValue(!0),pe=m.floatBlocks.items.map(le=>le.width),Q=m.floatBlocks.gap||20,X=ve.cols-pe.length;let Z=[],J=pe.reduce((le,Re)=>le+Re,0);ve.cols>=pe.length?J-=Q*X:J+=Q*Math.abs(X);const V=Math.round(J/ve.cols);function M(le,Re){const Be=[];for(let $e=0;$e<le;$e++)Be.push(ve.width?.[$e]?Math.round(J/100*ve.width?.[$e]):Re);return Be}Z=M(ve.cols,V);const Y=J-Z.reduce((le,Re)=>le+Re,0);if(Y!==0){let le=Z.map((Be,$e)=>[$e,Be]).filter(Be=>Be[1]>30);const Re=le.length-Math.abs(Y);le=le.map((Be,$e)=>{const z=Re<=$e?Be[1]+(Y>0?1:-1):Be[1];return[Be[0],z]}),le.map(Be=>(Z[Be[0]]=Be[1],Be))}let K={items:Z,gap:Ee.gap||20};const ee=Z.reduce((le,Re)=>le+Re,0);U(Z.map(le=>(le/ee*100).toFixed(1))),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksPreset",settings:K,editFromStructure:Wt()}),F({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,...K,items:K.items.map((le,Re)=>({width:le,current:!1}))},changeKey:"width"})},ye=()=>{const ve=c.getFieldsValue(!0);if(P<8){const Ee=m.floatBlocks.items.map(M=>M.width),pe=m.floatBlocks.gap,Q=Ee.reduce((M,Y)=>M+(Y>30?Y:0),0),X=(Q-30-pe)/Q,Z=Ee.map(M=>M>30?Math.round(M*X):M).reduce((M,Y)=>M+(Y>30?Y:0),0);let J=Ee.map(M=>M>30?Math.round(M*X):M);J.push(30);const V=Q-Z-30-pe;if(V!==0){let M=J.map((K,ee)=>[ee,K]).filter(K=>K[1]>30);const Y=M.length-Math.abs(V);M=M.map((K,ee)=>{const le=Y<=ee?K[1]+(V>0?1:-1):K[1];return[K[0],le]}),M.map(K=>(J[K[0]]=K[1],K))}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_ADD,settings:{gap:ve.gap,gapMobile:ve.gapMobile,minWidth:30},editFromStructure:Wt()}),F({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,items:J.map((M,Y)=>({width:M,current:m.floatBlocks.items[Y]?.current||!1}))},changeKey:"width"})}else document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.add("noactive")},me=ve=>{const Ee=c.getFieldsValue(!0);let pe=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((le,Re)=>{le===ve.target.closest(".selected-element-panel__columns-settings__controls__column")&&(pe=Re)});const Q=+m.floatBlocks.gap,X=+m.floatBlocks.items[pe].width+Q,Z=m.floatBlocks.items.map(le=>+le.width),J=(Z.length-1)*Q,V=Z.reduce((le,Re)=>le+Re,0)+J,M=Z.length-1,Y=Math.floor(X/M);let K=Z.filter((le,Re)=>Re!==pe).map(le=>le+Y);const ee=V-(K.reduce((le,Re)=>le+Re,0)+(Z.length-2)*Q);if(ee!==0){const le=K.length-Math.abs(ee);K=K.map((Re,Be)=>le<=Be?Re+(ee>0?1:-1):Re)}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_REMOVE,settings:{removedBlockIndex:pe,gap:Ee.gap},editFromStructure:Wt()}),F({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,items:K.map((le,Re)=>({width:le,current:m.floatBlocks.items.filter((Be,$e)=>$e!==pe)[Re].current}))},changeKey:"width"})},he=ve=>{if(P>=8)return;const Ee=c.getFieldsValue(!0);let pe=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((Be,$e)=>{Be===ve.target.closest(".selected-element-panel__columns-settings__controls__column")&&(pe=$e)});const Q=parseFloat(Ee.gap)||0,X=m.floatBlocks.items.map(Be=>+Be.width),Z=X[pe],J=X.reduce((Be,$e)=>Be+$e,0),V=J-Q,M=J+Z,Y=M>0?V/M:1;let K=[];const ee=[];X.forEach((Be,$e)=>{K.push(Math.max(30,Math.round(Be*Y))),ee.push(m.floatBlocks.items[$e]?.current||!1),$e===pe&&(K.push(Math.max(30,Math.round(Z*Y))),ee.push(!1))});const le=V-K.reduce((Be,$e)=>Be+$e,0);if(le!==0){let Be=K.map((z,re)=>[re,z]).filter(z=>z[1]>30);const $e=Be.length-Math.abs(le);Be=Be.map((z,re)=>[z[0],$e<=re?z[1]+(le>0?1:-1):z[1]]),Be.forEach(z=>K[z[0]]=z[1])}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_COPY,settings:{copiedBlockIndex:pe,gap:Ee.gap,widths:K},editFromStructure:Wt()});const Re=K.reduce((Be,$e)=>Be+$e,0);U(K.map(Be=>(Be/Re*100).toFixed(1))),F({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,items:K.map((Be,$e)=>({width:Be,current:ee[$e]||!1}))},changeKey:"width"})},ke=(0,n.useCallback)(ve=>{const Ee=".selected-element-panel__columns-settings__controls__column",pe=Array.from(document.querySelectorAll(Ee)).indexOf(ve.target.closest(Ee)),Q=pe-1;if(Q<0)return;const X=m.floatBlocks,Z=X.items.map(({width:J,current:V})=>({width:J,current:V||!1}));[Z[Q],Z[pe]]=[Z[pe],Z[Q]],d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_SWAP,settings:{indexA:Q,indexB:pe},editFromStructure:Wt()}),F({...m,activateSection:i?void 0:"structure",floatBlocks:{...X,items:Z},changeKey:"width"})},[m,F,i,d]),ce=ve=>{x(ve),d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_WRAP,settings:{wrap:!S}}),F({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,wrap:!S},changeKey:"wrap"})},ze=ve=>{y(ve),d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_DIR,settings:{dirRevert:!f}}),F({...m,activateSection:i?void 0:"structure",floatBlocks:{...m.floatBlocks,dirRevert:!f},changeKey:"dir"})},Oe=()=>setTimeout(()=>p?.current&&p.current.focus({cursor:"end"}),300);return m.floatBlocks&&m.floatBlocks.items.length>0&&(0,t.jsx)(o.ui_kit$Form,{layout:"vertical",form:c,name:"float_blocks_settings_form",autoComplete:"off",initialValues:{gap:m.floatBlocks?.gap||0,gapDim:"px",gapMobile:m.floatBlocks?.gapMobile||0,valign:m.floatBlocks?.valign||"top",...m.floatBlocks?.items.reduce((ve,{width:Ee},pe)=>(ve[`width-${pe}`]=Ee,ve),{})},onValuesChange:te,onFieldsChange:Oe,className:"element-controls",children:(0,t.jsxs)("div",{className:"selected-element-panel__columns-settings",style:{paddingTop:h.switchDesktopMobilePropsEnabled||h.stepToOtherElementEnabled||h.deleteButtonEnabled||m.type==="structure"?0:24},children:[m.floatBlocks.items.length===1&&(0,t.jsx)(o.ui_kit$Alert,{style:{marginBottom:10},title:l('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"}),L!=="mobile"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"selected-element-panel__columns-settings__header",children:[(0,t.jsx)("span",{className:"selected-element-panel__columns-settings__header-title",children:l("Columns")}),(0,t.jsxs)("div",{className:"selected-element-panel__columns-settings__links",children:[(0,t.jsxs)("span",{className:"selected-element-panel__columns-settings__links__add",onClick:ye,children:[(0,t.jsx)(r.EmIcons,{icon:"PlusCircleOutlined",component:o.icons$PlusCircleOutlined,size:16,strokeWidth:h.iconStrokeWidth})," ",l("Add column")]}),m.floatBlocks.items.length>1&&(0,t.jsx)("span",{onClick:xe,children:(0,t.jsxs)(o.ui_kit$Tooltip,{title:l("Make columns the same width."),children:[(0,t.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined})," ",l("Equalize")]})})]})]}),m.floatBlocks.items.length>1&&(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:16},children:(0,t.jsx)("div",{className:"selected-element-panel__columns-settings__controls",children:m.floatBlocks.items.map((ve,Ee)=>(0,t.jsxs)("div",{className:"selected-element-panel__columns-settings__controls__column "+(ve.current?"current":""),style:{width:ve.width/B*100+"%"},children:[Ee>0&&(0,t.jsx)(o.ui_kit$Tooltip,{title:l("Swap columns"),children:(0,t.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__swap",onClick:ke,children:(0,t.jsx)(r.EmIcons,{icon:"SwapHorizontalIcon",component:o.icons$SwapHorizontalIcon,size:15,strokeWidth:h.iconStrokeWidth})})}),m.floatBlocks.items.length>1&&(0,t.jsx)(o.ui_kit$Tooltip,{title:l("Delete column"),children:(0,t.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__remove",onClick:me,children:(0,t.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:15,strokeWidth:h.iconStrokeWidth,style:{color:"#ff4d4f"}})})}),m.floatBlocks.items.length<8&&(0,t.jsx)(o.ui_kit$Tooltip,{title:l("Copy column"),children:(0,t.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__copy",onClick:he,children:(0,t.jsx)(r.EmIcons,{icon:"CopyOutlined",component:o.icons$CopyOutlined,size:15,strokeWidth:h.iconStrokeWidth})})}),(0,t.jsx)("div",{className:"selected-element-panel__columns-settings__controls__field",children:(0,t.jsx)(o.ui_kit$Form.Item,{label:"",name:"width-"+Ee,children:(0,t.jsx)(o.ui_kit$InputNumber,{min:30,value:ve.width||0,placeholder:l("Width"),ref:v==="width-"+Ee&&p})})})]},"floatblock-"+Ee))})}),(0,t.jsxs)("div",{className:"columns-presets",children:[(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{be({cols:1})},children:(0,t.jsx)(r.EmIcons,{icon:"LayoutCol1",component:o.icons$LayoutCol1})}),(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{be({cols:2})},children:(0,t.jsx)(r.EmIcons,{icon:"LayoutCol2",component:o.icons$LayoutCol2})}),(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{be({cols:2,width:[66,34]})},children:(0,t.jsx)(r.EmIcons,{icon:"LayoutCol2WideLeft",component:o.icons$LayoutCol2WideLeft})}),(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{be({cols:2,width:[34,66]})},children:(0,t.jsx)(r.EmIcons,{icon:"LayoutCol2WideRight",component:o.icons$LayoutCol2WideRight})}),(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{be({cols:3})},children:(0,t.jsx)(r.EmIcons,{icon:"LayoutCol3",component:o.icons$LayoutCol3})}),(0,t.jsx)(o.ui_kit$Button,{onClick:()=>{be({cols:4})},children:(0,t.jsx)(r.EmIcons,{icon:"LayoutCol4",component:o.icons$LayoutCol4})})]})]}),m.floatBlocks.items.length>1&&(0,t.jsxs)(t.Fragment,{children:[L==="mobile"&&(0,t.jsx)("div",{style:{marginBottom:24},children:(0,t.jsx)(o.ui_kit$Switch,{id:"column-wrap",label:l("Line break on mobile devices"),size:"small",disabled:m.floatBlocks?.wrap===void 0,checked:S,onChange:ce,labelStyle:{position:"relative",top:2}})}),L!=="mobile"&&(0,t.jsx)("div",{style:{marginBottom:24},children:(0,t.jsx)(o.ui_kit$Switch,{id:"column-dir-revers",label:l("Reverse order on desktop"),size:"small",disabled:m.floatBlocks?.wrap===void 0,checked:f,onChange:ze,labelStyle:{position:"relative",top:2}})})]}),m.floatBlocks.items.length>1&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$FormSection,{title:l("Vertical alignment"),titleStyle:{paddingTop:20},children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"valign",style:{marginBottom:0},children:(0,t.jsx)(o.ui_kit$FormVerticalAlignControl,{disabled:m.floatBlocks.items.length<=1,strokeWidth:h.iconStrokeWidth,labels:{alignTop:l("Align top"),alignMiddle:l("Center vertically"),alignBottom:l("Align bottom")}})})})}),(0,t.jsxs)(t.Fragment,{children:[L!=="mobile"&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$FormSection,{title:l("Indent between columns"),titleStyle:{paddingTop:20},children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"gap",style:{marginBottom:20},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,disabled:m.floatBlocks.items.length<=1,placeholder:l("Indent between columns"),prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:"px",ref:v==="gap"&&p})})})}),L==="mobile"&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$FormSection,{title:l("Indent in mobile"),titleStyle:{paddingTop:20},children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"gapMobile",style:{marginBottom:20},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,disabled:m.floatBlocks.items.length<=1,placeholder:l("Indent in mobile"),prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:o.icons$ColumnHeightOutlined}),addonAfter:"px"})})})})]})]})]})]})})};Rl.propTypes={selectedElement:_.default.shape({parent:_.default.string})};var Gc=()=>{},Tl=({email:e,formSettings:i={},onClosePanel:s=Gc})=>{const{__:l}=r.useI18n(),a=r.useRootElement(),d=r.useDispatch(),c=r.useSendPostMessage(),p=Object.prototype.hasOwnProperty.call(e,"type")?r.BLOCK:r.EMAIL,g=r.useSelector(r.selectElementSettings$1),b=r.useSelector(r.selectElementSettings),k=r.useSelector(r.selectPropertiesPanelKey),h=p==="email"?g:b,m=Object.keys(i).length>0?i.settings:h,S=i?.type==="advanced"&&!!i?.content,x=!!i?.extraTabs?.length,f=r.useAppConfig(),y=m.type==="customTable",v=!!m.type&&!!m.floatBlocks?.items.length>0&&!!m.floatBlocks?.items.filter(H=>!!H.width).length>0,N=(0,n.useRef)(null);(0,n.useEffect)(()=>{const H=Object.values(r.ELEMENT_TYPES),ae=m.type&&H.includes(m.type)?`${m.type}-${JSON.stringify(m.path||[])}`:null;if(S||x){const T=a.querySelector(".email-pane .panel-form__body");T&&(T.scrollTop=0),d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else if(m.type&&H.includes(m.type)){const T=N.current!==ae;if(N.current=ae,m.activateSection!=="structure"){if(T){const te=a.querySelector(".email-pane .panel-form__body");te&&(te.scrollTop=0)}d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else d(r.setPropertiesPanelKey(r.STRUCTURE))}else JSON.stringify(m)!=="{}"&&(N.current=null,d(r.setPropertiesPanelKey("")))},[m,d,a,S,x]);const B=(0,n.useMemo)(()=>{const H=[{key:r.EDIT_SELECTED_ELEMENT,label:(0,t.jsx)("span",{style:{textTransform:"capitalize"},children:m.caption?m.caption:l("Edit element")})}];return v&&H.push({key:r.STRUCTURE,label:l("Columns")}),H},[m.caption,v,l]),C=(0,n.useMemo)(()=>[{key:r.EDIT_SELECTED_ELEMENT,label:l("Cell")},{key:r.TABLE_PROPERTIES,label:l("Table")}],[l]),$=H=>{H.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_REMOVE}),d(p==="email"?r.setElementSettings$1({}):r.setElementSettings({}))},U=H=>{H.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_PARENT_GET})},L=()=>{s(m),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})},F=(0,t.jsxs)(t.Fragment,{children:[f.deleteButtonEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:l("Remove element by Delete Key"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{type:"text",onClick:$,disabled:!m.deletable,icon:(0,t.jsx)(o.ui_kit$EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:18,strokeWidth:f.iconStrokeWidth})})}),f.stepToOtherElementEnabled&&(0,t.jsx)(o.ui_kit$Tooltip,{title:l("Up to parent element"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Button,{type:"text",onClick:U,disabled:!m.parent,icon:(0,t.jsx)(o.ui_kit$EmIcons,{icon:"GoToParent",component:o.icons$GoToParent,size:18,strokeWidth:f.iconStrokeWidth})})})]}),P=f.switchDesktopMobilePropsEnabled||f.stepToOtherElementEnabled||f.deleteButtonEnabled;return(0,t.jsxs)(o.ui_kit$PanelForm,{children:[(0,t.jsx)(o.ui_kit$PanelForm.Header,{onClose:L,closeIcon:(0,t.jsx)(o.ui_kit$EmIcons,{icon:"Close",component:o.icons$Close,size:24,strokeWidth:f.iconStrokeWidth}),extra:P?F:void 0,children:(0,t.jsx)(o.ui_kit$Tabs,{items:y?C:B,activeKey:k,onChange:H=>d(r.setPropertiesPanelKey(H||""))})}),(0,t.jsx)(o.ui_kit$PanelForm.Body,{children:y?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{style:{display:k==="Edit selected element"?void 0:"none"},children:(0,t.jsx)(lo,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:p,formName:`${r.EDIT_SELECTED_TABLE_CELLS}`})}),(0,t.jsx)("div",{style:{display:k==="Table properties"?void 0:"none"},children:(0,t.jsx)(lo,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:p,formName:`${r.TABLE_PROPERTIES}`})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{style:{display:k==="Edit selected element"?void 0:"none"},children:(0,t.jsx)(lo,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:p})}),v&&(0,t.jsx)("div",{style:{display:k==="Structure"?void 0:"none"},children:(0,t.jsx)(Rl,{selectedElement:m,emailElementType:p,isSelectedElement:!1})})]})})]})},Yc=({taxonomy:e})=>{const{__:i,_x:s}=r.useI18n(),l=r.useDispatch(),[a]=o.ui_kit$Form.useForm(),d=(0,n.useRef)(null),c=r.useSelector(r.selectActiveModal$1)===r.MODALS.ADD_NEW_GROUP_MODAL,p=r.useNotification(),g=r.useProjectData(),b=(0,n.useCallback)(()=>{a.resetFields(),setTimeout(()=>d.current?.focus({cursor:"start"}),0)},[a]);(0,n.useEffect)(()=>{c&&b()},[c,b]);const k=()=>l(r.closeModal$1()),[h,m]=r.useAddTermMutation(),[S,x]=(0,n.useState)(!1),f=()=>{a.validateFields().then(({name:y})=>(x(!0),h({project:g,kind:"group",name:y}).then(v=>{if("error"in v){p.error(v);return}p.success({title:i("The group “")+v.data.name+s("” was successfully created.",e)}),k()}))).catch(y=>{}).finally(()=>x(!1))};return(0,t.jsx)(o.ui_kit$Modal,{title:i("Add a new group"),open:c,onOk:f,onCancel:k,className:"new-group-modal",footer:[(0,t.jsx)(o.ui_kit$Button,{type:"primary",size:"large",loading:m.isLoading||S,onClick:f,children:i("Create group")},"submit")],children:(0,t.jsx)(o.ui_kit$Form,{form:a,layout:"vertical",name:"add_new_group_form",onFinish:f,initialValues:{remember:!1,name:""},autoComplete:"off",style:{paddingTop:10},children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"name",rules:[{required:!0,message:i("Please enter the group name")}],children:(0,t.jsx)(o.ui_kit$Input,{disabled:m.isLoading,size:"large",placeholder:i("Enter the group name"),ref:d,style:{marginBottom:5}})})})})},Xc=({group:e,refetch:i})=>{const{__:s,_x:l}=r.useI18n(),a=r.useDispatch(),[d]=o.ui_kit$Form.useForm(),c=(0,n.useRef)(null),p=r.useSelector(r.selectActiveModal$1)===r.MODALS.EDIT_GROUP_NAME_MODAL,g=r.useNotification(),{id:b=null,name:k=""}=e,h=()=>a(r.closeModal$1()),[m,S]=r.useEditTermMutation();(0,n.useEffect)(()=>{p&&d.setFieldsValue({name:k})},[p,k,d]);const x=()=>{d.validateFields().then(({name:f})=>{m({kind:"group",id:b,name:f}).then(({data:y,error:v})=>{v?(g.error({error:v}),d.setFieldValue("name",f)):(i().then(({data:N})=>{if(N){const B=N[0]?.children?.find(C=>C.id===b)?.name;d.setFieldValue("name",B)}}),h(),g.success({title:s("The group “")+f+l("” was successfully changed to “","group")+y.name+s("”.")}))})})};return(0,t.jsx)(o.ui_kit$Modal,{title:s("Change group name"),open:p,onOk:x,onCancel:h,className:"new-group-name-modal",footer:[(0,t.jsx)(o.ui_kit$Button,{type:"primary",size:"large",loading:S.isLoading,onClick:x,children:s("Change name")},"submit")],children:(0,t.jsx)(o.ui_kit$Form,{form:d,layout:"vertical",name:"rename_group_form",onFinish:x,initialValues:{remember:!1,name:k},autoComplete:"off",style:{paddingTop:10},children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"name",rules:[{required:!0,message:s("Please enter the group name")}],children:(0,t.jsx)(o.ui_kit$Input,{disabled:S.isLoading,size:"large",placeholder:s("Enter the group name"),ref:c,style:{marginBottom:5}})})})})},Wi={width:"100%"},Kc=["hover"],qc={color:"#ff4d4f"},Jc={color:o.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0},Qc=({level:e,onRename:i,onRemove:s})=>{const{__:l}=r.useI18n(),a=(0,n.useMemo)(()=>({items:[{label:l("Rename"),key:"Rename",icon:(0,t.jsx)(r.EmIcons,{icon:"CopyOutlined",component:o.icons$CopyOutlined,size:16}),onClick:()=>i(e)},{label:l("Remove"),key:"Remove",icon:(0,t.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:16}),style:qc,onClick:()=>s(e)}]}),[l,e,s,i]);return(0,t.jsx)(o.ui_kit$Button,{type:"text",className:"groups-management__group_menu","data-group-id":e.id,size:"large",children:(0,t.jsx)(o.ui_kit$Dropdown,{className:"groups-management__group_menu-inner",placement:"bottomLeft",menu:a,trigger:Kc,children:(0,t.jsx)("span",{className:"groups-management__actions",children:(0,t.jsx)(r.EmIcons,{icon:"MoreOutlined",component:o.icons$MoreOutlined})})})})},Zc=({className:e,levels:i,readOnlyLevels:s=!1,levelsRead:l=!1,refetchProjectGroups:a,isLoading:d})=>{const{__:c,_x:p}=r.useI18n(),g=r.useDispatch(),b=r.useNotification(),{modal:k}=o.ui_kit$App.useApp(),{confirm:h}=k,{token:m}=(0,o.ui_kit$useToken)(),S=r.useSelector(r.selectProjectGroups),x=i??S,[f]=r.useDeleteTermMutation(),[y,v]=(0,n.useState)({id:null,name:""}),N=(0,n.useCallback)((L,F)=>{f({kind:"group",id:Number(L)}).unwrap().then(P=>{P?.deleted&&b.success({title:c("The group “")+F+p("” was successfully deleted.","recovery")})}).catch(P=>{b.error({error:P})})},[f,b,c,p]),B=(0,n.useCallback)(L=>{const F=L.name??"";h({mask:{closable:!0},centered:!0,title:p("Are you sure to delete “","group")+F+c("” group and all nested groups?"),icon:(0,t.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:22,style:Jc}),okText:c("Yes"),cancelText:c("No"),onOk:()=>N(String(L.id),F)})},[h,N,c,p]),C=(0,n.useCallback)(L=>{g(r.openModal$1(r.MODALS.EDIT_GROUP_NAME_MODAL)),v({id:L.id,name:L.name??""})},[g]),$=(0,n.useMemo)(()=>({marginBottom:m.formItemMarginBottomMD}),[m]),U=(0,n.useCallback)(()=>{g(r.openModal$1(r.MODALS.ADD_NEW_GROUP_MODAL))},[g]);return(0,t.jsxs)("div",{className:(0,We.default)("groups-management",{[e]:e}),children:[d?(0,t.jsx)(o.ui_kit$Skeleton,{active:!0}):(0,t.jsxs)(o.ui_kit$Row,{children:[!!x?.length&&x?.map((L,F)=>(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:`group_${L.id}`,style:{marginBottom:m.formItemMarginBottomMD},label:(0,t.jsxs)(o.ui_kit$Flex,{justify:"space-between",align:"center",style:Wi,children:[(0,t.jsx)("span",{children:L.name}),!s&&(0,t.jsx)(Qc,{level:L,onRename:C,onRemove:B})]}),className:"groups-management__group-select",rules:[{message:"Please input category name!",type:"array"}],children:(0,t.jsx)(o.ui_kit$Select,{mode:s?"multiple":"tags",style:Wi,placeholder:c(s?"Select a category":"Type category here"),options:L.children?.map(P=>({label:P.name,value:String(P.id)})),tagRender:P=>{const{label:H,closable:ae,onClose:T}=P,te=xe=>{xe.preventDefault(),xe.stopPropagation()};return(0,t.jsx)(o.ui_kit$Tag,{variant:"solid",color:m.colorPrimary,onMouseDown:te,closable:ae,onClose:T,style:{borderRadius:6},children:H})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})},L.id)),s&&l&&!x?.length&&(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Text,{type:"secondary",style:$,children:c("This project has no template sections yet.")})}),!s&&(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Form.Item,{style:$,children:(0,t.jsx)(o.ui_kit$Button,{id:"add_group_button",icon:(0,t.jsx)(r.EmIcons,{icon:"AddSlide",component:o.icons$AddSlide}),style:Wi,onClick:U,children:c("Add group")})})})]}),(0,t.jsx)(Yc,{taxonomy:r.ELEMENT_TYPES.GROUP}),(0,t.jsx)(Xc,{group:y,refetch:a})]})};function eu(e,{gallery:i=!1}={}){const s=r.isEmailsV2Enabled(),l=r.useGetTemplateSectionsQuery({scope:"gallery"},{skip:!s||!i}),a=r.useGetTemplateSectionsQuery({scope:"project",projectId:e},{skip:!s||!e});return{emailsOnV2:s,standardSections:l.data,projectSections:a.data,projectSectionsLoading:s&&!!e&&a.isLoading}}var{title:zi,description:oi,tags:ii,type:Gi,is_template:tu,group:yl}={title:"title",description:"description",tags:"tags",type:"type",is_template:"is_template",group:"group"},ou={[zi]:"",[oi]:"",[ii]:[],[tu]:!1},iu={[oi]:"",[ii]:[],[Gi]:""};function ru(e){const i=new Set;return e?.filter(s=>i.has(s.name)?!1:(i.add(s.name),!0))}var su=e=>Array.isArray(e)&&e.length>0,wl=({className:e="",element:i})=>{const{__:s}=r.useI18n(),l=r.useDispatch(),a=r.useEmailAttributesWriter(),[d]=o.ui_kit$Form.useForm(),{token:c}=(0,o.ui_kit$useToken)(),p=r.useAppConfig(),g=r.useEditorLocked(),b=r.useEditorLockCheck(),k=r.useSelector(r.selectProjectGroups),{data:h}=r.useGetBlockTypesQuery(),m=r.useProjectData(),S=i.hasOwnProperty("type")?r.BLOCK:r.EMAIL,x=i.hasOwnProperty("type")?r.BLOCK_TAGS:r.EMAIL_TAGS,{emailsOnV2:f,projectSections:y,projectSectionsLoading:v}=eu(m?.id),{data:N,refetch:B,isLoading:C,isFetching:$,isUninitialized:U,isSuccess:L}=r.useGetTermsQuery({project:m,kind:"group"},{skip:f||!m?.id}),F=(0,n.useMemo)(()=>f?y??[]:k,[f,y,k]);(0,n.useEffect)(()=>{N&&l(r.projectGroupsLoaded(N,S==="email"?i.group??[]:void 0))},[l,N,S,i.group]),(0,n.useEffect)(()=>{!U&&B()},[U,B]),(0,n.useEffect)(()=>{if(!f||!i.is_template)return;const Q=new Set(i.projectCategories??[]),X={};let Z=!1;for(const J of y??[]){const V=`group_${J.id}`,M=(J.children??[]).filter(K=>Q.has(String(K.id))).map(K=>String(K.id)),Y=d.getFieldValue(V);(!Y||Y.length!==M.length||M.some((K,ee)=>Y[ee]!==K))&&(Z=!0),X[V]=M}Z&&d.setFieldsValue(X)},[d,f,i.is_template,i.projectCategories,y]);const[P,H]=(0,n.useState)([]),[ae,T]=(0,n.useState)([]),[te,xe]=(0,n.useState)(i.is_template||!1),be=r.useProjectData();(0,n.useEffect)(()=>{!U&&B()},[i.group,B,U]),(0,n.useEffect)(()=>{if(L&&i.is_template&&su(i.group)){const Q=i.group;let X={};Q.length&&k.length&&Q?.forEach(J=>{k?.forEach(V=>{let M=V.children.find(Y=>Y.id===J);M&&(X.hasOwnProperty(V.id)||(X[V.id]=[]),X[V.id].push({label:M.name,value:M.id}))})});let Z={};for(let J in X)X.hasOwnProperty(+J)&&(Z[`group_${J}`]=X[J].map(V=>({...V,value:String(V.value)})));d.setFieldsValue(Z)}},[d,k,i.is_template,i.group,L]);const{data:ye,isFetching:me,refetch:he}=r.useGetTermsQuery({project:be,kind:x},{skip:!be?.id});(0,n.useEffect)(()=>{T(ru(ye)?.map(Q=>({value:Q.name,key:Q.id})))},[ye]),(0,n.useEffect)(()=>{if(i){const Q=r.getTaxonomy(i,x)??[],X=ye??[],Z=Q.map(M=>M.name??""),J=i.emailtags||i.blocktags||[],V=Q.concat(X).filter(M=>J.some(Y=>r.sameTermId(M.id,Y))).map(M=>M.name??"");d.setFieldsValue({title:i.title,description:i.description,tags:Array.isArray(i.tags)?i.tags:V.length?Array.from(new Set(V)):Z,type:i.type})}},[d,i,x,ye]);const ke=(0,n.useMemo)(()=>{if(!(S==="email"?f:r.isBlocksV2Enabled())||!i)return[];const Q=r.getTaxonomy(i,x)??[],X=ye??[],Z=[...Q,...X];return((S==="email"?i.emailtags:i.blocktags)??[]).filter(J=>!Z.some(V=>V.name&&r.sameTermId(V.id,J)))},[f,S,i,x,ye]),[ce,ze]=(0,n.useState)(void 0),Oe=!Array.isArray(i?.tags);(0,n.useEffect)(()=>{Oe&&ke.length&&be?.id&&!me&&ce!==i?.id&&(ze(i?.id),he())},[Oe,ke.length,be?.id,me,ce,i?.id,he]);const ve=Oe&&ke.length>0&&(ye===void 0||me||ce!==i?.id),Ee=Q=>{if(b())return;const X=Object.keys(Q)[0],Z=Q,J=X.split("_")[0];if(J===zi)a({title:Z[X]});else if(J===oi)a({description:Z[X]});else if(J===ii){const V=Z[X],M=S==="email"&&(V?.length??0)===0;a({tags:(V??[]).map(Y=>Y.trim()),...M?{emailtags:[]}:{}})}else J==="is"&&S==="email"?a({is_template:Z[X]}):J===Gi&&S==="block"&&a({type:Z[X]});switch(X.split("_")[0]){case yl:if(f){const V=new Set((y??[]).flatMap(ee=>(ee.children??[]).map(le=>String(le.id)))),M=d.getFieldsValue(!0),Y=Object.keys(M).filter(ee=>ee.startsWith(`${yl}_`)).flatMap(ee=>M[ee]??[]).map(String).filter(ee=>V.has(ee)),K=(i.projectCategories??[]).map(String).filter(ee=>!V.has(ee));a({projectCategories:[...new Set([...K,...Y])]});break}l(r.setEmailGroups({[X.split("_")[1]]:Q[X]}));break;default:return}};(0,n.useEffect)(()=>{if(h){const Q=h;let X=[];const Z={Applications:s("Apps"),Articles:s("Article"),Banners:s("Banners"),Buttons:s("Buttons"),"Call to Action":s("Call to Action"),Contacts:s("Contacts"),Content:s("Content"),"E-Commerce":s("E-Commerce"),Feature:s("Features"),Footer:s("Footers"),Header:s("Headers"),Lists:s("Lists"),Menu:s("Menus"),Other:s("Others"),Polls:s("Polls"),Promocodes:s("Promocodes"),Separators:s("Separators"),Transactional:s("Transactional")};for(let J in Q)X.push({label:Z[Q[J]],value:Q[J]});H(X)}},[h,s]);const pe=Q=>{xe(Q)};return(0,t.jsx)("div",{className:(0,We.default)("settings-panel",{[e]:e}),children:(0,t.jsxs)(o.ui_kit$Form,{form:d,layout:"vertical",name:"settings_panel_form",initialValues:S==="email"?{EmailInitialValues:ou}:iu,onValuesChange:Ee,autoComplete:"off",disabled:g,children:[p.subjectEnabled&&S==="email"&&(0,t.jsx)(o.ui_kit$Form.Item,{label:s("Title"),name:zi,tooltip:{title:s("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,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$TextArea,{placeholder:s("Type title here"),autoSize:{minRows:1}})}),p.descriptionEnabled&&(0,t.jsx)(o.ui_kit$Form.Item,{label:s("Description"),name:oi,tooltip:{title:s("Description is used in other sections of the service."),icon:(0,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$TextArea,{placeholder:s("Type your description here"),autoSize:{minRows:2}})}),p.tagsEnabled&&(0,t.jsx)(o.ui_kit$Form.Item,{label:s("Tags"),name:ii,tooltip:{title:s("Tags help you find the block in the list."),icon:(0,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},rules:[{message:s("Please input tags!"),type:"array"}],children:(0,t.jsx)(o.ui_kit$Select,{mode:"tags",style:{width:"100%"},placeholder:s("Type your tags here"),options:ae,disabled:ve||g,loading:ve,tagRender:Q=>{const{label:X,closable:Z,onClose:J}=Q,V=M=>{M.preventDefault(),M.stopPropagation()};return(0,t.jsx)(o.ui_kit$Tag,{variant:"solid",color:c.colorPrimary,onMouseDown:V,closable:Z,onClose:J,style:{borderRadius:6},children:X})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})}),S==="email"&&p.isTemplateEnabled&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:16}}),(0,t.jsx)(o.ui_kit$Tooltip,{title:i.isNew?s("Save email first."):s("Use this email as a template for creating future emails."),children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"is_template",valuePropName:"checked",initialValue:te,children:(0,t.jsx)(o.ui_kit$Switch,{id:"setIsTemplate",label:s("Is a template"),size:"small",onChange:pe,disabled:!!i.isNew||g,labelStyle:{position:"relative",top:2,fontSize:14,color:c.colorText}})})},"isTemplate")]}),te&&(0,t.jsx)(Zc,{element:i,levels:F,readOnlyLevels:f,levelsRead:y!==void 0,refetchProjectGroups:B,isLoading:f?v:C||$}),S==="block"&&(0,t.jsx)(o.ui_kit$Form.Item,{name:Gi,label:s("Type"),tooltip:{title:s("Select the block type to find any block on the list faster."),icon:(0,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},rules:[{message:s("Please input type!")}],children:(0,t.jsx)(o.ui_kit$Select,{placeholder:s("Choose block type"),options:P,getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})]})})};wl.propTypes={className:_.default.string,email:_.default.object};var{utm_source:jl,utm_medium:vl,utm_campaign:Il,utm_term:Cl,utm_content:Pl}={utm_source:"utm_source",utm_medium:"utm_medium",utm_campaign:"utm_campaign",utm_term:"utm_term",utm_content:"utm_content"},lu={[jl]:"",[vl]:"",[Il]:"",[Cl]:"",[Pl]:""},Al=({className:e="",email:i=void 0})=>{const{__:s}=r.useI18n(),l=r.useEmailAttributesWriter(),a=r.useEditorLocked(),d=r.useEditorLockCheck(),[c]=o.ui_kit$Form.useForm();(0,n.useEffect)(()=>{i&&c.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||""})},[c,i]);const p=g=>{if(d())return;const b=Object.keys(g)[0],k=g;l({utm_parameters:{...i?.utm_parameters,[b]:k[b]}})};return(0,t.jsx)("div",{className:(0,We.default)("settings-panel",{[e]:e}),children:(0,t.jsxs)(o.ui_kit$Form,{form:c,layout:"vertical",name:"settings_panel_form_utm",initialValues:lu,onValuesChange:p,autoComplete:"off",disabled:a,children:[(0,t.jsx)(o.ui_kit$Alert,{title:s("The specified parameters will be added to all links when exporting the email."),type:"info",showIcon:!0,style:{marginBottom:20}}),(0,t.jsx)(o.ui_kit$Form.Item,{label:s("utm_source"),name:jl,tooltip:{title:s("Mandatory. Indicates the traffic source. Example: utm_source=google"),icon:(0,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:s("google")})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:s("utm_medium"),name:vl,tooltip:{title:s("Identifies what type of link was used, such as cost per click or email. For example: utm_medium=cpc"),icon:(0,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:s("cpc")})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:s("utm_campaign"),name:Il,tooltip:{title:s("Indicates a specific product promotion or a marketing campaign. Example: utm_campaign=spring_sale"),icon:(0,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:s("spring_sale")})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:s("utm_term"),name:Cl,tooltip:{title:s("Identifies search terms. For example: utm_term=running+shoes"),icon:(0,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:s("running+shoes")})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:s("utm_content"),name:Pl,tooltip:{title:s("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,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:s("textlink")})})]})})};Al.propTypes={className:_.default.string,email:_.default.object};var Ye={PRODUCT_CAROUSEL:"productCarousel",SINGLE_IMAGE_PREVIEW:"singleImagePreview",DEAL_ANNOTATION:"dealAnnotation",DEAL_CARD:"dealCard"},Nl="emailmaker-gmail-annotations";function Yi(e){return/^[A-Za-z]{3}$/.test((e??"").trim())}function au(e){return typeof e=="object"&&e!==null}function ri(e,i){const s=e[i];return typeof s=="string"?s:""}var nu=new Set(["PromotionCard","DiscountOffer","Organization"]);function Ll(e){let i;try{i=JSON.parse(e)}catch{return!1}const s=Array.isArray(i)?i:[i];return s.length===0?!1:s.every(l=>typeof l=="object"&&l!==null&&nu.has(String(l["@type"])))}function du(){let e=new Date().getTime(),i=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{let l=Math.random()*16;return e>0?(l=(e+l)%16|0,e=Math.floor(e/16)):(l=(i+l)%16|0,i=Math.floor(i/16)),(s==="x"?l:l&3|8).toString(16)})}function si(e){return e.annotationType||Ye.PRODUCT_CAROUSEL}function ao(e){return!!(e?.image||e?.url||e?.headline||e?.price||e?.priceCurrency||e?.discountValue)}function Xi(e){return!e.description&&!e.discountCode&&!e.availabilityStarts&&!e.availabilityEnds}function li(e){return typeof e=="string"&&e.trim().length>0}function Ki(e){return li(e)?/^https?:\/\//i.test(e.trim()):!1}function Ol(e){return li(e?.image)&&Ki(e?.url)}function cu(e){switch(si(e)){case Ye.SINGLE_IMAGE_PREVIEW:return Ol(e.cards?.[0]);case Ye.DEAL_ANNOTATION:return!Xi(e);case Ye.DEAL_CARD:return li(e.description)&&(Ki(e.offerPageUrl)||Ki(e.merchantHomepageUrl));case Ye.PRODUCT_CAROUSEL:default:return!!e.cards?.some(Ol)}}function uu(e){switch(si(e)){case Ye.SINGLE_IMAGE_PREVIEW:return!ao(e.cards?.[0])&&!li(e.discountCode);case Ye.DEAL_ANNOTATION:return Xi(e);case Ye.DEAL_CARD:return Xi(e)&&!e.offerPageUrl&&!e.merchantHomepageUrl;case Ye.PRODUCT_CAROUSEL:default:return!e.cards?.some(ao)}}function mu(e){switch(si(e)){case Ye.DEAL_ANNOTATION:case Ye.DEAL_CARD:return!!(e.description||e.discountCode||e.availabilityStarts||e.availabilityEnds||e.offerPageUrl||e.merchantHomepageUrl);case Ye.SINGLE_IMAGE_PREVIEW:return ao(e.cards?.[0]);case Ye.PRODUCT_CAROUSEL:default:return e.logo?!0:!!e.cards?.some(ao)}}function pu(e){let i=typeof e.price=="string"||typeof e.price=="number"?String(e.price):"",s=typeof e.discountValue=="string"||typeof e.discountValue=="number"?String(e.discountValue):"";const l=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&&l&&(i=l),!s&&i&&a){const d=parseFloat(i),c=parseFloat(a);!isNaN(d)&&!isNaN(c)&&d>=c&&(s=String(d-c))}return{id:du(),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:s}}function $l(e,i){const s={"@context":"http://schema.org/","@type":"PromotionCard",image:e.image};if(e.url&&(s.url=e.url),e.headline&&(s.headline=e.headline),e.price&&(s.price=e.price),e.priceCurrency){const l=e.priceCurrency.trim();s.priceCurrency=Yi(l)?l.toUpperCase():l}return e.discountValue&&(s.discountValue=e.discountValue),i&&(s.position=i),s}function qi(e){const i={"@context":"http://schema.org/","@type":"DiscountOffer"};for(const s of["description","discountCode","availabilityStarts","availabilityEnds","offerPageUrl","merchantHomepageUrl"]){const l=e[s];l&&(i[s]=l)}return i}function Fl(e){return{"@context":"http://schema.org/","@type":"Organization",logo:e}}function hu(e){const i=si(e),s=[];if(i===Ye.DEAL_CARD)return[qi(e)];if(i===Ye.DEAL_ANNOTATION){const l=[];return e.logo&&l.push(Fl(e.logo)),l.push(qi(e)),l}if(e.logo&&s.push(Fl(e.logo)),i===Ye.SINGLE_IMAGE_PREVIEW){const l=e.cards?.[0];return e.discountCode?.trim()&&s.push(qi(e)),l&&ao(l)&&s.push($l(l)),s}return(e.cards||[]).filter(ao).forEach((l,a)=>{s.push($l(l,a+1))}),s}function bu(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function gu(e){if(uu(e))return null;const i=bu(JSON.stringify(hu(e),null,2));return`<script type="application/ld+json" id="${Nl}">
|
|
10
10
|
${i}
|
|
11
|
-
<\/script>`}function
|
|
11
|
+
<\/script>`}function Ml(e,i){const s=e.toLowerCase().indexOf("<\/script>",i);return s===-1?-1:s+9}function Dl(e,i,s,l){return{range:{start:i,end:l},contentRange:{start:s,end:l-9}}}function Ji(e){const i=new RegExp(`<script\\b[^>]*\\bid=["']${Nl}["']`,"i").exec(e);if(i?.index!==void 0){const a=e.indexOf(">",i.index)+1;if(a<=0)return null;const d=Ml(e,a);if(d!==-1)return Dl(e,i.index,a,d)}const s=/<script\b[^>]*type=["']application\/ld\+json["'][^>]*>/gi;let l;for(;(l=s.exec(e))!==null;){const a=l.index+l[0].length,d=Ml(e,a);if(d!==-1&&Ll(e.slice(a,d-9)))return Dl(e,l.index,a,d)}return null}function fu(e){const i=e.indexOf(">")+1,s=e.toLowerCase().lastIndexOf("<\/script>");return i<=0||s===-1?e:e.slice(i,s)}function _u(e){const i=/<\/head>/i.exec(e);if(i?.index!==void 0)return i.index;const s=/<head\b[^>]*>/i.exec(e);if(s?.index!==void 0)return s.index+s[0].length;const l=/<body\b[^>]*>/i.exec(e);return l?.index!==void 0?l.index:e.length}function Vl(e,i){let{start:s,end:l}=i;return s>0&&e[s-1]===`
|
|
12
12
|
`?s-=1:l<e.length&&e[l]===`
|
|
13
|
-
`&&(l+=1),{start:s,end:l}}function
|
|
13
|
+
`&&(l+=1),{start:s,end:l}}function xu(e,i){const s=Ji(e),l=gu(i);if(!l&&!s)return null;if(s&&!l){const c=Vl(e,s.range);return e.slice(c.start,c.end)?{range:c,text:""}:null}if(s&&l){const c=fu(l);return e.slice(s.contentRange.start,s.contentRange.end)===c?null:{range:s.contentRange,text:c}}if(!l)return null;const a=_u(e),d=`${a>0&&e[a-1]!==`
|
|
14
14
|
`?`
|
|
15
15
|
`:""}${l}
|
|
16
|
-
`;return{range:{start:a,end:a},text:d}}function Wl(e){const i=Qi(e);return i?e.slice(i.contentRange.start,i.contentRange.end):null}function Eu(e){let i=e;for(let s=0;s<50;s++){const l=Qi(i);if(!l)return i;const{start:a,end:d}=Ul(i,l.range);i=i.slice(0,a)+i.slice(d)}return i}function Su(e){try{const i=new DOMParser().parseFromString(e,"text/html").querySelectorAll('script[type="application/ld+json"]');for(let s=0;s<i.length;s++){const l=i[s];if(l.id==="emailmaker-gmail-annotations"||$l(l.textContent||"")){const a=JSON.parse(l.textContent||"[]"),d=(Array.isArray(a)?a:[a]).filter(nu),c={cards:[]};let h=!1,g=!1,b=!1;return d.forEach(x=>{const p=si(x,"@type");if(p==="Organization"){const m=si(x,"logo");m&&(c.logo=m);return}if(p==="DiscountOffer"){g=!0;for(const m of["description","discountCode","availabilityStarts","availabilityEnds"]){const S=si(x,m);S&&(c[m]=S)}for(const m of["offerPageUrl","merchantHomepageUrl"]){const S=si(x,m);S&&(c[m]=S,h=!0)}return}p==="PromotionCard"&&(x.position!==void 0&&(b=!0),c.cards.push(hu(x)))}),c.cards.length>1?c.annotationType=Ye.PRODUCT_CAROUSEL:c.cards.length===1?c.annotationType=b?Ye.PRODUCT_CAROUSEL:Ye.SINGLE_IMAGE_PREVIEW:g&&(c.annotationType=h?Ye.DEAL_CARD:Ye.DEAL_ANNOTATION),c}}}catch{}return null}var Bu={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 Ru(e){return Number.isInteger(e)?String(e):e.toFixed(2)}function zl(e){const i=e?.trim();return i?Bu[i.toUpperCase()]??i:"$"}function Zi(e,i){return`${zl(i)}${Ru(e)}`}function Tu(e){const i=parseFloat(e.price??""),s=parseFloat(e.discountValue??"");return!Number.isNaN(i)&&!Number.isNaN(s)&&s>0?{sale:Zi(i-s,e.priceCurrency),original:Zi(i,e.priceCurrency)}:Number.isNaN(i)?{}:{sale:Zi(i,e.priceCurrency)}}var nt=({variant:e="line",width:i,height:s,className:l})=>{const a=(0,n.useMemo)(()=>({width:i,height:s}),[i,s]);return(0,t.jsx)("span",{className:(0,We.default)("preview-skeleton",`preview-skeleton--${e}`,l),style:a,"aria-hidden":"true"})};function er({className:e}){return(0,t.jsx)("svg",{className:e,width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:(0,t.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 Gl({className:e}){return(0,t.jsxs)("svg",{className:e,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,t.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,t.jsx)("circle",{cx:"7",cy:"7",r:"1.5",fill:"currentColor"})]})}function yu({className:e}){return(0,t.jsxs)("svg",{className:e,width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"1.5"}),(0,t.jsx)("path",{d:"M12 12V7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,t.jsx)("path",{d:"M12 12L15.5 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,t.jsx)("path",{d:"M12 3a9 9 0 0 1 7.5 4",fill:"currentColor",fillOpacity:"0.18"})]})}var wu=2;function ju({card:e}){const i=Tu(e),s=(0,n.useMemo)(()=>({backgroundImage:`url(${e.image})`}),[e.image]),l=!!e.headline?.trim(),a=!!e.image?.trim(),d=!i.sale&&!i.original;return(0,t.jsxs)("div",{className:"product-carousel-preview__card",children:[a?(0,t.jsx)("div",{className:"product-carousel-preview__card-image",style:s}):(0,t.jsx)(nt,{variant:"block",className:"product-carousel-preview__card-image-skeleton"}),(0,t.jsxs)("div",{className:"product-carousel-preview__card-body",children:[l?(0,t.jsx)("div",{className:"product-carousel-preview__card-headline",children:e.headline}):(0,t.jsxs)("div",{className:"product-carousel-preview__card-headline-skeleton",children:[(0,t.jsx)(nt,{height:12}),(0,t.jsx)(nt,{height:12,width:"75%"})]}),d?(0,t.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,t.jsx)(nt,{width:48,height:14}),(0,t.jsx)(nt,{width:40,height:12})]}):(i.sale||i.original)&&(0,t.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[i.sale&&(0,t.jsx)("span",{className:"product-carousel-preview__card-sale-price",children:i.sale}),i.original&&(0,t.jsx)("span",{className:"product-carousel-preview__card-original-price",children:i.original})]})]})]})}function vu(){return(0,t.jsxs)("div",{className:"product-carousel-preview__card",children:[(0,t.jsx)(nt,{variant:"block",className:"product-carousel-preview__card-image-skeleton"}),(0,t.jsxs)("div",{className:"product-carousel-preview__card-body",children:[(0,t.jsxs)("div",{className:"product-carousel-preview__card-headline-skeleton",children:[(0,t.jsx)(nt,{height:12}),(0,t.jsx)(nt,{height:12,width:"75%"})]}),(0,t.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,t.jsx)(nt,{width:48,height:14}),(0,t.jsx)(nt,{width:40,height:12})]})]})]})}var Iu=({data:e,subjectLine:i,cards:s})=>{const{__:l}=r.useI18n(),a=!!e.logo?.trim(),d=!!i?.trim();return(0,t.jsxs)("div",{className:"product-carousel-preview",children:[(0,t.jsx)("div",{className:"product-carousel-preview__header",children:(0,t.jsxs)("div",{className:"product-carousel-preview__header-main",children:[a?(0,t.jsx)("img",{src:e.logo,alt:"",className:"product-carousel-preview__logo"}):(0,t.jsx)(nt,{variant:"circle",width:40,height:40,className:"product-carousel-preview__logo-skeleton"}),(0,t.jsxs)("div",{className:"product-carousel-preview__header-text",children:[(0,t.jsxs)("div",{className:"product-carousel-preview__header-row",children:[(0,t.jsx)("div",{className:"product-carousel-preview__brand-name",children:l("Your company")}),(0,t.jsx)("div",{className:"product-carousel-preview__time",children:"10:10 AM"})]}),(0,t.jsxs)("div",{className:"product-carousel-preview__header-row product-carousel-preview__header-row--subject",children:[d?(0,t.jsx)("div",{className:"product-carousel-preview__subject-line",children:i}):(0,t.jsx)(nt,{height:14,className:"product-carousel-preview__subject-skeleton"}),(0,t.jsx)(er,{className:"product-carousel-preview__star-icon"})]})]})]})}),(0,t.jsx)("div",{className:"product-carousel-preview__carousel",children:s.length>0?s.map((c,h)=>(0,t.jsx)(ju,{card:c},c.id||h)):Array.from({length:wu},(c,h)=>(0,t.jsx)(vu,{},`skeleton-${h}`))})]})};function Cu(e){const i=parseFloat(e?.price??""),s=parseFloat(e?.discountValue??"");if(!Number.isNaN(i)&&i>0&&!Number.isNaN(s)&&s>0){const a=Math.round(s/i*100);if(a>0)return`${a}% Off`}const l=e?.discountValue?.trim();return l?/off/i.test(l)||l.includes("%")?l:`${l} Off`:null}function Yl(e){const i=e?.trim();return i?/^code\s/i.test(i)?i:`Code ${i}`:null}var Pu=({data:e,subjectLine:i,card:s})=>{const{__:l}=r.useI18n(),a=!!e.logo?.trim(),d=!!i?.trim(),c=!!s?.image?.trim(),h=!!s?.headline?.trim(),g=Cu(s),b=Yl(e.discountCode),x=!!(g||b),p=(0,n.useMemo)(()=>({backgroundImage:`url(${s?.image})`}),[s?.image]);return(0,t.jsxs)("div",{className:"single-image-preview",children:[(0,t.jsx)("div",{className:"single-image-preview__header",children:(0,t.jsxs)("div",{className:"single-image-preview__header-main",children:[a?(0,t.jsx)("img",{src:e.logo,alt:"",className:"single-image-preview__logo"}):(0,t.jsx)(nt,{variant:"circle",width:40,height:40,className:"single-image-preview__logo-skeleton"}),(0,t.jsxs)("div",{className:"single-image-preview__header-text",children:[(0,t.jsxs)("div",{className:"single-image-preview__header-row",children:[(0,t.jsx)("div",{className:"single-image-preview__brand-name",children:l("Your company")}),(0,t.jsx)("div",{className:"single-image-preview__time",children:"10:10 AM"})]}),d?(0,t.jsx)("div",{className:"single-image-preview__subject-line",children:i}):(0,t.jsx)(nt,{height:14,className:"single-image-preview__subject-skeleton"}),(0,t.jsxs)("div",{className:"single-image-preview__promo-row",children:[(0,t.jsxs)("div",{className:"single-image-preview__promo-content",children:[g?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Gl,{className:"single-image-preview__promo-icon"}),(0,t.jsx)("span",{className:"single-image-preview__promo-badge",children:g})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(nt,{width:16,height:16,className:"single-image-preview__promo-icon-skeleton"}),(0,t.jsx)(nt,{width:72,height:14})]}),x&&(0,t.jsx)("span",{className:"single-image-preview__promo-separator",children:"·"}),b?(0,t.jsx)("span",{className:"single-image-preview__promo-code",children:b}):(0,t.jsx)(nt,{width:96,height:14,className:"single-image-preview__promo-skeleton"})]}),(0,t.jsx)(er,{className:"single-image-preview__star-icon"})]})]})]})}),(0,t.jsxs)("div",{className:"single-image-preview__card",children:[c?(0,t.jsx)("div",{className:"single-image-preview__card-image",style:p}):(0,t.jsx)(nt,{variant:"block",className:"single-image-preview__card-image-skeleton"}),(0,t.jsx)("div",{className:"single-image-preview__card-body",children:h?(0,t.jsx)("div",{className:"single-image-preview__card-description",children:s?.headline}):(0,t.jsxs)("div",{className:"single-image-preview__card-description-skeleton",children:[(0,t.jsx)(nt,{height:12}),(0,t.jsx)(nt,{height:12,width:"92%"})]})})]})]})};function Au(e){const i=e?.trim();if(!i)return null;const s=(0,At.default)(i);if(!s.isValid())return null;const l=(0,At.default)().startOf("day"),a=s.startOf("day").diff(l,"day");return a===0?"Today":a===1?"Tomorrow":a>1&&a<=7?s.format("MMM D"):s.format("MMM D, YYYY")}function tr(e){const i=e?.trim();return i||null}function Nu(e,i){return e?e==="Today"?i("Today"):e==="Tomorrow"?i("Tomorrow"):e:null}function Lu(e,i){return Nu(Au(e),i)}var Ou=({data:e,subjectLine:i})=>{const{__:s}=r.useI18n(),l=!!e.logo?.trim(),a=!!i?.trim(),d=tr(e.description),c=Yl(e.discountCode),h=!!(d||c);return(0,t.jsx)("div",{className:"deal-annotation-preview",children:(0,t.jsxs)("div",{className:"deal-annotation-preview__header-main",children:[l?(0,t.jsx)("img",{src:e.logo,alt:"",className:"deal-annotation-preview__logo"}):(0,t.jsx)(nt,{variant:"circle",width:40,height:40,className:"deal-annotation-preview__logo-skeleton"}),(0,t.jsxs)("div",{className:"deal-annotation-preview__header-text",children:[(0,t.jsxs)("div",{className:"deal-annotation-preview__header-row",children:[(0,t.jsx)("div",{className:"deal-annotation-preview__brand-name",children:s("Your company")}),(0,t.jsx)("div",{className:"deal-annotation-preview__time",children:"10:10 AM"})]}),a?(0,t.jsx)("div",{className:"deal-annotation-preview__subject-line",children:i}):(0,t.jsx)(nt,{height:14,className:"deal-annotation-preview__subject-skeleton"}),(0,t.jsxs)("div",{className:"deal-annotation-preview__promo-row",children:[(0,t.jsxs)("div",{className:"deal-annotation-preview__promo-content",children:[d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Gl,{className:"deal-annotation-preview__promo-icon"}),(0,t.jsx)("span",{className:"deal-annotation-preview__promo-badge",children:d})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(nt,{width:16,height:16,className:"deal-annotation-preview__promo-icon-skeleton"}),(0,t.jsx)(nt,{width:72,height:14})]}),h&&(0,t.jsx)("span",{className:"deal-annotation-preview__promo-separator",children:"·"}),c?(0,t.jsx)("span",{className:"deal-annotation-preview__promo-code",children:c}):(0,t.jsx)(nt,{width:96,height:14,className:"deal-annotation-preview__promo-skeleton"})]}),(0,t.jsx)(er,{className:"deal-annotation-preview__star-icon"})]})]})]})})},$u=({data:e})=>{const{__:i}=r.useI18n(),s=tr(e.description),l=Lu(e.availabilityEnds,i),a=tr(e.discountCode);return(0,t.jsxs)("div",{className:"deal-card-preview",children:[(0,t.jsx)("div",{className:"deal-card-preview__sender",children:i("Your company")}),s?(0,t.jsx)("div",{className:"deal-card-preview__headline",children:s}):(0,t.jsx)(nt,{height:24,className:"deal-card-preview__headline-skeleton"}),(0,t.jsxs)("div",{className:"deal-card-preview__details",children:[(0,t.jsxs)("div",{className:"deal-card-preview__expires",children:[(0,t.jsx)(yu,{className:"deal-card-preview__clock-icon"}),(0,t.jsxs)("div",{className:"deal-card-preview__detail-text",children:[(0,t.jsx)("div",{className:"deal-card-preview__detail-label",children:i("Expires")}),l?(0,t.jsx)("div",{className:"deal-card-preview__detail-value",children:l}):(0,t.jsx)(nt,{width:72,height:14,className:"deal-card-preview__detail-skeleton"})]})]}),(0,t.jsx)("div",{className:"deal-card-preview__code",children:(0,t.jsxs)("div",{className:"deal-card-preview__detail-text",children:[(0,t.jsx)("div",{className:"deal-card-preview__detail-label",children:i("Code")}),a?(0,t.jsx)("div",{className:"deal-card-preview__detail-value",children:a}):(0,t.jsx)(nt,{width:56,height:14,className:"deal-card-preview__detail-skeleton"})]})})]}),(0,t.jsxs)("div",{className:"deal-card-preview__actions",children:[(0,t.jsx)("span",{className:"deal-card-preview__button",children:i("Visit site")}),(0,t.jsx)("span",{className:"deal-card-preview__button",children:i("Copy code")})]})]})};function Fu(e){return e.annotationType===Ye.SINGLE_IMAGE_PREVIEW?e.cards?.[0]?[e.cards[0]]:[]:e.annotationType===Ye.PRODUCT_CAROUSEL?e.cards||[]:[]}function Mu(e,i){switch(e){case Ye.SINGLE_IMAGE_PREVIEW:return i("Single image preview");case Ye.DEAL_ANNOTATION:return i("Deal Annotation");case Ye.DEAL_CARD:return i("Deal Card");default:return i("Product carousel")}}var or=300,Wt=16;function Du(e){if(!e||e.offsetParent===null)return!1;const i=e.getBoundingClientRect();return i.width>0&&i.height>0}function Vu(e){const i=Array.from(document.querySelectorAll(e));for(const s of i){if(!(s instanceof HTMLElement))continue;const l=s.getBoundingClientRect(),a=window.getComputedStyle(s);if(l.width>0&&l.height>0&&a.display!=="none"&&a.visibility!=="hidden")return s}return null}var Hu=({data:e,subjectLine:i,parentRef:s,overlayTargetSelector:l,onApply:a,applyDisabled:d=!1,applyBlockers:c=[],onRemove:h,visible:g=!0})=>{const{__:b}=r.useI18n(),[x,p]=(0,n.useState)(null),[m,S]=(0,n.useState)(null);(0,n.useEffect)(()=>{if(!g){p(null),S(null);return}const R=()=>{if(!Du(s?.current)){p(null),S(null);return}if(l){const oe=s?.current?.closest(".email-pane__col_settings-inner")||Vu(".email-pane__col_settings-inner");if(oe){S(oe),p({type:"popover"});return}}if(!s?.current)return;let V=s.current.getBoundingClientRect();if(V.width===0&&V.height===0){const oe=s.current.closest(".email-pane__col");oe&&(V=oe.getBoundingClientRect())}const ne=Math.max(Wt,Math.min(V.top,window.innerHeight-Wt));let T=V.left-or-Wt;T<Wt&&(T=V.right+Wt),T+or>window.innerWidth-Wt&&(T=window.innerWidth-or-Wt),S(document.body),p({type:"side",top:ne,left:Math.max(Wt,T)})};R();const C=window.requestAnimationFrame(R),F=[window],U=s?.current?.closest(".email-pane__collapse-wrapper"),$=s?.current?.closest(".email-pane__col");U&&F.push(U),$&&F.push($),F.forEach(V=>{V.addEventListener("scroll",R,{passive:!0})}),window.addEventListener("resize",R);const L=s?.current,P=L&&typeof ResizeObserver<"u"?new ResizeObserver(R):null;return P?.observe(L),()=>{window.cancelAnimationFrame(C),P?.disconnect(),F.forEach(V=>{V.removeEventListener("scroll",R)}),window.removeEventListener("resize",R)}},[s,e,l,g]);const k=(0,n.useMemo)(()=>x?.type==="side"?{position:"fixed",top:x.top,left:x.left}:void 0,[x]);if(!g||!e||!pu(e)&&!a||!x)return null;const f=Fu(e),y=e.annotationType||Ye.PRODUCT_CAROUSEL,v=(()=>{switch(y){case Ye.PRODUCT_CAROUSEL:return(0,t.jsx)(Iu,{data:e,subjectLine:i,cards:f});case Ye.SINGLE_IMAGE_PREVIEW:return(0,t.jsx)(Pu,{data:e,subjectLine:i,card:f[0]});case Ye.DEAL_ANNOTATION:return(0,t.jsx)(Ou,{data:e,subjectLine:i});case Ye.DEAL_CARD:return(0,t.jsx)($u,{data:e});default:return null}})(),N=(0,t.jsxs)("div",{className:`annotations-preview${x.type==="popover"?" annotations-preview--popover":""}`,style:k,children:[(0,t.jsxs)("div",{className:"annotations-preview__content",children:[(0,t.jsxs)("div",{className:"annotations-preview__type",children:[b("Preview"),": ",Mu(y,b)]}),v]}),(a||h)&&(0,t.jsxs)("div",{className:"annotations-preview__footer",children:[h&&(0,t.jsx)(o.ui_kit$Button,{type:"text",size:"small",danger:!0,onClick:h,children:b("Remove annotations")}),a&&(0,t.jsx)(o.ui_kit$Tooltip,{title:d&&c.length?c.join(". "):"",children:(0,t.jsx)("span",{className:"annotations-preview__apply-wrap",children:(0,t.jsx)(o.ui_kit$Button,{type:"primary",size:"small",onClick:a,disabled:d,children:b("Apply")})})})]})]});return(0,Fn.createPortal)(N,m||document.body)};function Uu(e){return e.replaceAll(`\r
|
|
16
|
+
`;return{range:{start:a,end:a},text:d}}function Hl(e){const i=Ji(e);return i?e.slice(i.contentRange.start,i.contentRange.end):null}function ku(e){let i=e;for(let s=0;s<50;s++){const l=Ji(i);if(!l)return i;const{start:a,end:d}=Vl(i,l.range);i=i.slice(0,a)+i.slice(d)}return i}function Eu(e){try{const i=new DOMParser().parseFromString(e,"text/html").querySelectorAll('script[type="application/ld+json"]');for(let s=0;s<i.length;s++){const l=i[s];if(l.id==="emailmaker-gmail-annotations"||Ll(l.textContent||"")){const a=JSON.parse(l.textContent||"[]"),d=(Array.isArray(a)?a:[a]).filter(au),c={cards:[]};let p=!1,g=!1,b=!1;return d.forEach(k=>{const h=ri(k,"@type");if(h==="Organization"){const m=ri(k,"logo");m&&(c.logo=m);return}if(h==="DiscountOffer"){g=!0;for(const m of["description","discountCode","availabilityStarts","availabilityEnds"]){const S=ri(k,m);S&&(c[m]=S)}for(const m of["offerPageUrl","merchantHomepageUrl"]){const S=ri(k,m);S&&(c[m]=S,p=!0)}return}h==="PromotionCard"&&(k.position!==void 0&&(b=!0),c.cards.push(pu(k)))}),c.cards.length>1?c.annotationType=Ye.PRODUCT_CAROUSEL:c.cards.length===1?c.annotationType=b?Ye.PRODUCT_CAROUSEL:Ye.SINGLE_IMAGE_PREVIEW:g&&(c.annotationType=p?Ye.DEAL_CARD:Ye.DEAL_ANNOTATION),c}}}catch{}return null}var Su={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 Bu(e){return Number.isInteger(e)?String(e):e.toFixed(2)}function Ul(e){const i=e?.trim();return i?Su[i.toUpperCase()]??i:"$"}function Qi(e,i){return`${Ul(i)}${Bu(e)}`}function Ru(e){const i=parseFloat(e.price??""),s=parseFloat(e.discountValue??"");return!Number.isNaN(i)&&!Number.isNaN(s)&&s>0?{sale:Qi(i-s,e.priceCurrency),original:Qi(i,e.priceCurrency)}:Number.isNaN(i)?{}:{sale:Qi(i,e.priceCurrency)}}var nt=({variant:e="line",width:i,height:s,className:l})=>{const a=(0,n.useMemo)(()=>({width:i,height:s}),[i,s]);return(0,t.jsx)("span",{className:(0,We.default)("preview-skeleton",`preview-skeleton--${e}`,l),style:a,"aria-hidden":"true"})};function Zi({className:e}){return(0,t.jsx)("svg",{className:e,width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:(0,t.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 Wl({className:e}){return(0,t.jsxs)("svg",{className:e,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,t.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,t.jsx)("circle",{cx:"7",cy:"7",r:"1.5",fill:"currentColor"})]})}function Tu({className:e}){return(0,t.jsxs)("svg",{className:e,width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"1.5"}),(0,t.jsx)("path",{d:"M12 12V7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,t.jsx)("path",{d:"M12 12L15.5 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,t.jsx)("path",{d:"M12 3a9 9 0 0 1 7.5 4",fill:"currentColor",fillOpacity:"0.18"})]})}var yu=2;function wu({card:e}){const i=Ru(e),s=(0,n.useMemo)(()=>({backgroundImage:`url(${e.image})`}),[e.image]),l=!!e.headline?.trim(),a=!!e.image?.trim(),d=!i.sale&&!i.original;return(0,t.jsxs)("div",{className:"product-carousel-preview__card",children:[a?(0,t.jsx)("div",{className:"product-carousel-preview__card-image",style:s}):(0,t.jsx)(nt,{variant:"block",className:"product-carousel-preview__card-image-skeleton"}),(0,t.jsxs)("div",{className:"product-carousel-preview__card-body",children:[l?(0,t.jsx)("div",{className:"product-carousel-preview__card-headline",children:e.headline}):(0,t.jsxs)("div",{className:"product-carousel-preview__card-headline-skeleton",children:[(0,t.jsx)(nt,{height:12}),(0,t.jsx)(nt,{height:12,width:"75%"})]}),d?(0,t.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,t.jsx)(nt,{width:48,height:14}),(0,t.jsx)(nt,{width:40,height:12})]}):(i.sale||i.original)&&(0,t.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[i.sale&&(0,t.jsx)("span",{className:"product-carousel-preview__card-sale-price",children:i.sale}),i.original&&(0,t.jsx)("span",{className:"product-carousel-preview__card-original-price",children:i.original})]})]})]})}function ju(){return(0,t.jsxs)("div",{className:"product-carousel-preview__card",children:[(0,t.jsx)(nt,{variant:"block",className:"product-carousel-preview__card-image-skeleton"}),(0,t.jsxs)("div",{className:"product-carousel-preview__card-body",children:[(0,t.jsxs)("div",{className:"product-carousel-preview__card-headline-skeleton",children:[(0,t.jsx)(nt,{height:12}),(0,t.jsx)(nt,{height:12,width:"75%"})]}),(0,t.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,t.jsx)(nt,{width:48,height:14}),(0,t.jsx)(nt,{width:40,height:12})]})]})]})}var vu=({data:e,subjectLine:i,cards:s})=>{const{__:l}=r.useI18n(),a=!!e.logo?.trim(),d=!!i?.trim();return(0,t.jsxs)("div",{className:"product-carousel-preview",children:[(0,t.jsx)("div",{className:"product-carousel-preview__header",children:(0,t.jsxs)("div",{className:"product-carousel-preview__header-main",children:[a?(0,t.jsx)("img",{src:e.logo,alt:"",className:"product-carousel-preview__logo"}):(0,t.jsx)(nt,{variant:"circle",width:40,height:40,className:"product-carousel-preview__logo-skeleton"}),(0,t.jsxs)("div",{className:"product-carousel-preview__header-text",children:[(0,t.jsxs)("div",{className:"product-carousel-preview__header-row",children:[(0,t.jsx)("div",{className:"product-carousel-preview__brand-name",children:l("Your company")}),(0,t.jsx)("div",{className:"product-carousel-preview__time",children:"10:10 AM"})]}),(0,t.jsxs)("div",{className:"product-carousel-preview__header-row product-carousel-preview__header-row--subject",children:[d?(0,t.jsx)("div",{className:"product-carousel-preview__subject-line",children:i}):(0,t.jsx)(nt,{height:14,className:"product-carousel-preview__subject-skeleton"}),(0,t.jsx)(Zi,{className:"product-carousel-preview__star-icon"})]})]})]})}),(0,t.jsx)("div",{className:"product-carousel-preview__carousel",children:s.length>0?s.map((c,p)=>(0,t.jsx)(wu,{card:c},c.id||p)):Array.from({length:yu},(c,p)=>(0,t.jsx)(ju,{},`skeleton-${p}`))})]})};function Iu(e){const i=parseFloat(e?.price??""),s=parseFloat(e?.discountValue??"");if(!Number.isNaN(i)&&i>0&&!Number.isNaN(s)&&s>0){const a=Math.round(s/i*100);if(a>0)return`${a}% Off`}const l=e?.discountValue?.trim();return l?/off/i.test(l)||l.includes("%")?l:`${l} Off`:null}function zl(e){const i=e?.trim();return i?/^code\s/i.test(i)?i:`Code ${i}`:null}var Cu=({data:e,subjectLine:i,card:s})=>{const{__:l}=r.useI18n(),a=!!e.logo?.trim(),d=!!i?.trim(),c=!!s?.image?.trim(),p=!!s?.headline?.trim(),g=Iu(s),b=zl(e.discountCode),k=!!(g||b),h=(0,n.useMemo)(()=>({backgroundImage:`url(${s?.image})`}),[s?.image]);return(0,t.jsxs)("div",{className:"single-image-preview",children:[(0,t.jsx)("div",{className:"single-image-preview__header",children:(0,t.jsxs)("div",{className:"single-image-preview__header-main",children:[a?(0,t.jsx)("img",{src:e.logo,alt:"",className:"single-image-preview__logo"}):(0,t.jsx)(nt,{variant:"circle",width:40,height:40,className:"single-image-preview__logo-skeleton"}),(0,t.jsxs)("div",{className:"single-image-preview__header-text",children:[(0,t.jsxs)("div",{className:"single-image-preview__header-row",children:[(0,t.jsx)("div",{className:"single-image-preview__brand-name",children:l("Your company")}),(0,t.jsx)("div",{className:"single-image-preview__time",children:"10:10 AM"})]}),d?(0,t.jsx)("div",{className:"single-image-preview__subject-line",children:i}):(0,t.jsx)(nt,{height:14,className:"single-image-preview__subject-skeleton"}),(0,t.jsxs)("div",{className:"single-image-preview__promo-row",children:[(0,t.jsxs)("div",{className:"single-image-preview__promo-content",children:[g?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Wl,{className:"single-image-preview__promo-icon"}),(0,t.jsx)("span",{className:"single-image-preview__promo-badge",children:g})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(nt,{width:16,height:16,className:"single-image-preview__promo-icon-skeleton"}),(0,t.jsx)(nt,{width:72,height:14})]}),k&&(0,t.jsx)("span",{className:"single-image-preview__promo-separator",children:"·"}),b?(0,t.jsx)("span",{className:"single-image-preview__promo-code",children:b}):(0,t.jsx)(nt,{width:96,height:14,className:"single-image-preview__promo-skeleton"})]}),(0,t.jsx)(Zi,{className:"single-image-preview__star-icon"})]})]})]})}),(0,t.jsxs)("div",{className:"single-image-preview__card",children:[c?(0,t.jsx)("div",{className:"single-image-preview__card-image",style:h}):(0,t.jsx)(nt,{variant:"block",className:"single-image-preview__card-image-skeleton"}),(0,t.jsx)("div",{className:"single-image-preview__card-body",children:p?(0,t.jsx)("div",{className:"single-image-preview__card-description",children:s?.headline}):(0,t.jsxs)("div",{className:"single-image-preview__card-description-skeleton",children:[(0,t.jsx)(nt,{height:12}),(0,t.jsx)(nt,{height:12,width:"92%"})]})})]})]})};function Pu(e){const i=e?.trim();if(!i)return null;const s=(0,At.default)(i);if(!s.isValid())return null;const l=(0,At.default)().startOf("day"),a=s.startOf("day").diff(l,"day");return a===0?"Today":a===1?"Tomorrow":a>1&&a<=7?s.format("MMM D"):s.format("MMM D, YYYY")}function er(e){const i=e?.trim();return i||null}function Au(e,i){return e?e==="Today"?i("Today"):e==="Tomorrow"?i("Tomorrow"):e:null}function Nu(e,i){return Au(Pu(e),i)}var Lu=({data:e,subjectLine:i})=>{const{__:s}=r.useI18n(),l=!!e.logo?.trim(),a=!!i?.trim(),d=er(e.description),c=zl(e.discountCode),p=!!(d||c);return(0,t.jsx)("div",{className:"deal-annotation-preview",children:(0,t.jsxs)("div",{className:"deal-annotation-preview__header-main",children:[l?(0,t.jsx)("img",{src:e.logo,alt:"",className:"deal-annotation-preview__logo"}):(0,t.jsx)(nt,{variant:"circle",width:40,height:40,className:"deal-annotation-preview__logo-skeleton"}),(0,t.jsxs)("div",{className:"deal-annotation-preview__header-text",children:[(0,t.jsxs)("div",{className:"deal-annotation-preview__header-row",children:[(0,t.jsx)("div",{className:"deal-annotation-preview__brand-name",children:s("Your company")}),(0,t.jsx)("div",{className:"deal-annotation-preview__time",children:"10:10 AM"})]}),a?(0,t.jsx)("div",{className:"deal-annotation-preview__subject-line",children:i}):(0,t.jsx)(nt,{height:14,className:"deal-annotation-preview__subject-skeleton"}),(0,t.jsxs)("div",{className:"deal-annotation-preview__promo-row",children:[(0,t.jsxs)("div",{className:"deal-annotation-preview__promo-content",children:[d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Wl,{className:"deal-annotation-preview__promo-icon"}),(0,t.jsx)("span",{className:"deal-annotation-preview__promo-badge",children:d})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(nt,{width:16,height:16,className:"deal-annotation-preview__promo-icon-skeleton"}),(0,t.jsx)(nt,{width:72,height:14})]}),p&&(0,t.jsx)("span",{className:"deal-annotation-preview__promo-separator",children:"·"}),c?(0,t.jsx)("span",{className:"deal-annotation-preview__promo-code",children:c}):(0,t.jsx)(nt,{width:96,height:14,className:"deal-annotation-preview__promo-skeleton"})]}),(0,t.jsx)(Zi,{className:"deal-annotation-preview__star-icon"})]})]})]})})},Ou=({data:e})=>{const{__:i}=r.useI18n(),s=er(e.description),l=Nu(e.availabilityEnds,i),a=er(e.discountCode);return(0,t.jsxs)("div",{className:"deal-card-preview",children:[(0,t.jsx)("div",{className:"deal-card-preview__sender",children:i("Your company")}),s?(0,t.jsx)("div",{className:"deal-card-preview__headline",children:s}):(0,t.jsx)(nt,{height:24,className:"deal-card-preview__headline-skeleton"}),(0,t.jsxs)("div",{className:"deal-card-preview__details",children:[(0,t.jsxs)("div",{className:"deal-card-preview__expires",children:[(0,t.jsx)(Tu,{className:"deal-card-preview__clock-icon"}),(0,t.jsxs)("div",{className:"deal-card-preview__detail-text",children:[(0,t.jsx)("div",{className:"deal-card-preview__detail-label",children:i("Expires")}),l?(0,t.jsx)("div",{className:"deal-card-preview__detail-value",children:l}):(0,t.jsx)(nt,{width:72,height:14,className:"deal-card-preview__detail-skeleton"})]})]}),(0,t.jsx)("div",{className:"deal-card-preview__code",children:(0,t.jsxs)("div",{className:"deal-card-preview__detail-text",children:[(0,t.jsx)("div",{className:"deal-card-preview__detail-label",children:i("Code")}),a?(0,t.jsx)("div",{className:"deal-card-preview__detail-value",children:a}):(0,t.jsx)(nt,{width:56,height:14,className:"deal-card-preview__detail-skeleton"})]})})]}),(0,t.jsxs)("div",{className:"deal-card-preview__actions",children:[(0,t.jsx)("span",{className:"deal-card-preview__button",children:i("Visit site")}),(0,t.jsx)("span",{className:"deal-card-preview__button",children:i("Copy code")})]})]})};function $u(e){return e.annotationType===Ye.SINGLE_IMAGE_PREVIEW?e.cards?.[0]?[e.cards[0]]:[]:e.annotationType===Ye.PRODUCT_CAROUSEL?e.cards||[]:[]}function Fu(e,i){switch(e){case Ye.SINGLE_IMAGE_PREVIEW:return i("Single image preview");case Ye.DEAL_ANNOTATION:return i("Deal Annotation");case Ye.DEAL_CARD:return i("Deal Card");default:return i("Product carousel")}}var tr=300,zt=16;function Mu(e){if(!e||e.offsetParent===null)return!1;const i=e.getBoundingClientRect();return i.width>0&&i.height>0}function Du(e){const i=Array.from(document.querySelectorAll(e));for(const s of i){if(!(s instanceof HTMLElement))continue;const l=s.getBoundingClientRect(),a=window.getComputedStyle(s);if(l.width>0&&l.height>0&&a.display!=="none"&&a.visibility!=="hidden")return s}return null}var Vu=({data:e,subjectLine:i,parentRef:s,overlayTargetSelector:l,onApply:a,applyDisabled:d=!1,applyBlockers:c=[],onRemove:p,visible:g=!0})=>{const{__:b}=r.useI18n(),[k,h]=(0,n.useState)(null),[m,S]=(0,n.useState)(null);(0,n.useEffect)(()=>{if(!g){h(null),S(null);return}const B=()=>{if(!Mu(s?.current)){h(null),S(null);return}if(l){const te=s?.current?.closest(".email-pane__col_settings-inner")||Du(".email-pane__col_settings-inner");if(te){S(te),h({type:"popover"});return}}if(!s?.current)return;let H=s.current.getBoundingClientRect();if(H.width===0&&H.height===0){const te=s.current.closest(".email-pane__col");te&&(H=te.getBoundingClientRect())}const ae=Math.max(zt,Math.min(H.top,window.innerHeight-zt));let T=H.left-tr-zt;T<zt&&(T=H.right+zt),T+tr>window.innerWidth-zt&&(T=window.innerWidth-tr-zt),S(document.body),h({type:"side",top:ae,left:Math.max(zt,T)})};B();const C=window.requestAnimationFrame(B),$=[window],U=s?.current?.closest(".email-pane__collapse-wrapper"),L=s?.current?.closest(".email-pane__col");U&&$.push(U),L&&$.push(L),$.forEach(H=>{H.addEventListener("scroll",B,{passive:!0})}),window.addEventListener("resize",B);const F=s?.current,P=F&&typeof ResizeObserver<"u"?new ResizeObserver(B):null;return P?.observe(F),()=>{window.cancelAnimationFrame(C),P?.disconnect(),$.forEach(H=>{H.removeEventListener("scroll",B)}),window.removeEventListener("resize",B)}},[s,e,l,g]);const x=(0,n.useMemo)(()=>k?.type==="side"?{position:"fixed",top:k.top,left:k.left}:void 0,[k]);if(!g||!e||!mu(e)&&!a||!k)return null;const f=$u(e),y=e.annotationType||Ye.PRODUCT_CAROUSEL,v=(()=>{switch(y){case Ye.PRODUCT_CAROUSEL:return(0,t.jsx)(vu,{data:e,subjectLine:i,cards:f});case Ye.SINGLE_IMAGE_PREVIEW:return(0,t.jsx)(Cu,{data:e,subjectLine:i,card:f[0]});case Ye.DEAL_ANNOTATION:return(0,t.jsx)(Lu,{data:e,subjectLine:i});case Ye.DEAL_CARD:return(0,t.jsx)(Ou,{data:e});default:return null}})(),N=(0,t.jsxs)("div",{className:`annotations-preview${k.type==="popover"?" annotations-preview--popover":""}`,style:x,children:[(0,t.jsxs)("div",{className:"annotations-preview__content",children:[(0,t.jsxs)("div",{className:"annotations-preview__type",children:[b("Preview"),": ",Fu(y,b)]}),v]}),(a||p)&&(0,t.jsxs)("div",{className:"annotations-preview__footer",children:[p&&(0,t.jsx)(o.ui_kit$Button,{type:"text",size:"small",danger:!0,onClick:p,children:b("Remove annotations")}),a&&(0,t.jsx)(o.ui_kit$Tooltip,{title:d&&c.length?c.join(". "):"",children:(0,t.jsx)("span",{className:"annotations-preview__apply-wrap",children:(0,t.jsx)(o.ui_kit$Button,{type:"primary",size:"small",onClick:a,disabled:d,children:b("Apply")})})})]})]});return(0,$n.createPortal)(N,m||document.body)};function Hu(e){return e.replaceAll(`\r
|
|
17
17
|
`,`
|
|
18
|
-
`)}function Wu(e){if(!e)return"";const i=document.createElement("textarea");return i.innerHTML=e,i.value.replace(/\u00A0/g," ").trim()}var zu=["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 no(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 Ro(e,i=2){return String(Number(e.toFixed(i)))}function To(e){const i=no(e);return i!==null&&i>0&&i<=100?i:null}function Xl(e,i){const s=no(e),l=To(i);return s===null||s<=0||l===null?"":Ro(s*l/100)}function Gu(e,i){if(i?.includes("%")){const c=To(i);return c===null?"":Ro(c)}const s=no(e),l=no(i);if(s===null||s<=0||l===null||l<=0)return"";const a=l/s*100,d=Ro(l);for(const c of[0,1,2]){const h=Ro(a,c);if(Xl(e,h)===d)return h}return Ro(a)}function ni(){return{id:ht.generateUUID(),image:"",url:"",headline:"",price:"",priceCurrency:"",discountPercent:""}}function Yu({discountValue:e,...i}){return{...i,discountPercent:Gu(i.price,e)}}function Kl(e,i){return i?.length?i.map(Yu):e===Ye.PRODUCT_CAROUSEL||e===Ye.SINGLE_IMAGE_PREVIEW?[ni()]:[]}function ql(e=Ye.PRODUCT_CAROUSEL){return{annotationType:e,annotationLogo:"",description:"",discountCode:"",availabilityStarts:null,availabilityEnds:null,offerPageUrl:"",merchantHomepageUrl:"",cards:Kl(e)}}function Xu(e){const i=e.annotationType||Ye.PRODUCT_CAROUSEL;return{annotationType:i,annotationLogo:e.logo||"",description:e.description||"",discountCode:e.discountCode||"",availabilityStarts:e.availabilityStarts?(0,At.default)(e.availabilityStarts):null,availabilityEnds:e.availabilityEnds?(0,At.default)(e.availabilityEnds):null,offerPageUrl:e.offerPageUrl||"",merchantHomepageUrl:e.merchantHomepageUrl||"",cards:Kl(i,e.cards)}}function Jl(e){const i=e.cards||[];return{annotationType:typeof e.annotationType=="string"?e.annotationType:Ye.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&&At.default.isDayjs(e.availabilityStarts)?e.availabilityStarts.toISOString():void 0,availabilityEnds:e.availabilityEnds&&At.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(s=>({id:s.id||ht.generateUUID(),image:s.image||"",url:s.url||"",headline:s.headline||"",price:s.price||"",priceCurrency:s.priceCurrency||"",discountValue:Xl(s.price,s.discountPercent)}))}}function Ku(e,i){const s=e.getContent();if(!s)return!1;const l=ku(s,i);if(!l||s.slice(l.range.start,l.range.end)===l.text)return!1;const a=s.slice(l.range.start,l.range.end);return e.mutate({changes:[new r.TextChange(l.range.start,a,l.range.start,l.text)]},{source:"user"}),!0}function qu(e,i){return e?e.emailId!==i.emailId||e.markup!==i.markup:!0}function Ju(e){const i=e.getContent(),s=Eu(i);return s===i?!1:(e.mutate({changes:[new r.TextChange(0,i,0,s)]},{source:"user"}),!0)}function ir(e){return!!e&&/^https?:\/\//i.test(e.trim())}function Qu(e,i){const s=e.annotationType??Ye.PRODUCT_CAROUSEL,l=[];return s===Ye.PRODUCT_CAROUSEL||s===Ye.SINGLE_IMAGE_PREVIEW?(e.cards?.some(a=>!!a.image&&ir(a.url))||l.push(i("At least one card needs an image and a link starting with https://")),e.cards?.some(a=>!!a.priceCurrency?.trim()&&!Xi(a.priceCurrency))&&l.push(i("Price currency must be a three-letter ISO 4217 code, for example USD")),l):s===Ye.DEAL_CARD?(e.description?.trim()||l.push(i("Discount description is required")),!ir(e.offerPageUrl)&&!ir(e.merchantHomepageUrl)&&l.push(i("Offer page or merchant homepage link starting with https:// is required")),l):(!e.description&&!e.discountCode&&!e.availabilityStarts&&!e.availabilityEnds&&l.push(i("Fill in at least one offer field")),l)}function Zu(e,i){const s=[],l=e.filter(a=>!!a.discountPercent?.trim());return l.some(a=>To(a.discountPercent)===null)&&s.push(i("Discount must be a percentage greater than 0 and up to 100")),l.some(a=>{const d=no(a.price);return To(a.discountPercent)!==null&&(d===null||d<=0)})&&s.push(i("Enter the price as a number to calculate the discount")),s}var{Text:em}=o.ui_kit$Typography,tm=10,om=1,Ql={width:"100%"},im="https://developers.google.com/workspace/gmail/promotab",Tt=["hover"],rm=["annotationLogo"],Zl=["cards",0,"price"],sm=["cards",0,"discountPercent"],lm=["cards",0,"priceCurrency"];function xt(e){return e.closest(".email-pane__collapse-wrapper")??document.body}var Ft={clearIcon:(0,t.jsx)(o.ui_kit$ColorPickerClearGlyph,{})},am={optionFilterProp:"label"};function nm(e){return{value:e||void 0}}var dm=zu.map(e=>{const i=zl(e);return{value:e,label:i===e?e:`${e} (${i})`}}),ea=({name:e,pricePath:i,iconStrokeWidth:s})=>{const{__:l}=r.useI18n(),a=(0,n.useMemo)(()=>[i],[i]),d=(0,n.useMemo)(()=>[({getFieldValue:c})=>({validator:async(h,g)=>{const b=typeof g=="string"?g.trim():"";if(!b)return;if(To(b)===null)throw new Error(l("Discount must be a percentage greater than 0 and up to 100"));const x=no(c(i));if(x===null||x<=0)throw new Error(l("Enter the price as a number to calculate the discount"))}})],[l,i]);return(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:l("Discount, %"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:e,dependencies:a,rules:d,className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"Percent02Icon",component:o.icons$Percent02Icon,size:16,strokeWidth:s}),placeholder:l("Discount, %"),inputMode:"decimal",allowClear:Ft})})})},ta=({name:e,iconStrokeWidth:i})=>{const{__:s}=r.useI18n(),l=(0,n.useMemo)(()=>[{validator:async(a,d)=>{const c=typeof d=="string"?d.trim():"";if(c&&!Xi(c))throw new Error(s("Price currency must be a three-letter ISO 4217 code, for example USD"))}}],[s]);return(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:s("Price currency"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:e,rules:l,getValueProps:nm,className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Select,{options:dm,placeholder:s("Price currency"),prefix:(0,t.jsx)(r.EmIcons,{icon:"Globe02Icon",component:o.icons$Globe02Icon,size:16,strokeWidth:i}),showSearch:am,allowClear:!0,getPopupContainer:xt})})})},cm=({onAdd:e})=>{const{__:i}=r.useI18n(),s=(0,n.useCallback)(()=>e(ni()),[e]);return(0,t.jsx)(o.ui_kit$Button,{type:"text",block:!0,className:"selected-social-form__add-bar",icon:(0,t.jsx)(r.EmIcons,{icon:"AddSlide",component:o.icons$AddSlide}),onClick:s,children:i("Add card")})},um=({field:e,index:i,form:s,isSingleImagePreview:l,onRemove:a})=>{const{__:d}=r.useI18n(),c=r.useAppConfig(),h=(0,n.useMemo)(()=>[e.name,"image"],[e.name]),g=(0,n.useMemo)(()=>["cards",e.name,"image"],[e.name]),b=(0,n.useMemo)(()=>[e.name,"headline"],[e.name]),x=(0,n.useMemo)(()=>[e.name,"url"],[e.name]),p=(0,n.useMemo)(()=>[e.name,"price"],[e.name]),m=(0,n.useMemo)(()=>["cards",e.name,"price"],[e.name]),S=(0,n.useMemo)(()=>[e.name,"discountPercent"],[e.name]),k=(0,n.useMemo)(()=>[e.name,"priceCurrency"],[e.name]),f=(0,n.useMemo)(()=>[e.name,"id"],[e.name]),y=(0,n.useMemo)(()=>[{validator:async(N,R)=>{const C=typeof R=="string"?R.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,t.jsxs)("div",{className:"selected-social-form__card",children:[(0,t.jsxs)("div",{className:"selected-social-form__card-head",children:[(0,t.jsx)(em,{className:"selected-social-form__card-title",children:l?d("Single image preview"):`${d("Card")} ${i+1}`}),!l&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:d("Delete"),placement:"top",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Button,{type:"text",className:"selected-social-form__card-head-remove",icon:(0,t.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:18,strokeWidth:c.iconStrokeWidth}),"aria-label":d("Delete"),onClick:v})})]}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:d("Image"),placement:"top",getPopupContainer:xt,children:(0,t.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,t.jsx)(Pt,{form:s,label:d("Image"),name:h,watchPath:g})})}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:d("Headline"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:b,className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"ElementTitle",component:o.icons$ElementTitle,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Headline"),allowClear:Ft})})}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:d("Link"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:x,className:"selected-social-form__card-field",rules:y,children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"Link03",component:o.icons$Link03,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Enter link"),allowClear:Ft})})}),!l&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:d("Price"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:p,className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"CreditCard02Icon",component:o.icons$CreditCard02Icon,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Price"),allowClear:Ft})})}),(0,t.jsx)(ea,{name:S,pricePath:m,iconStrokeWidth:c.iconStrokeWidth}),(0,t.jsx)(ta,{name:k,iconStrokeWidth:c.iconStrokeWidth})]}),(0,t.jsx)(o.ui_kit$Form.Item,{name:f,hidden:!0,children:(0,t.jsx)(o.ui_kit$Input,{})})]})};function oa({iconStrokeWidth:e}){const{__:i}=r.useI18n();return(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:i("Discount code"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"discountCode",className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"Sale04Icon",component:o.icons$Sale04Icon,size:16,strokeWidth:e}),placeholder:i("Discount code"),allowClear:Ft})})})}var mm=({className:e="",isActive:i=!0,email:s})=>{const{__:l}=r.useI18n(),a=r.useAppConfig(),d=r.useEditorLocked(),c=r.useEditorLockCheck(),{document:h}=r.useDocumentSessionContext(),g=r.useNotification(),[b]=o.ui_kit$Form.useForm(),x=(0,n.useRef)(null),p=(0,n.useRef)(!1),m=(0,n.useRef)(null),[S,k]=(0,n.useState)(!1),f=o.ui_kit$Form.useWatch("annotationType",b),y=o.ui_kit$Form.useWatch("annotationLogo",b),v=o.ui_kit$Form.useWatch("description",b),N=o.ui_kit$Form.useWatch("discountCode",b),R=o.ui_kit$Form.useWatch("availabilityStarts",b),C=o.ui_kit$Form.useWatch("availabilityEnds",b),F=o.ui_kit$Form.useWatch("offerPageUrl",b),U=o.ui_kit$Form.useWatch("merchantHomepageUrl",b),$=o.ui_kit$Form.useWatch("cards",b),L=JSON.stringify($??[]),P=(0,n.useMemo)(()=>JSON.parse(L)??[],[L]),V=f||Ye.PRODUCT_CAROUSEL,ne=V===Ye.PRODUCT_CAROUSEL||V===Ye.SINGLE_IMAGE_PREVIEW,T=V===Ye.DEAL_ANNOTATION||V===Ye.DEAL_CARD,oe=V===Ye.DEAL_CARD,xe=V===Ye.DEAL_ANNOTATION,be=V===Ye.SINGLE_IMAGE_PREVIEW,Se=V===Ye.SINGLE_IMAGE_PREVIEW?om:tm,me=(0,n.useMemo)(()=>[{value:Ye.PRODUCT_CAROUSEL,label:l("Product carousel")},{value:Ye.SINGLE_IMAGE_PREVIEW,label:l("Single image preview")},{value:Ye.DEAL_ANNOTATION,label:l("Deal Annotation")},{value:Ye.DEAL_CARD,label:l("Deal Card")}],[l]),he=(0,n.useMemo)(()=>{let X="";h&&(X=h.getContent()),!X&&s?.html&&(X=s.html);const Z=X.match(/<title[^>]*>([\s\S]*?)<\/title>/i),J=Z?Z[1].trim():s?.title||s?.subject||"";return Wu(J)},[h,s?.html,s?.title,s?.subject]),ke=(0,n.useMemo)(()=>Jl({annotationType:V,annotationLogo:y,description:v,discountCode:N,availabilityStarts:R,availabilityEnds:C,offerPageUrl:F,merchantHomepageUrl:U,cards:P}),[V,y,v,N,R,C,F,U,P]),ce=(0,n.useMemo)(()=>ne?Zu(P,l):[],[ne,P,l]),ze=(0,n.useMemo)(()=>uu(ke)&&ce.length===0,[ke,ce]),Oe=(0,n.useMemo)(()=>[...Qu(ke,l),...ce],[ke,ce,l]),ve=(0,n.useMemo)(()=>l("Learn more about %s").split("%s"),[l]),Ee=(0,n.useCallback)(()=>{!h||c()||!Ju(h)||(b.setFieldsValue(ql(V)),m.current={emailId:s?.id,markup:null},k(!1),g.success(l("Gmail annotations were removed from the template code.")))},[h,c,b,V,s?.id,g,l]);(0,n.useEffect)(()=>{if(!ne)return;const X=b.getFieldValue("cards")??[];if(V===Ye.SINGLE_IMAGE_PREVIEW){if(X.length>1){b.setFieldsValue({cards:[X[0]]});return}X.length===0&&b.setFieldsValue({cards:[ni()]});return}X.length===0&&b.setFieldsValue({cards:[ni()]})},[b,ne,V,P]);const pe=(0,n.useCallback)(X=>{if(!X||!p.current||!h||c())return!1;const Z=Ku(h,Jl(X));if(Z){const J=Wl(h.getContent());m.current={emailId:s?.id,markup:J},k(J!==null)}return Z},[h,c,s?.id]),Q=(0,n.useCallback)(()=>{pe(b.getFieldsValue(!0))&&g.success(l("Gmail annotation was successfully applied to the template code."))},[pe,b,g,l]);return(0,n.useEffect)(()=>{if(!i)return;const X=Uu(h?.getContent()||s?.html||""),Z={emailId:s?.id,markup:X?Wl(X):null};if(k(Z.markup!==null),!qu(m.current,Z))return;m.current=Z,p.current=!1;const J=X?Su(X):null;b.setFieldsValue(J?Xu(J):ql()),p.current=!0},[i,s?.id,s?.html,h,b]),(0,t.jsxs)("div",{className:(0,We.default)("selected-social-form","annotations-panel",e),ref:x,children:[(0,t.jsx)(Hu,{data:ke,subjectLine:he,parentRef:x,overlayTargetSelector:"#pane-content-iframe",onApply:Q,applyDisabled:!ze||d,applyBlockers:Oe,onRemove:S&&!d?Ee:void 0,visible:i}),(0,t.jsxs)(o.ui_kit$Form,{form:b,layout:"vertical",className:"selected-social-form__form element-controls",autoComplete:"off",disabled:d,children:[(0,t.jsxs)("div",{className:"selected-social-form__section",children:[(0,t.jsx)("div",{className:"selected-social-form__section-title",children:l("General settings")}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:l("Annotation type"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"annotationType",className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Select,{options:me,placeholder:l("Annotation type"),getPopupContainer:xt})})}),!oe&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:l("Organization logo"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,t.jsx)(Pt,{form:b,label:l("Organization logo"),name:"annotationLogo",watchPath:rm})})}),(be||xe)&&(0,t.jsx)(oa,{iconStrokeWidth:a.iconStrokeWidth}),be&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:l("Price"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:Zl,className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"CreditCard02Icon",component:o.icons$CreditCard02Icon,size:16,strokeWidth:a.iconStrokeWidth}),placeholder:l("Price"),allowClear:Ft})})}),(0,t.jsx)(ea,{name:sm,pricePath:Zl,iconStrokeWidth:a.iconStrokeWidth}),(0,t.jsx)(ta,{name:lm,iconStrokeWidth:a.iconStrokeWidth})]}),T&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:l("Discount description"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"description",className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"CommentOutlined",component:o.icons$CommentOutlined,size:16,strokeWidth:a.iconStrokeWidth}),placeholder:l("Discount description"),allowClear:Ft})})}),oe&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(oa,{iconStrokeWidth:a.iconStrokeWidth}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:l("Offer page URL"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"offerPageUrl",className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"Link03",component:o.icons$Link03,size:16,strokeWidth:a.iconStrokeWidth}),placeholder:l("Offer page URL"),allowClear:Ft})})}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:l("Merchant homepage URL"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"merchantHomepageUrl",className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"Link03",component:o.icons$Link03,size:16,strokeWidth:a.iconStrokeWidth}),placeholder:l("Merchant homepage URL"),allowClear:Ft})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:l("Starts"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"availabilityStarts",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DatePicker,{showTime:!0,placeholder:l("Starts"),style:Ql,getPopupContainer:xt})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:l("Ends"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"availabilityEnds",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DatePicker,{showTime:!0,placeholder:l("Ends"),style:Ql,getPopupContainer:xt})})})})]})]})]}),ne&&(0,t.jsxs)("div",{className:(0,We.default)("selected-social-form__section",{"selected-social-form__section--bordered":!be,"annotations-panel__cards-section":be}),children:[V===Ye.PRODUCT_CAROUSEL&&(0,t.jsxs)("div",{className:"selected-social-form__section-title",children:[l("Promotion cards"),(0,t.jsx)("span",{className:"annotations-panel__section-hint",children:l("max 10")})]}),(0,t.jsx)(o.ui_kit$Form.List,{name:"cards",children:(X,{add:Z,remove:J})=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"selected-social-form__items",children:X.map((H,M)=>(0,t.jsx)(um,{field:H,index:M,form:b,isSingleImagePreview:be,onRemove:J},H.key))}),!be&&P.length<Se&&(0,t.jsx)(cm,{onAdd:Z})]})})]}),(0,t.jsxs)("div",{className:"annotations-panel__docs-hint",children:[ve[0],(0,t.jsx)("a",{href:im,target:"_blank",rel:"noopener noreferrer",children:l("Gmail annotations")}),ve[1]]})]})]})},rr=({email:e})=>{const{__:i}=r.useI18n(),s=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,[l,a]=(0,n.useState)(r.SETTINGS),d=r.useAppConfig(),c=S=>a(S||""),h=d.settingsTabEnabled,g=d.UTMEnabled&&s==="email",b=d.annotationsEnabled&&s==="email",x=[h&&"Settings",g&&"UTM parameters",b&&"Annotations parameters"].filter(Boolean),p=x.includes(l)?l:x[0],m=(0,n.useMemo)(()=>{const S=[];return h&&S.push({label:(0,t.jsx)(t.Fragment,{children:i("Settings")}),key:r.SETTINGS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,t.jsx)(vl,{className:"email-settings__collapse-panel-content",element:e})}),g&&S.push({label:(0,t.jsx)(t.Fragment,{children:i("UTM parameters")}),key:r.UTM_PARAMETERS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,t.jsx)(Ll,{className:"email-settings__collapse-panel-content",email:e})}),b&&S.push({label:(0,t.jsx)(t.Fragment,{children:i("Annotations")}),key:r.ANNOTATIONS_PARAMETERS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,t.jsx)(mm,{className:"email-settings__collapse-panel-content",email:e,isActive:p===r.ANNOTATIONS_PARAMETERS})}),S},[i,e,h,g,b,p]);return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse",size:"large",activeKey:p,onChange:c,items:m})})};rr.propTypes={};var ia=320,pm=1200,hm=350,{backgroundColor:ra,backgroundImage:sr,backgroundPositionX:lr,backgroundPositionY:ar,backgroundRepeat:di,backgroundSize:nr,responsive:bm,backgroundColorContent:gm,width:dr}={backgroundColor:"backgroundColor",backgroundImage:"backgroundImage",backgroundPositionX:"backgroundPositionX",backgroundPositionY:"backgroundPositionY",backgroundRepeat:"backgroundRepeat",backgroundSize:"backgroundSize",responsive:"responsive",backgroundColorContent:"backgroundColorContent",width:"width"},fm={[ra]:"",[sr]:"",[lr]:"",[ar]:"",[di]:"checked",[nr]:"",[gm]:"",[dr]:""};function cr(e){const i=Number(e);return Number.isNaN(i)?null:{value:i,dim:"px"}}var sa=({className:e=""})=>{const{__:i}=r.useI18n(),{token:s}=(0,o.ui_kit$useToken)(),l=r.useDispatch(),a=r.useAppConfig(),[d]=o.ui_kit$Form.useForm(),c=r.useSendPostMessage(),h=r.useEmailAttribute("common_styles"),g=r.useSelector(r.selectEmailSettings),b=r.useSelector(r.selectIsSettingsDisabled$1),x=r.useSelector(r.selectActiveSettingsTab),p=r.useSelector(r.selectIsNeedUpdateAppearance),[m,S]=(0,n.useState)(!0),k=(0,n.useRef)(!1),f=(0,n.useRef)(null),y=i("Email not yet loaded or global container not found.");(0,n.useEffect)(()=>{p&&(l(r.setIsNeedUpdateAppearance(!1)),c({operation:r.EVENT_TYPES.INIT_PREVIEW}))},[d,p,l,c,h]),(0,n.useEffect)(()=>()=>{f.current&&clearTimeout(f.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"}],N=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}];(0,n.useEffect)(()=>{const{width:V,...ne}=g,T={...ne,backgroundImage:g.backgroundImage?g.backgroundImage[0]?.value:"",backgroundRepeat:g[di]===""?"repeat":g[di],backgroundSize:g[nr],responsive:g.responsive?.shutdown};k.current||(T.width=V?.value,T.widthDim=V?.dim),d.setFieldsValue(T),S(!g.backgroundImage)},[g,d]);const R=(0,n.useCallback)(V=>{const ne=cr(V);!ne||ne.value<ia||c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{width:ne}})},[c]),C=(0,n.useCallback)(V=>{const ne=cr(V);ne&&l(r.setEmailSettings({...g,width:ne}))},[l,g]),F=(0,n.useCallback)(V=>{f.current&&clearTimeout(f.current),C(V),f.current=setTimeout(()=>{R(V)},hm)},[R,C]),U=V=>{const ne=d.getFieldsValue(!0),T=Object.keys(V)[0];switch(T){case dr:F(V[T]);break;case lr:case ar:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[T]:V[T]===""?"none":V[T]}});break;case sr:S(V[T]===""),c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[T]:[{...g?.backgroundImage?.[0],type:"url",value:V[T]}],backgroundSize:"cover"}});break;case bm:{const oe=cr(ne.width);c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{responsive:{shutdown:V[T],styles:V[T]},...oe?{width:oe}:{}}});break}default:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:V})}},$=V=>{l(r.setMobileViewActive({shutdown:V,styles:V})),c({operation:r.EVENT_TYPES.SANDBOX_IFRAME_SETSIZE,settings:{iframeWidth:document.querySelector(".email-pane__iframe").getBoundingClientRect().width}})},L=()=>{k.current=!0},P=()=>{f.current&&(clearTimeout(f.current),f.current=null);const V=d.getFieldValue(dr);C(V),R(V),requestAnimationFrame(()=>{k.current=!1})};return(0,t.jsx)("div",{className:(0,We.default)("appearance-panel",{[e]:e}),children:(0,t.jsxs)(o.ui_kit$Form,{form:d,layout:"vertical",name:"appearance_panel_form",initialValues:{remember:!1,...fm},onValuesChange:U,autoComplete:"off",className:"element-controls",children:[b?(0,t.jsx)(o.ui_kit$Alert,{style:{marginBottom:"24px"},title:y,type:"error"}):null,(0,t.jsx)(o.ui_kit$FormSection,{title:i("Email layout width"),dividerTop:!1,children:(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:g.width?.value?i("This field sets the width of the email."):i("Couldn`t determine the email width"),placement:"right",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"width",style:{marginBottom:s.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$InputNumber,{min:ia,max:pm,placeholder:i("Width"),disabled:!g.width?.value,addonAfter:"px",onFocus:L,onBlur:P})})})})})}),a.emailResponsiveControlEnabled&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Row,{gutter:20,children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"responsive",valuePropName:"checked",children:(0,t.jsx)(o.ui_kit$Switch,{id:"responsive",label:i("Responsive email"),size:"small",name:"responsive",disabled:g.responsive?.shutdown===void 0,onChange:$})})})}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:i("Email background color"),dividerTop:!a.emailResponsiveControlEnabled,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:m?16:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:ra,style:{marginBottom:s.formItemMarginBottomXS},rules:[{message:i("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:g.usedColors,disabled:b})})})}),(0,t.jsx)(o.ui_kit$Col,{span:m?12:24,children:a.formEmailFieldBackgroundImageEnabled&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Pt,{form:d,label:i("Background image"),name:sr,tooltipTitle:i("Background image"),disabled:b||x!=="Styles",elementSettings:g}),!m&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:"0"},children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Horizontal position"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:lr,style:{marginBottom:s.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:i("Horizontal position"),prefix:(0,t.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:o.icons$BgPositionHorizontal})})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Vertical position"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:ar,style:{marginBottom:s.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:i("Vertical position"),prefix:(0,t.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:o.icons$BgPositionVertical})})})})})]})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Background image repeat"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:di,children:(0,t.jsx)(o.ui_kit$Select,{placeholder:i("Please select"),disabled:b,options:v})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Background image size"),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:nr,children:(0,t.jsx)(o.ui_kit$Select,{placeholder:i("Please select"),disabled:b,options:N})})})})]})]})]})})]})})]})})};sa.propTypes={className:_.default.string};var{Option:la}=o.ui_kit$Select,{width:aa,widthDim:_m}={width:"width",widthDim:"widthDim"},xm={[aa]:"",[_m]:""},na=({className:e=""})=>{const{__:i}=r.useI18n(),s=r.useSelector(r.selectBlockSettings),l=r.useSelector(r.selectIsSettingsDisabled),[a]=o.ui_kit$Form.useForm(),d=r.useSendPostMessage(),c=i("Block not yet loaded or global container not found.");(0,n.useEffect)(()=>{a.setFieldsValue({width:s.width.value,widthDim:s.width.dim})},[s,a]);const h=g=>{const b=a.getFieldsValue(!0),x=Object.keys(g)[0];let p;switch(x){case"width":p={[x]:{value:g[x],dim:b.widthDim}};break;case"widthDim":p={width:{value:b.width,dim:g[x]}};break;default:return}d({operation:r.EVENT_TYPES.SANDBOX_BLOCK_SETTINGS_SET,settings:p})};return(0,t.jsx)("div",{className:(0,We.default)("block-appearance-panel",{[e]:e}),children:(0,t.jsxs)(o.ui_kit$Form,{form:a,layout:"vertical",name:"block_appearance_panel_form",initialValues:{remember:!1,...xm},onValuesChange:h,autoComplete:"off",children:[l?(0,t.jsx)(o.ui_kit$Alert,{style:{marginBottom:"24px"},title:c,type:"error"}):null,(0,t.jsx)(o.ui_kit$Form.Item,{label:i("Container width"),name:aa,tooltip:{title:i("Specifies the block width."),icon:(0,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},rules:[{message:i("Please input container width")}],children:(0,t.jsx)(o.ui_kit$Input,{disabled:l,placeholder:i("Container width"),addonAfter:(0,t.jsx)(o.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:(0,t.jsxs)(o.ui_kit$Select,{className:"select-after",children:[(0,t.jsx)(la,{value:"px",children:"px"}),(0,t.jsx)(la,{value:"%",children:"%"})]})})})})]})})};na.propTypes={className:_.default.string};var km=()=>{};function da(){const e=r.useContainer(),i=(0,n.useCallback)(l=>{if(!e)return km;const a=r.provideDefaultCommonStyles(e).watch(l);return()=>a.dispose()},[e]),s=(0,n.useCallback)(()=>r.getDefaultCommonStyles(e),[e]);return(0,n.useSyncExternalStore)(i,s,s)}function ca(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ur(e,i){const s={...e};for(const l of Object.keys(i)){const a=i[l],d=e[l];ca(a)&&ca(d)?s[l]=ur(d,a):a!==void 0&&(s[l]=a)}return s}function ua(e,i){const s=r.COMMON_STYLES;if(typeof e=="string"){const l=e.trim();if(l.startsWith("{"))try{const a=JSON.parse(l);if(a&&typeof a=="object"&&!Array.isArray(a)&&Object.keys(a).length>0)return ur(s,a)}catch{}}return i&&typeof i=="object"&&!Array.isArray(i)?ur(s,i):s}var ma=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||"#1C52DC",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||"#1C52DC",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||"#1C52DC",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}),Em={buttons_borderRadiusAll:"all",buttons_borderRadiusTopLeft:"topLeft",buttons_borderRadiusBottomLeft:"bottomLeft",buttons_borderRadiusTopRight:"topRight",buttons_borderRadiusBottomRight:"bottomRight"},Sm={cards_borderRadiusAll:"all",cards_borderRadiusTopLeft:"topLeft",cards_borderRadiusBottomLeft:"bottomLeft",cards_borderRadiusTopRight:"topRight",cards_borderRadiusBottomRight:"bottomRight"},Bm={blockPaddingTop:"top",blockPaddingLeft:"left",blockPaddingRight:"right",blockPaddingBottom:"bottom"},Rm=({className:e})=>{const{__:i}=r.useI18n(),s=W.useGoogleFontsLoader(),l=r.useDispatch(),a=r.useSendPostMessage(),[d]=o.ui_kit$Form.useForm(),c=r.useSelector(r.selectEmailSettings),h=r.useSelector(r.selectIsNeedUpdateContentAppearance),g=da(),b=r.useEmailAttribute("common_styles"),x=r.useAppConfig(),{token:p}=(0,o.ui_kit$useToken)(),[m,S]=(0,n.useState)({}),[k,f]=(0,n.useState)({}),[y,v]=(0,n.useState)(!0),[N,R]=(0,n.useState)(!0),[C,F]=(0,n.useState)(!1),[U,$]=(0,n.useState)(!1),L={buttonsPaddingTop:"top",buttonsPaddingLeft:"left",buttonsPaddingRight:"right",buttonsPaddingBottom:"bottom"},P=ua(b,g),[V,ne]=(0,n.useState)(P.headings.bold),[T,oe]=(0,n.useState)(P.headings.italic),[xe,be]=(0,n.useState)(P.links.underline),[Se,me]=(0,n.useState)(P.buttons.bold),[he,ke]=(0,n.useState)(P.buttons.italic),[ce,ze]=(0,n.useState)(null),Oe=r.useSelector(r.selectIsPanelHistoryCollapsed);(0,n.useEffect)(()=>{Oe||ze(null)},[P,ze,Oe]),(0,n.useEffect)(()=>{Oe&&!ce&&ze(ma(P))},[P,ce,Oe]),(0,n.useEffect)(()=>{h&&(l(r.setIsNeedUpdateContentAppearance(!1)),d.setFieldsValue(ma(P)))},[d,h,l,P]);const[ve,Ee]=(0,n.useState)(Math.min(P.headings.fontSize-1,19)),[pe,Q]=(0,n.useState)(Math.max(P.text.fontSize+1,20));(0,n.useEffect)(()=>{if(ce){const H=ce.buttonsBorder;S(H);const M=Object.keys(H).find(te=>H[te]?.width||H[te]?.style||H[te]?.color),Y=ce.cardsBorder;f(Y);const K=Object.keys(Y).find(te=>Y[te]?.width||Y[te]?.style||Y[te]?.color);d.setFieldsValue({buttons_borderPosition:M||"all",buttons_borderWidth:H[M]?.width!==null?H[M]?.width:"",buttons_borderColor:H[M]?.color||"",buttons_borderStyle:H[M]?.style||"",cards_borderPosition:K||"all",cards_borderWidth:Y[K]?.width!==null?Y[K]?.width:"",cards_borderColor:Y[K]?.color||"",cards_borderStyle:Y[K]?.style||"",buttons_borderRadiusAll:u(ce.buttonsBorderRadius.all),buttons_borderRadiusTopLeft:u(ce.buttonsBorderRadius.topLeft),buttons_borderRadiusBottomLeft:u(ce.buttonsBorderRadius.bottomLeft),buttons_borderRadiusTopRight:u(ce.buttonsBorderRadius.topRight),buttons_borderRadiusBottomRight:u(ce.buttonsBorderRadius.bottomRight),cards_borderRadiusAll:u(ce.cardsBorderRadius.all),cards_borderRadiusTopLeft:u(ce.cardsBorderRadius.topLeft),cards_borderRadiusBottomLeft:u(ce.cardsBorderRadius.bottomLeft),cards_borderRadiusTopRight:u(ce.cardsBorderRadius.topRight),cards_borderRadiusBottomRight:u(ce.cardsBorderRadius.bottomRight),blockPaddingAll:u(ce.blockPaddingAll),blockPaddingTop:u(ce.blockPaddingTop),blockPaddingRight:u(ce.blockPaddingRight),blockPaddingBottom:u(ce.blockPaddingBottom),blockPaddingLeft:u(ce.blockPaddingLeft),blockPaddingLeftRight:u(ce.blockPaddingRight)||u(ce.blockPaddingLeft),blockPaddingTopBottom:u(ce.blockPaddingTop)||u(ce.blockPaddingBottom)}),!u(ce.blockPaddingAll)&&(u(ce.blockPaddingTop)||u(ce.blockPaddingRight)||u(ce.blockPaddingBottom)||u(ce.blockPaddingLeft))&&(ce.blockPaddingTop!==ce.blockPaddingBottom||ce.blockPaddingRight!==ce.blockPaddingLeft)?$(!1):$(!0),!u(ce.buttonsBorderRadius.all)&&(u(ce.buttonsBorderRadius.topLeft)||u(ce.buttonsBorderRadius.bottomLeft)||u(ce.buttonsBorderRadius.topRight)||u(ce.buttonsBorderRadius.bottomRight))?v(!1):v(!0),ce.buttonsPadding&&!u(ce.buttonsPadding.all)&&(u(ce.buttonsPadding.bottom)||u(ce.buttonsPadding.right)||u(ce.buttonsPadding.left)||u(ce.buttonsPadding.top))&&F(!1),!u(ce.cardsBorderRadius?.all)&&(u(ce.cardsBorderRadius?.topLeft)||u(ce.cardsBorderRadius?.bottomLeft)||u(ce.cardsBorderRadius?.topRight)||u(ce.cardsBorderRadius?.bottomRight))?R(!1):R(!0)}},[d,ce]);const X=()=>{$(M=>!M);const H=d.getFieldsValue(!0);if(!U){H.blockPaddingLeftRight=H.blockPaddingLeft,H.blockPaddingTopBottom=H.blockPaddingTop,H.blockPaddingRight=H.blockPaddingLeft,H.blockPaddingBottom=H.blockPaddingTop;const M=Number(H.blockPaddingTopBottom),Y=Number(H.blockPaddingLeftRight);a({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{blockPadding:{top:Number.isFinite(M)?M:0,bottom:Number.isFinite(M)?M:0,left:Number.isFinite(Y)?Y:0,right:Number.isFinite(Y)?Y:0}}})}},Z=H=>{const M=H.target.closest("button");if(!M)return;const Y=M.name,K=M.classList.contains("selected-td-form__button--active");M.className=K?"ant-btn ant-btn-default":"ant-btn ant-btn-default selected-td-form__button--active";try{M.blur()}catch{}Y==="headingBold"?ne(!K):Y==="headingItalic"?oe(!K):Y==="linkUnderline"?be(!K):Y==="buttonsBold"?me(!K):Y==="buttonsItalic"&&ke(!K),a({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[Y]:!K}})},J=H=>{const M=d.getFieldsValue(!0),Y=Object.keys(H)[0];let K={};switch(Y){case"headingFontSize":Ee(Math.min(M.headingFontSize-1,19)),K=H;break;case"textFontSize":Q(Math.max(M.textFontSize+1,20)),K=H;break;case"buttons_borderStyle":K={buttonsBorder:{[M.buttons_borderPosition]:{...m[M.buttons_borderPosition],style:H[Y]}}},M.buttons_borderPosition==="all"?S(te=>({...r.RESET_BORDER_PARAMS,[M.buttons_borderPosition]:{...te[M.buttons_borderPosition],style:H[Y]}})):S(te=>({...te,[M.buttons_borderPosition]:{...te[M.buttons_borderPosition],style:H[Y]}}));break;case"buttons_borderColor":K={buttonsBorder:{[M.buttons_borderPosition]:{...m[M.buttonsBorderPosition],color:H[Y]}}},M.buttons_borderPosition==="all"?S(te=>({...r.RESET_BORDER_PARAMS,[M.buttons_borderPosition]:{...te[M.buttons_borderPosition],color:H[Y]}})):S(te=>({...te,[M.buttons_borderPosition]:{...te[M.buttons_borderPosition],color:H[Y]}}));break;case"buttons_borderWidth":K={buttonsBorder:{[M.buttons_borderPosition]:{...m[M.buttons_borderPosition],width:H[Y]}}},M.buttonsBorderPosition==="all"?S(te=>({...r.RESET_BORDER_PARAMS,[M.buttons_borderPosition]:{...te[M.buttons_borderPosition],width:H[Y]}})):S(te=>({...te,[M.buttons_borderPosition]:{...te[M.buttons_borderPosition],width:H[Y]}}));break;case"buttons_borderPosition":d.setFieldsValue({buttons_borderWidth:m[H[Y]]?.width||"",buttons_borderColor:m[H[Y]]?.color||"",buttons_borderStyle:m[H[Y]]?.style||""});break;case"cards_borderStyle":K={cardsBorder:{[M.cards_borderPosition]:{...k[M.cards_borderPosition],style:H[Y]}}},M.cards_borderPosition==="all"?f(te=>({...r.RESET_BORDER_PARAMS,[M.cards_borderPosition]:{...te[M.cards_borderPosition],style:H[Y]}})):f(te=>({...te,[M.cards_borderPosition]:{...te[M.cards_borderPosition],style:H[Y]}}));break;case"cards_borderColor":K={cardsBorder:{[M.cards_borderPosition]:{...k[M.cardsBorderPosition],color:H[Y]}}},M.cards_borderPosition==="all"?f(te=>({...r.RESET_BORDER_PARAMS,[M.cards_borderPosition]:{...te[M.cards_borderPosition],color:H[Y]}})):f(te=>({...te,[M.cards_borderPosition]:{...te[M.cards_borderPosition],color:H[Y]}}));break;case"cards_borderWidth":K={cardsBorder:{[M.cards_borderPosition]:{...k[M.cards_borderPosition],width:H[Y]}}},M.cardsBorderPosition==="all"?f(te=>({...r.RESET_BORDER_PARAMS,[M.cards_borderPosition]:{...te[M.cards_borderPosition],width:H[Y]}})):f(te=>({...te,[M.cards_borderPosition]:{...te[M.cards_borderPosition],width:H[Y]}}));break;case"cards_borderPosition":d.setFieldsValue({cards_borderWidth:k[H[Y]]?.width||"",cards_borderColor:k[H[Y]]?.color||"",cards_borderStyle:k[H[Y]]?.style||""});break;case"buttons_borderRadiusAll":case"buttons_borderRadiusTopLeft":case"buttons_borderRadiusBottomLeft":case"buttons_borderRadiusTopRight":case"buttons_borderRadiusBottomRight":K={buttonsBorderRadius:{[Em[Y]]:+H[Y]}};break;case"cards_borderRadiusAll":case"cards_borderRadiusTopLeft":case"cards_borderRadiusBottomLeft":case"cards_borderRadiusTopRight":case"cards_borderRadiusBottomRight":K={cardsBorderRadius:{[Sm[Y]]:+H[Y]}};break;case"buttonsPaddingTop":case"buttonsPaddingLeft":case"buttonsPaddingRight":case"buttonsPaddingBottom":C?(K={padding:{all:+H[Y]}},d.setFieldsValue({paddingTop:H[Y],paddingLeft:H[Y],paddingRight:H[Y],paddingBottom:H[Y]})):K={buttonsPadding:{[L[Y]]:+H[Y]}};break;case"blockPaddingTop":case"blockPaddingLeft":case"blockPaddingRight":case"blockPaddingBottom":K={blockPadding:{[Bm[Y]]:+H[Y]}};break;case"blockPaddingTopBottom":K={blockPadding:{top:+H[Y],bottom:+H[Y]}},M.blockPaddingTop=M.blockPaddingBottom=+H[Y];break;case"blockPaddingLeftRight":K={blockPadding:{left:+H[Y],right:+H[Y]}},M.blockPaddingLeft=M.blockPaddingRight=+H[Y];break;default:K=H}Y!=="buttons_borderPosition"&&a({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:K})};return ce&&(0,t.jsx)("div",{className:(0,We.default)("appearance-panel",{[e]:e}),children:(0,t.jsxs)(o.ui_kit$Form,{form:d,layout:"vertical",name:"content_appearance_panel_form",initialValues:ce,onValuesChange:J,autoComplete:"off",className:"element-controls",children:[null,(0,t.jsxs)(o.ui_kit$FormSection,{title:i("Blocks"),dividerTop:!1,children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Blocks background color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"blockBackgroundColor",style:{marginBottom:p.formItemMarginBottomMD+4},rules:[{message:i("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color of the contrast blocks"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"blockContrastBackgroundColor",style:{marginBottom:p.formItemMarginBottomMD+4},rules:[{message:i("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})})]}),(0,t.jsx)(o.ui_kit$FormPaddingInputs,{extended:U,onToggleExtended:X,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,t.jsxs)(o.ui_kit$FormSection,{title:i("General text"),dividerTop:!0,children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Font of the general text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textFontFamily",style:{marginBottom:p.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{loadGoogleFonts:s,getPopupContainer:H=>H.closest(".email-pane__content-col")})})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Font size of the general text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textFontSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:15,max:ve,placeholder:i("Font size"),prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Line height of the general text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textLineHeight",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,t.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Color of the general text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Text color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrast block text color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textContrastColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Text color"),usedColors:c.usedColors})})})})]}),(0,t.jsx)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom padding of the general text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textPaddingBottom",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom padding"),prefix:(0,t.jsx)(r.EmIcons,{icon:"PaddingBottom",component:o.icons$PaddingBottom}),addonAfter:"px"})})})})})]}),(0,t.jsxs)(o.ui_kit$FormSection,{title:i("Headings"),dividerTop:!0,children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading font"),placement:"left",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingFontFamily",style:{marginBottom:p.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{loadGoogleFonts:s,getPopupContainer:H=>H.closest(".email-pane__content-col")})})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingFontSize",style:{marginBottom:p.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:pe,max:40,placeholder:i("Font size"),prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading line height"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingLineHeight",style:{marginBottom:p.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,t.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading letter spacing"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingLetterSpacing",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Letter spacing"),prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsxs)(o.ui_kit$Space,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:i("Strong"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)({"selected-td-form__button--active":V}),type:"default",name:"headingBold",onClick:Z,children:(0,t.jsx)(r.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined})})}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:i("Italic"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)({"selected-td-form__button--active":T}),type:"default",name:"headingItalic",onClick:Z,children:(0,t.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined})})})]})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Heading color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrast block header color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingContrastColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Heading color"),usedColors:c.usedColors})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Top padding"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingPaddingTop",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Top padding"),prefix:(0,t.jsx)(r.EmIcons,{icon:"PaddingTop",component:o.icons$PaddingTop}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom padding"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingPaddingBottom",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom padding"),prefix:(0,t.jsx)(r.EmIcons,{icon:"PaddingBottom",component:o.icons$PaddingBottom}),addonAfter:"px"})})})})]})]}),(0,t.jsxs)(o.ui_kit$FormSection,{title:i("Links"),dividerTop:!0,children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Link color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"linkColor",style:{marginBottom:p.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Link color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:i("Underline"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)({"selected-td-form__button--active":xe}),type:"default",name:"linkUnderline",onClick:Z,children:(0,t.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined})})})})]}),(0,t.jsx)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Link color in contrasting blocks"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"linkContrastColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Link color"),usedColors:c.usedColors})})})})})]}),(0,t.jsxs)(o.ui_kit$FormSection,{title:(0,t.jsxs)(t.Fragment,{children:[i("Buttons")," ",(0,t.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Text & background")]}),dividerTop:!0,children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons font"),placement:"left",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsFontFamily",style:{marginBottom:p.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{loadGoogleFonts:s,getPopupContainer:H=>H.closest(".email-pane__content-col")})})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsFontSize",style:{marginBottom:p.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Font size"),prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons letter spacing"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsLetterSpacing",style:{marginBottom:p.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Letter spacing"),prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:"px"})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons text color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsColor",style:{marginBottom:p.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Buttons text color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Button text color in contrasting blocks"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsContrastColor",style:{marginBottom:p.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Buttons text color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons background color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsBackgroundColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Button background color in contrasting blocks"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsContrastBackgroundColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),x.formButtonFieldTextAlignEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Zt,{form:d,elementSettings:{textAlign:"",type:"email"},imgParent:!1,name:"buttonsAlign",withHotKeys:!1})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsxs)(o.ui_kit$Space,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:i("Strong"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)({"selected-td-form__button--active":Se}),type:"default",name:"buttonsBold",onClick:Z,children:(0,t.jsx)(r.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined})})}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:i("Italic"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)({"selected-td-form__button--active":he}),type:"default",name:"buttonsItalic",onClick:Z,children:(0,t.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined})})})]})})]})]}),x.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:(0,t.jsxs)(t.Fragment,{children:[i("Buttons")," ",(0,t.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Borders")]}),dividerTop:!0,children:(0,t.jsx)("div",{style:{paddingBottom:4},children:(0,t.jsx)(W.SelectedElementFormBorder,{form:d,borders:m,namePrefix:"buttons_"})})}),x.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:(0,t.jsxs)(t.Fragment,{children:[i("Buttons")," ",(0,t.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Border radius")]}),dividerTop:!0,children:(0,t.jsx)("div",{style:{paddingBottom:4},children:(0,t.jsx)(Rt,{form:d,oneBorderRadiusValue:y,setOneBorderRadiusValue:v,elementSettings:ce,namePrefix:"buttons_"})})}),(0,t.jsx)(o.ui_kit$FormSection,{title:(0,t.jsxs)(t.Fragment,{children:[i("Buttons")," ",(0,t.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Margins")]}),dividerTop:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Top margin"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsMarginTop",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Top margin"),prefix:(0,t.jsx)(r.EmIcons,{icon:"PaddingTop",component:o.icons$PaddingTop}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom margin"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsMarginBottom",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom margin"),prefix:(0,t.jsx)(r.EmIcons,{icon:"PaddingBottom",component:o.icons$PaddingBottom}),addonAfter:"px"})})})})]})}),(0,t.jsxs)(o.ui_kit$FormSection,{title:(0,t.jsxs)(t.Fragment,{children:[i("Cards")," ",(0,t.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Colors")]}),dividerTop:!0,children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$FormSection,{title:i("Base colors"),compact:!0,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Base background color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"cardsBaseBackgroundColor",style:{marginBottom:p.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Base background color"),usedColors:c.usedColors})})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$FormSection,{title:i("Contrasting colors"),compact:!0,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrasting background color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"cardsContrastBackgroundColor",style:{marginBottom:p.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Contrasting background color"),usedColors:c.usedColors})})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Base text color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"cardsBaseTextColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Base text color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrasting text color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"cardsContrastTextColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Contrasting text color"),usedColors:c.usedColors})})})})]})]}),x.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:(0,t.jsxs)(t.Fragment,{children:[i("Cards")," ",(0,t.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Borders")]}),dividerTop:!0,children:(0,t.jsx)("div",{style:{paddingBottom:4},children:(0,t.jsx)(W.SelectedElementFormBorder,{form:d,borders:k,namePrefix:"cards_"})})}),x.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:(0,t.jsxs)(t.Fragment,{children:[i("Cards")," ",(0,t.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Border radius")]}),dividerTop:!0,children:(0,t.jsx)("div",{style:{paddingBottom:4},children:(0,t.jsx)(Rt,{form:d,oneBorderRadiusValue:N,setOneBorderRadiusValue:R,elementSettings:ce,namePrefix:"cards_"})})})]})})},mr=({email:e})=>{const{__:i}=r.useI18n(),s=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,[l,a]=(0,n.useState)(r.APPEARANCE),d=r.useAppConfig(),c=b=>a(b||"");e.common_styles&&e.common_styles;const h=s==="email"&&d.commonStylesEnabled&&!0;let g=[{label:(0,t.jsx)(t.Fragment,{children:i(s==="email"?"Global styles":"Block styles")}),key:r.APPEARANCE,forceRender:!0,className:"email-settings__collapse-panel",children:s==="email"?(0,t.jsx)(sa,{className:"email-settings__collapse-panel-content"}):(0,t.jsx)(na,{className:"email-settings__collapse-panel-content"})}];return h&&g.push({label:(0,t.jsx)(t.Fragment,{children:i("Content styles")}),key:"contentStyles",forceRender:!0,className:"email-settings__collapse-panel",children:(0,t.jsx)(Rm,{className:"email-settings__collapse-panel-content"})}),(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse appearance-panel__content-styles",size:"large",activeKey:l,onChange:c,items:g})})};mr.propTypes={};var Tm=at.__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((s,l)=>(s[l.toLowerCase()]=l,s),{});e.CASE_SENSITIVE_TAG_NAMES_MAP=i}));function ym(e){return e.type===lt.Tag||e.type===lt.Script||e.type===lt.Style}var lt,wm,jm,vm,Im,Cm,Pm,Am,Nm,Lm,pa=at.__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"})(lt||(lt={})),wm=lt.Root,jm=lt.Text,vm=lt.Directive,Im=lt.Comment,Cm=lt.Script,Pm=lt.Style,Am=lt.Tag,Nm=lt.CDATA,Lm=lt.Doctype}));function ha(e){return ym(e)}function ba(e){return e.type===lt.CDATA}function ga(e){return e.type===lt.Text}function fa(e){return e.type===lt.Comment}function _a(e){return e.type===lt.Directive}function xa(e){return e.type===lt.Root}function Om(e){return Object.hasOwn(e,"children")}function pr(e,i=!1){let s;if(ga(e))s=new wo(e.data);else if(fa(e))s=new ui(e.data);else if(ha(e)){const l=i?hr(e.children):[],a=new hi(e.name,{...e.attribs},l);for(const d of l)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"]}),s=a}else if(ba(e)){const l=i?hr(e.children):[],a=new pi(l);for(const d of l)d.parent=a;s=a}else if(xa(e)){const l=i?hr(e.children):[],a=new vo(l);for(const d of l)d.parent=a;e["x-mode"]&&(a["x-mode"]=e["x-mode"]),s=a}else if(_a(e)){const l=new mi(e.name,e.data);e["x-name"]!=null&&(l["x-name"]=e["x-name"],l["x-publicId"]=e["x-publicId"],l["x-systemId"]=e["x-systemId"]),s=l}else throw new Error(`Not implemented yet: ${e.type}`);return s.startIndex=e.startIndex,s.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(s.sourceCodeLocation=e.sourceCodeLocation),s}function hr(e){const i=e.map(s=>pr(s,!0));for(let s=1;s<i.length;s++)i[s].prev=i[s-1],i[s-1].next=i[s];return i}var ci,yo,wo,ui,mi,jo,pi,vo,hi,ka=at.__esmMin((()=>{pa(),ci=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 pr(this,e)}},yo=class extends ci{data;constructor(e){super(),this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}},wo=class extends yo{type=lt.Text;get nodeType(){return 3}},ui=class extends yo{type=lt.Comment;get nodeType(){return 8}},mi=class extends yo{type=lt.Directive;name;constructor(e,i){super(i),this.name=e}get nodeType(){return 1}"x-name";"x-publicId";"x-systemId"},jo=class extends ci{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}},pi=class extends jo{type=lt.CDATA;get nodeType(){return 4}},vo=class extends jo{type=lt.Root;get nodeType(){return 9}},hi=class extends jo{name;attribs;type;constructor(e,i,s=[],l=e==="script"?lt.Script:e==="style"?lt.Style:lt.Tag){super(s),this.name=e,this.attribs=i,this.type=l}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"}})),br=at.__exportAll({CDATA:()=>pi,Comment:()=>ui,DataNode:()=>yo,Document:()=>vo,DomHandler:()=>fr,Element:()=>hi,Node:()=>ci,NodeWithChildren:()=>jo,ProcessingInstruction:()=>mi,Text:()=>wo,cloneNode:()=>pr,default:()=>fr,hasChildren:()=>Om,isCDATA:()=>ba,isComment:()=>fa,isDirective:()=>_a,isDocument:()=>xa,isTag:()=>ha,isText:()=>ga}),gr,fr,_r=at.__esmMin((()=>{pa(),ka(),ka(),gr={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},fr=class{dom=[];root=new vo(this.dom);callback;options;elementCB;done=!1;tagStack=[this.root];lastNode=null;parser=null;constructor(e,i,s){typeof i=="function"&&(s=i,i=gr),typeof e=="object"&&(i=e,e=void 0),this.callback=e??null,this.options=i??gr,this.elementCB=s??null}onparserinit(e){this.parser=e}onreset(){this.dom=[],this.root=new vo(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 s=this.options.xmlMode?lt.Tag:void 0,l=new hi(e,i,void 0,s);this.addNode(l),this.tagStack.push(l)}ontext(e){const{lastNode:i}=this;if(i&&i.type===lt.Text)i.data+=e,this.options.withEndIndices&&this.parser&&(i.endIndex=this.parser.endIndex);else{const s=new wo(e);this.addNode(s),this.lastNode=s}}oncomment(e){if(this.lastNode&&this.lastNode.type===lt.Comment){this.lastNode.data+=e;return}const i=new ui(e);this.addNode(i),this.lastNode=i}oncommentend(){this.lastNode=null}oncdatastart(){const e=new wo(""),i=new pi([e]);this.addNode(i),e.parent=i,this.lastNode=e}oncdataend(){this.lastNode=null}onprocessinginstruction(e,i){const s=new mi(e,i);this.addNode(s)}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],s=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),s&&(e.prev=s,s.next=e),e.parent=i,this.lastNode=null}}})),Ea=at.__commonJSMin((e=>{var i=Tm(),s=(_r(),at.__toCommonJS(br)),l="\r",a=new RegExp(l,"g"),d=`__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_${Date.now().toString()}__`,c=new RegExp(d,"g");function h(k){return i.CASE_SENSITIVE_TAG_NAMES_MAP[k]}function g(k){const f={};let y=0;const v=k.length;for(;y<v;y++){const N=k[y];f[N.name]=N.value}return f}function b(k){k=k.toLowerCase();const f=h(k);return f||k}function x(k,f){const y="<"+f,v=k.toLowerCase().indexOf(y);if(v===-1)return!1;const N=k[v+y.length];return N===">"||N===" "||N===" "||N===`
|
|
19
|
-
`||N==="\r"||N==="/"}function p(k){return k.replace(a,d)}function m(k){return k.replace(c,l)}function S(k,f=null,y){const v=[];let N,R=0;const C=k.length;for(;R<C;R++){const F=k[R];switch(F.nodeType){case 1:{const $=b(F.nodeName);N=new s.Element($,g(F.attributes)),N.children=S($==="template"?F.content.childNodes:F.childNodes,N);break}case 3:N=new s.Text(m(F.nodeValue??""));break;case 8:N=new s.Comment(F.nodeValue??"");break;default:continue}const U=v[R-1]??null;U&&(U.next=N),N.parent=f,N.prev=U,N.next=null,v.push(N)}return y&&(N=new s.ProcessingInstruction(y.substring(0,y.indexOf(" ")).toLowerCase(),y),N.next=v[0]??null,N.parent=f,v.unshift(N),v[1]&&(v[1].prev=v[0])),v}e.escapeSpecialCharacters=p,e.formatDOM=S,e.hasOpenTag=x})),$m=at.__commonJSMin((e=>{var i=Ea(),s="html",l="head",a="body",d=/<([a-zA-Z]+[0-9]?)/;function c(k,f){return f?f.createHTML(k):k}var h=(k,f,y)=>{throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},g=(k,f,y)=>{throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},b=typeof window=="object"&&window.DOMParser;if(typeof b=="function"){const k=new b,f="text/html";g=(y,v,N)=>(v&&(y=`<${v}>${y}</${v}>`),k.parseFromString(y,f)),h=g}if(typeof document=="object"&&document.implementation){const k=document.implementation.createHTMLDocument();h=function(f,y,v){if(y){const N=k.documentElement.querySelector(y);return N&&(N.innerHTML=c(f,v)),k}return k.documentElement.innerHTML=c(f,v),k}}var x=typeof document=="object"&&document.createElement("template"),p;x&&x.content&&(p=(k,f)=>(x.innerHTML=c(k,f),x.content.childNodes));var m=()=>document.createDocumentFragment().childNodes;function S(k,f){k=i.escapeSpecialCharacters(k);const y=d.exec(k)?.[1]?.toLowerCase();switch(y){case s:{const v=g(k);if(!i.hasOpenTag(k,l)){const N=v.querySelector(l);N?.parentNode?.removeChild(N)}if(!i.hasOpenTag(k,a)){const N=v.querySelector(a);N?.parentNode?.removeChild(N)}return v.querySelectorAll(s)}case l:case a:{const v=h(k,void 0,f).querySelectorAll(y);return i.hasOpenTag(k,a)&&i.hasOpenTag(k,l)?v[0].parentNode?.childNodes??m():v}default:return p?p(k,f):h(k,a,f).querySelector(a)?.childNodes??m()}}e.default=S})),Fm=at.__commonJSMin((e=>{Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var i=Ea(),s=$m(),l=/<(![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 h=l.exec(d),g=h?h[1]:void 0;return i.formatDOM(s.default(d,c?.trustedTypePolicy),null,g)}e.default=a})),Mm=at.__commonJSMin((e=>{var i=0;e.SAME=i;var s=1;e.CAMELCASE=s,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}})),Dm=at.__commonJSMin((e=>{var i=0,s=1,l=2,a=3,d=4,c=5,h=6;function g(R){return x.hasOwnProperty(R)?x[R]:null}function b(R,C,F,U,$,L,P){this.acceptsBooleans=C===l||C===a||C===d,this.attributeName=U,this.attributeNamespace=$,this.mustUseProperty=F,this.propertyName=R,this.type=C,this.sanitizeURL=L,this.removeEmptyString=P}var x={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(R=>{x[R]=new b(R,i,!1,R,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([R,C])=>{x[R]=new b(R,s,!1,C,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(R=>{x[R]=new b(R,l,!1,R.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(R=>{x[R]=new b(R,l,!1,R,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(R=>{x[R]=new b(R,a,!1,R.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(R=>{x[R]=new b(R,a,!0,R,null,!1,!1)}),["capture","download"].forEach(R=>{x[R]=new b(R,d,!1,R,null,!1,!1)}),["cols","rows","size","span"].forEach(R=>{x[R]=new b(R,h,!1,R,null,!1,!1)}),["rowSpan","start"].forEach(R=>{x[R]=new b(R,c,!1,R.toLowerCase(),null,!1,!1)});var p=/[\-\:]([a-z])/g,m=R=>R[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(R=>{const C=R.replace(p,m);x[C]=new b(C,s,!1,R,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(R=>{const C=R.replace(p,m);x[C]=new b(C,s,!1,R,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(R=>{const C=R.replace(p,m);x[C]=new b(C,s,!1,R,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(R=>{x[R]=new b(R,s,!1,R.toLowerCase(),null,!1,!1)});var S="xlinkHref";x[S]=new b("xlinkHref",s,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(R=>{x[R]=new b(R,s,!1,R.toLowerCase(),null,!0,!0)});var{CAMELCASE:k,SAME:f,possibleStandardNames:y}=Mm(),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]*$")),N=Object.keys(y).reduce((R,C)=>{const F=y[C];return F===f?R[C]=C:F===k?R[C.toLowerCase()]=C:R[C]=F,R},{});e.BOOLEAN=a,e.BOOLEANISH_STRING=l,e.NUMERIC=c,e.OVERLOADED_BOOLEAN=d,e.POSITIVE_NUMERIC=h,e.RESERVED=i,e.STRING=s,e.getPropertyInfo=g,e.isCustomAttribute=v,e.possibleStandardNames=N}));function Vm(e,i){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];i=i||{};var s=1,l=1;function a(k){var f=k.match(Ba);f&&(s+=f.length);var y=k.lastIndexOf(Ia);l=~y?k.length-y:l+k.length}function d(){var k={line:s,column:l};return function(f){return f.position=new c(k),b(),f}}function c(k){this.start=k,this.end={line:s,column:l},this.source=i.source}c.prototype.content=e;function h(k){var f=new Error(i.source+":"+s+":"+l+": "+k);if(f.reason=k,f.filename=i.source,f.line=s,f.column=l,f.source=e,!i.silent)throw f}function g(k){var f=k.exec(e);if(f){var y=f[0];return a(y),e=e.slice(y.length),f}}function b(){g(Ra)}function x(k){var f;for(k=k||[];f=p();)f!==!1&&k.push(f);return k}function p(){var k=d();if(!(kr!=e.charAt(0)||Er!=e.charAt(1))){for(var f=2;zt!=e.charAt(f)&&(Er!=e.charAt(f)||kr!=e.charAt(f+1));)++f;if(f+=2,zt===e.charAt(f-1))return h("End of comment missing");var y=e.slice(2,f-2);return l+=2,a(y),e=e.slice(f),l+=2,k({type:Ca,comment:y})}}function m(){var k=d(),f=g(Ta);if(f){if(p(),!g(ya))return h("property missing ':'");var y=g(wa),v=k({type:Pa,property:Sa(f[0].replace(xr,zt)),value:y?Sa(y[0].replace(xr,zt)):zt});return g(ja),v}}function S(){var k=[];x(k);for(var f;f=m();)f!==!1&&(k.push(f),x(k));return k}return b(),S()}function Sa(e){return e?e.replace(va,zt):zt}var xr,Ba,Ra,Ta,ya,wa,ja,va,Ia,kr,Er,zt,Ca,Pa,Hm=at.__esmMin((()=>{xr=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Ba=/\n/g,Ra=/^\s*/,Ta=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,ya=/^:\s*/,wa=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,ja=/^[;\s]*/,va=/^\s+|\s+$/g,Ia=`
|
|
20
|
-
`,
|
|
21
|
-
`:""}${l.documentElement.outerHTML}`}}catch{}return i}var Zm=e=>{const{__:i}=r.useI18n();return[{key:"📧",label:(0,t.jsxs)("div",{onClick:()=>{e("theme-and-preheader-generator")},children:["📧 ",i("Subject line & preheader generator")]})},{key:"🌎",label:(0,t.jsxs)("div",{onClick:()=>{e("translator")},children:["🌎 ",i("Translator")]})},{key:"📄",label:(0,t.jsxs)("div",{onClick:()=>{e("writer")},children:["📄 ",i("Copywriter")]})},{key:"🔎",label:(0,t.jsxs)("div",{onClick:()=>{e("corrector")},children:["🔎 ",i("Proofreader")]})},{key:"🧠",label:(0,t.jsxs)("div",{onClick:()=>{e("psychologist")},children:["🧠 ",i("Psychologist")]})},{key:"📈",label:(0,t.jsxs)("div",{onClick:()=>{e("marketolog")},children:["📈 ",i("Marketer")]})},{key:"✨",label:(0,t.jsxs)("div",{onClick:()=>{e("email-generator")},children:["✨ ",i("Email generator")]})}]},ep={background:r.emCssVar("colorInfo"),color:"#ffffff"},Ga=({messages:e,newEmailAiGeneratorRef:i})=>{const s=r.useElementEntityKind(),{document:l}=r.useDocumentSessionContext(),a=r.useContentReader(),d=r.useUserContentReplacer(),{__:c,_n:h}=r.useI18n(),g=r.useDispatch(),b=r.useAppNavigate(),x=(0,n.useRef)(null),p=r.useAppConfig(),m=r.useEditorLocked(),S=r.useEditorLockCheck(),k=r.useNotification(),f=r.useEditorProjectId(),y=r.useWpEntityId(),v=r.usePushToDataLayer(),N={document:l,pushToDataLayer:v,entityType:s==="block"?"block":"email",entityId:y,projectId:f},R=r.useEventEmitter(ht.events.ON_LIMIT_ID),[C,F]=(0,n.useState)(null),[U,$]=(0,n.useState)(0),[L,P]=(0,n.useState)(!1),[V,ne]=(0,n.useState)(""),[T,oe]=(0,n.useState)([]),[xe,be]=(0,n.useState)(!1),[Se,me]=(0,n.useState)(!1),[he,ke]=(0,n.useState)(null),[ce,ze]=(0,n.useState)(0),[Oe,ve]=(0,n.useState)(null),Ee=r.useEmailAttribute("subject"),pe=r.useEmailAttribute("preheader"),Q=r.useCurrentUser(),X=r.toLanguageCode(r.useInterfaceLocale()),Z=Q.avatar_url||Q.avatar_urls?.[24],J=[Q.first_name,Q.last_name].filter(Boolean).join(" ")||Q.username,H=r.useMessageService(),[M]=r.useLazyGetDialogQuery(),Y=r.useSendPostMessage(),[K,te]=r.useSendMessageMutation(),le=(0,n.useRef)(new Set),Te=(0,n.useCallback)(_e=>{const B=K(_e),ee=le.current;ee.add(B);const E=()=>ee.delete(B);return B.then(E,E),B},[K]);(0,n.useEffect)(()=>{const _e=le.current;return()=>{_e.forEach(B=>B.abort?.()),_e.clear()}},[]);const[Re,{reset:$e}]=r.useGetAiGenerateStatusMutation(),[z,{data:re=[]}]=r.useLazyGetGeneratedContentQuery(),[Ce]=r.useLazyGetLimitsStatsByTypeQuery(),G={cursor:L?"not-allowed":"default",pointerEvents:L?"none":"auto"};(0,n.useEffect)(()=>{Oe&&xe&&(i.current=!0),xe||(i.current=!1)},[Oe,xe]);const Be=!!(p.limits&&p.counters)&&!0,{limits:Fe}=p.limits?p:{limits:{ai_limit:0,ai_generator_limit:0}},{ai_limit:Ae,ai_generator_limit:Ve}=Fe,Ue=r.useEventEmitter(ht.events.AI_TEXT_REQUEST_ID).hasListeners(),Xe=Rr({limitsInPlugin:Be,hostedAiActive:Ue}),de=Wa({limitsInPlugin:Be,hostedAiActive:Ue,counter:U,limit:Ae}),ye=Wa({limitsInPlugin:Be,hostedAiActive:Ue,counter:ce,limit:Ve}),I=(0,n.useCallback)(()=>{R.fire({name:"AiChatCount",count:U+1})},[R,U]),se=(0,n.useCallback)(()=>{R.fire({name:"AiGeneratorCount",count:ce+1})},[R,ce]),je=(0,n.useCallback)(async _e=>!0,[c,Ce,k]);(0,n.useEffect)(()=>{Be&&($(p?.counters?.ai_counter||0),ze(p?.counters?.ai_generator_counter||0))},[p,Be]),(0,n.useEffect)(()=>{ve(T.length<=0?!1:T.toReversed().find(B=>B.data?.context)?.data.context==="email-generator")},[T]);const Ne=(0,n.useCallback)(async()=>await H.sendAsync(r.EVENT_TYPES.SANDBOX_IS_EMAIL_EMPTY),[H]),He=(0,n.useCallback)(()=>{const _e=x.current?.closest(".ant-tabs-content.ant-tabs-content-top");setTimeout(()=>{_e?.scrollTo({top:_e.scrollHeight,behavior:"smooth"})},0)},[x]),Ke=(0,n.useCallback)(()=>{r.swallowPromiseRejection(M({entity_id:y}).then(_e=>{oe(_e.data.documents),He()}))},[y,M,oe,He]),tt=(0,n.useCallback)(_e=>{if(!_e?.data?._eventResult)return!1;const{aiMessage:B,aiHtml:ee}=_e.data;if(oe(E=>{const ae=[...E];for(let Pe=ae.length-1;Pe>=0;Pe--)if(ae[Pe]?.data?.isLoading&&ae[Pe]?.data?.role==="assistant"){ae[Pe]={data:{role:"assistant",message:B,isLoading:!1}};break}return ae}),ee){const E=za(a(),String(ee));d(E,{undoable:!0})}return He(),!0},[a,d,He]),O=(0,n.useCallback)(_e=>{oe(B=>{for(let ee=B.length-1;ee>=0;ee--)if(B[ee]?.data?.isLoading&&B[ee]?.data?.role==="assistant"){const E=[...B];return _e?E[ee]={data:{role:"assistant",message:_e}}:E.splice(ee,1),E}return B})},[]),ie=(0,n.useCallback)(_e=>{const B=_e?.message==="ERROR"?void 0:_e?.message;return[_e?.data?.message,B].find(ee=>typeof ee=="string"&&ee)||c("Something went wrong.")},[c]),j=l?.get().docId,w=r.useEventEmitter(ht.events.AI_TEXT_PROGRESS_ID);(0,n.useEffect)(()=>{const _e=w.event(({progress:B,status:ee,docId:E})=>{if(E!==j)return;const ae=ee||`${Math.round(B)}%`;oe(Pe=>{const Qe=[...Pe];for(let De=Qe.length-1;De>=0;De--)if(Qe[De]?.data?.isLoading&&Qe[De]?.data?.role==="assistant"){Qe[De]={data:{...Qe[De].data,message:ae}};break}return Qe})});return()=>_e.dispose()},[w,j]);const ue=r.useEventEmitter(ht.events.AI_TEXT_STREAM_ID);(0,n.useEffect)(()=>{const _e=ue.event(({partialHtml:B,docId:ee})=>{if(ee!==j)return;const E=za(a(),String(B));d(E,{undoable:!0})});return()=>_e.dispose()},[ue,a,d,g,j]);const Ie=(0,n.useCallback)(_e=>{be(!0),P(!0),r.swallowPromiseRejection(Re({task_id:_e||C,entity_id:y,status:"started"}).then(()=>{Ke()}))},[y,Re,C,Ke]),qe=(0,n.useCallback)(()=>{Re({task_id:C,entity_id:y,status:"completed"}).then(_e=>{_e.data.status===403&&$e(),Ke()}).catch(_e=>{}),P(!1),be(!1)},[y,Re,C,Ke,$e]);(0,n.useEffect)(()=>{let _e;if(xe){const B=re[re.length-1]?.processing?.email;if(B){let ee=re[re.length-1].status;d(String(B),{undoable:!0}),ee===0&&qe()}he&&(clearInterval(_e),be(!1),ke(!1),P(!1),O())}return()=>{clearInterval(_e)}},[d,he,g,re,xe,Ee,pe,y,C,Ke,Re,te,qe,O]),(0,n.useEffect)(He,[He]),(0,n.useEffect)(()=>{e?.length>0&&oe(e),Y({operation:r.EVENT_TYPES.SANDBOX_EMAIL_CONTENT_GET})},[e,Y]),(0,n.useEffect)(()=>{const _e=H.onInit(()=>{H.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:L}),H.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_DISCUSS,value:L})});return()=>_e.dispose()},[L,H]);const Ze=async()=>{if(V&&!S()){const _e=V.replaceAll(/\n/g,"<br>"),B={project_id:f,connection:"chat",entity_id:y,message:_e,locale:X,subject:Ee||"",preheader:pe||"",textContent:fi.extractDocumentTextContent(a())};if(Oe&&ye||de){k.error({title:c(Oe?"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 ee={data:{role:"assistant",message:c(Oe?"You have reached the limit of AI generator usage.":"You have reached the limit of AI chat usage.")}};oe(E=>[...E,ee])}else{if(!await je(Oe?"email_generate":"ai")){ne("");return}Xe&&(Oe&&ce!==Ve?(se(),ze(E=>E+1)):U!==Ae&&(I(),$(E=>E+1))),v({event:"submit_form",action:"chat_whit_ai_assistant",entity_id:B.entity_id,project_id:B.project_id});const ee=[{data:{role:"user",message:_e,userInfo:{display_name:J,avatar_url:Z}}},{data:{role:"assistant",message:c("Typing..."),isLoading:!0}}];oe(E=>[...E,...ee]),Te({body:B}).then(E=>{if(E?.error)throw E.error;if(!E?.data||E.data.status===401)throw new Error(r.ERROR);if(!tt(E)){if(v({event:"submit",action:"send_discussion_chat_message",entity_type:s==="block"?"block":"email",entity_id:y,project_id:f,context:"editor"}),E.data.task_id){let ae=E.data.task_id;F(ae),z({id:ae,setError:ke}),r.swallowPromiseRejection(Ne().then(Pe=>{Pe?Ie(ae):me(!0)}))}Ke()}}).catch(E=>{const ae=ie(E);k.error({title:E?.data?.code||c("Error"),description:ae}),O(ae)})}ne("")}},dt=async _e=>{if(S())return;const B={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};oe(E=>[...E,B]);const ee={project_id:f,connection:"chat",entity_id:y,context:_e,locale:X,subject:Ee||"",preheader:pe||"",textContent:fi.extractDocumentTextContent(a())};if(Xe&&(Oe&&ce!==Ve?(se(),ze(E=>E+1)):U!==Ae&&(I(),$(E=>E+1))),de)k.error({title:c("You have reached the limit of AI chat usage."),description:c("Please upgrade your plan.")}),O(c("You have reached the limit of AI chat usage."));else{if(!await je("ai")){O();return}v({event:"select",action:"select_ai_assistant_role",context:ee.context,entity_id:ee.entity_id,project_id:ee.project_id}),Te({body:ee}).then(E=>{if(E?.error)throw E.error;if(!E?.data||E.data.status===401)throw new Error(r.ERROR);tt(E)||Ke()}).catch(E=>{const ae=ie(E);k.error({title:E?.data?.code||c("Error"),description:ae}),O(ae)})}},st=(0,n.useCallback)(async _e=>{const B={data:{role:"user",message:_e,userInfo:{display_name:J,avatar_url:Z}}},ee={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};oe(ae=>[...ae,B,ee]);const E={project_id:f,connection:"chat",entity_id:y,message:_e,locale:X,subject:Ee||"",preheader:pe||"",textContent:fi.extractDocumentTextContent(a())};if(ye)k.error({title:c("You have reached the limit of AI generator usage."),description:c("Please upgrade your plan.")}),O(c("You have reached the limit of AI chat usage."));else{if(!await je(Oe?"email_generate":"ai")){O();return}Te({body:E}).then(ae=>{if(ae?.error)throw ae.error;if(!ae?.data||ae.data.status===401)throw new Error(r.ERROR);if(!tt(ae)){if(v({event:"submit",action:"send_discussion_chat_message",entity_type:s==="block"?"block":"email",entity_id:y,project_id:f,context:"editor"}),ae.data.task_id){let Pe=ae.data.task_id;F(Pe),z({id:Pe,setError:ke}),r.swallowPromiseRejection(Ne().then(Qe=>{Qe?Ie(Pe):me(!0)}))}Xe&&(Oe&&ce!==Ve?(se(),ze(Pe=>Pe+1)):U!==Ae&&(I(),$(Pe=>Pe+1))),Ke()}}).catch(ae=>{const Pe=ie(ae);k.error({title:ae?.data?.code||c("Error"),description:Pe}),O(Pe)})}},[c,U,ce,Z,Ne,O,Ie,ie,J,Ae,Ve,Q,Ee,pe,y,Oe,ye,X,I,se,Xe,a,k,je,f,Te,z,Ke]);(0,n.useEffect)(()=>{const _e=new ht.Disposable,B=window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings);if((!e?.length||e.length===1&&e[0]?.data?.role==="assistant")&&B&&y&&!m){const ee={project_id:f,connection:"chat",entity_id:y,context:"email-generator",locale:X};Jm(`discuss-ai-generator-context:${y}`,()=>{if(Ue){window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),st(B);return}r.swallowPromiseRejection(K({body:ee}).then(()=>{window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),_e.isDisposed()||st(B)}))})}return()=>_e.dispose()},[e,st,y,X,f,K,Ue,m]);const ct=_e=>{typeof _e.target.className=="string"&&_e.target.className.includes("ai-response-change-context")&&(te.isLoading||dt(_e.target.role))},kt=_e=>{if(S())return;const B=_e.children[0].data??"";Ua("subject",B,N),k.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Title copied to email settings"),data:B})},St=_e=>{if(S())return;const B=_e.children[0].data??"";Ua("preheader",B,N),k.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Preheader copied to email settings"),data:B,duration:300})},D=_e=>{const B=_e.children[0].data;navigator.clipboard.writeText(B).then(()=>{k.success({id:"TEXT_COPIED_TO_CLIPBOARD",title:c("Text copied to clipboard"),data:B})}).catch(ee=>{})},q={replace:_e=>{if(_e.attribs?.class?.split(" ").includes("ai-response-title"))return(0,t.jsx)(o.ui_kit$Tooltip,{placement:"left",title:c("Replace the title"),children:(0,t.jsx)("div",{onClick:()=>kt(_e),children:(0,t.jsx)("span",{className:"ai-response-title",children:(0,co.domToReact)(_e.children,q)})})});if(_e.attribs?.class?.split(" ").includes("ai-response-preheader"))return(0,t.jsx)(o.ui_kit$Tooltip,{placement:"left",title:c("Replace the preheader"),children:(0,t.jsx)("div",{onClick:()=>St(_e),children:(0,t.jsx)("span",{className:"ai-response-preheader",children:(0,co.domToReact)(_e.children,q)})})});if(_e.attribs?.class?.split(" ").includes("ai-response-copy"))return(0,t.jsx)(o.ui_kit$Tooltip,{placement:"left",title:c("Copy to clipboard"),children:(0,t.jsx)("div",{onClick:()=>D(_e),children:(0,t.jsx)("span",{className:"ai-response-copy",children:(0,co.domToReact)(_e.children,q)})})});if(_e.attribs?.class?.split(" ").includes("ai-response-user-message")){const B=_e.attribs?.data||_e.children?.[0]?.data;return(0,t.jsx)("li",{className:_e.attribs?.class,data:_e.attribs?.data,onClick:()=>st(B),children:(0,co.domToReact)(_e.children,q)})}}},we=()=>{Ie(),me(!1)},Ge=()=>{qe(),me(!1)};return(0,t.jsxs)("div",{ref:x,className:"discuss-main",children:[T.length>0&&(0,t.jsx)(o.ui_kit$List,{onClick:ct,className:"comment-list",itemLayout:"horizontal",dataSource:T,renderItem:_e=>(0,t.jsx)("li",{id:_e._id,children:(0,t.jsx)(o.ui_kit$Comment,{className:_e.data.userInfo?"":"ai-comment",avatar:_e.data.role==="assistant"?(0,t.jsx)(r.EmIcons,{icon:"ChatGpt",component:o.icons$ChatGpt,className:"anticon-robot",style:{color:"#ffffff",fontSize:16,width:24,height:24,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"}}):_e.data.userInfo&&_e.data._modified?_e.data.userInfo.avatar_url:Z||(0,t.jsx)(r.EmIcons,{icon:"UserOutlined",component:o.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,t.jsx)("div",{style:G,children:_e?.data?.role==="user"?Q?.username||c("User"):c("AI Assistant")}),datetime:_e._created?(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:r.formatDate(r.parseISO(_e._created),h,!0)}}):null,content:_e.data.isLoading?(0,t.jsx)("div",{className:"spin",children:(0,t.jsx)(r.EmIcons,{icon:"LoadingOutlined",component:o.icons$LoadingOutlined,style:{fontSize:24},spin:!0})}):(0,t.jsx)("div",{style:G,children:qm(_e.data.message,q)})})},_e._id)}),Be&&(Oe?(0,t.jsx)(o.ui_kit$LimitsCounter,{text:`${ce} ${c("of")} ${Ve>0?Ve:"∞"} ${c("mail generator")} ${h("was used","were used",ce)}`,exceeded:Ve>0&&ce>=Ve,style:{marginTop:-25},extra:(0,t.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>b(p.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})}):(0,t.jsx)(o.ui_kit$LimitsCounter,{text:`${U} ${c("of")} ${Ae>0?Ae:"∞"} ${c("messeges")} ${h("was used","were used",U)}`,exceeded:Ae>0&&U>=Ae,style:{marginTop:-25},extra:(0,t.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>b(p.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})})),(0,t.jsxs)(o.ui_kit$Form,{onFinish:Ze,className:"addMode",children:[(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,t.jsx)(o.ui_kit$TextArea,{disabled:L||m,value:V,onChange:_e=>ne(_e.target.value),rows:4,placeholder:c("Type your request"),className:"textarea-comment",onPressEnter:_e=>_e.key==="Enter"&&_e.ctrlKey&&Ze(),spellCheck:"false"})}),(0,t.jsx)(o.ui_kit$Form.Item,{children:(0,t.jsxs)(o.ui_kit$Space,{size:8,children:[(0,t.jsx)(o.ui_kit$Button,{disabled:te.isLoading||L||m,type:"default",style:ep,className:"button-target",children:(0,t.jsx)(o.ui_kit$Dropdown,{placement:"top",disabled:L,arrow:{pointAtCenter:!0},menu:{items:Zm(dt)},children:(0,t.jsxs)("div",{disabled:L,style:{margin:0,padding:0,color:"#ffffff",display:"inline-flex",alignItems:"center"},children:[(0,t.jsx)(r.EmIcons,{icon:"ChatGpt",component:o.icons$ChatGpt,style:{marginRight:5}}),c("Role")]})},"Export")}),(0,t.jsxs)(o.ui_kit$Button,{disabled:te.isLoading||L||m,className:"button-add",type:"primary",htmlType:"submit",children:[c("Send")," ",(0,t.jsx)(r.EmIcons,{icon:"SendOutlined",component:o.icons$SendOutlined,size:16,strokeWidth:p.iconStrokeWidth})]})]})})]}),(0,t.jsx)(o.ui_kit$Modal,{title:c("Warning"),open:Se,onOk:we,onCancel:Ge,children:(0,t.jsx)("p",{children:c("The current template will be changed to the generated one, are you sure about this?")})})]})},tp=[r.VALID,r.ERRORS,r.WARNINGS],Ya=({summary:e,__:i,selectedTags:s,setSelectedTags:l})=>{const a=(0,n.useCallback)((c,h)=>{l(h?s.length===2?[]:[...s,c]:s.filter(g=>g!==c))},[s,l]),d=(0,n.useCallback)(c=>i(c==="valid"?"Valid":c==="warnings"?"Warnings":"Errors"),[i]);return(0,t.jsx)(o.ui_kit$Title,{level:5,className:"optimise__valid-title",children:(0,t.jsx)(o.ui_kit$Space,{className:"optimise__valid-title-space",size:8,children:tp.map((c,h)=>(0,t.jsxs)(o.ui_kit$CheckableTag,{checked:s?.includes(c),onChange:g=>a(c,g),className:(0,We.default)(`${c} optimise__button`,{[`${c}_active`]:s.includes(c)}),children:[d(c),": ",e?.[c]||0]},c+h))})})},{LINKS:op}=r.OPTIMISE_TABS,Xa=(0,n.memo)(({__:e,activeTab:i,validateLinksResult:s,validateLinks:l,selectedTags:a,setSelectedTags:d,isLoading:c,disabled:h,iconStrokeWidth:g,onValidate:b,goToLinkHandler:x})=>i!==op||!s?.links?null:s.links.length===0?(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,t.jsx)(o.ui_kit$Alert,{title:e("No links found."),type:"info"})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-14",children:(0,t.jsxs)("div",{className:"optimise__title-wrapper",children:[(0,t.jsx)(Ya,{__:e,summary:s.summary,setSelectedTags:d,selectedTags:a}),(0,t.jsx)(o.ui_kit$Button,{disabled:h,loading:c,onClick:b,icon:(0,t.jsx)(r.EmIcons,{icon:"SyncOutlined",component:o.icons$SyncOutlined,size:16,strokeWidth:g}),children:e("Refresh")})]})}),(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$List,{itemLayout:"horizontal",dataSource:l,renderItem:(p,m)=>(0,t.jsx)(o.ui_kit$List.Item,{className:o.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,t.jsx)(o.ui_kit$List.Item.Meta,{avatar:p.status==="valid"?(0,t.jsx)(r.EmIcons,{icon:"CheckCircleFilled",component:o.icons$CheckCircleFilled,className:r.VALID}):p.status==="warnings"?(0,t.jsx)(r.EmIcons,{icon:"CheckCircleFilled",component:o.icons$CheckCircleFilled,className:r.WARNINGS}):(0,t.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:o.icons$CloseCircleFilled,className:r.ERRORS}),title:(0,t.jsx)(o.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>x(p.linkId,600>(p.statusCode||0)&&(p.statusCode||0)>399||!p.statusCode),children:p.url===""?e("empty link"):p.url}),description:(0,t.jsxs)(t.Fragment,{children:[!!p.text?.length&&(0,t.jsx)(o.ui_kit$Text,{type:"secondary",children:p.text}),p.page?.title&&p.page.title,p.page?.secure&&p.status==="valid"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,t.jsx)("span",{className:"valid",children:e("secure")})]}),!p.resolvedUrl&&!p.statusCode&&p.type==="url"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,t.jsx)(o.ui_kit$Text,{type:"secondary",children:e("Failed to load")})]})]})})},m+"_"+p.linkId)})})})]}));Xa.displayName="LinksSection";var{IMAGES:ip}=r.OPTIMISE_TABS,Ka=(0,n.memo)(({__:e,activeTab:i,validateImagesResult:s,validateImages:l,selectedTags:a,setSelectedTags:d,isLoading:c,disabled:h,iconStrokeWidth:g,onValidate:b,goToImageHandler:x,showImgPreviewHandler:p,hideBlockPreviewHandler:m})=>i!==ip||!s?.images?null:s.images.length===0?(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,t.jsx)(o.ui_kit$Alert,{title:e("No images found."),type:"info"})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-16",children:(0,t.jsx)(o.ui_kit$Alert,{className:"optimise__alert-custom",title:(0,t.jsxs)("div",{className:"optimise__summary",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)(o.ui_kit$Title,{level:4,className:"optimise__summary-title",children:[s.images.length," "]}),(0,t.jsx)("span",{className:"optimise__summary-label",children:e("images")})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(o.ui_kit$Title,{level:4,className:"optimise__summary-title",children:[s.summaryTime?.value,s.summaryTime?.name]}),(0,t.jsx)("span",{className:"optimise__summary-label",children:e("total size")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.ui_kit$Title,{level:4,className:"optimise__summary-title",children:(Math.max(...s.images.map(S=>S.image.responseTime))/1e3).toFixed(2)+e("s")}),(0,t.jsx)("span",{className:"optimise__summary-label",children:e("time to load")})]})]}),type:"warning"})}),(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-12",children:(0,t.jsxs)("div",{className:"optimise__title-wrapper",children:[(0,t.jsx)(Ya,{__:e,summary:s.summary,setSelectedTags:d,selectedTags:a}),(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(r.EmIcons,{icon:"SyncOutlined",component:o.icons$SyncOutlined,size:16,strokeWidth:g}),disabled:h,loading:c,onClick:b,children:e("Refresh")})]})}),(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-12",children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$List,{className:"optimise__result-list",itemLayout:"horizontal",dataSource:l,renderItem:(S,k)=>(0,t.jsx)(o.ui_kit$List.Item,{className:`optimise__image-item image-item ${o.ui_kit$LIST_ITEM_BORDERLESS_CLASS}`,children:(0,t.jsx)(o.ui_kit$List.Item.Meta,{className:(0,We.default)("image-item__meta",{"image-item__meta_fail":!S.resolvedUrl&&!S.statusCode}),avatar:(0,t.jsx)(o.ui_kit$Image,{className:(0,We.default)("image-item__image optimise__image-auto-height",{"image-item__image_fail":!S.resolvedUrl||!S.valid}),width:92,height:"auto",src:S.resolvedUrl||"",preview:!1,onMouseEnter:()=>p(S.url,S.image.dimensions?.width),onMouseLeave:()=>m()}),title:S.url?(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:S.message,children:(0,t.jsx)(o.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>x(S.imageId,600>(S.statusCode||0)&&(S.statusCode||0)>399||!S.statusCode),children:S?.url===""?e("empty src"):S.url})}):S.message,description:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"image-size",children:[S.image.dimensions&&(0,t.jsxs)(t.Fragment,{children:[S.image.dimensions.width+" × "+S.image.dimensions.height,(0,t.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,t.jsxs)("span",{children:[Math.round(S.image.bytes/1024),e("kB")]}),(0,t.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,t.jsxs)("span",{children:[S.image.responseTime,e("ms")]}),(0,t.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,t.jsx)("span",{className:"image-size-format",children:Oo(S.image.contentType)})]}),S.image.secure&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,t.jsx)("span",{className:"valid",children:e("secure")})]}),S.resolvedUrl&&!S.valid&&(0,t.jsx)(o.ui_kit$Text,{type:"danger",children:e("not valid")})]}),!S.resolvedUrl&&!S.statusCode&&(0,t.jsx)(o.ui_kit$Text,{type:"danger",children:e("Failed to load")})]})})},k)})})})]}));Ka.displayName="ImagesSection";var{SPAM_ASSASSIN:rp}=r.OPTIMISE_TABS,qa=(0,n.memo)(({__:e,activeTab:i,validateSpamResult:s,isLoading:l,disabled:a,iconStrokeWidth:d,onValidate:c})=>{const h=s?.report?.length||Object.prototype.hasOwnProperty.call(s,"spamScore");if(i!==rp||!h)return null;const g=s.spamScore||0,b=s.baseSpamScore||0,x=g<2||!s.spamScore||g<=b-1?"success":g<b-1?"warning":"danger";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{className:"optimise__row-mb-8",children:[(0,t.jsxs)("div",{className:"optimise__title-wrapper optimise__title-wrapper_spam",children:[(0,t.jsxs)(o.ui_kit$Title,{level:1,className:"optimise__spam-score-title",type:x,children:[(0,t.jsx)("span",{className:"optimise__spam-score-value",children:g}),(0,t.jsx)(o.ui_kit$Text,{className:"optimise__spam-score-text",children:"Score"})]}),(0,t.jsx)(o.ui_kit$Button,{disabled:a,icon:(0,t.jsx)(r.EmIcons,{icon:"SyncOutlined",component:o.icons$SyncOutlined,size:16,strokeWidth:d}),loading:l,onClick:c,children:e("Refresh")})]}),g>b-1&&(0,t.jsx)(o.ui_kit$Text,{children:e("Lower scores are better. Aim for a score less than ")+(b-1)+"."})]}),(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-8",children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(s.report?.length||0)>0?(0,t.jsx)(o.ui_kit$List,{itemLayout:"horizontal",dataSource:s.report,renderItem:p=>(0,t.jsx)(o.ui_kit$List.Item,{className:o.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,t.jsx)(o.ui_kit$List.Item.Meta,{title:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Text,{className:"optimise__spam-report-score",children:p.score}),(0,t.jsx)("span",{className:"optimise__spam-report-description",children:p.description})]})})})}):(0,t.jsx)(t.Fragment,{children:s.spamScore===0&&e("Your email doesn't look like spam.")})})})]})});qa.displayName="SpamSection";var{PROBLEMS:sp}=r.OPTIMISE_TABS,Ja=(0,n.memo)(({__:e,activeTab:i,problemsList:s,onSetMonacoPosition:l})=>i!==sp?null:s?.length?(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-8",children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$List,{itemLayout:"horizontal",dataSource:s,renderItem:a=>(0,t.jsx)(o.ui_kit$List.Item,{className:o.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,t.jsx)(o.ui_kit$List.Item.Meta,{avatar:a.severity<6?(0,t.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:o.icons$CloseCircleFilled,className:r.WARNINGS}):(0,t.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:o.icons$CloseCircleFilled,className:r.ERRORS}),title:(0,t.jsxs)(o.ui_kit$Text,{onClick:()=>l(a),className:(0,We.default)("optimise__text-clickable",{warning:a.severity<6,error:a.severity>=6}),children:["Line: ",a.startLineNumber," ",a.startLineNumber!==a.endLineNumber&&" – "+a.endLineNumber]}),description:(0,t.jsx)(o.ui_kit$Text,{children:a.message})})})})})}):(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,t.jsx)(o.ui_kit$Alert,{title:e("No problems found."),type:"info"})}));Ja.displayName="ProblemsSection";var lp={activeTab:"",selectedTags:[],validateLinks:[],validateImages:[],validateSpamResult:{},optimisationCounter:0,linkCheckCounter:0,imageCheckCounter:0,spamCheckCounter:0,validateLinksResult:{},validateImagesResult:{}},ap=(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}},bi={link_check:"link_check_counter",image_check:"image_check_counter",spam_check:"spam_check_counter"},Tr={link_check:"link_check_limit",image_check:"image_check_limit",spam_check:"spam_check_limit"},np=(e,i)=>{const s=Object.values(bi),l=Object.values(Tr);return s.some(a=>e?.[a]!==void 0)||l.some(a=>i?.[a]!==void 0)||s.some(a=>i?.[a]!==void 0)||l.some(a=>e?.[a]!==void 0)},uo=(e,i,s=0)=>{const l=e?.[i];return typeof l=="number"&&!Number.isNaN(l)?l:s},dp=(e,i)=>({counter:e,limit:i,disabled:i>0&&e>=i}),cp=({appConfig:e,data:i,isSuccess:s,optimisationCounter:l,linkCheckCounter:a,imageCheckCounter:d,spamCheckCounter:c,setOptimisationCounter:h,setLinkCheckCounter:g,setImageCheckCounter:b,setSpamCheckCounter:x})=>{const p=(0,n.useMemo)(()=>!!(e.limits&&e.counters)&&!0,[e]),m=(0,n.useMemo)(()=>e.counters,[e,i]),S=(0,n.useMemo)(()=>e.limits,[e,i]),k=(0,n.useMemo)(()=>p&&np(m,S),[p,m,S]),f=(0,n.useMemo)(()=>uo(S,"optimization_limit",0),[S]),y=(0,n.useMemo)(()=>!k&&l>=f&&f>0,[k,l,f]),v=(0,n.useMemo)(()=>{const R={link_check:a,image_check:d,spam_check:c};return Object.keys(Tr).reduce((C,F)=>{const U=Tr[F],$=k?uo(S,U,0):f,L=k?R[F]:l;return C[F]=dp(L,$),C},{})},[k,S,f,a,d,c,l]),N=R=>k?v[R].disabled:y;return(0,n.useEffect)(()=>{if(!p){const R=i?.counters;s&&R?.optimization_counter&&h(R.optimization_counter);return}h(uo(m,"optimization_counter",0)),k&&(g(uo(m,bi.link_check,0)),b(uo(m,bi.image_check,0)),x(uo(m,bi.spam_check,0)))},[p,k,i,s,m,h,g,b,x]),{limitsInPlugin:p,perTypeAvailable:k,currentBillingOptimisationLimits:f,disableFields:y,typeLimits:v,isTypeDisabled:N}},up=()=>{const e=(0,n.useRef)(null);return{showImgPreviewHandler:(0,n.useCallback)((i,s)=>{e.current&&clearTimeout(e.current);let l=document.querySelector(".img-preview"),a=document.querySelector(".img-preview-content");document.querySelector(".img-preview")||(l=document.createElement("div"),l.classList.add("img-preview"),a=document.createElement("div"),a.classList.add("img-preview-content"),l.append(a),document.querySelector(".email-pane__col_settings-inner")?.append(l)),a&&(a.innerHTML=`<table cellspacing="0" cellpadding="0" border="0" width="100%"><img height="auto" width=${(s||0)+"px"} alt="" style="max-width: 100%; object-fit: contain" src=${i}></table>`),l&&l.style.opacity!=="1"&&setTimeout(()=>{l&&(l.style.opacity="1",l.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:mp,IMAGES:pp}=r.OPTIMISE_TABS,hp=({activeTab:e,selectedTags:i,validateLinksResult:s,validateImagesResult:l,setValidateLinks:a,setValidateImages:d})=>{(0,n.useEffect)(()=>{e===mp&&s.links&&a(i.length>0?s.links.filter(c=>i.includes(c.status)):s.links),e===pp&&l.images&&d(i.length>0?l.images.filter(c=>i.includes(c.status)):l.images)},[s.links,l.images,i,e,a,d])},bp=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,Qa=e=>e.statusCode!==null&&e.statusCode<300?r.VALID:e.statusCode<400&&e.statusCode>=300||e.statusCode===200&&!e.valid?r.WARNINGS:r.ERRORS,Za=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}),gp={ai:(0,t.jsx)(r.EmIcons,{icon:"AIRequests",component:o.icons$AIRequests}),email_generate:(0,t.jsx)(r.EmIcons,{icon:"EmailEnvelope",component:o.icons$EmailEnvelope}),image_generate:(0,t.jsx)(r.EmIcons,{icon:"Image",component:o.icons$Image}),optimization:(0,t.jsx)(r.EmIcons,{icon:"Optimization",component:o.icons$Optimization}),preview:(0,t.jsx)(r.EmIcons,{icon:"SendOutlined",component:o.icons$SendOutlined}),test_sends:(0,t.jsx)(r.EmIcons,{icon:"SendOutlined",component:o.icons$SendOutlined}),link_check:(0,t.jsx)(r.EmIcons,{icon:"Web",component:o.icons$Web}),image_check:(0,t.jsx)(r.EmIcons,{icon:"Image",component:o.icons$Image}),spam_check:(0,t.jsx)(r.EmIcons,{icon:"Block",component:o.icons$Block}),projects:(0,t.jsx)(r.EmIcons,{icon:"FolderOpen",component:o.icons$FolderOpen}),emails:(0,t.jsx)(r.EmIcons,{icon:"EmailEnvelope",component:o.icons$EmailEnvelope}),blocks:(0,t.jsx)(r.EmIcons,{icon:"Block",component:o.icons$Block}),users:(0,t.jsx)(r.EmIcons,{icon:"SliderGroup",component:o.icons$SliderGroup})};function en(e,i){if(e==null)return null;if(typeof e=="number"||typeof e=="string"){const s=e==="∞"||typeof e=="string"&&e.toLowerCase()==="infinity";return(0,t.jsx)("span",{className:i==="old"?"limit-upgrade-modal__limit-old":`limit-upgrade-modal__limit-new${s?" limit-upgrade-modal__limit-new--infinity":""}`,children:s?"∞":e})}return e}var gi=({open:e,onClose:i,title:s,subtitle:l,usageResource:a,icon:d,previousDisplay:c,nextDisplay:h,onChangePlan:g,secondaryAction:b,changePlanLabel:x})=>{const{__:p}=r.useI18n(),m=x??p("Change plan"),S=!!b,k=a!=null?gp[a]:d??null;return(0,t.jsx)(o.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,t.jsxs)("div",{className:"limit-upgrade-modal__wrap",children:[(0,t.jsx)("div",{className:"limit-upgrade-modal__header",children:(0,t.jsx)("button",{type:"button",className:"limit-upgrade-modal__close",onClick:i,"aria-label":p("Close"),children:(0,t.jsx)(r.EmIcons,{icon:"CloseOutlined",component:o.icons$CloseOutlined})})}),(0,t.jsxs)("div",{className:"limit-upgrade-modal__body",children:[(0,t.jsx)("h1",{className:"limit-upgrade-modal__title",children:s}),(0,t.jsx)("p",{className:"limit-upgrade-modal__subtitle",children:l}),(0,t.jsxs)("div",{className:"limit-upgrade-modal__limits-row",children:[(0,t.jsx)("div",{className:"limit-upgrade-modal__icon-circle","aria-hidden":!0,children:k}),en(c,"old"),(0,t.jsx)("div",{className:"limit-upgrade-modal__arrow-btn","aria-hidden":!0,children:(0,t.jsx)(r.EmIcons,{icon:"ArrowUpOutlined",component:o.icons$ArrowUpOutlined,className:"limit-upgrade-modal__arrow-icon"})}),en(h,"new")]})]}),(0,t.jsx)("hr",{className:"limit-upgrade-modal__divider"}),(0,t.jsx)("div",{className:S?"limit-upgrade-modal__footer limit-upgrade-modal__footer--dual":"limit-upgrade-modal__footer",children:b?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Button,{className:"limit-upgrade-modal__cta-secondary",onClick:b.onClick,children:b.label}),(0,t.jsx)(o.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:g,children:m})]}):(0,t.jsx)(o.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:g,children:m})})]})})},{LINKS:yr,IMAGES:wr,SPAM_ASSASSIN:tn,PROBLEMS:jr}=r.OPTIMISE_TABS,on={textDecoration:"underline",cursor:"pointer",background:"none",border:"none",padding:0,font:"inherit",color:"inherit"},fp={link_check:"LinkCheckCount",image_check:"ImageCheckCount",spam_check:"SpamCheckCount"},_p={link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"},rn=(e,i,s,l)=>`${e} ${s("of")} ${i>0?i:"∞"} ${l("test","tests",i>0?i:e)} ${l("was used","were used",e)}`,sn=()=>{const{__:e,_n:i}=r.useI18n(),s=r.useDispatch(),l=r.useOpenPlanCatalog(),a=r.useAppNavigate(),d=r.useNotification(),c=r.useContentReader(),h=r.useAppConfig(),g=r.useEditorProjectId(),b=r.useRouteEmailId(),{document:x}=r.useDocumentSessionContext(),p=r.useEmailOfDocument(x,void 0),m=b||(p?.id!=null?String(p.id):void 0),S=m||p?.renderGuid,k=g||(p?.project!=null?String(p.project):void 0),[f,y]=(0,n.useState)(null),v=(0,n.useRef)(!1),N=(0,n.useRef)({link_check:!1,image_check:!1,spam_check:!1}),R=r.useProjectPlanLimitPreflight(),C=(0,n.useCallback)(I=>{y(I)},[]),F=(0,n.useCallback)((I,se)=>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"}[se],previousDisplay:e("—"),nextDisplay:r.presetLimitDisplay("infinity")}),s(r.limitsApi.util.invalidateTags(["LimitsStats","LimitsWarnings"])),!0):!1,[s,e,C]),U=(0,n.useCallback)((I,se)=>{F(I,se)||d.error({error:I})},[F,d]),$=(0,n.useCallback)(async I=>!0,[s,R,C]),L=r.useMessageService(),P=r.useSelector(r.selectProblemsList),V=r.useEventEmitter(ht.events.ON_LIMIT_ID),ne=r.usePushToDataLayer(),[T,oe]=(0,n.useReducer)(ap,lp),[xe,be]=r.useEditSpamMutation(),[Se,me]=r.useEditLinksMutation(),[he,ke]=r.useEditImagesMutation(),{data:ce,isSuccess:ze}=r.useGetProjectQuery(+(k||0),{skip:!0}),Oe=r.useInvalidateProject(),ve=(0,n.useCallback)(I=>oe({type:"SET_OPTIMISATION_COUNTER",payload:I}),[]),Ee=(0,n.useCallback)(I=>oe({type:"SET_LINK_CHECK_COUNTER",payload:I}),[]),pe=(0,n.useCallback)(I=>oe({type:"SET_IMAGE_CHECK_COUNTER",payload:I}),[]),Q=(0,n.useCallback)(I=>oe({type:"SET_SPAM_CHECK_COUNTER",payload:I}),[]),X=(0,n.useCallback)(I=>oe({type:"SET_VALIDATE_LINKS",payload:I}),[]),Z=(0,n.useCallback)(I=>oe({type:"SET_VALIDATE_IMAGES",payload:I}),[]),J=(0,n.useCallback)(I=>oe({type:"SET_SELECTED_TAGS",payload:I}),[]),{limitsInPlugin:H,perTypeAvailable:M,currentBillingOptimisationLimits:Y,disableFields:K,typeLimits:te,isTypeDisabled:le}=cp({appConfig:h,data:ce,isSuccess:ze,optimisationCounter:T.optimisationCounter,linkCheckCounter:T.linkCheckCounter,imageCheckCounter:T.imageCheckCounter,spamCheckCounter:T.spamCheckCounter,setOptimisationCounter:ve,setLinkCheckCounter:Ee,setImageCheckCounter:pe,setSpamCheckCounter:Q});hp({activeTab:T.activeTab,selectedTags:T.selectedTags,validateLinksResult:T.validateLinksResult,validateImagesResult:T.validateImagesResult,setValidateLinks:X,setValidateImages:Z});const{showImgPreviewHandler:Te,hideBlockPreviewHandler:Re}=up(),$e=(0,n.useCallback)(I=>I==="link_check"?T.linkCheckCounter:I==="image_check"?T.imageCheckCounter:T.spamCheckCounter,[T.linkCheckCounter,T.imageCheckCounter,T.spamCheckCounter]),z=(0,n.useCallback)(I=>{if(H){if(M){oe({type:{link_check:"INCREMENT_LINK_CHECK_COUNTER",image_check:"INCREMENT_IMAGE_CHECK_COUNTER",spam_check:"INCREMENT_SPAM_CHECK_COUNTER"}[I]}),V.fire({name:fp[I],count:$e(I)+1});return}oe({type:"INCREMENT_OPTIMISATION_COUNTER"}),V.fire({name:"OptimizationCount",count:T.optimisationCounter+1})}},[H,M,V,$e,T.optimisationCounter]),re=(0,n.useCallback)(I=>{if(M){const{limit:se}=te[I];C({presetId:_p[I],previousDisplay:se>0?se:r.presetLimitDisplay("infinity"),nextDisplay:r.presetLimitDisplay("infinity")});return}C({presetId:"optimization_exceeded",previousDisplay:Y,nextDisplay:r.presetLimitDisplay("infinity")})},[M,te,C,Y]),Ce=(0,n.useCallback)(()=>{a(h.billingPageUrl||r.APP_ROUTES.billing)},[h.billingPageUrl,a]),G=I=>{if(!H||!M)return null;const{counter:se,limit:je,disabled:Ne}=te[I];return(0,t.jsx)(o.ui_kit$LimitsCounter,{text:rn(se,je,e,i),exceeded:Ne,extra:(0,t.jsx)("button",{type:"button",style:on,onClick:Ce,children:e("Need more?")})})},Be=(0,n.useCallback)((I,se)=>{L.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_LINK,settings:{elementId:I,isError:se}})},[L]),Fe=(0,n.useCallback)((I,se)=>{L.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_IMG,settings:{elementId:I,isError:se}})},[L]),Ae=(0,n.useCallback)(I=>{const se={startColumn:I.startColumn,startLineNumber:I.startLineNumber,endColumn:I.endColumn,endLineNumber:I.endLineNumber};s(r.setActiveProblemRange(se))},[s]),Ve=(0,n.useCallback)(I=>{oe({type:"SET_ACTIVE_TAB",payload:I}),oe({type:"RESET_SELECTED_TAGS"}),I===jr&&P?.length>0&&ne({event:"check",action:"check_email_code",email_id:m,project_id:k,problems_count:P?.length||0})},[P,ne,m,k]),Ue=(0,n.useCallback)(async()=>{if(!S){d.error({title:"Save the mail first."});return}if(le("link_check")){re("link_check");return}if(!await $("link_check"))return;z("link_check");const I=c(),se=new DOMParser().parseFromString(I,"text/html"),je={},Ne={};se.querySelectorAll("a[href]").forEach((He,Ke)=>{je[`link_${Ke}`]=He.getAttribute("href"),Ne[`link_${Ke}`]=He.textContent||""}),L.send({operation:"sandbox_set_attr_to_links"}),Se({entity_id:S,data:je}).then(({data:He,error:Ke})=>{if(Ke)U(Ke,"link_check");else if(He?.result){const tt=[...He.result];tt?.sort((j,w)=>j.linkId-w.linkId);const O=tt.map(j=>({...j,text:Ne[j.linkId],status:bp(j)})),ie={links:O,summary:Za(O)};oe({type:"SET_VALIDATE_LINKS_RESULT",payload:ie}),d.success(e("Links validation was successfully completed")),He.limit_warning&&He.limit_remaining!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${He.limit_remaining}`}),ne({event:"check",action:"check_email_links",email_id:m,project_id:k,links_count:ie.links?.length||0})}else He.statusCode>300||!He.success?d.error({error:{data:He}}):d.error({title:e("Something went wrong.")}),!T.validateLinksResult.links&&Ve("")}).catch(He=>{U(He,"link_check")})},[m,S,le,re,$,z,c,L,Se,d,e,ne,k,Oe,T.validateLinksResult.links,U,Ve]),Xe=(0,n.useCallback)(async()=>{if(!S){d.error({title:"Save the mail first."});return}if(le("image_check")){re("image_check");return}if(!await $("image_check"))return;z("image_check");const I=c(),se=new DOMParser().parseFromString(I,"text/html"),je={};se.querySelectorAll("img").forEach((Ne,He)=>je[`image_${He}`]=Ne.src),L.send({operation:"sandbox_set_attr_to_images"}),he({entity_id:S,data:je}).then(({data:Ne,error:He})=>{let Ke;if(He)U(He,"image_check");else if(Ne?.result){const tt=Object.values(Ne.result);tt.sort((ie,j)=>ie.imageId-j.imageId);const O=tt.reduce((ie,j)=>ie+Math.round(j.image.bytes/1024),0);Ke={images:tt.map(ie=>({...ie,status:Qa(ie)}))||[],summary:Za(tt.map(ie=>({...ie,status:Qa(ie)}))),summaryTime:{value:(O>1200?O/1e3:O).toFixed(1),name:O>1200?e("MB"):e("KB")}},Ke&&oe({type:"SET_VALIDATE_IMAGES_RESULT",payload:Ke}),d.success(e("Images validation was successfully completed")),Ne.limit_warning&&Ne.limit_remaining!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${Ne.limit_remaining}`}),ne({event:"check",action:"check_email_images",email_id:m,project_id:k,images_count:Ke.images?.length||0})}else Ne.statusCode>300||!Ne.success?d.error({error:{data:Ne}}):d.error({title:e("Something went wrong.")}),!T.validateImagesResult?.images?.length&&Ve("")}).catch(Ne=>{U(Ne,"image_check")})},[m,S,le,re,$,z,c,L,he,d,e,ne,k,Oe,T.validateImagesResult,U,Ve]),de=(0,n.useCallback)(async()=>{if(!S){d.error({title:"Save the mail first."});return}if(le("spam_check")){re("spam_check");return}await $("spam_check")&&(z("spam_check"),xe({entity_id:S,data:{html:c()}}).then(({data:I,error:se})=>{if(se)U(se,"spam_check");else if(I&&I.success){const je=!!I.result.report&&Object.values(I.result.report);je?(je.sort((Ne,He)=>Ne.score-He.score),oe({type:"SET_VALIDATE_SPAM_RESULT",payload:{...I.result,report:je}})):I.result&&oe({type:"SET_VALIDATE_SPAM_RESULT",payload:{...I.result,report:je}}),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}`}),ne({event:"check",action:"check_email_spam",email_id:m,project_id:k,spam_score:I.result?.spamScore||0})}else I.statusCode>300||!I.success?d.error({error:{data:I}}):d.error({title:e("Something went wrong.")}),!T.validateSpamResult?.report?.length&&Ve("")}).catch(I=>{U(I,"spam_check")}))},[m,S,le,re,$,z,c,xe,d,e,ne,k,Oe,T.validateSpamResult,U,Ve]);(0,n.useEffect)(()=>{if(H){if(M){["link_check","image_check","spam_check"].forEach(I=>{const{limit:se,counter:je,disabled:Ne}=te[I];if(!Ne){N.current[I]=!1;return}N.current[I]||se>0&&je>=se&&(N.current[I]=!0,re(I))});return}if(!(Y>0&&T.optimisationCounter>=Y)){v.current=!1;return}v.current||(v.current=!0,re("link_check"))}},[H,M,te,T.optimisationCounter,Y,re]);const ye=f?r.getLimitUpgradePresetDefinition(f.presetId):null;return(0,t.jsxs)("div",{className:"optimise selected_form-props-wrapper selected_form-props-wrapper_optimize",children:[ye&&f?(0,t.jsx)(gi,{open:!0,onClose:()=>y(null),title:e(ye.titleKey),subtitle:e(ye.subtitleKey),usageResource:ye.usageResource,previousDisplay:f.previousDisplay,nextDisplay:f.nextDisplay,onChangePlan:()=>{y(null),l()}}):null,H&&!M&&(0,t.jsx)(o.ui_kit$LimitsCounter,{text:rn(T.optimisationCounter,Y,e,i),exceeded:K,extra:(0,t.jsx)("button",{type:"button",style:on,onClick:Ce,children:e("Need more?")})}),h.optimizeLinksEnabled&&(0,t.jsxs)(t.Fragment,{children:[G("link_check"),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,align:"middle",children:[(0,t.jsx)(o.ui_kit$Col,{span:20,children:(0,t.jsx)("div",{style:{padding:"15px 0"},children:e("Links validation")})}),(0,t.jsx)(o.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,t.jsx)(o.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:I=>I.preventDefault(),onClick:()=>{Ve(yr),!T.validateLinksResult?.links?.length&&T.activeTab!==yr&&Ue()},loading:me.isLoading,disabled:le("link_check")&&!T.validateLinksResult?.links?.length,children:!me.isLoading&&(T.activeTab===yr?(0,t.jsx)(r.EmIcons,{icon:"DownOutlined",component:o.icons$DownOutlined,size:16,strokeWidth:h.iconStrokeWidth}):(0,t.jsx)(r.EmIcons,{icon:"RightOutlined",component:o.icons$RightOutlined,size:16,strokeWidth:h.iconStrokeWidth}))})})]}),(0,t.jsx)(Xa,{__:e,activeTab:T.activeTab,validateLinksResult:T.validateLinksResult,validateLinks:T.validateLinks,selectedTags:T.selectedTags,setSelectedTags:J,isLoading:me.isLoading,disabled:le("link_check"),iconStrokeWidth:h.iconStrokeWidth,onValidate:Ue,goToLinkHandler:Be})]}),h.optimizeImagesEnabled&&(0,t.jsxs)(t.Fragment,{children:[G("image_check"),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,align:"middle",children:[(0,t.jsx)(o.ui_kit$Col,{span:20,children:(0,t.jsx)("div",{style:{padding:"15px 0"},children:e("Images validation")})}),(0,t.jsx)(o.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,t.jsx)(o.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:I=>I.preventDefault(),onClick:()=>{Ve(wr),!T.validateImagesResult?.images?.length&&T.activeTab!==wr&&Xe()},loading:ke.isLoading,children:!ke.isLoading&&(T.activeTab===wr?(0,t.jsx)(r.EmIcons,{icon:"DownOutlined",component:o.icons$DownOutlined,size:16,strokeWidth:h.iconStrokeWidth}):(0,t.jsx)(r.EmIcons,{icon:"RightOutlined",component:o.icons$RightOutlined,size:16,strokeWidth:h.iconStrokeWidth}))})})]}),(0,t.jsx)(Ka,{__:e,activeTab:T.activeTab,validateImagesResult:T.validateImagesResult,validateImages:T.validateImages,selectedTags:T.selectedTags,setSelectedTags:J,isLoading:ke.isLoading,disabled:le("image_check"),iconStrokeWidth:h.iconStrokeWidth,onValidate:Xe,goToImageHandler:Fe,showImgPreviewHandler:Te,hideBlockPreviewHandler:Re})]}),h.optimizeSpamAssassinEnabled&&(0,t.jsxs)(t.Fragment,{children:[G("spam_check"),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,align:"middle",children:[(0,t.jsx)(o.ui_kit$Col,{span:20,children:(0,t.jsx)("div",{style:{padding:"15px 0"},children:e("SpamAssassin")})}),(0,t.jsx)(o.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,t.jsx)(o.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:I=>I.preventDefault(),loading:be.isLoading,onClick:()=>{Ve(tn),T.validateSpamResult.report?.length||Object.prototype.hasOwnProperty.call(T.validateSpamResult,"spamScore")||de()},disabled:le("spam_check")&&!(T.validateSpamResult?.report?.length||Object.prototype.hasOwnProperty.call(T.validateSpamResult,"spamScore")),children:!be.isLoading&&(T.activeTab===tn?(0,t.jsx)(r.EmIcons,{icon:"DownOutlined",component:o.icons$DownOutlined,size:16,strokeWidth:h.iconStrokeWidth}):(0,t.jsx)(r.EmIcons,{icon:"RightOutlined",component:o.icons$RightOutlined,size:16,strokeWidth:h.iconStrokeWidth}))})})]}),(0,t.jsx)(qa,{__:e,activeTab:T.activeTab,validateSpamResult:T.validateSpamResult,isLoading:be.isLoading,disabled:le("spam_check"),iconStrokeWidth:h.iconStrokeWidth,onValidate:de})]}),h.optimizeCheckCodeEnabled&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,align:"middle",children:[(0,t.jsx)(o.ui_kit$Col,{span:20,children:(0,t.jsx)("div",{style:{padding:"15px 0"},children:e("Source code validation")})}),(0,t.jsx)(o.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,t.jsx)(o.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:I=>I.preventDefault(),onClick:()=>Ve(jr),children:T.activeTab===jr?(0,t.jsx)(r.EmIcons,{icon:"DownOutlined",component:o.icons$DownOutlined,size:16,strokeWidth:h.iconStrokeWidth}):(0,t.jsx)(r.EmIcons,{icon:"RightOutlined",component:o.icons$RightOutlined,size:16,strokeWidth:h.iconStrokeWidth})})})]}),(0,t.jsx)(Ja,{__:e,activeTab:T.activeTab,problemsList:P,onSetMonacoPosition:Ae})]})]})},xp=({state:e,onCancel:i,onRetry:s,onDismiss:l})=>{const{__:a}=r.useI18n();return e.kind==="hidden"?null:(0,t.jsx)("div",{className:"indexing-tray",role:"status","aria-live":"polite",children:(0,t.jsx)(o.ui_kit$Card,{size:"small",variant:"borderless",className:"indexing-tray__card",children:(0,t.jsxs)(o.ui_kit$Flex,{vertical:!0,gap:8,children:[kp(e,a),(0,t.jsx)(o.ui_kit$Flex,{justify:"flex-end",children:Ep(e,{onCancel:i,onRetry:s,onDismiss:l},a)})]})})})};function kp(e,i){switch(e.kind){case"scanning":return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Flex,{align:"center",gap:8,children:[(0,t.jsx)(o.ui_kit$Spin,{size:"small"}),(0,t.jsx)(o.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Moving files from old storage…")})]}),(0,t.jsx)(o.ui_kit$Text,{type:"secondary",children:i("Found so far: %s").replace("%s",String(e.scanned))}),(0,t.jsx)(o.ui_kit$Progress,{percent:100,status:"active",showInfo:!1,strokeColor:r.emCssVar("colorPrimary")})]});case"indexing":{const s=e.total>0?Math.min(100,Math.round(e.scanned/e.total*100)):0;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Indexing files…")}),(0,t.jsx)(o.ui_kit$Text,{type:"secondary",children:`${e.scanned} / ${e.total}`}),(0,t.jsx)(o.ui_kit$Progress,{percent:s,status:"active",strokeColor:r.emCssVar("colorPrimary")})]})}case"done":return(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Could not move files from old storage")});case"cancelled":return(0,t.jsx)(o.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Move stopped")});default:return null}}function Ep(e,i,s){switch(e.kind){case"scanning":case"indexing":return(0,t.jsx)(o.ui_kit$Button,{type:"link",size:"small",onClick:i.onCancel,disabled:e.cancelling,children:e.cancelling?s("Stopping…"):s("Cancel")});case"failed":return(0,t.jsx)(o.ui_kit$Button,{type:"link",size:"small",onClick:i.onRetry,children:s("Retry")});case"cancelled":return(0,t.jsx)(o.ui_kit$Button,{type:"link",size:"small",onClick:i.onRetry,children:s("Resume")});case"done":return(0,t.jsx)(o.ui_kit$Button,{type:"link",size:"small",onClick:i.onDismiss,children:s("Close")});default:return null}}var Sp=2500,ln=48,Bp=4e3;function Rp(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 Tp(e){return e.kind==="done"||e.kind==="failed"||e.kind==="cancelled"}function yp({projectId:e,api:i,triggered:s,onCompleted:l}){const[a,d]=(0,n.useState)({kind:"hidden"}),c=(0,n.useRef)(!1),h=(0,n.useRef)(!0),g=(0,n.useRef)(e);g.current=e;const b=(0,n.useRef)(s);b.current=s;const x=(0,n.useRef)(l);x.current=l,(0,n.useEffect)(()=>(h.current=!0,()=>{h.current=!1}),[]),(0,n.useEffect)(()=>{d({kind:"hidden"})},[e]);const p=(0,n.useCallback)(async()=>{try{const S=await i.files.backfillList({project_id:e});return!S.ok||S.error?null:Rp(S.data)}catch{return null}},[i,e]),m=(0,n.useCallback)(async()=>{if(c.current)return;c.current=!0;const S=g.current;let k=0;try{for(;h.current&&g.current===S&&b.current;){const f=await p();if(!h.current)break;if(f)if(f.kind==="hidden"){if(k+=1,k>=ln){d({kind:"failed"});break}}else{if(k=0,d(f),f.kind==="done")try{await x.current?.()}catch{}if(Tp(f))break}else if(k+=1,k>=ln){d({kind:"failed"});break}await new Promise(y=>setTimeout(y,Sp))}}finally{c.current=!1}},[p]);return(0,n.useEffect)(()=>{s&&m()},[s,m]),(0,n.useEffect)(()=>{if(a.kind!=="done")return;const S=setTimeout(()=>{h.current&&d({kind:"hidden"})},Bp);return()=>clearTimeout(S)},[a.kind]),{state:a,cancel:(0,n.useCallback)(()=>{d(S=>S.kind==="scanning"||S.kind==="indexing"?{...S,cancelling:!0}:S),i.files.backfillCancelCreate({project_id:e})},[i,e]),retry:(0,n.useCallback)(()=>{b.current=!0,i.files.backfillCreate({project_id:e}),m()},[i,e,m]),dismiss:(0,n.useCallback)(()=>d({kind:"hidden"}),[])}}var wp=r.lazyRoute(()=>(0,No.__vitePreload)(()=>Promise.resolve().then(()=>_t("./e2694475.js")),void 0,{}.url)),jp=r.lazyRoute(()=>(0,No.__vitePreload)(()=>Promise.resolve().then(()=>_t("./cd715a88.js")),void 0,{}.url)),an={height:"100%"};function vp(e){(e?(0,No.__vitePreload)(()=>Promise.resolve().then(()=>_t("./aea50cd5.js")),void 0,{}.url):(0,No.__vitePreload)(()=>Promise.resolve().then(()=>_t("./69842511.js")),void 0,{}.url)).catch(()=>{})}var Ip=({storageProvider:e,dataProvider:i,pathProxy:s,usesBuiltInStorage:l,contentKey:a})=>{const d=r.useAppConfig(),c=r.isImageEditModal(r.useSelector(r.selectActiveModal$1)),h=!!d.imageCenterFileManagerView;(0,n.useEffect)(()=>{c&&vp(h)},[c,h]);let g=(0,t.jsx)(o.ui_kit$PageLoader,{style:an});return e&&i&&d.imageCenterFileManagerView?g=(0,t.jsx)(wp,{storageProvider:e,dataProvider:i,pathProxy:s},a):e&&i&&(g=(0,t.jsx)(jp,{dataProvider:i,usesBuiltInStorage:l},a)),(0,t.jsx)(n.Suspense,{fallback:(0,t.jsx)(o.ui_kit$PageLoader,{style:an}),children:g})};function Cp(){const e=r.useAppConfig(),i=r.useIsStandalone(),s=r.useStorageProvider(),l=r.useProjectData(),a=r.useRestClient(r.EM_FILES_MODULES),d=r.useStore(),c=(0,n.useMemo)(()=>r.createRestClientV2(d),[d]),h=r.useI18n(),g=r.useCurrentUser(),b=l?.id?String(l.id):"",x=g?.id!=="0"?String(g.id):"",p=r.isFileManagerV2Enabled(e),[m,S]=(0,n.useState)(null),k=p&&!!b&&m===b,[f,y]=(0,n.useState)(0),[v,N]=(0,n.useState)(0),R=(0,n.useRef)(b);(0,n.useEffect)(()=>{R.current!==b&&(R.current=b,S(null))},[b]);const C=(0,n.useCallback)(L=>{L&&b&&S(b)},[b]),F=(0,n.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:s,projectId:b,restApi:a,restApiV2:c,i18n:h,pathPostfix:x,appConfig:e,isStandalone:i,onIndexingStateChange:C}),[e,C,h,i,b,f,a,c,s,x]),U=(0,n.useCallback)(async()=>{try{typeof F.dataProvider?.clearCache=="function"&&await F.dataProvider.clearCache()}catch{}S(null),y(L=>L+1),N(L=>L+1)},[F.dataProvider]),$=(0,n.useCallback)(()=>{b&&S(b)},[b]);return{...F,projectId:b,restApiV2:c,v2Enabled:p,backfillTriggered:k,contentKey:`${b}:${v}`,handleIndexingCompleted:U,markIndexingStarted:$}}var Pp={height:"100%"},nn=()=>{const{storageProvider:e,dataProvider:i,pathProxy:s,usesBuiltInStorage:l,projectId:a,restApiV2:d,v2Enabled:c,backfillTriggered:h,contentKey:g,handleIndexingCompleted:b,markIndexingStarted:x}=Cp(),p=r.useSelector(r.selectActiveModal$1),m=r.isImageCenterModal(p),{state:S,cancel:k,retry:f,dismiss:y}=yp({projectId:a,api:d,triggered:h,onCompleted:b}),v=n.default.useCallback(()=>{x(),f()},[x,f]);return(0,t.jsxs)(t.Fragment,{children:[m&&(0,t.jsx)(n.Suspense,{fallback:(0,t.jsx)(o.ui_kit$PageLoader,{style:Pp}),children:(0,t.jsx)(Ip,{storageProvider:e,dataProvider:i,pathProxy:s,usesBuiltInStorage:l,contentKey:g})}),c&&(0,t.jsx)(xp,{state:S,onCancel:k,onRetry:v,onDismiss:y})]})},Ap=(function(){var e=window.__emailmaker__;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 Np(e){return!!(e?.global_block??e?.acf?.global_block)}var Lp=({className:e,size:i=16})=>{const s=r.useAppConfig(),{__:l}=r.useI18n(),a=l("Global block");return(0,t.jsx)(o.ui_kit$Tooltip,{title:a,placement:"top",trigger:["hover"],children:(0,t.jsx)("span",{className:(0,We.default)("block-global-badge",e),"aria-label":a,role:"img",children:(0,t.jsx)(r.EmIcons,{icon:"Globe02Icon",component:o.icons$Globe02Icon,size:i,strokeWidth:s.iconStrokeWidth})})})},dn=new Map;function cn(e){return`<table cellspacing="0" cellpadding="0" border="0" width="100%">${e}</table>`}function vr(e,i){const s=i??"";if(e===void 0)return r.sanitizeHtml(cn(s));const l=String(e),a=dn.get(l);if(a&&a.source===s)return a.markup;const d=r.sanitizeHtml(cn(s));return dn.set(l,{source:s,markup:d}),d}function Op(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Ir(e){return!r.isBlocksV2Enabled()||e.html&&e.html.trim()!==""?e.html:`<tr><td style="padding:16px 20px;font-family:Arial,sans-serif;font-size:14px;line-height:20px;color:#5b6370;background:#f4f5f7">${Op(e.title??"")}</td></tr>`}function Io(e){return r.isBlocksV2Enabled()&&e.id!=null&&!(e.html&&e.html.trim()!=="")}function $p(e,i){r.isBlockAutosaveInFlight(i)||e(r.blocksApi.endpoints.getBlock.initiate(i)).unsubscribe()}function Fp(e,i){const s=String(i.id),l=r.blocksApi.endpoints.getBlock.select(s);return r.isBlockAutosaveInFlight(s)?void 0:l(e()).data?.html}async function un(e,i){if(!Io(i))return i.html;const s=String(i.id);if(!await new Promise(a=>r.whenBlockAutosaveSettledWithin(s,r.getSaveTimeoutMs(),a)))return;const l=e(r.blocksApi.endpoints.getBlock.initiate(s));try{return(await l).data?.html??i.html}finally{l.unsubscribe()}}var Cr=new Set;function Mp(e,i){const s=String(i.id);return Cr.has(s)?null:(Cr.add(s),un(e,i).finally(()=>Cr.delete(s)))}function Dp(e,i){return e?i.openBlockFromEmailEnabled===!0?"over-email":null:"link"}var Vp={fontSize:"16px",margin:0},{name:Pr,type:mn,tags:pn}={name:"name",type:"type",tags:"tags"},hn={[Pr]:"",[mn]:[],[pn]:[]},mo={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},Ar=({parentEmailId:e,blocksTab:i,search:s,reloadBlockScreens:l,setIsShowAddAllBlocksModal:a})=>{const{parentId:d}=r.useBlocksParentId(e),c=r.useEditorProjectId(),h=r.useSetHtmlElementInIframeHandler(),g=r.useDragStartBlockToIframeHandler(),[b]=o.ui_kit$Form.useForm(),{data:x}=r.useGetBlockTypesQuery(),{token:p}=(0,o.ui_kit$useToken)(),{__:m,_x:S}=r.useI18n(),k=r.useNotification(),{modal:f}=o.ui_kit$App.useApp(),{confirm:y}=f,v={pathname:r.useRoutePathname()},N=r.useAppConfig(),R=r.useSelector(r.selectParentBlocks),C=da(),F=(0,n.useRef)(null),U=(0,n.useRef)(null),$=r.useRootElement(),L=660,P=207/L,V=B=>Np(B)?(0,t.jsx)("div",{className:"blocks-search__result-global-mark",children:(0,t.jsx)(Lp,{className:"block-global-badge--tile",size:14})}):null,ne=r.useEmailAttribute("common_styles"),T=(0,n.useMemo)(()=>ua(ne,C),[ne,C]),oe=(0,n.useRef)(null),xe=(0,n.useRef)(null),be=(0,n.useRef)(null),Se=r.useStore(),me=(B,ee=!1)=>(E,ae,Pe,Qe,De)=>{if(!Io(De)){B(E,ae,Pe,Qe,De);return}const Et=pt=>{if(pt===void 0){k.error({id:"BLOCK_GET_ERROR",title:m("Failed to load")});return}B(E,Pe==="common"?st({html:pt}):pt,Pe,Qe,{...De,html:pt})},Gt=Fp(()=>Se.getState(),De);if(Gt!==void 0){Et(Gt);return}(ee?Mp(Se.dispatch,De):un(Se.dispatch,De))?.then(Et)},he=me(h,!0),ke=me(g);(0,n.useEffect)(()=>{U.current?.scrollTo({top:0})},[i,s]),(0,n.useEffect)(()=>{const B=U.current;if(!B)return;const ee=E=>{const ae=(E.target instanceof Element?E.target.closest("[data-block-id]"):null)?.getAttribute("data-block-id");ae&&$p(Se.dispatch,ae)};return B.addEventListener("mouseover",ee),()=>B.removeEventListener("mouseover",ee)},[Se]);const ce=r.useProjectData(),{data:ze}=r.useGetTermsQuery({project:ce,kind:r.BLOCK_TAGS},{skip:!ce?.id}),[Oe,ve]=(0,n.useState)(()=>r.projectBlocksArgs(c));(0,n.useEffect)(()=>{s||(b.setFieldsValue(hn),Ne({type:null,name:null}),l())},[s,b,l]),(0,n.useEffect)(()=>{if(x){const B=x;let ee=[];for(let E in B)ee.push({label:m(r.TYPES_TRANSLATE[B[E]]),value:B[E]})}},[x,m]);const{isSuccess:Ee,isError:pe,isLoading:Q,isFetching:X,data:Z,refetch:J,error:H}=r.useGetBlocksQuery({...Oe,projectId:c,page:1}),M=(0,n.useMemo)(()=>{if(Ee&&Z)return[...Z].sort((B,ee)=>mo[B.type]-mo[ee.type])},[Ee,Z]),[Y,K]=(0,n.useState)([]);r.usePrevious(B=>{B!==pe&&k.fromError("BLOCK_GET_ERROR",{},H,!0)},[pe,H,k]);const[te,le]=(0,n.useState)(()=>r.parentEmailBlocksArgs(d,c)),{isSuccess:Te,isError:Re,isLoading:$e,isFetching:z}=r.useGetParentEmailBlocksQuery({...te,emailId:d,page:1,...r.pageProjectKey(c)},{skip:!d||R.length}),re=(0,n.useMemo)(()=>{if(Te||R.length)return[...R].sort((B,ee)=>mo[B.type]-mo[ee.type])},[Te,R]),[Ce,G]=(0,n.useState)([]);(0,n.useEffect)(()=>{const B=new Set;if(R.length&&re){for(const ee of re)ee.type&&B.add(ee.type);G(Array.from(B))}else G([])},[R,re]);const[Be,Fe]=(0,n.useState)(()=>r.templateBlocksArgs(c)),{isSuccess:Ae,isError:Ve,isLoading:Ue,isFetching:Xe,data:de=[]}=r.useGetTemplateBlocksQuery({...Be,page:1,...r.pageProjectKey(c)}),ye=(0,n.useMemo)(()=>{if(de.length)return[...de].sort((B,ee)=>mo[B.type]-mo[ee.type])},[de]),[I,se]=(0,n.useState)([]);(0,n.useEffect)(()=>{const B=new Set;if(ye&&de.length){for(const ee of ye)ee.type&&B.add(ee.type);se(Array.from(B))}},[de.length,ye]);const je=(0,n.useMemo)(()=>{const B=new Set;for(const ee of Y)B.add(ee);for(const ee of Ce)B.add(ee);for(const ee of I)B.add(ee);return Array.from(B)},[I,Ce,Y]),Ne=B=>{ve(ee=>({...ee,...B,page:1})),le(ee=>({...ee,...B,page:1})),Fe(ee=>({...ee,...B,page:1}))},He=r.useFitBlockPreviewHeight(P),Ke=(0,n.useCallback)(()=>{$.querySelector(".blocks-search__result-wrapper.is_search")&&($.querySelector(".blocks-search__result-wrapper").style.removeProperty("transition"),$.querySelector(".blocks-search__result-wrapper").style.opacity=0,r.measureBlockPreviews($,207/L),$.querySelector(".blocks-search__result-wrapper").style.transition="opacity 0.2s",$.querySelectorAll(".blocks-search__result-wrapper").forEach(B=>B.style.opacity=1))},[L,$]);(0,n.useEffect)(()=>{!(Xe||Ue)&&Ae&&i!=="template"&&(s?Ke():l())},[Xe,Ue,Ae,Ke,Oe.name,l,s,i]),(0,n.useEffect)(()=>{const B=new Set;if(Ee&&M){for(const ee of M)ee.type&&B.add(ee.type);K(Array.from(B))}},[Ee,M]);const tt=B=>{const ee=Object.keys(B)[0],E=b.getFieldsValue(!0);switch(ee){case pn:const ae=(ze||[]).filter(Pe=>B[ee].includes(Pe.name)).map(Pe=>Pe.id)||null;Ne({tags:ae});break;case mn:Ne({type:E.type||null});break;case Pr:F.current&&window.clearTimeout(F.current),F.current=window.setTimeout(function(){Ne({name:E.name||null})},300)}},O=B=>{l(),B.target.getAttribute("data-type")?(B.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(ee=>ee.style.display="none"),B.target.closest(".blocks-search").querySelectorAll(`[data-type="${B.target.getAttribute("data-type")}"]`).forEach(ee=>ee.style.display="block")):B.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(ee=>ee.style.display="block"),B.target.parentElement.querySelector(".active").classList.remove("active"),B.target.classList.add("active")};let ie=null;const j=B=>{clearTimeout(ie);let ee=$.querySelector(".block-search__preview")?$.querySelector(".block-search__preview"):null,E=$.querySelector(".block-search__preview-title")?$.querySelector(".block-search__preview-title"):null,ae=$.querySelector(".block-search__preview-content")?$.querySelector(".block-search__preview-content"):null;$.querySelector(".block-search__preview")||(ee=document.createElement("div"),ee.classList.add("block-search__preview"),E=document.createElement("div"),E.classList.add("block-search__preview-title"),ae=document.createElement("div"),ae.classList.add("block-search__preview-content"),ee.append(ae),ee.append(E),$.querySelector(".email-pane__col_settings-inner").append(ee)),E.innerHTML="",ae.innerHTML="",E.innerHTML=B.title;let Pe=B.html.replaceAll(/<style((.|\n|\r)*?)<\/style>/gi,"").trim();ae.innerHTML=r.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+Pe+"</table>"),ee.style.opacity!=="1"&&setTimeout(function(){ee.style.opacity="1",ee.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(100%)":"translateX(-100%)"},10)},w=()=>{let B=$.querySelector(".block-search__preview");B&&(ie=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)(()=>{$.querySelectorAll(".blocks-search__result").forEach(B=>{B.style.display="block"})},[i]);const ue=!Z?.length&&(!d||!R?.length)&&!de?.length&&(Oe.tags||Oe.name||Oe.type)&&!(Q||X),Ie=B=>Se.dispatch(r.blocksApi.endpoints.deleteBlock.initiate(B.id)).then(ee=>{if(ee.error){k.fromError("BLOCK_REMOVING_ERROR",r.getBlockDesc(B),ee.error);return}k.success({id:"BLOCK_REMOVING_SUCCESS",data:r.getBlockDesc(B),title:m('The block "')+B.title+S('" was successfully removed.',"block")}),J()});(0,n.useEffect)(()=>{!Q&&!X&&l()},[Q,X,l]),(0,n.useEffect)(()=>{(i==="common"||s)&&setTimeout(l,50)},[Z,l,i,s]);const qe=B=>{y({mask:{closable:!0},centered:!0,title:S("Are you sure you want to delete the “","block")+B.title+m("” block?"),icon:(0,t.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:22,style:{color:o.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0}}),okText:m("Yes"),cancelText:m("No"),onOk:()=>Ie(B)})},Ze=(B,ee)=>`${B.pathname.split("emails")[0]}blocks/${ee.id}`,dt=B=>{let ee=[{key:"Delete block",className:"blocks-search__result__menu-item",icon:(0,t.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:16,style:{margin:0}}),style:{color:p.colorError},onClick:()=>qe(B)}];const E=Dp(!0,N);return E==="link"&&ee.unshift({key:"Edit block",className:"blocks-search__result__menu-item",icon:(0,t.jsx)(r.EmIcons,{icon:"EditOutlined",component:o.icons$EditOutlined,style:{fontSize:"16px",margin:0}}),label:(0,t.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:Ze(v,B),children:" "})}),E==="over-email"&&ee.unshift({key:"Edit block",className:"blocks-search__result__menu-item",icon:(0,t.jsx)(r.EmIcons,{icon:"EditOutlined",component:o.icons$EditOutlined,style:Vp}),onClick:()=>{r.getEmitter(ht.getContainer(Se),ht.events.OPEN_BLOCK_REQUEST_ID).fireSettled(String(B.id)).then(({errors:ae})=>{ae.length&&k.fromError("BLOCK_GET_ERROR",r.getBlockDesc(B),ae[0])})}}),ee},st=B=>{let ee=B.html.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");if(ee.replaceChildren(...r.parseFromString(B.html)),Object.keys(T).length!==0&&(ee.querySelectorAll(".em-contrast-card").forEach(E=>{T.cards?.contrastBackgroundColor&&(E.getAttribute("bgcolor")?T.cards.contrastBackgroundColor?E.setAttribute("bgcolor",T.cards.contrastBackgroundColor):E.removeAttribute("bgcolor"):T.cards.contrastBackgroundColor?E.style.backgroundColor=T.cards.contrastBackgroundColor:E.style.removeProperty("background-color")),T.cards?.contrastTextColor&&E.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(ae=>{if(kt(ae.style.color).toLowerCase()!=="#ffffff"){let Pe=ae.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.cards.contrastTextColor};`);ae.setAttribute("style",Pe)}})}),ee.querySelectorAll(".em-card").forEach(E=>{T.cards?.baseBackgroundColor&&(E.getAttribute("bgcolor")?T.cards.baseBackgroundColor?E.setAttribute("bgcolor",T.cards.baseBackgroundColor):E.removeAttribute("bgcolor"):T.cards.baseBackgroundColor?E.style.backgroundColor=T.cards.baseBackgroundColor:E.style.removeProperty("background-color")),T.cards?.baseTextColor&&E.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(ae=>{if(kt(ae.style.color).toLowerCase()!=="#ffffff"){let Pe=ae.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.cards.baseTextColor};`);ae.setAttribute("style",Pe)}})}),ee.querySelectorAll(".em-card, .em-contrast-card").forEach(E=>{T.cards?.border&&D({settings:{border:T.cards?.border},elem:E}),T.cards?.borderRadius?.all?(E.style.borderBottomLeftRadius&&E.style.borderBottomLeftRadius!=="0px"&&(E.style.borderBottomLeftRadius=T.cards?.borderRadius.all+"px"),E.style.borderBottomRightRadius&&E.style.borderBottomRightRadius!=="0px"&&(E.style.borderBottomRightRadius=T.cards?.borderRadius.all+"px"),E.style.borderTopLeftRadius&&E.style.borderTopLeftRadius!=="0px"&&(E.style.borderTopLeftRadius=T.cards?.borderRadius.all+"px"),E.style.borderTopRightRadius&&E.style.borderTopRightRadius!=="0px"&&(E.style.borderTopRightRadius=T.cards?.borderRadius.all+"px")):T.cards?.borderRadius?.all===""?E.style.removeProperty("border-radius"):(T.cards?.borderRadius?.topLeft&&E.style.borderTopLeftRadius&&E.style.borderTopLeftRadius!=="0px"?E.style.borderTopLeftRadius=T.cards?.borderRadius.topLeft+"px":T.cards?.borderRadius?.topLeft===""&&E.style.removeProperty("border-top-left-radius"),T.cards?.borderRadius?.topRight&&E.style.borderTopRightRadius&&E.style.borderTopRightRadius!=="0px"?E.style.borderTopRightRadius=T.cards?.borderRadius.topRight+"px":T.cards?.borderRadius?.topRight===""&&E.style.removeProperty("border-top-right-radius"),T.cards?.borderRadius?.bottomRight&&E.style.borderBottomRightRadius&&E.style.borderBottomRightRadius!=="0px"?E.style.borderBottomRightRadius=T.cards?.borderRadius.bottomRight+"px":T.cards?.borderRadius?.bottomRight===""&&E.style.removeProperty("border-bottom-right-radius"),T.cards?.borderRadius?.bottomLeft&&E.style.borderBottomLeftRadius&&E.style.borderBottomLeftRadius!=="0px"?E.style.borderBottomLeftRadius=T.cards?.borderRadius.bottomLeft+"px":T.cards?.borderRadius?.bottomLeft===""&&E.style.removeProperty("border-bottom-left-radius"))}),ee.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(E=>{if(!E.style.display&&parseFloat(E.style.fontSize)<=20){let ae="",Pe=T.text.fontFamily;if(parseFloat(E.style.fontSize)>14&&(ae=E.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${T.text.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${T.text.lineHeight}px`),E.setAttribute("style",ae)),!E.closest(".em-contrast-card, .em-card")&&kt(E.style.color).toLowerCase()!=="#ffffff"&&(ae=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.text.color};`),E.setAttribute("style",ae)),E.closest(".em-contrast-block")&&!E.closest(".em-contrast-card, .em-card")&&(ae=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.text.contrastColor};`),E.setAttribute("style",ae)),Pe[0]==="Safe Fonts"?(E.style.fontFamily=Pe[1],ct({elem:ee})):Pe[0]==="Google Fonts"&&(Pe[1]==="Sans Serif"?E.style.fontFamily="Helvetica, Arial, sans-serif":Pe[1]==="Serif"&&(E.style.fontFamily='"Times New Roman", Times, serif'),E.classList.remove(...[...E.classList].filter(Qe=>Qe.startsWith("em-font"))),E.classList.add(`em-font-${Pe[2].replace(/\s/g,"")}-${Pe[3].replace(/\s/g,"")}`),St({elem:ee,fontFamilyArray:Pe})),E.closest('[em="atom"] > tr > td')&&E.closest('[em="atom"] > tr > td').style.paddingBottom)E.closest('[em="atom"] > tr > td').style.paddingBottom=T.text.paddingBottom+"px";else if(E.nextElementSibling||E.closest("table")&&E.closest("table").nextElementSibling){let Qe=E.nextElementSibling??E.closest("table").nextElementSibling;Qe&&Qe.tagName==="TABLE"&&(Qe.classList.contains("em-vindent-table")||Qe.querySelector("td").innerHTML==="")&&Qe.querySelector("td").setAttribute("height",T.text.paddingBottom)}}else if(!E.style.display&&parseFloat(E.style.fontSize)>=20&&kt(E.style.color).toLowerCase()!=="#eb3737"){let ae="",Pe=T.headings.fontFamily;parseFloat(E.style.fontSize)<40&&(ae=E.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${T.headings.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${T.headings.lineHeight}px`),E.setAttribute("style",ae)),!E.closest(".em-contrast-card, .em-card")&&kt(E.style.color).toLowerCase()!=="#ffffff"&&(ae=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.headings.color};`),E.setAttribute("style",ae)),E.closest(".em-contrast-block")&&!E.closest(".em-contrast-card, .em-card")&&(ae=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.headings.contrastColor};`),E.setAttribute("style",ae)),Pe[0]==="Safe Fonts"?(E.style.fontFamily=Pe[1],ct({elem:ee})):Pe[0]==="Google Fonts"&&(Pe[1]==="Sans Serif"?E.style.fontFamily="Helvetica, Arial, sans-serif":Pe[1]==="Serif"&&(E.style.fontFamily='"Times New Roman", Times, serif'),E.classList.remove(...[...E.classList].filter(De=>De.startsWith("em-font"))),E.classList.add(`em-font-${Pe[2].replace(/\s/g,"")}-${Pe[3].replace(/\s/g,"")}`),St({elem:ee,fontFamilyArray:Pe}));let Qe="";if(T.headings.letterSpacing>0?Qe=E.style.letterSpacing?E.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${T.headings.letterSpacing}px`):E.getAttribute("style")+` letter-spacing: ${T.headings.letterSpacing}px;`:Qe=E.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),E.setAttribute("style",Qe),T.headings.bold?E.querySelector("b")?E.querySelector("b").replaceWith(...E.querySelector("b").childNodes):E.querySelector("strong")||(E.innerHTML="<strong>"+E.innerHTML+"</strong>"):E.querySelector("strong")?E.querySelector("strong").replaceWith(...E.querySelector("strong").childNodes):E.querySelector("b")&&E.querySelector("b").replaceWith(...E.querySelector("b").childNodes),E.style.fontWeight){let De=E.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");E.setAttribute("style",De)}if(T.headings.italic?E.querySelector("i")?E.querySelector("i").replaceWith(...E.querySelector("i").childNodes):E.querySelector("em")||(E.innerHTML="<em>"+E.innerHTML+"</em>"):E.querySelector("em")?E.querySelector("em").replaceWith(...E.querySelector("em").childNodes):E.querySelector("i")&&E.querySelector("i").replaceWith(...E.querySelector("i").childNodes),E.style.fontStyle){let De=E.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");E.setAttribute("style",De)}if(E.closest('[em="atom"] > tr > td')&&E.closest('[em="atom"] > tr > td').style.paddingTop)E.closest('[em="atom"] > tr > td').style.paddingTop=T.headings.paddingTop+"px";else if(E.previousElementSibling){let De=E.previousElementSibling;De&&De.tagName==="TABLE"&&(De.classList.contains("em-vindent-table")||De.querySelector("td").innerHTML==="")&&De.querySelector("td").setAttribute("height",T.headings.paddingTop)}if(E.closest('[em="atom"] > tr > td')&&E.closest('[em="atom"] > tr > td').style.paddingBottom)E.closest('[em="atom"] > tr > td').style.paddingBottom=T.headings.paddingBottom+"px";else if(E.nextElementSibling){let De=E.nextElementSibling;De&&De.tagName==="TABLE"&&(De.classList.contains("em-vindent-table")||De.querySelector("td").innerHTML==="")&&De.querySelector("td").setAttribute("height",T.headings.paddingBottom)}}}),ee.querySelectorAll('a[style*="color"]').forEach(E=>{if(E.style.display){if(E.style.display&&E.style.display==="block"){let ae="";if(ae=E.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${T.buttons.fontSize}px`),E.setAttribute("style",ae),E.closest("td").style.backgroundColor&&!E.closest("td").style.borderWidth&&!E.closest(".em-contrast-card"))if(E.closest(".em-contrast-block")?ae=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.contrastColor};`):ae=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.color};`),E.setAttribute("style",ae),E.closest(".em-contrast-block"))if(T.buttons.contrastBackgroundColor){let De=E.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${T.buttons.contrastBackgroundColor};`);E.closest("td").setAttribute("style",De)}else E.closest("td").style.removeProperty("background-color");else if(T.buttons.backgroundColor){let De=E.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${T.buttons.backgroundColor};`);E.closest("td").setAttribute("style",De)}else E.closest("td").style.removeProperty("background-color");else if(E.closest("td").style.borderWidth)if(Object.values(T.buttons.border).every(De=>De===null)){if(E.closest(".em-contrast-block")){if(T.buttons.contrastBackgroundColor){let De=E.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,Et=>Et.replace(/#[A-Fa-f0-9]{6}/,`${T.buttons.contrastBackgroundColor}`));E.closest("td").setAttribute("style",De),ae=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.contrastBackgroundColor};`),E.setAttribute("style",ae)}}else if(T.buttons.backgroundColor){let De=E.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,Et=>Et.replace(/#[A-Fa-f0-9]{6}/,`${T.buttons.backgroundColor}`));E.closest("td").setAttribute("style",De),ae=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.backgroundColor};`),E.setAttribute("style",ae)}}else for(const De in T.buttons.border)T.buttons.border[De]&&T.buttons.border[De].color!==void 0&&(ae=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.border[De].color};`),E.setAttribute("style",ae));else E.closest(".em-contrast-block")?T.buttons.contrastBackgroundColor&&(ae=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.contrastBackgroundColor};`),E.setAttribute("style",ae)):T.buttons.backgroundColor&&(ae=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.backgroundColor};`),E.setAttribute("style",ae));let Pe=T.buttons.fontFamily;Pe[0]==="Safe Fonts"?(E.style.fontFamily=Pe[1],ct({elem:ee})):Pe[0]==="Google Fonts"&&(Pe[1]==="Sans Serif"?E.style.fontFamily="Helvetica, Arial, sans-serif":Pe[1]==="Serif"&&(E.style.fontFamily='"Times New Roman", Times, serif'),E.classList.remove(...[...E.classList].filter(De=>De.startsWith("em-font"))),E.classList.add(`em-font-${Pe[2].replace(/\s/g,"")}-${Pe[3].replace(/\s/g,"")}`),St({elem:ee,fontFamilyArray:Pe})),E.closest("td").setAttribute("align",T.buttons.textAlign);let Qe="";if(T.buttons.letterSpacing>0?Qe=E.style.letterSpacing?E.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${T.buttons.letterSpacing}px`):E.getAttribute("style")+` letter-spacing: ${T.buttons.letterSpacing}px;`:Qe=E.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),E.setAttribute("style",Qe),T.buttons.bold?E.querySelector("b")?E.querySelector("b").replaceWith(...E.querySelector("b").childNodes):E.querySelector("strong")||(E.innerHTML="<strong>"+E.innerHTML+"</strong>"):E.querySelector("strong")?E.querySelector("strong").replaceWith(...E.querySelector("strong").childNodes):E.querySelector("b")&&E.querySelector("b").replaceWith(...E.querySelector("b").childNodes),E.style.fontWeight){let De=E.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");E.setAttribute("style",De)}if(T.buttons.italic?E.querySelector("i")?E.querySelector("i").replaceWith(...E.querySelector("i").childNodes):E.querySelector("em")||(E.innerHTML="<em>"+E.innerHTML+"</em>"):E.querySelector("em")?E.querySelector("em").replaceWith(...E.querySelector("em").childNodes):E.querySelector("i")&&E.querySelector("i").replaceWith(...E.querySelector("i").childNodes),E.style.fontStyle){let De=E.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");E.setAttribute("style",De)}if(E.closest('[em="atom"] > tr > td')&&E.closest('[em="atom"] > tr > td').style.paddingTop)E.closest('[em="atom"] > tr > td').style.paddingTop=T.buttons.marginTop+"px";else if(E.closest("table").previousElementSibling){let De=E.closest("table").previousElementSibling;De&&De.tagName==="TABLE"&&(De.classList.contains("em-vindent-table")||De.querySelector("td").innerHTML==="")&&De.querySelector("td").setAttribute("height",T.buttons.marginTop)}if(E.closest('[em="atom"] > tr > td')&&E.closest('[em="atom"] > tr > td').style.paddingBottom)E.closest('[em="atom"] > tr > td').style.paddingBottom=T.buttons.marginBottom+"px";else if(E.closest("table").previousElementSibling){let De=E.closest("table").nextElementSibling;De&&De.tagName==="TABLE"&&(De.classList.contains("em-vindent-table")||De.querySelector("td").innerHTML==="")&&De.querySelector("td").setAttribute("height",T.buttons.marginBottom)}T.buttons.padding.all&&(E.style.padding=T.buttons.padding.all+"px"),T.buttons.padding.top&&(E.style.paddingTop=T.buttons.padding.top+"px"),T.buttons.padding.right&&(E.style.paddingRight=T.buttons.padding.right+"px"),T.buttons.padding.bottom&&(E.style.paddingBottom=T.buttons.padding.bottom+"px"),T.buttons.padding.left&&(E.style.paddingLeft=T.buttons.padding.left+"px"),D({settings:{border:T.buttons.border},elem:E.closest("td")}),q({settings:{borderRadius:T.buttons.borderRadius},elem:E.closest("td")})}}else{let ae=T.text.fontFamily;if(kt(E.style.color).toLowerCase()==="#1c52dc"){let Qe=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.links.color};`);E.setAttribute("style",Qe)}else{let Qe=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.text.color};`);E.setAttribute("style",Qe)}if(E.closest(".em-contrast-block")){let Qe=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.links.contrastColor};`);E.setAttribute("style",Qe)}let Pe="";T.links.underline?Pe=E.style.textDecoration?E.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: underline;"):E.getAttribute("style")+" text-decoration: underline;":Pe=E.style.textDecoration?E.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: none;"):E.getAttribute("style")+" text-decoration: none;",E.setAttribute("style",Pe),ae[0]==="Safe Fonts"?(E.style.fontFamily=ae[1],ct({elem:ee})):ae[0]==="Google Fonts"&&(ae[1]==="Sans Serif"?E.style.fontFamily="Helvetica, Arial, sans-serif":ae[1]==="Serif"&&(E.style.fontFamily='"Times New Roman", Times, serif'),E.classList.remove(...[...E.classList].filter(Qe=>Qe.startsWith("em-font"))),E.classList.add(`em-font-${ae[2].replace(/\s/g,"")}-${ae[3].replace(/\s/g,"")}`),St({elem:ee,fontFamilyArray:ae}))}}),ee.querySelector('[em="block"]'))){const E=ee.querySelectorAll('[em="block"]');T.block?.backgroundColor&&E.forEach(ae=>{ae.querySelectorAll(":scope > td").forEach(Pe=>{Pe.setAttribute("bgcolor",T.block.backgroundColor)})}),T.block?.padding&&E.forEach(ae=>{ae.querySelectorAll(":scope > td").forEach(Pe=>{Pe.style.paddingTop=T.block.padding.top+"px",Pe.style.paddingRight=T.block.padding.right+"px",Pe.style.paddingBottom=T.block.padding.bottom+"px",Pe.style.paddingLeft=T.block.padding.left+"px"})})}return ee.tagName==="DIV"?r.getElementInnerHTML(ee):r.getElementInnerHTML(ee.querySelector("tbody")||ee)},ct=B=>{B.elem.querySelectorAll("link[em-class]").forEach(ee=>{B.elem.querySelector("."+ee.getAttribute("em-class"))||ee.remove()})};function kt(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 ee=parseInt(B[0],10).toString(16),E=parseInt(B[1],10).toString(16),ae=parseInt(B[2],10).toString(16);return ee=ee.length===1?"0"+ee:ee,E=E.length===1?"0"+E:E,ae=ae.length===1?"0"+ae:ae,"#"+ee+E+ae}}else if(B&&B.charAt(0)==="#")return B}const St=B=>{const ee=B.elem.querySelectorAll("link"),E=`em-font-${B.fontFamilyArray[2].replace(/\s/g,"")}-${B.fontFamilyArray[3].replace(/\s/g,"")}`;if(!Array.from(ee)?.find(Pe=>Pe.getAttribute("em-class")===E)){let Pe=document.createElement("link");Pe.setAttribute("rel","stylesheet"),Pe.setAttribute("href",`https://fonts.googleapis.com/css2?family=${B.fontFamilyArray[2]}:ital,wght@${we[B.fontFamilyArray[3]].indexOf("i")>-1?"1":"0"},${we[B.fontFamilyArray[3]].replaceAll("i","")}&display=swap`),Pe.setAttribute("em-class",E),B.elem.insertAdjacentElement("afterbegin",Pe)}_e({elem:B.elem});let ae=`font-family: '${B.fontFamilyArray[2]}', ${Ge[B.fontFamilyArray[1]]}!important;`;ae+=` font-weight: ${we[B.fontFamilyArray[3]].replaceAll("i","")}!important;`,we[B.fontFamilyArray[3]].indexOf("i")>-1&&(ae+=" 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,"")} { ${ae} }`),setTimeout(()=>ct({elem:B.elem}),0)},D=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")))},q=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"))},we={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"},Ge={"Sans Serif":"sans-serif",Serif:"serif"};function _e(B){if(!B.elem.querySelector('style[em="styles"]')){let ee=document.createElement("style");ee.setAttribute("em","styles"),B.elem.append(ee)}}return(0,t.jsxs)("div",{className:(0,We.default)("blocks-search",{is_search:s}),children:[(0,t.jsx)(o.ui_kit$Form,{className:(0,We.default)("blocks-search__form",{is_search:s}),form:b,layout:"vertical",name:"blocks_search_form",initialValues:{...hn},onValuesChange:tt,autoComplete:"off",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:Pr,children:(0,t.jsx)(o.ui_kit$SearchInput,{placeholder:m("Search by title"),allowClear:!0,enterButton:!1})})}),(pe||Re||Ve)&&(0,t.jsx)(o.ui_kit$Alert,{title:m("Error"),description:m("Error when receiving data. Try again (reload page) or contact support."),type:"error",showIcon:!0}),s&&!ue&&(0,t.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,t.jsxs)("ul",{children:[(0,t.jsx)("li",{"data-type":"",className:"active",onClick:O,children:m("All")},"search_All"),je.map(B=>(0,t.jsx)("li",{"data-type":B,onClick:O,children:m(r.TYPES_TRANSLATE[B])},"search_"+B))]})}),(0,t.jsxs)("div",{ref:U,className:(0,We.default)("blocks-search__result-wrapper",{is_search:s}),children:[(i==="project"||s)&&(0,t.jsxs)(t.Fragment,{children:[!!Y.length&&!s&&(0,t.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,t.jsxs)("ul",{children:[(0,t.jsx)("li",{"data-type":"",className:"active",onClick:O,children:m("All")},"blocksSections_All"),Y.map(B=>(0,t.jsx)("li",{"data-type":B,onClick:O,children:m(r.TYPES_TRANSLATE[B])},"blocksSections_"+B))]})}),(0,t.jsxs)("div",{className:(0,We.default)("blocks-search__blocks-wrapper",{is_search:s}),ref:oe,children:[(0,t.jsx)("div",{className:"blocks-search__result-holder project",children:!(Q||X)&&(M?.length?M.map((B,ee)=>{const E=vr(B.id,Ir(B));return(0,t.jsx)("div",{className:"blocks-search__result","data-type":B.type,"data-block-id":Io(B)?String(B.id):void 0,children:(0,t.jsx)(o.ui_kit$Dropdown,{placement:"leftTop",menu:{items:dt(B)},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,t.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:ae=>he(ae,B.html,"project",B.title,B),onDragStart:ae=>ke(ae,B.html,"project",B.title,B),onMouseEnter:()=>j({html:B.html,title:B.title}),onMouseLeave:w,children:[V(B),(0,t.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:E,onContentLoad:He,style:{transform:`scale(${P})`}})]})},"commenMenu")},B.id+ee.toString())}):!(Oe.tags||Oe.name||Oe.type)&&Ee&&!(Q||X)&&!s&&(0,t.jsxs)("div",{style:{padding:"10px 0 20px",display:"flex",flexDirection:"row",justifyContent:"space-between"},children:[(0,t.jsxs)("div",{style:{width:"110%"},children:[(0,t.jsx)("h3",{style:{lineHeight:"1.2"},children:m("You don`t have any saved blocks yet.")}),m("To add a block from the dashboard click the"),' "',m("Save to Blocks button."),'" ',(0,t.jsx)(r.EmIcons,{icon:"SaveBlock",component:o.icons$SaveBlock,style:{position:"relative",top:"2px"}}),(0,t.jsx)("br",{}),(0,t.jsx)("br",{}),m("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,t.jsx)("br",{}),(0,t.jsx)("br",{}),(0,t.jsx)(o.ui_kit$Flex,{justify:"left",children:(0,t.jsx)(o.ui_kit$Button,{type:"primary",onClick:()=>a(!0),style:{cursor:"pointer"},children:m("Save all blocks")})})]}),(0,t.jsx)("div",{style:{width:"80px",height:"200px"},children:(0,t.jsx)("img",{src:Ap,style:{display:"block",width:80,position:"absolute",right:5}})})]}))}),(Q||X)&&(0,t.jsx)(o.ui_kit$Skeleton,{active:!0})]})]}),s&&Z?.length>0&&R?.length>0&&(0,t.jsx)(o.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="template"||s)&&(0,t.jsxs)(t.Fragment,{children:[!!Ce.length&&!s&&(0,t.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,t.jsxs)("ul",{children:[(0,t.jsx)("li",{"data-type":"",className:"active",onClick:O,children:m("All")},"templateBlocksSections_All"),Ce.map(B=>(0,t.jsx)("li",{"data-type":B,onClick:O,children:m(r.TYPES_TRANSLATE[B])},"templateBlocksSections_"+B))]})}),(0,t.jsxs)("div",{className:(0,We.default)("blocks-search__blocks-wrapper",{is_search:s}),ref:xe,children:[(0,t.jsxs)("div",{className:"blocks-search__result-holder template",children:[R&&!($e||z)&&re?.length?(0,t.jsx)(t.Fragment,{children:re.map((B,ee)=>{const E=vr(B.id,Ir(B));return(0,t.jsx)("div",{className:"blocks-search__result","data-type":B.type,"data-block-id":Io(B)?String(B.id):void 0,children:(0,t.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:ae=>he(ae,B.html,"template",B.title,B),onDragStart:ae=>ke(ae,B.html,"template",B.title,B),onMouseEnter:()=>j({html:B.html,title:B.title}),onMouseLeave:()=>w(),children:[V(B),(0,t.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:E,onContentLoad:He,style:{transform:`scale(${P})`}})]})},B.id+ee.toString())})}):!s&&!Ue&&!z&&(0,t.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:m("No related blocks found.")})," "]}),($e||z)&&(0,t.jsx)(o.ui_kit$Skeleton,{active:!0})]})]}),s&&R?.length>0&&de?.length>0&&(0,t.jsx)(o.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="common"||s)&&(0,t.jsxs)(t.Fragment,{children:[!!I?.length&&!s&&(0,t.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,t.jsxs)("ul",{children:[(0,t.jsx)("li",{"data-type":"",className:"active",onClick:O,children:m("All")},"commonBlocksSections_All"),I.map(B=>(0,t.jsx)("li",{"data-type":B,onClick:O,children:m(r.TYPES_TRANSLATE[B])},"commonBlocksSections_"+B))]})}),(0,t.jsxs)("div",{className:(0,We.default)("blocks-search__blocks-wrapper",{is_search:s}),ref:be,children:[(0,t.jsxs)("div",{className:"blocks-search__result-holder common",children:[Ae&&!!ye?.length&&!(Xe||Ue)&&(0,t.jsx)(t.Fragment,{children:ye.map((B,ee)=>{const E=st({html:vr(B.id,Ir(B))});return(0,t.jsx)("div",{className:"blocks-search__result","data-type":B.type,"data-block-id":Io(B)?String(B.id):void 0,children:(0,t.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:ae=>he(ae,st({html:B.html}),"common",B.title,B),onDragStart:ae=>ke(ae,st({html:B.html}),"common",B.title,B),onMouseEnter:()=>j({html:st({html:r.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+B.html+"</table>")}),title:B.title}),onMouseLeave:()=>w(),children:[V(B),(0,t.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:E,onContentLoad:He,style:{transform:`scale(${P})`}})]})},B.id+ee.toString())})})," "]}),(Ue||Xe)&&(0,t.jsx)(o.ui_kit$Skeleton,{active:!0})]})]}),ue&&(0,t.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:m("There are no blocks for this request.")})]})]})};Ar.propTypes={};function Hp(e,i){return e==="email"||r.isBlocksV2Enabled()?!0:i!==void 0&&r.isPluginGoHistory(i)}var bn=({comments:e,subjectId:i,isLoggedIn:s,projectTitle:l="",emailElementType:a,email:d})=>{const{__:c,_n:h}=r.useI18n(),g=r.useSendPostMessage(),b=r.useNotification(),{token:x}=(0,o.ui_kit$useToken)(),p=r.useAppConfig(),m=r.usePushToDataLayer(),S=(0,n.useRef)(null),[k,f]=(0,n.useState)(""),[y,v]=(0,n.useState)("ADD"),[N,R]=(0,n.useState)(!1),[C,F]=(0,n.useState)(null),[U,$]=(0,n.useState)(null),[L,P]=(0,n.useState)(""),[V,ne]=(0,n.useState)(""),[T,oe]=(0,n.useState)(!1),[xe,be]=(0,n.useState)(""),[Se,me]=r.useAddCommentMutation(),[he,ke]=r.useDeleteCommentMutation(),[ce,ze]=r.useEditCommentMutation(),[Oe,ve]=r.useDeleteTargetMutation(),[Ee]=r.useAutoSaveBlockMutation(),pe=r.useDispatch(),Q=r.useStore(),X=r.useCurrentUser(),Z=r.useCurrentProjectRequested(),J=r.useContentReader(),H=de=>{const ye=r.getEmailDocuments(ht.getContainer(Q));ye.save("anchor",{project:de}).then(I=>{const se=I?ye.revisionFacts()?.lastRevisionAt:void 0;se!==void 0&&d?.id!=null&&pe(r.rememberAutosaveTime({emailId:d.id,modified:new Date(se).toISOString()}))})},M=()=>{const de=Z;if(Hp(a,ht.getContainer(Q))){H(de);return}const ye={...d?.meta!==void 0?{meta:d.meta}:{},title:d?.title,emailId:d?.id,project:de,html:J(),excerpt:d?.date_gmt};d?.id!=null&&Ee({blockId:d.id,body:ye}).catch(I=>{})};function Y(de){oe(!1),be(""),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:xe}),R(!0),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!0})}function K(){$(C),e.filter(de=>de.parent===C).length?ce({commentId:C,status:"deleted"}).unwrap():he(C),document.querySelector('.discuss-main li[id="'+C+'"] .comment-icon-target')?.getAttribute("target-id")&&g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:document.querySelector('.discuss-main li[id="'+C+'"] .comment-icon-target')?.getAttribute("target-id")}),M(),be("")}function te(de){$(C);const ye=e.find(se=>se.id?.toString()===C),I=ye?.target_id?.toString()||"";oe(!!I),be(I),ne(ye?.content?.slice(3,-5)?.toString()),v("EDIT")}function le(de){$(C),P(""),v("REPLY")}const Te=()=>{b.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 "))+`${l}.`,okText:c("Okay. I'll log in.")})};async function Re(){s?(await ce({commentId:U,content:V,targetId:xe}).unwrap(),v("ADD"),ne(""),$(0),oe(!1),R(!1),be(""),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Te()}const $e=de=>{v("ADD"),ne(""),$(0),oe(!1),R(!1),be(""),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})},z=async()=>{s?((k||L)&&await Se({subjectId:i,author:X.id,parent:y==="ADD"?"0":U,content:k||L,author_name:X.name,author_email:X.email,targetId:xe}).then(de=>{if(de.error){const{data:ye}=de.error;b.error({title:ye?.code??c("Error"),description:ye?.message??c("Something went wrong. Try again later.")})}else m({event:"submit",action:"send_discussion_chat_message",entity_type:a==="block"?"block":"email",entity_id:d?.id,project_id:d?.project,context:"editor"},void 0,{analyticsName:"editor_comment_sent"})}),be(""),v("ADD"),P(""),f(""),$(0),oe(!1),R(!1),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Te()};function re(){T?(R(!1),oe(!1),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:xe})):(R(!N),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!N}),N&&oe(!1))}function Ce(de){let ye=JSON.parse(JSON.stringify(de));if(!ye||!ye.length)return[];let I=[],se=new Map;for(let je=0,Ne=ye.length;je<Ne;++je){let He=ye[je],Ke=se.get(He.id);if((!Ke||Array.isArray(Ke))&&(Ke&&(He.children=Ke),se.set(He.id,He)),String(He.parent)==="0")I.push(He);else{let tt=se.get(He.parent);tt?(Array.isArray(tt)?tt:tt.children=tt.children||[]).push(He):se.set(He.parent,[He])}}return I.forEach(je=>{je.status==="deleted"&&!je.children&&(ke.isUninitialized||ke.isSuccess)&&he(je.id).unwrap().catch(Ne=>{})}),I}const G=de=>{const ye=de.data.operation;if(ye===r.EVENT_TYPES.APPLICATION_DISCUSS_SET_ID&&(be(de.data.settings.value),de.data.settings.value!==""?(oe(!0),R(!1)):(oe(!1),R(!0))),ye===r.EVENT_TYPES.APPLICATION_DISCUSS_SAVE_TARGET&&M(),ye===r.EVENT_TYPES.APPLICATION_DISCUSS_GET_COMMENT)if(document.querySelector('.comment-icon-target[target-id="'+de.data.settings.targetId+'"]')){let I=document.querySelector('.comment-icon-target[target-id="'+de.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 g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:de.data.settings.targetId}),b.error({title:c("There's no such comment.")});ye===r.EVENT_TYPES.APPLICATION_DISCUSS_NO_COMMENT&&b.error({title:c("There's no such element in the email.")})};r.useListenPostMessage(G);const Be=de=>{g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_GET_TARGET,value:de})},Fe=de=>(de?.sort((ye,I)=>ye.date>I.date?1:-1),(0,t.jsx)(t.Fragment,{children:de&&!!de.length&&(0,t.jsx)(o.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:de,renderItem:ye=>(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("li",{id:ye.id,children:(0,t.jsxs)(t.Fragment,{children:[ye.status==="deleted"&&ye.clildren&&(0,t.jsx)(o.ui_kit$Comment,{className:"deletedComment",content:(0,t.jsx)(o.ui_kit$Alert,{description:c("Comment was removed."),type:"info"}),children:Fe(ye.children)}),ye.status!=="deleted"&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Comment,{author_id:ye.author_id,author:ye.author_name,avatar:ye.author_avatar_urls&&ye.author_avatar_urls[48]||"",className:(0,We.default)(ye.target_id&&"targetted-comment-item",(!ye.author_avatar_urls||!ye.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,t.jsx)(o.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>F(ye.id),menu:{items:ye.author===X.id?Ue:Xe},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,t.jsx)("div",{onClick:()=>ye.target_id&&Be(ye.target_id),dangerouslySetInnerHTML:{__html:ye.content}})},"commenMenu"),datetime:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:ye.date&&r.formatDate(r.tryParseISO(ye.date),h,!0)}}),ye.target_id&&(0,t.jsx)("span",{className:"comment-icon-target","target-id":ye.target_id,onClick:()=>Be(ye.target_id),children:(0,t.jsx)(r.EmIcons,{icon:"AimOutlined",component:o.icons$AimOutlined,style:{color:x.colorInfo,top:-2,position:"relative"}})})]}),children:(0,t.jsxs)(t.Fragment,{children:[y==="REPLY"&&U===ye.id&&Ve,y==="EDIT"&&U===ye.id&&Ae,Fe(ye.children)]})})})]})})})})})),Ae=(0,t.jsxs)(o.ui_kit$Form,{onFinish:Re,className:"commentForm",children:[(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,t.jsx)(o.ui_kit$TextArea,{className:"textarea-reply",value:V,onChange:de=>ne(de.target.value),rows:4,placeholder:c("Editing comments"),onKeyDown:de=>de.key==="Escape"&&$e(),onPressEnter:de=>de.key==="Enter"&&de.ctrlKey&&Re(),ref:S})}),(0,t.jsx)(o.ui_kit$Form.Item,{className:"buttons",children:(0,t.jsxs)(o.ui_kit$Space,{children:[T?(0,t.jsx)(o.ui_kit$Popconfirm,{title:c("Are you sure?"),okText:c("Yes"),cancelText:c("No"),onConfirm:Y,children:(0,t.jsx)(o.ui_kit$Button,{loading:ve.isLoading,type:N||T&&y==="EDIT"&&xe!==""?"primary":"default",className:"button-target "+(N&&!T?"button-target_choose":""),style:T&&y==="EDIT"&&xe!==""?{background:x.colorInfo}:{},children:(0,t.jsx)(r.EmIcons,{icon:"AimOutlined",component:o.icons$AimOutlined,className:"icon-target"})})}):(0,t.jsx)(o.ui_kit$Button,{onClick:re,loading:ve.isLoading,type:N||T&&y==="EDIT"&&xe!==""?"primary":"default",className:"button-target "+(N&&!T?"button-target_choose":""),style:T&&y==="EDIT"&&xe!==""?{background:x.colorInfo}:{},children:(0,t.jsx)(r.EmIcons,{icon:"AimOutlined",component:o.icons$AimOutlined,className:"icon-target"})}),(0,t.jsxs)(o.ui_kit$Button,{className:"button-reply",type:"primary",loading:ze.isLoading,htmlType:"submit",children:[c("Save")," ",(0,t.jsx)(r.EmIcons,{icon:"SaveOutlined",component:o.icons$SaveOutlined,size:16,strokeWidth:p.iconStrokeWidth})]}),(0,t.jsx)(o.ui_kit$Button,{onClick:$e,className:"button-reply",children:c("Cancel")})]})})]}),Ve=(0,t.jsxs)(o.ui_kit$Form,{name:"reply",className:"commentForm",onFinish:z,children:[(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,t.jsx)(o.ui_kit$TextArea,{className:"textarea-reply",value:L,onChange:de=>P(de.target.value),rows:4,placeholder:c("Reply to the comment"),onKeyDown:de=>de.key==="Escape"&&$e(),onPressEnter:de=>de.key==="Enter"&&de.ctrlKey&&z(),ref:S})}),(0,t.jsx)(o.ui_kit$Form.Item,{hidden:!0,name:"targetId",children:(0,t.jsx)(o.ui_kit$Input,{type:"hidden"})}),(0,t.jsx)(o.ui_kit$Form.Item,{className:"buttons",children:(0,t.jsxs)(o.ui_kit$Space,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:c("Add a note"),styles:{body:{maxWidth:"150px"}},children:(0,t.jsx)(o.ui_kit$Button,{onClick:re,type:N||T&&y==="REPLY"&&xe!==""?"primary":"default",className:"button-target "+(N&&!T?"button-target_choose":""),style:T&&y==="REPLY"&&xe!==""?{background:x.colorInfo}:{},children:(0,t.jsx)(r.EmIcons,{icon:"AimOutlined",component:o.icons$AimOutlined,className:"icon-target"})})}),(0,t.jsxs)(o.ui_kit$Button,{className:"button-reply",type:"primary",loading:y==="REPLY"&&me.isLoading,htmlType:"submit",children:[c("Reply")," ",(0,t.jsx)(r.EmIcons,{icon:"SendOutlined",component:o.icons$SendOutlined,size:16,strokeWidth:p.iconStrokeWidth})]}),(0,t.jsx)(o.ui_kit$Button,{onClick:$e,className:"button-reply",ghost:!0,type:"primary",children:c("Cancel")})]})})]});(0,n.useEffect)(()=>{y==="REPLY"&&S.current.focus({cursor:"start"}),y==="EDIT"&&S.current.focus({cursor:"end"})},[y]);let Ue=[];Ue.push({key:"Reply to comment",icon:(0,t.jsx)(r.EmIcons,{icon:"RollbackOutlined",component:o.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:le},{key:"Edit comment",icon:(0,t.jsx)(r.EmIcons,{icon:"EditOutlined",component:o.icons$EditOutlined,style:{fontSize:"16px"}}),label:c("Edit"),onClick:te},{key:"Delete comment",icon:(0,t.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:16}),label:c("Delete"),style:{color:x.colorError},onClick:K});let Xe=[];return Xe.push({key:"Reply to comment",icon:(0,t.jsx)(r.EmIcons,{icon:"RollbackOutlined",component:o.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:le}),(0,t.jsxs)("div",{className:"discuss-main",children:[e.length>0&&(0,t.jsx)(o.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:Ce(e),renderItem:de=>(0,t.jsxs)("li",{id:de.id,children:[de.comment_status==="deleted"&&(0,t.jsx)(o.ui_kit$Comment,{className:"deletedComment",content:(0,t.jsx)(o.ui_kit$Alert,{description:c("Comment was removed."),type:"info"}),children:Fe(de.children)}),de.comment_status!=="deleted"&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Comment,{author_id:de.author_id,author:de.author_name,avatar:de.author_avatar_urls&&de.author_avatar_urls[48]||"",className:(0,We.default)(de.target_id&&"targetted-comment-item",(!de.author_avatar_urls||!de.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,t.jsx)(o.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>F(de.id),menu:{items:de.author===X.id?Ue:Xe},styles:{root:{minWidth:"auto"}},children:(0,t.jsx)("div",{onClick:()=>de.target_id&&Be(de.target_id),dangerouslySetInnerHTML:{__html:de.content}})},"commenMenu"),datetime:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:de.date&&r.formatDate(r.tryParseISO(de.date),h,!0)}}),de.target_id&&(0,t.jsx)("span",{className:"comment-icon-target","target-id":de.target_id,onClick:()=>Be(de.target_id),children:(0,t.jsx)(r.EmIcons,{icon:"AimOutlined",component:o.icons$AimOutlined,style:{color:x.colorInfo,top:-2,position:"relative"}})})]}),children:(0,t.jsxs)(t.Fragment,{children:[y==="REPLY"&&U===de.id&&Ve,y==="EDIT"&&U===de.id&&Ae,Fe(de.children)]})})})]})}),(0,t.jsxs)(o.ui_kit$Form,{onFinish:z,className:y==="ADD"?"addMode":"replyEditMode",children:[(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,t.jsx)(o.ui_kit$TextArea,{value:k,onChange:de=>f(de.target.value),rows:4,placeholder:c("Leave your comment"),className:"textarea-comment",onPressEnter:de=>de.key==="Enter"&&de.ctrlKey&&z()})}),(0,t.jsx)(o.ui_kit$Form.Item,{children:(0,t.jsxs)(o.ui_kit$Space,{size:8,children:[(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:c("Add a note"),styles:{body:{maxWidth:"150px"}},children:(0,t.jsx)(o.ui_kit$Button,{onClick:re,type:N||T&&y==="ADD"&&xe!==""?"primary":"default",className:"button-target "+(N&&!T?"button-target_choose":""),style:T&&y==="ADD"&&xe!==""?{background:x.colorInfo}:{},icon:(0,t.jsx)(r.EmIcons,{icon:"Target",component:o.icons$Target,size:16,strokeWidth:p.iconStrokeWidth,className:"icon-target"})})}),(0,t.jsxs)(o.ui_kit$Button,{className:"button-add",type:"primary",loading:y==="ADD"&&me.isLoading,htmlType:"submit",children:[c("Send")," ",(0,t.jsx)(r.EmIcons,{icon:"SendOutlined",component:o.icons$SendOutlined,size:16,strokeWidth:p.iconStrokeWidth})]})]})})]})]})};function Up(e,i){return{ID:e.userId,userId:e.userId,display_name:e.displayName,user_email:e.email,user_firstname:e.firstName,user_lastname:e.lastName,avatar_url:e.avatarUrl,...i?{role:i}:{}}}var Wp=["common_styles","subject","preheader","meta"];function zp(e,i){r.writeSourceReport(e,r.fromRevision(i))}function Gp(e){if(!e)return null;const i=e.get().attributes??{},s={};for(const l of Wp)i[l]!==void 0&&(s[l]=i[l]);return{content:e.getContent(),attributes:s}}function gn(e,i){i&&r.writeSourceReport(e,{content:i.content,attributes:i.attributes})}var fn=(e,i)=>({key:e.id,id:e.id,author:e.author,authorName:e.authorName,date:r.formatDate(r.tryParseISO(e.date||e.modified),i),title:e.title,html:e.html,common_styles:e.common_styles,loading:!1,isAutosave:e.isAutosave===!0}),Nr=({emailElement:e})=>{const{__:i}=r.useI18n(),s=r.useSendPostMessage(),l=r.useDispatch(),a=r.useEditorProjectId(),d=r.useEmailAttributesWriter(),c=r.useContentReplacer(),h=r.useEditorLocked(),g=r.useEditorLockCheck(),{document:b}=r.useDocumentSessionContext(),x=r.useSelector(r.selectHistoryData),p=r.useDocumentHistoryReader(),m=r.useRevisionContent(),S=r.useNotification(),k=(0,n.useRef)({preview:0,apply:0}),f=r.useProjectData()?.members,y=r.useSelector(r.selectElementHistoryHasMore),v=r.useSelector(r.selectIsPanelHistoryCollapsed),[N,R]=(0,n.useState)(!0),[C,F]=(0,n.useState)(!1),[U,$]=(0,n.useState)([]),[L,P]=(0,n.useState)([]),V=K=>l(r.switchIsPanelHistoryCollapsed(K)),ne=(0,n.useCallback)(K=>{if(!K?.html||g())return;const te=r.fromRevision(K);te?.attributes&&d(te.attributes),l(r.markAppearanceNeedsUpdate());const le=b?.get().version;c(K.html,{undoable:!0}),b&&b.get().version===le&&b.markUnsaved()},[c,l,d,b,g]),T=(0,n.useCallback)(K=>{zp(b,K),l(r.markAppearanceNeedsUpdate())},[b,l]),{data:oe}=r.projectsApi.useGetProjectQuery(Number(a),{skip:!a}),[xe,be]=(0,n.useState)([]);(0,n.useEffect)(()=>{if(oe){const{owner:K,admins:te,users:le}=oe?.members;be([K&&{...K},te&&Array.isArray(te)&&te.map(Te=>({...Te})),le&&Array.isArray(le)&&le.map(Te=>({...Te}))].filter(Te=>Te).flat(1).map(Te=>({id:Te.ID,display_name:Te.display_name})))}},[oe,oe?.members,i]);const[Se,me]=(0,n.useState)(1),[he,ke]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const K=Array.isArray(x)&&x.length&&x?.map(te=>fn(te,i));P(K||[]),$(K),R(!1),y||ke(!0)},[x,y,i]);const ce=()=>{F(!0),P(U.concat([...new Array(3)].map(()=>({loading:!0})))),p(e.id,Se+1).then(K=>{if(K.isStale)return;const{data:te,hasMore:le}=K.data,Te=Array.isArray(te)&&te?.map($e=>fn($e,i)),Re=U.concat(Te);P(Re),$(Re),F(!1),window.dispatchEvent(new Event("resize")),le||ke(!0),me(Se+1)})},ze=!N&&!C&&!he?(0,t.jsx)("div",{style:{textAlign:"center",marginTop:24,marginBottom:24,height:32,lineHeight:"32px"},children:(0,t.jsx)(o.ui_kit$Button,{onClick:ce,children:i("loading more")})}):null,[Oe,ve]=(0,n.useState)(),[Ee,pe]=(0,n.useState)(null),Q=(0,n.useCallback)(K=>{ne(K),ve(null),pe(null),s({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),l(r.resetToLastActiveSettingsTab())},[ne,s,l]),X=(0,n.useCallback)((K,te)=>le=>{const Te=k.current;Te[te]+=1,te==="apply"&&(Te.preview+=1);const Re=Te[te],$e=()=>Re===k.current[te];if(le?.html||!le?.id){K(le);return}m(e.id,le).then(z=>{$e()&&K(z)},z=>{$e()&&(ve(null),S.error({message:i("Failed to load"),innerException:z}))})},[m,e.id,S,i]),Z=X(Q,"apply"),J=X(T,"preview"),H=({author:K,authorName:te})=>{if(Y.revisionService)return te||K||"–";const le=xe.find(Re=>Re.id?.toString()===K?.toString())?.display_name;if(le)return le;const Te=r.authorFromMembers(K,f);return Te?Up(Te).display_name||Te.email||"–":te||"–"},M=(0,n.useRef)(void 0);(0,n.useEffect)(()=>{!v&&!Ee&&(M.current=b,pe(Gp(b)))},[v,pe,b,Ee]),(0,n.useEffect)(()=>{v&&(k.current.preview+=1),v&&Ee&&(M.current===b&&(gn(b,Ee),l(r.markAppearanceNeedsUpdate())),pe(null))},[v,Ee,b,l]);const Y=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse secondary-tabs_unset_scroll",size:"large",activeKey:r.HISTORY,items:[{label:(0,t.jsx)(t.Fragment,{children:i("Version history")}),key:r.HISTORY,forceRender:!0,className:"email-settings__collapse-panel",style:{height:"100%"},children:(0,t.jsx)(o.ui_kit$List,{className:"history-panel__list",loading:N,itemLayout:"horizontal",loadMore:ze,dataSource:L,header:(0,t.jsxs)("div",{className:"history-panel__list-header",children:[(0,t.jsx)("div",{className:"history-panel__list-date",children:i("Time")}),(0,t.jsx)("div",{className:"history-panel__list-author",children:i("Author")}),(0,t.jsx)("div",{className:"history-panel__restore",children:"Set"})]}),renderItem:(K,te)=>(0,t.jsx)(o.ui_kit$List.Item,{onClick:()=>{te!==Oe&&(ve(te),J(U[te])),l(r.setBlockSettingsDisable(!0))},className:(0,We.default)("history-panel__item",{"history-panel__item_active":te===Oe}),children:(0,t.jsxs)(o.ui_kit$Skeleton,{title:!1,loading:K.loading||!1,active:!0,children:[(0,t.jsx)("div",{className:"history-panel__list-date",children:K.date}),(0,t.jsx)("div",{className:"history-panel__list-author",children:H(K)}),K.isAutosave&&Oe!==te&&(0,t.jsx)("div",{style:{opacity:.45},className:"history-panel__list-autosave",children:i("Auto")}),!K.isAutosave&&(0,t.jsx)(o.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",disabled:h,onClick:le=>{Oe===te&&le.stopPropagation(),Z(U[te])},children:i("Set")}),K.isAutosave&&Oe===te&&(0,t.jsx)(o.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",disabled:h,onClick:le=>{Oe===te&&le.stopPropagation(),Z(U[te])},children:i("Set")})]})})})}]}),(0,t.jsx)(o.ui_kit$Button,{type:"text",className:"ant-modal-close","aria-label":"Close",onClick:()=>{l(r.resetToLastActiveSettingsTab()),Ee&&gn(b,Ee),pe(null),V(!0),s({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1})},children:(0,t.jsx)(r.EmIcons,{icon:"Close",component:o.icons$Close})})]})};Nr.propTypes={};var _n=async({blockTags:e,projectTagsArray:i,addTerm:s,project:l,notification:a})=>{if(!e||e.length===0)return[];const d=e.map(c=>{const h=i.find(g=>g.name===c);return h?Promise.resolve(h.id):s({project:l,kind:r.BLOCK_TAGS,name:c}).then(({error:g,data:b})=>{if(g?.status===400)return r.existingTermIdFromError(g);if(b)return b.id;if(g)return a.fromError("TAG_CREATING_ERROR",c,g),null})});return(await Promise.all(d)).filter(c=>c!=null)},xn=()=>{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/660+"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))},Yp=async e=>{const{block:i,form:s,projectData:l,projectTagsArray:a,projectId:d,addBlock:c,editBlock:h,editProject:g,addTerm:b,notification:x,__:p,handleCloseModal:m,htmlContent:S,refetchBlocks:k,reloadBlockScreens:f,onGlobalBlockTemplateSynced:y,onPlainBlockCreated:v}=e;try{const{valid:N,values:R,blockTags:C}=await kn({form:s,notification:x,__:p});if(!N)return;const F=await _n({blockTags:C,projectTagsArray:a,addTerm:b,project:l,notification:x});await En({block:i,form:s,projectId:d,htmlContent:S,values:R,tagIds:F,addBlock:c,editBlock:h,editProject:g,notification:x,refetchBlocks:k,reloadBlockScreens:f,projectTagsArray:a,__:p,handleCloseModal:m,onGlobalBlockTemplateSynced:y,onPlainBlockCreated:v})}catch{}},kn=async({form:e,notification:i,__:s})=>{let l=!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:s("Maximum 10 tags available.")}),l=!1),{valid:l,values:a,blockTags:d}};function Lr(e){if(e!==null&&typeof e=="object"&&"data"in e){const i=e.data;return{code:i?.code,message:i?.message}}return{}}async function Xp(e){const{created:i,blockData:s,editBlock:l,notification:a,onGlobalBlockTemplateSynced:d}=e,c=r.globalBlockMark(i);if(!i.id||!c)return;const h=new Date,g=r.formatEmBlockVersion(h);if(l){const b=i.html??s.html??"",x=r.injectEmBlockIdIntoBlockHtml(b,c,h);if(x!==b){const p=await l({blockId:String(i.id),html:x});if(p.error){const m=Lr(p.error);a.error({id:"BLOCK_EDITING_ERROR",data:{title:s.title,code:x},innerException:p.error,message:m.code,description:m.message})}}}d?.(c,g)}function Kp(e){const{block:i,projectId:s,htmlContent:l,values:a}=e;return i?{title:i.blockTitle,project:i.projectId,html:r.stripEmBlockMark(i.htmlContent),type:i.blockType||"Other",global_block:!1}:{title:a?.title??"",project:s,html:l?r.stripEmBlockMark(l):"",type:a?.type||"Other",...a?.global_block===!0?{global_block:!0}:{}}}var En=async({block:e,form:i,projectId:s,htmlContent:l,values:a,tagIds:d,addBlock:c,editBlock:h,editProject:g,notification:b,refetchBlocks:x,reloadBlockScreens:p,projectTagsArray:m,__:S,handleCloseModal:k,onGlobalBlockTemplateSynced:f,onPlainBlockCreated:y})=>{const v=Kp({block:e,projectId:s,htmlContent:l,values:a}),N=await c({...v,blocktags:d.join(",")}),R=r.isBlockCreatedWithoutCopy(N.error);if(R)r.warnBlockCreatedWithoutCopy(b,S);else if(N.error){const L=Lr(N.error);throw b.error({id:"BLOCK_CREATING_ERROR",data:{title:v.title,code:v.html},innerException:N.error,message:L.code,description:L.message}),i.resetFields(),k(),new Error("Ошибка создания блока")}const C=N.data;!e&&a?.global_block===!0?C?.id&&await Xp({created:C,blockData:v,editBlock:h,notification:b,onGlobalBlockTemplateSynced:f}):e||y?.(),e||(i.resetFields(),k());const F=m.map(L=>L.id),U=new Set([...F,...d]),$=r.isBlocksV2Enabled()?{}:await g({projectId:s,blocktags:[...U].join(",")});if($.error){const L=Lr($.error);b.error({message:L.message,code:L.code})}else!e&&x&&R?x():!e&&x&&(b.success({id:"BLOCK_CREATING_SUCCESS",data:r.getBlockDesc(N.data),message:S("The block “")+String(N.data?.title??"")+S("” was successfully created.")}),x());return!e&&p&&p(),N.data},Or=({isModalVisible:e,htmlContent:i,projectId:s,setIsShowAddAllBlocksModal:l,setIsShowAddAllBlocksModalForNewEmail:a})=>{const{__:d}=r.useI18n(),c=r.useDispatch(),[h]=o.ui_kit$Form.useForm(),[g,b]=(0,n.useState)([]),[x,p]=r.useAddBlockMutation(),[m]=r.useEditBlockMutation(),{data:S}=r.useGetBlockTypesQuery(),k=r.useNotification(),f=r.useAppConfig(),[y,v]=(0,n.useState)([]),N=r.useProjectData(),{refetch:R}=r.useGetBlocksQuery(r.projectBlocksArgs(s)),[C,F]=r.useAddTermMutation(),[U,$]=r.useEditProjectMutation(),L=r.useSendPostMessage(),P=(0,n.useCallback)((be,Se)=>{L({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:be,...Se?{emBlockVersion:Se}:{}}})},[L]),V=(0,n.useCallback)(()=>{L({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_CLEAR_EM_BLOCK_ID})},[L]),{data:ne}=r.useGetTermsQuery({project:N,kind:r.BLOCK_TAGS},{skip:!N?.id});(0,n.useEffect)(()=>{v((ne||[]).map(be=>({value:be.name})))},[ne]),(0,n.useEffect)(()=>{if(S){const be=S;let Se=[];for(let me in be)Se.push({label:d(r.TYPES_TRANSLATE[be[me]]),value:be[me]});b(Se)}},[S,d]);const T=()=>{c(r.closeModal())},oe=()=>{l(!0),a(!1),T()},xe=async()=>{await Yp({form:h,projectData:N,projectTagsArray:ne||[],projectId:s,addBlock:x,editBlock:m,editProject:U,addTerm:C,notification:k,__:d,handleCloseModal:T,htmlContent:i,refetchBlocks:R,reloadBlockScreens:xn,onGlobalBlockTemplateSynced:P,onPlainBlockCreated:V})};return(0,t.jsx)(o.ui_kit$Modal,{title:(0,t.jsx)("div",{className:"ant-modal-title",children:d("Save block")}),open:e,onOk:()=>oe(),onCancel:T,footer:(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",padding:"8px 0"},children:[(0,t.jsx)(o.ui_kit$Button,{size:"large",onClick:oe,children:d("Save all blocks")},"create-all-blocks"),(0,t.jsx)(o.ui_kit$Button,{className:"add-new-block-modal__save-btn",size:"large",type:"primary",loading:p.isLoading,onClick:xe,icon:(0,t.jsx)(r.EmIcons,{icon:"CreateBlock",component:o.icons$CreateBlock,style:{fontSize:22}}),children:d("Save block")},"submit")]}),children:(0,t.jsxs)(o.ui_kit$Form,{form:h,layout:"vertical",name:"add_new_block_form",onFinish:xe,initialValues:{title:"",type:"",tags:[],global_block:!1},autoComplete:"off",children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:16,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:d("Block name"),name:"title",rules:[{required:!0,message:d("Please input block name")}],style:{marginBottom:15},children:(0,t.jsx)(o.ui_kit$Input,{disabled:p.isLoading||F.isLoading||$.isLoading,size:"large",placeholder:d("Enter block name"),spellCheck:"false"})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:d("Type"),name:"type",rules:[{required:!0,message:d("Please choose block type")}],style:{marginBottom:15},children:(0,t.jsx)(o.ui_kit$Select,{disabled:p.isLoading||F.isLoading||$.isLoading,size:"large",placeholder:d("Choose block type"),options:g})})})]}),f.tagsEnabled&&(0,t.jsx)(o.ui_kit$Form.Item,{label:d("Tags"),name:"tags",children:(0,t.jsx)(o.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,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},disabled:p.isLoading||F.isLoading||$.isLoading,options:y})}),f.globalBlockCheckboxEnabled&&(0,t.jsx)(o.ui_kit$Form.Item,{name:"global_block",valuePropName:"checked",style:{marginBottom:15},children:(0,t.jsx)(o.ui_kit$Switch,{label:d("Global block"),disabled:p.isLoading||F.isLoading||$.isLoading})})]})})};Or.propTypes={};var qp="https://app.emailmaker.ru/api/".replace(/\/+$/,""),Jp=`${qp}/wp-json/ai-generator/v1/identificate_blocks`,Qp=["Menu","Header","Content","Banners","Lists","Buttons","Promocodes","Feature","Call to Action","E-Commerce","Articles","Polls","Applications","Separators","Contacts","Footer","Other"];async function Zp(e){return await e.getInstance(ht.TOKEN_ID)}async function eh(e,i,s,l,a){const d={blocks:l,types:Qp,locale:i};s.current=d;try{const c=await Zp(a),h=await fetch(Jp,{method:"POST",headers:{"Content-Type":"application/json",...c?{Authorization:`Bearer ${c}`}:{}},body:JSON.stringify(d)});if(!h.ok||h.status!==200)throw new Error(`${h.statusText}`);return await h.json()}catch(c){throw c}}var th=(e,i="block")=>{const s=new DOMParser,l=s.parseFromString(e,"text/html"),a=l.querySelectorAll(`[em="${i}"]`),d=l.querySelectorAll("link");return{parser:s,document:l,blockElements:a,styleElement:l.querySelector('[em="styles"]'),linksElements:d}};function oh(e){return Array.from(e).map(i=>i.outerHTML).join("")}var ih=(e,i="block",s=!1)=>{if(!e?.html)return[];const{document:l,blockElements:a,styleElement:d,linksElements:c}=th(e.html,i),h=oh(c);if(!(a instanceof NodeList))return[];const g=l.querySelector("head"),b=g?g.innerHTML:"";return Array.from(a).map((x,p)=>{if(!(x instanceof Element)||!x.outerHTML)return null;const m=d?d.outerHTML:"";return{id:`${e.id}-${p}`,html:s?`<!DOCTYPE html>
|
|
18
|
+
`)}function Uu(e){if(!e)return"";const i=document.createElement("textarea");return i.innerHTML=e,i.value.replace(/\u00A0/g," ").trim()}var Wu=["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 no(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 Ro(e,i=2){return String(Number(e.toFixed(i)))}function To(e){const i=no(e);return i!==null&&i>0&&i<=100?i:null}function Gl(e,i){const s=no(e),l=To(i);return s===null||s<=0||l===null?"":Ro(s*l/100)}function zu(e,i){if(i?.includes("%")){const c=To(i);return c===null?"":Ro(c)}const s=no(e),l=no(i);if(s===null||s<=0||l===null||l<=0)return"";const a=l/s*100,d=Ro(l);for(const c of[0,1,2]){const p=Ro(a,c);if(Gl(e,p)===d)return p}return Ro(a)}function ai(){return{id:ht.generateUUID(),image:"",url:"",headline:"",price:"",priceCurrency:"",discountPercent:""}}function Gu({discountValue:e,...i}){return{...i,discountPercent:zu(i.price,e)}}function Yl(e,i){return i?.length?i.map(Gu):e===Ye.PRODUCT_CAROUSEL||e===Ye.SINGLE_IMAGE_PREVIEW?[ai()]:[]}function Xl(e=Ye.PRODUCT_CAROUSEL){return{annotationType:e,annotationLogo:"",description:"",discountCode:"",availabilityStarts:null,availabilityEnds:null,offerPageUrl:"",merchantHomepageUrl:"",cards:Yl(e)}}function Yu(e){const i=e.annotationType||Ye.PRODUCT_CAROUSEL;return{annotationType:i,annotationLogo:e.logo||"",description:e.description||"",discountCode:e.discountCode||"",availabilityStarts:e.availabilityStarts?(0,At.default)(e.availabilityStarts):null,availabilityEnds:e.availabilityEnds?(0,At.default)(e.availabilityEnds):null,offerPageUrl:e.offerPageUrl||"",merchantHomepageUrl:e.merchantHomepageUrl||"",cards:Yl(i,e.cards)}}function Kl(e){const i=e.cards||[];return{annotationType:typeof e.annotationType=="string"?e.annotationType:Ye.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&&At.default.isDayjs(e.availabilityStarts)?e.availabilityStarts.toISOString():void 0,availabilityEnds:e.availabilityEnds&&At.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(s=>({id:s.id||ht.generateUUID(),image:s.image||"",url:s.url||"",headline:s.headline||"",price:s.price||"",priceCurrency:s.priceCurrency||"",discountValue:Gl(s.price,s.discountPercent)}))}}function Xu(e,i){const s=e.getContent();if(!s)return!1;const l=xu(s,i);if(!l||s.slice(l.range.start,l.range.end)===l.text)return!1;const a=s.slice(l.range.start,l.range.end);return e.mutate({changes:[new r.TextChange(l.range.start,a,l.range.start,l.text)]},{source:"user"}),!0}function Ku(e,i){return e?e.emailId!==i.emailId||e.markup!==i.markup:!0}function qu(e){const i=e.getContent(),s=ku(i);return s===i?!1:(e.mutate({changes:[new r.TextChange(0,i,0,s)]},{source:"user"}),!0)}function or(e){return!!e&&/^https?:\/\//i.test(e.trim())}function Ju(e,i){const s=e.annotationType??Ye.PRODUCT_CAROUSEL,l=[];return s===Ye.PRODUCT_CAROUSEL||s===Ye.SINGLE_IMAGE_PREVIEW?(e.cards?.some(a=>!!a.image&&or(a.url))||l.push(i("At least one card needs an image and a link starting with https://")),e.cards?.some(a=>!!a.priceCurrency?.trim()&&!Yi(a.priceCurrency))&&l.push(i("Price currency must be a three-letter ISO 4217 code, for example USD")),l):s===Ye.DEAL_CARD?(e.description?.trim()||l.push(i("Discount description is required")),!or(e.offerPageUrl)&&!or(e.merchantHomepageUrl)&&l.push(i("Offer page or merchant homepage link starting with https:// is required")),l):(!e.description&&!e.discountCode&&!e.availabilityStarts&&!e.availabilityEnds&&l.push(i("Fill in at least one offer field")),l)}function Qu(e,i){const s=[],l=e.filter(a=>!!a.discountPercent?.trim());return l.some(a=>To(a.discountPercent)===null)&&s.push(i("Discount must be a percentage greater than 0 and up to 100")),l.some(a=>{const d=no(a.price);return To(a.discountPercent)!==null&&(d===null||d<=0)})&&s.push(i("Enter the price as a number to calculate the discount")),s}var{Text:Zu}=o.ui_kit$Typography,em=10,tm=1,ql={width:"100%"},om="https://developers.google.com/workspace/gmail/promotab",Tt=["hover"],im=["annotationLogo"],Jl=["cards",0,"price"],rm=["cards",0,"discountPercent"],sm=["cards",0,"priceCurrency"];function xt(e){return e.closest(".email-pane__collapse-wrapper")??document.body}var Ft={clearIcon:(0,t.jsx)(o.ui_kit$ColorPickerClearGlyph,{})},lm={optionFilterProp:"label"};function am(e){return{value:e||void 0}}var nm=Wu.map(e=>{const i=Ul(e);return{value:e,label:i===e?e:`${e} (${i})`}}),Ql=({name:e,pricePath:i,iconStrokeWidth:s})=>{const{__:l}=r.useI18n(),a=(0,n.useMemo)(()=>[i],[i]),d=(0,n.useMemo)(()=>[({getFieldValue:c})=>({validator:async(p,g)=>{const b=typeof g=="string"?g.trim():"";if(!b)return;if(To(b)===null)throw new Error(l("Discount must be a percentage greater than 0 and up to 100"));const k=no(c(i));if(k===null||k<=0)throw new Error(l("Enter the price as a number to calculate the discount"))}})],[l,i]);return(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:l("Discount, %"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:e,dependencies:a,rules:d,className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"Percent02Icon",component:o.icons$Percent02Icon,size:16,strokeWidth:s}),placeholder:l("Discount, %"),inputMode:"decimal",allowClear:Ft})})})},Zl=({name:e,iconStrokeWidth:i})=>{const{__:s}=r.useI18n(),l=(0,n.useMemo)(()=>[{validator:async(a,d)=>{const c=typeof d=="string"?d.trim():"";if(c&&!Yi(c))throw new Error(s("Price currency must be a three-letter ISO 4217 code, for example USD"))}}],[s]);return(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:s("Price currency"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:e,rules:l,getValueProps:am,className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Select,{options:nm,placeholder:s("Price currency"),prefix:(0,t.jsx)(r.EmIcons,{icon:"Globe02Icon",component:o.icons$Globe02Icon,size:16,strokeWidth:i}),showSearch:lm,allowClear:!0,getPopupContainer:xt})})})},dm=({onAdd:e})=>{const{__:i}=r.useI18n(),s=(0,n.useCallback)(()=>e(ai()),[e]);return(0,t.jsx)(o.ui_kit$Button,{type:"text",block:!0,className:"selected-social-form__add-bar",icon:(0,t.jsx)(r.EmIcons,{icon:"AddSlide",component:o.icons$AddSlide}),onClick:s,children:i("Add card")})},cm=({field:e,index:i,form:s,isSingleImagePreview:l,onRemove:a})=>{const{__:d}=r.useI18n(),c=r.useAppConfig(),p=(0,n.useMemo)(()=>[e.name,"image"],[e.name]),g=(0,n.useMemo)(()=>["cards",e.name,"image"],[e.name]),b=(0,n.useMemo)(()=>[e.name,"headline"],[e.name]),k=(0,n.useMemo)(()=>[e.name,"url"],[e.name]),h=(0,n.useMemo)(()=>[e.name,"price"],[e.name]),m=(0,n.useMemo)(()=>["cards",e.name,"price"],[e.name]),S=(0,n.useMemo)(()=>[e.name,"discountPercent"],[e.name]),x=(0,n.useMemo)(()=>[e.name,"priceCurrency"],[e.name]),f=(0,n.useMemo)(()=>[e.name,"id"],[e.name]),y=(0,n.useMemo)(()=>[{validator:async(N,B)=>{const C=typeof B=="string"?B.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,t.jsxs)("div",{className:"selected-social-form__card",children:[(0,t.jsxs)("div",{className:"selected-social-form__card-head",children:[(0,t.jsx)(Zu,{className:"selected-social-form__card-title",children:l?d("Single image preview"):`${d("Card")} ${i+1}`}),!l&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:d("Delete"),placement:"top",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Button,{type:"text",className:"selected-social-form__card-head-remove",icon:(0,t.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:18,strokeWidth:c.iconStrokeWidth}),"aria-label":d("Delete"),onClick:v})})]}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:d("Image"),placement:"top",getPopupContainer:xt,children:(0,t.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,t.jsx)(Pt,{form:s,label:d("Image"),name:p,watchPath:g})})}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:d("Headline"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:b,className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"ElementTitle",component:o.icons$ElementTitle,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Headline"),allowClear:Ft})})}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:d("Link"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:k,className:"selected-social-form__card-field",rules:y,children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"Link03",component:o.icons$Link03,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Enter link"),allowClear:Ft})})}),!l&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:d("Price"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:h,className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"CreditCard02Icon",component:o.icons$CreditCard02Icon,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Price"),allowClear:Ft})})}),(0,t.jsx)(Ql,{name:S,pricePath:m,iconStrokeWidth:c.iconStrokeWidth}),(0,t.jsx)(Zl,{name:x,iconStrokeWidth:c.iconStrokeWidth})]}),(0,t.jsx)(o.ui_kit$Form.Item,{name:f,hidden:!0,children:(0,t.jsx)(o.ui_kit$Input,{})})]})};function ea({iconStrokeWidth:e}){const{__:i}=r.useI18n();return(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:i("Discount code"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"discountCode",className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"Sale04Icon",component:o.icons$Sale04Icon,size:16,strokeWidth:e}),placeholder:i("Discount code"),allowClear:Ft})})})}var um=({className:e="",isActive:i=!0,email:s})=>{const{__:l}=r.useI18n(),a=r.useAppConfig(),d=r.useEditorLocked(),c=r.useEditorLockCheck(),{document:p}=r.useDocumentSessionContext(),g=r.useNotification(),[b]=o.ui_kit$Form.useForm(),k=(0,n.useRef)(null),h=(0,n.useRef)(!1),m=(0,n.useRef)(null),[S,x]=(0,n.useState)(!1),f=o.ui_kit$Form.useWatch("annotationType",b),y=o.ui_kit$Form.useWatch("annotationLogo",b),v=o.ui_kit$Form.useWatch("description",b),N=o.ui_kit$Form.useWatch("discountCode",b),B=o.ui_kit$Form.useWatch("availabilityStarts",b),C=o.ui_kit$Form.useWatch("availabilityEnds",b),$=o.ui_kit$Form.useWatch("offerPageUrl",b),U=o.ui_kit$Form.useWatch("merchantHomepageUrl",b),L=o.ui_kit$Form.useWatch("cards",b),F=JSON.stringify(L??[]),P=(0,n.useMemo)(()=>JSON.parse(F)??[],[F]),H=f||Ye.PRODUCT_CAROUSEL,ae=H===Ye.PRODUCT_CAROUSEL||H===Ye.SINGLE_IMAGE_PREVIEW,T=H===Ye.DEAL_ANNOTATION||H===Ye.DEAL_CARD,te=H===Ye.DEAL_CARD,xe=H===Ye.DEAL_ANNOTATION,be=H===Ye.SINGLE_IMAGE_PREVIEW,ye=H===Ye.SINGLE_IMAGE_PREVIEW?tm:em,me=(0,n.useMemo)(()=>[{value:Ye.PRODUCT_CAROUSEL,label:l("Product carousel")},{value:Ye.SINGLE_IMAGE_PREVIEW,label:l("Single image preview")},{value:Ye.DEAL_ANNOTATION,label:l("Deal Annotation")},{value:Ye.DEAL_CARD,label:l("Deal Card")}],[l]),he=(0,n.useMemo)(()=>{let X="";p&&(X=p.getContent()),!X&&s?.html&&(X=s.html);const Z=X.match(/<title[^>]*>([\s\S]*?)<\/title>/i),J=Z?Z[1].trim():s?.title||s?.subject||"";return Uu(J)},[p,s?.html,s?.title,s?.subject]),ke=(0,n.useMemo)(()=>Kl({annotationType:H,annotationLogo:y,description:v,discountCode:N,availabilityStarts:B,availabilityEnds:C,offerPageUrl:$,merchantHomepageUrl:U,cards:P}),[H,y,v,N,B,C,$,U,P]),ce=(0,n.useMemo)(()=>ae?Qu(P,l):[],[ae,P,l]),ze=(0,n.useMemo)(()=>cu(ke)&&ce.length===0,[ke,ce]),Oe=(0,n.useMemo)(()=>[...Ju(ke,l),...ce],[ke,ce,l]),ve=(0,n.useMemo)(()=>l("Learn more about %s").split("%s"),[l]),Ee=(0,n.useCallback)(()=>{!p||c()||!qu(p)||(b.setFieldsValue(Xl(H)),m.current={emailId:s?.id,markup:null},x(!1),g.success(l("Gmail annotations were removed from the template code.")))},[p,c,b,H,s?.id,g,l]);(0,n.useEffect)(()=>{if(!ae)return;const X=b.getFieldValue("cards")??[];if(H===Ye.SINGLE_IMAGE_PREVIEW){if(X.length>1){b.setFieldsValue({cards:[X[0]]});return}X.length===0&&b.setFieldsValue({cards:[ai()]});return}X.length===0&&b.setFieldsValue({cards:[ai()]})},[b,ae,H,P]);const pe=(0,n.useCallback)(X=>{if(!X||!h.current||!p||c())return!1;const Z=Xu(p,Kl(X));if(Z){const J=Hl(p.getContent());m.current={emailId:s?.id,markup:J},x(J!==null)}return Z},[p,c,s?.id]),Q=(0,n.useCallback)(()=>{pe(b.getFieldsValue(!0))&&g.success(l("Gmail annotation was successfully applied to the template code."))},[pe,b,g,l]);return(0,n.useEffect)(()=>{if(!i)return;const X=Hu(p?.getContent()||s?.html||""),Z={emailId:s?.id,markup:X?Hl(X):null};if(x(Z.markup!==null),!Ku(m.current,Z))return;m.current=Z,h.current=!1;const J=X?Eu(X):null;b.setFieldsValue(J?Yu(J):Xl()),h.current=!0},[i,s?.id,s?.html,p,b]),(0,t.jsxs)("div",{className:(0,We.default)("selected-social-form","annotations-panel",e),ref:k,children:[(0,t.jsx)(Vu,{data:ke,subjectLine:he,parentRef:k,overlayTargetSelector:"#pane-content-iframe",onApply:Q,applyDisabled:!ze||d,applyBlockers:Oe,onRemove:S&&!d?Ee:void 0,visible:i}),(0,t.jsxs)(o.ui_kit$Form,{form:b,layout:"vertical",className:"selected-social-form__form element-controls",autoComplete:"off",disabled:d,children:[(0,t.jsxs)("div",{className:"selected-social-form__section",children:[(0,t.jsx)("div",{className:"selected-social-form__section-title",children:l("General settings")}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:l("Annotation type"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"annotationType",className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Select,{options:me,placeholder:l("Annotation type"),getPopupContainer:xt})})}),!te&&(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:l("Organization logo"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,t.jsx)(Pt,{form:b,label:l("Organization logo"),name:"annotationLogo",watchPath:im})})}),(be||xe)&&(0,t.jsx)(ea,{iconStrokeWidth:a.iconStrokeWidth}),be&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:l("Price"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:Jl,className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"CreditCard02Icon",component:o.icons$CreditCard02Icon,size:16,strokeWidth:a.iconStrokeWidth}),placeholder:l("Price"),allowClear:Ft})})}),(0,t.jsx)(Ql,{name:rm,pricePath:Jl,iconStrokeWidth:a.iconStrokeWidth}),(0,t.jsx)(Zl,{name:sm,iconStrokeWidth:a.iconStrokeWidth})]}),T&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:l("Discount description"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"description",className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"CommentOutlined",component:o.icons$CommentOutlined,size:16,strokeWidth:a.iconStrokeWidth}),placeholder:l("Discount description"),allowClear:Ft})})}),te&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ea,{iconStrokeWidth:a.iconStrokeWidth}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:l("Offer page URL"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"offerPageUrl",className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"Link03",component:o.icons$Link03,size:16,strokeWidth:a.iconStrokeWidth}),placeholder:l("Offer page URL"),allowClear:Ft})})}),(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:l("Merchant homepage URL"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"merchantHomepageUrl",className:"selected-social-form__card-field",children:(0,t.jsx)(o.ui_kit$Input,{prefix:(0,t.jsx)(r.EmIcons,{icon:"Link03",component:o.icons$Link03,size:16,strokeWidth:a.iconStrokeWidth}),placeholder:l("Merchant homepage URL"),allowClear:Ft})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:l("Starts"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"availabilityStarts",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DatePicker,{showTime:!0,placeholder:l("Starts"),style:ql,getPopupContainer:xt})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:Tt,title:l("Ends"),placement:"bottom",getPopupContainer:xt,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"availabilityEnds",className:"form-item-margin-xs",children:(0,t.jsx)(o.ui_kit$DatePicker,{showTime:!0,placeholder:l("Ends"),style:ql,getPopupContainer:xt})})})})]})]})]}),ae&&(0,t.jsxs)("div",{className:(0,We.default)("selected-social-form__section",{"selected-social-form__section--bordered":!be,"annotations-panel__cards-section":be}),children:[H===Ye.PRODUCT_CAROUSEL&&(0,t.jsxs)("div",{className:"selected-social-form__section-title",children:[l("Promotion cards"),(0,t.jsx)("span",{className:"annotations-panel__section-hint",children:l("max 10")})]}),(0,t.jsx)(o.ui_kit$Form.List,{name:"cards",children:(X,{add:Z,remove:J})=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"selected-social-form__items",children:X.map((V,M)=>(0,t.jsx)(cm,{field:V,index:M,form:b,isSingleImagePreview:be,onRemove:J},V.key))}),!be&&P.length<ye&&(0,t.jsx)(dm,{onAdd:Z})]})})]}),(0,t.jsxs)("div",{className:"annotations-panel__docs-hint",children:[ve[0],(0,t.jsx)("a",{href:om,target:"_blank",rel:"noopener noreferrer",children:l("Gmail annotations")}),ve[1]]})]})]})},mm={appearance:"title"},ir=({email:e,pluginOnly:i=!1})=>{const{__:s}=r.useI18n(),l=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,[a,d]=(0,n.useState)(r.SETTINGS),c=r.useAppConfig(),p=r.usePluginViewTabs("documentSettings",mm),{lastOpenedKey:g,lastOpenedStamp:b,claimNewest:k}=p,h=(0,n.useCallback)(L=>{p.activate(L),d(L||"")},[p]);(0,n.useEffect)(()=>{g&&(k(),d(g))},[g,b,k]);const m=(0,n.useRef)(!1);(0,n.useEffect)(()=>{if(!m.current&&p.openedKnown){m.current=!0;const L=k();L&&d(L)}},[p.openedKnown,k]);const S=!i&&c.settingsTabEnabled,x=!i&&c.UTMEnabled&&l==="email",f=!i&&c.annotationsEnabled&&l==="email",y=[S&&"Settings",x&&"UTM parameters",f&&"Annotations parameters"].filter(Boolean),v=[...y,...p.openedKeys].includes(a)?a:y[0]??"",N=p.keys[0],B=y.length===0,C=B&&p.openedKnown&&p.openedKeys.length===0,$=(0,n.useRef)(!1);(0,n.useEffect)(()=>{B||($.current=!1)},[B]),(0,n.useEffect)(()=>{C&&N&&!$.current&&($.current=!0,p.activate(N))},[C,N,p]);const U=(0,n.useMemo)(()=>{const L=[];return S&&L.push({label:(0,t.jsx)(t.Fragment,{children:s("Settings")}),key:r.SETTINGS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,t.jsx)(wl,{className:"email-settings__collapse-panel-content",element:e})}),x&&L.push({label:(0,t.jsx)(t.Fragment,{children:s("UTM parameters")}),key:r.UTM_PARAMETERS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,t.jsx)(Al,{className:"email-settings__collapse-panel-content",email:e})}),f&&L.push({label:(0,t.jsx)(t.Fragment,{children:s("Annotations")}),key:r.ANNOTATIONS_PARAMETERS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,t.jsx)(um,{className:"email-settings__collapse-panel-content",email:e,isActive:v===r.ANNOTATIONS_PARAMETERS})}),L.push(...p.tabs()),L},[s,e,S,x,f,v,p]);return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse",size:"large",activeKey:v,onChange:h,items:U})})};ir.propTypes={};var ta=320,pm=1200,hm=350,{backgroundColor:oa,backgroundImage:rr,backgroundPositionX:sr,backgroundPositionY:lr,backgroundRepeat:ni,backgroundSize:ar,responsive:bm,backgroundColorContent:gm,width:nr}={backgroundColor:"backgroundColor",backgroundImage:"backgroundImage",backgroundPositionX:"backgroundPositionX",backgroundPositionY:"backgroundPositionY",backgroundRepeat:"backgroundRepeat",backgroundSize:"backgroundSize",responsive:"responsive",backgroundColorContent:"backgroundColorContent",width:"width"},fm={[oa]:"",[rr]:"",[sr]:"",[lr]:"",[ni]:"checked",[ar]:"",[gm]:"",[nr]:""};function dr(e){const i=Number(e);return Number.isNaN(i)?null:{value:i,dim:"px"}}var ia=({className:e=""})=>{const{__:i}=r.useI18n(),{token:s}=(0,o.ui_kit$useToken)(),l=r.useDispatch(),a=r.useAppConfig(),[d]=o.ui_kit$Form.useForm(),c=r.useSendPostMessage(),p=r.useEmailAttribute("common_styles"),g=r.useSelector(r.selectEmailSettings),b=r.useSelector(r.selectIsSettingsDisabled$1),k=r.useSelector(r.selectActiveSettingsTab),h=r.useSelector(r.selectIsNeedUpdateAppearance),[m,S]=(0,n.useState)(!0),x=(0,n.useRef)(!1),f=(0,n.useRef)(null),y=i("Email not yet loaded or global container not found.");(0,n.useEffect)(()=>{h&&(l(r.setIsNeedUpdateAppearance(!1)),c({operation:r.EVENT_TYPES.INIT_PREVIEW}))},[d,h,l,c,p]),(0,n.useEffect)(()=>()=>{f.current&&clearTimeout(f.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"}],N=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}];(0,n.useEffect)(()=>{const{width:H,...ae}=g,T={...ae,backgroundImage:g.backgroundImage?g.backgroundImage[0]?.value:"",backgroundRepeat:g[ni]===""?"repeat":g[ni],backgroundSize:g[ar],responsive:g.responsive?.shutdown};x.current||(T.width=H?.value,T.widthDim=H?.dim),d.setFieldsValue(T),S(!g.backgroundImage)},[g,d]);const B=(0,n.useCallback)(H=>{const ae=dr(H);!ae||ae.value<ta||c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{width:ae}})},[c]),C=(0,n.useCallback)(H=>{const ae=dr(H);ae&&l(r.setEmailSettings({...g,width:ae}))},[l,g]),$=(0,n.useCallback)(H=>{f.current&&clearTimeout(f.current),C(H),f.current=setTimeout(()=>{B(H)},hm)},[B,C]),U=H=>{const ae=d.getFieldsValue(!0),T=Object.keys(H)[0];switch(T){case nr:$(H[T]);break;case sr:case lr:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[T]:H[T]===""?"none":H[T]}});break;case rr:S(H[T]===""),c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[T]:[{...g?.backgroundImage?.[0],type:"url",value:H[T]}],backgroundSize:"cover"}});break;case bm:{const te=dr(ae.width);c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{responsive:{shutdown:H[T],styles:H[T]},...te?{width:te}:{}}});break}default:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:H})}},L=H=>{l(r.setMobileViewActive({shutdown:H,styles:H})),c({operation:r.EVENT_TYPES.SANDBOX_IFRAME_SETSIZE,settings:{iframeWidth:document.querySelector(".email-pane__iframe").getBoundingClientRect().width}})},F=()=>{x.current=!0},P=()=>{f.current&&(clearTimeout(f.current),f.current=null);const H=d.getFieldValue(nr);C(H),B(H),requestAnimationFrame(()=>{x.current=!1})};return(0,t.jsx)("div",{className:(0,We.default)("appearance-panel",{[e]:e}),children:(0,t.jsxs)(o.ui_kit$Form,{form:d,layout:"vertical",name:"appearance_panel_form",initialValues:{remember:!1,...fm},onValuesChange:U,autoComplete:"off",className:"element-controls",children:[b?(0,t.jsx)(o.ui_kit$Alert,{style:{marginBottom:"24px"},title:y,type:"error"}):null,(0,t.jsx)(o.ui_kit$FormSection,{title:i("Email layout width"),dividerTop:!1,children:(0,t.jsx)(o.ui_kit$Row,{gutter:10,children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:g.width?.value?i("This field sets the width of the email."):i("Couldn`t determine the email width"),placement:"right",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"width",style:{marginBottom:s.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$InputNumber,{min:ta,max:pm,placeholder:i("Width"),disabled:!g.width?.value,addonAfter:"px",onFocus:F,onBlur:P})})})})})}),a.emailResponsiveControlEnabled&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Row,{gutter:20,children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"responsive",valuePropName:"checked",children:(0,t.jsx)(o.ui_kit$Switch,{id:"responsive",label:i("Responsive email"),size:"small",name:"responsive",disabled:g.responsive?.shutdown===void 0,onChange:L})})})}),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider"})]}),(0,t.jsx)(o.ui_kit$FormSection,{title:i("Email background color"),dividerTop:!a.emailResponsiveControlEnabled,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:m?16:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:oa,style:{marginBottom:s.formItemMarginBottomXS},rules:[{message:i("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:g.usedColors,disabled:b})})})}),(0,t.jsx)(o.ui_kit$Col,{span:m?12:24,children:a.formEmailFieldBackgroundImageEnabled&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Pt,{form:d,label:i("Background image"),name:rr,tooltipTitle:i("Background image"),disabled:b||k!=="Styles",elementSettings:g}),!m&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:"0"},children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Horizontal position"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:sr,style:{marginBottom:s.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:i("Horizontal position"),prefix:(0,t.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:o.icons$BgPositionHorizontal})})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Vertical position"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:lr,style:{marginBottom:s.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$Input,{placeholder:i("Vertical position"),prefix:(0,t.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:o.icons$BgPositionVertical})})})})})]})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Background image repeat"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:ni,children:(0,t.jsx)(o.ui_kit$Select,{placeholder:i("Please select"),disabled:b,options:v})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Background image size"),placement:"top",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:ar,children:(0,t.jsx)(o.ui_kit$Select,{placeholder:i("Please select"),disabled:b,options:N})})})})]})]})]})})]})})]})})};ia.propTypes={className:_.default.string};var{Option:ra}=o.ui_kit$Select,{width:sa,widthDim:_m}={width:"width",widthDim:"widthDim"},xm={[sa]:"",[_m]:""},la=({className:e=""})=>{const{__:i}=r.useI18n(),s=r.useSelector(r.selectBlockSettings),l=r.useSelector(r.selectIsSettingsDisabled),[a]=o.ui_kit$Form.useForm(),d=r.useSendPostMessage(),c=i("Block not yet loaded or global container not found.");(0,n.useEffect)(()=>{a.setFieldsValue({width:s.width.value,widthDim:s.width.dim})},[s,a]);const p=g=>{const b=a.getFieldsValue(!0),k=Object.keys(g)[0];let h;switch(k){case"width":h={[k]:{value:g[k],dim:b.widthDim}};break;case"widthDim":h={width:{value:b.width,dim:g[k]}};break;default:return}d({operation:r.EVENT_TYPES.SANDBOX_BLOCK_SETTINGS_SET,settings:h})};return(0,t.jsx)("div",{className:(0,We.default)("block-appearance-panel",{[e]:e}),children:(0,t.jsxs)(o.ui_kit$Form,{form:a,layout:"vertical",name:"block_appearance_panel_form",initialValues:{remember:!1,...xm},onValuesChange:p,autoComplete:"off",children:[l?(0,t.jsx)(o.ui_kit$Alert,{style:{marginBottom:"24px"},title:c,type:"error"}):null,(0,t.jsx)(o.ui_kit$Form.Item,{label:i("Container width"),name:sa,tooltip:{title:i("Specifies the block width."),icon:(0,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},rules:[{message:i("Please input container width")}],children:(0,t.jsx)(o.ui_kit$Input,{disabled:l,placeholder:i("Container width"),addonAfter:(0,t.jsx)(o.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:(0,t.jsxs)(o.ui_kit$Select,{className:"select-after",children:[(0,t.jsx)(ra,{value:"px",children:"px"}),(0,t.jsx)(ra,{value:"%",children:"%"})]})})})})]})})};la.propTypes={className:_.default.string};var km=()=>{};function aa(){const e=r.useContainer(),i=(0,n.useCallback)(l=>{if(!e)return km;const a=r.provideDefaultCommonStyles(e).watch(l);return()=>a.dispose()},[e]),s=(0,n.useCallback)(()=>r.getDefaultCommonStyles(e),[e]);return(0,n.useSyncExternalStore)(i,s,s)}function na(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function cr(e,i){const s={...e};for(const l of Object.keys(i)){const a=i[l],d=e[l];na(a)&&na(d)?s[l]=cr(d,a):a!==void 0&&(s[l]=a)}return s}function da(e,i){const s=r.COMMON_STYLES;if(typeof e=="string"){const l=e.trim();if(l.startsWith("{"))try{const a=JSON.parse(l);if(a&&typeof a=="object"&&!Array.isArray(a)&&Object.keys(a).length>0)return cr(s,a)}catch{}}return i&&typeof i=="object"&&!Array.isArray(i)?cr(s,i):s}var ca=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||"#1C52DC",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||"#1C52DC",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||"#1C52DC",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}),Em={buttons_borderRadiusAll:"all",buttons_borderRadiusTopLeft:"topLeft",buttons_borderRadiusBottomLeft:"bottomLeft",buttons_borderRadiusTopRight:"topRight",buttons_borderRadiusBottomRight:"bottomRight"},Sm={cards_borderRadiusAll:"all",cards_borderRadiusTopLeft:"topLeft",cards_borderRadiusBottomLeft:"bottomLeft",cards_borderRadiusTopRight:"topRight",cards_borderRadiusBottomRight:"bottomRight"},Bm={blockPaddingTop:"top",blockPaddingLeft:"left",blockPaddingRight:"right",blockPaddingBottom:"bottom"},Rm=({className:e})=>{const{__:i}=r.useI18n(),s=W.useGoogleFontsLoader(),l=r.useDispatch(),a=r.useSendPostMessage(),[d]=o.ui_kit$Form.useForm(),c=r.useSelector(r.selectEmailSettings),p=r.useSelector(r.selectIsNeedUpdateContentAppearance),g=aa(),b=r.useEmailAttribute("common_styles"),k=r.useAppConfig(),{token:h}=(0,o.ui_kit$useToken)(),[m,S]=(0,n.useState)({}),[x,f]=(0,n.useState)({}),[y,v]=(0,n.useState)(!0),[N,B]=(0,n.useState)(!0),[C,$]=(0,n.useState)(!1),[U,L]=(0,n.useState)(!1),F={buttonsPaddingTop:"top",buttonsPaddingLeft:"left",buttonsPaddingRight:"right",buttonsPaddingBottom:"bottom"},P=da(b,g),[H,ae]=(0,n.useState)(P.headings.bold),[T,te]=(0,n.useState)(P.headings.italic),[xe,be]=(0,n.useState)(P.links.underline),[ye,me]=(0,n.useState)(P.buttons.bold),[he,ke]=(0,n.useState)(P.buttons.italic),[ce,ze]=(0,n.useState)(null),Oe=r.useSelector(r.selectIsPanelHistoryCollapsed);(0,n.useEffect)(()=>{Oe||ze(null)},[P,ze,Oe]),(0,n.useEffect)(()=>{Oe&&!ce&&ze(ca(P))},[P,ce,Oe]),(0,n.useEffect)(()=>{p&&(l(r.setIsNeedUpdateContentAppearance(!1)),d.setFieldsValue(ca(P)))},[d,p,l,P]);const[ve,Ee]=(0,n.useState)(Math.min(P.headings.fontSize-1,19)),[pe,Q]=(0,n.useState)(Math.max(P.text.fontSize+1,20));(0,n.useEffect)(()=>{if(ce){const V=ce.buttonsBorder;S(V);const M=Object.keys(V).find(ee=>V[ee]?.width||V[ee]?.style||V[ee]?.color),Y=ce.cardsBorder;f(Y);const K=Object.keys(Y).find(ee=>Y[ee]?.width||Y[ee]?.style||Y[ee]?.color);d.setFieldsValue({buttons_borderPosition:M||"all",buttons_borderWidth:V[M]?.width!==null?V[M]?.width:"",buttons_borderColor:V[M]?.color||"",buttons_borderStyle:V[M]?.style||"",cards_borderPosition:K||"all",cards_borderWidth:Y[K]?.width!==null?Y[K]?.width:"",cards_borderColor:Y[K]?.color||"",cards_borderStyle:Y[K]?.style||"",buttons_borderRadiusAll:u(ce.buttonsBorderRadius.all),buttons_borderRadiusTopLeft:u(ce.buttonsBorderRadius.topLeft),buttons_borderRadiusBottomLeft:u(ce.buttonsBorderRadius.bottomLeft),buttons_borderRadiusTopRight:u(ce.buttonsBorderRadius.topRight),buttons_borderRadiusBottomRight:u(ce.buttonsBorderRadius.bottomRight),cards_borderRadiusAll:u(ce.cardsBorderRadius.all),cards_borderRadiusTopLeft:u(ce.cardsBorderRadius.topLeft),cards_borderRadiusBottomLeft:u(ce.cardsBorderRadius.bottomLeft),cards_borderRadiusTopRight:u(ce.cardsBorderRadius.topRight),cards_borderRadiusBottomRight:u(ce.cardsBorderRadius.bottomRight),blockPaddingAll:u(ce.blockPaddingAll),blockPaddingTop:u(ce.blockPaddingTop),blockPaddingRight:u(ce.blockPaddingRight),blockPaddingBottom:u(ce.blockPaddingBottom),blockPaddingLeft:u(ce.blockPaddingLeft),blockPaddingLeftRight:u(ce.blockPaddingRight)||u(ce.blockPaddingLeft),blockPaddingTopBottom:u(ce.blockPaddingTop)||u(ce.blockPaddingBottom)}),!u(ce.blockPaddingAll)&&(u(ce.blockPaddingTop)||u(ce.blockPaddingRight)||u(ce.blockPaddingBottom)||u(ce.blockPaddingLeft))&&(ce.blockPaddingTop!==ce.blockPaddingBottom||ce.blockPaddingRight!==ce.blockPaddingLeft)?L(!1):L(!0),!u(ce.buttonsBorderRadius.all)&&(u(ce.buttonsBorderRadius.topLeft)||u(ce.buttonsBorderRadius.bottomLeft)||u(ce.buttonsBorderRadius.topRight)||u(ce.buttonsBorderRadius.bottomRight))?v(!1):v(!0),ce.buttonsPadding&&!u(ce.buttonsPadding.all)&&(u(ce.buttonsPadding.bottom)||u(ce.buttonsPadding.right)||u(ce.buttonsPadding.left)||u(ce.buttonsPadding.top))&&$(!1),!u(ce.cardsBorderRadius?.all)&&(u(ce.cardsBorderRadius?.topLeft)||u(ce.cardsBorderRadius?.bottomLeft)||u(ce.cardsBorderRadius?.topRight)||u(ce.cardsBorderRadius?.bottomRight))?B(!1):B(!0)}},[d,ce]);const X=()=>{L(M=>!M);const V=d.getFieldsValue(!0);if(!U){V.blockPaddingLeftRight=V.blockPaddingLeft,V.blockPaddingTopBottom=V.blockPaddingTop,V.blockPaddingRight=V.blockPaddingLeft,V.blockPaddingBottom=V.blockPaddingTop;const M=Number(V.blockPaddingTopBottom),Y=Number(V.blockPaddingLeftRight);a({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{blockPadding:{top:Number.isFinite(M)?M:0,bottom:Number.isFinite(M)?M:0,left:Number.isFinite(Y)?Y:0,right:Number.isFinite(Y)?Y:0}}})}},Z=V=>{const M=V.target.closest("button");if(!M)return;const Y=M.name,K=M.classList.contains("selected-td-form__button--active");M.className=K?"ant-btn ant-btn-default":"ant-btn ant-btn-default selected-td-form__button--active";try{M.blur()}catch{}Y==="headingBold"?ae(!K):Y==="headingItalic"?te(!K):Y==="linkUnderline"?be(!K):Y==="buttonsBold"?me(!K):Y==="buttonsItalic"&&ke(!K),a({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[Y]:!K}})},J=V=>{const M=d.getFieldsValue(!0),Y=Object.keys(V)[0];let K={};switch(Y){case"headingFontSize":Ee(Math.min(M.headingFontSize-1,19)),K=V;break;case"textFontSize":Q(Math.max(M.textFontSize+1,20)),K=V;break;case"buttons_borderStyle":K={buttonsBorder:{[M.buttons_borderPosition]:{...m[M.buttons_borderPosition],style:V[Y]}}},M.buttons_borderPosition==="all"?S(ee=>({...r.RESET_BORDER_PARAMS,[M.buttons_borderPosition]:{...ee[M.buttons_borderPosition],style:V[Y]}})):S(ee=>({...ee,[M.buttons_borderPosition]:{...ee[M.buttons_borderPosition],style:V[Y]}}));break;case"buttons_borderColor":K={buttonsBorder:{[M.buttons_borderPosition]:{...m[M.buttonsBorderPosition],color:V[Y]}}},M.buttons_borderPosition==="all"?S(ee=>({...r.RESET_BORDER_PARAMS,[M.buttons_borderPosition]:{...ee[M.buttons_borderPosition],color:V[Y]}})):S(ee=>({...ee,[M.buttons_borderPosition]:{...ee[M.buttons_borderPosition],color:V[Y]}}));break;case"buttons_borderWidth":K={buttonsBorder:{[M.buttons_borderPosition]:{...m[M.buttons_borderPosition],width:V[Y]}}},M.buttonsBorderPosition==="all"?S(ee=>({...r.RESET_BORDER_PARAMS,[M.buttons_borderPosition]:{...ee[M.buttons_borderPosition],width:V[Y]}})):S(ee=>({...ee,[M.buttons_borderPosition]:{...ee[M.buttons_borderPosition],width:V[Y]}}));break;case"buttons_borderPosition":d.setFieldsValue({buttons_borderWidth:m[V[Y]]?.width||"",buttons_borderColor:m[V[Y]]?.color||"",buttons_borderStyle:m[V[Y]]?.style||""});break;case"cards_borderStyle":K={cardsBorder:{[M.cards_borderPosition]:{...x[M.cards_borderPosition],style:V[Y]}}},M.cards_borderPosition==="all"?f(ee=>({...r.RESET_BORDER_PARAMS,[M.cards_borderPosition]:{...ee[M.cards_borderPosition],style:V[Y]}})):f(ee=>({...ee,[M.cards_borderPosition]:{...ee[M.cards_borderPosition],style:V[Y]}}));break;case"cards_borderColor":K={cardsBorder:{[M.cards_borderPosition]:{...x[M.cardsBorderPosition],color:V[Y]}}},M.cards_borderPosition==="all"?f(ee=>({...r.RESET_BORDER_PARAMS,[M.cards_borderPosition]:{...ee[M.cards_borderPosition],color:V[Y]}})):f(ee=>({...ee,[M.cards_borderPosition]:{...ee[M.cards_borderPosition],color:V[Y]}}));break;case"cards_borderWidth":K={cardsBorder:{[M.cards_borderPosition]:{...x[M.cards_borderPosition],width:V[Y]}}},M.cardsBorderPosition==="all"?f(ee=>({...r.RESET_BORDER_PARAMS,[M.cards_borderPosition]:{...ee[M.cards_borderPosition],width:V[Y]}})):f(ee=>({...ee,[M.cards_borderPosition]:{...ee[M.cards_borderPosition],width:V[Y]}}));break;case"cards_borderPosition":d.setFieldsValue({cards_borderWidth:x[V[Y]]?.width||"",cards_borderColor:x[V[Y]]?.color||"",cards_borderStyle:x[V[Y]]?.style||""});break;case"buttons_borderRadiusAll":case"buttons_borderRadiusTopLeft":case"buttons_borderRadiusBottomLeft":case"buttons_borderRadiusTopRight":case"buttons_borderRadiusBottomRight":K={buttonsBorderRadius:{[Em[Y]]:+V[Y]}};break;case"cards_borderRadiusAll":case"cards_borderRadiusTopLeft":case"cards_borderRadiusBottomLeft":case"cards_borderRadiusTopRight":case"cards_borderRadiusBottomRight":K={cardsBorderRadius:{[Sm[Y]]:+V[Y]}};break;case"buttonsPaddingTop":case"buttonsPaddingLeft":case"buttonsPaddingRight":case"buttonsPaddingBottom":C?(K={padding:{all:+V[Y]}},d.setFieldsValue({paddingTop:V[Y],paddingLeft:V[Y],paddingRight:V[Y],paddingBottom:V[Y]})):K={buttonsPadding:{[F[Y]]:+V[Y]}};break;case"blockPaddingTop":case"blockPaddingLeft":case"blockPaddingRight":case"blockPaddingBottom":K={blockPadding:{[Bm[Y]]:+V[Y]}};break;case"blockPaddingTopBottom":K={blockPadding:{top:+V[Y],bottom:+V[Y]}},M.blockPaddingTop=M.blockPaddingBottom=+V[Y];break;case"blockPaddingLeftRight":K={blockPadding:{left:+V[Y],right:+V[Y]}},M.blockPaddingLeft=M.blockPaddingRight=+V[Y];break;default:K=V}Y!=="buttons_borderPosition"&&a({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:K})};return ce&&(0,t.jsx)("div",{className:(0,We.default)("appearance-panel",{[e]:e}),children:(0,t.jsxs)(o.ui_kit$Form,{form:d,layout:"vertical",name:"content_appearance_panel_form",initialValues:ce,onValuesChange:J,autoComplete:"off",className:"element-controls",children:[null,(0,t.jsxs)(o.ui_kit$FormSection,{title:i("Blocks"),dividerTop:!1,children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Blocks background color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"blockBackgroundColor",style:{marginBottom:h.formItemMarginBottomMD+4},rules:[{message:i("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color of the contrast blocks"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"blockContrastBackgroundColor",style:{marginBottom:h.formItemMarginBottomMD+4},rules:[{message:i("Please set the background color")}],children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})})]}),(0,t.jsx)(o.ui_kit$FormPaddingInputs,{extended:U,onToggleExtended:X,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,t.jsxs)(o.ui_kit$FormSection,{title:i("General text"),dividerTop:!0,children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Font of the general text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textFontFamily",style:{marginBottom:h.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{loadGoogleFonts:s,getPopupContainer:V=>V.closest(".email-pane__content-col")})})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Font size of the general text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textFontSize",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:15,max:ve,placeholder:i("Font size"),prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Line height of the general text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textLineHeight",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,t.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Color of the general text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Text color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrast block text color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textContrastColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Text color"),usedColors:c.usedColors})})})})]}),(0,t.jsx)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom padding of the general text"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"textPaddingBottom",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom padding"),prefix:(0,t.jsx)(r.EmIcons,{icon:"PaddingBottom",component:o.icons$PaddingBottom}),addonAfter:"px"})})})})})]}),(0,t.jsxs)(o.ui_kit$FormSection,{title:i("Headings"),dividerTop:!0,children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading font"),placement:"left",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingFontFamily",style:{marginBottom:h.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{loadGoogleFonts:s,getPopupContainer:V=>V.closest(".email-pane__content-col")})})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingFontSize",style:{marginBottom:h.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:pe,max:40,placeholder:i("Font size"),prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading line height"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingLineHeight",style:{marginBottom:h.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,t.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:o.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading letter spacing"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingLetterSpacing",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Letter spacing"),prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsxs)(o.ui_kit$Space,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:i("Strong"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)({"selected-td-form__button--active":H}),type:"default",name:"headingBold",onClick:Z,children:(0,t.jsx)(r.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined})})}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:i("Italic"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)({"selected-td-form__button--active":T}),type:"default",name:"headingItalic",onClick:Z,children:(0,t.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined})})})]})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Heading color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrast block header color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingContrastColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Heading color"),usedColors:c.usedColors})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Top padding"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingPaddingTop",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Top padding"),prefix:(0,t.jsx)(r.EmIcons,{icon:"PaddingTop",component:o.icons$PaddingTop}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom padding"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"headingPaddingBottom",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom padding"),prefix:(0,t.jsx)(r.EmIcons,{icon:"PaddingBottom",component:o.icons$PaddingBottom}),addonAfter:"px"})})})})]})]}),(0,t.jsxs)(o.ui_kit$FormSection,{title:i("Links"),dividerTop:!0,children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Link color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"linkColor",style:{marginBottom:h.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Link color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:i("Underline"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)({"selected-td-form__button--active":xe}),type:"default",name:"linkUnderline",onClick:Z,children:(0,t.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:o.icons$UnderlineOutlined})})})})]}),(0,t.jsx)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Link color in contrasting blocks"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"linkContrastColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Link color"),usedColors:c.usedColors})})})})})]}),(0,t.jsxs)(o.ui_kit$FormSection,{title:(0,t.jsxs)(t.Fragment,{children:[i("Buttons")," ",(0,t.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Text & background")]}),dividerTop:!0,children:[(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons font"),placement:"left",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsFontFamily",style:{marginBottom:h.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ControlFontFamily,{loadGoogleFonts:s,getPopupContainer:V=>V.closest(".email-pane__content-col")})})}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons font size"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsFontSize",style:{marginBottom:h.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Font size"),prefix:(0,t.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:o.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons letter spacing"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsLetterSpacing",style:{marginBottom:h.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Letter spacing"),prefix:(0,t.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:o.icons$ColumnWidthOutlined}),addonAfter:"px"})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons text color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsColor",style:{marginBottom:h.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Buttons text color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Button text color in contrasting blocks"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsContrastColor",style:{marginBottom:h.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Buttons text color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons background color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsBackgroundColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Button background color in contrasting blocks"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsContrastBackgroundColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),k.formButtonFieldTextAlignEnabled&&(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(Zt,{form:d,elementSettings:{textAlign:"",type:"email"},imgParent:!1,name:"buttonsAlign",withHotKeys:!1})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsxs)(o.ui_kit$Space,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:i("Strong"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)({"selected-td-form__button--active":ye}),type:"default",name:"buttonsBold",onClick:Z,children:(0,t.jsx)(r.EmIcons,{icon:"BoldOutlined",component:o.icons$BoldOutlined})})}),(0,t.jsx)(o.ui_kit$Tooltip,{placement:"bottom",title:i("Italic"),children:(0,t.jsx)(o.ui_kit$Button,{className:(0,We.default)({"selected-td-form__button--active":he}),type:"default",name:"buttonsItalic",onClick:Z,children:(0,t.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:o.icons$ItalicOutlined})})})]})})]})]}),k.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:(0,t.jsxs)(t.Fragment,{children:[i("Buttons")," ",(0,t.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Borders")]}),dividerTop:!0,children:(0,t.jsx)("div",{style:{paddingBottom:4},children:(0,t.jsx)(W.SelectedElementFormBorder,{form:d,borders:m,namePrefix:"buttons_"})})}),k.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:(0,t.jsxs)(t.Fragment,{children:[i("Buttons")," ",(0,t.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Border radius")]}),dividerTop:!0,children:(0,t.jsx)("div",{style:{paddingBottom:4},children:(0,t.jsx)(Rt,{form:d,oneBorderRadiusValue:y,setOneBorderRadiusValue:v,elementSettings:ce,namePrefix:"buttons_"})})}),(0,t.jsx)(o.ui_kit$FormSection,{title:(0,t.jsxs)(t.Fragment,{children:[i("Buttons")," ",(0,t.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Margins")]}),dividerTop:!0,children:(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Top margin"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsMarginTop",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Top margin"),prefix:(0,t.jsx)(r.EmIcons,{icon:"PaddingTop",component:o.icons$PaddingTop}),addonAfter:"px"})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom margin"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"buttonsMarginBottom",children:(0,t.jsx)(o.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom margin"),prefix:(0,t.jsx)(r.EmIcons,{icon:"PaddingBottom",component:o.icons$PaddingBottom}),addonAfter:"px"})})})})]})}),(0,t.jsxs)(o.ui_kit$FormSection,{title:(0,t.jsxs)(t.Fragment,{children:[i("Cards")," ",(0,t.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Colors")]}),dividerTop:!0,children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:10,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$FormSection,{title:i("Base colors"),compact:!0,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Base background color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"cardsBaseBackgroundColor",style:{marginBottom:h.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Base background color"),usedColors:c.usedColors})})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$FormSection,{title:i("Contrasting colors"),compact:!0,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrasting background color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"cardsContrastBackgroundColor",style:{marginBottom:h.formItemMarginBottomXS},children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Contrasting background color"),usedColors:c.usedColors})})})})})]}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Base text color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"cardsBaseTextColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Base text color"),usedColors:c.usedColors})})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrasting text color"),placement:"bottom",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:"cardsContrastTextColor",children:(0,t.jsx)(o.ui_kit$ColorPickerInput,{placeholder:i("Contrasting text color"),usedColors:c.usedColors})})})})]})]}),k.formFieldBorderEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:(0,t.jsxs)(t.Fragment,{children:[i("Cards")," ",(0,t.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Borders")]}),dividerTop:!0,children:(0,t.jsx)("div",{style:{paddingBottom:4},children:(0,t.jsx)(W.SelectedElementFormBorder,{form:d,borders:x,namePrefix:"cards_"})})}),k.formFieldBorderRadiusEnabled&&(0,t.jsx)(o.ui_kit$FormSection,{title:(0,t.jsxs)(t.Fragment,{children:[i("Cards")," ",(0,t.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Border radius")]}),dividerTop:!0,children:(0,t.jsx)("div",{style:{paddingBottom:4},children:(0,t.jsx)(Rt,{form:d,oneBorderRadiusValue:N,setOneBorderRadiusValue:B,elementSettings:ce,namePrefix:"cards_"})})})]})})},ur=({email:e})=>{const{__:i}=r.useI18n(),s=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,[l,a]=(0,n.useState)(r.APPEARANCE),d=r.useAppConfig(),c=b=>a(b||"");e.common_styles&&e.common_styles;const p=s==="email"&&d.commonStylesEnabled&&!0;let g=[{label:(0,t.jsx)(t.Fragment,{children:i(s==="email"?"Global styles":"Block styles")}),key:r.APPEARANCE,forceRender:!0,className:"email-settings__collapse-panel",children:s==="email"?(0,t.jsx)(ia,{className:"email-settings__collapse-panel-content"}):(0,t.jsx)(la,{className:"email-settings__collapse-panel-content"})}];return p&&g.push({label:(0,t.jsx)(t.Fragment,{children:i("Content styles")}),key:"contentStyles",forceRender:!0,className:"email-settings__collapse-panel",children:(0,t.jsx)(Rm,{className:"email-settings__collapse-panel-content"})}),(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse appearance-panel__content-styles",size:"large",activeKey:l,onChange:c,items:g})})};ur.propTypes={};var Tm=at.__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((s,l)=>(s[l.toLowerCase()]=l,s),{});e.CASE_SENSITIVE_TAG_NAMES_MAP=i}));function ym(e){return e.type===lt.Tag||e.type===lt.Script||e.type===lt.Style}var lt,wm,jm,vm,Im,Cm,Pm,Am,Nm,Lm,ua=at.__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"})(lt||(lt={})),wm=lt.Root,jm=lt.Text,vm=lt.Directive,Im=lt.Comment,Cm=lt.Script,Pm=lt.Style,Am=lt.Tag,Nm=lt.CDATA,Lm=lt.Doctype}));function ma(e){return ym(e)}function pa(e){return e.type===lt.CDATA}function ha(e){return e.type===lt.Text}function ba(e){return e.type===lt.Comment}function ga(e){return e.type===lt.Directive}function fa(e){return e.type===lt.Root}function Om(e){return Object.hasOwn(e,"children")}function mr(e,i=!1){let s;if(ha(e))s=new wo(e.data);else if(ba(e))s=new ci(e.data);else if(ma(e)){const l=i?pr(e.children):[],a=new pi(e.name,{...e.attribs},l);for(const d of l)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"]}),s=a}else if(pa(e)){const l=i?pr(e.children):[],a=new mi(l);for(const d of l)d.parent=a;s=a}else if(fa(e)){const l=i?pr(e.children):[],a=new vo(l);for(const d of l)d.parent=a;e["x-mode"]&&(a["x-mode"]=e["x-mode"]),s=a}else if(ga(e)){const l=new ui(e.name,e.data);e["x-name"]!=null&&(l["x-name"]=e["x-name"],l["x-publicId"]=e["x-publicId"],l["x-systemId"]=e["x-systemId"]),s=l}else throw new Error(`Not implemented yet: ${e.type}`);return s.startIndex=e.startIndex,s.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(s.sourceCodeLocation=e.sourceCodeLocation),s}function pr(e){const i=e.map(s=>mr(s,!0));for(let s=1;s<i.length;s++)i[s].prev=i[s-1],i[s-1].next=i[s];return i}var di,yo,wo,ci,ui,jo,mi,vo,pi,_a=at.__esmMin((()=>{ua(),di=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 mr(this,e)}},yo=class extends di{data;constructor(e){super(),this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}},wo=class extends yo{type=lt.Text;get nodeType(){return 3}},ci=class extends yo{type=lt.Comment;get nodeType(){return 8}},ui=class extends yo{type=lt.Directive;name;constructor(e,i){super(i),this.name=e}get nodeType(){return 1}"x-name";"x-publicId";"x-systemId"},jo=class extends di{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}},mi=class extends jo{type=lt.CDATA;get nodeType(){return 4}},vo=class extends jo{type=lt.Root;get nodeType(){return 9}},pi=class extends jo{name;attribs;type;constructor(e,i,s=[],l=e==="script"?lt.Script:e==="style"?lt.Style:lt.Tag){super(s),this.name=e,this.attribs=i,this.type=l}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"}})),hr=at.__exportAll({CDATA:()=>mi,Comment:()=>ci,DataNode:()=>yo,Document:()=>vo,DomHandler:()=>gr,Element:()=>pi,Node:()=>di,NodeWithChildren:()=>jo,ProcessingInstruction:()=>ui,Text:()=>wo,cloneNode:()=>mr,default:()=>gr,hasChildren:()=>Om,isCDATA:()=>pa,isComment:()=>ba,isDirective:()=>ga,isDocument:()=>fa,isTag:()=>ma,isText:()=>ha}),br,gr,fr=at.__esmMin((()=>{ua(),_a(),_a(),br={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},gr=class{dom=[];root=new vo(this.dom);callback;options;elementCB;done=!1;tagStack=[this.root];lastNode=null;parser=null;constructor(e,i,s){typeof i=="function"&&(s=i,i=br),typeof e=="object"&&(i=e,e=void 0),this.callback=e??null,this.options=i??br,this.elementCB=s??null}onparserinit(e){this.parser=e}onreset(){this.dom=[],this.root=new vo(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 s=this.options.xmlMode?lt.Tag:void 0,l=new pi(e,i,void 0,s);this.addNode(l),this.tagStack.push(l)}ontext(e){const{lastNode:i}=this;if(i&&i.type===lt.Text)i.data+=e,this.options.withEndIndices&&this.parser&&(i.endIndex=this.parser.endIndex);else{const s=new wo(e);this.addNode(s),this.lastNode=s}}oncomment(e){if(this.lastNode&&this.lastNode.type===lt.Comment){this.lastNode.data+=e;return}const i=new ci(e);this.addNode(i),this.lastNode=i}oncommentend(){this.lastNode=null}oncdatastart(){const e=new wo(""),i=new mi([e]);this.addNode(i),e.parent=i,this.lastNode=e}oncdataend(){this.lastNode=null}onprocessinginstruction(e,i){const s=new ui(e,i);this.addNode(s)}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],s=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),s&&(e.prev=s,s.next=e),e.parent=i,this.lastNode=null}}})),xa=at.__commonJSMin((e=>{var i=Tm(),s=(fr(),at.__toCommonJS(hr)),l="\r",a=new RegExp(l,"g"),d=`__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_${Date.now().toString()}__`,c=new RegExp(d,"g");function p(x){return i.CASE_SENSITIVE_TAG_NAMES_MAP[x]}function g(x){const f={};let y=0;const v=x.length;for(;y<v;y++){const N=x[y];f[N.name]=N.value}return f}function b(x){x=x.toLowerCase();const f=p(x);return f||x}function k(x,f){const y="<"+f,v=x.toLowerCase().indexOf(y);if(v===-1)return!1;const N=x[v+y.length];return N===">"||N===" "||N===" "||N===`
|
|
19
|
+
`||N==="\r"||N==="/"}function h(x){return x.replace(a,d)}function m(x){return x.replace(c,l)}function S(x,f=null,y){const v=[];let N,B=0;const C=x.length;for(;B<C;B++){const $=x[B];switch($.nodeType){case 1:{const L=b($.nodeName);N=new s.Element(L,g($.attributes)),N.children=S(L==="template"?$.content.childNodes:$.childNodes,N);break}case 3:N=new s.Text(m($.nodeValue??""));break;case 8:N=new s.Comment($.nodeValue??"");break;default:continue}const U=v[B-1]??null;U&&(U.next=N),N.parent=f,N.prev=U,N.next=null,v.push(N)}return y&&(N=new s.ProcessingInstruction(y.substring(0,y.indexOf(" ")).toLowerCase(),y),N.next=v[0]??null,N.parent=f,v.unshift(N),v[1]&&(v[1].prev=v[0])),v}e.escapeSpecialCharacters=h,e.formatDOM=S,e.hasOpenTag=k})),$m=at.__commonJSMin((e=>{var i=xa(),s="html",l="head",a="body",d=/<([a-zA-Z]+[0-9]?)/;function c(x,f){return f?f.createHTML(x):x}var p=(x,f,y)=>{throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},g=(x,f,y)=>{throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},b=typeof window=="object"&&window.DOMParser;if(typeof b=="function"){const x=new b,f="text/html";g=(y,v,N)=>(v&&(y=`<${v}>${y}</${v}>`),x.parseFromString(y,f)),p=g}if(typeof document=="object"&&document.implementation){const x=document.implementation.createHTMLDocument();p=function(f,y,v){if(y){const N=x.documentElement.querySelector(y);return N&&(N.innerHTML=c(f,v)),x}return x.documentElement.innerHTML=c(f,v),x}}var k=typeof document=="object"&&document.createElement("template"),h;k&&k.content&&(h=(x,f)=>(k.innerHTML=c(x,f),k.content.childNodes));var m=()=>document.createDocumentFragment().childNodes;function S(x,f){x=i.escapeSpecialCharacters(x);const y=d.exec(x)?.[1]?.toLowerCase();switch(y){case s:{const v=g(x);if(!i.hasOpenTag(x,l)){const N=v.querySelector(l);N?.parentNode?.removeChild(N)}if(!i.hasOpenTag(x,a)){const N=v.querySelector(a);N?.parentNode?.removeChild(N)}return v.querySelectorAll(s)}case l:case a:{const v=p(x,void 0,f).querySelectorAll(y);return i.hasOpenTag(x,a)&&i.hasOpenTag(x,l)?v[0].parentNode?.childNodes??m():v}default:return h?h(x,f):p(x,a,f).querySelector(a)?.childNodes??m()}}e.default=S})),Fm=at.__commonJSMin((e=>{Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var i=xa(),s=$m(),l=/<(![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=l.exec(d),g=p?p[1]:void 0;return i.formatDOM(s.default(d,c?.trustedTypePolicy),null,g)}e.default=a})),Mm=at.__commonJSMin((e=>{var i=0;e.SAME=i;var s=1;e.CAMELCASE=s,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}})),Dm=at.__commonJSMin((e=>{var i=0,s=1,l=2,a=3,d=4,c=5,p=6;function g(B){return k.hasOwnProperty(B)?k[B]:null}function b(B,C,$,U,L,F,P){this.acceptsBooleans=C===l||C===a||C===d,this.attributeName=U,this.attributeNamespace=L,this.mustUseProperty=$,this.propertyName=B,this.type=C,this.sanitizeURL=F,this.removeEmptyString=P}var k={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(B=>{k[B]=new b(B,i,!1,B,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([B,C])=>{k[B]=new b(B,s,!1,C,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(B=>{k[B]=new b(B,l,!1,B.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(B=>{k[B]=new b(B,l,!1,B,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(B=>{k[B]=new b(B,a,!1,B.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(B=>{k[B]=new b(B,a,!0,B,null,!1,!1)}),["capture","download"].forEach(B=>{k[B]=new b(B,d,!1,B,null,!1,!1)}),["cols","rows","size","span"].forEach(B=>{k[B]=new b(B,p,!1,B,null,!1,!1)}),["rowSpan","start"].forEach(B=>{k[B]=new b(B,c,!1,B.toLowerCase(),null,!1,!1)});var h=/[\-\:]([a-z])/g,m=B=>B[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(B=>{const C=B.replace(h,m);k[C]=new b(C,s,!1,B,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(B=>{const C=B.replace(h,m);k[C]=new b(C,s,!1,B,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(B=>{const C=B.replace(h,m);k[C]=new b(C,s,!1,B,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(B=>{k[B]=new b(B,s,!1,B.toLowerCase(),null,!1,!1)});var S="xlinkHref";k[S]=new b("xlinkHref",s,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(B=>{k[B]=new b(B,s,!1,B.toLowerCase(),null,!0,!0)});var{CAMELCASE:x,SAME:f,possibleStandardNames:y}=Mm(),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]*$")),N=Object.keys(y).reduce((B,C)=>{const $=y[C];return $===f?B[C]=C:$===x?B[C.toLowerCase()]=C:B[C]=$,B},{});e.BOOLEAN=a,e.BOOLEANISH_STRING=l,e.NUMERIC=c,e.OVERLOADED_BOOLEAN=d,e.POSITIVE_NUMERIC=p,e.RESERVED=i,e.STRING=s,e.getPropertyInfo=g,e.isCustomAttribute=v,e.possibleStandardNames=N}));function Vm(e,i){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];i=i||{};var s=1,l=1;function a(x){var f=x.match(Ea);f&&(s+=f.length);var y=x.lastIndexOf(ja);l=~y?x.length-y:l+x.length}function d(){var x={line:s,column:l};return function(f){return f.position=new c(x),b(),f}}function c(x){this.start=x,this.end={line:s,column:l},this.source=i.source}c.prototype.content=e;function p(x){var f=new Error(i.source+":"+s+":"+l+": "+x);if(f.reason=x,f.filename=i.source,f.line=s,f.column=l,f.source=e,!i.silent)throw f}function g(x){var f=x.exec(e);if(f){var y=f[0];return a(y),e=e.slice(y.length),f}}function b(){g(Sa)}function k(x){var f;for(x=x||[];f=h();)f!==!1&&x.push(f);return x}function h(){var x=d();if(!(xr!=e.charAt(0)||kr!=e.charAt(1))){for(var f=2;Gt!=e.charAt(f)&&(kr!=e.charAt(f)||xr!=e.charAt(f+1));)++f;if(f+=2,Gt===e.charAt(f-1))return p("End of comment missing");var y=e.slice(2,f-2);return l+=2,a(y),e=e.slice(f),l+=2,x({type:va,comment:y})}}function m(){var x=d(),f=g(Ba);if(f){if(h(),!g(Ra))return p("property missing ':'");var y=g(Ta),v=x({type:Ia,property:ka(f[0].replace(_r,Gt)),value:y?ka(y[0].replace(_r,Gt)):Gt});return g(ya),v}}function S(){var x=[];k(x);for(var f;f=m();)f!==!1&&(x.push(f),k(x));return x}return b(),S()}function ka(e){return e?e.replace(wa,Gt):Gt}var _r,Ea,Sa,Ba,Ra,Ta,ya,wa,ja,xr,kr,Gt,va,Ia,Hm=at.__esmMin((()=>{_r=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Ea=/\n/g,Sa=/^\s*/,Ba=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Ra=/^:\s*/,Ta=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,ya=/^[;\s]*/,wa=/^\s+|\s+$/g,ja=`
|
|
20
|
+
`,xr="/",kr="*",Gt="",va="comment",Ia="declaration"}));function Um(e,i){let s=null;if(!e||typeof e!="string")return s;const l=Vm(e),a=typeof i=="function";return l.forEach(d=>{if(d.type!=="declaration")return;const{property:c,value:p}=d;a?i(c,p,d):p&&(s=s??{},s[c]=p)}),s}var Wm=at.__esmMin((()=>{Hm()})),zm=at.__exportAll({default:()=>Gm});function Gm(e,i){const s={};return!e||typeof e!="string"||Um(e,(l,a)=>{l&&a&&(s[Fa(l,i)]=a)}),s}var Ca,Pa,Aa,Na,La,Oa,$a,Er,Fa,Ym=at.__esmMin((()=>{Wm(),Ca=/^--[a-zA-Z0-9_-]+$/,Pa=/-([a-z])/g,Aa=/^[^-]+$/,Na=/^-(webkit|moz|ms|o|khtml)-/,La=/^-(ms)-/,Oa=e=>!e||Aa.test(e)||Ca.test(e),$a=(e,i)=>i.toUpperCase(),Er=(e,i)=>`${i}-`,Fa=(e,i={})=>Oa(e)?e:(e=e.toLowerCase(),i.reactCompat?e=e.replace(La,Er):e=e.replace(Na,Er),e.replace(Pa,$a))})),Ma=at.__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 s=_t("react"),l=i((Ym(),at.__toCommonJS(zm))),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,h){return k.includes("-")?!a.has(k):!!(h&&typeof h.is=="string")}var c={reactCompat:!0};function p(k,h){if(typeof k=="string"){if(!k.trim()){h.style={};return}try{h.style=(0,l.default)(k,c)}catch{h.style={}}}}e.PRESERVE_CUSTOM_ATTRIBUTES=Number(s.version.split(".")[0])>=16,e.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var g=k=>!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(k.name);e.canTextBeChildOfNode=g;var b=k=>k;e.returnFirstArg=b})),Da=at.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var i=Dm(),s=Ma(),l=["checked","value"],a=["input","select","textarea"],d={reset:!0,submit:!0};function c(g={},b){const k={},h=!!(g.type&&d[g.type]);for(const m in g){const S=g[m];if((0,i.isCustomAttribute)(m)){k[m]=S;continue}const x=m.toLowerCase();let f=p(x);if(f){const y=(0,i.getPropertyInfo)(f);switch(l.includes(f)&&a.includes(b)&&!h&&(f=p("default"+x)),k[f]=S,y?.type){case i.BOOLEAN:k[f]=!0;break;case i.OVERLOADED_BOOLEAN:S===""&&(k[f]=!0)}continue}s.PRESERVE_CUSTOM_ATTRIBUTES&&(k[m]=S)}return(0,s.setStyleProp)(g.style,k),k}function p(g){return i.possibleStandardNames[g]}})),Xm=at.__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 s=(fr(),at.__toCommonJS(hr)),l=_t("react"),a=i(Da()),d=Ma(),c={cloneElement:l.cloneElement,createElement:l.createElement,isValidElement:l.isValidElement};function p(k,h={}){var m,S,x,f,y;const v=[],N=typeof h.replace=="function",B=(m=h.transform)!==null&&m!==void 0?m:d.returnFirstArg,{cloneElement:C,createElement:$,isValidElement:U}=(S=h.library)!==null&&S!==void 0?S:c,L=k.length;g(k);for(let F=0;F<L;F++){const P=k[F];if(N){let te=(x=h.replace)===null||x===void 0?void 0:x.call(h,P,F);if(U(te)){L>1&&(te=C(te,{key:(f=te.key)!==null&&f!==void 0?f:F})),v.push(B(te,P,F));continue}}if(P.type==="text"){const te=!P.data.trim().length;if(te&&P.parent&&!(0,d.canTextBeChildOfNode)(P.parent)||h.trim&&te)continue;v.push(B(P.data,P,F));continue}const H=P;let ae={};b(H)?((0,d.setStyleProp)(H.attribs.style,H.attribs),ae=H.attribs):H.attribs&&(ae=(0,a.default)(H.attribs,H.name));let T;switch(P.type){case"script":case"style":P.children[0]&&(ae.dangerouslySetInnerHTML={__html:P.children[0].data});break;case"tag":P.name==="textarea"&&P.children[0]?ae.defaultValue=P.children[0].data:!((y=P.children)===null||y===void 0)&&y.length&&(T=p(P.children,h));break;default:continue}L>1&&(ae.key=F),v.push(B($(P.name,ae,T),P,F))}return v.length===1?v[0]:v}function g(k){for(const h of k)(h.type==="tag"||h.type==="script"||h.type==="style")&&(Object.setPrototypeOf(h,s.Element.prototype),g(h.children))}function b(k){return d.PRESERVE_CUSTOM_ATTRIBUTES&&k.type==="tag"&&(0,d.isCustomComponent)(k.name,k.attribs)}})),Km=at.__commonJSMin((e=>{var i=e&&e.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};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 s=i(Fm());e.htmlToDOM=s.default;var l=i(Da());e.attributesToProps=l.default;var a=i(Xm());e.domToReact=a.default;var d=(fr(),at.__toCommonJS(hr));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(g,b){var k;if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];const h=Object.assign(Object.assign({},(k=b?.htmlparser2)!==null&&k!==void 0?k:c),{trustedTypePolicy:b?.trustedTypePolicy});return(0,a.default)((0,s.default)(g,h),b)}})),co=at.__toESM(Km(),1),qm=co.default.default||co.default,Sr=new Set;function Jm(e,i){Sr.has(e)||(Sr.add(e),Promise.resolve(i()).finally(()=>{Sr.delete(e)}))}var Qm={subject:"insert_generated_subject",preheader:"insert_generated_preheader"};function Va(e,i,s){s.document&&(r.writeEmailAttributes(s.document,{[e]:i}),s.pushToDataLayer({event:"submit",action:Qm[e],entity_type:s.entityType,entity_id:s.entityId,project_id:s.projectId,context:"editor"}))}function Br({limitsInPlugin:e,hostedAiActive:i}){return e&&!i}function Ha({limitsInPlugin:e,hostedAiActive:i,counter:s,limit:l}){return Br({limitsInPlugin:e,hostedAiActive:i})?l>0&&s>=l:!1}function Ua(e,i){if(!i||typeof e!="string")return i||e;const s=i.trim();if(!s)return e;if(/^\s*<!DOCTYPE/i.test(s)||/^\s*<\s*html[\s>]/i.test(s))return i;try{const l=new DOMParser().parseFromString(e,"text/html"),a=l.querySelector("editor");if(a){a.innerHTML=i;const d=e.match(/^[\s\uFEFF]*<!DOCTYPE[^>]*>/i);return`${d?`${d[0]}
|
|
21
|
+
`:""}${l.documentElement.outerHTML}`}}catch{}return i}var Zm=e=>{const{__:i}=r.useI18n();return[{key:"📧",label:(0,t.jsxs)("div",{onClick:()=>{e("theme-and-preheader-generator")},children:["📧 ",i("Subject line & preheader generator")]})},{key:"🌎",label:(0,t.jsxs)("div",{onClick:()=>{e("translator")},children:["🌎 ",i("Translator")]})},{key:"📄",label:(0,t.jsxs)("div",{onClick:()=>{e("writer")},children:["📄 ",i("Copywriter")]})},{key:"🔎",label:(0,t.jsxs)("div",{onClick:()=>{e("corrector")},children:["🔎 ",i("Proofreader")]})},{key:"🧠",label:(0,t.jsxs)("div",{onClick:()=>{e("psychologist")},children:["🧠 ",i("Psychologist")]})},{key:"📈",label:(0,t.jsxs)("div",{onClick:()=>{e("marketolog")},children:["📈 ",i("Marketer")]})},{key:"✨",label:(0,t.jsxs)("div",{onClick:()=>{e("email-generator")},children:["✨ ",i("Email generator")]})}]},ep={background:r.emCssVar("colorInfo"),color:"#ffffff"},Wa=({messages:e,newEmailAiGeneratorRef:i})=>{const s=r.useElementEntityKind(),{document:l}=r.useDocumentSessionContext(),a=r.useContentReader(),d=r.useUserContentReplacer(),{__:c,_n:p}=r.useI18n(),g=r.useDispatch(),b=r.useAppNavigate(),k=(0,n.useRef)(null),h=r.useAppConfig(),m=r.useEditorLocked(),S=r.useEditorLockCheck(),x=r.useNotification(),f=r.useEditorProjectId(),y=r.useWpEntityId(),v=r.usePushToDataLayer(),N={document:l,pushToDataLayer:v,entityType:s==="block"?"block":"email",entityId:y,projectId:f},B=r.useEventEmitter(ht.events.ON_LIMIT_ID),[C,$]=(0,n.useState)(null),[U,L]=(0,n.useState)(0),[F,P]=(0,n.useState)(!1),[H,ae]=(0,n.useState)(""),[T,te]=(0,n.useState)([]),[xe,be]=(0,n.useState)(!1),[ye,me]=(0,n.useState)(!1),[he,ke]=(0,n.useState)(null),[ce,ze]=(0,n.useState)(0),[Oe,ve]=(0,n.useState)(null),Ee=r.useEmailAttribute("subject"),pe=r.useEmailAttribute("preheader"),Q=r.useCurrentUser(),X=r.toLanguageCode(r.useInterfaceLocale()),Z=Q.avatar_url||Q.avatar_urls?.[24],J=[Q.first_name,Q.last_name].filter(Boolean).join(" ")||Q.username,V=r.useMessageService(),[M]=r.useLazyGetDialogQuery(),Y=r.useSendPostMessage(),[K,ee]=r.useSendMessageMutation(),le=(0,n.useRef)(new Set),Re=(0,n.useCallback)(_e=>{const R=K(_e),oe=le.current;oe.add(R);const E=()=>oe.delete(R);return R.then(E,E),R},[K]);(0,n.useEffect)(()=>{const _e=le.current;return()=>{_e.forEach(R=>R.abort?.()),_e.clear()}},[]);const[Be,{reset:$e}]=r.useGetAiGenerateStatusMutation(),[z,{data:re=[]}]=r.useLazyGetGeneratedContentQuery(),[Pe]=r.useLazyGetLimitsStatsByTypeQuery(),G={cursor:F?"not-allowed":"default",pointerEvents:F?"none":"auto"};(0,n.useEffect)(()=>{Oe&&xe&&(i.current=!0),xe||(i.current=!1)},[Oe,xe]);const Se=!!(h.limits&&h.counters)&&!0,{limits:Fe}=h.limits?h:{limits:{ai_limit:0,ai_generator_limit:0}},{ai_limit:Ae,ai_generator_limit:Ve}=Fe,Ue=r.useEventEmitter(ht.events.AI_TEXT_REQUEST_ID).hasListeners(),Xe=Br({limitsInPlugin:Se,hostedAiActive:Ue}),ne=Ha({limitsInPlugin:Se,hostedAiActive:Ue,counter:U,limit:Ae}),Te=Ha({limitsInPlugin:Se,hostedAiActive:Ue,counter:ce,limit:Ve}),I=(0,n.useCallback)(()=>{B.fire({name:"AiChatCount",count:U+1})},[B,U]),se=(0,n.useCallback)(()=>{B.fire({name:"AiGeneratorCount",count:ce+1})},[B,ce]),je=(0,n.useCallback)(async _e=>!0,[c,Pe,x]);(0,n.useEffect)(()=>{Se&&(L(h?.counters?.ai_counter||0),ze(h?.counters?.ai_generator_counter||0))},[h,Se]),(0,n.useEffect)(()=>{ve(T.length<=0?!1:T.toReversed().find(R=>R.data?.context)?.data.context==="email-generator")},[T]);const Ne=(0,n.useCallback)(async()=>await V.sendAsync(r.EVENT_TYPES.SANDBOX_IS_EMAIL_EMPTY),[V]),He=(0,n.useCallback)(()=>{const _e=k.current?.closest(".ant-tabs-content.ant-tabs-content-top");setTimeout(()=>{_e?.scrollTo({top:_e.scrollHeight,behavior:"smooth"})},0)},[k]),Ke=(0,n.useCallback)(()=>{r.swallowPromiseRejection(M({entity_id:y}).then(_e=>{te(_e.data.documents),He()}))},[y,M,te,He]),tt=(0,n.useCallback)(_e=>{if(!_e?.data?._eventResult)return!1;const{aiMessage:R,aiHtml:oe}=_e.data;if(te(E=>{const de=[...E];for(let Ce=de.length-1;Ce>=0;Ce--)if(de[Ce]?.data?.isLoading&&de[Ce]?.data?.role==="assistant"){de[Ce]={data:{role:"assistant",message:R,isLoading:!1}};break}return de}),oe){const E=Ua(a(),String(oe));d(E,{undoable:!0})}return He(),!0},[a,d,He]),O=(0,n.useCallback)(_e=>{te(R=>{for(let oe=R.length-1;oe>=0;oe--)if(R[oe]?.data?.isLoading&&R[oe]?.data?.role==="assistant"){const E=[...R];return _e?E[oe]={data:{role:"assistant",message:_e}}:E.splice(oe,1),E}return R})},[]),ie=(0,n.useCallback)(_e=>{const R=_e?.message==="ERROR"?void 0:_e?.message;return[_e?.data?.message,R].find(oe=>typeof oe=="string"&&oe)||c("Something went wrong.")},[c]),j=l?.get().docId,w=r.useEventEmitter(ht.events.AI_TEXT_PROGRESS_ID);(0,n.useEffect)(()=>{const _e=w.event(({progress:R,status:oe,docId:E})=>{if(E!==j)return;const de=oe||`${Math.round(R)}%`;te(Ce=>{const Qe=[...Ce];for(let Me=Qe.length-1;Me>=0;Me--)if(Qe[Me]?.data?.isLoading&&Qe[Me]?.data?.role==="assistant"){Qe[Me]={data:{...Qe[Me].data,message:de}};break}return Qe})});return()=>_e.dispose()},[w,j]);const ue=r.useEventEmitter(ht.events.AI_TEXT_STREAM_ID);(0,n.useEffect)(()=>{const _e=ue.event(({partialHtml:R,docId:oe})=>{if(oe!==j)return;const E=Ua(a(),String(R));d(E,{undoable:!0})});return()=>_e.dispose()},[ue,a,d,g,j]);const Ie=(0,n.useCallback)(_e=>{be(!0),P(!0),r.swallowPromiseRejection(Be({task_id:_e||C,entity_id:y,status:"started"}).then(()=>{Ke()}))},[y,Be,C,Ke]),qe=(0,n.useCallback)(()=>{Be({task_id:C,entity_id:y,status:"completed"}).then(_e=>{_e.data.status===403&&$e(),Ke()}).catch(_e=>{}),P(!1),be(!1)},[y,Be,C,Ke,$e]);(0,n.useEffect)(()=>{let _e;if(xe){const R=re[re.length-1]?.processing?.email;if(R){let oe=re[re.length-1].status;d(String(R),{undoable:!0}),oe===0&&qe()}he&&(clearInterval(_e),be(!1),ke(!1),P(!1),O())}return()=>{clearInterval(_e)}},[d,he,g,re,xe,Ee,pe,y,C,Ke,Be,ee,qe,O]),(0,n.useEffect)(He,[He]),(0,n.useEffect)(()=>{e?.length>0&&te(e),Y({operation:r.EVENT_TYPES.SANDBOX_EMAIL_CONTENT_GET})},[e,Y]),(0,n.useEffect)(()=>{const _e=V.onInit(()=>{V.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:F}),V.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_DISCUSS,value:F})});return()=>_e.dispose()},[F,V]);const Ze=async()=>{if(H&&!S()){const _e=H.replaceAll(/\n/g,"<br>"),R={project_id:f,connection:"chat",entity_id:y,message:_e,locale:X,subject:Ee||"",preheader:pe||"",textContent:gi.extractDocumentTextContent(a())};if(Oe&&Te||ne){x.error({title:c(Oe?"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 oe={data:{role:"assistant",message:c(Oe?"You have reached the limit of AI generator usage.":"You have reached the limit of AI chat usage.")}};te(E=>[...E,oe])}else{if(!await je(Oe?"email_generate":"ai")){ae("");return}Xe&&(Oe&&ce!==Ve?(se(),ze(E=>E+1)):U!==Ae&&(I(),L(E=>E+1))),v({event:"submit_form",action:"chat_whit_ai_assistant",entity_id:R.entity_id,project_id:R.project_id});const oe=[{data:{role:"user",message:_e,userInfo:{display_name:J,avatar_url:Z}}},{data:{role:"assistant",message:c("Typing..."),isLoading:!0}}];te(E=>[...E,...oe]),Re({body:R}).then(E=>{if(E?.error)throw E.error;if(!E?.data||E.data.status===401)throw new Error(r.ERROR);if(!tt(E)){if(v({event:"submit",action:"send_discussion_chat_message",entity_type:s==="block"?"block":"email",entity_id:y,project_id:f,context:"editor"}),E.data.task_id){let de=E.data.task_id;$(de),z({id:de,setError:ke}),r.swallowPromiseRejection(Ne().then(Ce=>{Ce?Ie(de):me(!0)}))}Ke()}}).catch(E=>{const de=ie(E);x.error({title:E?.data?.code||c("Error"),description:de}),O(de)})}ae("")}},dt=async _e=>{if(S())return;const R={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};te(E=>[...E,R]);const oe={project_id:f,connection:"chat",entity_id:y,context:_e,locale:X,subject:Ee||"",preheader:pe||"",textContent:gi.extractDocumentTextContent(a())};if(Xe&&(Oe&&ce!==Ve?(se(),ze(E=>E+1)):U!==Ae&&(I(),L(E=>E+1))),ne)x.error({title:c("You have reached the limit of AI chat usage."),description:c("Please upgrade your plan.")}),O(c("You have reached the limit of AI chat usage."));else{if(!await je("ai")){O();return}v({event:"select",action:"select_ai_assistant_role",context:oe.context,entity_id:oe.entity_id,project_id:oe.project_id}),Re({body:oe}).then(E=>{if(E?.error)throw E.error;if(!E?.data||E.data.status===401)throw new Error(r.ERROR);tt(E)||Ke()}).catch(E=>{const de=ie(E);x.error({title:E?.data?.code||c("Error"),description:de}),O(de)})}},st=(0,n.useCallback)(async _e=>{const R={data:{role:"user",message:_e,userInfo:{display_name:J,avatar_url:Z}}},oe={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};te(de=>[...de,R,oe]);const E={project_id:f,connection:"chat",entity_id:y,message:_e,locale:X,subject:Ee||"",preheader:pe||"",textContent:gi.extractDocumentTextContent(a())};if(Te)x.error({title:c("You have reached the limit of AI generator usage."),description:c("Please upgrade your plan.")}),O(c("You have reached the limit of AI chat usage."));else{if(!await je(Oe?"email_generate":"ai")){O();return}Re({body:E}).then(de=>{if(de?.error)throw de.error;if(!de?.data||de.data.status===401)throw new Error(r.ERROR);if(!tt(de)){if(v({event:"submit",action:"send_discussion_chat_message",entity_type:s==="block"?"block":"email",entity_id:y,project_id:f,context:"editor"}),de.data.task_id){let Ce=de.data.task_id;$(Ce),z({id:Ce,setError:ke}),r.swallowPromiseRejection(Ne().then(Qe=>{Qe?Ie(Ce):me(!0)}))}Xe&&(Oe&&ce!==Ve?(se(),ze(Ce=>Ce+1)):U!==Ae&&(I(),L(Ce=>Ce+1))),Ke()}}).catch(de=>{const Ce=ie(de);x.error({title:de?.data?.code||c("Error"),description:Ce}),O(Ce)})}},[c,U,ce,Z,Ne,O,Ie,ie,J,Ae,Ve,Q,Ee,pe,y,Oe,Te,X,I,se,Xe,a,x,je,f,Re,z,Ke]);(0,n.useEffect)(()=>{const _e=new ht.Disposable,R=window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings);if((!e?.length||e.length===1&&e[0]?.data?.role==="assistant")&&R&&y&&!m){const oe={project_id:f,connection:"chat",entity_id:y,context:"email-generator",locale:X};Jm(`discuss-ai-generator-context:${y}`,()=>{if(Ue){window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),st(R);return}r.swallowPromiseRejection(K({body:oe}).then(()=>{window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),_e.isDisposed()||st(R)}))})}return()=>_e.dispose()},[e,st,y,X,f,K,Ue,m]);const ct=_e=>{typeof _e.target.className=="string"&&_e.target.className.includes("ai-response-change-context")&&(ee.isLoading||dt(_e.target.role))},kt=_e=>{if(S())return;const R=_e.children[0].data??"";Va("subject",R,N),x.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Title copied to email settings"),data:R})},St=_e=>{if(S())return;const R=_e.children[0].data??"";Va("preheader",R,N),x.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Preheader copied to email settings"),data:R,duration:300})},D=_e=>{const R=_e.children[0].data;navigator.clipboard.writeText(R).then(()=>{x.success({id:"TEXT_COPIED_TO_CLIPBOARD",title:c("Text copied to clipboard"),data:R})}).catch(oe=>{})},q={replace:_e=>{if(_e.attribs?.class?.split(" ").includes("ai-response-title"))return(0,t.jsx)(o.ui_kit$Tooltip,{placement:"left",title:c("Replace the title"),children:(0,t.jsx)("div",{onClick:()=>kt(_e),children:(0,t.jsx)("span",{className:"ai-response-title",children:(0,co.domToReact)(_e.children,q)})})});if(_e.attribs?.class?.split(" ").includes("ai-response-preheader"))return(0,t.jsx)(o.ui_kit$Tooltip,{placement:"left",title:c("Replace the preheader"),children:(0,t.jsx)("div",{onClick:()=>St(_e),children:(0,t.jsx)("span",{className:"ai-response-preheader",children:(0,co.domToReact)(_e.children,q)})})});if(_e.attribs?.class?.split(" ").includes("ai-response-copy"))return(0,t.jsx)(o.ui_kit$Tooltip,{placement:"left",title:c("Copy to clipboard"),children:(0,t.jsx)("div",{onClick:()=>D(_e),children:(0,t.jsx)("span",{className:"ai-response-copy",children:(0,co.domToReact)(_e.children,q)})})});if(_e.attribs?.class?.split(" ").includes("ai-response-user-message")){const R=_e.attribs?.data||_e.children?.[0]?.data;return(0,t.jsx)("li",{className:_e.attribs?.class,data:_e.attribs?.data,onClick:()=>st(R),children:(0,co.domToReact)(_e.children,q)})}}},we=()=>{Ie(),me(!1)},Ge=()=>{qe(),me(!1)};return(0,t.jsxs)("div",{ref:k,className:"discuss-main",children:[T.length>0&&(0,t.jsx)(o.ui_kit$List,{onClick:ct,className:"comment-list",itemLayout:"horizontal",dataSource:T,renderItem:_e=>(0,t.jsx)("li",{id:_e._id,children:(0,t.jsx)(o.ui_kit$Comment,{className:_e.data.userInfo?"":"ai-comment",avatar:_e.data.role==="assistant"?(0,t.jsx)(r.EmIcons,{icon:"ChatGpt",component:o.icons$ChatGpt,className:"anticon-robot",style:{color:"#ffffff",fontSize:16,width:24,height:24,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"}}):_e.data.userInfo&&_e.data._modified?_e.data.userInfo.avatar_url:Z||(0,t.jsx)(r.EmIcons,{icon:"UserOutlined",component:o.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,t.jsx)("div",{style:G,children:_e?.data?.role==="user"?Q?.username||c("User"):c("AI Assistant")}),datetime:_e._created?(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:r.formatDate(r.parseISO(_e._created),p,!0)}}):null,content:_e.data.isLoading?(0,t.jsx)("div",{className:"spin",children:(0,t.jsx)(r.EmIcons,{icon:"LoadingOutlined",component:o.icons$LoadingOutlined,style:{fontSize:24},spin:!0})}):(0,t.jsx)("div",{style:G,children:qm(_e.data.message,q)})})},_e._id)}),Se&&(Oe?(0,t.jsx)(o.ui_kit$LimitsCounter,{text:`${ce} ${c("of")} ${Ve>0?Ve:"∞"} ${c("mail generator")} ${p("was used","were used",ce)}`,exceeded:Ve>0&&ce>=Ve,style:{marginTop:-25},extra:(0,t.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>b(h.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})}):(0,t.jsx)(o.ui_kit$LimitsCounter,{text:`${U} ${c("of")} ${Ae>0?Ae:"∞"} ${c("messeges")} ${p("was used","were used",U)}`,exceeded:Ae>0&&U>=Ae,style:{marginTop:-25},extra:(0,t.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>b(h.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})})),(0,t.jsxs)(o.ui_kit$Form,{onFinish:Ze,className:"addMode",children:[(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,t.jsx)(o.ui_kit$TextArea,{disabled:F||m,value:H,onChange:_e=>ae(_e.target.value),rows:4,placeholder:c("Type your request"),className:"textarea-comment",onPressEnter:_e=>_e.key==="Enter"&&_e.ctrlKey&&Ze(),spellCheck:"false"})}),(0,t.jsx)(o.ui_kit$Form.Item,{children:(0,t.jsxs)(o.ui_kit$Space,{size:8,children:[(0,t.jsx)(o.ui_kit$Button,{disabled:ee.isLoading||F||m,type:"default",style:ep,className:"button-target",children:(0,t.jsx)(o.ui_kit$Dropdown,{placement:"top",disabled:F,arrow:{pointAtCenter:!0},menu:{items:Zm(dt)},children:(0,t.jsxs)("div",{disabled:F,style:{margin:0,padding:0,color:"#ffffff",display:"inline-flex",alignItems:"center"},children:[(0,t.jsx)(r.EmIcons,{icon:"ChatGpt",component:o.icons$ChatGpt,style:{marginRight:5}}),c("Role")]})},"Export")}),(0,t.jsxs)(o.ui_kit$Button,{disabled:ee.isLoading||F||m,className:"button-add",type:"primary",htmlType:"submit",children:[c("Send")," ",(0,t.jsx)(r.EmIcons,{icon:"SendOutlined",component:o.icons$SendOutlined,size:16,strokeWidth:h.iconStrokeWidth})]})]})})]}),(0,t.jsx)(o.ui_kit$Modal,{title:c("Warning"),open:ye,onOk:we,onCancel:Ge,children:(0,t.jsx)("p",{children:c("The current template will be changed to the generated one, are you sure about this?")})})]})},tp=[r.VALID,r.ERRORS,r.WARNINGS],za=({summary:e,__:i,selectedTags:s,setSelectedTags:l})=>{const a=(0,n.useCallback)((c,p)=>{l(p?s.length===2?[]:[...s,c]:s.filter(g=>g!==c))},[s,l]),d=(0,n.useCallback)(c=>i(c==="valid"?"Valid":c==="warnings"?"Warnings":"Errors"),[i]);return(0,t.jsx)(o.ui_kit$Title,{level:5,className:"optimise__valid-title",children:(0,t.jsx)(o.ui_kit$Space,{className:"optimise__valid-title-space",size:8,children:tp.map((c,p)=>(0,t.jsxs)(o.ui_kit$CheckableTag,{checked:s?.includes(c),onChange:g=>a(c,g),className:(0,We.default)(`${c} optimise__button`,{[`${c}_active`]:s.includes(c)}),children:[d(c),": ",e?.[c]||0]},c+p))})})},{LINKS:op}=r.OPTIMISE_TABS,Ga=(0,n.memo)(({__:e,activeTab:i,validateLinksResult:s,validateLinks:l,selectedTags:a,setSelectedTags:d,isLoading:c,disabled:p,iconStrokeWidth:g,onValidate:b,goToLinkHandler:k})=>i!==op||!s?.links?null:s.links.length===0?(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,t.jsx)(o.ui_kit$Alert,{title:e("No links found."),type:"info"})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-14",children:(0,t.jsxs)("div",{className:"optimise__title-wrapper",children:[(0,t.jsx)(za,{__:e,summary:s.summary,setSelectedTags:d,selectedTags:a}),(0,t.jsx)(o.ui_kit$Button,{disabled:p,loading:c,onClick:b,icon:(0,t.jsx)(r.EmIcons,{icon:"SyncOutlined",component:o.icons$SyncOutlined,size:16,strokeWidth:g}),children:e("Refresh")})]})}),(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$List,{itemLayout:"horizontal",dataSource:l,renderItem:(h,m)=>(0,t.jsx)(o.ui_kit$List.Item,{className:o.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,t.jsx)(o.ui_kit$List.Item.Meta,{avatar:h.status==="valid"?(0,t.jsx)(r.EmIcons,{icon:"CheckCircleFilled",component:o.icons$CheckCircleFilled,className:r.VALID}):h.status==="warnings"?(0,t.jsx)(r.EmIcons,{icon:"CheckCircleFilled",component:o.icons$CheckCircleFilled,className:r.WARNINGS}):(0,t.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:o.icons$CloseCircleFilled,className:r.ERRORS}),title:(0,t.jsx)(o.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>k(h.linkId,600>(h.statusCode||0)&&(h.statusCode||0)>399||!h.statusCode),children:h.url===""?e("empty link"):h.url}),description:(0,t.jsxs)(t.Fragment,{children:[!!h.text?.length&&(0,t.jsx)(o.ui_kit$Text,{type:"secondary",children:h.text}),h.page?.title&&h.page.title,h.page?.secure&&h.status==="valid"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,t.jsx)("span",{className:"valid",children:e("secure")})]}),!h.resolvedUrl&&!h.statusCode&&h.type==="url"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,t.jsx)(o.ui_kit$Text,{type:"secondary",children:e("Failed to load")})]})]})})},m+"_"+h.linkId)})})})]}));Ga.displayName="LinksSection";var{IMAGES:ip}=r.OPTIMISE_TABS,Ya=(0,n.memo)(({__:e,activeTab:i,validateImagesResult:s,validateImages:l,selectedTags:a,setSelectedTags:d,isLoading:c,disabled:p,iconStrokeWidth:g,onValidate:b,goToImageHandler:k,showImgPreviewHandler:h,hideBlockPreviewHandler:m})=>i!==ip||!s?.images?null:s.images.length===0?(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,t.jsx)(o.ui_kit$Alert,{title:e("No images found."),type:"info"})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-16",children:(0,t.jsx)(o.ui_kit$Alert,{className:"optimise__alert-custom",title:(0,t.jsxs)("div",{className:"optimise__summary",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)(o.ui_kit$Title,{level:4,className:"optimise__summary-title",children:[s.images.length," "]}),(0,t.jsx)("span",{className:"optimise__summary-label",children:e("images")})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)(o.ui_kit$Title,{level:4,className:"optimise__summary-title",children:[s.summaryTime?.value,s.summaryTime?.name]}),(0,t.jsx)("span",{className:"optimise__summary-label",children:e("total size")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(o.ui_kit$Title,{level:4,className:"optimise__summary-title",children:(Math.max(...s.images.map(S=>S.image.responseTime))/1e3).toFixed(2)+e("s")}),(0,t.jsx)("span",{className:"optimise__summary-label",children:e("time to load")})]})]}),type:"warning"})}),(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-12",children:(0,t.jsxs)("div",{className:"optimise__title-wrapper",children:[(0,t.jsx)(za,{__:e,summary:s.summary,setSelectedTags:d,selectedTags:a}),(0,t.jsx)(o.ui_kit$Button,{icon:(0,t.jsx)(r.EmIcons,{icon:"SyncOutlined",component:o.icons$SyncOutlined,size:16,strokeWidth:g}),disabled:p,loading:c,onClick:b,children:e("Refresh")})]})}),(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-12",children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$List,{className:"optimise__result-list",itemLayout:"horizontal",dataSource:l,renderItem:(S,x)=>(0,t.jsx)(o.ui_kit$List.Item,{className:`optimise__image-item image-item ${o.ui_kit$LIST_ITEM_BORDERLESS_CLASS}`,children:(0,t.jsx)(o.ui_kit$List.Item.Meta,{className:(0,We.default)("image-item__meta",{"image-item__meta_fail":!S.resolvedUrl&&!S.statusCode}),avatar:(0,t.jsx)(o.ui_kit$Image,{className:(0,We.default)("image-item__image optimise__image-auto-height",{"image-item__image_fail":!S.resolvedUrl||!S.valid}),width:92,height:"auto",src:S.resolvedUrl||"",preview:!1,onMouseEnter:()=>h(S.url,S.image.dimensions?.width),onMouseLeave:()=>m()}),title:S.url?(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:S.message,children:(0,t.jsx)(o.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>k(S.imageId,600>(S.statusCode||0)&&(S.statusCode||0)>399||!S.statusCode),children:S?.url===""?e("empty src"):S.url})}):S.message,description:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"image-size",children:[S.image.dimensions&&(0,t.jsxs)(t.Fragment,{children:[S.image.dimensions.width+" × "+S.image.dimensions.height,(0,t.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,t.jsxs)("span",{children:[Math.round(S.image.bytes/1024),e("kB")]}),(0,t.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,t.jsxs)("span",{children:[S.image.responseTime,e("ms")]}),(0,t.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,t.jsx)("span",{className:"image-size-format",children:Lo(S.image.contentType)})]}),S.image.secure&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,t.jsx)("span",{className:"valid",children:e("secure")})]}),S.resolvedUrl&&!S.valid&&(0,t.jsx)(o.ui_kit$Text,{type:"danger",children:e("not valid")})]}),!S.resolvedUrl&&!S.statusCode&&(0,t.jsx)(o.ui_kit$Text,{type:"danger",children:e("Failed to load")})]})})},x)})})})]}));Ya.displayName="ImagesSection";var{SPAM_ASSASSIN:rp}=r.OPTIMISE_TABS,Xa=(0,n.memo)(({__:e,activeTab:i,validateSpamResult:s,isLoading:l,disabled:a,iconStrokeWidth:d,onValidate:c})=>{const p=s?.report?.length||Object.prototype.hasOwnProperty.call(s,"spamScore");if(i!==rp||!p)return null;const g=s.spamScore||0,b=s.baseSpamScore||0,k=g<2||!s.spamScore||g<=b-1?"success":g<b-1?"warning":"danger";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Row,{className:"optimise__row-mb-8",children:[(0,t.jsxs)("div",{className:"optimise__title-wrapper optimise__title-wrapper_spam",children:[(0,t.jsxs)(o.ui_kit$Title,{level:1,className:"optimise__spam-score-title",type:k,children:[(0,t.jsx)("span",{className:"optimise__spam-score-value",children:g}),(0,t.jsx)(o.ui_kit$Text,{className:"optimise__spam-score-text",children:"Score"})]}),(0,t.jsx)(o.ui_kit$Button,{disabled:a,icon:(0,t.jsx)(r.EmIcons,{icon:"SyncOutlined",component:o.icons$SyncOutlined,size:16,strokeWidth:d}),loading:l,onClick:c,children:e("Refresh")})]}),g>b-1&&(0,t.jsx)(o.ui_kit$Text,{children:e("Lower scores are better. Aim for a score less than ")+(b-1)+"."})]}),(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-8",children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(s.report?.length||0)>0?(0,t.jsx)(o.ui_kit$List,{itemLayout:"horizontal",dataSource:s.report,renderItem:h=>(0,t.jsx)(o.ui_kit$List.Item,{className:o.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,t.jsx)(o.ui_kit$List.Item.Meta,{title:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Text,{className:"optimise__spam-report-score",children:h.score}),(0,t.jsx)("span",{className:"optimise__spam-report-description",children:h.description})]})})})}):(0,t.jsx)(t.Fragment,{children:s.spamScore===0&&e("Your email doesn't look like spam.")})})})]})});Xa.displayName="SpamSection";var{PROBLEMS:sp}=r.OPTIMISE_TABS,Ka=(0,n.memo)(({__:e,activeTab:i,problemsList:s,onSetMonacoPosition:l})=>i!==sp?null:s?.length?(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-8",children:(0,t.jsx)(o.ui_kit$Col,{span:24,children:(0,t.jsx)(o.ui_kit$List,{itemLayout:"horizontal",dataSource:s,renderItem:a=>(0,t.jsx)(o.ui_kit$List.Item,{className:o.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,t.jsx)(o.ui_kit$List.Item.Meta,{avatar:a.severity<6?(0,t.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:o.icons$CloseCircleFilled,className:r.WARNINGS}):(0,t.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:o.icons$CloseCircleFilled,className:r.ERRORS}),title:(0,t.jsxs)(o.ui_kit$Text,{onClick:()=>l(a),className:(0,We.default)("optimise__text-clickable",{warning:a.severity<6,error:a.severity>=6}),children:["Line: ",a.startLineNumber," ",a.startLineNumber!==a.endLineNumber&&" – "+a.endLineNumber]}),description:(0,t.jsx)(o.ui_kit$Text,{children:a.message})})})})})}):(0,t.jsx)(o.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,t.jsx)(o.ui_kit$Alert,{title:e("No problems found."),type:"info"})}));Ka.displayName="ProblemsSection";var lp={activeTab:"",selectedTags:[],validateLinks:[],validateImages:[],validateSpamResult:{},optimisationCounter:0,linkCheckCounter:0,imageCheckCounter:0,spamCheckCounter:0,validateLinksResult:{},validateImagesResult:{}},ap=(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}},hi={link_check:"link_check_counter",image_check:"image_check_counter",spam_check:"spam_check_counter"},Rr={link_check:"link_check_limit",image_check:"image_check_limit",spam_check:"spam_check_limit"},np=(e,i)=>{const s=Object.values(hi),l=Object.values(Rr);return s.some(a=>e?.[a]!==void 0)||l.some(a=>i?.[a]!==void 0)||s.some(a=>i?.[a]!==void 0)||l.some(a=>e?.[a]!==void 0)},uo=(e,i,s=0)=>{const l=e?.[i];return typeof l=="number"&&!Number.isNaN(l)?l:s},dp=(e,i)=>({counter:e,limit:i,disabled:i>0&&e>=i}),cp=({appConfig:e,data:i,isSuccess:s,optimisationCounter:l,linkCheckCounter:a,imageCheckCounter:d,spamCheckCounter:c,setOptimisationCounter:p,setLinkCheckCounter:g,setImageCheckCounter:b,setSpamCheckCounter:k})=>{const h=(0,n.useMemo)(()=>!!(e.limits&&e.counters)&&!0,[e]),m=(0,n.useMemo)(()=>e.counters,[e,i]),S=(0,n.useMemo)(()=>e.limits,[e,i]),x=(0,n.useMemo)(()=>h&&np(m,S),[h,m,S]),f=(0,n.useMemo)(()=>uo(S,"optimization_limit",0),[S]),y=(0,n.useMemo)(()=>!x&&l>=f&&f>0,[x,l,f]),v=(0,n.useMemo)(()=>{const B={link_check:a,image_check:d,spam_check:c};return Object.keys(Rr).reduce((C,$)=>{const U=Rr[$],L=x?uo(S,U,0):f,F=x?B[$]:l;return C[$]=dp(F,L),C},{})},[x,S,f,a,d,c,l]),N=B=>x?v[B].disabled:y;return(0,n.useEffect)(()=>{if(!h){const B=i?.counters;s&&B?.optimization_counter&&p(B.optimization_counter);return}p(uo(m,"optimization_counter",0)),x&&(g(uo(m,hi.link_check,0)),b(uo(m,hi.image_check,0)),k(uo(m,hi.spam_check,0)))},[h,x,i,s,m,p,g,b,k]),{limitsInPlugin:h,perTypeAvailable:x,currentBillingOptimisationLimits:f,disableFields:y,typeLimits:v,isTypeDisabled:N}},up=()=>{const e=(0,n.useRef)(null);return{showImgPreviewHandler:(0,n.useCallback)((i,s)=>{e.current&&clearTimeout(e.current);let l=document.querySelector(".img-preview"),a=document.querySelector(".img-preview-content");document.querySelector(".img-preview")||(l=document.createElement("div"),l.classList.add("img-preview"),a=document.createElement("div"),a.classList.add("img-preview-content"),l.append(a),document.querySelector(".email-pane__col_settings-inner")?.append(l)),a&&(a.innerHTML=`<table cellspacing="0" cellpadding="0" border="0" width="100%"><img height="auto" width=${(s||0)+"px"} alt="" style="max-width: 100%; object-fit: contain" src=${i}></table>`),l&&l.style.opacity!=="1"&&setTimeout(()=>{l&&(l.style.opacity="1",l.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:mp,IMAGES:pp}=r.OPTIMISE_TABS,hp=({activeTab:e,selectedTags:i,validateLinksResult:s,validateImagesResult:l,setValidateLinks:a,setValidateImages:d})=>{(0,n.useEffect)(()=>{e===mp&&s.links&&a(i.length>0?s.links.filter(c=>i.includes(c.status)):s.links),e===pp&&l.images&&d(i.length>0?l.images.filter(c=>i.includes(c.status)):l.images)},[s.links,l.images,i,e,a,d])},bp=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,qa=e=>e.statusCode!==null&&e.statusCode<300?r.VALID:e.statusCode<400&&e.statusCode>=300||e.statusCode===200&&!e.valid?r.WARNINGS:r.ERRORS,Ja=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}),gp={ai:(0,t.jsx)(r.EmIcons,{icon:"AIRequests",component:o.icons$AIRequests}),email_generate:(0,t.jsx)(r.EmIcons,{icon:"EmailEnvelope",component:o.icons$EmailEnvelope}),image_generate:(0,t.jsx)(r.EmIcons,{icon:"Image",component:o.icons$Image}),optimization:(0,t.jsx)(r.EmIcons,{icon:"Optimization",component:o.icons$Optimization}),preview:(0,t.jsx)(r.EmIcons,{icon:"SendOutlined",component:o.icons$SendOutlined}),test_sends:(0,t.jsx)(r.EmIcons,{icon:"SendOutlined",component:o.icons$SendOutlined}),link_check:(0,t.jsx)(r.EmIcons,{icon:"Web",component:o.icons$Web}),image_check:(0,t.jsx)(r.EmIcons,{icon:"Image",component:o.icons$Image}),spam_check:(0,t.jsx)(r.EmIcons,{icon:"Block",component:o.icons$Block}),projects:(0,t.jsx)(r.EmIcons,{icon:"FolderOpen",component:o.icons$FolderOpen}),emails:(0,t.jsx)(r.EmIcons,{icon:"EmailEnvelope",component:o.icons$EmailEnvelope}),blocks:(0,t.jsx)(r.EmIcons,{icon:"Block",component:o.icons$Block}),users:(0,t.jsx)(r.EmIcons,{icon:"SliderGroup",component:o.icons$SliderGroup})};function Qa(e,i){if(e==null)return null;if(typeof e=="number"||typeof e=="string"){const s=e==="∞"||typeof e=="string"&&e.toLowerCase()==="infinity";return(0,t.jsx)("span",{className:i==="old"?"limit-upgrade-modal__limit-old":`limit-upgrade-modal__limit-new${s?" limit-upgrade-modal__limit-new--infinity":""}`,children:s?"∞":e})}return e}var bi=({open:e,onClose:i,title:s,subtitle:l,usageResource:a,icon:d,previousDisplay:c,nextDisplay:p,onChangePlan:g,secondaryAction:b,changePlanLabel:k})=>{const{__:h}=r.useI18n(),m=k??h("Change plan"),S=!!b,x=a!=null?gp[a]:d??null;return(0,t.jsx)(o.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,t.jsxs)("div",{className:"limit-upgrade-modal__wrap",children:[(0,t.jsx)("div",{className:"limit-upgrade-modal__header",children:(0,t.jsx)("button",{type:"button",className:"limit-upgrade-modal__close",onClick:i,"aria-label":h("Close"),children:(0,t.jsx)(r.EmIcons,{icon:"CloseOutlined",component:o.icons$CloseOutlined})})}),(0,t.jsxs)("div",{className:"limit-upgrade-modal__body",children:[(0,t.jsx)("h1",{className:"limit-upgrade-modal__title",children:s}),(0,t.jsx)("p",{className:"limit-upgrade-modal__subtitle",children:l}),(0,t.jsxs)("div",{className:"limit-upgrade-modal__limits-row",children:[(0,t.jsx)("div",{className:"limit-upgrade-modal__icon-circle","aria-hidden":!0,children:x}),Qa(c,"old"),(0,t.jsx)("div",{className:"limit-upgrade-modal__arrow-btn","aria-hidden":!0,children:(0,t.jsx)(r.EmIcons,{icon:"ArrowUpOutlined",component:o.icons$ArrowUpOutlined,className:"limit-upgrade-modal__arrow-icon"})}),Qa(p,"new")]})]}),(0,t.jsx)("hr",{className:"limit-upgrade-modal__divider"}),(0,t.jsx)("div",{className:S?"limit-upgrade-modal__footer limit-upgrade-modal__footer--dual":"limit-upgrade-modal__footer",children:b?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Button,{className:"limit-upgrade-modal__cta-secondary",onClick:b.onClick,children:b.label}),(0,t.jsx)(o.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:g,children:m})]}):(0,t.jsx)(o.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:g,children:m})})]})})},{LINKS:Tr,IMAGES:yr,SPAM_ASSASSIN:Za,PROBLEMS:wr}=r.OPTIMISE_TABS,en={textDecoration:"underline",cursor:"pointer",background:"none",border:"none",padding:0,font:"inherit",color:"inherit"},fp={link_check:"LinkCheckCount",image_check:"ImageCheckCount",spam_check:"SpamCheckCount"},_p={link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"},tn=(e,i,s,l)=>`${e} ${s("of")} ${i>0?i:"∞"} ${l("test","tests",i>0?i:e)} ${l("was used","were used",e)}`,on=()=>{const{__:e,_n:i}=r.useI18n(),s=r.useDispatch(),l=r.useOpenPlanCatalog(),a=r.useAppNavigate(),d=r.useNotification(),c=r.useContentReader(),p=r.useAppConfig(),g=r.useEditorProjectId(),b=r.useRouteEmailId(),{document:k}=r.useDocumentSessionContext(),h=r.useEmailOfDocument(k,void 0),m=b||(h?.id!=null?String(h.id):void 0),S=m||h?.renderGuid,x=g||(h?.project!=null?String(h.project):void 0),[f,y]=(0,n.useState)(null),v=(0,n.useRef)(!1),N=(0,n.useRef)({link_check:!1,image_check:!1,spam_check:!1}),B=r.useProjectPlanLimitPreflight(),C=(0,n.useCallback)(I=>{y(I)},[]),$=(0,n.useCallback)((I,se)=>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"}[se],previousDisplay:e("—"),nextDisplay:r.presetLimitDisplay("infinity")}),s(r.limitsApi.util.invalidateTags(["LimitsStats","LimitsWarnings"])),!0):!1,[s,e,C]),U=(0,n.useCallback)((I,se)=>{$(I,se)||d.error({error:I})},[$,d]),L=(0,n.useCallback)(async I=>!0,[s,B,C]),F=r.useMessageService(),P=r.useSelector(r.selectProblemsList),H=r.useEventEmitter(ht.events.ON_LIMIT_ID),ae=r.usePushToDataLayer(),[T,te]=(0,n.useReducer)(ap,lp),[xe,be]=r.useEditSpamMutation(),[ye,me]=r.useEditLinksMutation(),[he,ke]=r.useEditImagesMutation(),{data:ce,isSuccess:ze}=r.useGetProjectQuery(+(x||0),{skip:!0}),Oe=r.useInvalidateProject(),ve=(0,n.useCallback)(I=>te({type:"SET_OPTIMISATION_COUNTER",payload:I}),[]),Ee=(0,n.useCallback)(I=>te({type:"SET_LINK_CHECK_COUNTER",payload:I}),[]),pe=(0,n.useCallback)(I=>te({type:"SET_IMAGE_CHECK_COUNTER",payload:I}),[]),Q=(0,n.useCallback)(I=>te({type:"SET_SPAM_CHECK_COUNTER",payload:I}),[]),X=(0,n.useCallback)(I=>te({type:"SET_VALIDATE_LINKS",payload:I}),[]),Z=(0,n.useCallback)(I=>te({type:"SET_VALIDATE_IMAGES",payload:I}),[]),J=(0,n.useCallback)(I=>te({type:"SET_SELECTED_TAGS",payload:I}),[]),{limitsInPlugin:V,perTypeAvailable:M,currentBillingOptimisationLimits:Y,disableFields:K,typeLimits:ee,isTypeDisabled:le}=cp({appConfig:p,data:ce,isSuccess:ze,optimisationCounter:T.optimisationCounter,linkCheckCounter:T.linkCheckCounter,imageCheckCounter:T.imageCheckCounter,spamCheckCounter:T.spamCheckCounter,setOptimisationCounter:ve,setLinkCheckCounter:Ee,setImageCheckCounter:pe,setSpamCheckCounter:Q});hp({activeTab:T.activeTab,selectedTags:T.selectedTags,validateLinksResult:T.validateLinksResult,validateImagesResult:T.validateImagesResult,setValidateLinks:X,setValidateImages:Z});const{showImgPreviewHandler:Re,hideBlockPreviewHandler:Be}=up(),$e=(0,n.useCallback)(I=>I==="link_check"?T.linkCheckCounter:I==="image_check"?T.imageCheckCounter:T.spamCheckCounter,[T.linkCheckCounter,T.imageCheckCounter,T.spamCheckCounter]),z=(0,n.useCallback)(I=>{if(V){if(M){te({type:{link_check:"INCREMENT_LINK_CHECK_COUNTER",image_check:"INCREMENT_IMAGE_CHECK_COUNTER",spam_check:"INCREMENT_SPAM_CHECK_COUNTER"}[I]}),H.fire({name:fp[I],count:$e(I)+1});return}te({type:"INCREMENT_OPTIMISATION_COUNTER"}),H.fire({name:"OptimizationCount",count:T.optimisationCounter+1})}},[V,M,H,$e,T.optimisationCounter]),re=(0,n.useCallback)(I=>{if(M){const{limit:se}=ee[I];C({presetId:_p[I],previousDisplay:se>0?se:r.presetLimitDisplay("infinity"),nextDisplay:r.presetLimitDisplay("infinity")});return}C({presetId:"optimization_exceeded",previousDisplay:Y,nextDisplay:r.presetLimitDisplay("infinity")})},[M,ee,C,Y]),Pe=(0,n.useCallback)(()=>{a(p.billingPageUrl||r.APP_ROUTES.billing)},[p.billingPageUrl,a]),G=I=>{if(!V||!M)return null;const{counter:se,limit:je,disabled:Ne}=ee[I];return(0,t.jsx)(o.ui_kit$LimitsCounter,{text:tn(se,je,e,i),exceeded:Ne,extra:(0,t.jsx)("button",{type:"button",style:en,onClick:Pe,children:e("Need more?")})})},Se=(0,n.useCallback)((I,se)=>{F.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_LINK,settings:{elementId:I,isError:se}})},[F]),Fe=(0,n.useCallback)((I,se)=>{F.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_IMG,settings:{elementId:I,isError:se}})},[F]),Ae=(0,n.useCallback)(I=>{const se={startColumn:I.startColumn,startLineNumber:I.startLineNumber,endColumn:I.endColumn,endLineNumber:I.endLineNumber};s(r.setActiveProblemRange(se))},[s]),Ve=(0,n.useCallback)(I=>{te({type:"SET_ACTIVE_TAB",payload:I}),te({type:"RESET_SELECTED_TAGS"}),I===wr&&P?.length>0&&ae({event:"check",action:"check_email_code",email_id:m,project_id:x,problems_count:P?.length||0})},[P,ae,m,x]),Ue=(0,n.useCallback)(async()=>{if(!S){d.error({title:"Save the mail first."});return}if(le("link_check")){re("link_check");return}if(!await L("link_check"))return;z("link_check");const I=c(),se=new DOMParser().parseFromString(I,"text/html"),je={},Ne={};se.querySelectorAll("a[href]").forEach((He,Ke)=>{je[`link_${Ke}`]=He.getAttribute("href"),Ne[`link_${Ke}`]=He.textContent||""}),F.send({operation:"sandbox_set_attr_to_links"}),ye({entity_id:S,data:je}).then(({data:He,error:Ke})=>{if(Ke)U(Ke,"link_check");else if(He?.result){const tt=[...He.result];tt?.sort((j,w)=>j.linkId-w.linkId);const O=tt.map(j=>({...j,text:Ne[j.linkId],status:bp(j)})),ie={links:O,summary:Ja(O)};te({type:"SET_VALIDATE_LINKS_RESULT",payload:ie}),d.success(e("Links validation was successfully completed")),He.limit_warning&&He.limit_remaining!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${He.limit_remaining}`}),ae({event:"check",action:"check_email_links",email_id:m,project_id:x,links_count:ie.links?.length||0})}else He.statusCode>300||!He.success?d.error({error:{data:He}}):d.error({title:e("Something went wrong.")}),!T.validateLinksResult.links&&Ve("")}).catch(He=>{U(He,"link_check")})},[m,S,le,re,L,z,c,F,ye,d,e,ae,x,Oe,T.validateLinksResult.links,U,Ve]),Xe=(0,n.useCallback)(async()=>{if(!S){d.error({title:"Save the mail first."});return}if(le("image_check")){re("image_check");return}if(!await L("image_check"))return;z("image_check");const I=c(),se=new DOMParser().parseFromString(I,"text/html"),je={};se.querySelectorAll("img").forEach((Ne,He)=>je[`image_${He}`]=Ne.src),F.send({operation:"sandbox_set_attr_to_images"}),he({entity_id:S,data:je}).then(({data:Ne,error:He})=>{let Ke;if(He)U(He,"image_check");else if(Ne?.result){const tt=Object.values(Ne.result);tt.sort((ie,j)=>ie.imageId-j.imageId);const O=tt.reduce((ie,j)=>ie+Math.round(j.image.bytes/1024),0);Ke={images:tt.map(ie=>({...ie,status:qa(ie)}))||[],summary:Ja(tt.map(ie=>({...ie,status:qa(ie)}))),summaryTime:{value:(O>1200?O/1e3:O).toFixed(1),name:O>1200?e("MB"):e("KB")}},Ke&&te({type:"SET_VALIDATE_IMAGES_RESULT",payload:Ke}),d.success(e("Images validation was successfully completed")),Ne.limit_warning&&Ne.limit_remaining!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${Ne.limit_remaining}`}),ae({event:"check",action:"check_email_images",email_id:m,project_id:x,images_count:Ke.images?.length||0})}else Ne.statusCode>300||!Ne.success?d.error({error:{data:Ne}}):d.error({title:e("Something went wrong.")}),!T.validateImagesResult?.images?.length&&Ve("")}).catch(Ne=>{U(Ne,"image_check")})},[m,S,le,re,L,z,c,F,he,d,e,ae,x,Oe,T.validateImagesResult,U,Ve]),ne=(0,n.useCallback)(async()=>{if(!S){d.error({title:"Save the mail first."});return}if(le("spam_check")){re("spam_check");return}await L("spam_check")&&(z("spam_check"),xe({entity_id:S,data:{html:c()}}).then(({data:I,error:se})=>{if(se)U(se,"spam_check");else if(I&&I.success){const je=!!I.result.report&&Object.values(I.result.report);je?(je.sort((Ne,He)=>Ne.score-He.score),te({type:"SET_VALIDATE_SPAM_RESULT",payload:{...I.result,report:je}})):I.result&&te({type:"SET_VALIDATE_SPAM_RESULT",payload:{...I.result,report:je}}),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}`}),ae({event:"check",action:"check_email_spam",email_id:m,project_id:x,spam_score:I.result?.spamScore||0})}else I.statusCode>300||!I.success?d.error({error:{data:I}}):d.error({title:e("Something went wrong.")}),!T.validateSpamResult?.report?.length&&Ve("")}).catch(I=>{U(I,"spam_check")}))},[m,S,le,re,L,z,c,xe,d,e,ae,x,Oe,T.validateSpamResult,U,Ve]);(0,n.useEffect)(()=>{if(V){if(M){["link_check","image_check","spam_check"].forEach(I=>{const{limit:se,counter:je,disabled:Ne}=ee[I];if(!Ne){N.current[I]=!1;return}N.current[I]||se>0&&je>=se&&(N.current[I]=!0,re(I))});return}if(!(Y>0&&T.optimisationCounter>=Y)){v.current=!1;return}v.current||(v.current=!0,re("link_check"))}},[V,M,ee,T.optimisationCounter,Y,re]);const Te=f?r.getLimitUpgradePresetDefinition(f.presetId):null;return(0,t.jsxs)("div",{className:"optimise selected_form-props-wrapper selected_form-props-wrapper_optimize",children:[Te&&f?(0,t.jsx)(bi,{open:!0,onClose:()=>y(null),title:e(Te.titleKey),subtitle:e(Te.subtitleKey),usageResource:Te.usageResource,previousDisplay:f.previousDisplay,nextDisplay:f.nextDisplay,onChangePlan:()=>{y(null),l()}}):null,V&&!M&&(0,t.jsx)(o.ui_kit$LimitsCounter,{text:tn(T.optimisationCounter,Y,e,i),exceeded:K,extra:(0,t.jsx)("button",{type:"button",style:en,onClick:Pe,children:e("Need more?")})}),p.optimizeLinksEnabled&&(0,t.jsxs)(t.Fragment,{children:[G("link_check"),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,align:"middle",children:[(0,t.jsx)(o.ui_kit$Col,{span:20,children:(0,t.jsx)("div",{style:{padding:"15px 0"},children:e("Links validation")})}),(0,t.jsx)(o.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,t.jsx)(o.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:I=>I.preventDefault(),onClick:()=>{Ve(Tr),!T.validateLinksResult?.links?.length&&T.activeTab!==Tr&&Ue()},loading:me.isLoading,disabled:le("link_check")&&!T.validateLinksResult?.links?.length,children:!me.isLoading&&(T.activeTab===Tr?(0,t.jsx)(r.EmIcons,{icon:"DownOutlined",component:o.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,t.jsx)(r.EmIcons,{icon:"RightOutlined",component:o.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth}))})})]}),(0,t.jsx)(Ga,{__:e,activeTab:T.activeTab,validateLinksResult:T.validateLinksResult,validateLinks:T.validateLinks,selectedTags:T.selectedTags,setSelectedTags:J,isLoading:me.isLoading,disabled:le("link_check"),iconStrokeWidth:p.iconStrokeWidth,onValidate:Ue,goToLinkHandler:Se})]}),p.optimizeImagesEnabled&&(0,t.jsxs)(t.Fragment,{children:[G("image_check"),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,align:"middle",children:[(0,t.jsx)(o.ui_kit$Col,{span:20,children:(0,t.jsx)("div",{style:{padding:"15px 0"},children:e("Images validation")})}),(0,t.jsx)(o.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,t.jsx)(o.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:I=>I.preventDefault(),onClick:()=>{Ve(yr),!T.validateImagesResult?.images?.length&&T.activeTab!==yr&&Xe()},loading:ke.isLoading,children:!ke.isLoading&&(T.activeTab===yr?(0,t.jsx)(r.EmIcons,{icon:"DownOutlined",component:o.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,t.jsx)(r.EmIcons,{icon:"RightOutlined",component:o.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth}))})})]}),(0,t.jsx)(Ya,{__:e,activeTab:T.activeTab,validateImagesResult:T.validateImagesResult,validateImages:T.validateImages,selectedTags:T.selectedTags,setSelectedTags:J,isLoading:ke.isLoading,disabled:le("image_check"),iconStrokeWidth:p.iconStrokeWidth,onValidate:Xe,goToImageHandler:Fe,showImgPreviewHandler:Re,hideBlockPreviewHandler:Be})]}),p.optimizeSpamAssassinEnabled&&(0,t.jsxs)(t.Fragment,{children:[G("spam_check"),(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,align:"middle",children:[(0,t.jsx)(o.ui_kit$Col,{span:20,children:(0,t.jsx)("div",{style:{padding:"15px 0"},children:e("SpamAssassin")})}),(0,t.jsx)(o.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,t.jsx)(o.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:I=>I.preventDefault(),loading:be.isLoading,onClick:()=>{Ve(Za),T.validateSpamResult.report?.length||Object.prototype.hasOwnProperty.call(T.validateSpamResult,"spamScore")||ne()},disabled:le("spam_check")&&!(T.validateSpamResult?.report?.length||Object.prototype.hasOwnProperty.call(T.validateSpamResult,"spamScore")),children:!be.isLoading&&(T.activeTab===Za?(0,t.jsx)(r.EmIcons,{icon:"DownOutlined",component:o.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,t.jsx)(r.EmIcons,{icon:"RightOutlined",component:o.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth}))})})]}),(0,t.jsx)(Xa,{__:e,activeTab:T.activeTab,validateSpamResult:T.validateSpamResult,isLoading:be.isLoading,disabled:le("spam_check"),iconStrokeWidth:p.iconStrokeWidth,onValidate:ne})]}),p.optimizeCheckCodeEnabled&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,t.jsxs)(o.ui_kit$Row,{gutter:10,align:"middle",children:[(0,t.jsx)(o.ui_kit$Col,{span:20,children:(0,t.jsx)("div",{style:{padding:"15px 0"},children:e("Source code validation")})}),(0,t.jsx)(o.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,t.jsx)(o.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:I=>I.preventDefault(),onClick:()=>Ve(wr),children:T.activeTab===wr?(0,t.jsx)(r.EmIcons,{icon:"DownOutlined",component:o.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,t.jsx)(r.EmIcons,{icon:"RightOutlined",component:o.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth})})})]}),(0,t.jsx)(Ka,{__:e,activeTab:T.activeTab,problemsList:P,onSetMonacoPosition:Ae})]})]})},xp=({state:e,onCancel:i,onRetry:s,onDismiss:l})=>{const{__:a}=r.useI18n();return e.kind==="hidden"?null:(0,t.jsx)("div",{className:"indexing-tray",role:"status","aria-live":"polite",children:(0,t.jsx)(o.ui_kit$Card,{size:"small",variant:"borderless",className:"indexing-tray__card",children:(0,t.jsxs)(o.ui_kit$Flex,{vertical:!0,gap:8,children:[kp(e,a),(0,t.jsx)(o.ui_kit$Flex,{justify:"flex-end",children:Ep(e,{onCancel:i,onRetry:s,onDismiss:l},a)})]})})})};function kp(e,i){switch(e.kind){case"scanning":return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(o.ui_kit$Flex,{align:"center",gap:8,children:[(0,t.jsx)(o.ui_kit$Spin,{size:"small"}),(0,t.jsx)(o.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Moving files from old storage…")})]}),(0,t.jsx)(o.ui_kit$Text,{type:"secondary",children:i("Found so far: %s").replace("%s",String(e.scanned))}),(0,t.jsx)(o.ui_kit$Progress,{percent:100,status:"active",showInfo:!1,strokeColor:r.emCssVar("colorPrimary")})]});case"indexing":{const s=e.total>0?Math.min(100,Math.round(e.scanned/e.total*100)):0;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Indexing files…")}),(0,t.jsx)(o.ui_kit$Text,{type:"secondary",children:`${e.scanned} / ${e.total}`}),(0,t.jsx)(o.ui_kit$Progress,{percent:s,status:"active",strokeColor:r.emCssVar("colorPrimary")})]})}case"done":return(0,t.jsx)(o.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,t.jsx)(o.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Could not move files from old storage")});case"cancelled":return(0,t.jsx)(o.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Move stopped")});default:return null}}function Ep(e,i,s){switch(e.kind){case"scanning":case"indexing":return(0,t.jsx)(o.ui_kit$Button,{type:"link",size:"small",onClick:i.onCancel,disabled:e.cancelling,children:e.cancelling?s("Stopping…"):s("Cancel")});case"failed":return(0,t.jsx)(o.ui_kit$Button,{type:"link",size:"small",onClick:i.onRetry,children:s("Retry")});case"cancelled":return(0,t.jsx)(o.ui_kit$Button,{type:"link",size:"small",onClick:i.onRetry,children:s("Resume")});case"done":return(0,t.jsx)(o.ui_kit$Button,{type:"link",size:"small",onClick:i.onDismiss,children:s("Close")});default:return null}}var Sp=2500,rn=48,Bp=4e3;function Rp(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 Tp(e){return e.kind==="done"||e.kind==="failed"||e.kind==="cancelled"}function yp({projectId:e,api:i,triggered:s,onCompleted:l}){const[a,d]=(0,n.useState)({kind:"hidden"}),c=(0,n.useRef)(!1),p=(0,n.useRef)(!0),g=(0,n.useRef)(e);g.current=e;const b=(0,n.useRef)(s);b.current=s;const k=(0,n.useRef)(l);k.current=l,(0,n.useEffect)(()=>(p.current=!0,()=>{p.current=!1}),[]),(0,n.useEffect)(()=>{d({kind:"hidden"})},[e]);const h=(0,n.useCallback)(async()=>{try{const S=await i.files.backfillList({project_id:e});return!S.ok||S.error?null:Rp(S.data)}catch{return null}},[i,e]),m=(0,n.useCallback)(async()=>{if(c.current)return;c.current=!0;const S=g.current;let x=0;try{for(;p.current&&g.current===S&&b.current;){const f=await h();if(!p.current)break;if(f)if(f.kind==="hidden"){if(x+=1,x>=rn){d({kind:"failed"});break}}else{if(x=0,d(f),f.kind==="done")try{await k.current?.()}catch{}if(Tp(f))break}else if(x+=1,x>=rn){d({kind:"failed"});break}await new Promise(y=>setTimeout(y,Sp))}}finally{c.current=!1}},[h]);return(0,n.useEffect)(()=>{s&&m()},[s,m]),(0,n.useEffect)(()=>{if(a.kind!=="done")return;const S=setTimeout(()=>{p.current&&d({kind:"hidden"})},Bp);return()=>clearTimeout(S)},[a.kind]),{state:a,cancel:(0,n.useCallback)(()=>{d(S=>S.kind==="scanning"||S.kind==="indexing"?{...S,cancelling:!0}:S),i.files.backfillCancelCreate({project_id:e})},[i,e]),retry:(0,n.useCallback)(()=>{b.current=!0,i.files.backfillCreate({project_id:e}),m()},[i,e,m]),dismiss:(0,n.useCallback)(()=>d({kind:"hidden"}),[])}}var wp=r.lazyRoute(()=>(0,Ao.__vitePreload)(()=>Promise.resolve().then(()=>_t("./87c47034.js")),void 0,{}.url)),jp=r.lazyRoute(()=>(0,Ao.__vitePreload)(()=>Promise.resolve().then(()=>_t("./78916fed.js")),void 0,{}.url)),sn={height:"100%"};function vp(e){(e?(0,Ao.__vitePreload)(()=>Promise.resolve().then(()=>_t("./a15ab3fe.js")),void 0,{}.url):(0,Ao.__vitePreload)(()=>Promise.resolve().then(()=>_t("./312fb954.js")),void 0,{}.url)).catch(()=>{})}var Ip=({storageProvider:e,dataProvider:i,pathProxy:s,usesBuiltInStorage:l,contentKey:a})=>{const d=r.useAppConfig(),c=r.isImageEditModal(r.useSelector(r.selectActiveModal$1)),p=!!d.imageCenterFileManagerView;(0,n.useEffect)(()=>{c&&vp(p)},[c,p]);let g=(0,t.jsx)(o.ui_kit$PageLoader,{style:sn});return e&&i&&d.imageCenterFileManagerView?g=(0,t.jsx)(wp,{storageProvider:e,dataProvider:i,pathProxy:s},a):e&&i&&(g=(0,t.jsx)(jp,{dataProvider:i,usesBuiltInStorage:l},a)),(0,t.jsx)(n.Suspense,{fallback:(0,t.jsx)(o.ui_kit$PageLoader,{style:sn}),children:g})};function Cp(){const e=r.useAppConfig(),i=r.useIsStandalone(),s=r.useStorageProvider(),l=r.useProjectData(),a=r.useRestClient(r.EM_FILES_MODULES),d=r.useStore(),c=(0,n.useMemo)(()=>r.createRestClientV2(d),[d]),p=r.useI18n(),g=r.useCurrentUser(),b=l?.id?String(l.id):"",k=g?.id!=="0"?String(g.id):"",h=r.isFileManagerV2Enabled(e),[m,S]=(0,n.useState)(null),x=h&&!!b&&m===b,[f,y]=(0,n.useState)(0),[v,N]=(0,n.useState)(0),B=(0,n.useRef)(b);(0,n.useEffect)(()=>{B.current!==b&&(B.current=b,S(null))},[b]);const C=(0,n.useCallback)(F=>{F&&b&&S(b)},[b]),$=(0,n.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:s,projectId:b,restApi:a,restApiV2:c,i18n:p,pathPostfix:k,appConfig:e,isStandalone:i,onIndexingStateChange:C}),[e,C,p,i,b,f,a,c,s,k]),U=(0,n.useCallback)(async()=>{try{typeof $.dataProvider?.clearCache=="function"&&await $.dataProvider.clearCache()}catch{}S(null),y(F=>F+1),N(F=>F+1)},[$.dataProvider]),L=(0,n.useCallback)(()=>{b&&S(b)},[b]);return{...$,projectId:b,restApiV2:c,v2Enabled:h,backfillTriggered:x,contentKey:`${b}:${v}`,handleIndexingCompleted:U,markIndexingStarted:L}}var Pp={height:"100%"},ln=()=>{const{storageProvider:e,dataProvider:i,pathProxy:s,usesBuiltInStorage:l,projectId:a,restApiV2:d,v2Enabled:c,backfillTriggered:p,contentKey:g,handleIndexingCompleted:b,markIndexingStarted:k}=Cp(),h=r.useSelector(r.selectActiveModal$1),m=r.isImageCenterModal(h),{state:S,cancel:x,retry:f,dismiss:y}=yp({projectId:a,api:d,triggered:p,onCompleted:b}),v=n.default.useCallback(()=>{k(),f()},[k,f]);return(0,t.jsxs)(t.Fragment,{children:[m&&(0,t.jsx)(n.Suspense,{fallback:(0,t.jsx)(o.ui_kit$PageLoader,{style:Pp}),children:(0,t.jsx)(Ip,{storageProvider:e,dataProvider:i,pathProxy:s,usesBuiltInStorage:l,contentKey:g})}),c&&(0,t.jsx)(xp,{state:S,onCancel:x,onRetry:v,onDismiss:y})]})},Ap=(function(){var e=window.__emailmaker__;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 Np(e){return!!(e?.global_block??e?.acf?.global_block)}var Lp=({className:e,size:i=16})=>{const s=r.useAppConfig(),{__:l}=r.useI18n(),a=l("Global block");return(0,t.jsx)(o.ui_kit$Tooltip,{title:a,placement:"top",trigger:["hover"],children:(0,t.jsx)("span",{className:(0,We.default)("block-global-badge",e),"aria-label":a,role:"img",children:(0,t.jsx)(r.EmIcons,{icon:"Globe02Icon",component:o.icons$Globe02Icon,size:i,strokeWidth:s.iconStrokeWidth})})})},an=new Map;function nn(e){return`<table cellspacing="0" cellpadding="0" border="0" width="100%">${e}</table>`}function jr(e,i){const s=i??"";if(e===void 0)return r.sanitizeHtml(nn(s));const l=String(e),a=an.get(l);if(a&&a.source===s)return a.markup;const d=r.sanitizeHtml(nn(s));return an.set(l,{source:s,markup:d}),d}function Op(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function vr(e){return!r.isBlocksV2Enabled()||e.html&&e.html.trim()!==""?e.html:`<tr><td style="padding:16px 20px;font-family:Arial,sans-serif;font-size:14px;line-height:20px;color:#5b6370;background:#f4f5f7">${Op(e.title??"")}</td></tr>`}function dn(e){return e?Date.parse(e):NaN}function $p(e){return r.isBlocksV2Enabled()&&e.id!=null&&r.isBlockAutosaveInFlight(String(e.id))}function cn(e,i){if(!r.isBlocksV2Enabled()||i.id==null)return i.html;const s=String(i.id);if(r.isBlockAutosaveInFlight(s))return;const l=r.blocksApi.endpoints.getBlock.select(s)(e());if(l.data?.html===void 0)return i.html;const a=dn(i.modified);return Number.isNaN(a)||dn(l.data.modified)>a?l.data.html:i.html}async function un(e,i){return await new Promise(s=>r.whenBlockAutosaveSettledWithin(String(i.id),r.getSaveTimeoutMs(),s))?cn(e,i):void 0}var Ir=new Set;function Fp(e,i){const s=String(i.id);return Ir.has(s)?null:(Ir.add(s),un(e,i).finally(()=>Ir.delete(s)))}function Mp(e,i){return e?i.openBlockFromEmailEnabled===!0?"over-email":null:"link"}var Dp={fontSize:"16px",margin:0},{name:Cr,type:mn,tags:pn}={name:"name",type:"type",tags:"tags"},hn={[Cr]:"",[mn]:[],[pn]:[]},mo={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},Pr=({parentEmailId:e,blocksTab:i,search:s,reloadBlockScreens:l,setIsShowAddAllBlocksModal:a})=>{const{parentId:d}=r.useBlocksParentId(e),c=r.useEditorProjectId(),p=r.useSetHtmlElementInIframeHandler(),g=r.useDragStartBlockToIframeHandler(),[b]=o.ui_kit$Form.useForm(),{data:k}=r.useGetBlockTypesQuery(),{token:h}=(0,o.ui_kit$useToken)(),{__:m,_x:S}=r.useI18n(),x=r.useNotification(),{modal:f}=o.ui_kit$App.useApp(),{confirm:y}=f,v={pathname:r.useRoutePathname()},N=r.useAppConfig(),B=r.useSelector(r.selectParentBlocks),C=aa(),$=(0,n.useRef)(null),U=(0,n.useRef)(null),L=r.useRootElement(),F=660,P=207/F,H=R=>Np(R)?(0,t.jsx)("div",{className:"blocks-search__result-global-mark",children:(0,t.jsx)(Lp,{className:"block-global-badge--tile",size:14})}):null,ae=r.useEmailAttribute("common_styles"),T=(0,n.useMemo)(()=>da(ae,C),[ae,C]),te=(0,n.useRef)(null),xe=(0,n.useRef)(null),be=(0,n.useRef)(null),ye=r.useStore(),me=(R,oe=!1)=>(E,de,Ce,Qe,Me)=>{if(!r.isBlocksV2Enabled()){R(E,de,Ce,Qe,Me);return}const Et=pt=>{if(pt===void 0){x.error({id:"BLOCK_GET_ERROR",title:m("Failed to load")});return}if(pt===Me.html){R(E,de,Ce,Qe,Me);return}R(E,Ce==="common"?st({html:pt}):pt,Ce,Qe,{...Me,html:pt})},Mt=()=>ye.getState();if(!$p(Me)){Et(cn(Mt,Me));return}(oe?Fp(Mt,Me):un(Mt,Me))?.then(Et)},he=me(p,!0),ke=me(g);(0,n.useEffect)(()=>{U.current?.scrollTo({top:0})},[i,s]);const ce=r.useProjectData(),{data:ze}=r.useGetTermsQuery({project:ce,kind:r.BLOCK_TAGS},{skip:!ce?.id}),[Oe,ve]=(0,n.useState)(()=>r.projectBlocksArgs(c));(0,n.useEffect)(()=>{s||(b.setFieldsValue(hn),Ne({type:null,name:null}),l())},[s,b,l]),(0,n.useEffect)(()=>{if(k){const R=k;let oe=[];for(let E in R)oe.push({label:m(r.TYPES_TRANSLATE[R[E]]),value:R[E]})}},[k,m]);const{isSuccess:Ee,isError:pe,isLoading:Q,isFetching:X,data:Z,refetch:J,error:V}=r.useGetBlocksQuery({...Oe,projectId:c,page:1}),M=(0,n.useMemo)(()=>{if(Ee&&Z)return[...Z].sort((R,oe)=>mo[R.type]-mo[oe.type])},[Ee,Z]),[Y,K]=(0,n.useState)([]);r.usePrevious(R=>{R!==pe&&x.fromError("BLOCK_GET_ERROR",{},V,!0)},[pe,V,x]);const[ee,le]=(0,n.useState)(()=>r.parentEmailBlocksArgs(d,c)),{isSuccess:Re,isError:Be,isLoading:$e,isFetching:z}=r.useGetParentEmailBlocksQuery({...ee,emailId:d,page:1,...r.pageProjectKey(c)},{skip:!d||B.length}),re=(0,n.useMemo)(()=>{if(Re||B.length)return[...B].sort((R,oe)=>mo[R.type]-mo[oe.type])},[Re,B]),[Pe,G]=(0,n.useState)([]);(0,n.useEffect)(()=>{const R=new Set;if(B.length&&re){for(const oe of re)oe.type&&R.add(oe.type);G(Array.from(R))}else G([])},[B,re]);const[Se,Fe]=(0,n.useState)(()=>r.templateBlocksArgs(c)),{isSuccess:Ae,isError:Ve,isLoading:Ue,isFetching:Xe,data:ne=[]}=r.useGetTemplateBlocksQuery({...Se,page:1,...r.pageProjectKey(c)}),Te=(0,n.useMemo)(()=>{if(ne.length)return[...ne].sort((R,oe)=>mo[R.type]-mo[oe.type])},[ne]),[I,se]=(0,n.useState)([]);(0,n.useEffect)(()=>{const R=new Set;if(Te&&ne.length){for(const oe of Te)oe.type&&R.add(oe.type);se(Array.from(R))}},[ne.length,Te]);const je=(0,n.useMemo)(()=>{const R=new Set;for(const oe of Y)R.add(oe);for(const oe of Pe)R.add(oe);for(const oe of I)R.add(oe);return Array.from(R)},[I,Pe,Y]),Ne=R=>{ve(oe=>({...oe,...R,page:1})),le(oe=>({...oe,...R,page:1})),Fe(oe=>({...oe,...R,page:1}))},He=r.useFitBlockPreviewHeight(P),Ke=(0,n.useCallback)(()=>{L.querySelector(".blocks-search__result-wrapper.is_search")&&(L.querySelector(".blocks-search__result-wrapper").style.removeProperty("transition"),L.querySelector(".blocks-search__result-wrapper").style.opacity=0,r.measureBlockPreviews(L,207/F),L.querySelector(".blocks-search__result-wrapper").style.transition="opacity 0.2s",L.querySelectorAll(".blocks-search__result-wrapper").forEach(R=>R.style.opacity=1))},[F,L]);(0,n.useEffect)(()=>{!(Xe||Ue)&&Ae&&i!=="template"&&(s?Ke():l())},[Xe,Ue,Ae,Ke,Oe.name,l,s,i]),(0,n.useEffect)(()=>{const R=new Set;if(Ee&&M){for(const oe of M)oe.type&&R.add(oe.type);K(Array.from(R))}},[Ee,M]);const tt=R=>{const oe=Object.keys(R)[0],E=b.getFieldsValue(!0);switch(oe){case pn:const de=(ze||[]).filter(Ce=>R[oe].includes(Ce.name)).map(Ce=>Ce.id)||null;Ne({tags:de});break;case mn:Ne({type:E.type||null});break;case Cr:$.current&&window.clearTimeout($.current),$.current=window.setTimeout(function(){Ne({name:E.name||null})},300)}},O=R=>{l(),R.target.getAttribute("data-type")?(R.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(oe=>oe.style.display="none"),R.target.closest(".blocks-search").querySelectorAll(`[data-type="${R.target.getAttribute("data-type")}"]`).forEach(oe=>oe.style.display="block")):R.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(oe=>oe.style.display="block"),R.target.parentElement.querySelector(".active").classList.remove("active"),R.target.classList.add("active")};let ie=null;const j=R=>{clearTimeout(ie);let oe=L.querySelector(".block-search__preview")?L.querySelector(".block-search__preview"):null,E=L.querySelector(".block-search__preview-title")?L.querySelector(".block-search__preview-title"):null,de=L.querySelector(".block-search__preview-content")?L.querySelector(".block-search__preview-content"):null;L.querySelector(".block-search__preview")||(oe=document.createElement("div"),oe.classList.add("block-search__preview"),E=document.createElement("div"),E.classList.add("block-search__preview-title"),de=document.createElement("div"),de.classList.add("block-search__preview-content"),oe.append(de),oe.append(E),L.querySelector(".email-pane__col_settings-inner").append(oe)),E.innerHTML="",de.innerHTML="",E.innerHTML=R.title;let Ce=R.html.replaceAll(/<style((.|\n|\r)*?)<\/style>/gi,"").trim();de.innerHTML=r.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+Ce+"</table>"),oe.style.opacity!=="1"&&setTimeout(function(){oe.style.opacity="1",oe.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(100%)":"translateX(-100%)"},10)},w=()=>{let R=L.querySelector(".block-search__preview");R&&(ie=setTimeout(()=>{R.style.opacity="0",R.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(99%)":"translateX(-99%)",setTimeout(function(){R.remove()},300)},300))};(0,n.useEffect)(()=>{L.querySelectorAll(".blocks-search__result").forEach(R=>{R.style.display="block"})},[i]);const ue=!Z?.length&&(!d||!B?.length)&&!ne?.length&&(Oe.tags||Oe.name||Oe.type)&&!(Q||X),Ie=R=>ye.dispatch(r.blocksApi.endpoints.deleteBlock.initiate(R.id)).then(oe=>{if(oe.error){x.fromError("BLOCK_REMOVING_ERROR",r.getBlockDesc(R),oe.error);return}x.success({id:"BLOCK_REMOVING_SUCCESS",data:r.getBlockDesc(R),title:m('The block "')+R.title+S('" was successfully removed.',"block")}),J()});(0,n.useEffect)(()=>{!Q&&!X&&l()},[Q,X,l]),(0,n.useEffect)(()=>{(i==="common"||s)&&setTimeout(l,50)},[Z,l,i,s]);const qe=R=>{y({mask:{closable:!0},centered:!0,title:S("Are you sure you want to delete the “","block")+R.title+m("” block?"),icon:(0,t.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:22,style:{color:o.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0}}),okText:m("Yes"),cancelText:m("No"),onOk:()=>Ie(R)})},Ze=(R,oe)=>`${R.pathname.split("emails")[0]}blocks/${oe.id}`,dt=R=>{let oe=[{key:"Delete block",className:"blocks-search__result__menu-item",icon:(0,t.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:16,style:{margin:0}}),style:{color:h.colorError},onClick:()=>qe(R)}];const E=Mp(!0,N);return E==="link"&&oe.unshift({key:"Edit block",className:"blocks-search__result__menu-item",icon:(0,t.jsx)(r.EmIcons,{icon:"EditOutlined",component:o.icons$EditOutlined,style:{fontSize:"16px",margin:0}}),label:(0,t.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:Ze(v,R),children:" "})}),E==="over-email"&&oe.unshift({key:"Edit block",className:"blocks-search__result__menu-item",icon:(0,t.jsx)(r.EmIcons,{icon:"EditOutlined",component:o.icons$EditOutlined,style:Dp}),onClick:()=>{r.getEmitter(ht.getContainer(ye),ht.events.OPEN_BLOCK_REQUEST_ID).fireSettled(String(R.id)).then(({errors:de})=>{de.length&&x.fromError("BLOCK_GET_ERROR",r.getBlockDesc(R),de[0])})}}),oe},st=R=>{let oe=R.html.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");if(oe.replaceChildren(...r.parseFromString(R.html)),Object.keys(T).length!==0&&(oe.querySelectorAll(".em-contrast-card").forEach(E=>{T.cards?.contrastBackgroundColor&&(E.getAttribute("bgcolor")?T.cards.contrastBackgroundColor?E.setAttribute("bgcolor",T.cards.contrastBackgroundColor):E.removeAttribute("bgcolor"):T.cards.contrastBackgroundColor?E.style.backgroundColor=T.cards.contrastBackgroundColor:E.style.removeProperty("background-color")),T.cards?.contrastTextColor&&E.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(de=>{if(kt(de.style.color).toLowerCase()!=="#ffffff"){let Ce=de.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.cards.contrastTextColor};`);de.setAttribute("style",Ce)}})}),oe.querySelectorAll(".em-card").forEach(E=>{T.cards?.baseBackgroundColor&&(E.getAttribute("bgcolor")?T.cards.baseBackgroundColor?E.setAttribute("bgcolor",T.cards.baseBackgroundColor):E.removeAttribute("bgcolor"):T.cards.baseBackgroundColor?E.style.backgroundColor=T.cards.baseBackgroundColor:E.style.removeProperty("background-color")),T.cards?.baseTextColor&&E.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(de=>{if(kt(de.style.color).toLowerCase()!=="#ffffff"){let Ce=de.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.cards.baseTextColor};`);de.setAttribute("style",Ce)}})}),oe.querySelectorAll(".em-card, .em-contrast-card").forEach(E=>{T.cards?.border&&D({settings:{border:T.cards?.border},elem:E}),T.cards?.borderRadius?.all?(E.style.borderBottomLeftRadius&&E.style.borderBottomLeftRadius!=="0px"&&(E.style.borderBottomLeftRadius=T.cards?.borderRadius.all+"px"),E.style.borderBottomRightRadius&&E.style.borderBottomRightRadius!=="0px"&&(E.style.borderBottomRightRadius=T.cards?.borderRadius.all+"px"),E.style.borderTopLeftRadius&&E.style.borderTopLeftRadius!=="0px"&&(E.style.borderTopLeftRadius=T.cards?.borderRadius.all+"px"),E.style.borderTopRightRadius&&E.style.borderTopRightRadius!=="0px"&&(E.style.borderTopRightRadius=T.cards?.borderRadius.all+"px")):T.cards?.borderRadius?.all===""?E.style.removeProperty("border-radius"):(T.cards?.borderRadius?.topLeft&&E.style.borderTopLeftRadius&&E.style.borderTopLeftRadius!=="0px"?E.style.borderTopLeftRadius=T.cards?.borderRadius.topLeft+"px":T.cards?.borderRadius?.topLeft===""&&E.style.removeProperty("border-top-left-radius"),T.cards?.borderRadius?.topRight&&E.style.borderTopRightRadius&&E.style.borderTopRightRadius!=="0px"?E.style.borderTopRightRadius=T.cards?.borderRadius.topRight+"px":T.cards?.borderRadius?.topRight===""&&E.style.removeProperty("border-top-right-radius"),T.cards?.borderRadius?.bottomRight&&E.style.borderBottomRightRadius&&E.style.borderBottomRightRadius!=="0px"?E.style.borderBottomRightRadius=T.cards?.borderRadius.bottomRight+"px":T.cards?.borderRadius?.bottomRight===""&&E.style.removeProperty("border-bottom-right-radius"),T.cards?.borderRadius?.bottomLeft&&E.style.borderBottomLeftRadius&&E.style.borderBottomLeftRadius!=="0px"?E.style.borderBottomLeftRadius=T.cards?.borderRadius.bottomLeft+"px":T.cards?.borderRadius?.bottomLeft===""&&E.style.removeProperty("border-bottom-left-radius"))}),oe.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(E=>{if(!E.style.display&&parseFloat(E.style.fontSize)<=20){let de="",Ce=T.text.fontFamily;if(parseFloat(E.style.fontSize)>14&&(de=E.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${T.text.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${T.text.lineHeight}px`),E.setAttribute("style",de)),!E.closest(".em-contrast-card, .em-card")&&kt(E.style.color).toLowerCase()!=="#ffffff"&&(de=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.text.color};`),E.setAttribute("style",de)),E.closest(".em-contrast-block")&&!E.closest(".em-contrast-card, .em-card")&&(de=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.text.contrastColor};`),E.setAttribute("style",de)),Ce[0]==="Safe Fonts"?(E.style.fontFamily=Ce[1],ct({elem:oe})):Ce[0]==="Google Fonts"&&(Ce[1]==="Sans Serif"?E.style.fontFamily="Helvetica, Arial, sans-serif":Ce[1]==="Serif"&&(E.style.fontFamily='"Times New Roman", Times, serif'),E.classList.remove(...[...E.classList].filter(Qe=>Qe.startsWith("em-font"))),E.classList.add(`em-font-${Ce[2].replace(/\s/g,"")}-${Ce[3].replace(/\s/g,"")}`),St({elem:oe,fontFamilyArray:Ce})),E.closest('[em="atom"] > tr > td')&&E.closest('[em="atom"] > tr > td').style.paddingBottom)E.closest('[em="atom"] > tr > td').style.paddingBottom=T.text.paddingBottom+"px";else if(E.nextElementSibling||E.closest("table")&&E.closest("table").nextElementSibling){let Qe=E.nextElementSibling??E.closest("table").nextElementSibling;Qe&&Qe.tagName==="TABLE"&&(Qe.classList.contains("em-vindent-table")||Qe.querySelector("td").innerHTML==="")&&Qe.querySelector("td").setAttribute("height",T.text.paddingBottom)}}else if(!E.style.display&&parseFloat(E.style.fontSize)>=20&&kt(E.style.color).toLowerCase()!=="#eb3737"){let de="",Ce=T.headings.fontFamily;parseFloat(E.style.fontSize)<40&&(de=E.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${T.headings.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${T.headings.lineHeight}px`),E.setAttribute("style",de)),!E.closest(".em-contrast-card, .em-card")&&kt(E.style.color).toLowerCase()!=="#ffffff"&&(de=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.headings.color};`),E.setAttribute("style",de)),E.closest(".em-contrast-block")&&!E.closest(".em-contrast-card, .em-card")&&(de=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.headings.contrastColor};`),E.setAttribute("style",de)),Ce[0]==="Safe Fonts"?(E.style.fontFamily=Ce[1],ct({elem:oe})):Ce[0]==="Google Fonts"&&(Ce[1]==="Sans Serif"?E.style.fontFamily="Helvetica, Arial, sans-serif":Ce[1]==="Serif"&&(E.style.fontFamily='"Times New Roman", Times, serif'),E.classList.remove(...[...E.classList].filter(Me=>Me.startsWith("em-font"))),E.classList.add(`em-font-${Ce[2].replace(/\s/g,"")}-${Ce[3].replace(/\s/g,"")}`),St({elem:oe,fontFamilyArray:Ce}));let Qe="";if(T.headings.letterSpacing>0?Qe=E.style.letterSpacing?E.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${T.headings.letterSpacing}px`):E.getAttribute("style")+` letter-spacing: ${T.headings.letterSpacing}px;`:Qe=E.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),E.setAttribute("style",Qe),T.headings.bold?E.querySelector("b")?E.querySelector("b").replaceWith(...E.querySelector("b").childNodes):E.querySelector("strong")||(E.innerHTML="<strong>"+E.innerHTML+"</strong>"):E.querySelector("strong")?E.querySelector("strong").replaceWith(...E.querySelector("strong").childNodes):E.querySelector("b")&&E.querySelector("b").replaceWith(...E.querySelector("b").childNodes),E.style.fontWeight){let Me=E.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");E.setAttribute("style",Me)}if(T.headings.italic?E.querySelector("i")?E.querySelector("i").replaceWith(...E.querySelector("i").childNodes):E.querySelector("em")||(E.innerHTML="<em>"+E.innerHTML+"</em>"):E.querySelector("em")?E.querySelector("em").replaceWith(...E.querySelector("em").childNodes):E.querySelector("i")&&E.querySelector("i").replaceWith(...E.querySelector("i").childNodes),E.style.fontStyle){let Me=E.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");E.setAttribute("style",Me)}if(E.closest('[em="atom"] > tr > td')&&E.closest('[em="atom"] > tr > td').style.paddingTop)E.closest('[em="atom"] > tr > td').style.paddingTop=T.headings.paddingTop+"px";else if(E.previousElementSibling){let Me=E.previousElementSibling;Me&&Me.tagName==="TABLE"&&(Me.classList.contains("em-vindent-table")||Me.querySelector("td").innerHTML==="")&&Me.querySelector("td").setAttribute("height",T.headings.paddingTop)}if(E.closest('[em="atom"] > tr > td')&&E.closest('[em="atom"] > tr > td').style.paddingBottom)E.closest('[em="atom"] > tr > td').style.paddingBottom=T.headings.paddingBottom+"px";else if(E.nextElementSibling){let Me=E.nextElementSibling;Me&&Me.tagName==="TABLE"&&(Me.classList.contains("em-vindent-table")||Me.querySelector("td").innerHTML==="")&&Me.querySelector("td").setAttribute("height",T.headings.paddingBottom)}}}),oe.querySelectorAll('a[style*="color"]').forEach(E=>{if(E.style.display){if(E.style.display&&E.style.display==="block"){let de="";if(de=E.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${T.buttons.fontSize}px`),E.setAttribute("style",de),E.closest("td").style.backgroundColor&&!E.closest("td").style.borderWidth&&!E.closest(".em-contrast-card"))if(E.closest(".em-contrast-block")?de=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.contrastColor};`):de=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.color};`),E.setAttribute("style",de),E.closest(".em-contrast-block"))if(T.buttons.contrastBackgroundColor){let Me=E.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${T.buttons.contrastBackgroundColor};`);E.closest("td").setAttribute("style",Me)}else E.closest("td").style.removeProperty("background-color");else if(T.buttons.backgroundColor){let Me=E.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${T.buttons.backgroundColor};`);E.closest("td").setAttribute("style",Me)}else E.closest("td").style.removeProperty("background-color");else if(E.closest("td").style.borderWidth)if(Object.values(T.buttons.border).every(Me=>Me===null)){if(E.closest(".em-contrast-block")){if(T.buttons.contrastBackgroundColor){let Me=E.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,Et=>Et.replace(/#[A-Fa-f0-9]{6}/,`${T.buttons.contrastBackgroundColor}`));E.closest("td").setAttribute("style",Me),de=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.contrastBackgroundColor};`),E.setAttribute("style",de)}}else if(T.buttons.backgroundColor){let Me=E.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,Et=>Et.replace(/#[A-Fa-f0-9]{6}/,`${T.buttons.backgroundColor}`));E.closest("td").setAttribute("style",Me),de=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.backgroundColor};`),E.setAttribute("style",de)}}else for(const Me in T.buttons.border)T.buttons.border[Me]&&T.buttons.border[Me].color!==void 0&&(de=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.border[Me].color};`),E.setAttribute("style",de));else E.closest(".em-contrast-block")?T.buttons.contrastBackgroundColor&&(de=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.contrastBackgroundColor};`),E.setAttribute("style",de)):T.buttons.backgroundColor&&(de=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.buttons.backgroundColor};`),E.setAttribute("style",de));let Ce=T.buttons.fontFamily;Ce[0]==="Safe Fonts"?(E.style.fontFamily=Ce[1],ct({elem:oe})):Ce[0]==="Google Fonts"&&(Ce[1]==="Sans Serif"?E.style.fontFamily="Helvetica, Arial, sans-serif":Ce[1]==="Serif"&&(E.style.fontFamily='"Times New Roman", Times, serif'),E.classList.remove(...[...E.classList].filter(Me=>Me.startsWith("em-font"))),E.classList.add(`em-font-${Ce[2].replace(/\s/g,"")}-${Ce[3].replace(/\s/g,"")}`),St({elem:oe,fontFamilyArray:Ce})),E.closest("td").setAttribute("align",T.buttons.textAlign);let Qe="";if(T.buttons.letterSpacing>0?Qe=E.style.letterSpacing?E.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${T.buttons.letterSpacing}px`):E.getAttribute("style")+` letter-spacing: ${T.buttons.letterSpacing}px;`:Qe=E.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),E.setAttribute("style",Qe),T.buttons.bold?E.querySelector("b")?E.querySelector("b").replaceWith(...E.querySelector("b").childNodes):E.querySelector("strong")||(E.innerHTML="<strong>"+E.innerHTML+"</strong>"):E.querySelector("strong")?E.querySelector("strong").replaceWith(...E.querySelector("strong").childNodes):E.querySelector("b")&&E.querySelector("b").replaceWith(...E.querySelector("b").childNodes),E.style.fontWeight){let Me=E.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");E.setAttribute("style",Me)}if(T.buttons.italic?E.querySelector("i")?E.querySelector("i").replaceWith(...E.querySelector("i").childNodes):E.querySelector("em")||(E.innerHTML="<em>"+E.innerHTML+"</em>"):E.querySelector("em")?E.querySelector("em").replaceWith(...E.querySelector("em").childNodes):E.querySelector("i")&&E.querySelector("i").replaceWith(...E.querySelector("i").childNodes),E.style.fontStyle){let Me=E.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");E.setAttribute("style",Me)}if(E.closest('[em="atom"] > tr > td')&&E.closest('[em="atom"] > tr > td').style.paddingTop)E.closest('[em="atom"] > tr > td').style.paddingTop=T.buttons.marginTop+"px";else if(E.closest("table").previousElementSibling){let Me=E.closest("table").previousElementSibling;Me&&Me.tagName==="TABLE"&&(Me.classList.contains("em-vindent-table")||Me.querySelector("td").innerHTML==="")&&Me.querySelector("td").setAttribute("height",T.buttons.marginTop)}if(E.closest('[em="atom"] > tr > td')&&E.closest('[em="atom"] > tr > td').style.paddingBottom)E.closest('[em="atom"] > tr > td').style.paddingBottom=T.buttons.marginBottom+"px";else if(E.closest("table").previousElementSibling){let Me=E.closest("table").nextElementSibling;Me&&Me.tagName==="TABLE"&&(Me.classList.contains("em-vindent-table")||Me.querySelector("td").innerHTML==="")&&Me.querySelector("td").setAttribute("height",T.buttons.marginBottom)}T.buttons.padding.all&&(E.style.padding=T.buttons.padding.all+"px"),T.buttons.padding.top&&(E.style.paddingTop=T.buttons.padding.top+"px"),T.buttons.padding.right&&(E.style.paddingRight=T.buttons.padding.right+"px"),T.buttons.padding.bottom&&(E.style.paddingBottom=T.buttons.padding.bottom+"px"),T.buttons.padding.left&&(E.style.paddingLeft=T.buttons.padding.left+"px"),D({settings:{border:T.buttons.border},elem:E.closest("td")}),q({settings:{borderRadius:T.buttons.borderRadius},elem:E.closest("td")})}}else{let de=T.text.fontFamily;if(kt(E.style.color).toLowerCase()==="#1c52dc"){let Qe=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.links.color};`);E.setAttribute("style",Qe)}else{let Qe=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.text.color};`);E.setAttribute("style",Qe)}if(E.closest(".em-contrast-block")){let Qe=E.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${T.links.contrastColor};`);E.setAttribute("style",Qe)}let Ce="";T.links.underline?Ce=E.style.textDecoration?E.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: underline;"):E.getAttribute("style")+" text-decoration: underline;":Ce=E.style.textDecoration?E.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: none;"):E.getAttribute("style")+" text-decoration: none;",E.setAttribute("style",Ce),de[0]==="Safe Fonts"?(E.style.fontFamily=de[1],ct({elem:oe})):de[0]==="Google Fonts"&&(de[1]==="Sans Serif"?E.style.fontFamily="Helvetica, Arial, sans-serif":de[1]==="Serif"&&(E.style.fontFamily='"Times New Roman", Times, serif'),E.classList.remove(...[...E.classList].filter(Qe=>Qe.startsWith("em-font"))),E.classList.add(`em-font-${de[2].replace(/\s/g,"")}-${de[3].replace(/\s/g,"")}`),St({elem:oe,fontFamilyArray:de}))}}),oe.querySelector('[em="block"]'))){const E=oe.querySelectorAll('[em="block"]');T.block?.backgroundColor&&E.forEach(de=>{de.querySelectorAll(":scope > td").forEach(Ce=>{Ce.setAttribute("bgcolor",T.block.backgroundColor)})}),T.block?.padding&&E.forEach(de=>{de.querySelectorAll(":scope > td").forEach(Ce=>{Ce.style.paddingTop=T.block.padding.top+"px",Ce.style.paddingRight=T.block.padding.right+"px",Ce.style.paddingBottom=T.block.padding.bottom+"px",Ce.style.paddingLeft=T.block.padding.left+"px"})})}return oe.tagName==="DIV"?r.getElementInnerHTML(oe):r.getElementInnerHTML(oe.querySelector("tbody")||oe)},ct=R=>{R.elem.querySelectorAll("link[em-class]").forEach(oe=>{R.elem.querySelector("."+oe.getAttribute("em-class"))||oe.remove()})};function kt(R){if(R&&R.charAt(0)==="r"){if(R.charAt(3)==="a")return R=R.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i),R&&R.length===4?"#"+("0"+parseInt(R[1],10).toString(16)).slice(-2)+("0"+parseInt(R[2],10).toString(16)).slice(-2)+("0"+parseInt(R[3],10).toString(16)).slice(-2):"";{R=R.replace("rgb(","").replace(")","").split(",");let oe=parseInt(R[0],10).toString(16),E=parseInt(R[1],10).toString(16),de=parseInt(R[2],10).toString(16);return oe=oe.length===1?"0"+oe:oe,E=E.length===1?"0"+E:E,de=de.length===1?"0"+de:de,"#"+oe+E+de}}else if(R&&R.charAt(0)==="#")return R}const St=R=>{const oe=R.elem.querySelectorAll("link"),E=`em-font-${R.fontFamilyArray[2].replace(/\s/g,"")}-${R.fontFamilyArray[3].replace(/\s/g,"")}`;if(!Array.from(oe)?.find(Ce=>Ce.getAttribute("em-class")===E)){let Ce=document.createElement("link");Ce.setAttribute("rel","stylesheet"),Ce.setAttribute("href",`https://fonts.googleapis.com/css2?family=${R.fontFamilyArray[2]}:ital,wght@${we[R.fontFamilyArray[3]].indexOf("i")>-1?"1":"0"},${we[R.fontFamilyArray[3]].replaceAll("i","")}&display=swap`),Ce.setAttribute("em-class",E),R.elem.insertAdjacentElement("afterbegin",Ce)}_e({elem:R.elem});let de=`font-family: '${R.fontFamilyArray[2]}', ${Ge[R.fontFamilyArray[1]]}!important;`;de+=` font-weight: ${we[R.fontFamilyArray[3]].replaceAll("i","")}!important;`,we[R.fontFamilyArray[3]].indexOf("i")>-1&&(de+=" font-style: italic!important;"),R.elem.querySelector('style[em="styles"]').insertAdjacentHTML("beforeend",`
|
|
22
|
+
.em-font-${R.fontFamilyArray[2].replace(/\s/g,"")}-${R.fontFamilyArray[3].replace(/\s/g,"")} { ${de} }`),setTimeout(()=>ct({elem:R.elem}),0)},D=R=>{R.settings.border.all?R.settings.border.all.width!=null&&(R.settings.border.all.style||R.settings.border.all.color)?(R.elem.style.borderWidth=R.settings.border.all.width+"px",R.elem.style.borderStyle=R.settings.border.all.style,R.elem.style.borderColor=R.settings.border.all.color):R.elem.style.removeProperty("border"):(R.settings.border.top&&(R.settings.border.top.width!=null&&(R.settings.border.top.style||R.settings.border.top.color)?(R.elem.style.borderTopWidth=R.settings.border.top.width+"px",R.elem.style.borderTopStyle=R.settings.border.top.style,R.elem.style.borderTopColor=R.settings.border.top.color):R.elem.style.removeProperty("border-top")),R.settings.border.right&&(R.settings.border.right.width!=null&&(R.settings.border.right.style||R.settings.border.right.color)?(R.elem.style.borderRightWidth=R.settings.border.right.width+"px",R.elem.style.borderRightStyle=R.settings.border.right.style,R.elem.style.borderRightColor=R.settings.border.right.color):R.elem.style.removeProperty("border-right")),R.settings.border.bottom&&(R.settings.border.bottom.width!=null&&(R.settings.border.bottom.style||R.settings.border.bottom.color)?(R.elem.style.borderBottomWidth=R.settings.border.bottom.width+"px",R.elem.style.borderBottomStyle=R.settings.border.bottom.style,R.elem.style.borderBottomColor=R.settings.border.bottom.color):R.elem.style.removeProperty("border-bottom")),R.settings.border.left&&(R.settings.border.left.width!=null&&(R.settings.border.left.style||R.settings.border.left.color)?(R.elem.style.borderLeftWidth=R.settings.border.left.width+"px",R.elem.style.borderLeftStyle=R.settings.border.left.style,R.elem.style.borderLeftColor=R.settings.border.left.color):R.elem.style.removeProperty("border-left")))},q=R=>{R.settings.borderRadius.all?R.elem.style.borderRadius=R.settings.borderRadius.all+"px":R.settings.borderRadius.all===""?R.elem.style.removeProperty("border-radius"):(R.settings.borderRadius.topLeft?R.elem.style.borderTopLeftRadius=R.settings.borderRadius.topLeft+"px":R.settings.borderRadius.topLeft===""&&R.elem.style.removeProperty("border-top-left-radius"),R.settings.borderRadius.topRight?R.elem.style.borderTopRightRadius=R.settings.borderRadius.topRight+"px":R.settings.borderRadius.topRight===""&&R.elem.style.removeProperty("border-top-right-radius"),R.settings.borderRadius.bottomRight?R.elem.style.borderBottomRightRadius=R.settings.borderRadius.bottomRight+"px":R.settings.borderRadius.bottomRight===""&&R.elem.style.removeProperty("border-bottom-right-radius"),R.settings.borderRadius.bottomLeft?R.elem.style.borderBottomLeftRadius=R.settings.borderRadius.bottomLeft+"px":R.settings.borderRadius.bottomLeft===""&&R.elem.style.removeProperty("border-bottom-left-radius"))},we={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"},Ge={"Sans Serif":"sans-serif",Serif:"serif"};function _e(R){if(!R.elem.querySelector('style[em="styles"]')){let oe=document.createElement("style");oe.setAttribute("em","styles"),R.elem.append(oe)}}return(0,t.jsxs)("div",{className:(0,We.default)("blocks-search",{is_search:s}),children:[(0,t.jsx)(o.ui_kit$Form,{className:(0,We.default)("blocks-search__form",{is_search:s}),form:b,layout:"vertical",name:"blocks_search_form",initialValues:{...hn},onValuesChange:tt,autoComplete:"off",children:(0,t.jsx)(o.ui_kit$Form.Item,{name:Cr,children:(0,t.jsx)(o.ui_kit$SearchInput,{placeholder:m("Search by title"),allowClear:!0,enterButton:!1})})}),(pe||Be||Ve)&&(0,t.jsx)(o.ui_kit$Alert,{title:m("Error"),description:m("Error when receiving data. Try again (reload page) or contact support."),type:"error",showIcon:!0}),s&&!ue&&(0,t.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,t.jsxs)("ul",{children:[(0,t.jsx)("li",{"data-type":"",className:"active",onClick:O,children:m("All")},"search_All"),je.map(R=>(0,t.jsx)("li",{"data-type":R,onClick:O,children:m(r.TYPES_TRANSLATE[R])},"search_"+R))]})}),(0,t.jsxs)("div",{ref:U,className:(0,We.default)("blocks-search__result-wrapper",{is_search:s}),children:[(i==="project"||s)&&(0,t.jsxs)(t.Fragment,{children:[!!Y.length&&!s&&(0,t.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,t.jsxs)("ul",{children:[(0,t.jsx)("li",{"data-type":"",className:"active",onClick:O,children:m("All")},"blocksSections_All"),Y.map(R=>(0,t.jsx)("li",{"data-type":R,onClick:O,children:m(r.TYPES_TRANSLATE[R])},"blocksSections_"+R))]})}),(0,t.jsxs)("div",{className:(0,We.default)("blocks-search__blocks-wrapper",{is_search:s}),ref:te,children:[(0,t.jsx)("div",{className:"blocks-search__result-holder project",children:!(Q||X)&&(M?.length?M.map((R,oe)=>{const E=jr(R.id,vr(R));return(0,t.jsx)("div",{className:"blocks-search__result","data-type":R.type,children:(0,t.jsx)(o.ui_kit$Dropdown,{placement:"leftTop",menu:{items:dt(R)},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,t.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:de=>he(de,R.html,"project",R.title,R),onDragStart:de=>ke(de,R.html,"project",R.title,R),onMouseEnter:()=>j({html:R.html,title:R.title}),onMouseLeave:w,children:[H(R),(0,t.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:E,onContentLoad:He,style:{transform:`scale(${P})`}})]})},"commenMenu")},R.id+oe.toString())}):!(Oe.tags||Oe.name||Oe.type)&&Ee&&!(Q||X)&&!s&&(0,t.jsxs)("div",{style:{padding:"10px 0 20px",display:"flex",flexDirection:"row",justifyContent:"space-between"},children:[(0,t.jsxs)("div",{style:{width:"110%"},children:[(0,t.jsx)("h3",{style:{lineHeight:"1.2"},children:m("You don`t have any saved blocks yet.")}),m("To add a block from the dashboard click the"),' "',m("Save to Blocks button."),'" ',(0,t.jsx)(r.EmIcons,{icon:"SaveBlock",component:o.icons$SaveBlock,style:{position:"relative",top:"2px"}}),(0,t.jsx)("br",{}),(0,t.jsx)("br",{}),m("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,t.jsx)("br",{}),(0,t.jsx)("br",{}),(0,t.jsx)(o.ui_kit$Flex,{justify:"left",children:(0,t.jsx)(o.ui_kit$Button,{type:"primary",onClick:()=>a(!0),style:{cursor:"pointer"},children:m("Save all blocks")})})]}),(0,t.jsx)("div",{style:{width:"80px",height:"200px"},children:(0,t.jsx)("img",{src:Ap,style:{display:"block",width:80,position:"absolute",right:5}})})]}))}),(Q||X)&&(0,t.jsx)(o.ui_kit$Skeleton,{active:!0})]})]}),s&&Z?.length>0&&B?.length>0&&(0,t.jsx)(o.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="template"||s)&&(0,t.jsxs)(t.Fragment,{children:[!!Pe.length&&!s&&(0,t.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,t.jsxs)("ul",{children:[(0,t.jsx)("li",{"data-type":"",className:"active",onClick:O,children:m("All")},"templateBlocksSections_All"),Pe.map(R=>(0,t.jsx)("li",{"data-type":R,onClick:O,children:m(r.TYPES_TRANSLATE[R])},"templateBlocksSections_"+R))]})}),(0,t.jsxs)("div",{className:(0,We.default)("blocks-search__blocks-wrapper",{is_search:s}),ref:xe,children:[(0,t.jsxs)("div",{className:"blocks-search__result-holder template",children:[B&&!($e||z)&&re?.length?(0,t.jsx)(t.Fragment,{children:re.map((R,oe)=>{const E=jr(R.id,vr(R));return(0,t.jsx)("div",{className:"blocks-search__result","data-type":R.type,children:(0,t.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:de=>he(de,R.html,"template",R.title,R),onDragStart:de=>ke(de,R.html,"template",R.title,R),onMouseEnter:()=>j({html:R.html,title:R.title}),onMouseLeave:()=>w(),children:[H(R),(0,t.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:E,onContentLoad:He,style:{transform:`scale(${P})`}})]})},R.id+oe.toString())})}):!s&&!Ue&&!z&&(0,t.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:m("No related blocks found.")})," "]}),($e||z)&&(0,t.jsx)(o.ui_kit$Skeleton,{active:!0})]})]}),s&&B?.length>0&&ne?.length>0&&(0,t.jsx)(o.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="common"||s)&&(0,t.jsxs)(t.Fragment,{children:[!!I?.length&&!s&&(0,t.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,t.jsxs)("ul",{children:[(0,t.jsx)("li",{"data-type":"",className:"active",onClick:O,children:m("All")},"commonBlocksSections_All"),I.map(R=>(0,t.jsx)("li",{"data-type":R,onClick:O,children:m(r.TYPES_TRANSLATE[R])},"commonBlocksSections_"+R))]})}),(0,t.jsxs)("div",{className:(0,We.default)("blocks-search__blocks-wrapper",{is_search:s}),ref:be,children:[(0,t.jsxs)("div",{className:"blocks-search__result-holder common",children:[Ae&&!!Te?.length&&!(Xe||Ue)&&(0,t.jsx)(t.Fragment,{children:Te.map((R,oe)=>{const E=st({html:jr(R.id,vr(R))});return(0,t.jsx)("div",{className:"blocks-search__result","data-type":R.type,children:(0,t.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:de=>he(de,st({html:R.html}),"common",R.title,R),onDragStart:de=>ke(de,st({html:R.html}),"common",R.title,R),onMouseEnter:()=>j({html:st({html:r.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+R.html+"</table>")}),title:R.title}),onMouseLeave:()=>w(),children:[H(R),(0,t.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:E,onContentLoad:He,style:{transform:`scale(${P})`}})]})},R.id+oe.toString())})})," "]}),(Ue||Xe)&&(0,t.jsx)(o.ui_kit$Skeleton,{active:!0})]})]}),ue&&(0,t.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:m("There are no blocks for this request.")})]})]})};Pr.propTypes={};function Vp(e,i){return e==="email"||r.isBlocksV2Enabled()?!0:i!==void 0&&r.isPluginGoHistory(i)}var bn=({comments:e,subjectId:i,isLoggedIn:s,projectTitle:l="",emailElementType:a,email:d})=>{const{__:c,_n:p}=r.useI18n(),g=r.useSendPostMessage(),b=r.useNotification(),{token:k}=(0,o.ui_kit$useToken)(),h=r.useAppConfig(),m=r.usePushToDataLayer(),S=(0,n.useRef)(null),[x,f]=(0,n.useState)(""),[y,v]=(0,n.useState)("ADD"),[N,B]=(0,n.useState)(!1),[C,$]=(0,n.useState)(null),[U,L]=(0,n.useState)(null),[F,P]=(0,n.useState)(""),[H,ae]=(0,n.useState)(""),[T,te]=(0,n.useState)(!1),[xe,be]=(0,n.useState)(""),[ye,me]=r.useAddCommentMutation(),[he,ke]=r.useDeleteCommentMutation(),[ce,ze]=r.useEditCommentMutation(),[Oe,ve]=r.useDeleteTargetMutation(),[Ee]=r.useAutoSaveBlockMutation(),pe=r.useDispatch(),Q=r.useStore(),X=r.useCurrentUser(),Z=r.useCurrentProjectRequested(),J=r.useContentReader(),V=ne=>{const Te=r.getEmailDocuments(ht.getContainer(Q));Te.save("anchor",{project:ne}).then(I=>{const se=I?Te.revisionFacts()?.lastRevisionAt:void 0;se!==void 0&&d?.id!=null&&pe(r.rememberAutosaveTime({emailId:d.id,modified:new Date(se).toISOString()}))})},M=()=>{const ne=Z;if(Vp(a,ht.getContainer(Q))){V(ne);return}const Te={...d?.meta!==void 0?{meta:d.meta}:{},title:d?.title,emailId:d?.id,project:ne,html:J(),excerpt:d?.date_gmt};d?.id!=null&&Ee({blockId:d.id,body:Te}).catch(I=>{})};function Y(ne){te(!1),be(""),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:xe}),B(!0),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!0})}function K(){L(C),e.filter(ne=>ne.parent===C).length?ce({commentId:C,status:"deleted"}).unwrap():he(C),document.querySelector('.discuss-main li[id="'+C+'"] .comment-icon-target')?.getAttribute("target-id")&&g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:document.querySelector('.discuss-main li[id="'+C+'"] .comment-icon-target')?.getAttribute("target-id")}),M(),be("")}function ee(ne){L(C);const Te=e.find(se=>se.id?.toString()===C),I=Te?.target_id?.toString()||"";te(!!I),be(I),ae(Te?.content?.slice(3,-5)?.toString()),v("EDIT")}function le(ne){L(C),P(""),v("REPLY")}const Re=()=>{b.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 "))+`${l}.`,okText:c("Okay. I'll log in.")})};async function Be(){s?(await ce({commentId:U,content:H,targetId:xe}).unwrap(),v("ADD"),ae(""),L(0),te(!1),B(!1),be(""),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Re()}const $e=ne=>{v("ADD"),ae(""),L(0),te(!1),B(!1),be(""),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})},z=async()=>{s?((x||F)&&await ye({subjectId:i,author:X.id,parent:y==="ADD"?"0":U,content:x||F,author_name:X.name,author_email:X.email,targetId:xe}).then(ne=>{if(ne.error){const{data:Te}=ne.error;b.error({title:Te?.code??c("Error"),description:Te?.message??c("Something went wrong. Try again later.")})}else m({event:"submit",action:"send_discussion_chat_message",entity_type:a==="block"?"block":"email",entity_id:d?.id,project_id:d?.project,context:"editor"},void 0,{analyticsName:"editor_comment_sent"})}),be(""),v("ADD"),P(""),f(""),L(0),te(!1),B(!1),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Re()};function re(){T?(B(!1),te(!1),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:xe})):(B(!N),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!N}),N&&te(!1))}function Pe(ne){let Te=JSON.parse(JSON.stringify(ne));if(!Te||!Te.length)return[];let I=[],se=new Map;for(let je=0,Ne=Te.length;je<Ne;++je){let He=Te[je],Ke=se.get(He.id);if((!Ke||Array.isArray(Ke))&&(Ke&&(He.children=Ke),se.set(He.id,He)),String(He.parent)==="0")I.push(He);else{let tt=se.get(He.parent);tt?(Array.isArray(tt)?tt:tt.children=tt.children||[]).push(He):se.set(He.parent,[He])}}return I.forEach(je=>{je.status==="deleted"&&!je.children&&(ke.isUninitialized||ke.isSuccess)&&he(je.id).unwrap().catch(Ne=>{})}),I}const G=ne=>{const Te=ne.data.operation;if(Te===r.EVENT_TYPES.APPLICATION_DISCUSS_SET_ID&&(be(ne.data.settings.value),ne.data.settings.value!==""?(te(!0),B(!1)):(te(!1),B(!0))),Te===r.EVENT_TYPES.APPLICATION_DISCUSS_SAVE_TARGET&&M(),Te===r.EVENT_TYPES.APPLICATION_DISCUSS_GET_COMMENT)if(document.querySelector('.comment-icon-target[target-id="'+ne.data.settings.targetId+'"]')){let I=document.querySelector('.comment-icon-target[target-id="'+ne.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 g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:ne.data.settings.targetId}),b.error({title:c("There's no such comment.")});Te===r.EVENT_TYPES.APPLICATION_DISCUSS_NO_COMMENT&&b.error({title:c("There's no such element in the email.")})};r.useListenPostMessage(G);const Se=ne=>{g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_GET_TARGET,value:ne})},Fe=ne=>(ne?.sort((Te,I)=>Te.date>I.date?1:-1),(0,t.jsx)(t.Fragment,{children:ne&&!!ne.length&&(0,t.jsx)(o.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:ne,renderItem:Te=>(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("li",{id:Te.id,children:(0,t.jsxs)(t.Fragment,{children:[Te.status==="deleted"&&Te.clildren&&(0,t.jsx)(o.ui_kit$Comment,{className:"deletedComment",content:(0,t.jsx)(o.ui_kit$Alert,{description:c("Comment was removed."),type:"info"}),children:Fe(Te.children)}),Te.status!=="deleted"&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Comment,{author_id:Te.author_id,author:Te.author_name,avatar:Te.author_avatar_urls&&Te.author_avatar_urls[48]||"",className:(0,We.default)(Te.target_id&&"targetted-comment-item",(!Te.author_avatar_urls||!Te.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,t.jsx)(o.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>$(Te.id),menu:{items:Te.author===X.id?Ue:Xe},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,t.jsx)("div",{onClick:()=>Te.target_id&&Se(Te.target_id),dangerouslySetInnerHTML:{__html:Te.content}})},"commenMenu"),datetime:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:Te.date&&r.formatDate(r.tryParseISO(Te.date),p,!0)}}),Te.target_id&&(0,t.jsx)("span",{className:"comment-icon-target","target-id":Te.target_id,onClick:()=>Se(Te.target_id),children:(0,t.jsx)(r.EmIcons,{icon:"AimOutlined",component:o.icons$AimOutlined,style:{color:k.colorInfo,top:-2,position:"relative"}})})]}),children:(0,t.jsxs)(t.Fragment,{children:[y==="REPLY"&&U===Te.id&&Ve,y==="EDIT"&&U===Te.id&&Ae,Fe(Te.children)]})})})]})})})})})),Ae=(0,t.jsxs)(o.ui_kit$Form,{onFinish:Be,className:"commentForm",children:[(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,t.jsx)(o.ui_kit$TextArea,{className:"textarea-reply",value:H,onChange:ne=>ae(ne.target.value),rows:4,placeholder:c("Editing comments"),onKeyDown:ne=>ne.key==="Escape"&&$e(),onPressEnter:ne=>ne.key==="Enter"&&ne.ctrlKey&&Be(),ref:S})}),(0,t.jsx)(o.ui_kit$Form.Item,{className:"buttons",children:(0,t.jsxs)(o.ui_kit$Space,{children:[T?(0,t.jsx)(o.ui_kit$Popconfirm,{title:c("Are you sure?"),okText:c("Yes"),cancelText:c("No"),onConfirm:Y,children:(0,t.jsx)(o.ui_kit$Button,{loading:ve.isLoading,type:N||T&&y==="EDIT"&&xe!==""?"primary":"default",className:"button-target "+(N&&!T?"button-target_choose":""),style:T&&y==="EDIT"&&xe!==""?{background:k.colorInfo}:{},children:(0,t.jsx)(r.EmIcons,{icon:"AimOutlined",component:o.icons$AimOutlined,className:"icon-target"})})}):(0,t.jsx)(o.ui_kit$Button,{onClick:re,loading:ve.isLoading,type:N||T&&y==="EDIT"&&xe!==""?"primary":"default",className:"button-target "+(N&&!T?"button-target_choose":""),style:T&&y==="EDIT"&&xe!==""?{background:k.colorInfo}:{},children:(0,t.jsx)(r.EmIcons,{icon:"AimOutlined",component:o.icons$AimOutlined,className:"icon-target"})}),(0,t.jsxs)(o.ui_kit$Button,{className:"button-reply",type:"primary",loading:ze.isLoading,htmlType:"submit",children:[c("Save")," ",(0,t.jsx)(r.EmIcons,{icon:"SaveOutlined",component:o.icons$SaveOutlined,size:16,strokeWidth:h.iconStrokeWidth})]}),(0,t.jsx)(o.ui_kit$Button,{onClick:$e,className:"button-reply",children:c("Cancel")})]})})]}),Ve=(0,t.jsxs)(o.ui_kit$Form,{name:"reply",className:"commentForm",onFinish:z,children:[(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,t.jsx)(o.ui_kit$TextArea,{className:"textarea-reply",value:F,onChange:ne=>P(ne.target.value),rows:4,placeholder:c("Reply to the comment"),onKeyDown:ne=>ne.key==="Escape"&&$e(),onPressEnter:ne=>ne.key==="Enter"&&ne.ctrlKey&&z(),ref:S})}),(0,t.jsx)(o.ui_kit$Form.Item,{hidden:!0,name:"targetId",children:(0,t.jsx)(o.ui_kit$Input,{type:"hidden"})}),(0,t.jsx)(o.ui_kit$Form.Item,{className:"buttons",children:(0,t.jsxs)(o.ui_kit$Space,{children:[(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:c("Add a note"),styles:{body:{maxWidth:"150px"}},children:(0,t.jsx)(o.ui_kit$Button,{onClick:re,type:N||T&&y==="REPLY"&&xe!==""?"primary":"default",className:"button-target "+(N&&!T?"button-target_choose":""),style:T&&y==="REPLY"&&xe!==""?{background:k.colorInfo}:{},children:(0,t.jsx)(r.EmIcons,{icon:"AimOutlined",component:o.icons$AimOutlined,className:"icon-target"})})}),(0,t.jsxs)(o.ui_kit$Button,{className:"button-reply",type:"primary",loading:y==="REPLY"&&me.isLoading,htmlType:"submit",children:[c("Reply")," ",(0,t.jsx)(r.EmIcons,{icon:"SendOutlined",component:o.icons$SendOutlined,size:16,strokeWidth:h.iconStrokeWidth})]}),(0,t.jsx)(o.ui_kit$Button,{onClick:$e,className:"button-reply",ghost:!0,type:"primary",children:c("Cancel")})]})})]});(0,n.useEffect)(()=>{y==="REPLY"&&S.current.focus({cursor:"start"}),y==="EDIT"&&S.current.focus({cursor:"end"})},[y]);let Ue=[];Ue.push({key:"Reply to comment",icon:(0,t.jsx)(r.EmIcons,{icon:"RollbackOutlined",component:o.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:le},{key:"Edit comment",icon:(0,t.jsx)(r.EmIcons,{icon:"EditOutlined",component:o.icons$EditOutlined,style:{fontSize:"16px"}}),label:c("Edit"),onClick:ee},{key:"Delete comment",icon:(0,t.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:o.icons$DeleteOutlined,size:16}),label:c("Delete"),style:{color:k.colorError},onClick:K});let Xe=[];return Xe.push({key:"Reply to comment",icon:(0,t.jsx)(r.EmIcons,{icon:"RollbackOutlined",component:o.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:le}),(0,t.jsxs)("div",{className:"discuss-main",children:[e.length>0&&(0,t.jsx)(o.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:Pe(e),renderItem:ne=>(0,t.jsxs)("li",{id:ne.id,children:[ne.comment_status==="deleted"&&(0,t.jsx)(o.ui_kit$Comment,{className:"deletedComment",content:(0,t.jsx)(o.ui_kit$Alert,{description:c("Comment was removed."),type:"info"}),children:Fe(ne.children)}),ne.comment_status!=="deleted"&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(o.ui_kit$Comment,{author_id:ne.author_id,author:ne.author_name,avatar:ne.author_avatar_urls&&ne.author_avatar_urls[48]||"",className:(0,We.default)(ne.target_id&&"targetted-comment-item",(!ne.author_avatar_urls||!ne.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,t.jsx)(o.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>$(ne.id),menu:{items:ne.author===X.id?Ue:Xe},styles:{root:{minWidth:"auto"}},children:(0,t.jsx)("div",{onClick:()=>ne.target_id&&Se(ne.target_id),dangerouslySetInnerHTML:{__html:ne.content}})},"commenMenu"),datetime:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:ne.date&&r.formatDate(r.tryParseISO(ne.date),p,!0)}}),ne.target_id&&(0,t.jsx)("span",{className:"comment-icon-target","target-id":ne.target_id,onClick:()=>Se(ne.target_id),children:(0,t.jsx)(r.EmIcons,{icon:"AimOutlined",component:o.icons$AimOutlined,style:{color:k.colorInfo,top:-2,position:"relative"}})})]}),children:(0,t.jsxs)(t.Fragment,{children:[y==="REPLY"&&U===ne.id&&Ve,y==="EDIT"&&U===ne.id&&Ae,Fe(ne.children)]})})})]})}),(0,t.jsxs)(o.ui_kit$Form,{onFinish:z,className:y==="ADD"?"addMode":"replyEditMode",children:[(0,t.jsx)(o.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,t.jsx)(o.ui_kit$TextArea,{value:x,onChange:ne=>f(ne.target.value),rows:4,placeholder:c("Leave your comment"),className:"textarea-comment",onPressEnter:ne=>ne.key==="Enter"&&ne.ctrlKey&&z()})}),(0,t.jsx)(o.ui_kit$Form.Item,{children:(0,t.jsxs)(o.ui_kit$Space,{size:8,children:[(0,t.jsx)(o.ui_kit$Tooltip,{placement:"top",title:c("Add a note"),styles:{body:{maxWidth:"150px"}},children:(0,t.jsx)(o.ui_kit$Button,{onClick:re,type:N||T&&y==="ADD"&&xe!==""?"primary":"default",className:"button-target "+(N&&!T?"button-target_choose":""),style:T&&y==="ADD"&&xe!==""?{background:k.colorInfo}:{},icon:(0,t.jsx)(r.EmIcons,{icon:"Target",component:o.icons$Target,size:16,strokeWidth:h.iconStrokeWidth,className:"icon-target"})})}),(0,t.jsxs)(o.ui_kit$Button,{className:"button-add",type:"primary",loading:y==="ADD"&&me.isLoading,htmlType:"submit",children:[c("Send")," ",(0,t.jsx)(r.EmIcons,{icon:"SendOutlined",component:o.icons$SendOutlined,size:16,strokeWidth:h.iconStrokeWidth})]})]})})]})]})};function Hp(e,i){return{ID:e.userId,userId:e.userId,display_name:e.displayName,user_email:e.email,user_firstname:e.firstName,user_lastname:e.lastName,avatar_url:e.avatarUrl,...i?{role:i}:{}}}var Up=["common_styles","subject","preheader","meta"];function Wp(e,i){r.writeSourceReport(e,r.fromRevision(i))}function zp(e){if(!e)return null;const i=e.get().attributes??{},s={};for(const l of Up)i[l]!==void 0&&(s[l]=i[l]);return{content:e.getContent(),attributes:s}}function gn(e,i){i&&r.writeSourceReport(e,{content:i.content,attributes:i.attributes})}var fn=(e,i)=>({key:e.id,id:e.id,author:e.author,authorName:e.authorName,date:r.formatDate(r.tryParseISO(e.date||e.modified),i),title:e.title,html:e.html,common_styles:e.common_styles,loading:!1,isAutosave:e.isAutosave===!0}),Ar=({emailElement:e})=>{const{__:i}=r.useI18n(),s=r.useSendPostMessage(),l=r.useDispatch(),a=r.useEditorProjectId(),d=r.useEmailAttributesWriter(),c=r.useContentReplacer(),p=r.useEditorLocked(),g=r.useEditorLockCheck(),{document:b}=r.useDocumentSessionContext(),k=r.useSelector(r.selectHistoryData),h=r.useDocumentHistoryReader(),m=r.useRevisionContent(),S=r.useNotification(),x=(0,n.useRef)({preview:0,apply:0}),f=r.useProjectData()?.members,y=r.useSelector(r.selectElementHistoryHasMore),v=r.useSelector(r.selectIsPanelHistoryCollapsed),[N,B]=(0,n.useState)(!0),[C,$]=(0,n.useState)(!1),[U,L]=(0,n.useState)([]),[F,P]=(0,n.useState)([]),H=K=>l(r.switchIsPanelHistoryCollapsed(K)),ae=(0,n.useCallback)(K=>{if(!K?.html||g())return;const ee=r.fromRevision(K);ee?.attributes&&d(ee.attributes),l(r.markAppearanceNeedsUpdate());const le=b?.get().version;c(K.html,{undoable:!0}),b&&b.get().version===le&&b.markUnsaved()},[c,l,d,b,g]),T=(0,n.useCallback)(K=>{Wp(b,K),l(r.markAppearanceNeedsUpdate())},[b,l]),{data:te}=r.projectsApi.useGetProjectQuery(Number(a),{skip:!a}),[xe,be]=(0,n.useState)([]);(0,n.useEffect)(()=>{if(te){const{owner:K,admins:ee,users:le}=te?.members;be([K&&{...K},ee&&Array.isArray(ee)&&ee.map(Re=>({...Re})),le&&Array.isArray(le)&&le.map(Re=>({...Re}))].filter(Re=>Re).flat(1).map(Re=>({id:Re.ID,display_name:Re.display_name})))}},[te,te?.members,i]);const[ye,me]=(0,n.useState)(1),[he,ke]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const K=Array.isArray(k)&&k.length&&k?.map(ee=>fn(ee,i));P(K||[]),L(K),B(!1),y||ke(!0)},[k,y,i]);const ce=()=>{$(!0),P(U.concat([...new Array(3)].map(()=>({loading:!0})))),h(e.id,ye+1).then(K=>{if(K.isStale)return;const{data:ee,hasMore:le}=K.data,Re=Array.isArray(ee)&&ee?.map($e=>fn($e,i)),Be=U.concat(Re);P(Be),L(Be),$(!1),window.dispatchEvent(new Event("resize")),le||ke(!0),me(ye+1)})},ze=!N&&!C&&!he?(0,t.jsx)("div",{style:{textAlign:"center",marginTop:24,marginBottom:24,height:32,lineHeight:"32px"},children:(0,t.jsx)(o.ui_kit$Button,{onClick:ce,children:i("loading more")})}):null,[Oe,ve]=(0,n.useState)(),[Ee,pe]=(0,n.useState)(null),Q=(0,n.useCallback)(K=>{ae(K),ve(null),pe(null),s({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),l(r.resetToLastActiveSettingsTab())},[ae,s,l]),X=(0,n.useCallback)((K,ee)=>le=>{const Re=x.current;Re[ee]+=1,ee==="apply"&&(Re.preview+=1);const Be=Re[ee],$e=()=>Be===x.current[ee];if(le?.html||!le?.id){K(le);return}m(e.id,le).then(z=>{$e()&&K(z)},z=>{$e()&&(ve(null),S.error({message:i("Failed to load"),innerException:z}))})},[m,e.id,S,i]),Z=X(Q,"apply"),J=X(T,"preview"),V=({author:K,authorName:ee})=>{if(Y.revisionService)return ee||K||"–";const le=xe.find(Be=>Be.id?.toString()===K?.toString())?.display_name;if(le)return le;const Re=r.authorFromMembers(K,f);return Re?Hp(Re).display_name||Re.email||"–":ee||"–"},M=(0,n.useRef)(void 0);(0,n.useEffect)(()=>{!v&&!Ee&&(M.current=b,pe(zp(b)))},[v,pe,b,Ee]),(0,n.useEffect)(()=>{v&&(x.current.preview+=1),v&&Ee&&(M.current===b&&(gn(b,Ee),l(r.markAppearanceNeedsUpdate())),pe(null))},[v,Ee,b,l]);const Y=r.useAppConfig();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse secondary-tabs_unset_scroll",size:"large",activeKey:r.HISTORY,items:[{label:(0,t.jsx)(t.Fragment,{children:i("Version history")}),key:r.HISTORY,forceRender:!0,className:"email-settings__collapse-panel",style:{height:"100%"},children:(0,t.jsx)(o.ui_kit$List,{className:"history-panel__list",loading:N,itemLayout:"horizontal",loadMore:ze,dataSource:F,header:(0,t.jsxs)("div",{className:"history-panel__list-header",children:[(0,t.jsx)("div",{className:"history-panel__list-date",children:i("Time")}),(0,t.jsx)("div",{className:"history-panel__list-author",children:i("Author")}),(0,t.jsx)("div",{className:"history-panel__restore",children:"Set"})]}),renderItem:(K,ee)=>(0,t.jsx)(o.ui_kit$List.Item,{onClick:()=>{ee!==Oe&&(ve(ee),J(U[ee])),l(r.setBlockSettingsDisable(!0))},className:(0,We.default)("history-panel__item",{"history-panel__item_active":ee===Oe}),children:(0,t.jsxs)(o.ui_kit$Skeleton,{title:!1,loading:K.loading||!1,active:!0,children:[(0,t.jsx)("div",{className:"history-panel__list-date",children:K.date}),(0,t.jsx)("div",{className:"history-panel__list-author",children:V(K)}),K.isAutosave&&Oe!==ee&&(0,t.jsx)("div",{style:{opacity:.45},className:"history-panel__list-autosave",children:i("Auto")}),!K.isAutosave&&(0,t.jsx)(o.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",disabled:p,onClick:le=>{Oe===ee&&le.stopPropagation(),Z(U[ee])},children:i("Set")}),K.isAutosave&&Oe===ee&&(0,t.jsx)(o.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",disabled:p,onClick:le=>{Oe===ee&&le.stopPropagation(),Z(U[ee])},children:i("Set")})]})})})}]}),(0,t.jsx)(o.ui_kit$Button,{type:"text",className:"ant-modal-close","aria-label":"Close",onClick:()=>{l(r.resetToLastActiveSettingsTab()),Ee&&gn(b,Ee),pe(null),H(!0),s({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1})},children:(0,t.jsx)(r.EmIcons,{icon:"Close",component:o.icons$Close})})]})};Ar.propTypes={};var _n=async({blockTags:e,projectTagsArray:i,addTerm:s,project:l,notification:a})=>{if(!e||e.length===0)return[];const d=e.map(c=>{const p=i.find(g=>g.name===c);return p?Promise.resolve(p.id):s({project:l,kind:r.BLOCK_TAGS,name:c}).then(({error:g,data:b})=>{if(g?.status===400)return r.existingTermIdFromError(g);if(b)return b.id;if(g)return a.fromError("TAG_CREATING_ERROR",c,g),null})});return(await Promise.all(d)).filter(c=>c!=null)},xn=()=>{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/660+"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))},Gp=async e=>{const{block:i,form:s,projectData:l,projectTagsArray:a,projectId:d,addBlock:c,editBlock:p,editProject:g,addTerm:b,notification:k,__:h,handleCloseModal:m,htmlContent:S,refetchBlocks:x,reloadBlockScreens:f,onGlobalBlockTemplateSynced:y,onPlainBlockCreated:v}=e;try{const{valid:N,values:B,blockTags:C}=await kn({form:s,notification:k,__:h});if(!N)return;const $=await _n({blockTags:C,projectTagsArray:a,addTerm:b,project:l,notification:k});await r.createBlock({block:i,form:s,projectId:d,htmlContent:S,values:B,tagIds:$,addBlock:c,editBlock:p,editProject:g,notification:k,refetchBlocks:x,reloadBlockScreens:f,projectTagsArray:a,__:h,handleCloseModal:m,onGlobalBlockTemplateSynced:y,onPlainBlockCreated:v})}catch{}},kn=async({form:e,notification:i,__:s})=>{let l=!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:s("Maximum 10 tags available.")}),l=!1),{valid:l,values:a,blockTags:d}},Nr=({isModalVisible:e,htmlContent:i,projectId:s,setIsShowAddAllBlocksModal:l,setIsShowAddAllBlocksModalForNewEmail:a})=>{const{__:d}=r.useI18n(),c=r.useDispatch(),[p]=o.ui_kit$Form.useForm(),[g,b]=(0,n.useState)([]),[k,h]=r.useAddBlockMutation(),[m]=r.useEditBlockMutation(),{data:S}=r.useGetBlockTypesQuery(),x=r.useNotification(),f=r.useAppConfig(),[y,v]=(0,n.useState)([]),N=r.useProjectData(),{refetch:B}=r.useGetBlocksQuery(r.projectBlocksArgs(s)),[C,$]=r.useAddTermMutation(),[U,L]=r.useEditProjectMutation(),F=r.useSendPostMessage(),P=(0,n.useCallback)((be,ye)=>{F({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:be,...ye?{emBlockVersion:ye}:{}}})},[F]),H=(0,n.useCallback)(()=>{F({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_CLEAR_EM_BLOCK_ID})},[F]),{data:ae}=r.useGetTermsQuery({project:N,kind:r.BLOCK_TAGS},{skip:!N?.id});(0,n.useEffect)(()=>{v((ae||[]).map(be=>({value:be.name})))},[ae]),(0,n.useEffect)(()=>{if(S){const be=S;let ye=[];for(let me in be)ye.push({label:d(r.TYPES_TRANSLATE[be[me]]),value:be[me]});b(ye)}},[S,d]);const T=()=>{c(r.closeModal())},te=()=>{l(!0),a(!1),T()},xe=async()=>{await Gp({form:p,projectData:N,projectTagsArray:ae||[],projectId:s,addBlock:k,editBlock:m,editProject:U,addTerm:C,notification:x,__:d,handleCloseModal:T,htmlContent:i,refetchBlocks:B,reloadBlockScreens:xn,onGlobalBlockTemplateSynced:P,onPlainBlockCreated:H})};return(0,t.jsx)(o.ui_kit$Modal,{title:(0,t.jsx)("div",{className:"ant-modal-title",children:d("Save block")}),open:e,onOk:()=>te(),onCancel:T,footer:(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",padding:"8px 0"},children:[(0,t.jsx)(o.ui_kit$Button,{size:"large",onClick:te,children:d("Save all blocks")},"create-all-blocks"),(0,t.jsx)(o.ui_kit$Button,{className:"add-new-block-modal__save-btn",size:"large",type:"primary",loading:h.isLoading,onClick:xe,icon:(0,t.jsx)(r.EmIcons,{icon:"CreateBlock",component:o.icons$CreateBlock,style:{fontSize:22}}),children:d("Save block")},"submit")]}),children:(0,t.jsxs)(o.ui_kit$Form,{form:p,layout:"vertical",name:"add_new_block_form",onFinish:xe,initialValues:{title:"",type:"",tags:[],global_block:!1},autoComplete:"off",children:[(0,t.jsxs)(o.ui_kit$Row,{gutter:16,children:[(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:d("Block name"),name:"title",rules:[{required:!0,message:d("Please input block name")}],style:{marginBottom:15},children:(0,t.jsx)(o.ui_kit$Input,{disabled:h.isLoading||$.isLoading||L.isLoading,size:"large",placeholder:d("Enter block name"),spellCheck:"false"})})}),(0,t.jsx)(o.ui_kit$Col,{span:12,children:(0,t.jsx)(o.ui_kit$Form.Item,{label:d("Type"),name:"type",rules:[{required:!0,message:d("Please choose block type")}],style:{marginBottom:15},children:(0,t.jsx)(o.ui_kit$Select,{disabled:h.isLoading||$.isLoading||L.isLoading,size:"large",placeholder:d("Choose block type"),options:g})})})]}),f.tagsEnabled&&(0,t.jsx)(o.ui_kit$Form.Item,{label:d("Tags"),name:"tags",children:(0,t.jsx)(o.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,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},disabled:h.isLoading||$.isLoading||L.isLoading,options:y})}),f.globalBlockCheckboxEnabled&&(0,t.jsx)(o.ui_kit$Form.Item,{name:"global_block",valuePropName:"checked",style:{marginBottom:15},children:(0,t.jsx)(o.ui_kit$Switch,{label:d("Global block"),disabled:h.isLoading||$.isLoading||L.isLoading})})]})})};Nr.propTypes={};var Yp="https://app.emailmaker.ru/api/".replace(/\/+$/,""),Xp=`${Yp}/wp-json/ai-generator/v1/identificate_blocks`,Kp=["Menu","Header","Content","Banners","Lists","Buttons","Promocodes","Feature","Call to Action","E-Commerce","Articles","Polls","Applications","Separators","Contacts","Footer","Other"];async function qp(e){return await e.getInstance(ht.TOKEN_ID)}async function Jp(e,i,s,l,a){const d={blocks:l,types:Kp,locale:i};s.current=d;try{const c=await qp(a),p=await fetch(Xp,{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 Qp=(e,i="block")=>{const s=new DOMParser,l=s.parseFromString(e,"text/html"),a=l.querySelectorAll(`[em="${i}"]`),d=l.querySelectorAll("link");return{parser:s,document:l,blockElements:a,styleElement:l.querySelector('[em="styles"]'),linksElements:d}};function Zp(e){return Array.from(e).map(i=>i.outerHTML).join("")}var eh=(e,i="block",s=!1)=>{if(!e?.html)return[];const{document:l,blockElements:a,styleElement:d,linksElements:c}=Qp(e.html,i),p=Zp(c);if(!(a instanceof NodeList))return[];const g=l.querySelector("head"),b=g?g.innerHTML:"";return Array.from(a).map((k,h)=>{if(!(k instanceof Element)||!k.outerHTML)return null;const m=d?d.outerHTML:"";return{id:`${e.id}-${h}`,html:s?`<!DOCTYPE html>
|
|
23
23
|
<html>
|
|
24
24
|
<head>${b}</head>
|
|
25
25
|
<body>
|
|
26
|
-
<table>${
|
|
26
|
+
<table>${k.outerHTML}</table>
|
|
27
27
|
</body>
|
|
28
|
-
</html>`:r.minifyHtml(`${h}${m}${x.outerHTML.replace(/class="em-structure"/,'class=""')}`)}}).filter(Boolean)};function rh(e,i,s){const{images:l}=e,{blocks:a}=i;return l?.map(d=>{const c=a.find(h=>h.id===d.block_id);return{blockType:d.classification,blockTitle:d.name,htmlContent:c?.html||"",projectId:s}})}var sh=e=>e.replace(/<div\s+[^>]*style="font-family:[^>]*>(.*?)<\/div>/gs,i=>i.replace(/>(.*?)<\/div>/s,"></div>")),lh=e=>e.replace(/src="[^"]*"/g,'src=""'),ah=e=>/<div\s+[^>]*style="font-family:/i.test(e),nh=e=>{const i=new Set,s=[];for(const l of e)if(ah(l.html)){const a=lh(sh(l.html));i.has(a)||(i.add(a),s.push(l))}else s.push(l);return s},dh=async e=>{const{block:i,form:s,projectData:l,projectId:a,addBlock:d,editProject:c,notification:h,__:g,handleCloseModal:b,htmlContent:x,refetchBlocks:p,reloadBlockScreens:m,values:S,tagIds:k,projectTagsArray:f}=e;try{return await En({block:i,form:s,projectId:a,htmlContent:x,values:S,tagIds:k,addBlock:d,editProject:c,notification:h,refetchBlocks:p,reloadBlockScreens:m,projectTagsArray:f,__:g,handleCloseModal:b})}catch(y){throw y}},ch=({projectData:e,addTerm:i,addBlock:s,editProject:l,reloadBlockScreens:a,notification:d,__:c,handleCloseModal:h,setTriggerOpenSavedBlocksTab:g,setTagsOptions:b,form:x,projectId:p})=>{const[m,S]=(0,n.useState)(!1),k=r.useInvalidateProject(),{data:f}=r.useGetTermsQuery({project:e,kind:r.BLOCK_TAGS},{skip:!e?.id});return(0,n.useEffect)(()=>{b((f||[]).map(v=>({value:v.name})))},[f,b]),{bulkSave:async(v,N,R,C)=>{S(!0);try{if(!N)return;const F=await _n({blockTags:C,projectTagsArray:f||[],addTerm:i,project:e,notification:d});let U=!0,$=!1,L=0;for(const P of v)try{const V=await dh({block:P,form:x,projectData:e,projectId:p,addBlock:s,editProject:l,notification:d,__:c,handleCloseModal:h,values:R,tagIds:F,projectTagsArray:f||[]});$||=!V}catch{U=!1,L++}if(U&&!$&&d.success({id:"BULK_SAVE_SUCCESS",title:c("All blocks saved successfully."),placement:"bottomRight"}),!U){if(L===v.length)throw new Error;d.warning({id:"BULK_SAVE_PARTIAL_SUCCESS",title:c("Some blocks were not saved successfully."),placement:"bottomRight"})}g(!0),k(p),a()}catch(F){throw F}finally{S(!1),x.resetFields(),h()}},confirmSavingBlocksLoading:m}},$r=({isModalVisible:e,currentEmail:i,setIsShowAddAllBlocksModal:s,setTriggerOpenSavedBlocksTab:l,projectId:a})=>{const{__:d,_n:c,sprintf:h}=r.useI18n(),g=r.useContainer(),b=r.useProjectData(),{tagsEnabled:x}=r.useAppConfig(),[p,m]=(0,n.useState)(!1),[S]=o.ui_kit$Form.useForm(),[k,f]=(0,n.useState)([]),[y,v]=(0,n.useState)([]),N=(0,n.useRef)({}),[R]=r.useAddTermMutation(),[C]=r.useEditProjectMutation(),[F,U]=r.useAddBlockMutation(),$=r.useEditorLocale()||void 0,L=ih(i),P=nh(L).map(Se=>Se),V=P.length,ne=r.useNotification(),T=()=>{p||xe||s(!1)},{bulkSave:oe,confirmSavingBlocksLoading:xe}=ch({projectData:b,addTerm:R,addBlock:F,editProject:C,reloadBlockScreens:xn,notification:ne,__:d,handleCloseModal:T,setTriggerOpenSavedBlocksTab:l,setTagsOptions:v,form:S,projectId:a}),be=async()=>{try{const{valid:Se,values:me,blockTags:he}=await kn({form:S,notification:ne,__:d});l(!1),m(!0);const ke=await eh(i,$,N,P,g),ce=r.wpProjectId(i.project,a??b?.id),ze=rh(ke,N.current,String(ce??""));m(!1),await oe(ze,Se,me,he)}catch{m(!1),s(!1),ne.error({title:d("Failed to save blocks."),placement:"bottomRight"})}};return(0,t.jsxs)(o.ui_kit$Modal,{title:(0,t.jsx)("div",{className:"ant-modal-title",children:d("Bulk saving of blocks")}),open:e,onOk:be,onCancel:T,footer:(0,t.jsx)("div",{className:"modal-footer",children:!(p||xe)&&(0,t.jsx)(o.ui_kit$Button,{size:"large",type:"primary",disabled:p||xe,onClick:be,children:h(c("Save %d block","Save %d blocks",V),V)},"submit")}),children:[p||xe?(0,t.jsx)("div",{children:d("All blocks saved at this point can be found in the “Saved Blocks” section in the sidebar.")}):(0,t.jsx)("div",{children:h(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.",V),V)}),!(p||xe)&&x&&(0,t.jsx)(o.ui_kit$Form,{form:S,name:"add_all_blocks_form",layout:"vertical",onFinish:be,style:{paddingTop:24},children:(0,t.jsx)(o.ui_kit$Form.Item,{label:d("Tags"),name:"tags",labelCol:{span:24},wrapperCol:{span:24},style:{display:"block",marginBottom:0},children:(0,t.jsx)(o.ui_kit$Select,{size:"large",mode:"tags",placeholder:d("Add some tags"),style:{width:"100%"},value:k,onChange:f,disabled:U.isLoading,options:y})})}),(xe||p)&&(0,t.jsx)("div",{className:"modal-spinner",children:(0,t.jsx)(o.ui_kit$Spin,{size:"large"})})]})};$r.propTypes={};var uh=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"),Fr=({isModalVisible:e=!1,email:i=null})=>{const{__:s}=r.useI18n(),[l]=o.ui_kit$Form.useForm(),a=r.useDispatch(),d=r.useRouteEmailId(),c=r.useNotification(),h=r.useCurrentUser(),g=r.useProjectData()?.projects_test_emails,[b,x]=r.useSendTestEmailMutation(),{token:p}=(0,o.ui_kit$useToken)(),[m,S]=(0,n.useState)(!1);r.useAppConfig(),r.useCookieManager();const k=r.useProjectData(),f=r.wpProjectId(i.project,k?.id)??i.project,y=d&&r.isEmailsV2Enabled()?r.wpEmailTarget({id:d,wpId:i.wpId},f)?.emailId:void 0,v=y!=null?String(y):d,{data:N}=r.useGetProjectTestRecipientsQuery(f??0,{skip:!0}),[R,C]=r.useEditProjectMutation(),[F]=r.usePutProjectTestRecipientsMutation(),U=r.useProjectData(),{testEmails:$}=r.useAppConfig(),L=r.usePushToDataLayer(),[P,V]=(0,n.useState)([]),[ne,T]=(0,n.useState)(!1),oe=r.useEventEmitter(ht.events.ON_SEND_EMAIL_MODAL_ID);(0,n.useEffect)(()=>{e?oe.fire(i).then(he=>{he.some(ke=>ke===!1)?a(r.closeModal$1()):S(e)}):S(e)},[e,a,S,i,oe]),(0,n.useEffect)(()=>{},[U,f,N]),(0,n.useEffect)(()=>{V($.map(he=>({value:he})))},[$]),(0,n.useEffect)(()=>{const he=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails);if(he&&m&&l.getFieldValue("recipients")?.length===0){const ke=JSON.parse(he);ke?.[f]&&l.setFieldsValue({recipients:ke[f]})}},[f,m,l]),(0,n.useEffect)(()=>{l.setFieldsValue({subject:i.subject})},[l,i.subject]);const xe=()=>{a(r.closeModal$1()),l.resetFields()},be=r.useContentReader(),Se=()=>{l.validateFields().then(()=>{const he={user_id:h.id,project_id:f,email_id:v,subject:l.getFieldValue("subject"),email:l.getFieldValue("recipients").join(","),html:uh(be())};b(he).unwrap().catch(ke=>{c.error({error:{data:{code:ke?.data?.code,message:ke?.data?.message}}})}),T(!0),L({event:"submit",action:"send_test_email",entity_id:d,project_id:f,recipients_count:l.getFieldValue("recipients").length})}).catch(he=>{})},me=n.default.useRef(g);return me.current=g,(0,n.useEffect)(()=>{const he=me.current;if(x.isSuccess&&ne){x.data?.status;{const ke=[...new Set([...P.map(pe=>pe.value),...l.getFieldValue("recipients")])],ce=ke.map(pe=>({projects_test_email:pe}));((pe,Q)=>{if(!pe||!Q)return pe===Q;if(pe.length!==Q.length)return!1;const X=pe.map(J=>J.projects_test_email).sort(),Z=Q.map(J=>J.projects_test_email).sort();return X.every((J,H)=>J===Z[H])})(ce,r.isProjectsV2Enabled()?(N||[]).map(pe=>({projects_test_email:pe})):he)||(r.isProjectsV2Enabled()?F({projectId:f,emails:ke}):R({projectId:f,projects_test_emails:ce}));const Oe=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails)?JSON.parse(localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails)):[];let ve=l.getFieldValue("recipients");localStorage.setItem(r.LOCAL_STORAGE_ITEMS.em_test_emails,JSON.stringify({...Oe,[f]:[...new Set(ve)]}));const Ee=i.title||i.subject||s("Untitled email.").replace(/\.$/,"");c.success(s("The email “")+Ee+s("” was successfully sent."))}T(!1),l.resetFields(),a(r.closeModal$1())}},[x,l,f,R,F,N,P,ne,a,i.title,i.subject,c,C,s]),(0,n.useEffect)(()=>{C.isError&&(c.error(C),T(!1),l.resetFields(),a(r.closeModal$1()))},[a,C,l]),(0,n.useEffect)(()=>{l.setFieldsValue({subject:i.subject||i.title})},[i,l]),(0,t.jsx)(o.ui_kit$Modal,{width:572,title:(0,t.jsxs)("div",{style:{paddingBottom:8},children:[(0,t.jsx)(r.EmIcons,{icon:"SendOutlined",component:o.icons$SendOutlined,size:20,strokeWidth:2})," ",s("Send a test email")]}),open:m,onCancel:xe,footer:[(0,t.jsx)(o.ui_kit$Button,{size:"large",className:"em-analytics__email-send-test",type:"primary",htmlType:"submit",form:"Send mail",loading:C.isLoading,icon:(0,t.jsx)(r.EmIcons,{icon:"SendOutlined",component:o.icons$SendOutlined,size:18,strokeWidth:2,className:"email-preview-menu__list-item-icon"}),onClick:Se,disabled:x.isLoading,children:s("Send")},"submit")],forceRender:!0,children:(0,t.jsxs)(o.ui_kit$Form,{form:l,layout:"vertical",name:"send_mail_form",initialValues:{subject:i.subject||i.title,recipients:[]},autoComplete:"off",children:[(0,t.jsx)(o.ui_kit$Form.Item,{label:s("Subject"),name:"subject",rules:[{required:!1,message:s("Please type subject")}],children:(0,t.jsx)(o.ui_kit$Input,{size:"large",placeholder:s("Type subject")})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:s("Recipients"),name:"recipients",tooltip:{title:s("The test email will be sent to the specified addresses."),icon:(0,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},rules:[{required:!0,validator:(he,ke)=>ke.length>10?Promise.reject(new Error(s("A test email can be sent to a maximum of 10 addresses."))):ke.length!==0?ke.every(ce=>r.emailValidation.test(ce.toLowerCase()))?Promise.resolve():Promise.reject(new Error(s("Please type correct emails"))):Promise.reject(new Error(s("Please type emails")))}],children:(0,t.jsx)(o.ui_kit$Select,{size:"large",mode:"tags",placeholder:s("Add up to 10 recipients"),tooltip:{title:"Tooltip with customize icon",icon:(0,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},options:P,tagRender:he=>{const{label:ke,closable:ce,onClose:ze}=he,Oe=ve=>{ve.preventDefault(),ve.stopPropagation()};return(0,t.jsx)(o.ui_kit$Tag,{variant:"solid",color:p.colorPrimary,onMouseDown:Oe,closable:ce,onClose:ze,style:{borderRadius:6},children:ke})},getPopupContainer:()=>document.getElementById("send_mail_form")})})]})})};Fr.propTypes={isModalVisible:_.default.bool,email:_.default.shape({html:_.default.string,subject:_.default.string})};var mh=at.__exportAll({AddAllBlocksModal:()=>$r,AddNewBlockModal:()=>Or,BlocksSearch:()=>Ar,Discuss:()=>bn,DiscussAi:()=>Ga,EmailProperties:()=>wl,EmailSettings:()=>rr,EmailStyles:()=>mr,FileManagerDataLayer:()=>nn,HistoryPanel:()=>Nr,LimitUpgradeModal:()=>gi,Optimise:()=>sn,SaveBlockBtn:()=>Ur.SaveBlockBtn,SelectedElementPanel:()=>lo,SendTestEmailModal:()=>Fr});mt.AddAllBlocksModal=$r,mt.AddNewBlockModal=Or,mt.BlocksSearch=Ar,mt.Discuss=bn,mt.DiscussAi=Ga,mt.EmailProperties=wl,mt.EmailSettings=rr,mt.EmailStyles=mr,mt.FileManagerDataLayer=nn,mt.HistoryPanel=Nr,mt.LimitUpgradeModal=gi,mt.LimitUpgradeModal$1=gi,mt.Optimise=sn,mt.SaveBlockBtn=Ur.SaveBlockBtn,mt.SelectedElementPanel=lo,mt.SendTestEmailModal=Fr,mt.canonicalImageUrlKey=ho,mt.getImageDimensionsFromBlob=Wr,mt.normalizeImageFormatForDisplay=Oo,Object.defineProperty(mt,"panels_exports",{enumerable:!0,get:function(){return mh}}),mt.resolveDataProviderPreview=Gr,mt.shouldCountAiUsage=Rr,mt.useImageBlobFetch=Yr,mt.useImageBlobResolver=Xr});
|
|
28
|
+
</html>`:r.minifyHtml(`${p}${m}${k.outerHTML.replace(/class="em-structure"/,'class=""')}`)}}).filter(Boolean)};function th(e,i,s){const{images:l}=e,{blocks:a}=i;return l?.map(d=>{const c=a.find(p=>p.id===d.block_id);return{blockType:d.classification,blockTitle:d.name,htmlContent:c?.html||"",projectId:s}})}var oh=e=>e.replace(/<div\s+[^>]*style="font-family:[^>]*>(.*?)<\/div>/gs,i=>i.replace(/>(.*?)<\/div>/s,"></div>")),ih=e=>e.replace(/src="[^"]*"/g,'src=""'),rh=e=>/<div\s+[^>]*style="font-family:/i.test(e),sh=e=>{const i=new Set,s=[];for(const l of e)if(rh(l.html)){const a=ih(oh(l.html));i.has(a)||(i.add(a),s.push(l))}else s.push(l);return s},lh=async e=>{const{block:i,form:s,projectData:l,projectId:a,addBlock:d,editProject:c,notification:p,__:g,handleCloseModal:b,htmlContent:k,refetchBlocks:h,reloadBlockScreens:m,values:S,tagIds:x,projectTagsArray:f}=e;try{return await r.createBlock({block:i,form:s,projectId:a,htmlContent:k,values:S,tagIds:x,addBlock:d,editProject:c,notification:p,refetchBlocks:h,reloadBlockScreens:m,projectTagsArray:f,__:g,handleCloseModal:b})}catch(y){throw y}},ah=({projectData:e,addTerm:i,addBlock:s,editProject:l,reloadBlockScreens:a,notification:d,__:c,handleCloseModal:p,setTriggerOpenSavedBlocksTab:g,setTagsOptions:b,form:k,projectId:h})=>{const[m,S]=(0,n.useState)(!1),x=r.useInvalidateProject(),{data:f}=r.useGetTermsQuery({project:e,kind:r.BLOCK_TAGS},{skip:!e?.id});return(0,n.useEffect)(()=>{b((f||[]).map(v=>({value:v.name})))},[f,b]),{bulkSave:async(v,N,B,C)=>{S(!0);try{if(!N)return;const $=await _n({blockTags:C,projectTagsArray:f||[],addTerm:i,project:e,notification:d});let U=!0,L=0;for(const F of v)try{await lh({block:F,form:k,projectData:e,projectId:h,addBlock:s,editProject:l,notification:d,__:c,handleCloseModal:p,values:B,tagIds:$,projectTagsArray:f||[]})}catch{U=!1,L++}if(U&&d.success({id:"BULK_SAVE_SUCCESS",title:c("All blocks saved successfully."),placement:"bottomRight"}),!U){if(L===v.length)throw new Error;d.warning({id:"BULK_SAVE_PARTIAL_SUCCESS",title:c("Some blocks were not saved successfully."),placement:"bottomRight"})}g(!0),x(h),a()}catch($){throw $}finally{S(!1),k.resetFields(),p()}},confirmSavingBlocksLoading:m}},Lr=({isModalVisible:e,currentEmail:i,setIsShowAddAllBlocksModal:s,setTriggerOpenSavedBlocksTab:l,projectId:a})=>{const{__:d,_n:c,sprintf:p}=r.useI18n(),g=r.useContainer(),b=r.useProjectData(),{tagsEnabled:k}=r.useAppConfig(),[h,m]=(0,n.useState)(!1),[S]=o.ui_kit$Form.useForm(),[x,f]=(0,n.useState)([]),[y,v]=(0,n.useState)([]),N=(0,n.useRef)({}),[B]=r.useAddTermMutation(),[C]=r.useEditProjectMutation(),[$,U]=r.useAddBlockMutation(),L=r.useEditorLocale()||void 0,F=eh(i),P=sh(F).map(ye=>ye),H=P.length,ae=r.useNotification(),T=()=>{h||xe||s(!1)},{bulkSave:te,confirmSavingBlocksLoading:xe}=ah({projectData:b,addTerm:B,addBlock:$,editProject:C,reloadBlockScreens:xn,notification:ae,__:d,handleCloseModal:T,setTriggerOpenSavedBlocksTab:l,setTagsOptions:v,form:S,projectId:a}),be=async()=>{try{const{valid:ye,values:me,blockTags:he}=await kn({form:S,notification:ae,__:d});l(!1),m(!0);const ke=await Jp(i,L,N,P,g),ce=r.wpProjectId(i.project,a??b?.id),ze=th(ke,N.current,String(ce??""));m(!1),await te(ze,ye,me,he)}catch{m(!1),s(!1),ae.error({title:d("Failed to save blocks."),placement:"bottomRight"})}};return(0,t.jsxs)(o.ui_kit$Modal,{title:(0,t.jsx)("div",{className:"ant-modal-title",children:d("Bulk saving of blocks")}),open:e,onOk:be,onCancel:T,footer:(0,t.jsx)("div",{className:"modal-footer",children:!(h||xe)&&(0,t.jsx)(o.ui_kit$Button,{size:"large",type:"primary",disabled:h||xe,onClick:be,children:p(c("Save %d block","Save %d blocks",H),H)},"submit")}),children:[h||xe?(0,t.jsx)("div",{children:d("All blocks saved at this point can be found in the “Saved Blocks” section in the sidebar.")}):(0,t.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.",H),H)}),!(h||xe)&&k&&(0,t.jsx)(o.ui_kit$Form,{form:S,name:"add_all_blocks_form",layout:"vertical",onFinish:be,style:{paddingTop:24},children:(0,t.jsx)(o.ui_kit$Form.Item,{label:d("Tags"),name:"tags",labelCol:{span:24},wrapperCol:{span:24},style:{display:"block",marginBottom:0},children:(0,t.jsx)(o.ui_kit$Select,{size:"large",mode:"tags",placeholder:d("Add some tags"),style:{width:"100%"},value:x,onChange:f,disabled:U.isLoading,options:y})})}),(xe||h)&&(0,t.jsx)("div",{className:"modal-spinner",children:(0,t.jsx)(o.ui_kit$Spin,{size:"large"})})]})};Lr.propTypes={};var nh=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"),Or=({isModalVisible:e=!1,email:i=null})=>{const{__:s}=r.useI18n(),[l]=o.ui_kit$Form.useForm(),a=r.useDispatch(),d=r.useRouteEmailId(),c=r.useNotification(),p=r.useCurrentUser(),g=r.useProjectData()?.projects_test_emails,[b,k]=r.useSendTestEmailMutation(),{token:h}=(0,o.ui_kit$useToken)(),[m,S]=(0,n.useState)(!1);r.useAppConfig(),r.useCookieManager();const x=r.useProjectData(),f=r.wpProjectId(i.project,x?.id)??i.project,y=d&&r.isEmailsV2Enabled()?r.wpEmailTarget({id:d,wpId:i.wpId},f)?.emailId:void 0,v=y!=null?String(y):d,{data:N}=r.useGetProjectTestRecipientsQuery(f??0,{skip:!0}),[B,C]=r.useEditProjectMutation(),[$]=r.usePutProjectTestRecipientsMutation(),U=r.useProjectData(),{testEmails:L}=r.useAppConfig(),F=r.usePushToDataLayer(),[P,H]=(0,n.useState)([]),[ae,T]=(0,n.useState)(!1),te=r.useEventEmitter(ht.events.ON_SEND_EMAIL_MODAL_ID);(0,n.useEffect)(()=>{e?te.fire(i).then(he=>{he.some(ke=>ke===!1)?a(r.closeModal$1()):S(e)}):S(e)},[e,a,S,i,te]),(0,n.useEffect)(()=>{},[U,f,N]),(0,n.useEffect)(()=>{H(L.map(he=>({value:he})))},[L]),(0,n.useEffect)(()=>{const he=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails);if(he&&m&&l.getFieldValue("recipients")?.length===0){const ke=JSON.parse(he);ke?.[f]&&l.setFieldsValue({recipients:ke[f]})}},[f,m,l]),(0,n.useEffect)(()=>{l.setFieldsValue({subject:i.subject})},[l,i.subject]);const xe=()=>{a(r.closeModal$1()),l.resetFields()},be=r.useContentReader(),ye=()=>{l.validateFields().then(()=>{const he={user_id:p.id,project_id:f,email_id:v,subject:l.getFieldValue("subject"),email:l.getFieldValue("recipients").join(","),html:nh(be())};b(he).unwrap().catch(ke=>{c.error({error:{data:{code:ke?.data?.code,message:ke?.data?.message}}})}),T(!0),F({event:"submit",action:"send_test_email",entity_id:d,project_id:f,recipients_count:l.getFieldValue("recipients").length})}).catch(he=>{})},me=n.default.useRef(g);return me.current=g,(0,n.useEffect)(()=>{const he=me.current;if(k.isSuccess&&ae){k.data?.status;{const ke=[...new Set([...P.map(pe=>pe.value),...l.getFieldValue("recipients")])],ce=ke.map(pe=>({projects_test_email:pe}));((pe,Q)=>{if(!pe||!Q)return pe===Q;if(pe.length!==Q.length)return!1;const X=pe.map(J=>J.projects_test_email).sort(),Z=Q.map(J=>J.projects_test_email).sort();return X.every((J,V)=>J===Z[V])})(ce,r.isProjectsV2Enabled()?(N||[]).map(pe=>({projects_test_email:pe})):he)||(r.isProjectsV2Enabled()?$({projectId:f,emails:ke}):B({projectId:f,projects_test_emails:ce}));const Oe=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails)?JSON.parse(localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails)):[];let ve=l.getFieldValue("recipients");localStorage.setItem(r.LOCAL_STORAGE_ITEMS.em_test_emails,JSON.stringify({...Oe,[f]:[...new Set(ve)]}));const Ee=i.title||i.subject||s("Untitled email.").replace(/\.$/,"");c.success(s("The email “")+Ee+s("” was successfully sent."))}T(!1),l.resetFields(),a(r.closeModal$1())}},[k,l,f,B,$,N,P,ae,a,i.title,i.subject,c,C,s]),(0,n.useEffect)(()=>{C.isError&&(c.error(C),T(!1),l.resetFields(),a(r.closeModal$1()))},[a,C,l]),(0,n.useEffect)(()=>{l.setFieldsValue({subject:i.subject||i.title})},[i,l]),(0,t.jsx)(o.ui_kit$Modal,{width:572,title:(0,t.jsxs)("div",{style:{paddingBottom:8},children:[(0,t.jsx)(r.EmIcons,{icon:"SendOutlined",component:o.icons$SendOutlined,size:20,strokeWidth:2})," ",s("Send a test email")]}),open:m,onCancel:xe,footer:[(0,t.jsx)(o.ui_kit$Button,{size:"large",className:"em-analytics__email-send-test",type:"primary",htmlType:"submit",form:"Send mail",loading:C.isLoading,icon:(0,t.jsx)(r.EmIcons,{icon:"SendOutlined",component:o.icons$SendOutlined,size:18,strokeWidth:2,className:"email-preview-menu__list-item-icon"}),onClick:ye,disabled:k.isLoading,children:s("Send")},"submit")],forceRender:!0,children:(0,t.jsxs)(o.ui_kit$Form,{form:l,layout:"vertical",name:"send_mail_form",initialValues:{subject:i.subject||i.title,recipients:[]},autoComplete:"off",children:[(0,t.jsx)(o.ui_kit$Form.Item,{label:s("Subject"),name:"subject",rules:[{required:!1,message:s("Please type subject")}],children:(0,t.jsx)(o.ui_kit$Input,{size:"large",placeholder:s("Type subject")})}),(0,t.jsx)(o.ui_kit$Form.Item,{label:s("Recipients"),name:"recipients",tooltip:{title:s("The test email will be sent to the specified addresses."),icon:(0,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},rules:[{required:!0,validator:(he,ke)=>ke.length>10?Promise.reject(new Error(s("A test email can be sent to a maximum of 10 addresses."))):ke.length!==0?ke.every(ce=>r.emailValidation.test(ce.toLowerCase()))?Promise.resolve():Promise.reject(new Error(s("Please type correct emails"))):Promise.reject(new Error(s("Please type emails")))}],children:(0,t.jsx)(o.ui_kit$Select,{size:"large",mode:"tags",placeholder:s("Add up to 10 recipients"),tooltip:{title:"Tooltip with customize icon",icon:(0,t.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:o.icons$InfoCircleOutlined})},options:P,tagRender:he=>{const{label:ke,closable:ce,onClose:ze}=he,Oe=ve=>{ve.preventDefault(),ve.stopPropagation()};return(0,t.jsx)(o.ui_kit$Tag,{variant:"solid",color:h.colorPrimary,onMouseDown:Oe,closable:ce,onClose:ze,style:{borderRadius:6},children:ke})},getPopupContainer:()=>document.getElementById("send_mail_form")})})]})})};Or.propTypes={isModalVisible:_.default.bool,email:_.default.shape({html:_.default.string,subject:_.default.string})};var dh=at.__exportAll({AddAllBlocksModal:()=>Lr,AddNewBlockModal:()=>Nr,BlocksSearch:()=>Pr,Discuss:()=>bn,DiscussAi:()=>Wa,EmailProperties:()=>Tl,EmailSettings:()=>ir,EmailStyles:()=>ur,FileManagerDataLayer:()=>ln,HistoryPanel:()=>Ar,LimitUpgradeModal:()=>bi,Optimise:()=>on,SaveBlockBtn:()=>Vr.SaveBlockBtn,SelectedElementPanel:()=>lo,SendTestEmailModal:()=>Or});mt.AddAllBlocksModal=Lr,mt.AddNewBlockModal=Nr,mt.BlocksSearch=Pr,mt.Discuss=bn,mt.DiscussAi=Wa,mt.EmailProperties=Tl,mt.EmailSettings=ir,mt.EmailStyles=ur,mt.FileManagerDataLayer=ln,mt.HistoryPanel=Ar,mt.LimitUpgradeModal=bi,mt.LimitUpgradeModal$1=bi,mt.Optimise=on,mt.SaveBlockBtn=Vr.SaveBlockBtn,mt.SelectedElementPanel=lo,mt.SendTestEmailModal=Or,mt.canonicalImageUrlKey=ho,mt.getImageDimensionsFromBlob=Hr,mt.normalizeImageFormatForDisplay=Lo,Object.defineProperty(mt,"panels_exports",{enumerable:!0,get:function(){return dh}}),mt.resolveDataProviderPreview=Wr,mt.shouldCountAiUsage=Br,mt.useImageBlobFetch=zr,mt.useImageBlobResolver=Gr});
|