@emailmaker/emailmaker 1.2.0 → 1.2.5
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/CHANGELOG.md +81 -0
- package/README.md +4 -0
- package/emailmaker-core.ee1618fa.js +859 -0
- package/emailmaker-esm.js +11 -11
- package/{emailmaker-po.fec11667.js → emailmaker-po.ee1618fa.js} +1 -1
- package/emailmaker.d.ts +34 -2
- package/emailmaker.js +12 -12
- package/iframe/.vite/manifest.json +4 -4
- package/iframe/{iframe-eblock.fec11667.html → iframe-eblock.ee1618fa.html} +2 -2
- package/iframe/{iframe.fec11667.html → iframe.ee1618fa.html} +2 -2
- package/iframe/js/elMarkupHelper.Buog1r0c.js +278 -0
- package/iframe/js/iframe-eblock.body.ee1618fa.js +9 -0
- package/iframe/js/iframe-eblock.js +2 -2
- package/iframe/js/iframe.body.ee1618fa.js +129 -0
- package/iframe/js/iframe.js +2 -2
- package/iframe/js/sanitize-html/sanitize-html.js +46 -21756
- package/package.json +1 -1
- package/runtime/react/index.js +1 -1
- package/static/core/155e871a.js +7 -0
- package/static/core/{7be64bf5.js → 17fba7af.js} +1 -1
- package/static/core/{a9235d9e.js → 2a042fe3.js} +1 -1
- package/static/core/{c5713f94.js → 32a14159.js} +1 -1
- package/static/core/{99c15a5d.js → 4de9c323.js} +1 -1
- package/static/core/{ec5f739e.js → 50ba806c.js} +10 -10
- package/static/core/{db685f4e.js → 5b6e2acb.js} +1 -1
- package/static/core/{f2ced98d.js → 63e7f8c1.js} +2 -2
- package/static/core/{790366d3.js → 64711257.js} +1 -1
- package/static/core/{f54ef492.js → 659796a7.js} +1 -1
- package/static/core/{b74171bd.js → 683a6a53.js} +1 -1
- package/static/core/{b27aec0b.js → 6b16159c.js} +1 -1
- package/static/core/{5c4239d8.js → 7e167222.js} +1 -1
- package/static/core/{8b89090c.js → 82f8beb4.js} +1 -1
- package/static/core/{a2c7aeb0.js → 987afc3f.js} +1 -1
- package/static/core/{44fac8d4.js → 9eaed676.js} +1 -1
- package/static/core/{9f7e0f94.js → a8b4352d.js} +1 -1
- package/static/core/{b7dee12b.js → b7289065.js} +2 -2
- package/static/core/b96e571d.js +2 -0
- package/static/core/c03be019.js +4 -0
- package/static/core/{7d006e7b.js → c3d00c5e.js} +1 -1
- package/static/core/{727a165f.js → c67df236.js} +1 -1
- package/static/core/{e15ab856.js → c8443fab.js} +1 -1
- package/static/core/{64c27f91.js → d2780737.js} +1 -1
- package/static/core/d503c406.js +1 -0
- package/static/core/{29b3ccef.js → dd230bbb.js} +1 -1
- package/static/core/e7fa68c2.js +28 -0
- package/static/core/{ccb090eb.js → f35181ec.js} +7 -7
- package/static/esm/b4f8dfdc.js +1 -0
- package/static/umd-runtime/{runtime.CunK0nEC.js → runtime.Bsid8PpY.js} +1 -1
- package/vendor/@emailmaker/ui-kit/package.json +1 -1
- package/emailmaker-core.fec11667.js +0 -859
- package/iframe/js/elMarkupHelper.Dv3AYDYP.js +0 -279
- package/iframe/js/iframe-eblock.body.fec11667.js +0 -9
- package/iframe/js/iframe.body.fec11667.js +0 -129
- package/iframe/js/sanitize-html/sanitize-html.min.js +0 -16923
- package/static/core/2e70fae0.js +0 -4
- package/static/core/83d2ca5d.js +0 -28
- package/static/core/8da91a53.js +0 -2
- package/static/core/bbb87124.js +0 -1
- package/static/core/e7bbe544.js +0 -7
- package/static/esm/ae0fe329.js +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
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/61d7e59b.js",["require","exports","module","static/core/5dc34752.js","static/core/814472f3.js","static/core/425e50a8.js","react","react/jsx-runtime","__delivery__/libs","classnames"],function(B,I,De){const J=B("./5dc34752.js"),r=B("./814472f3.js"),u=B("./425e50a8.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`,G=`${p}borderRadiusBottomRight`,ue="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",q=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:q,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:q,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:q,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,[G]: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,[G]:n})}else{const n=s[U];n===s[H]&&n===s[M]&&n===s[G]?o.setFieldsValue({[le]:n}):o.setFieldsValue({[U]:null,[H]:null,[M]:null,[G]: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:q})}),(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
|
+
|
|
4
|
+
__emailmaker__.define("static/core/425e50a8.js",["require","exports","module","static/core/5dc34752.js","static/core/814472f3.js","react","react/jsx-runtime","__delivery__/libs"],function(t,e,S){const i=t("./5dc34752.js"),r=t("./814472f3.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}})});
|
|
5
|
+
|
|
6
|
+
__emailmaker__.define("static/core/b37ca4d7.js",["require","exports","module","static/core/5dc34752.js","static/core/814472f3.js","static/core/75bbe11f.js","vite/preload-helper"],function(h,I,B){const R=h("./5dc34752.js"),n=h("./814472f3.js"),p=h("./75bbe11f.js");let D=h("vite/preload-helper");var b=R.__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,D.__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}})});
|
|
7
|
+
|
|
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/e7fa68c2.js",["require","exports","module","static/core/5dc34752.js","static/core/ee980948.js","static/core/814472f3.js","static/core/75bbe11f.js","static/core/987afc3f.js","static/core/b37ca4d7.js","static/core/425e50a8.js","react","react/jsx-runtime","__delivery__/libs","react-dom","vite/preload-helper","classnames","dayjs"],function(go,mo,tp){const lo=go("./5dc34752.js"),fo=go("./ee980948.js"),r=go("./814472f3.js"),di=go("./75bbe11f.js"),yr=go("./987afc3f.js"),Va=go("./b37ca4d7.js"),z=go("./425e50a8.js");let n=go("react");n=lo.__toESM(n);let o=go("react/jsx-runtime"),t=go("__delivery__/libs"),Ha=go("react-dom"),Lt=go("vite/preload-helper"),We=go("classnames");We=lo.__toESM(We);let Oo=go("dayjs");Oo=lo.__toESM(Oo);var _=lo.__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,l)=>{const s=URL.createObjectURL(e),a=new Image;a.onload=()=>{URL.revokeObjectURL(s);const d=a.naturalWidth||a.width,c=a.naturalHeight||a.height;d>0&&c>0?i({width:d,height:c}):l(new Error("Could not read image dimensions"))},a.onerror=()=>{URL.revokeObjectURL(s),l(new Error("Could not decode image"))},a.src=s})}function ft(e){return e.trim()}var Ua=67108864,Wa=2e3;function Ot(e){e.abandonTimer!==void 0&&(clearTimeout(e.abandonTimer),e.abandonTimer=void 0)}function jr(e,i){return i?new Promise((l,s)=>{if(i.aborted){s(new DOMException("Aborted","AbortError"));return}const a=()=>{s(new DOMException("Aborted","AbortError"))};i.addEventListener("abort",a,{once:!0}),e.then(d=>{i.removeEventListener("abort",a),l(d)},d=>{i.removeEventListener("abort",a),s(d)})}):e}function za(e={}){const i=e.maxCacheBytes??Ua,l=e.abandonDelayMs??Wa,s=new Map,a=new Map;let d=0;function c(k){const x=s.get(k);x&&(d-=x.size,s.delete(k))}function m(k,x){if(c(k),!(x.size>i)){s.set(k,x),d+=x.size;for(const T of s.keys()){if(d<=i)break;c(T)}}}function f(k){const x=a.get(k);x&&(Ot(x),a.delete(k))}function g(k,x){x.waiters-=1,!(x.waiters>0||x.abandonTimer!==void 0||a.get(k)!==x)&&(x.abandonTimer=setTimeout(()=>{x.abandonTimer=void 0,!(a.get(k)!==x||x.waiters>0)&&(a.delete(k),x.controller.abort())},l))}function E(k,x,T){return x.waiters+=1,Ot(x),T.then(()=>g(k,x),()=>g(k,x)),T}async function h(k,x,T){const I=ft(k);if(!I)throw new Error("Empty image URL");const L=s.get(I);if(L){if(x?.aborted)throw new DOMException("Aborted","AbortError");return s.delete(I),s.set(I,L),L}const y=a.get(I);if(y)return E(I,y,jr(y.promise,x));const C=new AbortController,P={promise:T(I,C.signal).then(K=>(f(I),m(I,K),K)).catch(K=>{throw f(I),K}),controller:C,waiters:0,abandonTimer:void 0};return a.set(I,P),E(I,P,jr(P.promise,x))}function p(k){const x=ft(k);if(!x)return;const T=a.get(x);T&&(Ot(T),T.controller.abort(),a.delete(x)),c(x)}function S(){for(const[,k]of a)Ot(k),k.controller.abort();a.clear(),s.clear(),d=0}return{resolve:h,abandonKey:p,invalidateAll:S}}async function vr(e,i){if(!e||typeof e.findFileByUrl!="function")return null;const l=await e.findFileByUrl(i);if(!l)return null;const s=typeof e.getFileById=="function"&&l.id&&await e.getFileById(l.id)||l,a=s.url||i,d=s.thumbnailUrl||s.thumbnail||a||(typeof e.getThumbnailUrl=="function"?await e.getThumbnailUrl(s):"")||"";return d?{file:s,previewUrl:d}:null}function gt(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 Ga(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 Ya(e,i){const l=await fetch(e,i);if(!l.ok)throw new Error(`Server returned ${l.status}`);return l.blob()}async function Xa(e,i,l){const s=l?{signal:l}: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,m)=>fo.fetchWithResourceProxy(d,{config:i.appConfig,standalone:i.isStandalone,intent:m?.intent||"downloadBlob",validateBlob:async f=>!f.type||f.type.startsWith("image/"),init:c})},d=>Ya(d,s),Ga,{fetchInit:s});return a}function Ir(){const e=r.useAppConfig(),i=r.useIsStandalone(),l=r.useProjectData(),s=r.useEditorProjectId(),a=l?.id!==void 0?String(l.id):s||"",d=r.useEventEmitter(fo.events.FILE_PROXY_EVENT_ID),c=r.useEventEmitter(fo.events.PROXY_URL_EVENT_ID);return(0,n.useCallback)(async(m,f)=>Xa(m,{appConfig:e,isStandalone:i,fireFileProxy:g=>d.fire({url:g,project:a}),fireProxyUrl:g=>c.fire({url:g,project:a})},f),[e,a,i,d,c])}function Ka(e){return fo.getContainer(e).getOrCreateInstance(fo.IMAGE_BLOB_RESOLVER_ID,()=>za())}function Cr(){const e=r.useStore();return(0,n.useMemo)(()=>Ka(e),[e])}function $t(e){const i=String(e??"").split(";")[0].trim();if(!i)return"";const l=i.toLowerCase(),s=l.indexOf("/");if(s===-1)return l;const a=l.slice(s+1);return a==="svg+xml"?"svg":a}var Pr=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),ci=({onChange:e,value:i,validateStatus:l,placeholder:s,disabled:a,name:d,elementSettings:c,imageInfo:m,previewReloadSignal:f,onRemotePreviewValidate:g})=>{const E=r.useCurrentUser(),h=r.useProjectData(),p=r.useAppConfig(),S=r.useIsStandalone(),{__:k}=r.useI18n();r.useSendPostMessage();const x=r.useSendPostMessageEx(),{openImagePicker:T}=r.useImagePicker(),I=r.useStorageProvider(),L=r.useRestClient(),y=h?.id!==void 0?String(h?.id):"",C=E?.id!=="0"?String(E.id):"",{dataProvider:P}=(0,n.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:I,projectId:y,restApi:L,i18n:{__:k},pathPostfix:C,appConfig:p,isStandalone:S}),[p,S,y,L,I,C,k]),K=Ir(),[M]=r.useLazyGetImageInfoQuery(),[$,A]=(0,n.useState)({width:"",height:"",size:""}),[W,se]=(0,n.useState)(!1),[R,te]=(0,n.useState)(0),[he,be]=(0,n.useState)(""),Ie=(0,n.useRef)(""),xe=(0,n.useRef)(f?.counter||0),Be=Cr(),ke=(0,n.useRef)(""),ne=(0,n.useRef)(""),[He,Fe]=(0,n.useState)(0),Se=r.usePlanFeatureGate("image_editor"),ye=()=>{ke.current&&(URL.revokeObjectURL(ke.current),ke.current="")};(0,n.useEffect)(()=>{if(!i){A({width:"",height:"",size:"",format:""}),Ie.current="",be(""),ye();return}if(i.startsWith("data:")||i.startsWith("blob:")){ye(),Ie.current=i,be(i),A({width:"",height:"",size:"",format:""});return}const U=r.stripEmVersionFromUrlString(i);ne.current=U;const V=ft(U),J=new AbortController;let de=!1;const me=async Ae=>{ye();const we=He?r.appendEmVersionForPreviewReload(Ae):Ae;Ie.current=we,be(we);try{const{data:$e}=await M(U);return de||!$e?!1:(A({width:$e?.width,height:$e?.height,size:$e?.fileSize!=null?($e.fileSize/1024).toFixed(0):"",format:$t($e?.format)}),!0)}catch{return!1}},pe=async()=>{const Ae=await Be.resolve(V,J.signal,K);if(de)return;const{width:we,height:$e}=await wr(Ae);if(de)return;ye();const Y=URL.createObjectURL(Ae);ke.current=Y,Ie.current=Y,be(Y),A({width:we,height:$e,size:(Ae.size/1024).toFixed(0),format:$t(Ae.type)})};return(async()=>{try{if(!S){const Ae=await vr(P,U);if(Ae?.previewUrl&&await me(Ae.previewUrl))return}await pe()}catch{de||(ye(),Ie.current="",be(""),A({width:"",height:"",size:"",format:""}))}})(),()=>{de=!0,J.abort()}},[i,P,K,M,S,Be,He]);const re=(0,n.useCallback)(()=>{const U=ne.current;U&&Be.abandonKey(ft(U)),Fe(Date.now())},[Be]);(0,n.useEffect)(()=>{!f?.counter||f.name!==d||f.counter!==xe.current&&(xe.current=f.counter,re())},[d,f,re]),(0,n.useEffect)(()=>()=>ye(),[]);const q=!!i&&!gt(r.stripEmVersionFromUrlString(String(i))),X=async(U=null)=>{const V=d.startsWith("src"),J=U||(V?r.MODALS.UPLOAD_IMAGE_MODAL:r.MODALS.UPLOAD_BACKGROUND_MODAL),de=r.stripEmVersionFromUrlString(i||""),me=await T({kind:V?"img":"background",currentUrl:gt(de)?"":de,entryModal:J});if(!me?.url)return;const pe=de===r.stripEmVersionFromUrlString(me.url);(!pe||me.url!==i)&&e(me.url),me.meta?.mode==="save"&&pe&&(re(),V&&x(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(me.url)}))},Q=[{label:k("Upload"),key:"Upload",onClick:()=>X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}];p.imageCenterStockEnabled&&Q.push({label:k("Stock"),key:"Stock",onClick:()=>X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_STOCK:r.MODALS.UPLOAD_BACKGROUND_MODAL_STOCK)}),p.imageCenterGifEnabled&&Q.push({label:k("GIF"),key:"GIF",onClick:()=>X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_GIF:r.MODALS.UPLOAD_BACKGROUND_MODAL_GIF)}),p.elementAIimageEnabled&&Q.push({label:k("AI"),key:"AI",onClick:()=>X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_AI:r.MODALS.UPLOAD_BACKGROUND_MODAL_AI)});const Z=()=>{se(!1)};return(0,o.jsxs)("div",{className:(0,We.default)("upload-bg-image",{"upload-bg-image_disabled":a}),children:[i?(0,o.jsxs)("div",{className:"ant-input-file-uploader upload-bg-image__inner-wrap",onClick:U=>{U.target?.closest(".upload-bg-image__edit")||U.target?.closest(".upload-bg-image__edit-menu")||U.target?.closest(".upload-bg-image__menu")||U.target?.closest(".inputGroup")||X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)},children:[(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,popupRender:()=>p.imagePathDropdownEnabled?(0,o.jsx)("div",{className:"inputGroup",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image,size:20,strokeWidth:p.iconStrokeWidth,style:{verticalAlign:"text-top"}}),allowClear:!0,onChange:e,value:i,placeholder:s,name:d,disabled:a,className:"upload-bg-image__input"})}):(0,o.jsx)(o.Fragment,{}),classNames:{root:"upload-bg-image__dropdown-overlay"},styles:{root:{top:32,marginTop:"8px",width:347,left:0}},trigger:["hover"],placement:"bottom",getPopupContainer:U=>U.closest(".upload-bg-image__inner-wrap"),children:(0,o.jsxs)("div",{className:"upload-bg-image__hover-container",style:{display:"flex",alignItems:"center"},children:[(0,o.jsx)("div",{className:"upload-bg-image__uploader",children:(0,o.jsx)("div",{className:"upload-bg-image__uploader-content",children:(0,o.jsxs)("div",{className:"upload-bg-image__uploader-content-inner",children:[(0,o.jsx)("div",{className:"upload-bg-image__uploader-img-wrap",children:he?(0,o.jsx)("img",{className:"upload-bg-image__uploader-img",src:he,alt:"",onLoad:()=>{g&&Pr(r.stripEmVersionFromUrlString(i||""))&&g("success")},onError:()=>{const U=ne.current,V=r.stripEmVersionFromUrlString(he||""),J=r.stripEmVersionFromUrlString(U||"");if(U&&V!==J){Ie.current=U,be(U);return}g&&Pr(J)&&g("error")}}):(0,o.jsx)("div",{className:"upload-bg-image__uploader-img-placeholder","aria-hidden":!0})}),(0,o.jsx)("div",{className:"upload-bg-image__uploader-icons-wrap",children:(0,o.jsx)("div",{className:"upload-bg-image__uploader-content"})})]})})}),$.width&&$.height?(0,o.jsxs)("div",{className:"image-size",children:[$.width," × ",$.height,!!c&&(c.type===r.ELEMENT_TYPES.IMG||c.type===r.ELEMENT_TYPES.CAROUSEL)&&" → "+m.renderedWidth+" × "+m.renderedHeight,(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsxs)("span",{children:[$.size," ",k("kB")]}),$.format&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)("span",{className:"image-size-format",children:$.format})]})]}):(0,o.jsx)(t.ui_kit$Text,{type:"secondary",className:"image-empty-text",children:s})]})}),(0,o.jsx)("div",{style:{flexGrow:1}}),$.format!=="gif"&&p.imageCenterEditorEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:k("Edit"),children:(0,o.jsx)(t.ui_kit$Text,{type:"link",className:"upload-bg-image__edit",children:(0,o.jsx)(r.EmIcons,{icon:"Edit",component:t.icons$Edit,size:16,strokeWidth:p.iconStrokeWidth,onClick:()=>{Se.isLocked&&q?(se(!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,o.jsx)(t.ui_kit$Dropdown,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:Q},classNames:{root:"upload-bg-image__menu"},children:(0,o.jsx)(t.ui_kit$Text,{type:"link",className:"upload-bg-image__edit-menu image-change",children:i?(0,o.jsx)(r.EmIcons,{size:16,strokeWidth:p.iconStrokeWidth,icon:"SyncOutlined",component:t.icons$SyncOutlined,onClick:()=>X(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}):k("Upload")})},"Actions")]}):(0,o.jsx)(t.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,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image,size:16,strokeWidth:p.iconStrokeWidth}),children:k("Add image")}),W&&(0,o.jsx)(r.PlanUpgradePrompt,{open:!0,onCancel:Z,initialSlide:R})]})};ci.propTypes={};var qa=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),Ja=(e,i,l)=>i||(l?.type===r.ELEMENT_TYPES.CAROUSEL?["images",e]:Array.isArray(e)?e:[e]),Ar=e=>Array.isArray(e)?e.join("_"):e,No=({form:e,label:i,name:l,watchPath:s,disabled:a=!1,elementSettings:d,previewReloadSignal:c=void 0})=>{const{token:m}=(0,t.ui_kit$useToken)(),[f,g]=(0,n.useState)("success"),E=(0,n.useMemo)(()=>({marginBottom:m.formItemMarginBottomXS}),[m.formItemMarginBottomXS]),h=t.ui_kit$Form.useWatch(Ja(l,s,d),e);return(0,n.useEffect)(()=>{if(!h){g("");return}if(typeof h=="string"&&(h.startsWith("data:")||h.startsWith("blob:"))){g("success");return}if(qa(h)){g("validating");return}g("success")},[h]),(0,o.jsx)(t.ui_kit$Form.Item,{name:l,validateStatus:f,style:E,children:(0,o.jsx)(ci,{validateStatus:f,placeholder:i,name:Ar(l),disabled:a,elementSettings:d,imageInfo:d?.type===r.ELEMENT_TYPES.CAROUSEL?d?.carouselImages?.[Ar(l).split("_")[1]]:d,previewReloadSignal:c,onRemotePreviewValidate:g})})};No.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},No.defaulProps={disabled:!1,previewReloadSignal:null};var To=({form:e,oneBorderRadiusValue:i,setOneBorderRadiusValue:l,elementSettings:s,namePrefix:a="",typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),m=d==="mobile",f=m?"mobileBorderRadius":"borderRadius",g=m?"mobileBorderRadiusAll":"borderRadiusAll",E=m?"mobileBorderRadiusTopLeft":"borderRadiusTopLeft",h=m?"mobileBorderRadiusTopRight":"borderRadiusTopRight",p=m?"mobileBorderRadiusBottomRight":"borderRadiusBottomRight",S=m?"mobileBorderRadiusBottomLeft":"borderRadiusBottomLeft",k=m?z.MOBILE_BORDER_RADIUS_POSITION:z.BORDER_RADIUS_POSITION,x=()=>{const T=e.getFieldsValue(!0);let I;i?(e.setFieldsValue({[E]:T[g]||null,[S]:T[g]||null,[h]:T[g]||null,[p]:T[g]||null}),I={[f]:{[k[E]]:T[g]||0,[k[S]]:T[g]||0,[k[h]]:T[g]||0,[k[p]]:T[g]||0}}):T[E]===T[S]&&T[E]===T[h]&&T[E]===T[p]?(e.setFieldsValue({[g]:T[E]}),I={[f]:{[k[g]]:T[E]}}):(e.setFieldsValue({[E]:null,[S]:null,[h]:null,[p]:null}),I={[f]:{[k[g]]:0,[k[E]]:0,[k[S]]:0,[k[h]]:0,[k[p]]:0}});const L=m?{mobileBorderRadius:{all:T.mobileBorderRadiusAll||null,classNamePrefix:"em-mob-border_radius_all-"}}:{[`${a}${f}`]:{...s[`${a}${f}`],...I[`${a}${f}`]}};c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:L}),l(y=>!y)};return(0,o.jsx)(t.ui_kit$FormBorderRadiusInputs,{namePrefix:a,typeOfForm:d,oneBorderRadiusValue:i,onToggle:x,borderRadiusIcon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"BorderRadius",component:t.icons$BorderRadius,className:"selected-td-form__icon-radius"})})};To.displayName="SelectedElementFormBorderRadius";var Qa="em-mob-text_align-",Za=({value:e,onChange:i,onSync:l,fieldName:s,...a})=>{const d=(typeof e=="object"?e?.value:e)??"",c=m=>{const f={classNamePrefix:Qa,value:m};i?.(f),l?.({[s]:f})};return(0,o.jsx)(t.ui_kit$FormAlignControl,{value:d,onChange:c,...a})},Ho=({form:e,elementSettings:i,imgParent:l=!1,name:s="align",tooltipTitle:a,typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),m=r.useAppConfig(),f=d==="mobile",g=f?"mobileAlign":s;if(f){const E=h=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:h})};return(0,o.jsx)(t.ui_kit$Form.Item,{name:g,children:(0,o.jsx)(Za,{fieldName:g,onSync:E,disabled:l&&!i.parent,strokeWidth:m.iconStrokeWidth,tooltipTitle:a})})}return(0,o.jsx)(t.ui_kit$Form.Item,{name:g,children:(0,o.jsx)(t.ui_kit$FormAlignControl,{disabled:l&&!i.parent,strokeWidth:m.iconStrokeWidth,tooltipTitle:a})})},Mo=({form:e,elementSettings:i,tooltipTitle:l,disabled:s=!1,isNewIconType:a=!1,typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),m=r.useAppConfig(),f=d==="mobile",g=f?"mobileVerticalAlign":"valign",E=h=>{e.setFieldsValue({[g]:h}),f||c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[g]:h}})};return(0,o.jsx)(t.ui_kit$Form.Item,{name:g,children:(0,o.jsx)(t.ui_kit$FormVerticalAlignControl,{...!f&&{value:i.valign,onChange:E},disabled:s,isNewIconType:a,strokeWidth:m.iconStrokeWidth})})},en=["mobileBoxShadowHOffset","mobileBoxShadowVOffset","mobileBoxShadowBlurRadius","mobileBoxShadowSpreadRadius","mobileBoxShadowColor","mobileBoxShadowInset"],on=({form:e,elementSettings:i,enableSwitch:l,usedColors:s,withoutShadowLabel:a})=>{const d=r.useSendPostMessage(),c=i.mobileBoxShadow,[m,f]=(0,n.useState)(!c||c.hOffset===0&&c.vOffset===0&&c.blurRadius===0&&c.spreadRadius===0),g=t.ui_kit$Form.useWatch(en,e);(0,n.useEffect)(()=>{if(!g)return;const[h,p,S,k,x,T]=g;(h===0||h===void 0||h===null)&&(p===0||p===void 0||p===null)&&(S===0||S===void 0||S===null)&&(k===0||k===void 0||k===null)&&(x===""||x===void 0||x===null)&&(T===!1||T===void 0)||f(!1)},[g]);const E=()=>{f(h=>!h),e.setFieldsValue({mobileBoxShadowHOffset:m?"":0,mobileBoxShadowVOffset:m?"":0,mobileBoxShadowBlurRadius:m?"":0,mobileBoxShadowSpreadRadius:m?"":0,mobileBoxShadowColor:"",mobileBoxShadowInset:!1}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBoxShadow:{classNamePrefix:"em-mob-box_shadow-",hOffset:m?null:0,vOffset:m?null:0,blurRadius:m?null:0,spreadRadius:m?null:0,color:null,inset:!1}}})};return(0,o.jsxs)(o.Fragment,{children:[l&&(0,o.jsx)("div",{style:{float:"right",marginTop:-9,marginRight:50},children:(0,o.jsx)(t.ui_kit$Switch,{id:"without-shadow",label:a,labelSize:"small",size:"small",checked:m,onChange:E})}),(0,o.jsx)("p",{style:{paddingBottom:"8px",margin:"-30px 0 0"},children:" "}),(0,o.jsx)(t.ui_kit$FormBoxShadowInputs,{typeOfForm:"mobile",usedColors:s})]})},vo=({typeOfForm:e="desktop",form:i,elementSettings:l,enableSwitch:s=!0})=>{const{__:a}=r.useI18n(),d=r.useSelector(r.selectEmailSettings).usedColors;return e==="mobile"&&i&&l?(0,o.jsx)(on,{form:i,elementSettings:l,enableSwitch:s,usedColors:d,withoutShadowLabel:a("Without shadow")}):(0,o.jsx)(t.ui_kit$FormBoxShadowInputs,{typeOfForm:e,usedColors:d})};vo.displayName="SelectedElementFormBoxShadow";var Io=({form:e,elementSettings:i,directionControl:l})=>{const{__:s}=r.useI18n();return(0,o.jsx)(t.ui_kit$FormDisplayControl,{directionControl:l,className:"selected-element-form-show",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"show",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$Radio.Group,{children:(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Radio.Button,{value:"all",children:s("Both")}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:s("Desktop"),children:(0,o.jsx)(t.ui_kit$Radio.Button,{value:"desktop",children:(0,o.jsx)(r.EmIcons,{icon:"DesktopOutlined",component:t.icons$DesktopOutlined})})}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:s("Mobile"),children:(0,o.jsx)(t.ui_kit$Radio.Button,{value:"mobile",children:(0,o.jsx)(r.EmIcons,{icon:"MobileOutlined",component:t.icons$MobileOutlined})})})]})})})})},ui=({form:e,elementSettings:i,handleChangeValues:l})=>{const{__:s}=r.useI18n(),a=(0,n.useRef)(),{token:d}=(0,t.ui_kit$useToken)(),[c,m]=(0,n.useState)(!1),[f,g]=(0,n.useState)(!1),[E,h]=(0,n.useState)(!1),[p,S]=(0,n.useState)(!1),[k,x]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let A=new URL("https://emailmaker.ru/?"+i.countdown);m(A.searchParams.get("font1").endsWith("-b")||A.searchParams.get("font1").endsWith("-bi")),g(A.searchParams.get("font1").endsWith("-i")||A.searchParams.get("font1").endsWith("-bi")),h(A.searchParams.get("font2").endsWith("-b")||A.searchParams.get("font2").endsWith("-bi")),S(A.searchParams.get("font2").endsWith("-i")||A.searchParams.get("font2").endsWith("-bi")),x(A.searchParams.get("tp")==="true")},[i]);const T=[{value:"-12",label:s("-12:00 Apia")},{value:"-11",label:s("-11:00 Pago Pago, Midway Atoll")},{value:"-10",label:s("-10:00 Honolulu, Anchorage")},{value:"-9",label:s("-9:00 Anchorage, Yukon")},{value:"-8",label:s("-8:00 Los Angeles, Vancouver")},{value:"-7",label:s("-7:00 Denver, Phoenix")},{value:"-6",label:s("-6:00 Mexico City, Guadalajara")},{value:"-5",label:s("-5:00 New York, Toronto, Havana")},{value:"-4",label:s("-4:00 Caracas, Santo Domingo")},{value:"-3",label:s("-3:00 Buenos Aires, Santiago, Montevideo")},{value:"-2",label:s("-2:00 South Georgia, Saint Helena")},{value:"-1",label:s("-1:00 Azores, Cape Verde")},{value:"0",label:s("+0:00 London, Lisbon, Dublin")},{value:"1",label:s("+1:00 Paris, Berlin, Rome")},{value:"2",label:s("+2:00 Athens, Kiev, Istanbul")},{value:"3",label:s("+3:00 Istanbul, Doha, Baghdad")},{value:"4",label:s("+4:00 Baku, Dubai, Tbilisi")},{value:"5",label:s("+5:00 Karachi, Tashkent, Islamabad")},{value:"6",label:s("+6:00 Almaty, Dhaka, Bishkek")},{value:"7",label:s("+7:00 Bangkok, Ho Chi Minh City, Jakarta")},{value:"8",label:s("+8:00 Beijing, Hong Kong, Singapore")},{value:"9",label:s("+9:00 Tokyo, Seoul, Jayapura")},{value:"10",label:s("+10:00 Sydney, Melbourne, Port Moresby")},{value:"11",label:s("+11:00 Honiara, Nuku'alofa, Apia")}],I=[{value:"20",label:s("20 s")},{value:"40",label:s("40 s")},{value:"60",label:s("60 s")}],L=[{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"}],y=A=>A&&A<(0,Oo.default)().endOf("day")-864e5,C=A=>{x(A)},P=()=>{const A=!c;e.setFieldValue("countdownNumbersStrong",A),l({countdownNumbersStrong:A}),m(A)},K=()=>{const A=!f;e.setFieldValue("countdownNumbersItalic",A),l({countdownNumbersItalic:A}),g(A)},M=()=>{const A=!E;e.setFieldValue("countdownLabelsStrong",A),l({countdownLabelsStrong:A}),h(A)},$=()=>{const A=!p;e.setFieldValue("countdownLabelsItalic",A),l({countdownLabelsItalic:A}),S(A)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("End time"),name:"countdownTime",children:(0,o.jsx)(t.ui_kit$DatePicker,{ref:a,format:"DD.MM.YYYY HH:mm",disabledDate:y,showTime:!0,placement:"bottomRight",getPopupContainer:A=>{const W=A?.closest(".blocks-app");return W||(A?.ownerDocument?.body??document.body)},allowClear:!1,allowEmpty:!1})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("Time zone"),name:"countdownTimeZone",style:{width:"100%"},children:(0,o.jsx)(t.ui_kit$Select,{placeholder:s("Select the time zone"),getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),children:T.map(A=>(0,o.jsx)(t.ui_kit$Select.Option,{value:A.value,children:A.label},A.value))})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:20,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("Background color"),name:"countdownBackgroundColor",className:"countdown-color",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:s("Background color"),usedColors:i.usedColors})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownTransparency",valuePropName:"checked",style:{paddingTop:29},children:(0,o.jsx)(t.ui_kit$Switch,{id:"countdownTransparency",label:s("Transparency"),labelSize:"small",size:"small",onChange:C})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:s("Countdown font settings"),compact:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersFont",style:{marginBottom:d.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:L})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersColor",className:"countdown-color",style:{marginBottom:d.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{usedColors:i.usedColors})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersFontSize",children:(0,o.jsx)(t.ui_kit$InputNumber,{min:12,placeholder:s("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:s("Strong"),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersStrong",children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":c}),onClick:P,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-td-form__icon-radius"})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:s("Italic"),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersItalic",children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":f}),onClick:K,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})})})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:s("Time units font settings"),compact:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsFont",style:{marginBottom:d.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:L})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsColor",className:"countdown-color",style:{marginBottom:d.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{usedColors:i.usedColors})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsFontSize",children:(0,o.jsx)(t.ui_kit$InputNumber,{min:8,placeholder:s("Font size"),addonAfter:"px",prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined})})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:s("Strong"),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsStrong",children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":E}),onClick:M,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-td-form__icon-radius"})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:s("Italic"),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsItalic",children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":p}),onClick:$,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})})})})})]})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("Language"),name:"countdownLanguage",style:{width:"100%"},children:(0,o.jsx)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:[{value:"ru_RU",label:"Русский"},{value:"en_US",label:"English"},{value:"uk_UA",label:"Українська"},{value:"pt_BR",label:"Português"},{value:"fr-CA",label:"Français"},{value:"de_DE",label:"Deutsch"},{value:"pl_PL",label:"Polski"},{value:"es_ES",label:"Español"},{value:"tr_TR",label:"Türkçe"},{value:"lt_LT",label:"Lietuvių kalba"},{value:"lv_LV",label:"Latviešu valoda"},{value:"et_EE",label:"Eesti keel"},{value:"hu_HU",label:"Magyar"},{value:"el_GR",label:"Ελληνικά"},{value:"it_IT",label:"Italiano"}]})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("Duration"),name:"countdownDuration",style:{width:"100%"},children:(0,o.jsx)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:I})})})]})]})};ui.propTypes={form:_.default.shape({setFieldsValue:_.default.func.isRequired}).isRequired,elementSettings:_.default.object.isRequired,tooltipTitle:_.default.string};var mi=({form:e,elementSettings:i})=>{const{__:l}=r.useI18n(),{token:s}=(0,t.ui_kit$useToken)();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("URL of the video clip."),placement:"right",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:["video","source"],className:"selected-image-form__alt",children:(0,o.jsx)(t.ui_kit$Input,{allowClear:!0,placeholder:l("Video URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"VideoCameraOutlined",component:t.icons$VideoCameraOutlined})})})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Play button"),name:["video","playButton"],style:{width:"100%",marginBottom:s.formItemMarginBottomMD+4},children:(0,o.jsxs)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),children:[(0,o.jsxs)(t.ui_kit$Select.Option,{value:"youtube_red",children:[(0,o.jsx)(r.EmIcons,{icon:"YoutubeOutlined",component:t.icons$YoutubeOutlined,style:{color:"#FF0000"}})," ",l("Youtube Red")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"youtube_black",children:[(0,o.jsx)(r.EmIcons,{icon:"YoutubeOutlined",component:t.icons$YoutubeOutlined})," ",l("Youtube Black")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"youtube_white",children:[(0,o.jsx)(r.EmIcons,{icon:"YoutubeOutlined",component:t.icons$YoutubeOutlined,style:{color:"#aaa"}})," ",l("Youtube White")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"vimeo",children:[(0,o.jsx)(r.EmIcons,{icon:"Vimeo",component:t.icons$Vimeo})," ",l("Vimeo")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"white_circle",children:[(0,o.jsx)(r.EmIcons,{icon:"PlayCircleOutlined",component:t.icons$PlayCircleOutlined,style:{color:"#aaa"}})," ",l("White circle")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"black_circle",children:[(0,o.jsx)(r.EmIcons,{icon:"PlayCircleOutlined",component:t.icons$PlayCircleOutlined})," ",l("Black circle")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"white_circle_outlined",children:[(0,o.jsx)(r.EmIcons,{icon:"RightCircleOutlined",component:t.icons$RightCircleOutlined,style:{color:"#aaa"}})," ",l("White circle outlined")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"black_circle_outlined",children:[(0,o.jsx)(r.EmIcons,{icon:"RightCircleOutlined",component:t.icons$RightCircleOutlined})," ",l("Black circle outlined")]}),(0,o.jsxs)(t.ui_kit$Select.Option,{value:"none",children:[" ",l("Without button")]})]})})]})};mi.propTypes={form:_.default.shape({setFieldsValue:_.default.func.isRequired}).isRequired,elementSettings:_.default.object.isRequired,tooltipTitle:_.default.string};var tn={marginBottom:10},Co=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(t.ui_kit$Row,{gutter:20,style:tn,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"ampShow",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$Radio.Group,{children:(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Radio.Button,{value:"all",children:e("Both")}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:e("AMP"),children:(0,o.jsx)(t.ui_kit$Radio.Button,{value:"amp",children:"AMP"})}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:e("HTML"),children:(0,o.jsx)(t.ui_kit$Radio.Button,{value:"html",children:"HTML"})})]})})})})})},{Option:pi}=t.ui_kit$Select,{mobileBorderRadiusAll:rn,mobileBorderRadiusTopLeft:hi,mobileBorderRadiusBottomLeft:bi,mobileBorderRadiusTopRight:fi,mobileBorderRadiusBottomRight:gi,borderRadiusBottomRight:_i,borderRadiusTopRight:xi,borderRadiusBottomLeft:ki,borderRadiusTopLeft:Ei,alt:ln,src:sn,title:an,link:lt,borderRadiusAll:Nr,imgReplacer:nn,expanded:dn}={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"},Jo=({linkProtocol:e})=>{switch(e){case"https://":return(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined});case"mailto:":return(0,o.jsx)(r.EmIcons,{icon:"MailOutlined",component:t.icons$MailOutlined});case"tel:":return(0,o.jsx)(r.EmIcons,{icon:"PhoneOutlined",component:t.icons$PhoneOutlined});case"sms:":return(0,o.jsx)(r.EmIcons,{icon:"CommentOutlined",component:t.icons$CommentOutlined});case"ftp://":return(0,o.jsx)(r.EmIcons,{icon:"FileOutlined",component:t.icons$FileOutlined});case"#":return(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined});default:return(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined})}},cn=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")}],Qo=({handleLinkProtocolsChange:e,linkProtocol:i,__:l})=>{const s=n.default.useMemo(()=>cn(l),[l]);return(0,o.jsx)(t.ui_kit$Select,{style:{width:90,textAlign:"left"},value:i,onChange:e,options:s,popupMatchSelectWidth:!1,listHeight:320})},Zo=({show:e,__:i,style:l,className:s})=>{const a=n.default.useMemo(()=>({marginBottom:8,...l}),[l]);return e?(0,o.jsx)(t.ui_kit$Alert,{className:s,title:i("Anchor links do not work in Outlook, Gmail, and several other email clients."),type:"warning",showIcon:!0,style:a}):null},Bi=e=>!(!e.startsWith("#")||e.indexOf("#",1)!==-1),un=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*(["'])((?:\\.|(?!\1).)*?)\1(?:\s*\/?>)?\s*$/i,mn=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*([^\s/>]+)(?:\s*\/?>)?\s*$/i;function et(e){if(typeof e!="string")return e;let i=e.trim();if(!i)return i;const l=i.match(un);if(l)i=l[2];else{const s=i.match(mn);s&&(i=s[1])}return i.startsWith("https://http")&&(i=i.substring(8)),i}var Ft=(e,i="https://")=>e?e.startsWith("https://")||e.startsWith("http://")?"https://":e.startsWith("mailto:")?"mailto:":e.startsWith("tel:")?"tel:":e.startsWith("sms:")?"sms:":e.startsWith("ftp://")?"ftp://":Bi(e)?"#":"":i,Uo=(e,i)=>{const l=Ft(e,"");return i(l),l},Lr=e=>{if(!e||!e.startsWith("mailto:"))return{subject:"",body:"",baseEmail:e||""};try{const i=new URL(e),l=e.split("?")[0];return{subject:i.searchParams.get("subject")||"",body:i.searchParams.get("body")||"",baseEmail:l}}catch{return{subject:"",body:"",baseEmail:e.split("?")[0]}}},Si=(e,i,l)=>{if(!e||!e.startsWith("mailto:"))return e;const s=e.split("?")[0],a=[];return i&&a.push(`subject=${encodeURIComponent(i)}`),l&&a.push(`body=${encodeURIComponent(l)}`),a.length>0?`${s}?${a.join("&")}`:s},u=e=>e||(e===0?"0":""),po=e=>e&&e!=="auto"?e:e===0?"0":"",Or=(e,i)=>{if(typeof e=="object"&&e!==null&&"value"in e){if(e.value)return e.value;if(e.value==="")return""}return typeof e=="string"&&e?e:i||""};function Ti(e){const i={...e,link:e.link==null?"https://":e.link,borderRadiusAll:u(e.borderRadius?.all),borderRadiusTopLeft:u(e.borderRadius?.topLeft),borderRadiusBottomLeft:u(e.borderRadius?.bottomLeft),borderRadiusTopRight:u(e.borderRadius?.topRight),borderRadiusBottomRight:u(e.borderRadius?.bottomRight),mobileBorderRadiusAll:u(e.mobileBorderRadius?.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius?.topLeft!==null?e.mobileBorderRadius?.topLeft:e.mobileBorderRadius?.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius?.bottomLeft!==null?e.mobileBorderRadius?.bottomLeft:e.mobileBorderRadius?.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius?.topRight!==null?e.mobileBorderRadius?.topRight:e.mobileBorderRadius?.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius?.bottomRight!==null?e.mobileBorderRadius?.bottomRight:e.mobileBorderRadius?.all),show:e.show?e.show:"all",altSrc:e.src};if(e.video&&(i.videoPlayButton=e.video.playButton??"youtube_red",i.videoSource=e.video.source??""),e.carouselImages?.length>0){const l={};e.carouselImages?.map((s,a)=>(Object.keys(s).forEach(d=>{l[d+"_"+a]=s[d]}),!0)),i.images=l}if(e.sections?.length>0){const l=[];e.sections?.map((s,a)=>(l.push({[`expanded_${a}`]:s.expanded}),!0)),i.sections=l}return i}function $r(e,i,l){const s=l.hasOwnProperty("images"),a=l.hasOwnProperty("sections"),d=Object.keys(s?l.images:a?l.sections:l)[0],c=s?l.images:a?l.sections:l;let m={};const f=i.getFieldsValue(!0);switch(d.split("_")[0]){case an:case sn:case ln:case nn:if(s){const E=[...e.carouselImages];E[d.split("_")[1]][d.split("_")[0]]=c[d],m={carouselImages:E}}else m=c;break;case dn:if(a){const E=[...e.sections];E[d.split("_")[1]][d.split("_")[0]]=c[d],m={sections:E}}break;case lt:let g=et(c[d]);e.type===r.ELEMENT_TYPES.CAROUSEL?(m.carouselImages=e.carouselImages,s?(i.setFieldValue(["images",[lt+"_"+d.split("_")[1]]],g),m.carouselImages[d.split("_")[1]].link=g,m.link="",i.setFieldValue(lt,"")):(e.carouselImages.forEach((E,h)=>{i.setFieldValue(["images",lt+"_"+h],g),m.carouselImages[h].link=g,m.link=g}),i.setFieldValue(lt,g))):(i.setFieldValue(lt,g),m.link=g);break;case Nr:m={borderRadius:{...e.borderRadius,[z.BORDER_RADIUS_POSITION[Ei]]:f[Ei],[z.BORDER_RADIUS_POSITION[ki]]:f[ki],[z.BORDER_RADIUS_POSITION[xi]]:f[xi],[z.BORDER_RADIUS_POSITION[_i]]:f[_i],[z.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case Ei:case ki:case xi:case _i:m={borderRadius:{...e.borderRadius,[z.BORDER_RADIUS_POSITION[Nr]]:null,[z.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case rn:case hi:case bi:case fi:case gi:m={mobileBorderRadius:{...e.mobileBorderRadius,[z.MOBILE_BORDER_RADIUS_POSITION[hi]]:f[hi],[z.MOBILE_BORDER_RADIUS_POSITION[bi]]:f[bi],[z.MOBILE_BORDER_RADIUS_POSITION[fi]]:f[fi],[z.MOBILE_BORDER_RADIUS_POSITION[gi]]:f[gi],[z.MOBILE_BORDER_RADIUS_POSITION[d]]:c[d],classNamePrefix:"em-mob-border_radius_"+z.MOBILE_BORDER_RADIUS_POSITION[d]+"-"}};break;default:m=c}return{...e,...m}}var $o=(0,o.jsxs)(t.ui_kit$Select,{className:"select-after",children:[(0,o.jsx)(pi,{value:"px",children:"px"}),(0,o.jsx)(pi,{value:"%",children:"%"})]}),pn=(0,o.jsx)(t.ui_kit$Select,{className:"select-after",children:(0,o.jsx)(pi,{value:"px",children:"px"})}),Fr=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:a,boxShadowShow:d,oneBorderRadiusValue:c,setOneBorderRadiusValue:m,hasLink:f,hasAlt:g,hasTitle:E,isOpenSrcReplacer:h,mergeTagItems:p,mergeMenuOpen:S,setMergeMenuOpen:k,cascaderRef:x,linkInputRef:T,linkButtonRef:I,altInputRef:L,altButtonRef:y,titleInputRef:C,titleButtonRef:P,srcReplacerInputRef:K,srcReplacerButtonRef:M,linkProtocol:$,handleLinkProtocolsChange:A,linkButtonHandler:W,linkInputHandler:se,altButtonHandler:R,altInputHandler:te,titleButtonHandler:he,titleInputHandler:be,srcReplacerButtonHandler:Ie,srcInputHandler:xe,handleSelect:Be,onChange:ke,filter:ne,renderSearchOption:He,handleChangeValues:Fe,toggleShowBorderHandler:Se,toggleShowBorderRadiusHandler:ye,toggleShowBoxShadowHandler:re})=>{const{__:q}=r.useI18n(),{token:X}=(0,t.ui_kit$useToken)(),Q=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Ho,{form:e,elementSettings:i,imgParent:!0})}),Q.formImageFieldVerticalAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,align:"right",children:(0,o.jsx)(Mo,{form:e,elementSettings:i})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:i.type==="countdown"?15:24}}),i.type==="countdown"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(ui,{form:e,elementSettings:i,handleChangeValues:Fe}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),Q.mergeTagsShow&&p&&(0,o.jsx)(t.ui_kit$Col,{span:24,id:"merge_tags_wrapper",children:(0,o.jsxs)(t.ui_kit$Form.Item,{style:{marginBottom:24},children:[(0,o.jsx)(t.ui_kit$Button,{id:"merge_tags_button",icon:(0,o.jsx)(r.EmIcons,{icon:"MergeTags",component:t.icons$MergeTags}),style:{width:"100%",display:S?"none":"inline-flex"},onClick:()=>k(!0),children:q("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:x,classNames:{popup:{root:"merge-tags"}},options:p,placeholder:q("Start typing the title"),showSearch:{filter:ne,render:He},spellCheck:"false",getPopupContainer:Z=>Z.closest(".email-pane__collapse-wrapper"),onChange:ke,style:{display:S?"block":"none"},open:S,onKeyDown:Z=>{Z.key==="Escape"&&k(!1)}})]})}),i.type==="video"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(mi,{form:e,elementSettings:i}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),(i.type==="img"||i.type==="video")&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,o.jsx)(No,{form:e,label:q("Image path"),name:"src",placeholder:q("Image path"),elementSettings:i,tooltipTitle:""})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,style:{marginBottom:!g&&!f&&!E&&!h?X.formItemMarginBottomMD+4:X.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:g||q("Alternative text"),placement:"bottom",getPopupContainer:Z=>Z.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!g}),onClick:R,ref:y,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),Q.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:E||q("Tooltip text"),placement:"bottom",getPopupContainer:Z=>Z.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!E}),onClick:he,ref:P,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:f||q("Hyperlink URL"),placement:"bottom",getPopupContainer:Z=>Z.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!f}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:W,ref:I})}),Q.formImageFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:q("Image replacer"),placement:"bottom",getPopupContainer:Z=>Z.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":h}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:Ie,ref:M})})]}),(!!f||!!g||!!E||!!h)&&(0,o.jsxs)("div",{style:{marginBottom:X.formItemMarginBottomMD+4},children:[!!f&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Zo,{show:$==="#",__:q,style:{marginBottom:X.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:q("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:X.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Qo,{linkProtocol:$,handleLinkProtocolsChange:A,__:q}),placeholder:q("Hyperlink URL"),allowClear:!0,ref:T,onChange:se,onSelect:Be,prefix:(0,o.jsx)(Jo,{linkProtocol:$})})})})]}),!!g&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:q("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:X.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:q("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:te,ref:L,onSelect:Be})})}),Q.formFieldImageTitleEnabled&&!!E&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:q("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:X.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:q("Enter the title of the image"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:be,ref:C,onSelect:Be})})}),!!h&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:q("Image src"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"imgReplacer",className:"selected-image-form__alt",style:{marginBottom:X.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:q("Code that will replace the image `src`"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:q("Image src")}),onChange:xe,ref:K,onSelect:Be})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:q("Size"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:i.maxWidth,showHeight:Q.formImageFieldHeightEnabled,showMinMax:!1,gutter:X.marginSM,rowStyle:{marginBottom:Q.formImageFieldHeightEnabled?4:24},labels:{width:q("Width"),height:q("Height"),minWidth:q("Minimum width"),maxWidth:q("Maximum width")}})}),Q.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:q("Borders"),collapsible:!0,open:s,onToggle:Se,dividerTop:!0,children:(0,o.jsx)(z.SelectedElementFormBorder,{form:e,elementSettings:i})}),Q.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:q("Border radius"),collapsible:!0,open:a,onToggle:ye,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:c,setOneBorderRadiusValue:m,elementSettings:i})}),Q.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:q("Box shadow"),collapsible:!0,open:d,onToggle:re,dividerTop:!0,children:(0,o.jsx)(vo,{})}),Q.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:q("Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e})}),Q.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:q("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Co,{})})]})};Fr.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 Wo=({form:e,name:i,elementSettings:l,isPicture:s,tooltipTitle:a})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),m=(0,n.useRef)(),[f,g]=(0,n.useState)(l[i]?.value==="auto"),{token:E}=(0,t.ui_kit$useToken)(),[h,p]=(0,n.useState)(""),S=x=>{e.setFieldsValue({[i]:"",[i+"Dim"]:"px"}),g(T=>!T),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{[i]:{classNamePrefix:"em-mob-width-",value:f?null:"auto",dim:""}}})},k=x=>{g(!1),p(e.getFieldsValue(!0)[i+"Dim"]==="%"?100:"")};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:a,placement:"bottom",children:(0,o.jsx)("div",{children:(0,o.jsx)(t.ui_kit$Form.Item,{name:i,style:{marginBottom:E.formItemMarginBottomXS/2},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{ref:m,min:0,max:h,placeholder:d("Width"),onChange:k,prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:(0,o.jsx)(t.ui_kit$Form.Item,{name:i+"Dim",noStyle:!0,children:$o})})})})}),!s&&(0,o.jsx)(t.ui_kit$Switch,{id:"auto-width",label:d("Auto"),labelSize:"small",size:"small",checked:f,onChange:S})]})};Wo.propTypes={form:_.default.shape({setFieldsValue:_.default.func.isRequired}).isRequired,elementSettings:_.default.object.isRequired,tooltipTitle:_.default.string};var ot=({form:e,name:i,elementSettings:l,isPicture:s,tooltipTitle:a})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),m=(0,n.useRef)(),[f,g]=(0,n.useState)(l.mobileHeight?.value==="auto"),{token:E}=(0,t.ui_kit$useToken)(),h=S=>{e.setFieldsValue({mobileHeight:"",mobileHeightDim:"px"}),g(k=>!k),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{mobileHeight:{classNamePrefix:"em-mob-height-",value:f?null:"auto",dim:""}}})},p=S=>{g(!1)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:a,placement:"bottom",children:(0,o.jsx)("div",{children:(0,o.jsx)(t.ui_kit$Form.Item,{name:i,style:{marginBottom:E.formItemMarginBottomXS/2},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{ref:m,min:0,placeholder:d("Height"),onChange:p,prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})}),!s&&(0,o.jsx)(t.ui_kit$Switch,{id:"auto-height",label:d("Auto"),labelSize:"small",size:"small",checked:f,onChange:h})]})};ot.propTypes={form:_.default.shape({setFieldsValue:_.default.func.isRequired}).isRequired,elementSettings:_.default.object.isRequired,tooltipTitle:_.default.string};var Mr=({form:e,elementSettings:i,handleChangeValues:l,boxShadow:s,mobileBordersShow:a,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:m,oneMobileBorderRadiusValue:f,setOneMobileBorderRadiusValue:g,hasLink:E,hasAlt:h,hasTitle:p,linkInputRef:S,linkButtonRef:k,altInputRef:x,altButtonRef:T,titleInputRef:I,titleButtonRef:L,linkInputHandler:y,altButtonHandler:C,altInputHandler:P,titleButtonHandler:K,titleInputHandler:M,linkButtonHandler:$,toggleShowMobileBorderHandler:A,toggleShowMobileBorderRadiusHandler:W,toggleShowMobileBoxShadowHandler:se,toggleShowMobileSizeHandler:R})=>{const{__:te}=r.useI18n(),{token:he}=(0,t.ui_kit$useToken)(),be=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:30,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Ho,{form:e,elementSettings:i,imgParent:!0,typeOfForm:"mobile"})}),be.formImageFieldVerticalAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,align:"right",children:(0,o.jsx)(Mo,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:i.type==="countdown"?15:24}}),i.type==="countdown"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(ui,{form:e,elementSettings:i,handleChangeValues:l}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),i.type==="video"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(mi,{form:e,elementSettings:i}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),(i.type==="img"||i.type==="video")&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,o.jsx)(No,{form:e,label:te("Image path"),name:"src",placeholder:te("Image path"),elementSettings:i,tooltipTitle:""})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,style:{marginBottom:!h&&!E&&!p?he.formItemMarginBottomMD+4:he.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:h||te("Alternative text"),placement:"bottom",getPopupContainer:Ie=>Ie.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!h}),onClick:C,ref:T,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),be.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:p||te("Tooltip text"),placement:"bottom",getPopupContainer:Ie=>Ie.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!p}),onClick:K,ref:L,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:E||te("Hyperlink URL"),placement:"bottom",getPopupContainer:Ie=>Ie.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!E}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:$,ref:k})})]}),(!!E||!!h||!!p)&&(0,o.jsxs)("div",{style:{marginBottom:he.formItemMarginBottomMD+4},children:[!!E&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:te("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:he.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{ref:S,allowClear:!0,placeholder:te("Hyperlink URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined}),onChange:y})})}),!!h&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:te("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:he.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:te("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:P,ref:x})})}),be.formFieldImageTitleEnabled&&!!p&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:te("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:he.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:te("Tooltip text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:M,ref:I})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:te("Size"),collapsible:!0,open:m,onToggle:R,dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:24},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Wo,{form:e,name:"mobileWidth",elementSettings:i,isPicture:"true",tooltipTitle:te("Width")})}),be.formImageFieldHeightEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(ot,{form:e,name:"mobileHeight",elementSettings:i,isPicture:"true",tooltipTitle:te("Height")})})]})}),be.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:te("Borders"),collapsible:!0,open:a,onToggle:A,dividerTop:!0,children:(0,o.jsx)(z.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),be.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:te("Border radius"),collapsible:!0,open:d,onToggle:W,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:f,setOneBorderRadiusValue:g,elementSettings:i,typeOfForm:"mobile"})}),be.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:te("Box shadow"),collapsible:!0,open:c,onToggle:se,dividerTop:!0,children:(0,o.jsx)(vo,{typeOfForm:"mobile"})}),be.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:te("Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e})}),be.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:te("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Co,{})})]})};Mr.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 hn=e=>typeof e=="object"&&e!==null?e.path:void 0;function Fo(){const e=(0,n.useRef)(!1),i=(0,n.useRef)(null),l=(0,n.useCallback)(a=>{e.current=!a},[]),s=(0,n.useCallback)((a,d)=>{const c=JSON.stringify(hn(a)??null);return i.current!==c&&(i.current=c,e.current=!1),d?e.current:(e.current=!1,!1)},[]);return(0,n.useMemo)(()=>({markBorderToggled:l,isStaleBorderSnapshot:s}),[l,s])}function st(e){const i=(0,n.useRef)(null),l=(0,n.useRef)(e);return l.current=e,{remember:(0,n.useCallback)(s=>{i.current=s},[]),fillFields:(0,n.useCallback)((s,a)=>{l.current!==i.current&&s.setFieldsValue(a)},[])}}var Dr=2e3;function Vr(e,{ordered:i=!1}={}){const l=(0,n.useRef)([]),s=(0,n.useRef)(new WeakMap),a=(0,n.useRef)(e);return a.current=e,{remember:(0,n.useCallback)(d=>{const c=Date.now(),m=l.current.filter(f=>c-f.at<Dr);m.push({key:JSON.stringify(a.current(d)),at:c}),l.current=m.slice(-10),i&&d&&typeof d=="object"&&s.current.set(d,!1)},[i]),isOwnEcho:(0,n.useCallback)(d=>{if(!d)return!1;const c=Date.now(),m=JSON.stringify(a.current(d)),f=l.current.filter(h=>c-h.at<Dr);if(!i)return f.some(h=>h.key===m);const g=s.current.get(d);if(g!==void 0)return g;const E=f.findIndex(h=>h.key===m);return E>=0&&(l.current=f.slice(E)),s.current.set(d,E>=0),E>=0},[i]),forget:(0,n.useCallback)(()=>{l.current=[],s.current=new WeakMap},[])}}var bn=1e3,fn=2e4,Hr="https://useblocks.io/app/",gn=["activateSection","changeKey","parent","path","nextElem","prevElem"];function Ri(e){if(Array.isArray(e))return e.map(Ri);if(e&&typeof e=="object"){const i=e;return Object.fromEntries(Object.keys(i).sort().map(l=>[l,Ri(i[l])]))}return e}function _n(e){const i={...e};return gn.forEach(l=>delete i[l]),Ri(i)}var Ur=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm(),s=Fo(),a=Fo();let d=r.useDispatch();const c=r.useAppConfig(),m=r.useEditorProjectId(),f=r.useNotification(),g=r.useSendPostMessage(),E=r.useSendPostMessageEx(),{openImagePicker:h}=r.useImagePicker(),p=r.useSelector(r.selectEmailViewType),S=r.useSelector(r.selectMobileViewActive),k=r.useCurrentUser(),x=r.useSelector(r.selectIsCodeMode),T=r.useSelector(r.selectCodeModeDirection),[I]=r.useUploadImageMutation(),[L,y]=r.useSendShortLinkMutation(),[C,P]=(0,n.useState)({name:"",counter:0}),K=(0,n.useRef)(null),M=(0,n.useRef)(null),$=(0,n.useRef)(null),A=(0,n.useRef)(null),W=(0,n.useRef)(null),se=(0,n.useRef)(null),R=(0,n.useRef)(null),te=(0,n.useRef)(null),he=(0,n.useRef)(null),[be,Ie]=(0,n.useState)({}),[xe,Be]=(0,n.useState)(!0),[ke,ne]=(0,n.useState)(!0),[He,Fe]=(0,n.useState)(""),[Se,ye]=(0,n.useState)(""),[re,q]=(0,n.useState)(""),[X,Q]=(0,n.useState)(!1),[Z,U]=(0,n.useState)(!1),[V,J]=(0,n.useState)(!1),[de,me]=(0,n.useState)(!1),[pe,Ae]=(0,n.useState)(!1),[we,$e]=(0,n.useState)(!1),[Y,le]=(0,n.useState)(!1),[Ce,G]=(0,n.useState)(!1),[Te,Ne]=(0,n.useState)("https://"),Pe=(0,n.useRef)(!1),Me=(0,n.useRef)(),Ue=e,ze=(0,n.useRef)(Ue);ze.current=Ue;const ce=(0,n.useCallback)(()=>l.getFieldsValue(!0).video,[l]),[fe,v]=(0,n.useState)(),[ie,Re]=(0,n.useState)(!1),[Oe,De]=(0,n.useState)(null),[Ge,Qe]=(0,n.useState)({start:0,end:0}),[O,oe]=(0,n.useState)(!1),[j,w]=(0,n.useState)(!1),[ue,ve]=(0,n.useState)(!1),[Xe,Ke]=(0,n.useState)(!1),to=(0,n.useRef)(void 0),io=(0,n.useRef)(null),co=(0,n.useRef)(null),Eo=Xe||ue||Ce;(0,n.useEffect)(()=>()=>clearTimeout(to.current),[]);const xo=(0,n.useRef)(null);(0,n.useEffect)(()=>{const N=xo.current,Le=N?.firstElementChild??null;if(!Eo||!N||!Le)return;const ge=[];for(let Ze=N.parentElement;Ze;Ze=Ze.parentElement)getComputedStyle(Ze).overflowY!=="visible"&&ge.push(Ze);let _e=0,Ve="";const qe=()=>{const Ze=N.getBoundingClientRect(),ho=N.offsetHeight>0?Ze.height/N.offsetHeight:1;let bo=Math.max(Ze.top,0),oo=Math.min(Ze.bottom,window.innerHeight);ge.forEach(qo=>{const bt=qo.getBoundingClientRect();bo=Math.max(bo,bt.top),oo=Math.min(oo,bt.bottom)});const uo=(bo-Ze.top)/(ho||1),So=Math.max(oo-bo,0)/(ho||1),jo=`${Math.round(uo)}/${Math.round(So)}`;jo!==Ve&&(Ve=jo,Le.style.top=`${uo}px`,Le.style.height=`${So}px`),_e=requestAnimationFrame(qe)};return qe(),()=>cancelAnimationFrame(_e)},[Eo]);const D=()=>{const N=io.current;co.current=N?.isConnected&&typeof N.selectionStart=="number"?{element:N,start:N.selectionStart,end:N.selectionEnd??N.selectionStart}:null},ee=x&&T!=="bottom",B=r.useElementEntityKind();(0,n.useEffect)(()=>{ie&&he.current&&he.current.focus()},[ie]);const F=(N,Le)=>{const ge=document.getElementById(Le);if(ge){const _e=Le.substring(Le.indexOf("selected_image_form_")+20),Ve=ge.value?.substring(0,Ge.start),qe=ge.value?.substring(Ge.end);g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{...e,[_e]:Ve+N+qe}}),l.setFieldValue(_e,Ve+N+qe),ge.focus(),setTimeout(()=>{ge.selectionStart=Ge.start,ge.selectionEnd=Ge.start+N.length},400),oe(!0)}},b=r.useAppConfig().mergeTags;(0,n.useEffect)(()=>{b?.items?.length&&v(r.mapMargeTags(b.items))},[b,v]);const H=(N,Le)=>{if(Re(!1),N){const ge=b.syntax.length>1?fe.findIndex(Ve=>Ve.key===Le[0].key):0,_e=b.syntax[ge].replace("%value%",N[N.length-1]);Oe?.getAttribute("id")==="selected_image_form_title"||Oe?.getAttribute("id")==="selected_image_form_alt"||Oe?.getAttribute("id")==="selected_image_form_link"||Oe?.getAttribute("id")==="selected_image_form_imgReplacer"?F(_e,Oe?.getAttribute("id")):(l.setFieldValue("imgReplacer",_e),g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:_e}}))}},ae=(N,Le)=>Le.some(ge=>ge.label.toLowerCase().indexOf(N.toLowerCase())>-1),je=(N,Le)=>{const ge=Le.map((_e,Ve)=>{const qe=_e.label.split(new RegExp(`(${N})`,"gi"));return(0,o.jsxs)("span",{children:[Ve!==0&&(0,o.jsx)("span",{children:" / "}),qe.map((Ze,ho)=>Ze.toLowerCase()===N.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:Ze},ho):Ze)]},_e.value)});return(0,o.jsx)("div",{title:Le.map(_e=>_e.label).join(" / "),children:ge})},Ee=r.useRootElement();(0,n.useEffect)(()=>{const N=({target:_e})=>{_e.closest('[id="merge_tags_wrapper"]')||(io.current=_e,De(_e))},Le=({target:_e})=>{!_e.closest(".merge-tags")&&!_e.closest("#merge_tags_button")&&Re(!1)},ge=new fo.Disposable;return ge.addDisposable(r.addWindowListenerFromShadow(Ee,"focusin",N)),ge.addDisposable(r.addWindowListenerFromShadow(Ee,"click",Le)),()=>{ge.dispose()}},[Ee]);const Je=({target:N})=>{if(N&&!O){const{selectionStart:Le,selectionEnd:ge}=N;Qe({start:Le,end:ge})}oe(!1)},no=e.border,wo=e.mobileBorder,Po=Object.keys(no).find(N=>no[N]?.width||no[N]?.style||no[N]?.color),Bo=Object.keys(wo).find(N=>wo[N]?.width||wo[N]?.style||wo[N]?.color),ao=N=>N&&(N?.width||N?.style||N?.color)?N:"",{remember:yo,fillFields:Ko}=st(e),{remember:ko,isOwnEcho:Vo,forget:It}=Vr(_n,{ordered:!0}),Lo=(0,n.useRef)(void 0);(0,n.useEffect)(()=>{if(e){const N=e.path;N!==Lo.current&&(Lo.current=N,It());const Le=Vo(e)?()=>{}:Ko;e.src!==Me.current&&(Me.current=e.src,Pe.current=!1);const ge=e.boxShadow;if(Ie(ge),e.link&&Ne(Ft(e.link,"https://")),Le(l,{...e,link:e.link==null?"https://":e.link,width:e.width?.value,widthDim:e.width?.dim,height:e.height?.value,heightDim:e.height?.dim,borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),mobileBorderAll:ao(e.mobileBorder.all)||!(ao(e.mobileBorder.top)||ao(e.mobileBorder.bottom)||ao(e.mobileBorder.right)||ao(e.mobileBorder.left))&&ao(e.border.all),mobileBorderTop:ao(e.mobileBorder.top)||!ao(e.mobileBorder.all)&&ao(e.border.top),mobileBorderBottom:ao(e.mobileBorder.bottom)||!ao(e.mobileBorder.all)&&ao(e.border.bottom),mobileBorderRight:ao(e.mobileBorder.right)||!ao(e.mobileBorder.all)&&ao(e.border.right),mobileBorderLeft:ao(e.mobileBorder.left)||!ao(e.mobileBorder.all)&&ao(e.border.left),borderRadiusAll:u(e.borderRadius.all),borderRadiusTopLeft:u(e.borderRadius.topLeft),borderRadiusBottomLeft:u(e.borderRadius.bottomLeft),borderRadiusTopRight:u(e.borderRadius.topRight),borderRadiusBottomRight:u(e.borderRadius.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:po(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:po(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:po(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:po(e.mobileHeight?.value)?e.mobileHeight?.dim:e.height?.dim,mobileBorderRadiusAll:u(e.mobileBorderRadius.all)||u(e.borderRadius.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius?.topLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topLeft)||u(e.borderRadius?.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius?.bottomLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomLeft)||u(e.borderRadius?.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius?.topRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topRight)||u(e.borderRadius?.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius?.bottomRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomRight)||u(e.borderRadius?.all),mobileBoxShadowInset:e.mobileBoxShadow?.inset!=null?e.mobileBoxShadow.inset:e.boxShadow?.inset||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset)||u(e.boxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset)||u(e.boxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius)||u(e.boxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius)||u(e.boxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color||e.boxShadow?.color),mobileAlign:u(e.mobileAlign?.value)||e.align,mobileVerticalAlign:u(e.mobileVerticalAlign?.value||e.valign),show:e.show?e.show:"all",altSrc:e.src,video:{source:"",playButton:"youtube_red",...Ue.video}}),e.countdown){let qe=new URL("https://emailmaker.ru/?"+e.countdown),Ze=qe.searchParams.get("font1"),ho=!1,bo=!1;Ze.endsWith("-b")?(Ze=Ze.substring(0,Ze.length-2),ho=!0):Ze.endsWith("-i")?(Ze=Ze.substring(0,Ze.length-2),bo=!0):Ze.endsWith("-bi")&&(Ze=Ze.substring(0,Ze.length-3),ho=!0,bo=!0);let oo=qe.searchParams.get("font2"),uo=!1,So=!1;oo.endsWith("-b")?(oo=oo.substring(0,oo.length-2),uo=!0):oo.endsWith("-i")?(oo=oo.substring(0,oo.length-2),So=!0):oo.endsWith("-bi")&&(oo=oo.substring(0,oo.length-3),uo=!0,So=!0),Le(l,{countdownTime:(0,Oo.default)(new Date(Date.parse(qe.searchParams.get("time"))+qe.searchParams.get("timezone")*36e5+new Date().getTimezoneOffset()/60*36e5).toISOString()),countdownDuration:qe.searchParams.get("frames")||20,countdownTimeZone:qe.searchParams.get("timezone"),countdownLanguage:qe.searchParams.get("locale").replace("-","_"),countdownBackgroundColor:"#"+qe.searchParams.get("bg"),countdownTransparency:qe.searchParams.get("tp")==="true"?"checked":"",countdownNumbersFont:Ze,countdownNumbersFontSize:qe.searchParams.get("size1")/2,countdownNumbersFontSizeDim:"px",countdownNumbersColor:"#"+qe.searchParams.get("color1"),countdownLabelsFont:oo,countdownLabelsFontSize:qe.searchParams.get("size2")/2,countdownLabelsFontSizeDim:"px",countdownLabelsColor:"#"+qe.searchParams.get("color2"),countdownNumbersStrong:ho,countdownNumbersItalic:bo,countdownLabelsStrong:uo,countdownLabelsItalic:So})}!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?Be(!1):Be(!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))?ne(!1):ne(!0);const _e=s.isStaleBorderSnapshot(e,!!Po),Ve=a.isStaleBorderSnapshot(e,!!Bo);_e&&l.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Ve||_e&&!Bo)&&l.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),Q(qe=>Po&&!_e?!0:qe),U(qe=>Po&&!_e||Bo&&!Ve?!0:qe),J(!!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),Ae(!!e.boxShadow),$e(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),le(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value||!!e.height.value),e.link?Fe(e.link):Fe(Pe.current?"...":""),ye(e.alt),q(e.title),w(e.imgReplacer?.length)}},[l,e,Ko,Vo,It,Ue,Po,Bo,s,a]),(0,n.useEffect)(()=>{if(Eo)return;const N=co.current;co.current=null,!(!N||!N.element.isConnected||N.element.disabled)&&io.current===N.element&&(N.element.focus(),N.element.setSelectionRange(N.start,N.end))},[Eo]);const rt=async(N,Le,ge)=>{const _e={};_e.user_id=k.id,_e.folder=N,Le&&(Le=await r.prepareImageForEditorUpload(Le,c),_e.file=Le),ge&&(_e.page_url=ge);const Ve=await I(_e);if(Ve.error)f.fromError("IMAGE_UPLOAD_ERROR",Le,Ve.error,!0);else{const qe=Va.extractUploadResult(Ve.data);if(qe.error)return;if(qe.file_url)return qe.file_url}},ai=(N,Le)=>new Promise((ge,_e)=>{const Ve=new Image,qe=new Image;Ve.crossOrigin="Anonymous",qe.crossOrigin="Anonymous";let Ze=Le?2:1;const ho=()=>{clearTimeout(oo),_e(new Error("video preview images are not loaded"))},bo=()=>{Ze-=1,Ze===0&&(clearTimeout(oo),ge({frame:Ve,button:Le?qe:null}))},oo=setTimeout(ho,fn);Ve.onload=bo,Ve.onerror=ho,Ve.src=N,Le&&(qe.onload=bo,qe.onerror=ho,qe.src=Le)}),ni=(N,Le,ge,_e)=>{const Ve=document.createElement("canvas"),qe=Ve.getContext("2d");if(Ve.width=N.width,Ve.height=N.height,qe.clearRect(0,0,Ve.width,Ve.height),qe.drawImage(N,0,0,N.width,N.height),!Le)return Ve;const Ze=Math.min(Ve.width,Ve.height);let ho;if(N.height>N.width)ho=.3;else{const bt=N.width/N.height;ho=Math.min(_e,.3+(bt-1)/(ge-1)*.1)}const bo=Ze*ho,oo=Le.width/Le.height;let uo,So;oo>=1?(uo=bo,So=bo/oo):(So=bo,uo=bo*oo);const jo=(Ve.width-uo)/2,qo=(Ve.height-So)/2;return qe.drawImage(Le,jo,qo,uo,So),Ve},Ct=N=>new Promise(Le=>{N.toBlob(ge=>Le(ge?new File([ge],"image.jpeg",{type:"image/jpeg"}):null),"image/jpg",1)}),Hm=async N=>{const Le=l.getFieldsValue(!0).video?.playButton||e.video?.playButton;if(!(!N||!Le||Le==="none"||ue)){D(),ve(!0);try{const{frame:ge,button:_e}=await ai(N,`${Hr}${Le}.png`),Ve=await Ct(ni(ge,_e,2,.4)),qe=Ve&&await rt(m,Ve);if(!qe)return;g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:ze.current.type,settings:{src:qe}}),Pt({...ze.current,src:qe,video:ce()||ze.current.video,activateSection:null,changeKey:"src"}),setTimeout(()=>{l.setFieldValue("src",qe)},100)}catch{}finally{ve(!1)}}},Um=async()=>{const N=ce(),Le=N?.source,ge=N?.playButton;if(!Le)return;const _e=()=>ce()?.source!==Le;D(),Ke(!0);try{const Ve=await rt("tmp",null,Le);if(!Ve||_e())return;const{frame:qe,button:Ze}=await ai(Ve,ge&&ge!=="none"?`${Hr}${ge}.png`:null);if(_e())return;const ho=await Ct(ni(qe,Ze,2.5,.35)),bo=ho&&await rt(m,ho);bo&&!_e()&&Tr(bo)}catch{}finally{Ke(!1)}},Sr=N=>{clearTimeout(to.current),to.current=setTimeout(()=>{N()},bn)},Wm=()=>{const N=l.getFieldsValue(!0);let Le=new URL("https://cdt3.emcdn.ru/rndt?"+e.countdown),ge=N.countdownNumbersFont;N.countdownNumbersStrong&&N.countdownNumbersItalic?ge+="-bi":N.countdownNumbersStrong?ge+="-b":N.countdownNumbersItalic&&(ge+="-i");let _e=N.countdownLabelsFont;N.countdownLabelsStrong&&N.countdownLabelsItalic?_e+="-bi":N.countdownLabelsStrong?_e+="-b":N.countdownLabelsItalic&&(_e+="-i"),Le.searchParams.set("time",new Date(N.countdownTime.$d-N.countdownTimeZone*36e5-new Date().getTimezoneOffset()/60*36e5).toISOString()),Le.searchParams.set("bg",N.countdownBackgroundColor.substring(1)||"#FFFFFF"),Le.searchParams.set("tp",!!N.countdownTransparency),Le.searchParams.set("font1",ge),Le.searchParams.set("size1",N.countdownNumbersFontSize*2||12),Le.searchParams.set("color1",N.countdownNumbersColor.substring(1)||"#000000"),Le.searchParams.set("font2",_e),Le.searchParams.set("size2",N.countdownLabelsFontSize*2||8),Le.searchParams.set("color2",N.countdownLabelsColor.substring(1)||"#959595"),Le.searchParams.set("spacing",Math.round(N.countdownNumbersFontSize*.4)||5),Le.searchParams.set("locale",N.countdownLanguage.replace("_","-")),Le.searchParams.set("timezone",N.countdownTimeZone),Le.searchParams.set("frames",N.countdownDuration),L({link:JSON.stringify({target:Le.href})}),D(),G(!0)},Pt=(0,n.useCallback)(N=>{yo(N),ko(N),d(B==="email"?r.setElementSettings$1(N):r.setElementSettings(N))},[d,B,yo,ko]),Tr=(0,n.useCallback)((N,Le)=>{const ge=ze.current,_e=r.stripEmVersionFromUrlString(ge.src||"")===r.stripEmVersionFromUrlString(N||"");(!_e||N!==ge.src)&&(g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:ge.type,settings:{src:N}}),Pt({...ge,src:N,...ge.type==="video"?{video:ce()||ge.video}:{},activateSection:null,changeKey:"src"}),l.setFieldValue("src",N)),Le?.mode==="save"&&_e&&(P(Ve=>({name:"src",counter:Ve.counter+1})),E(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(N)}))},[l,ce,Pt,g,E]),At=(0,n.useCallback)(async N=>{const Le=e.src||"",ge=r.stripEmVersionFromUrlString(Le),_e=await h({kind:"img",currentUrl:gt(ge)?"":ge,entryModal:N});_e?.url&&Tr(_e.url,_e.meta)},[Tr,e.src,h]),Rr=(N,...Le)=>{const ge=l.getFieldsValue(!0),_e=Object.keys(N)[0];let Ve;switch(_e){case"link":let qe=et(N[_e]);qe!==N[_e]&&l.setFieldValue("link",qe),Ve={link:qe};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Ve={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"?(Ve={border:{...r.RESET_BORDER_PARAMS,all:{...z.NULL_BORDER,...ge.borderAll}}},l.setFieldsValue({borderLeft:z.NULL_BORDER,borderRight:z.NULL_BORDER,borderTop:z.NULL_BORDER,borderBottom:z.NULL_BORDER})):ge.borderAll?.width||ge.borderAll?.style||ge.borderAll?.color?(Ve={border:{all:null,left:ge.borderAll,right:ge.borderAll,top:ge.borderAll,bottom:ge.borderAll,[z.REVERSE_BORDER_POSITIONS[_e]]:{...ge[_e],...N[_e]}}},l.setFieldsValue({borderAll:null,borderLeft:ge.borderAll,borderRight:ge.borderAll,borderTop:ge.borderAll,borderBottom:ge.borderAll,[_e]:{...ge[_e],...N[_e]}})):(Ve={border:{all:null,left:ge.borderLeft,right:ge.borderRight,top:ge.borderTop,bottom:ge.borderBottom,[z.REVERSE_BORDER_POSITIONS[_e]]:{...ge[_e],...N[_e]}}},l.setFieldsValue({border:Ve.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(ge.mobileBorderPosition==="mobileBorderAll")Ve={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...z.NULL_BORDER,...ge.mobileBorderAll,classNamePrefix:"em-mob-border_"+z.MOBILE_REVERSE_BORDER_POSITIONS[_e]+"-"}}},l.setFieldsValue({borderLeft:z.NULL_BORDER,borderRight:z.NULL_BORDER,borderTop:z.NULL_BORDER,borderBottom:z.NULL_BORDER});else{const oo=z.MOBILE_REVERSE_BORDER_POSITIONS[_e],uo={...ge[_e],...N[_e]},So=!uo?.width&&!uo?.style&&!uo?.color;if(ge.mobileBorder?.all?.width||ge.mobileBorder?.all?.style||ge.mobileBorder?.all?.color){const jo=ge.mobileBorderAll;Ve={mobileBorder:{all:null,left:jo,right:jo,top:jo,bottom:jo,[oo]:So?null:{...uo,classNamePrefix:"em-mob-border_"+oo+"-"}}},l.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:jo,mobileBorderRight:jo,mobileBorderTop:jo,mobileBorderBottom:jo,[_e]:uo})}else{const jo=e.mobileBorder||{},qo=bt=>{const Nt=jo[bt];return Nt&&(Nt?.width||Nt?.style||Nt?.color)?Nt:null};Ve={mobileBorder:{all:null,left:oo==="left"?So?null:{...uo,classNamePrefix:"em-mob-border_left-"}:qo("left"),right:oo==="right"?So?null:{...uo,classNamePrefix:"em-mob-border_right-"}:qo("right"),top:oo==="top"?So?null:{...uo,classNamePrefix:"em-mob-border_top-"}:qo("top"),bottom:oo==="bottom"?So?null:{...uo,classNamePrefix:"em-mob-border_bottom-"}:qo("bottom")}},l.setFieldsValue({[_e]:uo})}}break;case"width":Ve={[_e]:{value:N[_e],dim:ge.widthDim}};break;case"widthDim":Ve={width:{value:ge.width,dim:N[_e]}};break;case"height":Ve={[_e]:{value:N[_e],dim:ge.heightDim}};break;case"heightDim":Ve={height:{value:ge.height,dim:N[_e]}};break;case"borderRadiusAll":Ve={borderRadius:{[z.BORDER_RADIUS_POSITION[_e]]:+N[_e]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Ve={borderRadius:{topLeft:ge.borderRadiusTopLeft,bottomLeft:ge.borderRadiusBottomLeft,topRight:ge.borderRadiusTopRight,bottomRight:ge.borderRadiusBottomRight,[z.BORDER_RADIUS_POSITION[_e]]:+N[_e]}};break;case"mobileWidth":Ve={[_e]:{classNamePrefix:"em-mob-width-",value:N[_e],dim:ge.mobileWidthDim}};break;case"mobileWidthDim":Ve={mobileWidth:{classNamePrefix:"em-mob-width-",value:ge.mobileWidth||100,dim:N[_e]}};break;case"mobileHeight":Ve={[_e]:{classNamePrefix:"em-mob-height-",value:N[_e],dim:ge.mobileHeightDim}};break;case"mobileHeightDim":Ve={mobileHeight:{classNamePrefix:"em-mob-height-",value:ge.mobileHeight,dim:N[_e]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Ve={mobileBorderRadius:{[z.MOBILE_BORDER_RADIUS_POSITION[_e]]:N[_e],classNamePrefix:"em-mob-border_radius_"+z.MOBILE_BORDER_RADIUS_POSITION[_e]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Ve={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":Ve={[_e]:{classNamePrefix:"em-mob-text_align-",value:N[_e]}};break;case"mobileVerticalAlign":Ve={[_e]:{classNamePrefix:"em-mob-vertical_align-",value:N[_e]}};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":Sr(Wm);break;case"video":{const oo={...e.video,...ge.video,...N.video},uo=oo.source??ge.link;Sr(Um),g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"video",settings:{video:oo,link:uo}}),Pt({...e,video:oo,link:uo,activateSection:null,changeKey:"video"});break}case"src":const Ze=N[_e],ho=e.src,bo=ge.video?.playButton||e.video?.playButton;if(e.type==="video"&&bo&&bo!=="none"&&!ue&&Ze&&(!ho||Ze!==ho)){Sr(()=>Hm(Ze));return}Ve=N;break;default:Ve=N}_e!=="borderPosition"&&_e!=="mobileBorderPosition"&&_e.indexOf("countdown")===-1&&_e!=="video"&&(g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ve}),_e!=="video"&&_e.indexOf("countdown")===-1&&_e!=="mobileBorderRadiusAll"&&_e!=="mobileBorderRadiusTopLeft"&&_e!=="mobileBorderRadiusTopRight"&&_e!=="mobileBorderRadiusBottomLeft"&&_e!=="mobileBorderRadiusBottomRight"&&Pt({...e,...Ve,mobileBorderRadius:{...e.mobileBorderRadius,...Ve?.mobileBorderRadius},activateSection:null,changeKey:_e}))};(0,n.useEffect)(()=>{y.isError&&(f.error(y),G(!1))},[y]),(0,n.useEffect)(()=>{if(y.isSuccess&&Ce){if(y.data.data?.status===400)f.error({title:y.data.code,description:y.data.message});else{let N=new URL(y.data.target),Le={countdown:{link:y.data.link,params:N.search.substring(1)}};g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Le})}G(!1)}},[y,Ce,e,f,g]);const zm=N=>{N.data.operation===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(d(r.closeSecondModal()),d(r.closeModal$1()))};r.useListenPostMessage(zm),r.useImageControlRequest(e.src,N=>{N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?At(r.MODALS.UPLOAD_IMAGE_MODAL_AI):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?At(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?At(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?At(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP&&At(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK)});const Gm=()=>{const N=l.getFieldsValue(!0);s.markBorderToggled(!X),setTimeout(()=>{Q(Le=>!Le),X?(N.borderAll=z.NULL_BORDER,N.borderTop=z.NULL_BORDER,N.borderBottom=z.NULL_BORDER,N.borderRight=z.NULL_BORDER,N.borderLeft=z.NULL_BORDER):N.borderAll={width:1,color:"#E5E5E5",style:"solid"},g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:N.borderAll.color,style:N.borderAll.style,width:N.borderAll.width}}}})})},Ym=()=>{const N=l.getFieldsValue(!0);a.markBorderToggled(!Z),setTimeout(()=>{U(Le=>!Le),Z?(N.mobileBorderAll=z.NULL_BORDER,N.mobileBorderTop=z.NULL_BORDER,N.mobileBorderBottom=z.NULL_BORDER,N.mobileBorderRight=z.NULL_BORDER,N.mobileBorderLeft=z.NULL_BORDER):N.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:N.mobileBorderAll.color,style:N.mobileBorderAll.style,width:N.mobileBorderAll.width}}}})})},Xm=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{J(Le=>!Le),V?(N.borderRadiusAll=0,Be(!0)):N.borderRadiusAll=5,g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:N.borderRadiusAll}}})})},Km=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{me(Le=>!Le),de?(N.mobileBorderRadiusAll=null,ne(!0)):N.mobileBorderRadiusAll=5,g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:N.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},qm=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{Ae(Le=>!Le),pe?(N.boxShadowInset=!1,N.boxShadowHOffset=null,N.boxShadowVOffset=null,N.boxShadowBlurRadius=null,N.boxShadowSpreadRadius=null,N.boxShadowColor=""):(N.boxShadowInset=!1,N.boxShadowHOffset=5,N.boxShadowVOffset=5,N.boxShadowBlurRadius=10,N.boxShadowSpreadRadius=-5,N.boxShadowColor="#000000"),g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:N.boxShadowBlurRadius,color:N.boxShadowColor,hOffset:N.boxShadowHOffset,inset:N.boxShadowInset,spreadRadius:N.boxShadowSpreadRadius,vOffset:N.boxShadowVOffset}}})})},Jm=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{$e(Le=>!Le),we?(N.mobileBoxShadowInset=!1,N.mobileBoxShadowHOffset=null,N.mobileBoxShadowVOffset=null,N.mobileBoxShadowBlurRadius=null,N.mobileBoxShadowSpreadRadius=null,N.mobileBoxShadowColor=""):(N.mobileBoxShadowInset=!1,N.mobileBoxShadowHOffset=5,N.mobileBoxShadowVOffset=5,N.mobileBoxShadowBlurRadius=10,N.mobileBoxShadowSpreadRadius=-5,N.mobileBoxShadowColor="#000000"),g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:N.mobileBoxShadowBlurRadius,color:N.mobileBoxShadowColor,hOffset:N.mobileBoxShadowHOffset,inset:N.mobileBoxShadowInset,spreadRadius:N.mobileBoxShadowSpreadRadius,vOffset:N.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Qm=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{le(Le=>!Le),Y&&(N.mobileWidth="",N.mobileHeight="",g({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-"}}}))})},La=()=>{He?(Pe.current=!1,Fe(""),l.setFieldValue("link",""),g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{link:""}})):(Pe.current=!0,Fe(K.current&&K.current.input.value?K.current.input.value:"..."),setTimeout(()=>{K.current.focus()}))},Oa=N=>{N.target.value===""?Fe("..."):(M.current.classList.add("selected-td-form__button--active"),Fe(N.target.value)),Uo(N.target.value,Ne)},$a=()=>{const N=l.getFieldsValue(!0);Se?(ye(""),N.alt="",g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{alt:""}})):(ye($.current&&$.current.input.value?$.current.input.value:"..."),setTimeout(()=>{$.current.focus()}))},Fa=N=>{N.target.value===""?ye("..."):(A.current.classList.add("selected-td-form__button--active"),ye(N.target.value))},Ma=()=>{const N=l.getFieldsValue(!0);re?(q(""),N.title="",g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{title:""}})):(q(W.current&&W.current.input.value?W.current.input.value:"..."),setTimeout(()=>{W.current.focus()}))},Zm=()=>{w(!j),j?(l.setFieldValue("imgReplacer",""),g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:""}})):setTimeout(()=>R.current.focus())},ep=N=>{N.target.value!==""&&te.current.classList.add("selected-td-form__button--active")},Da=N=>{N.target.value===""?q("..."):(se.current.classList.add("selected-td-form__button--active"),q(N.target.value))},op=N=>{l.setFieldValue("link",N!=="mergetag"?N:""),Ne(N)};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_image_form",initialValues:{src:"",width:"",height:"",widthDim:"",heightDim:"",alt:"",align:"left",border:"",boxShadow:"",show:"all",borderPosition:z.BORDER_POSITIONS[Po]||"borderAll",mobileBorderPosition:z.MOBILE_BORDER_POSITIONS[Bo]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileAlign:"left",mobileVerticalAlign:"",link:"https://",imgReplacer:"",countdownNumbersStrong:!1,countdownNumbersItalic:!1,countdownLabelsStrong:!1,countdownLabelsItalic:!1,video:{source:"",playButton:"youtube_red"}},onValuesChange:Rr,autoComplete:"off",disabled:Eo,className:Eo?"element-controls selected-image-form_busy":"element-controls",children:[Eo&&(0,o.jsx)("div",{className:"selected-image-form__loader",ref:xo,children:(0,o.jsxs)("div",{className:"selected-image-form__loader-body",children:[(0,o.jsx)(t.ui_kit$Spin,{size:"large"}),(0,o.jsx)("div",{className:"selected-image-form__loader-title",children:Ue.type==="countdown"?i("Preparing countdown preview…"):i("Preparing video preview…")})]})}),!ee&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),p==="mobile"&&S.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(Mr,{form:l,elementSettings:e,handleChangeValues:Rr,boxShadow:be,mobileBordersShow:Z,mobileBorderRadiusShow:de,mobileBoxShadowShow:we,mobileSizeShow:Y,oneMobileBorderRadiusValue:ke,setOneMobileBorderRadiusValue:ne,hasLink:He,hasAlt:Se,hasTitle:re,linkInputRef:K,linkButtonRef:M,altInputRef:$,altButtonRef:A,titleInputRef:W,titleButtonRef:se,linkInputHandler:Oa,altButtonHandler:$a,altInputHandler:Fa,titleButtonHandler:Ma,titleInputHandler:Da,linkButtonHandler:La,toggleShowMobileBorderHandler:Ym,toggleShowMobileBorderRadiusHandler:Km,toggleShowMobileBoxShadowHandler:Jm,toggleShowMobileSizeHandler:Qm})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Fr,{form:l,elementSettings:e,boxShadow:be,bordersShow:X,borderRadiusShow:V,boxShadowShow:pe,oneBorderRadiusValue:xe,setOneBorderRadiusValue:Be,hasLink:He,hasAlt:Se,hasTitle:re,isOpenSrcReplacer:j,mergeTagItems:fe,mergeMenuOpen:ie,setMergeMenuOpen:Re,cascaderRef:he,linkInputRef:K,linkButtonRef:M,altInputRef:$,altButtonRef:A,titleInputRef:W,titleButtonRef:se,srcReplacerInputRef:R,srcReplacerButtonRef:te,linkProtocol:Te,handleLinkProtocolsChange:op,linkButtonHandler:La,linkInputHandler:Oa,altButtonHandler:$a,altInputHandler:Fa,titleButtonHandler:Ma,titleInputHandler:Da,srcReplacerButtonHandler:Zm,srcInputHandler:ep,handleSelect:Je,onChange:H,filter:ae,renderSearchOption:je,handleChangeValues:Rr,toggleShowBorderHandler:Gm,toggleShowBorderRadiusHandler:Xm,toggleShowBoxShadowHandler:qm})})]})};Ur.propTypes={elementSettings:_.default.object.isRequired};var Wr=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:e("The font-size CSS property sets the size of the font."),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileFontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:e("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})},tt=({form:e,elementSettings:i,imgParent:l=!1,name:s="align",setAlignStateHandle:a=()=>{},withHotKeys:d=!0})=>{const{__:c}=r.useI18n(),m=r.useSendPostMessage(),f=r.useAppConfig(),[g,E]=(0,n.useState)(null);(0,n.useEffect)(()=>{globalThis?.navigator?.userAgent.includes("Macintosh")&&E(!0)},[]);const h=I=>{a(I),e.setFieldsValue({[s]:I}),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[s]:I}})},p=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?g?p:S:void 0,x=i[s],T=typeof x=="string"?x:"";return(0,o.jsx)(t.ui_kit$Form.Item,{name:s,children:(0,o.jsx)(t.ui_kit$FormAlignTextControl,{value:T,onChange:h,disabled:l&&!i.parent,strokeWidth:f?.iconStrokeWidth,labels:k})})},eo=({form:e,elementSettings:i,name:l,icon:s,tooltipTitle:a=null,showTooltip:d=!0,forceInactive:c=!1})=>{const{__:m}=r.useI18n(),f=e.getFieldValue(l),g=r.useSendPostMessage(),[E,h]=(0,n.useState)(i[l]);(0,n.useEffect)(()=>{i[l]!==e.getFieldValue(l)&&(e.setFieldValue(l,i[l]),h(i[l]))},[i,e,l]),(0,n.useEffect)(()=>{E!==f&&h(f)},[f,E,l]);const p=()=>{const S={[l]:!E};e.setFieldValue(l,!E),g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:S}),l==="textSuperscript"?e.setFieldValue("textSubscript",!1):l==="textSubscript"&&e.setFieldValue("textSuperscript",!1),h(k=>!k)};return(0,o.jsx)(t.ui_kit$Form.Item,{name:l,children:d?(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:a||m(l.substring(4)),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":E&&!c}),onClick:p,children:s})}):(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":E&&!c}),onClick:p,children:s})})};eo.propTypes={form:_.default.shape({setFieldsValue:_.default.func.isRequired}).isRequired,elementSettings:_.default.object.isRequired,tooltipTitle:_.default.string,imgParent:_.default.bool};var xn=["email","block"];function kn(e){const i=r.getMessageService(e).getTarget(),l=r.getCanvasService(e);xn.map(s=>l?.peek(s)?.element).find(s=>!!i&&s?.contentWindow===i)?.focus({preventScroll:!0})}var zr=()=>{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")}]},En=(e,i="#c6c3c3",l={},s)=>{const{symbolSize:a="25px",marginRight:d="5px",marginBottom:c="5px",textStyle:m={whiteSpace:"normal",lineHeight:"1.2"}}=l;return e.map(f=>({value:f.code,label:(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,o.jsx)("span",{style:{color:i||"#c6c3c3",marginRight:d,marginBottom:c,fontSize:a,lineHeight:"0.7",width:a,textAlign:"center",...m},children:f.symbol}),(0,o.jsx)("span",{style:m,children:f.description})]})}))},_t=({form:e,fillFields:i,elementSettings:l,showAddParagraph:s=!0,isButton:a=!1,linkProtocol:d,setLinkProtocol:c,linkTarget:m,isBulletFontColorChecked:f=!1,setIsBulletFontColorChecked:g=()=>{},showTopDivider:E=!0})=>{const{__:h}=r.useI18n(),p=z.useGoogleFontsLoader(),{token:S}=(0,t.ui_kit$useToken)(),k=r.useNotification(),x=r.useSendPostMessage(),T=r.useContainer(),I=r.useAppConfig(),L=(0,n.useRef)(),y=(0,n.useRef)(null),C=(0,n.useRef)(null),P=(0,n.useRef)(null),K=(0,n.useRef)(!1),M=l,[$,A]=(0,n.useState)(!!M.textReplacer?.length),[W,se]=(0,n.useState)(!!M.textAnchor?.length),[R,te]=(0,n.useState)(null),[he,be]=(0,n.useState)({start:0,end:0}),[Ie,xe]=(0,n.useState)(!1),[Be,ke]=(0,n.useState)([]),[ne,He]=(0,n.useState)(M.list?.bulletsColor),[Fe,Se]=(0,n.useState)(l);l!==Fe&&(Se(l),He(M.list?.bulletsColor),A(!!M.textReplacer?.length),se(!!M.textAnchor?.length));const[ye,re]=(0,n.useState)(!1),[q,X]=(0,n.useState)(!1),Q=(0,n.useRef)(null),Z=(0,n.useRef)(""),U=zr(),V=(0,n.useMemo)(()=>U,[]),J={textColor:t.ui_kit$Form.useWatch("textColor",e),textLink:t.ui_kit$Form.useWatch("textLink",e),linkHref:t.ui_kit$Form.useWatch("linkHref",e),listUL:t.ui_kit$Form.useWatch("listUL",e),listOL:t.ui_kit$Form.useWatch("listOL",e)};(0,n.useEffect)(()=>{a&&l?.textColor!==void 0&&e.setFieldValue("textColor",l.textColor)},[a,l?.textColor,e]);let de=null;(0,n.useEffect)(()=>{if(J?.textColor&&f){const w=e.getFieldValue("textColor");x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{ColorBullets:w}})}},[J?.textColor]),(0,n.useEffect)(()=>{const w=e.getFieldValue("textLink");typeof l.linkHref=="string"&&re(!0),Q&&!w&&(re(!1),e.setFieldsValue({linkHref:null})),Q.current=w||null},[J?.textLink,J?.linkHref,l.linkHref,e]),(0,n.useEffect)(()=>{const w=e.getFieldValue("listUL"),ue=e.getFieldValue("listOL");w&&Z.current!=="listUL"?(e.setFieldValue("listOL",!1),Z.current="listUL"):ue&&Z.current!=="listOL"&&(e.setFieldValue("listUL",!1),Z.current="listOL"),!w&&!ue&&(Z.current="")},[J?.listUL,J?.listOL,e]);const me=w=>{w.data.operation===r.EVENT_TYPES.APPLICATION_FOCUS_IN_IFRAME&&te(null)};r.useListenPostMessage(me);const[pe,Ae]=(0,n.useState)(null);(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&Ae(!0)},[]);const we=(0,n.useRef)(null);function $e(w){const ue=w.key.toLowerCase();let ve=!1;return((de==="control"||de==="meta")&&(ue==="a"||ue==="A")||(de==="a"||de==="A")&&(ue==="control"||ue==="meta"))&&(ve=!0),de=ue,ue!=="control"&&ue!=="a"&&ue!=="A"&&ue!=="meta"&&(de=null),ve}const Y=w=>{x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:w,locale:"ru_RU"}),k.success({title:h("It`s done!")})},le=[{key:"1",label:h("This element"),onClick:()=>Y("typograf")},{key:"2",label:h("The whole email"),onClick:()=>Y("typograf_all")}],[Ce,G]=(0,n.useState)(),[Te,Ne]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const w=En(V,ne,{});ke(w)},[V,ne]),(0,n.useEffect)(()=>{const w=l.linkHref||l.href;w&&Uo(w,c);const ue=l.linkHref||l.href,ve=ue&&Bi(ue)?ue.slice(1):ue||"https://";(i??((Xe,Ke)=>Xe.setFieldsValue(Ke)))(e,{linkHref:ve})},[e,l,c,i]);const Pe=r.useAppConfig().mergeTags;(0,n.useEffect)(()=>{Pe?.items?.length&&G(r.mapMargeTags(Pe.items))},[Pe,G]);const Me=w=>{e.setFieldValue("linkHref",w!=="mergetag"?w:""),c(w)},Ue=(w,ue)=>{if(Ne(!1),w){const ve=Pe.syntax.length>1?Ce.findIndex(Ke=>Ke.key===ue[0].key):0,Xe=Pe.syntax[ve].replace("%value%",w[w.length-1]);if(R?.getAttribute("id")==="selected_button_form_href"||R?.getAttribute("id")==="selected_text_form_linkHref"||R?.getAttribute("id")==="selected_text_form_textReplacer")Re(Xe,R?.getAttribute("id"));else{e.setFieldValue("textReplacer",Xe);const Ke=Date.now();x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:`${Xe}~~${Ke}`}}),T&&setTimeout(()=>kn(T))}}},ze=(w,ue)=>ue.some(ve=>ve.label.toLowerCase().indexOf(w.toLowerCase())>-1),ce=(w,ue)=>{const ve=ue.map((Xe,Ke)=>{const to=Xe.label.split(new RegExp(`(${w})`,"gi"));return(0,o.jsxs)("span",{children:[Ke!==0&&(0,o.jsx)("span",{children:" / "}),to.map((io,co)=>io.toLowerCase()===w.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:io},co):io)]},Xe.value)});return(0,o.jsx)("div",{title:ue.map(Xe=>Xe.label).join(" / "),children:ve})};(0,n.useEffect)(()=>{Te&&we.current&&we.current.focus()},[Te]);const fe=r.useRootElement();(0,n.useEffect)(()=>{const w=({target:Xe})=>{Xe.closest('[id="merge_tags_wrapper"]')||te(Xe)},ue=({target:Xe})=>{!Xe.closest(".merge-tags")&&!Xe.closest("#merge_tags_button")&&Ne(!1)},ve=new fo.Disposable;return ve.addDisposable(r.addWindowListenerFromShadow(fe,"focusin",w)),ve.addDisposable(r.addWindowListenerFromShadow(fe,"click",ue)),()=>{ve.dispose()}},[fe]);const v=(0,n.useCallback)(()=>{const w=window.getSelection();w&&w.toString().length>0&&(K.current=!0)},[]),ie=(0,n.useCallback)(({target:w})=>{if(w&&!Ie){const{selectionStart:ue,selectionEnd:ve}=w;be(Xe=>Xe?.start===ue&&Xe?.end===ve?Xe:{start:ue,end:ve})}xe(!1)},[Ie]);(0,n.useEffect)(()=>ie({target:m?.target}),[m,ie]);const Re=(w,ue)=>{const ve=document.getElementById(ue);if(ve){const Xe=ve.value?.substring(0,he.start),Ke=ve.value?.substring(he.end),to=ue.substring(ue.lastIndexOf("_")+1);x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{[to]:Xe+w+Ke}}),e.setFieldValue(to,Xe+w+Ke),ve.focus(),setTimeout(()=>{ve.selectionStart=he.start,ve.selectionEnd=he.start+w.length},400),xe(!0)}},Oe=()=>{A(!$),$?(e.setFieldValue("textReplacer",""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:""}})):setTimeout(()=>y.current.focus())},De=w=>{w.target.value!==""&&C.current?.classList.add("selected-td-form__button--active")},Ge=(w="unknown")=>{se(!W),W?(e.setFieldValue("textAnchor",""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textAnchor:""}})):setTimeout(()=>P.current?.focus())},Qe=w=>{const ue=w.target,ve=ue.value,Xe=ue.selectionStart,Ke=$e(w);if(K.current&&Xe===0&&x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:`${ve}~`}}),K.current=Ke,Xe===0&&w.key===" "){w.preventDefault();return}if(w.key===" "){if(Xe!==ve.length){w.preventDefault();return}ve.endsWith(" ")&&w.preventDefault()}},O=w=>{He(w),f&&g(!1)},oe=a?I.formButtonFieldInsertImageEnabled:I.formTextFieldTypografEnabled,j=I.formTextFieldTypografEnabled&&!a;return(0,o.jsxs)(o.Fragment,{children:[s&&!l.showOnMobile&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Row,{gutter:20,style:{paddingBottom:4},children:(0,o.jsx)(t.ui_kit$Col,{span:12,gutter:20,children:(0,o.jsx)(tt,{form:e,elementSettings:l,name:"textAlign"})})})}),oe||j||I.mergeTagsShow&&Ce?(0,o.jsx)(t.ui_kit$FormSection,{title:null,dividerTop:E,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginTop:4},children:[oe&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Col,{span:j?12:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"AddImage",style:{marginBottom:S.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"AddImage",component:t.icons$AddImage}),onClick:()=>Y("add_img"),style:{width:"100%"},children:h("Add image")})})})}),j&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"Typography",style:{marginBottom:S.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,menu:{items:le},trigger:["hover"],placement:"bottom",getPopupContainer:w=>w.closest(".selected-element-panel"),children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Typograf",component:t.icons$Typograf}),onClick:()=>Y("typograf"),style:{width:"100%"},children:h("Typography")})})})})}),I.mergeTagsShow&&Ce&&(0,o.jsxs)(t.ui_kit$Col,{span:24,id:"merge_tags_wrapper",style:{marginBottom:S.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Button,{id:"merge_tags_button",icon:(0,o.jsx)(r.EmIcons,{icon:"MergeTags",component:t.icons$MergeTags}),style:{width:"100%",display:Te?"none":"inline-flex"},onClick:()=>Ne(!0),children:h("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:we,classNames:{popup:{root:"merge-tags"}},options:Ce,placeholder:h("Start typing the title"),showSearch:{filter:ze,render:ce},spellCheck:"false",getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper"),onChange:Ue,style:{display:Te?"block":"none",width:"100%"},open:Te,onKeyDown:w=>{w.key==="Escape"&&Ne(!1)}})]})]})}):null,(0,o.jsxs)(t.ui_kit$FormSection,{title:null,dividerTop:E||oe||j,bodyStyle:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Text font"),placement:"bottom",zIndex:1,getPopupContainer:w=>w.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:p,getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper")})})}),!l.showOnMobile&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:h("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:h("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{marginBottom:10,marginTop:5},children:(0,o.jsxs)(t.ui_kit$Col,{span:24,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:-10},children:[a&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsxs)("div",{className:"selected-text-common-form__format-toolbar",children:[(0,o.jsx)(eo,{form:e,elementSettings:l,name:"textStrong",tooltipTitle:h(pe?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})}),(0,o.jsx)(eo,{form:e,elementSettings:l,name:"textItalic",tooltipTitle:h(pe?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})}),(0,o.jsx)(eo,{form:e,elementSettings:l,name:"textUnderline",tooltipTitle:h(pe?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})}),(0,o.jsx)(eo,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:h(pe?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Text color"),placement:"bottom",zIndex:1,getPopupContainer:w=>w.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:h("Please set the font color")}],className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:h("Color"),usedColors:l.usedColors})})})})]}),!a&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(eo,{form:e,elementSettings:l,name:"textStrong",tooltipTitle:h(pe?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(eo,{form:e,elementSettings:l,name:"textItalic",tooltipTitle:h(pe?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(eo,{form:e,elementSettings:l,name:"textUnderline",tooltipTitle:h(pe?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})}),l?.list?.isList&&(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(eo,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:h(pe?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]}),!l?.list?.isList&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(eo,{form:e,elementSettings:l,name:"listUL",tooltipTitle:h("Unordered list"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnorderedListOutlined",component:t.icons$UnorderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:ie})}),!l?.list?.isList&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(eo,{form:e,elementSettings:l,name:"listOL",tooltipTitle:h("Ordered list"),icon:(0,o.jsx)(r.EmIcons,{icon:"OrderedListOutlined",component:t.icons$OrderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:ie})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(eo,{form:e,elementSettings:l,name:"textSuperscript",tooltipTitle:h("Text superscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Superscript",component:t.icons$Superscript})})}),l?.list?.isList&&(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(eo,{form:e,elementSettings:l,name:"textSubscript",tooltipTitle:h("Text subscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Subscript",component:t.icons$Subscript})})]}),s&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(eo,{form:e,className:(0,We.default)("selected-text-common-form__button selected-text-common-form__button_style",{"selected-text-common-form__button--active":typeof l.linkHref=="string"}),elementSettings:l,name:"textLink",forceInactive:!!l.textAnchor,tooltipTitle:h("Link"),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"}),onSelect:ie})}),l?.list?.isList&&I.formTextFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:h("Text replacer"),placement:"bottom",getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":$}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:Oe,ref:C})})}),(!l?.list?.isList||s&&l?.list?.isList)&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:h("More options"),placement:"bottom",getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":q||W}),icon:(0,o.jsx)(r.EmIcons,{icon:"DotsHoriz",component:t.icons$DotsHoriz,className:"selected-td-form__icon-radius"}),onClick:()=>X(!q)})})})]})]}),!a&&q&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[!l?.list?.isList&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(eo,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:h(pe?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]}),(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(eo,{form:e,elementSettings:l,name:"textSubscript",tooltipTitle:h("Text subscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Subscript",component:t.icons$Subscript})})]}),I.formTextFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:h("Text replacer"),placement:"bottom",getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":$}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:Oe,ref:C})})})]}),s&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:h("Anchor"),placement:"bottom",getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":W}),icon:(0,o.jsx)(r.EmIcons,{icon:"Anchor",component:t.icons$Anchor,className:"selected-text-common-form__icon-radius"}),onMouseDown:w=>{w.preventDefault(),Ge("mouseDown")}})})})]}),s&&typeof l.linkHref=="string"&&ye&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Zo,{show:d==="#",__:h,style:{marginBottom:S.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h(d==="#"?"Anchor name":"The URL that the hyperlink directs to."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkHref",style:{marginBottom:d==="mailto:"?S.formItemMarginBottomXS:""},children:(0,o.jsx)(t.ui_kit$Input,{ref:L,addonBefore:(0,o.jsx)(Qo,{linkProtocol:d,handleLinkProtocolsChange:Me,__:h}),allowClear:!0,placeholder:h(d==="#"?"Anchor name":"Hyperlink URL"),autoFocus:l?.isNewLink,onSelect:ie,prefix:(0,o.jsx)(Jo,{linkProtocol:d})})})}),d==="mailto:"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"subject",style:{marginBottom:S.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:h("Subject"),onSelect:ie})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:S.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:h("Body"),onSelect:ie})})]})]}),s&&W&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Anchor name"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textAnchor",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:h("Anchor name"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content addon-text-content--icon",title:h("Anchor"),"aria-hidden":!0,children:(0,o.jsx)(r.EmIcons,{icon:"Anchor",component:t.icons$Anchor,className:"selected-text-common-form__icon-radius",size:18})}),ref:P,onSelect:ie,onBlur:()=>{e.getFieldValue("textAnchor")?.trim()||se(!1)}})})}),!a&&$&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textReplacer",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:h("The code that will replace this text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:h("Text")}),onChange:De,onKeyDown:Qe,onDoubleClick:v,ref:y,onSelect:ie})})})]})}),!a&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Text color"),placement:"bottom",zIndex:1,getPopupContainer:w=>w.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:h("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:h("Color"),usedColors:l.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Text background"),placement:"bottom",zIndex:1,getPopupContainer:w=>w.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:h("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:h("Background color"),usedColors:l.usedColors})})})})]})]}),!a&&l?.list?.isList&&(0,o.jsxs)(t.ui_kit$FormSection,{title:h("List settings"),dividerTop:!0,children:[l?.list?.listType==="OL"&&(0,o.jsx)(t.ui_kit$Row,{children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Bullets font"),placement:"bottom",zIndex:1,getPopupContainer:w=>w.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"BulletsFontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:p,getPopupContainer:w=>w.closest(".email-pane__collapse-wrapper"),style:{marginTop:"-9px"}})})})})}),(0,o.jsx)(t.ui_kit$Row,{gutter:[10],children:l?.list?.listType==="UL"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Bullets type"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"BulletType",className:"bullet-type",children:(0,o.jsx)(t.ui_kit$Select,{size:"medium",placeholder:h("Bullets type"),onClick:w=>w.stopPropagation(),options:Be})})})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:[10],children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Bullets color"),placement:"bottom",zIndex:1,getPopupContainer:w=>w.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"ColorBullets",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:h("Bullets color"),usedColors:l.usedColors,disabled:f,onChange:O,externalValue:f?J?.textColor:void 0})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Bullets size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"BulletsSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,defaultValue:l?.list?.bulletFontSize,placeholder:h("Bullets size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})})]}),l?.list?.listType==="OL"&&(0,o.jsxs)(t.ui_kit$Row,{children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(eo,{form:e,elementSettings:l,name:"BulletTextStrong",tooltipTitle:h(pe?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(eo,{form:e,elementSettings:l,name:"BulletTextItalic",tooltipTitle:h(pe?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(eo,{form:e,elementSettings:l,name:"BulletTextStrikethrough",tooltipTitle:h(pe?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(eo,{form:e,elementSettings:l,name:"BulletTextUnderline",tooltipTitle:h(pe?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:[10],style:{marginTop:"-8px"},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Between list items"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"SpacingBetweenParagraphs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:5,max:100,placeholder:h("Between list items"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Between bullets and text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"SpacingBetweenBulletsAndText",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:1,max:100,placeholder:h("Between bullets and text"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px"})})})})]})]})]})},yi=({form:e,elementSettings:i,showAddParagraph:l=!0,isButton:s=!1})=>{const{__:a}=r.useI18n(),d=z.useGoogleFontsLoader(),c=r.useSendPostMessage(),m=r.useDispatch(),f=r.useElementEntityKind(),g=r.useAppConfig(),[E,h]=(0,n.useState)(null);(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&h(!0)},[]);const p=L=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:L,locale:"ru_RU"})},[S,k]=(0,n.useState)(i.textAlign),[x,T]=(0,n.useState)(i.linkHref),I=L=>k(L);return(0,n.useEffect)(()=>{k(i.textAlign),T(i.linkHref)},[i]),(0,o.jsx)("div",{className:"selected_text_common_form_mobile",children:(0,o.jsxs)(t.ui_kit$Space,{size:"8",separator:(0,o.jsx)(t.ui_kit$Divider,{orientation:"vertical"}),children:[(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,o.jsx)("div",{style:{width:190},children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Text font"),placement:"bottom",zIndex:1,getPopupContainer:L=>L.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:d,getPopupContainer:L=>L.closest(".selected_text_common_form_mobile")})})})}),(0,o.jsx)("div",{style:{width:90},children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:a("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)("div",{style:{width:90},children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:a("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,o.jsx)(eo,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:a(E?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-td-form__icon-radius"})}),(0,o.jsx)(eo,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:a(E?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})}),(0,o.jsx)(eo,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:a(E?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-td-form__icon-radius"})}),(0,o.jsx)(eo,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:a(E?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-td-form__icon-radius"})})]}),(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Text color"),placement:"bottom",zIndex:1,getPopupContainer:L=>L.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:a("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:a("Color"),usedColors:i.usedColors,getPopupContainer:L=>L.closest(".selected_text_common_form_mobile")})})}),!s&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Text background"),placement:"bottom",zIndex:1,getPopupContainer:L=>L.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:a("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:a("Background color"),usedColors:i.usedColors})})})})]}),l&&(0,o.jsx)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:(0,o.jsxs)(o.Fragment,{children:[typeof x=="string"?(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,popupRender:()=>(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("The URL that the hyperlink directs to."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkHref",children:(0,o.jsx)(t.ui_kit$Input,{allowClear:!0,placeholder:a("Hyperlink URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined}),autoFocus:i?.isNewLink})})}),classNames:{root:"codemode-textalign-dropdown"},styles:{root:{left:520,top:52,transform:"translateX(0)",marginLeft:57}},trigger:["hover"],placement:"bottom",getPopupContainer:L=>L.closest(".selected_text_common_form_mobile"),children:(0,o.jsx)("div",{children:(0,o.jsx)(eo,{form:e,className:"selected-td-form__button selected-td-form__button_style selected-td-form__button--active",elementSettings:i,name:"textLink",icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),showTooltip:!1})})}):(0,o.jsx)(eo,{form:e,className:"selected-td-form__button selected-td-form__button_style",elementSettings:i,name:"textLink",tooltipTitle:a("Link"),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"})}),(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,popupRender:()=>(0,o.jsx)(tt,{form:e,elementSettings:i,name:"textAlign",setAlignStateHandle:I}),classNames:{root:"codemode-textalign-dropdown"},styles:{root:{left:615,top:52,transform:"translateX(0)",marginLeft:57}},trigger:["hover"],placement:"bottom",getPopupContainer:L=>L.closest(".selected_text_common_form_mobile"),children:(0,o.jsx)(t.ui_kit$Button,{icon:S==="right"?(0,o.jsx)(r.EmIcons,{icon:"AlignRightOutlined",component:t.icons$AlignRightOutlined,size:18,strokeWidth:g.iconStrokeWidth}):S==="center"?(0,o.jsx)(r.EmIcons,{icon:"AlignCenterOutlined",component:t.icons$AlignCenterOutlined,size:18,strokeWidth:g.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"AlignLeftOutlined",component:t.icons$AlignLeftOutlined,size:18,strokeWidth:g.iconStrokeWidth}),className:"selected-td-form__button"})})]})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[l&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Add paragraph"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Paragraph",component:t.icons$Paragraph}),onClick:()=>p("add_p"),className:"selected-td-form__button"})}),(!s||g.formButtonFieldInsertImageEnabled)&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:a("Add inline image"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"ImageAdd",component:t.icons$ImageAdd,size:16,strokeWidth:g.iconStrokeWidth}),onClick:()=>p("add_img"),className:"selected-td-form__button"})})}),!s&&(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Typograf",component:t.icons$Typograf}),className:"selected-td-form__button"}),(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"CloseOutlined",component:t.icons$CloseOutlined}),type:"icon",style:{marginLeft:26},onClick:()=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),m(r.resetToLastActiveSettingsTab()),setTimeout(()=>{m(f==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300)}})]})]})})},Mt=({elementSettings:e,imgParent:i=!1,name:l="mobileAlign"})=>{const{__:s}=r.useI18n(),a=r.useAppConfig();return(0,o.jsx)(t.ui_kit$Form.Item,{name:l,children:(0,o.jsx)(t.ui_kit$FormAlignTextControl,{disabled:i&&!e.parent,strokeWidth:a?.iconStrokeWidth,labels:{alignLeft:s("Text align left"),alignCenter:s("Text align center"),alignRight:s("Text align right"),alignJustify:s("Text align justify")}})})};Mt.propTypes={elementSettings:_.default.object.isRequired,imgParent:_.default.bool,name:_.default.string};var Bn=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useDispatch(),s=r.useSendPostMessage(),[a]=t.ui_kit$Form.useForm(),d=r.useSelector(r.selectEmailViewType),c=r.useSelector(r.selectMobileViewActive),m=r.useSelector(r.selectIsCodeMode),f=r.useSelector(r.selectCodeModeDirection),g=m&&f!=="bottom",[E,h]=(0,n.useState)("https://"),[p,S]=(0,n.useState)(!1),k=zr(),x=(0,n.useMemo)(()=>k,[]),T=r.useElementEntityKind(),{remember:I,fillFields:L}=st(e),y=(0,n.useCallback)(P=>{I(P),l(T==="email"?r.setElementSettings$1(P):r.setElementSettings(P))},[l,T,I]);(0,n.useEffect)(()=>{if(e){const{subject:P,body:K,baseEmail:M}=Lr(e.linkHref),$=e.linkHref,A=typeof $=="string"&&Bi($),W=typeof $=="string"&&$.startsWith("mailto:")?M:A?$.slice(1):typeof $=="string"?$:"https://";h(Ft($||"","https://")),L(a,{...e,lineHeight:u(e.lineHeight),linkHref:W,subject:P,body:K,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:Or(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:p,BulletsFontFamily:e?.list?.bulletFontFamily,BulletTextUnderline:e?.list?.bulletFontUnderline,BulletTextStrikethrough:e?.list?.bulletFontStrikethrough,BulletType:x.find(se=>se.symbol===e?.list?.bulletType)?.code??x[0].code,textSuperscript:e?.textSuperscript,textSubscript:e?.textSubscript,listOL:e?.standardList?.listTypeOL,listUL:e?.standardList?.listTypeUL})}},[a,e]);const C=P=>{const K=a.getFieldsValue(!0),M=Object.keys(P)[0];let $;switch(M){case"mobileFontSize":$={[M]:{classNamePrefix:"em-mob-font_size-",value:P[M],dim:K.mobileFontSizeDim}};break;case"mobileLineHeight":$={[M]:{classNamePrefix:"em-mob-line_height-",value:P[M],dim:K.mobileLineHeightDim}};break;case"mobileTextAlign":$={[M]:{classNamePrefix:"em-mob-text_align-",value:P[M]}};break;case"linkHref":let A=et(P[M]);if(A!==P[M]&&a.setFieldValue("linkHref",A),E==="#"&&A&&!A.startsWith("#")&&(A="#"+A),A.startsWith("mailto:")){const se=a.getFieldValue("subject"),R=a.getFieldValue("body");$={[M]:Si(A,se,R)}}else $={[M]:A};Uo(A,h);break;case"subject":case"body":const W=a.getFieldValue("linkHref")||"";if(W.substring(0,7)==="mailto:"){const se=W.split("?")[0],R=M==="subject"?P[M]:a.getFieldValue("subject"),te=M==="body"?P[M]:a.getFieldValue("body"),he=[];R&&he.push(`subject=${encodeURIComponent(R)}`),te&&he.push(`body=${encodeURIComponent(te)}`),$={linkHref:he.length>0?`${se}?${he.join("&")}`:se}}else return;break;default:$=P}s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:$}),y({...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:x.find(A=>A.code===a.getFieldValue("BulletType"))?.symbol??x[0].symbol},...$,activateSection:null,changeKey:M})};return(0,o.jsxs)(t.ui_kit$Form,{form:a,layout:"vertical",name:"selected_text_form",autoComplete:"off",onValuesChange:C,className:"element-controls",initialValues:{textAlign:"left",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1,textColor:"",textBackgroundColor:"",textLink:!1,textReplacer:"",textAnchor:"",subject:"",body:"",SpacingBetweenBulletsAndText:0,SpacingBetweenParagraphs:0,BulletsSize:0,ColorBullets:"",BulletTextStrong:!1,BulletTextItalic:!1,CheckboxColor:!1,BulletsFontFamily:"",BulletTextUnderline:!1,BulletTextStrikethrough:!1,BulletType:"",textSuperscript:!1,textSubscript:!1,listOL:!1,listUL:!1},children:[!g&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),!(d==="mobile"&&!g&&c.styles)&&(0,o.jsx)("div",{id:"selected_element_form_desktop_props",style:{paddingRight:0},children:g?(0,o.jsx)(yi,{form:a,elementSettings:e}):(0,o.jsx)(_t,{form:a,fillFields:L,elementSettings:e,linkProtocol:E,setLinkProtocol:h,isBulletFontColorChecked:p,setIsBulletFontColorChecked:S})}),!g&&(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:d==="mobile"&&c.styles?"block":"none"},children:[(0,o.jsx)(t.ui_kit$Row,{gutter:20,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Mt,{form:a,elementSettings:e,name:"mobileTextAlign"})})}),!!e.showOnMobile&&(0,o.jsx)(_t,{form:a,fillFields:L,elementSettings:e,linkProtocol:E,setLinkProtocol:h}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Wr,{})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileLineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})]})]})]})},wi=(e,i)=>{const{__:l}=r.useI18n();return(0,o.jsx)(t.ui_kit$Tooltip,{title:l("During export, the element is converted into an image."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"exportAsPicture",valuePropName:"checked",className:"form-item-margin-xs",style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$Switch,{id:"convert-in-image",label:l("Convert into an image"),size:"small",labelStyle:{position:"relative",top:2}})})},"exportAsPicture")},Gr={marginBottom:10},Yr={position:"relative",top:2};function Sn(e){return Array.isArray(e)?!!e[0]?.value:typeof e=="string"?e.trim()!=="":!!e}var it=({form:e,showRounding:i=!1,showBackground:l=!1})=>{const{__:s}=r.useI18n(),a=Sn(t.ui_kit$Form.useWatch("backgroundImage",e));return(0,o.jsxs)(o.Fragment,{children:[i&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Adds bulletproof VML markup so the button keeps rounded corners in Outlook."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"outlookRounding",valuePropName:"checked",className:"form-item-margin-xs",style:Gr,children:(0,o.jsx)(t.ui_kit$Switch,{id:"outlook-rounding",label:s("Rounded corners in Outlook (VML)"),size:"small",labelStyle:Yr})})},"outlookRounding"),l&&a&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Adds VML markup so the background image is visible in Outlook."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"outlookBackground",valuePropName:"checked",className:"form-item-margin-xs",style:Gr,children:(0,o.jsx)(t.ui_kit$Switch,{id:"outlook-background",label:s("Background image in Outlook (VML)"),size:"small",labelStyle:Yr})})},"outlookBackground")]})};it.propTypes={form:_.default.object,showRounding:_.default.bool,showBackground:_.default.bool};var Xr=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:a,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:m,backgroundRepeatOptions:f,backgroundSizeOptions:g,sizeShow:E,modificationShow:h,oneBorderRadiusValue:p,setOneBorderRadiusValue:S,toggleShowBorderHandler:k,toggleShowBorderRadiusHandler:x,toggleShowBoxShadowHandler:T,toggleShowSizeHandler:I,toggleShowBackgroundHandler:L,toggleShowModificationHandler:y})=>{const{__:C}=r.useI18n(),P=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(Ho,{form:e,elementSettings:i,tooltipTitle:C("The align attribute sets the horizontal alignment of the table.")})}),(0,o.jsx)(t.ui_kit$FormSection,{title:C("Size"),collapsible:!0,open:E,onToggle:I,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{showHeight:!1,showMinMax:!0,columnsPerRow:2,dimensionSelect:$o,minWidthDimensionSelect:$o,maxWidthDimensionSelect:$o,rowStyle:{marginBottom:4},labels:{width:C("Width"),height:C("Height"),minWidth:C("Minimum width"),maxWidth:C("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:C("Background"),collapsible:!0,open:c,onToggle:L,dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{imageEnabled:P.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:m,usedColors:i.usedColors,colorPlaceholder:C("Background color"),horizontalPositionPlaceholder:C("Horizontal position"),horizontalPositionTooltip:C("Horizontal position"),verticalPositionPlaceholder:C("Vertical position"),verticalPositionTooltip:C("Vertical position"),backgroundRepeatTooltip:C("Background image repeat"),backgroundSizeTooltip:C("Background image size"),selectPlaceholder:C("Please choose"),backgroundRepeatOptions:f,backgroundSizeOptions:g,imageUploadSlot:P.formTableFieldBackgroundImageEnabled?(0,o.jsx)(No,{form:e,label:C("Background image"),name:"backgroundImage",tooltipTitle:C("Background image"),placeholder:C("Background image link/route")}):void 0}),(0,o.jsx)(it,{form:e,showBackground:!0})]}),P.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("Borders"),collapsible:!0,open:s,onToggle:k,dividerTop:!0,children:(0,o.jsx)(z.SelectedElementFormBorder,{form:e,elementSettings:i})}),P.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("Border radius"),collapsible:!0,open:a,onToggle:x,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:p,setOneBorderRadiusValue:S,elementSettings:i})}),P.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("Box shadow"),collapsible:!0,open:d,onToggle:T,dividerTop:!0,children:(0,o.jsx)(vo,{})}),P.formFieldExportAsPictureEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("Export settings"),collapsible:!0,open:h,onToggle:y,dividerTop:!0,children:(0,o.jsx)(wi,{form:e,elementSettings:i})}),P.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e})}),P.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:C("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Co,{})})]})};Xr.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 Kr=({form:e,elementSettings:i,label:l})=>{const{__:s}=r.useI18n();(0,n.useRef)();const[a,d]=(0,n.useState)(i.mobileBackgroundColor?.value==="none"),{token:c}=(0,t.ui_kit$useToken)(),m=r.useSendPostMessage(),f=E=>{e.setFieldsValue({mobileBackgroundColor:""}),d(h=>!h),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:a?"":"none"}}})},g=E=>{d(!1)};return(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)(t.ui_kit$Tooltip,{trigger:["hover"],title:s("Background color"),placement:"left",children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundColor",style:{marginBottom:c.formItemMarginBottomXS/2},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{onChange:g,placeholder:l,usedColors:i.usedColors})}),(0,o.jsx)(t.ui_kit$Switch,{id:"without-background-color",label:s("Without background color"),labelSize:"small",size:"small",checked:a,onChange:f})]})})};Kr.propTypes={form:_.default.shape({setFieldsValue:_.default.func.isRequired}).isRequired,elementSettings:_.default.object.isRequired};var Dt={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"}]},ji={mobileBackgroundColor:"em-mob-background_color-",mobileBackgroundImage:"em-mob-background_image-",mobileBackgroundPositionX:"em-mob-background_position_x-",mobileBackgroundPositionY:"em-mob-background_position_y-",mobileBackgroundRepeat:"em-mob-background_repeat-",mobileBackgroundSize:"em-mob-background_size-"},at="none",Tn=/^(https?:)?\/\//i,Rn=/^(\d*\.?\d+)(%|px)$/;function yn(e){return e in ji}function qr(e){return Tn.test(e.trim())}function vi(e,i){const l=ji[e],s=typeof i=="string"?i:"";return e==="mobileBackgroundImage"?s&&s!==at&&!qr(s)?null:{[e]:[{classNamePrefix:l,value:s,type:"url"}]}:e==="mobileBackgroundRepeat"?{[e]:{classNamePrefix:l,value:s||at}}:{[e]:{classNamePrefix:l,value:s}}}function xt(e){const[i]=Object.keys(e??{});return!i||!yn(i)?null:vi(i,e[i])}function wn(){return Object.keys(ji).reduce((e,i)=>({...e,...vi(i,"")}),{})}function Jr(e){const i=(e??"").trim(),l=i.match(Rn);return l?{position:l[1],unit:l[2]}:{position:i,unit:"px"}}function Qr(e,i){return e?isNaN(parseFloat(e))?e:e+i:""}function zo(e){const i=e??{},l=i.customTable??i;return{type:i.type,usedColors:i.usedColors,mobileBackgroundColor:l.mobileBackgroundColor,mobileBackgroundImage:l.mobileBackgroundImage,mobileBackgroundPositionX:l.mobileBackgroundPositionX,mobileBackgroundPositionY:l.mobileBackgroundPositionY,mobileBackgroundRepeat:l.mobileBackgroundRepeat,mobileBackgroundSize:l.mobileBackgroundSize}}function kt(e){const i=e??{},l=i.customTable??i,s=l.backgroundSize??"";return{image:l.backgroundImage?.[0]?.value??"",positionX:l.backgroundPositionX??"",positionY:l.backgroundPositionY??"",repeat:l.backgroundRepeat??"",size:s==="auto"?"":s}}function nt(e){const i=zo(e),l=i.mobileBackgroundImage?.[0]?.value??"";return{mobileBackgroundImage:l===at?"":l,mobileBackgroundPositionX:i.mobileBackgroundPositionX?.value??"",mobileBackgroundPositionY:i.mobileBackgroundPositionY?.value??"",mobileBackgroundRepeat:i.mobileBackgroundRepeat?.value||at,mobileBackgroundSize:i.mobileBackgroundSize?.value??""}}function Et(e){const i=zo(e),l=i.mobileBackgroundRepeat?.value;return!!i.mobileBackgroundColor?.value||!!i.mobileBackgroundImage?.[0]?.value||!!i.mobileBackgroundPositionX?.value||!!i.mobileBackgroundPositionY?.value||!!l&&l!==at||!!i.mobileBackgroundSize?.value}function jn(e,i){return e===at?!1:!!e||!!i}function Bt(e,i,l){e.setFieldsValue({...nt({}),mobileBackgroundColor:""}),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:zo(i).type,settings:wn()})}var vn=/^\d*\.?\d+$/,In={bottom:"auto"},Zr={marginBottom:0},Cn=(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal}),Pn=(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical}),An=e=>e.closest(".email-pane__collapse-wrapper")??e.parentNode,el=({value:e,onChange:i,inheritedValue:l,options:s,placeholder:a,prefix:d})=>{const c=e||l,[m,f]=(0,n.useState)(()=>Jr(c));(0,n.useEffect)(()=>{f(p=>Qr(p.position,p.unit)===c?p:Jr(c))},[c]);const g=(0,n.useCallback)((p,S)=>{f({position:p,unit:S});const k=s.some(x=>x.value===p);(p===""||k||vn.test(p))&&i?.(Qr(p,S))},[i,s]),E=(0,n.useCallback)(p=>g(p,m.unit),[g,m.unit]),h=(0,n.useCallback)(p=>g(m.position,p),[g,m.position]);return(0,o.jsx)(t.ui_kit$InputSelect,{options:s,position:m.position,setPosition:E,unit:m.unit,setUnit:h,placeholder:a,prefix:d,dropdownStyle:In,tooltipTitle:a,getTooltipPopupContainer:An})},Nn=({desktopPositionX:e,desktopPositionY:i})=>{const{__:l}=r.useI18n(),{token:s}=(0,t.ui_kit$useToken)(),a=s.formItemMarginBottomXS,d=(0,n.useMemo)(()=>({marginBottom:a}),[a]);return(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:d,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundPositionX",style:Zr,children:(0,o.jsx)(el,{inheritedValue:e,options:Dt.horizontal,placeholder:l("Horizontal position"),prefix:Cn})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundPositionY",style:Zr,children:(0,o.jsx)(el,{inheritedValue:i,options:Dt.vertical,placeholder:l("Vertical position"),prefix:Pn})})})]})},ol=["hover"],tl=e=>document.querySelector(".email-properties__collapse-panel")??e.parentNode,il=({value:e,emptyValue:i,inheritedValue:l,...s})=>{const a=!!e&&e!==i,d=s.options.some(c=>c.value===l)?l:i;return(0,o.jsx)(t.ui_kit$Select,{...s,value:a?e:d})},Ln=({desktopPositionX:e,desktopPositionY:i,desktopRepeat:l,desktopSize:s,backgroundRepeatOptions:a,backgroundSizeOptions:d})=>{const{__:c}=r.useI18n(),{token:m}=(0,t.ui_kit$useToken)(),f=m.formItemMarginBottomXS,g=(0,n.useMemo)(()=>({marginBottom:f}),[f]),E=(0,n.useMemo)(()=>({marginBottom:(f??0)*1.5}),[f]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Nn,{desktopPositionX:e,desktopPositionY:i}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:E,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:ol,title:c("Background image repeat"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundRepeat",style:g,children:(0,o.jsx)(il,{emptyValue:"none",inheritedValue:l,options:a,placeholder:c("Please choose"),getPopupContainer:tl})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:ol,title:c("Background image size"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundSize",style:g,children:(0,o.jsx)(il,{emptyValue:"",inheritedValue:s,options:d,placeholder:c("Please choose"),getPopupContainer:tl})})})})]})]})},On=ci,$n=({value:e,inheritedImage:i,...l})=>(0,o.jsx)(On,{...l,value:e||i}),Fn=e=>/^https?:\/\//i.test(e.trim()),Mn=({form:e,name:i="mobileBackgroundImage",placeholder:l="",disabled:s=!1,elementSettings:a,inheritedImage:d="",isImageNone:c=!1,onImageNoneChange:m})=>{const{__:f}=r.useI18n(),{token:g}=(0,t.ui_kit$useToken)(),E=t.ui_kit$Form.useWatch(i,e),[h,p]=(0,n.useState)(""),S=E||d,k=g.formItemMarginBottomXS??0,x=(0,n.useMemo)(()=>({marginBottom:k/2}),[k]);(0,n.useEffect)(()=>{if(!S){p("");return}p(Fn(S)?"validating":"success")},[S]);const T=!!E&&!qr(E),I=T?"error":h;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:i,className:"mobile-background-image-field",validateStatus:I,help:T?f("Enter a URL starting with http:// or https://"):void 0,style:x,children:(0,o.jsx)($n,{inheritedImage:d,validateStatus:I,placeholder:l,name:i,disabled:s,elementSettings:a,imageInfo:a,onRemotePreviewValidate:p})}),(0,o.jsx)(t.ui_kit$Switch,{label:f("Without image"),labelSize:"small",size:"small",checked:c,onChange:m})]})},Dn={image:"",positionX:"",positionY:"",repeat:"",size:""},St=({elementSettings:e,imageEnabled:i=!1,desktopBackground:l=Dn})=>{const{__:s}=r.useI18n(),{token:a}=(0,t.ui_kit$useToken)(),d=t.ui_kit$Form.useFormInstance(),c=a.formItemMarginBottomMD,m=r.useSendPostMessage(),f=e.mobileBackgroundImage?.[0]?.value,[g,E]=(0,n.useState)(f==="none"),h=t.ui_kit$Form.useWatch("mobileBackgroundImage",d);(0,n.useEffect)(()=>{E(f==="none")},[f]),(0,n.useEffect)(()=>{h&&E(!1)},[h]);const p=(0,n.useCallback)(C=>{E(C),d.setFieldsValue({mobileBackgroundImage:""}),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:vi("mobileBackgroundImage",C?"none":"")})},[e.type,d,m]),S=(0,n.useMemo)(()=>[{label:s("Not defined"),value:"none"},{label:s("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:s("Repeat background (repeat)"),value:"repeat"},{label:s("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:s("Repeat background vertically (repeat-y)"),value:"repeat-y"}],[s]),k=(0,n.useMemo)(()=>[{label:s("Not defined"),value:""},{label:s("Contain"),value:"contain"},{label:s("Cover"),value:"cover"}],[s]),x=jn(g?"none":h,l.image),T=(0,n.useMemo)(()=>({marginBottom:x?c:0}),[c,x]),I=(0,n.useMemo)(()=>(0,o.jsx)("div",{style:T,children:(0,o.jsx)(Kr,{form:d,elementSettings:e,label:s("Background color")})}),[s,e,d,T]),L=(0,n.useMemo)(()=>(0,o.jsx)("div",{style:T,children:(0,o.jsx)(Mn,{form:d,placeholder:s("Background image"),elementSettings:e,inheritedImage:g?"":l.image,isImageNone:g,onImageNoneChange:p})}),[s,l.image,e,d,p,g,T]),y=(0,n.useMemo)(()=>(0,o.jsx)(Ln,{desktopPositionX:l.positionX,desktopPositionY:l.positionY,desktopRepeat:l.repeat,desktopSize:l.size,backgroundRepeatOptions:S,backgroundSizeOptions:k}),[S,k,l.positionX,l.positionY,l.repeat,l.size]);return(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{colorFieldName:"mobileBackgroundColor",colorSlot:I,imageEnabled:i,backgroundImageEmpty:!x,imageUploadSlot:L,imageControlsSlot:y,usedColors:e.usedColors})},rl=({form:e,elementSettings:i,mobileBoxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:a,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:m,oneMobileBorderRadiusValue:f,setOneMobileBorderRadiusValue:g,toggleShowMobileBorderHandler:E,toggleShowMobileBorderRadiusHandler:h,toggleShowMobileBoxShadowHandler:p,toggleShowMobileSizeHandler:S,toggleShowMobileBackgroundHandler:k})=>{const{__:x}=r.useI18n(),{token:T}=(0,t.ui_kit$useToken)(),I=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(Ho,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,o.jsx)(t.ui_kit$FormSection,{title:x("Size"),collapsible:!0,open:c,onToggle:S,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:x("Table width"),placement:"left",children:(0,o.jsx)("div",{style:{marginBottom:T.formItemMarginBottomMD+4},children:(0,o.jsx)(Wo,{form:e,name:"mobileWidth",elementSettings:i})})})})})}),(0,o.jsx)(t.ui_kit$FormSection,{title:x("Background"),collapsible:!0,open:m,onToggle:k,dividerTop:!0,children:(0,o.jsx)(St,{elementSettings:zo(i),imageEnabled:I.formTableFieldBackgroundImageEnabled,desktopBackground:kt(i)})}),I.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Borders"),collapsible:!0,open:s,onToggle:E,dividerTop:!0,children:(0,o.jsx)(z.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),I.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Border radius"),collapsible:!0,open:a,onToggle:h,dividerTop:!0,children:(0,o.jsx)(To,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:f,setOneBorderRadiusValue:g,elementSettings:i})}),I.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Box shadow"),collapsible:!0,open:d,onToggle:p,dividerTop:!0,children:(0,o.jsx)(vo,{typeOfForm:"mobile",form:e,elementSettings:i})}),I.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e})}),I.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Co,{})})]})};rl.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 ll=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),a=Fo(),d=Fo(),c=r.useDispatch(),m=r.useElementEntityKind(),[f,g]=(0,n.useState)({}),[E,h]=(0,n.useState)(!0),[p,S]=(0,n.useState)({}),[k,x]=(0,n.useState)(!0),T=r.useSelector(r.selectEmailViewType),I=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[L,y]=(0,n.useState)(e.backgroundImage[0].value===""),C=r.useSelector(r.selectIsCodeMode),P=r.useSelector(r.selectCodeModeDirection),K=C&&P!=="bottom",[M,$]=(0,n.useState)(!1),[A,W]=(0,n.useState)(!1),[se,R]=(0,n.useState)(!1),[te,he]=(0,n.useState)(!1),[be,Ie]=(0,n.useState)(!1),[xe,Be]=(0,n.useState)(!1),[ke,ne]=(0,n.useState)(!1),[He,Fe]=(0,n.useState)(!1),[Se,ye]=(0,n.useState)(!1),[re,q]=(0,n.useState)(!1),[X,Q]=(0,n.useState)(!1),Z=[{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"}],U=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}],V=v=>v&&(v?.width||v?.style||v?.color)?v:"",J=e.border,de=e.mobileBorder,me=Object.keys(J).find(v=>J[v]?.width||J[v]?.style||J[v]?.color),pe=Object.keys(de).find(v=>de[v]?.width||de[v]?.style||de[v]?.color),{remember:Ae,fillFields:we}=st(e);(0,n.useEffect)(()=>{if(e){const v=e.boxShadow,ie=e.mobileBoxShadow;g(v),S(ie),we(s,{...e,width:e.width?.value,widthDim:e.width?.dim,maxWidth:e.maxWidth?.value,maxWidthDim:e.maxWidth?.dim,minWidth:e.minWidth?.value,minWidthDim:e.minWidth?.dim,backgroundImage:e.backgroundImage[0].value,show:e.show?e.show:"all",borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),borderRadiusAll:u(e.borderRadius.all),borderRadiusTopLeft:u(e.borderRadius.topLeft),borderRadiusBottomLeft:u(e.borderRadius.bottomLeft),borderRadiusTopRight:u(e.borderRadius.topRight),borderRadiusBottomRight:u(e.borderRadius.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:po(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileAlign:e.mobileAlign?.value,mobileBorderAll:V(e.mobileBorder.all)||!(V(e.mobileBorder.top)||V(e.mobileBorder.bottom)||V(e.mobileBorder.right)||V(e.mobileBorder.left))&&V(e.border.all),mobileBorderTop:V(e.mobileBorder.top)||!V(e.mobileBorder.all)&&V(e.border.top),mobileBorderBottom:V(e.mobileBorder.bottom)||!V(e.mobileBorder.all)&&V(e.border.bottom),mobileBorderRight:V(e.mobileBorder.right)||!V(e.mobileBorder.all)&&V(e.border.right),mobileBorderLeft:V(e.mobileBorder.left)||!V(e.mobileBorder.all)&&V(e.border.left),mobileBorderRadiusAll:u(e.mobileBorderRadius.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius.topLeft!==null?e.mobileBorderRadius.topLeft:e.mobileBorderRadius.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius.bottomLeft!==null?e.mobileBorderRadius.bottomLeft:e.mobileBorderRadius.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius.topRight!==null?e.mobileBorderRadius.topRight:e.mobileBorderRadius.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius.bottomRight!==null?e.mobileBorderRadius.bottomRight:e.mobileBorderRadius.all),mobileBoxShadowInset:u(e.mobileBoxShadow?.inset)||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color),mobileBackgroundColor:u(e.mobileBackgroundColor?.value!=="none"?e.mobileBackgroundColor?.value:""),...nt(e),exportAsPicture:e?.exportAsPicture}),!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?h(!1):h(!0),u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight)?x(!1):x(!0),y(e.backgroundImage[0].value==="");const Re=a.isStaleBorderSnapshot(e,!!me),Oe=d.isStaleBorderSnapshot(e,!!pe);Re&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Oe||Re&&!pe)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),$(De=>me&&!Re?!0:De),W(De=>me&&!Re||pe&&!Oe?!0:De),R(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),he(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),Ie(!!e.boxShadow),Be(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),ne(!!e.width?.value||!!e.minWidth?.value||!!e.maxWidth?.value),Fe(!!e.mobileWidth.value),ye(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),q(Et(e)),Q(!!e.exportAsPicture)}},[s,e,me,pe,a,d,we]);const $e=(0,n.useCallback)(v=>{Ae(v),c(m==="email"?r.setElementSettings$1(v):r.setElementSettings(v))},[c,m,Ae]),Y=v=>{const ie=s.getFieldsValue(!0),Re=Object.keys(v)[0];let Oe;switch(Re){case"exportAsPicture":Oe={exportAsPicture:ie.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Oe={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"?(Oe={border:{...r.RESET_BORDER_PARAMS,all:{...z.NULL_BORDER,...ie.borderAll}}},s.setFieldsValue({borderLeft:z.NULL_BORDER,borderRight:z.NULL_BORDER,borderTop:z.NULL_BORDER,borderBottom:z.NULL_BORDER})):ie.borderAll?.width||ie.borderAll?.style||ie.borderAll?.color?(Oe={border:{all:null,left:ie.borderAll,right:ie.borderAll,top:ie.borderAll,bottom:ie.borderAll,[z.REVERSE_BORDER_POSITIONS[Re]]:{...ie[Re],...v[Re]}}},s.setFieldsValue({borderAll:null,borderLeft:ie.borderAll,borderRight:ie.borderAll,borderTop:ie.borderAll,borderBottom:ie.borderAll,[Re]:{...ie[Re],...v[Re]}})):(Oe={border:{all:null,left:ie.borderLeft,right:ie.borderRight,top:ie.borderTop,bottom:ie.borderBottom,[z.REVERSE_BORDER_POSITIONS[Re]]:{...ie[Re],...v[Re]}}},s.setFieldsValue({border:Oe.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(ie.mobileBorderPosition==="mobileBorderAll")Oe={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...z.NULL_BORDER,...ie.mobileBorderAll,classNamePrefix:"em-mob-border_"+z.MOBILE_REVERSE_BORDER_POSITIONS[Re]+"-"}}},s.setFieldsValue({borderLeft:z.NULL_BORDER,borderRight:z.NULL_BORDER,borderTop:z.NULL_BORDER,borderBottom:z.NULL_BORDER});else{const De=z.MOBILE_REVERSE_BORDER_POSITIONS[Re],Ge={...ie[Re],...v[Re]},Qe=!Ge?.width&&!Ge?.style&&!Ge?.color;if(ie.mobileBorder?.all?.width||ie.mobileBorder?.all?.style||ie.mobileBorder?.all?.color){const O=ie.mobileBorderAll;Oe={mobileBorder:{all:null,left:O,right:O,top:O,bottom:O,[De]:Qe?null:{...Ge,classNamePrefix:"em-mob-border_"+De+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:O,mobileBorderRight:O,mobileBorderTop:O,mobileBorderBottom:O,[Re]:Ge})}else{const O=e.mobileBorder||{},oe=j=>{const w=O[j];return w&&(w?.width||w?.style||w?.color)?w:null};Oe={mobileBorder:{all:null,left:De==="left"?Qe?null:{...Ge,classNamePrefix:"em-mob-border_left-"}:oe("left"),right:De==="right"?Qe?null:{...Ge,classNamePrefix:"em-mob-border_right-"}:oe("right"),top:De==="top"?Qe?null:{...Ge,classNamePrefix:"em-mob-border_top-"}:oe("top"),bottom:De==="bottom"?Qe?null:{...Ge,classNamePrefix:"em-mob-border_bottom-"}:oe("bottom")}},s.setFieldsValue({[Re]:Ge})}}break;case"width":Oe={[Re]:{value:v[Re],dim:ie.widthDim}};break;case"widthDim":Oe={width:{value:ie.width,dim:v[Re]}};break;case"maxWidth":Oe={[Re]:{value:v[Re],dim:ie.maxWidthDim}};break;case"maxWidthDim":Oe={maxWidth:{value:ie.maxWidth,dim:v[Re]}};break;case"minWidth":Oe={[Re]:{value:v[Re],dim:ie.minWidthDim}};break;case"minWidthDim":Oe={minWidth:{value:ie.minWidth,dim:v[Re]}};break;case"backgroundImage":y(v[Re]===""),Oe={[Re]:[{...e.backgroundImage[0],value:v[Re]}],backgroundSize:"cover"};break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Oe={borderRadius:{[z.BORDER_RADIUS_POSITION[Re]]:+v[Re]}};break;case"mobileWidth":Oe={[Re]:{classNamePrefix:"em-mob-width-",value:v[Re],dim:ie.mobileWidthDim}};break;case"mobileWidthDim":Oe={mobileWidth:{classNamePrefix:"em-mob-width-",value:ie.mobileWidth||100,dim:v[Re]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Oe={mobileBorderRadius:{[z.MOBILE_BORDER_RADIUS_POSITION[Re]]:v[Re],classNamePrefix:"em-mob-border_radius_"+z.MOBILE_BORDER_RADIUS_POSITION[Re]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Oe={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"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Oe=xt(v),!Oe)return;break;case"mobileAlign":Oe={[Re]:{classNamePrefix:"em-mob-table_align-",value:v[Re]}};break;default:Oe=v}Re!=="borderPosition"&&Re!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Oe}),Re!=="mobileBorderRadiusAll"&&Re!=="mobileBorderRadiusTopLeft"&&Re!=="mobileBorderRadiusTopRight"&&Re!=="mobileBorderRadiusBottomLeft"&&Re!=="mobileBorderRadiusBottomRight"&&$e({...e,...Oe,mobileBorderRadius:{...e.mobileBorderRadius,...Oe?.mobileBorderRadius},activateSection:null,changeKey:Re}))},le=()=>{const v=s.getFieldsValue(!0);a.markBorderToggled(!M),setTimeout(()=>{$(ie=>!ie),M?(v.borderAll=z.NULL_BORDER,v.borderTop=z.NULL_BORDER,v.borderBottom=z.NULL_BORDER,v.borderRight=z.NULL_BORDER,v.borderLeft=z.NULL_BORDER):v.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:v.borderAll.color,style:v.borderAll.style,width:v.borderAll.width}}}})})},Ce=()=>{const v=s.getFieldsValue(!0);d.markBorderToggled(!A),setTimeout(()=>{W(ie=>!ie),A?(v.mobileBorderAll=z.NULL_BORDER,v.mobileBorderTop=z.NULL_BORDER,v.mobileBorderBottom=z.NULL_BORDER,v.mobileBorderRight=z.NULL_BORDER,v.mobileBorderLeft=z.NULL_BORDER):v.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:v.mobileBorderAll.color,style:v.mobileBorderAll.style,width:v.mobileBorderAll.width}}}})})},G=()=>{const v=s.getFieldsValue(!0);setTimeout(()=>{R(ie=>!ie),se?(v.borderRadiusAll=0,h(!0)):v.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:v.borderRadiusAll}}})})},Te=()=>{const v=s.getFieldsValue(!0);setTimeout(()=>{he(ie=>!ie),te?(v.mobileBorderRadiusAll=null,x(!0)):v.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:v.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},Ne=()=>{const v=s.getFieldsValue(!0);setTimeout(()=>{Ie(ie=>!ie),be?(v.boxShadowInset=!1,v.boxShadowHOffset=null,v.boxShadowVOffset=null,v.boxShadowBlurRadius=null,v.boxShadowSpreadRadius=null,v.boxShadowColor=""):(v.boxShadowInset=!1,v.boxShadowHOffset=5,v.boxShadowVOffset=5,v.boxShadowBlurRadius=10,v.boxShadowSpreadRadius=-5,v.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:v.boxShadowBlurRadius,color:v.boxShadowColor,hOffset:v.boxShadowHOffset,inset:v.boxShadowInset,spreadRadius:v.boxShadowSpreadRadius,vOffset:v.boxShadowVOffset}}})})},Pe=()=>{const v=s.getFieldsValue(!0);setTimeout(()=>{Be(ie=>!ie),xe?(v.mobileBoxShadowInset=!1,v.mobileBoxShadowHOffset=null,v.mobileBoxShadowVOffset=null,v.mobileBoxShadowBlurRadius=null,v.mobileBoxShadowSpreadRadius=null,v.mobileBoxShadowColor=""):(v.mobileBoxShadowInset=!1,v.mobileBoxShadowHOffset=5,v.mobileBoxShadowVOffset=5,v.mobileBoxShadowBlurRadius=10,v.mobileBoxShadowSpreadRadius=-5,v.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:v.mobileBoxShadowBlurRadius,color:v.mobileBoxShadowColor,hOffset:v.mobileBoxShadowHOffset,inset:v.mobileBoxShadowInset,spreadRadius:v.mobileBoxShadowSpreadRadius,vOffset:v.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Me=()=>{const v=s.getFieldsValue(!0);setTimeout(()=>{ne(ie=>!ie),ke&&(v.width="",v.minWidth="",v.maxWidth="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{width:{value:null,dim:"px"},minWidth:{value:null,dim:"px"},maxWidth:{value:null,dim:"px"}}}))})},Ue=()=>{const v=s.getFieldsValue(!0);setTimeout(()=>{Fe(ie=>!ie),He&&(v.mobileWidth="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"}}}))})},ze=()=>{const v=s.getFieldsValue(!0);setTimeout(()=>{ye(ie=>!ie),Se?(v.backgroundColor="",v.backgroundImage="",v.backgroundPositionX="",v.backgroundPositionY="",v.backgroundRepeat="none",v.backgroundSize="",y(!0)):(v.backgroundColor="#E5E5E5",v.backgroundSize="",v.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:v.backgroundColor,backgroundImage:[{type:"url",value:v.backgroundImage}],backgroundPositionX:v.backgroundPositionX,backgroundPositionY:v.backgroundPositionY,backgroundRepeat:v.backgroundRepeat,backgroundSize:v.backgroundSize}})})},ce=()=>{const v=s.getFieldsValue(!0);setTimeout(()=>{q(ie=>!ie),re?v.mobileBackgroundColor="":v.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:v.mobileBackgroundColor}}}),re&&Bt(s,e,l)})},fe=()=>{const v=s.getFieldsValue(!0);setTimeout(()=>{Q(ie=>!ie),X&&(v.exportAsPicture=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_table_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,show:"all",width:{value:"",dim:""},maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",mobileAlign:"",border:"",boxShadow:"",borderPosition:z.BORDER_POSITIONS[me]||"borderAll",mobileBorderPosition:z.MOBILE_BORDER_POSITIONS[pe]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileBackgroundColor:"",mobileBackgroundImage:""},onValuesChange:Y,autoComplete:"off",className:"element-controls",children:[!K&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),T==="mobile"&&I.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(rl,{form:s,elementSettings:e,mobileBoxShadow:p,mobileBordersShow:A,mobileBorderRadiusShow:te,mobileBoxShadowShow:xe,mobileSizeShow:He,mobileBackgroundShow:re,oneMobileBorderRadiusValue:k,setOneMobileBorderRadiusValue:x,toggleShowMobileBorderHandler:Ce,toggleShowMobileBorderRadiusHandler:Te,toggleShowMobileBoxShadowHandler:Pe,toggleShowMobileSizeHandler:Ue,toggleShowMobileBackgroundHandler:ce})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Xr,{form:s,elementSettings:e,boxShadow:f,bordersShow:M,borderRadiusShow:se,boxShadowShow:be,backgroundShow:Se,backgroundImageEmpty:L,backgroundRepeatOptions:Z,backgroundSizeOptions:U,sizeShow:ke,modificationShow:X,oneBorderRadiusValue:E,setOneBorderRadiusValue:h,toggleShowBorderHandler:le,toggleShowBorderRadiusHandler:G,toggleShowBoxShadowHandler:Ne,toggleShowSizeHandler:Me,toggleShowBackgroundHandler:ze,toggleShowModificationHandler:fe})})]})};ll.propTypes={elementSettings:_.default.object.isRequired};var sl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),a=r.useAppConfig(),d=r.useSelector(r.selectIsCodeMode),c=r.useSelector(r.selectCodeModeDirection),[m,f]=(0,n.useState)({}),[g,E]=(0,n.useState)("https://"),h=({target:k})=>{const{selectionStart:x,selectionEnd:T}=k;k&&f({target:k,selection:{start:x,end:T}})};(0,n.useEffect)(()=>{if(e){let k="",x="",T=e.href==null?"https://":e.href;if(T&&T.substring(0,7)==="mailto:"){const I=new URL(e.href);k=I.searchParams.get("subject")||"",x=I.searchParams.get("body")||"",T=e.href.split("?")[0],E("mailto:")}else e.href&&(e.href.substring(0,8)==="https://"||e.href.substring(0,7)==="http://"?E("https://"):e.href.substring(0,4)==="tel:"?E("tel:"):e.href.substring(0,4)==="sms:"?E("sms:"):e.href.substring(0,6)==="ftp://"?E("ftp://"):E(""));s.setFieldsValue({...e,href:T,subject:k,body:x})}},[s,e]);const p=k=>{const x=Object.keys(k)[0];let T=k;if(x==="href"){const I=et(k[x]);if(I!==k[x]&&s.setFieldValue("href",I),I.substring(0,7)==="mailto:"){const L=s.getFieldValue("subject"),y=s.getFieldValue("body"),C=[];L&&C.push(`subject=${encodeURIComponent(L)}`),y&&C.push(`body=${encodeURIComponent(y)}`),T={href:C.length>0?`${I}?${C.join("&")}`:I}}else T={href:I}}if(x==="subject"||x==="body"){const I=s.getFieldValue("href")||"";if(I.substring(0,7)==="mailto:"){const L=I.split("?")[0],y=x==="subject"?k[x]:s.getFieldValue("subject"),C=x==="body"?k[x]:s.getFieldValue("body"),P=[];y&&P.push(`subject=${encodeURIComponent(y)}`),C&&P.push(`body=${encodeURIComponent(C)}`),T={href:P.length>0?`${L}?${P.join("&")}`:L}}else return}l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:T})},S=k=>{l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:k})};return(0,o.jsx)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_link_form",initialValues:{href:"https://",target:"",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1,textReplacer:"",subject:"",body:""},onValuesChange:p,autoComplete:"off",className:"element-controls",children:!d||c==="bottom"?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Hyperlink URL"),placement:"left",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:24,paddingRight:10},children:(0,o.jsx)(t.ui_kit$Input,{allowClear:!0,placeholder:i("Hyperlink URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined}),onSelect:h})})}),a.formLinkFieldInsertImageEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:i("Actions with the chosen text"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$Form.Item,{children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"PicLeftOutlined",component:t.icons$PicLeftOutlined}),onClick:()=>S("add_img"),children:i("Add inline image")})})}),(0,o.jsx)(_t,{form:s,elementSettings:e,showAddParagraph:!1,linkTarget:m,linkProtocol:g,setLinkProtocol:E})]}):(0,o.jsx)(yi,{form:s,elementSettings:e,showAddParagraph:!1})})};sl.propTypes={elementSettings:_.default.object.isRequired};var al=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:14,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"height",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:e("Indent height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})})};al.propTypes={};var nl=({form:e,elementSettings:i})=>(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{marginBottom:20},children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(ot,{form:e,name:"mobileHeight",elementSettings:i})})});nl.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired};var dl=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm(),s=r.useDispatch(),a=r.useSendPostMessage(),d=r.useSelector(r.selectEmailViewType),c=r.useSelector(r.selectMobileViewActive),m=r.useSelector(r.selectIsCodeMode),f=r.useSelector(r.selectCodeModeDirection),g=m&&f!=="bottom",E=r.useElementEntityKind(),{remember:h,fillFields:p}=st(e);(0,n.useEffect)(()=>{e&&p(l,{...e,height:e.height?.value,heightDim:e.height?.dim,mobileHeight:po(e.mobileHeight?.value||e.height?.value),mobileHeightDim:e.mobileHeight?.dim||e.height?.dim})},[l,e,p]);const S=(0,n.useCallback)(x=>{h(x),s(E==="email"?r.setElementSettings$1(x):r.setElementSettings(x))},[s,E,h]),k=x=>{const T=l.getFieldsValue(!0),I=Object.keys(x)[0];let L;switch(I){case"height":L={[I]:{value:x[I],dim:T.heightDim}};break;case"heightDim":L={height:{value:T.height,dim:x[I]}};break;case"mobileHeight":L={[I]:{classNamePrefix:"em-mob-height-",value:x[I],dim:T.mobileHeightDim}};break;case"mobileHeightDim":L={mobileHeight:{classNamePrefix:"em-mob-height-",value:T.mobileHeight,dim:x[I]}};break;default:L=x}a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:L}),S({...e,...L,activateSection:null,changeKey:I})};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_vindent_form",initialValues:{height:"",heightDim:"",mobileHeight:"",mobileHeightDim:""},onValuesChange:k,autoComplete:"off",children:[!g&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),d==="mobile"&&c.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:d==="mobile"&&c.styles?"block":"none",marginBottom:10},children:(0,o.jsx)(nl,{form:l,elementSettings:e})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",style:{display:d==="mobile"&&c.styles?"none":"block"},children:(0,o.jsx)(al,{})})]})};dl.propTypes={elementSettings:_.default.object.isRequired};var Vt=({form:e,elementSettings:i,typeOfForm:l="desktop"})=>{const s=r.useSendPostMessage(),a=l==="mobile",d=a?"mobileDirection":"direction",c=f=>{e.setFieldsValue({[d]:f}),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[d]:f}})},m=a?i.mobileDirection?.value??"":i.direction??"";return(0,o.jsx)(t.ui_kit$Form.Item,{name:d,className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$FormDirectionControl,{value:m,onChange:c})})},Ht=e=>e.closest(".email-pane__collapse-wrapper")||e.parentNode,Ii=({form:e,backgroundImageEmpty:i,appConfig:l,token:s,elementSettings:a,backgroundRepeatOptions:d,handleChangeValues:c})=>{const{__:m}=r.useI18n(),[f,g]=(0,n.useState)(""),[E,h]=(0,n.useState)("px"),[p,S]=(0,n.useState)(""),[k,x]=(0,n.useState)("px"),T=[{label:m("Not defined"),value:""},{label:m("Contain"),value:"contain"},{label:m("Cover"),value:"cover"}],I=C=>{if(!C||typeof C!="string")return{value:"",unit:"px"};C=C.trim();const P=C.match(/^(\d*\.?\d+)(%|px)$/);return P?{value:P[1],unit:P[2]}:{value:C,unit:"px"}};(0,n.useEffect)(()=>{const C=e.getFieldValue("backgroundPositionX"),P=e.getFieldValue("backgroundPositionY"),K=I(C),M=I(P);g(String(K.value)),h(K.unit),S(String(M.value)),x(M.unit)},[e]);const L=(C,P)=>{g(String(C)),h(P),c&&c({backgroundPositionX:{position:C,unit:P}})},y=(C,P)=>{S(String(C)),x(P),c&&c({backgroundPositionY:{position:C,unit:P}})};return(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:8},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:m("Background color"),placement:"bottom",getPopupContainer:Ht,children:(0,o.jsx)("div",{children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"backgroundColor",style:{marginBottom:s.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:m("Background color"),usedColors:a.usedColors,placement:"bottomLeft"})})})})}),l.formCellFieldBackgroundImageEnabled&&(0,o.jsxs)(t.ui_kit$Col,{span:i?12:24,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:m("Background image"),placement:"bottom",getPopupContainer:Ht,children:(0,o.jsx)("div",{children:(0,o.jsx)(No,{form:e,label:m("Background image"),name:"backgroundImage",tooltipTitle:m("Background image"),placeholder:m("Background image link/route")})})}),!i&&(0,o.jsxs)(t.ui_kit$Form.Item,{style:{marginBottom:"0"},children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:s.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$InputSelect,{options:Dt.horizontal,position:f,setPosition:C=>L(C,E),unit:E,setUnit:C=>L(f,C),placeholder:m("Horizontal position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal}),dropdownStyle:{bottom:"auto"},tooltipTitle:m("Horizontal position"),getTooltipPopupContainer:Ht})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$InputSelect,{options:Dt.vertical,position:p,setPosition:C=>y(C,k),unit:k,setUnit:C=>y(p,C),placeholder:m("Vertical position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical}),dropdownStyle:{bottom:"auto"},tooltipTitle:m("Vertical position"),getTooltipPopupContainer:Ht})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:m("Background image repeat"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"backgroundRepeat",style:{marginBottom:s.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{placeholder:m("Please choose"),options:d,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:m("Background image size"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"backgroundSize",style:{marginBottom:s.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{placeholder:m("Please choose"),options:T,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})})]})]})]})]})},Vn=({form:e,elementSettings:i,__:l,appConfig:s})=>{const a=z.useGoogleFontsLoader(),[d,c]=(0,n.useState)(null);return(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&c(!0)},[]),(0,o.jsxs)("div",{style:{marginBottom:"-15px"},children:[s.formTextFieldTypografEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Text font"),placement:"bottom",zIndex:1,getPopupContainer:m=>m.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:a,getPopupContainer:m=>m.closest(".email-pane__collapse-wrapper")})})}),!i.showOnMobile&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:l("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:l("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(eo,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:l(d?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(eo,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:l(d?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(eo,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:l(d?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(eo,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:l(d?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Text color"),placement:"bottom",zIndex:2,getPopupContainer:m=>m.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:l("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l("Color"),usedColors:i.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Text background"),placement:"bottom",zIndex:2,getPopupContainer:m=>m.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:l("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l("Background color"),usedColors:i.usedColors})})})})]})]})},cl=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:a,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:m,backgroundRepeatOptions:f,sizeShow:g,maxWidthValue:E,modificationShow:h,paddingsExt:p,oneBorderRadiusValue:S,setOneBorderRadiusValue:k,elementListShow:x,togglePaddingHandler:T,toggleShowBorderHandler:I,toggleShowBorderRadiusHandler:L,toggleShowBoxShadowHandler:y,toggleShowSizeHandler:C,toggleShowBackgroundHandler:P,toggleShowModificationHandler:K,handleChangeValues:M})=>{const{__:$}=r.useI18n(),{token:A}=(0,t.ui_kit$useToken)(),W=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(tt,{form:e,elementSettings:i})}),W.formCellFieldVerticalAlignEnabled&&i.type!=="group"&&(i.type!=="structure"||i.type==="structure"&&i.floatBlocks.items.length===1)&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Mo,{form:e,elementSettings:i})})]}),W.formCellFieldPaddingsEnabled&&(0,o.jsxs)(o.Fragment,{children:[x&&(0,o.jsx)("div",{style:{marginTop:"15px"},children:(0,o.jsx)(Vn,{form:e,elementSettings:i,appConfig:W,__:$})}),(0,o.jsx)(t.ui_kit$FormSection,{title:$("Padding"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:p,onToggleExtended:T,showHorizontal:i.type!=="group"&&i.type!=="column",rowStyle:{paddingBottom:4},labels:{horizontal:$("Horizontal padding"),vertical:$("Vertical padding"),left:$("Left padding"),right:$("Right padding"),top:$("Top padding"),bottom:$("Bottom padding"),individual:$("Individual padding")}})})]}),i.type!=="group"&&W.formCellFieldSizeEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Size"),collapsible:!0,open:g,onToggle:C,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{showWidth:i.type!=="structure"&&i.type!=="column",maxWidth:E,dimensionSelect:$o,rowStyle:{paddingBottom:4},labels:{width:$("Width"),height:$("Height"),minWidth:$("Minimum width"),maxWidth:$("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:$("Background"),collapsible:!0,open:c,onToggle:P,dividerTop:!0,children:[(0,o.jsx)(Ii,{form:e,backgroundImageEmpty:m,appConfig:W,token:A,elementSettings:i,backgroundRepeatOptions:f,handleChangeValues:M}),(0,o.jsx)(it,{form:e,showBackground:!0})]}),W.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Borders"),collapsible:!0,open:s,onToggle:I,dividerTop:!0,children:(0,o.jsx)(z.SelectedElementFormBorder,{form:e,elementSettings:i})}),W.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Border radius"),collapsible:!0,open:a,onToggle:L,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:S,setOneBorderRadiusValue:k,elementSettings:i})}),W.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Box shadow"),collapsible:!0,open:d,onToggle:y,dividerTop:!0,children:(0,o.jsx)(vo,{})}),W.formFieldExportAsPictureEnabled&&i.type!=="group"&&(0,o.jsxs)(t.ui_kit$FormSection,{title:$("Settings"),collapsible:!0,open:h,onToggle:K,dividerTop:!0,children:[i.type==="structure"&&(0,o.jsx)(t.ui_kit$Tooltip,{title:$("The block will change its colors to contrasting colors. You can change them in the Content Styles section."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"isContrastBlock",valuePropName:"checked",style:{marginBottom:0},children:(0,o.jsx)(t.ui_kit$Switch,{id:"contrast-colors",label:$("Contrast block"),size:"small",labelStyle:{position:"relative",top:2}})})},"isContrastBlock"),(0,o.jsx)(wi,{form:e,elementSettings:i})]}),W.formFieldVisibilityEnabled&&i.type!=="column"&&(0,o.jsx)(t.ui_kit$FormSection,{title:$(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,o.jsx)(Vt,{elementSettings:i,form:e}):void 0})}),W.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Co,{})})]})};cl.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 Ut=({form:e,elementSettings:i,mobilePaddingsExt:l,setMobilePaddingsExt:s,rowStyle:a})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),m=()=>{s(g=>!g);const f=e.getFieldsValue(!0);l||(f.mobilePaddingLeftRight=f.mobilePaddingLeft,f.mobilePaddingTopBottom=f.mobilePaddingTop,f.mobilePaddingRight=f.mobilePaddingLeft,f.mobilePaddingBottom=f.mobilePaddingTop,c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobilePadding:{top:f.mobilePaddingTop!==""?f.mobilePaddingTop:null,bottom:f.mobilePaddingTopBottom!==""?f.mobilePaddingTopBottom:null,left:f.mobilePaddingLeft!==""?f.mobilePaddingLeft:null,right:f.mobilePaddingRight!==""?f.mobilePaddingRight:null,classNamePrefix:"em-mob-padding_"}}}))};return(0,o.jsx)(t.ui_kit$FormPaddingInputs,{typeOfForm:"mobile",extended:l,onToggleExtended:m,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")}})};Ut.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 ul=({form:e,elementSettings:i,boxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:a,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:m,mobilePaddingShow:f,mobilePaddingsExt:g,setMobilePaddingsExt:E,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:p,toggleShowMobileBorderHandler:S,toggleShowMobileBorderRadiusHandler:k,toggleShowMobileBoxShadowHandler:x,toggleShowMobileSizeHandler:T,toggleShowMobileBackgroundHandler:I,toggleShowMobilePaddingHandler:L})=>{const{__:y}=r.useI18n(),C=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Ho,{form:e,elementSettings:i,imgParent:!0,typeOfForm:"mobile"})}),C.formCellFieldVerticalAlignEnabled&&i.type!=="group"&&(i.type!=="structure"||i.type==="structure"&&i.floatBlocks.items.length===1)&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Mo,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),C.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Padding"),collapsible:!0,open:f,onToggle:L,dividerTop:!0,children:(0,o.jsx)(Ut,{form:e,elementSettings:i,mobilePaddingsExt:g,setMobilePaddingsExt:E,rowStyle:{paddingBottom:4}})}),i.type!=="group"&&C.formCellFieldSizeEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Size"),collapsible:!0,open:c,onToggle:T,dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:9},children:[i.type!=="structure"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:15},children:(0,o.jsx)(Wo,{form:e,name:"mobileWidth",elementSettings:i})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:15},children:(0,o.jsx)(ot,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:y("Background"),collapsible:!0,open:m,onToggle:I,dividerTop:!0,children:(0,o.jsx)(St,{elementSettings:zo(i),imageEnabled:C.formCellFieldBackgroundImageEnabled,desktopBackground:kt(i)})}),C.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Borders"),collapsible:!0,open:s,onToggle:S,dividerTop:!0,children:(0,o.jsx)(z.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),C.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Border radius"),collapsible:!0,open:a,onToggle:k,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:h,setOneBorderRadiusValue:p,elementSettings:i,typeOfForm:"mobile"})}),C.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Box shadow"),collapsible:!0,open:d,onToggle:x,dividerTop:!0,children:(0,o.jsx)(vo,{typeOfForm:"mobile"})}),C.formFieldVisibilityEnabled&&i.type!=="column"&&(0,o.jsx)(t.ui_kit$FormSection,{title:y(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,o.jsx)(Vt,{elementSettings:i,form:e,typeOfForm:"mobile"}):void 0})}),C.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Co,{})})]})};ul.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 ml=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),s=r.useDispatch(),[a]=t.ui_kit$Form.useForm(),d=Fo(),c=Fo(),[m,f]=(0,n.useState)(""),[g,E]=(0,n.useState)({}),[h,p]=(0,n.useState)(!0),[S,k]=(0,n.useState)(!0),x=r.useSelector(r.selectEmailViewType),T=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[I,L]=(0,n.useState)(e.backgroundImage[0].value===""),y=r.useSelector(r.selectIsCodeMode),C=r.useSelector(r.selectCodeModeDirection),P=y&&C!=="bottom",[K,M]=(0,n.useState)(!1),[$,A]=(0,n.useState)(!1),[W,se]=(0,n.useState)(!1),[R,te]=(0,n.useState)(!1),[he,be]=(0,n.useState)(!1),[Ie,xe]=(0,n.useState)(!1),[Be,ke]=(0,n.useState)(!1),[ne,He]=(0,n.useState)(!1),[Fe,Se]=(0,n.useState)(!1),[ye,re]=(0,n.useState)(!1),[q,X]=(0,n.useState)(!1),[Q,Z]=(0,n.useState)(!1),[U,V]=(0,n.useState)(!1),[J,de]=(0,n.useState)(!1),[me,pe]=(0,n.useState)(!1),Ae=r.useElementEntityKind(),we=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],$e=e.border,Y=e.mobileBorder,le=Object.keys($e).find(j=>$e[j]?.width||$e[j]?.style||$e[j]?.color),Ce=Object.keys(Y).find(j=>Y[j]?.width||Y[j]?.style||Y[j]?.color),G=j=>j&&(j?.width||j?.style||j?.color)?j:"",{remember:Te,fillFields:Ne}=st(e);(0,n.useEffect)(()=>{if(e){const j=e.boxShadow;E(j),Ne(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:po(e.mobileWidth?.value)||po(e.width?.value),mobileWidthDim:po(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:po(e.mobileHeight?.value)||po(e.height?.value),mobileHeightDim:po(e.mobileHeight?.value)?e.mobileHeight?.dim:e.height?.dim,mobileBorderRadiusAll:u(e.mobileBorderRadius?.all)||u(e.borderRadius?.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius?.topLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topLeft)||u(e.borderRadius?.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius?.bottomLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomLeft)||u(e.borderRadius?.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius?.topRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topRight)||u(e.borderRadius?.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius?.bottomRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomRight)||u(e.borderRadius?.all),mobileBoxShadowInset:e.mobileBoxShadow?.inset!=null?e.mobileBoxShadow.inset:e.boxShadow?.inset||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset)||u(e.boxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset)||u(e.boxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius)||u(e.boxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius)||u(e.boxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color)||u(e.boxShadow?.color),mobileAlign:u(e.mobileAlign?.value)||e.align,mobileVerticalAlign:u(e.mobileVerticalAlign?.value||e.valign),mobileDirection:u(e.mobileDirection?.value),mobileBackgroundColor:u(e.mobileBackgroundColor?.value||e.backgroundColor||""),...nt(e),mobilePaddingTop:u(e.mobilePadding.all)||u(e.mobilePadding.top)||u(e.padding?.all)||u(e.padding?.top),mobilePaddingLeft:u(e.mobilePadding.all)||u(e.mobilePadding.left)||u(e.padding?.all)||u(e.padding?.left),mobilePaddingRight:u(e.mobilePadding.all)||u(e.mobilePadding.right)||u(e.padding?.all)||u(e.padding?.right),mobilePaddingBottom:u(e.mobilePadding.all)||u(e.mobilePadding.bottom)||u(e.padding?.all)||u(e.padding?.bottom),mobilePaddingTopBottom:u(e.mobilePadding.top)||u(e.mobilePadding.bottom)||u(e.padding?.top)||u(e.padding?.bottom),mobilePaddingLeftRight:u(e.mobilePadding.left)||u(e.mobilePadding.right)||u(e.padding?.left)||u(e.padding?.right),exportAsPicture:e?.exportAsPicture}),!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?p(!1):p(!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),L(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)?M(!1):M(!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)?A(!1):A(!0);const w=d.isStaleBorderSnapshot(e,!!le),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}),se(ve=>le&&!w?!0:ve),te(ve=>le&&!w||Ce&&!ue?!0:ve),be(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),xe(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight||!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),ke(!!e.boxShadow),He(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),Se(!!e.width.value&&e.type!=="column"||!!e.height.value),re(!!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),Z(!!e.mobileBackgroundColor.value||!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Et(e)&&Z(!0),V(!!e.exportAsPicture||!!e.isContrastBlock),de(!!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"?pe(!0):pe(!1)}},[a,e,le,Ce,d,c,Ne]);const Pe=(0,n.useCallback)(j=>{Te(j),s(Ae==="email"?r.setElementSettings$1(j):r.setElementSettings(j))},[s,Ae,Te]),Me=j=>{const w=a.getFieldsValue(!0),ue=Object.keys(j)[0];let ve;switch(f(a.getFieldsValue(!0).widthDim==="%"?100:""),ue){case"exportAsPicture":ve={exportAsPicture:w.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":ve={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"?(ve={border:{...r.RESET_BORDER_PARAMS,all:{...z.NULL_BORDER,...w.borderAll}}},a.setFieldsValue({borderLeft:z.NULL_BORDER,borderRight:z.NULL_BORDER,borderTop:z.NULL_BORDER,borderBottom:z.NULL_BORDER})):w.borderAll?.width||w.borderAll?.style||w.borderAll?.color?(ve={border:{all:null,left:w.borderAll,right:w.borderAll,top:w.borderAll,bottom:w.borderAll,[z.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]}})):(ve={border:{all:null,left:w.borderLeft,right:w.borderRight,top:w.borderTop,bottom:w.borderBottom,[z.REVERSE_BORDER_POSITIONS[ue]]:{...w[ue],...j[ue]}}},a.setFieldsValue({border:ve.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(w.mobileBorderPosition==="mobileBorderAll")ve={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...z.NULL_BORDER,...w.mobileBorderAll,classNamePrefix:"em-mob-border_"+z.MOBILE_REVERSE_BORDER_POSITIONS[ue]+"-"}}},a.setFieldsValue({borderLeft:z.NULL_BORDER,borderRight:z.NULL_BORDER,borderTop:z.NULL_BORDER,borderBottom:z.NULL_BORDER});else{const Xe=z.MOBILE_REVERSE_BORDER_POSITIONS[ue],Ke={...w[ue],...j[ue]},to=!Ke?.width&&!Ke?.style&&!Ke?.color;if(w.mobileBorder?.all?.width||w.mobileBorder?.all?.style||w.mobileBorder?.all?.color){const io=w.mobileBorderAll;ve={mobileBorder:{all:null,left:io,right:io,top:io,bottom:io,[Xe]:to?null:{...Ke,classNamePrefix:"em-mob-border_"+Xe+"-"}}},a.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:io,mobileBorderRight:io,mobileBorderTop:io,mobileBorderBottom:io,[ue]:Ke})}else{const io=e.mobileBorder||{},co=Eo=>{const xo=io[Eo];return xo&&(xo?.width||xo?.style||xo?.color)?xo:null};ve={mobileBorder:{all:null,left:Xe==="left"?to?null:{...Ke,classNamePrefix:"em-mob-border_left-"}:co("left"),right:Xe==="right"?to?null:{...Ke,classNamePrefix:"em-mob-border_right-"}:co("right"),top:Xe==="top"?to?null:{...Ke,classNamePrefix:"em-mob-border_top-"}:co("top"),bottom:Xe==="bottom"?to?null:{...Ke,classNamePrefix:"em-mob-border_bottom-"}:co("bottom")}},a.setFieldsValue({[ue]:Ke})}}break;case"width":ve={[ue]:{value:j[ue],dim:w.widthDim}};break;case"height":ve={[ue]:{value:j[ue],dim:w.heightDim}};break;case"widthDim":ve={width:{value:w.width,dim:j[ue]}};break;case"heightDim":ve={height:{value:w.height,dim:j[ue]}};break;case"backgroundImage":L(j[ue]===""),ve={[ue]:[{...e.backgroundImage[0],value:j[ue]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":ve={padding:{left:w.paddingLeft,right:w.paddingRight,top:w.paddingTop,bottom:w.paddingBottom,[z.PADDING_POSITION[ue]]:+j[ue]}};break;case"paddingTopBottom":ve={padding:{left:w.paddingLeft,right:w.paddingRight,top:+j[ue],bottom:+j[ue]}},w.paddingTop=w.paddingBottom=+j[ue];break;case"paddingLeftRight":ve={padding:{top:w.paddingTop,bottom:w.paddingBottom,left:+j[ue],right:+j[ue]}},w.paddingLeft=w.paddingRight=+j[ue];break;case"borderRadiusAll":ve={borderRadius:{[z.BORDER_RADIUS_POSITION[ue]]:+j[ue]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":ve={borderRadius:{topLeft:w.borderRadiusTopLeft,bottomLeft:w.borderRadiusBottomLeft,topRight:w.borderRadiusTopRight,bottomRight:w.borderRadiusBottomRight,[z.BORDER_RADIUS_POSITION[ue]]:+j[ue]}};break;case"mobileWidth":ve={[ue]:{classNamePrefix:"em-mob-width-",value:j[ue],dim:w.mobileWidthDim}};break;case"mobileWidthDim":ve={mobileWidth:{classNamePrefix:"em-mob-width-",value:w.mobileWidth||100,dim:j[ue]}};break;case"mobileHeight":ve={[ue]:{classNamePrefix:"em-mob-height-",value:j[ue],dim:w.mobileHeightDim}};break;case"mobileHeightDim":ve={mobileHeight:{classNamePrefix:"em-mob-height-",value:w.mobileHeight,dim:j[ue]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":ve={mobileBorderRadius:{[z.MOBILE_BORDER_RADIUS_POSITION[ue]]:j[ue],classNamePrefix:"em-mob-border_radius_"+z.MOBILE_BORDER_RADIUS_POSITION[ue]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":ve={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":ve={[ue]:{classNamePrefix:"em-mob-text_align-",value:j[ue]}};break;case"mobileVerticalAlign":ve={[ue]:{classNamePrefix:"em-mob-vertical_align-",value:j[ue]}};break;case"mobileDirection":ve={[ue]:{classNamePrefix:"em-mob-direction-",value:j[ue]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(ve=xt(j),!ve)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":ve={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],ve={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],ve={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":ve={[ue]:isNaN(parseFloat(j[ue].position))?j[ue].position:j[ue].position+j[ue].unit};break;default:ve=j}ue!=="borderPosition"&&ue!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:ve}),ue!=="mobileBorderRadiusAll"&&ue!=="mobileBorderRadiusTopLeft"&&ue!=="mobileBorderRadiusTopRight"&&ue!=="mobileBorderRadiusBottomLeft"&&ue!=="mobileBorderRadiusBottomRight"&&Pe({...e,...ve,mobileBorderRadius:{...e.mobileBorderRadius,...ve?.mobileBorderRadius},activateSection:null,changeKey:ue}))},Ue=()=>{M(w=>!w);const j=a.getFieldsValue(!0);K||(j.paddingLeftRight=j.paddingLeft,j.paddingTopBottom=j.paddingTop,j.paddingRight=j.paddingLeft,j.paddingBottom=j.paddingTop,l({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}}}))},ze=()=>{const j=a.getFieldsValue(!0);d.markBorderToggled(!W),setTimeout(()=>{se(w=>!w),W?(j.borderAll=z.NULL_BORDER,j.borderTop=z.NULL_BORDER,j.borderBottom=z.NULL_BORDER,j.borderRight=z.NULL_BORDER,j.borderLeft=z.NULL_BORDER):j.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({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}}}})})},ce=()=>{const j=a.getFieldsValue(!0);c.markBorderToggled(!R),setTimeout(()=>{te(w=>!w),R?(j.mobileBorderAll=z.NULL_BORDER,j.mobileBorderTop=z.NULL_BORDER,j.mobileBorderBottom=z.NULL_BORDER,j.mobileBorderRight=z.NULL_BORDER,j.mobileBorderLeft=z.NULL_BORDER):j.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({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}}}})})},fe=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{be(w=>!w),he?(j.borderRadiusAll=0,p(!0)):j.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:j.borderRadiusAll}}})})},v=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{xe(w=>!w),Ie?(j.mobileBorderRadiusAll=null,k(!0)):j.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:j.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},ie=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{ke(w=>!w),Be?(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"),l({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}}})})},Re=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{He(w=>!w),ne?(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"),l({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-"}}})})},Oe=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{Se(w=>!w),Fe&&(j.width="",j.height="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{width:{value:null,dim:"px"},height:{value:null,dim:"px"}}}))})},De=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{re(w=>!w),ye&&(j.mobileWidth="",j.mobileHeight="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"},mobileHeight:{value:null,dim:"px",classNamePrefix:"em-mob-height-"}}}))})},Ge=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{X(w=>!w),q?(j.backgroundColor="",j.backgroundImage="",j.backgroundPositionX="",j.backgroundPositionY="",j.backgroundRepeat="none",j.backgroundSize="",L(!0)):(j.backgroundColor="#E5E5E5",j.backgroundSize="",j.backgroundRepeat="none"),l({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}})})},Qe=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{Z(w=>!w),Q?j.mobileBackgroundColor="":j.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:j.mobileBackgroundColor}}}),Q&&Bt(a,e,l)})},O=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{V(w=>!w),U&&(j.exportAsPicture=!1,j.isContrastBlock=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1,isContrastBlock:!1}}))})},oe=()=>{const j=a.getFieldsValue(!0);setTimeout(()=>{de(w=>!w),J&&(j.mobilePaddingLeftRight="",j.mobilePaddingLeft="",j.mobilePaddingRight="",j.mobilePaddingTopBottom="",j.mobilePaddingTop="",j.mobilePaddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobilePadding:{all:null,top:null,right:null,bottom:null,left:null,classNamePrefix:"em-mob-padding_"}}}))})};return(0,o.jsx)(t.ui_kit$Form,{form:a,layout:"vertical",name:"selected_td_form",initialValues:{horizontalPosition:"",horizontalUnit:"px",backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",align:"",valign:"",border:"",show:"all",borderPosition:z.BORDER_POSITIONS[le]||"borderAll",mobileBorderPosition:z.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:Me,autoComplete:"off",className:"element-controls",children:x==="mobile"&&T.styles?(0,o.jsxs)("div",{className:"selected_form-mobile-props-wrapper",style:{display:x==="mobile"&&T.styles?"flex":"none"},children:[(0,o.jsx)("div",{className:"selected_form-mobile-props-header",children:!P&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})})}),(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(ul,{form:a,elementSettings:e,boxShadow:g,mobileBordersShow:R,mobileBorderRadiusShow:Ie,mobileBoxShadowShow:ne,mobileSizeShow:ye,mobileBackgroundShow:Q,mobilePaddingShow:J,mobilePaddingsExt:$,setMobilePaddingsExt:A,oneMobileBorderRadiusValue:S,setOneMobileBorderRadiusValue:k,toggleShowMobileBorderHandler:ce,toggleShowMobileBorderRadiusHandler:v,toggleShowMobileBoxShadowHandler:Re,toggleShowMobileSizeHandler:De,toggleShowMobileBackgroundHandler:Qe,toggleShowMobilePaddingHandler:oe})})]}):(0,o.jsxs)(o.Fragment,{children:[!P&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(cl,{form:a,elementSettings:e,boxShadow:g,bordersShow:W,borderRadiusShow:he,boxShadowShow:Be,backgroundShow:q,backgroundImageEmpty:I,backgroundRepeatOptions:we,sizeShow:Fe,maxWidthValue:m,modificationShow:U,paddingsExt:K,oneBorderRadiusValue:h,setOneBorderRadiusValue:p,elementListShow:me,togglePaddingHandler:Ue,toggleShowBorderHandler:ze,toggleShowBorderRadiusHandler:fe,toggleShowBoxShadowHandler:ie,toggleShowSizeHandler:Oe,toggleShowBackgroundHandler:Ge,toggleShowModificationHandler:O,handleChangeValues:Me})})]})})};ml.propTypes={elementSettings:_.default.object.isRequired};var pl=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:a,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:m,backgroundRepeatOptions:f,sizeShow:g,maxWidthValue:E,modificationShow:h,paddingShow:p,paddingsExt:S,oneBorderRadiusValue:k,setOneBorderRadiusValue:x,togglePaddingHandler:T,toggleShowPaddingHandler:I,toggleShowBorderHandler:L,toggleShowBorderRadiusHandler:y,toggleShowBoxShadowHandler:C,toggleShowSizeHandler:P,toggleShowBackgroundHandler:K,toggleShowModificationHandler:M,handleChangeValues:$})=>{const{__:A}=r.useI18n(),{token:W}=(0,t.ui_kit$useToken)(),se=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:A("Appearance on mobile devices"),type:"info"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(tt,{form:e,elementSettings:i})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Mo,{form:e,elementSettings:i})})]}),se.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:A("Padding"),collapsible:!0,open:p,onToggle:I,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:S,onToggleExtended:T,labels:{horizontal:A("Horizontal padding"),vertical:A("Vertical padding"),left:A("Left padding"),right:A("Right padding"),top:A("Top padding"),bottom:A("Bottom padding"),individual:A("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:A("Size"),collapsible:!0,open:g,onToggle:P,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:E,dimensionSelect:$o,showMinMax:!0,minWidthDimensionSelect:$o,maxWidthDimensionSelect:$o,labels:{width:A("Width"),height:A("Height"),minWidth:A("Minimum width"),maxWidth:A("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:A("Background"),collapsible:!0,open:c,onToggle:K,dividerTop:!0,children:[(0,o.jsx)(Ii,{form:e,backgroundImageEmpty:m,appConfig:se,token:W,elementSettings:i,backgroundRepeatOptions:f,handleChangeValues:$}),(0,o.jsx)(it,{form:e,showBackground:!0})]}),se.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:A("Borders"),collapsible:!0,open:s,onToggle:L,dividerTop:!0,children:(0,o.jsx)(z.SelectedElementFormBorder,{form:e,elementSettings:i})}),se.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:A("Border radius"),collapsible:!0,open:a,onToggle:y,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:k,setOneBorderRadiusValue:x,elementSettings:i})}),se.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:A("Box shadow"),collapsible:!0,open:d,onToggle:C,dividerTop:!0,children:(0,o.jsx)(vo,{})}),se.formFieldExportAsPictureEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:A("Export settings"),collapsible:!0,open:h,onToggle:M,dividerTop:!0,children:(0,o.jsx)(wi,{form:e,elementSettings:i})}),se.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:A("Display control & Direction"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e,directionControl:(0,o.jsx)(Vt,{elementSettings:i,form:e})})}),se.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:A("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Co,{})})]})};pl.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 hl=({form:e,elementSettings:i,mobileBoxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:a,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:m,mobilePaddingShow:f,mobilePaddingsExt:g,setMobilePaddingsExt:E,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:p,toggleShowMobileBorderHandler:S,toggleShowMobileBorderRadiusHandler:k,toggleShowMobileBoxShadowHandler:x,toggleShowMobileSizeHandler:T,toggleShowMobileBackgroundHandler:I,toggleShowMobilePaddingHandler:L})=>{const{__:y}=r.useI18n(),{token:C}=(0,t.ui_kit$useToken)(),P=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Mt,{form:e,elementSettings:i,imgParent:!0})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Mo,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),P.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Padding"),collapsible:!0,open:f,onToggle:L,dividerTop:!0,children:(0,o.jsx)(Ut,{form:e,elementSettings:i,mobilePaddingsExt:g,setMobilePaddingsExt:E})}),(0,o.jsx)(t.ui_kit$FormSection,{title:y("Size"),collapsible:!0,open:c,onToggle:T,dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:8},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:C.formItemMarginBottomXS*2},children:(0,o.jsx)(Wo,{form:e,name:"mobileWidth",elementSettings:i})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:C.formItemMarginBottomXS},children:(0,o.jsx)(ot,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:y("Background"),collapsible:!0,open:m,onToggle:I,dividerTop:!0,children:(0,o.jsx)(St,{elementSettings:zo(i),imageEnabled:P.formDivFieldBackgroundImageEnabled,desktopBackground:kt(i)})}),P.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Borders"),collapsible:!0,open:s,onToggle:S,dividerTop:!0,children:(0,o.jsx)(z.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),P.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Border radius"),collapsible:!0,open:a,onToggle:k,dividerTop:!0,children:(0,o.jsx)(To,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:h,setOneBorderRadiusValue:p,elementSettings:i})}),P.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Box shadow"),collapsible:!0,open:d,onToggle:x,dividerTop:!0,children:(0,o.jsx)(vo,{typeOfForm:"mobile",form:e,elementSettings:i})}),P.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Display control & Direction"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e,directionControl:(0,o.jsx)(Vt,{elementSettings:i,form:e,typeOfForm:"mobile"})})}),P.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Co,{})})]})};hl.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 bl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),a=Fo(),d=Fo(),[c,m]=(0,n.useState)({}),[f,g]=(0,n.useState)(!0),[E,h]=(0,n.useState)({}),[p,S]=(0,n.useState)(!0),k=r.useSelector(r.selectEmailViewType),x=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[T,I]=(0,n.useState)(e.backgroundImage[0].value===""),L=r.useSelector(r.selectIsCodeMode),y=r.useSelector(r.selectCodeModeDirection),C=L&&y!=="bottom",[P,K]=(0,n.useState)(!1),[M,$]=(0,n.useState)(!1),[A,W]=(0,n.useState)(!1),[se,R]=(0,n.useState)(!1),[te,he]=(0,n.useState)(!1),[be,Ie]=(0,n.useState)(!1),[xe,Be]=(0,n.useState)(!1),[ke,ne]=(0,n.useState)(!1),[He,Fe]=(0,n.useState)(!1),[Se,ye]=(0,n.useState)(!1),[re,q]=(0,n.useState)(!1),[X,Q]=(0,n.useState)(!1),[Z,U]=(0,n.useState)(!1),[V,J]=(0,n.useState)(!1),[de,me]=(0,n.useState)(!1),[pe,Ae]=(0,n.useState)(""),we=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}];i("Not defined"),i("Contain"),i("Cover");const $e=e.border,Y=e.mobileBorder,le=Object.keys($e).find(O=>$e[O]?.width||$e[O]?.style||$e[O]?.color),Ce=Object.keys(Y).find(O=>Y[O]?.width||Y[O]?.style||Y[O]?.color),G=O=>O&&(O?.width||O?.style||O?.color)?O:"";(0,n.useEffect)(()=>{if(e){const O=e.boxShadow,oe=e.mobileBoxShadow;m(O),h(oe),s.setFieldsValue({...e,width:e.width?.value,widthDim:e.width?.dim,height:e.height?.value,heightDim:e.height?.dim,maxWidth:e.maxWidth?.value,maxWidthDim:e.maxWidth?.dim,minWidth:e.minWidth?.value,minWidthDim:e.minWidth?.dim,backgroundImage:e.backgroundImage[0].value,show:e.show?e.show:"all",borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),mobileBorderAll: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:po(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileHeight:po(e.mobileHeight?.value),mobileHeightDim:e.mobileHeight?.dim,mobileBorderRadiusAll:u(e.mobileBorderRadius.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius.topLeft!==null?e.mobileBorderRadius.topLeft:e.mobileBorderRadius.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius.bottomLeft!==null?e.mobileBorderRadius.bottomLeft:e.mobileBorderRadius.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius.topRight!==null?e.mobileBorderRadius.topRight:e.mobileBorderRadius.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius.bottomRight!==null?e.mobileBorderRadius.bottomRight:e.mobileBorderRadius.all),mobileBoxShadowInset:u(e.mobileBoxShadow?.inset)||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color),mobileAlign:u(e.mobileAlign?.value),mobileVerticalAlign:u(e.mobileVerticalAlign?.value),mobileDirection:u(e.mobileDirection?.value),mobileBackgroundColor:u(e.mobileBackgroundColor?.value!=="none"?e.mobileBackgroundColor?.value:""),...nt(e),mobilePaddingTop:u(e.mobilePadding.all)||u(e.mobilePadding.top),mobilePaddingLeft:u(e.mobilePadding.all)||u(e.mobilePadding.left),mobilePaddingRight:u(e.mobilePadding.all)||u(e.mobilePadding.right),mobilePaddingBottom:u(e.mobilePadding.all)||u(e.mobilePadding.bottom),mobilePaddingTopBottom:u(e.mobilePadding.top)||u(e.mobilePadding.bottom),mobilePaddingLeftRight:u(e.mobilePadding.left)||u(e.mobilePadding.right),exportAsPicture:e?.exportAsPicture}),!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?g(!1):g(!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),I(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)?K(!1):K(!0),!u(e.mobilePadding.all)&&(u(e.mobilePadding.top)||u(e.mobilePadding.right)||u(e.mobilePadding.bottom)||u(e.mobilePadding.left))&&(e.mobilePadding.top!==e.mobilePadding.bottom||e.mobilePadding.right!==e.mobilePadding.left)?$(!1):$(!0);const j=a.isStaleBorderSnapshot(e,!!le),w=d.isStaleBorderSnapshot(e,!!Ce);j&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(w||j&&!Ce)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),W(ue=>le&&!j?!0:ue),R(ue=>le&&!j||Ce&&!w?!0:ue),he(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),Ie(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),Be(!!e.boxShadow),ne(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),Fe(!!e.width.value||!!e.height.value||!!e.minWidth.value||!!e.maxWidth.value),ye(!!e.mobileWidth.value||!!e.mobileHeight.value),q(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Q(Et(e)),U(!!e.exportAsPicture),J(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),me(!!e.mobilePadding.all||!!e.mobilePadding.top||!!e.mobilePadding.bottom||!!e.mobilePadding.left||!!e.mobilePadding.right)}},[s,e,le,Ce,a,d]);const Te=O=>{const oe=s.getFieldsValue(!0),j=Object.keys(O)[0];let w;switch(Ae(s.getFieldsValue(!0).widthDim==="%"?100:""),j){case"exportAsPicture":w={exportAsPicture:oe.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":w={boxShadow:{hOffset:oe.boxShadowHOffset,vOffset:oe.boxShadowVOffset,blurRadius:oe.boxShadowBlurRadius,spreadRadius:oe.boxShadowSpreadRadius,color:oe.boxShadowColor,inset:oe.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":oe.borderPosition==="borderAll"?(w={border:{...r.RESET_BORDER_PARAMS,all:{...z.NULL_BORDER,...oe.borderAll}}},s.setFieldsValue({borderLeft:z.NULL_BORDER,borderRight:z.NULL_BORDER,borderTop:z.NULL_BORDER,borderBottom:z.NULL_BORDER})):oe.borderAll?.width||oe.borderAll?.style||oe.borderAll?.color?(w={border:{all:null,left:oe.borderAll,right:oe.borderAll,top:oe.borderAll,bottom:oe.borderAll,[z.REVERSE_BORDER_POSITIONS[j]]:{...oe[j],...O[j]}}},s.setFieldsValue({borderAll:null,borderLeft:oe.borderAll,borderRight:oe.borderAll,borderTop:oe.borderAll,borderBottom:oe.borderAll,[j]:{...oe[j],...O[j]}})):(w={border:{all:null,left:oe.borderLeft,right:oe.borderRight,top:oe.borderTop,bottom:oe.borderBottom,[z.REVERSE_BORDER_POSITIONS[j]]:{...oe[j],...O[j]}}},s.setFieldsValue({border:w.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(oe.mobileBorderPosition==="mobileBorderAll")w={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...z.NULL_BORDER,...oe.mobileBorderAll,classNamePrefix:"em-mob-border_"+z.MOBILE_REVERSE_BORDER_POSITIONS[j]+"-"}}},s.setFieldsValue({borderLeft:z.NULL_BORDER,borderRight:z.NULL_BORDER,borderTop:z.NULL_BORDER,borderBottom:z.NULL_BORDER});else{const ue=z.MOBILE_REVERSE_BORDER_POSITIONS[j],ve={...oe[j],...O[j]},Xe=!ve?.width&&!ve?.style&&!ve?.color;if(oe.mobileBorder?.all?.width||oe.mobileBorder?.all?.style||oe.mobileBorder?.all?.color){const Ke=oe.mobileBorderAll;w={mobileBorder:{all:null,left:Ke,right:Ke,top:Ke,bottom:Ke,[ue]:Xe?null:{...ve,classNamePrefix:"em-mob-border_"+ue+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:Ke,mobileBorderRight:Ke,mobileBorderTop:Ke,mobileBorderBottom:Ke,[j]:ve})}else{const Ke=e.mobileBorder||{},to=io=>{const co=Ke[io];return co&&(co?.width||co?.style||co?.color)?co:null};w={mobileBorder:{all:null,left:ue==="left"?Xe?null:{...ve,classNamePrefix:"em-mob-border_left-"}:to("left"),right:ue==="right"?Xe?null:{...ve,classNamePrefix:"em-mob-border_right-"}:to("right"),top:ue==="top"?Xe?null:{...ve,classNamePrefix:"em-mob-border_top-"}:to("top"),bottom:ue==="bottom"?Xe?null:{...ve,classNamePrefix:"em-mob-border_bottom-"}:to("bottom")}},s.setFieldsValue({[j]:ve})}}break;case"width":w={[j]:{value:O[j],dim:oe.widthDim}};break;case"height":w={[j]:{value:O[j],dim:oe.heightDim}};break;case"widthDim":w={width:{value:oe.width,dim:O[j]}};break;case"heightDim":w={height:{value:oe.height,dim:O[j]}};break;case"maxWidth":w={[j]:{value:O[j],dim:oe.maxWidthDim}};break;case"maxWidthDim":w={maxWidth:{value:oe.maxWidth,dim:O[j]}};break;case"minWidth":w={[j]:{value:O[j],dim:oe.minWidthDim}};break;case"minWidthDim":w={minWidth:{value:oe.minWidth,dim:O[j]}};break;case"backgroundImage":I(O[j]===""),w={[j]:[{...e.backgroundImage[0],value:O[j]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":w={padding:{[z.PADDING_POSITION[j]]:+O[j]}};break;case"paddingTopBottom":w={padding:{top:+O[j],bottom:+O[j]}},oe.paddingTop=oe.paddingBottom=+O[j];break;case"paddingLeftRight":w={padding:{left:+O[j],right:+O[j]}},oe.paddingLeft=oe.paddingRight=+O[j];break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":w={borderRadius:{[z.BORDER_RADIUS_POSITION[j]]:+O[j]}};break;case"mobileWidth":w={[j]:{classNamePrefix:"em-mob-width-",value:O[j],dim:oe.mobileWidthDim}};break;case"mobileWidthDim":w={mobileWidth:{classNamePrefix:"em-mob-width-",value:oe.mobileWidth||100,dim:O[j]}};break;case"mobileHeight":w={[j]:{classNamePrefix:"em-mob-height-",value:O[j],dim:oe.mobileHeightDim}};break;case"mobileHeightDim":w={mobileHeight:{classNamePrefix:"em-mob-height-",value:oe.mobileHeight,dim:O[j]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":w={mobileBorderRadius:{[z.MOBILE_BORDER_RADIUS_POSITION[j]]:O[j],classNamePrefix:"em-mob-border_radius_"+z.MOBILE_BORDER_RADIUS_POSITION[j]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":w={mobileBoxShadow:{hOffset:oe.mobileBoxShadowHOffset,vOffset:oe.mobileBoxShadowVOffset,blurRadius:oe.mobileBoxShadowBlurRadius,spreadRadius:oe.mobileBoxShadowSpreadRadius,color:oe.mobileBoxShadowColor,inset:oe.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=xt(O),!w)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":w={mobilePadding:{all:null,top:oe.mobilePaddingTop!==""?oe.mobilePaddingTop:null,right:oe.mobilePaddingRight!==""?oe.mobilePaddingRight:null,bottom:oe.mobilePaddingBottom!==""?oe.mobilePaddingBottom:null,left:oe.mobilePaddingLeft!==""?oe.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":oe.mobilePaddingTop=oe.mobilePaddingBottom=O[j],w={mobilePadding:{all:null,top:oe.mobilePaddingTop!==""?oe.mobilePaddingTop:null,right:oe.mobilePaddingRight!==""?oe.mobilePaddingRight:null,bottom:oe.mobilePaddingBottom!==""?oe.mobilePaddingBottom:null,left:oe.mobilePaddingLeft!==""?oe.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":oe.mobilePaddingLeft=oe.mobilePaddingRight=O[j],w={mobilePadding:{all:null,top:oe.mobilePaddingTop!==""?oe.mobilePaddingTop:null,right:oe.mobilePaddingRight!==""?oe.mobilePaddingRight:null,bottom:oe.mobilePaddingBottom!==""?oe.mobilePaddingBottom:null,left:oe.mobilePaddingLeft!==""?oe.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"&&l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:w})},Ne=()=>{K(oe=>!oe);const O=s.getFieldsValue(!0);P||(O.paddingLeftRight=O.paddingLeft,O.paddingTopBottom=O.paddingTop,O.paddingRight=O.paddingLeft,O.paddingBottom=O.paddingTop,l({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}}}))},Pe=()=>{const O=s.getFieldsValue(!0);a.markBorderToggled(!A),setTimeout(()=>{W(oe=>!oe),A?(O.borderAll=z.NULL_BORDER,O.borderTop=z.NULL_BORDER,O.borderBottom=z.NULL_BORDER,O.borderRight=z.NULL_BORDER,O.borderLeft=z.NULL_BORDER):O.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({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}}}})})},Me=()=>{const O=s.getFieldsValue(!0);d.markBorderToggled(!se),setTimeout(()=>{R(oe=>!oe),se?(O.mobileBorderAll=z.NULL_BORDER,O.mobileBorderTop=z.NULL_BORDER,O.mobileBorderBottom=z.NULL_BORDER,O.mobileBorderRight=z.NULL_BORDER,O.mobileBorderLeft=z.NULL_BORDER):O.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({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=s.getFieldsValue(!0);setTimeout(()=>{he(oe=>!oe),te?(O.borderRadiusAll=0,g(!0)):O.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:O.borderRadiusAll}}})})},ze=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{Ie(oe=>!oe),be?(O.mobileBorderRadiusAll=null,S(!0)):O.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:O.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},ce=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{Be(oe=>!oe),xe?(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"),l({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}}})})},fe=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{ne(oe=>!oe),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"),l({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-"}}})})},v=()=>{setTimeout(()=>{Fe(O=>!O)})},ie=()=>{setTimeout(()=>{ye(O=>!O)})},Re=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{q(oe=>!oe),re?(O.backgroundColor="",O.backgroundImage="",O.backgroundPositionX="",O.backgroundPositionY="",O.backgroundRepeat="none",O.backgroundSize="",I(!0)):(O.backgroundColor="#E5E5E5",O.backgroundSize="",O.backgroundRepeat="none"),l({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}})})},Oe=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{Q(oe=>!oe),X?O.mobileBackgroundColor="":O.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:O.mobileBackgroundColor}}}),X&&Bt(s,e,l)})},De=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{U(oe=>!oe),Z&&(O.exportAsPicture=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})},Ge=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{J(oe=>!oe),V&&(O.paddingLeftRight="",O.paddingLeft="",O.paddingRight="",O.paddingTopBottom="",O.paddingTop="",O.paddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},Qe=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{me(oe=>!oe),de&&(O.mobilePaddingLeftRight="",O.mobilePaddingLeft="",O.mobilePaddingRight="",O.mobilePaddingTopBottom="",O.mobilePaddingTop="",O.mobilePaddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobilePadding:{all:null,top:null,right:null,bottom:null,left:null,classNamePrefix:"em-mob-padding_"}}}))})};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_div_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",valign:"",border:"",boxShadow:"",show:"all",borderPosition:z.BORDER_POSITIONS[le]||"borderAll",mobileBorderPosition:z.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:Te,autoComplete:"off",className:"element-controls",children:[!C&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),k==="mobile"&&x.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(hl,{form:s,elementSettings:e,mobileBoxShadow:E,mobileBordersShow:se,mobileBorderRadiusShow:be,mobileBoxShadowShow:ke,mobileSizeShow:Se,mobileBackgroundShow:X,mobilePaddingShow:de,mobilePaddingsExt:M,setMobilePaddingsExt:$,oneMobileBorderRadiusValue:p,setOneMobileBorderRadiusValue:S,toggleShowMobileBorderHandler:Me,toggleShowMobileBorderRadiusHandler:ze,toggleShowMobileBoxShadowHandler:fe,toggleShowMobileSizeHandler:ie,toggleShowMobileBackgroundHandler:Oe,toggleShowMobilePaddingHandler:Qe})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(pl,{form:s,elementSettings:e,boxShadow:c,bordersShow:A,borderRadiusShow:te,boxShadowShow:xe,backgroundShow:re,backgroundImageEmpty:T,backgroundRepeatOptions:we,sizeShow:He,maxWidthValue:pe,modificationShow:Z,paddingShow:V,paddingsExt:P,oneBorderRadiusValue:f,setOneBorderRadiusValue:g,togglePaddingHandler:Ne,toggleShowPaddingHandler:Ge,toggleShowBorderHandler:Pe,toggleShowBorderRadiusHandler:Ue,toggleShowBoxShadowHandler:ce,toggleShowSizeHandler:v,toggleShowBackgroundHandler:Re,toggleShowModificationHandler:De,handleChangeValues:Te})})]})};bl.propTypes={elementSettings:_.default.object.isRequired};var fl=({form:e,elementSettings:i})=>{const{__:l}=r.useI18n(),s=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:"0"},children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Float block width"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"width",children:(0,o.jsx)(t.ui_kit$InputNumber,{min:0,placeholder:l("Float block width"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:(0,o.jsx)(t.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:$o})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Column gap"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gap",children:(0,o.jsx)(t.ui_kit$InputNumber,{min:0,placeholder:l("Column gap"),prefix:(0,o.jsx)(r.EmIcons,{icon:"SplitCellsOutlined",component:t.icons$SplitCellsOutlined}),addonAfter:(0,o.jsx)(t.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:pn})})})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Vertical alignment"),dividerTop:!0,children:(0,o.jsx)(Mo,{form:e,elementSettings:i})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e})}),s.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:l("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Co,{})})]})};fl.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired};var gl=({form:e,elementSettings:i})=>{const{__:l}=r.useI18n(),s=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:20},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Wo,{form:e,name:"mobileWidth",elementSettings:i})}),(0,o.jsx)(t.ui_kit$Col,{span:12})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Alignments"),dividerTop:!0,children:(0,o.jsx)(Mo,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e})}),s.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:l("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Co,{})})]})};gl.propTypes={form:_.default.object.isRequired,elementSettings:_.default.object.isRequired};var Ci=0,_l=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),a=r.useSelector(r.selectEmailViewType),d=r.useSelector(r.selectMobileViewActive),c=r.useSelector(r.selectIsCodeMode),m=r.useSelector(r.selectCodeModeDirection),f=c&&m!=="bottom";(0,n.useEffect)(()=>{e&&(s.setFieldsValue({...e,width:e.width?.value,widthDim:e.width?.dim,gap:e.gap?.value,gapDim:e.gap?.dim,maxWidth:e.maxWidth?.value,maxWidthDim:e.maxWidth?.dim,minWidth:e.minWidth?.value,minWidthDim:e.minWidth?.dim,show:e.show?e.show:"all",mobileWidth:po(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileContentWidth:po(e.mobileContentWidth?.value),mobileContentWidthDim:e.mobileContentWidth?.dim,mobileVerticalAlign:u(e.mobileVerticalAlign?.value)}),Ci=e.width.value+e.gap.value)},[s,e]);const g=E=>{const h=s.getFieldsValue(!0),p=Object.keys(E)[0];let S;switch(p){case"width":Ci=E[p]+h.gap,S={[p]:{value:E[p],dim:h.widthDim},gap:{value:h.gap}};break;case"widthDim":S={width:{value:h.width,dim:E[p]},gap:{value:h.gap}};break;case"gap":h.width=Ci-E[p],S={[p]:{value:E[p],dim:"px"}};break;case"mobileWidth":S={[p]:{classNamePrefix:"em-mob-width-",value:E[p],dim:h.mobileWidthDim}};break;case"mobileWidthDim":S={mobileWidth:{classNamePrefix:"em-mob-width-",value:h.mobileWidth||100,dim:E[p]}};break;case"mobileContentWidth":S={[p]:{classNamePrefix:"em-mob-width-",value:E[p],dim:h.mobileContentWidthDim}};break;case"mobileContentWidthDim":S={mobileContentWidth:{classNamePrefix:"em-mob-width-",value:100,dim:E[p]}};break;case"mobileVerticalAlign":S={[p]:{classNamePrefix:"em-mob-vertical_align-",value:E[p]}};break;default:S=E}l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:S})};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_float_block_form",initialValues:{width:{value:"",dim:""},gap:{value:"",dim:"px"},valign:"",show:"all",mobileWidth:"",mobileWidthDim:"",mobileContentWidth:"",mobileContentWidthDim:"",mobileVerticalAlign:""},onValuesChange:g,autoComplete:"off",className:"element-controls",children:[!f&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),a==="mobile"&&d.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:a==="mobile"&&d.styles?"block":"none"},children:(0,o.jsx)(gl,{form:s,elementSettings:e})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(fl,{form:s,elementSettings:e})})]})};_l.propTypes={elementSettings:_.default.object.isRequired};var xl=({form:e,fillFields:i,elementSettings:l,boxShadow:s,bordersShow:a,borderRadiusShow:d,boxShadowShow:c,backgroundShow:m,backgroundImageEmpty:f,backgroundRepeatOptions:g,paddingShow:E,paddingsExt:h,maxWidthValue:p,oneBorderRadiusValue:S,setOneBorderRadiusValue:k,linkProtocol:x,linkTarget:T,isOpenTextReplacer:I,textReplacerButtonRef:L,textReplacerInputRef:y,handleLinkProtocolsChange:C,handleSelect:P,textReplacerInputHandler:K,handleTextReplacerKeyDown:M,srcButtonHandler:$,togglePaddingHandler:A,toggleShowPaddingHandler:W,toggleShowBackgroundHandler:se,toggleShowBorderHandler:R,toggleShowBorderRadiusHandler:te,toggleShowBoxShadowHandler:he,setLinkProtocol:be,handleChangeValues:Ie})=>{const{__:xe}=r.useI18n(),{token:Be}=(0,t.ui_kit$useToken)(),ke=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:xe("Appearance on mobile devices"),type:"info"}),(0,o.jsxs)("div",{className:"selected_form-props-wrapper",children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Ho,{form:e,elementSettings:l})}),ke.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(tt,{form:e,name:"textAlign",elementSettings:l})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}}),(0,o.jsx)(Zo,{show:x==="#",__:xe,style:{marginBottom:Be.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:xe("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:ke.formButtonFieldReplacerEnabled?Be.formItemMarginBottomXS:Be.formItemMarginBottomMD+4},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Qo,{linkProtocol:x,handleLinkProtocolsChange:C,__:xe}),placeholder:xe("Hyperlink URL"),allowClear:!0,onSelect:P,prefix:(0,o.jsx)(Jo,{linkProtocol:x})})})}),x==="mailto:"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"subject",style:{marginBottom:Be.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:xe("Subject")})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:Be.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:xe("Body")})})]}),ke.formButtonFieldReplacerEnabled&&(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:xe("Text replacer"),placement:"bottom",getPopupContainer:ne=>ne.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":I}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:$,ref:L})})}),(0,o.jsx)(t.ui_kit$Col,{span:21,children:I&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:xe("Text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textReplacer",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:xe("The code that will replace this text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:xe("Text")}),onChange:K,onKeyDown:M,ref:y,onSelect:P})})})})]})}),ke.formButtonFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:xe("Padding"),collapsible:!0,open:E,onToggle:W,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:h,onToggleExtended:A,gutter:Be.marginSM,labels:{horizontal:xe("Horizontal padding"),vertical:xe("Vertical padding"),left:xe("Left padding"),right:xe("Right padding"),top:xe("Top padding"),bottom:xe("Bottom padding"),individual:xe("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:xe("Size"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:p,dimensionSelect:$o,gutter:Be.marginSM,labels:{width:xe("Width"),height:xe("Height"),minWidth:xe("Minimum width"),maxWidth:xe("Maximum width")}})}),(0,o.jsx)(_t,{form:e,fillFields:i,elementSettings:l,showAddParagraph:!1,isButton:!0,setLinkProtocol:be,linkProtocol:x,linkTarget:T}),(0,o.jsxs)(t.ui_kit$FormSection,{title:xe("Background"),collapsible:!0,open:m,onToggle:se,dividerTop:!0,children:[(0,o.jsx)(Ii,{form:e,backgroundImageEmpty:f,appConfig:ke,token:Be,elementSettings:l,backgroundRepeatOptions:g,handleChangeValues:Ie}),(0,o.jsx)(it,{form:e,showBackground:!0})]}),ke.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:xe("Borders"),collapsible:!0,open:a,onToggle:R,dividerTop:!0,children:(0,o.jsx)(z.SelectedElementFormBorder,{form:e,elementSettings:l})}),ke.formFieldBorderRadiusEnabled&&(0,o.jsxs)(t.ui_kit$FormSection,{title:xe("Border radius"),collapsible:!0,open:d,onToggle:te,dividerTop:!0,children:[(0,o.jsx)(To,{form:e,oneBorderRadiusValue:S,setOneBorderRadiusValue:k,elementSettings:l}),(0,o.jsx)(it,{form:e,showRounding:!0})]}),ke.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:xe("Box shadow"),collapsible:!0,open:c,onToggle:he,dividerTop:!0,children:(0,o.jsx)(vo,{})}),ke.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:xe("Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:l,form:e})}),ke.formFieldAmpVisibilityEnabled&&l.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:xe("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Co,{})})]})]})};xl.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 kl=({form:e,fillFields:i,elementSettings:l,boxShadow:s,mobileBordersShow:a,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:m,mobileBackgroundShow:f,mobilePaddingShow:g,mobilePaddingsExt:E,setMobilePaddingsExt:h,oneMobileBorderRadiusValue:p,setOneMobileBorderRadiusValue:S,linkProtocol:k,handleLinkProtocolsChange:x,setLinkProtocol:T,toggleShowMobileBorderHandler:I,toggleShowMobileBorderRadiusHandler:L,toggleShowMobileBoxShadowHandler:y,toggleShowMobileSizeHandler:C,toggleShowMobileBackgroundHandler:P,toggleShowMobilePaddingHandler:K})=>{const{__:M}=r.useI18n(),{token:$}=(0,t.ui_kit$useToken)(),A=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Ho,{form:e,elementSettings:l,imgParent:!0,typeOfForm:"mobile"})}),A.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Mt,{form:e,name:"mobileTextAlign",elementSettings:l,imgParent:!0})})]}),!!l.showOnMobile&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}}),(0,o.jsx)(Zo,{show:k==="#",__:M,style:{marginBottom:$.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:M("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:k==="mailto:"?$.formItemMarginBottomXS:$.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Qo,{linkProtocol:k,handleLinkProtocolsChange:x,__:M}),placeholder:M("Hyperlink URL"),allowClear:!0,prefix:(0,o.jsx)(Jo,{linkProtocol:k})})})}),k==="mailto:"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"subject",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:M("Subject")})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:$.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:M("Body")})})]})]}),!!l.showOnMobile&&(0,o.jsx)(_t,{form:e,fillFields:i,elementSettings:l,setLinkProtocol:T,linkProtocol:k,showAddParagraph:!1,isButton:!0}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Wr,{})})}),A.formButtonFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:M("Padding"),collapsible:!0,open:g,onToggle:K,dividerTop:!0,children:(0,o.jsx)(Ut,{form:e,elementSettings:l,mobilePaddingsExt:E,setMobilePaddingsExt:h})}),(0,o.jsx)(t.ui_kit$FormSection,{title:M("Size"),collapsible:!0,open:m,onToggle:C,dividerTop:!0,bodyStyle:{paddingBottom:$.formItemMarginBottomMD},children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:M("Width"),placement:"bottom",children:(0,o.jsx)(Wo,{form:e,name:"mobileWidth",elementSettings:l})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:M("Height"),placement:"bottom",children:(0,o.jsx)(ot,{form:e,name:"mobileHeight",elementSettings:l})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:M("Background"),collapsible:!0,open:f,onToggle:P,dividerTop:!0,bodyStyle:{paddingBottom:$.formItemMarginBottomMD},children:(0,o.jsx)(St,{elementSettings:zo(l),imageEnabled:A.formButtonFieldBackgroundImageEnabled,desktopBackground:kt(l)})}),A.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:M("Borders"),collapsible:!0,open:a,onToggle:I,dividerTop:!0,children:(0,o.jsx)(z.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),A.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:M("Border radius"),collapsible:!0,open:d,onToggle:L,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:p,setOneBorderRadiusValue:S,elementSettings:l,typeOfForm:"mobile"})}),A.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:M("Box shadow"),collapsible:!0,open:c,onToggle:y,dividerTop:!0,children:(0,o.jsx)(vo,{typeOfForm:"mobile"})}),A.formFieldAmpVisibilityEnabled&&l.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:M("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Co,{})}),A.formFieldAmpVisibilityEnabled&&l.isAmp&&(0,o.jsx)(t.ui_kit$FormSection,{title:M("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Co,{})})]})};kl.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 Hn=Object.freeze({}),El=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),a=Fo(),d=Fo(),c=r.useDispatch(),[m,f]=(0,n.useState)({}),[g,E]=(0,n.useState)(!0),[h,p]=(0,n.useState)(!0),S=r.useSelector(r.selectEmailViewType),k=r.useSelector(r.selectMobileViewActive),[x,T]=(0,n.useState)(e.backgroundImage?.[0].value===""),I=r.useSelector(r.selectIsCodeMode),L=r.useSelector(r.selectCodeModeDirection),y=I&&L!=="bottom",C=(0,n.useRef)(null),P=(0,n.useRef)(null),[K,M]=(0,n.useState)(!1),[$,A]=(0,n.useState)(!1),[W,se]=(0,n.useState)(!1),[R,te]=(0,n.useState)(!1),[he,be]=(0,n.useState)(!1),[Ie,xe]=(0,n.useState)(!1),[Be,ke]=(0,n.useState)(!1),[ne,He]=(0,n.useState)(!1),[Fe,Se]=(0,n.useState)(!1),[ye,re]=(0,n.useState)(!1),[q,X]=(0,n.useState)(!1),[Q,Z]=(0,n.useState)(!1),[U,V]=(0,n.useState)(!1),[J,de]=(0,n.useState)(""),[me,pe]=(0,n.useState)("https://"),[Ae,we]=(0,n.useState)({}),$e=e,[Y,le]=(0,n.useState)(!!$e.textReplacer?.length),[Ce,G]=(0,n.useState)(e);e!==Ce&&(G(e),le(!!$e.textReplacer?.length));const Te=r.useElementEntityKind(),Ne=[{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"}],Pe=e.border,Me=e.mobileBorder,Ue=Object.keys(Pe).find(D=>Pe[D]?.width||Pe[D]?.style||Pe[D]?.color),ze=Object.keys(Me).find(D=>Me[D]?.width||Me[D]?.style||Me[D]?.color),ce=D=>D&&(D?.width||D?.style||D?.color)?D:"",{remember:fe,fillFields:v}=st(e);(0,n.useEffect)(()=>{if(e){const D=e.boxShadow||Hn,ee=e.mobilePadding||{},B=e.mobileAlign||{};f(D);let F="",b="",H=e.href||"https://";if(e.href){if(e.href.startsWith("mailto:")){const Ee=Lr(e.href);F=Ee.subject,b=Ee.body,H=Ee.baseEmail}Uo(e.href,pe)}v(s,{...e,href:H,subject:F,body:b,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:ce(e.mobileBorder.all)||!(ce(e.mobileBorder.top)||ce(e.mobileBorder.bottom)||ce(e.mobileBorder.right)||ce(e.mobileBorder.left))&&ce(e.border.all),mobileBorderTop:ce(e.mobileBorder.top)||!ce(e.mobileBorder.all)&&ce(e.border.top),mobileBorderBottom:ce(e.mobileBorder.bottom)||!ce(e.mobileBorder.all)&&ce(e.border.bottom),mobileBorderRight:ce(e.mobileBorder.right)||!ce(e.mobileBorder.all)&&ce(e.border.right),mobileBorderLeft:ce(e.mobileBorder.left)||!ce(e.mobileBorder.all)&&ce(e.border.left),paddingTop:u(e.padding?.all)||u(e.padding?.top),paddingLeft:u(e.padding?.all)||u(e.padding?.left),paddingRight:u(e.padding?.all)||u(e.padding?.right),paddingBottom:u(e.padding?.all)||u(e.padding?.bottom),paddingLeftRight:u(e.padding?.left)||u(e.padding?.right),paddingTopBottom:u(e.padding?.top)||u(e.padding?.bottom),borderRadiusAll:u(e.borderRadius?.all),borderRadiusTopLeft:u(e.borderRadius?.topLeft),borderRadiusBottomLeft:u(e.borderRadius?.bottomLeft),borderRadiusTopRight:u(e.borderRadius?.topRight),borderRadiusBottomRight:u(e.borderRadius?.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:po(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:po(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:po(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:po(e.mobileHeight?.value)?e.mobileHeight?.dim:e.height?.dim,mobileBorderRadiusAll:u(e.mobileBorderRadius?.all)||u(e.borderRadius?.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius?.topLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topLeft)||u(e.borderRadius?.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius?.bottomLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomLeft)||u(e.borderRadius?.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius?.topRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topRight)||u(e.borderRadius?.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius?.bottomRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomRight)||u(e.borderRadius?.all),mobileBoxShadowInset:e.mobileBoxShadow?.inset!=null?e.mobileBoxShadow.inset:e.boxShadow?.inset||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset)||u(e.boxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset)||u(e.boxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius)||u(e.boxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius)||u(e.boxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color)||u(e.boxShadow?.color),mobileAlign:u(B?.value)||e.align,mobileVerticalAlign:u(e.mobileVerticalAlign?.value||e.valign),mobileBackgroundColor:u(e.mobileBackgroundColor?.value||e.backgroundColor||""),...nt(e),mobilePaddingTop:u(ee.all)||u(ee.top)||u(e.padding?.all)||u(e.padding?.top),mobilePaddingLeft:u(ee.all)||u(ee.left)||u(e.padding?.all)||u(e.padding?.left),mobilePaddingRight:u(ee.all)||u(ee.right)||u(e.padding?.all)||u(e.padding?.right),mobilePaddingBottom:u(ee.all)||u(ee.bottom)||u(e.padding?.all)||u(e.padding?.bottom),mobilePaddingTopBottom:u(ee.top)||u(ee.bottom)||u(e.padding?.top)||u(e.padding?.bottom),mobilePaddingLeftRight:u(ee.left)||u(ee.right)||u(e.padding?.left)||u(e.padding?.right),mobileTextAlign:Or(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))?E(!1):E(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||!u(e.borderRadius.all)&&!u(e.mobileBorderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?p(!1):p(!0),T(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)?M(!1):M(!0),!u(ee.all)&&(u(ee.top)||u(ee.right)||u(ee.bottom)||u(ee.left))&&(ee.top!==ee.bottom||ee.right!==ee.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)?A(!1):A(!0);const ae=a.isStaleBorderSnapshot(e,!!Ue),je=d.isStaleBorderSnapshot(e,!!ze);ae&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(je||ae&&!ze)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),se(Ee=>Ue&&!ae?!0:Ee),te(Ee=>Ue&&!ae||ze&&!je?!0:Ee),be(!!e.borderRadius?.all||!!e.borderRadius?.topLeft||!!e.borderRadius?.bottomLeft||!!e.borderRadius?.topRight||!!e.borderRadius?.bottomRight),xe(!!e.mobileBorderRadius?.all||!!e.mobileBorderRadius?.topLeft||!!e.mobileBorderRadius?.bottomLeft||!!e.mobileBorderRadius?.topRight||!!e.mobileBorderRadius?.bottomRight||!!e.borderRadius?.all||!!e.borderRadius?.topLeft||!!e.borderRadius?.bottomLeft||!!e.borderRadius?.topRight||!!e.borderRadius?.bottomRight),ke(!!e.boxShadow),He(!!e.mobileBoxShadow?.blurRadius||!!e.mobileBoxShadow?.color||!!e.mobileBoxShadow?.hOffset||!!e.mobileBoxShadow?.inset||!!e.mobileBoxShadow?.spreadRadius||!!e.mobileBoxShadow?.vOffset||!!e.boxShadow),Se(!!e.mobileWidth?.value||!!e.mobileHeight?.value||!!e.width.value||!!e.height.value),re(!!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),Et(e)&&X(!0),Z(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),V(!!e.mobilePadding?.all||!!e.mobilePadding?.top||!!e.mobilePadding?.bottom||!!e.mobilePadding?.left||!!e.mobilePadding?.right||!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right)}},[s,e,y,Ue,ze,a,d,v]);const ie=(0,n.useCallback)(D=>{fe(D),c(Te==="email"?r.setElementSettings$1(D):r.setElementSettings(D))},[c,Te,fe]),Re=D=>{const ee=s.getFieldsValue(!0),B=Object.keys(D)[0];let F;switch(de(s.getFieldsValue(!0).widthDim==="%"?100:""),B){case"exportAsPicture":F={exportAsPicture:ee.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":F={boxShadow:{hOffset:ee.boxShadowHOffset,vOffset:ee.boxShadowVOffset,blurRadius:ee.boxShadowBlurRadius,spreadRadius:ee.boxShadowSpreadRadius,color:ee.boxShadowColor,inset:ee.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":ee.borderPosition==="borderAll"?(F={border:{...r.RESET_BORDER_PARAMS,all:{...z.NULL_BORDER,...ee.borderAll}}},s.setFieldsValue({borderLeft:z.NULL_BORDER,borderRight:z.NULL_BORDER,borderTop:z.NULL_BORDER,borderBottom:z.NULL_BORDER})):ee.borderAll?.width||ee.borderAll?.style||ee.borderAll?.color?(F={border:{all:null,left:ee.borderAll,right:ee.borderAll,top:ee.borderAll,bottom:ee.borderAll,[z.REVERSE_BORDER_POSITIONS[B]]:{...ee[B],...D[B]}}},s.setFieldsValue({borderAll:null,borderLeft:ee.borderAll,borderRight:ee.borderAll,borderTop:ee.borderAll,borderBottom:ee.borderAll,[B]:{...ee[B],...D[B]}})):(F={border:{all:null,left:ee.borderLeft,right:ee.borderRight,top:ee.borderTop,bottom:ee.borderBottom,[z.REVERSE_BORDER_POSITIONS[B]]:{...ee[B],...D[B]}}},s.setFieldsValue({border:F.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(ee.mobileBorderPosition==="mobileBorderAll")F={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...z.NULL_BORDER,...ee.mobileBorderAll,classNamePrefix:"em-mob-border_"+z.MOBILE_REVERSE_BORDER_POSITIONS[B]+"-"}}},s.setFieldsValue({borderLeft:z.NULL_BORDER,borderRight:z.NULL_BORDER,borderTop:z.NULL_BORDER,borderBottom:z.NULL_BORDER});else{const ae=z.MOBILE_REVERSE_BORDER_POSITIONS[B],je={...ee[B],...D[B]},Ee=!je?.width&&!je?.style&&!je?.color;if(ee.mobileBorder?.all?.width||ee.mobileBorder?.all?.style||ee.mobileBorder?.all?.color){const Je=ee.mobileBorderAll;F={mobileBorder:{all:null,left:Je,right:Je,top:Je,bottom:Je,[ae]:Ee?null:{...je,classNamePrefix:"em-mob-border_"+ae+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:Je,mobileBorderRight:Je,mobileBorderTop:Je,mobileBorderBottom:Je,[B]:je})}else{const Je=e.mobileBorder||{},no=wo=>{const Po=Je[wo];return Po&&(Po?.width||Po?.style||Po?.color)?Po:null};F={mobileBorder:{all:null,left:ae==="left"?Ee?null:{...je,classNamePrefix:"em-mob-border_left-"}:no("left"),right:ae==="right"?Ee?null:{...je,classNamePrefix:"em-mob-border_right-"}:no("right"),top:ae==="top"?Ee?null:{...je,classNamePrefix:"em-mob-border_top-"}:no("top"),bottom:ae==="bottom"?Ee?null:{...je,classNamePrefix:"em-mob-border_bottom-"}:no("bottom")}},s.setFieldsValue({[B]:je})}}break;case"width":F={[B]:{value:D[B],dim:ee.widthDim}};break;case"height":F={[B]:{value:D[B],dim:ee.heightDim}};break;case"widthDim":F={width:{value:ee.width,dim:D[B]}};break;case"heightDim":F={height:{value:ee.height,dim:D[B]}};break;case"backgroundImage":T(D[B]===""),F={[B]:[{...e.backgroundImage[0],value:D[B]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":F={padding:{left:ee.paddingLeft,right:ee.paddingRight,top:ee.paddingTop,bottom:ee.paddingBottom,[z.PADDING_POSITION[B]]:+D[B]}};break;case"paddingTopBottom":F={padding:{left:ee.paddingLeft,right:ee.paddingRight,top:+D[B],bottom:+D[B]}},ee.paddingTop=ee.paddingBottom=+D[B];break;case"paddingLeftRight":F={padding:{top:ee.paddingTop,bottom:ee.paddingBottom,left:+D[B],right:+D[B]}},ee.paddingLeft=ee.paddingRight=+D[B];break;case"borderRadiusAll":F={borderRadius:{[z.BORDER_RADIUS_POSITION[B]]:+D[B]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":F={borderRadius:{topLeft:ee.borderRadiusTopLeft,bottomLeft:ee.borderRadiusBottomLeft,topRight:ee.borderRadiusTopRight,bottomRight:ee.borderRadiusBottomRight,[z.BORDER_RADIUS_POSITION[B]]:+D[B]}};break;case"mobileWidth":F={[B]:{classNamePrefix:"em-mob-width-",value:D[B],dim:ee.mobileWidthDim}};break;case"mobileWidthDim":F={mobileWidth:{classNamePrefix:"em-mob-width-",value:ee.mobileWidth||100,dim:D[B]}};break;case"mobileHeight":F={[B]:{classNamePrefix:"em-mob-height-",value:D[B],dim:ee.mobileHeightDim},mobileLineHeight:{classNamePrefix:"em-mob-line_height-",value:D[B],dim:ee.mobileHeightDim}};break;case"mobileHeightDim":F={mobileHeight:{classNamePrefix:"em-mob-height-",value:ee.mobileHeight,dim:D[B]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":F={mobileBorderRadius:{[z.MOBILE_BORDER_RADIUS_POSITION[B]]:D[B],classNamePrefix:"em-mob-border_radius_"+z.MOBILE_BORDER_RADIUS_POSITION[B]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":F={mobileBoxShadow:{hOffset:ee.mobileBoxShadowHOffset,vOffset:ee.mobileBoxShadowVOffset,blurRadius:ee.mobileBoxShadowBlurRadius,spreadRadius:ee.mobileBoxShadowSpreadRadius,color:ee.mobileBoxShadowColor,inset:ee.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":F={[B]:{classNamePrefix:"em-mob-table_align-",value:D[B]}};break;case"mobileTextAlign":F={[B]:{classNamePrefix:"em-mob-text_align-",value:D[B]}};break;case"mobileVerticalAlign":F={[B]:{classNamePrefix:"em-mob-vertical_align-",value:D[B]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(F=xt(D),!F)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":F={mobilePadding:{all:null,top:ee.mobilePaddingTop!==""?ee.mobilePaddingTop:null,right:ee.mobilePaddingRight!==""?ee.mobilePaddingRight:null,bottom:ee.mobilePaddingBottom!==""?ee.mobilePaddingBottom:null,left:ee.mobilePaddingLeft!==""?ee.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":ee.mobilePaddingTop=ee.mobilePaddingBottom=D[B],F={mobilePadding:{all:null,top:ee.mobilePaddingTop!==""?ee.mobilePaddingTop:null,right:ee.mobilePaddingRight!==""?ee.mobilePaddingRight:null,bottom:ee.mobilePaddingBottom!==""?ee.mobilePaddingBottom:null,left:ee.mobilePaddingLeft!==""?ee.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":ee.mobilePaddingLeft=ee.mobilePaddingRight=D[B],F={mobilePadding:{all:null,top:ee.mobilePaddingTop!==""?ee.mobilePaddingTop:null,right:ee.mobilePaddingRight!==""?ee.mobilePaddingRight:null,bottom:ee.mobilePaddingBottom!==""?ee.mobilePaddingBottom:null,left:ee.mobilePaddingLeft!==""?ee.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileFontSize":F={[B]:{classNamePrefix:"em-mob-font_size-",value:D[B],dim:ee.mobileFontSizeDim}};break;case"href":let b=et(D[B]);b!==D[B]&&(s.setFieldValue("href",b),ee.href=b),b.startsWith("mailto:")?F={[B]:Si(b,ee.subject,ee.body)}:F={[B]:b},Uo(D[B],pe);break;case"subject":case"body":const H=ee.href||"";if(H.startsWith("mailto:")){const ae=B==="subject"?D[B]:ee.subject,je=B==="body"?D[B]:ee.body;F={href:Si(H,ae,je)}}else return;break;case"backgroundPositionX":case"backgroundPositionY":F={[B]:isNaN(parseFloat(D[B].position))?D[B].position:D[B].position+D[B].unit};break;default:F=D}B!=="borderPosition"&&B!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:F}),B!=="mobileBorderRadiusAll"&&B!=="mobileBorderRadiusTopLeft"&&B!=="mobileBorderRadiusTopRight"&&B!=="mobileBorderRadiusBottomLeft"&&B!=="mobileBorderRadiusBottomRight"&&ie({...e,...F,mobileBorderRadius:{...e.mobileBorderRadius,...F?.mobileBorderRadius},activateSection:null,changeKey:B}))},Oe=()=>{M(ee=>!ee);const D=s.getFieldsValue(!0);K||(D.paddingLeftRight=D.paddingLeft,D.paddingTopBottom=D.paddingTop,D.paddingRight=D.paddingLeft,D.paddingBottom=D.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:D.paddingTopBottom,bottom:D.paddingTopBottom,left:D.paddingLeftRight,right:D.paddingLeftRight}}}))},De=()=>{const D=s.getFieldsValue(!0);a.markBorderToggled(!W),setTimeout(()=>{se(ee=>!ee),W?(D.borderAll=z.NULL_BORDER,D.borderTop=z.NULL_BORDER,D.borderBottom=z.NULL_BORDER,D.borderRight=z.NULL_BORDER,D.borderLeft=z.NULL_BORDER):D.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:D.borderAll.color,style:D.borderAll.style,width:D.borderAll.width}}}})})},Ge=()=>{const D=s.getFieldsValue(!0);d.markBorderToggled(!R),setTimeout(()=>{te(ee=>!ee),R?(D.mobileBorderAll=z.NULL_BORDER,D.mobileBorderTop=z.NULL_BORDER,D.mobileBorderBottom=z.NULL_BORDER,D.mobileBorderRight=z.NULL_BORDER,D.mobileBorderLeft=z.NULL_BORDER):D.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:D.mobileBorderAll.color,style:D.mobileBorderAll.style,width:D.mobileBorderAll.width}}}})})},Qe=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{be(ee=>!ee),he?(D.borderRadiusAll=0,E(!0)):D.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:D.borderRadiusAll}}})})},O=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{xe(ee=>!ee),Ie?(D.mobileBorderRadiusAll=null,p(!0)):D.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:D.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},oe=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{ke(ee=>!ee),Be?(D.boxShadowInset=!1,D.boxShadowHOffset=null,D.boxShadowVOffset=null,D.boxShadowBlurRadius=null,D.boxShadowSpreadRadius=null,D.boxShadowColor=""):(D.boxShadowInset=!1,D.boxShadowHOffset=5,D.boxShadowVOffset=5,D.boxShadowBlurRadius=10,D.boxShadowSpreadRadius=-5,D.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:D.boxShadowBlurRadius,color:D.boxShadowColor,hOffset:D.boxShadowHOffset,inset:D.boxShadowInset,spreadRadius:D.boxShadowSpreadRadius,vOffset:D.boxShadowVOffset}}})})},j=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{He(ee=>!ee),ne?(D.mobileBoxShadowInset=!1,D.mobileBoxShadowHOffset=null,D.mobileBoxShadowVOffset=null,D.mobileBoxShadowBlurRadius=null,D.mobileBoxShadowSpreadRadius=null,D.mobileBoxShadowColor=""):(D.mobileBoxShadowInset=!1,D.mobileBoxShadowHOffset=5,D.mobileBoxShadowVOffset=5,D.mobileBoxShadowBlurRadius=10,D.mobileBoxShadowSpreadRadius=-5,D.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:D.mobileBoxShadowBlurRadius,color:D.mobileBoxShadowColor,hOffset:D.mobileBoxShadowHOffset,inset:D.mobileBoxShadowInset,spreadRadius:D.mobileBoxShadowSpreadRadius,vOffset:D.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},w=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{Se(ee=>!ee),Fe&&(D.mobileWidth="",D.mobileHeight="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"},mobileHeight:{value:null,dim:"px",classNamePrefix:"em-mob-height-"}}}))})},ue=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{re(ee=>!ee),ye?(D.backgroundColor="",D.backgroundImage="",D.backgroundPositionX="",D.backgroundPositionY="",D.backgroundRepeat="none",D.backgroundSize="",T(!0)):(D.backgroundColor="#E5E5E5",D.backgroundSize="",D.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:D.backgroundColor,backgroundImage:[{type:"url",value:D.backgroundImage}],backgroundPositionX:D.backgroundPositionX,backgroundPositionY:D.backgroundPositionY,backgroundRepeat:D.backgroundRepeat,backgroundSize:D.backgroundSize}})})},ve=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{X(ee=>!ee),q?D.mobileBackgroundColor="":D.mobileBackgroundColor=e.commonStyles.buttons.backgroundColor||"#1C52DC",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:D.mobileBackgroundColor}}}),q&&Bt(s,e,l)})},Xe=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{Z(ee=>!ee),Q&&(D.paddingLeftRight="",D.paddingLeft="",D.paddingRight="",D.paddingTopBottom="",D.paddingTop="",D.paddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},Ke=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{V(ee=>!ee),U&&(D.mobilePaddingLeftRight="",D.mobilePaddingLeft="",D.mobilePaddingRight="",D.mobilePaddingTopBottom="",D.mobilePaddingTop="",D.mobilePaddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobilePadding:{all:null,top:null,right:null,bottom:null,left:null,classNamePrefix:"em-mob-padding_"}}}))})},to=D=>{s.setFieldValue("href",D!=="mergetag"?D:""),pe(D)},io=(0,n.useCallback)(({target:D})=>{if(!D)return;const{selectionStart:ee,selectionEnd:B}=D;we(F=>F.target===D&&F.selection?.start===ee&&F.selection?.end===B?F:{target:D,selection:{start:ee,end:B}})},[]),co=D=>{D.target.value!==""&&P.current.classList.add("selected-td-form__button--active")},Eo=()=>{le(!Y),Y?(s.setFieldValue("textReplacer",""),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{textReplacer:""}})):setTimeout(()=>C.current.focus())},xo=D=>{const ee=D.target,B=ee.value,F=ee.selectionStart;if(F===0&&D.key===" "){D.preventDefault();return}if(D.key===" "){if(F!==B.length){D.preventDefault();return}B.endsWith(" ")&&D.preventDefault()}};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_button_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",align:"",valign:"",border:"",boxShadow:"",show:"all",borderPosition:z.BORDER_POSITIONS[Ue]||"borderAll",mobileBorderPosition:z.MOBILE_BORDER_POSITIONS[ze]||"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:Re,autoComplete:"off",className:"element-controls",children:[!y&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),y?(0,o.jsx)(yi,{form:s,elementSettings:e,showAddParagraph:!1,isButton:!0}):(0,o.jsx)(o.Fragment,{children:S==="mobile"&&k.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(kl,{form:s,fillFields:v,elementSettings:e,boxShadow:m,mobileBordersShow:R,mobileBorderRadiusShow:Ie,mobileBoxShadowShow:ne,mobileSizeShow:Fe,mobileBackgroundShow:q,mobilePaddingShow:U,mobilePaddingsExt:$,setMobilePaddingsExt:A,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:p,linkProtocol:me,handleLinkProtocolsChange:to,setLinkProtocol:pe,toggleShowMobileBorderHandler:Ge,toggleShowMobileBorderRadiusHandler:O,toggleShowMobileBoxShadowHandler:j,toggleShowMobileSizeHandler:w,toggleShowMobileBackgroundHandler:ve,toggleShowMobilePaddingHandler:Ke})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(xl,{form:s,fillFields:v,elementSettings:e,boxShadow:m,bordersShow:W,borderRadiusShow:he,boxShadowShow:Be,backgroundShow:ye,backgroundImageEmpty:x,backgroundRepeatOptions:Ne,paddingShow:Q,paddingsExt:K,maxWidthValue:J,oneBorderRadiusValue:g,setOneBorderRadiusValue:E,linkProtocol:me,linkTarget:Ae,isOpenTextReplacer:Y,textReplacerButtonRef:P,textReplacerInputRef:C,handleLinkProtocolsChange:to,handleSelect:io,textReplacerInputHandler:co,handleTextReplacerKeyDown:xo,srcButtonHandler:Eo,togglePaddingHandler:Oe,toggleShowPaddingHandler:Xe,toggleShowBackgroundHandler:ue,toggleShowBorderHandler:De,toggleShowBorderRadiusHandler:Qe,toggleShowBoxShadowHandler:oe,setLinkProtocol:pe,handleChangeValues:Re})})})]})};El.propTypes={elementSettings:_.default.object.isRequired};var Bl=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm(),s=r.useSendPostMessage();(0,n.useEffect)(()=>{e&&l.setFieldsValue({...e})},[l,e]);const a=d=>{s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:d})};return(0,o.jsx)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_variable_form",initialValues:{value:""},onValuesChange:a,autoComplete:"off",children:(0,o.jsx)(t.ui_kit$Form.Item,{label:i("Variable value"),name:"value",tooltip:{title:i("Type the output parameters of your platform. E.g., ")+"${Recipient.FirstName}",icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},style:{marginBottom:35},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:4,placeholder:i("Variable value")})})})};Bl.propTypes={elementSettings:_.default.object.isRequired};function Un(e,i){const l=`selected_${e}_form_images_`,s=i.startsWith(l)?l:`selected_${e}_form_`;return i.startsWith(s)?i.slice(s.length):i}function Wn(e){const i=/^(.+)_(\d+)$/.exec(e);return i?{key:i[1],index:Number(i[2])}:void 0}function zn(e,i,l){return(e??[]).map((s,a)=>a===i.index?{...s,[i.key]:l}:s)}function Sl(e){return(e??[]).map((i,l)=>({...i,slideIndex:l}))}var Tl=({elementSettings:e,setElementSettings:i,postfix:l="",form:s,handleSelect:a,previewReloadSignal:d})=>{const{__:c}=r.useI18n(),{token:m}=(0,t.ui_kit$useToken)(),f=r.useAppConfig(),g=r.useSendPostMessage(),E="src"+l,h="title"+l,p="alt"+l,S="link"+l,k="imgReplacer"+l,x=(0,n.useRef)(null),T=(0,n.useRef)(null),I=(0,n.useRef)(null),L=(0,n.useRef)(null),y=(0,n.useRef)(null),C=(0,n.useRef)(null),P=(0,n.useRef)(null),K=(0,n.useRef)(null),[M,$]=(0,n.useState)(""),[A,W]=(0,n.useState)(""),[se,R]=(0,n.useState)(""),[te,he]=(0,n.useState)(!1),[be,Ie]=(0,n.useState)("https://"),xe=(0,n.useRef)(!1),Be=(0,n.useRef)(l);(0,n.useEffect)(()=>{l!==Be.current&&(Be.current=l,xe.current=!1),W(e.images?.[p]),R(e.images?.[h]);const Z=e.images?.[S];$(Z||(xe.current?"...":""))},[e,p,h,S,l]);const ke=()=>{M?(xe.current=!1,$(""),s.setFieldValue(S,""),g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[S]:""}})):(xe.current=!0,$(x.current&&x.current.input.value?x.current.input.value:"..."),setTimeout(()=>{x.current.focus()}))},ne=Z=>{Z.target.value===""?$("..."):(T.current.classList.add("selected-td-form__button--active"),$(Z.target.value));const U=Z.target.value;Uo(U,Ie)},He=()=>{A?(W(""),s.setFieldValue("alt",""),g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[p]:""}})):(W(I.current&&I.current.input.value?I.current.input.value:"..."),setTimeout(()=>{I.current.focus()}))},Fe=Z=>{Z.target.value===""?W("..."):(L.current.classList.add("selected-td-form__button--active"),W(Z.target.value))},Se=()=>{se?(R(!1),s.setFieldValue("title",""),g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[h]:""}})):(R(y.current&&y.current.input.value?y.current.input.value:"..."),setTimeout(()=>{y.current.focus()}))},ye=()=>{he(!te),te?(s.setFieldValue(k,""),g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[k]:""}})):setTimeout(()=>P.current.focus())},re=Z=>{Z.target.value!==""&&K.current.classList.add("selected-td-form__button--active")},q=Z=>{Z.target.value===""?R("..."):(C.current.classList.add("selected-td-form__button--active"),R(Z.target.value))},X=Z=>{s.setFieldValue("LinkName",Z!=="mergetag"?Z:""),Ie(Z)},Q=Z=>{const U=s.getFieldsValue(!0),V=+l.substring(1),J=Object.keys(U?.images).reduce((me,pe)=>(pe.includes(l)||(me[pe]=U[pe]),me),{}),de=e.carouselImages?.filter((me,pe)=>pe!==V);i(me=>({...me,settings:{...me.settings,carouselImages:Sl(de)}})),g({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:e.caption,settings:{...e,carouselImages:de}}),s.setFieldsValue({images:J})};return(0,o.jsxs)(o.Fragment,{children:[(e.type==="img"||e.type==="video"||e.type==="carousel")&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,o.jsx)(No,{form:s,label:c("Image path"),name:E,placeholder:c("Image path"),elementSettings:e,previewReloadSignal:d,tooltipTitle:""})}),(0,o.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:A||c("Alternative text"),placement:"bottom",getPopupContainer:Z=>Z.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!A}),onClick:He,ref:L,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),f.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:se||c("Tooltip text"),placement:"bottom",getPopupContainer:Z=>Z.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!se}),onClick:Se,ref:C,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:M||c("Hyperlink URL"),placement:"bottom",getPopupContainer:Z=>Z.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":!!M}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:ke,ref:T})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:c("Image replacer"),placement:"bottom",getPopupContainer:Z=>Z.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":te}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:ye,ref:K})})]}),(0,o.jsx)(t.ui_kit$Space,{size:8,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:c("Remove slide"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{type:"text",onClick:Q,icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16})})})})]}),(!!M||!!A||!!se||!!te)&&(0,o.jsxs)("div",{children:[!!M&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Zo,{show:be==="#",__:c,style:{marginBottom:m.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:S,className:"selected-image-form__alt",style:{marginTop:m.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Qo,{linkProtocol:be,handleLinkProtocolsChange:X,__:c}),placeholder:c("Hyperlink URL"),allowClear:!0,ref:x,onChange:ne,onSelect:a,prefix:(0,o.jsx)(Jo,{linkProtocol:be})})})})]}),!!A&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:p,className:"selected-image-form__alt",style:{marginTop:m.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:c("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:Fe,ref:I,onSelect:a})})}),f.formFieldImageTitleEnabled&&!!se&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:h,className:"selected-image-form__alt",style:{marginTop:m.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:c("Enter the title of the image"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:q,ref:y,onSelect:a})})}),!!te&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Image src"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:k,className:"selected-image-form__alt",style:{marginTop:m.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:c("Code that will replace the image `src`"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:c("Image src")}),onChange:re,ref:P,onSelect:a})})})]})]})};Tl.propTypes={};var Rl=({form:e,elementSettings:i,formFields:l,setElementSettings:s,borderRadiusShow:a,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,linkProtocol:m,mergeTagItems:f,mergeMenuOpen:g,setMergeMenuOpen:E,cascaderRef:h,handleLinkProtocolsChange:p,handleSelect:S,onChange:k,filter:x,renderSearchOption:T,toggleShowBorderRadiusHandler:I,setNewSlide:L})=>{const{__:y}=r.useI18n(),{token:C}=(0,t.ui_kit$useToken)(),P=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Zo,{show:m==="#",__:y,style:{marginBottom:C.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:y("Link for all slides"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(Qo,{linkProtocol:m,handleLinkProtocolsChange:p,__:y}),placeholder:y("Link for all slides"),allowClear:!0,onSelect:S,prefix:(0,o.jsx)(Jo,{linkProtocol:m})})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),P.mergeTagsShow&&f&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Col,{span:24,id:"merge_tags_wrapper",children:(0,o.jsxs)(t.ui_kit$Form.Item,{style:{marginBottom:C.formItemMarginBottomMD,marginTop:C.formItemMarginBottomMD},children:[(0,o.jsx)(t.ui_kit$Button,{id:"merge_tags_button",icon:(0,o.jsx)(r.EmIcons,{icon:"MergeTags",component:t.icons$MergeTags}),style:{width:"100%",display:g?"none":"inline-flex"},onClick:()=>E(!0),children:y("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:h,classNames:{popup:{root:"merge-tags"}},options:f,placeholder:y("Start typing the title"),showSearch:{filter:x,render:T},spellCheck:"false",getPopupContainer:K=>K.closest(".email-pane__collapse-wrapper"),onChange:k,style:{display:g?"block":"none"},open:g,onKeyDown:K=>{K.key==="Escape"&&E(!1)}})]})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"})]}),(0,o.jsx)(t.ui_kit$Form.List,{name:"images",initialValue:l?.images,children:()=>(0,o.jsx)("div",{style:{paddingTop:C.formItemMarginBottomMD+4},children:i?.settings?.carouselImages?.map((K,M)=>(0,o.jsx)("div",{className:"carousel__slide",children:(0,o.jsx)(Tl,{elementSettings:l,setElementSettings:s,postfix:"_"+M,form:e,handleSelect:S})},M))})}),(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:C.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Button,{id:"add_slide_button",icon:(0,o.jsx)(r.EmIcons,{icon:"AddSlide",component:t.icons$AddSlide}),style:{width:"100%"},onClick:()=>L(),children:y("Add slide")})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{marginTop:C.formItemMarginBottomMD-10},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"loop",valuePropName:"checked",style:{marginBottom:C.formItemMarginBottomMD-6},children:(0,o.jsx)(t.ui_kit$Switch,{id:"Loop",label:y("Loop"),size:"small",labelStyle:{position:"relative",top:2}})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"autoplay",valuePropName:"checked",style:{marginBottom:C.formItemMarginBottomMD-6},children:(0,o.jsx)(t.ui_kit$Switch,{id:"Autoplay",label:y("Autoplay"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),P.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Border radius"),collapsible:!0,open:a,onToggle:I,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,elementSettings:i.settings})})]})};Rl.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 yl=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("p",{children:e("No properties to edit.")})})};yl.propTypes={};var Gn={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 Yn(e){const i={...Ti(e)};return delete i.parent,delete i.path,delete i.nextElem,delete i.prevElem,i}var wl=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm();let s=r.useDispatch();r.useAppConfig();const a=r.useSendPostMessage(),d=r.useSendPostMessageEx(),{openImagePicker:c}=r.useImagePicker(),m=r.useSelector(r.selectEmailViewType),f=r.useSelector(r.selectMobileViewActive),[g,E]=(0,n.useState)(!0),[h,p]=(0,n.useState)(!0),[S,k]=(0,n.useState)(!1),[x,T]=(0,n.useState)(!1),[I,L]=(0,n.useState)("https://"),[y,C]=(0,n.useState)(l?.getFieldsValue(!0)),[P,K]=(0,n.useState)(e),{remember:M,isOwnEcho:$}=Vr(Yn),[A,W]=(0,n.useState)(e);e!==A&&(W(e),$(e?.settings)||K(e));const[se,R]=(0,n.useState)({name:"",counter:0}),[te,he]=(0,n.useState)(null),[be,Ie]=(0,n.useState)(),[xe,Be]=(0,n.useState)(!1),[ke,ne]=(0,n.useState)(!1),[He,Fe]=(0,n.useState)({start:0,end:0}),Se=(0,n.useRef)(null),ye=`selected_${P.type}_form_link`,re=r.useSelector(r.selectIsCodeMode),q=r.useSelector(r.selectCodeModeDirection),X=re&&q!=="bottom";(0,n.useEffect)(()=>{xe&&Se.current&&Se.current.focus()},[xe]);const Q=(G,Te)=>{const Ne=document.getElementById(Te);if(Ne){const Pe=P,Me=Un(Pe.type,Te),Ue=Wn(Me),ze=Ne.value?.substring(0,He.start),ce=Ne.value?.substring(He.end);let fe={[Me]:ze+G+ce};Ue?fe={carouselImages:zn(Pe.settings?.carouselImages,Ue,ze+G+ce)}:P.type===r.ELEMENT_TYPES.CAROUSEL&&ye===Te&&(fe={[Me]:ze+G+ce,carouselImages:[...P.settings?.carouselImages.map(v=>({...v,link:ze+G+ce}))||[]]}),a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...P.settings,...fe}}),K(v=>({...v,settings:{...v.settings,...fe}})),l.setFieldValue(Me,ze+G+ce),Ne.focus(),setTimeout(()=>{Ne.selectionStart=He.start,Ne.selectionEnd=He.start+G.length},400),ne(!0)}},Z=r.useAppConfig().mergeTags;(0,n.useEffect)(()=>{Z?.items?.length&&Ie(r.mapMargeTags(Z.items))},[Z,Ie]);const U=(G,Te)=>{if(Be(!1),G){const Ne=Z.syntax.length>1?be.findIndex(Ue=>Ue.key===Te[0].key):0,Pe=Z.syntax[Ne].replace("%value%",G[G.length-1]),Me=`selected_${P.type}_form${P.type==="carousel"?"_images":""}`;["imgReplacer","title","alt","src","link"].some(Ue=>te?.getAttribute("id").includes(`${Me}_${Ue}`))||te?.getAttribute("id").includes(ye)?Q(Pe,te?.getAttribute("id")):(l.setFieldValue("imgReplacer",Pe),a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...P.settings,imgReplacer:Pe}}),K(Ue=>({...Ue,settings:{...Ue.settings,imgReplacer:Pe}})))}},V=r.useRootElement();(0,n.useEffect)(()=>{const G=({target:Pe})=>{Pe.closest('[id="merge_tags_wrapper"]')||he(Pe)},Te=({target:Pe})=>{!Pe.closest(".merge-tags")&&!Pe.closest("#merge_tags_button")&&Be(!1)},Ne=new fo.Disposable;return Ne.addDisposable(r.addWindowListenerFromShadow(V,"focusin",G)),Ne.addDisposable(r.addWindowListenerFromShadow(V,"click",Te)),()=>{Ne.dispose()}},[V]);const J=(G,Te)=>Te.some(Ne=>Ne.label.toLowerCase().indexOf(G.toLowerCase())>-1),de=(G,Te)=>{const Ne=Te.map((Pe,Me)=>{const Ue=Pe.label.split(new RegExp(`(${G})`,"gi"));return(0,o.jsxs)("span",{children:[Me!==0&&(0,o.jsx)("span",{children:" / "}),Ue.map((ze,ce)=>ze.toLowerCase()===G.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:ze},ce):ze)]},Pe.value)});return(0,o.jsx)("div",{title:Te.map(Pe=>Pe.label).join(" / "),children:Ne})};(0,n.useEffect)(()=>{const G=l?.getFieldsValue(!0);C(G)},[l]);const me=({target:G})=>{if(G&&!ke){const{selectionStart:Te,selectionEnd:Ne}=G;Fe({start:Te,end:Ne})}ne(!1)};(0,n.useEffect)(()=>{if(P.settings){const G=P.settings,Te=Ti(G);l?.setFieldsValue(Te),C(Te),G.link&&L(Ft(G.link,"https://")),u(G.borderRadius?.all)||(u(G.borderRadius?.topLeft)||u(G.borderRadius?.bottomLeft)||u(G.borderRadius?.topRight)||u(G.borderRadius?.bottomRight)?E(!1):u(G.borderRadius?.all)||E(!0)),u(G.mobileBorderRadius?.topLeft)||u(G.mobileBorderRadius?.bottomLeft)||u(G.mobileBorderRadius?.topRight)||u(G.mobileBorderRadius?.bottomRight)?p(!1):p(!0),k(!!G.borderRadius?.all||!!G.borderRadius?.topLeft||!!G.borderRadius?.bottomLeft||!!G.borderRadius?.topRight||!!G.borderRadius?.bottomRight),T(!!G.mobileBorderRadius?.all||!!G.mobileBorderRadius?.topLeft||!!G.mobileBorderRadius?.bottomLeft||!!G.mobileBorderRadius?.topRight||!!G.mobileBorderRadius?.bottomRight)}},[l,P]);const pe=G=>{const Te=$r(P.settings,l,G);a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:Te.caption,settings:Te}),M({...P.settings,...Te}),K(Ne=>({...Ne,settings:{...Ne.settings,...Te}}))},Ae=(G,Te)=>{const Ne=r.stripEmVersionFromUrlString(P.settings?.src||"")===r.stripEmVersionFromUrlString(G||"");(!Ne||G!==P.settings?.src)&&pe({src:G}),Te?.mode==="save"&&Ne&&(R(Pe=>({name:"src",counter:Pe.counter+1})),d(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(G)}))},we=async G=>{const Te=P.settings?.src||"",Ne=r.stripEmVersionFromUrlString(Te),Pe=await c({kind:"img",currentUrl:gt(Ne)?"":Ne,entryModal:G});Pe?.url&&Ae(Pe.url,Pe.meta)},$e=G=>{const Te=G.data.operation;Te===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_AI):Te===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):Te===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):Te===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):Te===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK):Te===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(s(r.closeSecondModal()),s(r.closeModal$1()))};r.useListenPostMessage($e);const Y=()=>{setTimeout(()=>{k(G=>!G),l.setFieldValue("borderRadiusAll",S?0:5),a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...P.settings,borderRadius:{all:S?"":5}}}),K(G=>({...G,settings:{...G.settings,borderRadius:{all:S?null:5}}}))})},le=G=>{l.setFieldValue("link",G!=="mergetag"?G:""),L(G)},Ce=()=>{const{width:G,height:Te,renderedWidth:Ne,renderedHeight:Pe}=P?.settings?.carouselImages[0]||{width:{value:600},height:{value:600},renderedWidth:600,renderedHeight:600},Me={src:"https://emcdn.ru/1865/231031_17_BGU9Mso.png",width:{value:G.value,dim:"px"},height:{value:Te.value,dim:"px"},alt:"",title:"",link:null,renderedWidth:Ne,renderedHeight:Pe,imgReplacer:"",mobileWidth:{value:null,dim:"px"},mobileHeight:{value:null,dim:"px"},mobileBorderRadius:{all:null,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}},Ue=[...P?.settings?.carouselImages,Me];a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...P.settings,carouselImages:Ue}});const ze=Sl(Ue);K(ce=>({...ce,settings:{...ce.settings,carouselImages:ze}}))};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_carousel_form",initialValues:Gn,onValuesChange:pe,autoComplete:"off",className:"element-controls",children:[!X&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),m==="mobile"&&f.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(yl,{})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Rl,{form:l,elementSettings:P,formFields:y,setElementSettings:K,borderRadiusShow:S,oneBorderRadiusValue:g,setOneBorderRadiusValue:E,linkProtocol:I,mergeTagItems:be,mergeMenuOpen:xe,setMergeMenuOpen:Be,cascaderRef:Se,handleLinkProtocolsChange:le,handleSelect:me,onChange:U,filter:J,renderSearchOption:de,toggleShowBorderRadiusHandler:Y,setNewSlide:Ce})})]})};wl.propTypes={};var Xn={animate:!0,expandSingleSection:!0,sections:[{expanded:!1,index:0}]},jl=({elementSettings:e})=>{const{__:i}=r.useI18n(),{token:l}=(0,t.ui_kit$useToken)(),[s]=t.ui_kit$Form.useForm(),a=r.useSendPostMessage(),d=r.useAppConfig(),[c,m]=(0,n.useState)(e),[f,g]=(0,n.useState)(e);e!==f&&(g(e),m(e)),(0,n.useEffect)(()=>{if(c.settings){const S=c.settings,k=Ti(S);s?.setFieldsValue(k)}},[s,c]);const E=S=>{const k=$r(c.settings,s,S);a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:c.type,caption:k.caption,settings:k}),m(x=>({...x,settings:{...x.settings,...k}}))},h=()=>{m(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.")}})},p=S=>{m(k=>({...k,settings:{...k.settings,sections:c.settings.sections?.filter((x,T)=>T!==S)}})),a({operation:r.EVENT_TYPES.SANDBOX_ACCORDION_REMOVE_SECTION,settings:{index:S}})};return(0,o.jsx)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_carousel_form",initialValues:Xn,onValuesChange:E,autoComplete:"off",className:"element-controls",children:(0,o.jsxs)("div",{id:"selected_element_form_desktop_props",children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,children:[(0,o.jsx)(t.ui_kit$Col,{span:15,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"expandSingleSection",valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:"ExpandSingleSection",label:i("Expand only one section"),size:"small",labelStyle:{position:"relative",top:2}})})}),(0,o.jsx)(t.ui_kit$Col,{span:9,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"animate",valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:"Animate",label:i("Animate"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,o.jsx)(t.ui_kit$Form.List,{name:"sections",children:()=>(0,o.jsx)("div",{style:{paddingTop:l.formItemMarginBottomMD+4},children:c?.settings?.sections?.map((S,k)=>(0,o.jsxs)(t.ui_kit$Row,{gutter:24,children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsxs)(t.ui_kit$Space,{size:10,align:"baseline",children:[(0,o.jsx)("span",{style:{position:"relative",top:2},children:i("Section ")+(k+1)}),(0,o.jsx)(t.ui_kit$Form.Item,{name:`expanded_${k}`,valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:`expanded_${k}`,label:i("expanded"),labelSize:"small",size:"small"})})]})}),(0,o.jsx)(t.ui_kit$Col,{children:c?.settings?.sections?.length>1&&(0,o.jsx)(t.ui_kit$Button,{type:"text",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16}),style:{marginRight:"auto"},onClick:()=>p(k)})})]},`expanded_${k}`))})}),(0,o.jsx)(t.ui_kit$Row,{gutter:20,children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:l.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Button,{style:{display:"inline-flex",alignItems:"center",width:"100%"},icon:(0,o.jsx)(r.EmIcons,{icon:"PlusCircleOutlined",component:t.icons$PlusCircleOutlined,size:16,strokeWidth:d.iconStrokeWidth}),onClick:()=>h(),children:i(" Add section")})})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"})]})})};jl.propTypes={};var{Text:Kn}=t.ui_kit$Typography,qn="em",vl="text/plain",Jn=(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),Qn=(0,o.jsx)("span",{className:"addon-text-content",children:"Title"});function Ao(e){return e.closest(".email-pane__collapse-wrapper")}function Wt({form:e,name:i,placeholder:l,usedColors:s,onColorChange:a}){const d=t.ui_kit$Form.useWatch(i,e);return(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l,usedColors:s,value:typeof d=="string"?d:"",onChange:c=>a(i,c)})}var Zn=/^[a-z][a-z0-9+.-]*:/i;function Il(e){const i=et(typeof e=="string"?e:String(e??""));return i?Zn.test(i)?i:`https://${i}`:""}function ed(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 od(e){const i=Il(e);if(!i)return!1;try{const l=new URL(i);return!(l.protocol!=="http:"&&l.protocol!=="https:"||!l.hostname)}catch{return!1}}async function Cl(e,i){if(i===r.MODALS.UPLOAD_IMAGE_MODAL_EDIT&>(e)){try{const l=new URL(e,typeof window<"u"&&window.location?window.location.origin:"http://localhost").href,s=await fetch(l);if(s.ok){const a=await s.blob();return{entryModal:i,currentUrl:"",imageDataUrl:await new Promise((d,c)=>{const m=new FileReader;m.onload=()=>d(m.result),m.onerror=c,m.readAsDataURL(a)})}}}catch{}return{entryModal:r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,currentUrl:""}}return{entryModal:i,currentUrl:e}}function td(){const e=r.useSelector(r.selectEditorThemeColor$1),[i,l]=(0,n.useState)(()=>typeof document<"u"&&document.body.classList.contains("dark"));return(0,n.useEffect)(()=>{const s=()=>l(document.body.classList.contains("dark"));s();const a=new MutationObserver(s);return a.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>a.disconnect()},[]),e==="vs-dark"||i?"dark":"light"}function id(e){const i=String(e?.bgColor??"").trim();return{blockBgEnabled:!!(e?.bgEnabled&&i),blockBgColor:i}}function zt(e,i,l){return{...e,buttonBgColor:i,hostCellBgForIconLuminance:String(l??"").trim()}}function Pl(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 Al(e){if(!Array.isArray(e)||e.length===0)return"";const i=e.map(s=>s.customIcon?"":String(s?.itemBorderColor??"").trim()),l=i[0];return i.every(s=>s===l)?l:""}function Gt(e,i){const l=String(e??"").trim(),s=String(i??"").trim();return s||l}function rd(e,i){const l=String(e??"").trim(),s=String(i??"").trim();return!s||l&&s===l?"":s}function ld(e,i,l){const s=String(e??"").trim(),a=String(i??"").trim(),d=String(l??"").trim();return d&&(!s||d!==s)?d:a}function sd(e,i){return(e||[]).map(l=>({...l,itemBorderColor:l.customIcon?"":i}))}function ad(e,i,l){return(e||[]).map(s=>({...s,buttonBgColor:s.customIcon?"":ld(i,l,s.buttonBgColor)}))}function nd(e,i){if(e==null)return;const l=(s,a)=>{if(!a||!Object.prototype.hasOwnProperty.call(a,"platform"))return;const d=a.platform;d==null||d===""||i(s,d)};if(Array.isArray(e))e.forEach((s,a)=>{l(a,s)});else if(typeof e=="object")for(const s of Object.keys(e)){const a=Number.parseInt(s,10);Number.isNaN(a)||l(a,e[s])}}function Nl({__:e,form:i,fieldName:l,pushSettingsToIframe:s,onMetaActiveChange:a}){const{token:d}=(0,t.ui_kit$useToken)(),c=t.ui_kit$Form.useWatch(["items",l],i),m=c&&typeof c=="object"?c:{},f=typeof m.alt=="string"?m.alt:"",g=typeof m.title=="string"?m.title:"",[E,h]=(0,n.useState)(!1),[p,S]=(0,n.useState)(!1),k=(0,n.useRef)(null),x=(0,n.useRef)(null),T=(0,n.useMemo)(()=>({clearIcon:(0,o.jsx)(t.ui_kit$ColorPickerClearGlyph,{})}),[]);(0,n.useEffect)(()=>{f.trim()&&h(!0)},[f]);const I=!!(f.trim()||E),L=!!(g.trim()||p),y=I||L;(0,n.useLayoutEffect)(()=>{a(l,{alt:I,title:L})},[I,l,a,L]);const C=(0,n.useMemo)(()=>({marginBottom:y?d.formItemMarginBottomXS:0}),[y,d.formItemMarginBottomXS]),P=(0,n.useMemo)(()=>[l,"alt"],[l]),K=(0,n.useMemo)(()=>[l,"title"],[l]),M=y?"selected-social-form__meta-fields":"selected-social-form__meta-fields is-hidden",$=I?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",A=L?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",W=(0,n.useMemo)(()=>f.trim()?f.trim():e("Alternative text"),[e,f]),se=(0,n.useMemo)(()=>g.trim()?g.trim():e("Tooltip text"),[e,g]),R=(0,n.useMemo)(()=>(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":I}),[I]),te=(0,n.useMemo)(()=>(0,We.default)("selected-td-form__button",{"selected-td-form__button--active":L}),[L]),he=(0,n.useCallback)(xe=>{setTimeout(()=>{const Be=xe.current;if(Be){if(typeof Be.focus=="function"){Be.focus();return}Be.input&&typeof Be.input.focus=="function"&&Be.input.focus()}},0)},[]),be=(0,n.useCallback)(()=>{I?(h(!1),f.trim()&&(i.setFieldValue(["items",l,"alt"],""),setTimeout(()=>s(),0))):(h(!0),he(k))},[I,f,l,he,i,s]),Ie=(0,n.useCallback)(()=>{if(L)a(l,{title:!1}),S(!1),g.trim()&&(i.setFieldValue(["items",l,"title"],""),setTimeout(()=>s(),0));else{S(!0),a(l,{title:!0});const xe=f.trim();i.setFieldValue(["items",l,"title"],xe),setTimeout(()=>s(),0),he(x)}},[f,l,he,i,a,s,L,g]);return(0,o.jsxs)("div",{className:"selected-social-form__meta-block",children:[(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected-social-form__meta-toggle-row",style:C,children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:W,placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Button,{type:"default",className:R,onClick:be,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:se,placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Button,{type:"default",className:te,onClick:Ie,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})})]}),(0,o.jsxs)("div",{className:M,children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:P,className:$,children:(0,o.jsx)(t.ui_kit$Input,{ref:k,placeholder:e("Alternative text"),allowClear:T,prefix:Jn})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:K,className:A,children:(0,o.jsx)(t.ui_kit$Input,{ref:x,placeholder:e("Social network name"),allowClear:T,prefix:Qn})})]})]})}Nl.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 dd(e,i){if(!Array.isArray(e)||e.length===0)return i;let l=null;for(const s of e){const a=s.iconWidth;if(a==null||Number.isNaN(a)||a<=0)return i;if(l===null)l=a;else if(a!==l)return i}return l??i}function cd(e){if(!e)return{align:"center",iconSize:40,borderRadius:0,gap:8,globalBgColor:"",globalItemBorderColor:"",buttonBorderWidth:0,showLabel:!1,items:[]};const i=id(e),l=String(e?.hostCellBgForIconLuminance??"").trim(),s=dd(e.items,e.iconSize??40),a=typeof e.buttonBorderWidth=="number"&&!Number.isNaN(e.buttonBorderWidth)?e.buttonBorderWidth:0,d=e.bgEnabled&&e.bgColor?String(e.bgColor).trim():"";return{align:e.align??"center",iconSize:s,borderRadius:e.borderRadius??0,gap:e.gap??8,globalBgColor:d,globalItemBorderColor:Al(e.items),buttonBorderWidth:a,showLabel:e.showLabel??!1,items:Array.isArray(e.items)?e.items.map(c=>{const m=!!c.customIcon,f=m?"":Gt(d,c.buttonBgColor),g=c.platform&&!m?r.getSocialIconForBlockCell(c.platform,zt(i,f,l)):null;return{...c,customIcon:m,title:String(c.title??"").trim(),...g?{iconSrc:g}:{},iconWidth:null,iconHeight:null,buttonBgColor:f,itemBorderColor:m?"":String(c.itemBorderColor??"").trim()}}):[]}}var Ll=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useAppConfig(),s=r.useDispatch(),[a]=t.ui_kit$Form.useForm(),d=r.useSendPostMessage(),c=r.useSendPostMessageEx(),{openImagePicker:m}=r.useImagePicker(),[f,g]=(0,n.useState)(e),[E,h]=(0,n.useState)(null),[p,S]=(0,n.useState)(null),k=(0,n.useRef)(null),x=(0,n.useRef)(null),T=(0,n.useRef)(null),I=(0,n.useRef)(Pl(e)),L=r.useSelector(r.selectEmailSettings),y=(0,n.useRef)(null),C=(0,n.useRef)(!1),P=(0,n.useRef)(""),K=(0,n.useRef)({}),M=td(),$=L?.usedColors??[],A=t.ui_kit$Form.useWatch("items",a)||[],W=(0,n.useCallback)(()=>{y.current&&(document.removeEventListener("dragover",y.current,!0),y.current=null)},[]),se=(0,n.useCallback)(()=>{if(y.current)return;const Y=le=>{le.preventDefault(),le.dataTransfer&&(le.dataTransfer.dropEffect="move")};document.addEventListener("dragover",Y,!0),y.current=Y},[]),R=(0,n.useMemo)(()=>r.getSocialPresetsForBrand(qn).filter(Y=>r.SOCIAL_ICON_ORIGINAL_BY_PLATFORM[Y.id]),[]),te=(0,n.useMemo)(()=>R.map(Y=>({value:Y.id,label:(0,o.jsxs)("span",{className:"selected-social-form__platform-option",children:[(0,o.jsx)("img",{src:r.getSocialIcon(Y.id,M),alt:""}),(0,o.jsx)("span",{className:"selected-social-form__platform-option-text",children:i(Y.labelMsgid)})]})})),[i,R,M]),he=(0,n.useCallback)((Y,le)=>{K.current={...K.current,[Y]:{...K.current[Y],...le}}},[]);(0,n.useEffect)(()=>{const Y=Pl(e);I.current!==Y&&(I.current=Y,K.current={},g(e))},[e]);const be=(0,n.useRef)(!1);(0,n.useEffect)(()=>{if(f?.settings){if(be.current){be.current=!1;return}const Y=f.settings;P.current=Y.bgEnabled&&Y.bgColor?String(Y.bgColor).trim():"",a.setFieldsValue(cd(f.settings))}},[f,a]),(0,n.useEffect)(()=>()=>W(),[W]);const Ie=(0,n.useCallback)(()=>{const Y=a.getFieldsValue(!0),le=f.settings||{},Ce=String(le.hostCellBgForIconLuminance??"").trim(),G=(Y.globalBgColor||"").trim(),Te=typeof Y.iconSize=="number"&&!Number.isNaN(Y.iconSize)?Y.iconSize:le.iconSize??40,Ne=typeof Y.borderRadius=="number"&&!Number.isNaN(Y.borderRadius)?Y.borderRadius:le.borderRadius??0,Pe=typeof Y.gap=="number"&&!Number.isNaN(Y.gap)?Y.gap:le.gap??8,Me={blockBgEnabled:!!G,blockBgColor:G},Ue=(Y.globalItemBorderColor||"").trim();let ze=typeof Y.buttonBorderWidth=="number"&&!Number.isNaN(Y.buttonBorderWidth)?Y.buttonBorderWidth:0;ze=Math.max(0,Math.min(24,Math.round(ze)));const ce={...le,type:"social",align:Y.align??le.align??"center",iconSize:Te,borderRadius:Ne,gap:Pe,bgEnabled:!!G,bgColor:G,hostCellBgForIconLuminance:Ce,borderWidth:typeof le.borderWidth=="number"?le.borderWidth:0,borderColor:typeof le.borderColor=="string"?le.borderColor:"",buttonBorderColor:"",buttonBorderWidth:ze,showLabel:Y.showLabel,items:(Y.items||[]).filter(Boolean).map((fe,v)=>{const ie=!!fe.customIcon,Re=K.current[v]||{},Oe=ie?"":rd(G,(fe.buttonBgColor||"").trim()),De=typeof fe.href=="string"?Il(fe.href):fe.href,Ge=ie?"":Gt(G,Oe),Qe=!ie&&fe.platform?r.getSocialIconForBlockCell(fe.platform,zt(Me,Ge,Ce)):null,O=ie?"":Ue||String(fe.itemBorderColor??"").trim(),oe=ed(ie?fe.iconSrc||"":Qe||fe.iconSrc||"");return{...fe,customIcon:ie,href:De,iconSrc:oe,iconWidth:null,iconHeight:null,buttonBgColor:Oe,itemBorderColor:O,title:Re.title?String(fe.title??"").trim():""}})};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.SOCIAL,caption:f.caption,settings:ce}),P.current=G,be.current=!0,g(fe=>({...fe,settings:ce}))},[f.caption,f.settings,a,d]),xe=(0,n.useCallback)(Y=>{if(Y==null||Y==="")return-1;const le=r.stripEmVersionFromUrlString(String(Y));return(a.getFieldValue("items")||[]).findIndex(Ce=>r.stripEmVersionFromUrlString(Ce&&Ce.iconSrc||"")===le)},[a]),Be=(0,n.useCallback)((Y,le,Ce,G)=>{const Te=[...a.getFieldValue("items")||[]];if(Y<0||Y>=Te.length)return;const Ne=r.stripEmVersionFromUrlString(String(G||""))===r.stripEmVersionFromUrlString(String(le||""));(!Ne||le!==Te[Y]?.iconSrc)&&(Te[Y]={...Te[Y],iconSrc:le,customIcon:!0,buttonBgColor:"",itemBorderColor:""},a.setFieldValue("items",Te),setTimeout(()=>Ie(),0)),Ce?.mode==="save"&&Ne&&c(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(le)})},[a,Ie,c]),ke=(0,n.useCallback)(async(Y,le)=>{const Ce=r.stripEmVersionFromUrlString(String(le||"")),G=xe(le);if(G<0)return;const Te=(a.getFieldValue("items")||[])[G]?.iconSrc,{entryModal:Ne,currentUrl:Pe,imageDataUrl:Me}=await Cl(Ce,Y),Ue=await m({kind:"img",currentUrl:Pe,entryModal:Ne,imageDataUrl:Me});Ue?.url&&Be(G,Ue.url,Ue.meta,Te)},[Be,xe,a,m]),ne=(0,n.useCallback)(async Y=>{const le=(a.getFieldValue("items")||[])[Y];if(!le)return;const{entryModal:Ce,currentUrl:G,imageDataUrl:Te}=await Cl(r.stripEmVersionFromUrlString(String(le.iconSrc||"")),r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD),Ne=le.iconSrc,Pe=await m({kind:"img",currentUrl:G,entryModal:Ce,imageDataUrl:Te});Pe?.url&&Be(Y,Pe.url,Pe.meta,Ne)},[Be,a,m]),He=(0,n.useCallback)(Y=>{const le=parseInt(Y.currentTarget.dataset.socialEditIndex??"",10);Number.isNaN(le)||ne(le)},[ne]),Fe=(0,n.useCallback)(Y=>{const le=Y.data?.operation,Ce=Y.data?.src;le===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?ke(r.MODALS.UPLOAD_IMAGE_MODAL_AI,Ce):le===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?ke(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,Ce):le===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?ke(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT,Ce):le===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?ke(r.MODALS.UPLOAD_IMAGE_MODAL_GIF,Ce):le===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?ke(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK,Ce):le===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(s(r.closeSecondModal()),s(r.closeModal$1()))},[s,ke]);r.useListenPostMessage(Fe);const Se=(0,n.useCallback)(()=>{const Y=a.getFieldValue("items")||[],le=R[0],Ce=(a.getFieldValue("globalItemBorderColor")||"").trim(),G=(a.getFieldValue("globalBgColor")||"").trim();if(!le)a.setFieldsValue({items:[...Y,{platform:void 0,customIcon:!1,href:"",alt:"",title:"",iconSrc:"",iconWidth:null,iconHeight:null,buttonBgColor:G,itemBorderColor:Ce}]});else{const Te=String(f?.settings?.hostCellBgForIconLuminance??"").trim(),Ne=Gt(G,G),Pe=r.getSocialIconForBlockCell(le.id,zt({blockBgEnabled:!!G,blockBgColor:G},Ne,Te)),Me=i(le.labelMsgid);a.setFieldsValue({items:[...Y,{platform:le.id,customIcon:!1,href:"",alt:Me,title:"",iconSrc:Pe,iconWidth:null,iconHeight:null,buttonBgColor:G,itemBorderColor:Ce}]})}setTimeout(()=>Ie(),0)},[i,f?.settings?.hostCellBgForIconLuminance,a,R,Ie]),ye=(0,n.useCallback)((Y,le)=>{Y.dataTransfer.setData(vl,String(le)),Y.dataTransfer.setData(r.DND_SOCIAL_LIST_REORDER_MIME,String(le)),Y.dataTransfer.effectAllowed="move",k.current=le,h(le),se()},[se]),re=(0,n.useCallback)(()=>{W(),k.current=null,h(null),S(null)},[W]),q=(0,n.useCallback)((Y,le,Ce)=>{if(Ce<2)return;Y.preventDefault(),Y.dataTransfer.dropEffect="move";const G=k.current;G!==null&&G!==le&&S(le)},[]),X=(0,n.useCallback)((Y,le)=>{Y.currentTarget.contains(Y.relatedTarget)||S(Ce=>Ce===le?null:Ce)},[]),Q=(0,n.useCallback)((Y,le,Ce)=>{Y.preventDefault(),S(null);const G=Y.dataTransfer.getData(vl),Te=parseInt(G,10);if(Number.isNaN(Te)||Te===le){W();return}Ce(Te,le),W(),setTimeout(()=>Ie(),0)},[W,Ie]),Z=(0,n.useCallback)(Y=>{const le=Y.currentTarget,Ce=parseInt(le.dataset.itemIndex??"",10);Number.isNaN(Ce)||ye(Y,Ce)},[ye]),U=(0,n.useCallback)(Y=>{const le=Y.currentTarget,Ce=parseInt(le.dataset.itemIndex??"",10),G=parseInt(le.dataset.listLength??"",10);Number.isNaN(Ce)||Number.isNaN(G)||G<2||(Y.preventDefault(),Y.dataTransfer&&(Y.dataTransfer.dropEffect="move"))},[]),V=(0,n.useCallback)(Y=>{const le=Y.currentTarget,Ce=parseInt(le.dataset.itemIndex??"",10),G=parseInt(le.dataset.listLength??"",10);Number.isNaN(Ce)||Number.isNaN(G)||q(Y,Ce,G)},[q]),J=(0,n.useCallback)(Y=>{const le=parseInt(Y.currentTarget.dataset.itemIndex??"",10);Number.isNaN(le)||X(Y,le)},[X]),de=(0,n.useCallback)(Y=>{const le=parseInt(Y.currentTarget.dataset.itemIndex??"",10),Ce=x.current;Number.isNaN(le)||typeof Ce!="function"||Q(Y,le,Ce)},[Q]),me=(0,n.useCallback)(Y=>{Y.stopPropagation();const le=parseInt(Y.currentTarget.dataset.fieldName??"",10),Ce=T.current;Number.isNaN(le)||typeof Ce!="function"||(Ce(le),queueMicrotask(Ie))},[Ie]),pe=(0,n.useCallback)((Y,le)=>{const Ce=R.find(ce=>ce.id===le);if(!Ce)return;const G=i(Ce.labelMsgid),Te=K.current[Y]||{},Ne=String(a.getFieldValue(["items",Y,"alt"])??"").trim();(Te.alt||Ne)&&a.setFieldValue(["items",Y,"alt"],G),Te.title&&a.setFieldValue(["items",Y,"title"],G);const Pe=(a.getFieldValue("globalBgColor")||"").trim(),Me=Gt(Pe,(a.getFieldValue(["items",Y,"buttonBgColor"])||"").trim()),Ue=String(f?.settings?.hostCellBgForIconLuminance??"").trim(),ze=r.getSocialIconForBlockCell(le,zt({blockBgEnabled:!!Pe,blockBgColor:Pe},Me,Ue));ze&&(a.setFieldValue(["items",Y,"customIcon"],!1),a.setFieldValue(["items",Y,"iconSrc"],ze))},[i,f?.settings?.hostCellBgForIconLuminance,a,R]),Ae=(0,n.useCallback)(Y=>{if(Object.prototype.hasOwnProperty.call(Y,"globalItemBorderColor")){if(!C.current){const le=String(Y.globalItemBorderColor??"").trim(),Ce=a.getFieldValue("items")||[];a.setFieldsValue({items:sd(Ce,le)})}}else if(Object.prototype.hasOwnProperty.call(Y,"globalBgColor")){const le=P.current,Ce=String(Y.globalBgColor??"").trim(),G=a.getFieldValue("items")||[];a.setFieldsValue({items:ad(G,le,Ce)})}else if(Y?.items!=null){const le=a.getFieldValue("items")||[],Ce=Al(le);Ce!==(a.getFieldValue("globalItemBorderColor")||"").trim()&&(C.current=!0,a.setFieldValue("globalItemBorderColor",Ce),queueMicrotask(()=>{C.current=!1}));const G=f.settings?.items||[];le.forEach((Te,Ne)=>{const Pe=Te?.platform,Me=G[Ne]?.platform;Pe&&Pe!==Me&&pe(Ne,Pe)})}nd(Y?.items,pe),Ie()},[f.settings?.items,a,Ie,pe]),we=(0,n.useCallback)((Y,le)=>{if(a.setFieldValue(Y,le),Array.isArray(Y)&&Y[0]==="items"){Ae({items:{[Y[1]]:{[Y[2]]:le}}});return}Ae({[Y]:le})},[a,Ae]),$e=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"selected-social-form__section",children:[(0,o.jsx)("div",{className:"selected-social-form__section-title",children:i("General settings")}),(0,o.jsx)("div",{className:"selected-social-form__align-block",children:(0,o.jsx)(Ho,{form:a,elementSettings:{...f,type:r.ELEMENT_TYPES.SOCIAL}})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Button size"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"iconSize",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:16,max:64,prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px",placeholder:i("Button size"),className:"selected-social-form__input-full"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Corner radius"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"borderRadius",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,max:48,prefix:(0,o.jsx)(r.EmIcons,{icon:"BorderRadius",component:t.icons$BorderRadius,className:"selected-td-form__icon-radius"}),addonAfter:"px",placeholder:i("Corner radius"),className:"selected-social-form__input-full"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Spacing"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gap",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,max:48,prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingLeftRight",component:t.icons$PaddingLeftRight}),addonAfter:"px",placeholder:i("Spacing"),className:"selected-social-form__input-full"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"globalBgColor",className:"form-item-margin-xs",children:(0,o.jsx)(Wt,{form:a,name:"globalBgColor",placeholder:i("Background color"),usedColors:$,onColorChange:we})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Border"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonBorderWidth",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,max:24,prefix:(0,o.jsx)(r.EmIcons,{icon:"BorderOuterOutlined",component:t.icons$BorderOuterOutlined}),addonAfter:"px",placeholder:i("Border"),className:"selected-social-form__input-full"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Border color"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"globalItemBorderColor",className:"form-item-margin-xs",children:(0,o.jsx)(Wt,{form:a,name:"globalItemBorderColor",placeholder:i("Border color"),usedColors:$,onColorChange:we})})})})]})]}),(0,o.jsxs)("div",{className:"selected-social-form__section selected-social-form__section--bordered",children:[(0,o.jsx)("div",{className:"selected-social-form__section-title",children:i("Social buttons")}),(0,o.jsx)(t.ui_kit$Form.List,{name:"items",children:(Y,{remove:le,move:Ce})=>(x.current=Ce,T.current=le,(0,o.jsx)("div",{className:"selected-social-form__items",children:Y.map((G,Te)=>{const Ne=!!(A[Te]?.customIcon??A[G.name]?.customIcon);return(0,o.jsxs)("div",{className:(0,We.default)("selected-social-form__card",E===Te&&"selected-social-form__card--dragging",p===Te&&E!==Te&&"selected-social-form__card--drag-over"),"data-item-index":Te,"data-list-length":Y.length,onDragEnterCapture:U,onDragOverCapture:V,onDragLeave:J,onDropCapture:de,children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head",children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head-main",children:[Y.length>1?(0,o.jsx)("span",{className:"selected-social-form__drag-handle",draggable:!0,"data-item-index":Te,onDragStart:Z,onDragEnd:re,role:"button",tabIndex:0,"aria-label":i("Drag to reorder"),children:(0,o.jsx)(r.EmIcons,{icon:"HolderOutlined",component:t.icons$HolderOutlined})}):null,(0,o.jsxs)(Kn,{className:"selected-social-form__card-title",children:[i("Button")," ",Te+1]})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Delete"),placement:"top",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"selected-social-form__card-head-remove",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:18,strokeWidth:l.iconStrokeWidth}),"aria-label":i("Delete"),"data-field-name":G.name,onClick:me})})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[G.name,"iconSrc"],hidden:!0,children:(0,o.jsx)(t.ui_kit$Input,{})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[G.name,"customIcon"],valuePropName:"checked",hidden:!0,children:(0,o.jsx)(t.ui_kit$Checkbox,{})}),(0,o.jsxs)("div",{className:"selected-social-form__platform-row",children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:[G.name,"platform"],className:"selected-social-form__platform-field selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:te,className:"selected-social-form__platform-select",classNames:{popup:{root:"selected-social-form__platform-dropdown"}},placeholder:i("Select"),suffixIcon:(0,o.jsx)(r.EmIcons,{icon:"ChevronDownCustom",component:t.icons$ChevronDownCustom,className:"ant-select-suffix"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Edit icon"),placement:"top",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"selected-social-form__platform-edit","data-social-edit-index":Te,icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,size:18,strokeWidth:l.iconStrokeWidth}),"aria-label":i("Edit icon"),onClick:He})})]}),(0,o.jsx)(t.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(Pe,Me)=>{const Ue=typeof Me=="string"?Me.trim():String(Me??"").trim();if(Ue&&!od(Ue))throw new Error(i("Please enter the correct URL."))}}],children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Link03",component:t.icons$Link03,className:"selected-social-form__field-icon"}),placeholder:i("Enter link"),allowClear:{clearIcon:(0,o.jsx)(t.ui_kit$ColorPickerClearGlyph,{})}})}),Ne?null:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__card-field selected-social-form__bg-color-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:[G.name,"buttonBgColor"],className:"selected-social-form__card-field",children:(0,o.jsx)(Wt,{form:a,name:["items",G.name,"buttonBgColor"],placeholder:i("Background color"),usedColors:$,onColorChange:we})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Border color"),placement:"bottom",getPopupContainer:Ao,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:[G.name,"itemBorderColor"],className:"selected-social-form__card-field",children:(0,o.jsx)(Wt,{form:a,name:["items",G.name,"itemBorderColor"],placeholder:i("Border color"),usedColors:$,onColorChange:we})})})})]}),(0,o.jsx)(Nl,{__:i,form:a,fieldName:G.name,pushSettingsToIframe:Ie,onMetaActiveChange:he})]},G.key)})}))}),(0,o.jsx)(t.ui_kit$Button,{type:"text",block:!0,className:"selected-social-form__add-bar",icon:(0,o.jsx)(r.EmIcons,{icon:"PlusSquareOutlined",component:t.icons$PlusSquareOutlined}),onClick:Se,children:i("Add button")})]})]});return(0,o.jsx)("div",{className:"selected-social-form",children:(0,o.jsx)(t.ui_kit$Form,{form:a,layout:"vertical",className:"selected-social-form__form element-controls",onValuesChange:Ae,autoComplete:"off",children:(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:$e})})})};Ll.propTypes={elementSettings:_.default.shape({settings:_.default.object,type:_.default.string,caption:_.default.string})};var Ol=r.BASIC_BORDER_COLOR,ud=(e,i,l,s,a,d,c="")=>{const m=e.getFieldsValue(!0),f=i?"cell_":c;setTimeout(()=>{i?s(g=>!g):l(g=>!g),a&&(m[f+"borderWidth"]=null,m[f+"borderColor"]="",m[f+"borderStyle"]=""),d(g=>({...r.RESET_BORDER_PARAMS,[m[f+"borderPosition"]]:{...g[m[f+"borderPosition"]],width:m[f+"borderWidth"],color:m[f+"borderColor"],style:m[f+"borderStyle"]}}))})},md=(e,i,l,s,a,d,c)=>{const m=e.getFieldsValue(!0);setTimeout(()=>{i(f=>!f),!l&&!s[m?.mobileBorderPosition]?.color&&(m.mobileBorderStyle="solid",m.mobileBorderWidth=1,m.mobileBorderColor=Ol,a(f=>({...s,[m?.mobileBorderPosition]:{color:Ol,style:"solid",width:1}}))),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:c.type,settings:{mobileBorder:{...s,[m?.mobileBorderPosition]:{color:m.mobileBorderColor,style:m.mobileBorderStyle,width:m.mobileBorderWidth}}}})})},pd=(e,i,l,s,a,d,c="")=>{const m=e.getFieldsValue(!0);setTimeout(()=>{i(f=>!f),l?(m[c+"borderRadiusAll"]=0,s(!0)):m[c+"borderRadiusAll"]||(m[c+"borderRadiusAll"]=0),a({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:d.type,settings:{borderRadius:{all:m[c+"borderRadiusAll"]}}})})},hd=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!l&&!d.mobileBorderRadiusAll&&!d.mobileBorderRadiusTopLeft&&!d.mobileBorderRadiusTopRight&&!d.mobileBorderRadiusBottomRight&&!d.mobileBorderRadiusBottomLeft&&(d.mobileBorderRadiusAll=0),["all","topLeft","topRight","bottomRight","bottomLeft"].forEach(c=>{if(!d.mobileBorderRadius?.[c])return;const m=`mobileBorderRadius${c[0].toUpperCase()}${c.slice(1)}`;s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{mobileBorderRadius:{[c]:d[m],classNamePrefix:`em-mob-border_radius_${c}-`}}})})})},bd=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!l&&!d.boxShadowColor?(d.boxShadowInset=!1,d.boxShadowHOffset=5,d.boxShadowVOffset=5,d.boxShadowBlurRadius=10,d.boxShadowSpreadRadius=-5,d.boxShadowColor="#000000"):l&&(d.boxShadowInset=!1,d.boxShadowHOffset=null,d.boxShadowVOffset=null,d.boxShadowBlurRadius=null,d.boxShadowSpreadRadius=null,d.boxShadowColor=""),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{boxShadow:{blurRadius:d.boxShadowBlurRadius,color:d.boxShadowColor,hOffset:d.boxShadowHOffset,inset:d.boxShadowInset,spreadRadius:d.boxShadowSpreadRadius,vOffset:d.boxShadowVOffset}}})})},fd=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!l&&!d.mobileBoxShadowColor&&(d.mobileBoxShadowInset=!1,d.mobileBoxShadowHOffset=5,d.mobileBoxShadowVOffset=5,d.mobileBoxShadowBlurRadius=10,d.mobileBoxShadowSpreadRadius=-5,d.mobileBoxShadowColor="#000000"),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{mobileBoxShadow:{blurRadius:d.mobileBoxShadowBlurRadius,color:d.mobileBoxShadowColor,hOffset:d.mobileBoxShadowHOffset,inset:d.mobileBoxShadowInset,spreadRadius:d.mobileBoxShadowSpreadRadius,vOffset:d.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},gd=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!l&&!d.mobileWidth&&(d.mobileWidth=""),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{mobileWidth:{value:d.mobileWidth,dim:d.mobileWidthDim,classNamePrefix:"em-mob-width-"}}})})},_d=e=>{setTimeout(()=>{e(i=>!i)})},xd=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),!l&&!d.mobileBackgroundColor&&(d.mobileBackgroundColor="#E5E5E5"),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:d.mobileBackgroundColor}}}),l&&Bt(e,a,s)})},kd=(e,i,l,s,a)=>{const d=e.getFieldsValue(!0);setTimeout(()=>{i(c=>!c),l&&(d.paddingLeftRight="",d.paddingLeft="",d.paddingRight="",d.paddingTopBottom="",d.paddingTop="",d.paddingBottom="",s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{padding:{all:0}}}))})},Ed=(e,i,l,s,a)=>{i(c=>!c);const d=e.getFieldsValue(!0);l||(d.paddingLeftRight=d.paddingLeft,d.paddingTopBottom=d.paddingTop,d.paddingRight=d.paddingLeft,d.paddingBottom=d.paddingTop,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{padding:{top:d.paddingTopBottom,bottom:d.paddingTopBottom,left:d.paddingLeftRight,right:d.paddingLeftRight}}}))},Bd=e=>{setTimeout(()=>{e(i=>!i)})},Sd=(e,i,l,s,a)=>{i(c=>!c);const d=e.getFieldsValue(!0);l||(d.cell_paddingLeftRight=d.cell_paddingLeft,d.cell_paddingTopBottom=d.cell_paddingTop,d.cell_paddingRight=d.cell_paddingLeft,d.cell_paddingBottom=d.cell_paddingTop,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{cell_padding:{top:d.cell_paddingTopBottom,bottom:d.cell_paddingTopBottom,left:d.cell_paddingLeftRight,right:d.cell_paddingLeftRight}}})),(l&&d.cell_paddingLeftRight||d.cell_paddingLeftRight===0)&&(d.cell_paddingLeft=d.cell_paddingLeftRight,d.cell_paddingRight=d.cell_paddingLeftRight),(l&&d.cell_paddingTopBottom||d.cell_paddingTopBottom===0)&&(d.cell_paddingTop=d.cell_paddingTopBottom,d.cell_paddingBottom=d.cell_paddingTopBottom)},Td=({form:e,onBorderSideClear:i,formName:l,elementSettings:s,formValues:a,isMacOS:d,__:c,token:m,appConfig:f,typografItems:g,backgroundRepeatOptions:E,backgroundSizeOptions:h,sendAction:p,handleToggleShowPaddingCell:S,handleTogglePaddingCell:k,handleToggleBackground:x,handleToggleBorder:T,handleToggleBorderRadius:I,paddingCellShow:L,paddingsExt:y,backgroundShow:C,cellBordersShow:P,borderRadiusShow:K,oneBorderRadiusValue:M,setOneBorderRadiusValue:$,textInputRef:A,linkProtocol:W,handleLinkProtocolsChange:se,backgroundImageEmpty:R})=>{const te=z.useGoogleFontsLoader();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$FormSection,{title:c("Text"),dividerTop:!1,children:[f.formTextFieldTypografEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"AddImage",style:{marginBottom:m.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"AddImage",component:t.icons$AddImage}),onClick:()=>p("add_img"),style:{width:"100%"},children:c("Add image")})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"Typography",style:{marginBottom:m.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,menu:{items:g},trigger:["hover"],placement:"bottom",getPopupContainer:he=>he.closest(".selected-element-panel"),children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Typograf",component:t.icons$Typograf}),onClick:()=>p("typograf"),style:{width:"100%"},children:c("Typography")})})})})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Text font"),placement:"bottom",zIndex:1,getPopupContainer:he=>he.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:te,getPopupContainer:he=>he.closest(".email-pane__collapse-wrapper")})})}),!s.showOnMobile&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:c("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:c("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(eo,{form:e,elementSettings:s,name:"textStrong",tooltipTitle:c(d?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(eo,{form:e,elementSettings:s,name:"textItalic",tooltipTitle:c(d?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(eo,{form:e,elementSettings:s,name:"textStrikethrough",tooltipTitle:c(d?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(eo,{form:e,elementSettings:s,name:"textUnderline",tooltipTitle:c(d?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(eo,{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",tooltipTitle:c("Link"),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"})})})]}),a?.textLink&&(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsxs)(t.ui_kit$Col,{span:24,children:[(0,o.jsx)(Zo,{show:W==="#",__:c,style:{marginBottom:m.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("The URL that the hyperlink directs to."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkHref",children:(0,o.jsx)(t.ui_kit$Input,{ref:A,addonBefore:(0,o.jsx)(Qo,{linkProtocol:W,handleLinkProtocolsChange:se,__:c}),allowClear:!0,placeholder:c("Hyperlink URL"),autoFocus:s?.customTable?.isNewLink,prefix:(0,o.jsx)(Jo,{linkProtocol:W})})})})]})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Text color"),placement:"bottom",zIndex:2,getPopupContainer:he=>he.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:c("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:c("Color"),usedColors:s.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Text background"),placement:"bottom",zIndex:2,getPopupContainer:he=>he.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:c("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:c("Background color"),usedColors:s.usedColors})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(tt,{form:e,elementSettings:s,name:"textAlign"})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Mo,{form:e,elementSettings:s,name:"valign",isNewIconType:!0})})]})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:c("Padding"),collapsible:!0,open:L,onToggle:S,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{namePrefix:"cell_",extended:y,onToggleExtended:k,gutter:m.marginSM,rowStyle:{paddingBottom:4},labels:{horizontal:c("Horizontal padding"),vertical:c("Vertical padding"),left:c("Left padding"),right:c("Right padding"),top:c("Top padding"),bottom:c("Bottom padding"),individual:c("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:c("Background"),collapsible:!0,open:C,onToggle:x,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{colorFieldName:"cellBackgroundColor",imageEnabled:f.formTableFieldBackgroundImageEnabled&&!1,backgroundImageEmpty:R,usedColors:s.usedColors,colorPlaceholder:c("Background color"),horizontalPositionPlaceholder:c("Horizontal position"),horizontalPositionTooltip:c("Horizontal position"),verticalPositionPlaceholder:c("Vertical position"),verticalPositionTooltip:c("Vertical position"),backgroundRepeatTooltip:c("Background image repeat"),backgroundSizeTooltip:c("Background image size"),selectPlaceholder:c("Please choose"),backgroundRepeatOptions:E,backgroundSizeOptions:h,imageUploadSlot:(f.formTableFieldBackgroundImageEnabled,void 0)})}),(0,o.jsx)(t.ui_kit$FormSection,{title:c("Borders"),collapsible:!0,open:P,onToggle:T,dividerTop:!0,children:(0,o.jsx)(z.SelectedElementFormBorder,{form:e,namePrefix:"cell_"})}),f.formFieldBorderRadiusEnabled&&!1]})},$l=({form:e,onBorderSideClear:i,elementSettings:l,paddingShow:s,paddingsExt:a,backgroundShow:d,bordersShow:c,borderRadiusShow:m,boxShadowShow:f,handleToggleShowPadding:g,handleTogglePadding:E,handleToggleBackground:h,handleToggleBorder:p,handleToggleBorderRadius:S,handleToggleBoxShadow:k,backgroundRepeatOptions:x,backgroundSizeOptions:T,backgroundImageEmpty:I,oneBorderRadiusValue:L,setOneBorderRadiusValue:y,boxShadow:C})=>{const{__:P}=r.useI18n(),K=r.useAppConfig(),{token:M}=(0,t.ui_kit$useToken)();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$FormSection,{title:P("Padding"),collapsible:!0,open:s,onToggle:g,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:a,onToggleExtended:E,gutter:M.marginSM,labels:{horizontal:P("Horizontal padding"),vertical:P("Vertical padding"),left:P("Left padding"),right:P("Right padding"),top:P("Top padding"),bottom:P("Bottom padding"),individual:P("Individual padding")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:P("Background"),collapsible:!0,open:d,onToggle:h,dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{imageEnabled:K.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:I,usedColors:l.usedColors,colorPlaceholder:P("Background color"),horizontalPositionPlaceholder:P("Horizontal position"),horizontalPositionTooltip:P("Horizontal position"),verticalPositionPlaceholder:P("Vertical position"),verticalPositionTooltip:P("Vertical position"),backgroundRepeatTooltip:P("Background image repeat"),backgroundSizeTooltip:P("Background image size"),selectPlaceholder:P("Please choose"),backgroundRepeatOptions:x,backgroundSizeOptions:T,imageUploadSlot:K.formTableFieldBackgroundImageEnabled?(0,o.jsx)(No,{form:e,label:P("Background image"),name:"backgroundImage",tooltipTitle:P("Background image"),placeholder:P("Background image link/route")}):void 0}),(0,o.jsx)(it,{form:e,showBackground:!0})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:P("Borders"),collapsible:!0,open:c,onToggle:p,dividerTop:!0,children:(0,o.jsx)(z.SelectedElementFormBorder,{form:e,onBorderSideClear:i})}),K.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("Border radius"),collapsible:!0,open:m,onToggle:S,dividerTop:!0,children:(0,o.jsx)(To,{form:e,oneBorderRadiusValue:L,setOneBorderRadiusValue:y,elementSettings:l})}),K.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("Box shadow"),collapsible:!0,open:f,onToggle:k,dividerTop:!0,children:(0,o.jsx)(vo,{})}),K.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:l,form:e})})]})};$l.propTypes={form:_.default.object.isRequired,onBorderSideClear:_.default.func,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,boxShadow:_.default.object};var Fl=({form:e,elementSettings:i,mobileSizeShow:l,mobileBackgroundShow:s,mobileBordersShow:a,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,handleToggleMobileSize:m,handleToggleMobileBackground:f,handleToggleMobileBorder:g,handleToggleMobileBorderRadius:E,handleToggleMobileBoxShadow:h,oneMobileBorderRadiusValue:p,setOneMobileBorderRadiusValue:S,mobileBorders:k,mobileBoxShadow:x})=>{const{__:T,_x:I}=r.useI18n(),L=r.useAppConfig(),{token:y}=(0,t.ui_kit$useToken)(),C=r.useSelector(r.selectEmailSettings);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$FormSection,{title:T("Size"),collapsible:!0,open:l,onToggle:m,dividerTop:!0,children:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:T("Table width"),placement:"left",children:(0,o.jsx)("div",{style:{marginBottom:y.formItemMarginBottomMD+4},children:(0,o.jsx)(Wo,{form:e,name:"mobileWidth",elementSettings:i})})})})}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:y.formItemMarginBottomXS*2},children:(0,o.jsx)(t.ui_kit$Tooltip,{title:T("Height"),placement:"bottom",children:(0,o.jsx)(ot,{form:e,name:"mobileHeight",elementSettings:i})})})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:T("Background"),collapsible:!0,open:s,onToggle:f,dividerTop:!0,children:(0,o.jsx)(St,{elementSettings:zo(i),imageEnabled:L.formTableFieldBackgroundImageEnabled,desktopBackground:kt(i)})}),L.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:T("Borders"),collapsible:!0,open:a,onToggle:g,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormBorderInputs,{form:e,fieldStructure:"flat",borderValues:k,usedColors:C.usedColors,labels:{color:T("Color"),width:I("Width","border"),none:T("None"),solid:T("Solid"),dashed:T("Dashed"),dotted:T("Dotted"),above:T("Above"),below:T("Below"),onLeft:T("On the left"),onRight:T("On the right"),around:T("Around"),usedColors:T("Used"),recommendedColors:T("Recommended")}})}),L.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:T("Border radius"),collapsible:!0,open:d,onToggle:E,dividerTop:!0,children:(0,o.jsx)(To,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:p,setOneBorderRadiusValue:S,elementSettings:i})}),L.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:T("Box shadow"),collapsible:!0,open:c,onToggle:h,dividerTop:!0,children:(0,o.jsx)(vo,{typeOfForm:"mobile",form:e,elementSettings:i,enableSwitch:!1})}),L.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:T("Display control"),dividerTop:!0,children:(0,o.jsx)(Io,{elementSettings:i,form:e})})]})};Fl.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,mobileBoxShadow:_.default.object};var Rd=({form:e,onBorderSideClear:i,elementViewType:l,mobileViewActive:s,elementSettings:a,paddingShow:d,paddingsExt:c,backgroundShow:m,bordersShow:f,borderRadiusShow:g,boxShadowShow:E,mobileSizeShow:h,mobileBackgroundShow:p,mobileBordersShow:S,mobileBorderRadiusShow:k,mobileBoxShadowShow:x,handleToggleShowPadding:T,handleTogglePadding:I,handleToggleBackground:L,handleToggleBorder:y,handleToggleBorderRadius:C,handleToggleBoxShadow:P,handleToggleMobileSize:K,handleToggleMobileBackground:M,handleToggleMobileBorder:$,handleToggleMobileBorderRadius:A,handleToggleMobileBoxShadow:W,backgroundRepeatOptions:se,backgroundSizeOptions:R,backgroundImageEmpty:te,oneBorderRadiusValue:he,setOneBorderRadiusValue:be,oneMobileBorderRadiusValue:Ie,setOneMobileBorderRadiusValue:xe,boxShadow:Be,mobileBorders:ke,mobileBoxShadow:ne})=>(0,o.jsx)(o.Fragment,{children:l==="mobile"&&s.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(Fl,{form:e,elementSettings:a,mobileSizeShow:h,mobileBackgroundShow:p,mobileBordersShow:S,mobileBorderRadiusShow:k,mobileBoxShadowShow:x,handleToggleMobileSize:K,handleToggleMobileBackground:M,handleToggleMobileBorder:$,handleToggleMobileBorderRadius:A,handleToggleMobileBoxShadow:W,oneMobileBorderRadiusValue:Ie,setOneMobileBorderRadiusValue:xe,mobileBorders:ke,mobileBoxShadow:ne})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)($l,{form:e,onBorderSideClear:i,elementSettings:a,paddingShow:d,paddingsExt:c,backgroundShow:m,bordersShow:f,borderRadiusShow:g,boxShadowShow:E,handleToggleShowPadding:T,handleTogglePadding:I,handleToggleBackground:L,handleToggleBorder:y,handleToggleBorderRadius:C,handleToggleBoxShadow:P,backgroundRepeatOptions:se,backgroundSizeOptions:R,backgroundImageEmpty:te,oneBorderRadiusValue:he,setOneBorderRadiusValue:be,boxShadow:Be})})}),yd=["borderTop","borderBottom","borderLeft","borderRight"],Ml=({elementSettings:e,formName:i})=>{const{__:l}=r.useI18n(),s=r.useSendPostMessage(),[a]=t.ui_kit$Form.useForm(),{token:d}=(0,t.ui_kit$useToken)(),c=r.useAppConfig(),m=r.useSelector(r.selectEmailViewType),f=r.useSelector(r.selectMobileViewActive),g=r.useSelector(r.selectIsCodeMode),E=r.useSelector(r.selectCodeModeDirection),[h,p]=(0,n.useState)({}),[S,k]=(0,n.useState)(!0),[x,T]=(0,n.useState)({}),[I,L]=(0,n.useState)({}),[y,C]=(0,n.useState)(!0),[P,K]=(0,n.useState)(e.customTable?.backgroundImage[0].value===""),[M,$]=(0,n.useState)(),[A,W]=(0,n.useState)(!1),[se,R]=(0,n.useState)(!1),[te,he]=(0,n.useState)(!1),[be,Ie]=(0,n.useState)(!1),[xe,Be]=(0,n.useState)(!1),[ke,ne]=(0,n.useState)(!1),[He,Fe]=(0,n.useState)(!1),[Se,ye]=(0,n.useState)(!1),[re,q]=(0,n.useState)(!0),[X,Q]=(0,n.useState)(!0),[Z,U]=(0,n.useState)(!0),[V,J]=(0,n.useState)(!1),[de,me]=(0,n.useState)("https://"),[pe,Ae]=(0,n.useState)({}),[we,$e]=(0,n.useState)(!1),[Y,le]=(0,n.useState)(!1),[Ce,G]=(0,n.useState)(!1),[Te,Ne]=(0,n.useState)({}),Pe=(0,n.useRef)(null),Me=(0,n.useRef)(),Ue=t.ui_kit$Form.useWatch([],a),ze=[{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"}],ce=[{label:l("Not defined"),value:""},{label:l("Contain"),value:"contain"},{label:l("Cover"),value:"cover"}],fe={width:"",style:"",color:""},v=g&&E!=="bottom",ie=r.BASIC_BORDER_COLOR,Re=i==="Edit selected table cells"||!1,[Oe,De]=(0,n.useState)(null);(0,n.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&De(!0)},[]);const Ge=F=>{s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:F,locale:"ru_RU"})},Qe=[{key:"1",label:l("This element"),onClick:()=>Ge("typograf")},{key:"2",label:l("The whole email"),onClick:()=>Ge("typograf_all")}];let O="";(0,n.useEffect)(()=>{if(e){Et(e)&&ye(!0);const F=e.border,b=e.boxShadow,H=e.customTable?.mobileBorder,ae=e.customTable?.mobileBoxShadow,je=e.customTable?.cellBorders;Ne(F),p(b),T(H),L(ae),Ae(je);const Ee=Re?e?.customTable?.cell_borderPosition:e?.customTable?.borderPosition,Je=Object.keys(H).find(no=>H[no]?.width||H[no]?.style||H[no]?.color);a.setFieldsValue({...e,width:e.width?.value,widthDim:e.width?.dim,maxWidth:e.maxWidth?.value,maxWidthDim:e.maxWidth?.dim,minWidth:e.minWidth?.value,minWidthDim:e.minWidth?.dim,show:e.show?e.show:"all",mobileAlign:e.mobileAlign?.value,mobileBorderPosition:Je||"all",mobileBorderWidth:H[Je]?.width!==null?H[Je]?.width:"",mobileBorderColor:H[Je]?.color||"",mobileBorderStyle:H[Je]?.style||"",...nt(e),exportAsPicture:e?.exportAsPicture,paddingLeftRight:u(e.customTable?.paddingLeftRight.replace(/px$/,"")),paddingTopBottom:u(e.customTable?.paddingTopBottom.replace(/px$/,"")),paddingRight:u(e.customTable?.paddingRight.replace(/px$/,"")),paddingLeft:u(e.customTable?.paddingLeft.replace(/px$/,"")),paddingTop:u(e.customTable?.paddingTop.replace(/px$/,"")),paddingBottom:u(e.customTable?.paddingBottom.replace(/px$/,"")),backgroundColor:u(e.customTable?.backgroundColor),backgroundImage:u(e.customTable?.backgroundImage[0].value),backgroundPositionX:u(e.customTable?.backgroundPositionX),backgroundPositionY:u(e.customTable?.backgroundPositionY),backgroundRepeat:u(e.customTable?.backgroundRepeat),backgroundSize:u(e.customTable?.backgroundSize),borderAll:u(e.customTable?.borderAll),borderRadiusAll:u(e.customTable?.borderRadius.all),borderRadiusTopLeft:u(e.customTable?.borderRadius.topLeft),borderRadiusBottomLeft:u(e.customTable?.borderRadius.bottomLeft),borderRadiusTopRight:u(e.customTable?.borderRadius.topRight),borderRadiusBottomRight:u(e.customTable?.borderRadius.bottomRight),borderRadius:{all:u(e.customTable?.borderRadius.all),topLeft:u(e.customTable?.borderRadius.topLeft),topRight:u(e.customTable?.borderRadius.topRight),bottomLeft:u(e.customTable?.borderRadius.bottomLeft),bottomRight:u(e.customTable?.borderRadius.bottomRight)},borderTop:u(e.customTable?.borderTop),borderBottom:u(e.customTable?.borderBottom),borderLeft:u(e.customTable?.borderLeft),borderRight:u(e.customTable?.borderRight),borderPosition:Ee||"borderAll",boxShadowInset:u(e.customTable?.boxShadow?.inset)||!1,boxShadowHOffset:u(e.customTable?.boxShadow?.hOffset),boxShadowVOffset:u(e.customTable?.boxShadow?.vOffset),boxShadowBlurRadius:u(e.customTable?.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.customTable?.boxShadow?.spreadRadius),boxShadowColor:u(e.customTable?.boxShadow?.color),mobileBoxShadowInset:u(e.customTable?.mobileBoxShadow?.inset)||!1,mobileBoxShadowHOffset:u(e.customTable?.mobileBoxShadow?.hOffset),mobileBoxShadowVOffset:u(e.customTable?.mobileBoxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.customTable?.mobileBoxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.customTable?.mobileBoxShadow?.spreadRadius),mobileBoxShadowColor:u(e.customTable?.mobileBoxShadow?.color),mobileBackgroundColor:u(e.customTable?.mobileBackgroundColor?.value!=="none"?e.customTable?.mobileBackgroundColor?.value:""),mobileWidth:po(e.customTable?.mobileWidth?.value),mobileWidthDim:e.customTable?.mobileWidth?.dim,mobileHeight:po(e.customTable?.mobileHeight?.value),mobileHeightDim:e.customTable?.mobileHeight?.dim,mobileBorderRadiusAll:u(e.customTable?.mobileBorderRadius.all),mobileBorderRadiusTopLeft:u(e.customTable?.mobileBorderRadius.topLeft!==null?e.customTable?.mobileBorderRadius.topLeft:e.customTable?.mobileBorderRadius.all),mobileBorderRadiusBottomLeft:u(e.customTable?.mobileBorderRadius.bottomLeft!==null?e.customTable?.mobileBorderRadius.bottomLeft:e.customTable?.mobileBorderRadius.all),mobileBorderRadiusTopRight:u(e.customTable?.mobileBorderRadius.topRight!==null?e.customTable?.mobileBorderRadius.topRight:e.customTable?.mobileBorderRadius.all),mobileBorderRadiusBottomRight:u(e.customTable?.mobileBorderRadius.bottomRight!==null?e.customTable?.mobileBorderRadius.bottomRight:e.customTable?.mobileBorderRadius.all),cellBackgroundColor:u(e.customTable?.cellBackgroundColor),cell_borderPosition:u("cell_borderAll"),cell_borderAll:u(e.customTable?.cell_borderAll),cell_borderTop:u(e.customTable?.cell_borderTop),cell_borderBottom:u(e.customTable?.cell_borderBottom),cell_borderLeft:u(e.customTable?.cell_borderLeft),cell_borderRight:u(e.customTable?.cell_borderRight),cell_paddingLeftRight:u(e.customTable?.cell_paddingLeftRight?.replace(/px$/,"")),cell_paddingTopBottom:u(e.customTable?.cell_paddingTopBottom?.replace(/px$/,"")),cell_paddingRight:u(e.customTable?.cell_paddingRight?.replace(/px$/,"")),cell_paddingLeft:u(e.customTable?.cell_paddingLeft?.replace(/px$/,"")),cell_paddingTop:u(e.customTable?.cell_paddingTop?.replace(/px$/,"")),cell_paddingBottom:u(e.customTable?.cell_paddingBottom?.replace(/px$/,"")),fontFamily:u(e.customTable?.fontFamily),fontSize:u(e.customTable?.fontSize),lineHeight:u(e.customTable?.lineHeight),textStrong:u(e.customTable?.textStrong),textItalic:u(e.customTable?.textItalic),textStrikethrough:u(e.customTable?.textStrikethrough),textUnderline:u(e.customTable?.textUnderline),textLink:u(e.customTable?.textLink),linkHref:u(e.customTable?.linkHref),linkTarget:u(e.customTable?.linkTarget),textColor:u(e.customTable?.textColor),textBackgroundColor:u(e.customTable?.textBackgroundColor),textAlign:u(e.customTable?.textAlign),valign:u(e.customTable?.textValign)}),!u(e.customTable?.borderRadius.all)&&(u(e.customTable?.borderRadius.topLeft)||u(e.customTable?.borderRadius.bottomLeft)||u(e.customTable?.borderRadius.topRight)||u(e.customTable?.borderRadius.bottomRight))?k(!1):k(!0),!u(e.customTable?.mobileBorderRadius.all)&&u(e.customTable?.mobileBorderRadius.topLeft)||u(e.customTable?.mobileBorderRadius.bottomLeft)||u(e.customTable?.mobileBorderRadius.topRight)||u(e.customTable?.mobileBorderRadius.bottomRight)?C(!1):C(!0),K(e.customTable?.backgroundImage[0].value===""),$(no=>F[Ee]?.width||F[Ee]?.style||F[Ee]?.color?!0:no),R(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),Ie(!!e.boxShadow),G(!!e.width?.value||!!e.minWidth?.value||!!e.maxWidth?.value),ne(!!e.customTable?.mobileWidth.value),le(!!e.exportAsPicture)}},[a,e]),(0,n.useEffect)(()=>{const F=a.getFieldValue("linkHref");typeof e.customTable?.linkHref=="string"&&$e(!0),Pe&&!F&&($e(!1),a.setFieldsValue({linkHref:null})),Pe.current=F||null},[Ue?.textLink,Ue?.linkHref,e.customTable?.linkHref,a]),(0,n.useEffect)(()=>{e.customTable?.linkHref&&Uo(e.customTable?.linkHref||"",me),a.setFieldsValue({linkHref:typeof e.customTable?.linkHref=="string"?e.customTable.linkHref:"https://"})},[a,e,me]);const oe=F=>{a.setFieldValue("linkHref",F!=="mergetag"?F:""),me(F)},j=F=>{const b=a.getFieldsValue(!0),H=Object.keys(F)[0];let ae;const je=yd.includes(H)&&b[H]?{...b[H],width:b[H].width===""?b.borderAll?.width||"1":b[H].width,color:b[H].color===""?b.borderAll?.color||ie:b[H].color,style:b[H].style===""?b.borderAll?.style||"solid":b[H].style}:null,Ee=["top","right","bottom","left"],Je="em-mob-border_",no=Bo=>({...r.RESET_BORDER_PARAMS[Bo],classNamePrefix:`${Je}${Bo}-`}),wo=(Bo,ao,yo,Ko)=>Ee.reduce((ko,Vo)=>(ko[Vo]={...Bo,[yo]:Vo===ao?Ko:Bo[yo],classNamePrefix:`${Je}${Vo}-`},ko),{}),Po=(Bo,ao,yo,Ko)=>{const ko=Ko.mobileBorderPosition,Vo=ko==="all",It=ao===""||ao==null;let Lo;Vo?Lo={all:{...yo.all,[Bo]:It?null:ao,classNamePrefix:`${Je}all-`},...Ee.reduce((ni,Ct)=>({...ni,[Ct]:no(Ct)}),{})}:It?Lo={...yo,[ko]:no(ko),all:{...r.RESET_BORDER_PARAMS.all}}:yo.all?.color!=null&&yo.all?.width!=null&&yo.all?.style!=null?Lo={...wo(yo.all,ko,Bo,ao),all:{...r.RESET_BORDER_PARAMS.all}}:Lo={...yo,[ko]:{...yo[ko],[Bo]:ao,classNamePrefix:`${Je}${ko}-`},all:{...r.RESET_BORDER_PARAMS.all}};const rt=Vo?Lo.all:Lo[ko],ai={mobileBorderColor:rt?.color??ie,mobileBorderWidth:rt?.width??1,mobileBorderStyle:rt?.style??"solid"};return{newBorders:Lo,sending:{mobileBorder:Lo},formUpdates:ai}};switch(H){case"exportAsPicture":ae={exportAsPicture:b.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":ae={boxShadow:{hOffset:b.boxShadowHOffset,vOffset:b.boxShadowVOffset,blurRadius:b.boxShadowBlurRadius,spreadRadius:b.boxShadowSpreadRadius,color:b.boxShadowColor,inset:b.boxShadowInset}};break;case"width":ae={[H]:{value:F[H],dim:b.widthDim}};break;case"widthDim":ae={width:{value:b.width,dim:F[H]}};break;case"maxWidth":ae={[H]:{value:F[H],dim:b.maxWidthDim}};break;case"maxWidthDim":ae={maxWidth:{value:b.maxWidth,dim:F[H]}};break;case"minWidth":ae={[H]:{value:F[H],dim:b.minWidthDim}};break;case"minWidthDim":ae={minWidth:{value:b.minWidth,dim:F[H]}};break;case"backgroundImage":K(F[H]===""),ae={[H]:[{...e.customTable?.backgroundImage[0],value:F[H]}],backgroundSize:"cover"},a.setFieldsValue({backgroundColor:""});break;case"backgroundColor":K(!0),ae=F,a.setFieldsValue({backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:""});break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":ae={borderRadius:{[z.BORDER_RADIUS_POSITION[H]]:+F[H]}};break;case"mobileWidth":ae={[H]:{classNamePrefix:"em-mob-width-",value:F[H],dim:b.mobileWidthDim}};break;case"mobileWidthDim":ae={mobileWidth:{classNamePrefix:"em-mob-width-",value:b.mobileWidth||100,dim:F[H]}};break;case"mobileHeight":ae={[H]:{classNamePrefix:"em-mob-height-",value:F[H],dim:b.mobileHeightDim}};break;case"mobileBorderStyle":case"mobileBorderColor":case"mobileBorderWidth":const Bo={mobileBorderStyle:"style",mobileBorderColor:"color",mobileBorderWidth:"width"}[H],{newBorders:ao,sending:yo,formUpdates:Ko}=Po(Bo,F[H],x,b);Object.assign(b,Ko),T(ao),ae=yo;break;case"mobileBorderPosition":a.setFieldsValue({mobileBorderWidth:x[F[H]].width||"",mobileBorderColor:x[F[H]].color||"",mobileBorderStyle:x[F[H]].style||""});break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":ae={mobileBorderRadius:{[z.MOBILE_BORDER_RADIUS_POSITION[H]]:F[H],classNamePrefix:"em-mob-border_radius_"+z.MOBILE_BORDER_RADIUS_POSITION[H]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":ae={mobileBoxShadow:{hOffset:b.mobileBoxShadowHOffset,vOffset:b.mobileBoxShadowVOffset,blurRadius:b.mobileBoxShadowBlurRadius,spreadRadius:b.mobileBoxShadowSpreadRadius,color:b.mobileBoxShadowColor,inset:b.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(ae=xt(F),!ae)return;break;case"mobileAlign":ae={[H]:{classNamePrefix:"em-mob-table_align-",value:F[H]}};break;case"borderPosition":ae=F,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:ae});break;case"borderAll":F[H]?.style===""?a.setFieldsValue({borderAll:fe}):a.setFieldsValue({borderTop:fe,borderBottom:fe,borderLeft:fe,borderRight:fe}),ae=F;break;case"borderTop":a.setFieldsValue({borderTop:je}),F[H]?.style===""?a.setFieldsValue({borderTop:fe}):a.setFieldsValue({borderAll:fe}),ae=F;break;case"borderBottom":a.setFieldsValue({borderBottom:je}),F[H]?.style===""?a.setFieldsValue({borderBottom:fe}):a.setFieldsValue({borderAll:fe}),ae=F;break;case"borderLeft":a.setFieldsValue({borderLeft:je}),F[H]?.style===""?a.setFieldsValue({borderLeft:fe}):a.setFieldsValue({borderAll:fe}),ae=F;break;case"borderRight":a.setFieldsValue({borderRight:je}),F[H]?.style===""?a.setFieldsValue({borderRight:fe}):a.setFieldsValue({borderAll:fe}),ae=F;break;case"cell_borderPosition":ae=F,s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:ae});break;case"fontSize":case"lineHeight":if(F[H]===null||F[H]===""||F[H]===void 0)return;ae=F;break;case"linkHref":{const ko=et(F[H]);ko!==F[H]&&a.setFieldValue("linkHref",ko),ae={linkHref:ko},Uo(ko,me);break}default:ae=F}H!=="borderPosition"&&s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:ae})},w=(0,n.useCallback)(()=>{ud(a,Re,$,J,M,Ne,O)},[a,Re,M,O]),ue=(0,n.useCallback)(()=>{md(a,W,A,x,T,s,e)},[a,A,x,s,e]),ve=(0,n.useCallback)(()=>{pd(a,R,se,k,s,e,O)},[a,se,k,s,e,O]),Xe=(0,n.useCallback)(()=>{hd(a,he,te,s,e)},[a,te,s,e]),Ke=(0,n.useCallback)(()=>{bd(a,Ie,be,s,e)},[a,be,s,e]),to=(0,n.useCallback)(()=>{fd(a,Be,xe,s,e)},[a,xe,s,e]),io=(0,n.useCallback)(()=>{gd(a,ne,ke,s,e)},[a,ke,s,e]),co=(0,n.useCallback)(()=>{_d(Fe)},[Fe]),Eo=(0,n.useCallback)(()=>{xd(a,ye,Se,s,e)},[a,Se,s,e]),xo=(0,n.useCallback)(()=>{kd(a,q,re,s,e)},[a,re,s,e]),D=(0,n.useCallback)(()=>{Ed(a,Q,X,s,e)},[a,X,s,e]),ee=(0,n.useCallback)(()=>{Bd(U)},[U]),B=(0,n.useCallback)(()=>{Sd(a,Q,X,s,e)},[a,X,s,e]);return(0,o.jsxs)(t.ui_kit$Form,{form:a,layout:"vertical",name:i,initialValues:{paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",cell_paddingTop:"",cell_paddingLeft:"",cell_paddingRight:"",cell_paddingBottom:"",cell_paddingLeftRight:"",cell_paddingTopBottom:"",borderAll:{width:"",style:"",color:""},borderTop:{width:"",style:"",color:""},borderBottom:{width:"",style:"",color:""},borderLeft:{width:"",style:"",color:""},borderRight:{width:"",style:"",color:""},cellBackgroundColor:"",backgroundImageForCell:"",cellBackgroundPositionX:"",cellBackgroundPositionY:"",cellBackgroundRepeat:"",cellBackgroundSize:"",backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,show:"all",width:{value:"",dim:""},maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",mobileAlign:"",border:"",boxShadow:"",borderPosition:"",borderColor:"",borderWidth:"",borderStyle:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"px",mobileBorder:"",mobileBorderPosition:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBorderAll:"",mobileBorderTop:"",mobileBorderBottom:"",mobileBorderLeft:"",mobileBorderRight:"",mobileBoxShadow:"",mobileBackgroundColor:"",mobileBackgroundImage:"",cell_border:"",cell_borderColor:"",cell_borderWidth:"",cell_borderStyle:"",cell_borderPosition:"cell_borderAll",cell_borderAll:{color:"",width:"",style:""},cell_borderTop:{color:"",width:"",style:""},cell_borderBottom:{color:"",width:"",style:""},cell_borderLeft:{color:"",width:"",style:""},cell_borderRight:{color:"",width:"",style:""},cell_borderRadiusAll:"",cell_RadiusTopLeft:"",cell_RadiusBottomLeft:"",cell_RadiusTopRight:"",cell_RadiusBottomRight:"",fontFamily:"",fontSize:"",lineHeight:"",textStrong:"",textItalic:"",textStrikethrough:"",textUnderline:"",textLink:"",linkHref:"",textColor:"",textAlign:"",verticalAlign:"",textBackgroundColor:"",valign:""},onValuesChange:j,autoComplete:"off",className:"element-controls",style:{padding:0,display:"flex",flexDirection:"column"},children:[!v&&(0,o.jsx)(t.ui_kit$Tooltip,{title:l("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:l("Appearance on mobile devices"),type:"info"})}),Re?(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Td,{form:a,onBorderSideClear:j,formValues:Ue,elementSettings:e,appConfig:c,token:d,isMacOS:Oe,__:l,handleToggleShowPaddingCell:ee,handleTogglePaddingCell:B,handleToggleBackground:co,handleToggleBorder:w,handleToggleBorderRadius:ve,paddingCellShow:Z,paddingsExt:X,backgroundShow:He,cellBordersShow:V,borderRadiusShow:se,oneBorderRadiusValue:S,setOneBorderRadiusValue:k,backgroundImageEmpty:P,backgroundRepeatOptions:ze,backgroundSizeOptions:ce,sendAction:Ge,typografItems:Qe,textInputRef:Me,linkProtocol:de,handleLinkProtocolsChange:oe,isCodeVision:v})}):(0,o.jsx)(Rd,{form:a,onBorderSideClear:j,elementSettings:e,handleToggleShowPadding:xo,handleTogglePadding:D,handleToggleBackground:co,handleToggleBorder:w,handleToggleBorderRadius:ve,handleToggleBoxShadow:Ke,handleToggleMobileSize:io,handleToggleMobileBackground:Eo,handleToggleMobileBorder:ue,handleToggleMobileBorderRadius:Xe,handleToggleMobileBoxShadow:to,paddingShow:re,paddingsExt:X,backgroundShow:He,bordersShow:M,borderRadiusShow:se,boxShadowShow:be,mobileSizeShow:ke,mobileBackgroundShow:Se,mobileBordersShow:A,mobileBorderRadiusShow:te,mobileBoxShadowShow:xe,oneBorderRadiusValue:S,setOneBorderRadiusValue:k,oneMobileBorderRadiusValue:y,setOneMobileBorderRadiusValue:C,backgroundImageEmpty:P,backgroundRepeatOptions:ze,backgroundSizeOptions:ce,boxShadow:h,mobileBorders:x,mobileBoxShadow:I,elementViewType:m,mobileViewActive:f})," "]})};Ml.propTypes={elementSettings:_.default.object.isRequired};var dt=({className:e=null,formSettings:i,emailElementType:l,formName:s})=>{const a=r.useDispatch(),d=r.useSendStyleToggleToIframe(),c=(0,n.useRef)(),m=r.useSelector(r.selectActiveSettingsTab),f=r.useSelector(r.selectElementSettings$1),g=r.useSelector(r.selectElementSettings),E=r.useContainer(),h=r.getComponentRegistry(E),p=l==="email"?f:g,S=p.type,k=S===r.ELEMENT_TYPES.CAROUSEL||S===r.ELEMENT_TYPES.IMG?i.settings:p,[x,T]=(0,n.useState)(k),[I,L]=(0,n.useState)(k);k!==I&&(L(k),T(k));const y=C=>{const P=C.data.operation,K=C.data.action;if(P===r.EVENT_TYPES.APPLICATION_ACTION){let $=function(A,W=null){const se={[A]:W||!x[A]};d(se,x.type),a(r.setEmailSettings(se)),T(R=>({...R,...se}))};var M=$;K==="toggle_strong"&&$("textStrong"),K==="toggle_italic"&&$("textItalic"),K==="toggle_underline"&&$("textUnderline"),K==="toggle_strikethrough"&&$("textStrikethrough"),K==="textAlign_left"&&$("textAlign","left"),K==="textAlign_right"&&$("textAlign","right"),K==="textAlign_center"&&$("textAlign","center")}};return r.useListenPostMessage(y),(0,o.jsx)("div",{className:"selected-element-panel",children:(0,o.jsx)(r.CSSTransition,{nodeRef:c,in:m===r.PROPERTIES,timeout:300,classNames:"transition",children:(0,o.jsxs)("div",{ref:c,className:(0,We.default)("selected-element-panel-content",{[e]:e}),children:[i?.type==="advanced"&&i?.content?(0,o.jsx)(n.Fragment,{children:h.getReactElement(i.content)},i.instanceKey):null,(p.type===r.ELEMENT_TYPES.IMG||p.type===r.ELEMENT_TYPES.COUNTDOWN||p.type===r.ELEMENT_TYPES.VIDEO)&&(0,o.jsx)(Ur,{elementSettings:p}),p.type===r.ELEMENT_TYPES.TEXT&&(0,o.jsx)(Bn,{elementSettings:p}),p.type===r.ELEMENT_TYPES.LINK&&(0,o.jsx)(sl,{elementSettings:p}),p.type===r.ELEMENT_TYPES.TABLE&&(0,o.jsx)(ll,{elementSettings:p}),p.type===r.ELEMENT_TYPES.CUSTOM_TABLE&&(0,o.jsx)(Ml,{elementSettings:p,formName:s}),(p.type===r.ELEMENT_TYPES.TD||p.type===r.ELEMENT_TYPES.STRUCTURE||p.type===r.ELEMENT_TYPES.GROUP||p.type===r.ELEMENT_TYPES.COLUMN)&&(0,o.jsx)(ml,{elementSettings:p}),p.type===r.ELEMENT_TYPES.VAR&&(0,o.jsx)(Bl,{elementSettings:p}),p.type===r.ELEMENT_TYPES.BUTTON&&(0,o.jsx)(El,{elementSettings:p}),p.type===r.ELEMENT_TYPES.DIV&&(0,o.jsx)(bl,{elementSettings:p}),p.type===r.ELEMENT_TYPES.VINDENT&&(0,o.jsx)(dl,{elementSettings:p}),p.type===r.ELEMENT_TYPES.FLOAT_BLOCK&&(0,o.jsx)(_l,{elementSettings:p}),i.type===r.ELEMENT_TYPES.CAROUSEL&&(0,o.jsx)(wl,{elementSettings:i}),i.type===r.ELEMENT_TYPES.ACCORDION&&(0,o.jsx)(jl,{elementSettings:i}),i.type===r.ELEMENT_TYPES.SOCIAL&&(0,o.jsx)(Ll,{elementSettings:i})]})})})};dt.propTypes={className:_.default.string,formName:_.default.string};function Go(){return!!document.querySelector(".selected-element-panel__columns-settings__links__add")?.closest(".selected-element-panel")}var Dl=({emailElementType:e,isSelectedElement:i=!1,selectedElement:l={parent:!1}})=>{const{__:s}=r.useI18n(),a=r.useDispatch(),d=r.useSendPostMessage(),[c]=t.ui_kit$Form.useForm(),m=(0,n.useRef)(),f=(0,n.useRef)(),g=r.useSelector(r.selectElementSettings$1),E=r.useSelector(r.selectElementSettings),h=r.useAppConfig(),p=l||(e==="email"?g:E),[S,k]=(0,n.useState)(p.floatBlocks?.wrap),[x,T]=(0,n.useState)(p.floatBlocks?.dirRevers),[I,L]=(0,n.useState)(null),[y,C]=(0,n.useState)(0),[P,K]=(0,n.useState)([]),M=r.useSelector(r.selectEmailViewType),$=(0,n.useCallback)(Se=>{a(e==="email"?r.setElementSettings$1(Se):r.setElementSettings(Se))},[a,e]);(0,n.useEffect)(()=>{if(p&&JSON.stringify(p)!=="{}"&&c._init){if(c.resetFields(),c.setFieldsValue({gap:p.floatBlocks?.gap,gapMobile:p.floatBlocks?.gapMobile,gapDim:"px",valign:p.floatBlocks?.valign}),p.floatBlocks?.items.length>0){let q=function(X,Q){if(X.length!==Q.length)return!1;for(let Z=0;Z<X.length;Z++)if(X[Z]!==Q[Z])return!1;return!0};var Se=q;const ye=p.floatBlocks.items.reduce((X,Q)=>X+Q.width,0),re=p.floatBlocks.items.map(X=>((X.width||0)/ye*100).toFixed(1));C(ye),!q(re,P)&&p.changeKey!=="gap"&&K(re),p.floatBlocks.items.forEach((X,Q)=>c.setFieldsValue({["width-"+Q]:X.width||0})),p.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(p.floatBlocks?.wrap)}},[c,p,I,P]);let A=0;p.floatBlocks?.items.length>0&&(A=p.floatBlocks.items.length);const W=(Se,ye)=>{Object.keys(ye).forEach(re=>{if(re.includes("width")){const q=parseInt(re.match(/\d+/));c.setFieldsValue({[re]:Se.items[q]})}})},[se,R]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const Se=()=>R(!0),ye=()=>R(!1);return document.addEventListener("keyup",ye),document.addEventListener("keydown",Se),()=>{document.removeEventListener("keyup",ye),document.removeEventListener("keydown",Se)}},[]);const te=Se=>{f.current&&se&&clearTimeout(f.current),f.current=setTimeout(()=>ye(Se),50);function ye(re){const q=c.getFieldsValue(!0),X=Object.keys(re)[0];if(L(X),X.includes("width")){if(q[X]&&q[X]>=30){let Q={items:[],gap:q.gap,valign:q.valign,activateSection:i?void 0:"structure"},Z=0;if(document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").length>1){Z=parseFloat(Object.keys(re)[0].substring(Object.keys(re)[0].length-1));const U=q["width-"+(Z+1)]?Z+1:0;let V=y;Object.keys(q).forEach(J=>{J.includes("width")&&J.indexOf("width-"+U)===-1&&(V-=q[J])}),q["width-"+U]=V}Object.keys(q).forEach(U=>{U.includes("width")&&Q.items.push(q[U])}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:Q}),$({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...Q,items:p.floatBlocks.items.map((U,V)=>({...p.floatBlocks.items[V],width:Q.items[V]}))},changeKey:X})}}else if(X==="gap"){const Q={items:p.floatBlocks.items.map(J=>J.width),gap:p.floatBlocks.gap},Z=Q.items.reduce((J,de)=>J+de,0)+(Q.items.length-1)*Q.gap,U=q.gap,V=Z-(Q.items.length-1)*U;if(V>Q.items.length*30||p.floatBlocks.gap-re>=0){const J=(Ae,we)=>Math.round(we*Ae/100);let de=Q.items.map((Ae,we)=>J(P[we],V));const me=Z-(de.reduce((Ae,we)=>Ae+we,0)+(Q.items.length-1)*U);if(me!==0){const Ae=de.length-Math.abs(me);de=de.map((we,$e)=>Ae<=$e?we+(me>0?1:-1):we)}let pe={items:de,gap:U||0};W(pe,q),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGap",settings:pe,editFromStructure:Go()}),$({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...pe,items:p.floatBlocks.items.map((Ae,we)=>({...Ae,width:pe.items[we]}))},changeKey:X})}}else if(X==="valign"){let Q={valign:q.valign};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksValign",settings:Q,editFromStructure:Go()}),$({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...Q},changeKey:X})}else if(X==="gapMobile"){let Q={mobileHeight:{classNamePrefix:"em-mob-height-",value:re[X],dim:"px"}};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGapMobile",settings:Q}),$({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,gapMobile:Q.mobileHeight.value},changeKey:X})}setTimeout(()=>m?.current&&m.current.focus({cursor:"end"}),600)}},he=()=>{const Se=c.getFieldsValue(!0),ye=p.floatBlocks.items.map(V=>V.width);let re={items:[],gap:Se.gap};const q=ye.reduce((V,J)=>V+J,0),X=ye.length,Q=Math.ceil(y/X)*X,Z=Q/X,U=q-Q;if(re.items=Array(X).fill(Z),U!==0){const V=ye.length-Math.abs(U);re.items=re.items.map((J,de)=>V<=de?J+(U>0?1:-1):J)}W(re,Se),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:re,editFromStructure:Go()}),$({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...re,items:p.floatBlocks.items.map((V,J)=>({...V,width:re.items[J]}))},changeKey:"width"})},be=Se=>{const ye=c.getFieldsValue(!0),re=p.floatBlocks.items.map(pe=>pe.width),q=p.floatBlocks.gap||20,X=Se.cols-re.length;let Q=[],Z=re.reduce((pe,Ae)=>pe+Ae,0);Se.cols>=re.length?Z-=q*X:Z+=q*Math.abs(X);const U=Math.round(Z/Se.cols);function V(pe,Ae){const we=[];for(let $e=0;$e<pe;$e++)we.push(Se.width?.[$e]?Math.round(Z/100*Se.width?.[$e]):Ae);return we}Q=V(Se.cols,U);const J=Z-Q.reduce((pe,Ae)=>pe+Ae,0);if(J!==0){let pe=Q.map((we,$e)=>[$e,we]).filter(we=>we[1]>30);const Ae=pe.length-Math.abs(J);pe=pe.map((we,$e)=>{const Y=Ae<=$e?we[1]+(J>0?1:-1):we[1];return[we[0],Y]}),pe.map(we=>(Q[we[0]]=we[1],we))}let de={items:Q,gap:ye.gap||20};const me=Q.reduce((pe,Ae)=>pe+Ae,0);K(Q.map(pe=>(pe/me*100).toFixed(1))),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksPreset",settings:de,editFromStructure:Go()}),$({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...de,items:de.items.map((pe,Ae)=>({width:pe,current:!1}))},changeKey:"width"})},Ie=()=>{const Se=c.getFieldsValue(!0);if(A<8){const ye=p.floatBlocks.items.map(V=>V.width),re=p.floatBlocks.gap,q=ye.reduce((V,J)=>V+(J>30?J:0),0),X=(q-30-re)/q,Q=ye.map(V=>V>30?Math.round(V*X):V).reduce((V,J)=>V+(J>30?J:0),0);let Z=ye.map(V=>V>30?Math.round(V*X):V);Z.push(30);const U=q-Q-30-re;if(U!==0){let V=Z.map((de,me)=>[me,de]).filter(de=>de[1]>30);const J=V.length-Math.abs(U);V=V.map((de,me)=>{const pe=J<=me?de[1]+(U>0?1:-1):de[1];return[de[0],pe]}),V.map(de=>(Z[de[0]]=de[1],de))}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_ADD,settings:{gap:Se.gap,gapMobile:Se.gapMobile,minWidth:30},editFromStructure:Go()}),$({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,items:Z.map((V,J)=>({width:V,current:p.floatBlocks.items[J]?.current||!1}))},changeKey:"width"})}else document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.add("noactive")},xe=Se=>{const ye=c.getFieldsValue(!0);let re=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((pe,Ae)=>{pe===Se.target.closest(".selected-element-panel__columns-settings__controls__column")&&(re=Ae)});const q=+p.floatBlocks.gap,X=+p.floatBlocks.items[re].width+q,Q=p.floatBlocks.items.map(pe=>+pe.width),Z=(Q.length-1)*q,U=Q.reduce((pe,Ae)=>pe+Ae,0)+Z,V=Q.length-1,J=Math.floor(X/V);let de=Q.filter((pe,Ae)=>Ae!==re).map(pe=>pe+J);const me=U-(de.reduce((pe,Ae)=>pe+Ae,0)+(Q.length-2)*q);if(me!==0){const pe=de.length-Math.abs(me);de=de.map((Ae,we)=>pe<=we?Ae+(me>0?1:-1):Ae)}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_REMOVE,settings:{removedBlockIndex:re,gap:ye.gap},editFromStructure:Go()}),$({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,items:de.map((pe,Ae)=>({width:pe,current:p.floatBlocks.items.filter((we,$e)=>$e!==re)[Ae].current}))},changeKey:"width"})},Be=Se=>{if(A>=8)return;const ye=c.getFieldsValue(!0);let re=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((we,$e)=>{we===Se.target.closest(".selected-element-panel__columns-settings__controls__column")&&(re=$e)});const q=parseFloat(ye.gap)||0,X=p.floatBlocks.items.map(we=>+we.width),Q=X[re],Z=X.reduce((we,$e)=>we+$e,0),U=Z-q,V=Z+Q,J=V>0?U/V:1;let de=[];const me=[];X.forEach((we,$e)=>{de.push(Math.max(30,Math.round(we*J))),me.push(p.floatBlocks.items[$e]?.current||!1),$e===re&&(de.push(Math.max(30,Math.round(Q*J))),me.push(!1))});const pe=U-de.reduce((we,$e)=>we+$e,0);if(pe!==0){let we=de.map((Y,le)=>[le,Y]).filter(Y=>Y[1]>30);const $e=we.length-Math.abs(pe);we=we.map((Y,le)=>[Y[0],$e<=le?Y[1]+(pe>0?1:-1):Y[1]]),we.forEach(Y=>de[Y[0]]=Y[1])}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_COPY,settings:{copiedBlockIndex:re,gap:ye.gap,widths:de},editFromStructure:Go()});const Ae=de.reduce((we,$e)=>we+$e,0);K(de.map(we=>(we/Ae*100).toFixed(1))),$({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,items:de.map((we,$e)=>({width:we,current:me[$e]||!1}))},changeKey:"width"})},ke=(0,n.useCallback)(Se=>{const ye=".selected-element-panel__columns-settings__controls__column",re=Array.from(document.querySelectorAll(ye)).indexOf(Se.target.closest(ye)),q=re-1;if(q<0)return;const X=p.floatBlocks,Q=X.items.map(({width:Z,current:U})=>({width:Z,current:U||!1}));[Q[q],Q[re]]=[Q[re],Q[q]],d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_SWAP,settings:{indexA:q,indexB:re},editFromStructure:Go()}),$({...p,activateSection:i?void 0:"structure",floatBlocks:{...X,items:Q},changeKey:"width"})},[p,$,i,d]),ne=Se=>{k(Se),d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_WRAP,settings:{wrap:!S}}),$({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,wrap:!S},changeKey:"wrap"})},He=Se=>{T(Se),d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_DIR,settings:{dirRevert:!x}}),$({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,dirRevert:!x},changeKey:"dir"})},Fe=()=>setTimeout(()=>m?.current&&m.current.focus({cursor:"end"}),300);return p.floatBlocks&&p.floatBlocks.items.length>0&&(0,o.jsx)(t.ui_kit$Form,{layout:"vertical",form:c,name:"float_blocks_settings_form",autoComplete:"off",initialValues:{gap:p.floatBlocks?.gap||0,gapDim:"px",gapMobile:p.floatBlocks?.gapMobile||0,valign:p.floatBlocks?.valign||"top",...p.floatBlocks?.items.reduce((Se,{width:ye},re)=>(Se[`width-${re}`]=ye,Se),{})},onValuesChange:te,onFieldsChange:Fe,className:"element-controls",children:(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings",style:{paddingTop:h.switchDesktopMobilePropsEnabled||h.stepToOtherElementEnabled||h.deleteButtonEnabled||p.type==="structure"?0:24},children:[p.floatBlocks.items.length===1&&(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:10},title:s('The selected element is in the block that supports a multicolumn structure. To add a new column, click the "Add a column" button.'),type:"info"}),M!=="mobile"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__header",children:[(0,o.jsx)("span",{className:"selected-element-panel__columns-settings__header-title",children:s("Columns")}),(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__links",children:[(0,o.jsxs)("span",{className:"selected-element-panel__columns-settings__links__add",onClick:Ie,children:[(0,o.jsx)(r.EmIcons,{icon:"PlusCircleOutlined",component:t.icons$PlusCircleOutlined,size:16,strokeWidth:h.iconStrokeWidth})," ",s("Add column")]}),p.floatBlocks.items.length>1&&(0,o.jsx)("span",{onClick:he,children:(0,o.jsxs)(t.ui_kit$Tooltip,{title:s("Make columns the same width."),children:[(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined})," ",s("Equalize")]})})]})]}),p.floatBlocks.items.length>1&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:16},children:(0,o.jsx)("div",{className:"selected-element-panel__columns-settings__controls",children:p.floatBlocks.items.map((Se,ye)=>(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__controls__column "+(Se.current?"current":""),style:{width:Se.width/y*100+"%"},children:[ye>0&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Swap columns"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__swap",onClick:ke,children:(0,o.jsx)(r.EmIcons,{icon:"SwapHorizontalIcon",component:t.icons$SwapHorizontalIcon,size:15,strokeWidth:h.iconStrokeWidth})})}),p.floatBlocks.items.length>1&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Delete column"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__remove",onClick:xe,children:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:15,strokeWidth:h.iconStrokeWidth,style:{color:"#ff4d4f"}})})}),p.floatBlocks.items.length<8&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Copy column"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__copy",onClick:Be,children:(0,o.jsx)(r.EmIcons,{icon:"CopyOutlined",component:t.icons$CopyOutlined,size:15,strokeWidth:h.iconStrokeWidth})})}),(0,o.jsx)("div",{className:"selected-element-panel__columns-settings__controls__field",children:(0,o.jsx)(t.ui_kit$Form.Item,{label:"",name:"width-"+ye,children:(0,o.jsx)(t.ui_kit$InputNumber,{min:30,value:Se.width||0,placeholder:s("Width"),ref:I==="width-"+ye&&m})})})]},"floatblock-"+ye))})}),(0,o.jsxs)("div",{className:"columns-presets",children:[(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{be({cols:1})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol1",component:t.icons$LayoutCol1})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{be({cols:2})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol2",component:t.icons$LayoutCol2})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{be({cols:2,width:[66,34]})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol2WideLeft",component:t.icons$LayoutCol2WideLeft})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{be({cols:2,width:[34,66]})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol2WideRight",component:t.icons$LayoutCol2WideRight})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{be({cols:3})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol3",component:t.icons$LayoutCol3})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{be({cols:4})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol4",component:t.icons$LayoutCol4})})]})]}),p.floatBlocks.items.length>1&&(0,o.jsxs)(o.Fragment,{children:[M==="mobile"&&(0,o.jsx)("div",{style:{marginBottom:24},children:(0,o.jsx)(t.ui_kit$Switch,{id:"column-wrap",label:s("Line break on mobile devices"),size:"small",disabled:p.floatBlocks?.wrap===void 0,checked:S,onChange:ne,labelStyle:{position:"relative",top:2}})}),M!=="mobile"&&(0,o.jsx)("div",{style:{marginBottom:24},children:(0,o.jsx)(t.ui_kit$Switch,{id:"column-dir-revers",label:s("Reverse order on desktop"),size:"small",disabled:p.floatBlocks?.wrap===void 0,checked:x,onChange:He,labelStyle:{position:"relative",top:2}})})]}),p.floatBlocks.items.length>1&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:s("Vertical alignment"),titleStyle:{paddingTop:20},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"valign",style:{marginBottom:0},children:(0,o.jsx)(t.ui_kit$FormVerticalAlignControl,{disabled:p.floatBlocks.items.length<=1,strokeWidth:h.iconStrokeWidth,labels:{alignTop:s("Align top"),alignMiddle:s("Center vertically"),alignBottom:s("Align bottom")}})})})}),(0,o.jsxs)(o.Fragment,{children:[M!=="mobile"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:s("Indent between columns"),titleStyle:{paddingTop:20},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gap",style:{marginBottom:20},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,disabled:p.floatBlocks.items.length<=1,placeholder:s("Indent between columns"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px",ref:I==="gap"&&m})})})}),M==="mobile"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:s("Indent in mobile"),titleStyle:{paddingTop:20},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gapMobile",style:{marginBottom:20},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,disabled:p.floatBlocks.items.length<=1,placeholder:s("Indent in mobile"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})})]})]})]})]})})};Dl.propTypes={selectedElement:_.default.shape({parent:_.default.string})};var wd=()=>{},Vl=({email:e,formSettings:i={},onClosePanel:l=wd})=>{const{__:s}=r.useI18n(),a=r.useRootElement(),d=r.useDispatch(),c=r.useSendPostMessage(),m=Object.prototype.hasOwnProperty.call(e,"type")?r.BLOCK:r.EMAIL,f=r.useSelector(r.selectElementSettings$1),g=r.useSelector(r.selectElementSettings),E=r.useSelector(r.selectPropertiesPanelKey),h=m==="email"?f:g,p=Object.keys(i).length>0?i.settings:h,S=i?.type==="advanced"&&!!i?.content,k=!!i?.extraTabs?.length,x=r.useAppConfig(),T=p.type==="customTable",I=!!p.type&&!!p.floatBlocks?.items.length>0&&!!p.floatBlocks?.items.filter(W=>!!W.width).length>0,L=(0,n.useRef)(null);(0,n.useEffect)(()=>{const W=Object.values(r.ELEMENT_TYPES),se=p.type&&W.includes(p.type)?`${p.type}-${JSON.stringify(p.path||[])}`:null;if(S||k){const R=a.querySelector(".email-pane .panel-form__body");R&&(R.scrollTop=0),d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else if(p.type&&W.includes(p.type)){const R=L.current!==se;if(L.current=se,p.activateSection!=="structure"){if(R){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(p)!=="{}"&&(L.current=null,d(r.setPropertiesPanelKey("")))},[p,d,a,S,k]);const y=(0,n.useMemo)(()=>{const W=[{key:r.EDIT_SELECTED_ELEMENT,label:(0,o.jsx)("span",{style:{textTransform:"capitalize"},children:p.caption?p.caption:s("Edit element")})}];return I&&W.push({key:r.STRUCTURE,label:s("Columns")}),W},[p.caption,I,s]),C=(0,n.useMemo)(()=>[{key:r.EDIT_SELECTED_ELEMENT,label:s("Cell")},{key:r.TABLE_PROPERTIES,label:s("Table")}],[s]),P=W=>{W.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_REMOVE}),d(m==="email"?r.setElementSettings$1({}):r.setElementSettings({}))},K=W=>{W.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_PARENT_GET})},M=()=>{l(p),d(r.resetToLastActiveSettingsTab()),setTimeout(()=>{d(m==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET})},$=(0,o.jsxs)(o.Fragment,{children:[x.deleteButtonEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Remove element by Delete Key"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{type:"text",onClick:P,disabled:!p.deletable,icon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:18,strokeWidth:x.iconStrokeWidth})})}),x.stepToOtherElementEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Up to parent element"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{type:"text",onClick:K,disabled:!p.parent,icon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"GoToParent",component:t.icons$GoToParent,size:18,strokeWidth:x.iconStrokeWidth})})})]}),A=x.switchDesktopMobilePropsEnabled||x.stepToOtherElementEnabled||x.deleteButtonEnabled;return(0,o.jsxs)(t.ui_kit$PanelForm,{children:[(0,o.jsx)(t.ui_kit$PanelForm.Header,{onClose:M,closeIcon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"Close",component:t.icons$Close,size:24,strokeWidth:x.iconStrokeWidth}),extra:A?$:void 0,children:(0,o.jsx)(t.ui_kit$Tabs,{items:T?C:y,activeKey:E,onChange:W=>d(r.setPropertiesPanelKey(W||""))})}),(0,o.jsx)(t.ui_kit$PanelForm.Body,{children:T?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{display:E==="Edit selected element"?void 0:"none"},children:(0,o.jsx)(dt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:m,formName:`${r.EDIT_SELECTED_TABLE_CELLS}`})}),(0,o.jsx)("div",{style:{display:E==="Table properties"?void 0:"none"},children:(0,o.jsx)(dt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:m,formName:`${r.TABLE_PROPERTIES}`})})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{display:E==="Edit selected element"?void 0:"none"},children:(0,o.jsx)(dt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:m})}),I&&(0,o.jsx)("div",{style:{display:E==="Structure"?void 0:"none"},children:(0,o.jsx)(Dl,{selectedElement:p,emailElementType:m,isSelectedElement:!1})})]})})]})},jd=({taxonomy:e})=>{const{__:i,_x:l}=r.useI18n(),s=r.useDispatch(),[a]=t.ui_kit$Form.useForm(),d=(0,n.useRef)(null),c=r.useSelector(r.selectActiveModal$1)===r.MODALS.ADD_NEW_GROUP_MODAL,m=r.useNotification(),f=r.useProjectData(),g=(0,n.useCallback)(()=>{a.resetFields(),setTimeout(()=>d.current?.focus({cursor:"start"}),0)},[a]);(0,n.useEffect)(()=>{c&&g()},[c,g]);const E=()=>s(r.closeModal$1()),[h,p]=r.useAddTermMutation(),[S,k]=(0,n.useState)(!1),x=()=>{a.validateFields().then(({name:T})=>(k(!0),h({project:f,kind:"group",name:T}).then(I=>{if("error"in I){m.error(I);return}m.success({title:i("The group “")+I.data.name+l("” was successfully created.",e)}),E()}))).catch(T=>{}).finally(()=>k(!1))};return(0,o.jsx)(t.ui_kit$Modal,{title:i("Add a new group"),open:c,onOk:x,onCancel:E,className:"new-group-modal",footer:[(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"large",loading:p.isLoading||S,onClick:x,children:i("Create group")},"submit")],children:(0,o.jsx)(t.ui_kit$Form,{form:a,layout:"vertical",name:"add_new_group_form",onFinish:x,initialValues:{remember:!1,name:""},autoComplete:"off",style:{paddingTop:10},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"name",rules:[{required:!0,message:i("Please enter the group name")}],children:(0,o.jsx)(t.ui_kit$Input,{disabled:p.isLoading,size:"large",placeholder:i("Enter the group name"),ref:d,style:{marginBottom:5}})})})})},vd=({group:e,refetch:i})=>{const{__:l,_x:s}=r.useI18n(),a=r.useDispatch(),[d]=t.ui_kit$Form.useForm(),c=(0,n.useRef)(null),m=r.useSelector(r.selectActiveModal$1)===r.MODALS.EDIT_GROUP_NAME_MODAL,f=r.useNotification(),{id:g=null,name:E=""}=e,h=()=>a(r.closeModal$1()),[p,S]=r.useEditTermMutation();(0,n.useEffect)(()=>{m&&d.setFieldsValue({name:E})},[m,E,d]);const k=()=>{d.validateFields().then(({name:x})=>{p({kind:"group",id:g,name:x}).then(({data:T,error:I})=>{I?(f.error({error:I}),d.setFieldValue("name",x)):(i().then(({data:L})=>{if(L){const y=L[0]?.children?.find(C=>C.id===g)?.name;d.setFieldValue("name",y)}}),h(),f.success({title:l("The group “")+x+s("” was successfully changed to “","group")+T.name+l("”.")}))})})};return(0,o.jsx)(t.ui_kit$Modal,{title:l("Change group name"),open:m,onOk:k,onCancel:h,className:"new-group-name-modal",footer:[(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"large",loading:S.isLoading,onClick:k,children:l("Change name")},"submit")],children:(0,o.jsx)(t.ui_kit$Form,{form:d,layout:"vertical",name:"rename_group_form",onFinish:k,initialValues:{remember:!1,name:E},autoComplete:"off",style:{paddingTop:10},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"name",rules:[{required:!0,message:l("Please enter the group name")}],children:(0,o.jsx)(t.ui_kit$Input,{disabled:S.isLoading,size:"large",placeholder:l("Enter the group name"),ref:c,style:{marginBottom:5}})})})})},Pi={width:"100%"},Id=["hover"],Cd={color:"#ff4d4f"},Pd={color:t.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0},Ad=({level:e,onRename:i,onRemove:l})=>{const{__:s}=r.useI18n(),a=(0,n.useMemo)(()=>({items:[{label:s("Rename"),key:"Rename",icon:(0,o.jsx)(r.EmIcons,{icon:"CopyOutlined",component:t.icons$CopyOutlined,size:16}),onClick:()=>i(e)},{label:s("Remove"),key:"Remove",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16}),style:Cd,onClick:()=>l(e)}]}),[s,e,l,i]);return(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"groups-management__group_menu","data-group-id":e.id,size:"large",children:(0,o.jsx)(t.ui_kit$Dropdown,{className:"groups-management__group_menu-inner",placement:"bottomLeft",menu:a,trigger:Id,children:(0,o.jsx)("span",{className:"groups-management__actions",children:(0,o.jsx)(r.EmIcons,{icon:"MoreOutlined",component:t.icons$MoreOutlined})})})})},Nd=({className:e,levels:i,readOnlyLevels:l=!1,levelsRead:s=!1,refetchProjectGroups:a,isLoading:d})=>{const{__:c,_x:m}=r.useI18n(),f=r.useDispatch(),g=r.useNotification(),{modal:E}=t.ui_kit$App.useApp(),{confirm:h}=E,{token:p}=(0,t.ui_kit$useToken)(),S=r.useSelector(r.selectProjectGroups),k=i??S,[x]=r.useDeleteTermMutation(),[T,I]=(0,n.useState)({id:null,name:""}),L=(0,n.useCallback)((M,$)=>{x({kind:"group",id:Number(M)}).unwrap().then(A=>{A?.deleted&&g.success({title:c("The group “")+$+m("” was successfully deleted.","recovery")})}).catch(A=>{g.error({error:A})})},[x,g,c,m]),y=(0,n.useCallback)(M=>{const $=M.name??"";h({mask:{closable:!0},centered:!0,title:m("Are you sure to delete “","group")+$+c("” group and all nested groups?"),icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:22,style:Pd}),okText:c("Yes"),cancelText:c("No"),onOk:()=>L(String(M.id),$)})},[h,L,c,m]),C=(0,n.useCallback)(M=>{f(r.openModal$1(r.MODALS.EDIT_GROUP_NAME_MODAL)),I({id:M.id,name:M.name??""})},[f]),P=(0,n.useMemo)(()=>({marginBottom:p.formItemMarginBottomMD}),[p]),K=(0,n.useCallback)(()=>{f(r.openModal$1(r.MODALS.ADD_NEW_GROUP_MODAL))},[f]);return(0,o.jsxs)("div",{className:(0,We.default)("groups-management",{[e]:e}),children:[d?(0,o.jsx)(t.ui_kit$Skeleton,{active:!0}):(0,o.jsxs)(t.ui_kit$Row,{children:[!!k?.length&&k?.map((M,$)=>(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:`group_${M.id}`,style:{marginBottom:p.formItemMarginBottomMD},label:(0,o.jsxs)(t.ui_kit$Flex,{justify:"space-between",align:"center",style:Pi,children:[(0,o.jsx)("span",{children:M.name}),!l&&(0,o.jsx)(Ad,{level:M,onRename:C,onRemove:y})]}),className:"groups-management__group-select",rules:[{message:"Please input category name!",type:"array"}],children:(0,o.jsx)(t.ui_kit$Select,{mode:l?"multiple":"tags",style:Pi,placeholder:c(l?"Select a category":"Type category here"),options:M.children?.map(A=>({label:A.name,value:String(A.id)})),tagRender:A=>{const{label:W,closable:se,onClose:R}=A,te=he=>{he.preventDefault(),he.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:p.colorPrimary,onMouseDown:te,closable:se,onClose:R,style:{borderRadius:6},children:W})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})},M.id)),l&&s&&!k?.length&&(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Text,{type:"secondary",style:P,children:c("This project has no template sections yet.")})}),!l&&(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{style:P,children:(0,o.jsx)(t.ui_kit$Button,{id:"add_group_button",icon:(0,o.jsx)(r.EmIcons,{icon:"AddSlide",component:t.icons$AddSlide}),style:Pi,onClick:K,children:c("Add group")})})})]}),(0,o.jsx)(jd,{taxonomy:r.ELEMENT_TYPES.GROUP}),(0,o.jsx)(vd,{group:T,refetch:a})]})};function Ld(e,{gallery:i=!1}={}){const l=r.isEmailsV2Enabled(),s=r.useGetTemplateSectionsQuery({scope:"gallery"},{skip:!l||!i}),a=r.useGetTemplateSectionsQuery({scope:"project",projectId:e},{skip:!l||!e});return{emailsOnV2:l,standardSections:s.data,projectSections:a.data,projectSectionsLoading:l&&!!e&&a.isLoading}}var{title:Ai,description:Yt,tags:Xt,type:Ni,is_template:Od,group:Hl}={title:"title",description:"description",tags:"tags",type:"type",is_template:"is_template",group:"group"},$d={[Ai]:"",[Yt]:"",[Xt]:[],[Od]:!1},Fd={[Yt]:"",[Xt]:[],[Ni]:""};function Md(e){const i=new Set;return e?.filter(l=>i.has(l.name)?!1:(i.add(l.name),!0))}var Dd=e=>Array.isArray(e)&&e.length>0,Ul=({className:e="",element:i})=>{const{__:l}=r.useI18n(),s=r.useDispatch(),a=r.useEmailAttributesWriter(),[d]=t.ui_kit$Form.useForm(),{token:c}=(0,t.ui_kit$useToken)(),m=r.useAppConfig(),f=r.useEditorLocked(),g=r.useEditorLockCheck(),E=r.useSelector(r.selectProjectGroups),{data:h}=r.useGetBlocksSchemaQuery(),p=r.useProjectData(),S=i.hasOwnProperty("type")?r.BLOCK:r.EMAIL,k=i.hasOwnProperty("type")?r.BLOCK_TAGS:r.EMAIL_TAGS,{emailsOnV2:x,projectSections:T,projectSectionsLoading:I}=Ld(p?.id),{data:L,refetch:y,isLoading:C,isFetching:P,isUninitialized:K,isSuccess:M}=r.useGetTermsQuery({project:p,kind:"group"},{skip:x||!p?.id}),$=(0,n.useMemo)(()=>x?T??[]:E,[x,T,E]);(0,n.useEffect)(()=>{L&&s(r.projectGroupsLoaded(L,S==="email"?i.group??[]:void 0))},[s,L,S,i.group]),(0,n.useEffect)(()=>{!K&&y()},[K,y]),(0,n.useEffect)(()=>{if(!x||!i.is_template)return;const q=new Set(i.projectCategories??[]),X={};let Q=!1;for(const Z of T??[]){const U=`group_${Z.id}`,V=(Z.children??[]).filter(de=>q.has(String(de.id))).map(de=>String(de.id)),J=d.getFieldValue(U);(!J||J.length!==V.length||V.some((de,me)=>J[me]!==de))&&(Q=!0),X[U]=V}Q&&d.setFieldsValue(X)},[d,x,i.is_template,i.projectCategories,T]);const[A,W]=(0,n.useState)([]),[se,R]=(0,n.useState)([]),[te,he]=(0,n.useState)(i.is_template||!1),be=r.useProjectData();(0,n.useEffect)(()=>{!K&&y()},[i.group,y,K]),(0,n.useEffect)(()=>{if(M&&i.is_template&&Dd(i.group)){const q=i.group;let X={};q.length&&E.length&&q?.forEach(Z=>{E?.forEach(U=>{let V=U.children.find(J=>J.id===Z);V&&(X.hasOwnProperty(U.id)||(X[U.id]=[]),X[U.id].push({label:V.name,value:V.id}))})});let Q={};for(let Z in X)X.hasOwnProperty(+Z)&&(Q[`group_${Z}`]=X[Z].map(U=>({...U,value:String(U.value)})));d.setFieldsValue(Q)}},[d,E,i.is_template,i.group,M]);const{data:Ie,isFetching:xe,refetch:Be}=r.useGetTermsQuery({project:be,kind:k},{skip:!be?.id});(0,n.useEffect)(()=>{R(Md(Ie)?.map(q=>({value:q.name,key:q.id})))},[Ie]),(0,n.useEffect)(()=>{if(i){const q=r.getTaxonomy(i,k)??[],X=Ie??[],Q=q.map(V=>V.name??""),Z=i.emailtags||i.blocktags||[],U=q.concat(X).filter(V=>Z.some(J=>r.sameTermId(V.id,J))).map(V=>V.name??"");d.setFieldsValue({title:i.title,description:i.description,tags:Array.isArray(i.tags)?i.tags:U.length?Array.from(new Set(U)):Q,type:i.type})}},[d,i,k,Ie]);const ke=(0,n.useMemo)(()=>{if(!x||S!=="email"||!i)return[];const q=r.getTaxonomy(i,k)??[],X=Ie??[],Q=[...q,...X];return(i.emailtags??[]).filter(Z=>!Q.some(U=>U.name&&r.sameTermId(U.id,Z)))},[x,S,i,k,Ie]),[ne,He]=(0,n.useState)(void 0),Fe=!Array.isArray(i?.tags);(0,n.useEffect)(()=>{Fe&&ke.length&&be?.id&&!xe&&ne!==i?.id&&(He(i?.id),Be())},[Fe,ke.length,be?.id,xe,ne,i?.id,Be]);const Se=Fe&&ke.length>0&&(Ie===void 0||xe||ne!==i?.id),ye=q=>{if(g())return;const X=Object.keys(q)[0],Q=q,Z=X.split("_")[0];if(Z===Ai)a({title:Q[X]});else if(Z===Yt)a({description:Q[X]});else if(Z===Xt){const U=Q[X],V=S==="email"&&(U?.length??0)===0;a({tags:(U??[]).map(J=>J.trim()),...V?{emailtags:[]}:{}})}else Z==="is"&&S==="email"?a({is_template:Q[X]}):Z===Ni&&S==="block"&&a({type:Q[X]});switch(X.split("_")[0]){case Hl:if(x){const U=new Set((T??[]).flatMap(me=>(me.children??[]).map(pe=>String(pe.id)))),V=d.getFieldsValue(!0),J=Object.keys(V).filter(me=>me.startsWith(`${Hl}_`)).flatMap(me=>V[me]??[]).map(String).filter(me=>U.has(me)),de=(i.projectCategories??[]).map(String).filter(me=>!U.has(me));a({projectCategories:[...new Set([...de,...J])]});break}s(r.setEmailGroups({[X.split("_")[1]]:q[X]}));break;default:return}};(0,n.useEffect)(()=>{if(h){const q=h.schema.properties.acf.properties.type.items.enum;let X=[];const Q={Applications:l("Apps"),Articles:l("Article"),Banners:l("Banners"),Buttons:l("Buttons"),"Call to Action":l("Call to Action"),Contacts:l("Contacts"),Content:l("Content"),"E-Commerce":l("E-Commerce"),Feature:l("Features"),Footer:l("Footers"),Header:l("Headers"),Lists:l("Lists"),Menu:l("Menus"),Other:l("Others"),Polls:l("Polls"),Promocodes:l("Promocodes"),Separators:l("Separators")};for(let Z in q)X.push({label:Q[q[Z]],value:q[Z]});W(X)}},[h,l]);const re=q=>{he(q)};return(0,o.jsx)("div",{className:(0,We.default)("settings-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"settings_panel_form",initialValues:S==="email"?{EmailInitialValues:$d}:Fd,onValuesChange:ye,autoComplete:"off",disabled:f,children:[m.subjectEnabled&&S==="email"&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Title"),name:Ai,tooltip:{title:l("The title of the email is displayed in the list of the templates and usually matches the subject line, but you can change it."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$TextArea,{placeholder:l("Type title here"),autoSize:{minRows:1}})}),m.descriptionEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Description"),name:Yt,tooltip:{title:l("Description is used in other sections of the service."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$TextArea,{placeholder:l("Type your description here"),autoSize:{minRows:2}})}),m.tagsEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Tags"),name:Xt,tooltip:{title:l("Tags help you find the block in the list."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},rules:[{message:l("Please input tags!"),type:"array"}],children:(0,o.jsx)(t.ui_kit$Select,{mode:"tags",style:{width:"100%"},placeholder:l("Type your tags here"),options:se,disabled:Se||f,loading:Se,tagRender:q=>{const{label:X,closable:Q,onClose:Z}=q,U=V=>{V.preventDefault(),V.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:c.colorPrimary,onMouseDown:U,closable:Q,onClose:Z,style:{borderRadius:6},children:X})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})}),S==="email"&&m.isTemplateEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:16}}),(0,o.jsx)(t.ui_kit$Tooltip,{title:i.isNew?l("Save email first."):l("Use this email as a template for creating future emails."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"is_template",valuePropName:"checked",initialValue:te,children:(0,o.jsx)(t.ui_kit$Switch,{id:"setIsTemplate",label:l("Is a template"),size:"small",onChange:re,disabled:!!i.isNew||f,labelStyle:{position:"relative",top:2,fontSize:14,color:c.colorText}})})},"isTemplate")]}),te&&(0,o.jsx)(Nd,{element:i,levels:$,readOnlyLevels:x,levelsRead:T!==void 0,refetchProjectGroups:y,isLoading:x?I:C||P}),S==="block"&&(0,o.jsx)(t.ui_kit$Form.Item,{name:Ni,label:l("Type"),tooltip:{title:l("Select the block type to find any block on the list faster."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},rules:[{message:l("Please input type!")}],children:(0,o.jsx)(t.ui_kit$Select,{placeholder:l("Choose block type"),options:A,getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})]})})};Ul.propTypes={className:_.default.string,email:_.default.object};var{utm_source:Wl,utm_medium:zl,utm_campaign:Gl,utm_term:Yl,utm_content:Xl}={utm_source:"utm_source",utm_medium:"utm_medium",utm_campaign:"utm_campaign",utm_term:"utm_term",utm_content:"utm_content"},Vd={[Wl]:"",[zl]:"",[Gl]:"",[Yl]:"",[Xl]:""},Kl=({className:e="",email:i=void 0})=>{const{__:l}=r.useI18n(),s=r.useEmailAttributesWriter(),a=r.useEditorLocked(),d=r.useEditorLockCheck(),[c]=t.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 m=f=>{if(d())return;const g=Object.keys(f)[0],E=f;s({utm_parameters:{...i?.utm_parameters,[g]:E[g]}})};return(0,o.jsx)("div",{className:(0,We.default)("settings-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:c,layout:"vertical",name:"settings_panel_form_utm",initialValues:Vd,onValuesChange:m,autoComplete:"off",disabled:a,children:[(0,o.jsx)(t.ui_kit$Alert,{title:l("The specified parameters will be added to all links when exporting the email."),type:"info",showIcon:!0,style:{marginBottom:20}}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("utm_source"),name:Wl,tooltip:{title:l("Mandatory. Indicates the traffic source. Example: utm_source=google"),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:l("google")})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("utm_medium"),name:zl,tooltip:{title:l("Identifies what type of link was used, such as cost per click or email. For example: utm_medium=cpc"),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:l("cpc")})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("utm_campaign"),name:Gl,tooltip:{title:l("Indicates a specific product promotion or a marketing campaign. Example: utm_campaign=spring_sale"),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:l("spring_sale")})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("utm_term"),name:Yl,tooltip:{title:l("Identifies search terms. For example: utm_term=running+shoes"),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:l("running+shoes")})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("utm_content"),name:Xl,tooltip:{title:l("Indicates what user clicked to get to the site: a banner or a text link. It is often used for A/B testing and ad campaigns. Example: utm_content=logolink or utm_content=textlink"),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:l("textlink")})})]})})};Kl.propTypes={className:_.default.string,email:_.default.object};var Ye={PRODUCT_CAROUSEL:"productCarousel",SINGLE_IMAGE_PREVIEW:"singleImagePreview",DEAL_ANNOTATION:"dealAnnotation",DEAL_CARD:"dealCard"},ql="emailmaker-gmail-annotations";function Li(e){return/^[A-Za-z]{3}$/.test((e??"").trim())}function Hd(e){return typeof e=="object"&&e!==null}function Kt(e,i){const l=e[i];return typeof l=="string"?l:""}var Ud=new Set(["PromotionCard","DiscountOffer","Organization"]);function Jl(e){let i;try{i=JSON.parse(e)}catch{return!1}const l=Array.isArray(i)?i:[i];return l.length===0?!1:l.every(s=>typeof s=="object"&&s!==null&&Ud.has(String(s["@type"])))}function Wd(){let e=new Date().getTime(),i=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,l=>{let s=Math.random()*16;return e>0?(s=(e+s)%16|0,e=Math.floor(e/16)):(s=(i+s)%16|0,i=Math.floor(i/16)),(l==="x"?s:s&3|8).toString(16)})}function qt(e){return e.annotationType||Ye.PRODUCT_CAROUSEL}function ct(e){return!!(e?.image||e?.url||e?.headline||e?.price||e?.priceCurrency||e?.discountValue)}function Oi(e){return!e.description&&!e.discountCode&&!e.availabilityStarts&&!e.availabilityEnds}function Jt(e){return typeof e=="string"&&e.trim().length>0}function $i(e){return Jt(e)?/^https?:\/\//i.test(e.trim()):!1}function Ql(e){return Jt(e?.image)&&$i(e?.url)}function zd(e){switch(qt(e)){case Ye.SINGLE_IMAGE_PREVIEW:return Ql(e.cards?.[0]);case Ye.DEAL_ANNOTATION:return!Oi(e);case Ye.DEAL_CARD:return Jt(e.description)&&($i(e.offerPageUrl)||$i(e.merchantHomepageUrl));case Ye.PRODUCT_CAROUSEL:default:return!!e.cards?.some(Ql)}}function Gd(e){switch(qt(e)){case Ye.SINGLE_IMAGE_PREVIEW:return!ct(e.cards?.[0])&&!Jt(e.discountCode);case Ye.DEAL_ANNOTATION:return Oi(e);case Ye.DEAL_CARD:return Oi(e)&&!e.offerPageUrl&&!e.merchantHomepageUrl;case Ye.PRODUCT_CAROUSEL:default:return!e.cards?.some(ct)}}function Yd(e){switch(qt(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 ct(e.cards?.[0]);case Ye.PRODUCT_CAROUSEL:default:return e.logo?!0:!!e.cards?.some(ct)}}function Xd(e){let i=typeof e.price=="string"||typeof e.price=="number"?String(e.price):"",l=typeof e.discountValue=="string"||typeof e.discountValue=="number"?String(e.discountValue):"";const s=typeof e.em_regularPrice=="string"||typeof e.em_regularPrice=="number"?String(e.em_regularPrice):"",a=typeof e.em_price=="string"||typeof e.em_price=="number"?String(e.em_price):"";if(!i&&s&&(i=s),!l&&i&&a){const d=parseFloat(i),c=parseFloat(a);!isNaN(d)&&!isNaN(c)&&d>=c&&(l=String(d-c))}return{id:Wd(),image:typeof e.image=="string"?e.image:"",url:typeof e.url=="string"?e.url:"",headline:typeof e.headline=="string"?e.headline:"",price:i,priceCurrency:typeof e.priceCurrency=="string"?e.priceCurrency:"",discountValue:l}}function Zl(e,i){const l={"@context":"http://schema.org/","@type":"PromotionCard",image:e.image};if(e.url&&(l.url=e.url),e.headline&&(l.headline=e.headline),e.price&&(l.price=e.price),e.priceCurrency){const s=e.priceCurrency.trim();l.priceCurrency=Li(s)?s.toUpperCase():s}return e.discountValue&&(l.discountValue=e.discountValue),i&&(l.position=i),l}function Fi(e){const i={"@context":"http://schema.org/","@type":"DiscountOffer"};for(const l of["description","discountCode","availabilityStarts","availabilityEnds","offerPageUrl","merchantHomepageUrl"]){const s=e[l];s&&(i[l]=s)}return i}function es(e){return{"@context":"http://schema.org/","@type":"Organization",logo:e}}function Kd(e){const i=qt(e),l=[];if(i===Ye.DEAL_CARD)return[Fi(e)];if(i===Ye.DEAL_ANNOTATION){const s=[];return e.logo&&s.push(es(e.logo)),s.push(Fi(e)),s}if(e.logo&&l.push(es(e.logo)),i===Ye.SINGLE_IMAGE_PREVIEW){const s=e.cards?.[0];return e.discountCode?.trim()&&l.push(Fi(e)),s&&ct(s)&&l.push(Zl(s)),l}return(e.cards||[]).filter(ct).forEach((s,a)=>{l.push(Zl(s,a+1))}),l}function qd(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Jd(e){if(Gd(e))return null;const i=qd(JSON.stringify(Kd(e),null,2));return`<script type="application/ld+json" id="${ql}">
|
|
10
|
+
${i}
|
|
11
|
+
<\/script>`}function os(e,i){const l=e.toLowerCase().indexOf("<\/script>",i);return l===-1?-1:l+9}function ts(e,i,l,s){return{range:{start:i,end:s},contentRange:{start:l,end:s-9}}}function Mi(e){const i=new RegExp(`<script\\b[^>]*\\bid=["']${ql}["']`,"i").exec(e);if(i?.index!==void 0){const a=e.indexOf(">",i.index)+1;if(a<=0)return null;const d=os(e,a);if(d!==-1)return ts(e,i.index,a,d)}const l=/<script\b[^>]*type=["']application\/ld\+json["'][^>]*>/gi;let s;for(;(s=l.exec(e))!==null;){const a=s.index+s[0].length,d=os(e,a);if(d!==-1&&Jl(e.slice(a,d-9)))return ts(e,s.index,a,d)}return null}function Qd(e){const i=e.indexOf(">")+1,l=e.toLowerCase().lastIndexOf("<\/script>");return i<=0||l===-1?e:e.slice(i,l)}function Zd(e){const i=/<\/head>/i.exec(e);if(i?.index!==void 0)return i.index;const l=/<head\b[^>]*>/i.exec(e);if(l?.index!==void 0)return l.index+l[0].length;const s=/<body\b[^>]*>/i.exec(e);return s?.index!==void 0?s.index:e.length}function is(e,i){let{start:l,end:s}=i;return l>0&&e[l-1]===`
|
|
12
|
+
`?l-=1:s<e.length&&e[s]===`
|
|
13
|
+
`&&(s+=1),{start:l,end:s}}function ec(e,i){const l=Mi(e),s=Jd(i);if(!s&&!l)return null;if(l&&!s){const c=is(e,l.range);return e.slice(c.start,c.end)?{range:c,text:""}:null}if(l&&s){const c=Qd(s);return e.slice(l.contentRange.start,l.contentRange.end)===c?null:{range:l.contentRange,text:c}}if(!s)return null;const a=Zd(e),d=`${a>0&&e[a-1]!==`
|
|
14
|
+
`?`
|
|
15
|
+
`:""}${s}
|
|
16
|
+
`;return{range:{start:a,end:a},text:d}}function rs(e){const i=Mi(e);return i?e.slice(i.contentRange.start,i.contentRange.end):null}function oc(e){let i=e;for(let l=0;l<50;l++){const s=Mi(i);if(!s)return i;const{start:a,end:d}=is(i,s.range);i=i.slice(0,a)+i.slice(d)}return i}function tc(e){try{const i=new DOMParser().parseFromString(e,"text/html").querySelectorAll('script[type="application/ld+json"]');for(let l=0;l<i.length;l++){const s=i[l];if(s.id==="emailmaker-gmail-annotations"||Jl(s.textContent||"")){const a=JSON.parse(s.textContent||"[]"),d=(Array.isArray(a)?a:[a]).filter(Hd),c={cards:[]};let m=!1,f=!1,g=!1;return d.forEach(E=>{const h=Kt(E,"@type");if(h==="Organization"){const p=Kt(E,"logo");p&&(c.logo=p);return}if(h==="DiscountOffer"){f=!0;for(const p of["description","discountCode","availabilityStarts","availabilityEnds"]){const S=Kt(E,p);S&&(c[p]=S)}for(const p of["offerPageUrl","merchantHomepageUrl"]){const S=Kt(E,p);S&&(c[p]=S,m=!0)}return}h==="PromotionCard"&&(E.position!==void 0&&(g=!0),c.cards.push(Xd(E)))}),c.cards.length>1?c.annotationType=Ye.PRODUCT_CAROUSEL:c.cards.length===1?c.annotationType=g?Ye.PRODUCT_CAROUSEL:Ye.SINGLE_IMAGE_PREVIEW:f&&(c.annotationType=m?Ye.DEAL_CARD:Ye.DEAL_ANNOTATION),c}}}catch{}return null}var ic={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 rc(e){return Number.isInteger(e)?String(e):e.toFixed(2)}function ls(e){const i=e?.trim();return i?ic[i.toUpperCase()]??i:"$"}function Di(e,i){return`${ls(i)}${rc(e)}`}function lc(e){const i=parseFloat(e.price??""),l=parseFloat(e.discountValue??"");return!Number.isNaN(i)&&!Number.isNaN(l)&&l>0?{sale:Di(i-l,e.priceCurrency),original:Di(i,e.priceCurrency)}:Number.isNaN(i)?{}:{sale:Di(i,e.priceCurrency)}}var so=({variant:e="line",width:i,height:l,className:s})=>{const a=(0,n.useMemo)(()=>({width:i,height:l}),[i,l]);return(0,o.jsx)("span",{className:(0,We.default)("preview-skeleton",`preview-skeleton--${e}`,s),style:a,"aria-hidden":"true"})};function Vi({className:e}){return(0,o.jsx)("svg",{className:e,width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:(0,o.jsx)("path",{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})})}function ss({className:e}){return(0,o.jsxs)("svg",{className:e,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,o.jsx)("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),(0,o.jsx)("circle",{cx:"7",cy:"7",r:"1.5",fill:"currentColor"})]})}function sc({className:e}){return(0,o.jsxs)("svg",{className:e,width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,o.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"1.5"}),(0,o.jsx)("path",{d:"M12 12V7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,o.jsx)("path",{d:"M12 12L15.5 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,o.jsx)("path",{d:"M12 3a9 9 0 0 1 7.5 4",fill:"currentColor",fillOpacity:"0.18"})]})}var ac=2;function nc({card:e}){const i=lc(e),l=(0,n.useMemo)(()=>({backgroundImage:`url(${e.image})`}),[e.image]),s=!!e.headline?.trim(),a=!!e.image?.trim(),d=!i.sale&&!i.original;return(0,o.jsxs)("div",{className:"product-carousel-preview__card",children:[a?(0,o.jsx)("div",{className:"product-carousel-preview__card-image",style:l}):(0,o.jsx)(so,{variant:"block",className:"product-carousel-preview__card-image-skeleton"}),(0,o.jsxs)("div",{className:"product-carousel-preview__card-body",children:[s?(0,o.jsx)("div",{className:"product-carousel-preview__card-headline",children:e.headline}):(0,o.jsxs)("div",{className:"product-carousel-preview__card-headline-skeleton",children:[(0,o.jsx)(so,{height:12}),(0,o.jsx)(so,{height:12,width:"75%"})]}),d?(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,o.jsx)(so,{width:48,height:14}),(0,o.jsx)(so,{width:40,height:12})]}):(i.sale||i.original)&&(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[i.sale&&(0,o.jsx)("span",{className:"product-carousel-preview__card-sale-price",children:i.sale}),i.original&&(0,o.jsx)("span",{className:"product-carousel-preview__card-original-price",children:i.original})]})]})]})}function dc(){return(0,o.jsxs)("div",{className:"product-carousel-preview__card",children:[(0,o.jsx)(so,{variant:"block",className:"product-carousel-preview__card-image-skeleton"}),(0,o.jsxs)("div",{className:"product-carousel-preview__card-body",children:[(0,o.jsxs)("div",{className:"product-carousel-preview__card-headline-skeleton",children:[(0,o.jsx)(so,{height:12}),(0,o.jsx)(so,{height:12,width:"75%"})]}),(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,o.jsx)(so,{width:48,height:14}),(0,o.jsx)(so,{width:40,height:12})]})]})]})}var cc=({data:e,subjectLine:i,cards:l})=>{const{__:s}=r.useI18n(),a=!!e.logo?.trim(),d=!!i?.trim();return(0,o.jsxs)("div",{className:"product-carousel-preview",children:[(0,o.jsx)("div",{className:"product-carousel-preview__header",children:(0,o.jsxs)("div",{className:"product-carousel-preview__header-main",children:[a?(0,o.jsx)("img",{src:e.logo,alt:"",className:"product-carousel-preview__logo"}):(0,o.jsx)(so,{variant:"circle",width:40,height:40,className:"product-carousel-preview__logo-skeleton"}),(0,o.jsxs)("div",{className:"product-carousel-preview__header-text",children:[(0,o.jsxs)("div",{className:"product-carousel-preview__header-row",children:[(0,o.jsx)("div",{className:"product-carousel-preview__brand-name",children:s("Your company")}),(0,o.jsx)("div",{className:"product-carousel-preview__time",children:"10:10 AM"})]}),(0,o.jsxs)("div",{className:"product-carousel-preview__header-row product-carousel-preview__header-row--subject",children:[d?(0,o.jsx)("div",{className:"product-carousel-preview__subject-line",children:i}):(0,o.jsx)(so,{height:14,className:"product-carousel-preview__subject-skeleton"}),(0,o.jsx)(Vi,{className:"product-carousel-preview__star-icon"})]})]})]})}),(0,o.jsx)("div",{className:"product-carousel-preview__carousel",children:l.length>0?l.map((c,m)=>(0,o.jsx)(nc,{card:c},c.id||m)):Array.from({length:ac},(c,m)=>(0,o.jsx)(dc,{},`skeleton-${m}`))})]})};function uc(e){const i=parseFloat(e?.price??""),l=parseFloat(e?.discountValue??"");if(!Number.isNaN(i)&&i>0&&!Number.isNaN(l)&&l>0){const a=Math.round(l/i*100);if(a>0)return`${a}% Off`}const s=e?.discountValue?.trim();return s?/off/i.test(s)||s.includes("%")?s:`${s} Off`:null}function as(e){const i=e?.trim();return i?/^code\s/i.test(i)?i:`Code ${i}`:null}var mc=({data:e,subjectLine:i,card:l})=>{const{__:s}=r.useI18n(),a=!!e.logo?.trim(),d=!!i?.trim(),c=!!l?.image?.trim(),m=!!l?.headline?.trim(),f=uc(l),g=as(e.discountCode),E=!!(f||g),h=(0,n.useMemo)(()=>({backgroundImage:`url(${l?.image})`}),[l?.image]);return(0,o.jsxs)("div",{className:"single-image-preview",children:[(0,o.jsx)("div",{className:"single-image-preview__header",children:(0,o.jsxs)("div",{className:"single-image-preview__header-main",children:[a?(0,o.jsx)("img",{src:e.logo,alt:"",className:"single-image-preview__logo"}):(0,o.jsx)(so,{variant:"circle",width:40,height:40,className:"single-image-preview__logo-skeleton"}),(0,o.jsxs)("div",{className:"single-image-preview__header-text",children:[(0,o.jsxs)("div",{className:"single-image-preview__header-row",children:[(0,o.jsx)("div",{className:"single-image-preview__brand-name",children:s("Your company")}),(0,o.jsx)("div",{className:"single-image-preview__time",children:"10:10 AM"})]}),d?(0,o.jsx)("div",{className:"single-image-preview__subject-line",children:i}):(0,o.jsx)(so,{height:14,className:"single-image-preview__subject-skeleton"}),(0,o.jsxs)("div",{className:"single-image-preview__promo-row",children:[(0,o.jsxs)("div",{className:"single-image-preview__promo-content",children:[f?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(ss,{className:"single-image-preview__promo-icon"}),(0,o.jsx)("span",{className:"single-image-preview__promo-badge",children:f})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(so,{width:16,height:16,className:"single-image-preview__promo-icon-skeleton"}),(0,o.jsx)(so,{width:72,height:14})]}),E&&(0,o.jsx)("span",{className:"single-image-preview__promo-separator",children:"·"}),g?(0,o.jsx)("span",{className:"single-image-preview__promo-code",children:g}):(0,o.jsx)(so,{width:96,height:14,className:"single-image-preview__promo-skeleton"})]}),(0,o.jsx)(Vi,{className:"single-image-preview__star-icon"})]})]})]})}),(0,o.jsxs)("div",{className:"single-image-preview__card",children:[c?(0,o.jsx)("div",{className:"single-image-preview__card-image",style:h}):(0,o.jsx)(so,{variant:"block",className:"single-image-preview__card-image-skeleton"}),(0,o.jsx)("div",{className:"single-image-preview__card-body",children:m?(0,o.jsx)("div",{className:"single-image-preview__card-description",children:l?.headline}):(0,o.jsxs)("div",{className:"single-image-preview__card-description-skeleton",children:[(0,o.jsx)(so,{height:12}),(0,o.jsx)(so,{height:12,width:"92%"})]})})]})]})};function pc(e){const i=e?.trim();if(!i)return null;const l=(0,Oo.default)(i);if(!l.isValid())return null;const s=(0,Oo.default)().startOf("day"),a=l.startOf("day").diff(s,"day");return a===0?"Today":a===1?"Tomorrow":a>1&&a<=7?l.format("MMM D"):l.format("MMM D, YYYY")}function Hi(e){const i=e?.trim();return i||null}function hc(e,i){return e?e==="Today"?i("Today"):e==="Tomorrow"?i("Tomorrow"):e:null}function bc(e,i){return hc(pc(e),i)}var fc=({data:e,subjectLine:i})=>{const{__:l}=r.useI18n(),s=!!e.logo?.trim(),a=!!i?.trim(),d=Hi(e.description),c=as(e.discountCode),m=!!(d||c);return(0,o.jsx)("div",{className:"deal-annotation-preview",children:(0,o.jsxs)("div",{className:"deal-annotation-preview__header-main",children:[s?(0,o.jsx)("img",{src:e.logo,alt:"",className:"deal-annotation-preview__logo"}):(0,o.jsx)(so,{variant:"circle",width:40,height:40,className:"deal-annotation-preview__logo-skeleton"}),(0,o.jsxs)("div",{className:"deal-annotation-preview__header-text",children:[(0,o.jsxs)("div",{className:"deal-annotation-preview__header-row",children:[(0,o.jsx)("div",{className:"deal-annotation-preview__brand-name",children:l("Your company")}),(0,o.jsx)("div",{className:"deal-annotation-preview__time",children:"10:10 AM"})]}),a?(0,o.jsx)("div",{className:"deal-annotation-preview__subject-line",children:i}):(0,o.jsx)(so,{height:14,className:"deal-annotation-preview__subject-skeleton"}),(0,o.jsxs)("div",{className:"deal-annotation-preview__promo-row",children:[(0,o.jsxs)("div",{className:"deal-annotation-preview__promo-content",children:[d?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(ss,{className:"deal-annotation-preview__promo-icon"}),(0,o.jsx)("span",{className:"deal-annotation-preview__promo-badge",children:d})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(so,{width:16,height:16,className:"deal-annotation-preview__promo-icon-skeleton"}),(0,o.jsx)(so,{width:72,height:14})]}),m&&(0,o.jsx)("span",{className:"deal-annotation-preview__promo-separator",children:"·"}),c?(0,o.jsx)("span",{className:"deal-annotation-preview__promo-code",children:c}):(0,o.jsx)(so,{width:96,height:14,className:"deal-annotation-preview__promo-skeleton"})]}),(0,o.jsx)(Vi,{className:"deal-annotation-preview__star-icon"})]})]})]})})},gc=({data:e})=>{const{__:i}=r.useI18n(),l=Hi(e.description),s=bc(e.availabilityEnds,i),a=Hi(e.discountCode);return(0,o.jsxs)("div",{className:"deal-card-preview",children:[(0,o.jsx)("div",{className:"deal-card-preview__sender",children:i("Your company")}),l?(0,o.jsx)("div",{className:"deal-card-preview__headline",children:l}):(0,o.jsx)(so,{height:24,className:"deal-card-preview__headline-skeleton"}),(0,o.jsxs)("div",{className:"deal-card-preview__details",children:[(0,o.jsxs)("div",{className:"deal-card-preview__expires",children:[(0,o.jsx)(sc,{className:"deal-card-preview__clock-icon"}),(0,o.jsxs)("div",{className:"deal-card-preview__detail-text",children:[(0,o.jsx)("div",{className:"deal-card-preview__detail-label",children:i("Expires")}),s?(0,o.jsx)("div",{className:"deal-card-preview__detail-value",children:s}):(0,o.jsx)(so,{width:72,height:14,className:"deal-card-preview__detail-skeleton"})]})]}),(0,o.jsx)("div",{className:"deal-card-preview__code",children:(0,o.jsxs)("div",{className:"deal-card-preview__detail-text",children:[(0,o.jsx)("div",{className:"deal-card-preview__detail-label",children:i("Code")}),a?(0,o.jsx)("div",{className:"deal-card-preview__detail-value",children:a}):(0,o.jsx)(so,{width:56,height:14,className:"deal-card-preview__detail-skeleton"})]})})]}),(0,o.jsxs)("div",{className:"deal-card-preview__actions",children:[(0,o.jsx)("span",{className:"deal-card-preview__button",children:i("Visit site")}),(0,o.jsx)("span",{className:"deal-card-preview__button",children:i("Copy code")})]})]})};function _c(e){return e.annotationType===Ye.SINGLE_IMAGE_PREVIEW?e.cards?.[0]?[e.cards[0]]:[]:e.annotationType===Ye.PRODUCT_CAROUSEL?e.cards||[]:[]}function xc(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 Ui=300,Yo=16;function kc(e){if(!e||e.offsetParent===null)return!1;const i=e.getBoundingClientRect();return i.width>0&&i.height>0}function Ec(e){const i=Array.from(document.querySelectorAll(e));for(const l of i){if(!(l instanceof HTMLElement))continue;const s=l.getBoundingClientRect(),a=window.getComputedStyle(l);if(s.width>0&&s.height>0&&a.display!=="none"&&a.visibility!=="hidden")return l}return null}var Bc=({data:e,subjectLine:i,parentRef:l,overlayTargetSelector:s,onApply:a,applyDisabled:d=!1,applyBlockers:c=[],onRemove:m,visible:f=!0})=>{const{__:g}=r.useI18n(),[E,h]=(0,n.useState)(null),[p,S]=(0,n.useState)(null);(0,n.useEffect)(()=>{if(!f){h(null),S(null);return}const y=()=>{if(!kc(l?.current)){h(null),S(null);return}if(s){const te=l?.current?.closest(".email-pane__col_settings-inner")||Ec(".email-pane__col_settings-inner");if(te){S(te),h({type:"popover"});return}}if(!l?.current)return;let W=l.current.getBoundingClientRect();if(W.width===0&&W.height===0){const te=l.current.closest(".email-pane__col");te&&(W=te.getBoundingClientRect())}const se=Math.max(Yo,Math.min(W.top,window.innerHeight-Yo));let R=W.left-Ui-Yo;R<Yo&&(R=W.right+Yo),R+Ui>window.innerWidth-Yo&&(R=window.innerWidth-Ui-Yo),S(document.body),h({type:"side",top:se,left:Math.max(Yo,R)})};y();const C=window.requestAnimationFrame(y),P=[window],K=l?.current?.closest(".email-pane__collapse-wrapper"),M=l?.current?.closest(".email-pane__col");K&&P.push(K),M&&P.push(M),P.forEach(W=>{W.addEventListener("scroll",y,{passive:!0})}),window.addEventListener("resize",y);const $=l?.current,A=$&&typeof ResizeObserver<"u"?new ResizeObserver(y):null;return A?.observe($),()=>{window.cancelAnimationFrame(C),A?.disconnect(),P.forEach(W=>{W.removeEventListener("scroll",y)}),window.removeEventListener("resize",y)}},[l,e,s,f]);const k=(0,n.useMemo)(()=>E?.type==="side"?{position:"fixed",top:E.top,left:E.left}:void 0,[E]);if(!f||!e||!Yd(e)&&!a||!E)return null;const x=_c(e),T=e.annotationType||Ye.PRODUCT_CAROUSEL,I=(()=>{switch(T){case Ye.PRODUCT_CAROUSEL:return(0,o.jsx)(cc,{data:e,subjectLine:i,cards:x});case Ye.SINGLE_IMAGE_PREVIEW:return(0,o.jsx)(mc,{data:e,subjectLine:i,card:x[0]});case Ye.DEAL_ANNOTATION:return(0,o.jsx)(fc,{data:e,subjectLine:i});case Ye.DEAL_CARD:return(0,o.jsx)(gc,{data:e});default:return null}})(),L=(0,o.jsxs)("div",{className:`annotations-preview${E.type==="popover"?" annotations-preview--popover":""}`,style:k,children:[(0,o.jsxs)("div",{className:"annotations-preview__content",children:[(0,o.jsxs)("div",{className:"annotations-preview__type",children:[g("Preview"),": ",xc(T,g)]}),I]}),(a||m)&&(0,o.jsxs)("div",{className:"annotations-preview__footer",children:[m&&(0,o.jsx)(t.ui_kit$Button,{type:"text",size:"small",danger:!0,onClick:m,children:g("Remove annotations")}),a&&(0,o.jsx)(t.ui_kit$Tooltip,{title:d&&c.length?c.join(". "):"",children:(0,o.jsx)("span",{className:"annotations-preview__apply-wrap",children:(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"small",onClick:a,disabled:d,children:g("Apply")})})})]})]});return(0,Ha.createPortal)(L,p||document.body)};function Sc(e){return e.replaceAll(`\r
|
|
17
|
+
`,`
|
|
18
|
+
`)}function Tc(e){if(!e)return"";const i=document.createElement("textarea");return i.innerHTML=e,i.value.replace(/\u00A0/g," ").trim()}var Rc=["USD","EUR","GBP","JPY","CNY","CAD","AUD","CHF","INR","BRL","MXN","KRW","RUB","UAH","KZT","PLN","TRY","SEK","NOK","DKK","CZK","ILS","AED","SGD","HKD","NZD","ZAR"];function ut(e){let i=(e??"").replace(/[\s\u00A0%]/g,"");return i=i.includes(".")?i.replace(/,/g,""):i.replace(",","."),/^\d+(\.\d+)?$/.test(i)?Number(i):null}function Tt(e,i=2){return String(Number(e.toFixed(i)))}function Rt(e){const i=ut(e);return i!==null&&i>0&&i<=100?i:null}function ns(e,i){const l=ut(e),s=Rt(i);return l===null||l<=0||s===null?"":Tt(l*s/100)}function yc(e,i){if(i?.includes("%")){const c=Rt(i);return c===null?"":Tt(c)}const l=ut(e),s=ut(i);if(l===null||l<=0||s===null||s<=0)return"";const a=s/l*100,d=Tt(s);for(const c of[0,1,2]){const m=Tt(a,c);if(ns(e,m)===d)return m}return Tt(a)}function Qt(){return{id:fo.generateUUID(),image:"",url:"",headline:"",price:"",priceCurrency:"",discountPercent:""}}function wc({discountValue:e,...i}){return{...i,discountPercent:yc(i.price,e)}}function ds(e,i){return i?.length?i.map(wc):e===Ye.PRODUCT_CAROUSEL||e===Ye.SINGLE_IMAGE_PREVIEW?[Qt()]:[]}function cs(e=Ye.PRODUCT_CAROUSEL){return{annotationType:e,annotationLogo:"",description:"",discountCode:"",availabilityStarts:null,availabilityEnds:null,offerPageUrl:"",merchantHomepageUrl:"",cards:ds(e)}}function jc(e){const i=e.annotationType||Ye.PRODUCT_CAROUSEL;return{annotationType:i,annotationLogo:e.logo||"",description:e.description||"",discountCode:e.discountCode||"",availabilityStarts:e.availabilityStarts?(0,Oo.default)(e.availabilityStarts):null,availabilityEnds:e.availabilityEnds?(0,Oo.default)(e.availabilityEnds):null,offerPageUrl:e.offerPageUrl||"",merchantHomepageUrl:e.merchantHomepageUrl||"",cards:ds(i,e.cards)}}function us(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&&Oo.default.isDayjs(e.availabilityStarts)?e.availabilityStarts.toISOString():void 0,availabilityEnds:e.availabilityEnds&&Oo.default.isDayjs(e.availabilityEnds)?e.availabilityEnds.toISOString():void 0,offerPageUrl:typeof e.offerPageUrl=="string"?e.offerPageUrl:"",merchantHomepageUrl:typeof e.merchantHomepageUrl=="string"?e.merchantHomepageUrl:"",cards:i.map(l=>({id:l.id||fo.generateUUID(),image:l.image||"",url:l.url||"",headline:l.headline||"",price:l.price||"",priceCurrency:l.priceCurrency||"",discountValue:ns(l.price,l.discountPercent)}))}}function vc(e,i){const l=e.getContent();if(!l)return!1;const s=ec(l,i);if(!s||l.slice(s.range.start,s.range.end)===s.text)return!1;const a=l.slice(s.range.start,s.range.end);return e.mutate({changes:[new r.TextChange(s.range.start,a,s.range.start,s.text)]},{source:"user"}),!0}function Ic(e,i){return e?e.emailId!==i.emailId||e.markup!==i.markup:!0}function Cc(e){const i=e.getContent(),l=oc(i);return l===i?!1:(e.mutate({changes:[new r.TextChange(0,i,0,l)]},{source:"user"}),!0)}function Wi(e){return!!e&&/^https?:\/\//i.test(e.trim())}function Pc(e,i){const l=e.annotationType??Ye.PRODUCT_CAROUSEL,s=[];return l===Ye.PRODUCT_CAROUSEL||l===Ye.SINGLE_IMAGE_PREVIEW?(e.cards?.some(a=>!!a.image&&Wi(a.url))||s.push(i("At least one card needs an image and a link starting with https://")),e.cards?.some(a=>!!a.priceCurrency?.trim()&&!Li(a.priceCurrency))&&s.push(i("Price currency must be a three-letter ISO 4217 code, for example USD")),s):l===Ye.DEAL_CARD?(e.description?.trim()||s.push(i("Discount description is required")),!Wi(e.offerPageUrl)&&!Wi(e.merchantHomepageUrl)&&s.push(i("Offer page or merchant homepage link starting with https:// is required")),s):(!e.description&&!e.discountCode&&!e.availabilityStarts&&!e.availabilityEnds&&s.push(i("Fill in at least one offer field")),s)}function Ac(e,i){const l=[],s=e.filter(a=>!!a.discountPercent?.trim());return s.some(a=>Rt(a.discountPercent)===null)&&l.push(i("Discount must be a percentage greater than 0 and up to 100")),s.some(a=>{const d=ut(a.price);return Rt(a.discountPercent)!==null&&(d===null||d<=0)})&&l.push(i("Enter the price as a number to calculate the discount")),l}var{Text:Nc}=t.ui_kit$Typography,Lc=10,Oc=1,ms={width:"100%"},$c="https://developers.google.com/workspace/gmail/promotab",Ro=["hover"],Fc=["annotationLogo"],ps=["cards",0,"price"],Mc=["cards",0,"discountPercent"],Dc=["cards",0,"priceCurrency"];function _o(e){return e.closest(".email-pane__collapse-wrapper")??document.body}var Do={clearIcon:(0,o.jsx)(t.ui_kit$ColorPickerClearGlyph,{})},Vc={optionFilterProp:"label"};function Hc(e){return{value:e||void 0}}var Uc=Rc.map(e=>{const i=ls(e);return{value:e,label:i===e?e:`${e} (${i})`}}),hs=({name:e,pricePath:i,iconStrokeWidth:l})=>{const{__:s}=r.useI18n(),a=(0,n.useMemo)(()=>[i],[i]),d=(0,n.useMemo)(()=>[({getFieldValue:c})=>({validator:async(m,f)=>{const g=typeof f=="string"?f.trim():"";if(!g)return;if(Rt(g)===null)throw new Error(s("Discount must be a percentage greater than 0 and up to 100"));const E=ut(c(i));if(E===null||E<=0)throw new Error(s("Enter the price as a number to calculate the discount"))}})],[s,i]);return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:s("Discount, %"),placement:"bottom",getPopupContainer:_o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:e,dependencies:a,rules:d,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Percent02Icon",component:t.icons$Percent02Icon,size:16,strokeWidth:l}),placeholder:s("Discount, %"),inputMode:"decimal",allowClear:Do})})})},bs=({name:e,iconStrokeWidth:i})=>{const{__:l}=r.useI18n(),s=(0,n.useMemo)(()=>[{validator:async(a,d)=>{const c=typeof d=="string"?d.trim():"";if(c&&!Li(c))throw new Error(l("Price currency must be a three-letter ISO 4217 code, for example USD"))}}],[l]);return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:l("Price currency"),placement:"bottom",getPopupContainer:_o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:e,rules:s,getValueProps:Hc,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:Uc,placeholder:l("Price currency"),prefix:(0,o.jsx)(r.EmIcons,{icon:"Globe02Icon",component:t.icons$Globe02Icon,size:16,strokeWidth:i}),showSearch:Vc,allowClear:!0,getPopupContainer:_o})})})},Wc=({onAdd:e})=>{const{__:i}=r.useI18n(),l=(0,n.useCallback)(()=>e(Qt()),[e]);return(0,o.jsx)(t.ui_kit$Button,{type:"text",block:!0,className:"selected-social-form__add-bar",icon:(0,o.jsx)(r.EmIcons,{icon:"AddSlide",component:t.icons$AddSlide}),onClick:l,children:i("Add card")})},zc=({field:e,index:i,form:l,isSingleImagePreview:s,onRemove:a})=>{const{__:d}=r.useI18n(),c=r.useAppConfig(),m=(0,n.useMemo)(()=>[e.name,"image"],[e.name]),f=(0,n.useMemo)(()=>["cards",e.name,"image"],[e.name]),g=(0,n.useMemo)(()=>[e.name,"headline"],[e.name]),E=(0,n.useMemo)(()=>[e.name,"url"],[e.name]),h=(0,n.useMemo)(()=>[e.name,"price"],[e.name]),p=(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]),x=(0,n.useMemo)(()=>[e.name,"id"],[e.name]),T=(0,n.useMemo)(()=>[{validator:async(L,y)=>{const C=typeof y=="string"?y.trim():"";if(C&&!/^https?:\/\//i.test(C))throw new Error(d("Please enter the correct URL."))}}],[d]),I=(0,n.useCallback)(()=>a(e.name),[a,e.name]);return(0,o.jsxs)("div",{className:"selected-social-form__card",children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head",children:[(0,o.jsx)(Nc,{className:"selected-social-form__card-title",children:s?d("Single image preview"):`${d("Card")} ${i+1}`}),!s&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:d("Delete"),placement:"top",getPopupContainer:_o,children:(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"selected-social-form__card-head-remove",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:18,strokeWidth:c.iconStrokeWidth}),"aria-label":d("Delete"),onClick:I})})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:d("Image"),placement:"top",getPopupContainer:_o,children:(0,o.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,o.jsx)(No,{form:l,label:d("Image"),name:m,watchPath:f})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:d("Headline"),placement:"bottom",getPopupContainer:_o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:g,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"ElementTitle",component:t.icons$ElementTitle,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Headline"),allowClear:Do})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:d("Link"),placement:"bottom",getPopupContainer:_o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:E,className:"selected-social-form__card-field",rules:T,children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Link03",component:t.icons$Link03,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Enter link"),allowClear:Do})})}),!s&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:d("Price"),placement:"bottom",getPopupContainer:_o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:h,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"CreditCard02Icon",component:t.icons$CreditCard02Icon,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Price"),allowClear:Do})})}),(0,o.jsx)(hs,{name:S,pricePath:p,iconStrokeWidth:c.iconStrokeWidth}),(0,o.jsx)(bs,{name:k,iconStrokeWidth:c.iconStrokeWidth})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:x,hidden:!0,children:(0,o.jsx)(t.ui_kit$Input,{})})]})};function fs({iconStrokeWidth:e}){const{__:i}=r.useI18n();return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:i("Discount code"),placement:"bottom",getPopupContainer:_o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"discountCode",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Sale04Icon",component:t.icons$Sale04Icon,size:16,strokeWidth:e}),placeholder:i("Discount code"),allowClear:Do})})})}var Gc=({className:e="",isActive:i=!0,email:l})=>{const{__:s}=r.useI18n(),a=r.useAppConfig(),d=r.useEditorLocked(),c=r.useEditorLockCheck(),{document:m}=r.useDocumentSessionContext(),f=r.useNotification(),[g]=t.ui_kit$Form.useForm(),E=(0,n.useRef)(null),h=(0,n.useRef)(!1),p=(0,n.useRef)(null),[S,k]=(0,n.useState)(!1),x=t.ui_kit$Form.useWatch("annotationType",g),T=t.ui_kit$Form.useWatch("annotationLogo",g),I=t.ui_kit$Form.useWatch("description",g),L=t.ui_kit$Form.useWatch("discountCode",g),y=t.ui_kit$Form.useWatch("availabilityStarts",g),C=t.ui_kit$Form.useWatch("availabilityEnds",g),P=t.ui_kit$Form.useWatch("offerPageUrl",g),K=t.ui_kit$Form.useWatch("merchantHomepageUrl",g),M=t.ui_kit$Form.useWatch("cards",g),$=JSON.stringify(M??[]),A=(0,n.useMemo)(()=>JSON.parse($)??[],[$]),W=x||Ye.PRODUCT_CAROUSEL,se=W===Ye.PRODUCT_CAROUSEL||W===Ye.SINGLE_IMAGE_PREVIEW,R=W===Ye.DEAL_ANNOTATION||W===Ye.DEAL_CARD,te=W===Ye.DEAL_CARD,he=W===Ye.DEAL_ANNOTATION,be=W===Ye.SINGLE_IMAGE_PREVIEW,Ie=W===Ye.SINGLE_IMAGE_PREVIEW?Oc:Lc,xe=(0,n.useMemo)(()=>[{value:Ye.PRODUCT_CAROUSEL,label:s("Product carousel")},{value:Ye.SINGLE_IMAGE_PREVIEW,label:s("Single image preview")},{value:Ye.DEAL_ANNOTATION,label:s("Deal Annotation")},{value:Ye.DEAL_CARD,label:s("Deal Card")}],[s]),Be=(0,n.useMemo)(()=>{let X="";m&&(X=m.getContent()),!X&&l?.html&&(X=l.html);const Q=X.match(/<title[^>]*>([\s\S]*?)<\/title>/i),Z=Q?Q[1].trim():l?.title||l?.subject||"";return Tc(Z)},[m,l?.html,l?.title,l?.subject]),ke=(0,n.useMemo)(()=>us({annotationType:W,annotationLogo:T,description:I,discountCode:L,availabilityStarts:y,availabilityEnds:C,offerPageUrl:P,merchantHomepageUrl:K,cards:A}),[W,T,I,L,y,C,P,K,A]),ne=(0,n.useMemo)(()=>se?Ac(A,s):[],[se,A,s]),He=(0,n.useMemo)(()=>zd(ke)&&ne.length===0,[ke,ne]),Fe=(0,n.useMemo)(()=>[...Pc(ke,s),...ne],[ke,ne,s]),Se=(0,n.useMemo)(()=>s("Learn more about %s").split("%s"),[s]),ye=(0,n.useCallback)(()=>{!m||c()||!Cc(m)||(g.setFieldsValue(cs(W)),p.current={emailId:l?.id,markup:null},k(!1),f.success(s("Gmail annotations were removed from the template code.")))},[m,c,g,W,l?.id,f,s]);(0,n.useEffect)(()=>{if(!se)return;const X=g.getFieldValue("cards")??[];if(W===Ye.SINGLE_IMAGE_PREVIEW){if(X.length>1){g.setFieldsValue({cards:[X[0]]});return}X.length===0&&g.setFieldsValue({cards:[Qt()]});return}X.length===0&&g.setFieldsValue({cards:[Qt()]})},[g,se,W,A]);const re=(0,n.useCallback)(X=>{if(!X||!h.current||!m||c())return!1;const Q=vc(m,us(X));if(Q){const Z=rs(m.getContent());p.current={emailId:l?.id,markup:Z},k(Z!==null)}return Q},[m,c,l?.id]),q=(0,n.useCallback)(()=>{re(g.getFieldsValue(!0))&&f.success(s("Gmail annotation was successfully applied to the template code."))},[re,g,f,s]);return(0,n.useEffect)(()=>{if(!i)return;const X=Sc(m?.getContent()||l?.html||""),Q={emailId:l?.id,markup:X?rs(X):null};if(k(Q.markup!==null),!Ic(p.current,Q))return;p.current=Q,h.current=!1;const Z=X?tc(X):null;g.setFieldsValue(Z?jc(Z):cs()),h.current=!0},[i,l?.id,l?.html,m,g]),(0,o.jsxs)("div",{className:(0,We.default)("selected-social-form","annotations-panel",e),ref:E,children:[(0,o.jsx)(Bc,{data:ke,subjectLine:Be,parentRef:E,overlayTargetSelector:"#pane-content-iframe",onApply:q,applyDisabled:!He||d,applyBlockers:Fe,onRemove:S&&!d?ye:void 0,visible:i}),(0,o.jsxs)(t.ui_kit$Form,{form:g,layout:"vertical",className:"selected-social-form__form element-controls",autoComplete:"off",disabled:d,children:[(0,o.jsxs)("div",{className:"selected-social-form__section",children:[(0,o.jsx)("div",{className:"selected-social-form__section-title",children:s("General settings")}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:s("Annotation type"),placement:"bottom",getPopupContainer:_o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"annotationType",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:xe,placeholder:s("Annotation type"),getPopupContainer:_o})})}),!te&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:s("Organization logo"),placement:"bottom",getPopupContainer:_o,children:(0,o.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,o.jsx)(No,{form:g,label:s("Organization logo"),name:"annotationLogo",watchPath:Fc})})}),(be||he)&&(0,o.jsx)(fs,{iconStrokeWidth:a.iconStrokeWidth}),be&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:s("Price"),placement:"bottom",getPopupContainer:_o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:ps,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"CreditCard02Icon",component:t.icons$CreditCard02Icon,size:16,strokeWidth:a.iconStrokeWidth}),placeholder:s("Price"),allowClear:Do})})}),(0,o.jsx)(hs,{name:Mc,pricePath:ps,iconStrokeWidth:a.iconStrokeWidth}),(0,o.jsx)(bs,{name:Dc,iconStrokeWidth:a.iconStrokeWidth})]}),R&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:s("Discount description"),placement:"bottom",getPopupContainer:_o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"description",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"CommentOutlined",component:t.icons$CommentOutlined,size:16,strokeWidth:a.iconStrokeWidth}),placeholder:s("Discount description"),allowClear:Do})})}),te&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(fs,{iconStrokeWidth:a.iconStrokeWidth}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:s("Offer page URL"),placement:"bottom",getPopupContainer:_o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"offerPageUrl",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Link03",component:t.icons$Link03,size:16,strokeWidth:a.iconStrokeWidth}),placeholder:s("Offer page URL"),allowClear:Do})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:s("Merchant homepage URL"),placement:"bottom",getPopupContainer:_o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"merchantHomepageUrl",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Link03",component:t.icons$Link03,size:16,strokeWidth:a.iconStrokeWidth}),placeholder:s("Merchant homepage URL"),allowClear:Do})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:s("Starts"),placement:"bottom",getPopupContainer:_o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"availabilityStarts",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DatePicker,{showTime:!0,placeholder:s("Starts"),style:ms,getPopupContainer:_o})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Ro,title:s("Ends"),placement:"bottom",getPopupContainer:_o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"availabilityEnds",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DatePicker,{showTime:!0,placeholder:s("Ends"),style:ms,getPopupContainer:_o})})})})]})]})]}),se&&(0,o.jsxs)("div",{className:(0,We.default)("selected-social-form__section",{"selected-social-form__section--bordered":!be,"annotations-panel__cards-section":be}),children:[W===Ye.PRODUCT_CAROUSEL&&(0,o.jsxs)("div",{className:"selected-social-form__section-title",children:[s("Promotion cards"),(0,o.jsx)("span",{className:"annotations-panel__section-hint",children:s("max 10")})]}),(0,o.jsx)(t.ui_kit$Form.List,{name:"cards",children:(X,{add:Q,remove:Z})=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"selected-social-form__items",children:X.map((U,V)=>(0,o.jsx)(zc,{field:U,index:V,form:g,isSingleImagePreview:be,onRemove:Z},U.key))}),!be&&A.length<Ie&&(0,o.jsx)(Wc,{onAdd:Q})]})})]}),(0,o.jsxs)("div",{className:"annotations-panel__docs-hint",children:[Se[0],(0,o.jsx)("a",{href:$c,target:"_blank",rel:"noopener noreferrer",children:s("Gmail annotations")}),Se[1]]})]})]})},zi=({email:e})=>{const{__:i}=r.useI18n(),l=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,[s,a]=(0,n.useState)(r.SETTINGS),d=r.useAppConfig(),c=S=>a(S||""),m=d.settingsTabEnabled,f=d.UTMEnabled&&l==="email",g=d.annotationsEnabled&&l==="email",E=[m&&"Settings",f&&"UTM parameters",g&&"Annotations parameters"].filter(Boolean),h=E.includes(s)?s:E[0],p=(0,n.useMemo)(()=>{const S=[];return m&&S.push({label:(0,o.jsx)(o.Fragment,{children:i("Settings")}),key:r.SETTINGS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(Ul,{className:"email-settings__collapse-panel-content",element:e})}),f&&S.push({label:(0,o.jsx)(o.Fragment,{children:i("UTM parameters")}),key:r.UTM_PARAMETERS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(Kl,{className:"email-settings__collapse-panel-content",email:e})}),g&&S.push({label:(0,o.jsx)(o.Fragment,{children:i("Annotations")}),key:r.ANNOTATIONS_PARAMETERS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(Gc,{className:"email-settings__collapse-panel-content",email:e,isActive:h===r.ANNOTATIONS_PARAMETERS})}),S},[i,e,m,f,g,h]);return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse",size:"large",activeKey:h,onChange:c,items:p})})};zi.propTypes={};var gs=320,Yc=1200,Xc=350,{backgroundColor:_s,backgroundImage:Gi,backgroundPositionX:Yi,backgroundPositionY:Xi,backgroundRepeat:Zt,backgroundSize:Ki,responsive:Kc,backgroundColorContent:qc,width:qi}={backgroundColor:"backgroundColor",backgroundImage:"backgroundImage",backgroundPositionX:"backgroundPositionX",backgroundPositionY:"backgroundPositionY",backgroundRepeat:"backgroundRepeat",backgroundSize:"backgroundSize",responsive:"responsive",backgroundColorContent:"backgroundColorContent",width:"width"},Jc={[_s]:"",[Gi]:"",[Yi]:"",[Xi]:"",[Zt]:"checked",[Ki]:"",[qc]:"",[qi]:""};function Ji(e){const i=Number(e);return Number.isNaN(i)?null:{value:i,dim:"px"}}var xs=({className:e=""})=>{const{__:i}=r.useI18n(),{token:l}=(0,t.ui_kit$useToken)(),s=r.useDispatch(),a=r.useAppConfig(),[d]=t.ui_kit$Form.useForm(),c=r.useSendPostMessage(),m=r.useEmailAttribute("common_styles"),f=r.useSelector(r.selectEmailSettings),g=r.useSelector(r.selectIsSettingsDisabled$1),E=r.useSelector(r.selectActiveSettingsTab),h=r.useSelector(r.selectIsNeedUpdateAppearance),[p,S]=(0,n.useState)(!0),k=(0,n.useRef)(!1),x=(0,n.useRef)(null),T=i("Email not yet loaded or global container not found.");(0,n.useEffect)(()=>{h&&(s(r.setIsNeedUpdateAppearance(!1)),c({operation:r.EVENT_TYPES.INIT_PREVIEW}))},[d,h,s,c,m]),(0,n.useEffect)(()=>()=>{x.current&&clearTimeout(x.current)},[]);const I=[{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"}],L=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}];(0,n.useEffect)(()=>{const{width:W,...se}=f,R={...se,backgroundImage:f.backgroundImage?f.backgroundImage[0]?.value:"",backgroundRepeat:f[Zt]===""?"repeat":f[Zt],backgroundSize:f[Ki],responsive:f.responsive?.shutdown};k.current||(R.width=W?.value,R.widthDim=W?.dim),d.setFieldsValue(R),S(!f.backgroundImage)},[f,d]);const y=(0,n.useCallback)(W=>{const se=Ji(W);!se||se.value<gs||c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{width:se}})},[c]),C=(0,n.useCallback)(W=>{const se=Ji(W);se&&s(r.setEmailSettings({...f,width:se}))},[s,f]),P=(0,n.useCallback)(W=>{x.current&&clearTimeout(x.current),C(W),x.current=setTimeout(()=>{y(W)},Xc)},[y,C]),K=W=>{const se=d.getFieldsValue(!0),R=Object.keys(W)[0];switch(R){case qi:P(W[R]);break;case Yi:case Xi:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[R]:W[R]===""?"none":W[R]}});break;case Gi:S(W[R]===""),c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[R]:[{...f?.backgroundImage?.[0],type:"url",value:W[R]}],backgroundSize:"cover"}});break;case Kc:{const te=Ji(se.width);c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{responsive:{shutdown:W[R],styles:W[R]},...te?{width:te}:{}}});break}default:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:W})}},M=W=>{s(r.setMobileViewActive({shutdown:W,styles:W})),c({operation:r.EVENT_TYPES.SANDBOX_IFRAME_SETSIZE,settings:{iframeWidth:document.querySelector(".email-pane__iframe").getBoundingClientRect().width}})},$=()=>{k.current=!0},A=()=>{x.current&&(clearTimeout(x.current),x.current=null);const W=d.getFieldValue(qi);C(W),y(W),requestAnimationFrame(()=>{k.current=!1})};return(0,o.jsx)("div",{className:(0,We.default)("appearance-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"appearance_panel_form",initialValues:{remember:!1,...Jc},onValuesChange:K,autoComplete:"off",className:"element-controls",children:[g?(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:"24px"},title:T,type:"error"}):null,(0,o.jsx)(t.ui_kit$FormSection,{title:i("Email layout width"),dividerTop:!1,children:(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:f.width?.value?i("This field sets the width of the email."):i("Couldn`t determine the email width"),placement:"right",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"width",style:{marginBottom:l.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$InputNumber,{min:gs,max:Yc,placeholder:i("Width"),disabled:!f.width?.value,addonAfter:"px",onFocus:$,onBlur:A})})})})})}),a.emailResponsiveControlEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{gutter:20,children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"responsive",valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:"responsive",label:i("Responsive email"),size:"small",name:"responsive",disabled:f.responsive?.shutdown===void 0,onChange:M})})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:i("Email background color"),dividerTop:!a.emailResponsiveControlEnabled,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:p?16:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:_s,style:{marginBottom:l.formItemMarginBottomXS},rules:[{message:i("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:f.usedColors,disabled:g})})})}),(0,o.jsx)(t.ui_kit$Col,{span:p?12:24,children:a.formEmailFieldBackgroundImageEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(No,{form:d,label:i("Background image"),name:Gi,tooltipTitle:i("Background image"),disabled:g||E!=="Styles",elementSettings:f}),!p&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:"0"},children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Horizontal position"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:Yi,style:{marginBottom:l.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:i("Horizontal position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Vertical position"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:Xi,style:{marginBottom:l.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:i("Vertical position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical})})})})})]})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background image repeat"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:Zt,children:(0,o.jsx)(t.ui_kit$Select,{placeholder:i("Please select"),disabled:g,options:I})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background image size"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:Ki,children:(0,o.jsx)(t.ui_kit$Select,{placeholder:i("Please select"),disabled:g,options:L})})})})]})]})]})})]})})]})})};xs.propTypes={className:_.default.string};var{Option:ks}=t.ui_kit$Select,{width:Es,widthDim:Qc}={width:"width",widthDim:"widthDim"},Zc={[Es]:"",[Qc]:""},Bs=({className:e=""})=>{const{__:i}=r.useI18n(),l=r.useSelector(r.selectBlockSettings),s=r.useSelector(r.selectIsSettingsDisabled),[a]=t.ui_kit$Form.useForm(),d=r.useSendPostMessage(),c=i("Block not yet loaded or global container not found.");(0,n.useEffect)(()=>{a.setFieldsValue({width:l.width.value,widthDim:l.width.dim})},[l,a]);const m=f=>{const g=a.getFieldsValue(!0),E=Object.keys(f)[0];let h;switch(E){case"width":h={[E]:{value:f[E],dim:g.widthDim}};break;case"widthDim":h={width:{value:g.width,dim:f[E]}};break;default:return}d({operation:r.EVENT_TYPES.SANDBOX_BLOCK_SETTINGS_SET,settings:h})};return(0,o.jsx)("div",{className:(0,We.default)("block-appearance-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:a,layout:"vertical",name:"block_appearance_panel_form",initialValues:{remember:!1,...Zc},onValuesChange:m,autoComplete:"off",children:[s?(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:"24px"},title:c,type:"error"}):null,(0,o.jsx)(t.ui_kit$Form.Item,{label:i("Container width"),name:Es,tooltip:{title:i("Specifies the block width."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},rules:[{message:i("Please input container width")}],children:(0,o.jsx)(t.ui_kit$Input,{disabled:s,placeholder:i("Container width"),addonAfter:(0,o.jsx)(t.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:(0,o.jsxs)(t.ui_kit$Select,{className:"select-after",children:[(0,o.jsx)(ks,{value:"px",children:"px"}),(0,o.jsx)(ks,{value:"%",children:"%"})]})})})})]})})};Bs.propTypes={className:_.default.string};var eu=()=>{};function Ss(){const e=r.useContainer(),i=(0,n.useCallback)(s=>{if(!e)return eu;const a=r.provideDefaultCommonStyles(e).watch(s);return()=>a.dispose()},[e]),l=(0,n.useCallback)(()=>r.getDefaultCommonStyles(e),[e]);return(0,n.useSyncExternalStore)(i,l,l)}function Ts(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Qi(e,i){const l={...e};for(const s of Object.keys(i)){const a=i[s],d=e[s];Ts(a)&&Ts(d)?l[s]=Qi(d,a):a!==void 0&&(l[s]=a)}return l}function Rs(e,i){const l=r.COMMON_STYLES;if(typeof e=="string"){const s=e.trim();if(s.startsWith("{"))try{const a=JSON.parse(s);if(a&&typeof a=="object"&&!Array.isArray(a)&&Object.keys(a).length>0)return Qi(l,a)}catch{}}return i&&typeof i=="object"&&!Array.isArray(i)?Qi(l,i):l}var ys=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}),ou={buttons_borderRadiusAll:"all",buttons_borderRadiusTopLeft:"topLeft",buttons_borderRadiusBottomLeft:"bottomLeft",buttons_borderRadiusTopRight:"topRight",buttons_borderRadiusBottomRight:"bottomRight"},tu={cards_borderRadiusAll:"all",cards_borderRadiusTopLeft:"topLeft",cards_borderRadiusBottomLeft:"bottomLeft",cards_borderRadiusTopRight:"topRight",cards_borderRadiusBottomRight:"bottomRight"},iu={blockPaddingTop:"top",blockPaddingLeft:"left",blockPaddingRight:"right",blockPaddingBottom:"bottom"},ru=({className:e})=>{const{__:i}=r.useI18n(),l=z.useGoogleFontsLoader(),s=r.useDispatch(),a=r.useSendPostMessage(),[d]=t.ui_kit$Form.useForm(),c=r.useSelector(r.selectEmailSettings),m=r.useSelector(r.selectIsNeedUpdateContentAppearance),f=Ss(),g=r.useEmailAttribute("common_styles"),E=r.useAppConfig(),{token:h}=(0,t.ui_kit$useToken)(),[p,S]=(0,n.useState)({}),[k,x]=(0,n.useState)({}),[T,I]=(0,n.useState)(!0),[L,y]=(0,n.useState)(!0),[C,P]=(0,n.useState)(!1),[K,M]=(0,n.useState)(!1),$={buttonsPaddingTop:"top",buttonsPaddingLeft:"left",buttonsPaddingRight:"right",buttonsPaddingBottom:"bottom"},A=Rs(g,f),[W,se]=(0,n.useState)(A.headings.bold),[R,te]=(0,n.useState)(A.headings.italic),[he,be]=(0,n.useState)(A.links.underline),[Ie,xe]=(0,n.useState)(A.buttons.bold),[Be,ke]=(0,n.useState)(A.buttons.italic),[ne,He]=(0,n.useState)(null),Fe=r.useSelector(r.selectIsPanelHistoryCollapsed);(0,n.useEffect)(()=>{Fe||He(null)},[A,He,Fe]),(0,n.useEffect)(()=>{Fe&&!ne&&He(ys(A))},[A,ne,Fe]),(0,n.useEffect)(()=>{m&&(s(r.setIsNeedUpdateContentAppearance(!1)),d.setFieldsValue(ys(A)))},[d,m,s,A]);const[Se,ye]=(0,n.useState)(Math.min(A.headings.fontSize-1,19)),[re,q]=(0,n.useState)(Math.max(A.text.fontSize+1,20));(0,n.useEffect)(()=>{if(ne){const U=ne.buttonsBorder;S(U);const V=Object.keys(U).find(me=>U[me]?.width||U[me]?.style||U[me]?.color),J=ne.cardsBorder;x(J);const de=Object.keys(J).find(me=>J[me]?.width||J[me]?.style||J[me]?.color);d.setFieldsValue({buttons_borderPosition:V||"all",buttons_borderWidth:U[V]?.width!==null?U[V]?.width:"",buttons_borderColor:U[V]?.color||"",buttons_borderStyle:U[V]?.style||"",cards_borderPosition:de||"all",cards_borderWidth:J[de]?.width!==null?J[de]?.width:"",cards_borderColor:J[de]?.color||"",cards_borderStyle:J[de]?.style||"",buttons_borderRadiusAll:u(ne.buttonsBorderRadius.all),buttons_borderRadiusTopLeft:u(ne.buttonsBorderRadius.topLeft),buttons_borderRadiusBottomLeft:u(ne.buttonsBorderRadius.bottomLeft),buttons_borderRadiusTopRight:u(ne.buttonsBorderRadius.topRight),buttons_borderRadiusBottomRight:u(ne.buttonsBorderRadius.bottomRight),cards_borderRadiusAll:u(ne.cardsBorderRadius.all),cards_borderRadiusTopLeft:u(ne.cardsBorderRadius.topLeft),cards_borderRadiusBottomLeft:u(ne.cardsBorderRadius.bottomLeft),cards_borderRadiusTopRight:u(ne.cardsBorderRadius.topRight),cards_borderRadiusBottomRight:u(ne.cardsBorderRadius.bottomRight),blockPaddingAll:u(ne.blockPaddingAll),blockPaddingTop:u(ne.blockPaddingTop),blockPaddingRight:u(ne.blockPaddingRight),blockPaddingBottom:u(ne.blockPaddingBottom),blockPaddingLeft:u(ne.blockPaddingLeft),blockPaddingLeftRight:u(ne.blockPaddingRight)||u(ne.blockPaddingLeft),blockPaddingTopBottom:u(ne.blockPaddingTop)||u(ne.blockPaddingBottom)}),!u(ne.blockPaddingAll)&&(u(ne.blockPaddingTop)||u(ne.blockPaddingRight)||u(ne.blockPaddingBottom)||u(ne.blockPaddingLeft))&&(ne.blockPaddingTop!==ne.blockPaddingBottom||ne.blockPaddingRight!==ne.blockPaddingLeft)?M(!1):M(!0),!u(ne.buttonsBorderRadius.all)&&(u(ne.buttonsBorderRadius.topLeft)||u(ne.buttonsBorderRadius.bottomLeft)||u(ne.buttonsBorderRadius.topRight)||u(ne.buttonsBorderRadius.bottomRight))?I(!1):I(!0),ne.buttonsPadding&&!u(ne.buttonsPadding.all)&&(u(ne.buttonsPadding.bottom)||u(ne.buttonsPadding.right)||u(ne.buttonsPadding.left)||u(ne.buttonsPadding.top))&&P(!1),!u(ne.cardsBorderRadius?.all)&&(u(ne.cardsBorderRadius?.topLeft)||u(ne.cardsBorderRadius?.bottomLeft)||u(ne.cardsBorderRadius?.topRight)||u(ne.cardsBorderRadius?.bottomRight))?y(!1):y(!0)}},[d,ne]);const X=()=>{M(V=>!V);const U=d.getFieldsValue(!0);if(!K){U.blockPaddingLeftRight=U.blockPaddingLeft,U.blockPaddingTopBottom=U.blockPaddingTop,U.blockPaddingRight=U.blockPaddingLeft,U.blockPaddingBottom=U.blockPaddingTop;const V=Number(U.blockPaddingTopBottom),J=Number(U.blockPaddingLeftRight);a({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{blockPadding:{top:Number.isFinite(V)?V:0,bottom:Number.isFinite(V)?V:0,left:Number.isFinite(J)?J:0,right:Number.isFinite(J)?J:0}}})}},Q=U=>{const V=U.target.closest("button");if(!V)return;const J=V.name,de=V.classList.contains("selected-td-form__button--active");V.className=de?"ant-btn ant-btn-default":"ant-btn ant-btn-default selected-td-form__button--active";try{V.blur()}catch{}J==="headingBold"?se(!de):J==="headingItalic"?te(!de):J==="linkUnderline"?be(!de):J==="buttonsBold"?xe(!de):J==="buttonsItalic"&&ke(!de),a({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[J]:!de}})},Z=U=>{const V=d.getFieldsValue(!0),J=Object.keys(U)[0];let de={};switch(J){case"headingFontSize":ye(Math.min(V.headingFontSize-1,19)),de=U;break;case"textFontSize":q(Math.max(V.textFontSize+1,20)),de=U;break;case"buttons_borderStyle":de={buttonsBorder:{[V.buttons_borderPosition]:{...p[V.buttons_borderPosition],style:U[J]}}},V.buttons_borderPosition==="all"?S(me=>({...r.RESET_BORDER_PARAMS,[V.buttons_borderPosition]:{...me[V.buttons_borderPosition],style:U[J]}})):S(me=>({...me,[V.buttons_borderPosition]:{...me[V.buttons_borderPosition],style:U[J]}}));break;case"buttons_borderColor":de={buttonsBorder:{[V.buttons_borderPosition]:{...p[V.buttonsBorderPosition],color:U[J]}}},V.buttons_borderPosition==="all"?S(me=>({...r.RESET_BORDER_PARAMS,[V.buttons_borderPosition]:{...me[V.buttons_borderPosition],color:U[J]}})):S(me=>({...me,[V.buttons_borderPosition]:{...me[V.buttons_borderPosition],color:U[J]}}));break;case"buttons_borderWidth":de={buttonsBorder:{[V.buttons_borderPosition]:{...p[V.buttons_borderPosition],width:U[J]}}},V.buttonsBorderPosition==="all"?S(me=>({...r.RESET_BORDER_PARAMS,[V.buttons_borderPosition]:{...me[V.buttons_borderPosition],width:U[J]}})):S(me=>({...me,[V.buttons_borderPosition]:{...me[V.buttons_borderPosition],width:U[J]}}));break;case"buttons_borderPosition":d.setFieldsValue({buttons_borderWidth:p[U[J]]?.width||"",buttons_borderColor:p[U[J]]?.color||"",buttons_borderStyle:p[U[J]]?.style||""});break;case"cards_borderStyle":de={cardsBorder:{[V.cards_borderPosition]:{...k[V.cards_borderPosition],style:U[J]}}},V.cards_borderPosition==="all"?x(me=>({...r.RESET_BORDER_PARAMS,[V.cards_borderPosition]:{...me[V.cards_borderPosition],style:U[J]}})):x(me=>({...me,[V.cards_borderPosition]:{...me[V.cards_borderPosition],style:U[J]}}));break;case"cards_borderColor":de={cardsBorder:{[V.cards_borderPosition]:{...k[V.cardsBorderPosition],color:U[J]}}},V.cards_borderPosition==="all"?x(me=>({...r.RESET_BORDER_PARAMS,[V.cards_borderPosition]:{...me[V.cards_borderPosition],color:U[J]}})):x(me=>({...me,[V.cards_borderPosition]:{...me[V.cards_borderPosition],color:U[J]}}));break;case"cards_borderWidth":de={cardsBorder:{[V.cards_borderPosition]:{...k[V.cards_borderPosition],width:U[J]}}},V.cardsBorderPosition==="all"?x(me=>({...r.RESET_BORDER_PARAMS,[V.cards_borderPosition]:{...me[V.cards_borderPosition],width:U[J]}})):x(me=>({...me,[V.cards_borderPosition]:{...me[V.cards_borderPosition],width:U[J]}}));break;case"cards_borderPosition":d.setFieldsValue({cards_borderWidth:k[U[J]]?.width||"",cards_borderColor:k[U[J]]?.color||"",cards_borderStyle:k[U[J]]?.style||""});break;case"buttons_borderRadiusAll":case"buttons_borderRadiusTopLeft":case"buttons_borderRadiusBottomLeft":case"buttons_borderRadiusTopRight":case"buttons_borderRadiusBottomRight":de={buttonsBorderRadius:{[ou[J]]:+U[J]}};break;case"cards_borderRadiusAll":case"cards_borderRadiusTopLeft":case"cards_borderRadiusBottomLeft":case"cards_borderRadiusTopRight":case"cards_borderRadiusBottomRight":de={cardsBorderRadius:{[tu[J]]:+U[J]}};break;case"buttonsPaddingTop":case"buttonsPaddingLeft":case"buttonsPaddingRight":case"buttonsPaddingBottom":C?(de={padding:{all:+U[J]}},d.setFieldsValue({paddingTop:U[J],paddingLeft:U[J],paddingRight:U[J],paddingBottom:U[J]})):de={buttonsPadding:{[$[J]]:+U[J]}};break;case"blockPaddingTop":case"blockPaddingLeft":case"blockPaddingRight":case"blockPaddingBottom":de={blockPadding:{[iu[J]]:+U[J]}};break;case"blockPaddingTopBottom":de={blockPadding:{top:+U[J],bottom:+U[J]}},V.blockPaddingTop=V.blockPaddingBottom=+U[J];break;case"blockPaddingLeftRight":de={blockPadding:{left:+U[J],right:+U[J]}},V.blockPaddingLeft=V.blockPaddingRight=+U[J];break;default:de=U}J!=="buttons_borderPosition"&&a({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:de})};return ne&&(0,o.jsx)("div",{className:(0,We.default)("appearance-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"content_appearance_panel_form",initialValues:ne,onValuesChange:Z,autoComplete:"off",className:"element-controls",children:[null,(0,o.jsxs)(t.ui_kit$FormSection,{title:i("Blocks"),dividerTop:!1,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Blocks background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"blockBackgroundColor",style:{marginBottom:h.formItemMarginBottomMD+4},rules:[{message:i("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color of the contrast blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"blockContrastBackgroundColor",style:{marginBottom:h.formItemMarginBottomMD+4},rules:[{message:i("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})})]}),(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:K,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,o.jsxs)(t.ui_kit$FormSection,{title:i("General text"),dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Font of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textFontFamily",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{loadGoogleFonts:l,getPopupContainer:U=>U.closest(".email-pane__content-col")})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Font size of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textFontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:15,max:Se,placeholder:i("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Line height of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textLineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Color of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrast block text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textContrastColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Text color"),usedColors:c.usedColors})})})})]}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom padding of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textPaddingBottom",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom padding"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingBottom",component:t.icons$PaddingBottom}),addonAfter:"px"})})})})})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:i("Headings"),dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading font"),placement:"left",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingFontFamily",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{loadGoogleFonts:l,getPopupContainer:U=>U.closest(".email-pane__content-col")})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingFontSize",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:re,max:40,placeholder:i("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingLineHeight",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading letter spacing"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingLetterSpacing",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Letter spacing"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsxs)(t.ui_kit$Space,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Strong"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)({"selected-td-form__button--active":W}),type:"default",name:"headingBold",onClick:Q,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined})})}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Italic"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)({"selected-td-form__button--active":R}),type:"default",name:"headingItalic",onClick:Q,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined})})})]})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Heading color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrast block header color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingContrastColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Heading color"),usedColors:c.usedColors})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Top padding"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingPaddingTop",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Top padding"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingTop",component:t.icons$PaddingTop}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom padding"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingPaddingBottom",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom padding"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingBottom",component:t.icons$PaddingBottom}),addonAfter:"px"})})})})]})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:i("Links"),dividerTop:!0,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Link color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkColor",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Link color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Underline"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)({"selected-td-form__button--active":he}),type:"default",name:"linkUnderline",onClick:Q,children:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined})})})})]}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Link color in contrasting blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkContrastColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Link color"),usedColors:c.usedColors})})})})})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Text & background")]}),dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons font"),placement:"left",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsFontFamily",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{loadGoogleFonts:l,getPopupContainer:U=>U.closest(".email-pane__content-col")})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsFontSize",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons letter spacing"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsLetterSpacing",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Letter spacing"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsColor",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Buttons text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Button text color in contrasting blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsContrastColor",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Buttons text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsBackgroundColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Button background color in contrasting blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsContrastBackgroundColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),E.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(tt,{form:d,elementSettings:{textAlign:"",type:"email"},imgParent:!1,name:"buttonsAlign",withHotKeys:!1})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsxs)(t.ui_kit$Space,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Strong"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)({"selected-td-form__button--active":Ie}),type:"default",name:"buttonsBold",onClick:Q,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined})})}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Italic"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,We.default)({"selected-td-form__button--active":Be}),type:"default",name:"buttonsItalic",onClick:Q,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined})})})]})})]})]}),E.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Borders")]}),dividerTop:!0,children:(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(z.SelectedElementFormBorder,{form:d,borders:p,namePrefix:"buttons_"})})}),E.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Border radius")]}),dividerTop:!0,children:(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(To,{form:d,oneBorderRadiusValue:T,setOneBorderRadiusValue:I,elementSettings:ne,namePrefix:"buttons_"})})}),(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Margins")]}),dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Top margin"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsMarginTop",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Top margin"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingTop",component:t.icons$PaddingTop}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom margin"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsMarginBottom",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom margin"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingBottom",component:t.icons$PaddingBottom}),addonAfter:"px"})})})})]})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Cards")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Colors")]}),dividerTop:!0,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:i("Base colors"),compact:!0,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Base background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsBaseBackgroundColor",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Base background color"),usedColors:c.usedColors})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:i("Contrasting colors"),compact:!0,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrasting background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsContrastBackgroundColor",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Contrasting background color"),usedColors:c.usedColors})})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Base text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsBaseTextColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Base text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrasting text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsContrastTextColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Contrasting text color"),usedColors:c.usedColors})})})})]})]}),E.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Cards")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Borders")]}),dividerTop:!0,children:(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(z.SelectedElementFormBorder,{form:d,borders:k,namePrefix:"cards_"})})}),E.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Cards")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Border radius")]}),dividerTop:!0,children:(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(To,{form:d,oneBorderRadiusValue:L,setOneBorderRadiusValue:y,elementSettings:ne,namePrefix:"cards_"})})})]})})},Zi=({email:e})=>{const{__:i}=r.useI18n(),l=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,[s,a]=(0,n.useState)(r.APPEARANCE),d=r.useAppConfig(),c=g=>a(g||"");e.common_styles&&e.common_styles;const m=l==="email"&&d.commonStylesEnabled&&!0;let f=[{label:(0,o.jsx)(o.Fragment,{children:i(l==="email"?"Global styles":"Block styles")}),key:r.APPEARANCE,forceRender:!0,className:"email-settings__collapse-panel",children:l==="email"?(0,o.jsx)(xs,{className:"email-settings__collapse-panel-content"}):(0,o.jsx)(Bs,{className:"email-settings__collapse-panel-content"})}];return m&&f.push({label:(0,o.jsx)(o.Fragment,{children:i("Content styles")}),key:"contentStyles",forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(ru,{className:"email-settings__collapse-panel-content"})}),(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse appearance-panel__content-styles",size:"large",activeKey:s,onChange:c,items:f})})};Zi.propTypes={};var lu=lo.__commonJSMin((e=>{var i=["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"].reduce((l,s)=>(l[s.toLowerCase()]=s,l),{});e.CASE_SENSITIVE_TAG_NAMES_MAP=i}));function su(e){return e.type===ro.Tag||e.type===ro.Script||e.type===ro.Style}var ro,au,nu,du,cu,uu,mu,pu,hu,bu,ws=lo.__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"})(ro||(ro={})),au=ro.Root,nu=ro.Text,du=ro.Directive,cu=ro.Comment,uu=ro.Script,mu=ro.Style,pu=ro.Tag,hu=ro.CDATA,bu=ro.Doctype}));function js(e){return su(e)}function vs(e){return e.type===ro.CDATA}function Is(e){return e.type===ro.Text}function Cs(e){return e.type===ro.Comment}function Ps(e){return e.type===ro.Directive}function As(e){return e.type===ro.Root}function fu(e){return Object.hasOwn(e,"children")}function er(e,i=!1){let l;if(Is(e))l=new wt(e.data);else if(Cs(e))l=new oi(e.data);else if(js(e)){const s=i?or(e.children):[],a=new ri(e.name,{...e.attribs},s);for(const d of s)d.parent=a;e.namespace!=null&&(a.namespace=e.namespace),e["x-attribsNamespace"]&&(a["x-attribsNamespace"]={...e["x-attribsNamespace"]}),e["x-attribsPrefix"]&&(a["x-attribsPrefix"]={...e["x-attribsPrefix"]}),l=a}else if(vs(e)){const s=i?or(e.children):[],a=new ii(s);for(const d of s)d.parent=a;l=a}else if(As(e)){const s=i?or(e.children):[],a=new vt(s);for(const d of s)d.parent=a;e["x-mode"]&&(a["x-mode"]=e["x-mode"]),l=a}else if(Ps(e)){const s=new ti(e.name,e.data);e["x-name"]!=null&&(s["x-name"]=e["x-name"],s["x-publicId"]=e["x-publicId"],s["x-systemId"]=e["x-systemId"]),l=s}else throw new Error(`Not implemented yet: ${e.type}`);return l.startIndex=e.startIndex,l.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(l.sourceCodeLocation=e.sourceCodeLocation),l}function or(e){const i=e.map(l=>er(l,!0));for(let l=1;l<i.length;l++)i[l].prev=i[l-1],i[l-1].next=i[l];return i}var ei,yt,wt,oi,ti,jt,ii,vt,ri,Ns=lo.__esmMin((()=>{ws(),ei=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 er(this,e)}},yt=class extends ei{data;constructor(e){super(),this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}},wt=class extends yt{type=ro.Text;get nodeType(){return 3}},oi=class extends yt{type=ro.Comment;get nodeType(){return 8}},ti=class extends yt{type=ro.Directive;name;constructor(e,i){super(i),this.name=e}get nodeType(){return 1}"x-name";"x-publicId";"x-systemId"},jt=class extends ei{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}},ii=class extends jt{type=ro.CDATA;get nodeType(){return 4}},vt=class extends jt{type=ro.Root;get nodeType(){return 9}},ri=class extends jt{name;attribs;type;constructor(e,i,l=[],s=e==="script"?ro.Script:e==="style"?ro.Style:ro.Tag){super(l),this.name=e,this.attribs=i,this.type=s}get nodeType(){return 1}get tagName(){return this.name}set tagName(e){this.name=e}get attributes(){return Object.keys(this.attribs).map(e=>({name:e,value:this.attribs[e],namespace:this["x-attribsNamespace"]?.[e],prefix:this["x-attribsPrefix"]?.[e]}))}namespace;"x-attribsNamespace";"x-attribsPrefix"}})),tr=lo.__exportAll({CDATA:()=>ii,Comment:()=>oi,DataNode:()=>yt,Document:()=>vt,DomHandler:()=>rr,Element:()=>ri,Node:()=>ei,NodeWithChildren:()=>jt,ProcessingInstruction:()=>ti,Text:()=>wt,cloneNode:()=>er,default:()=>rr,hasChildren:()=>fu,isCDATA:()=>vs,isComment:()=>Cs,isDirective:()=>Ps,isDocument:()=>As,isTag:()=>js,isText:()=>Is}),ir,rr,lr=lo.__esmMin((()=>{ws(),Ns(),Ns(),ir={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},rr=class{dom=[];root=new vt(this.dom);callback;options;elementCB;done=!1;tagStack=[this.root];lastNode=null;parser=null;constructor(e,i,l){typeof i=="function"&&(l=i,i=ir),typeof e=="object"&&(i=e,e=void 0),this.callback=e??null,this.options=i??ir,this.elementCB=l??null}onparserinit(e){this.parser=e}onreset(){this.dom=[],this.root=new vt(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null}onend(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))}onerror(e){this.handleCallback(e)}onclosetag(){this.lastNode=null;const e=this.tagStack.pop();this.options.withEndIndices&&this.parser&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)}onopentag(e,i){const l=this.options.xmlMode?ro.Tag:void 0,s=new ri(e,i,void 0,l);this.addNode(s),this.tagStack.push(s)}ontext(e){const{lastNode:i}=this;if(i&&i.type===ro.Text)i.data+=e,this.options.withEndIndices&&this.parser&&(i.endIndex=this.parser.endIndex);else{const l=new wt(e);this.addNode(l),this.lastNode=l}}oncomment(e){if(this.lastNode&&this.lastNode.type===ro.Comment){this.lastNode.data+=e;return}const i=new oi(e);this.addNode(i),this.lastNode=i}oncommentend(){this.lastNode=null}oncdatastart(){const e=new wt(""),i=new ii([e]);this.addNode(i),e.parent=i,this.lastNode=e}oncdataend(){this.lastNode=null}onprocessinginstruction(e,i){const l=new ti(e,i);this.addNode(l)}handleCallback(e){if(typeof this.callback=="function")this.callback(e,this.dom);else if(e)throw e}addNode(e){const i=this.tagStack[this.tagStack.length-1],l=i.children[i.children.length-1];this.options.withStartIndices&&this.parser&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&this.parser&&(e.endIndex=this.parser.endIndex),i.children.push(e),l&&(e.prev=l,l.next=e),e.parent=i,this.lastNode=null}}})),Ls=lo.__commonJSMin((e=>{var i=lu(),l=(lr(),lo.__toCommonJS(tr)),s="\r",a=new RegExp(s,"g"),d=`__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_${Date.now().toString()}__`,c=new RegExp(d,"g");function m(k){return i.CASE_SENSITIVE_TAG_NAMES_MAP[k]}function f(k){const x={};let T=0;const I=k.length;for(;T<I;T++){const L=k[T];x[L.name]=L.value}return x}function g(k){k=k.toLowerCase();const x=m(k);return x||k}function E(k,x){const T="<"+x,I=k.toLowerCase().indexOf(T);if(I===-1)return!1;const L=k[I+T.length];return L===">"||L===" "||L===" "||L===`
|
|
19
|
+
`||L==="\r"||L==="/"}function h(k){return k.replace(a,d)}function p(k){return k.replace(c,s)}function S(k,x=null,T){const I=[];let L,y=0;const C=k.length;for(;y<C;y++){const P=k[y];switch(P.nodeType){case 1:{const M=g(P.nodeName);L=new l.Element(M,f(P.attributes)),L.children=S(M==="template"?P.content.childNodes:P.childNodes,L);break}case 3:L=new l.Text(p(P.nodeValue??""));break;case 8:L=new l.Comment(P.nodeValue??"");break;default:continue}const K=I[y-1]??null;K&&(K.next=L),L.parent=x,L.prev=K,L.next=null,I.push(L)}return T&&(L=new l.ProcessingInstruction(T.substring(0,T.indexOf(" ")).toLowerCase(),T),L.next=I[0]??null,L.parent=x,I.unshift(L),I[1]&&(I[1].prev=I[0])),I}e.escapeSpecialCharacters=h,e.formatDOM=S,e.hasOpenTag=E})),gu=lo.__commonJSMin((e=>{var i=Ls(),l="html",s="head",a="body",d=/<([a-zA-Z]+[0-9]?)/;function c(k,x){return x?x.createHTML(k):k}var m=(k,x,T)=>{throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},f=(k,x,T)=>{throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},g=typeof window=="object"&&window.DOMParser;if(typeof g=="function"){const k=new g,x="text/html";f=(T,I,L)=>(I&&(T=`<${I}>${T}</${I}>`),k.parseFromString(T,x)),m=f}if(typeof document=="object"&&document.implementation){const k=document.implementation.createHTMLDocument();m=function(x,T,I){if(T){const L=k.documentElement.querySelector(T);return L&&(L.innerHTML=c(x,I)),k}return k.documentElement.innerHTML=c(x,I),k}}var E=typeof document=="object"&&document.createElement("template"),h;E&&E.content&&(h=(k,x)=>(E.innerHTML=c(k,x),E.content.childNodes));var p=()=>document.createDocumentFragment().childNodes;function S(k,x){k=i.escapeSpecialCharacters(k);const T=d.exec(k)?.[1]?.toLowerCase();switch(T){case l:{const I=f(k);if(!i.hasOpenTag(k,s)){const L=I.querySelector(s);L?.parentNode?.removeChild(L)}if(!i.hasOpenTag(k,a)){const L=I.querySelector(a);L?.parentNode?.removeChild(L)}return I.querySelectorAll(l)}case s:case a:{const I=m(k,void 0,x).querySelectorAll(T);return i.hasOpenTag(k,a)&&i.hasOpenTag(k,s)?I[0].parentNode?.childNodes??p():I}default:return h?h(k,x):m(k,a,x).querySelector(a)?.childNodes??p()}}e.default=S})),_u=lo.__commonJSMin((e=>{Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var i=Ls(),l=gu(),s=/<(![a-zA-Z\s]+)>/;function a(d,c){if(typeof d!="string")throw new TypeError("First argument must be a string");if(!d)return[];const m=s.exec(d),f=m?m[1]:void 0;return i.formatDOM(l.default(d,c?.trustedTypePolicy),null,f)}e.default=a})),xu=lo.__commonJSMin((e=>{var i=0;e.SAME=i;var l=1;e.CAMELCASE=l,e.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1}})),ku=lo.__commonJSMin((e=>{var i=0,l=1,s=2,a=3,d=4,c=5,m=6;function f(y){return E.hasOwnProperty(y)?E[y]:null}function g(y,C,P,K,M,$,A){this.acceptsBooleans=C===s||C===a||C===d,this.attributeName=K,this.attributeNamespace=M,this.mustUseProperty=P,this.propertyName=y,this.type=C,this.sanitizeURL=$,this.removeEmptyString=A}var E={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(y=>{E[y]=new g(y,i,!1,y,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([y,C])=>{E[y]=new g(y,l,!1,C,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(y=>{E[y]=new g(y,s,!1,y.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(y=>{E[y]=new g(y,s,!1,y,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(y=>{E[y]=new g(y,a,!1,y.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(y=>{E[y]=new g(y,a,!0,y,null,!1,!1)}),["capture","download"].forEach(y=>{E[y]=new g(y,d,!1,y,null,!1,!1)}),["cols","rows","size","span"].forEach(y=>{E[y]=new g(y,m,!1,y,null,!1,!1)}),["rowSpan","start"].forEach(y=>{E[y]=new g(y,c,!1,y.toLowerCase(),null,!1,!1)});var h=/[\-\:]([a-z])/g,p=y=>y[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(y=>{const C=y.replace(h,p);E[C]=new g(C,l,!1,y,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(y=>{const C=y.replace(h,p);E[C]=new g(C,l,!1,y,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(y=>{const C=y.replace(h,p);E[C]=new g(C,l,!1,y,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(y=>{E[y]=new g(y,l,!1,y.toLowerCase(),null,!1,!1)});var S="xlinkHref";E[S]=new g("xlinkHref",l,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(y=>{E[y]=new g(y,l,!1,y.toLowerCase(),null,!0,!0)});var{CAMELCASE:k,SAME:x,possibleStandardNames:T}=xu(),I=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]*$")),L=Object.keys(T).reduce((y,C)=>{const P=T[C];return P===x?y[C]=C:P===k?y[C.toLowerCase()]=C:y[C]=P,y},{});e.BOOLEAN=a,e.BOOLEANISH_STRING=s,e.NUMERIC=c,e.OVERLOADED_BOOLEAN=d,e.POSITIVE_NUMERIC=m,e.RESERVED=i,e.STRING=l,e.getPropertyInfo=f,e.isCustomAttribute=I,e.possibleStandardNames=L}));function Eu(e,i){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];i=i||{};var l=1,s=1;function a(k){var x=k.match($s);x&&(l+=x.length);var T=k.lastIndexOf(Ws);s=~T?k.length-T:s+k.length}function d(){var k={line:l,column:s};return function(x){return x.position=new c(k),g(),x}}function c(k){this.start=k,this.end={line:l,column:s},this.source=i.source}c.prototype.content=e;function m(k){var x=new Error(i.source+":"+l+":"+s+": "+k);if(x.reason=k,x.filename=i.source,x.line=l,x.column=s,x.source=e,!i.silent)throw x}function f(k){var x=k.exec(e);if(x){var T=x[0];return a(T),e=e.slice(T.length),x}}function g(){f(Fs)}function E(k){var x;for(k=k||[];x=h();)x!==!1&&k.push(x);return k}function h(){var k=d();if(!(ar!=e.charAt(0)||nr!=e.charAt(1))){for(var x=2;Xo!=e.charAt(x)&&(nr!=e.charAt(x)||ar!=e.charAt(x+1));)++x;if(x+=2,Xo===e.charAt(x-1))return m("End of comment missing");var T=e.slice(2,x-2);return s+=2,a(T),e=e.slice(x),s+=2,k({type:zs,comment:T})}}function p(){var k=d(),x=f(Ms);if(x){if(h(),!f(Ds))return m("property missing ':'");var T=f(Vs),I=k({type:Gs,property:Os(x[0].replace(sr,Xo)),value:T?Os(T[0].replace(sr,Xo)):Xo});return f(Hs),I}}function S(){var k=[];E(k);for(var x;x=p();)x!==!1&&(k.push(x),E(k));return k}return g(),S()}function Os(e){return e?e.replace(Us,Xo):Xo}var sr,$s,Fs,Ms,Ds,Vs,Hs,Us,Ws,ar,nr,Xo,zs,Gs,Bu=lo.__esmMin((()=>{sr=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,$s=/\n/g,Fs=/^\s*/,Ms=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Ds=/^:\s*/,Vs=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Hs=/^[;\s]*/,Us=/^\s+|\s+$/g,Ws=`
|
|
20
|
+
`,ar="/",nr="*",Xo="",zs="comment",Gs="declaration"}));function Su(e,i){let l=null;if(!e||typeof e!="string")return l;const s=Eu(e),a=typeof i=="function";return s.forEach(d=>{if(d.type!=="declaration")return;const{property:c,value:m}=d;a?i(c,m,d):m&&(l=l??{},l[c]=m)}),l}var Tu=lo.__esmMin((()=>{Bu()})),Ru=lo.__exportAll({default:()=>yu});function yu(e,i){const l={};return!e||typeof e!="string"||Su(e,(s,a)=>{s&&a&&(l[ea(s,i)]=a)}),l}var Ys,Xs,Ks,qs,Js,Qs,Zs,dr,ea,wu=lo.__esmMin((()=>{Tu(),Ys=/^--[a-zA-Z0-9_-]+$/,Xs=/-([a-z])/g,Ks=/^[^-]+$/,qs=/^-(webkit|moz|ms|o|khtml)-/,Js=/^-(ms)-/,Qs=e=>!e||Ks.test(e)||Ys.test(e),Zs=(e,i)=>i.toUpperCase(),dr=(e,i)=>`${i}-`,ea=(e,i={})=>Qs(e)?e:(e=e.toLowerCase(),i.reactCompat?e=e.replace(Js,dr):e=e.replace(qs,dr),e.replace(Xs,Zs))})),oa=lo.__commonJSMin((e=>{var i=e&&e.__importDefault||function(E){return E&&E.__esModule?E:{default:E}};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=m;var l=go("react"),s=i((wu(),lo.__toCommonJS(Ru))),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(E,h){return E.includes("-")?!a.has(E):!!(h&&typeof h.is=="string")}var c={reactCompat:!0};function m(E,h){if(typeof E=="string"){if(!E.trim()){h.style={};return}try{h.style=(0,s.default)(E,c)}catch{h.style={}}}}e.PRESERVE_CUSTOM_ATTRIBUTES=Number(l.version.split(".")[0])>=16,e.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var f=E=>!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(E.name);e.canTextBeChildOfNode=f;var g=E=>E;e.returnFirstArg=g})),ta=lo.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var i=ku(),l=oa(),s=["checked","value"],a=["input","select","textarea"],d={reset:!0,submit:!0};function c(f={},g){const E={},h=!!(f.type&&d[f.type]);for(const p in f){const S=f[p];if((0,i.isCustomAttribute)(p)){E[p]=S;continue}const k=p.toLowerCase();let x=m(k);if(x){const T=(0,i.getPropertyInfo)(x);switch(s.includes(x)&&a.includes(g)&&!h&&(x=m("default"+k)),E[x]=S,T?.type){case i.BOOLEAN:E[x]=!0;break;case i.OVERLOADED_BOOLEAN:S===""&&(E[x]=!0)}continue}l.PRESERVE_CUSTOM_ATTRIBUTES&&(E[p]=S)}return(0,l.setStyleProp)(f.style,E),E}function m(f){return i.possibleStandardNames[f]}})),ju=lo.__commonJSMin((e=>{var i=e&&e.__importDefault||function(E){return E&&E.__esModule?E:{default:E}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=m;var l=(lr(),lo.__toCommonJS(tr)),s=go("react"),a=i(ta()),d=oa(),c={cloneElement:s.cloneElement,createElement:s.createElement,isValidElement:s.isValidElement};function m(E,h={}){var p,S,k,x,T;const I=[],L=typeof h.replace=="function",y=(p=h.transform)!==null&&p!==void 0?p:d.returnFirstArg,{cloneElement:C,createElement:P,isValidElement:K}=(S=h.library)!==null&&S!==void 0?S:c,M=E.length;f(E);for(let $=0;$<M;$++){const A=E[$];if(L){let te=(k=h.replace)===null||k===void 0?void 0:k.call(h,A,$);if(K(te)){M>1&&(te=C(te,{key:(x=te.key)!==null&&x!==void 0?x:$})),I.push(y(te,A,$));continue}}if(A.type==="text"){const te=!A.data.trim().length;if(te&&A.parent&&!(0,d.canTextBeChildOfNode)(A.parent)||h.trim&&te)continue;I.push(y(A.data,A,$));continue}const W=A;let se={};g(W)?((0,d.setStyleProp)(W.attribs.style,W.attribs),se=W.attribs):W.attribs&&(se=(0,a.default)(W.attribs,W.name));let R;switch(A.type){case"script":case"style":A.children[0]&&(se.dangerouslySetInnerHTML={__html:A.children[0].data});break;case"tag":A.name==="textarea"&&A.children[0]?se.defaultValue=A.children[0].data:!((T=A.children)===null||T===void 0)&&T.length&&(R=m(A.children,h));break;default:continue}M>1&&(se.key=$),I.push(y(P(A.name,se,R),A,$))}return I.length===1?I[0]:I}function f(E){for(const h of E)(h.type==="tag"||h.type==="script"||h.type==="style")&&(Object.setPrototypeOf(h,l.Element.prototype),f(h.children))}function g(E){return d.PRESERVE_CUSTOM_ATTRIBUTES&&E.type==="tag"&&(0,d.isCustomComponent)(E.name,E.attribs)}})),vu=lo.__commonJSMin((e=>{var i=e&&e.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(e,"__esModule",{value:!0}),e.htmlToDOM=e.domToReact=e.attributesToProps=e.Text=e.ProcessingInstruction=e.Element=e.Comment=void 0,e.default=m;var l=i(_u());e.htmlToDOM=l.default;var s=i(ta());e.attributesToProps=s.default;var a=i(ju());e.domToReact=a.default;var d=(lr(),lo.__toCommonJS(tr));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 m(f,g){var E;if(typeof f!="string")throw new TypeError("First argument must be a string");if(!f)return[];const h=Object.assign(Object.assign({},(E=g?.htmlparser2)!==null&&E!==void 0?E:c),{trustedTypePolicy:g?.trustedTypePolicy});return(0,a.default)((0,l.default)(f,h),g)}})),mt=lo.__toESM(vu(),1),Iu=mt.default.default||mt.default,cr=new Set;function Cu(e,i){cr.has(e)||(cr.add(e),Promise.resolve(i()).finally(()=>{cr.delete(e)}))}var Pu={subject:"insert_generated_subject",preheader:"insert_generated_preheader"};function ia(e,i,l){l.document&&(r.writeEmailAttributes(l.document,{[e]:i}),l.pushToDataLayer({event:"submit",action:Pu[e],entity_type:l.entityType,entity_id:l.entityId,project_id:l.projectId,context:"editor"}))}function ur({limitsInPlugin:e,hostedAiActive:i}){return e&&!i}function ra({limitsInPlugin:e,hostedAiActive:i,counter:l,limit:s}){return ur({limitsInPlugin:e,hostedAiActive:i})?s>0&&l>=s:!1}function la(e,i){if(!i||typeof e!="string")return i||e;const l=i.trim();if(!l)return e;if(/^\s*<!DOCTYPE/i.test(l)||/^\s*<\s*html[\s>]/i.test(l))return i;try{const s=new DOMParser().parseFromString(e,"text/html"),a=s.querySelector("editor");if(a){a.innerHTML=i;const d=e.match(/^[\s\uFEFF]*<!DOCTYPE[^>]*>/i);return`${d?`${d[0]}
|
|
21
|
+
`:""}${s.documentElement.outerHTML}`}}catch{}return i}var Au=e=>{const{__:i}=r.useI18n();return[{key:"📧",label:(0,o.jsxs)("div",{onClick:()=>{e("theme-and-preheader-generator")},children:["📧 ",i("Subject line & preheader generator")]})},{key:"🌎",label:(0,o.jsxs)("div",{onClick:()=>{e("translator")},children:["🌎 ",i("Translator")]})},{key:"📄",label:(0,o.jsxs)("div",{onClick:()=>{e("writer")},children:["📄 ",i("Copywriter")]})},{key:"🔎",label:(0,o.jsxs)("div",{onClick:()=>{e("corrector")},children:["🔎 ",i("Proofreader")]})},{key:"🧠",label:(0,o.jsxs)("div",{onClick:()=>{e("psychologist")},children:["🧠 ",i("Psychologist")]})},{key:"📈",label:(0,o.jsxs)("div",{onClick:()=>{e("marketolog")},children:["📈 ",i("Marketer")]})},{key:"✨",label:(0,o.jsxs)("div",{onClick:()=>{e("email-generator")},children:["✨ ",i("Email generator")]})}]},Nu={background:r.emCssVar("colorInfo"),color:"#ffffff"},sa=({messages:e,newEmailAiGeneratorRef:i})=>{const l=r.useElementEntityKind(),{document:s}=r.useDocumentSessionContext(),a=r.useContentReader(),d=r.useUserContentReplacer(),{__:c,_n:m}=r.useI18n(),f=r.useDispatch(),g=r.useAppNavigate(),E=(0,n.useRef)(null),h=r.useAppConfig(),p=r.useEditorLocked(),S=r.useEditorLockCheck(),k=r.useNotification(),x=r.useEditorProjectId(),T=r.useWpEntityId(),I=r.usePushToDataLayer(),L={document:s,pushToDataLayer:I,entityType:l==="block"?"block":"email",entityId:T,projectId:x},y=r.useEventEmitter(fo.events.ON_LIMIT_ID),[C,P]=(0,n.useState)(null),[K,M]=(0,n.useState)(0),[$,A]=(0,n.useState)(!1),[W,se]=(0,n.useState)(""),[R,te]=(0,n.useState)([]),[he,be]=(0,n.useState)(!1),[Ie,xe]=(0,n.useState)(!1),[Be,ke]=(0,n.useState)(null),[ne,He]=(0,n.useState)(0),[Fe,Se]=(0,n.useState)(null),ye=r.useEmailAttribute("subject"),re=r.useEmailAttribute("preheader"),q=r.useCurrentUser(),X=r.toLanguageCode(r.useInterfaceLocale()),Q=q.avatar_url||q.avatar_urls?.[24],Z=[q.first_name,q.last_name].filter(Boolean).join(" ")||q.username,U=r.useMessageService(),[V]=r.useLazyGetDialogQuery(),J=r.useSendPostMessage(),[de,me]=r.useSendMessageMutation(),pe=(0,n.useRef)(new Set),Ae=(0,n.useCallback)(b=>{const H=de(b),ae=pe.current;ae.add(H);const je=()=>ae.delete(H);return H.then(je,je),H},[de]);(0,n.useEffect)(()=>{const b=pe.current;return()=>{b.forEach(H=>H.abort?.()),b.clear()}},[]);const[we,{reset:$e}]=r.useGetAiGenerateStatusMutation(),[Y,{data:le=[]}]=r.useLazyGetGeneratedContentQuery(),[Ce]=r.useLazyGetLimitsStatsByTypeQuery(),G={cursor:$?"not-allowed":"default",pointerEvents:$?"none":"auto"};(0,n.useEffect)(()=>{Fe&&he&&(i.current=!0),he||(i.current=!1)},[Fe,he]);const Te=!!(h.limits&&h.counters)&&!0,{limits:Ne}=h.limits?h:{limits:{ai_limit:0,ai_generator_limit:0}},{ai_limit:Pe,ai_generator_limit:Me}=Ne,Ue=r.useEventEmitter(fo.events.AI_TEXT_REQUEST_ID).hasListeners(),ze=ur({limitsInPlugin:Te,hostedAiActive:Ue}),ce=ra({limitsInPlugin:Te,hostedAiActive:Ue,counter:K,limit:Pe}),fe=ra({limitsInPlugin:Te,hostedAiActive:Ue,counter:ne,limit:Me}),v=(0,n.useCallback)(()=>{y.fire({name:"AiChatCount",count:K+1})},[y,K]),ie=(0,n.useCallback)(()=>{y.fire({name:"AiGeneratorCount",count:ne+1})},[y,ne]),Re=(0,n.useCallback)(async b=>!0,[c,Ce,k]);(0,n.useEffect)(()=>{Te&&(M(h?.counters?.ai_counter||0),He(h?.counters?.ai_generator_counter||0))},[h,Te]),(0,n.useEffect)(()=>{Se(R.length<=0?!1:R.toReversed().find(H=>H.data?.context)?.data.context==="email-generator")},[R]);const Oe=(0,n.useCallback)(async()=>await U.sendAsync(r.EVENT_TYPES.SANDBOX_IS_EMAIL_EMPTY),[U]),De=(0,n.useCallback)(()=>{const b=E.current?.closest(".ant-tabs-content.ant-tabs-content-top");setTimeout(()=>{b?.scrollTo({top:b.scrollHeight,behavior:"smooth"})},0)},[E]),Ge=(0,n.useCallback)(()=>{r.swallowPromiseRejection(V({entity_id:T}).then(b=>{te(b.data.documents),De()}))},[T,V,te,De]),Qe=(0,n.useCallback)(b=>{if(!b?.data?._eventResult)return!1;const{aiMessage:H,aiHtml:ae}=b.data;if(te(je=>{const Ee=[...je];for(let Je=Ee.length-1;Je>=0;Je--)if(Ee[Je]?.data?.isLoading&&Ee[Je]?.data?.role==="assistant"){Ee[Je]={data:{role:"assistant",message:H,isLoading:!1}};break}return Ee}),ae){const je=la(a(),String(ae));d(je,{undoable:!0})}return De(),!0},[a,d,De]),O=(0,n.useCallback)(b=>{te(H=>{for(let ae=H.length-1;ae>=0;ae--)if(H[ae]?.data?.isLoading&&H[ae]?.data?.role==="assistant"){const je=[...H];return b?je[ae]={data:{role:"assistant",message:b}}:je.splice(ae,1),je}return H})},[]),oe=(0,n.useCallback)(b=>{const H=b?.message==="ERROR"?void 0:b?.message;return[b?.data?.message,H].find(ae=>typeof ae=="string"&&ae)||c("Something went wrong.")},[c]),j=s?.get().docId,w=r.useEventEmitter(fo.events.AI_TEXT_PROGRESS_ID);(0,n.useEffect)(()=>{const b=w.event(({progress:H,status:ae,docId:je})=>{if(je!==j)return;const Ee=ae||`${Math.round(H)}%`;te(Je=>{const no=[...Je];for(let wo=no.length-1;wo>=0;wo--)if(no[wo]?.data?.isLoading&&no[wo]?.data?.role==="assistant"){no[wo]={data:{...no[wo].data,message:Ee}};break}return no})});return()=>b.dispose()},[w,j]);const ue=r.useEventEmitter(fo.events.AI_TEXT_STREAM_ID);(0,n.useEffect)(()=>{const b=ue.event(({partialHtml:H,docId:ae})=>{if(ae!==j)return;const je=la(a(),String(H));d(je,{undoable:!0})});return()=>b.dispose()},[ue,a,d,f,j]);const ve=(0,n.useCallback)(b=>{be(!0),A(!0),r.swallowPromiseRejection(we({task_id:b||C,entity_id:T,status:"started"}).then(()=>{Ge()}))},[T,we,C,Ge]),Xe=(0,n.useCallback)(()=>{we({task_id:C,entity_id:T,status:"completed"}).then(b=>{b.data.status===403&&$e(),Ge()}).catch(b=>{}),A(!1),be(!1)},[T,we,C,Ge,$e]);(0,n.useEffect)(()=>{let b;if(he){const H=le[le.length-1]?.processing?.email;if(H){let ae=le[le.length-1].status;d(String(H),{undoable:!0}),ae===0&&Xe()}Be&&(clearInterval(b),be(!1),ke(!1),A(!1),O())}return()=>{clearInterval(b)}},[d,Be,f,le,he,ye,re,T,C,Ge,we,me,Xe,O]),(0,n.useEffect)(De,[De]),(0,n.useEffect)(()=>{e?.length>0&&te(e),J({operation:r.EVENT_TYPES.SANDBOX_EMAIL_CONTENT_GET})},[e,J]),(0,n.useEffect)(()=>{const b=U.onInit(()=>{U.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:$}),U.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_DISCUSS,value:$})});return()=>b.dispose()},[$,U]);const Ke=async()=>{if(W&&!S()){const b=W.replaceAll(/\n/g,"<br>"),H={project_id:x,connection:"chat",entity_id:T,message:b,locale:X,subject:ye||"",preheader:re||"",textContent:di.extractDocumentTextContent(a())};if(Fe&&fe||ce){k.error({title:c(Fe?"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 ae={data:{role:"assistant",message:c(Fe?"You have reached the limit of AI generator usage.":"You have reached the limit of AI chat usage.")}};te(je=>[...je,ae])}else{if(!await Re(Fe?"email_generate":"ai")){se("");return}ze&&(Fe&&ne!==Me?(ie(),He(je=>je+1)):K!==Pe&&(v(),M(je=>je+1))),I({event:"submit_form",action:"chat_whit_ai_assistant",entity_id:H.entity_id,project_id:H.project_id});const ae=[{data:{role:"user",message:b,userInfo:{display_name:Z,avatar_url:Q}}},{data:{role:"assistant",message:c("Typing..."),isLoading:!0}}];te(je=>[...je,...ae]),Ae({body:H}).then(je=>{if(je?.error)throw je.error;if(!je?.data||je.data.status===401)throw new Error(r.ERROR);if(!Qe(je)){if(I({event:"submit",action:"send_discussion_chat_message",entity_type:l==="block"?"block":"email",entity_id:T,project_id:x,context:"editor"}),je.data.task_id){let Ee=je.data.task_id;P(Ee),Y({id:Ee,setError:ke}),r.swallowPromiseRejection(Oe().then(Je=>{Je?ve(Ee):xe(!0)}))}Ge()}}).catch(je=>{const Ee=oe(je);k.error({title:je?.data?.code||c("Error"),description:Ee}),O(Ee)})}se("")}},to=async b=>{if(S())return;const H={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};te(je=>[...je,H]);const ae={project_id:x,connection:"chat",entity_id:T,context:b,locale:X,subject:ye||"",preheader:re||"",textContent:di.extractDocumentTextContent(a())};if(ze&&(Fe&&ne!==Me?(ie(),He(je=>je+1)):K!==Pe&&(v(),M(je=>je+1))),ce)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 Re("ai")){O();return}I({event:"select",action:"select_ai_assistant_role",context:ae.context,entity_id:ae.entity_id,project_id:ae.project_id}),Ae({body:ae}).then(je=>{if(je?.error)throw je.error;if(!je?.data||je.data.status===401)throw new Error(r.ERROR);Qe(je)||Ge()}).catch(je=>{const Ee=oe(je);k.error({title:je?.data?.code||c("Error"),description:Ee}),O(Ee)})}},io=(0,n.useCallback)(async b=>{const H={data:{role:"user",message:b,userInfo:{display_name:Z,avatar_url:Q}}},ae={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};te(Ee=>[...Ee,H,ae]);const je={project_id:x,connection:"chat",entity_id:T,message:b,locale:X,subject:ye||"",preheader:re||"",textContent:di.extractDocumentTextContent(a())};if(fe)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 Re(Fe?"email_generate":"ai")){O();return}Ae({body:je}).then(Ee=>{if(Ee?.error)throw Ee.error;if(!Ee?.data||Ee.data.status===401)throw new Error(r.ERROR);if(!Qe(Ee)){if(I({event:"submit",action:"send_discussion_chat_message",entity_type:l==="block"?"block":"email",entity_id:T,project_id:x,context:"editor"}),Ee.data.task_id){let Je=Ee.data.task_id;P(Je),Y({id:Je,setError:ke}),r.swallowPromiseRejection(Oe().then(no=>{no?ve(Je):xe(!0)}))}ze&&(Fe&&ne!==Me?(ie(),He(Je=>Je+1)):K!==Pe&&(v(),M(Je=>Je+1))),Ge()}}).catch(Ee=>{const Je=oe(Ee);k.error({title:Ee?.data?.code||c("Error"),description:Je}),O(Je)})}},[c,K,ne,Q,Oe,O,ve,oe,Z,Pe,Me,q,ye,re,T,Fe,fe,X,v,ie,ze,a,k,Re,x,Ae,Y,Ge]);(0,n.useEffect)(()=>{const b=new fo.Disposable,H=window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings);if((!e?.length||e.length===1&&e[0]?.data?.role==="assistant")&&H&&T&&!p){const ae={project_id:x,connection:"chat",entity_id:T,context:"email-generator",locale:X};Cu(`discuss-ai-generator-context:${T}`,()=>{if(Ue){window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),io(H);return}r.swallowPromiseRejection(de({body:ae}).then(()=>{window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),b.isDisposed()||io(H)}))})}return()=>b.dispose()},[e,io,T,X,x,de,Ue,p]);const co=b=>{typeof b.target.className=="string"&&b.target.className.includes("ai-response-change-context")&&(me.isLoading||to(b.target.role))},Eo=b=>{if(S())return;const H=b.children[0].data??"";ia("subject",H,L),k.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Title copied to email settings"),data:H})},xo=b=>{if(S())return;const H=b.children[0].data??"";ia("preheader",H,L),k.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Preheader copied to email settings"),data:H,duration:300})},D=b=>{const H=b.children[0].data;navigator.clipboard.writeText(H).then(()=>{k.success({id:"TEXT_COPIED_TO_CLIPBOARD",title:c("Text copied to clipboard"),data:H})}).catch(ae=>{})},ee={replace:b=>{if(b.attribs?.class?.split(" ").includes("ai-response-title"))return(0,o.jsx)(t.ui_kit$Tooltip,{placement:"left",title:c("Replace the title"),children:(0,o.jsx)("div",{onClick:()=>Eo(b),children:(0,o.jsx)("span",{className:"ai-response-title",children:(0,mt.domToReact)(b.children,ee)})})});if(b.attribs?.class?.split(" ").includes("ai-response-preheader"))return(0,o.jsx)(t.ui_kit$Tooltip,{placement:"left",title:c("Replace the preheader"),children:(0,o.jsx)("div",{onClick:()=>xo(b),children:(0,o.jsx)("span",{className:"ai-response-preheader",children:(0,mt.domToReact)(b.children,ee)})})});if(b.attribs?.class?.split(" ").includes("ai-response-copy"))return(0,o.jsx)(t.ui_kit$Tooltip,{placement:"left",title:c("Copy to clipboard"),children:(0,o.jsx)("div",{onClick:()=>D(b),children:(0,o.jsx)("span",{className:"ai-response-copy",children:(0,mt.domToReact)(b.children,ee)})})});if(b.attribs?.class?.split(" ").includes("ai-response-user-message")){const H=b.attribs?.data||b.children?.[0]?.data;return(0,o.jsx)("li",{className:b.attribs?.class,data:b.attribs?.data,onClick:()=>io(H),children:(0,mt.domToReact)(b.children,ee)})}}},B=()=>{ve(),xe(!1)},F=()=>{Xe(),xe(!1)};return(0,o.jsxs)("div",{ref:E,className:"discuss-main",children:[R.length>0&&(0,o.jsx)(t.ui_kit$List,{onClick:co,className:"comment-list",itemLayout:"horizontal",dataSource:R,renderItem:b=>(0,o.jsx)("li",{id:b._id,children:(0,o.jsx)(t.ui_kit$Comment,{className:b.data.userInfo?"":"ai-comment",avatar:b.data.role==="assistant"?(0,o.jsx)(r.EmIcons,{icon:"ChatGpt",component:t.icons$ChatGpt,className:"anticon-robot",style:{color:"#ffffff",fontSize:16,width:24,height:24,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"}}):b.data.userInfo&&b.data._modified?b.data.userInfo.avatar_url:Q||(0,o.jsx)(r.EmIcons,{icon:"UserOutlined",component:t.icons$UserOutlined,className:"anticon-user",style:{color:"#ffffff",fontSize:16,width:24,height:24,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"}}),author:(0,o.jsx)("div",{style:G,children:b?.data?.role==="user"?q?.username||c("User"):c("AI Assistant")}),datetime:b._created?(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:r.formatDate(r.parseISO(b._created),m,!0)}}):null,content:b.data.isLoading?(0,o.jsx)("div",{className:"spin",children:(0,o.jsx)(r.EmIcons,{icon:"LoadingOutlined",component:t.icons$LoadingOutlined,style:{fontSize:24},spin:!0})}):(0,o.jsx)("div",{style:G,children:Iu(b.data.message,ee)})})},b._id)}),Te&&(Fe?(0,o.jsx)(t.ui_kit$LimitsCounter,{text:`${ne} ${c("of")} ${Me>0?Me:"∞"} ${c("mail generator")} ${m("was used","were used",ne)}`,exceeded:Me>0&&ne>=Me,style:{marginTop:-25},extra:(0,o.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>g(h.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})}):(0,o.jsx)(t.ui_kit$LimitsCounter,{text:`${K} ${c("of")} ${Pe>0?Pe:"∞"} ${c("messeges")} ${m("was used","were used",K)}`,exceeded:Pe>0&&K>=Pe,style:{marginTop:-25},extra:(0,o.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>g(h.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})})),(0,o.jsxs)(t.ui_kit$Form,{onFinish:Ke,className:"addMode",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{disabled:$||p,value:W,onChange:b=>se(b.target.value),rows:4,placeholder:c("Type your request"),className:"textarea-comment",onPressEnter:b=>b.key==="Enter"&&b.ctrlKey&&Ke(),spellCheck:"false"})}),(0,o.jsx)(t.ui_kit$Form.Item,{children:(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Button,{disabled:me.isLoading||$||p,type:"default",style:Nu,className:"button-target",children:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"top",disabled:$,arrow:{pointAtCenter:!0},menu:{items:Au(to)},children:(0,o.jsxs)("div",{disabled:$,style:{margin:0,padding:0,color:"#ffffff",display:"inline-flex",alignItems:"center"},children:[(0,o.jsx)(r.EmIcons,{icon:"ChatGpt",component:t.icons$ChatGpt,style:{marginRight:5}}),c("Role")]})},"Export")}),(0,o.jsxs)(t.ui_kit$Button,{disabled:me.isLoading||$||p,className:"button-add",type:"primary",htmlType:"submit",children:[c("Send")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:h.iconStrokeWidth})]})]})})]}),(0,o.jsx)(t.ui_kit$Modal,{title:c("Warning"),open:Ie,onOk:B,onCancel:F,children:(0,o.jsx)("p",{children:c("The current template will be changed to the generated one, are you sure about this?")})})]})},Lu=[r.VALID,r.ERRORS,r.WARNINGS],aa=({summary:e,__:i,selectedTags:l,setSelectedTags:s})=>{const a=(0,n.useCallback)((c,m)=>{s(m?l.length===2?[]:[...l,c]:l.filter(f=>f!==c))},[l,s]),d=(0,n.useCallback)(c=>i(c==="valid"?"Valid":c==="warnings"?"Warnings":"Errors"),[i]);return(0,o.jsx)(t.ui_kit$Title,{level:5,className:"optimise__valid-title",children:(0,o.jsx)(t.ui_kit$Space,{className:"optimise__valid-title-space",size:8,children:Lu.map((c,m)=>(0,o.jsxs)(t.ui_kit$CheckableTag,{checked:l?.includes(c),onChange:f=>a(c,f),className:(0,We.default)(`${c} optimise__button`,{[`${c}_active`]:l.includes(c)}),children:[d(c),": ",e?.[c]||0]},c+m))})})},{LINKS:Ou}=r.OPTIMISE_TABS,na=(0,n.memo)(({__:e,activeTab:i,validateLinksResult:l,validateLinks:s,selectedTags:a,setSelectedTags:d,isLoading:c,disabled:m,iconStrokeWidth:f,onValidate:g,goToLinkHandler:E})=>i!==Ou||!l?.links?null:l.links.length===0?(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,o.jsx)(t.ui_kit$Alert,{title:e("No links found."),type:"info"})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-14",children:(0,o.jsxs)("div",{className:"optimise__title-wrapper",children:[(0,o.jsx)(aa,{__:e,summary:l.summary,setSelectedTags:d,selectedTags:a}),(0,o.jsx)(t.ui_kit$Button,{disabled:m,loading:c,onClick:g,icon:(0,o.jsx)(r.EmIcons,{icon:"SyncOutlined",component:t.icons$SyncOutlined,size:16,strokeWidth:f}),children:e("Refresh")})]})}),(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$List,{itemLayout:"horizontal",dataSource:s,renderItem:(h,p)=>(0,o.jsx)(t.ui_kit$List.Item,{className:t.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{avatar:h.status==="valid"?(0,o.jsx)(r.EmIcons,{icon:"CheckCircleFilled",component:t.icons$CheckCircleFilled,className:r.VALID}):h.status==="warnings"?(0,o.jsx)(r.EmIcons,{icon:"CheckCircleFilled",component:t.icons$CheckCircleFilled,className:r.WARNINGS}):(0,o.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:t.icons$CloseCircleFilled,className:r.ERRORS}),title:(0,o.jsx)(t.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>E(h.linkId,600>(h.statusCode||0)&&(h.statusCode||0)>399||!h.statusCode),children:h.url===""?e("empty link"):h.url}),description:(0,o.jsxs)(o.Fragment,{children:[!!h.text?.length&&(0,o.jsx)(t.ui_kit$Text,{type:"secondary",children:h.text}),h.page?.title&&h.page.title,h.page?.secure&&h.status==="valid"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)("span",{className:"valid",children:e("secure")})]}),!h.resolvedUrl&&!h.statusCode&&h.type==="url"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)(t.ui_kit$Text,{type:"secondary",children:e("Failed to load")})]})]})})},p+"_"+h.linkId)})})})]}));na.displayName="LinksSection";var{IMAGES:$u}=r.OPTIMISE_TABS,da=(0,n.memo)(({__:e,activeTab:i,validateImagesResult:l,validateImages:s,selectedTags:a,setSelectedTags:d,isLoading:c,disabled:m,iconStrokeWidth:f,onValidate:g,goToImageHandler:E,showImgPreviewHandler:h,hideBlockPreviewHandler:p})=>i!==$u||!l?.images?null:l.images.length===0?(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,o.jsx)(t.ui_kit$Alert,{title:e("No images found."),type:"info"})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-16",children:(0,o.jsx)(t.ui_kit$Alert,{className:"optimise__alert-custom",title:(0,o.jsxs)("div",{className:"optimise__summary",children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)(t.ui_kit$Title,{level:4,className:"optimise__summary-title",children:[l.images.length," "]}),(0,o.jsx)("span",{className:"optimise__summary-label",children:e("images")})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)(t.ui_kit$Title,{level:4,className:"optimise__summary-title",children:[l.summaryTime?.value,l.summaryTime?.name]}),(0,o.jsx)("span",{className:"optimise__summary-label",children:e("total size")})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)(t.ui_kit$Title,{level:4,className:"optimise__summary-title",children:(Math.max(...l.images.map(S=>S.image.responseTime))/1e3).toFixed(2)+e("s")}),(0,o.jsx)("span",{className:"optimise__summary-label",children:e("time to load")})]})]}),type:"warning"})}),(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-12",children:(0,o.jsxs)("div",{className:"optimise__title-wrapper",children:[(0,o.jsx)(aa,{__:e,summary:l.summary,setSelectedTags:d,selectedTags:a}),(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"SyncOutlined",component:t.icons$SyncOutlined,size:16,strokeWidth:f}),disabled:m,loading:c,onClick:g,children:e("Refresh")})]})}),(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-12",children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$List,{className:"optimise__result-list",itemLayout:"horizontal",dataSource:s,renderItem:(S,k)=>(0,o.jsx)(t.ui_kit$List.Item,{className:`optimise__image-item image-item ${t.ui_kit$LIST_ITEM_BORDERLESS_CLASS}`,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{className:(0,We.default)("image-item__meta",{"image-item__meta_fail":!S.resolvedUrl&&!S.statusCode}),avatar:(0,o.jsx)(t.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:()=>p()}),title:S.url?(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:S.message,children:(0,o.jsx)(t.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>E(S.imageId,600>(S.statusCode||0)&&(S.statusCode||0)>399||!S.statusCode),children:S?.url===""?e("empty src"):S.url})}):S.message,description:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"image-size",children:[S.image.dimensions&&(0,o.jsxs)(o.Fragment,{children:[S.image.dimensions.width+" × "+S.image.dimensions.height,(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsxs)("span",{children:[Math.round(S.image.bytes/1024),e("kB")]}),(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsxs)("span",{children:[S.image.responseTime,e("ms")]}),(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)("span",{className:"image-size-format",children:$t(S.image.contentType)})]}),S.image.secure&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)("span",{className:"valid",children:e("secure")})]}),S.resolvedUrl&&!S.valid&&(0,o.jsx)(t.ui_kit$Text,{type:"danger",children:e("not valid")})]}),!S.resolvedUrl&&!S.statusCode&&(0,o.jsx)(t.ui_kit$Text,{type:"danger",children:e("Failed to load")})]})})},k)})})})]}));da.displayName="ImagesSection";var{SPAM_ASSASSIN:Fu}=r.OPTIMISE_TABS,ca=(0,n.memo)(({__:e,activeTab:i,validateSpamResult:l,isLoading:s,disabled:a,iconStrokeWidth:d,onValidate:c})=>{const m=l?.report?.length||Object.prototype.hasOwnProperty.call(l,"spamScore");if(i!==Fu||!m)return null;const f=l.spamScore||0,g=l.baseSpamScore||0,E=f<2||!l.spamScore||f<=g-1?"success":f<g-1?"warning":"danger";return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{className:"optimise__row-mb-8",children:[(0,o.jsxs)("div",{className:"optimise__title-wrapper optimise__title-wrapper_spam",children:[(0,o.jsxs)(t.ui_kit$Title,{level:1,className:"optimise__spam-score-title",type:E,children:[(0,o.jsx)("span",{className:"optimise__spam-score-value",children:f}),(0,o.jsx)(t.ui_kit$Text,{className:"optimise__spam-score-text",children:"Score"})]}),(0,o.jsx)(t.ui_kit$Button,{disabled:a,icon:(0,o.jsx)(r.EmIcons,{icon:"SyncOutlined",component:t.icons$SyncOutlined,size:16,strokeWidth:d}),loading:s,onClick:c,children:e("Refresh")})]}),f>g-1&&(0,o.jsx)(t.ui_kit$Text,{children:e("Lower scores are better. Aim for a score less than ")+(g-1)+"."})]}),(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-8",children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(l.report?.length||0)>0?(0,o.jsx)(t.ui_kit$List,{itemLayout:"horizontal",dataSource:l.report,renderItem:h=>(0,o.jsx)(t.ui_kit$List.Item,{className:t.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{title:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Text,{className:"optimise__spam-report-score",children:h.score}),(0,o.jsx)("span",{className:"optimise__spam-report-description",children:h.description})]})})})}):(0,o.jsx)(o.Fragment,{children:l.spamScore===0&&e("Your email doesn't look like spam.")})})})]})});ca.displayName="SpamSection";var{PROBLEMS:Mu}=r.OPTIMISE_TABS,ua=(0,n.memo)(({__:e,activeTab:i,problemsList:l,onSetMonacoPosition:s})=>i!==Mu?null:l?.length?(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-8",children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$List,{itemLayout:"horizontal",dataSource:l,renderItem:a=>(0,o.jsx)(t.ui_kit$List.Item,{className:t.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{avatar:a.severity<6?(0,o.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:t.icons$CloseCircleFilled,className:r.WARNINGS}):(0,o.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:t.icons$CloseCircleFilled,className:r.ERRORS}),title:(0,o.jsxs)(t.ui_kit$Text,{onClick:()=>s(a),className:(0,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,o.jsx)(t.ui_kit$Text,{children:a.message})})})})})}):(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,o.jsx)(t.ui_kit$Alert,{title:e("No problems found."),type:"info"})}));ua.displayName="ProblemsSection";var Du={activeTab:"",selectedTags:[],validateLinks:[],validateImages:[],validateSpamResult:{},optimisationCounter:0,linkCheckCounter:0,imageCheckCounter:0,spamCheckCounter:0,validateLinksResult:{},validateImagesResult:{}},Vu=(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}},li={link_check:"link_check_counter",image_check:"image_check_counter",spam_check:"spam_check_counter"},mr={link_check:"link_check_limit",image_check:"image_check_limit",spam_check:"spam_check_limit"},Hu=(e,i)=>{const l=Object.values(li),s=Object.values(mr);return l.some(a=>e?.[a]!==void 0)||s.some(a=>i?.[a]!==void 0)||l.some(a=>i?.[a]!==void 0)||s.some(a=>e?.[a]!==void 0)},pt=(e,i,l=0)=>{const s=e?.[i];return typeof s=="number"&&!Number.isNaN(s)?s:l},Uu=(e,i)=>({counter:e,limit:i,disabled:i>0&&e>=i}),Wu=({appConfig:e,data:i,isSuccess:l,optimisationCounter:s,linkCheckCounter:a,imageCheckCounter:d,spamCheckCounter:c,setOptimisationCounter:m,setLinkCheckCounter:f,setImageCheckCounter:g,setSpamCheckCounter:E})=>{const h=(0,n.useMemo)(()=>!!(e.limits&&e.counters)&&!0,[e]),p=(0,n.useMemo)(()=>e.counters,[e,i]),S=(0,n.useMemo)(()=>e.limits,[e,i]),k=(0,n.useMemo)(()=>h&&Hu(p,S),[h,p,S]),x=(0,n.useMemo)(()=>pt(S,"optimization_limit",0),[S]),T=(0,n.useMemo)(()=>!k&&s>=x&&x>0,[k,s,x]),I=(0,n.useMemo)(()=>{const y={link_check:a,image_check:d,spam_check:c};return Object.keys(mr).reduce((C,P)=>{const K=mr[P],M=k?pt(S,K,0):x,$=k?y[P]:s;return C[P]=Uu($,M),C},{})},[k,S,x,a,d,c,s]),L=y=>k?I[y].disabled:T;return(0,n.useEffect)(()=>{if(!h){const y=i?.counters;l&&y?.optimization_counter&&m(y.optimization_counter);return}m(pt(p,"optimization_counter",0)),k&&(f(pt(p,li.link_check,0)),g(pt(p,li.image_check,0)),E(pt(p,li.spam_check,0)))},[h,k,i,l,p,m,f,g,E]),{limitsInPlugin:h,perTypeAvailable:k,currentBillingOptimisationLimits:x,disableFields:T,typeLimits:I,isTypeDisabled:L}},zu=()=>{const e=(0,n.useRef)(null);return{showImgPreviewHandler:(0,n.useCallback)((i,l)=>{e.current&&clearTimeout(e.current);let s=document.querySelector(".img-preview"),a=document.querySelector(".img-preview-content");document.querySelector(".img-preview")||(s=document.createElement("div"),s.classList.add("img-preview"),a=document.createElement("div"),a.classList.add("img-preview-content"),s.append(a),document.querySelector(".email-pane__col_settings-inner")?.append(s)),a&&(a.innerHTML=`<table cellspacing="0" cellpadding="0" border="0" width="100%"><img height="auto" width=${(l||0)+"px"} alt="" style="max-width: 100%; object-fit: contain" src=${i}></table>`),s&&s.style.opacity!=="1"&&setTimeout(()=>{s&&(s.style.opacity="1",s.style.transform="translateX(-100%)")},10)},[]),hideBlockPreviewHandler:(0,n.useCallback)(()=>{const i=document.querySelector(".img-preview");i&&(e.current=setTimeout(()=>{i&&(i.style.opacity="0",i.style.transform="translateX(-99%)",setTimeout(()=>{i?.remove()},300))},300))},[])}},{LINKS:Gu,IMAGES:Yu}=r.OPTIMISE_TABS,Xu=({activeTab:e,selectedTags:i,validateLinksResult:l,validateImagesResult:s,setValidateLinks:a,setValidateImages:d})=>{(0,n.useEffect)(()=>{e===Gu&&l.links&&a(i.length>0?l.links.filter(c=>i.includes(c.status)):l.links),e===Yu&&s.images&&d(i.length>0?s.images.filter(c=>i.includes(c.status)):s.images)},[l.links,s.images,i,e,a,d])},Ku=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,ma=e=>e.statusCode!==null&&e.statusCode<300?r.VALID:e.statusCode<400&&e.statusCode>=300||e.statusCode===200&&!e.valid?r.WARNINGS:r.ERRORS,pa=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}),qu={ai:(0,o.jsx)(r.EmIcons,{icon:"AIRequests",component:t.icons$AIRequests}),email_generate:(0,o.jsx)(r.EmIcons,{icon:"EmailEnvelope",component:t.icons$EmailEnvelope}),image_generate:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image}),optimization:(0,o.jsx)(r.EmIcons,{icon:"Optimization",component:t.icons$Optimization}),preview:(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined}),test_sends:(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined}),link_check:(0,o.jsx)(r.EmIcons,{icon:"Web",component:t.icons$Web}),image_check:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image}),spam_check:(0,o.jsx)(r.EmIcons,{icon:"Block",component:t.icons$Block}),projects:(0,o.jsx)(r.EmIcons,{icon:"FolderOpen",component:t.icons$FolderOpen}),emails:(0,o.jsx)(r.EmIcons,{icon:"EmailEnvelope",component:t.icons$EmailEnvelope}),blocks:(0,o.jsx)(r.EmIcons,{icon:"Block",component:t.icons$Block}),users:(0,o.jsx)(r.EmIcons,{icon:"SliderGroup",component:t.icons$SliderGroup})};function ha(e,i){if(e==null)return null;if(typeof e=="number"||typeof e=="string"){const l=e==="∞"||typeof e=="string"&&e.toLowerCase()==="infinity";return(0,o.jsx)("span",{className:i==="old"?"limit-upgrade-modal__limit-old":`limit-upgrade-modal__limit-new${l?" limit-upgrade-modal__limit-new--infinity":""}`,children:l?"∞":e})}return e}var si=({open:e,onClose:i,title:l,subtitle:s,usageResource:a,icon:d,previousDisplay:c,nextDisplay:m,onChangePlan:f,secondaryAction:g,changePlanLabel:E})=>{const{__:h}=r.useI18n(),p=E??h("Change plan"),S=!!g,k=a!=null?qu[a]:d??null;return(0,o.jsx)(t.ui_kit$Modal,{open:e,onCancel:i,footer:null,closable:!1,width:400,centered:!0,className:"limit-upgrade-modal",destroyOnHidden:!0,mask:{closable:!0},children:(0,o.jsxs)("div",{className:"limit-upgrade-modal__wrap",children:[(0,o.jsx)("div",{className:"limit-upgrade-modal__header",children:(0,o.jsx)("button",{type:"button",className:"limit-upgrade-modal__close",onClick:i,"aria-label":h("Close"),children:(0,o.jsx)(r.EmIcons,{icon:"CloseOutlined",component:t.icons$CloseOutlined})})}),(0,o.jsxs)("div",{className:"limit-upgrade-modal__body",children:[(0,o.jsx)("h1",{className:"limit-upgrade-modal__title",children:l}),(0,o.jsx)("p",{className:"limit-upgrade-modal__subtitle",children:s}),(0,o.jsxs)("div",{className:"limit-upgrade-modal__limits-row",children:[(0,o.jsx)("div",{className:"limit-upgrade-modal__icon-circle","aria-hidden":!0,children:k}),ha(c,"old"),(0,o.jsx)("div",{className:"limit-upgrade-modal__arrow-btn","aria-hidden":!0,children:(0,o.jsx)(r.EmIcons,{icon:"ArrowUpOutlined",component:t.icons$ArrowUpOutlined,className:"limit-upgrade-modal__arrow-icon"})}),ha(m,"new")]})]}),(0,o.jsx)("hr",{className:"limit-upgrade-modal__divider"}),(0,o.jsx)("div",{className:S?"limit-upgrade-modal__footer limit-upgrade-modal__footer--dual":"limit-upgrade-modal__footer",children:g?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Button,{className:"limit-upgrade-modal__cta-secondary",onClick:g.onClick,children:g.label}),(0,o.jsx)(t.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:f,children:p})]}):(0,o.jsx)(t.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:f,children:p})})]})})},{LINKS:pr,IMAGES:hr,SPAM_ASSASSIN:ba,PROBLEMS:br}=r.OPTIMISE_TABS,fa={textDecoration:"underline",cursor:"pointer",background:"none",border:"none",padding:0,font:"inherit",color:"inherit"},Ju={link_check:"LinkCheckCount",image_check:"ImageCheckCount",spam_check:"SpamCheckCount"},Qu={link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"},ga=(e,i,l,s)=>`${e} ${l("of")} ${i>0?i:"∞"} ${s("test","tests",i>0?i:e)} ${s("was used","were used",e)}`,_a=()=>{const{__:e,_n:i}=r.useI18n(),l=r.useDispatch(),s=r.useOpenPlanCatalog(),a=r.useAppNavigate(),d=r.useNotification(),c=r.useContentReader(),m=r.useAppConfig(),f=r.useEditorProjectId(),g=r.useRouteEmailId(),{document:E}=r.useDocumentSessionContext(),h=r.useEmailOfDocument(E,void 0),p=g||(h?.id!=null?String(h.id):void 0),S=p||h?.renderGuid,k=f||(h?.project!=null?String(h.project):void 0),[x,T]=(0,n.useState)(null),I=(0,n.useRef)(!1),L=(0,n.useRef)({link_check:!1,image_check:!1,spam_check:!1}),y=r.useProjectPlanLimitPreflight(),C=(0,n.useCallback)(v=>{T(v)},[]),P=(0,n.useCallback)((v,ie)=>v?.status===401&&v?.data?.code==="usage_limit_exceeded"?(C({presetId:{link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"}[ie],previousDisplay:e("—"),nextDisplay:r.presetLimitDisplay("infinity")}),l(r.limitsApi.util.invalidateTags(["LimitsStats","LimitsWarnings"])),!0):!1,[l,e,C]),K=(0,n.useCallback)((v,ie)=>{P(v,ie)||d.error({error:v})},[P,d]),M=(0,n.useCallback)(async v=>!0,[l,y,C]),$=r.useMessageService(),A=r.useSelector(r.selectProblemsList),W=r.useEventEmitter(fo.events.ON_LIMIT_ID),se=r.usePushToDataLayer(),[R,te]=(0,n.useReducer)(Vu,Du),[he,be]=r.useEditSpamMutation(),[Ie,xe]=r.useEditLinksMutation(),[Be,ke]=r.useEditImagesMutation(),{data:ne,isSuccess:He}=r.useGetProjectQuery(+(k||0),{skip:!0}),Fe=r.useInvalidateProject(),Se=(0,n.useCallback)(v=>te({type:"SET_OPTIMISATION_COUNTER",payload:v}),[]),ye=(0,n.useCallback)(v=>te({type:"SET_LINK_CHECK_COUNTER",payload:v}),[]),re=(0,n.useCallback)(v=>te({type:"SET_IMAGE_CHECK_COUNTER",payload:v}),[]),q=(0,n.useCallback)(v=>te({type:"SET_SPAM_CHECK_COUNTER",payload:v}),[]),X=(0,n.useCallback)(v=>te({type:"SET_VALIDATE_LINKS",payload:v}),[]),Q=(0,n.useCallback)(v=>te({type:"SET_VALIDATE_IMAGES",payload:v}),[]),Z=(0,n.useCallback)(v=>te({type:"SET_SELECTED_TAGS",payload:v}),[]),{limitsInPlugin:U,perTypeAvailable:V,currentBillingOptimisationLimits:J,disableFields:de,typeLimits:me,isTypeDisabled:pe}=Wu({appConfig:m,data:ne,isSuccess:He,optimisationCounter:R.optimisationCounter,linkCheckCounter:R.linkCheckCounter,imageCheckCounter:R.imageCheckCounter,spamCheckCounter:R.spamCheckCounter,setOptimisationCounter:Se,setLinkCheckCounter:ye,setImageCheckCounter:re,setSpamCheckCounter:q});Xu({activeTab:R.activeTab,selectedTags:R.selectedTags,validateLinksResult:R.validateLinksResult,validateImagesResult:R.validateImagesResult,setValidateLinks:X,setValidateImages:Q});const{showImgPreviewHandler:Ae,hideBlockPreviewHandler:we}=zu(),$e=(0,n.useCallback)(v=>v==="link_check"?R.linkCheckCounter:v==="image_check"?R.imageCheckCounter:R.spamCheckCounter,[R.linkCheckCounter,R.imageCheckCounter,R.spamCheckCounter]),Y=(0,n.useCallback)(v=>{if(U){if(V){te({type:{link_check:"INCREMENT_LINK_CHECK_COUNTER",image_check:"INCREMENT_IMAGE_CHECK_COUNTER",spam_check:"INCREMENT_SPAM_CHECK_COUNTER"}[v]}),W.fire({name:Ju[v],count:$e(v)+1});return}te({type:"INCREMENT_OPTIMISATION_COUNTER"}),W.fire({name:"OptimizationCount",count:R.optimisationCounter+1})}},[U,V,W,$e,R.optimisationCounter]),le=(0,n.useCallback)(v=>{if(V){const{limit:ie}=me[v];C({presetId:Qu[v],previousDisplay:ie>0?ie:r.presetLimitDisplay("infinity"),nextDisplay:r.presetLimitDisplay("infinity")});return}C({presetId:"optimization_exceeded",previousDisplay:J,nextDisplay:r.presetLimitDisplay("infinity")})},[V,me,C,J]),Ce=(0,n.useCallback)(()=>{a(m.billingPageUrl||r.APP_ROUTES.billing)},[m.billingPageUrl,a]),G=v=>{if(!U||!V)return null;const{counter:ie,limit:Re,disabled:Oe}=me[v];return(0,o.jsx)(t.ui_kit$LimitsCounter,{text:ga(ie,Re,e,i),exceeded:Oe,extra:(0,o.jsx)("button",{type:"button",style:fa,onClick:Ce,children:e("Need more?")})})},Te=(0,n.useCallback)((v,ie)=>{$.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_LINK,settings:{elementId:v,isError:ie}})},[$]),Ne=(0,n.useCallback)((v,ie)=>{$.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_IMG,settings:{elementId:v,isError:ie}})},[$]),Pe=(0,n.useCallback)(v=>{const ie={startColumn:v.startColumn,startLineNumber:v.startLineNumber,endColumn:v.endColumn,endLineNumber:v.endLineNumber};l(r.setActiveProblemRange(ie))},[l]),Me=(0,n.useCallback)(v=>{te({type:"SET_ACTIVE_TAB",payload:v}),te({type:"RESET_SELECTED_TAGS"}),v===br&&A?.length>0&&se({event:"check",action:"check_email_code",email_id:p,project_id:k,problems_count:A?.length||0})},[A,se,p,k]),Ue=(0,n.useCallback)(async()=>{if(!S){d.error({title:"Save the mail first."});return}if(pe("link_check")){le("link_check");return}if(!await M("link_check"))return;Y("link_check");const v=c(),ie=new DOMParser().parseFromString(v,"text/html"),Re={},Oe={};ie.querySelectorAll("a[href]").forEach((De,Ge)=>{Re[`link_${Ge}`]=De.getAttribute("href"),Oe[`link_${Ge}`]=De.textContent||""}),$.send({operation:"sandbox_set_attr_to_links"}),Ie({entity_id:S,data:Re}).then(({data:De,error:Ge})=>{if(Ge)K(Ge,"link_check");else if(De?.result){const Qe=[...De.result];Qe?.sort((j,w)=>j.linkId-w.linkId);const O=Qe.map(j=>({...j,text:Oe[j.linkId],status:Ku(j)})),oe={links:O,summary:pa(O)};te({type:"SET_VALIDATE_LINKS_RESULT",payload:oe}),d.success(e("Links validation was successfully completed")),De.limit_warning&&De.limit_remaining!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${De.limit_remaining}`}),se({event:"check",action:"check_email_links",email_id:p,project_id:k,links_count:oe.links?.length||0})}else De.statusCode>300||!De.success?d.error({error:{data:De}}):d.error({title:e("Something went wrong.")}),!R.validateLinksResult.links&&Me("")}).catch(De=>{K(De,"link_check")})},[p,S,pe,le,M,Y,c,$,Ie,d,e,se,k,Fe,R.validateLinksResult.links,K,Me]),ze=(0,n.useCallback)(async()=>{if(!S){d.error({title:"Save the mail first."});return}if(pe("image_check")){le("image_check");return}if(!await M("image_check"))return;Y("image_check");const v=c(),ie=new DOMParser().parseFromString(v,"text/html"),Re={};ie.querySelectorAll("img").forEach((Oe,De)=>Re[`image_${De}`]=Oe.src),$.send({operation:"sandbox_set_attr_to_images"}),Be({entity_id:S,data:Re}).then(({data:Oe,error:De})=>{let Ge;if(De)K(De,"image_check");else if(Oe?.result){const Qe=Object.values(Oe.result);Qe.sort((oe,j)=>oe.imageId-j.imageId);const O=Qe.reduce((oe,j)=>oe+Math.round(j.image.bytes/1024),0);Ge={images:Qe.map(oe=>({...oe,status:ma(oe)}))||[],summary:pa(Qe.map(oe=>({...oe,status:ma(oe)}))),summaryTime:{value:(O>1200?O/1e3:O).toFixed(1),name:O>1200?e("MB"):e("KB")}},Ge&&te({type:"SET_VALIDATE_IMAGES_RESULT",payload:Ge}),d.success(e("Images validation was successfully completed")),Oe.limit_warning&&Oe.limit_remaining!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${Oe.limit_remaining}`}),se({event:"check",action:"check_email_images",email_id:p,project_id:k,images_count:Ge.images?.length||0})}else Oe.statusCode>300||!Oe.success?d.error({error:{data:Oe}}):d.error({title:e("Something went wrong.")}),!R.validateImagesResult?.images?.length&&Me("")}).catch(Oe=>{K(Oe,"image_check")})},[p,S,pe,le,M,Y,c,$,Be,d,e,se,k,Fe,R.validateImagesResult,K,Me]),ce=(0,n.useCallback)(async()=>{if(!S){d.error({title:"Save the mail first."});return}if(pe("spam_check")){le("spam_check");return}await M("spam_check")&&(Y("spam_check"),he({entity_id:S,data:{html:c()}}).then(({data:v,error:ie})=>{if(ie)K(ie,"spam_check");else if(v&&v.success){const Re=!!v.result.report&&Object.values(v.result.report);Re?(Re.sort((Oe,De)=>Oe.score-De.score),te({type:"SET_VALIDATE_SPAM_RESULT",payload:{...v.result,report:Re}})):v.result&&te({type:"SET_VALIDATE_SPAM_RESULT",payload:{...v.result,report:Re}}),d.success(e("Spam validation was successfully completed")),v.limit_warning&&v.limit_remaining!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${v.limit_remaining}`}),se({event:"check",action:"check_email_spam",email_id:p,project_id:k,spam_score:v.result?.spamScore||0})}else v.statusCode>300||!v.success?d.error({error:{data:v}}):d.error({title:e("Something went wrong.")}),!R.validateSpamResult?.report?.length&&Me("")}).catch(v=>{K(v,"spam_check")}))},[p,S,pe,le,M,Y,c,he,d,e,se,k,Fe,R.validateSpamResult,K,Me]);(0,n.useEffect)(()=>{if(U){if(V){["link_check","image_check","spam_check"].forEach(v=>{const{limit:ie,counter:Re,disabled:Oe}=me[v];if(!Oe){L.current[v]=!1;return}L.current[v]||ie>0&&Re>=ie&&(L.current[v]=!0,le(v))});return}if(!(J>0&&R.optimisationCounter>=J)){I.current=!1;return}I.current||(I.current=!0,le("link_check"))}},[U,V,me,R.optimisationCounter,J,le]);const fe=x?r.getLimitUpgradePresetDefinition(x.presetId):null;return(0,o.jsxs)("div",{className:"optimise selected_form-props-wrapper selected_form-props-wrapper_optimize",children:[fe&&x?(0,o.jsx)(si,{open:!0,onClose:()=>T(null),title:e(fe.titleKey),subtitle:e(fe.subtitleKey),usageResource:fe.usageResource,previousDisplay:x.previousDisplay,nextDisplay:x.nextDisplay,onChangePlan:()=>{T(null),s()}}):null,U&&!V&&(0,o.jsx)(t.ui_kit$LimitsCounter,{text:ga(R.optimisationCounter,J,e,i),exceeded:de,extra:(0,o.jsx)("button",{type:"button",style:fa,onClick:Ce,children:e("Need more?")})}),m.optimizeLinksEnabled&&(0,o.jsxs)(o.Fragment,{children:[G("link_check"),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,align:"middle",children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsx)("div",{style:{padding:"15px 0"},children:e("Links validation")})}),(0,o.jsx)(t.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,o.jsx)(t.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:v=>v.preventDefault(),onClick:()=>{Me(pr),!R.validateLinksResult?.links?.length&&R.activeTab!==pr&&Ue()},loading:xe.isLoading,disabled:pe("link_check")&&!R.validateLinksResult?.links?.length,children:!xe.isLoading&&(R.activeTab===pr?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:m.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:m.iconStrokeWidth}))})})]}),(0,o.jsx)(na,{__:e,activeTab:R.activeTab,validateLinksResult:R.validateLinksResult,validateLinks:R.validateLinks,selectedTags:R.selectedTags,setSelectedTags:Z,isLoading:xe.isLoading,disabled:pe("link_check"),iconStrokeWidth:m.iconStrokeWidth,onValidate:Ue,goToLinkHandler:Te})]}),m.optimizeImagesEnabled&&(0,o.jsxs)(o.Fragment,{children:[G("image_check"),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,align:"middle",children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsx)("div",{style:{padding:"15px 0"},children:e("Images validation")})}),(0,o.jsx)(t.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,o.jsx)(t.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:v=>v.preventDefault(),onClick:()=>{Me(hr),!R.validateImagesResult?.images?.length&&R.activeTab!==hr&&ze()},loading:ke.isLoading,children:!ke.isLoading&&(R.activeTab===hr?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:m.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:m.iconStrokeWidth}))})})]}),(0,o.jsx)(da,{__:e,activeTab:R.activeTab,validateImagesResult:R.validateImagesResult,validateImages:R.validateImages,selectedTags:R.selectedTags,setSelectedTags:Z,isLoading:ke.isLoading,disabled:pe("image_check"),iconStrokeWidth:m.iconStrokeWidth,onValidate:ze,goToImageHandler:Ne,showImgPreviewHandler:Ae,hideBlockPreviewHandler:we})]}),m.optimizeSpamAssassinEnabled&&(0,o.jsxs)(o.Fragment,{children:[G("spam_check"),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,align:"middle",children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsx)("div",{style:{padding:"15px 0"},children:e("SpamAssassin")})}),(0,o.jsx)(t.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,o.jsx)(t.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:v=>v.preventDefault(),loading:be.isLoading,onClick:()=>{Me(ba),R.validateSpamResult.report?.length||Object.prototype.hasOwnProperty.call(R.validateSpamResult,"spamScore")||ce()},disabled:pe("spam_check")&&!(R.validateSpamResult?.report?.length||Object.prototype.hasOwnProperty.call(R.validateSpamResult,"spamScore")),children:!be.isLoading&&(R.activeTab===ba?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:m.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:m.iconStrokeWidth}))})})]}),(0,o.jsx)(ca,{__:e,activeTab:R.activeTab,validateSpamResult:R.validateSpamResult,isLoading:be.isLoading,disabled:pe("spam_check"),iconStrokeWidth:m.iconStrokeWidth,onValidate:ce})]}),m.optimizeCheckCodeEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,align:"middle",children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsx)("div",{style:{padding:"15px 0"},children:e("Source code validation")})}),(0,o.jsx)(t.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,o.jsx)(t.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:v=>v.preventDefault(),onClick:()=>Me(br),children:R.activeTab===br?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:m.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:m.iconStrokeWidth})})})]}),(0,o.jsx)(ua,{__:e,activeTab:R.activeTab,problemsList:A,onSetMonacoPosition:Pe})]})]})},Zu=({state:e,onCancel:i,onRetry:l,onDismiss:s})=>{const{__:a}=r.useI18n();return e.kind==="hidden"?null:(0,o.jsx)("div",{className:"indexing-tray",role:"status","aria-live":"polite",children:(0,o.jsx)(t.ui_kit$Card,{size:"small",variant:"borderless",className:"indexing-tray__card",children:(0,o.jsxs)(t.ui_kit$Flex,{vertical:!0,gap:8,children:[em(e,a),(0,o.jsx)(t.ui_kit$Flex,{justify:"flex-end",children:om(e,{onCancel:i,onRetry:l,onDismiss:s},a)})]})})})};function em(e,i){switch(e.kind){case"scanning":return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Flex,{align:"center",gap:8,children:[(0,o.jsx)(t.ui_kit$Spin,{size:"small"}),(0,o.jsx)(t.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Moving files from old storage…")})]}),(0,o.jsx)(t.ui_kit$Text,{type:"secondary",children:i("Found so far: %s").replace("%s",String(e.scanned))}),(0,o.jsx)(t.ui_kit$Progress,{percent:100,status:"active",showInfo:!1,strokeColor:r.emCssVar("colorPrimary")})]});case"indexing":{const l=e.total>0?Math.min(100,Math.round(e.scanned/e.total*100)):0;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Indexing files…")}),(0,o.jsx)(t.ui_kit$Text,{type:"secondary",children:`${e.scanned} / ${e.total}`}),(0,o.jsx)(t.ui_kit$Progress,{percent:l,status:"active",strokeColor:r.emCssVar("colorPrimary")})]})}case"done":return(0,o.jsx)(t.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Files ready: %s").replace("%s",String(e.files+e.folders+e.trashed))});case"failed":return(0,o.jsx)(t.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Could not move files from old storage")});case"cancelled":return(0,o.jsx)(t.ui_kit$Title,{level:5,className:"indexing-tray__title",children:i("Move stopped")});default:return null}}function om(e,i,l){switch(e.kind){case"scanning":case"indexing":return(0,o.jsx)(t.ui_kit$Button,{type:"link",size:"small",onClick:i.onCancel,disabled:e.cancelling,children:e.cancelling?l("Stopping…"):l("Cancel")});case"failed":return(0,o.jsx)(t.ui_kit$Button,{type:"link",size:"small",onClick:i.onRetry,children:l("Retry")});case"cancelled":return(0,o.jsx)(t.ui_kit$Button,{type:"link",size:"small",onClick:i.onRetry,children:l("Resume")});case"done":return(0,o.jsx)(t.ui_kit$Button,{type:"link",size:"small",onClick:i.onDismiss,children:l("Close")});default:return null}}var tm=2500,xa=48,im=4e3;function rm(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 lm(e){return e.kind==="done"||e.kind==="failed"||e.kind==="cancelled"}function sm({projectId:e,api:i,triggered:l,onCompleted:s}){const[a,d]=(0,n.useState)({kind:"hidden"}),c=(0,n.useRef)(!1),m=(0,n.useRef)(!0),f=(0,n.useRef)(e);f.current=e;const g=(0,n.useRef)(l);g.current=l;const E=(0,n.useRef)(s);E.current=s,(0,n.useEffect)(()=>(m.current=!0,()=>{m.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:rm(S.data)}catch{return null}},[i,e]),p=(0,n.useCallback)(async()=>{if(c.current)return;c.current=!0;const S=f.current;let k=0;try{for(;m.current&&f.current===S&&g.current;){const x=await h();if(!m.current)break;if(x)if(x.kind==="hidden"){if(k+=1,k>=xa){d({kind:"failed"});break}}else{if(k=0,d(x),x.kind==="done")try{await E.current?.()}catch{}if(lm(x))break}else if(k+=1,k>=xa){d({kind:"failed"});break}await new Promise(T=>setTimeout(T,tm))}}finally{c.current=!1}},[h]);return(0,n.useEffect)(()=>{l&&p()},[l,p]),(0,n.useEffect)(()=>{if(a.kind!=="done")return;const S=setTimeout(()=>{m.current&&d({kind:"hidden"})},im);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)(()=>{g.current=!0,i.files.backfillCreate({project_id:e}),p()},[i,e,p]),dismiss:(0,n.useCallback)(()=>d({kind:"hidden"}),[])}}var am=r.lazyRoute(()=>(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>go("./63e7f8c1.js")),void 0,{}.url)),nm=r.lazyRoute(()=>(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>go("./155e871a.js")),void 0,{}.url)),ka={height:"100%"};function dm(e){(e?(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>go("./b7289065.js")),void 0,{}.url):(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>go("./a8b4352d.js")),void 0,{}.url)).catch(()=>{})}var cm=({storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,contentKey:a})=>{const d=r.useAppConfig(),c=r.isImageEditModal(r.useSelector(r.selectActiveModal$1)),m=!!d.imageCenterFileManagerView;(0,n.useEffect)(()=>{c&&dm(m)},[c,m]);let f=(0,o.jsx)(t.ui_kit$PageLoader,{style:ka});return e&&i&&d.imageCenterFileManagerView?f=(0,o.jsx)(am,{storageProvider:e,dataProvider:i,pathProxy:l},a):e&&i&&(f=(0,o.jsx)(nm,{dataProvider:i,usesBuiltInStorage:s},a)),(0,o.jsx)(n.Suspense,{fallback:(0,o.jsx)(t.ui_kit$PageLoader,{style:ka}),children:f})};function um(){const e=r.useAppConfig(),i=r.useIsStandalone(),l=r.useStorageProvider(),s=r.useProjectData(),a=r.useRestClient(r.EM_FILES_MODULES),d=r.useStore(),c=(0,n.useMemo)(()=>r.createRestClientV2(d),[d]),m=r.useI18n(),f=r.useCurrentUser(),g=s?.id?String(s.id):"",E=f?.id!=="0"?String(f.id):"",h=r.isFileManagerV2Enabled(e),[p,S]=(0,n.useState)(null),k=h&&!!g&&p===g,[x,T]=(0,n.useState)(0),[I,L]=(0,n.useState)(0),y=(0,n.useRef)(g);(0,n.useEffect)(()=>{y.current!==g&&(y.current=g,S(null))},[g]);const C=(0,n.useCallback)($=>{$&&g&&S(g)},[g]),P=(0,n.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:l,projectId:g,restApi:a,restApiV2:c,i18n:m,pathPostfix:E,appConfig:e,isStandalone:i,onIndexingStateChange:C}),[e,C,m,i,g,x,a,c,l,E]),K=(0,n.useCallback)(async()=>{try{typeof P.dataProvider?.clearCache=="function"&&await P.dataProvider.clearCache()}catch{}S(null),T($=>$+1),L($=>$+1)},[P.dataProvider]),M=(0,n.useCallback)(()=>{g&&S(g)},[g]);return{...P,projectId:g,restApiV2:c,v2Enabled:h,backfillTriggered:k,contentKey:`${g}:${I}`,handleIndexingCompleted:K,markIndexingStarted:M}}var mm={height:"100%"},Ea=()=>{const{storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,projectId:a,restApiV2:d,v2Enabled:c,backfillTriggered:m,contentKey:f,handleIndexingCompleted:g,markIndexingStarted:E}=um(),h=r.useSelector(r.selectActiveModal$1),p=r.isImageCenterModal(h),{state:S,cancel:k,retry:x,dismiss:T}=sm({projectId:a,api:d,triggered:m,onCompleted:g}),I=n.default.useCallback(()=>{E(),x()},[E,x]);return(0,o.jsxs)(o.Fragment,{children:[p&&(0,o.jsx)(n.Suspense,{fallback:(0,o.jsx)(t.ui_kit$PageLoader,{style:mm}),children:(0,o.jsx)(cm,{storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,contentKey:f})}),c&&(0,o.jsx)(Zu,{state:S,onCancel:k,onRetry:I,onDismiss:T})]})};function pm(e){const i=r.parentEmailSource(e),l=r.isEmailsV2Enabled()&&r.needsWpIdLookup(i)?i:void 0,{data:s,isError:a}=r.useGetParentEmailWpIdQuery(l??"",{skip:l===void 0});return(0,n.useMemo)(()=>l===void 0?{parentId:i,unresolved:!1}:{parentId:s||void 0,unresolved:a||s===0},[l,s,a,i])}var hm=(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 bm(e){return!!(e?.global_block??e?.acf?.global_block)}var fm=({className:e,size:i=16})=>{const l=r.useAppConfig(),{__:s}=r.useI18n(),a=s("Global block");return(0,o.jsx)(t.ui_kit$Tooltip,{title:a,placement:"top",trigger:["hover"],children:(0,o.jsx)("span",{className:(0,We.default)("block-global-badge",e),"aria-label":a,role:"img",children:(0,o.jsx)(r.EmIcons,{icon:"Globe02Icon",component:t.icons$Globe02Icon,size:i,strokeWidth:l.iconStrokeWidth})})})},Ba=new Map;function Sa(e){return`<table cellspacing="0" cellpadding="0" border="0" width="100%">${e}</table>`}function fr(e,i){const l=i??"";if(e===void 0)return r.sanitizeHtml(Sa(l));const s=String(e),a=Ba.get(s);if(a&&a.source===l)return a.markup;const d=r.sanitizeHtml(Sa(l));return Ba.set(s,{source:l,markup:d}),d}function gm(e,i){return e?i.openBlockFromEmailEnabled===!0?"over-email":null:"link"}var _m={fontSize:"16px",margin:0},{name:gr,type:Ta,tags:Ra}={name:"name",type:"type",tags:"tags"},ya={[gr]:"",[Ta]:[],[Ra]:[]},ht={Header:10,Menu:20,Banners:30,Content:40,Lists:50,Buttons:60,Promocodes:70,"E-Commerce":80,Transactional:80,Articles:90,Polls:100,Applications:110,Feature:120,Separators:130,Contacts:140,Footer:150},_r=({parentEmailId:e,blocksTab:i,search:l,reloadBlockScreens:s,setIsShowAddAllBlocksModal:a})=>{const{parentId:d}=pm(e),c=r.useEditorProjectId(),m=r.useSetHtmlElementInIframeHandler(),f=r.useDragStartBlockToIframeHandler(),[g]=t.ui_kit$Form.useForm(),{data:E}=r.useGetBlocksSchemaQuery(),{token:h}=(0,t.ui_kit$useToken)(),{__:p,_x:S}=r.useI18n(),k=r.useNotification(),{modal:x}=t.ui_kit$App.useApp(),{confirm:T}=x,I={pathname:r.useRoutePathname()},L=r.useAppConfig(),y=r.useSelector(r.selectParentBlocks),C=Ss(),P=(0,n.useRef)(null),K=(0,n.useRef)(null),M=r.useRootElement(),$=660,A=207/$,W=B=>bm(B)?(0,o.jsx)("div",{className:"blocks-search__result-global-mark",children:(0,o.jsx)(fm,{className:"block-global-badge--tile",size:14})}):null,se=r.useEmailAttribute("common_styles"),R=(0,n.useMemo)(()=>Rs(se,C),[se,C]),te=(0,n.useRef)(null),he=(0,n.useRef)(null),be=(0,n.useRef)(null),Ie=r.useStore();(0,n.useEffect)(()=>{K.current?.scrollTo({top:0})},[i,l]);const xe=r.useProjectData(),{data:Be}=r.useGetTermsQuery({project:xe,kind:r.BLOCK_TAGS},{skip:!xe?.id}),[ke,ne]=(0,n.useState)(()=>r.projectBlocksArgs(c));(0,n.useEffect)(()=>{l||(g.setFieldsValue(ya),v({type:null,name:null}),s())},[l,g,s]),(0,n.useEffect)(()=>{if(E){const B=E.schema.properties.acf.properties.type.items.enum;let F=[];for(let b in B)F.push({label:p(r.TYPES_TRANSLATE[B[b]]),value:B[b]})}},[E,p]);const{isSuccess:He,isError:Fe,isLoading:Se,isFetching:ye,data:re,refetch:q,error:X}=r.useGetBlocksQuery({...ke,page:1}),Q=(0,n.useMemo)(()=>{if(He&&re)return[...re].sort((B,F)=>ht[B.type]-ht[F.type])},[He,re]),[Z,U]=(0,n.useState)([]);r.usePrevious(B=>{B!==Fe&&k.fromError("BLOCK_GET_ERROR",{},X,!0)},[Fe,X,k]);const[V,J]=(0,n.useState)(()=>r.parentEmailBlocksArgs(d)),{isSuccess:de,isError:me,isLoading:pe,isFetching:Ae}=r.useGetParentEmailBlocksQuery({...V,emailId:d,page:1},{skip:!d||y.length}),we=(0,n.useMemo)(()=>{if(de||y.length)return[...y].sort((B,F)=>ht[B.type]-ht[F.type])},[de,y]),[$e,Y]=(0,n.useState)([]);(0,n.useEffect)(()=>{const B=new Set;if(y.length&&we){for(const F of we)F.type&&B.add(F.type);Y(Array.from(B))}else Y([])},[y,we]);const[le,Ce]=(0,n.useState)(r.templateBlocksArgs),{isSuccess:G,isError:Te,isLoading:Ne,isFetching:Pe,data:Me=[]}=r.useGetTemplateBlocksQuery({...le,page:1}),Ue=(0,n.useMemo)(()=>{if(Me.length)return[...Me].sort((B,F)=>ht[B.type]-ht[F.type])},[Me]),[ze,ce]=(0,n.useState)([]);(0,n.useEffect)(()=>{const B=new Set;if(Ue&&Me.length){for(const F of Ue)F.type&&B.add(F.type);ce(Array.from(B))}},[Me.length,Ue]);const fe=(0,n.useMemo)(()=>{const B=new Set;for(const F of Z)B.add(F);for(const F of $e)B.add(F);for(const F of ze)B.add(F);return Array.from(B)},[ze,$e,Z]),v=B=>{ne(F=>({...F,...B,page:1})),J(F=>({...F,...B,page:1})),Ce(F=>({...F,...B,page:1}))},ie=r.useFitBlockPreviewHeight(A),Re=(0,n.useCallback)(()=>{M.querySelector(".blocks-search__result-wrapper.is_search")&&(M.querySelector(".blocks-search__result-wrapper").style.removeProperty("transition"),M.querySelector(".blocks-search__result-wrapper").style.opacity=0,r.measureBlockPreviews(M,207/$),M.querySelector(".blocks-search__result-wrapper").style.transition="opacity 0.2s",M.querySelectorAll(".blocks-search__result-wrapper").forEach(B=>B.style.opacity=1))},[$,M]);(0,n.useEffect)(()=>{!(Pe||Ne)&&G&&i!=="template"&&(l?Re():s())},[Pe,Ne,G,Re,ke.name,s,l,i]),(0,n.useEffect)(()=>{const B=new Set;if(He&&Q){for(const F of Q)F.type&&B.add(F.type);U(Array.from(B))}},[He,Q]);const Oe=B=>{const F=Object.keys(B)[0],b=g.getFieldsValue(!0);switch(F){case Ra:const H=(Be||[]).filter(ae=>B[F].includes(ae.name)).map(ae=>ae.id)||null;v({tags:H});break;case Ta:v({type:b.type||null});break;case gr:P.current&&window.clearTimeout(P.current),P.current=window.setTimeout(function(){v({name:b.name||null})},300)}},De=B=>{s(),B.target.getAttribute("data-type")?(B.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(F=>F.style.display="none"),B.target.closest(".blocks-search").querySelectorAll(`[data-type="${B.target.getAttribute("data-type")}"]`).forEach(F=>F.style.display="block")):B.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(F=>F.style.display="block"),B.target.parentElement.querySelector(".active").classList.remove("active"),B.target.classList.add("active")};let Ge=null;const Qe=B=>{clearTimeout(Ge);let F=M.querySelector(".block-search__preview")?M.querySelector(".block-search__preview"):null,b=M.querySelector(".block-search__preview-title")?M.querySelector(".block-search__preview-title"):null,H=M.querySelector(".block-search__preview-content")?M.querySelector(".block-search__preview-content"):null;M.querySelector(".block-search__preview")||(F=document.createElement("div"),F.classList.add("block-search__preview"),b=document.createElement("div"),b.classList.add("block-search__preview-title"),H=document.createElement("div"),H.classList.add("block-search__preview-content"),F.append(H),F.append(b),M.querySelector(".email-pane__col_settings-inner").append(F)),b.innerHTML="",H.innerHTML="",b.innerHTML=B.title;let ae=B.html.replaceAll(/<style((.|\n|\r)*?)<\/style>/gi,"").trim();H.innerHTML=r.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+ae+"</table>"),F.style.opacity!=="1"&&setTimeout(function(){F.style.opacity="1",F.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(100%)":"translateX(-100%)"},10)},O=()=>{let B=M.querySelector(".block-search__preview");B&&(Ge=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)(()=>{M.querySelectorAll(".blocks-search__result").forEach(B=>{B.style.display="block"})},[i]);const oe=!re?.length&&(!d||!y?.length)&&!Me?.length&&(ke.tags||ke.name||ke.type)&&!(Se||ye),j=B=>Ie.dispatch(r.blocksApi.endpoints.deleteBlock.initiate(B.id)).then(F=>{F.error&&k.fromError("BLOCK_REMOVING_ERROR",r.getBlockDesc(B),F.error),k.success({id:"BLOCK_REMOVING_SUCCESS",data:r.getBlockDesc(B),title:p('The block "')+F.data.title+S('" was successfully removed.',"block")}),q()});(0,n.useEffect)(()=>{!Se&&!ye&&s()},[Se,ye,s]),(0,n.useEffect)(()=>{(i==="common"||l)&&setTimeout(s,50)},[re,s,i,l]);const w=B=>{T({mask:{closable:!0},centered:!0,title:S("Are you sure you want to delete the “","block")+B.title+p("” block?"),icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:22,style:{color:t.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0}}),okText:p("Yes"),cancelText:p("No"),onOk:()=>j(B)})},ue=(B,F)=>`${B.pathname.split("emails")[0]}blocks/${F.id}`,ve=B=>{let F=[{key:"Delete block",className:"blocks-search__result__menu-item",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16,style:{margin:0}}),style:{color:h.colorError},onClick:()=>w(B)}];const b=gm(!0,L);return b==="link"&&F.unshift({key:"Edit block",className:"blocks-search__result__menu-item",icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,style:{fontSize:"16px",margin:0}}),label:(0,o.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:ue(I,B),children:" "})}),b==="over-email"&&F.unshift({key:"Edit block",className:"blocks-search__result__menu-item",icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,style:_m}),onClick:()=>{r.getEmitter(fo.getContainer(Ie),fo.events.OPEN_BLOCK_REQUEST_ID).fireSettled(String(B.id)).then(({errors:H})=>{H.length&&k.fromError("BLOCK_GET_ERROR",r.getBlockDesc(B),H[0])})}}),F},Xe=B=>{let F=B.html.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");if(F.replaceChildren(...r.parseFromString(B.html)),Object.keys(R).length!==0&&(F.querySelectorAll(".em-contrast-card").forEach(b=>{R.cards?.contrastBackgroundColor&&(b.getAttribute("bgcolor")?R.cards.contrastBackgroundColor?b.setAttribute("bgcolor",R.cards.contrastBackgroundColor):b.removeAttribute("bgcolor"):R.cards.contrastBackgroundColor?b.style.backgroundColor=R.cards.contrastBackgroundColor:b.style.removeProperty("background-color")),R.cards?.contrastTextColor&&b.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(H=>{if(to(H.style.color).toLowerCase()!=="#ffffff"){let ae=H.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.cards.contrastTextColor};`);H.setAttribute("style",ae)}})}),F.querySelectorAll(".em-card").forEach(b=>{R.cards?.baseBackgroundColor&&(b.getAttribute("bgcolor")?R.cards.baseBackgroundColor?b.setAttribute("bgcolor",R.cards.baseBackgroundColor):b.removeAttribute("bgcolor"):R.cards.baseBackgroundColor?b.style.backgroundColor=R.cards.baseBackgroundColor:b.style.removeProperty("background-color")),R.cards?.baseTextColor&&b.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(H=>{if(to(H.style.color).toLowerCase()!=="#ffffff"){let ae=H.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.cards.baseTextColor};`);H.setAttribute("style",ae)}})}),F.querySelectorAll(".em-card, .em-contrast-card").forEach(b=>{R.cards?.border&&co({settings:{border:R.cards?.border},elem:b}),R.cards?.borderRadius?.all?(b.style.borderBottomLeftRadius&&b.style.borderBottomLeftRadius!=="0px"&&(b.style.borderBottomLeftRadius=R.cards?.borderRadius.all+"px"),b.style.borderBottomRightRadius&&b.style.borderBottomRightRadius!=="0px"&&(b.style.borderBottomRightRadius=R.cards?.borderRadius.all+"px"),b.style.borderTopLeftRadius&&b.style.borderTopLeftRadius!=="0px"&&(b.style.borderTopLeftRadius=R.cards?.borderRadius.all+"px"),b.style.borderTopRightRadius&&b.style.borderTopRightRadius!=="0px"&&(b.style.borderTopRightRadius=R.cards?.borderRadius.all+"px")):R.cards?.borderRadius?.all===""?b.style.removeProperty("border-radius"):(R.cards?.borderRadius?.topLeft&&b.style.borderTopLeftRadius&&b.style.borderTopLeftRadius!=="0px"?b.style.borderTopLeftRadius=R.cards?.borderRadius.topLeft+"px":R.cards?.borderRadius?.topLeft===""&&b.style.removeProperty("border-top-left-radius"),R.cards?.borderRadius?.topRight&&b.style.borderTopRightRadius&&b.style.borderTopRightRadius!=="0px"?b.style.borderTopRightRadius=R.cards?.borderRadius.topRight+"px":R.cards?.borderRadius?.topRight===""&&b.style.removeProperty("border-top-right-radius"),R.cards?.borderRadius?.bottomRight&&b.style.borderBottomRightRadius&&b.style.borderBottomRightRadius!=="0px"?b.style.borderBottomRightRadius=R.cards?.borderRadius.bottomRight+"px":R.cards?.borderRadius?.bottomRight===""&&b.style.removeProperty("border-bottom-right-radius"),R.cards?.borderRadius?.bottomLeft&&b.style.borderBottomLeftRadius&&b.style.borderBottomLeftRadius!=="0px"?b.style.borderBottomLeftRadius=R.cards?.borderRadius.bottomLeft+"px":R.cards?.borderRadius?.bottomLeft===""&&b.style.removeProperty("border-bottom-left-radius"))}),F.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(b=>{if(!b.style.display&&parseFloat(b.style.fontSize)<=20){let H="",ae=R.text.fontFamily;if(parseFloat(b.style.fontSize)>14&&(H=b.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${R.text.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${R.text.lineHeight}px`),b.setAttribute("style",H)),!b.closest(".em-contrast-card, .em-card")&&to(b.style.color).toLowerCase()!=="#ffffff"&&(H=b.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.text.color};`),b.setAttribute("style",H)),b.closest(".em-contrast-block")&&!b.closest(".em-contrast-card, .em-card")&&(H=b.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.text.contrastColor};`),b.setAttribute("style",H)),ae[0]==="Safe Fonts"?(b.style.fontFamily=ae[1],Ke({elem:F})):ae[0]==="Google Fonts"&&(ae[1]==="Sans Serif"?b.style.fontFamily="Helvetica, Arial, sans-serif":ae[1]==="Serif"&&(b.style.fontFamily='"Times New Roman", Times, serif'),b.classList.remove(...[...b.classList].filter(je=>je.startsWith("em-font"))),b.classList.add(`em-font-${ae[2].replace(/\s/g,"")}-${ae[3].replace(/\s/g,"")}`),io({elem:F,fontFamilyArray:ae})),b.closest('[em="atom"] > tr > td')&&b.closest('[em="atom"] > tr > td').style.paddingBottom)b.closest('[em="atom"] > tr > td').style.paddingBottom=R.text.paddingBottom+"px";else if(b.nextElementSibling||b.closest("table")&&b.closest("table").nextElementSibling){let je=b.nextElementSibling??b.closest("table").nextElementSibling;je&&je.tagName==="TABLE"&&(je.classList.contains("em-vindent-table")||je.querySelector("td").innerHTML==="")&&je.querySelector("td").setAttribute("height",R.text.paddingBottom)}}else if(!b.style.display&&parseFloat(b.style.fontSize)>=20&&to(b.style.color).toLowerCase()!=="#eb3737"){let H="",ae=R.headings.fontFamily;parseFloat(b.style.fontSize)<40&&(H=b.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${R.headings.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${R.headings.lineHeight}px`),b.setAttribute("style",H)),!b.closest(".em-contrast-card, .em-card")&&to(b.style.color).toLowerCase()!=="#ffffff"&&(H=b.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.headings.color};`),b.setAttribute("style",H)),b.closest(".em-contrast-block")&&!b.closest(".em-contrast-card, .em-card")&&(H=b.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.headings.contrastColor};`),b.setAttribute("style",H)),ae[0]==="Safe Fonts"?(b.style.fontFamily=ae[1],Ke({elem:F})):ae[0]==="Google Fonts"&&(ae[1]==="Sans Serif"?b.style.fontFamily="Helvetica, Arial, sans-serif":ae[1]==="Serif"&&(b.style.fontFamily='"Times New Roman", Times, serif'),b.classList.remove(...[...b.classList].filter(Ee=>Ee.startsWith("em-font"))),b.classList.add(`em-font-${ae[2].replace(/\s/g,"")}-${ae[3].replace(/\s/g,"")}`),io({elem:F,fontFamilyArray:ae}));let je="";if(R.headings.letterSpacing>0?je=b.style.letterSpacing?b.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${R.headings.letterSpacing}px`):b.getAttribute("style")+` letter-spacing: ${R.headings.letterSpacing}px;`:je=b.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),b.setAttribute("style",je),R.headings.bold?b.querySelector("b")?b.querySelector("b").replaceWith(...b.querySelector("b").childNodes):b.querySelector("strong")||(b.innerHTML="<strong>"+b.innerHTML+"</strong>"):b.querySelector("strong")?b.querySelector("strong").replaceWith(...b.querySelector("strong").childNodes):b.querySelector("b")&&b.querySelector("b").replaceWith(...b.querySelector("b").childNodes),b.style.fontWeight){let Ee=b.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");b.setAttribute("style",Ee)}if(R.headings.italic?b.querySelector("i")?b.querySelector("i").replaceWith(...b.querySelector("i").childNodes):b.querySelector("em")||(b.innerHTML="<em>"+b.innerHTML+"</em>"):b.querySelector("em")?b.querySelector("em").replaceWith(...b.querySelector("em").childNodes):b.querySelector("i")&&b.querySelector("i").replaceWith(...b.querySelector("i").childNodes),b.style.fontStyle){let Ee=b.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");b.setAttribute("style",Ee)}if(b.closest('[em="atom"] > tr > td')&&b.closest('[em="atom"] > tr > td').style.paddingTop)b.closest('[em="atom"] > tr > td').style.paddingTop=R.headings.paddingTop+"px";else if(b.previousElementSibling){let Ee=b.previousElementSibling;Ee&&Ee.tagName==="TABLE"&&(Ee.classList.contains("em-vindent-table")||Ee.querySelector("td").innerHTML==="")&&Ee.querySelector("td").setAttribute("height",R.headings.paddingTop)}if(b.closest('[em="atom"] > tr > td')&&b.closest('[em="atom"] > tr > td').style.paddingBottom)b.closest('[em="atom"] > tr > td').style.paddingBottom=R.headings.paddingBottom+"px";else if(b.nextElementSibling){let Ee=b.nextElementSibling;Ee&&Ee.tagName==="TABLE"&&(Ee.classList.contains("em-vindent-table")||Ee.querySelector("td").innerHTML==="")&&Ee.querySelector("td").setAttribute("height",R.headings.paddingBottom)}}}),F.querySelectorAll('a[style*="color"]').forEach(b=>{if(b.style.display){if(b.style.display&&b.style.display==="block"){let H="";if(H=b.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${R.buttons.fontSize}px`),b.setAttribute("style",H),b.closest("td").style.backgroundColor&&!b.closest("td").style.borderWidth&&!b.closest(".em-contrast-card"))if(b.closest(".em-contrast-block")?H=b.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.buttons.contrastColor};`):H=b.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.buttons.color};`),b.setAttribute("style",H),b.closest(".em-contrast-block"))if(R.buttons.contrastBackgroundColor){let Ee=b.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${R.buttons.contrastBackgroundColor};`);b.closest("td").setAttribute("style",Ee)}else b.closest("td").style.removeProperty("background-color");else if(R.buttons.backgroundColor){let Ee=b.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${R.buttons.backgroundColor};`);b.closest("td").setAttribute("style",Ee)}else b.closest("td").style.removeProperty("background-color");else if(b.closest("td").style.borderWidth)if(Object.values(R.buttons.border).every(Ee=>Ee===null)){if(b.closest(".em-contrast-block")){if(R.buttons.contrastBackgroundColor){let Ee=b.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,Je=>Je.replace(/#[A-Fa-f0-9]{6}/,`${R.buttons.contrastBackgroundColor}`));b.closest("td").setAttribute("style",Ee),H=b.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.buttons.contrastBackgroundColor};`),b.setAttribute("style",H)}}else if(R.buttons.backgroundColor){let Ee=b.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,Je=>Je.replace(/#[A-Fa-f0-9]{6}/,`${R.buttons.backgroundColor}`));b.closest("td").setAttribute("style",Ee),H=b.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.buttons.backgroundColor};`),b.setAttribute("style",H)}}else for(const Ee in R.buttons.border)R.buttons.border[Ee]&&R.buttons.border[Ee].color!==void 0&&(H=b.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.buttons.border[Ee].color};`),b.setAttribute("style",H));else b.closest(".em-contrast-block")?R.buttons.contrastBackgroundColor&&(H=b.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.buttons.contrastBackgroundColor};`),b.setAttribute("style",H)):R.buttons.backgroundColor&&(H=b.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.buttons.backgroundColor};`),b.setAttribute("style",H));let ae=R.buttons.fontFamily;ae[0]==="Safe Fonts"?(b.style.fontFamily=ae[1],Ke({elem:F})):ae[0]==="Google Fonts"&&(ae[1]==="Sans Serif"?b.style.fontFamily="Helvetica, Arial, sans-serif":ae[1]==="Serif"&&(b.style.fontFamily='"Times New Roman", Times, serif'),b.classList.remove(...[...b.classList].filter(Ee=>Ee.startsWith("em-font"))),b.classList.add(`em-font-${ae[2].replace(/\s/g,"")}-${ae[3].replace(/\s/g,"")}`),io({elem:F,fontFamilyArray:ae})),b.closest("td").setAttribute("align",R.buttons.textAlign);let je="";if(R.buttons.letterSpacing>0?je=b.style.letterSpacing?b.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${R.buttons.letterSpacing}px`):b.getAttribute("style")+` letter-spacing: ${R.buttons.letterSpacing}px;`:je=b.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),b.setAttribute("style",je),R.buttons.bold?b.querySelector("b")?b.querySelector("b").replaceWith(...b.querySelector("b").childNodes):b.querySelector("strong")||(b.innerHTML="<strong>"+b.innerHTML+"</strong>"):b.querySelector("strong")?b.querySelector("strong").replaceWith(...b.querySelector("strong").childNodes):b.querySelector("b")&&b.querySelector("b").replaceWith(...b.querySelector("b").childNodes),b.style.fontWeight){let Ee=b.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");b.setAttribute("style",Ee)}if(R.buttons.italic?b.querySelector("i")?b.querySelector("i").replaceWith(...b.querySelector("i").childNodes):b.querySelector("em")||(b.innerHTML="<em>"+b.innerHTML+"</em>"):b.querySelector("em")?b.querySelector("em").replaceWith(...b.querySelector("em").childNodes):b.querySelector("i")&&b.querySelector("i").replaceWith(...b.querySelector("i").childNodes),b.style.fontStyle){let Ee=b.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");b.setAttribute("style",Ee)}if(b.closest('[em="atom"] > tr > td')&&b.closest('[em="atom"] > tr > td').style.paddingTop)b.closest('[em="atom"] > tr > td').style.paddingTop=R.buttons.marginTop+"px";else if(b.closest("table").previousElementSibling){let Ee=b.closest("table").previousElementSibling;Ee&&Ee.tagName==="TABLE"&&(Ee.classList.contains("em-vindent-table")||Ee.querySelector("td").innerHTML==="")&&Ee.querySelector("td").setAttribute("height",R.buttons.marginTop)}if(b.closest('[em="atom"] > tr > td')&&b.closest('[em="atom"] > tr > td').style.paddingBottom)b.closest('[em="atom"] > tr > td').style.paddingBottom=R.buttons.marginBottom+"px";else if(b.closest("table").previousElementSibling){let Ee=b.closest("table").nextElementSibling;Ee&&Ee.tagName==="TABLE"&&(Ee.classList.contains("em-vindent-table")||Ee.querySelector("td").innerHTML==="")&&Ee.querySelector("td").setAttribute("height",R.buttons.marginBottom)}R.buttons.padding.all&&(b.style.padding=R.buttons.padding.all+"px"),R.buttons.padding.top&&(b.style.paddingTop=R.buttons.padding.top+"px"),R.buttons.padding.right&&(b.style.paddingRight=R.buttons.padding.right+"px"),R.buttons.padding.bottom&&(b.style.paddingBottom=R.buttons.padding.bottom+"px"),R.buttons.padding.left&&(b.style.paddingLeft=R.buttons.padding.left+"px"),co({settings:{border:R.buttons.border},elem:b.closest("td")}),Eo({settings:{borderRadius:R.buttons.borderRadius},elem:b.closest("td")})}}else{let H=R.text.fontFamily;if(to(b.style.color).toLowerCase()==="#1c52dc"){let je=b.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.links.color};`);b.setAttribute("style",je)}else{let je=b.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.text.color};`);b.setAttribute("style",je)}if(b.closest(".em-contrast-block")){let je=b.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${R.links.contrastColor};`);b.setAttribute("style",je)}let ae="";R.links.underline?ae=b.style.textDecoration?b.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: underline;"):b.getAttribute("style")+" text-decoration: underline;":ae=b.style.textDecoration?b.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: none;"):b.getAttribute("style")+" text-decoration: none;",b.setAttribute("style",ae),H[0]==="Safe Fonts"?(b.style.fontFamily=H[1],Ke({elem:F})):H[0]==="Google Fonts"&&(H[1]==="Sans Serif"?b.style.fontFamily="Helvetica, Arial, sans-serif":H[1]==="Serif"&&(b.style.fontFamily='"Times New Roman", Times, serif'),b.classList.remove(...[...b.classList].filter(je=>je.startsWith("em-font"))),b.classList.add(`em-font-${H[2].replace(/\s/g,"")}-${H[3].replace(/\s/g,"")}`),io({elem:F,fontFamilyArray:H}))}}),F.querySelector('[em="block"]'))){const b=F.querySelectorAll('[em="block"]');R.block?.backgroundColor&&b.forEach(H=>{H.querySelectorAll(":scope > td").forEach(ae=>{ae.setAttribute("bgcolor",R.block.backgroundColor)})}),R.block?.padding&&b.forEach(H=>{H.querySelectorAll(":scope > td").forEach(ae=>{ae.style.paddingTop=R.block.padding.top+"px",ae.style.paddingRight=R.block.padding.right+"px",ae.style.paddingBottom=R.block.padding.bottom+"px",ae.style.paddingLeft=R.block.padding.left+"px"})})}return F.tagName==="DIV"?r.getElementInnerHTML(F):r.getElementInnerHTML(F.querySelector("tbody")||F)},Ke=B=>{B.elem.querySelectorAll("link[em-class]").forEach(F=>{B.elem.querySelector("."+F.getAttribute("em-class"))||F.remove()})};function to(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 F=parseInt(B[0],10).toString(16),b=parseInt(B[1],10).toString(16),H=parseInt(B[2],10).toString(16);return F=F.length===1?"0"+F:F,b=b.length===1?"0"+b:b,H=H.length===1?"0"+H:H,"#"+F+b+H}}else if(B&&B.charAt(0)==="#")return B}const io=B=>{const F=B.elem.querySelectorAll("link"),b=`em-font-${B.fontFamilyArray[2].replace(/\s/g,"")}-${B.fontFamilyArray[3].replace(/\s/g,"")}`;if(!Array.from(F)?.find(ae=>ae.getAttribute("em-class")===b)){let ae=document.createElement("link");ae.setAttribute("rel","stylesheet"),ae.setAttribute("href",`https://fonts.googleapis.com/css2?family=${B.fontFamilyArray[2]}:ital,wght@${xo[B.fontFamilyArray[3]].indexOf("i")>-1?"1":"0"},${xo[B.fontFamilyArray[3]].replaceAll("i","")}&display=swap`),ae.setAttribute("em-class",b),B.elem.insertAdjacentElement("afterbegin",ae)}ee({elem:B.elem});let H=`font-family: '${B.fontFamilyArray[2]}', ${D[B.fontFamilyArray[1]]}!important;`;H+=` font-weight: ${xo[B.fontFamilyArray[3]].replaceAll("i","")}!important;`,xo[B.fontFamilyArray[3]].indexOf("i")>-1&&(H+=" 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,"")} { ${H} }`),setTimeout(()=>Ke({elem:B.elem}),0)},co=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")))},Eo=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"))},xo={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"},D={"Sans Serif":"sans-serif",Serif:"serif"};function ee(B){if(!B.elem.querySelector('style[em="styles"]')){let F=document.createElement("style");F.setAttribute("em","styles"),B.elem.append(F)}}return(0,o.jsxs)("div",{className:(0,We.default)("blocks-search",{is_search:l}),children:[(0,o.jsx)(t.ui_kit$Form,{className:(0,We.default)("blocks-search__form",{is_search:l}),form:g,layout:"vertical",name:"blocks_search_form",initialValues:{...ya},onValuesChange:Oe,autoComplete:"off",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:gr,children:(0,o.jsx)(t.ui_kit$SearchInput,{placeholder:p("Search by title"),allowClear:!0,enterButton:!1})})}),(Fe||me||Te)&&(0,o.jsx)(t.ui_kit$Alert,{title:p("Error"),description:p("Error when receiving data. Try again (reload page) or contact support."),type:"error",showIcon:!0}),l&&!oe&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:De,children:p("All")},"search_All"),fe.map(B=>(0,o.jsx)("li",{"data-type":B,onClick:De,children:p(r.TYPES_TRANSLATE[B])},"search_"+B))]})}),(0,o.jsxs)("div",{ref:K,className:(0,We.default)("blocks-search__result-wrapper",{is_search:l}),children:[(i==="project"||l)&&(0,o.jsxs)(o.Fragment,{children:[!!Z.length&&!l&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:De,children:p("All")},"blocksSections_All"),Z.map(B=>(0,o.jsx)("li",{"data-type":B,onClick:De,children:p(r.TYPES_TRANSLATE[B])},"blocksSections_"+B))]})}),(0,o.jsxs)("div",{className:(0,We.default)("blocks-search__blocks-wrapper",{is_search:l}),ref:te,children:[(0,o.jsx)("div",{className:"blocks-search__result-holder project",children:!(Se||ye)&&(Q?.length?Q.map((B,F)=>{const b=fr(B.id,B.html);return(0,o.jsx)("div",{className:"blocks-search__result","data-type":B.type,children:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"leftTop",menu:{items:ve(B)},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:H=>m(H,B.html,"project",B.title,B),onDragStart:H=>f(H,B.html,"project",B.title,B),onMouseEnter:()=>Qe({html:B.html,title:B.title}),onMouseLeave:O,children:[W(B),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:b,onContentLoad:ie,style:{transform:`scale(${A})`}})]})},"commenMenu")},B.id+F.toString())}):!(ke.tags||ke.name||ke.type)&&He&&!(Se||ye)&&!l&&(0,o.jsxs)("div",{style:{padding:"10px 0 20px",display:"flex",flexDirection:"row",justifyContent:"space-between"},children:[(0,o.jsxs)("div",{style:{width:"110%"},children:[(0,o.jsx)("h3",{style:{lineHeight:"1.2"},children:p("You don`t have any saved blocks yet.")}),p("To add a block from the dashboard click the"),' "',p("Save to Blocks button."),'" ',(0,o.jsx)(r.EmIcons,{icon:"SaveBlock",component:t.icons$SaveBlock,style:{position:"relative",top:"2px"}}),(0,o.jsx)("br",{}),(0,o.jsx)("br",{}),p("You can also save all blocks at once. The AI assistant will automatically determine the type and create a name for each block when saving."),(0,o.jsx)("br",{}),(0,o.jsx)("br",{}),(0,o.jsx)(t.ui_kit$Flex,{justify:"left",children:(0,o.jsx)(t.ui_kit$Button,{type:"primary",onClick:()=>a(!0),style:{cursor:"pointer"},children:p("Save all blocks")})})]}),(0,o.jsx)("div",{style:{width:"80px",height:"200px"},children:(0,o.jsx)("img",{src:hm,style:{display:"block",width:80,position:"absolute",right:5}})})]}))}),(Se||ye)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),l&&re?.length>0&&y?.length>0&&(0,o.jsx)(t.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="template"||l)&&(0,o.jsxs)(o.Fragment,{children:[!!$e.length&&!l&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:De,children:p("All")},"templateBlocksSections_All"),$e.map(B=>(0,o.jsx)("li",{"data-type":B,onClick:De,children:p(r.TYPES_TRANSLATE[B])},"templateBlocksSections_"+B))]})}),(0,o.jsxs)("div",{className:(0,We.default)("blocks-search__blocks-wrapper",{is_search:l}),ref:he,children:[(0,o.jsxs)("div",{className:"blocks-search__result-holder template",children:[y&&!(pe||Ae)&&we?.length?(0,o.jsx)(o.Fragment,{children:we.map((B,F)=>{const b=fr(B.id,B.html);return(0,o.jsx)("div",{className:"blocks-search__result","data-type":B.type,children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:H=>m(H,B.html,"template",B.title,B),onDragStart:H=>f(H,B.html,"template",B.title,B),onMouseEnter:()=>Qe({html:B.html,title:B.title}),onMouseLeave:()=>O(),children:[W(B),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:b,onContentLoad:ie,style:{transform:`scale(${A})`}})]})},B.id+F.toString())})}):!l&&!Ne&&!Ae&&(0,o.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:p("No related blocks found.")})," "]}),(pe||Ae)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),l&&y?.length>0&&Me?.length>0&&(0,o.jsx)(t.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="common"||l)&&(0,o.jsxs)(o.Fragment,{children:[!!ze?.length&&!l&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:De,children:p("All")},"commonBlocksSections_All"),ze.map(B=>(0,o.jsx)("li",{"data-type":B,onClick:De,children:p(r.TYPES_TRANSLATE[B])},"commonBlocksSections_"+B))]})}),(0,o.jsxs)("div",{className:(0,We.default)("blocks-search__blocks-wrapper",{is_search:l}),ref:be,children:[(0,o.jsxs)("div",{className:"blocks-search__result-holder common",children:[G&&!!Ue?.length&&!(Pe||Ne)&&(0,o.jsx)(o.Fragment,{children:Ue.map((B,F)=>{const b=Xe({html:fr(B.id,B.html)});return(0,o.jsx)("div",{className:"blocks-search__result","data-type":B.type,children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:H=>m(H,Xe({html:B.html}),"common",B.title,B),onDragStart:H=>f(H,Xe({html:B.html}),"common",B.title,B),onMouseEnter:()=>Qe({html:Xe({html:r.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+B.html+"</table>")}),title:B.title}),onMouseLeave:()=>O(),children:[W(B),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:b,onContentLoad:ie,style:{transform:`scale(${A})`}})]})},B.id+F.toString())})})," "]}),(Ne||Pe)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),oe&&(0,o.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:p("There are no blocks for this request.")})]})]})};_r.propTypes={};var wa=({comments:e,subjectId:i,isLoggedIn:l,projectTitle:s="",emailElementType:a,email:d})=>{const{__:c,_n:m}=r.useI18n(),f=r.useSendPostMessage(),g=r.useNotification(),{token:E}=(0,t.ui_kit$useToken)(),h=r.useAppConfig(),p=r.usePushToDataLayer(),S=(0,n.useRef)(null),[k,x]=(0,n.useState)(""),[T,I]=(0,n.useState)("ADD"),[L,y]=(0,n.useState)(!1),[C,P]=(0,n.useState)(null),[K,M]=(0,n.useState)(null),[$,A]=(0,n.useState)(""),[W,se]=(0,n.useState)(""),[R,te]=(0,n.useState)(!1),[he,be]=(0,n.useState)(""),[Ie,xe]=r.useAddCommentMutation(),[Be,ke]=r.useDeleteCommentMutation(),[ne,He]=r.useEditCommentMutation(),[Fe,Se]=r.useDeleteTargetMutation(),[ye]=r.useAutoSaveBlockMutation(),re=r.useDispatch(),q=r.useStore(),X=r.useCurrentUser(),Q=r.useCurrentProjectRequested(),Z=r.useContentReader(),U=ce=>{const fe=r.getEmailDocuments(fo.getContainer(q));fe.save("anchor",{project:ce}).then(v=>{const ie=v?fe.revisionFacts()?.lastRevisionAt:void 0;ie!==void 0&&d?.id!=null&&re(r.rememberAutosaveTime({emailId:d.id,modified:new Date(ie).toISOString()}))})},V=()=>{const ce=Q;if(a==="email"){U(ce);return}const fe={...d?.meta!==void 0?{meta:d.meta}:{},title:d?.title,emailId:d?.id,project:ce,html:Z(),excerpt:d?.date_gmt};ye({blockId:d?.id,body:fe}).catch(v=>{})};function J(ce){te(!1),be(""),f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:he}),y(!0),f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!0})}function de(){M(C),e.filter(ce=>ce.parent===C).length?ne({commentId:C,status:"deleted"}).unwrap():Be(C),document.querySelector('.discuss-main li[id="'+C+'"] .comment-icon-target')?.getAttribute("target-id")&&f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:document.querySelector('.discuss-main li[id="'+C+'"] .comment-icon-target')?.getAttribute("target-id")}),V(),be("")}function me(ce){M(C);const fe=e.find(ie=>ie.id?.toString()===C),v=fe?.target_id?.toString()||"";te(!!v),be(v),se(fe?.content?.slice(3,-5)?.toString()),I("EDIT")}function pe(ce){M(C),A(""),I("REPLY")}const Ae=()=>{g.error({mask:{closable:!0},centered:!0,title:c("Please log in"),content:(r.isUseBlocksBuild()?c("To leave comments you must be logged into Blocks and added to the project "):c("To leave comments you must be logged into EmailMaker and added to the project "))+`${s}.`,okText:c("Okay. I'll log in.")})};async function we(){l?(await ne({commentId:K,content:W,targetId:he}).unwrap(),I("ADD"),se(""),M(0),te(!1),y(!1),be(""),f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Ae()}const $e=ce=>{I("ADD"),se(""),M(0),te(!1),y(!1),be(""),f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})},Y=async()=>{l?((k||$)&&await Ie({subjectId:i,author:X.id,parent:T==="ADD"?"0":K,content:k||$,author_name:X.name,author_email:X.email,targetId:he}).then(ce=>{if(ce.error){const{data:fe}=ce.error;g.error({title:fe?.code??c("Error"),description:fe?.message??c("Something went wrong. Try again later.")})}else p({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(""),I("ADD"),A(""),x(""),M(0),te(!1),y(!1),f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Ae()};function le(){R?(y(!1),te(!1),f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:he})):(y(!L),f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!L}),L&&te(!1))}function Ce(ce){let fe=JSON.parse(JSON.stringify(ce));if(!fe||!fe.length)return[];let v=[],ie=new Map;for(let Re=0,Oe=fe.length;Re<Oe;++Re){let De=fe[Re],Ge=ie.get(De.id);if((!Ge||Array.isArray(Ge))&&(Ge&&(De.children=Ge),ie.set(De.id,De)),String(De.parent)==="0")v.push(De);else{let Qe=ie.get(De.parent);Qe?(Array.isArray(Qe)?Qe:Qe.children=Qe.children||[]).push(De):ie.set(De.parent,[De])}}return v.forEach(Re=>{Re.status==="deleted"&&!Re.children&&(ke.isUninitialized||ke.isSuccess)&&Be(Re.id).unwrap().catch(Oe=>{})}),v}const G=ce=>{const fe=ce.data.operation;if(fe===r.EVENT_TYPES.APPLICATION_DISCUSS_SET_ID&&(be(ce.data.settings.value),ce.data.settings.value!==""?(te(!0),y(!1)):(te(!1),y(!0))),fe===r.EVENT_TYPES.APPLICATION_DISCUSS_SAVE_TARGET&&V(),fe===r.EVENT_TYPES.APPLICATION_DISCUSS_GET_COMMENT)if(document.querySelector('.comment-icon-target[target-id="'+ce.data.settings.targetId+'"]')){let v=document.querySelector('.comment-icon-target[target-id="'+ce.data.settings.targetId+'"]').closest(".ant-comment");document.querySelector(".comment-block")?document.querySelector(".comment-block").scrollTo(0,v.offsetTop):document.querySelector(".em-analytics__email-tab-discuss .ant-tabs-content").scrollTo(0,v.offsetTop),v.classList.add("active"),setTimeout(()=>{v.classList.remove("active")},2e3)}else f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:ce.data.settings.targetId}),g.error({title:c("There's no such comment.")});fe===r.EVENT_TYPES.APPLICATION_DISCUSS_NO_COMMENT&&g.error({title:c("There's no such element in the email.")})};r.useListenPostMessage(G);const Te=ce=>{f({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_GET_TARGET,value:ce})},Ne=ce=>(ce?.sort((fe,v)=>fe.date>v.date?1:-1),(0,o.jsx)(o.Fragment,{children:ce&&!!ce.length&&(0,o.jsx)(t.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:ce,renderItem:fe=>(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("li",{id:fe.id,children:(0,o.jsxs)(o.Fragment,{children:[fe.status==="deleted"&&fe.clildren&&(0,o.jsx)(t.ui_kit$Comment,{className:"deletedComment",content:(0,o.jsx)(t.ui_kit$Alert,{description:c("Comment was removed."),type:"info"}),children:Ne(fe.children)}),fe.status!=="deleted"&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Comment,{author_id:fe.author_id,author:fe.author_name,avatar:fe.author_avatar_urls&&fe.author_avatar_urls[48]||"",className:(0,We.default)(fe.target_id&&"targetted-comment-item",(!fe.author_avatar_urls||!fe.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>P(fe.id),menu:{items:fe.author===X.id?Ue:ze},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,o.jsx)("div",{onClick:()=>fe.target_id&&Te(fe.target_id),dangerouslySetInnerHTML:{__html:fe.content}})},"commenMenu"),datetime:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:fe.date&&r.formatDate(r.tryParseISO(fe.date),m,!0)}}),fe.target_id&&(0,o.jsx)("span",{className:"comment-icon-target","target-id":fe.target_id,onClick:()=>Te(fe.target_id),children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,style:{color:E.colorInfo,top:-2,position:"relative"}})})]}),children:(0,o.jsxs)(o.Fragment,{children:[T==="REPLY"&&K===fe.id&&Me,T==="EDIT"&&K===fe.id&&Pe,Ne(fe.children)]})})})]})})})})})),Pe=(0,o.jsxs)(t.ui_kit$Form,{onFinish:we,className:"commentForm",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{className:"textarea-reply",value:W,onChange:ce=>se(ce.target.value),rows:4,placeholder:c("Editing comments"),onKeyDown:ce=>ce.key==="Escape"&&$e(),onPressEnter:ce=>ce.key==="Enter"&&ce.ctrlKey&&we(),ref:S})}),(0,o.jsx)(t.ui_kit$Form.Item,{className:"buttons",children:(0,o.jsxs)(t.ui_kit$Space,{children:[R?(0,o.jsx)(t.ui_kit$Popconfirm,{title:c("Are you sure?"),okText:c("Yes"),cancelText:c("No"),onConfirm:J,children:(0,o.jsx)(t.ui_kit$Button,{loading:Se.isLoading,type:L||R&&T==="EDIT"&&he!==""?"primary":"default",className:"button-target "+(L&&!R?"button-target_choose":""),style:R&&T==="EDIT"&&he!==""?{background:E.colorInfo}:{},children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,className:"icon-target"})})}):(0,o.jsx)(t.ui_kit$Button,{onClick:le,loading:Se.isLoading,type:L||R&&T==="EDIT"&&he!==""?"primary":"default",className:"button-target "+(L&&!R?"button-target_choose":""),style:R&&T==="EDIT"&&he!==""?{background:E.colorInfo}:{},children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,className:"icon-target"})}),(0,o.jsxs)(t.ui_kit$Button,{className:"button-reply",type:"primary",loading:He.isLoading,htmlType:"submit",children:[c("Save")," ",(0,o.jsx)(r.EmIcons,{icon:"SaveOutlined",component:t.icons$SaveOutlined,size:16,strokeWidth:h.iconStrokeWidth})]}),(0,o.jsx)(t.ui_kit$Button,{onClick:$e,className:"button-reply",children:c("Cancel")})]})})]}),Me=(0,o.jsxs)(t.ui_kit$Form,{name:"reply",className:"commentForm",onFinish:Y,children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{className:"textarea-reply",value:$,onChange:ce=>A(ce.target.value),rows:4,placeholder:c("Reply to the comment"),onKeyDown:ce=>ce.key==="Escape"&&$e(),onPressEnter:ce=>ce.key==="Enter"&&ce.ctrlKey&&Y(),ref:S})}),(0,o.jsx)(t.ui_kit$Form.Item,{hidden:!0,name:"targetId",children:(0,o.jsx)(t.ui_kit$Input,{type:"hidden"})}),(0,o.jsx)(t.ui_kit$Form.Item,{className:"buttons",children:(0,o.jsxs)(t.ui_kit$Space,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:c("Add a note"),styles:{body:{maxWidth:"150px"}},children:(0,o.jsx)(t.ui_kit$Button,{onClick:le,type:L||R&&T==="REPLY"&&he!==""?"primary":"default",className:"button-target "+(L&&!R?"button-target_choose":""),style:R&&T==="REPLY"&&he!==""?{background:E.colorInfo}:{},children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,className:"icon-target"})})}),(0,o.jsxs)(t.ui_kit$Button,{className:"button-reply",type:"primary",loading:T==="REPLY"&&xe.isLoading,htmlType:"submit",children:[c("Reply")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:h.iconStrokeWidth})]}),(0,o.jsx)(t.ui_kit$Button,{onClick:$e,className:"button-reply",ghost:!0,type:"primary",children:c("Cancel")})]})})]});(0,n.useEffect)(()=>{T==="REPLY"&&S.current.focus({cursor:"start"}),T==="EDIT"&&S.current.focus({cursor:"end"})},[T]);let Ue=[];Ue.push({key:"Reply to comment",icon:(0,o.jsx)(r.EmIcons,{icon:"RollbackOutlined",component:t.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:pe},{key:"Edit comment",icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,style:{fontSize:"16px"}}),label:c("Edit"),onClick:me},{key:"Delete comment",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16}),label:c("Delete"),style:{color:E.colorError},onClick:de});let ze=[];return ze.push({key:"Reply to comment",icon:(0,o.jsx)(r.EmIcons,{icon:"RollbackOutlined",component:t.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:pe}),(0,o.jsxs)("div",{className:"discuss-main",children:[e.length>0&&(0,o.jsx)(t.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:Ce(e),renderItem:ce=>(0,o.jsxs)("li",{id:ce.id,children:[ce.comment_status==="deleted"&&(0,o.jsx)(t.ui_kit$Comment,{className:"deletedComment",content:(0,o.jsx)(t.ui_kit$Alert,{description:c("Comment was removed."),type:"info"}),children:Ne(ce.children)}),ce.comment_status!=="deleted"&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Comment,{author_id:ce.author_id,author:ce.author_name,avatar:ce.author_avatar_urls&&ce.author_avatar_urls[48]||"",className:(0,We.default)(ce.target_id&&"targetted-comment-item",(!ce.author_avatar_urls||!ce.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>P(ce.id),menu:{items:ce.author===X.id?Ue:ze},styles:{root:{minWidth:"auto"}},children:(0,o.jsx)("div",{onClick:()=>ce.target_id&&Te(ce.target_id),dangerouslySetInnerHTML:{__html:ce.content}})},"commenMenu"),datetime:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:ce.date&&r.formatDate(r.tryParseISO(ce.date),m,!0)}}),ce.target_id&&(0,o.jsx)("span",{className:"comment-icon-target","target-id":ce.target_id,onClick:()=>Te(ce.target_id),children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,style:{color:E.colorInfo,top:-2,position:"relative"}})})]}),children:(0,o.jsxs)(o.Fragment,{children:[T==="REPLY"&&K===ce.id&&Me,T==="EDIT"&&K===ce.id&&Pe,Ne(ce.children)]})})})]})}),(0,o.jsxs)(t.ui_kit$Form,{onFinish:Y,className:T==="ADD"?"addMode":"replyEditMode",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{value:k,onChange:ce=>x(ce.target.value),rows:4,placeholder:c("Leave your comment"),className:"textarea-comment",onPressEnter:ce=>ce.key==="Enter"&&ce.ctrlKey&&Y()})}),(0,o.jsx)(t.ui_kit$Form.Item,{children:(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:c("Add a note"),styles:{body:{maxWidth:"150px"}},children:(0,o.jsx)(t.ui_kit$Button,{onClick:le,type:L||R&&T==="ADD"&&he!==""?"primary":"default",className:"button-target "+(L&&!R?"button-target_choose":""),style:R&&T==="ADD"&&he!==""?{background:E.colorInfo}:{},icon:(0,o.jsx)(r.EmIcons,{icon:"Target",component:t.icons$Target,size:16,strokeWidth:h.iconStrokeWidth,className:"icon-target"})})}),(0,o.jsxs)(t.ui_kit$Button,{className:"button-add",type:"primary",loading:T==="ADD"&&xe.isLoading,htmlType:"submit",children:[c("Send")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:h.iconStrokeWidth})]})]})})]})]})},xm=["common_styles","subject","preheader","meta"];function km(e,i){r.writeSourceReport(e,r.fromRevision(i))}function Em(e){if(!e)return null;const i=e.get().attributes??{},l={};for(const s of xm)i[s]!==void 0&&(l[s]=i[s]);return{content:e.getContent(),attributes:l}}function ja(e,i){i&&r.writeSourceReport(e,{content:i.content,attributes:i.attributes})}var va=(e,i)=>({key:e.id,author:e.author,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}),xr=({emailElement:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),s=r.useDispatch(),a=r.useEditorProjectId(),d=r.useEmailAttributesWriter(),c=r.useContentReplacer(),m=r.useEditorLocked(),f=r.useEditorLockCheck(),{document:g}=r.useDocumentSessionContext(),E=r.useSelector(r.selectHistoryData),h=r.useDocumentHistoryReader(),p=r.useSelector(r.selectElementHistoryHasMore),S=r.useSelector(r.selectIsPanelHistoryCollapsed),[k,x]=(0,n.useState)(!0),[T,I]=(0,n.useState)(!1),[L,y]=(0,n.useState)([]),[C,P]=(0,n.useState)([]),K=re=>s(r.switchIsPanelHistoryCollapsed(re)),M=(0,n.useCallback)(re=>{if(!re?.html||f())return;const q=r.fromRevision(re);q?.attributes&&d(q.attributes),s(r.markAppearanceNeedsUpdate());const X=g?.get().version;c(re.html,{undoable:!0}),g&&g.get().version===X&&g.markUnsaved()},[c,s,d,g,f]),$=(0,n.useCallback)(re=>{km(g,re),s(r.markAppearanceNeedsUpdate())},[g,s]),{data:A}=r.projectsApi.useGetProjectQuery(Number(a),{skip:!a}),[W,se]=(0,n.useState)([]);(0,n.useEffect)(()=>{if(A){const{owner:re,admins:q,users:X}=A?.members;se([re&&{...re},q&&Array.isArray(q)&&q.map(Q=>({...Q})),X&&Array.isArray(X)&&X.map(Q=>({...Q}))].filter(Q=>Q).flat(1).map(Q=>({id:Q.ID,display_name:Q.display_name})))}},[A,A?.members,i]);const[R,te]=(0,n.useState)(1),[he,be]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const re=Array.isArray(E)&&E.length&&E?.map(q=>va(q,i));P(re||[]),y(re),x(!1),p||be(!0)},[E,p,i]);const Ie=()=>{I(!0),P(L.concat([...new Array(3)].map(()=>({loading:!0})))),h(e.id,R+1).then(re=>{if(re.isStale)return;const{data:q,hasMore:X}=re.data,Q=Array.isArray(q)&&q?.map(U=>va(U,i)),Z=L.concat(Q);P(Z),y(Z),I(!1),window.dispatchEvent(new Event("resize")),X||be(!0),te(R+1)})},xe=!k&&!T&&!he?(0,o.jsx)("div",{style:{textAlign:"center",marginTop:24,marginBottom:24,height:32,lineHeight:"32px"},children:(0,o.jsx)(t.ui_kit$Button,{onClick:Ie,children:i("loading more")})}):null,[Be,ke]=(0,n.useState)(),[ne,He]=(0,n.useState)(null),Fe=(0,n.useCallback)(re=>{M(re),ke(null),He(null),l({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),s(r.resetToLastActiveSettingsTab())},[M,l,s]),Se=(0,n.useRef)(void 0);(0,n.useEffect)(()=>{!S&&!ne&&(Se.current=g,He(Em(g)))},[S,He,g,ne]),(0,n.useEffect)(()=>{S&&ne&&(Se.current===g&&(ja(g,ne),s(r.markAppearanceNeedsUpdate())),He(null))},[S,ne,g,s]);const ye=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse secondary-tabs_unset_scroll",size:"large",activeKey:r.HISTORY,items:[{label:(0,o.jsx)(o.Fragment,{children:i("Version history")}),key:r.HISTORY,forceRender:!0,className:"email-settings__collapse-panel",style:{height:"100%"},children:(0,o.jsx)(t.ui_kit$List,{className:"history-panel__list",loading:k,itemLayout:"horizontal",loadMore:xe,dataSource:C,header:(0,o.jsxs)("div",{className:"history-panel__list-header",children:[(0,o.jsx)("div",{className:"history-panel__list-date",children:i("Time")}),(0,o.jsx)("div",{className:"history-panel__list-author",children:i("Author")}),(0,o.jsx)("div",{className:"history-panel__restore",children:"Set"})]}),renderItem:(re,q)=>(0,o.jsx)(t.ui_kit$List.Item,{onClick:()=>{q!==Be&&(ke(q),$(L[q])),s(r.setBlockSettingsDisable(!0))},className:(0,We.default)("history-panel__item",{"history-panel__item_active":q===Be}),children:(0,o.jsxs)(t.ui_kit$Skeleton,{title:!1,loading:re.loading||!1,active:!0,children:[(0,o.jsx)("div",{className:"history-panel__list-date",children:re.date}),(0,o.jsx)("div",{className:"history-panel__list-author",children:ye.revisionService?re.author:W.find(X=>X.id?.toString()===re.author?.toString())?.display_name||"–"}),re.isAutosave&&Be!==q&&(0,o.jsx)("div",{style:{opacity:.45},className:"history-panel__list-autosave",children:i("Auto")}),!re.isAutosave&&(0,o.jsx)(t.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",disabled:m,onClick:X=>{Be===q&&X.stopPropagation(),Fe(L[q])},children:i("Set")}),re.isAutosave&&Be===q&&(0,o.jsx)(t.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",disabled:m,onClick:X=>{Be===q&&X.stopPropagation(),Fe(L[q])},children:i("Set")})]})})})}]}),(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"ant-modal-close","aria-label":"Close",onClick:()=>{s(r.resetToLastActiveSettingsTab()),ne&&ja(g,ne),He(null),K(!0),l({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1})},children:(0,o.jsx)(r.EmIcons,{icon:"Close",component:t.icons$Close})})]})};xr.propTypes={};var Ia=async({blockTags:e,projectTagsArray:i,addTerm:l,project:s,notification:a})=>{if(!e||e.length===0)return[];const d=e.map(c=>{const m=i.find(f=>f.name===c);return m?Promise.resolve(m.id):l({project:s,kind:r.BLOCK_TAGS,name:c}).then(({error:f,data:g})=>{if(f?.status===400)return r.existingTermIdFromError(f);if(g)return g.id;if(f)return a.fromError("TAG_CREATING_ERROR",c,f),null})});return(await Promise.all(d)).filter(c=>c!=null)},Ca=()=>{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))},Bm=async e=>{const{block:i,form:l,projectData:s,projectTagsArray:a,projectId:d,addBlock:c,editBlock:m,editProject:f,addTerm:g,notification:E,__:h,handleCloseModal:p,htmlContent:S,refetchBlocks:k,reloadBlockScreens:x,onGlobalBlockTemplateSynced:T}=e;try{const{valid:I,values:L,blockTags:y}=await Pa({form:l,notification:E,__:h});if(!I)return;const C=await Ia({blockTags:y,projectTagsArray:a,addTerm:g,project:s,notification:E});await Na({block:i,form:l,projectId:d,htmlContent:S,values:L,tagIds:C,addBlock:c,editBlock:m,editProject:f,notification:E,refetchBlocks:k,reloadBlockScreens:x,projectTagsArray:a,__:h,handleCloseModal:p,onGlobalBlockTemplateSynced:T})}catch{}},Pa=async({form:e,notification:i,__:l})=>{let s=!0;const a=await e.validateFields(),d=a.tags;return d?.length>10&&(i.error({id:"BLOCK_TOO_MANY_TAGS_ERROR",data:r.getBlockDesc(a),title:l("Maximum 10 tags available.")}),s=!1),{valid:s,values:a,blockTags:d}};function Aa(e){if(e!==null&&typeof e=="object"&&"data"in e){const i=e.data;return{code:i?.code,message:i?.message}}return{}}async function Sm(e){const{created:i,blockData:l,editBlock:s,onGlobalBlockTemplateSynced:a}=e;if(!i.id)return;const d=new Date,c=r.formatEmBlockVersion(d);if(s){const m=i.html??l.html??"",f=r.injectEmBlockIdIntoBlockHtml(m,String(i.id),d);f!==m&&await s({blockId:String(i.id),html:f})}a?.(String(i.id),c)}function Tm(e){const{block:i,projectId:l,htmlContent:s,values:a}=e;return i?{title:i.blockTitle,project:i.projectId,html:i.htmlContent,type:i.blockType||"Other",global_block:!1}:{title:a?.title??"",project:l,html:s||"",type:a?.type||"Other",...a?.global_block===!0?{global_block:!0}:{}}}var Na=async({block:e,form:i,projectId:l,htmlContent:s,values:a,tagIds:d,addBlock:c,editBlock:m,editProject:f,notification:g,refetchBlocks:E,reloadBlockScreens:h,projectTagsArray:p,__:S,handleCloseModal:k,onGlobalBlockTemplateSynced:x})=>{const T=Tm({block:e,projectId:l,htmlContent:s,values:a}),I=await c({...T,blocktags:d.join(",")});if(I.error){const P=Aa(I.error);throw g.error({id:"BLOCK_CREATING_ERROR",data:{title:T.title,code:T.html},innerException:I.error,message:P.code,description:P.message}),i.resetFields(),k(),new Error("Ошибка создания блока")}const L=I.data;!e&&a?.global_block===!0&&L?.id&&await Sm({created:L,blockData:T,editBlock:m,onGlobalBlockTemplateSynced:x}),e||(i.resetFields(),k());const y=p.map(P=>P.id),C=await f({projectId:l,blocktags:[...new Set([...y,...d])].join(",")});if(C.error){const P=Aa(C.error);g.error({message:P.message,code:P.code})}else!e&&E&&(g.success({id:"BLOCK_CREATING_SUCCESS",data:r.getBlockDesc(I.data),message:S("The block “")+String(I.data?.title??"")+S("” was successfully created.")}),E());return!e&&h&&h(),I.data},kr=({isModalVisible:e,htmlContent:i,projectId:l,setIsShowAddAllBlocksModal:s,setIsShowAddAllBlocksModalForNewEmail:a})=>{const{__:d}=r.useI18n(),c=r.useDispatch(),[m]=t.ui_kit$Form.useForm(),[f,g]=(0,n.useState)([]),[E,h]=r.useAddBlockMutation(),[p]=r.useEditBlockMutation(),{data:S}=r.useGetBlocksSchemaQuery(),k=r.useNotification(),x=r.useAppConfig(),[T,I]=(0,n.useState)([]),L=r.useProjectData(),{refetch:y}=r.useGetBlocksQuery(r.projectBlocksArgs(l)),[C,P]=r.useAddTermMutation(),[K,M]=r.useEditProjectMutation(),$=r.useSendPostMessage(),A=(0,n.useCallback)((he,be)=>{$({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:he,...be?{emBlockVersion:be}:{}}})},[$]),{data:W}=r.useGetTermsQuery({project:L,kind:r.BLOCK_TAGS},{skip:!L?.id});(0,n.useEffect)(()=>{I((W||[]).map(he=>({value:he.name})))},[W]),(0,n.useEffect)(()=>{if(S){const he=S.schema.properties.acf.properties.type.items.enum;let be=[];for(let Ie in he)be.push({label:d(r.TYPES_TRANSLATE[he[Ie]]),value:he[Ie]});g(be)}},[S,d]);const se=()=>{c(r.closeModal())},R=()=>{s(!0),a(!1),se()},te=async()=>{await Bm({form:m,projectData:L,projectTagsArray:W||[],projectId:l,addBlock:E,editBlock:p,editProject:K,addTerm:C,notification:k,__:d,handleCloseModal:se,htmlContent:i,refetchBlocks:y,reloadBlockScreens:Ca,onGlobalBlockTemplateSynced:A})};return(0,o.jsx)(t.ui_kit$Modal,{title:(0,o.jsx)("div",{className:"ant-modal-title",children:d("Save block")}),open:e,onOk:()=>R(),onCancel:se,footer:(0,o.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",padding:"8px 0"},children:[(0,o.jsx)(t.ui_kit$Button,{size:"large",onClick:R,children:d("Save all blocks")},"create-all-blocks"),(0,o.jsx)(t.ui_kit$Button,{className:"add-new-block-modal__save-btn",size:"large",type:"primary",loading:h.isLoading,onClick:te,icon:(0,o.jsx)(r.EmIcons,{icon:"CreateBlock",component:t.icons$CreateBlock,style:{fontSize:22}}),children:d("Save block")},"submit")]}),children:(0,o.jsxs)(t.ui_kit$Form,{form:m,layout:"vertical",name:"add_new_block_form",onFinish:te,initialValues:{title:"",type:"",tags:[],global_block:!1},autoComplete:"off",children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:16,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Block name"),name:"title",rules:[{required:!0,message:d("Please input block name")}],style:{marginBottom:15},children:(0,o.jsx)(t.ui_kit$Input,{disabled:h.isLoading||P.isLoading||M.isLoading,size:"large",placeholder:d("Enter block name"),spellCheck:"false"})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Type"),name:"type",rules:[{required:!0,message:d("Please choose block type")}],style:{marginBottom:15},children:(0,o.jsx)(t.ui_kit$Select,{disabled:h.isLoading||P.isLoading||M.isLoading,size:"large",placeholder:d("Choose block type"),options:f})})})]}),x.tagsEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Tags"),name:"tags",children:(0,o.jsx)(t.ui_kit$Select,{size:"large",mode:"tags",placeholder:d("Add some tags"),tooltip:{title:d("Tags help you find the block in the list."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},disabled:h.isLoading||P.isLoading||M.isLoading,options:T})}),x.globalBlockCheckboxEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{name:"global_block",valuePropName:"checked",style:{marginBottom:15},children:(0,o.jsx)(t.ui_kit$Switch,{label:d("Global block"),disabled:h.isLoading||P.isLoading||M.isLoading})})]})})};kr.propTypes={};var Rm="https://app.emailmaker.ru/api/".replace(/\/+$/,""),ym=`${Rm}/wp-json/ai-generator/v1/identificate_blocks`,wm=["Menu","Header","Content","Banners","Lists","Buttons","Promocodes","Feature","Call to Action","E-Commerce","Articles","Polls","Applications","Separators","Contacts","Footer","Other"];async function jm(e){return await e.getInstance(fo.TOKEN_ID)}async function vm(e,i,l,s,a){const d={blocks:s,types:wm,locale:i};l.current=d;try{const c=await jm(a),m=await fetch(ym,{method:"POST",headers:{"Content-Type":"application/json",...c?{Authorization:`Bearer ${c}`}:{}},body:JSON.stringify(d)});if(!m.ok||m.status!==200)throw new Error(`${m.statusText}`);return await m.json()}catch(c){throw c}}var Im=(e,i="block")=>{const l=new DOMParser,s=l.parseFromString(e,"text/html"),a=s.querySelectorAll(`[em="${i}"]`),d=s.querySelectorAll("link");return{parser:l,document:s,blockElements:a,styleElement:s.querySelector('[em="styles"]'),linksElements:d}};function Cm(e){return Array.from(e).map(i=>i.outerHTML).join("")}var Pm=(e,i="block",l=!1)=>{if(!e?.html)return[];const{document:s,blockElements:a,styleElement:d,linksElements:c}=Im(e.html,i),m=Cm(c);if(!(a instanceof NodeList))return[];const f=s.querySelector("head"),g=f?f.innerHTML:"";return Array.from(a).map((E,h)=>{if(!(E instanceof Element)||!E.outerHTML)return null;const p=d?d.outerHTML:"";return{id:`${e.id}-${h}`,html:l?`<!DOCTYPE html>
|
|
23
|
+
<html>
|
|
24
|
+
<head>${g}</head>
|
|
25
|
+
<body>
|
|
26
|
+
<table>${E.outerHTML}</table>
|
|
27
|
+
</body>
|
|
28
|
+
</html>`:r.minifyHtml(`${m}${p}${E.outerHTML.replace(/class="em-structure"/,'class=""')}`)}}).filter(Boolean)};function Am(e,i,l){const{images:s}=e,{blocks:a}=i;return s?.map(d=>{const c=a.find(m=>m.id===d.block_id);return{blockType:d.classification,blockTitle:d.name,htmlContent:c?.html||"",projectId:l}})}var Nm=e=>e.replace(/<div\s+[^>]*style="font-family:[^>]*>(.*?)<\/div>/gs,i=>i.replace(/>(.*?)<\/div>/s,"></div>")),Lm=e=>e.replace(/src="[^"]*"/g,'src=""'),Om=e=>/<div\s+[^>]*style="font-family:/i.test(e),$m=e=>{const i=new Set,l=[];for(const s of e)if(Om(s.html)){const a=Lm(Nm(s.html));i.has(a)||(i.add(a),l.push(s))}else l.push(s);return l},Fm=async e=>{const{block:i,form:l,projectData:s,projectId:a,addBlock:d,editProject:c,notification:m,__:f,handleCloseModal:g,htmlContent:E,refetchBlocks:h,reloadBlockScreens:p,values:S,tagIds:k,projectTagsArray:x}=e;try{await Na({block:i,form:l,projectId:a,htmlContent:E,values:S,tagIds:k,addBlock:d,editProject:c,notification:m,refetchBlocks:h,reloadBlockScreens:p,projectTagsArray:x,__:f,handleCloseModal:g})}catch(T){throw T}},Mm=({projectData:e,addTerm:i,addBlock:l,editProject:s,reloadBlockScreens:a,notification:d,__:c,handleCloseModal:m,setTriggerOpenSavedBlocksTab:f,setTagsOptions:g,form:E,projectId:h})=>{const[p,S]=(0,n.useState)(!1),k=r.useInvalidateProject(),{data:x}=r.useGetTermsQuery({project:e,kind:r.BLOCK_TAGS},{skip:!e?.id});return(0,n.useEffect)(()=>{g((x||[]).map(I=>({value:I.name})))},[x,g]),{bulkSave:async(I,L,y,C)=>{S(!0);try{if(!L)return;const P=await Ia({blockTags:C,projectTagsArray:x||[],addTerm:i,project:e,notification:d});let K=!0,M=0;for(const $ of I)try{await Fm({block:$,form:E,projectData:e,projectId:h,addBlock:l,editProject:s,notification:d,__:c,handleCloseModal:m,values:y,tagIds:P,projectTagsArray:x||[]})}catch{K=!1,M++}if(K&&d.success({id:"BULK_SAVE_SUCCESS",title:c("All blocks saved successfully."),placement:"bottomRight"}),!K){if(M===I.length)throw new Error;d.warning({id:"BULK_SAVE_PARTIAL_SUCCESS",title:c("Some blocks were not saved successfully."),placement:"bottomRight"})}f(!0),k(h),a()}catch(P){throw P}finally{S(!1),E.resetFields(),m()}},confirmSavingBlocksLoading:p}},Er=({isModalVisible:e,currentEmail:i,setIsShowAddAllBlocksModal:l,setTriggerOpenSavedBlocksTab:s,projectId:a})=>{const{__:d,_n:c,sprintf:m}=r.useI18n(),f=r.useContainer(),g=r.useProjectData(),{tagsEnabled:E}=r.useAppConfig(),[h,p]=(0,n.useState)(!1),[S]=t.ui_kit$Form.useForm(),[k,x]=(0,n.useState)([]),[T,I]=(0,n.useState)([]),L=(0,n.useRef)({}),[y]=r.useAddTermMutation(),[C]=r.useEditProjectMutation(),[P,K]=r.useAddBlockMutation(),M=r.useEditorLocale()||void 0,$=Pm(i),A=$m($).map(Ie=>Ie),W=A.length,se=r.useNotification(),R=()=>{h||he||l(!1)},{bulkSave:te,confirmSavingBlocksLoading:he}=Mm({projectData:g,addTerm:y,addBlock:P,editProject:C,reloadBlockScreens:Ca,notification:se,__:d,handleCloseModal:R,setTriggerOpenSavedBlocksTab:s,setTagsOptions:I,form:S,projectId:a}),be=async()=>{try{const{valid:Ie,values:xe,blockTags:Be}=await Pa({form:S,notification:se,__:d});s(!1),p(!0);const ke=await vm(i,M,L,A,f),ne=r.wpProjectId(i.project,a??g?.id),He=Am(ke,L.current,String(ne??""));p(!1),await te(He,Ie,xe,Be)}catch{p(!1),l(!1),se.error({title:d("Failed to save blocks."),placement:"bottomRight"})}};return(0,o.jsxs)(t.ui_kit$Modal,{title:(0,o.jsx)("div",{className:"ant-modal-title",children:d("Bulk saving of blocks")}),open:e,onOk:be,onCancel:R,footer:(0,o.jsx)("div",{className:"modal-footer",children:!(h||he)&&(0,o.jsx)(t.ui_kit$Button,{size:"large",type:"primary",disabled:h||he,onClick:be,children:m(c("Save %d block","Save %d blocks",W),W)},"submit")}),children:[h||he?(0,o.jsx)("div",{children:d("All blocks saved at this point can be found in the “Saved Blocks” section in the sidebar.")}):(0,o.jsx)("div",{children:m(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.",W),W)}),!(h||he)&&E&&(0,o.jsx)(t.ui_kit$Form,{form:S,name:"add_all_blocks_form",layout:"vertical",onFinish:be,style:{paddingTop:24},children:(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Tags"),name:"tags",labelCol:{span:24},wrapperCol:{span:24},style:{display:"block",marginBottom:0},children:(0,o.jsx)(t.ui_kit$Select,{size:"large",mode:"tags",placeholder:d("Add some tags"),style:{width:"100%"},value:k,onChange:x,disabled:K.isLoading,options:T})})}),(he||h)&&(0,o.jsx)("div",{className:"modal-spinner",children:(0,o.jsx)(t.ui_kit$Spin,{size:"large"})})]})};Er.propTypes={};var Dm=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"),Br=({isModalVisible:e=!1,email:i=null})=>{const{__:l}=r.useI18n(),[s]=t.ui_kit$Form.useForm(),a=r.useDispatch(),d=r.useRouteEmailId(),c=r.useNotification(),m=r.useCurrentUser(),f=r.useProjectData()?.projects_test_emails,[g,E]=r.useSendTestEmailMutation(),{token:h}=(0,t.ui_kit$useToken)(),[p,S]=(0,n.useState)(!1);r.useAppConfig(),r.useCookieManager();const k=r.useProjectData(),x=r.wpProjectId(i.project,k?.id)??i.project,T=d&&r.isEmailsV2Enabled()?r.wpEmailTarget({id:d,wpId:i.wpId},x)?.emailId:void 0,I=T!=null?String(T):d,{data:L}=r.useGetProjectTestRecipientsQuery(x??0,{skip:!0}),[y,C]=r.useEditProjectMutation(),[P]=r.usePutProjectTestRecipientsMutation(),K=r.useProjectData(),{testEmails:M}=r.useAppConfig(),$=r.usePushToDataLayer(),[A,W]=(0,n.useState)([]),[se,R]=(0,n.useState)(!1),te=r.useEventEmitter(fo.events.ON_SEND_EMAIL_MODAL_ID);(0,n.useEffect)(()=>{e?te.fire(i).then(Be=>{Be.some(ke=>ke===!1)?a(r.closeModal$1()):S(e)}):S(e)},[e,a,S,i,te]),(0,n.useEffect)(()=>{},[K,x,L]),(0,n.useEffect)(()=>{W(M.map(Be=>({value:Be})))},[M]),(0,n.useEffect)(()=>{const Be=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails);if(Be&&p&&s.getFieldValue("recipients")?.length===0){const ke=JSON.parse(Be);ke?.[x]&&s.setFieldsValue({recipients:ke[x]})}},[x,p,s]),(0,n.useEffect)(()=>{s.setFieldsValue({subject:i.subject})},[s,i.subject]);const he=()=>{a(r.closeModal$1()),s.resetFields()},be=r.useContentReader(),Ie=()=>{s.validateFields().then(()=>{const Be={user_id:m.id,project_id:x,email_id:I,subject:s.getFieldValue("subject"),email:s.getFieldValue("recipients").join(","),html:Dm(be())};g(Be).unwrap().catch(ke=>{c.error({error:{data:{code:ke?.data?.code,message:ke?.data?.message}}})}),R(!0),$({event:"submit",action:"send_test_email",entity_id:d,project_id:x,recipients_count:s.getFieldValue("recipients").length})}).catch(Be=>{})},xe=n.default.useRef(f);return xe.current=f,(0,n.useEffect)(()=>{const Be=xe.current;if(E.isSuccess&&se){E.data?.status;{const ke=[...new Set([...A.map(re=>re.value),...s.getFieldValue("recipients")])],ne=ke.map(re=>({projects_test_email:re}));((re,q)=>{if(!re||!q)return re===q;if(re.length!==q.length)return!1;const X=re.map(Z=>Z.projects_test_email).sort(),Q=q.map(Z=>Z.projects_test_email).sort();return X.every((Z,U)=>Z===Q[U])})(ne,r.isProjectsV2Enabled()?(L||[]).map(re=>({projects_test_email:re})):Be)||(r.isProjectsV2Enabled()?P({projectId:x,emails:ke}):y({projectId:x,projects_test_emails:ne}));const Fe=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails)?JSON.parse(localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails)):[];let Se=s.getFieldValue("recipients");localStorage.setItem(r.LOCAL_STORAGE_ITEMS.em_test_emails,JSON.stringify({...Fe,[x]:[...new Set(Se)]}));const ye=i.title||i.subject||l("Untitled email.").replace(/\.$/,"");c.success(l("The email “")+ye+l("” was successfully sent."))}R(!1),s.resetFields(),a(r.closeModal$1())}},[E,s,x,y,P,L,A,se,a,i.title,i.subject,c,C,l]),(0,n.useEffect)(()=>{C.isError&&(c.error(C),R(!1),s.resetFields(),a(r.closeModal$1()))},[a,C,s]),(0,n.useEffect)(()=>{s.setFieldsValue({subject:i.subject||i.title})},[i,s]),(0,o.jsx)(t.ui_kit$Modal,{width:572,title:(0,o.jsxs)("div",{style:{paddingBottom:8},children:[(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:20,strokeWidth:2})," ",l("Send a test email")]}),open:p,onCancel:he,footer:[(0,o.jsx)(t.ui_kit$Button,{size:"large",className:"em-analytics__email-send-test",type:"primary",htmlType:"submit",form:"Send mail",loading:C.isLoading,icon:(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:18,strokeWidth:2,className:"email-preview-menu__list-item-icon"}),onClick:Ie,disabled:E.isLoading,children:l("Send")},"submit")],forceRender:!0,children:(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"send_mail_form",initialValues:{subject:i.subject||i.title,recipients:[]},autoComplete:"off",children:[(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Subject"),name:"subject",rules:[{required:!1,message:l("Please type subject")}],children:(0,o.jsx)(t.ui_kit$Input,{size:"large",placeholder:l("Type subject")})}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Recipients"),name:"recipients",tooltip:{title:l("The test email will be sent to the specified addresses."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},rules:[{required:!0,validator:(Be,ke)=>ke.length>10?Promise.reject(new Error(l("A test email can be sent to a maximum of 10 addresses."))):ke.length!==0?ke.every(ne=>r.emailValidation.test(ne.toLowerCase()))?Promise.resolve():Promise.reject(new Error(l("Please type correct emails"))):Promise.reject(new Error(l("Please type emails")))}],children:(0,o.jsx)(t.ui_kit$Select,{size:"large",mode:"tags",placeholder:l("Add up to 10 recipients"),tooltip:{title:"Tooltip with customize icon",icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},options:A,tagRender:Be=>{const{label:ke,closable:ne,onClose:He}=Be,Fe=Se=>{Se.preventDefault(),Se.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:h.colorPrimary,onMouseDown:Fe,closable:ne,onClose:He,style:{borderRadius:6},children:ke})},getPopupContainer:()=>document.getElementById("send_mail_form")})})]})})};Br.propTypes={isModalVisible:_.default.bool,email:_.default.shape({html:_.default.string,subject:_.default.string})};var Vm=lo.__exportAll({AddAllBlocksModal:()=>Er,AddNewBlockModal:()=>kr,BlocksSearch:()=>_r,Discuss:()=>wa,DiscussAi:()=>sa,EmailProperties:()=>Vl,EmailSettings:()=>zi,EmailStyles:()=>Zi,FileManagerDataLayer:()=>Ea,HistoryPanel:()=>xr,LimitUpgradeModal:()=>si,Optimise:()=>_a,SaveBlockBtn:()=>yr.SaveBlockBtn,SelectedElementPanel:()=>dt,SendTestEmailModal:()=>Br});mo.AddAllBlocksModal=Er,mo.AddNewBlockModal=kr,mo.BlocksSearch=_r,mo.Discuss=wa,mo.DiscussAi=sa,mo.EmailProperties=Vl,mo.EmailSettings=zi,mo.EmailStyles=Zi,mo.FileManagerDataLayer=Ea,mo.HistoryPanel=xr,mo.LimitUpgradeModal=si,mo.LimitUpgradeModal$1=si,mo.Optimise=_a,mo.SaveBlockBtn=yr.SaveBlockBtn,mo.SelectedElementPanel=dt,mo.SendTestEmailModal=Br,mo.canonicalImageUrlKey=ft,mo.getImageDimensionsFromBlob=wr,mo.normalizeImageFormatForDisplay=$t,Object.defineProperty(mo,"panels_exports",{enumerable:!0,get:function(){return Vm}}),mo.resolveDataProviderPreview=vr,mo.shouldCountAiUsage=ur,mo.useImageBlobFetch=Ir,mo.useImageBlobResolver=Cr});
|