useblocks 1.3.11-dev.3 → 1.3.14
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/README.md +1 -1
- package/compat-globals.js +1 -1
- package/iframe/.vite/manifest.json +4 -4
- package/iframe/css/sandbox-dark.css +1 -1
- package/iframe/css/sandbox-light.css +1 -1
- package/iframe/css/sandbox.css +47 -17
- package/iframe/{iframe-eblock.5751e42b.html → iframe-eblock.cd84d2b9.html} +2 -2
- package/iframe/{iframe.5751e42b.html → iframe.cd84d2b9.html} +2 -2
- package/iframe/js/elMarkupHelper.CgToMPJX.js +278 -0
- package/iframe/js/{iframe-eblock.body.5751e42b.js → iframe-eblock.body.cd84d2b9.js} +1 -1
- package/iframe/js/iframe-eblock.js +2 -2
- package/iframe/js/{iframe.body.5751e42b.js → iframe.body.cd84d2b9.js} +2 -2
- package/iframe/js/iframe.js +2 -2
- package/package.json +1 -1
- package/runtime/react/index.js +1 -1
- package/static/core/{e037a420.js → 18b86617.js} +1 -1
- package/static/core/{1c7a6d45.js → 1a17438d.js} +1 -1
- package/static/core/{11dadbc0.js → 1c9acdf4.js} +1 -1
- package/static/core/{1c06cdb7.js → 1dfb486f.js} +1 -1
- package/static/core/{b55ae539.js → 209e2686.js} +1 -1
- package/static/core/{71727873.js → 2209544a.js} +1 -1
- package/static/core/243ff5f9.js +19 -0
- package/static/core/{516f59e7.js → 33588588.js} +1 -1
- package/static/core/{66113a18.js → 36ffa6e4.js} +1 -1
- package/static/core/{3d8e2478.js → 39d9efa2.js} +1 -1
- package/static/core/{c13b3d4f.js → 3a605273.js} +1 -1
- package/static/core/{e7e888c1.js → 4224aefb.js} +1 -1
- package/static/core/{3b65bc50.js → 4bfd6086.js} +1 -1
- package/static/core/{d9d5b376.js → 550803ff.js} +1 -1
- package/static/core/{b59c63d2.js → 555c0dda.js} +1 -1
- package/static/core/{2bed6a18.js → 5661be7c.js} +1 -1
- package/static/core/{bda2d9d5.js → 57948058.js} +1 -1
- package/static/core/{ef035f6b.js → 58c51568.js} +1 -1
- package/static/core/{3eeb4445.js → 5a21c667.js} +1 -1
- package/static/core/{76543cb2.js → 5cac7517.js} +1 -1
- package/static/core/{513e36bd.js → 5d315649.js} +1 -1
- package/static/core/{62855b97.js → 5f0554d8.js} +1 -1
- package/static/core/{347b0a0b.js → 605267a0.js} +1 -1
- package/static/core/{aee84e3d.js → 6100ddd2.js} +1 -1
- package/static/core/{94f9492b.js → 6c59da82.js} +1 -1
- package/static/core/{58dca22f.js → 87edea39.js} +1 -1
- package/static/core/{1c3a16fc.js → 8f57829b.js} +1 -1
- package/static/core/{8845436d.js → 91d46f38.js} +2 -2
- package/static/core/{d2cf6b4b.js → 92fb4e07.js} +1 -1
- package/static/core/{467344d4.js → 9d0b4233.js} +1 -1
- package/static/core/{dd008ec2.js → a8634edd.js} +1 -1
- package/static/core/{261a3a42.js → b4e4af36.js} +1 -1
- package/static/core/{c0a3f7d0.js → bff175af.js} +2 -2
- package/static/core/{e698ec22.js → c571b1dd.js} +1 -1
- package/static/core/{b9f553d7.js → c6114314.js} +1 -1
- package/static/core/{f8585ce6.js → ce93456f.js} +1 -1
- package/static/core/{f1b8515a.js → d4513bf2.js} +1 -1
- package/static/core/{d343e46e.js → de3f9bdc.js} +1 -1
- package/static/core/{8406bab5.js → e0282a25.js} +1 -1
- package/static/core/{7e329493.js → e35eca7d.js} +1 -1
- package/static/core/{11009bdf.js → e37ba502.js} +1 -1
- package/static/core/{257745eb.js → f4b9148a.js} +1 -1
- package/static/core/{6172f09a.js → f4e70f7f.js} +1 -1
- package/static/core/{5da33486.js → f9238279.js} +1 -1
- package/static/esm/delivery-libs.js +1 -1
- package/static/umd-runtime/{Cvm7BS4_.js → CyULsN57.js} +31 -31
- package/static/umd-runtime/DdK5piwW.js +1 -0
- package/static/umd-runtime/delivery-libs.BJHA1QD4.js +1 -0
- package/static/umd-runtime/runtime.DAdCc3rx.js +1 -0
- package/static/umd-runtime/{ui-kit.CoVNet0I.js → ui-kit.BZ4Y4jr2.js} +2 -2
- package/{useblocks-core.5751e42b.js → useblocks-core.cd84d2b9.js} +22 -22
- package/useblocks-esm.js +12 -12
- package/{useblocks-po.5751e42b.js → useblocks-po.cd84d2b9.js} +1 -1
- package/useblocks.d.ts +1 -1
- package/useblocks.js +12 -12
- package/vendor/useblocks-ui-kit/es/components/Custom/FormBackgroundSettings/index.js +3 -3
- package/vendor/useblocks-ui-kit/es/components/Custom/FormBorderRadiusInputs/index.js +6 -6
- package/vendor/useblocks-ui-kit/es/components/Custom/FormBoxShadowInputs/index.js +5 -5
- package/vendor/useblocks-ui-kit/es/components/Custom/FormPanel/FormPaddingInputs/index.js +69 -64
- package/vendor/useblocks-ui-kit/es/components/Custom/FormPanel/FormSizeInputs/index.js +5 -5
- package/vendor/useblocks-ui-kit/es/components/Custom/FormPanel/FormTypographyFields/index.js +5 -5
- package/vendor/useblocks-ui-kit/es/components/Custom/Inputs/DraggableInputNumber/index.js +41 -35
- package/vendor/useblocks-ui-kit/es/components/Layout/Splitter/index.js +5 -0
- package/vendor/useblocks-ui-kit/index.js +12 -11
- package/vendor/useblocks-ui-kit/package.json +1 -1
- package/iframe/js/elMarkupHelper.BpDXO-hq.js +0 -279
- package/static/core/ed65b5c3.js +0 -19
- package/static/umd-runtime/B7h7P1Np.js +0 -1
- package/static/umd-runtime/delivery-libs.BymXnePv.js +0 -1
- package/static/umd-runtime/runtime.Lgfb59e0.js +0 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
(function(){try{if(typeof document<"u"){var r=".blocks-app .form-editor-calendar-panel.panel-form{height:100%;min-height:0;max-height:100%}.blocks-app .form-editor-calendar-panel .panel-form__body.form-editor-calendar-panel__body{-webkit-overflow-scrolling:touch;flex:1;min-width:0;min-height:0;overflow:hidden auto}.blocks-app .form-editor-calendar-panel .panel-form__body-content{box-sizing:border-box;min-height:0}.blocks-app .form-editor-calendar-panel__title{font-size:16px;font-weight:600}.blocks-app .form-editor-calendar-panel__inner{box-sizing:border-box;padding:16px 20px 32px}.blocks-app .form-editor-calendar.ant-form-vertical>.ant-form-item{margin-bottom:20px}.blocks-app .form-editor-calendar__label-with-info{align-items:center;gap:6px;display:inline-flex}.blocks-app .form-editor-calendar__info-icon{color:var(--ub-colorTextSecondary);cursor:help;display:inline-flex}.blocks-app .form-editor-calendar__section-divider{margin:16px 0 20px}.blocks-app .form-editor-calendar__more-btn{margin-bottom:12px}.blocks-app .form-editor-calendar__expanded{flex-direction:column;gap:0;margin-top:8px;display:flex}.blocks-app .form-editor-calendar__expanded>.form-section:first-child>.form-section__header .form-section__title{padding-top:12px}.blocks-app .form-editor-calendar__section.form-section .form-section__body{padding-top:8px;padding-bottom:18px}.blocks-app .form-editor-calendar__bg-preview{align-items:center;gap:12px;margin-top:4px;padding-top:12px;display:flex}.blocks-app .form-editor-calendar__bg-chip{border-radius:calc(var(--ub-borderRadius) * 1px);border:1px solid var(--ub-colorBorderSecondary);justify-content:center;align-items:center;min-width:40px;height:36px;padding:0 10px;line-height:1;display:inline-flex}.blocks-app .form-editor-calendar__bg-chip--active{box-shadow:0 0 0 1px var(--ub-colorPrimaryBg)}.blocks-app .form-editor-calendar__full-width{width:100%}.blocks-app .form-editor-calendar__typography-stack{flex-direction:column;gap:16px;display:flex}.blocks-app .form-editor-calendar .form-border-radius-inputs,.blocks-app .form-editor-calendar .em-form-border-inputs{margin-top:4px}.blocks-app .form-editor-checkbox-panel.panel-form{height:100%;min-height:0;max-height:100%}.blocks-app .form-editor-checkbox-panel .panel-form__body.form-editor-checkbox-panel__body{-webkit-overflow-scrolling:touch;flex:1;min-width:0;min-height:0;overflow:hidden auto}.blocks-app .form-editor-checkbox-panel .panel-form__body-content{box-sizing:border-box;min-height:0}.blocks-app .form-editor-checkbox-panel__title{font-size:16px;font-weight:600}.blocks-app .form-editor-checkbox-panel__inner{box-sizing:border-box;padding:16px 20px 32px}.blocks-app .form-editor-checkbox.ant-form-vertical>.ant-form-item{margin-bottom:20px}.blocks-app .form-editor-checkbox__label-with-info{align-items:center;gap:6px;display:inline-flex}.blocks-app .form-editor-checkbox__info-icon{color:var(--ub-colorTextSecondary);cursor:help;display:inline-flex}.blocks-app .form-editor-checkbox__default-radios.em-radio.ant-radio-group,.blocks-app .form-editor-checkbox__shape-radios.em-radio.ant-radio-group{flex-wrap:wrap;align-items:center;gap:8px 24px;display:flex}.blocks-app .form-editor-checkbox__icon-toggle-group.em-radio.ant-radio-group{flex-wrap:nowrap;gap:6px;display:flex}.blocks-app .form-editor-checkbox__icon-toggle-group .ant-radio-button-wrapper{justify-content:center;align-items:center;min-width:32px;padding-inline:10px;line-height:1;display:inline-flex}.blocks-app .form-editor-checkbox__inner-section-divider{margin:12px 0 16px}.blocks-app .form-editor-checkbox__align-form-item.ant-form-item{margin-bottom:0}.blocks-app .form-editor-checkbox__align-block{margin-top:16px}.blocks-app .form-editor-checkbox__align-columns{flex-wrap:wrap;align-items:flex-start;gap:16px 24px;display:flex}.blocks-app .form-editor-checkbox__align-column{flex:140px;min-width:108px}.blocks-app .form-editor-checkbox__section-divider{margin:16px 0 20px}.blocks-app .form-editor-checkbox__more-btn{margin-bottom:12px}.blocks-app .form-editor-checkbox__bg-preview{flex-direction:column;gap:8px;margin-top:4px;padding-top:8px;display:flex}.blocks-app .form-editor-checkbox__preview-panel{border:1px solid var(--ub-colorBorderSecondary);border-radius:calc(var(--ub-borderRadius) * 1px);box-sizing:border-box;flex-direction:column;gap:6px;padding:10px;display:flex}.blocks-app .form-editor-checkbox__preview-row{box-sizing:border-box;align-items:center;gap:10px;min-height:28px;padding:4px 0;display:flex}.blocks-app .form-editor-checkbox__preview-checkbox{box-sizing:border-box;border-style:solid;border-width:2px;flex-shrink:0;justify-content:center;align-items:center;width:16px;height:16px;display:inline-flex}.blocks-app .form-editor-checkbox__preview-checkbox--round{border-radius:50%}.blocks-app .form-editor-checkbox__preview-checkbox--square{border-radius:2px}.blocks-app .form-editor-checkbox__preview-label{color:var(--ub-colorText);font-size:12px;line-height:1.3}.blocks-app .form-editor-checkbox__section.form-section .form-section__body{padding-top:8px;padding-bottom:18px}.blocks-app .form-editor-checkbox__expanded{flex-direction:column;gap:0;margin-top:8px;display:flex}.blocks-app .form-editor-checkbox__expanded>.form-section:first-child>.form-section__header .form-section__title{padding-top:12px}.blocks-app .form-editor-checkbox__full-width{width:100%}.blocks-app .form-editor-checkbox__micro-label{color:var(--ub-colorTextSecondary);margin-bottom:0;font-size:12px;line-height:1.2;display:block}.blocks-app .form-editor-checkbox .form-border-radius-inputs,.blocks-app .form-editor-checkbox .em-form-border-inputs{margin-top:4px}.blocks-app .form-editor-dropdown-list-panel.panel-form{height:100%;min-height:0;max-height:100%}.blocks-app .form-editor-dropdown-list-panel .panel-form__body.form-editor-dropdown-list-panel__body{-webkit-overflow-scrolling:touch;flex:1;min-width:0;min-height:0;overflow:hidden auto}.blocks-app .form-editor-dropdown-list-panel .panel-form__body-content{box-sizing:border-box;min-height:0}.blocks-app .form-editor-dropdown-list-panel__title{font-size:16px;font-weight:600}.blocks-app .form-editor-dropdown-list-panel__inner{box-sizing:border-box;padding:16px 20px 32px}.blocks-app .form-editor-dropdown.ant-form-vertical>.ant-form-item{margin-bottom:20px}.blocks-app .form-editor-dropdown__section-divider{margin:16px 0 20px}.blocks-app .form-editor-dropdown__more-btn{margin-bottom:12px}.blocks-app .form-editor-dropdown__bg-preview{flex-direction:column;gap:8px;margin-top:4px;padding-top:8px;display:flex}.blocks-app .form-editor-dropdown__trigger-mock{border:1px solid var(--ub-colorBorderSecondary);border-radius:calc(var(--ub-borderRadius) * 1px);box-sizing:border-box;justify-content:space-between;align-items:center;gap:8px;min-height:32px;padding:4px 11px;display:flex}.blocks-app .form-editor-dropdown__trigger-mock-text{min-width:0;color:var(--ub-colorTextQuaternary,var(--ub-colorTextSecondary));text-overflow:ellipsis;white-space:nowrap;flex:1;font-size:12px;line-height:1.3;overflow:hidden}.blocks-app .form-editor-dropdown__trigger-mock-arrow{flex-shrink:0;align-items:center;line-height:0;display:inline-flex}.blocks-app .form-editor-dropdown__list-mock{border:1px solid var(--ub-colorBorderSecondary);border-radius:calc(var(--ub-borderRadius) * 1px);box-sizing:border-box;flex-direction:column;gap:4px;padding:8px 10px;display:flex}.blocks-app .form-editor-dropdown__list-mock-item{color:var(--ub-colorText);font-size:12px;line-height:1.4}.blocks-app .form-editor-dropdown__section.form-section .form-section__body{padding-top:8px;padding-bottom:18px}.blocks-app .form-editor-dropdown__expanded{flex-direction:column;gap:0;margin-top:8px;display:flex}.blocks-app .form-editor-dropdown__expanded>.form-section:first-child>.form-section__header .form-section__title{padding-top:12px}.blocks-app .form-editor-dropdown__full-width{width:100%}.blocks-app .form-editor-dropdown .form-border-radius-inputs,.blocks-app .form-editor-dropdown .em-form-border-inputs{margin-top:4px}.blocks-app .form-editor-input-panel.panel-form{height:100%;min-height:0;max-height:100%}.blocks-app .form-editor-input-panel .panel-form__body.form-editor-input-panel__body{-webkit-overflow-scrolling:touch;flex:1;min-width:0;min-height:0;overflow:hidden auto}.blocks-app .form-editor-input-panel .panel-form__body-content{box-sizing:border-box;min-height:0}.blocks-app .form-editor-input-panel__title{font-size:16px;font-weight:600}.blocks-app .form-editor-input-panel__inner{box-sizing:border-box;padding:16px 20px 32px}.blocks-app .form-editor-input.ant-form-vertical>.ant-form-item{margin-bottom:20px}.blocks-app .form-editor-input__icon-toggle-group.em-radio.ant-radio-group{flex-wrap:nowrap;gap:6px;display:flex}.blocks-app .form-editor-input__icon-toggle-group .ant-radio-button-wrapper{justify-content:center;align-items:center;min-width:32px;padding-inline:10px;line-height:1;display:inline-flex}.blocks-app .form-editor-input__align-form-item.ant-form-item{margin-bottom:0}.blocks-app .form-editor-input__align-columns{flex-wrap:wrap;align-items:flex-start;gap:16px 24px;display:flex}.blocks-app .form-editor-input__align-column{flex:140px;min-width:108px}.blocks-app .form-editor-input__section-divider{margin:16px 0 20px}.blocks-app .form-editor-input__more-btn{margin-bottom:12px}.blocks-app .form-editor-input__bg-preview{margin-top:4px;padding-top:8px}.blocks-app .form-editor-input__preview-panel{border:1px solid var(--ub-colorBorderSecondary);border-radius:calc(var(--ub-borderRadius) * 1px);box-sizing:border-box;padding:10px}.blocks-app .form-editor-input__preview-input{border-radius:calc(var(--ub-borderRadius) * 1px);box-sizing:border-box;text-align:left;border-style:solid;border-width:1px;width:100%;min-height:32px;padding:6px 11px;font-size:14px;line-height:1.4}.blocks-app .form-editor-input__preview-placeholder-bit{opacity:.65}.blocks-app .form-editor-input__section.form-section .form-section__body{padding-top:8px;padding-bottom:18px}.blocks-app .form-editor-input__expanded{flex-direction:column;gap:0;margin-top:8px;display:flex}.blocks-app .form-editor-input__expanded>.form-section:first-child>.form-section__header .form-section__title{padding-top:12px}.blocks-app .form-editor-input__full-width{width:100%}.blocks-app .form-editor-input .form-border-radius-inputs,.blocks-app .form-editor-input .em-form-border-inputs{margin-top:4px}.blocks-app .form-editor-input__padding-row{flex-wrap:wrap;align-items:flex-start;gap:8px;width:100%;display:flex}.blocks-app .form-editor-input__padding-field.ant-form-item{flex:120px;min-width:100px;max-width:calc(50% - 4px);margin-bottom:0}.blocks-app .form-editor-input__padding-link-btn{flex:0 0 32px;justify-content:center;align-items:center;width:32px;height:32px;padding:0;display:inline-flex}.blocks-app .form-editor-input__advanced-block{flex-direction:column;gap:8px;width:100%;display:flex}.blocks-app .form-editor-input__advanced-block+.form-editor-input__advanced-block{margin-top:16px}.blocks-app .form-editor-input__advanced-switch-row{align-items:center;gap:12px;width:100%;padding:6px 0;display:flex}.blocks-app .form-editor-input__advanced-switch-label{color:var(--ub-colorText);flex:auto;min-width:0;margin:0;font-size:14px;line-height:1.3}.blocks-app .form-editor-input__advanced-description{margin:0;font-size:12px;line-height:1.35;display:block}.blocks-app .form-editor-input__visibility-row{flex-wrap:wrap;align-items:center;gap:12px 16px;width:100%;display:flex}.blocks-app .form-editor-input__visibility-form-item.ant-form-item,.blocks-app .form-editor-input__direction-form-item.ant-form-item{margin-bottom:0}.blocks-app .form-editor-input__visibility-segment.ant-radio-group,.blocks-app .form-editor-input__visibility-amp.ant-radio-group{flex-wrap:wrap;gap:6px;display:flex}.blocks-app .form-editor-input__visibility-segment .ant-radio-button-wrapper,.blocks-app .form-editor-input__visibility-amp .ant-radio-button-wrapper{justify-content:center;align-items:center;display:inline-flex}.blocks-app .form-editor-radio-panel.panel-form{height:100%;min-height:0;max-height:100%}.blocks-app .form-editor-radio-panel .panel-form__body.form-editor-radio-panel__body{-webkit-overflow-scrolling:touch;flex:1;min-width:0;min-height:0;overflow:hidden auto}.blocks-app .form-editor-radio-panel .panel-form__body-content{box-sizing:border-box;min-height:0}.blocks-app .form-editor-radio-panel__title{font-size:16px;font-weight:600}.blocks-app .form-editor-radio-panel__inner{box-sizing:border-box;padding:16px 20px 32px}.blocks-app .form-editor-radio.ant-form-vertical>.ant-form-item{margin-bottom:20px}.blocks-app .form-editor-radio__default-radios.em-radio.ant-radio-group,.blocks-app .form-editor-radio__shape-radios.em-radio.ant-radio-group{flex-wrap:wrap;align-items:center;gap:8px 24px;display:flex}.blocks-app .form-editor-radio__icon-toggle-group.em-radio.ant-radio-group{flex-wrap:nowrap;gap:6px;display:flex}.blocks-app .form-editor-radio__icon-toggle-group .ant-radio-button-wrapper{justify-content:center;align-items:center;min-width:32px;padding-inline:10px;line-height:1;display:inline-flex}.blocks-app .form-editor-radio__inner-section-divider{margin:12px 0 16px}.blocks-app .form-editor-radio__position-block,.blocks-app .form-editor-radio__layout-form-item.ant-form-item,.blocks-app .form-editor-radio__align-form-item.ant-form-item{margin-bottom:0}.blocks-app .form-editor-radio__align-block{margin-top:16px}.blocks-app .form-editor-radio__section-divider{margin:16px 0 20px}.blocks-app .form-editor-radio__more-btn{margin-bottom:12px}.blocks-app .form-editor-radio__bg-preview{flex-direction:column;gap:8px;margin-top:4px;padding-top:8px;display:flex}.blocks-app .form-editor-radio__preview-panel{border:1px solid var(--ub-colorBorderSecondary);border-radius:calc(var(--ub-borderRadius) * 1px);box-sizing:border-box;flex-direction:column;gap:6px;padding:10px;display:flex}.blocks-app .form-editor-radio__preview-row{border-radius:calc(var(--ub-borderRadius) * 1px);box-sizing:border-box;align-items:center;gap:10px;min-height:28px;padding:4px 8px;display:flex}.blocks-app .form-editor-radio__preview-dot{border:2px solid var(--ub-colorBorderSecondary);box-sizing:border-box;border-radius:50%;flex-shrink:0;width:14px;height:14px}.blocks-app .form-editor-radio__preview-dot--selected{border-style:solid}.blocks-app .form-editor-radio__preview-label{color:var(--ub-colorText);font-size:12px;line-height:1.3}.blocks-app .form-editor-radio__section.form-section .form-section__body{padding-top:8px;padding-bottom:18px}.blocks-app .form-editor-radio__expanded{flex-direction:column;gap:0;margin-top:8px;display:flex}.blocks-app .form-editor-radio__expanded>.form-section:first-child>.form-section__header .form-section__title{padding-top:12px}.blocks-app .form-editor-radio__full-width{width:100%}.blocks-app .form-editor-radio__micro-label{color:var(--ub-colorTextSecondary);margin-bottom:0;font-size:12px;line-height:1.2;display:block}.blocks-app .form-editor-radio .form-border-radius-inputs,.blocks-app .form-editor-radio .em-form-border-inputs{margin-top:4px}",o=window.__useblocks_styles__||(window.__useblocks_styles__={sheets:{},order:[]}),t=r;if(!o.sheets[t]){var e=null;try{typeof CSSStyleSheet=="function"&&"replaceSync"in CSSStyleSheet.prototype&&(e=new CSSStyleSheet,e.replaceSync(r))}catch{e=null}if(e){if(!o.host||!o.host.isConnected||!o.host.sheet){var i=document.createElement("style");i.setAttribute("data-useblocks","true"),document.head.appendChild(i),o.host=i}for(var d=o.host.sheet,a=0;a<e.cssRules.length;a++)try{d.insertRule(e.cssRules[a].cssText,d.cssRules.length)}catch{}(o.texts||(o.texts=[])).push(r),(o.listeners||[]).forEach(function(p){try{p(r)}catch{}})}else{var i=document.createElement("style");i.setAttribute("data-useblocks","true"),i.appendChild(document.createTextNode(r)),document.head.appendChild(i)}o.sheets[t]=!0,o.order.push(t)}}}catch(p){console.error("vite-plugin-css-injected-by-js",p)}})();
|
|
2
|
+
__useblocks__.define("static/core/93df7981.js",["require","exports","module","static/core/2ff39ddf.js","static/core/74875d47.js","static/core/e12242b9.js","react","react/jsx-runtime","__delivery__/libs","classnames"],function(B,I,De){const J=B("./2ff39ddf.js"),r=B("./74875d47.js"),u=B("./e12242b9.js");let d=B("react");d=J.__toESM(d);let e=B("react/jsx-runtime"),i=B("__delivery__/libs"),Q=B("classnames");Q=J.__toESM(Q);var S=J.__toESM(r.require_prop_types()),h="calendar_",ee=`${h}borderRadiusAll`,N=`${h}borderRadiusTopLeft`,y=`${h}borderRadiusTopRight`,L=`${h}borderRadiusBottomLeft`,w=`${h}borderRadiusBottomRight`,ne="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",he=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function ie({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:he,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}ie.propTypes={namePrefix:S.default.string.isRequired,microLabel:S.default.node.isRequired};function xe(){const t=i.ui_kit$Form.useWatch("inactiveDateBg"),l=i.ui_kit$Form.useWatch("activeDateBg"),a=i.ui_kit$Form.useWatch("inactiveColor"),o=i.ui_kit$Form.useWatch("activeColor"),c=i.ui_kit$Form.useWatch("inactiveFontFamily"),_=i.ui_kit$Form.useWatch("activeFontFamily"),m=i.ui_kit$Form.useWatch("inactiveFontSize"),$=i.ui_kit$Form.useWatch("activeFontSize"),b=i.ui_kit$Form.useWatch("inactiveTextStrong"),g=i.ui_kit$Form.useWatch("activeTextStrong");return(0,e.jsxs)("div",{className:"form-editor-calendar__bg-preview","aria-hidden":!0,children:[(0,e.jsx)("span",{className:"form-editor-calendar__bg-chip",style:{background:t,color:a,fontFamily:c,fontSize:m,fontWeight:b?700:400},children:"31"}),(0,e.jsx)("span",{className:"form-editor-calendar__bg-chip form-editor-calendar__bg-chip--active",style:{background:l,color:o,fontFamily:_,fontSize:$,fontWeight:g?700:400},children:"15"})]})}var ke=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>({placeholder:"",valueMode:void 0,dateFormat:"24h",required:!1,inactiveDateBg:"#ffffff",activeDateBg:"#01bca6",inactiveFontFamily:ne,inactiveFontSize:19,inactiveLineHeight:24,inactiveColor:"#333333",inactiveTextStrong:!1,inactiveTextItalic:!1,inactiveTextStrikethrough:!1,inactiveTextUnderline:!1,activeFontFamily:ne,activeFontSize:19,activeLineHeight:24,activeColor:"#ffffff",activeTextStrong:!0,activeTextItalic:!1,activeTextStrikethrough:!1,activeTextUnderline:!1,[`${h}borderPosition`]:`${h}borderAll`,[`${h}borderAll`]:{width:1,style:"solid",color:"#ffffff"},[`${h}borderTop`]:{...u.NULL_BORDER},[`${h}borderBottom`]:{...u.NULL_BORDER},[`${h}borderRight`]:{...u.NULL_BORDER},[`${h}borderLeft`]:{...u.NULL_BORDER},[ee]:5,[N]:null,[y]:null,[L]:null,[w]:null}),[]),g=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),v=(0,d.useCallback)(()=>{const n=o.getFieldsValue(!0);if(m){const j=n[ee]??0;o.setFieldsValue({[N]:j,[y]:j,[L]:j,[w]:j})}else{const j=n[N];j===n[y]&&j===n[L]&&j===n[w]?o.setFieldsValue({[ee]:j}):o.setFieldsValue({[N]:null,[y]:null,[L]:null,[w]:null})}$(j=>!j)},[o,m]),R=[{value:"24h",label:t("24 hours")},{value:"12h",label:t("12 hours")},{value:"DDMMYYYY",label:"DD.MM.YYYY"},{value:"YYYYMMDD",label:"YYYY-MM-DD"}],C=[{value:"empty",label:t("Enter value")},{value:"today",label:t("Today")},{value:"custom",label:t("Custom")}],T=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),s=(0,e.jsx)("div",{className:"form-editor-calendar-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-calendar",autoComplete:"off",initialValues:b,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"placeholder",label:t("Placeholder"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text visible at the start"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"valueMode",label:(0,e.jsxs)("span",{className:"form-editor-calendar__label-with-info",children:[t("Value"),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Default or bound value for the field"),children:(0,e.jsx)("span",{className:"form-editor-calendar__info-icon",children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"InfoCircleOutlined",component:i.icons$InfoCircleOutlined,size:16})})})]}),children:(0,e.jsx)(i.ui_kit$Select,{className:"form-editor-calendar__full-width",placeholder:t("Enter value"),options:C,allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"dateFormat",label:t("Date format"),children:(0,e.jsx)(i.ui_kit$Select,{className:"form-editor-calendar__full-width",options:R})}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Required field")}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-calendar__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-calendar__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(n=>!n),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-calendar__expanded",children:[(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-calendar__section",title:t("Background"),children:(0,e.jsxs)(i.ui_kit$Space,{orientation:"vertical",size:20,className:"form-editor-calendar__full-width",children:[(0,e.jsx)(i.ui_kit$FormColorField,{name:"inactiveDateBg",label:t("Inactive date background color")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"activeDateBg",label:t("Active date background color")}),(0,e.jsx)(xe,{})]})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-calendar__section",title:t("Input field text"),children:(0,e.jsxs)("div",{className:"form-editor-calendar__typography-stack",children:[(0,e.jsx)(ie,{namePrefix:"inactive",microLabel:t("Inactive date font")}),(0,e.jsx)(ie,{namePrefix:"active",microLabel:t("Active date font")})]})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-calendar__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:h,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:v,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-calendar__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:h})})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-calendar-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:g,closeIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Close",component:i.icons$Close,size:24,strokeWidth:a.iconStrokeWidth}),extra:T,children:(0,e.jsx)(i.ui_kit$PanelForm.HeaderTitle,{className:"form-editor-calendar-panel__title",children:t("Calendar")})}),(0,e.jsx)(i.ui_kit$PanelForm.Body,{className:"form-editor-calendar-panel__body",padding:{horizontal:0,vertical:0},children:s})]})},x="checkbox_",te=`${x}borderRadiusAll`,O=`${x}borderRadiusTopLeft`,E=`${x}borderRadiusTopRight`,A=`${x}borderRadiusBottomLeft`,P=`${x}borderRadiusBottomRight`,fe="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",ae=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function se({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:ae,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}se.propTypes={namePrefix:S.default.string.isRequired,microLabel:S.default.node.isRequired};function $e(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("markerShape"),a=i.ui_kit$Form.useWatch("appearanceBackground"),o=i.ui_kit$Form.useWatch("appearanceStrokeColor"),c=i.ui_kit$Form.useWatch("appearanceCheckColor"),_=i.ui_kit$Form.useWatch("useCustomCheckIcon"),m=(0,Q.default)("form-editor-checkbox__preview-checkbox",l==="round"&&"form-editor-checkbox__preview-checkbox--round",l==="square"&&"form-editor-checkbox__preview-checkbox--square");return(0,e.jsx)("div",{className:"form-editor-checkbox__bg-preview","aria-hidden":!0,children:(0,e.jsxs)("div",{className:"form-editor-checkbox__preview-panel",children:[(0,e.jsxs)("div",{className:"form-editor-checkbox__preview-row",children:[(0,e.jsx)("span",{className:m,style:{borderColor:o,background:c},children:!_&&(0,e.jsx)(i.ui_kit$EmIcons,{icon:"CheckOutlined",component:i.icons$CheckOutlined,size:10,style:{color:"#ffffff"}})}),(0,e.jsx)("span",{className:"form-editor-checkbox__preview-label",children:t("Checked")})]}),(0,e.jsxs)("div",{className:"form-editor-checkbox__preview-row",children:[(0,e.jsx)("span",{className:m,style:{borderColor:o,background:a}}),(0,e.jsx)("span",{className:"form-editor-checkbox__preview-label",children:t("Unchecked")})]})]})})}function be(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("useCustomCheckIcon");return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"markerShape",label:t("Marker shape"),children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-checkbox__shape-radios",children:[(0,e.jsx)(i.ui_kit$Radio,{value:"round",children:t("Round")}),(0,e.jsx)(i.ui_kit$Radio,{value:"square",children:t("Square")})]})}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-checkbox__inner-section-divider"}),(0,e.jsxs)(i.ui_kit$Space,{orientation:"vertical",size:16,className:"form-editor-checkbox__full-width",children:[(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceBackground",label:t("Background color")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceStrokeColor",label:t("Stroke color")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceCheckColor",label:t("Checked fill color")})]}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"useCustomCheckIcon",label:t("Use custom icon for checked state")}),l&&(0,e.jsx)(i.ui_kit$Form.Item,{name:"customCheckIconUrl",label:t("Checked icon URL"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:"https://",allowClear:!0})}),(0,e.jsx)($e,{})]})}function ge(){const{__:t}=r.useI18n(),l=r.useAppConfig().iconStrokeWidth;return(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-checkbox__section",title:t("Position in cell"),children:(0,e.jsxs)("div",{className:"form-editor-checkbox__align-columns",children:[(0,e.jsxs)("div",{className:"form-editor-checkbox__align-column",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-checkbox__micro-label",children:t("Horizontal alignment")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"alignHorizontal",className:"form-editor-checkbox__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-checkbox__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"left",title:t("Align left"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignLeftOutlined",component:i.icons$AlignLeftOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"center",title:t("Align center"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignCenterOutlined",component:i.icons$AlignCenterOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"right",title:t("Align right"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignRightOutlined",component:i.icons$AlignRightOutlined,size:16,strokeWidth:l})})]})})]}),(0,e.jsxs)("div",{className:"form-editor-checkbox__align-column",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-checkbox__micro-label",children:t("Vertical alignment")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"alignVertical",className:"form-editor-checkbox__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-checkbox__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"top",title:t("Align top"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalTop",component:i.icons$AlignVerticalTop,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"middle",title:t("Align middle"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalCenter",component:i.icons$AlignVerticalCenter,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"bottom",title:t("Align bottom"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalBottom",component:i.icons$AlignVerticalBottom,size:16,strokeWidth:l})})]})})]})]})})}function je(){const{__:t}=r.useI18n();return i.ui_kit$Form.useWatch("showHelperText")?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"helperText",label:t("Helper text"),children:(0,e.jsx)(i.ui_kit$Input.TextArea,{rows:2,placeholder:t("Tooltip or hint text"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"validationErrorText",label:t("Validation error message"),children:(0,e.jsx)(i.ui_kit$Input.TextArea,{rows:2,placeholder:t("Message when validation fails"),allowClear:!0})})]}):null}var Fe=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>[{value:"v1",label:`${t("Value")} 1`},{value:"v2",label:`${t("Value")} 2`},{value:"custom",label:t("Custom")}],[t]),g=(0,d.useMemo)(()=>({fieldHeading:"",boundValue:void 0,checkboxLabel:"",required:!1,defaultState:"disabled",showHelperText:!1,helperText:"",validationErrorText:"",alignHorizontal:"left",alignVertical:"top",markerShape:"square",appearanceBackground:"#ffffff",appearanceStrokeColor:"#d9d9d9",appearanceCheckColor:"#01bca6",useCustomCheckIcon:!1,customCheckIconUrl:"",labelTextFontFamily:fe,labelTextFontSize:19,labelTextLineHeight:24,labelTextColor:"#333333",labelTextStrong:!1,labelTextItalic:!1,labelTextStrikethrough:!1,labelTextUnderline:!1,[`${x}borderPosition`]:`${x}borderAll`,[`${x}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${x}borderTop`]:{...u.NULL_BORDER},[`${x}borderBottom`]:{...u.NULL_BORDER},[`${x}borderRight`]:{...u.NULL_BORDER},[`${x}borderLeft`]:{...u.NULL_BORDER},[te]:5,[O]:null,[E]:null,[A]:null,[P]:null}),[]),v=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),R=(0,d.useCallback)(()=>{const s=o.getFieldsValue(!0);if(m){const n=s[te]??0;o.setFieldsValue({[O]:n,[E]:n,[A]:n,[P]:n})}else{const n=s[O];n===s[E]&&n===s[A]&&n===s[P]?o.setFieldsValue({[te]:n}):o.setFieldsValue({[O]:null,[E]:null,[A]:null,[P]:null})}$(n=>!n)},[o,m]),C=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),T=(0,e.jsx)("div",{className:"form-editor-checkbox-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-checkbox",autoComplete:"off",initialValues:g,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldHeading",label:t("Field heading"),children:(0,e.jsx)(i.ui_kit$Input.TextArea,{rows:2,placeholder:t("Title shown above the control"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"boundValue",label:(0,e.jsxs)("span",{className:"form-editor-checkbox__label-with-info",children:[t("Value"),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Stored or bound value for this field"),children:(0,e.jsx)("span",{className:"form-editor-checkbox__info-icon",children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"InfoCircleOutlined",component:i.icons$InfoCircleOutlined,size:12})})})]}),children:(0,e.jsx)(i.ui_kit$Select,{className:"form-editor-checkbox__full-width",placeholder:t("Enter value"),options:b,allowClear:!0,getPopupContainer:ae})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"checkboxLabel",label:t("Label next to checkbox"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text beside the box"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Required field")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"defaultState",label:t("Default value"),children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-checkbox__default-radios",children:[(0,e.jsx)(i.ui_kit$Radio,{value:"enabled",children:t("Enabled")}),(0,e.jsx)(i.ui_kit$Radio,{value:"disabled",children:t("Disabled")})]})}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"showHelperText",label:t("Helper text / tooltip")}),(0,e.jsx)(je,{}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-checkbox__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-checkbox__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(s=>!s),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-checkbox__expanded",children:[(0,e.jsx)(ge,{}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-checkbox__section",title:t("Appearance"),children:(0,e.jsx)(be,{})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-checkbox__section",title:t("Label text style"),children:(0,e.jsx)(se,{namePrefix:"labelText",microLabel:t("Caption next to checkbox")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-checkbox__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:x,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:R,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-checkbox__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:x})})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-checkbox-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:v,closeIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Close",component:i.icons$Close,size:24,strokeWidth:a.iconStrokeWidth}),extra:C,children:(0,e.jsx)(i.ui_kit$PanelForm.HeaderTitle,{className:"form-editor-checkbox-panel__title",children:t("Checkbox")})}),(0,e.jsx)(i.ui_kit$PanelForm.Body,{className:"form-editor-checkbox-panel__body",padding:{horizontal:0,vertical:0},children:T})]})},k="dropdown_",oe=`${k}borderRadiusAll`,D=`${k}borderRadiusTopLeft`,V=`${k}borderRadiusTopRight`,z=`${k}borderRadiusBottomLeft`,W=`${k}borderRadiusBottomRight`,ve="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",ce=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function de({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:ce,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}de.propTypes={namePrefix:S.default.string.isRequired,microLabel:S.default.node.isRequired};function Re(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("triggerBackground"),a=i.ui_kit$Form.useWatch("listPanelBackground"),o=i.ui_kit$Form.useWatch("arrowColor");return(0,e.jsxs)("div",{className:"form-editor-dropdown__bg-preview","aria-hidden":!0,children:[(0,e.jsxs)("div",{className:"form-editor-dropdown__trigger-mock",style:{background:l},children:[(0,e.jsx)("span",{className:"form-editor-dropdown__trigger-mock-text",children:t("Text visible at the start")}),(0,e.jsx)("span",{className:"form-editor-dropdown__trigger-mock-arrow",style:{color:o},children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DownOutlined",component:i.icons$DownOutlined,size:14})})]}),(0,e.jsxs)("div",{className:"form-editor-dropdown__list-mock",style:{background:a},children:[(0,e.jsxs)("span",{className:"form-editor-dropdown__list-mock-item",children:[t("Value")," 1"]}),(0,e.jsxs)("span",{className:"form-editor-dropdown__list-mock-item",children:[t("Value")," 2"]})]})]})}var Ce=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>[{value:"v1",label:`${t("Value")} 1`},{value:"v2",label:`${t("Value")} 2`},{value:"custom",label:t("Custom")}],[t]),g=(0,d.useMemo)(()=>({placeholder:"",options:[{title:"",boundValue:void 0},{title:"",boundValue:void 0}],allowMultiple:!1,required:!1,triggerBackground:"#ffffff",listPanelBackground:"#ffffff",arrowColor:"rgba(0, 0, 0, 0.45)",listTextFontFamily:ve,listTextFontSize:14,listTextLineHeight:22,listTextColor:"#333333",listTextStrong:!1,listTextItalic:!1,listTextStrikethrough:!1,listTextUnderline:!1,[`${k}borderPosition`]:`${k}borderAll`,[`${k}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${k}borderTop`]:{...u.NULL_BORDER},[`${k}borderBottom`]:{...u.NULL_BORDER},[`${k}borderRight`]:{...u.NULL_BORDER},[`${k}borderLeft`]:{...u.NULL_BORDER},[oe]:5,[D]:null,[V]:null,[z]:null,[W]:null}),[]),v=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),R=(0,d.useCallback)(()=>{const s=o.getFieldsValue(!0);if(m){const n=s[oe]??0;o.setFieldsValue({[D]:n,[V]:n,[z]:n,[W]:n})}else{const n=s[D];n===s[V]&&n===s[z]&&n===s[W]?o.setFieldsValue({[oe]:n}):o.setFieldsValue({[D]:null,[V]:null,[z]:null,[W]:null})}$(n=>!n)},[o,m]),C=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),T=(0,e.jsx)("div",{className:"form-editor-dropdown-list-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-dropdown",autoComplete:"off",initialValues:g,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"placeholder",label:t("Placeholder"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text visible at the start"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$FormOptionsList,{name:"options",boundValueOptions:b,getPopupContainer:ce,labels:{itemTitle:s=>`${t("Value")} ${s}`,headingLabel:t("Heading"),valueLabel:t("Value"),valueTooltip:t("Stored or bound value for this option"),addLabel:t("Add value"),removeTooltip:t("Remove"),headingPlaceholder:t("Enter heading"),valuePlaceholder:t("Enter value")}}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"allowMultiple",label:t("Allow multiple selection")}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Required field")}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-dropdown__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-dropdown__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(s=>!s),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-dropdown__expanded",children:[(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-dropdown__section",title:t("Background"),children:(0,e.jsxs)(i.ui_kit$Space,{orientation:"vertical",size:20,className:"form-editor-dropdown__full-width",children:[(0,e.jsx)(i.ui_kit$FormColorField,{name:"triggerBackground",label:t("Closed field background")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"listPanelBackground",label:t("List panel background")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"arrowColor",label:t("Arrow color")}),(0,e.jsx)(Re,{})]})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-dropdown__section",title:t("List text style"),children:(0,e.jsx)(de,{namePrefix:"listText",microLabel:t("List item appearance")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-dropdown__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:k,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:R,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-dropdown__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:k})})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-dropdown-list-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:v,closeIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Close",component:i.icons$Close,size:24,strokeWidth:a.iconStrokeWidth}),extra:C,children:(0,e.jsx)(i.ui_kit$PanelForm.HeaderTitle,{className:"form-editor-dropdown-list-panel__title",children:t("Dropdown list")})}),(0,e.jsx)(i.ui_kit$PanelForm.Body,{className:"form-editor-dropdown-list-panel__body",padding:{horizontal:0,vertical:0},children:T})]})},F={TEXT:"text",EMAIL:"email",PHONE:"phone",NAME:"name",URL:"url",PASSWORD:"password"},p="inputField_",le=`${p}borderRadiusAll`,U=`${p}borderRadiusTopLeft`,H=`${p}borderRadiusTopRight`,M=`${p}borderRadiusBottomLeft`,q=`${p}borderRadiusBottomRight`,ue="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",G=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function me({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:G,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}function Te(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("fieldBackground"),a=i.ui_kit$Form.useWatch(`${p}borderAll`),o=i.ui_kit$Form.useWatch("placeholderTextColor"),c=i.ui_kit$Form.useWatch("inputValueTextColor"),_=a?.color??"#d9d9d9";return(0,e.jsx)("div",{className:"form-editor-input__bg-preview","aria-hidden":!0,children:(0,e.jsx)("div",{className:"form-editor-input__preview-panel",children:(0,e.jsxs)("div",{className:"form-editor-input__preview-input",style:{background:l,borderColor:_,color:c},children:[(0,e.jsx)("span",{className:"form-editor-input__preview-placeholder-bit",style:{color:o},children:t("Placeholder")}),(0,e.jsx)("span",{children:" · "}),(0,e.jsx)("span",{children:t("Value")})]})})})}function Se(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useFormInstance(),a=(0,d.useCallback)(()=>{const o=l.getFieldValue("paddingHorizontal");o!=null&&o!==""&&l.setFieldValue("fieldMinHeight",o)},[l]);return(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Internal padding"),children:(0,e.jsxs)("div",{className:"form-editor-input__padding-row",children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"paddingHorizontal",className:"form-editor-input__padding-field",children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:200,placeholder:"0",prefix:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ColumnWidthOutlined",component:i.icons$ColumnWidthOutlined}),addonAfter:"px"})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldMinHeight",className:"form-editor-input__padding-field",children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:200,placeholder:t("Height"),prefix:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ColumnHeightOutlined",component:i.icons$ColumnHeightOutlined}),addonAfter:"px"})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Apply horizontal padding to height"),children:(0,e.jsx)(i.ui_kit$Button,{type:"default",className:"form-editor-input__padding-link-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"BorderOuterOutlined",component:i.icons$BorderOuterOutlined,size:16}),onClick:a})})]})})}function Be(){const{__:t}=r.useI18n();return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"form-editor-input__advanced-block",children:[(0,e.jsxs)("div",{className:"form-editor-input__advanced-switch-row",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{className:"form-editor-input__advanced-switch-label",children:t("Field state appearance")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"customStylesForStates",valuePropName:"checked",noStyle:!0,children:(0,e.jsx)(i.ui_kit$Switch,{})})]}),(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-input__advanced-description",children:t("Use your own styles instead of defaults for states such as error, focus, and success.")})]}),(0,e.jsxs)("div",{className:"form-editor-input__advanced-block",children:[(0,e.jsxs)("div",{className:"form-editor-input__advanced-switch-row",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{className:"form-editor-input__advanced-switch-label",children:t("High contrast mode")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"highContrastMode",valuePropName:"checked",noStyle:!0,children:(0,e.jsx)(i.ui_kit$Switch,{})})]}),(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-input__advanced-description",children:t("Improves visibility by automatically tuning the form for accessibility. Turn off to restore the previous look.")})]})]})}function Ie(){const{__:t}=r.useI18n(),l=r.useAppConfig().iconStrokeWidth;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Visibility"),children:(0,e.jsxs)("div",{className:"form-editor-input__visibility-row",children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldVisibility",className:"form-editor-input__visibility-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-input__visibility-segment",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"always",children:t("Always")}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"desktop",title:t("Desktop"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DesktopOutlined",component:i.icons$DesktopOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"mobile",title:t("Mobile"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"MobileOutlined",component:i.icons$MobileOutlined,size:16,strokeWidth:l})})]})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldDirection",className:"form-editor-input__direction-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-input__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"ltr",title:t("Left to right"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ArrowLeftOutlined",component:i.icons$ArrowLeftOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"rtl",title:t("Right to left"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"ArrowRightOutlined",component:i.icons$ArrowRightOutlined,size:16,strokeWidth:l})})]})})]})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Visibility in AMP"),children:(0,e.jsx)(i.ui_kit$Form.Item,{name:"ampVisibility",className:"form-editor-input__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-input__visibility-amp",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"always",children:t("Always")}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"amp",children:"AMP"}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"html",children:"HTML"})]})})})]})}function Ne(){const{__:t}=r.useI18n();return i.ui_kit$Form.useWatch("limitLength")?(0,e.jsx)(i.ui_kit$Form.Item,{name:"maxLength",label:t("Maximum length"),children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:1,max:9999,placeholder:t("Characters"),addonAfter:t("chars")})}):null}function ye(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("inputType"),a=(0,d.useMemo)(()=>[{value:"minLength8",label:t("Minimum length 8 characters")},{value:"lowercase",label:t("Lowercase letters (a-z)")},{value:"uppercase",label:t("Uppercase letters (A-Z)")},{value:"digits",label:t("Digits (0-9)")},{value:"special",label:t("Special characters")}],[t]),o=(0,d.useMemo)(()=>[{value:"https",label:"HTTPS"},{value:"http",label:"HTTP"},{value:"mailto",label:"mailto:"},{value:"ftp",label:"FTP"}],[]);return l?(0,e.jsxs)(e.Fragment,{children:[l===F.TEXT&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"limitLength",label:t("Character limit")}),(0,e.jsx)(Ne,{})]}),l===F.PHONE&&(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"countryCodeSelector",label:t("Country selector (flag+code)")}),l===F.URL&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"urlAutoPrependProtocol",label:t("Auto-prepend protocol on blur")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"allowedProtocols",label:t("Allowed protocols"),children:(0,e.jsx)(i.ui_kit$Select,{mode:"multiple",className:"form-editor-input__full-width",placeholder:t("Choose allowed protocols"),options:o,getPopupContainer:G,allowClear:!0})})]}),l===F.PASSWORD&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"showPasswordEye",label:t("Show eye icon")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"passwordComplexityRules",label:t("Complexity rules"),children:(0,e.jsx)(i.ui_kit$Select,{mode:"multiple",className:"form-editor-input__full-width",placeholder:t("Choose complexity rules"),options:a,getPopupContainer:G,allowClear:!0})})]})]}):null}var Le=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>[{value:F.TEXT,label:t("Text")},{value:F.EMAIL,label:t("Email")},{value:F.PHONE,label:t("Phone number")},{value:F.NAME,label:t("Name")},{value:F.URL,label:t("URL")},{value:F.PASSWORD,label:t("Password")}],[t]),g=(0,d.useMemo)(()=>({placeholder:"",required:!1,limitLength:!1,maxLength:100,hintText:"",countryCodeSelector:!1,urlAutoPrependProtocol:!1,allowedProtocols:[],showPasswordEye:!1,passwordComplexityRules:[],paddingHorizontal:16,customStylesForStates:!1,highContrastMode:!1,fieldVisibility:"always",fieldDirection:"ltr",ampVisibility:"always",fieldBackground:"#ffffff",inputValueTextFontFamily:ue,inputValueTextFontSize:14,inputValueTextLineHeight:22,inputValueTextColor:"#333333",inputValueTextStrong:!1,inputValueTextItalic:!1,inputValueTextStrikethrough:!1,inputValueTextUnderline:!1,placeholderTextFontFamily:ue,placeholderTextFontSize:14,placeholderTextLineHeight:22,placeholderTextColor:"rgba(0, 0, 0, 0.25)",placeholderTextStrong:!1,placeholderTextItalic:!1,placeholderTextStrikethrough:!1,placeholderTextUnderline:!1,[`${p}borderPosition`]:`${p}borderAll`,[`${p}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${p}borderTop`]:{...u.NULL_BORDER},[`${p}borderBottom`]:{...u.NULL_BORDER},[`${p}borderRight`]:{...u.NULL_BORDER},[`${p}borderLeft`]:{...u.NULL_BORDER},[le]:5,[U]:null,[H]:null,[M]:null,[q]:null}),[]),v=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),R=(0,d.useCallback)(()=>{const s=o.getFieldsValue(!0);if(m){const n=s[le]??0;o.setFieldsValue({[U]:n,[H]:n,[M]:n,[q]:n})}else{const n=s[U];n===s[H]&&n===s[M]&&n===s[q]?o.setFieldsValue({[le]:n}):o.setFieldsValue({[U]:null,[H]:null,[M]:null,[q]:null})}$(n=>!n)},[o,m]),C=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),T=(0,e.jsx)("div",{className:"form-editor-input-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-input",autoComplete:"off",initialValues:g,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"inputType",label:t("Type"),children:(0,e.jsx)(i.ui_kit$Select,{className:"form-editor-input__full-width",placeholder:t("Choose input type"),options:b,allowClear:!0,getPopupContainer:G})}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Field required")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"placeholder",label:t("Placeholder"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text visible at the start"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"hintText",label:t("Hint text"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Come up with a hint"),allowClear:!0})}),(0,e.jsx)(ye,{}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-input__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-input__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(s=>!s),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-input__expanded",children:[(0,e.jsx)(Se,{}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Size"),collapsible:!0,defaultOpen:!1,children:(0,e.jsx)(i.ui_kit$Form.Item,{name:"fieldMaxWidth",label:t("Max width"),children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:2e3,placeholder:t("Not set"),addonAfter:"px"})})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Background"),children:(0,e.jsx)(i.ui_kit$FormColorField,{name:"fieldBackground",label:t("Background color")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Input field text"),children:(0,e.jsx)(me,{namePrefix:"inputValueText",microLabel:t("Font")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Placeholder text"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(me,{namePrefix:"placeholderText",microLabel:t("Font")})}),(0,e.jsx)(Te,{}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:p,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:R,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:p})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-input__section",title:t("Accessibility"),children:(0,e.jsx)(Be,{})}),(0,e.jsx)(Ie,{})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-input-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:v,closeIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Close",component:i.icons$Close,size:24,strokeWidth:a.iconStrokeWidth}),extra:C,children:(0,e.jsx)(i.ui_kit$PanelForm.HeaderTitle,{className:"form-editor-input-panel__title",children:t("Input")})}),(0,e.jsx)(i.ui_kit$PanelForm.Body,{className:"form-editor-input-panel__body",padding:{horizontal:0,vertical:0},children:T})]})},f="radio_",re=`${f}borderRadiusAll`,Y=`${f}borderRadiusTopLeft`,X=`${f}borderRadiusTopRight`,K=`${f}borderRadiusBottomLeft`,Z=`${f}borderRadiusBottomRight`,we="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",pe=t=>t.closest(".email-pane__collapse-wrapper")||t.closest(".email-pane__content-col")||document.body;function _e({namePrefix:t,microLabel:l}){const a=u.useGoogleFontsLoader(),{__:o}=r.useI18n(),c=r.useSelector(r.selectEmailSettings)?.usedColors;return(0,e.jsx)(i.ui_kit$FormTypographyFields,{namePrefix:t,microLabel:l,usedColors:c,loadGoogleFonts:a,getPopupContainer:pe,formatLabels:{bold:o("Strong ( Ctrl+B )"),italic:o("Italic ( Ctrl+I )"),strikethrough:o("Strikethrough ( Alt+Shift+5 )"),underline:o("Underline ( Ctrl+U )")},inputLabels:{fontSize:o("Font size"),lineHeight:o("Line height"),textColor:o("Text color")}})}_e.propTypes={namePrefix:S.default.string.isRequired,microLabel:S.default.node.isRequired};function Oe(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("appearanceBackground"),a=i.ui_kit$Form.useWatch("appearanceStrokeColor"),o=i.ui_kit$Form.useWatch("appearanceDotColor");return(0,e.jsx)("div",{className:"form-editor-radio__bg-preview","aria-hidden":!0,children:(0,e.jsxs)("div",{className:"form-editor-radio__preview-panel",children:[(0,e.jsxs)("div",{className:"form-editor-radio__preview-row",style:{background:l},children:[(0,e.jsx)("span",{className:"form-editor-radio__preview-dot form-editor-radio__preview-dot--selected",style:{borderColor:a,background:o}}),(0,e.jsxs)("span",{className:"form-editor-radio__preview-label",children:[t("Value")," 1"]})]}),(0,e.jsxs)("div",{className:"form-editor-radio__preview-row",style:{background:l},children:[(0,e.jsx)("span",{className:"form-editor-radio__preview-dot",style:{borderColor:a,background:"transparent"}}),(0,e.jsxs)("span",{className:"form-editor-radio__preview-label",children:[t("Value")," 2"]})]})]})})}function Ee(){const{__:t}=r.useI18n(),l=i.ui_kit$Form.useWatch("markerShape");return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"markerShape",label:t("Marker shape"),children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-radio__shape-radios",children:[(0,e.jsx)(i.ui_kit$Radio,{value:"round",children:t("Round")}),(0,e.jsx)(i.ui_kit$Radio,{value:"custom",children:t("Custom icon")})]})}),l==="custom"&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"customIconUrl",label:t("Icon URL"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:"https://",allowClear:!0})}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"customIconAlt",label:t("Icon description"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Accessibility text"),allowClear:!0})})]}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-radio__inner-section-divider"}),(0,e.jsxs)(i.ui_kit$Space,{orientation:"vertical",size:16,className:"form-editor-radio__full-width",children:[(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceBackground",label:t("Background color")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceStrokeColor",label:t("Stroke color")}),(0,e.jsx)(i.ui_kit$FormColorField,{name:"appearanceDotColor",label:t("Dot color")})]}),(0,e.jsx)(Oe,{})]})}function Ae(){const{__:t}=r.useI18n(),l=r.useAppConfig().iconStrokeWidth;return(0,e.jsxs)(i.ui_kit$FormSection,{className:"form-editor-radio__section",title:t("Position in cell"),children:[(0,e.jsxs)(i.ui_kit$Row,{gutter:[12,16],className:"form-editor-radio__position-block",children:[(0,e.jsxs)(i.ui_kit$Col,{xs:24,sm:10,md:9,children:[(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-radio__micro-label",children:t("Layout")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"radioLayout",className:"form-editor-radio__layout-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-radio__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"horizontal",title:t("Horizontal"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"MenuOutlined",component:i.icons$MenuOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"vertical",title:t("Vertical"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Column",component:i.icons$Column,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"grid",title:t("Grid"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Grid01Icon",component:i.icons$Grid01Icon,size:16,strokeWidth:l})})]})})]}),(0,e.jsx)(i.ui_kit$Col,{xs:24,sm:14,md:15,children:(0,e.jsx)(i.ui_kit$Form.Item,{name:"radioOptionGap",label:t("Spacing"),children:(0,e.jsx)(i.ui_kit$DraggableInputNumber,{min:0,max:120,placeholder:t("Spacing"),addonAfter:"px"})})})]}),(0,e.jsxs)("div",{className:"form-editor-radio__align-block",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-radio__micro-label",children:t("Horizontal alignment")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"alignHorizontal",className:"form-editor-radio__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-radio__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"left",title:t("Align left"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignLeftOutlined",component:i.icons$AlignLeftOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"center",title:t("Align center"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignCenterOutlined",component:i.icons$AlignCenterOutlined,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"right",title:t("Align right"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignRightOutlined",component:i.icons$AlignRightOutlined,size:16,strokeWidth:l})})]})})]}),(0,e.jsxs)("div",{className:"form-editor-radio__align-block",children:[(0,e.jsx)(i.ui_kit$Typography.Text,{type:"secondary",className:"form-editor-radio__micro-label",children:t("Vertical alignment")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"alignVertical",className:"form-editor-radio__align-form-item",children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-radio__icon-toggle-group",children:[(0,e.jsx)(i.ui_kit$Radio.Button,{value:"top",title:t("Align top"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalTop",component:i.icons$AlignVerticalTop,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"middle",title:t("Align middle"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalCenter",component:i.icons$AlignVerticalCenter,size:16,strokeWidth:l})}),(0,e.jsx)(i.ui_kit$Radio.Button,{value:"bottom",title:t("Align bottom"),children:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"AlignVerticalBottom",component:i.icons$AlignVerticalBottom,size:16,strokeWidth:l})})]})})]})]})}var Pe=()=>{const{__:t}=r.useI18n(),l=r.useDispatch(),a=r.useAppConfig(),[o]=i.ui_kit$Form.useForm(),[c,_]=(0,d.useState)(!1),[m,$]=(0,d.useState)(!0),b=(0,d.useMemo)(()=>[{value:"v1",label:`${t("Value")} 1`},{value:"v2",label:`${t("Value")} 2`},{value:"custom",label:t("Custom")}],[t]),g=(0,d.useMemo)(()=>({placeholder:"",options:[{title:"",boundValue:void 0},{title:"",boundValue:void 0}],allowShuffle:!1,required:!1,defaultState:"enabled",radioLayout:"vertical",radioOptionGap:20,alignHorizontal:"left",alignVertical:"top",markerShape:"round",customIconUrl:"",customIconAlt:"",appearanceBackground:"#ffffff",appearanceStrokeColor:"#01bca6",appearanceDotColor:"#01bca6",labelTextFontFamily:we,labelTextFontSize:19,labelTextLineHeight:24,labelTextColor:"#333333",labelTextStrong:!1,labelTextItalic:!1,labelTextStrikethrough:!1,labelTextUnderline:!1,[`${f}borderPosition`]:`${f}borderAll`,[`${f}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${f}borderTop`]:{...u.NULL_BORDER},[`${f}borderBottom`]:{...u.NULL_BORDER},[`${f}borderRight`]:{...u.NULL_BORDER},[`${f}borderLeft`]:{...u.NULL_BORDER},[re]:5,[Y]:null,[X]:null,[K]:null,[Z]:null}),[]),v=(0,d.useCallback)(()=>{l(r.setActiveSettingsTab(r.BUILD))},[l]),R=(0,d.useCallback)(()=>{const s=o.getFieldsValue(!0);if(m){const n=s[re]??0;o.setFieldsValue({[Y]:n,[X]:n,[K]:n,[Z]:n})}else{const n=s[Y];n===s[X]&&n===s[K]&&n===s[Z]?o.setFieldsValue({[re]:n}):o.setFieldsValue({[Y]:null,[X]:null,[K]:null,[Z]:null})}$(n=>!n)},[o,m]),C=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Remove"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"DeleteOutlined",component:i.icons$DeleteOutlined,size:18,strokeWidth:a.iconStrokeWidth})})}),(0,e.jsx)(i.ui_kit$Tooltip,{title:t("Link"),placement:"bottom",children:(0,e.jsx)(i.ui_kit$Button,{type:"text",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"LinkOutlined",component:i.icons$LinkOutlined,size:18,strokeWidth:a.iconStrokeWidth})})})]}),T=(0,e.jsx)("div",{className:"form-editor-radio-panel__inner",children:(0,e.jsxs)(i.ui_kit$Form,{form:o,layout:"vertical",className:"element-controls form-editor-radio",autoComplete:"off",initialValues:g,children:[(0,e.jsx)(i.ui_kit$Form.Item,{name:"placeholder",label:t("Placeholder"),children:(0,e.jsx)(i.ui_kit$Input,{placeholder:t("Text visible at the start"),allowClear:!0})}),(0,e.jsx)(i.ui_kit$FormOptionsList,{name:"options",boundValueOptions:b,getPopupContainer:pe,labels:{itemTitle:s=>`${t("Value")} ${s}`,headingLabel:t("Heading"),valueLabel:t("Value"),valueTooltip:t("Stored or bound value for this option"),addLabel:t("Add value"),removeTooltip:t("Remove"),headingPlaceholder:t("Enter heading"),valuePlaceholder:t("Enter value")}}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"allowShuffle",label:t("Shuffle options")}),(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"required",label:t("Required field")}),(0,e.jsx)(i.ui_kit$Form.Item,{name:"defaultState",label:t("Default value"),children:(0,e.jsxs)(i.ui_kit$Radio.Group,{className:"form-editor-radio__default-radios",children:[(0,e.jsx)(i.ui_kit$Radio,{value:"enabled",children:t("Enabled")}),(0,e.jsx)(i.ui_kit$Radio,{value:"disabled",children:t("Disabled")})]})}),(0,e.jsx)(i.ui_kit$Divider,{className:"form-editor-radio__section-divider"}),(0,e.jsx)(i.ui_kit$Button,{type:c?"primary":"default",block:!0,className:"form-editor-radio__more-btn",icon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"SettingOutlined",component:i.icons$SettingOutlined,size:16}),onClick:()=>_(s=>!s),children:t(c?"Fewer settings":"More settings")}),c&&(0,e.jsxs)("div",{className:"form-editor-radio__expanded",children:[(0,e.jsx)(Ae,{}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-radio__section",title:t("Appearance"),children:(0,e.jsx)(Ee,{})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-radio__section",title:t("Label text style"),children:(0,e.jsx)(_e,{namePrefix:"labelText",microLabel:t("Caption next to options")})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-radio__section",title:t("Border radius"),collapsible:!0,defaultOpen:!0,children:(0,e.jsx)(i.ui_kit$FormBorderRadiusInputs,{namePrefix:f,typeOfForm:"desktop",oneBorderRadiusValue:m,onToggle:R,borderRadiusIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"RadiusUpleftOutlined",component:i.icons$RadiusUpleftOutlined,className:"selected-td-form__icon-radius"}),labels:{borderRadius:t("Border radius"),topLeft:t("Top left corner"),topRight:t("Top right corner"),bottomLeft:t("Bottom left corner"),bottomRight:t("Bottom right corner")}})}),(0,e.jsx)(i.ui_kit$FormSection,{className:"form-editor-radio__section",title:t("Border"),children:(0,e.jsx)(u.SelectedElementFormBorder,{form:o,namePrefix:f})})]})]})});return(0,e.jsxs)(i.ui_kit$PanelForm,{className:"form-editor-radio-panel",children:[(0,e.jsx)(i.ui_kit$PanelForm.Header,{onClose:v,closeIcon:(0,e.jsx)(i.ui_kit$EmIcons,{icon:"Close",component:i.icons$Close,size:24,strokeWidth:a.iconStrokeWidth}),extra:C,children:(0,e.jsx)(i.ui_kit$PanelForm.HeaderTitle,{className:"form-editor-radio-panel__title",children:t("Radio button")})}),(0,e.jsx)(i.ui_kit$PanelForm.Body,{className:"form-editor-radio-panel__body",padding:{horizontal:0,vertical:0},children:T})]})};I.FormEditorCalendarPanel=ke,I.FormEditorCheckboxPanel=Fe,I.FormEditorDropdownListPanel=Ce,I.FormEditorInputPanel=Le,I.FormEditorRadioPanel=Pe});
|
|
3
|
+
|
|
4
|
+
__useblocks__.define("static/core/e12242b9.js",["require","exports","module","static/core/2ff39ddf.js","static/core/74875d47.js","react","react/jsx-runtime","__delivery__/libs"],function(t,e,S){const i=t("./2ff39ddf.js"),o=t("./74875d47.js");let r=t("react");r=i.__toESM(r);let l=t("react/jsx-runtime"),d=t("__delivery__/libs");function n(){return o.usePlanFeatureGate("google_fonts").isLocked?void 0:o.loadGFonts}var u=c=>{const{form:g,namePrefix:s="",typeOfForm:I="desktop"}=c,E=o.useSelector(o.selectEmailSettings).usedColors;return(0,l.jsx)(d.ui_kit$FormBorderInputs,{form:g,namePrefix:s,typeOfForm:I,usedColors:E})},b={paddingTop:"top",paddingLeft:"left",paddingRight:"right",paddingBottom:"bottom",mobilePaddingTop:"top",mobilePaddingLeft:"left",mobilePaddingRight:"right",mobilePaddingBottom:"bottom"},m={borderRadiusAll:"all",borderRadiusTopLeft:"topLeft",borderRadiusBottomLeft:"bottomLeft",borderRadiusTopRight:"topRight",borderRadiusBottomRight:"bottomRight"},R={mobileBorderRadiusAll:"all",mobileBorderRadiusTopLeft:"topLeft",mobileBorderRadiusBottomLeft:"bottomLeft",mobileBorderRadiusTopRight:"topRight",mobileBorderRadiusBottomRight:"bottomRight"},a={all:"borderAll",top:"borderTop",right:"borderRight",bottom:"borderBottom",left:"borderLeft"},O={all:"mobileBorderAll",top:"mobileBorderTop",right:"mobileBorderRight",bottom:"mobileBorderBottom",left:"mobileBorderLeft"},_={width:null,style:null,color:null},B={borderAll:"all",borderTop:"top",borderRight:"right",borderBottom:"bottom",borderLeft:"left"},f={mobileBorderAll:"all",mobileBorderTop:"top",mobileBorderRight:"right",mobileBorderBottom:"bottom",mobileBorderLeft:"left"};Object.defineProperty(e,"BORDER_POSITIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"BORDER_RADIUS_POSITION",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"MOBILE_BORDER_POSITIONS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"MOBILE_BORDER_RADIUS_POSITION",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"MOBILE_REVERSE_BORDER_POSITIONS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"NULL_BORDER",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"PADDING_POSITION",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"REVERSE_BORDER_POSITIONS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"SelectedElementFormBorder",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"useGoogleFontsLoader",{enumerable:!0,get:function(){return n}})});
|
|
5
|
+
|
|
6
|
+
__useblocks__.define("static/core/eb970abc.js",["require","exports","module","static/core/2ff39ddf.js","static/core/74875d47.js","static/core/276eec25.js","vite/preload-helper"],function(h,I,B){const D=h("./2ff39ddf.js"),n=h("./74875d47.js"),p=h("./276eec25.js");let R=h("vite/preload-helper");var b=D.__exportAll({IMPORT_UPLOAD_CONCURRENCY:()=>15,createDocumentProcessor:()=>W,createFileProcessor:()=>T,createImportFileNamer:()=>_,ensureFileExtension:()=>$,extractUploadResult:()=>F,fetchFileData:()=>U,getExt:()=>C,handleUploadResult:()=>j,importEmail:()=>L,importHtml:()=>x,importZip:()=>P,splitFileName:()=>M,uploadFile:()=>n.uploadFile});function C(e){const t=e.split(".");return t[t.length-1].toLowerCase()}function M(e){const t=e.split(".");return t[t.length-1].toLowerCase()}var w="index.html";function H(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function _(){const e=new Map;return(t,r)=>{const s=r.toLowerCase(),a=e.get(s);if(a===void 0)return e.set(s,t),r;if(a===t)return r;const i=r.lastIndexOf("."),l=`-${H(t)}`;return i>0?`${r.slice(0,i)}${l}${r.slice(i)}`:`${r}${l}`}}function E(e,t){return e.find(r=>r.toLowerCase().endsWith(t))}async function P(e,t,r){const s=await n.readZip(e),a=Object.keys(s),i=s[w]&&w||E(a,w)||E(a,".html")||E(a,".htm");if(i){const l=i.split("/"),d=document.location.pathname.split("/"),u=document.location.origin+d.slice(0,d.length-l.length).join("/")+"/",f=n.zipEntryToText(s[i]),{html:N,hasBrowserExtensionArtifacts:m}=n.prepareEmailHtmlForEditor(f),g=l.slice(0,l.length-1).join("/"),v=_();return{html:await p.changeHtml(N,async c=>{const y=c.document;await p.replaceImagesInDocument(y,async o=>{o=o.replace("\\","/"),o.startsWith(".")&&(o=o.substring(1)),o.startsWith("/")&&(o=o.substring(1)),o.startsWith(u)&&(o=o.substring(u.length)),g&&!o.match("^(ht|f)tp(s?)://")&&(o=`${g}/${o}`);const A=s[o];return A?t(n.zipEntryToBlob(A),o):t(o,v(o,p.getFileNameWithExt(o)))}),r&&r(c)}),hasBrowserExtensionArtifacts:m,sourceHtml:f}}}async function x(e,t,r){const{html:s,hasBrowserExtensionArtifacts:a}=n.prepareEmailHtmlForEditor(e),i=_();return{html:await p.changeHtml(s,async l=>{const d=l.document;await p.replaceImagesInDocument(d,async u=>(u=u.replace("\\","/"),t(u,i(u,p.getFileNameWithExt(u))))),r&&r(l)}),hasBrowserExtensionArtifacts:a,sourceHtml:e}}async function L(e,t,r){if(e)switch(C(e.name)){case"zip":return P(e,t,r);case"eml":{const s=await e.arrayBuffer(),{default:a}=await(0,R.__vitePreload)(async()=>{const{default:l}=await Promise.resolve().then(()=>h("./6561b34a.js"));return{default:l}},void 0,{}.url),i=(await a.parse(s)).html??void 0;if(typeof i>"u")throw new Error("Eml does not contain text/html");return x(i,t,r)}default:return x(await e.text(),t,r)}}async function U(e,t){if(typeof e!="string")return e;try{const r=await t({url:n.normalizeUrl(e)});return r?.data,r?.data||null}catch{return null}}async function $(e,t){if(!e||typeof e!="string")return`default.${await n.getMimeExtension(t)||"bin"}`;if(e.split(".").length<2){const r=await n.getMimeExtension(t);if(r)return`${e}.${r}`}return e}function F(e){if(e&&typeof e=="object"&&!Array.isArray(e)&&"code"in e&&"message"in e&&e.data){if(e.data.status===400)return{file_url:null,error:{code:e.code,message:e.message,status:e.data.status}};if(e.data.file_url)return{file_url:e.data.file_url,error:null}}if(Array.isArray(e)&&e.length>0){const t=e[0];if(t&&typeof t=="object"){if("code"in t&&"message"in t&&t.data?.status===400)return{file_url:null,error:{code:t.code,message:t.message,status:t.data.status}};if("file_url"in t&&t.file_url)return{file_url:t.file_url,error:null}}}if(e&&typeof e=="object"&&!Array.isArray(e)&&0 in e){if(e.data?.status===400)return{file_url:null,error:{status:e.data.status}};if(e[0]?.file_url)return{file_url:e[0].file_url,error:null}}return{file_url:null,error:null}}function j(e,t){if(!e||e.error)return typeof t=="string"?t:"";const r=F(e.data);return r.error?typeof t=="string"?t:"":r.file_url?r.file_url:typeof t=="string"?t:""}var 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(--ub-formItemMarginBottomXS) * 1px)}.blocks-app .upload-bg-image__inner-wrap{border:calc(var(--ub-borderWidth) * 1px) solid var(--ub-colorFillSecondaryDarken);border-radius:calc(var(--ub-borderRadius) * 1px);cursor:pointer;background-color:var(--ub-colorBgContainer);justify-content:space-between;align-items:center;transition:all .2s linear .2s;display:flex}.blocks-app .upload-bg-image__inner-wrap:hover{border-color:var(--ub-borderColorHover)}.blocks-app .upload-bg-image__uploader{width:calc((var(--ub-formControlHeight) - var(--ub-borderWidth) * 2 + 1) * 1px);height:calc((var(--ub-formControlHeight) - var(--ub-borderWidth) * 2) * 1px);border-radius:calc(var(--ub-borderRadius) * .8px);border:none;border-right:1px solid var(--ub-colorFillSecondaryDarken);flex-shrink:0;margin-right:10px;overflow:hidden}.blocks-app .upload-bg-image__uploader-content{background:0 0;flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%;font-size:11px;display:flex}.blocks-app .upload-bg-image__uploader-content-inner{width:inherit;height:inherit;position:relative}.blocks-app .upload-bg-image__uploader-img-wrap{width:inherit;height:inherit;z-index:1;border:none;position:absolute;overflow:hidden}.blocks-app .upload-bg-image__uploader-img-wrap:after{opacity:0;content:"";transition:opacity .3s;position:absolute;inset:0}.blocks-app .upload-bg-image__uploader-content:hover .upload-bg-image__uploader-img-wrap:after{opacity:1}.blocks-app .upload-bg-image .upload-bg-image__empty{border-top:2px solid var(--ub-colorError);z-index:2;width:27px;position:absolute;top:16px;left:3px;transform:rotate(-45deg)}.blocks-app .upload-bg-image .inputGroup{flex-direction:column;width:100%;display:flex}.blocks-app .upload-bg-image .image-size{color:var(--ub-colorTextTertiary);padding-right:15px;font-size:12px}.blocks-app .upload-bg-image .image-empty-text,.blocks-app .upload-bg-image .image-size-splitter{color:var(--ub-colorTextQuaternary)}.blocks-app .upload-bg-image__edit,.blocks-app .upload-bg-image__edit-menu{color:var(--ub-colorLink);right:calc((var(--ub-borderWidth) + 2) * 1px);padding:6px;line-height:1;position:absolute}.blocks-app .upload-bg-image__edit{right:calc((var(--ub-borderWidth) + 32) * 1px);position:absolute}.blocks-app .upload-bg-image__uploader-icons-wrap{z-index:2;width:inherit;height:inherit;opacity:1;cursor:pointer;justify-content:center;align-items:center;transition:opacity .3s;display:flex;position:relative}.blocks-app .upload-bg-image__uploader-content:hover .upload-bg-image__uploader-icons-wrap{opacity:.85}.blocks-app .upload-bg-image__uploader-icons-wrap-upload{z-index:1;width:inherit;height:inherit;opacity:.8;cursor:pointer;justify-content:center;align-items:center;transition:opacity .3s;display:flex;position:relative}.blocks-app .upload-bg-image__uploader-content:hover .upload-bg-image__uploader-icons-wrap-upload{opacity:.85}.blocks-app .upload-bg-image__uploader-icons-wrap-upload .upload-bg-image__uploader-content:empty{background-color:var(--ub-colorFillSecondary);border-radius:calc(var(--ub-borderRadius) * 1px)}.blocks-app .upload-bg-image__uploader-link,.blocks-app .upload-bg-image__uploader-link:hover{color:#fff}.blocks-app .upload-bg-image__uploader-icon{color:#fff;margin:0 3px;font-size:14px}.blocks-app .upload-bg-image__uploader-img{object-fit:cover;width:100%;height:100%;display:block!important}.blocks-app .upload-bg-image__uploader-img-placeholder{width:100%;height:100%;display:block}.blocks-app .upload-bg-image__uploader-icon-btn{cursor:pointer;background:0 0;border:0;margin:0;padding:0}.blocks-app .upload-bg-image__input{border-color:var(--ub-colorFillSecondaryDarken)}.blocks-app .upload-bg-image__uploader .ant-upload-select{cursor:pointer;width:100%;height:100%;display:block}.blocks-app .upload-bg-image__uploader .ant-upload-select .ant-upload{width:100%;height:100%;display:block}.dark .blocks-app .upload-bg-image__uploader{border-right:1px solid var(--ub-colorBorder)}.blocks-app .countdown-color .color-picker-input__picker-holder{z-index:auto;left:auto;right:-10px}.blocks-app .email-pane .box-shadow-control .ant-collapse-panel,.blocks-app .email-pane .border-control .ant-collapse-panel,.blocks-app .box-shadow-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body,.blocks-app .border-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body{overflow:visible}.blocks-app .selected-image-form_busy{position:relative}.blocks-app .selected-image-form__loader{z-index:5;background-color:color-mix(in srgb, var(--ub-colorBgContainer) 60%, transparent);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);box-shadow:28px 0 0 0 color-mix(in srgb, var(--ub-colorBgContainer) 60%, transparent), -28px 0 0 0 color-mix(in srgb, var(--ub-colorBgContainer) 60%, transparent);position:absolute;inset:0}.blocks-app .selected-image-form__loader-body{flex-direction:column;justify-content:center;align-items:center;gap:16px;height:100%;display:flex;position:absolute;top:0;left:0;right:0}.blocks-app .selected-image-form__loader-title{color:var(--ub-colorTextSecondary);text-align:center;padding:0 24px;font-size:13px}.blocks-app .selected-text-common-form__border-radio{position:relative}.blocks-app .selected-text-common-form__border-radio:after{content:"·";border:3px solid var(--ub-colorPrimary);border-radius:50%;font-size:0;line-height:0;position:absolute;top:2px;right:2px}.blocks-app .selected-text-common-form__border-col{margin-top:22px;margin-bottom:10px}@media (width<=1840px){.blocks-app .selected-text-common-form__border-col{margin-top:0}}.blocks-app .selected-text-common-form__border-item.ant-form-item .ant-row{flex-direction:row;align-items:center}.blocks-app .selected-text-common-form__border-item.ant-form-item .ant-row .ant-col.ant-form-item-label{white-space:nowrap;padding-top:6px}.blocks-app .selected-text-common-form__padding-input{max-width:46px;margin-bottom:0}.blocks-app .selected-text-common-form__padding-input input{text-align:center;padding:4px 8px}.blocks-app .selected-text-common-form__padding-input .ant-input-number-focused input{text-align:left}.blocks-app .selected-text-common-form__button--active,.blocks-app .selected-text-common-form__button--active:focus{color:#40a9ff;border-color:#40a9ff}.blocks-app .selected-text-common-form__br-input{margin-bottom:10px}.blocks-app .selected-text-common-form__tooltip{margin-left:4px}.blocks-app .selected-text-common-form__icon-radius{width:16px;height:100%}.blocks-app .selected-text-common-form__block{margin-bottom:24px}.blocks-app .selected-text-common-form__button_style{padding-left:10px;padding-right:10px;transition:none}.blocks-app .selected-text-common-form__format-toolbar{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:4px;display:flex}.blocks-app .selected-text-common-form__format-toolbar .ant-form-item{margin-bottom:0}.blocks-app .ant-app .bullet-type .ant-select-selector{padding-left:5px}.blocks-app .selected_text_common_form_mobile .ant-form-item{margin:0}.blocks-app .selected_text_common_form_mobile .ant-input-number-affix-wrapper{padding-inline-start:7px}.blocks-app .selected_text_common_form_mobile .ant-select-single:not(.ant-select-customize-input) .ant-select-selector,.blocks-app .selected_text_common_form_mobile .ant-input-number-group .ant-input-number-group-addon{padding:0 7px}.blocks-app .selected_text_common_form_mobile .ant-input-number .ant-input-number-handler-wrap{width:16px}.blocks-app .selected_text_common_form_mobile .ant-select .ant-select-arrow{inset-inline-end:7px;font-size:10px!important}.blocks-app .selected_text_common_form_mobile .ant-divider-vertical{height:46px;top:0}.blocks-app .selected_text_common_form_mobile .selected_text_common_form_mobile__group{padding:6px 0}.blocks-app .selected_text_common_form_mobile .selected-td-form__button{background:var(--ub-colorFillSecondary);width:34px;height:34px;border:1px solid #0000!important}.blocks-app .selected_text_common_form_mobile .ant-btn-default:not(:disabled,.ant-btn-disabled,.email-pane__content-col .selected-td-form__button--active):hover{background:var(--ub-colorFillSecondaryDarken);color:inherit;border-color:#0000}.blocks-app .selected_text_common_form_mobile .selected-td-form__button--active{background:var(--ub-colorPrimaryBg);color:var(--ub-colorPrimary);border-color:#0000}.blocks-app .selected_text_common_form_mobile .selected-td-form__button--active:hover{background:var(--ub-colorPrimaryBgHover)!important;color:var(--ub-colorPrimaryTextHover)!important}.blocks-app .selected_text_common_form_mobile .color-picker-input{width:34px;height:34px}.blocks-app .selected_text_common_form_mobile .color-picker-input .ant-input-affix-wrapper{display:none}.blocks-app .selected_text_common_form_mobile .color-picker-input__control-wrap .ant-color-picker-trigger{border:1px solid var(--ub-colorFillSecondaryDarken);width:34px;height:34px;top:0;left:0}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper{background:var(--ub-colorFillSecondary);height:34px;padding:0 9px;border:1px solid #0000!important}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper:not(.ant-radio-button-wrapper-checked):hover{color:inherit;background:var(--ub-colorFillSecondaryDarken)}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper.ant-radio-button-wrapper-checked{background:var(--ub-colorPrimaryBg);color:var(--ub-colorPrimary)}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper.ant-radio-button-wrapper-checked:hover{background:var(--ub-colorPrimaryBgHover);color:var(--ub-colorPrimaryTextHover)}.blocks-app .selected_text_common_form_mobile .codemode-textalign-dropdown{background-color:var(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadius) * 1px);box-shadow:var(--ub-boxShadowSecondary);padding:6px}.blocks-app .mobile-background-image-field .upload-bg-image{margin-bottom:0}.blocks-app .selected_element_vindent_values{font-size:12px}.blocks-app .selected_element_vindent_values span{cursor:pointer;margin-right:10px}.blocks-app .selected_element_vindent_values span:hover{color:#40a9ff}.blocks-app .selected-td-form__mobile-width-hint{color:var(--ub-colorTextSecondary);margin-bottom:15px;font-size:12px;line-height:18px}.blocks-app .selected-td-form__border-side-wrapper{display:inline-flex;position:relative}.blocks-app .selected-td-form__border-side-wrapper label{border-radius:calc(var(--ub-borderRadius) * 1px)}.blocks-app .selected-td-form__border-side-wrapper:hover .selected-td-form__border-side-clear{opacity:1}.blocks-app .selected-td-form__border-side-clear{z-index:1;opacity:0;cursor:pointer;color:var(--ub-colorTextSecondary);background-color:var(--ub-colorBgLayout);border-radius:50%;width:20px;height:20px;transition:opacity .15s;position:absolute;top:-6px;right:-4px}.blocks-app .selected-td-form__border-side-clear:hover{color:var(--ub-colorError)}.blocks-app .selected-td-form__border-radio:after{content:"·";border:3px solid var(--ub-colorPrimary);border-radius:50%;font-size:0;line-height:0;position:absolute;top:2px;right:2px}@media (width<=1840px){.blocks-app .selected-td-form__border-col{margin-top:0}}.blocks-app .selected-td-form__border-item.ant-form-item .ant-row{flex-direction:row;align-items:center}.blocks-app .selected-td-form__border-item.ant-form-item .ant-row .ant-col.ant-form-item-label{white-space:nowrap;padding-top:6px}.blocks-app .selected-td-form__padding-input input{text-align:center;padding:4px 8px}.blocks-app .selected-td-form__padding-input .ant-input-number-focused input{text-align:left}.blocks-app .selected-td-form__button--active,.blocks-app .selected-td-form__button--active:focus{color:#40a9ff;border-color:#40a9ff}.blocks-app .selected-td-form__tooltip{margin-left:4px}.blocks-app .selected-td-form__icon-radius{flex-shrink:0;justify-content:center;align-items:center;width:16px;height:16px;display:inline-flex}.blocks-app .selected-td-form__button_style{padding-left:10px;padding-right:10px;transition:none}.blocks-app .selected-td-form__border-radio{position:relative}.blocks-app .selected-td-form__border-radio:after{content:"·";border:3px solid var(--ub-colorPrimary);border-radius:50%;font-size:0;line-height:0;position:absolute;top:2px;left:2px;right:auto}.blocks-app .selected-td-form__border-col{margin-top:0;margin-bottom:0}@media (width<=1840px){.blocks-app .selected-td-form__border-col{margin-top:0}}.blocks-app .selected-td-form__border-item.ant-form-item .ant-col.ant-form-item-label{white-space:nowrap;padding-top:6px}.blocks-app .selected-td-form__padding-input{max-width:50px;margin-bottom:0}.blocks-app .selected-td-form__padding-input input{padding:4px 8px}.blocks-app .selected-td-form__br-input{margin-bottom:10px}.blocks-app .selected-td-form__tooltip{vertical-align:baseline;margin-left:4px}.blocks-app .selected-td-form__icon-radius{width:16px;height:100%}.blocks-app .selected-td-form__block{margin-bottom:24px}.blocks-app .carousel__slide{background-color:var(--ub-colorFillQuaternary);border-radius:calc(var(--ub-borderRadius) * 1px);margin-bottom:calc(var(--ub-formItemMarginBottomXS) * 1px);border:calc(var(--ub-borderWidth) * 1px) solid var(--ub-colorFillSecondaryDarken);padding:10px}.blocks-app .email-pane .box-shadow-control .ant-collapse-panel,.blocks-app .email-pane .border-control .ant-collapse-panel,.blocks-app .box-shadow-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body,.blocks-app .border-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body{overflow:visible}.blocks-app .selected-image-form__add-title{margin-top:-15px;margin-bottom:30px}.blocks-app .selected-image-form__add-title span{cursor:pointer}.blocks-app .selected-image-form__add-title span:hover{color:#40a9ff}.blocks-app .email-pane .box-shadow-control .ant-collapse-panel,.blocks-app .email-pane .border-control .ant-collapse-panel,.blocks-app .box-shadow-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body,.blocks-app .border-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body{overflow:visible}.blocks-app .selected-social-form{box-sizing:border-box;min-width:0;padding:0 0 16px}.blocks-app .selected-social-form .selected-social-form__form{padding:0 0 8px}.blocks-app .selected-social-form .selected-social-form__align-block{margin-bottom:16px}.blocks-app .selected-social-form .selected-social-form__align-block .ant-form-item,.blocks-app .selected-social-form .selected-social-form__section{margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__section--bordered{border-top:1px solid var(--ub-colorBorderSecondary,#f0f0f0);margin-top:16px;padding-top:16px}.blocks-app .selected-social-form .selected-social-form__section-title{color:var(--ub-colorText,#000000e0);margin:0 0 16px;font-size:14px;font-weight:400;line-height:1.2}.blocks-app .selected-social-form .selected-social-form__field-row{margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__field-icon{color:var(--ub-colorTextSecondary,#8c8c8c)}.blocks-app .selected-social-form .selected-social-form__input-full{width:100%}.blocks-app .selected-social-form .selected-social-form__items{flex-direction:column;gap:6px;margin-bottom:6px;display:flex}.blocks-app .selected-social-form .selected-social-form__card{border:1px solid var(--ub-colorBorderSecondary,#f0f0f0);background:var(--ub-colorFillTertiary,#f8f8f8);border-radius:6px;padding:12px;transition:border-color .15s,box-shadow .15s,opacity .15s}.blocks-app .selected-social-form .selected-social-form__card--dragging{opacity:.72}.blocks-app .selected-social-form .selected-social-form__card--drag-over{border-color:var(--ub-colorPrimary);box-shadow:0 0 0 1px var(--ub-colorPrimary)}.blocks-app .selected-social-form .selected-social-form__card-head{justify-content:space-between;align-items:center;gap:8px;margin-bottom:12px;display:flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-main{flex:auto;align-items:center;gap:8px;min-width:0;display:flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle{width:24px;height:24px;color:var(--ub-colorTextSecondary,#8c8c8c);cursor:grab;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;margin:0;padding:0;transition:color .15s,background-color .15s;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle:hover{color:var(--ub-colorText,#000000e0);background:var(--ub-colorFillSecondary,#f0f0f0)}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle:active{cursor:grabbing}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle:focus-visible{outline:2px solid var(--ub-colorPrimary);outline-offset:1px}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle .anticon{font-size:14px;transform:rotate(90deg)}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn{box-sizing:border-box;aspect-ratio:1;width:24px;min-width:24px;max-width:24px;height:24px;min-height:24px;max-height:24px;color:var(--ub-colorTextSecondary,#8c8c8c);background:0 0;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;padding:0;line-height:1;transition:color .15s,background-color .15s;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn .anticon{justify-content:center;align-items:center;line-height:0;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn svg{width:18px;height:18px;display:block}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn:hover{color:var(--ub-colorText,#000000e0);background:var(--ub-colorFillSecondary,#f0f0f0)}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn:focus-visible{outline:2px solid var(--ub-colorPrimary);outline-offset:1px}.blocks-app .selected-social-form .selected-social-form__card-title{min-width:0;color:var(--ub-colorText,#000000e0);flex:auto;font-size:14px;font-weight:300;line-height:1.2}.blocks-app .selected-social-form .selected-social-form__card-field.ant-row{margin-bottom:8px}.blocks-app .selected-social-form .selected-social-form__card-field.ant-row:last-child{margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__bg-color-row{width:100%;margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__bg-color-row .ant-col .ant-form-item{max-width:none;margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__bg-color-row .ant-form-item-control-input-content,.blocks-app .selected-social-form .selected-social-form__meta-block{width:100%}.blocks-app .selected-social-form .selected-social-form__meta-toggle-row{flex-wrap:wrap;align-items:center;display:flex}.blocks-app .selected-social-form .selected-social-form__meta-fields.is-hidden,.blocks-app .selected-social-form .selected-social-form__card-field.is-hidden{display:none}.blocks-app .selected-social-form .selected-social-form__meta-fields{flex-direction:column;gap:6px;width:100%;display:flex}.blocks-app .selected-social-form .selected-social-form__meta-fields .ant-form-item{margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__meta-fields .ant-form-item-control-input-content{width:100%}.blocks-app .selected-social-form .selected-social-form__platform-row{align-items:flex-start;gap:8px;width:100%;margin-bottom:8px;display:flex}.blocks-app .selected-social-form .selected-social-form__platform-field{flex:auto;min-width:0;margin-bottom:0!important}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn{box-sizing:border-box;width:calc(var(--ub-formControlHeight) * 1px);min-width:calc(var(--ub-formControlHeight) * 1px);max-width:calc(var(--ub-formControlHeight) * 1px);height:calc(var(--ub-formControlHeight) * 1px);min-height:calc(var(--ub-formControlHeight) * 1px);max-height:calc(var(--ub-formControlHeight) * 1px);line-height:calc((var(--ub-formControlHeight) - 2) * 1px);color:var(--ub-colorTextSecondary,#8c8c8c);border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;margin:0;padding:0;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn.ant-btn-icon-only .ant-btn-icon{justify-content:center;align-items:center;width:100%;height:100%;line-height:0;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn.ant-btn-icon-only .ant-btn-icon svg{display:block}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn:hover{color:var(--ub-colorText,#000000e0);background:var(--ub-colorFillSecondary,#f0f0f0)}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn:focus-visible{outline:2px solid var(--ub-colorPrimary);outline-offset:1px}.blocks-app .selected-social-form .selected-social-form__platform-select{width:100%}.blocks-app .selected-social-form .selected-social-form__platform-select.ant-select-single .ant-select-selector .ant-select-selection-item{align-self:center;align-items:center;line-height:1.2;display:flex}.blocks-app .selected-social-form .selected-social-form__platform-select .ant-select-arrow{color:var(--ub-colorTextSecondary,#8c8c8c)}.blocks-app .selected-social-form .selected-social-form__platform-select .ant-select-arrow svg{width:16px;height:16px}.blocks-app .selected-social-form .selected-social-form__platform-option{align-items:center;gap:4px;min-width:0;line-height:1.2;display:flex}.blocks-app .selected-social-form .selected-social-form__platform-option img{flex-shrink:0;width:30px;height:30px;margin-left:-6px;display:block}.blocks-app .selected-social-form .selected-social-form__platform-option-text{white-space:nowrap;text-overflow:ellipsis;line-height:1.2;overflow:hidden}.blocks-app .selected-social-form .selected-social-form__add-bar{background:var(--ub-colorFillTertiary,#f8f8f8);height:32px;color:var(--ub-colorText,#000000e0);border-radius:6px;justify-content:center;align-items:center;gap:8px;margin-top:0;padding:8px 12px;font-size:14px;font-weight:300;line-height:1.2;display:flex}.blocks-app .selected-social-form .selected-social-form__add-bar:not(:disabled):hover{background:var(--ub-colorFillSecondary,#f0f0f0);color:var(--ub-colorText,#000000e0)}.blocks-app .selected-social-form__platform-dropdown .ant-select-item-option{align-items:center}.blocks-app .selected-social-form__platform-dropdown .ant-select-item-option-content{align-items:center;min-height:0;line-height:1.2;display:flex}.blocks-app .selected-social-form__platform-dropdown .selected-social-form__platform-option{gap:0}.blocks-app .selected-social-form__platform-dropdown .selected-social-form__platform-option img{width:30px;height:30px;margin-left:-6px}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-suffix{flex-shrink:0;align-items:center;display:inline-flex}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-clear-icon:not(.ant-input-clear-icon-hidden){color:var(--ub-colorTextSecondary,#8c8c8c)}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-clear-icon:not(.ant-input-clear-icon-hidden) .anticon{vertical-align:0;justify-content:center;align-items:center;line-height:0;display:inline-flex}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-clear-icon:not(.ant-input-clear-icon-hidden) svg{width:16px;height:16px;display:block}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-clear-icon:not(.ant-input-clear-icon-hidden):hover{color:var(--ub-colorText,#000000e0)}.blocks-app .ant-app .email-pane__content-col .selected-social-form .ant-form-item.selected-social-form__card-field{margin-bottom:8px}.blocks-app .ant-app .email-pane__content-col .selected-social-form .ant-form-item.selected-social-form__card-field:last-child{margin-bottom:0}.blocks-app .email-pane .selected-social-form form.selected-social-form__form.element-controls,.blocks-app .email-pane .email-pane__collapse-wrapper.mobile-properties .selected-social-form form.selected-social-form__form.element-controls{height:auto;max-height:none}.blocks-app .ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-header{padding:20px 0;font-size:14px}.blocks-app .ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body{padding-left:0;padding-right:0}.blocks-app .ant-collapse.hidden-props .ant-alert{margin-bottom:24px}.blocks-app .selected_form-mobile-props{padding:24px 14px 0 24px}.blocks-app .email-pane_code-mode:not(.email-pane_code-mode-bottom) .selected-element-panel-content.selected-element-panel__hidden{visibility:hidden;opacity:0;height:0}.blocks-app .email-properties__collapse-panel .selected-element-panel-content{height:100%}.blocks-app .email-pane_code-mode:not(.email-pane_code-mode-bottom) .selected-element-panel-content{width:auto;box-shadow:var(--ub-boxShadowSecondary);border-radius:calc(var(--ub-borderRadius) * 1px);border:none;margin:0;padding:0 6px;transition:opacity .2s;position:absolute;top:-60px;left:50%;transform:translate(-50%)}.blocks-app .em-analytics__email-tab-properties,.blocks-app .em-analytics__email-tab-history{z-index:999;position:absolute}.blocks-app .em-analytics__email-tab-properties .email-pane__collapse-wrapper,.blocks-app .em-analytics__email-tab-history .email-pane__collapse-wrapper{z-index:999;box-shadow:0 1px 2px -2px #00000029,0 3px 6px #0000001f,0 5px 12px 4px #0000000f}.blocks-app .email-pane__col-wrapper_pinch .em-analytics__email-tab-properties .email-pane__collapse-wrapper,.blocks-app .email-pane__col-wrapper_pinch .em-analytics__email-tab-history .email-pane__collapse-wrapper{box-shadow:none}.blocks-app .selected-element-panel{height:100%;overflow:visible}.blocks-app .selected-element-panel button.selected-element-panel__extra-btn,.blocks-app .selected-element-panel__extra-btn button{height:24px;padding:0 7px}.blocks-app .selected-element-panel-content{position:relative}.blocks-app .selected-element-panel-content.column-settings-show_onecol{padding-top:75px}.blocks-app .selected-element-panel__columns-settings{z-index:1;width:100%;position:relative}.blocks-app .selected-element-panel__columns-settings__header{justify-content:space-between;align-items:center;gap:12px;margin-bottom:15px;display:flex}.blocks-app .selected-element-panel__columns-settings__header-title{color:var(--ub-colorText);font-size:14px;line-height:1.5}.blocks-app .selected-element-panel__columns-settings__title{white-space:nowrap;text-overflow:ellipsis;margin-bottom:20px;font-size:16px;font-weight:500;line-height:20px;overflow:hidden}.blocks-app .selected-element-panel__columns-settings__links{white-space:nowrap;justify-content:flex-end;align-items:center;gap:8px;margin-left:auto;font-size:14px;display:flex}.blocks-app .selected-element-panel__columns-settings__links span,.blocks-app .selected-element-panel__columns-settings__links button{align-items:center;gap:4px;display:inline-flex}.blocks-app .selected-element-panel__columns-settings__links span{color:var(--ub-colorLink);cursor:pointer}.blocks-app .selected-element-panel__columns-settings__links span:hover{color:#40a9ff}.blocks-app .selected-element-panel__columns-settings__links button{font:inherit;cursor:pointer;background:0 0;border:none;align-items:center;padding:0;display:inline-flex}.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 .ant-splitter{width:100%}.blocks-app .selected-element-panel__columns-settings__controls .ant-splitter-panel{min-width:44px;padding:0 4px;overflow:visible;container-type:inline-size}.blocks-app .selected-element-panel__columns-settings__controls__column{align-items:center;width:100%;min-width:36px;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,.blocks-app .selected-element-panel__columns-settings__controls__column__more{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;left:auto;right:16px}.blocks-app .selected-element-panel__columns-settings__controls__column__copy{color:#000000a6;top:-11px;left:auto;right:46px}.blocks-app .selected-element-panel__columns-settings__controls__column__swap{color:#000000a6;top:-12.5px;left:-16.5px}.blocks-app .selected-element-panel__columns-settings__controls__column__more{color:#000000a6;top:-12.5px;left:50%;transform:translate(-50%)}.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,.blocks-app .selected-element-panel__columns-settings__controls__column__more: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}@container (width<=140px){: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:none}.blocks-app .selected-element-panel__columns-settings__controls__column__more.ant-dropdown-open{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__more{display:flex}}.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;padding:0 4px}.blocks-app .selected-element-panel__columns-settings__controls__field .ant-input-number .ant-input-number-input{text-align:center;height:43px;padding:0}@container (width<=60px){.blocks-app .selected-element-panel__columns-settings__controls__field .ant-input-number-actions{display:none}}.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__columns-settings__mobile{margin-bottom:16px}.blocks-app .selected-element-panel__columns-settings__mobile>.selected-element-panel__columns-settings__links{margin-top:6px;line-height:20px}.blocks-app .selected-element-panel__columns-settings__mobile-column{white-space:nowrap;justify-content:center;align-items:center;display:flex;overflow:hidden}.blocks-app .selected-element-panel .selected-element-panel__columns-settings__divider-wrapper{display:block;position:relative}.blocks-app .selected-element-panel .selected-element-panel__columns-settings__divider{width:calc(100% + 80px);height:20px;margin:24px -40px 0;position:absolute;bottom:-20px}.blocks-app .selected-element-panel__content_abs{border:1px solid var(--ub-colorBorder);z-index:100;background-color:var(--ub-colorBgContainer);border-top:none;border-radius:0 0 8px 8px;width:100%;max-width:1400px;min-height:15px;margin-bottom:15px;transition:all .5s;display:flex;position:sticky;top:0;left:0}.blocks-app .selected-element-panel__mobile-switch{background-color:var(--ub-colorPrimary)}.blocks-app .selected-element-panel__mobile-switch.ant-switch-checked{background-color:var(--ub-colorInfo)}.blocks-app #selected_element_form_desktop_props .ant-alert-info .ant-alert-title{color:var(--ub-colorInfoText)}.blocks-app .ant-app .selected_form-mobile-switch{margin-bottom:20px;font-size:16px;font-weight:500}.blocks-app .ant-app .selected_form-mobile-props{--ub-colorPrimaryBorder:var(--ub-colorInfo);--ub-controlOutline:var(--ub-colorInfoBgHover)}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number:focus,.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-focused,.blocks-app .ant-app .selected_form-mobile-props .ant-input:focus,.blocks-app .ant-app .selected_form-mobile-props .ant-select-focused:not(.ant-select-disabled).ant-select:not(.ant-select-customize-input) .ant-select-selector,.blocks-app .ant-app .selected_form-mobile-props .ant-input-affix-wrapper:focus,.blocks-app .ant-app .selected_form-mobile-props .ant-input-affix-wrapper-focused{border-color:var(--ub-colorInfo);box-shadow:0 0 0 calc(var(--ub-controlOutlineWidth) * 1px) var(--ub-controlOutline)!important}:is(.blocks-app .ant-app .selected_form-mobile-props .ant-input-affix-wrapper>.ant-input:focus,.blocks-app .ant-app .selected_form-mobile-props .ant-space-compact:has(>.ant-input-number):focus-within>.ant-input-number,.blocks-app .ant-app .selected_form-mobile-props .input-select:focus-within .ant-input-affix-wrapper){box-shadow:none!important}.blocks-app .ant-app .selected_form-mobile-props .ant-select:not(.ant-select-disabled):hover .ant-select-selector{border-color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-select-item-option-selected:not(.ant-select-item-option-disabled){background-color:#edd3ed}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within{box-shadow:var(--ub-colorInfoBg) 0 0 0 2px!important}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within .ant-input-number-affix-wrapper:not(:last-child),.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within .ant-input-number-group-addon:last-child,.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within>.ant-input-number:first-child{border-color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within .ant-input-number-affix-wrapper:not(:last-child){border-right-color:var(--ub-colorFillSecondaryDarken)}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group-addon .ant-select-open .ant-select-selector,.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group-addon .ant-select-focused .ant-select-selector,.blocks-app .ant-app .selected_form-mobile-props .ant-radio-button-wrapper:hover,.blocks-app .ant-app .selected_form-mobile-props .ant-collapse>.ant-collapse-item>.ant-collapse-header:hover{color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-btn-background-ghost.ant-btn-primary{color:var(--ub-colorInfo);border-color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):first-child,.blocks-app .ant-app .selected_form-mobile-props .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled),.blocks-app .ant-app .selected_form-mobile-props .selected-td-form__button--active{background-color:var(--ub-colorInfoBg)!important;color:var(--ub-colorInfoText)!important}.blocks-app .ant-app .selected_form-mobile-props .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):before,.blocks-app .ant-app .selected_form-mobile-props .ant-switch-checked{background-color:var(--ub-colorInfoTextActive)}.blocks-app .ant-app .selected_form-mobile-props .ant-switch.ant-switch-checked:hover:not(.ant-switch-disabled){background-color:var(--ub-colorInfoHover)}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-action:hover .ant-input-number-action-up-inner,.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-action:hover .ant-input-number-action-down-inner{color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-alert-info{background-color:var(--ub-colorInfoBg);border:none}.blocks-app .ant-app .selected_form-mobile-props .ant-alert-info .ant-alert-title{color:var(--ub-colorInfoText)}.blocks-app .ant-app .selected_form-mobile-props .selected-element-panel__columns-settings__controls__column.current .selected-element-panel__columns-settings__controls__field{background:var(--ub-colorInfoBg);border-color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .selected-element-panel__columns-settings__links span{color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .selected-element-panel__columns-settings__links span:hover{color:var(--ub-colorInfoHover)}.blocks-app .selected-element-panel__columns-settings.selected_form-mobile-props{padding:0}.blocks-app .selected-element-panel__extra-btn-container{position:absolute;top:13px;right:50px}.blocks-app .selected-element-panel__extra-btn-container .ant-btn-text:disabled{color:var(--ub-colorTextQuaternary)}.blocks-app .email-properties__collapse .ant-tabs-content>.ant-tabs-tabpane{height:100%}.blocks-app .ant-app .columns-presets{width:100%;margin-bottom:calc(var(--ub-formItemMarginBottomMD) * 1px);align-items:center;gap:7px;display:flex}.blocks-app .ant-app .columns-presets .ant-btn{flex:1;min-width:0;padding:7px 9px;line-height:1!important}.blocks-app .email-pane__collapse-wrapper .ant-modal-close{width:24px;height:24px;font-size:16px}.blocks-app .email-pane__collapse-wrapper .ant-modal-close .anticon{line-height:0}.blocks-app .groups-management__group-select label{width:100%}.blocks-app .groups-management__group-select label:after{display:none}.blocks-app .groups-management__group_menu{border-color:var(--ub-colorFillSecondaryDarken)}.blocks-app .annotations-preview{z-index:1100;pointer-events:auto;background:#fff;border-radius:8px;width:300px;padding:16px;position:absolute;top:0;box-shadow:0 4px 12px #00000026}.blocks-app .annotations-preview--popover{opacity:1;z-index:1;pointer-events:auto;width:420px;max-height:calc(100vh - 48px);position:absolute;top:0;left:-15px;overflow:hidden;transform:translate(-100%)}.blocks-app .annotations-preview__content{pointer-events:none}.blocks-app .annotations-preview__type{color:#202124;margin-bottom:10px;font-size:13px;font-weight:600}.blocks-app .annotations-preview__footer{pointer-events:auto;justify-content:space-between;align-items:center;gap:8px;margin-top:12px;display:flex}.blocks-app .annotations-preview__apply-wrap{margin-left:auto;display:inline-flex}.blocks-app .email-pane__col-wrapper_reverse .annotations-preview--popover{left:auto;right:-15px;transform:translate(100%)}.blocks-app .preview-skeleton{background:linear-gradient(90deg,#f1f3f4 25%,#e8eaed 50%,#f1f3f4 75%) 0 0/200% 100%;border-radius:4px;flex-shrink:0;animation:1.4s ease-in-out infinite preview-skeleton-shimmer;display:block}.blocks-app .preview-skeleton--circle{border-radius:50%}.blocks-app .preview-skeleton--block{border-radius:0}@keyframes preview-skeleton-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}.blocks-app .product-carousel-preview__header{margin-bottom:12px}.blocks-app .product-carousel-preview__header-main{align-items:flex-start;gap:12px;display:flex}.blocks-app .product-carousel-preview__logo{object-fit:cover;border:1px solid #f0f0f0;border-radius:50%;flex-shrink:0;width:40px;height:40px}.blocks-app .product-carousel-preview__logo-skeleton{border:none}.blocks-app .product-carousel-preview__subject-skeleton{flex:1;min-width:0;max-width:220px}.blocks-app .product-carousel-preview__header-text{flex:1;min-width:0}.blocks-app .product-carousel-preview__header-row{justify-content:space-between;align-items:center;gap:8px;display:flex}.blocks-app .product-carousel-preview__header-row--subject{align-items:flex-start;margin-top:2px}.blocks-app .product-carousel-preview__brand-name{color:#202124;font-size:14px;font-weight:600;line-height:20px}.blocks-app .product-carousel-preview__time{color:#5f6368;flex-shrink:0;font-size:11px;line-height:16px}.blocks-app .product-carousel-preview__subject-line{color:#202124;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-size:13px;line-height:18px;overflow:hidden}.blocks-app .product-carousel-preview__star-icon{color:#5f6368;flex-shrink:0}.blocks-app .product-carousel-preview__carousel{gap:8px;margin:0 -2px;padding-bottom:4px;display:flex;overflow-x:auto}.blocks-app .product-carousel-preview__carousel::-webkit-scrollbar{display:none}.blocks-app .product-carousel-preview__carousel{-ms-overflow-style:none;scrollbar-width:none}.blocks-app .product-carousel-preview__card{background:#fff;border:1px solid #dadce0;border-radius:8px;flex:0 0 128px;width:128px;overflow:hidden}.blocks-app .product-carousel-preview__card-image{aspect-ratio:1;background-color:#f1f3f4;background-position:50%;background-size:cover;width:100%}.blocks-app .product-carousel-preview__card-image-skeleton{aspect-ratio:1;width:100%}.blocks-app .product-carousel-preview__card-body{padding:8px}.blocks-app .product-carousel-preview__card-headline{color:#3c4043;-webkit-line-clamp:2;-webkit-box-orient:vertical;min-height:32px;font-size:12px;line-height:16px;display:-webkit-box;overflow:hidden}.blocks-app .product-carousel-preview__card-headline-skeleton{flex-direction:column;gap:4px;min-height:32px;display:flex}.blocks-app .product-carousel-preview__card-prices{flex-wrap:wrap;align-items:baseline;gap:6px;margin-top:6px;display:flex}.blocks-app .product-carousel-preview__card-sale-price{color:#202124;font-size:13px;font-weight:600;line-height:16px}.blocks-app .product-carousel-preview__card-original-price{color:#5f6368;font-size:12px;line-height:16px;text-decoration:line-through}.blocks-app .single-image-preview__header{margin-bottom:10px}.blocks-app .single-image-preview__header-main{align-items:flex-start;gap:12px;display:flex}.blocks-app .single-image-preview__logo{object-fit:cover;border:1px solid #f0f0f0;border-radius:50%;flex-shrink:0;width:40px;height:40px}.blocks-app .single-image-preview__logo-skeleton{border:none}.blocks-app .single-image-preview__header-text{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.blocks-app .single-image-preview__header-row{justify-content:space-between;align-items:center;gap:8px;display:flex}.blocks-app .single-image-preview__brand-name{color:#202124;font-size:14px;font-weight:600;line-height:20px}.blocks-app .single-image-preview__time{color:#5f6368;flex-shrink:0;font-size:11px;line-height:16px}.blocks-app .single-image-preview__subject-line{color:#202124;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:600;line-height:18px;overflow:hidden}.blocks-app .single-image-preview__subject-skeleton{max-width:100%}.blocks-app .single-image-preview__promo-row{justify-content:space-between;align-items:center;gap:8px;min-height:18px;display:flex}.blocks-app .single-image-preview__promo-content{flex:1;align-items:center;gap:4px;min-width:0;display:flex}.blocks-app .single-image-preview__promo-icon{color:#188038;flex-shrink:0}.blocks-app .single-image-preview__promo-icon-skeleton{border-radius:4px;flex-shrink:0}.blocks-app .single-image-preview__promo-badge{color:#188038;flex-shrink:0;font-size:13px;font-weight:500;line-height:16px}.blocks-app .single-image-preview__promo-separator{color:#5f6368;flex-shrink:0;font-size:13px;line-height:16px}.blocks-app .single-image-preview__promo-code{text-overflow:ellipsis;white-space:nowrap;color:#5f6368;min-width:0;font-size:13px;line-height:16px;overflow:hidden}.blocks-app .single-image-preview__promo-skeleton{flex-shrink:0}.blocks-app .single-image-preview__star-icon{color:#5f6368;flex-shrink:0}.blocks-app .single-image-preview__card{background:#fff;border:1px solid #dadce0;border-radius:10px;width:calc(100% - 76px);max-width:100%;margin-left:52px;margin-right:24px;overflow:hidden}.blocks-app .single-image-preview__card-image{aspect-ratio:1.91;background-color:#f1f3f4;background-position:50%;background-size:cover;width:100%}.blocks-app .single-image-preview__card-image-skeleton{aspect-ratio:1.91;width:100%}.blocks-app .single-image-preview__card-body{padding:10px 12px 12px}.blocks-app .single-image-preview__card-description{color:#3c4043;-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:14px;line-height:16px;display:-webkit-box;overflow:hidden}.blocks-app .single-image-preview__card-description-skeleton{flex-direction:column;gap:6px;min-height:34px;display:flex}.blocks-app .deal-annotation-preview__header-main{align-items:flex-start;gap:12px;display:flex}.blocks-app .deal-annotation-preview__logo{object-fit:cover;border:1px solid #f0f0f0;border-radius:50%;flex-shrink:0;width:40px;height:40px}.blocks-app .deal-annotation-preview__logo-skeleton{border:none}.blocks-app .deal-annotation-preview__header-text{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.blocks-app .deal-annotation-preview__header-row{justify-content:space-between;align-items:center;gap:8px;display:flex}.blocks-app .deal-annotation-preview__brand-name{color:#202124;font-size:14px;font-weight:600;line-height:20px}.blocks-app .deal-annotation-preview__time{color:#5f6368;flex-shrink:0;font-size:11px;line-height:16px}.blocks-app .deal-annotation-preview__subject-line{color:#202124;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:600;line-height:18px;overflow:hidden}.blocks-app .deal-annotation-preview__subject-skeleton{max-width:100%}.blocks-app .deal-annotation-preview__promo-row{justify-content:space-between;align-items:center;gap:8px;min-height:18px;display:flex}.blocks-app .deal-annotation-preview__promo-content{flex:1;align-items:center;gap:4px;min-width:0;display:flex}.blocks-app .deal-annotation-preview__promo-icon{color:#188038;flex-shrink:0}.blocks-app .deal-annotation-preview__promo-icon-skeleton{border-radius:4px;flex-shrink:0}.blocks-app .deal-annotation-preview__promo-badge{color:#188038;flex-shrink:0;font-size:13px;font-weight:500;line-height:16px}.blocks-app .deal-annotation-preview__promo-separator{color:#5f6368;flex-shrink:0;font-size:13px;line-height:16px}.blocks-app .deal-annotation-preview__promo-code{text-overflow:ellipsis;white-space:nowrap;color:#5f6368;min-width:0;font-size:13px;line-height:16px;overflow:hidden}.blocks-app .deal-annotation-preview__promo-skeleton{flex-shrink:0}.blocks-app .deal-annotation-preview__star-icon{color:#5f6368;flex-shrink:0}.blocks-app .deal-card-preview{background:#f1f3f4;border-radius:12px;flex-direction:column;gap:12px;padding:16px;display:flex}.blocks-app .deal-card-preview__sender{color:#202124;font-size:12px;font-weight:600;line-height:16px}.blocks-app .deal-card-preview__headline{color:#202124;word-break:break-word;font-size:22px;font-weight:400;line-height:28px}.blocks-app .deal-card-preview__headline-skeleton{max-width:100%}.blocks-app .deal-card-preview__details{align-items:flex-start;gap:24px;display:flex}.blocks-app .deal-card-preview__expires{align-items:flex-start;gap:8px;min-width:0;display:flex}.blocks-app .deal-card-preview__clock-icon{color:#5f6368;flex-shrink:0;margin-top:1px}.blocks-app .deal-card-preview__code{min-width:0}.blocks-app .deal-card-preview__detail-text{flex-direction:column;gap:2px;min-width:0;display:flex}.blocks-app .deal-card-preview__detail-label{color:#202124;font-size:12px;font-weight:600;line-height:16px}.blocks-app .deal-card-preview__detail-value{color:#5f6368;word-break:break-word;font-size:12px;font-weight:400;line-height:16px}.blocks-app .deal-card-preview__detail-skeleton{margin-top:1px}.blocks-app .deal-card-preview__actions{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.blocks-app .deal-card-preview__button{color:#001d35;white-space:nowrap;background:#c2e7ff;border-radius:999px;justify-content:center;align-items:center;padding:8px 16px;font-size:13px;font-weight:500;line-height:16px;display:inline-flex}.blocks-app .annotations-panel .selected-social-form__section-title{align-items:baseline;gap:6px;display:flex}.blocks-app .annotations-panel__docs-hint{color:var(--ub-colorTextSecondary,#8c8c8c);margin-top:16px;font-size:12px;font-weight:300;line-height:1.4}.blocks-app .annotations-panel__section-hint{color:var(--ub-colorTextSecondary,#8c8c8c);font-size:12px;font-weight:300}.blocks-app .annotations-panel__field-tooltip-wrap{width:100%;margin-bottom:8px;display:block}.blocks-app .annotations-panel__cards-section{margin-top:16px}.blocks-app .email-pane__content-col .selected-social-form.annotations-panel .selected-social-form__form .ant-form-item.selected-social-form__card-field:last-child{margin-bottom:8px}.blocks-app .email-settings{height:100%;display:flex}.blocks-app .email-settings__collapse{flex-direction:column;width:100%;height:100%;min-height:0;max-height:100%;display:flex;overflow:hidden}.blocks-app .email-settings__collapse.ant-collapse{border:0}.blocks-app .email-settings__collapse.secondary-tabs.ant-tabs .ant-tabs-content-holder{flex:1;min-height:0;overflow:hidden auto}.blocks-app .email-settings__collapse.secondary-tabs.ant-tabs .ant-tabs-content,.blocks-app .email-settings__collapse.secondary-tabs.ant-tabs .ant-tabs-tabpane-active{overflow:visible}.blocks-app .email-settings__collapse-panel:last-child.ant-collapse-item-active{padding-bottom:12px}.blocks-app .email-settings__collapse-panel.ant-collapse-item{min-height:50px;overflow:hidden}.blocks-app .email-settings__collapse-panel-content{width:100%}.blocks-app .email-settings .ant-collapse-body{padding:0 2px 0 12px;overflow:hidden}.blocks-app #content_appearance_panel_form button.ant-btn:not(.ant-btn-primary):hover{border-color:#d9d9d9}.blocks-app .section-title-bull{color:var(--ub-colorTextQuaternary)}.blocks-app .appearance-panel__content-styles{flex-direction:column;height:100%;min-height:0;display:flex}.blocks-app .appearance-panel__content-styles.ant-tabs{height:100%;min-height:0}.blocks-app .appearance-panel__content-styles .ant-tabs-content-holder,.blocks-app .appearance-panel__content-styles .ant-tabs-content,.blocks-app .appearance-panel__content-styles .ant-tabs-tabpane,.blocks-app .appearance-panel__content-styles .ant-tabs-tabpane-active,.blocks-app .appearance-panel__content-styles .email-settings__collapse-panel-content,.blocks-app .appearance-panel__content-styles .appearance-panel,.blocks-app .appearance-panel__content-styles .element-controls{min-height:0}.blocks-app .appearance-panel__content-styles .ant-tabs-content-holder,.blocks-app .appearance-panel__content-styles .ant-tabs-content,.blocks-app .appearance-panel__content-styles .ant-tabs-tabpane-active,.blocks-app .appearance-panel__content-styles .email-settings__collapse-panel-content,.blocks-app .appearance-panel__content-styles .appearance-panel{flex-direction:column;flex:1;display:flex}.blocks-app .appearance-panel__content-styles .ant-tabs-content-holder{overflow:hidden auto}.blocks-app .appearance-panel__content-styles .ant-tabs-content,.blocks-app .appearance-panel__content-styles .ant-tabs-tabpane-active{overflow:visible}.blocks-app .modal-select-role__cards-grid{grid-gap:20px;grid-template-columns:repeat(auto-fit,322px);padding:10px 24px 24px;display:grid}.blocks-app .modal-select-role .element-card__select-role{cursor:pointer;height:300px}.blocks-app .modal-select-role .element-card__select-role img{cursor:pointer;background-color:#fff;width:100%}.blocks-app .modal-select-role .element-card__select-role .ant-card-body{height:50px}.blocks-app .modal-select-role__title-wrapper{display:inline-block}.blocks-app .ai-response-paragraph{margin-bottom:16px}.blocks-app .em-analytics__email-tab-discuss{overflow:auto!important}.blocks-app .discuss-ai-wrapper{flex-direction:column;flex:1;height:100%;min-height:0;display:flex}.blocks-app .discuss-ai-wrapper .ant-tabs-content-holder,.blocks-app .discuss-ai-wrapper .ant-tabs-content,.blocks-app .discuss-ai-wrapper .ant-tabs-tabpane,.blocks-app .discuss-ai-wrapper .ant-tabs-tabpane-active{flex-direction:column;flex:1;min-height:0;display:flex}.blocks-app .discuss-ai-wrapper .ant-tabs-content{overflow:hidden auto}.blocks-app .discuss-ai-wrapper .discuss-main{min-height:0}.blocks-app .ant-tabs-content .discuss-ai{background-color:#fafafa;border:1px solid #f1ebeb;border-radius:8px;margin:0 0 20px;padding:24px 36px 0}.dark .blocks-app .ant-tabs-content .discuss-ai{background-color:#181818;border-color:#262626}.blocks-app .discuss-main{margin:0}.blocks-app .discuss-main__form{position:relative}.blocks-app .discuss-main__buttons{justify-content:space-between;display:flex}.blocks-app .discuss-main>.comment-list{margin-bottom:16px}.blocks-app .discuss-main>form{padding-bottom:20px}.blocks-app .discuss-main .ant-comment-actions{opacity:.6;transition:all .3s cubic-bezier(.645,.045,.355,1)}.blocks-app .discuss-main .replyEditMode{opacity:.5}.blocks-app .modal-select-role{max-height:1400px}.blocks-app .modal-select-role .element-card.element-card_select-role .ant-card-cover{border:none;height:auto}.blocks-app .modal-select-role .element-card .ant-card-body{height:auto}.blocks-app .modal-select-role__cards-grid{grid-gap:20px;grid-template-columns:repeat(3,260px);width:auto;padding:10px 24px 24px;display:grid}.blocks-app .modal-select-role .element-card_select-role{cursor:pointer}.blocks-app .modal-select-role .element-card_select-role img,.blocks-app .modal-select-role .element-card__no-img{background-color:#fff}@media (width<=1200px){.blocks-app .modal-select-role__cards-grid{grid-template-columns:repeat(4,240px);width:auto}.blocks-app .modal-select-role .element-card__title{font-size:15px}}.blocks-app .ant-comment .ant-comment-avatar{cursor:auto}.blocks-app .ant-comment .ant-comment-avatar .anticon-robot{background:var(--ub-colorInfo)}.blocks-app .ant-comment .ant-comment-avatar .anticon-user{background:var(--ub-colorPrimary)}.blocks-app .ant-comment.ai-comment .ant-comment-avatar .anticon-robot{background:var(--ub-colorInfo)}.blocks-app .ant-comment.ai-comment .ant-comment-avatar .anticon-user{background:var(--ub-colorPrimary)}.blocks-app .ant-comment.ai-comment .ai-guide__example{border-left:1px solid #3b91ff;padding-left:15px;font-style:italic}.blocks-app .ant-comment.ai-comment .ai-guide__example strong{font-weight:500}.blocks-app .ant-comment-content-detail{margin-top:16px;margin-left:-30px}.blocks-app .ant-comment-content-detail p{white-space:normal;margin:16px 0;line-height:1.4}.blocks-app .ant-comment-content-detail ul{margin:16px 0}.blocks-app .ant-comment-content-detail .buttons-variants{white-space:normal;margin-left:0;padding-left:0}.blocks-app body.dark .ant-comment-content-detail .buttons-variants .ant-btn-default:hover{background:#e6f7ff}.blocks-app .ant-comment-content-detail .buttons-variants li{white-space:normal;margin-bottom:4px}.blocks-app .ant-comment-content-detail .buttons-variants .ant-btn.ant-btn-sm{text-align:left;height:auto;padding:4px 7px;line-height:1.4}.blocks-app .ant-comment-content-detail .ai-response-variant{margin:15px 0}.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-title,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-preheader,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-copy{cursor:pointer;background-color:#1890ff33;border-radius:4px;margin:4px 0;padding:3px 8px;line-height:1.4;transition:all .3s;display:block}.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-title:hover,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-preheader:hover,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-copy:hover{color:#000}.blocks-app body.dark .ant-comment-content-detail .ai-response-variant .ai-response-title:hover,.blocks-app body.dark .ant-comment-content-detail .ai-response-variant .ai-response-preheader:hover,.blocks-app body.dark .ant-comment-content-detail .ai-response-variant .ai-response-copy:hover{color:#fff}.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-title:hover,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-preheader:hover,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-copy:hover{background-color:#1890ff55}.blocks-app .limit-upgrade-modal.ant-modal{max-width:calc(100vw - 24px)}.blocks-app .limit-upgrade-modal .ant-modal-content{border-radius:16px;padding:0;overflow:hidden;box-shadow:0 12px 24px -4px #191d3a14}.blocks-app .limit-upgrade-modal .ant-modal-header{display:none}.blocks-app .limit-upgrade-modal .ant-modal-content .ant-modal-body{padding:0}.blocks-app .limit-upgrade-modal__wrap{background:var(--ub-colorBgContainer);flex-direction:column;align-items:center;width:400px;max-width:100%;display:flex}.blocks-app .limit-upgrade-modal__header{z-index:1;box-sizing:border-box;justify-content:flex-end;align-items:center;display:flex;position:absolute;top:20px;right:20px}.blocks-app .limit-upgrade-modal__close{background:var(--ub-colorBgContainer);width:34px;height:34px;color:var(--ub-colorTextSecondary);cursor:pointer;border:none;border-radius:6px;justify-content:center;align-items:center;margin:0;padding:0;transition:background .15s,color .15s;display:flex}.blocks-app .limit-upgrade-modal__close:hover{background:var(--ub-colorFillTertiary);color:var(--ub-colorText)}.blocks-app .limit-upgrade-modal__close .anticon{font-size:16px}.blocks-app .limit-upgrade-modal__body{box-sizing:border-box;flex-direction:column;align-items:center;gap:16px;width:100%;padding:44px 40px 24px;display:flex}.blocks-app .limit-upgrade-modal__title{text-align:center;max-width:320px;color:var(--ub-colorText);margin:0;font-size:18px;font-weight:400;line-height:130%}.blocks-app .limit-upgrade-modal__subtitle{text-align:center;max-width:320px;color:var(--ub-colorTextSecondary);margin:0;font-size:14px;font-weight:100;line-height:120%}.blocks-app .limit-upgrade-modal__limits-row{flex-flow:wrap;justify-content:center;align-items:center;gap:8px;width:100%;max-width:320px;display:flex}.blocks-app .limit-upgrade-modal__icon-circle{box-sizing:border-box;border:1px solid var(--ub-colorText);width:34px;height:34px;color:var(--ub-colorText);border-radius:32px;flex:none;justify-content:center;align-items:center;padding:8px;display:flex}.blocks-app .limit-upgrade-modal__icon-circle .anticon{font-size:18px}.blocks-app .limit-upgrade-modal__icon-circle svg{flex-shrink:0;width:18px;height:18px;display:block}.blocks-app .limit-upgrade-modal__limit-old{color:#f85243;flex-shrink:0;font-size:40px;font-weight:100;line-height:100%}.blocks-app .limit-upgrade-modal__arrow-btn{color:#fff;background:#8946fb;border-radius:38px;flex:none;justify-content:center;align-items:center;width:34px;height:34px;display:flex}.blocks-app .limit-upgrade-modal__arrow-icon{font-size:16px;transform:rotate(45deg)}.blocks-app .limit-upgrade-modal__limit-new{color:#7ed846;flex-shrink:0;font-size:40px;font-weight:400;line-height:100%}.blocks-app .limit-upgrade-modal__limit-new--infinity{font-size:36px;line-height:40px}.blocks-app .limit-upgrade-modal__divider{border:none;border-top:1px solid var(--ub-colorBorderSecondary);width:100%;height:0;margin:0}.blocks-app .limit-upgrade-modal__footer{box-sizing:border-box;flex-direction:column;justify-content:center;align-items:center;width:100%;padding:16px 0;display:flex}.blocks-app .limit-upgrade-modal__footer--dual{flex-flow:wrap;justify-content:center;align-items:center;gap:8px;padding:16px}.blocks-app .limit-upgrade-modal__cta.ant-btn-primary{min-width:147px;height:32px;box-shadow:none;background:#2884ff;border-color:#2884ff;border-radius:6px;padding:8px 16px;font-size:14px;font-weight:400;line-height:19px}.blocks-app .limit-upgrade-modal__cta.ant-btn-primary:hover{background:#1a75f0;border-color:#1a75f0}.blocks-app .limit-upgrade-modal__cta-secondary.ant-btn-default{border-color:var(--ub-colorBorder);min-width:147px;height:32px;color:var(--ub-colorText);box-shadow:none;border-radius:6px;padding:8px 16px;font-size:14px;font-weight:400;line-height:19px}.blocks-app .limit-upgrade-modal__cta-secondary.ant-btn-default:hover{color:#2884ff;border-color:#2884ff}.blocks-app .optimise-wrapper{flex-direction:column;flex:1;height:100%;min-height:0;display:flex}.blocks-app .optimise-wrapper .ant-tabs-content-holder,.blocks-app .optimise-wrapper .ant-tabs-content,.blocks-app .optimise-wrapper .ant-tabs-tabpane,.blocks-app .optimise-wrapper .ant-tabs-tabpane-active{flex-direction:column;flex:1;min-height:0;display:flex}.blocks-app .optimise-wrapper .ant-tabs-content{overflow:hidden auto}.blocks-app .optimise{background:0 0;border:none;min-height:0}.blocks-app .optimise.ant-collapse>.ant-collapse-item:last-child{border-bottom:none!important}.blocks-app .optimise .ant-list-item-meta-title{-webkit-user-select:text;user-select:text}.blocks-app .optimise__summary{justify-content:space-between;width:100%;display:flex}.blocks-app .optimise__summary>div:not(:last-child){margin-right:10px}.blocks-app .optimise__summary h4{line-height:1}.blocks-app .optimise .ant-divider.ant-divider-horizontal{border-top:1px solid var(--ub-colorBorderSecondary);background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);width:calc(100% + 50px);margin:26px -25px}.blocks-app .optimise.ant-collapse>.ant-collapse-item{border-bottom:1px solid var(--ub-colorBorderSecondary)}.blocks-app .optimise.ant-collapse>.ant-collapse-item .ant-collapse-header{padding:12px 0 12px 24px}.blocks-app .optimise.ant-collapse>.ant-collapse-item .ant-collapse-panel{border-top:none}.blocks-app .optimise.ant-collapse>.ant-collapse-item .ant-collapse-body{padding:24px 14px 12px 24px;overflow-y:hidden;padding-top:0!important;padding-right:24px!important}.blocks-app .optimise .valid{white-space:nowrap;color:var(--ub-colorSuccessText)}.blocks-app .optimise .error{white-space:nowrap;color:var(--ub-colorErrorText)}.blocks-app .optimise .warning{white-space:nowrap;color:var(--ub-colorWarningText)}.blocks-app .optimise__title-wrapper{justify-content:space-between;align-items:flex-start;width:100%;display:flex}.blocks-app .optimise__title-wrapper h5{width:70%}.blocks-app .optimise__link{-webkit-user-select:text;user-select:text}.blocks-app .optimise__link:hover{color:var(--ub-colorLinkHover)!important}.blocks-app .email-pane .optimise .ant-collapse-panel{height:calc(100% - 184px)}.blocks-app .optimise__image-item .image-item__meta_fail .ant-list-item-meta-avatar{background:linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-colorBorder) 0), linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-colorBorder) 0);background-position:0 0,4px 4px;background-size:8px 8px;border-radius:6px}.blocks-app .optimise__image-item .image-item__meta.ant-list-item-meta{align-items:stretch}.blocks-app .optimise__image-item .image-item__image{cursor:pointer;object-fit:contain;border-radius:calc(var(--ub-borderRadius) * 1px);background:linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-colorBorder) 0), linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-colorBorder) 0);background-position:0 0,4px 4px;background-size:8px 8px}.blocks-app .optimise__image-item .image-item__image+.ant-image-mask{border-radius:calc(var(--ub-borderRadius) * 1px)}.blocks-app .optimise__image-item .image-item__image_fail{height:92px!important}.blocks-app .optimise .ant-list .ant-list-item .ant-list-item-meta .ant-list-item-meta-avatar{margin-inline-end:12px}.blocks-app .optimise .warnings{color:var(--ub-colorWarningText)}.blocks-app .optimise .errors{color:var(--ub-colorErrorText)}.blocks-app .optimise .valid{color:var(--ub-colorSuccessText)}.blocks-app .optimise__button.warnings{border-color:var(--ub-colorWarningBorder);background:var(--ub-colorWarningBg)}.blocks-app .optimise__button.warnings:not(.ant-tag-checkable-checked):hover{border-color:var(--ub-colorWarningBorderHover);color:var(--ub-colorWarningTextHover);background:var(--ub-colorWarningBgHover)}.blocks-app .optimise__button.warnings_active{color:#fff;background-color:var(--ub-colorWarningActive);border-color:var(--ub-colorWarningActive)}.blocks-app .optimise__button.errors{border-color:var(--ub-colorErrorBorder);background:var(--ub-colorErrorBg)}.blocks-app .optimise__button.errors:not(.ant-tag-checkable-checked):hover{border-color:var(--ub-colorErrorBorderHover);color:var(--ub-colorErrorTextHover);background:var(--ub-colorErrorBgHover)}.blocks-app .optimise__button.errors_active{color:#fff;background-color:var(--ub-colorErrorActive);border-color:var(--ub-colorErrorActive)}.blocks-app .optimise__button.valid{border-color:var(--ub-colorSuccessBorder);background:var(--ub-colorSuccessBg)}.blocks-app .optimise__button.valid:not(.ant-tag-checkable-checked):hover{border-color:var(--ub-colorSuccessBorderHover);color:var(--ub-colorSuccessTextHover);background:var(--ub-colorSuccessBgHover)}.blocks-app .optimise__button.valid_active{color:#fff;background-color:var(--ub-colorSuccessActive);border-color:var(--ub-colorSuccessActive)}.blocks-app .optimise .ant-alert-info{width:100%;margin-top:5px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__divider-no-margin.selected-td-form__divider{margin-top:0;margin-bottom:0}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-col.optimise__col-align-right{text-align:right}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-24{margin-bottom:24px}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-16{margin-bottom:16px}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-14{margin-bottom:14px}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-12{margin-bottom:12px}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-8{margin-bottom:8px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__link-blue.ant-typography{color:#177ddc;text-decoration:underline}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-image.optimise__image-auto-height{height:auto}.blocks-app .ant-app .email-pane .ant-tabs .optimise__text-clickable.ant-typography{cursor:pointer}.blocks-app .ant-app .email-pane .ant-tabs .optimise__valid-title.ant-typography{margin:0;font-size:14px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__valid-title-space.ant-space{flex-wrap:wrap}.blocks-app .ant-app .email-pane .ant-tabs .optimise__alert-custom.ant-alert{width:100%;padding:14px 14px 10px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__summary-title.ant-typography{margin-bottom:0}.blocks-app .ant-app .email-pane .ant-tabs .optimise__summary-label{font-size:12px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-score-title.ant-typography{margin:0}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-score-value{margin-right:12px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-score-text.ant-typography{margin-right:12px;font-size:20px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-report-score.ant-typography{font-size:20px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-report-description{margin-left:12px}.blocks-app .img-preview{background-color:var(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadiusXL) * 1px);box-shadow:var(--ub-boxShadow);opacity:0;border:1px solid #fff;max-width:668px;padding:3px;transition:opacity .3s,transform .3s;position:absolute;top:0;left:-15px;transform:translate(-99%)}.blocks-app .img-preview-content{border:1px solid var(--ub-colorBorderSecondary);border-radius:calc(var(--ub-borderRadiusLG) * 1px);background:linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 25%, transparent 75%, var(--ub-colorBorder) 75%), linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 25%, transparent 75%, var(--ub-colorBorder) 75%);background-position:0 0,4px 4px;background-size:8px 8px;overflow:hidden}.blocks-app .img-preview-content table{border-collapse:initial}.dark .blocks-app .img-preview{border-color:#4f4f4f}.blocks-app .indexing-tray{z-index:4010;width:360px;max-width:calc(100vw - 40px);position:fixed;bottom:20px;right:20px}.blocks-app .indexing-tray__card{box-shadow:0 6px 16px #0000001f}.blocks-app .indexing-tray__title{font-size:14px;margin:0!important}.blocks-app .blocks-search{height:100%;min-height:0;overflow:visible}.blocks-app .blocks-search .ant-select-clear{right:30px}.blocks-app .blocks-search form{z-index:1;width:85%;padding:16px 0 0 24px;position:absolute;top:0;left:0}.blocks-app .blocks-search__form{display:none}.blocks-app .blocks-search__form.is_search{display:block}.blocks-app .blocks-search__divider-wrapper{z-index:1;margin-top:12px;position:relative}.blocks-app .blocks-search__divider{pointer-events:none;width:auto;height:20px;margin:24px 0 0;position:absolute;bottom:-20px;left:-24px;right:-13px}.blocks-app .blocks-search__type-wrapper{min-width:35%;min-height:0;padding:20px 24px 14px 0;overflow-y:auto}.blocks-app .blocks-search__type-wrapper ul{padding:0}.blocks-app .blocks-search__type-wrapper li{cursor:pointer;color:var(--ub-colorTextSecondary);text-align:left;margin-bottom:12px;line-height:1.2;list-style:none}.blocks-app .blocks-search__type-wrapper li.active{color:var(--ub-colorLink)}.blocks-app .blocks-search__type-wrapper li:hover{color:var(--ub-colorLinkHover)}.blocks-app .blocks-search__result-wrapper{height:100%;min-height:0;margin-left:0;margin-right:0;padding-left:24px;display:flex;position:relative}.blocks-app .blocks-search__result-wrapper:after{content:"";background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);z-index:1;width:100%;height:20px;position:absolute;top:0;left:0}.blocks-app .blocks-search__result-wrapper.is_search:after{top:72px}.dark .blocks-app .blocks-search__result-wrapper:after{background:linear-gradient(180deg, var(--ub-colorBgBase) -100%, transparent 50%)}.blocks-app .blocks-search__result-wrapper.is_search{flex:auto;min-width:0;margin-left:0;margin-right:0;padding-top:20px;padding-left:0;padding-right:6px;display:block;position:static;overflow:hidden auto}.blocks-app .blocks-search__blocks-wrapper{min-width:65%;min-height:0;padding-top:20px;padding-left:10px;padding-right:14px;overflow-y:scroll}.blocks-app .blocks-search__result-holder{opacity:0}.blocks-app .blocks-search__blocks-wrapper{overflow-anchor:none}.blocks-app .blocks-search__blocks-wrapper.is_search{box-sizing:border-box;width:100%;min-width:0;padding-top:0;padding-left:4px;padding-right:0}.blocks-app .blocks-search__result{margin-bottom:14px}.blocks-app .ant-dropdown .ant-dropdown-menu .blocks-search__result__menu-item{padding:9px}.blocks-app .blocks-search__result-header{z-index:2;justify-content:space-between;padding:4px 10px;font-size:13px;display:none;position:relative;box-shadow:0 5px 20px #00000012}.blocks-app .blocks-search__result-global-mark{z-index:10;pointer-events:none;position:absolute;top:1px;right:1px}.blocks-app .blocks-search__result-body{background:var(--ub-colorBgElevated);border:1px solid var(--ub-colorBorder);border-radius:calc(var(--ub-borderRadiusSM) * 1px);text-align:center;cursor:grab;background-color:var(--ub-controlTmpOutline);min-height:13px;padding:0;transition:border-color .3s cubic-bezier(.645,.045,.355,1),background-color .3s cubic-bezier(.645,.045,.355,1),box-shadow .3s cubic-bezier(.645,.045,.355,1);position:relative;overflow:hidden}.blocks-app .blocks-search__result-body:hover{border-color:var(--ub-colorTextDisabled);cursor:grab!important}.blocks-app .blocks-search__result-body:active{cursor:grabbing}.blocks-app .blocks-search__result-body:not([data-preview-measured]){min-height:180px}.blocks-app .blocks-search__result-body:after{content:"";z-index:1;width:100%;height:100%;display:block;position:absolute;top:0;left:0}.blocks-app .blocks-search__result-html{transform-origin:0 0;text-align:left;min-width:660px;height:100%;overflow-x:visible}.blocks-app .blocks-search__result-body:not([data-preview-measured]) .blocks-search__result-html{min-height:1px}.blocks-app .blocks-search .em-dragging-element .blocks-search__result-body{background-color:var(--ub-controlTmpOutline)}.blocks-app .blocks-search .em-ghost-element{border-radius:calc(var(--ub-borderRadiusXL) * 1px);overflow:hidden;background-color:var(--ub-colorBgContainer)!important}.blocks-app .email-pane .ant-tabs .blocks-search__result-divider.ant-divider-horizontal{width:100%;margin-left:0;margin-right:0}.blocks-app .blocks-search.is_search{display:flex}.blocks-app .blocks-search.is_search .blocks-search__type-wrapper{min-width:33%;padding-left:24px;padding-right:0}.blocks-app .block-search__preview{background-color:var(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadiusXL) * 1px);box-shadow:var(--ub-boxShadow);opacity:0;border:1px solid #fff;width:668px;padding:3px;transition:opacity .3s,transform .3s;position:absolute;top:0;left:-15px;transform:translate(-99%)}.blocks-app .block-search__preview-title{color:var(--ub-colorTextSecondary);padding:8px 15px;font-size:14px}.blocks-app .block-search__preview-content{border:1px solid var(--ub-colorBorderSecondary);border-radius:calc(var(--ub-borderRadiusLG) * 1px);overflow:hidden}.blocks-app .block-search__preview-content table{border-collapse:initial}.dark .blocks-app .block-search__preview{border-color:#4f4f4f}.blocks-app .email-pane__col-wrapper_reverse .block-search__preview{left:auto;right:-15px;transform:translate(99%)}.blocks-app .block-global-badge{color:var(--ub-colorTextSecondary);pointer-events:auto;justify-content:center;align-items:center;line-height:0;display:inline-flex}.blocks-app .block-global-badge svg{display:block}.blocks-app .block-global-badge--tile{box-sizing:border-box;background-color:#ffffffb8;border-radius:6px;width:24px;min-width:24px;height:24px;min-height:24px;padding:0;box-shadow:0 1px 2px #0000001a}.blocks-app .block-global-badge--tile svg{flex-shrink:0}.blocks-app body.dark .block-global-badge--tile,.dark .blocks-app .block-global-badge--tile{color:#ffffffe0;background-color:#0000008c;box-shadow:0 1px 3px #00000059}.blocks-app .discuss-wrapper{flex-direction:column;flex:1;height:100%;min-height:0;display:flex}.blocks-app .discuss-wrapper .ant-tabs-content-holder,.blocks-app .discuss-wrapper .ant-tabs-content,.blocks-app .discuss-wrapper .ant-tabs-tabpane,.blocks-app .discuss-wrapper .ant-tabs-tabpane-active{flex-direction:column;flex:1;min-height:0;display:flex}.blocks-app .discuss-wrapper .ant-tabs-tabpane-active{overflow:hidden}.blocks-app .discuss-wrapper .discuss-main{flex-direction:column;height:100%;min-height:0;display:flex;position:relative;overflow:hidden}.blocks-app .discuss-main>.comment-list{flex:auto;min-height:0;margin-bottom:24px;overflow:hidden auto}.blocks-app .discuss-main>form{flex-shrink:0}.blocks-app .discuss-main .ant-comment-content{flex:1;min-width:0}.blocks-app .discuss-main .ant-comment-content-author{flex-wrap:wrap;align-items:baseline;gap:8px;margin-bottom:4px;display:flex}.blocks-app .discuss-main .ant-comment .ant-comment-content-author-name{color:var(--ub-colorTextBase);font-weight:500;transition:color .3s;font-size:14px!important;line-height:1.4!important}.blocks-app .discuss-main .ant-comment-content-author-time{color:var(--ub-colorTextSecondary);white-space:nowrap;font-size:12px;line-height:1.4}.blocks-app .discuss-main .comment-item-noavatar .ant-comment-content-detail{margin-left:0}.blocks-app .discuss-main .ant-comment-content-detail p{white-space:normal;color:var(--ub-colorText);margin:0 0 16px;line-height:1.4}.blocks-app .discuss-main .ant-comment-content-detail :not(.ant-btn,.buttons-variants,.buttons-variants *){-webkit-user-select:text;user-select:text}.blocks-app .discuss-main .ant-dropdown-trigger{z-index:1;color:var(--ub-colorText);margin:-36px 0 -1px -24px;padding:36px 0 1px 24px;position:relative}.blocks-app .discuss-main .ant-comment-nested .ant-dropdown-trigger{margin-left:-18px;padding-left:18px}.blocks-app .discuss-main .ant-comment-inner{transition:all .5s}.blocks-app .discuss-main .ant-comment.active>.ant-comment-inner{background:#efdbff}.blocks-app .discuss-main .targetted-comment-item>.ant-comment-inner{background:var(--ub-colorInfoBg);cursor:pointer}.blocks-app .discuss-main .ant-comment-actions{opacity:.6;margin-top:6px;transition:all .3s cubic-bezier(.645,.045,.355,1);display:none}.blocks-app .discuss-main .ant-form-item-control-input-content{margin-left:2px}.blocks-app .discuss-main .ant-tooltip-container{text-align:center}.blocks-app .discuss-main .ant-comment-content:hover .ant-comment-actions{opacity:1}.blocks-app .discuss-main .replyEditMode{opacity:.5;display:none}.blocks-app .discuss-main .icon-target{font-size:16px;transform:translateY(5%)}.blocks-app .discuss-main .comment-icon-target{border-radius:8px;margin-left:5px;padding:0 8px 2px}.blocks-app .discuss-main .comment-icon-target:hover{cursor:pointer}.blocks-app .discuss-main .ant-btn.ant-btn-primary.button-target.button-target_choose{background:var(--ub-colorInfo)}.blocks-app .discuss-main .ant-space button{margin-right:0}.blocks-app .anticon-history{transform:scaleX(-1)}.blocks-app .history-panel{border-right:1px solid var(--ub-colorBorder);flex-direction:column;justify-content:space-between;height:100%;display:flex;box-shadow:-12px 0 48px 16px #00000008,-9px 0 28px #0000000d,-6px 0 16px -8px #00000014}.blocks-app .history-panel__sider{z-index:11;background:var(--ub-colorBgContainer);height:100%;position:absolute;top:0;bottom:0;left:80px}.blocks-app .history-panel__list-header,.blocks-app .history-panel__header{justify-content:space-between;align-items:center;padding:0 24px 9px;font-weight:500;display:flex}.blocks-app .history-panel__list-header :last-child{min-width:60px}.blocks-app .history-panel__header{padding-left:24px;padding-right:24px}.blocks-app .history-panel__list-header:before{background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);border-top:1px solid var(--ub-colorBorderSecondary);content:"";z-index:1;background-position:0 -2px;background-repeat:no-repeat;border-bottom:none;height:20px;position:absolute;inset:30px 0 -20px}.dark .blocks-app .history-panel__list-header:before{background:linear-gradient(180deg, var(--ub-colorBgBase), transparent 40%)}.blocks-app .history-panel__header-title{font-size:14px;font-style:normal;line-height:24px}.blocks-app body.dark .history-panel__header-title{color:#fff}.blocks-app .history-panel__header-close{color:#00000073;margin-right:-16px}.blocks-app body.dark .history-panel__header-close{color:#fff}.blocks-app .history-panel__list{height:100%;margin:10px -24px 0}.blocks-app .history-panel__list .ant-list-header{border:none;margin-bottom:5px;padding:0;font-weight:500}.blocks-app .history-panel__list .ant-spin-nested-loading,.blocks-app .history-panel__list .ant-spin-container{height:100%}.blocks-app .history-panel__list .ant-list-items{height:calc(100% - 30px);overflow:auto}.blocks-app .history-panel__list .ant-list-item{cursor:pointer;border:none;padding:9px 24px}.blocks-app .history-panel__list .ant-list-item:hover{background-color:var(--ub-colorFillQuaternary)}.blocks-app .history-panel__list .ant-btn.ant-btn-sm{--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(--ub-colorFillSecondary)}.blocks-app body.dark .history-panel__item_active{background:#111b26}.blocks-app .history-panel__item_active .history-panel__restore{opacity:1;visibility:visible}.blocks-app .ant-layout-sider.history-panel__sider .ant-layout-sider-children{opacity:1;width:500px;height:100%;transition:opacity .5s;position:absolute;right:0}.blocks-app .ant-layout-sider-collapsed.history-panel__sider .ant-layout-sider-children{opacity:0}.blocks-app .add-new-block-modal__save-btn .ant-btn-icon .anticon{font-size:22px;line-height:0}.blocks-app .add-new-block-modal__save-btn .ant-btn-icon .anticon svg{width:22px;height:22px}.blocks-app .modal-footer{justify-content:flex-end;padding:8px 0;display:flex}.blocks-app .modal-spinner{justify-content:center;align-items:center;height:108px;display:flex}',e=window.__useblocks_styles__||(window.__useblocks_styles__={sheets:{},order:[]}),p=t;if(!e.sheets[p]){var a=null;try{typeof CSSStyleSheet=="function"&&"replaceSync"in CSSStyleSheet.prototype&&(a=new CSSStyleSheet,a.replaceSync(t))}catch{a=null}if(a){if(!e.host||!e.host.isConnected||!e.host.sheet){var o=document.createElement("style");o.setAttribute("data-useblocks","true"),document.head.appendChild(o),e.host=o}for(var i=e.host.sheet,r=0;r<a.cssRules.length;r++)try{i.insertRule(a.cssRules[r].cssText,i.cssRules.length)}catch{}(e.texts||(e.texts=[])).push(t),(e.listeners||[]).forEach(function(l){try{l(t)}catch{}})}else{var o=document.createElement("style");o.setAttribute("data-useblocks","true"),o.appendChild(document.createTextNode(t)),document.head.appendChild(o)}e.sheets[p]=!0,e.order.push(p)}}}catch(l){console.error("vite-plugin-css-injected-by-js",l)}})();
|
|
9
|
+
__useblocks__.define("static/core/243ff5f9.js",["require","exports","module","static/core/2ff39ddf.js","static/core/cf7d1dd7.js","static/core/74875d47.js","static/core/276eec25.js","static/core/eb970abc.js","static/core/e12242b9.js","static/core/8f57829b.js","static/core/1dfb486f.js","static/core/555c0dda.js","static/core/5cac7517.js","static/core/605267a0.js","react","react/jsx-runtime","__delivery__/libs","react-dom","vite/preload-helper","classnames","dayjs"],function(xo,Ro,Yp){const bo=xo("./2ff39ddf.js"),vo=xo("./cf7d1dd7.js"),r=xo("./74875d47.js"),bi=xo("./276eec25.js"),un=xo("./eb970abc.js"),W=xo("./e12242b9.js"),et=xo("./8f57829b.js"),Ze=xo("./1dfb486f.js"),gi=xo("./555c0dda.js"),Ft=xo("./5cac7517.js"),Pr=xo("./605267a0.js");let a=xo("react");a=bo.__toESM(a);let o=xo("react/jsx-runtime"),t=xo("__delivery__/libs"),mn=xo("react-dom"),Mt=xo("vite/preload-helper"),Ke=xo("classnames");Ke=bo.__toESM(Ke);let ct=xo("dayjs");ct=bo.__toESM(ct);var f=bo.__toESM(r.require_prop_types());async function Nr(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),n=new Image;n.onload=()=>{URL.revokeObjectURL(s);const d=n.naturalWidth||n.width,c=n.naturalHeight||n.height;d>0&&c>0?i({width:d,height:c}):l(new Error("Could not read image dimensions"))},n.onerror=()=>{URL.revokeObjectURL(s),l(new Error("Could not decode image"))},n.src=s})}async function Ar(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,n=s.url||i,d=s.thumbnailUrl||s.thumbnail||n||(typeof e.getThumbnailUrl=="function"?await e.getThumbnailUrl(s):"")||"";return d?{file:s,previewUrl:d}:null}function Et(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 Lr(){const e=r.useAppConfig(),i=r.useIsStandalone(),l=r.useProjectData(),s=r.useEditorProjectId(),n=l?.id!==void 0?String(l.id):s||"",d=r.useEventEmitter(vo.events.FILE_PROXY_EVENT_ID),c=r.useEventEmitter(vo.events.PROXY_URL_EVENT_ID);return(0,a.useCallback)(async(p,g)=>et.fetchEditorImageBlobByUrl(p,{appConfig:e,isStandalone:i,fireFileProxy:m=>d.fire({url:m,project:n}),fireProxyUrl:m=>c.fire({url:m,project:n})},g),[e,n,i,d,c])}var Or=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),fi=({onChange:e,value:i,validateStatus:l,placeholder:s,disabled:n,name:d,elementSettings:c,imageInfo:p,previewReloadSignal:g,onRemotePreviewValidate:m})=>{const _=r.useCurrentUser(),E=r.useProjectData(),b=r.useAppConfig(),h=r.useIsStandalone(),{__:k}=r.useI18n();r.useSendPostMessage();const x=r.useSendPostMessageEx(),{openImagePicker:T}=r.useImagePicker(),j=r.useStorageProvider(),P=r.useRestClient(),S=E?.id!==void 0?String(E?.id):"",y=_?.id!=="0"?String(_.id):"",{dataProvider:V}=(0,a.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:j,projectId:S,restApi:P,i18n:{__:k},pathPostfix:y,appConfig:b,isStandalone:h}),[b,h,S,P,j,y,k]),z=Lr(),[A]=r.useLazyGetImageInfoQuery(),[O,w]=(0,a.useState)({width:"",height:"",size:""}),[U,J]=(0,a.useState)(!1),[Q,I]=(0,a.useState)(0),[le,xe]=(0,a.useState)(""),ve=(0,a.useRef)(""),Z=(0,a.useRef)(g?.counter||0),be=et.useImageBlobResolver(),Ne=(0,a.useRef)(""),de=(0,a.useRef)(""),[Fe,Ae]=(0,a.useState)(0),Ge=r.usePlanFeatureGate("image_editor"),je=()=>{Ne.current&&(URL.revokeObjectURL(Ne.current),Ne.current="")};(0,a.useEffect)(()=>{if(!i){w({width:"",height:"",size:"",format:""}),ve.current="",xe(""),je();return}if(i.startsWith("data:")||i.startsWith("blob:")){je(),ve.current=i,xe(i),w({width:"",height:"",size:"",format:""});return}const K=r.stripEmVersionFromUrlString(i);de.current=K;const ee=et.canonicalImageUrlKey(K),ie=new AbortController;let ae=!1;const ne=async te=>{je();const Te=Fe?r.appendEmVersionForPreviewReload(te):te;ve.current=Te,xe(Te);try{const{data:ke}=await A(K);return ae||!ke?!1:(w({width:ke?.width,height:ke?.height,size:ke?.fileSize!=null?(ke.fileSize/1024).toFixed(0):"",format:et.normalizeImageFormatForDisplay(ke?.format)}),!0)}catch{return!1}},Me=async()=>{const te=await be.resolve(ee,ie.signal,z);if(ae)return;const{width:Te,height:ke}=await Nr(te);if(ae)return;je();const M=URL.createObjectURL(te);Ne.current=M,ve.current=M,xe(M),w({width:Te,height:ke,size:(te.size/1024).toFixed(0),format:et.normalizeImageFormatForDisplay(te.type)})};return(async()=>{try{if(!h){const te=await Ar(V,K);if(te?.previewUrl&&await ne(te.previewUrl))return}await Me()}catch{ae||(je(),ve.current="",xe(""),w({width:"",height:"",size:"",format:""}))}})(),()=>{ae=!0,ie.abort()}},[i,V,z,A,h,be,Fe]);const ye=(0,a.useCallback)(()=>{const K=de.current;K&&be.abandonKey(et.canonicalImageUrlKey(K)),Ae(Date.now())},[be]);(0,a.useEffect)(()=>{!g?.counter||g.name!==d||g.counter!==Z.current&&(Z.current=g.counter,ye())},[d,g,ye]),(0,a.useEffect)(()=>()=>je(),[]);const _e=!!i&&!Et(r.stripEmVersionFromUrlString(String(i))),pe=async(K=null)=>{const ee=d.startsWith("src"),ie=K||(ee?r.MODALS.UPLOAD_IMAGE_MODAL:r.MODALS.UPLOAD_BACKGROUND_MODAL),ae=r.stripEmVersionFromUrlString(i||""),ne=await T({kind:ee?"img":"background",currentUrl:Et(ae)?"":ae,entryModal:ie});if(!ne?.url)return;const Me=ae===r.stripEmVersionFromUrlString(ne.url);(!Me||ne.url!==i)&&e(ne.url),ne.meta?.mode==="save"&&Me&&(ye(),ee&&x(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(ne.url)}))},fe=[{label:k("Upload"),key:"Upload",onClick:()=>pe(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}];b.imageCenterStockEnabled&&fe.push({label:k("Stock"),key:"Stock",onClick:()=>pe(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_STOCK:r.MODALS.UPLOAD_BACKGROUND_MODAL_STOCK)}),b.imageCenterGifEnabled&&fe.push({label:k("GIF"),key:"GIF",onClick:()=>pe(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_GIF:r.MODALS.UPLOAD_BACKGROUND_MODAL_GIF)}),b.elementAIimageEnabled&&fe.push({label:k("AI"),key:"AI",onClick:()=>pe(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_AI:r.MODALS.UPLOAD_BACKGROUND_MODAL_AI)});const me=()=>{J(!1)};return(0,o.jsxs)("div",{className:(0,Ke.default)("upload-bg-image",{"upload-bg-image_disabled":n}),children:[i?(0,o.jsxs)("div",{className:"ant-input-file-uploader upload-bg-image__inner-wrap",onClick:K=>{K.target?.closest(".upload-bg-image__edit")||K.target?.closest(".upload-bg-image__edit-menu")||K.target?.closest(".upload-bg-image__menu")||K.target?.closest(".inputGroup")||pe(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:()=>b.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:b.iconStrokeWidth,style:{verticalAlign:"text-top"}}),allowClear:!0,onChange:e,value:i,placeholder:s,name:d,disabled:n,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:K=>K.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:le?(0,o.jsx)("img",{className:"upload-bg-image__uploader-img",src:le,alt:"",onLoad:()=>{m&&Or(r.stripEmVersionFromUrlString(i||""))&&m("success")},onError:()=>{const K=de.current,ee=r.stripEmVersionFromUrlString(le||""),ie=r.stripEmVersionFromUrlString(K||"");if(K&&ee!==ie){ve.current=K,xe(K);return}m&&Or(ie)&&m("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"})})]})})}),O.width&&O.height?(0,o.jsxs)("div",{className:"image-size",children:[O.width," × ",O.height,!!c&&(c.type===r.ELEMENT_TYPES.IMG||c.type===r.ELEMENT_TYPES.CAROUSEL)&&" → "+p.renderedWidth+" × "+p.renderedHeight,(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsxs)("span",{children:[O.size," ",k("kB")]}),O.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:O.format})]})]}):(0,o.jsx)(t.ui_kit$Text,{type:"secondary",className:"image-empty-text",children:s})]})}),(0,o.jsx)("div",{style:{flexGrow:1}}),O.format!=="gif"&&b.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:b.iconStrokeWidth,onClick:()=>{Ge.isLocked&&_e?(J(!0),I(r.FEATURE_UPSELL_SLIDE.image_editor)):pe(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:fe},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:b.iconStrokeWidth,icon:"SyncOutlined",component:t.icons$SyncOutlined,onClick:()=>pe(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:()=>pe(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:b.iconStrokeWidth}),children:k("Add image")}),U&&(0,o.jsx)(r.PlanUpgradePrompt,{open:!0,onCancel:me,initialSlide:Q})]})};fi.propTypes={};var pn=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),hn=(e,i,l)=>i||(l?.type===r.ELEMENT_TYPES.CAROUSEL?["images",e]:Array.isArray(e)?e:[e]),$r=e=>Array.isArray(e)?e.join("_"):e,Fo=({form:e,label:i,name:l,watchPath:s,disabled:n=!1,elementSettings:d,previewReloadSignal:c=void 0})=>{const{token:p}=(0,t.ui_kit$useToken)(),[g,m]=(0,a.useState)("success"),_=(0,a.useMemo)(()=>({marginBottom:p.formItemMarginBottomXS}),[p.formItemMarginBottomXS]),E=t.ui_kit$Form.useWatch(hn(l,s,d),e);return(0,a.useEffect)(()=>{if(!E){m("");return}if(typeof E=="string"&&(E.startsWith("data:")||E.startsWith("blob:"))){m("success");return}if(pn(E)){m("validating");return}m("success")},[E]),(0,o.jsx)(t.ui_kit$Form.Item,{name:l,validateStatus:g,style:_,children:(0,o.jsx)(fi,{validateStatus:g,placeholder:i,name:$r(l),disabled:n,elementSettings:d,imageInfo:d?.type===r.ELEMENT_TYPES.CAROUSEL?d?.carouselImages?.[$r(l).split("_")[1]]:d,previewReloadSignal:c,onRemotePreviewValidate:m})})};Fo.propTypes={label:f.default.string.isRequired,name:f.default.oneOfType([f.default.string,f.default.arrayOf(f.default.oneOfType([f.default.string,f.default.number]))]).isRequired,watchPath:f.default.arrayOf(f.default.oneOfType([f.default.string,f.default.number])),tooltipTitle:f.default.string,disabled:f.default.bool,previewReloadSignal:f.default.shape({name:f.default.string,counter:f.default.number}),form:f.default.shape({getFieldValue:f.default.func.isRequired}).isRequired},Fo.defaulProps={disabled:!1,previewReloadSignal:null};var Io=({form:e,oneBorderRadiusValue:i,setOneBorderRadiusValue:l,elementSettings:s,namePrefix:n="",typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),p=d==="mobile",g=p?"mobileBorderRadius":"borderRadius",m=p?"mobileBorderRadiusAll":"borderRadiusAll",_=p?"mobileBorderRadiusTopLeft":"borderRadiusTopLeft",E=p?"mobileBorderRadiusTopRight":"borderRadiusTopRight",b=p?"mobileBorderRadiusBottomRight":"borderRadiusBottomRight",h=p?"mobileBorderRadiusBottomLeft":"borderRadiusBottomLeft",k=p?W.MOBILE_BORDER_RADIUS_POSITION:W.BORDER_RADIUS_POSITION,x=()=>{const T=e.getFieldsValue(!0);let j;i?(e.setFieldsValue({[_]:T[m]||null,[h]:T[m]||null,[E]:T[m]||null,[b]:T[m]||null}),j={[g]:{[k[_]]:T[m]||0,[k[h]]:T[m]||0,[k[E]]:T[m]||0,[k[b]]:T[m]||0}}):T[_]===T[h]&&T[_]===T[E]&&T[_]===T[b]?(e.setFieldsValue({[m]:T[_]}),j={[g]:{[k[m]]:T[_]}}):(e.setFieldsValue({[_]:null,[h]:null,[E]:null,[b]:null}),j={[g]:{[k[m]]:0,[k[_]]:0,[k[h]]:0,[k[E]]:0,[k[b]]:0}});const P=p?{mobileBorderRadius:{all:T.mobileBorderRadiusAll||null,classNamePrefix:"em-mob-border_radius_all-"}}:{[`${n}${g}`]:{...s[`${n}${g}`],...j[`${n}${g}`]}};c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:P}),l(S=>!S)};return(0,o.jsx)(t.ui_kit$FormBorderRadiusInputs,{namePrefix:n,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"})})};Io.displayName="SelectedElementFormBorderRadius";var bn="em-mob-text_align-",gn=({value:e,onChange:i,onSync:l,fieldName:s,...n})=>{const d=(typeof e=="object"?e?.value:e)??"",c=p=>{const g={classNamePrefix:bn,value:p};i?.(g),l?.({[s]:g})};return(0,o.jsx)(t.ui_kit$FormAlignControl,{value:d,onChange:c,...n})},Go=({form:e,elementSettings:i,imgParent:l=!1,name:s="align",tooltipTitle:n,typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),p=r.useAppConfig(),g=d==="mobile",m=g?"mobileAlign":s;if(g){const _=E=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:E})};return(0,o.jsx)(t.ui_kit$Form.Item,{name:m,children:(0,o.jsx)(gn,{fieldName:m,onSync:_,disabled:l&&!i.parent,strokeWidth:p.iconStrokeWidth,tooltipTitle:n})})}return(0,o.jsx)(t.ui_kit$Form.Item,{name:m,children:(0,o.jsx)(t.ui_kit$FormAlignControl,{disabled:l&&!i.parent,strokeWidth:p.iconStrokeWidth,tooltipTitle:n})})},Vo=({form:e,elementSettings:i,tooltipTitle:l,disabled:s=!1,isNewIconType:n=!1,typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),p=r.useAppConfig(),g=d==="mobile",m=g?"mobileVerticalAlign":"valign",_=E=>{e.setFieldsValue({[m]:E}),g||c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[m]:E}})};return(0,o.jsx)(t.ui_kit$Form.Item,{name:m,children:(0,o.jsx)(t.ui_kit$FormVerticalAlignControl,{...!g&&{value:i.valign,onChange:_},disabled:s,isNewIconType:n,strokeWidth:p.iconStrokeWidth})})},fn=["mobileBoxShadowHOffset","mobileBoxShadowVOffset","mobileBoxShadowBlurRadius","mobileBoxShadowSpreadRadius","mobileBoxShadowColor","mobileBoxShadowInset"],_n=({form:e,elementSettings:i,enableSwitch:l,usedColors:s,withoutShadowLabel:n})=>{const d=r.useSendPostMessage(),c=i.mobileBoxShadow,[p,g]=(0,a.useState)(!c||c.hOffset===0&&c.vOffset===0&&c.blurRadius===0&&c.spreadRadius===0),m=t.ui_kit$Form.useWatch(fn,e);(0,a.useEffect)(()=>{if(!m)return;const[E,b,h,k,x,T]=m;(E===0||E===void 0||E===null)&&(b===0||b===void 0||b===null)&&(h===0||h===void 0||h===null)&&(k===0||k===void 0||k===null)&&(x===""||x===void 0||x===null)&&(T===!1||T===void 0)||g(!1)},[m]);const _=()=>{g(E=>!E),e.setFieldsValue({mobileBoxShadowHOffset:p?"":0,mobileBoxShadowVOffset:p?"":0,mobileBoxShadowBlurRadius:p?"":0,mobileBoxShadowSpreadRadius:p?"":0,mobileBoxShadowColor:"",mobileBoxShadowInset:!1}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBoxShadow:{classNamePrefix:"em-mob-box_shadow-",hOffset:p?null:0,vOffset:p?null:0,blurRadius:p?null:0,spreadRadius:p?null:0,color:null,inset:!1}}})};return(0,o.jsxs)(o.Fragment,{children:[l&&(0,o.jsx)("div",{style:{float:"right",marginTop:-9,marginRight:50},children:(0,o.jsx)(t.ui_kit$Switch,{id:"without-shadow",label:n,labelSize:"small",size:"small",checked:p,onChange:_})}),(0,o.jsx)("p",{style:{paddingBottom:"8px",margin:"-30px 0 0"},children:" "}),(0,o.jsx)(t.ui_kit$FormBoxShadowInputs,{typeOfForm:"mobile",usedColors:s})]})},No=({typeOfForm:e="desktop",form:i,elementSettings:l,enableSwitch:s=!0})=>{const{__:n}=r.useI18n(),d=r.useSelector(r.selectEmailSettings).usedColors;return e==="mobile"&&i&&l?(0,o.jsx)(_n,{form:i,elementSettings:l,enableSwitch:s,usedColors:d,withoutShadowLabel:n("Without shadow")}):(0,o.jsx)(t.ui_kit$FormBoxShadowInputs,{typeOfForm:e,usedColors:d})};No.displayName="SelectedElementFormBoxShadow";var Ao=({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})})})]})})})})},_i=({form:e,elementSettings:i,handleChangeValues:l})=>{const{__:s}=r.useI18n(),n=(0,a.useRef)(),{token:d}=(0,t.ui_kit$useToken)(),[c,p]=(0,a.useState)(!1),[g,m]=(0,a.useState)(!1),[_,E]=(0,a.useState)(!1),[b,h]=(0,a.useState)(!1),[k,x]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let w=new URL("https://emailmaker.ru/?"+i.countdown);p(w.searchParams.get("font1").endsWith("-b")||w.searchParams.get("font1").endsWith("-bi")),m(w.searchParams.get("font1").endsWith("-i")||w.searchParams.get("font1").endsWith("-bi")),E(w.searchParams.get("font2").endsWith("-b")||w.searchParams.get("font2").endsWith("-bi")),h(w.searchParams.get("font2").endsWith("-i")||w.searchParams.get("font2").endsWith("-bi")),x(w.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")}],j=[{value:"20",label:s("20 s")},{value:"40",label:s("40 s")},{value:"60",label:s("60 s")}],P=[{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"}],S=w=>w&&w<(0,ct.default)().endOf("day")-864e5,y=w=>{x(w)},V=()=>{const w=!c;e.setFieldValue("countdownNumbersStrong",w),l({countdownNumbersStrong:w}),p(w)},z=()=>{const w=!g;e.setFieldValue("countdownNumbersItalic",w),l({countdownNumbersItalic:w}),m(w)},A=()=>{const w=!_;e.setFieldValue("countdownLabelsStrong",w),l({countdownLabelsStrong:w}),E(w)},O=()=>{const w=!b;e.setFieldValue("countdownLabelsItalic",w),l({countdownLabelsItalic:w}),h(w)};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:n,format:"MM/DD/YYYY HH:mm",disabledDate:S,showTime:!0,placement:"bottomRight",getPopupContainer:w=>{const U=w?.closest(".blocks-app");return U||(w?.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(w=>(0,o.jsx)(t.ui_kit$Select.Option,{value:w.value,children:w.label},w.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:y})})})]}),(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:P})})}),(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,Ke.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":c}),onClick:V,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,Ke.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":g}),onClick:z,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:P})})}),(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,Ke.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":_}),onClick:A,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,Ke.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":b}),onClick:O,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:j})})})]})]})};_i.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string};var xi=({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")]})]})})]})};xi.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string};var xn={marginBottom:10},Lo=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(t.ui_kit$Row,{gutter:20,style:xn,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:ki}=t.ui_kit$Select,{mobileBorderRadiusAll:kn,mobileBorderRadiusTopLeft:Ei,mobileBorderRadiusBottomLeft:Bi,mobileBorderRadiusTopRight:Si,mobileBorderRadiusBottomRight:Ti,borderRadiusBottomRight:Ri,borderRadiusTopRight:yi,borderRadiusBottomLeft:ji,borderRadiusTopLeft:wi,alt:En,src:Bn,title:Sn,link:ut,borderRadiusAll:Fr,imgReplacer:Tn,expanded:Rn}={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"},ot=({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})}},yn=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")}],tt=({handleLinkProtocolsChange:e,linkProtocol:i,__:l})=>{const s=a.default.useMemo(()=>yn(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})},it=({show:e,__:i,style:l,className:s})=>{const n=a.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:n}):null},vi=e=>!(!e.startsWith("#")||e.indexOf("#",1)!==-1),jn=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*(["'])((?:\\.|(?!\1).)*?)\1(?:\s*\/?>)?\s*$/i,wn=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*([^\s/>]+)(?:\s*\/?>)?\s*$/i;function rt(e){if(typeof e!="string")return e;let i=e.trim();if(!i)return i;const l=i.match(jn);if(l)i=l[2];else{const s=i.match(wn);s&&(i=s[1])}return i.startsWith("https://http")&&(i=i.substring(8)),i}var Dt=(e,i="https://")=>e?e.startsWith("https://")||e.startsWith("http://")?"https://":e.startsWith("mailto:")?"mailto:":e.startsWith("tel:")?"tel:":e.startsWith("sms:")?"sms:":e.startsWith("ftp://")?"ftp://":vi(e)?"#":"":i,Yo=(e,i)=>{const l=Dt(e,"");return i(l),l},Mr=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]}}},Ii=(e,i,l)=>{if(!e||!e.startsWith("mailto:"))return e;const s=e.split("?")[0],n=[];return i&&n.push(`subject=${encodeURIComponent(i)}`),l&&n.push(`body=${encodeURIComponent(l)}`),n.length>0?`${s}?${n.join("&")}`:s},u=e=>e||(e===0?"0":""),Bo=e=>e&&e!=="auto"?e:e===0?"0":"",Dr=(e,i)=>{if(typeof e=="object"&&e!==null&&"value"in e){if(e.value)return e.value;if(e.value==="")return""}return typeof e=="string"&&e?e:i||""};function Ci(e){const i={...e,link:e.link==null?"https://":e.link,borderRadiusAll:u(e.borderRadius?.all),borderRadiusTopLeft:u(e.borderRadius?.topLeft),borderRadiusBottomLeft:u(e.borderRadius?.bottomLeft),borderRadiusTopRight:u(e.borderRadius?.topRight),borderRadiusBottomRight:u(e.borderRadius?.bottomRight),mobileBorderRadiusAll:u(e.mobileBorderRadius?.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius?.topLeft!==null?e.mobileBorderRadius?.topLeft:e.mobileBorderRadius?.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius?.bottomLeft!==null?e.mobileBorderRadius?.bottomLeft:e.mobileBorderRadius?.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius?.topRight!==null?e.mobileBorderRadius?.topRight:e.mobileBorderRadius?.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius?.bottomRight!==null?e.mobileBorderRadius?.bottomRight:e.mobileBorderRadius?.all),show:e.show?e.show:"all",altSrc:e.src};if(e.video&&(i.videoPlayButton=e.video.playButton??"youtube_red",i.videoSource=e.video.source??""),e.carouselImages?.length>0){const l={};e.carouselImages?.map((s,n)=>(Object.keys(s).forEach(d=>{l[d+"_"+n]=s[d]}),!0)),i.images=l}if(e.sections?.length>0){const l=[];e.sections?.map((s,n)=>(l.push({[`expanded_${n}`]:s.expanded}),!0)),i.sections=l}return i}function Vr(e,i,l){const s=l.hasOwnProperty("images"),n=l.hasOwnProperty("sections"),d=Object.keys(s?l.images:n?l.sections:l)[0],c=s?l.images:n?l.sections:l;let p={};const g=i.getFieldsValue(!0);switch(d.split("_")[0]){case Sn:case Bn:case En:case Tn:if(s){const _=[...e.carouselImages];_[d.split("_")[1]][d.split("_")[0]]=c[d],p={carouselImages:_}}else p=c;break;case Rn:if(n){const _=[...e.sections];_[d.split("_")[1]][d.split("_")[0]]=c[d],p={sections:_}}break;case ut:let m=rt(c[d]);e.type===r.ELEMENT_TYPES.CAROUSEL?(p.carouselImages=e.carouselImages,s?(i.setFieldValue(["images",[ut+"_"+d.split("_")[1]]],m),p.carouselImages[d.split("_")[1]].link=m,p.link="",i.setFieldValue(ut,"")):(e.carouselImages.forEach((_,E)=>{i.setFieldValue(["images",ut+"_"+E],m),p.carouselImages[E].link=m,p.link=m}),i.setFieldValue(ut,m))):(i.setFieldValue(ut,m),p.link=m);break;case Fr:p={borderRadius:{...e.borderRadius,[W.BORDER_RADIUS_POSITION[wi]]:g[wi],[W.BORDER_RADIUS_POSITION[ji]]:g[ji],[W.BORDER_RADIUS_POSITION[yi]]:g[yi],[W.BORDER_RADIUS_POSITION[Ri]]:g[Ri],[W.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case wi:case ji:case yi:case Ri:p={borderRadius:{...e.borderRadius,[W.BORDER_RADIUS_POSITION[Fr]]:null,[W.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case kn:case Ei:case Bi:case Si:case Ti:p={mobileBorderRadius:{...e.mobileBorderRadius,[W.MOBILE_BORDER_RADIUS_POSITION[Ei]]:g[Ei],[W.MOBILE_BORDER_RADIUS_POSITION[Bi]]:g[Bi],[W.MOBILE_BORDER_RADIUS_POSITION[Si]]:g[Si],[W.MOBILE_BORDER_RADIUS_POSITION[Ti]]:g[Ti],[W.MOBILE_BORDER_RADIUS_POSITION[d]]:c[d],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[d]+"-"}};break;default:p=c}return{...e,...p}}var Mo=(0,o.jsxs)(t.ui_kit$Select,{className:"select-after",children:[(0,o.jsx)(ki,{value:"px",children:"px"}),(0,o.jsx)(ki,{value:"%",children:"%"})]}),vn=(0,o.jsx)(t.ui_kit$Select,{className:"select-after",children:(0,o.jsx)(ki,{value:"px",children:"px"})}),Hr=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:n,boxShadowShow:d,oneBorderRadiusValue:c,setOneBorderRadiusValue:p,hasLink:g,hasAlt:m,hasTitle:_,isOpenSrcReplacer:E,mergeTagItems:b,mergeMenuOpen:h,setMergeMenuOpen:k,cascaderRef:x,linkInputRef:T,linkButtonRef:j,altInputRef:P,altButtonRef:S,titleInputRef:y,titleButtonRef:V,srcReplacerInputRef:z,srcReplacerButtonRef:A,linkProtocol:O,handleLinkProtocolsChange:w,linkButtonHandler:U,linkInputHandler:J,altButtonHandler:Q,altInputHandler:I,titleButtonHandler:le,titleInputHandler:xe,srcReplacerButtonHandler:ve,srcInputHandler:Z,handleSelect:be,onChange:Ne,filter:de,renderSearchOption:Fe,handleChangeValues:Ae,toggleShowBorderHandler:Ge,toggleShowBorderRadiusHandler:je,toggleShowBoxShadowHandler:ye})=>{const{__:_e}=r.useI18n(),{token:pe}=(0,t.ui_kit$useToken)(),fe=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)(Go,{form:e,elementSettings:i,imgParent:!0})}),fe.formImageFieldVerticalAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,align:"right",children:(0,o.jsx)(Vo,{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)(_i,{form:e,elementSettings:i,handleChangeValues:Ae}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),fe.mergeTagsShow&&b&&(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:h?"none":"inline-flex"},onClick:()=>k(!0),children:_e("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:x,classNames:{popup:{root:"merge-tags"}},options:b,placeholder:_e("Start typing the title"),showSearch:{filter:de,render:Fe},spellCheck:"false",getPopupContainer:me=>me.closest(".email-pane__collapse-wrapper"),onChange:Ne,style:{display:h?"block":"none"},open:h,onKeyDown:me=>{me.key==="Escape"&&k(!1)}})]})}),i.type==="video"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(xi,{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)(Fo,{form:e,label:_e("Image path"),name:"src",placeholder:_e("Image path"),elementSettings:i,tooltipTitle:""})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,style:{marginBottom:!m&&!g&&!_&&!E?pe.formItemMarginBottomMD+4:pe.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:m||_e("Alternative text"),placement:"bottom",getPopupContainer:me=>me.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":!!m}),onClick:Q,ref:S,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),fe.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:_||_e("Tooltip text"),placement:"bottom",getPopupContainer:me=>me.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":!!_}),onClick:le,ref:V,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:g||_e("Hyperlink URL"),placement:"bottom",getPopupContainer:me=>me.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":!!g}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:U,ref:j})}),fe.formImageFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:_e("Image replacer"),placement:"bottom",getPopupContainer:me=>me.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":E}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:ve,ref:A})})]}),(!!g||!!m||!!_||!!E)&&(0,o.jsxs)("div",{style:{marginBottom:pe.formItemMarginBottomMD+4},children:[!!g&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(it,{show:O==="#",__:_e,style:{marginBottom:pe.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:_e("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:pe.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(tt,{linkProtocol:O,handleLinkProtocolsChange:w,__:_e}),placeholder:_e("Hyperlink URL"),allowClear:!0,ref:T,onChange:J,onSelect:be,prefix:(0,o.jsx)(ot,{linkProtocol:O})})})})]}),!!m&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:_e("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:pe.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:_e("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:I,ref:P,onSelect:be})})}),fe.formFieldImageTitleEnabled&&!!_&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:_e("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:pe.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:_e("Enter the title of the image"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:xe,ref:y,onSelect:be})})}),!!E&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:_e("Image src"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"imgReplacer",className:"selected-image-form__alt",style:{marginBottom:pe.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:_e("Code that will replace the image `src`"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:_e("Image src")}),onChange:Z,ref:z,onSelect:be})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:_e("Size"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:i.maxWidth,showHeight:fe.formImageFieldHeightEnabled,showMinMax:!1,gutter:pe.marginSM,rowStyle:{marginBottom:fe.formImageFieldHeightEnabled?4:24},labels:{width:_e("Width"),height:_e("Height"),minWidth:_e("Minimum width"),maxWidth:_e("Maximum width")}})}),fe.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:_e("Borders"),collapsible:!0,open:s,onToggle:Ge,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),fe.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:_e("Border radius"),collapsible:!0,open:n,onToggle:je,dividerTop:!0,children:(0,o.jsx)(Io,{form:e,oneBorderRadiusValue:c,setOneBorderRadiusValue:p,elementSettings:i})}),fe.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:_e("Box shadow"),collapsible:!0,open:d,onToggle:ye,dividerTop:!0,children:(0,o.jsx)(No,{})}),fe.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:_e("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e})}),fe.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:_e("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})};Hr.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,bordersShow:f.default.bool,borderRadiusShow:f.default.bool,boxShadowShow:f.default.bool,oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func,hasLink:f.default.string,hasAlt:f.default.string,hasTitle:f.default.string,isOpenSrcReplacer:f.default.oneOfType([f.default.bool,f.default.number]),mergeTagItems:f.default.array,mergeMenuOpen:f.default.bool,setMergeMenuOpen:f.default.func,cascaderRef:f.default.object,linkInputRef:f.default.object,linkButtonRef:f.default.object,altInputRef:f.default.object,altButtonRef:f.default.object,titleInputRef:f.default.object,titleButtonRef:f.default.object,srcReplacerInputRef:f.default.object,srcReplacerButtonRef:f.default.object,linkProtocol:f.default.string,handleLinkProtocolsChange:f.default.func,linkButtonHandler:f.default.func,linkInputHandler:f.default.func,altButtonHandler:f.default.func,altInputHandler:f.default.func,titleButtonHandler:f.default.func,titleInputHandler:f.default.func,srcReplacerButtonHandler:f.default.func,srcInputHandler:f.default.func,handleSelect:f.default.func,onChange:f.default.func,filter:f.default.func,renderSearchOption:f.default.func,handleChangeValues:f.default.func,toggleShowBorderHandler:f.default.func,toggleShowBorderRadiusHandler:f.default.func,toggleShowBoxShadowHandler:f.default.func};var Xo=({form:e,name:i,elementSettings:l,isPicture:s,tooltipTitle:n})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),p=(0,a.useRef)(),[g,m]=(0,a.useState)(l[i]?.value==="auto"),{token:_}=(0,t.ui_kit$useToken)(),[E,b]=(0,a.useState)(void 0),h=x=>{e.setFieldsValue({[i]:"",[i+"Dim"]:"px"}),m(T=>!T),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{[i]:{classNamePrefix:"em-mob-width-",value:g?null:"auto",dim:""}}})},k=x=>{m(!1);const T=e.getFieldsValue(!0);b(T[`${String(i)}Dim`]==="%"?100:void 0)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:n,placement:"bottom",children:(0,o.jsx)("div",{children:(0,o.jsx)(t.ui_kit$Form.Item,{name:i,style:{marginBottom:_.formItemMarginBottomXS/2},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{ref:p,min:0,max:E,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:Mo})})})})}),!s&&(0,o.jsx)(t.ui_kit$Switch,{id:"auto-width",label:d("Auto"),labelSize:"small",size:"small",checked:g,onChange:h})]})};Xo.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string};var lt=({form:e,name:i,elementSettings:l,isPicture:s,tooltipTitle:n})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),p=(0,a.useRef)(),[g,m]=(0,a.useState)(l.mobileHeight?.value==="auto"),{token:_}=(0,t.ui_kit$useToken)(),E=h=>{e.setFieldsValue({mobileHeight:"",mobileHeightDim:"px"}),m(k=>!k),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{mobileHeight:{classNamePrefix:"em-mob-height-",value:g?null:"auto",dim:""}}})},b=h=>{m(!1)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:n,placement:"bottom",children:(0,o.jsx)("div",{children:(0,o.jsx)(t.ui_kit$Form.Item,{name:i,style:{marginBottom:_.formItemMarginBottomXS/2},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{ref:p,min:0,placeholder:d("Height"),onChange:b,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:g,onChange:E})]})};lt.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string};var Ur=({form:e,elementSettings:i,handleChangeValues:l,boxShadow:s,mobileBordersShow:n,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:p,oneMobileBorderRadiusValue:g,setOneMobileBorderRadiusValue:m,hasLink:_,hasAlt:E,hasTitle:b,linkInputRef:h,linkButtonRef:k,altInputRef:x,altButtonRef:T,titleInputRef:j,titleButtonRef:P,linkInputHandler:S,altButtonHandler:y,altInputHandler:V,titleButtonHandler:z,titleInputHandler:A,linkButtonHandler:O,toggleShowMobileBorderHandler:w,toggleShowMobileBorderRadiusHandler:U,toggleShowMobileBoxShadowHandler:J,toggleShowMobileSizeHandler:Q})=>{const{__:I}=r.useI18n(),{token:le}=(0,t.ui_kit$useToken)(),xe=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)(Go,{form:e,elementSettings:i,imgParent:!0,typeOfForm:"mobile"})}),xe.formImageFieldVerticalAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,align:"right",children:(0,o.jsx)(Vo,{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)(_i,{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)(xi,{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)(Fo,{form:e,label:I("Image path"),name:"src",placeholder:I("Image path"),elementSettings:i,tooltipTitle:""})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,style:{marginBottom:!E&&!_&&!b?le.formItemMarginBottomMD+4:le.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:E||I("Alternative text"),placement:"bottom",getPopupContainer:ve=>ve.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":!!E}),onClick:y,ref:T,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),xe.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:b||I("Tooltip text"),placement:"bottom",getPopupContainer:ve=>ve.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":!!b}),onClick:z,ref:P,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:_||I("Hyperlink URL"),placement:"bottom",getPopupContainer:ve=>ve.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":!!_}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:O,ref:k})})]}),(!!_||!!E||!!b)&&(0,o.jsxs)("div",{style:{marginBottom:le.formItemMarginBottomMD+4},children:[!!_&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:I("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:le.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{ref:h,allowClear:!0,placeholder:I("Hyperlink URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined}),onChange:S})})}),!!E&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:I("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:le.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:I("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:V,ref:x})})}),xe.formFieldImageTitleEnabled&&!!b&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:I("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:le.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:I("Tooltip text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:A,ref:j})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:I("Size"),collapsible:!0,open:p,onToggle:Q,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)(Xo,{form:e,name:"mobileWidth",elementSettings:i,isPicture:"true",tooltipTitle:I("Width")})}),xe.formImageFieldHeightEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(lt,{form:e,name:"mobileHeight",elementSettings:i,isPicture:"true",tooltipTitle:I("Height")})})]})}),xe.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Borders"),collapsible:!0,open:n,onToggle:w,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),xe.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Border radius"),collapsible:!0,open:d,onToggle:U,dividerTop:!0,children:(0,o.jsx)(Io,{form:e,oneBorderRadiusValue:g,setOneBorderRadiusValue:m,elementSettings:i,typeOfForm:"mobile"})}),xe.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Box shadow"),collapsible:!0,open:c,onToggle:J,dividerTop:!0,children:(0,o.jsx)(No,{typeOfForm:"mobile"})}),xe.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e})}),xe.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})};Ur.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,handleChangeValues:f.default.func,boxShadow:f.default.object,mobileBordersShow:f.default.bool,mobileBorderRadiusShow:f.default.bool,mobileBoxShadowShow:f.default.bool,mobileSizeShow:f.default.bool,oneMobileBorderRadiusValue:f.default.bool,setOneMobileBorderRadiusValue:f.default.func,hasLink:f.default.string,hasAlt:f.default.string,hasTitle:f.default.string,linkInputRef:f.default.object,linkButtonRef:f.default.object,altInputRef:f.default.object,altButtonRef:f.default.object,titleInputRef:f.default.object,titleButtonRef:f.default.object,linkInputHandler:f.default.func,altButtonHandler:f.default.func,altInputHandler:f.default.func,titleButtonHandler:f.default.func,titleInputHandler:f.default.func,linkButtonHandler:f.default.func,toggleShowMobileBorderHandler:f.default.func,toggleShowMobileBorderRadiusHandler:f.default.func,toggleShowMobileBoxShadowHandler:f.default.func,toggleShowMobileSizeHandler:f.default.func};var In=e=>typeof e=="object"&&e!==null?e.path:void 0;function Do(){const e=(0,a.useRef)(!1),i=(0,a.useRef)(null),l=(0,a.useCallback)(n=>{e.current=!n},[]),s=(0,a.useCallback)((n,d)=>{const c=JSON.stringify(In(n)??null);return i.current!==c&&(i.current=c,e.current=!1),d?e.current:(e.current=!1,!1)},[]);return(0,a.useMemo)(()=>({markBorderToggled:l,isStaleBorderSnapshot:s}),[l,s])}function mt(e){const i=(0,a.useRef)(null),l=(0,a.useRef)(e);return l.current=e,{remember:(0,a.useCallback)(s=>{i.current=s},[]),fillFields:(0,a.useCallback)((s,n)=>{l.current!==i.current&&s.setFieldsValue(n)},[]),isOwnEcho:(0,a.useCallback)(()=>l.current===i.current,[])}}var Wr=2e3;function zr(e,{ordered:i=!1}={}){const l=(0,a.useRef)([]),s=(0,a.useRef)(new WeakMap),n=(0,a.useRef)(e);return n.current=e,{remember:(0,a.useCallback)(d=>{const c=Date.now(),p=l.current.filter(g=>c-g.at<Wr);p.push({key:JSON.stringify(n.current(d)),at:c}),l.current=p.slice(-10),i&&d&&typeof d=="object"&&s.current.set(d,!1)},[i]),isOwnEcho:(0,a.useCallback)(d=>{if(!d)return!1;const c=Date.now(),p=JSON.stringify(n.current(d)),g=l.current.filter(E=>c-E.at<Wr);if(!i)return g.some(E=>E.key===p);const m=s.current.get(d);if(m!==void 0)return m;const _=g.findIndex(E=>E.key===p);return _>=0&&(l.current=g.slice(_)),s.current.set(d,_>=0),_>=0},[i]),forget:(0,a.useCallback)(()=>{l.current=[],s.current=new WeakMap},[])}}var Cn=1e3,Pn=2e4,Gr="https://useblocks.io/app/",Nn=["activateSection","changeKey","parent","path","nextElem","prevElem"];function Pi(e){if(Array.isArray(e))return e.map(Pi);if(e&&typeof e=="object"){const i=e;return Object.fromEntries(Object.keys(i).sort().map(l=>[l,Pi(i[l])]))}return e}function An(e){const i={...e};return Nn.forEach(l=>delete i[l]),Pi(i)}var Yr=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm(),s=Do(),n=Do();let d=r.useDispatch();const c=r.useAppConfig(),p=r.useEditorProjectId(),g=r.useNotification(),m=r.useSendPostMessage(),_=r.useSendPostMessageEx(),{openImagePicker:E}=r.useImagePicker(),b=r.useSelector(r.selectEmailViewType),h=r.useSelector(r.selectMobileViewActive),k=r.useCurrentUser(),x=r.useSelector(r.selectIsCodeMode),T=r.useSelector(r.selectCodeModeDirection),[j]=r.useUploadImageMutation(),[P,S]=r.useSendShortLinkMutation(),[y,V]=(0,a.useState)({name:"",counter:0}),z=(0,a.useRef)(null),A=(0,a.useRef)(null),O=(0,a.useRef)(null),w=(0,a.useRef)(null),U=(0,a.useRef)(null),J=(0,a.useRef)(null),Q=(0,a.useRef)(null),I=(0,a.useRef)(null),le=(0,a.useRef)(null),[xe,ve]=(0,a.useState)({}),[Z,be]=(0,a.useState)(!0),[Ne,de]=(0,a.useState)(!0),[Fe,Ae]=(0,a.useState)(""),[Ge,je]=(0,a.useState)(""),[ye,_e]=(0,a.useState)(""),[pe,fe]=(0,a.useState)(!1),[me,K]=(0,a.useState)(!1),[ee,ie]=(0,a.useState)(!1),[ae,ne]=(0,a.useState)(!1),[Me,te]=(0,a.useState)(!1),[Te,ke]=(0,a.useState)(!1),[M,C]=(0,a.useState)(!1),[G,L]=(0,a.useState)(!1),[re,ce]=(0,a.useState)("https://"),he=(0,a.useRef)(!1),Ee=(0,a.useRef)(),$e=e,Ce=(0,a.useRef)($e);Ce.current=$e;const Y=(0,a.useCallback)(()=>l.getFieldsValue(!0).video,[l]),[oe,D]=(0,a.useState)(),[ue,Ie]=(0,a.useState)(!1),[Ve,to]=(0,a.useState)(null),[io,uo]=(0,a.useState)({start:0,end:0}),[$,se]=(0,a.useState)(!1),[v,H]=(0,a.useState)(!1),[Pe,He]=(0,a.useState)(!1),[ko,mo]=(0,a.useState)(!1),ao=(0,a.useRef)(void 0),ge=(0,a.useRef)(null),Ye=(0,a.useRef)(null),qe=ko||Pe||G;(0,a.useEffect)(()=>()=>clearTimeout(ao.current),[]);const lo=(0,a.useRef)(null);(0,a.useEffect)(()=>{const N=lo.current,Oe=N?.firstElementChild??null;if(!qe||!N||!Oe)return;const Be=[];for(let ro=N.parentElement;ro;ro=ro.parentElement)getComputedStyle(ro).overflowY!=="visible"&&Be.push(ro);let Se=0,De="";const Qe=()=>{const ro=N.getBoundingClientRect(),So=N.offsetHeight>0?ro.height/N.offsetHeight:1;let To=Math.max(ro.top,0),co=Math.min(ro.bottom,window.innerHeight);Be.forEach(Zo=>{const kt=Zo.getBoundingClientRect();To=Math.max(To,kt.top),co=Math.min(co,kt.bottom)});const _o=(To-ro.top)/(So||1),wo=Math.max(co-To,0)/(So||1),Po=`${Math.round(_o)}/${Math.round(wo)}`;Po!==De&&(De=Po,Oe.style.top=`${_o}px`,Oe.style.height=`${wo}px`),Se=requestAnimationFrame(Qe)};return Qe(),()=>cancelAnimationFrame(Se)},[qe]);const fo=()=>{const N=ge.current;Ye.current=N?.isConnected&&typeof N.selectionStart=="number"?{element:N,start:N.selectionStart,end:N.selectionEnd??N.selectionStart}:null},F=x&&T!=="bottom",X=r.useElementEntityKind();(0,a.useEffect)(()=>{ue&&le.current&&le.current.focus()},[ue]);const we=(N,Oe)=>{const Be=document.getElementById(Oe);if(Be){const Se=Oe.substring(Oe.indexOf("selected_image_form_")+20),De=Be.value?.substring(0,io.start),Qe=Be.value?.substring(io.end);m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{...e,[Se]:De+N+Qe}}),l.setFieldValue(Se,De+N+Qe),Be.focus(),setTimeout(()=>{Be.selectionStart=io.start,Be.selectionEnd=io.start+N.length},400),se(!0)}},q=r.useAppConfig().mergeTags;(0,a.useEffect)(()=>{q?.items?.length&&D(r.mapMargeTags(q.items))},[q,D]);const We=(N,Oe)=>{if(Ie(!1),N){const Be=q.syntax.length>1?oe.findIndex(De=>De.key===Oe[0].key):0,Se=q.syntax[Be].replace("%value%",N[N.length-1]);Ve?.getAttribute("id")==="selected_image_form_title"||Ve?.getAttribute("id")==="selected_image_form_alt"||Ve?.getAttribute("id")==="selected_image_form_link"||Ve?.getAttribute("id")==="selected_image_form_imgReplacer"?we(Se,Ve?.getAttribute("id")):(l.setFieldValue("imgReplacer",Se),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:Se}}))}},Je=(N,Oe)=>Oe.some(Be=>Be.label.toLowerCase().indexOf(N.toLowerCase())>-1),Ue=(N,Oe)=>{const Be=Oe.map((Se,De)=>{const Qe=Se.label.split(new RegExp(`(${N})`,"gi"));return(0,o.jsxs)("span",{children:[De!==0&&(0,o.jsx)("span",{children:" / "}),Qe.map((ro,So)=>ro.toLowerCase()===N.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:ro},So):ro)]},Se.value)});return(0,o.jsx)("div",{title:Oe.map(Se=>Se.label).join(" / "),children:Be})},eo=r.useRootElement();(0,a.useEffect)(()=>{const N=({target:Se})=>{Se.closest('[id="merge_tags_wrapper"]')||(ge.current=Se,to(Se))},Oe=({target:Se})=>{!Se.closest(".merge-tags")&&!Se.closest("#merge_tags_button")&&Ie(!1)},Be=new vo.Disposable;return Be.addDisposable(r.addWindowListenerFromShadow(eo,"focusin",N)),Be.addDisposable(r.addWindowListenerFromShadow(eo,"click",Oe)),()=>{Be.dispose()}},[eo]);const oo=({target:N})=>{if(N&&!$){const{selectionStart:Oe,selectionEnd:Be}=N;uo({start:Oe,end:Be})}se(!1)},yo=e.border,Eo=e.mobileBorder,R=Object.keys(yo).find(N=>yo[N]?.width||yo[N]?.style||yo[N]?.color),Re=Object.keys(Eo).find(N=>Eo[N]?.width||Eo[N]?.style||Eo[N]?.color),B=N=>N&&(N?.width||N?.style||N?.color)?N:"",{remember:Le,fillFields:ze}=mt(e),{remember:ho,isOwnEcho:Xe,forget:Wo}=zr(An,{ordered:!0}),xt=(0,a.useRef)(void 0);(0,a.useEffect)(()=>{if(e){const N=e.path;N!==xt.current&&(xt.current=N,Wo());const Oe=Xe(e)?()=>{}:ze;e.src!==Ee.current&&(Ee.current=e.src,he.current=!1);const Be=e.boxShadow;if(ve(Be),e.link&&ce(Dt(e.link,"https://")),Oe(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:B(e.mobileBorder.all)||!(B(e.mobileBorder.top)||B(e.mobileBorder.bottom)||B(e.mobileBorder.right)||B(e.mobileBorder.left))&&B(e.border.all),mobileBorderTop:B(e.mobileBorder.top)||!B(e.mobileBorder.all)&&B(e.border.top),mobileBorderBottom:B(e.mobileBorder.bottom)||!B(e.mobileBorder.all)&&B(e.border.bottom),mobileBorderRight:B(e.mobileBorder.right)||!B(e.mobileBorder.all)&&B(e.border.right),mobileBorderLeft:B(e.mobileBorder.left)||!B(e.mobileBorder.all)&&B(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:Bo(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:Bo(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:Bo(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:Bo(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",...$e.video}}),e.countdown){let Qe=new URL("https://emailmaker.ru/?"+e.countdown),ro=Qe.searchParams.get("font1"),So=!1,To=!1;ro.endsWith("-b")?(ro=ro.substring(0,ro.length-2),So=!0):ro.endsWith("-i")?(ro=ro.substring(0,ro.length-2),To=!0):ro.endsWith("-bi")&&(ro=ro.substring(0,ro.length-3),So=!0,To=!0);let co=Qe.searchParams.get("font2"),_o=!1,wo=!1;co.endsWith("-b")?(co=co.substring(0,co.length-2),_o=!0):co.endsWith("-i")?(co=co.substring(0,co.length-2),wo=!0):co.endsWith("-bi")&&(co=co.substring(0,co.length-3),_o=!0,wo=!0),Oe(l,{countdownTime:(0,ct.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:ro,countdownNumbersFontSize:Qe.searchParams.get("size1")/2,countdownNumbersFontSizeDim:"px",countdownNumbersColor:"#"+Qe.searchParams.get("color1"),countdownLabelsFont:co,countdownLabelsFontSize:Qe.searchParams.get("size2")/2,countdownLabelsFontSizeDim:"px",countdownLabelsColor:"#"+Qe.searchParams.get("color2"),countdownNumbersStrong:So,countdownNumbersItalic:To,countdownLabelsStrong:_o,countdownLabelsItalic:wo})}!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))?de(!1):de(!0);const Se=s.isStaleBorderSnapshot(e,!!R),De=n.isStaleBorderSnapshot(e,!!Re);Se&&l.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(De||Se&&!Re)&&l.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),fe(Qe=>R&&!Se?!0:Qe),K(Qe=>R&&!Se||Re&&!De?!0:Qe),ie(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),ne(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight||!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),te(!!e.boxShadow),ke(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),C(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value||!!e.height.value),e.link?Ae(e.link):Ae(he.current?"...":""),je(e.alt),_e(e.title),H(e.imgReplacer?.length)}},[l,e,ze,Xe,Wo,$e,R,Re,s,n]),(0,a.useEffect)(()=>{if(qe)return;const N=Ye.current;Ye.current=null,!(!N||!N.element.isConnected||N.element.disabled)&&ge.current===N.element&&(N.element.focus(),N.element.setSelectionRange(N.start,N.end))},[qe]);const zo=async(N,Oe,Be)=>{const Se={};Se.user_id=k.id,Se.folder=N,Oe&&(Oe=await r.prepareImageForEditorUpload(Oe,c),Se.file=Oe),Be&&(Se.page_url=Be);const De=await j(Se);if(De.error)g.fromError("IMAGE_UPLOAD_ERROR",Oe,De.error,!0);else{const Qe=un.extractUploadResult(De.data);if(Qe.error)return;if(Qe.file_url)return Qe.file_url}},on=(N,Oe)=>new Promise((Be,Se)=>{const De=new Image,Qe=new Image;De.crossOrigin="Anonymous",Qe.crossOrigin="Anonymous";let ro=Oe?2:1;const So=()=>{clearTimeout(co),Se(new Error("video preview images are not loaded"))},To=()=>{ro-=1,ro===0&&(clearTimeout(co),Be({frame:De,button:Oe?Qe:null}))},co=setTimeout(So,Pn);De.onload=To,De.onerror=So,De.src=N,Oe&&(Qe.onload=To,Qe.onerror=So,Qe.src=Oe)}),tn=(N,Oe,Be,Se)=>{const De=document.createElement("canvas"),Qe=De.getContext("2d");if(De.width=N.width,De.height=N.height,Qe.clearRect(0,0,De.width,De.height),Qe.drawImage(N,0,0,N.width,N.height),!Oe)return De;const ro=Math.min(De.width,De.height);let So;if(N.height>N.width)So=.3;else{const kt=N.width/N.height;So=Math.min(Se,.3+(kt-1)/(Be-1)*.1)}const To=ro*So,co=Oe.width/Oe.height;let _o,wo;co>=1?(_o=To,wo=To/co):(wo=To,_o=To*co);const Po=(De.width-_o)/2,Zo=(De.height-wo)/2;return Qe.drawImage(Oe,Po,Zo,_o,wo),De},rn=N=>new Promise(Oe=>{N.toBlob(Be=>Oe(Be?new File([Be],"image.jpeg",{type:"image/jpeg"}):null),"image/jpg",1)}),Np=async N=>{const Oe=l.getFieldsValue(!0).video?.playButton||e.video?.playButton;if(!(!N||!Oe||Oe==="none"||Pe)){fo(),He(!0);try{const{frame:Be,button:Se}=await on(N,`${Gr}${Oe}.png`),De=await rn(tn(Be,Se,2,.4)),Qe=De&&await zo(p,De);if(!Qe)return;m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Ce.current.type,settings:{src:Qe}}),Lt({...Ce.current,src:Qe,video:Y()||Ce.current.video,activateSection:null,changeKey:"src"}),setTimeout(()=>{l.setFieldValue("src",Qe)},100)}catch{}finally{He(!1)}}},Ap=async()=>{const N=Y(),Oe=N?.source,Be=N?.playButton;if(!Oe)return;const Se=()=>Y()?.source!==Oe;fo(),mo(!0);try{const De=await zo("tmp",null,Oe);if(!De||Se())return;const{frame:Qe,button:ro}=await on(De,Be&&Be!=="none"?`${Gr}${Be}.png`:null);if(Se())return;const So=await rn(tn(Qe,ro,2.5,.35)),To=So&&await zo(p,So);To&&!Se()&&Ir(To)}catch{}finally{mo(!1)}},vr=N=>{clearTimeout(ao.current),ao.current=setTimeout(()=>{N()},Cn)},Lp=()=>{const N=l.getFieldsValue(!0);let Oe=new URL("https://cdt3.useblocks.io/rndt?"+e.countdown),Be=N.countdownNumbersFont;N.countdownNumbersStrong&&N.countdownNumbersItalic?Be+="-bi":N.countdownNumbersStrong?Be+="-b":N.countdownNumbersItalic&&(Be+="-i");let Se=N.countdownLabelsFont;N.countdownLabelsStrong&&N.countdownLabelsItalic?Se+="-bi":N.countdownLabelsStrong?Se+="-b":N.countdownLabelsItalic&&(Se+="-i"),Oe.searchParams.set("time",new Date(N.countdownTime.$d-N.countdownTimeZone*36e5-new Date().getTimezoneOffset()/60*36e5).toISOString()),Oe.searchParams.set("bg",N.countdownBackgroundColor.substring(1)||"#FFFFFF"),Oe.searchParams.set("tp",!!N.countdownTransparency),Oe.searchParams.set("font1",Be),Oe.searchParams.set("size1",N.countdownNumbersFontSize*2||12),Oe.searchParams.set("color1",N.countdownNumbersColor.substring(1)||"#000000"),Oe.searchParams.set("font2",Se),Oe.searchParams.set("size2",N.countdownLabelsFontSize*2||8),Oe.searchParams.set("color2",N.countdownLabelsColor.substring(1)||"#959595"),Oe.searchParams.set("spacing",Math.round(N.countdownNumbersFontSize*.4)||5),Oe.searchParams.set("locale",N.countdownLanguage.replace("_","-")),Oe.searchParams.set("timezone",N.countdownTimeZone),Oe.searchParams.set("frames",N.countdownDuration),P({link:JSON.stringify({target:Oe.href})}),fo(),L(!0)},Lt=(0,a.useCallback)(N=>{Le(N),ho(N),d(X==="email"?r.setElementSettings$1(N):r.setElementSettings(N))},[d,X,Le,ho]),Ir=(0,a.useCallback)((N,Oe)=>{const Be=Ce.current,Se=r.stripEmVersionFromUrlString(Be.src||"")===r.stripEmVersionFromUrlString(N||"");(!Se||N!==Be.src)&&(m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Be.type,settings:{src:N}}),Lt({...Be,src:N,...Be.type==="video"?{video:Y()||Be.video}:{},activateSection:null,changeKey:"src"}),l.setFieldValue("src",N)),Oe?.mode==="save"&&Se&&(V(De=>({name:"src",counter:De.counter+1})),_(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(N)}))},[l,Y,Lt,m,_]),Ot=(0,a.useCallback)(async N=>{const Oe=e.src||"",Be=r.stripEmVersionFromUrlString(Oe),Se=await E({kind:"img",currentUrl:Et(Be)?"":Be,entryModal:N});Se?.url&&Ir(Se.url,Se.meta)},[Ir,e.src,E]),Cr=(N,...Oe)=>{const Be=l.getFieldsValue(!0),Se=Object.keys(N)[0];let De;switch(Se){case"link":let Qe=rt(N[Se]);Qe!==N[Se]&&l.setFieldValue("link",Qe),De={link:Qe};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":De={boxShadow:{hOffset:Be.boxShadowHOffset,vOffset:Be.boxShadowVOffset,blurRadius:Be.boxShadowBlurRadius,spreadRadius:Be.boxShadowSpreadRadius,color:Be.boxShadowColor,inset:Be.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":Be.borderPosition==="borderAll"?(De={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...Be.borderAll}}},l.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):Be.borderAll?.width||Be.borderAll?.style||Be.borderAll?.color?(De={border:{all:null,left:Be.borderAll,right:Be.borderAll,top:Be.borderAll,bottom:Be.borderAll,[W.REVERSE_BORDER_POSITIONS[Se]]:{...Be[Se],...N[Se]}}},l.setFieldsValue({borderAll:null,borderLeft:Be.borderAll,borderRight:Be.borderAll,borderTop:Be.borderAll,borderBottom:Be.borderAll,[Se]:{...Be[Se],...N[Se]}})):(De={border:{all:null,left:Be.borderLeft,right:Be.borderRight,top:Be.borderTop,bottom:Be.borderBottom,[W.REVERSE_BORDER_POSITIONS[Se]]:{...Be[Se],...N[Se]}}},l.setFieldsValue({border:De.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(Be.mobileBorderPosition==="mobileBorderAll")De={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...Be.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[Se]+"-"}}},l.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const co=W.MOBILE_REVERSE_BORDER_POSITIONS[Se],_o={...Be[Se],...N[Se]},wo=!_o?.width&&!_o?.style&&!_o?.color;if(Be.mobileBorder?.all?.width||Be.mobileBorder?.all?.style||Be.mobileBorder?.all?.color){const Po=Be.mobileBorderAll;De={mobileBorder:{all:null,left:Po,right:Po,top:Po,bottom:Po,[co]:wo?null:{..._o,classNamePrefix:"em-mob-border_"+co+"-"}}},l.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:Po,mobileBorderRight:Po,mobileBorderTop:Po,mobileBorderBottom:Po,[Se]:_o})}else{const Po=e.mobileBorder||{},Zo=kt=>{const $t=Po[kt];return $t&&($t?.width||$t?.style||$t?.color)?$t:null};De={mobileBorder:{all:null,left:co==="left"?wo?null:{..._o,classNamePrefix:"em-mob-border_left-"}:Zo("left"),right:co==="right"?wo?null:{..._o,classNamePrefix:"em-mob-border_right-"}:Zo("right"),top:co==="top"?wo?null:{..._o,classNamePrefix:"em-mob-border_top-"}:Zo("top"),bottom:co==="bottom"?wo?null:{..._o,classNamePrefix:"em-mob-border_bottom-"}:Zo("bottom")}},l.setFieldsValue({[Se]:_o})}}break;case"width":De={[Se]:{value:N[Se],dim:Be.widthDim}};break;case"widthDim":De={width:{value:Be.width,dim:N[Se]}};break;case"height":De={[Se]:{value:N[Se],dim:Be.heightDim}};break;case"heightDim":De={height:{value:Be.height,dim:N[Se]}};break;case"borderRadiusAll":De={borderRadius:{[W.BORDER_RADIUS_POSITION[Se]]:+N[Se]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":De={borderRadius:{topLeft:Be.borderRadiusTopLeft,bottomLeft:Be.borderRadiusBottomLeft,topRight:Be.borderRadiusTopRight,bottomRight:Be.borderRadiusBottomRight,[W.BORDER_RADIUS_POSITION[Se]]:+N[Se]}};break;case"mobileWidth":De={[Se]:{classNamePrefix:"em-mob-width-",value:N[Se],dim:Be.mobileWidthDim}};break;case"mobileWidthDim":De={mobileWidth:{classNamePrefix:"em-mob-width-",value:Be.mobileWidth||100,dim:N[Se]}};break;case"mobileHeight":De={[Se]:{classNamePrefix:"em-mob-height-",value:N[Se],dim:Be.mobileHeightDim}};break;case"mobileHeightDim":De={mobileHeight:{classNamePrefix:"em-mob-height-",value:Be.mobileHeight,dim:N[Se]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":De={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[Se]]:N[Se],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[Se]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":De={mobileBoxShadow:{hOffset:Be.mobileBoxShadowHOffset,vOffset:Be.mobileBoxShadowVOffset,blurRadius:Be.mobileBoxShadowBlurRadius,spreadRadius:Be.mobileBoxShadowSpreadRadius,color:Be.mobileBoxShadowColor,inset:Be.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":De={[Se]:{classNamePrefix:"em-mob-text_align-",value:N[Se]}};break;case"mobileVerticalAlign":De={[Se]:{classNamePrefix:"em-mob-vertical_align-",value:N[Se]}};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":vr(Lp);break;case"video":{const co={...e.video,...Be.video,...N.video},_o=co.source??Be.link;vr(Ap),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"video",settings:{video:co,link:_o}}),Lt({...e,video:co,link:_o,activateSection:null,changeKey:"video"});break}case"src":const ro=N[Se],So=e.src,To=Be.video?.playButton||e.video?.playButton;if(e.type==="video"&&To&&To!=="none"&&!Pe&&ro&&(!So||ro!==So)){vr(()=>Np(ro));return}De=N;break;default:De=N}Se!=="borderPosition"&&Se!=="mobileBorderPosition"&&Se.indexOf("countdown")===-1&&Se!=="video"&&(m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:De}),Se!=="video"&&Se.indexOf("countdown")===-1&&Se!=="mobileBorderRadiusAll"&&Se!=="mobileBorderRadiusTopLeft"&&Se!=="mobileBorderRadiusTopRight"&&Se!=="mobileBorderRadiusBottomLeft"&&Se!=="mobileBorderRadiusBottomRight"&&Lt({...e,...De,mobileBorderRadius:{...e.mobileBorderRadius,...De?.mobileBorderRadius},activateSection:null,changeKey:Se}))};(0,a.useEffect)(()=>{S.isError&&(g.error(S),L(!1))},[S]),(0,a.useEffect)(()=>{if(S.isSuccess&&G){if(S.data.data?.status===400)g.error({title:S.data.code,description:S.data.message});else{let N=new URL(S.data.target),Oe={countdown:{link:S.data.link,params:N.search.substring(1)}};m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Oe})}L(!1)}},[S,G,e,g,m]);const Op=N=>{N.data.operation===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(d(r.closeSecondModal()),d(r.closeModal$1()))};r.useListenPostMessage(Op),r.useImageControlRequest(e.src,N=>{N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?Ot(r.MODALS.UPLOAD_IMAGE_MODAL_AI):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?Ot(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?Ot(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?Ot(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP&&Ot(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK)});const $p=()=>{const N=l.getFieldsValue(!0);s.markBorderToggled(!pe),setTimeout(()=>{fe(Oe=>!Oe),pe?(N.borderAll=W.NULL_BORDER,N.borderTop=W.NULL_BORDER,N.borderBottom=W.NULL_BORDER,N.borderRight=W.NULL_BORDER,N.borderLeft=W.NULL_BORDER):N.borderAll={width:1,color:"#E5E5E5",style:"solid"},m({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}}}})})},Fp=()=>{const N=l.getFieldsValue(!0);n.markBorderToggled(!me),setTimeout(()=>{K(Oe=>!Oe),me?(N.mobileBorderAll=W.NULL_BORDER,N.mobileBorderTop=W.NULL_BORDER,N.mobileBorderBottom=W.NULL_BORDER,N.mobileBorderRight=W.NULL_BORDER,N.mobileBorderLeft=W.NULL_BORDER):N.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},m({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}}}})})},Mp=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{ie(Oe=>!Oe),ee?(N.borderRadiusAll=0,be(!0)):N.borderRadiusAll=5,m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:N.borderRadiusAll}}})})},Dp=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{ne(Oe=>!Oe),ae?(N.mobileBorderRadiusAll=null,de(!0)):N.mobileBorderRadiusAll=5,m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:N.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},Vp=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{te(Oe=>!Oe),Me?(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"),m({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}}})})},Hp=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{ke(Oe=>!Oe),Te?(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"),m({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-"}}})})},Up=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{C(Oe=>!Oe),M&&(N.mobileWidth="",N.mobileHeight="",m({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-"}}}))})},ln=()=>{Fe?(he.current=!1,Ae(""),l.setFieldValue("link",""),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{link:""}})):(he.current=!0,Ae(z.current&&z.current.input.value?z.current.input.value:"..."),setTimeout(()=>{z.current.focus()}))},sn=N=>{N.target.value===""?Ae("..."):(A.current.classList.add("selected-td-form__button--active"),Ae(N.target.value)),Yo(N.target.value,ce)},an=()=>{const N=l.getFieldsValue(!0);Ge?(je(""),N.alt="",m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{alt:""}})):(je(O.current&&O.current.input.value?O.current.input.value:"..."),setTimeout(()=>{O.current.focus()}))},nn=N=>{N.target.value===""?je("..."):(w.current.classList.add("selected-td-form__button--active"),je(N.target.value))},dn=()=>{const N=l.getFieldsValue(!0);ye?(_e(""),N.title="",m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{title:""}})):(_e(U.current&&U.current.input.value?U.current.input.value:"..."),setTimeout(()=>{U.current.focus()}))},Wp=()=>{H(!v),v?(l.setFieldValue("imgReplacer",""),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:""}})):setTimeout(()=>Q.current.focus())},zp=N=>{N.target.value!==""&&I.current.classList.add("selected-td-form__button--active")},cn=N=>{N.target.value===""?_e("..."):(J.current.classList.add("selected-td-form__button--active"),_e(N.target.value))},Gp=N=>{l.setFieldValue("link",N!=="mergetag"?N:""),ce(N)};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_image_form",initialValues:{src:"",width:"",height:"",widthDim:"",heightDim:"",alt:"",align:"left",border:"",boxShadow:"",show:"all",borderPosition:W.BORDER_POSITIONS[R]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[Re]||"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:Cr,autoComplete:"off",disabled:qe,className:qe?"element-controls selected-image-form_busy":"element-controls",children:[qe&&(0,o.jsx)("div",{className:"selected-image-form__loader",ref:lo,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:$e.type==="countdown"?i("Preparing countdown preview…"):i("Preparing video preview…")})]})}),!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"})}),b==="mobile"&&h.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(Ur,{form:l,elementSettings:e,handleChangeValues:Cr,boxShadow:xe,mobileBordersShow:me,mobileBorderRadiusShow:ae,mobileBoxShadowShow:Te,mobileSizeShow:M,oneMobileBorderRadiusValue:Ne,setOneMobileBorderRadiusValue:de,hasLink:Fe,hasAlt:Ge,hasTitle:ye,linkInputRef:z,linkButtonRef:A,altInputRef:O,altButtonRef:w,titleInputRef:U,titleButtonRef:J,linkInputHandler:sn,altButtonHandler:an,altInputHandler:nn,titleButtonHandler:dn,titleInputHandler:cn,linkButtonHandler:ln,toggleShowMobileBorderHandler:Fp,toggleShowMobileBorderRadiusHandler:Dp,toggleShowMobileBoxShadowHandler:Hp,toggleShowMobileSizeHandler:Up})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Hr,{form:l,elementSettings:e,boxShadow:xe,bordersShow:pe,borderRadiusShow:ee,boxShadowShow:Me,oneBorderRadiusValue:Z,setOneBorderRadiusValue:be,hasLink:Fe,hasAlt:Ge,hasTitle:ye,isOpenSrcReplacer:v,mergeTagItems:oe,mergeMenuOpen:ue,setMergeMenuOpen:Ie,cascaderRef:le,linkInputRef:z,linkButtonRef:A,altInputRef:O,altButtonRef:w,titleInputRef:U,titleButtonRef:J,srcReplacerInputRef:Q,srcReplacerButtonRef:I,linkProtocol:re,handleLinkProtocolsChange:Gp,linkButtonHandler:ln,linkInputHandler:sn,altButtonHandler:an,altInputHandler:nn,titleButtonHandler:dn,titleInputHandler:cn,srcReplacerButtonHandler:Wp,srcInputHandler:zp,handleSelect:oo,onChange:We,filter:Je,renderSearchOption:Ue,handleChangeValues:Cr,toggleShowBorderHandler:$p,toggleShowBorderRadiusHandler:Mp,toggleShowBoxShadowHandler:Vp})})]})};Yr.propTypes={elementSettings:f.default.object.isRequired};var Xr=()=>{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"})})})},st=({form:e,elementSettings:i,imgParent:l=!1,name:s="align",setAlignStateHandle:n=()=>{},withHotKeys:d=!0})=>{const{__:c}=r.useI18n(),p=r.useSendPostMessage(),g=r.useAppConfig(),[m,_]=(0,a.useState)(null);(0,a.useEffect)(()=>{globalThis?.navigator?.userAgent.includes("Macintosh")&&_(!0)},[]);const E=j=>{n(j),e.setFieldsValue({[s]:j}),p({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[s]:j}})},b=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,h=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?m?b:h: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:E,disabled:l&&!i.parent,strokeWidth:g?.iconStrokeWidth,labels:k})})},no=({form:e,elementSettings:i,name:l,icon:s,tooltipTitle:n=null,showTooltip:d=!0,forceInactive:c=!1})=>{const{__:p}=r.useI18n(),g=e.getFieldValue(l),m=r.useSendPostMessage(),[_,E]=(0,a.useState)(i[l]);(0,a.useEffect)(()=>{i[l]!==e.getFieldValue(l)&&(e.setFieldValue(l,i[l]),E(i[l]))},[i,e,l]),(0,a.useEffect)(()=>{_!==g&&E(g)},[g,_,l]);const b=()=>{const h={[l]:!_};e.setFieldValue(l,!_),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:h}),l==="textSuperscript"?e.setFieldValue("textSubscript",!1):l==="textSubscript"&&e.setFieldValue("textSuperscript",!1),E(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:n||p(l.substring(4)),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":_&&!c}),onClick:b,children:s})}):(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":_&&!c}),onClick:b,children:s})})};no.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string,imgParent:f.default.bool};var Ln=["email","block"];function On(e){const i=r.getMessageService(e).getTarget(),l=r.getCanvasService(e);Ln.map(s=>l?.peek(s)?.element).find(s=>!!i&&s?.contentWindow===i)?.focus({preventScroll:!0})}var Kr=()=>{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")}]},$n=["hover"],Fn=e=>e.parentNode,Mn=(e,i="#c6c3c3",l={},s)=>{const{symbolSize:n="25px",marginRight:d="5px",marginBottom:c="5px",textStyle:p={whiteSpace:"normal",lineHeight:"1.2"}}=l;return e.map(g=>({value:g.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:n,lineHeight:"0.7",width:n,textAlign:"center",...p},children:g.symbol}),(0,o.jsx)("span",{style:p,children:g.description})]})}))},Bt=({form:e,fillFields:i,elementSettings:l,showAddParagraph:s=!0,isButton:n=!1,linkProtocol:d,setLinkProtocol:c,linkTarget:p,isBulletFontColorChecked:g=!1,setIsBulletFontColorChecked:m=()=>{},showTopDivider:_=!0,showLineHeight:E=!0})=>{const{__:b}=r.useI18n(),h=W.useGoogleFontsLoader(),{token:k}=(0,t.ui_kit$useToken)(),x=r.useNotification(),T=r.useSendPostMessage(),j=r.useContainer(),P=r.useAppConfig(),S=(0,a.useRef)(),y=(0,a.useRef)(null),V=(0,a.useRef)(null),z=(0,a.useRef)(null),A=(0,a.useRef)(!1),O=l,[w,U]=(0,a.useState)(!!O.textReplacer?.length),[J,Q]=(0,a.useState)(!!O.textAnchor?.length),[I,le]=(0,a.useState)(null),[xe,ve]=(0,a.useState)({start:0,end:0}),[Z,be]=(0,a.useState)(!1),[Ne,de]=(0,a.useState)([]),[Fe,Ae]=(0,a.useState)(O.list?.bulletsColor),[Ge,je]=(0,a.useState)(l);l!==Ge&&(je(l),Ae(O.list?.bulletsColor),U(!!O.textReplacer?.length),Q(!!O.textAnchor?.length));const[ye,_e]=(0,a.useState)(!1),[pe,fe]=(0,a.useState)(!1),me=(0,a.useRef)(null),K=(0,a.useRef)(""),ee=Kr(),ie=(0,a.useMemo)(()=>ee,[]),ae={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,a.useEffect)(()=>{n&&l?.textColor!==void 0&&e.setFieldValue("textColor",l.textColor)},[n,l?.textColor,e]);let ne=null;(0,a.useEffect)(()=>{if(ae?.textColor&&g){const ge=e.getFieldValue("textColor");T({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{ColorBullets:ge}})}},[ae?.textColor]),(0,a.useEffect)(()=>{const ge=e.getFieldValue("textLink");typeof l.linkHref=="string"&&_e(!0),me&&!ge&&(_e(!1),e.setFieldsValue({linkHref:null})),me.current=ge||null},[ae?.textLink,ae?.linkHref,l.linkHref,e]),(0,a.useEffect)(()=>{const ge=e.getFieldValue("listUL"),Ye=e.getFieldValue("listOL");ge&&K.current!=="listUL"?(e.setFieldValue("listOL",!1),K.current="listUL"):Ye&&K.current!=="listOL"&&(e.setFieldValue("listUL",!1),K.current="listOL"),!ge&&!Ye&&(K.current="")},[ae?.listUL,ae?.listOL,e]);const Me=ge=>{ge.data.operation===r.EVENT_TYPES.APPLICATION_FOCUS_IN_IFRAME&&le(null)};r.useListenPostMessage(Me);const[te,Te]=(0,a.useState)(null);(0,a.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&Te(!0)},[]);const ke=(0,a.useRef)(null);function M(ge){const Ye=ge.key.toLowerCase();let qe=!1;return((ne==="control"||ne==="meta")&&(Ye==="a"||Ye==="A")||(ne==="a"||ne==="A")&&(Ye==="control"||Ye==="meta"))&&(qe=!0),ne=Ye,Ye!=="control"&&Ye!=="a"&&Ye!=="A"&&Ye!=="meta"&&(ne=null),qe}const C=ge=>{T({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:ge,locale:"en_US"}),x.success({title:b("It`s done!")})},G=[{key:"1",label:b("This element"),onClick:()=>C("typograf")},{key:"2",label:b("The whole email"),onClick:()=>C("typograf_all")}],[L,re]=(0,a.useState)(),[ce,he]=(0,a.useState)(!1);(0,a.useEffect)(()=>{const ge=Mn(ie,Fe,{});de(ge)},[ie,Fe]),(0,a.useEffect)(()=>{const ge=l.linkHref||l.href;ge&&Yo(ge,c);const Ye=l.linkHref||l.href,qe=Ye&&vi(Ye)?Ye.slice(1):Ye||"https://";(i??((lo,fo)=>lo.setFieldsValue(fo)))(e,{linkHref:qe})},[e,l,c,i]);const Ee=r.useAppConfig().mergeTags;(0,a.useEffect)(()=>{Ee?.items?.length&&re(r.mapMargeTags(Ee.items))},[Ee,re]);const $e=ge=>{e.setFieldValue("linkHref",ge!=="mergetag"?ge:""),c(ge)},Ce=(ge,Ye)=>{if(he(!1),ge){const qe=Ee.syntax.length>1?L.findIndex(fo=>fo.key===Ye[0].key):0,lo=Ee.syntax[qe].replace("%value%",ge[ge.length-1]);if(I?.getAttribute("id")==="selected_button_form_href"||I?.getAttribute("id")==="selected_text_form_linkHref"||I?.getAttribute("id")==="selected_text_form_textReplacer")Ve(lo,I?.getAttribute("id"));else{e.setFieldValue("textReplacer",lo);const fo=Date.now();T({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:`${lo}~~${fo}`}}),j&&setTimeout(()=>On(j))}}},Y=(ge,Ye)=>Ye.some(qe=>qe.label.toLowerCase().indexOf(ge.toLowerCase())>-1),oe=(ge,Ye)=>{const qe=Ye.map((lo,fo)=>{const F=lo.label.split(new RegExp(`(${ge})`,"gi"));return(0,o.jsxs)("span",{children:[fo!==0&&(0,o.jsx)("span",{children:" / "}),F.map((X,we)=>X.toLowerCase()===ge.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:X},we):X)]},lo.value)});return(0,o.jsx)("div",{title:Ye.map(lo=>lo.label).join(" / "),children:qe})};(0,a.useEffect)(()=>{ce&&ke.current&&ke.current.focus()},[ce]);const D=r.useRootElement();(0,a.useEffect)(()=>{const ge=({target:lo})=>{lo.closest('[id="merge_tags_wrapper"]')||le(lo)},Ye=({target:lo})=>{!lo.closest(".merge-tags")&&!lo.closest("#merge_tags_button")&&he(!1)},qe=new vo.Disposable;return qe.addDisposable(r.addWindowListenerFromShadow(D,"focusin",ge)),qe.addDisposable(r.addWindowListenerFromShadow(D,"click",Ye)),()=>{qe.dispose()}},[D]);const ue=(0,a.useCallback)(()=>{const ge=window.getSelection();ge&&ge.toString().length>0&&(A.current=!0)},[]),Ie=(0,a.useCallback)(({target:ge})=>{if(ge&&!Z){const{selectionStart:Ye,selectionEnd:qe}=ge;ve(lo=>lo?.start===Ye&&lo?.end===qe?lo:{start:Ye,end:qe})}be(!1)},[Z]);(0,a.useEffect)(()=>Ie({target:p?.target}),[p,Ie]);const Ve=(ge,Ye)=>{const qe=document.getElementById(Ye);if(qe){const lo=qe.value?.substring(0,xe.start),fo=qe.value?.substring(xe.end),F=Ye.substring(Ye.lastIndexOf("_")+1);T({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{[F]:lo+ge+fo}}),e.setFieldValue(F,lo+ge+fo),qe.focus(),setTimeout(()=>{qe.selectionStart=xe.start,qe.selectionEnd=xe.start+ge.length},400),be(!0)}},to=()=>{U(!w),w?(e.setFieldValue("textReplacer",""),T({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:""}})):setTimeout(()=>y.current.focus())},io=ge=>{ge.target.value!==""&&V.current?.classList.add("selected-td-form__button--active")},uo=(ge="unknown")=>{Q(!J),J?(e.setFieldValue("textAnchor",""),T({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textAnchor:""}})):setTimeout(()=>z.current?.focus())},$=ge=>{const Ye=ge.target,qe=Ye.value,lo=Ye.selectionStart,fo=M(ge);if(A.current&&lo===0&&T({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:`${qe}~`}}),A.current=fo,lo===0&&ge.key===" "){ge.preventDefault();return}if(ge.key===" "){if(lo!==qe.length){ge.preventDefault();return}qe.endsWith(" ")&&ge.preventDefault()}},se=ge=>{Ae(ge),g&&m(!1)},v=n?P.formButtonFieldInsertImageEnabled:P.formTextFieldTypografEnabled,H=P.formTextFieldTypografEnabled&&!n,Pe=(0,a.useMemo)(()=>[{message:b("Please set the font color")}],[b]),{showOnMobile:He,usedColors:ko}=l,mo=n&&!E&&!He,ao=(0,o.jsx)(t.ui_kit$Tooltip,{trigger:$n,title:b("Text color"),placement:"bottom",zIndex:1,getPopupContainer:Fn,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:Pe,className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:b("Color"),usedColors:ko})})});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)(st,{form:e,elementSettings:l,name:"textAlign"})})})}),v||H||P.mergeTagsShow&&L?(0,o.jsx)(t.ui_kit$FormSection,{title:null,dividerTop:_,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginTop:4},children:[v&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Col,{span:H?12:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"AddImage",style:{marginBottom:k.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"AddImage",component:t.icons$AddImage}),onClick:()=>C("add_img"),style:{width:"100%"},children:b("Add image")})})})}),H&&(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:k.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,menu:{items:G},trigger:["hover"],placement:"bottom",getPopupContainer:ge=>ge.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:()=>C("typograf"),style:{width:"100%"},children:b("Typography")})})})})}),P.mergeTagsShow&&L&&(0,o.jsxs)(t.ui_kit$Col,{span:24,id:"merge_tags_wrapper",style:{marginBottom:k.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:ce?"none":"inline-flex"},onClick:()=>he(!0),children:b("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:ke,classNames:{popup:{root:"merge-tags"}},options:L,placeholder:b("Start typing the title"),showSearch:{filter:Y,render:oe},spellCheck:"false",getPopupContainer:ge=>ge.closest(".email-pane__collapse-wrapper"),onChange:Ce,style:{display:ce?"block":"none",width:"100%"},open:ce,onKeyDown:ge=>{ge.key==="Escape"&&he(!1)}})]})]})}):null,(0,o.jsxs)(t.ui_kit$FormSection,{title:null,dividerTop:_||v||H,bodyStyle:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Text font"),placement:"bottom",zIndex:1,getPopupContainer:ge=>ge.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:h,getPopupContainer:ge=>ge.closest(".email-pane__collapse-wrapper")})})}),!l.showOnMobile&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:b("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),E&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:b("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})}),mo&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:ao})]}),(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:[n&&(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)(no,{form:e,elementSettings:l,name:"textStrong",tooltipTitle:b(te?"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)(no,{form:e,elementSettings:l,name:"textItalic",tooltipTitle:b(te?"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)(no,{form:e,elementSettings:l,name:"textUnderline",tooltipTitle:b(te?"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)(no,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:b(te?"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"})})]})}),!mo&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:ao})]}),!n&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:l,name:"textStrong",tooltipTitle:b(te?"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)(no,{form:e,elementSettings:l,name:"textItalic",tooltipTitle:b(te?"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)(no,{form:e,elementSettings:l,name:"textUnderline",tooltipTitle:b(te?"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)(no,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:b(te?"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)(no,{form:e,elementSettings:l,name:"listUL",tooltipTitle:b("Unordered list"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnorderedListOutlined",component:t.icons$UnorderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:Ie})}),!l?.list?.isList&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:l,name:"listOL",tooltipTitle:b("Ordered list"),icon:(0,o.jsx)(r.EmIcons,{icon:"OrderedListOutlined",component:t.icons$OrderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:Ie})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:l,name:"textSuperscript",tooltipTitle:b("Text superscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Superscript",component:t.icons$Superscript})})}),l?.list?.isList&&(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(no,{form:e,elementSettings:l,name:"textSubscript",tooltipTitle:b("Text subscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Subscript",component:t.icons$Subscript})})]}),s&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,className:(0,Ke.default)("selected-text-common-form__button selected-text-common-form__button_style",{"selected-text-common-form__button--active":typeof l.linkHref=="string"}),elementSettings:l,name:"textLink",forceInactive:!!l.textAnchor,tooltipTitle:b("Link"),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"}),onSelect:Ie})}),l?.list?.isList&&P.formTextFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:b("Text replacer"),placement:"bottom",getPopupContainer:ge=>ge.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":w}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:to,ref:V})})}),(!l?.list?.isList||s&&l?.list?.isList)&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:b("More options"),placement:"bottom",getPopupContainer:ge=>ge.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":pe||J}),icon:(0,o.jsx)(r.EmIcons,{icon:"DotsHoriz",component:t.icons$DotsHoriz,className:"selected-td-form__icon-radius"}),onClick:()=>fe(!pe)})})})]})]}),!n&&pe&&(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)(no,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:b(te?"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)(no,{form:e,elementSettings:l,name:"textSubscript",tooltipTitle:b("Text subscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Subscript",component:t.icons$Subscript})})]}),P.formTextFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:b("Text replacer"),placement:"bottom",getPopupContainer:ge=>ge.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":w}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:to,ref:V})})})]}),s&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:b("Anchor"),placement:"bottom",getPopupContainer:ge=>ge.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":J}),icon:(0,o.jsx)(r.EmIcons,{icon:"Anchor",component:t.icons$Anchor,className:"selected-text-common-form__icon-radius"}),onMouseDown:ge=>{ge.preventDefault(),uo("mouseDown")}})})})]}),s&&typeof l.linkHref=="string"&&ye&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(it,{show:d==="#",__:b,style:{marginBottom:k.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b(d==="#"?"Anchor name":"The URL that the hyperlink directs to."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkHref",style:{marginBottom:d==="mailto:"?k.formItemMarginBottomXS:""},children:(0,o.jsx)(t.ui_kit$Input,{ref:S,addonBefore:(0,o.jsx)(tt,{linkProtocol:d,handleLinkProtocolsChange:$e,__:b}),allowClear:!0,placeholder:b(d==="#"?"Anchor name":"Hyperlink URL"),autoFocus:l?.isNewLink,onSelect:Ie,prefix:(0,o.jsx)(ot,{linkProtocol:d})})})}),d==="mailto:"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"subject",style:{marginBottom:k.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:b("Subject"),onSelect:Ie})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:k.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:b("Body"),onSelect:Ie})})]})]}),s&&J&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Anchor name"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textAnchor",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:b("Anchor name"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content addon-text-content--icon",title:b("Anchor"),"aria-hidden":!0,children:(0,o.jsx)(r.EmIcons,{icon:"Anchor",component:t.icons$Anchor,className:"selected-text-common-form__icon-radius",size:18})}),ref:z,onSelect:Ie,onBlur:()=>{e.getFieldValue("textAnchor")?.trim()||Q(!1)}})})}),!n&&w&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textReplacer",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:b("The code that will replace this text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:b("Text")}),onChange:io,onKeyDown:$,onDoubleClick:ue,ref:y,onSelect:Ie})})})]})}),!n&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Text color"),placement:"bottom",zIndex:1,getPopupContainer:ge=>ge.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:b("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:b("Color"),usedColors:l.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Text background"),placement:"bottom",zIndex:1,getPopupContainer:ge=>ge.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:b("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:b("Background color"),usedColors:l.usedColors})})})})]})]}),!n&&l?.list?.isList&&(0,o.jsxs)(t.ui_kit$FormSection,{title:b("List settings"),dividerTop:!0,children:[l?.list?.listType==="OL"&&(0,o.jsx)(t.ui_kit$Row,{children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets font"),placement:"bottom",zIndex:1,getPopupContainer:ge=>ge.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"BulletsFontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:h,getPopupContainer:ge=>ge.closest(".email-pane__collapse-wrapper"),style:{marginTop:"-9px"}})})})})}),(0,o.jsx)(t.ui_kit$Row,{gutter:[10],children:l?.list?.listType==="UL"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets type"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"BulletType",className:"bullet-type",children:(0,o.jsx)(t.ui_kit$Select,{size:"medium",placeholder:b("Bullets type"),onClick:ge=>ge.stopPropagation(),options:Ne})})})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:[10],children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets color"),placement:"bottom",zIndex:1,getPopupContainer:ge=>ge.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"ColorBullets",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:b("Bullets color"),usedColors:l.usedColors,disabled:g,onChange:se,externalValue:g?ae?.textColor:void 0})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"BulletsSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,defaultValue:l?.list?.bulletFontSize,placeholder:b("Bullets size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})})]}),l?.list?.listType==="OL"&&(0,o.jsxs)(t.ui_kit$Row,{children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:l,name:"BulletTextStrong",tooltipTitle:b(te?"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)(no,{form:e,elementSettings:l,name:"BulletTextItalic",tooltipTitle:b(te?"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)(no,{form:e,elementSettings:l,name:"BulletTextStrikethrough",tooltipTitle:b(te?"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)(no,{form:e,elementSettings:l,name:"BulletTextUnderline",tooltipTitle:b(te?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:[10],style:{marginTop:"-8px"},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Between list items"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"SpacingBetweenParagraphs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:5,max:100,placeholder:b("Between list items"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Between bullets and text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"SpacingBetweenBulletsAndText",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:1,max:100,placeholder:b("Between bullets and text"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px"})})})})]})]})]})},Ni=({form:e,elementSettings:i,showAddParagraph:l=!0,isButton:s=!1})=>{const{__:n}=r.useI18n(),d=W.useGoogleFontsLoader(),c=r.useSendPostMessage(),p=r.useDispatch(),g=r.useElementEntityKind(),m=r.useAppConfig(),[_,E]=(0,a.useState)(null);(0,a.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&E(!0)},[]);const b=P=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:P,locale:"en_US"})},[h,k]=(0,a.useState)(i.textAlign),[x,T]=(0,a.useState)(i.linkHref),j=P=>k(P);return(0,a.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:n("Text font"),placement:"bottom",zIndex:1,getPopupContainer:P=>P.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:P=>P.closest(".selected_text_common_form_mobile")})})})}),(0,o.jsx)("div",{style:{width:90},children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:n("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:n("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:n("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:n("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)(no,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:n(_?"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)(no,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:n(_?"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)(no,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:n(_?"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)(no,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:n(_?"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:n("Text color"),placement:"bottom",zIndex:1,getPopupContainer:P=>P.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:n("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:n("Color"),usedColors:i.usedColors,getPopupContainer:P=>P.closest(".selected_text_common_form_mobile")})})}),!s&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:n("Text background"),placement:"bottom",zIndex:1,getPopupContainer:P=>P.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:n("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:n("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:n("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:n("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:P=>P.closest(".selected_text_common_form_mobile"),children:(0,o.jsx)("div",{children:(0,o.jsx)(no,{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)(no,{form:e,className:"selected-td-form__button selected-td-form__button_style",elementSettings:i,name:"textLink",tooltipTitle:n("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)(st,{form:e,elementSettings:i,name:"textAlign",setAlignStateHandle:j}),classNames:{root:"codemode-textalign-dropdown"},styles:{root:{left:615,top:52,transform:"translateX(0)",marginLeft:57}},trigger:["hover"],placement:"bottom",getPopupContainer:P=>P.closest(".selected_text_common_form_mobile"),children:(0,o.jsx)(t.ui_kit$Button,{icon:h==="right"?(0,o.jsx)(r.EmIcons,{icon:"AlignRightOutlined",component:t.icons$AlignRightOutlined,size:18,strokeWidth:m.iconStrokeWidth}):h==="center"?(0,o.jsx)(r.EmIcons,{icon:"AlignCenterOutlined",component:t.icons$AlignCenterOutlined,size:18,strokeWidth:m.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"AlignLeftOutlined",component:t.icons$AlignLeftOutlined,size:18,strokeWidth:m.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:n("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:()=>b("add_p"),className:"selected-td-form__button"})}),(!s||m.formButtonFieldInsertImageEnabled)&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:n("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:m.iconStrokeWidth}),onClick:()=>b("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}),p(r.resetToLastActiveSettingsTab()),setTimeout(()=>{p(g==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300)}})]})]})})},Vt=({elementSettings:e,imgParent:i=!1,name:l="mobileAlign"})=>{const{__:s}=r.useI18n(),n=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:n?.iconStrokeWidth,labels:{alignLeft:s("Text align left"),alignCenter:s("Text align center"),alignRight:s("Text align right"),alignJustify:s("Text align justify")}})})};Vt.propTypes={elementSettings:f.default.object.isRequired,imgParent:f.default.bool,name:f.default.string};var Dn=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useDispatch(),s=r.useSendPostMessage(),[n]=t.ui_kit$Form.useForm(),d=r.useSelector(r.selectEmailViewType),c=r.useSelector(r.selectMobileViewActive),p=r.useSelector(r.selectIsCodeMode),g=r.useSelector(r.selectCodeModeDirection),m=p&&g!=="bottom",[_,E]=(0,a.useState)("https://"),[b,h]=(0,a.useState)(!1),k=Kr(),x=(0,a.useMemo)(()=>k,[]),T=r.useElementEntityKind(),{remember:j,fillFields:P}=mt(e),S=(0,a.useCallback)(V=>{j(V),l(T==="email"?r.setElementSettings$1(V):r.setElementSettings(V))},[l,T,j]);(0,a.useEffect)(()=>{if(e){const{subject:V,body:z,baseEmail:A}=Mr(e.linkHref),O=e.linkHref,w=typeof O=="string"&&vi(O),U=typeof O=="string"&&O.startsWith("mailto:")?A:w?O.slice(1):typeof O=="string"?O:"https://";E(Dt(O||"","https://")),P(n,{...e,lineHeight:u(e.lineHeight),linkHref:U,subject:V,body:z,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:Dr(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:b,BulletsFontFamily:e?.list?.bulletFontFamily,BulletTextUnderline:e?.list?.bulletFontUnderline,BulletTextStrikethrough:e?.list?.bulletFontStrikethrough,BulletType:x.find(J=>J.symbol===e?.list?.bulletType)?.code??x[0].code,textSuperscript:e?.textSuperscript,textSubscript:e?.textSubscript,listOL:e?.standardList?.listTypeOL,listUL:e?.standardList?.listTypeUL})}},[n,e]);const y=V=>{const z=n.getFieldsValue(!0),A=Object.keys(V)[0];let O;switch(A){case"mobileFontSize":O={[A]:{classNamePrefix:"em-mob-font_size-",value:V[A],dim:z.mobileFontSizeDim}};break;case"mobileLineHeight":O={[A]:{classNamePrefix:"em-mob-line_height-",value:V[A],dim:z.mobileLineHeightDim}};break;case"mobileTextAlign":O={[A]:{classNamePrefix:"em-mob-text_align-",value:V[A]}};break;case"linkHref":let w=rt(V[A]);if(w!==V[A]&&n.setFieldValue("linkHref",w),_==="#"&&w&&!w.startsWith("#")&&(w="#"+w),w.startsWith("mailto:")){const J=n.getFieldValue("subject"),Q=n.getFieldValue("body");O={[A]:Ii(w,J,Q)}}else O={[A]:w};Yo(w,E);break;case"subject":case"body":const U=n.getFieldValue("linkHref")||"";if(U.substring(0,7)==="mailto:"){const J=U.split("?")[0],Q=A==="subject"?V[A]:n.getFieldValue("subject"),I=A==="body"?V[A]:n.getFieldValue("body"),le=[];Q&&le.push(`subject=${encodeURIComponent(Q)}`),I&&le.push(`body=${encodeURIComponent(I)}`),O={linkHref:le.length>0?`${J}?${le.join("&")}`:J}}else return;break;default:O=V}s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:O}),S({...e,list:{...e.list,bulletsColor:n.getFieldValue("ColorBullets"),bulletFontFamily:n.getFieldValue("BulletsFontFamily"),bulletFontSize:n.getFieldValue("BulletsSize"),betweenParagraphs:n.getFieldValue("SpacingBetweenParagraphs"),betweenRowCell:n.getFieldValue("SpacingBetweenBulletsAndText"),bulletType:x.find(w=>w.code===n.getFieldValue("BulletType"))?.symbol??x[0].symbol},...O,activateSection:null,changeKey:A})};return(0,o.jsxs)(t.ui_kit$Form,{form:n,layout:"vertical",name:"selected_text_form",autoComplete:"off",onValuesChange:y,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:[!m&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),!(d==="mobile"&&!m&&c.styles)&&(0,o.jsx)("div",{id:"selected_element_form_desktop_props",style:{paddingRight:0},children:m?(0,o.jsx)(Ni,{form:n,elementSettings:e}):(0,o.jsx)(Bt,{form:n,fillFields:P,elementSettings:e,linkProtocol:_,setLinkProtocol:E,isBulletFontColorChecked:b,setIsBulletFontColorChecked:h})}),!m&&(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)(Vt,{form:n,elementSettings:e,name:"mobileTextAlign"})})}),!!e.showOnMobile&&(0,o.jsx)(Bt,{form:n,fillFields:P,elementSettings:e,linkProtocol:_,setLinkProtocol:E}),(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)(Xr,{})}),(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"})})})]})]})]})},Ai=(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")},qr={marginBottom:10},Jr={position:"relative",top:2};function Vn(e){return Array.isArray(e)?!!e[0]?.value:typeof e=="string"?e.trim()!=="":!!e}var at=({form:e,showRounding:i=!1,showBackground:l=!1})=>{const{__:s}=r.useI18n(),n=Vn(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:qr,children:(0,o.jsx)(t.ui_kit$Switch,{id:"outlook-rounding",label:s("Rounded corners in Outlook (VML)"),size:"small",labelStyle:Jr})})},"outlookRounding"),l&&n&&(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:qr,children:(0,o.jsx)(t.ui_kit$Switch,{id:"outlook-background",label:s("Background image in Outlook (VML)"),size:"small",labelStyle:Jr})})},"outlookBackground")]})};at.propTypes={form:f.default.object,showRounding:f.default.bool,showBackground:f.default.bool};var Qr=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:n,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:p,backgroundRepeatOptions:g,backgroundSizeOptions:m,sizeShow:_,modificationShow:E,oneBorderRadiusValue:b,setOneBorderRadiusValue:h,toggleShowBorderHandler:k,toggleShowBorderRadiusHandler:x,toggleShowBoxShadowHandler:T,toggleShowSizeHandler:j,toggleShowBackgroundHandler:P,toggleShowModificationHandler:S})=>{const{__:y}=r.useI18n(),V=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(Go,{form:e,elementSettings:i,tooltipTitle:y("The align attribute sets the horizontal alignment of the table.")})}),(0,o.jsx)(t.ui_kit$FormSection,{title:y("Size"),collapsible:!0,open:_,onToggle:j,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{showHeight:!1,showMinMax:!0,columnsPerRow:2,dimensionSelect:Mo,minWidthDimensionSelect:Mo,maxWidthDimensionSelect:Mo,rowStyle:{marginBottom:4},labels:{width:y("Width"),height:y("Height"),minWidth:y("Minimum width"),maxWidth:y("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:y("Background"),collapsible:!0,open:c,onToggle:P,dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{imageEnabled:V.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:p,usedColors:i.usedColors,colorPlaceholder:y("Background color"),horizontalPositionPlaceholder:y("Horizontal position"),horizontalPositionTooltip:y("Horizontal position"),verticalPositionPlaceholder:y("Vertical position"),verticalPositionTooltip:y("Vertical position"),backgroundRepeatTooltip:y("Background image repeat"),backgroundSizeTooltip:y("Background image size"),selectPlaceholder:y("Please choose"),backgroundRepeatOptions:g,backgroundSizeOptions:m,imageUploadSlot:V.formTableFieldBackgroundImageEnabled?(0,o.jsx)(Fo,{form:e,label:y("Background image"),name:"backgroundImage",tooltipTitle:y("Background image"),placeholder:y("Background image link/route")}):void 0}),(0,o.jsx)(at,{form:e,showBackground:!0})]}),V.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Borders"),collapsible:!0,open:s,onToggle:k,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),V.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Border radius"),collapsible:!0,open:n,onToggle:x,dividerTop:!0,children:(0,o.jsx)(Io,{form:e,oneBorderRadiusValue:b,setOneBorderRadiusValue:h,elementSettings:i})}),V.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Box shadow"),collapsible:!0,open:d,onToggle:T,dividerTop:!0,children:(0,o.jsx)(No,{})}),V.formFieldExportAsPictureEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Export settings"),collapsible:!0,open:E,onToggle:S,dividerTop:!0,children:(0,o.jsx)(Ai,{form:e,elementSettings:i})}),V.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e})}),V.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})};Qr.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,bordersShow:f.default.bool,borderRadiusShow:f.default.bool,boxShadowShow:f.default.bool,backgroundShow:f.default.bool,backgroundImageEmpty:f.default.bool,backgroundRepeatOptions:f.default.array,backgroundSizeOptions:f.default.array,sizeShow:f.default.bool,modificationShow:f.default.bool,oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func,toggleShowBorderHandler:f.default.func,toggleShowBorderRadiusHandler:f.default.func,toggleShowBoxShadowHandler:f.default.func,toggleShowSizeHandler:f.default.func,toggleShowBackgroundHandler:f.default.func,toggleShowModificationHandler:f.default.func};var Zr=({form:e,elementSettings:i,label:l})=>{const{__:s}=r.useI18n();(0,a.useRef)();const[n,d]=(0,a.useState)(i.mobileBackgroundColor?.value==="none"),{token:c}=(0,t.ui_kit$useToken)(),p=r.useSendPostMessage(),g=_=>{e.setFieldsValue({mobileBackgroundColor:""}),d(E=>!E),p({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:n?"":"none"}}})},m=_=>{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:m,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:n,onChange:g})]})})};Zr.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired};var Ht={horizontal:[{value:"left",label:"left"},{value:"center",label:"center"},{value:"right",label:"right"}],vertical:[{value:"top",label:"top"},{value:"center",label:"center"},{value:"bottom",label:"bottom"}]},Li={mobileBackgroundColor:"em-mob-background_color-",mobileBackgroundImage:"em-mob-background_image-",mobileBackgroundPositionX:"em-mob-background_position_x-",mobileBackgroundPositionY:"em-mob-background_position_y-",mobileBackgroundRepeat:"em-mob-background_repeat-",mobileBackgroundSize:"em-mob-background_size-"},pt="none",Hn=/^(https?:)?\/\//i,Un=/^(\d*\.?\d+)(%|px)$/;function Wn(e){return e in Li}function el(e){return Hn.test(e.trim())}function Oi(e,i){const l=Li[e],s=typeof i=="string"?i:"";return e==="mobileBackgroundImage"?s&&s!==pt&&!el(s)?null:{[e]:[{classNamePrefix:l,value:s,type:"url"}]}:e==="mobileBackgroundRepeat"?{[e]:{classNamePrefix:l,value:s||pt}}:{[e]:{classNamePrefix:l,value:s}}}function St(e){const[i]=Object.keys(e??{});return!i||!Wn(i)?null:Oi(i,e[i])}function ol(){return Object.keys(Li).reduce((e,i)=>({...e,...Oi(i,"")}),{})}function tl(e){const i=(e??"").trim(),l=i.match(Un);return l?{position:l[1],unit:l[2]}:{position:i,unit:"px"}}function il(e,i){return e?isNaN(parseFloat(e))?e:e+i:""}function Ko(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 Tt(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=Ko(e),l=i.mobileBackgroundImage?.[0]?.value??"";return{mobileBackgroundImage:l===pt?"":l,mobileBackgroundPositionX:i.mobileBackgroundPositionX?.value??"",mobileBackgroundPositionY:i.mobileBackgroundPositionY?.value??"",mobileBackgroundRepeat:i.mobileBackgroundRepeat?.value||pt,mobileBackgroundSize:i.mobileBackgroundSize?.value??""}}function Ut(e){const i=Ko(e),l=i.mobileBackgroundRepeat?.value;return!!i.mobileBackgroundColor?.value||!!i.mobileBackgroundImage?.[0]?.value||!!i.mobileBackgroundPositionX?.value||!!i.mobileBackgroundPositionY?.value||!!l&&l!==pt||!!i.mobileBackgroundSize?.value}function zn(e,i){return e===pt?!1:!!e||!!i}function Wt(e,i,l){e.setFieldsValue({...nt({}),mobileBackgroundColor:""}),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Ko(i).type,settings:ol()})}var Gn=/^\d*\.?\d+$/,Yn={bottom:"auto"},rl={marginBottom:0},Xn=(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal}),Kn=(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical}),qn=e=>e.closest(".email-pane__collapse-wrapper")??e.parentNode,ll=({value:e,onChange:i,inheritedValue:l,options:s,placeholder:n,prefix:d})=>{const c=e||l,[p,g]=(0,a.useState)(()=>tl(c));(0,a.useEffect)(()=>{g(b=>il(b.position,b.unit)===c?b:tl(c))},[c]);const m=(0,a.useCallback)((b,h)=>{g({position:b,unit:h});const k=s.some(x=>x.value===b);(b===""||k||Gn.test(b))&&i?.(il(b,h))},[i,s]),_=(0,a.useCallback)(b=>m(b,p.unit),[m,p.unit]),E=(0,a.useCallback)(b=>m(p.position,b),[m,p.position]);return(0,o.jsx)(t.ui_kit$InputSelect,{options:s,position:p.position,setPosition:_,unit:p.unit,setUnit:E,placeholder:n,prefix:d,dropdownStyle:Yn,tooltipTitle:n,getTooltipPopupContainer:qn})},Jn=({desktopPositionX:e,desktopPositionY:i})=>{const{__:l}=r.useI18n(),{token:s}=(0,t.ui_kit$useToken)(),n=s.formItemMarginBottomXS,d=(0,a.useMemo)(()=>({marginBottom:n}),[n]);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:rl,children:(0,o.jsx)(ll,{inheritedValue:e,options:Ht.horizontal,placeholder:l("Horizontal position"),prefix:Xn})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundPositionY",style:rl,children:(0,o.jsx)(ll,{inheritedValue:i,options:Ht.vertical,placeholder:l("Vertical position"),prefix:Kn})})})]})},sl=["hover"],al=e=>document.querySelector(".email-properties__collapse-panel")??e.parentNode,nl=({value:e,emptyValue:i,inheritedValue:l,...s})=>{const n=!!e&&e!==i,d=s.options.some(c=>c.value===l)?l:i;return(0,o.jsx)(t.ui_kit$Select,{...s,value:n?e:d})},Qn=({desktopPositionX:e,desktopPositionY:i,desktopRepeat:l,desktopSize:s,backgroundRepeatOptions:n,backgroundSizeOptions:d})=>{const{__:c}=r.useI18n(),{token:p}=(0,t.ui_kit$useToken)(),g=p.formItemMarginBottomXS,m=(0,a.useMemo)(()=>({marginBottom:g}),[g]),_=(0,a.useMemo)(()=>({marginBottom:(g??0)*1.5}),[g]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Jn,{desktopPositionX:e,desktopPositionY:i}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:_,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:sl,title:c("Background image repeat"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundRepeat",style:m,children:(0,o.jsx)(nl,{emptyValue:"none",inheritedValue:l,options:n,placeholder:c("Please choose"),getPopupContainer:al})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:sl,title:c("Background image size"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundSize",style:m,children:(0,o.jsx)(nl,{emptyValue:"",inheritedValue:s,options:d,placeholder:c("Please choose"),getPopupContainer:al})})})})]})]})},Zn=fi,ed=({value:e,inheritedImage:i,...l})=>(0,o.jsx)(Zn,{...l,value:e||i}),od=e=>/^https?:\/\//i.test(e.trim()),td=({form:e,name:i="mobileBackgroundImage",placeholder:l="",disabled:s=!1,elementSettings:n,inheritedImage:d="",isImageNone:c=!1,onImageNoneChange:p})=>{const{__:g}=r.useI18n(),{token:m}=(0,t.ui_kit$useToken)(),_=t.ui_kit$Form.useWatch(i,e),[E,b]=(0,a.useState)(""),h=_||d,k=m.formItemMarginBottomXS??0,x=(0,a.useMemo)(()=>({marginBottom:k/2}),[k]);(0,a.useEffect)(()=>{if(!h){b("");return}b(od(h)?"validating":"success")},[h]);const T=!!_&&!el(_),j=T?"error":E;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:i,className:"mobile-background-image-field",validateStatus:j,help:T?g("Enter a URL starting with http:// or https://"):void 0,style:x,children:(0,o.jsx)(ed,{inheritedImage:d,validateStatus:j,placeholder:l,name:i,disabled:s,elementSettings:n,imageInfo:n,onRemotePreviewValidate:b})}),(0,o.jsx)(t.ui_kit$Switch,{label:g("Without image"),labelSize:"small",size:"small",checked:c,onChange:p})]})},id={image:"",positionX:"",positionY:"",repeat:"",size:""},Rt=({elementSettings:e,imageEnabled:i=!1,desktopBackground:l=id})=>{const{__:s}=r.useI18n(),{token:n}=(0,t.ui_kit$useToken)(),d=t.ui_kit$Form.useFormInstance(),c=n.formItemMarginBottomMD,p=r.useSendPostMessage(),g=e.mobileBackgroundImage?.[0]?.value,[m,_]=(0,a.useState)(g==="none"),E=t.ui_kit$Form.useWatch("mobileBackgroundImage",d);(0,a.useEffect)(()=>{_(g==="none")},[g]),(0,a.useEffect)(()=>{E&&_(!1)},[E]);const b=(0,a.useCallback)(y=>{_(y),d.setFieldsValue({mobileBackgroundImage:""}),p({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Oi("mobileBackgroundImage",y?"none":"")})},[e.type,d,p]),h=(0,a.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,a.useMemo)(()=>[{label:s("Not defined"),value:""},{label:s("Contain"),value:"contain"},{label:s("Cover"),value:"cover"}],[s]),x=zn(m?"none":E,l.image),T=(0,a.useMemo)(()=>({marginBottom:x?c:0}),[c,x]),j=(0,a.useMemo)(()=>(0,o.jsx)("div",{style:T,children:(0,o.jsx)(Zr,{form:d,elementSettings:e,label:s("Background color")})}),[s,e,d,T]),P=(0,a.useMemo)(()=>(0,o.jsx)("div",{style:T,children:(0,o.jsx)(td,{form:d,placeholder:s("Background image"),elementSettings:e,inheritedImage:m?"":l.image,isImageNone:m,onImageNoneChange:b})}),[s,l.image,e,d,b,m,T]),S=(0,a.useMemo)(()=>(0,o.jsx)(Qn,{desktopPositionX:l.positionX,desktopPositionY:l.positionY,desktopRepeat:l.repeat,desktopSize:l.size,backgroundRepeatOptions:h,backgroundSizeOptions:k}),[h,k,l.positionX,l.positionY,l.repeat,l.size]);return(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{colorFieldName:"mobileBackgroundColor",colorSlot:j,imageEnabled:i,backgroundImageEmpty:!x,imageUploadSlot:P,imageControlsSlot:S,usedColors:e.usedColors})},dl=({form:e,elementSettings:i,mobileBoxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:n,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:p,oneMobileBorderRadiusValue:g,setOneMobileBorderRadiusValue:m,toggleShowMobileBorderHandler:_,toggleShowMobileBorderRadiusHandler:E,toggleShowMobileBoxShadowHandler:b,toggleShowMobileSizeHandler:h,toggleShowMobileBackgroundHandler:k})=>{const{__:x}=r.useI18n(),{token:T}=(0,t.ui_kit$useToken)(),j=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(Go,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,o.jsx)(t.ui_kit$FormSection,{title:x("Size"),collapsible:!0,open:c,onToggle:h,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)(Xo,{form:e,name:"mobileWidth",elementSettings:i})})})})})}),(0,o.jsx)(t.ui_kit$FormSection,{title:x("Background"),collapsible:!0,open:p,onToggle:k,dividerTop:!0,children:(0,o.jsx)(Rt,{elementSettings:Ko(i),imageEnabled:j.formTableFieldBackgroundImageEnabled,desktopBackground:Tt(i)})}),j.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Borders"),collapsible:!0,open:s,onToggle:_,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),j.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Border radius"),collapsible:!0,open:n,onToggle:E,dividerTop:!0,children:(0,o.jsx)(Io,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:g,setOneBorderRadiusValue:m,elementSettings:i})}),j.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Box shadow"),collapsible:!0,open:d,onToggle:b,dividerTop:!0,children:(0,o.jsx)(No,{typeOfForm:"mobile",form:e,elementSettings:i})}),j.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e})}),j.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})};dl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,mobileBoxShadow:f.default.object,mobileBordersShow:f.default.bool,mobileBorderRadiusShow:f.default.bool,mobileBoxShadowShow:f.default.bool,mobileSizeShow:f.default.bool,mobileBackgroundShow:f.default.bool,oneMobileBorderRadiusValue:f.default.bool,setOneMobileBorderRadiusValue:f.default.func,toggleShowMobileBorderHandler:f.default.func,toggleShowMobileBorderRadiusHandler:f.default.func,toggleShowMobileBoxShadowHandler:f.default.func,toggleShowMobileSizeHandler:f.default.func,toggleShowMobileBackgroundHandler:f.default.func};var cl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),n=Do(),d=Do(),c=r.useDispatch(),p=r.useElementEntityKind(),[g,m]=(0,a.useState)({}),[_,E]=(0,a.useState)(!0),[b,h]=(0,a.useState)({}),[k,x]=(0,a.useState)(!0),T=r.useSelector(r.selectEmailViewType),j=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[P,S]=(0,a.useState)(e.backgroundImage[0].value===""),y=r.useSelector(r.selectIsCodeMode),V=r.useSelector(r.selectCodeModeDirection),z=y&&V!=="bottom",[A,O]=(0,a.useState)(!1),[w,U]=(0,a.useState)(!1),[J,Q]=(0,a.useState)(!1),[I,le]=(0,a.useState)(!1),[xe,ve]=(0,a.useState)(!1),[Z,be]=(0,a.useState)(!1),[Ne,de]=(0,a.useState)(!1),[Fe,Ae]=(0,a.useState)(!1),[Ge,je]=(0,a.useState)(!1),[ye,_e]=(0,a.useState)(!1),[pe,fe]=(0,a.useState)(!1),me=[{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"}],K=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}],ee=D=>D&&(D?.width||D?.style||D?.color)?D:"",ie=e.border,ae=e.mobileBorder,ne=Object.keys(ie).find(D=>ie[D]?.width||ie[D]?.style||ie[D]?.color),Me=Object.keys(ae).find(D=>ae[D]?.width||ae[D]?.style||ae[D]?.color),{remember:te,fillFields:Te}=mt(e);(0,a.useEffect)(()=>{if(e){const D=e.boxShadow,ue=e.mobileBoxShadow;m(D),h(ue),Te(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:Bo(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileAlign:e.mobileAlign?.value,mobileBorderAll:ee(e.mobileBorder.all)||!(ee(e.mobileBorder.top)||ee(e.mobileBorder.bottom)||ee(e.mobileBorder.right)||ee(e.mobileBorder.left))&&ee(e.border.all),mobileBorderTop:ee(e.mobileBorder.top)||!ee(e.mobileBorder.all)&&ee(e.border.top),mobileBorderBottom:ee(e.mobileBorder.bottom)||!ee(e.mobileBorder.all)&&ee(e.border.bottom),mobileBorderRight:ee(e.mobileBorder.right)||!ee(e.mobileBorder.all)&&ee(e.border.right),mobileBorderLeft:ee(e.mobileBorder.left)||!ee(e.mobileBorder.all)&&ee(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))?E(!1):E(!0),u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight)?x(!1):x(!0),S(e.backgroundImage[0].value==="");const Ie=n.isStaleBorderSnapshot(e,!!ne),Ve=d.isStaleBorderSnapshot(e,!!Me);Ie&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Ve||Ie&&!Me)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),O(to=>ne&&!Ie?!0:to),U(to=>ne&&!Ie||Me&&!Ve?!0:to),Q(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),le(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),ve(!!e.boxShadow),be(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),de(!!e.width?.value||!!e.minWidth?.value||!!e.maxWidth?.value),Ae(!!e.mobileWidth.value),je(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),_e(Ut(e)),fe(!!e.exportAsPicture)}},[s,e,ne,Me,n,d,Te]);const ke=(0,a.useCallback)(D=>{te(D),c(p==="email"?r.setElementSettings$1(D):r.setElementSettings(D))},[c,p,te]),M=D=>{const ue=s.getFieldsValue(!0),Ie=Object.keys(D)[0];let Ve;switch(Ie){case"exportAsPicture":Ve={exportAsPicture:ue.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Ve={boxShadow:{hOffset:ue.boxShadowHOffset,vOffset:ue.boxShadowVOffset,blurRadius:ue.boxShadowBlurRadius,spreadRadius:ue.boxShadowSpreadRadius,color:ue.boxShadowColor,inset:ue.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":ue.borderPosition==="borderAll"?(Ve={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...ue.borderAll}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):ue.borderAll?.width||ue.borderAll?.style||ue.borderAll?.color?(Ve={border:{all:null,left:ue.borderAll,right:ue.borderAll,top:ue.borderAll,bottom:ue.borderAll,[W.REVERSE_BORDER_POSITIONS[Ie]]:{...ue[Ie],...D[Ie]}}},s.setFieldsValue({borderAll:null,borderLeft:ue.borderAll,borderRight:ue.borderAll,borderTop:ue.borderAll,borderBottom:ue.borderAll,[Ie]:{...ue[Ie],...D[Ie]}})):(Ve={border:{all:null,left:ue.borderLeft,right:ue.borderRight,top:ue.borderTop,bottom:ue.borderBottom,[W.REVERSE_BORDER_POSITIONS[Ie]]:{...ue[Ie],...D[Ie]}}},s.setFieldsValue({border:Ve.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(ue.mobileBorderPosition==="mobileBorderAll")Ve={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...ue.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[Ie]+"-"}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const to=W.MOBILE_REVERSE_BORDER_POSITIONS[Ie],io={...ue[Ie],...D[Ie]},uo=!io?.width&&!io?.style&&!io?.color;if(ue.mobileBorder?.all?.width||ue.mobileBorder?.all?.style||ue.mobileBorder?.all?.color){const $=ue.mobileBorderAll;Ve={mobileBorder:{all:null,left:$,right:$,top:$,bottom:$,[to]:uo?null:{...io,classNamePrefix:"em-mob-border_"+to+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:$,mobileBorderRight:$,mobileBorderTop:$,mobileBorderBottom:$,[Ie]:io})}else{const $=e.mobileBorder||{},se=v=>{const H=$[v];return H&&(H?.width||H?.style||H?.color)?H:null};Ve={mobileBorder:{all:null,left:to==="left"?uo?null:{...io,classNamePrefix:"em-mob-border_left-"}:se("left"),right:to==="right"?uo?null:{...io,classNamePrefix:"em-mob-border_right-"}:se("right"),top:to==="top"?uo?null:{...io,classNamePrefix:"em-mob-border_top-"}:se("top"),bottom:to==="bottom"?uo?null:{...io,classNamePrefix:"em-mob-border_bottom-"}:se("bottom")}},s.setFieldsValue({[Ie]:io})}}break;case"width":Ve={[Ie]:{value:D[Ie],dim:ue.widthDim}};break;case"widthDim":Ve={width:{value:ue.width,dim:D[Ie]}};break;case"maxWidth":Ve={[Ie]:{value:D[Ie],dim:ue.maxWidthDim}};break;case"maxWidthDim":Ve={maxWidth:{value:ue.maxWidth,dim:D[Ie]}};break;case"minWidth":Ve={[Ie]:{value:D[Ie],dim:ue.minWidthDim}};break;case"minWidthDim":Ve={minWidth:{value:ue.minWidth,dim:D[Ie]}};break;case"backgroundImage":S(D[Ie]===""),Ve={[Ie]:[{...e.backgroundImage[0],value:D[Ie]}],backgroundSize:"cover"};break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Ve={borderRadius:{[W.BORDER_RADIUS_POSITION[Ie]]:+D[Ie]}};break;case"mobileWidth":Ve={[Ie]:{classNamePrefix:"em-mob-width-",value:D[Ie],dim:ue.mobileWidthDim}};break;case"mobileWidthDim":Ve={mobileWidth:{classNamePrefix:"em-mob-width-",value:ue.mobileWidth||100,dim:D[Ie]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Ve={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[Ie]]:D[Ie],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[Ie]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Ve={mobileBoxShadow:{hOffset:ue.mobileBoxShadowHOffset,vOffset:ue.mobileBoxShadowVOffset,blurRadius:ue.mobileBoxShadowBlurRadius,spreadRadius:ue.mobileBoxShadowSpreadRadius,color:ue.mobileBoxShadowColor,inset:ue.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Ve=St(D),!Ve)return;break;case"mobileAlign":Ve={[Ie]:{classNamePrefix:"em-mob-table_align-",value:D[Ie]}};break;default:Ve=D}Ie!=="borderPosition"&&Ie!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ve}),Ie!=="mobileBorderRadiusAll"&&Ie!=="mobileBorderRadiusTopLeft"&&Ie!=="mobileBorderRadiusTopRight"&&Ie!=="mobileBorderRadiusBottomLeft"&&Ie!=="mobileBorderRadiusBottomRight"&&ke({...e,...Ve,mobileBorderRadius:{...e.mobileBorderRadius,...Ve?.mobileBorderRadius},activateSection:null,changeKey:Ie}))},C=()=>{const D=s.getFieldsValue(!0);n.markBorderToggled(!A),setTimeout(()=>{O(ue=>!ue),A?(D.borderAll=W.NULL_BORDER,D.borderTop=W.NULL_BORDER,D.borderBottom=W.NULL_BORDER,D.borderRight=W.NULL_BORDER,D.borderLeft=W.NULL_BORDER):D.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:D.borderAll.color,style:D.borderAll.style,width:D.borderAll.width}}}})})},G=()=>{const D=s.getFieldsValue(!0);d.markBorderToggled(!w),setTimeout(()=>{U(ue=>!ue),w?(D.mobileBorderAll=W.NULL_BORDER,D.mobileBorderTop=W.NULL_BORDER,D.mobileBorderBottom=W.NULL_BORDER,D.mobileBorderRight=W.NULL_BORDER,D.mobileBorderLeft=W.NULL_BORDER):D.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:D.mobileBorderAll.color,style:D.mobileBorderAll.style,width:D.mobileBorderAll.width}}}})})},L=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{Q(ue=>!ue),J?(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}}})})},re=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{le(ue=>!ue),I?(D.mobileBorderRadiusAll=null,x(!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-"}}})})},ce=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{ve(ue=>!ue),xe?(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}}})})},he=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{be(ue=>!ue),Z?(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-"}}})})},Ee=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{de(ue=>!ue),Ne&&(D.width="",D.minWidth="",D.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"}}}))})},$e=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{Ae(ue=>!ue),Fe&&(D.mobileWidth="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"}}}))})},Ce=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{je(ue=>!ue),Ge?(D.backgroundColor="",D.backgroundImage="",D.backgroundPositionX="",D.backgroundPositionY="",D.backgroundRepeat="none",D.backgroundSize="",S(!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}})})},Y=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{_e(ue=>!ue),ye?D.mobileBackgroundColor="":D.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:D.mobileBackgroundColor}}}),ye&&Wt(s,e,l)})},oe=()=>{const D=s.getFieldsValue(!0);setTimeout(()=>{fe(ue=>!ue),pe&&(D.exportAsPicture=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_table_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,show:"all",width:{value:"",dim:""},maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",mobileAlign:"",border:"",boxShadow:"",borderPosition:W.BORDER_POSITIONS[ne]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[Me]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileBackgroundColor:"",mobileBackgroundImage:""},onValuesChange:M,autoComplete:"off",className:"element-controls",children:[!z&&(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"&&j.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(dl,{form:s,elementSettings:e,mobileBoxShadow:b,mobileBordersShow:w,mobileBorderRadiusShow:I,mobileBoxShadowShow:Z,mobileSizeShow:Fe,mobileBackgroundShow:ye,oneMobileBorderRadiusValue:k,setOneMobileBorderRadiusValue:x,toggleShowMobileBorderHandler:G,toggleShowMobileBorderRadiusHandler:re,toggleShowMobileBoxShadowHandler:he,toggleShowMobileSizeHandler:$e,toggleShowMobileBackgroundHandler:Y})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Qr,{form:s,elementSettings:e,boxShadow:g,bordersShow:A,borderRadiusShow:J,boxShadowShow:xe,backgroundShow:Ge,backgroundImageEmpty:P,backgroundRepeatOptions:me,backgroundSizeOptions:K,sizeShow:Ne,modificationShow:pe,oneBorderRadiusValue:_,setOneBorderRadiusValue:E,toggleShowBorderHandler:C,toggleShowBorderRadiusHandler:L,toggleShowBoxShadowHandler:ce,toggleShowSizeHandler:Ee,toggleShowBackgroundHandler:Ce,toggleShowModificationHandler:oe})})]})};cl.propTypes={elementSettings:f.default.object.isRequired};var ul=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),n=r.useAppConfig(),d=r.useSelector(r.selectIsCodeMode),c=r.useSelector(r.selectCodeModeDirection),[p,g]=(0,a.useState)({}),[m,_]=(0,a.useState)("https://"),E=({target:k})=>{const{selectionStart:x,selectionEnd:T}=k;k&&g({target:k,selection:{start:x,end:T}})};(0,a.useEffect)(()=>{if(e){let k="",x="",T=e.href==null?"https://":e.href;if(T&&T.substring(0,7)==="mailto:"){const j=new URL(e.href);k=j.searchParams.get("subject")||"",x=j.searchParams.get("body")||"",T=e.href.split("?")[0],_("mailto:")}else e.href&&(e.href.substring(0,8)==="https://"||e.href.substring(0,7)==="http://"?_("https://"):e.href.substring(0,4)==="tel:"?_("tel:"):e.href.substring(0,4)==="sms:"?_("sms:"):e.href.substring(0,6)==="ftp://"?_("ftp://"):_(""));s.setFieldsValue({...e,href:T,subject:k,body:x})}},[s,e]);const b=k=>{const x=Object.keys(k)[0];let T=k;if(x==="href"){const j=rt(k[x]);if(j!==k[x]&&s.setFieldValue("href",j),j.substring(0,7)==="mailto:"){const P=s.getFieldValue("subject"),S=s.getFieldValue("body"),y=[];P&&y.push(`subject=${encodeURIComponent(P)}`),S&&y.push(`body=${encodeURIComponent(S)}`),T={href:y.length>0?`${j}?${y.join("&")}`:j}}else T={href:j}}if(x==="subject"||x==="body"){const j=s.getFieldValue("href")||"";if(j.substring(0,7)==="mailto:"){const P=j.split("?")[0],S=x==="subject"?k[x]:s.getFieldValue("subject"),y=x==="body"?k[x]:s.getFieldValue("body"),V=[];S&&V.push(`subject=${encodeURIComponent(S)}`),y&&V.push(`body=${encodeURIComponent(y)}`),T={href:V.length>0?`${P}?${V.join("&")}`:P}}else return}l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:T})},h=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:b,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:E})})}),n.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:()=>h("add_img"),children:i("Add inline image")})})}),(0,o.jsx)(Bt,{form:s,elementSettings:e,showAddParagraph:!1,linkTarget:p,linkProtocol:m,setLinkProtocol:_})]}):(0,o.jsx)(Ni,{form:s,elementSettings:e,showAddParagraph:!1})})};ul.propTypes={elementSettings:f.default.object.isRequired};var ml=()=>{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"})})})})};ml.propTypes={};var pl=({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)(lt,{form:e,name:"mobileHeight",elementSettings:i})})});pl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired};var hl=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm(),s=r.useDispatch(),n=r.useSendPostMessage(),d=r.useSelector(r.selectEmailViewType),c=r.useSelector(r.selectMobileViewActive),p=r.useSelector(r.selectIsCodeMode),g=r.useSelector(r.selectCodeModeDirection),m=p&&g!=="bottom",_=r.useElementEntityKind(),{remember:E,fillFields:b}=mt(e);(0,a.useEffect)(()=>{e&&b(l,{...e,height:e.height?.value,heightDim:e.height?.dim,mobileHeight:Bo(e.mobileHeight?.value||e.height?.value),mobileHeightDim:e.mobileHeight?.dim||e.height?.dim})},[l,e,b]);const h=(0,a.useCallback)(x=>{E(x),s(_==="email"?r.setElementSettings$1(x):r.setElementSettings(x))},[s,_,E]),k=x=>{const T=l.getFieldsValue(!0),j=Object.keys(x)[0];let P;switch(j){case"height":P={[j]:{value:x[j],dim:T.heightDim}};break;case"heightDim":P={height:{value:T.height,dim:x[j]}};break;case"mobileHeight":P={[j]:{classNamePrefix:"em-mob-height-",value:x[j],dim:T.mobileHeightDim}};break;case"mobileHeightDim":P={mobileHeight:{classNamePrefix:"em-mob-height-",value:T.mobileHeight,dim:x[j]}};break;default:P=x}n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:P}),h({...e,...P,activateSection:null,changeKey:j})};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:[!m&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),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)(pl,{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)(ml,{})})]})};hl.propTypes={elementSettings:f.default.object.isRequired};var zt=({form:e,elementSettings:i,typeOfForm:l="desktop"})=>{const s=r.useSendPostMessage(),n=l==="mobile",d=n?"mobileDirection":"direction",c=g=>{e.setFieldsValue({[d]:g}),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[d]:g}})},p=n?i.mobileDirection?.value??"":i.direction??"";return(0,o.jsx)(t.ui_kit$Form.Item,{name:d,className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$FormDirectionControl,{value:p,onChange:c})})},Gt=e=>e.closest(".email-pane__collapse-wrapper")||e.parentNode,$i=({form:e,backgroundImageEmpty:i,appConfig:l,token:s,elementSettings:n,backgroundRepeatOptions:d,handleChangeValues:c})=>{const{__:p}=r.useI18n(),[g,m]=(0,a.useState)(""),[_,E]=(0,a.useState)("px"),[b,h]=(0,a.useState)(""),[k,x]=(0,a.useState)("px"),T=[{label:p("Not defined"),value:""},{label:p("Contain"),value:"contain"},{label:p("Cover"),value:"cover"}],j=y=>{if(!y||typeof y!="string")return{value:"",unit:"px"};y=y.trim();const V=y.match(/^(\d*\.?\d+)(%|px)$/);return V?{value:V[1],unit:V[2]}:{value:y,unit:"px"}};(0,a.useEffect)(()=>{const y=e.getFieldValue("backgroundPositionX"),V=e.getFieldValue("backgroundPositionY"),z=j(y),A=j(V);m(String(z.value)),E(z.unit),h(String(A.value)),x(A.unit)},[e]);const P=(y,V)=>{m(String(y)),E(V),c&&c({backgroundPositionX:{position:y,unit:V}})},S=(y,V)=>{h(String(y)),x(V),c&&c({backgroundPositionY:{position:y,unit:V}})};return(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:8},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:p("Background color"),placement:"bottom",getPopupContainer:Gt,children:(0,o.jsx)("div",{children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"backgroundColor",style:{marginBottom:s.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:p("Background color"),usedColors:n.usedColors,placement:"bottomLeft"})})})})}),l.formCellFieldBackgroundImageEnabled&&(0,o.jsxs)(t.ui_kit$Col,{span:i?12:24,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:p("Background image"),placement:"bottom",getPopupContainer:Gt,children:(0,o.jsx)("div",{children:(0,o.jsx)(Fo,{form:e,label:p("Background image"),name:"backgroundImage",tooltipTitle:p("Background image"),placeholder:p("Background image link/route")})})}),!i&&(0,o.jsxs)(t.ui_kit$Form.Item,{style:{marginBottom:"0"},children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:s.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$InputSelect,{options:Ht.horizontal,position:g,setPosition:y=>P(y,_),unit:_,setUnit:y=>P(g,y),placeholder:p("Horizontal position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal}),dropdownStyle:{bottom:"auto"},tooltipTitle:p("Horizontal position"),getTooltipPopupContainer:Gt})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$InputSelect,{options:Ht.vertical,position:b,setPosition:y=>S(y,k),unit:k,setUnit:y=>S(b,y),placeholder:p("Vertical position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical}),dropdownStyle:{bottom:"auto"},tooltipTitle:p("Vertical position"),getTooltipPopupContainer:Gt})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:p("Background image repeat"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"backgroundRepeat",style:{marginBottom:s.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{placeholder:p("Please choose"),options:d,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:p("Background image size"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"backgroundSize",style:{marginBottom:s.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{placeholder:p("Please choose"),options:T,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})})]})]})]})]})},rd=({form:e,elementSettings:i,__:l,appConfig:s})=>{const n=W.useGoogleFontsLoader(),[d,c]=(0,a.useState)(null);return(0,a.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&c(!0)},[]),(0,o.jsxs)("div",{style:{marginBottom:"-15px"},children:[s.formTextFieldTypografEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Text font"),placement:"bottom",zIndex:1,getPopupContainer:p=>p.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:n,getPopupContainer:p=>p.closest(".email-pane__collapse-wrapper")})})}),!i.showOnMobile&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:l("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:l("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{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)(no,{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)(no,{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)(no,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:l(d?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Text color"),placement:"bottom",zIndex:2,getPopupContainer:p=>p.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:l("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l("Color"),usedColors:i.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Text background"),placement:"bottom",zIndex:2,getPopupContainer:p=>p.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:l("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l("Background color"),usedColors:i.usedColors})})})})]})]})},bl=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:n,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:p,backgroundRepeatOptions:g,sizeShow:m,maxWidthValue:_,modificationShow:E,paddingsExt:b,oneBorderRadiusValue:h,setOneBorderRadiusValue:k,elementListShow:x,togglePaddingHandler:T,toggleShowBorderHandler:j,toggleShowBorderRadiusHandler:P,toggleShowBoxShadowHandler:S,toggleShowSizeHandler:y,toggleShowBackgroundHandler:V,toggleShowModificationHandler:z,handleChangeValues:A})=>{const{__:O}=r.useI18n(),{token:w}=(0,t.ui_kit$useToken)(),U=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)(st,{form:e,elementSettings:i})}),U.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)(Vo,{form:e,elementSettings:i})})]}),U.formCellFieldPaddingsEnabled&&(0,o.jsxs)(o.Fragment,{children:[x&&(0,o.jsx)("div",{style:{marginTop:"15px"},children:(0,o.jsx)(rd,{form:e,elementSettings:i,appConfig:U,__:O})}),(0,o.jsx)(t.ui_kit$FormSection,{title:O("Padding"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:b,onToggleExtended:T,showHorizontal:i.type!=="group"&&i.type!=="column",rowStyle:{paddingBottom:4},labels:{horizontal:O("Horizontal padding"),vertical:O("Vertical padding"),left:O("Left padding"),right:O("Right padding"),top:O("Top padding"),bottom:O("Bottom padding"),individual:O("Individual padding")}})})]}),i.type!=="group"&&U.formCellFieldSizeEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("Size"),collapsible:!0,open:m,onToggle:y,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{showWidth:i.type!=="structure"&&i.type!=="column",maxWidth:_,dimensionSelect:Mo,rowStyle:{paddingBottom:4},labels:{width:O("Width"),height:O("Height"),minWidth:O("Minimum width"),maxWidth:O("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:O("Background"),collapsible:!0,open:c,onToggle:V,dividerTop:!0,children:[(0,o.jsx)($i,{form:e,backgroundImageEmpty:p,appConfig:U,token:w,elementSettings:i,backgroundRepeatOptions:g,handleChangeValues:A}),(0,o.jsx)(at,{form:e,showBackground:!0})]}),U.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("Borders"),collapsible:!0,open:s,onToggle:j,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),U.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("Border radius"),collapsible:!0,open:n,onToggle:P,dividerTop:!0,children:(0,o.jsx)(Io,{form:e,oneBorderRadiusValue:h,setOneBorderRadiusValue:k,elementSettings:i})}),U.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("Box shadow"),collapsible:!0,open:d,onToggle:S,dividerTop:!0,children:(0,o.jsx)(No,{})}),U.formFieldExportAsPictureEnabled&&i.type!=="group"&&(0,o.jsxs)(t.ui_kit$FormSection,{title:O("Settings"),collapsible:!0,open:E,onToggle:z,dividerTop:!0,children:[i.type==="structure"&&(0,o.jsx)(t.ui_kit$Tooltip,{title:O("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:O("Contrast block"),size:"small",labelStyle:{position:"relative",top:2}})})},"isContrastBlock"),(0,o.jsx)(Ai,{form:e,elementSettings:i})]}),U.formFieldVisibilityEnabled&&i.type!=="column"&&(0,o.jsx)(t.ui_kit$FormSection,{title:O(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,o.jsx)(zt,{elementSettings:i,form:e}):void 0})}),U.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:O("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})};bl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,bordersShow:f.default.bool,borderRadiusShow:f.default.bool,boxShadowShow:f.default.bool,backgroundShow:f.default.bool,backgroundImageEmpty:f.default.bool,backgroundRepeatOptions:f.default.array,sizeShow:f.default.bool,maxWidthValue:f.default.oneOfType([f.default.string,f.default.number]),modificationShow:f.default.bool,paddingsExt:f.default.bool,oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func,elementListShow:f.default.bool,togglePaddingHandler:f.default.func,toggleShowBorderHandler:f.default.func,toggleShowBorderRadiusHandler:f.default.func,toggleShowBoxShadowHandler:f.default.func,toggleShowSizeHandler:f.default.func,toggleShowBackgroundHandler:f.default.func,toggleShowModificationHandler:f.default.func,handleChangeValues:f.default.func};var Yt=({form:e,elementSettings:i,mobilePaddingsExt:l,setMobilePaddingsExt:s,rowStyle:n,showVertical:d=!0})=>{const{__:c}=r.useI18n(),p=r.useSendPostMessage(),g=()=>{s(_=>!_);const m=e.getFieldsValue(!0);l||(m.mobilePaddingLeftRight=m.mobilePaddingLeft,m.mobilePaddingTopBottom=m.mobilePaddingTop,m.mobilePaddingRight=m.mobilePaddingLeft,m.mobilePaddingBottom=m.mobilePaddingTop,p({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobilePadding:{top:m.mobilePaddingTop!==""?m.mobilePaddingTop:null,bottom:m.mobilePaddingTopBottom!==""?m.mobilePaddingTopBottom:null,left:m.mobilePaddingLeft!==""?m.mobilePaddingLeft:null,right:m.mobilePaddingRight!==""?m.mobilePaddingRight:null,classNamePrefix:"em-mob-padding_"}}}))};return(0,o.jsx)(t.ui_kit$FormPaddingInputs,{typeOfForm:"mobile",extended:l,onToggleExtended:g,showHorizontal:!0,showVertical:d,gutter:10,rowStyle:n,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")}})};Yt.propTypes={form:f.default.shape({getFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,mobilePaddingsExt:f.default.bool.isRequired,setMobilePaddingsExt:f.default.func.isRequired,rowStyle:f.default.object,showVertical:f.default.bool};var Xp=5,gl=.5,ld=.1;function sd(e){return(100-e*5)/(e-1)}function ad(e,i,l){const s=e.reduce((g,m)=>g+Math.max(m,0),0)>0?e.map(g=>Math.max(g,0)):e.map(()=>1),n=s.map(()=>!1);let d=[];for(let g=!0;g;){g=!1;const m=s.reduce((E,b,h)=>n[h]?E:E+b,0),_=i-l*n.filter(Boolean).length;d=s.map((E,b)=>n[b]?l:m>0?_*E/m:0),d.forEach((E,b)=>{!n[b]&&E<l&&(n[b]=!0,g=!0)})}const c=d.map(g=>Math.floor(g+1e-9));let p=i-c.reduce((g,m)=>g+m,0);return d.map((g,m)=>({i:m,fraction:g-c[m]})).sort((g,m)=>m.fraction-g.fraction||g.i-m.i).forEach(({i:g})=>{p>0&&(c[g]+=1,p-=1)}),c}function ht(e,i){const l=e.length;if(l<2)return{columns:l===1?[100]:[],gap:0};const s=Math.round(Math.min(Math.max(i,0),sd(l))*100);return{columns:ad(e,1e4-s*(l-1),500).map(n=>n/100),gap:s/100}}function nd(e){if(e<2)return 0;const i=(100-e*(Math.round(100/e)-2))/(e-1);return Math.round(i/gl)*gl}function dd(e,i){if(e.columns.length!==i.length)return!1;const l=ht(i,e.gap).columns;return e.columns.every((s,n)=>Math.abs(s-l[n])<=ld)}function fl(e){return ht(e,nd(e.length))}function yt(e,i){return{items:e.columns,gap:e.gap,linked:dd(e,i)}}function cd(e,i,l){return i.length<2?null:e?l==="follow"&&e.items.length===i.length&&!e.linked?{columns:e.items,gap:e.gap}:ht(i,e.gap):fl(i)}function ud(e,i){return ht(i,e.gap)}function md(e,i,l){return ht(e.linked?i:e.items,l)}function pd(e,i){return ht(i,e.gap)}function hd(e){if(!e||typeof e!="object")return!1;const i=e;return i.type==="column"&&!!i.floatBlocks?.mobile}function bd(e,i){const l=e&&typeof e=="object"?e[i]:void 0;return typeof l=="string"&&l!==""?l:null}function gd(e,i){const l=e&&typeof e=="object"?e[i]:void 0;if(l==null||l==="")return null;const s=Number(l);return Number.isFinite(s)?s:null}function bt(e){return e.items.map(i=>Number(i.width)||0)}function fd(e,i){return e.length===i.length&&e.every((l,s)=>l===i[s])}function _d(e,i){const l=e.mobile??null,s=bt(i);if(!l||i.mobile!==e.mobile||fd(bt(e),s))return i;const n=cd(l,s,"follow");return{...i,mobile:n?yt(n,s):null}}function xd(e,i){const l=bt(e);return i||l.length<2?null:yt(fl(l),l)}function kd(e,i){const l=e.mobile,s=bt(e);return l?yt(ud(l,i),s):null}function Ed(e,i){const l=e.mobile,s=bt(e);return l?yt(md(l,s,i),s):null}function Bd(e){const i=e.mobile,l=bt(e);return i?yt(pd(i,l),l):null}function Sd(e,i,l){if(!e)return null;const s=[...e.items];return[s[i],s[l]]=[s[l],s[i]],{...e,items:s}}function _l(e,i){const l=(String(i).split(".")[1]??"").length;return Number((Math.round(e/i)*i).toFixed(l))}function Td(e,i,l,s,n){const d=l.findIndex((E,b)=>Math.abs(E-i[b])>.5),c=d+1;if(d<0||c>=l.length||l[d]+l[c]<=0)return[...e];const p=e[d]+e[c],g=l[d]/(l[d]+l[c]),m=Math.min(Math.max(_l(p*g,n),s),p-s),_=[...e];return _[d]=m,_[c]=_l(p-m,n),_}var Rd={marginBottom:15},xl=({form:e,elementSettings:i,boxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:n,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:p,mobilePaddingShow:g,mobilePaddingsExt:m,setMobilePaddingsExt:_,oneMobileBorderRadiusValue:E,setOneMobileBorderRadiusValue:b,toggleShowMobileBorderHandler:h,toggleShowMobileBorderRadiusHandler:k,toggleShowMobileBoxShadowHandler:x,toggleShowMobileSizeHandler:T,toggleShowMobileBackgroundHandler:j,toggleShowMobilePaddingHandler:P})=>{const{__:S}=r.useI18n(),y=r.useAppConfig(),V=hd(i);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)(Go,{form:e,elementSettings:i,imgParent:!0,typeOfForm:"mobile"})}),y.formCellFieldVerticalAlignEnabled&&i.type!=="group"&&(i.type!=="structure"||i.type==="structure"&&i.floatBlocks.items.length===1)&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Vo,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),y.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:S("Padding"),collapsible:!0,open:g,onToggle:P,dividerTop:!0,children:(0,o.jsx)(Yt,{form:e,elementSettings:i,mobilePaddingsExt:m,setMobilePaddingsExt:_,rowStyle:{paddingBottom:4}})}),i.type!=="group"&&y.formCellFieldSizeEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:S("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:V?(0,o.jsx)("div",{className:"selected-td-form__mobile-width-hint",children:S("The mobile width of the columns is set on the Columns tab")}):(0,o.jsx)("div",{style:Rd,children:(0,o.jsx)(Xo,{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)(lt,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:S("Background"),collapsible:!0,open:p,onToggle:j,dividerTop:!0,children:(0,o.jsx)(Rt,{elementSettings:Ko(i),imageEnabled:y.formCellFieldBackgroundImageEnabled,desktopBackground:Tt(i)})}),y.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:S("Borders"),collapsible:!0,open:s,onToggle:h,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),y.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:S("Border radius"),collapsible:!0,open:n,onToggle:k,dividerTop:!0,children:(0,o.jsx)(Io,{form:e,oneBorderRadiusValue:E,setOneBorderRadiusValue:b,elementSettings:i,typeOfForm:"mobile"})}),y.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:S("Box shadow"),collapsible:!0,open:d,onToggle:x,dividerTop:!0,children:(0,o.jsx)(No,{typeOfForm:"mobile"})}),y.formFieldVisibilityEnabled&&i.type!=="column"&&(0,o.jsx)(t.ui_kit$FormSection,{title:S(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,o.jsx)(zt,{elementSettings:i,form:e,typeOfForm:"mobile"}):void 0})}),y.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:S("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})};xl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,mobileBordersShow:f.default.bool,mobileBorderRadiusShow:f.default.bool,mobileBoxShadowShow:f.default.bool,mobileSizeShow:f.default.bool,mobileBackgroundShow:f.default.bool,mobilePaddingShow:f.default.bool,mobilePaddingsExt:f.default.bool,setMobilePaddingsExt:f.default.func,oneMobileBorderRadiusValue:f.default.bool,setOneMobileBorderRadiusValue:f.default.func,toggleShowMobileBorderHandler:f.default.func,toggleShowMobileBorderRadiusHandler:f.default.func,toggleShowMobileBoxShadowHandler:f.default.func,toggleShowMobileSizeHandler:f.default.func,toggleShowMobileBackgroundHandler:f.default.func,toggleShowMobilePaddingHandler:f.default.func};function kl(e){return!!e&&typeof e=="object"&&e.type==="column"}function yd(e){const i={value:null,dim:"px"};return kl(e)?{height:i}:{width:{value:null,dim:"px"},height:i}}function jd(e){const i={value:null,dim:"px",classNamePrefix:"em-mob-height-"};return kl(e)?{mobileHeight:i}:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"},mobileHeight:i}}function El(e,i){!e||typeof e!="object"||Object.keys(i).forEach(l=>{e[l]=""})}var Bl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),s=r.useDispatch(),[n]=t.ui_kit$Form.useForm(),d=Do(),c=Do(),[p,g]=(0,a.useState)(void 0),[m,_]=(0,a.useState)({}),[E,b]=(0,a.useState)(!0),[h,k]=(0,a.useState)(!0),x=r.useSelector(r.selectEmailViewType),T=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[j,P]=(0,a.useState)(e.backgroundImage[0].value===""),S=r.useSelector(r.selectIsCodeMode),y=r.useSelector(r.selectCodeModeDirection),V=S&&y!=="bottom",[z,A]=(0,a.useState)(!1),[O,w]=(0,a.useState)(!1),[U,J]=(0,a.useState)(!1),[Q,I]=(0,a.useState)(!1),[le,xe]=(0,a.useState)(!1),[ve,Z]=(0,a.useState)(!1),[be,Ne]=(0,a.useState)(!1),[de,Fe]=(0,a.useState)(!1),[Ae,Ge]=(0,a.useState)(!1),[je,ye]=(0,a.useState)(!1),[_e,pe]=(0,a.useState)(!1),[fe,me]=(0,a.useState)(!1),[K,ee]=(0,a.useState)(!1),[ie,ae]=(0,a.useState)(!1),[ne,Me]=(0,a.useState)(!1),te=r.useElementEntityKind(),Te=[{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"}],ke=e.border,M=e.mobileBorder,C=Object.keys(ke).find(v=>ke[v]?.width||ke[v]?.style||ke[v]?.color),G=Object.keys(M).find(v=>M[v]?.width||M[v]?.style||M[v]?.color),L=v=>v&&(v?.width||v?.style||v?.color)?v:"",{remember:re,fillFields:ce}=mt(e);(0,a.useEffect)(()=>{if(e){const v=e.boxShadow;_(v),ce(n,{...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:L(e.mobileBorder.all)||!(L(e.mobileBorder.top)||L(e.mobileBorder.bottom)||L(e.mobileBorder.right)||L(e.mobileBorder.left))&&L(e.border.all),mobileBorderTop:L(e.mobileBorder.top)||!L(e.mobileBorder.all)&&L(e.border.top),mobileBorderBottom:L(e.mobileBorder.bottom)||!L(e.mobileBorder.all)&&L(e.border.bottom),mobileBorderRight:L(e.mobileBorder.right)||!L(e.mobileBorder.all)&&L(e.border.right),mobileBorderLeft:L(e.mobileBorder.left)||!L(e.mobileBorder.all)&&L(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:Bo(e.mobileWidth?.value)||Bo(e.width?.value),mobileWidthDim:Bo(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:Bo(e.mobileHeight?.value)||Bo(e.height?.value),mobileHeightDim:Bo(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))?b(!1):b(!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),P(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)?A(!1):A(!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)?w(!1):w(!0);const H=d.isStaleBorderSnapshot(e,!!C),Pe=c.isStaleBorderSnapshot(e,!!G);H&&n.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Pe||H&&!G)&&n.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),J(He=>C&&!H?!0:He),I(He=>C&&!H||G&&!Pe?!0:He),xe(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),Z(!!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),Ne(!!e.boxShadow),Fe(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),Ge(!!e.width.value&&e.type!=="column"||!!e.height.value),ye(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value&&e.type!=="column"||!!e.height.value),pe(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),me(!!e.mobileBackgroundColor.value||!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Ut(e)&&me(!0),ee(!!e.exportAsPicture||!!e.isContrastBlock),ae(!!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"?Me(!0):Me(!1)}},[n,e,C,G,d,c,ce]);const he=(0,a.useCallback)(v=>{re(v),s(te==="email"?r.setElementSettings$1(v):r.setElementSettings(v))},[s,te,re]),Ee=v=>{const H=n.getFieldsValue(!0),Pe=Object.keys(v)[0];let He;const{widthDim:ko}=n.getFieldsValue(!0);switch(g(ko==="%"?100:void 0),Pe){case"exportAsPicture":He={exportAsPicture:H.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":He={boxShadow:{hOffset:H.boxShadowHOffset,vOffset:H.boxShadowVOffset,blurRadius:H.boxShadowBlurRadius,spreadRadius:H.boxShadowSpreadRadius,color:H.boxShadowColor,inset:H.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":H.borderPosition==="borderAll"?(He={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...H.borderAll}}},n.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):H.borderAll?.width||H.borderAll?.style||H.borderAll?.color?(He={border:{all:null,left:H.borderAll,right:H.borderAll,top:H.borderAll,bottom:H.borderAll,[W.REVERSE_BORDER_POSITIONS[Pe]]:{...H[Pe],...v[Pe]}}},n.setFieldsValue({borderAll:null,borderLeft:H.borderAll,borderRight:H.borderAll,borderTop:H.borderAll,borderBottom:H.borderAll,[Pe]:{...H[Pe],...v[Pe]}})):(He={border:{all:null,left:H.borderLeft,right:H.borderRight,top:H.borderTop,bottom:H.borderBottom,[W.REVERSE_BORDER_POSITIONS[Pe]]:{...H[Pe],...v[Pe]}}},n.setFieldsValue({border:He.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(H.mobileBorderPosition==="mobileBorderAll")He={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...H.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[Pe]+"-"}}},n.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const mo=W.MOBILE_REVERSE_BORDER_POSITIONS[Pe],ao={...H[Pe],...v[Pe]},ge=!ao?.width&&!ao?.style&&!ao?.color;if(H.mobileBorder?.all?.width||H.mobileBorder?.all?.style||H.mobileBorder?.all?.color){const Ye=H.mobileBorderAll;He={mobileBorder:{all:null,left:Ye,right:Ye,top:Ye,bottom:Ye,[mo]:ge?null:{...ao,classNamePrefix:"em-mob-border_"+mo+"-"}}},n.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:Ye,mobileBorderRight:Ye,mobileBorderTop:Ye,mobileBorderBottom:Ye,[Pe]:ao})}else{const Ye=e.mobileBorder||{},qe=lo=>{const fo=Ye[lo];return fo&&(fo?.width||fo?.style||fo?.color)?fo:null};He={mobileBorder:{all:null,left:mo==="left"?ge?null:{...ao,classNamePrefix:"em-mob-border_left-"}:qe("left"),right:mo==="right"?ge?null:{...ao,classNamePrefix:"em-mob-border_right-"}:qe("right"),top:mo==="top"?ge?null:{...ao,classNamePrefix:"em-mob-border_top-"}:qe("top"),bottom:mo==="bottom"?ge?null:{...ao,classNamePrefix:"em-mob-border_bottom-"}:qe("bottom")}},n.setFieldsValue({[Pe]:ao})}}break;case"width":He={[Pe]:{value:v[Pe],dim:H.widthDim}};break;case"height":He={[Pe]:{value:v[Pe],dim:H.heightDim}};break;case"widthDim":He={width:{value:H.width,dim:v[Pe]}};break;case"heightDim":He={height:{value:H.height,dim:v[Pe]}};break;case"backgroundImage":P(v[Pe]===""),He={[Pe]:[{...e.backgroundImage[0],value:v[Pe]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":He={padding:{left:H.paddingLeft,right:H.paddingRight,top:H.paddingTop,bottom:H.paddingBottom,[W.PADDING_POSITION[Pe]]:+v[Pe]}};break;case"paddingTopBottom":He={padding:{left:H.paddingLeft,right:H.paddingRight,top:+v[Pe],bottom:+v[Pe]}},H.paddingTop=H.paddingBottom=+v[Pe];break;case"paddingLeftRight":He={padding:{top:H.paddingTop,bottom:H.paddingBottom,left:+v[Pe],right:+v[Pe]}},H.paddingLeft=H.paddingRight=+v[Pe];break;case"borderRadiusAll":He={borderRadius:{[W.BORDER_RADIUS_POSITION[Pe]]:+v[Pe]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":He={borderRadius:{topLeft:H.borderRadiusTopLeft,bottomLeft:H.borderRadiusBottomLeft,topRight:H.borderRadiusTopRight,bottomRight:H.borderRadiusBottomRight,[W.BORDER_RADIUS_POSITION[Pe]]:+v[Pe]}};break;case"mobileWidth":He={[Pe]:{classNamePrefix:"em-mob-width-",value:v[Pe],dim:H.mobileWidthDim}};break;case"mobileWidthDim":He={mobileWidth:{classNamePrefix:"em-mob-width-",value:H.mobileWidth||100,dim:v[Pe]}};break;case"mobileHeight":He={[Pe]:{classNamePrefix:"em-mob-height-",value:v[Pe],dim:H.mobileHeightDim}};break;case"mobileHeightDim":He={mobileHeight:{classNamePrefix:"em-mob-height-",value:H.mobileHeight,dim:v[Pe]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":He={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[Pe]]:v[Pe],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[Pe]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":He={mobileBoxShadow:{hOffset:H.mobileBoxShadowHOffset,vOffset:H.mobileBoxShadowVOffset,blurRadius:H.mobileBoxShadowBlurRadius,spreadRadius:H.mobileBoxShadowSpreadRadius,color:H.mobileBoxShadowColor,inset:H.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":He={[Pe]:{classNamePrefix:"em-mob-text_align-",value:v[Pe]}};break;case"mobileVerticalAlign":He={[Pe]:{classNamePrefix:"em-mob-vertical_align-",value:v[Pe]}};break;case"mobileDirection":He={[Pe]:{classNamePrefix:"em-mob-direction-",value:v[Pe]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(He=St(v),!He)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":He={mobilePadding:{all:null,top:H.mobilePaddingTop!==""?H.mobilePaddingTop:null,right:H.mobilePaddingRight!==""?H.mobilePaddingRight:null,bottom:H.mobilePaddingBottom!==""?H.mobilePaddingBottom:null,left:H.mobilePaddingLeft!==""?H.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":H.mobilePaddingTop=H.mobilePaddingBottom=v[Pe],He={mobilePadding:{all:null,top:H.mobilePaddingTop!==""?H.mobilePaddingTop:null,right:H.mobilePaddingRight!==""?H.mobilePaddingRight:null,bottom:H.mobilePaddingBottom!==""?H.mobilePaddingBottom:null,left:H.mobilePaddingLeft!==""?H.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":H.mobilePaddingLeft=H.mobilePaddingRight=v[Pe],He={mobilePadding:{all:null,top:H.mobilePaddingTop!==""?H.mobilePaddingTop:null,right:H.mobilePaddingRight!==""?H.mobilePaddingRight:null,bottom:H.mobilePaddingBottom!==""?H.mobilePaddingBottom:null,left:H.mobilePaddingLeft!==""?H.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"backgroundPositionX":case"backgroundPositionY":He={[Pe]:isNaN(parseFloat(v[Pe].position))?v[Pe].position:v[Pe].position+v[Pe].unit};break;default:He=v}Pe!=="borderPosition"&&Pe!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:He}),Pe!=="mobileBorderRadiusAll"&&Pe!=="mobileBorderRadiusTopLeft"&&Pe!=="mobileBorderRadiusTopRight"&&Pe!=="mobileBorderRadiusBottomLeft"&&Pe!=="mobileBorderRadiusBottomRight"&&he({...e,...He,mobileBorderRadius:{...e.mobileBorderRadius,...He?.mobileBorderRadius},activateSection:null,changeKey:Pe}))},$e=()=>{A(H=>!H);const v=n.getFieldsValue(!0);z||(v.paddingLeftRight=v.paddingLeft,v.paddingTopBottom=v.paddingTop,v.paddingRight=v.paddingLeft,v.paddingBottom=v.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:v.paddingTopBottom,bottom:v.paddingTopBottom,left:v.paddingLeftRight,right:v.paddingLeftRight}}}))},Ce=()=>{const v=n.getFieldsValue(!0);d.markBorderToggled(!U),setTimeout(()=>{J(H=>!H),U?(v.borderAll=W.NULL_BORDER,v.borderTop=W.NULL_BORDER,v.borderBottom=W.NULL_BORDER,v.borderRight=W.NULL_BORDER,v.borderLeft=W.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}}}})})},Y=()=>{const v=n.getFieldsValue(!0);c.markBorderToggled(!Q),setTimeout(()=>{I(H=>!H),Q?(v.mobileBorderAll=W.NULL_BORDER,v.mobileBorderTop=W.NULL_BORDER,v.mobileBorderBottom=W.NULL_BORDER,v.mobileBorderRight=W.NULL_BORDER,v.mobileBorderLeft=W.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}}}})})},oe=()=>{const v=n.getFieldsValue(!0);setTimeout(()=>{xe(H=>!H),le?(v.borderRadiusAll=0,b(!0)):v.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:v.borderRadiusAll}}})})},D=()=>{const v=n.getFieldsValue(!0);setTimeout(()=>{Z(H=>!H),ve?(v.mobileBorderRadiusAll=null,k(!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-"}}})})},ue=()=>{const v=n.getFieldsValue(!0);setTimeout(()=>{Ne(H=>!H),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}}})})},Ie=()=>{const v=n.getFieldsValue(!0);setTimeout(()=>{Fe(H=>!H),de?(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-"}}})})},Ve=()=>{const v=n.getFieldsValue(!0);setTimeout(()=>{if(Ge(H=>!H),Ae){const H=yd(e);El(v,H),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:H})}})},to=()=>{const v=n.getFieldsValue(!0);setTimeout(()=>{if(ye(H=>!H),je){const H=jd(e);El(v,H),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:H})}})},io=()=>{const v=n.getFieldsValue(!0);setTimeout(()=>{pe(H=>!H),_e?(v.backgroundColor="",v.backgroundImage="",v.backgroundPositionX="",v.backgroundPositionY="",v.backgroundRepeat="none",v.backgroundSize="",P(!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}})})},uo=()=>{const v=n.getFieldsValue(!0);setTimeout(()=>{me(H=>!H),fe?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}}}),fe&&Wt(n,e,l)})},$=()=>{const v=n.getFieldsValue(!0);setTimeout(()=>{ee(H=>!H),K&&(v.exportAsPicture=!1,v.isContrastBlock=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1,isContrastBlock:!1}}))})},se=()=>{const v=n.getFieldsValue(!0);setTimeout(()=>{ae(H=>!H),ie&&(v.mobilePaddingLeftRight="",v.mobilePaddingLeft="",v.mobilePaddingRight="",v.mobilePaddingTopBottom="",v.mobilePaddingTop="",v.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:n,layout:"vertical",name:"selected_td_form",initialValues:{horizontalPosition:"",horizontalUnit:"px",backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",align:"",valign:"",border:"",show:"all",borderPosition:W.BORDER_POSITIONS[C]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[G]||"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:Ee,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:!V&&(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)(xl,{form:n,elementSettings:e,boxShadow:m,mobileBordersShow:Q,mobileBorderRadiusShow:ve,mobileBoxShadowShow:de,mobileSizeShow:je,mobileBackgroundShow:fe,mobilePaddingShow:ie,mobilePaddingsExt:O,setMobilePaddingsExt:w,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:k,toggleShowMobileBorderHandler:Y,toggleShowMobileBorderRadiusHandler:D,toggleShowMobileBoxShadowHandler:Ie,toggleShowMobileSizeHandler:to,toggleShowMobileBackgroundHandler:uo,toggleShowMobilePaddingHandler:se})})]}):(0,o.jsxs)(o.Fragment,{children:[!V&&(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)(bl,{form:n,elementSettings:e,boxShadow:m,bordersShow:U,borderRadiusShow:le,boxShadowShow:be,backgroundShow:_e,backgroundImageEmpty:j,backgroundRepeatOptions:Te,sizeShow:Ae,maxWidthValue:p,modificationShow:K,paddingsExt:z,oneBorderRadiusValue:E,setOneBorderRadiusValue:b,elementListShow:ne,togglePaddingHandler:$e,toggleShowBorderHandler:Ce,toggleShowBorderRadiusHandler:oe,toggleShowBoxShadowHandler:ue,toggleShowSizeHandler:Ve,toggleShowBackgroundHandler:io,toggleShowModificationHandler:$,handleChangeValues:Ee})})]})})};Bl.propTypes={elementSettings:f.default.object.isRequired};var Sl=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:n,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:p,backgroundRepeatOptions:g,sizeShow:m,maxWidthValue:_,modificationShow:E,paddingShow:b,paddingsExt:h,oneBorderRadiusValue:k,setOneBorderRadiusValue:x,togglePaddingHandler:T,toggleShowPaddingHandler:j,toggleShowBorderHandler:P,toggleShowBorderRadiusHandler:S,toggleShowBoxShadowHandler:y,toggleShowSizeHandler:V,toggleShowBackgroundHandler:z,toggleShowModificationHandler:A,handleChangeValues:O})=>{const{__:w}=r.useI18n(),{token:U}=(0,t.ui_kit$useToken)(),J=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:w("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)(st,{form:e,elementSettings:i})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Vo,{form:e,elementSettings:i})})]}),J.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Padding"),collapsible:!0,open:b,onToggle:j,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:h,onToggleExtended:T,labels:{horizontal:w("Horizontal padding"),vertical:w("Vertical padding"),left:w("Left padding"),right:w("Right padding"),top:w("Top padding"),bottom:w("Bottom padding"),individual:w("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:w("Size"),collapsible:!0,open:m,onToggle:V,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:_,dimensionSelect:Mo,showMinMax:!0,minWidthDimensionSelect:Mo,maxWidthDimensionSelect:Mo,labels:{width:w("Width"),height:w("Height"),minWidth:w("Minimum width"),maxWidth:w("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:w("Background"),collapsible:!0,open:c,onToggle:z,dividerTop:!0,children:[(0,o.jsx)($i,{form:e,backgroundImageEmpty:p,appConfig:J,token:U,elementSettings:i,backgroundRepeatOptions:g,handleChangeValues:O}),(0,o.jsx)(at,{form:e,showBackground:!0})]}),J.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Borders"),collapsible:!0,open:s,onToggle:P,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:i})}),J.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Border radius"),collapsible:!0,open:n,onToggle:S,dividerTop:!0,children:(0,o.jsx)(Io,{form:e,oneBorderRadiusValue:k,setOneBorderRadiusValue:x,elementSettings:i})}),J.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Box shadow"),collapsible:!0,open:d,onToggle:y,dividerTop:!0,children:(0,o.jsx)(No,{})}),J.formFieldExportAsPictureEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Export settings"),collapsible:!0,open:E,onToggle:A,dividerTop:!0,children:(0,o.jsx)(Ai,{form:e,elementSettings:i})}),J.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("Display control & Direction"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e,directionControl:(0,o.jsx)(zt,{elementSettings:i,form:e})})}),J.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:w("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})};Sl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,bordersShow:f.default.bool,borderRadiusShow:f.default.bool,boxShadowShow:f.default.bool,backgroundShow:f.default.bool,backgroundImageEmpty:f.default.bool,backgroundRepeatOptions:f.default.array,sizeShow:f.default.bool,maxWidthValue:f.default.oneOfType([f.default.string,f.default.number]),modificationShow:f.default.bool,paddingShow:f.default.bool,paddingsExt:f.default.bool,oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func,togglePaddingHandler:f.default.func,toggleShowPaddingHandler:f.default.func,toggleShowBorderHandler:f.default.func,toggleShowBorderRadiusHandler:f.default.func,toggleShowBoxShadowHandler:f.default.func,toggleShowSizeHandler:f.default.func,toggleShowBackgroundHandler:f.default.func,toggleShowModificationHandler:f.default.func,handleChangeValues:f.default.func};var Tl=({form:e,elementSettings:i,mobileBoxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:n,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:p,mobilePaddingShow:g,mobilePaddingsExt:m,setMobilePaddingsExt:_,oneMobileBorderRadiusValue:E,setOneMobileBorderRadiusValue:b,toggleShowMobileBorderHandler:h,toggleShowMobileBorderRadiusHandler:k,toggleShowMobileBoxShadowHandler:x,toggleShowMobileSizeHandler:T,toggleShowMobileBackgroundHandler:j,toggleShowMobilePaddingHandler:P})=>{const{__:S}=r.useI18n(),{token:y}=(0,t.ui_kit$useToken)(),V=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)(Vt,{form:e,elementSettings:i,imgParent:!0})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Vo,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),V.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:S("Padding"),collapsible:!0,open:g,onToggle:P,dividerTop:!0,children:(0,o.jsx)(Yt,{form:e,elementSettings:i,mobilePaddingsExt:m,setMobilePaddingsExt:_})}),(0,o.jsx)(t.ui_kit$FormSection,{title:S("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:y.formItemMarginBottomXS*2},children:(0,o.jsx)(Xo,{form:e,name:"mobileWidth",elementSettings:i})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:y.formItemMarginBottomXS},children:(0,o.jsx)(lt,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:S("Background"),collapsible:!0,open:p,onToggle:j,dividerTop:!0,children:(0,o.jsx)(Rt,{elementSettings:Ko(i),imageEnabled:V.formDivFieldBackgroundImageEnabled,desktopBackground:Tt(i)})}),V.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:S("Borders"),collapsible:!0,open:s,onToggle:h,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),V.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:S("Border radius"),collapsible:!0,open:n,onToggle:k,dividerTop:!0,children:(0,o.jsx)(Io,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:E,setOneBorderRadiusValue:b,elementSettings:i})}),V.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:S("Box shadow"),collapsible:!0,open:d,onToggle:x,dividerTop:!0,children:(0,o.jsx)(No,{typeOfForm:"mobile",form:e,elementSettings:i})}),V.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:S("Display control & Direction"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e,directionControl:(0,o.jsx)(zt,{elementSettings:i,form:e,typeOfForm:"mobile"})})}),V.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:S("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})};Tl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,mobileBoxShadow:f.default.object,mobileBordersShow:f.default.bool,mobileBorderRadiusShow:f.default.bool,mobileBoxShadowShow:f.default.bool,mobileSizeShow:f.default.bool,mobileBackgroundShow:f.default.bool,mobilePaddingShow:f.default.bool,mobilePaddingsExt:f.default.bool,setMobilePaddingsExt:f.default.func,oneMobileBorderRadiusValue:f.default.bool,setOneMobileBorderRadiusValue:f.default.func,toggleShowMobileBorderHandler:f.default.func,toggleShowMobileBorderRadiusHandler:f.default.func,toggleShowMobileBoxShadowHandler:f.default.func,toggleShowMobileSizeHandler:f.default.func,toggleShowMobileBackgroundHandler:f.default.func,toggleShowMobilePaddingHandler:f.default.func};var Rl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),n=Do(),d=Do(),[c,p]=(0,a.useState)({}),[g,m]=(0,a.useState)(!0),[_,E]=(0,a.useState)({}),[b,h]=(0,a.useState)(!0),k=r.useSelector(r.selectEmailViewType),x=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[T,j]=(0,a.useState)(e.backgroundImage[0].value===""),P=r.useSelector(r.selectIsCodeMode),S=r.useSelector(r.selectCodeModeDirection),y=P&&S!=="bottom",[V,z]=(0,a.useState)(!1),[A,O]=(0,a.useState)(!1),[w,U]=(0,a.useState)(!1),[J,Q]=(0,a.useState)(!1),[I,le]=(0,a.useState)(!1),[xe,ve]=(0,a.useState)(!1),[Z,be]=(0,a.useState)(!1),[Ne,de]=(0,a.useState)(!1),[Fe,Ae]=(0,a.useState)(!1),[Ge,je]=(0,a.useState)(!1),[ye,_e]=(0,a.useState)(!1),[pe,fe]=(0,a.useState)(!1),[me,K]=(0,a.useState)(!1),[ee,ie]=(0,a.useState)(!1),[ae,ne]=(0,a.useState)(!1),[Me,te]=(0,a.useState)(void 0),Te=[{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 ke=e.border,M=e.mobileBorder,C=Object.keys(ke).find($=>ke[$]?.width||ke[$]?.style||ke[$]?.color),G=Object.keys(M).find($=>M[$]?.width||M[$]?.style||M[$]?.color),L=$=>$&&($?.width||$?.style||$?.color)?$:"";(0,a.useEffect)(()=>{if(e){const $=e.boxShadow,se=e.mobileBoxShadow;p($),E(se),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:L(e.mobileBorder.all)||!(L(e.mobileBorder.top)||L(e.mobileBorder.bottom)||L(e.mobileBorder.right)||L(e.mobileBorder.left))&&L(e.border.all),mobileBorderTop:L(e.mobileBorder.top)||!L(e.mobileBorder.all)&&L(e.border.top),mobileBorderBottom:L(e.mobileBorder.bottom)||!L(e.mobileBorder.all)&&L(e.border.bottom),mobileBorderRight:L(e.mobileBorder.right)||!L(e.mobileBorder.all)&&L(e.border.right),mobileBorderLeft:L(e.mobileBorder.left)||!L(e.mobileBorder.all)&&L(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:Bo(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileHeight:Bo(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))?m(!1):m(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))?h(!1):h(!0),j(e.backgroundImage[0].value===""),!u(e.padding.all)&&(u(e.padding.top)||u(e.padding.right)||u(e.padding.bottom)||u(e.padding.left))&&(e.padding.top!==e.padding.bottom||e.padding.right!==e.padding.left)?z(!1):z(!0),!u(e.mobilePadding.all)&&(u(e.mobilePadding.top)||u(e.mobilePadding.right)||u(e.mobilePadding.bottom)||u(e.mobilePadding.left))&&(e.mobilePadding.top!==e.mobilePadding.bottom||e.mobilePadding.right!==e.mobilePadding.left)?O(!1):O(!0);const v=n.isStaleBorderSnapshot(e,!!C),H=d.isStaleBorderSnapshot(e,!!G);v&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(H||v&&!G)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),U(Pe=>C&&!v?!0:Pe),Q(Pe=>C&&!v||G&&!H?!0:Pe),le(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),ve(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),be(!!e.boxShadow),de(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),Ae(!!e.width.value||!!e.height.value||!!e.minWidth.value||!!e.maxWidth.value),je(!!e.mobileWidth.value||!!e.mobileHeight.value),_e(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),fe(Ut(e)),K(!!e.exportAsPicture),ie(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),ne(!!e.mobilePadding.all||!!e.mobilePadding.top||!!e.mobilePadding.bottom||!!e.mobilePadding.left||!!e.mobilePadding.right)}},[s,e,C,G,n,d]);const re=$=>{const se=s.getFieldsValue(!0),v=Object.keys($)[0];let H;const{widthDim:Pe}=s.getFieldsValue(!0);switch(te(Pe==="%"?100:void 0),v){case"exportAsPicture":H={exportAsPicture:se.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":H={boxShadow:{hOffset:se.boxShadowHOffset,vOffset:se.boxShadowVOffset,blurRadius:se.boxShadowBlurRadius,spreadRadius:se.boxShadowSpreadRadius,color:se.boxShadowColor,inset:se.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":se.borderPosition==="borderAll"?(H={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...se.borderAll}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):se.borderAll?.width||se.borderAll?.style||se.borderAll?.color?(H={border:{all:null,left:se.borderAll,right:se.borderAll,top:se.borderAll,bottom:se.borderAll,[W.REVERSE_BORDER_POSITIONS[v]]:{...se[v],...$[v]}}},s.setFieldsValue({borderAll:null,borderLeft:se.borderAll,borderRight:se.borderAll,borderTop:se.borderAll,borderBottom:se.borderAll,[v]:{...se[v],...$[v]}})):(H={border:{all:null,left:se.borderLeft,right:se.borderRight,top:se.borderTop,bottom:se.borderBottom,[W.REVERSE_BORDER_POSITIONS[v]]:{...se[v],...$[v]}}},s.setFieldsValue({border:H.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(se.mobileBorderPosition==="mobileBorderAll")H={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...se.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[v]+"-"}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const He=W.MOBILE_REVERSE_BORDER_POSITIONS[v],ko={...se[v],...$[v]},mo=!ko?.width&&!ko?.style&&!ko?.color;if(se.mobileBorder?.all?.width||se.mobileBorder?.all?.style||se.mobileBorder?.all?.color){const ao=se.mobileBorderAll;H={mobileBorder:{all:null,left:ao,right:ao,top:ao,bottom:ao,[He]:mo?null:{...ko,classNamePrefix:"em-mob-border_"+He+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:ao,mobileBorderRight:ao,mobileBorderTop:ao,mobileBorderBottom:ao,[v]:ko})}else{const ao=e.mobileBorder||{},ge=Ye=>{const qe=ao[Ye];return qe&&(qe?.width||qe?.style||qe?.color)?qe:null};H={mobileBorder:{all:null,left:He==="left"?mo?null:{...ko,classNamePrefix:"em-mob-border_left-"}:ge("left"),right:He==="right"?mo?null:{...ko,classNamePrefix:"em-mob-border_right-"}:ge("right"),top:He==="top"?mo?null:{...ko,classNamePrefix:"em-mob-border_top-"}:ge("top"),bottom:He==="bottom"?mo?null:{...ko,classNamePrefix:"em-mob-border_bottom-"}:ge("bottom")}},s.setFieldsValue({[v]:ko})}}break;case"width":H={[v]:{value:$[v],dim:se.widthDim}};break;case"height":H={[v]:{value:$[v],dim:se.heightDim}};break;case"widthDim":H={width:{value:se.width,dim:$[v]}};break;case"heightDim":H={height:{value:se.height,dim:$[v]}};break;case"maxWidth":H={[v]:{value:$[v],dim:se.maxWidthDim}};break;case"maxWidthDim":H={maxWidth:{value:se.maxWidth,dim:$[v]}};break;case"minWidth":H={[v]:{value:$[v],dim:se.minWidthDim}};break;case"minWidthDim":H={minWidth:{value:se.minWidth,dim:$[v]}};break;case"backgroundImage":j($[v]===""),H={[v]:[{...e.backgroundImage[0],value:$[v]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":H={padding:{[W.PADDING_POSITION[v]]:+$[v]}};break;case"paddingTopBottom":H={padding:{top:+$[v],bottom:+$[v]}},se.paddingTop=se.paddingBottom=+$[v];break;case"paddingLeftRight":H={padding:{left:+$[v],right:+$[v]}},se.paddingLeft=se.paddingRight=+$[v];break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":H={borderRadius:{[W.BORDER_RADIUS_POSITION[v]]:+$[v]}};break;case"mobileWidth":H={[v]:{classNamePrefix:"em-mob-width-",value:$[v],dim:se.mobileWidthDim}};break;case"mobileWidthDim":H={mobileWidth:{classNamePrefix:"em-mob-width-",value:se.mobileWidth||100,dim:$[v]}};break;case"mobileHeight":H={[v]:{classNamePrefix:"em-mob-height-",value:$[v],dim:se.mobileHeightDim}};break;case"mobileHeightDim":H={mobileHeight:{classNamePrefix:"em-mob-height-",value:se.mobileHeight,dim:$[v]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":H={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[v]]:$[v],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[v]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":H={mobileBoxShadow:{hOffset:se.mobileBoxShadowHOffset,vOffset:se.mobileBoxShadowVOffset,blurRadius:se.mobileBoxShadowBlurRadius,spreadRadius:se.mobileBoxShadowSpreadRadius,color:se.mobileBoxShadowColor,inset:se.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":H={[v]:{classNamePrefix:"em-mob-text_align-",value:$[v]}};break;case"mobileVerticalAlign":H={[v]:{classNamePrefix:"em-mob-vertical_align-",value:$[v]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(H=St($),!H)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":H={mobilePadding:{all:null,top:se.mobilePaddingTop!==""?se.mobilePaddingTop:null,right:se.mobilePaddingRight!==""?se.mobilePaddingRight:null,bottom:se.mobilePaddingBottom!==""?se.mobilePaddingBottom:null,left:se.mobilePaddingLeft!==""?se.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":se.mobilePaddingTop=se.mobilePaddingBottom=$[v],H={mobilePadding:{all:null,top:se.mobilePaddingTop!==""?se.mobilePaddingTop:null,right:se.mobilePaddingRight!==""?se.mobilePaddingRight:null,bottom:se.mobilePaddingBottom!==""?se.mobilePaddingBottom:null,left:se.mobilePaddingLeft!==""?se.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":se.mobilePaddingLeft=se.mobilePaddingRight=$[v],H={mobilePadding:{all:null,top:se.mobilePaddingTop!==""?se.mobilePaddingTop:null,right:se.mobilePaddingRight!==""?se.mobilePaddingRight:null,bottom:se.mobilePaddingBottom!==""?se.mobilePaddingBottom:null,left:se.mobilePaddingLeft!==""?se.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileDirection":H={[v]:{classNamePrefix:"em-mob-direction-",value:$[v]}};break;case"backgroundPositionX":case"backgroundPositionY":H={[v]:isNaN(parseFloat($[v].position))?$[v].position:$[v].position+$[v].unit};break;default:H=$}v!=="borderPosition"&&v!=="mobileBorderPosition"&&l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:H})},ce=()=>{z(se=>!se);const $=s.getFieldsValue(!0);V||($.paddingLeftRight=$.paddingLeft,$.paddingTopBottom=$.paddingTop,$.paddingRight=$.paddingLeft,$.paddingBottom=$.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:$.paddingTopBottom,bottom:$.paddingTopBottom,left:$.paddingLeftRight,right:$.paddingLeftRight}}}))},he=()=>{const $=s.getFieldsValue(!0);n.markBorderToggled(!w),setTimeout(()=>{U(se=>!se),w?($.borderAll=W.NULL_BORDER,$.borderTop=W.NULL_BORDER,$.borderBottom=W.NULL_BORDER,$.borderRight=W.NULL_BORDER,$.borderLeft=W.NULL_BORDER):$.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:$.borderAll.color,style:$.borderAll.style,width:$.borderAll.width}}}})})},Ee=()=>{const $=s.getFieldsValue(!0);d.markBorderToggled(!J),setTimeout(()=>{Q(se=>!se),J?($.mobileBorderAll=W.NULL_BORDER,$.mobileBorderTop=W.NULL_BORDER,$.mobileBorderBottom=W.NULL_BORDER,$.mobileBorderRight=W.NULL_BORDER,$.mobileBorderLeft=W.NULL_BORDER):$.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:$.mobileBorderAll.color,style:$.mobileBorderAll.style,width:$.mobileBorderAll.width}}}})})},$e=()=>{const $=s.getFieldsValue(!0);setTimeout(()=>{le(se=>!se),I?($.borderRadiusAll=0,m(!0)):$.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:$.borderRadiusAll}}})})},Ce=()=>{const $=s.getFieldsValue(!0);setTimeout(()=>{ve(se=>!se),xe?($.mobileBorderRadiusAll=null,h(!0)):$.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:$.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},Y=()=>{const $=s.getFieldsValue(!0);setTimeout(()=>{be(se=>!se),Z?($.boxShadowInset=!1,$.boxShadowHOffset=null,$.boxShadowVOffset=null,$.boxShadowBlurRadius=null,$.boxShadowSpreadRadius=null,$.boxShadowColor=""):($.boxShadowInset=!1,$.boxShadowHOffset=5,$.boxShadowVOffset=5,$.boxShadowBlurRadius=10,$.boxShadowSpreadRadius=-5,$.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:$.boxShadowBlurRadius,color:$.boxShadowColor,hOffset:$.boxShadowHOffset,inset:$.boxShadowInset,spreadRadius:$.boxShadowSpreadRadius,vOffset:$.boxShadowVOffset}}})})},oe=()=>{const $=s.getFieldsValue(!0);setTimeout(()=>{de(se=>!se),Ne?($.mobileBoxShadowInset=!1,$.mobileBoxShadowHOffset=null,$.mobileBoxShadowVOffset=null,$.mobileBoxShadowBlurRadius=null,$.mobileBoxShadowSpreadRadius=null,$.mobileBoxShadowColor=""):($.mobileBoxShadowInset=!1,$.mobileBoxShadowHOffset=5,$.mobileBoxShadowVOffset=5,$.mobileBoxShadowBlurRadius=10,$.mobileBoxShadowSpreadRadius=-5,$.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:$.mobileBoxShadowBlurRadius,color:$.mobileBoxShadowColor,hOffset:$.mobileBoxShadowHOffset,inset:$.mobileBoxShadowInset,spreadRadius:$.mobileBoxShadowSpreadRadius,vOffset:$.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},D=()=>{setTimeout(()=>{Ae($=>!$)})},ue=()=>{setTimeout(()=>{je($=>!$)})},Ie=()=>{const $=s.getFieldsValue(!0);setTimeout(()=>{_e(se=>!se),ye?($.backgroundColor="",$.backgroundImage="",$.backgroundPositionX="",$.backgroundPositionY="",$.backgroundRepeat="none",$.backgroundSize="",j(!0)):($.backgroundColor="#E5E5E5",$.backgroundSize="",$.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:$.backgroundColor,backgroundImage:[{type:"url",value:$.backgroundImage}],backgroundPositionX:$.backgroundPositionX,backgroundPositionY:$.backgroundPositionY,backgroundRepeat:$.backgroundRepeat,backgroundSize:$.backgroundSize}})})},Ve=()=>{const $=s.getFieldsValue(!0);setTimeout(()=>{fe(se=>!se),pe?$.mobileBackgroundColor="":$.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:$.mobileBackgroundColor}}}),pe&&Wt(s,e,l)})},to=()=>{const $=s.getFieldsValue(!0);setTimeout(()=>{K(se=>!se),me&&($.exportAsPicture=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})},io=()=>{const $=s.getFieldsValue(!0);setTimeout(()=>{ie(se=>!se),ee&&($.paddingLeftRight="",$.paddingLeft="",$.paddingRight="",$.paddingTopBottom="",$.paddingTop="",$.paddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},uo=()=>{const $=s.getFieldsValue(!0);setTimeout(()=>{ne(se=>!se),ae&&($.mobilePaddingLeftRight="",$.mobilePaddingLeft="",$.mobilePaddingRight="",$.mobilePaddingTopBottom="",$.mobilePaddingTop="",$.mobilePaddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobilePadding:{all:null,top:null,right:null,bottom:null,left:null,classNamePrefix:"em-mob-padding_"}}}))})};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_div_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",valign:"",border:"",boxShadow:"",show:"all",borderPosition:W.BORDER_POSITIONS[C]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[G]||"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: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"})}),k==="mobile"&&x.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(Tl,{form:s,elementSettings:e,mobileBoxShadow:_,mobileBordersShow:J,mobileBorderRadiusShow:xe,mobileBoxShadowShow:Ne,mobileSizeShow:Ge,mobileBackgroundShow:pe,mobilePaddingShow:ae,mobilePaddingsExt:A,setMobilePaddingsExt:O,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:h,toggleShowMobileBorderHandler:Ee,toggleShowMobileBorderRadiusHandler:Ce,toggleShowMobileBoxShadowHandler:oe,toggleShowMobileSizeHandler:ue,toggleShowMobileBackgroundHandler:Ve,toggleShowMobilePaddingHandler:uo})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Sl,{form:s,elementSettings:e,boxShadow:c,bordersShow:w,borderRadiusShow:I,boxShadowShow:Z,backgroundShow:ye,backgroundImageEmpty:T,backgroundRepeatOptions:Te,sizeShow:Fe,maxWidthValue:Me,modificationShow:me,paddingShow:ee,paddingsExt:V,oneBorderRadiusValue:g,setOneBorderRadiusValue:m,togglePaddingHandler:ce,toggleShowPaddingHandler:io,toggleShowBorderHandler:he,toggleShowBorderRadiusHandler:$e,toggleShowBoxShadowHandler:Y,toggleShowSizeHandler:D,toggleShowBackgroundHandler:Ie,toggleShowModificationHandler:to,handleChangeValues:re})})]})};Rl.propTypes={elementSettings:f.default.object.isRequired};var yl=({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:Mo})})})})}),(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:vn})})})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Vertical alignment"),dividerTop:!0,children:(0,o.jsx)(Vo,{form:e,elementSettings:i})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{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)(Lo,{})})]})};yl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired};var jl=({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)(Xo,{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)(Vo,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{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)(Lo,{})})]})};jl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired};var Fi=0,wl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),n=r.useSelector(r.selectEmailViewType),d=r.useSelector(r.selectMobileViewActive),c=r.useSelector(r.selectIsCodeMode),p=r.useSelector(r.selectCodeModeDirection),g=c&&p!=="bottom";(0,a.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:Bo(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileContentWidth:Bo(e.mobileContentWidth?.value),mobileContentWidthDim:e.mobileContentWidth?.dim,mobileVerticalAlign:u(e.mobileVerticalAlign?.value)}),Fi=e.width.value+e.gap.value)},[s,e]);const m=_=>{const E=s.getFieldsValue(!0),b=Object.keys(_)[0];let h;switch(b){case"width":Fi=_[b]+E.gap,h={[b]:{value:_[b],dim:E.widthDim},gap:{value:E.gap}};break;case"widthDim":h={width:{value:E.width,dim:_[b]},gap:{value:E.gap}};break;case"gap":E.width=Fi-_[b],h={[b]:{value:_[b],dim:"px"}};break;case"mobileWidth":h={[b]:{classNamePrefix:"em-mob-width-",value:_[b],dim:E.mobileWidthDim}};break;case"mobileWidthDim":h={mobileWidth:{classNamePrefix:"em-mob-width-",value:E.mobileWidth||100,dim:_[b]}};break;case"mobileContentWidth":h={[b]:{classNamePrefix:"em-mob-width-",value:_[b],dim:E.mobileContentWidthDim}};break;case"mobileContentWidthDim":h={mobileContentWidth:{classNamePrefix:"em-mob-width-",value:100,dim:_[b]}};break;case"mobileVerticalAlign":h={[b]:{classNamePrefix:"em-mob-vertical_align-",value:_[b]}};break;default:h=_}l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:h})};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:m,autoComplete:"off",className:"element-controls",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"})}),n==="mobile"&&d.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:n==="mobile"&&d.styles?"block":"none"},children:(0,o.jsx)(jl,{form:s,elementSettings:e})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(yl,{form:s,elementSettings:e})})]})};wl.propTypes={elementSettings:f.default.object.isRequired};function vl({height:e,multiline:i}){return!i&&Number(e)>0}function wd(e,i,l){const s={classNamePrefix:"em-mob-height-",value:e,dim:i};return l?{mobileHeight:s}:{mobileHeight:s,mobileLineHeight:{classNamePrefix:"em-mob-line_height-",value:e,dim:i}}}var Il=({form:e,fillFields:i,elementSettings:l,boxShadow:s,bordersShow:n,borderRadiusShow:d,boxShadowShow:c,backgroundShow:p,backgroundImageEmpty:g,backgroundRepeatOptions:m,paddingShow:_,paddingsExt:E,maxWidthValue:b,oneBorderRadiusValue:h,setOneBorderRadiusValue:k,linkProtocol:x,linkTarget:T,isOpenTextReplacer:j,textReplacerButtonRef:P,textReplacerInputRef:S,handleLinkProtocolsChange:y,handleSelect:V,textReplacerInputHandler:z,handleTextReplacerKeyDown:A,srcButtonHandler:O,togglePaddingHandler:w,toggleShowPaddingHandler:U,toggleShowBackgroundHandler:J,toggleShowBorderHandler:Q,toggleShowBorderRadiusHandler:I,toggleShowBoxShadowHandler:le,setLinkProtocol:xe,handleChangeValues:ve})=>{const{__:Z}=r.useI18n(),be=t.ui_kit$Form.useWatch("height",e),Ne=l,de=vl({height:be??Ne.height?.value,multiline:Ne.multiline}),{token:Fe}=(0,t.ui_kit$useToken)(),Ae=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:Z("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)(Go,{form:e,elementSettings:l})}),Ae.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(st,{form:e,name:"textAlign",elementSettings:l})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}}),(0,o.jsx)(it,{show:x==="#",__:Z,style:{marginBottom:Fe.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Z("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:Ae.formButtonFieldReplacerEnabled?Fe.formItemMarginBottomXS:Fe.formItemMarginBottomMD+4},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(tt,{linkProtocol:x,handleLinkProtocolsChange:y,__:Z}),placeholder:Z("Hyperlink URL"),allowClear:!0,onSelect:V,prefix:(0,o.jsx)(ot,{linkProtocol:x})})})}),x==="mailto:"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"subject",style:{marginBottom:Fe.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:Z("Subject")})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:Fe.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:Z("Body")})})]}),Ae.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:Z("Text replacer"),placement:"bottom",getPopupContainer:Ge=>Ge.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":j}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:O,ref:P})})}),(0,o.jsx)(t.ui_kit$Col,{span:21,children:j&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Z("Text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textReplacer",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:Z("The code that will replace this text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:Z("Text")}),onChange:z,onKeyDown:A,ref:S,onSelect:V})})})})]})}),Ae.formButtonFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Z("Padding"),collapsible:!0,open:_,onToggle:U,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:E,onToggleExtended:w,showVertical:!de,gutter:Fe.marginSM,labels:{horizontal:Z("Horizontal padding"),vertical:Z("Vertical padding"),left:Z("Left padding"),right:Z("Right padding"),top:Z("Top padding"),bottom:Z("Bottom padding"),individual:Z("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:Z("Size"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:b,dimensionSelect:Mo,gutter:Fe.marginSM,labels:{width:Z("Width"),height:Z("Height"),minWidth:Z("Minimum width"),maxWidth:Z("Maximum width")}})}),(0,o.jsx)(Bt,{form:e,fillFields:i,elementSettings:l,showAddParagraph:!1,isButton:!0,showLineHeight:!de,setLinkProtocol:xe,linkProtocol:x,linkTarget:T}),(0,o.jsxs)(t.ui_kit$FormSection,{title:Z("Background"),collapsible:!0,open:p,onToggle:J,dividerTop:!0,children:[(0,o.jsx)($i,{form:e,backgroundImageEmpty:g,appConfig:Ae,token:Fe,elementSettings:l,backgroundRepeatOptions:m,handleChangeValues:ve}),(0,o.jsx)(at,{form:e,showBackground:!0})]}),Ae.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Z("Borders"),collapsible:!0,open:n,onToggle:Q,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,elementSettings:l})}),Ae.formFieldBorderRadiusEnabled&&(0,o.jsxs)(t.ui_kit$FormSection,{title:Z("Border radius"),collapsible:!0,open:d,onToggle:I,dividerTop:!0,children:[(0,o.jsx)(Io,{form:e,oneBorderRadiusValue:h,setOneBorderRadiusValue:k,elementSettings:l}),(0,o.jsx)(at,{form:e,showRounding:!0})]}),Ae.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Z("Box shadow"),collapsible:!0,open:c,onToggle:le,dividerTop:!0,children:(0,o.jsx)(No,{})}),Ae.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Z("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:l,form:e})}),Ae.formFieldAmpVisibilityEnabled&&l.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:Z("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})]})};Il.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,bordersShow:f.default.bool,borderRadiusShow:f.default.bool,boxShadowShow:f.default.bool,backgroundShow:f.default.bool,backgroundImageEmpty:f.default.bool,backgroundRepeatOptions:f.default.array,paddingShow:f.default.bool,paddingsExt:f.default.bool,maxWidthValue:f.default.oneOfType([f.default.string,f.default.number]),oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func,linkProtocol:f.default.string,linkTarget:f.default.object,isOpenTextReplacer:f.default.bool,textReplacerButtonRef:f.default.object,textReplacerInputRef:f.default.object,handleLinkProtocolsChange:f.default.func,handleSelect:f.default.func,textReplacerInputHandler:f.default.func,handleTextReplacerKeyDown:f.default.func,srcButtonHandler:f.default.func,togglePaddingHandler:f.default.func,toggleShowPaddingHandler:f.default.func,toggleShowBackgroundHandler:f.default.func,toggleShowBorderHandler:f.default.func,toggleShowBorderRadiusHandler:f.default.func,toggleShowBoxShadowHandler:f.default.func,setLinkProtocol:f.default.func,handleChangeValues:f.default.func};var Cl=({form:e,fillFields:i,elementSettings:l,boxShadow:s,mobileBordersShow:n,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:p,mobileBackgroundShow:g,mobilePaddingShow:m,mobilePaddingsExt:_,setMobilePaddingsExt:E,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:h,linkProtocol:k,handleLinkProtocolsChange:x,setLinkProtocol:T,toggleShowMobileBorderHandler:j,toggleShowMobileBorderRadiusHandler:P,toggleShowMobileBoxShadowHandler:S,toggleShowMobileSizeHandler:y,toggleShowMobileBackgroundHandler:V,toggleShowMobilePaddingHandler:z})=>{const{__:A}=r.useI18n(),O=t.ui_kit$Form.useWatch("mobileHeight",e),w=l,U=vl({height:O??w.mobileHeight?.value??w.height?.value,multiline:w.multiline}),{token:J}=(0,t.ui_kit$useToken)(),Q=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)(Go,{form:e,elementSettings:l,imgParent:!0,typeOfForm:"mobile"})}),Q.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Vt,{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)(it,{show:k==="#",__:A,style:{marginBottom:J.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:A("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:k==="mailto:"?J.formItemMarginBottomXS:J.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(tt,{linkProtocol:k,handleLinkProtocolsChange:x,__:A}),placeholder:A("Hyperlink URL"),allowClear:!0,prefix:(0,o.jsx)(ot,{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:A("Subject")})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:J.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:A("Body")})})]})]}),!!l.showOnMobile&&(0,o.jsx)(Bt,{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)(Xr,{})})}),Q.formButtonFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:A("Padding"),collapsible:!0,open:m,onToggle:z,dividerTop:!0,children:(0,o.jsx)(Yt,{form:e,elementSettings:l,mobilePaddingsExt:_,setMobilePaddingsExt:E,showVertical:!U})}),(0,o.jsx)(t.ui_kit$FormSection,{title:A("Size"),collapsible:!0,open:p,onToggle:y,dividerTop:!0,bodyStyle:{paddingBottom:J.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:A("Width"),placement:"bottom",children:(0,o.jsx)(Xo,{form:e,name:"mobileWidth",elementSettings:l})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:A("Height"),placement:"bottom",children:(0,o.jsx)(lt,{form:e,name:"mobileHeight",elementSettings:l})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:A("Background"),collapsible:!0,open:g,onToggle:V,dividerTop:!0,bodyStyle:{paddingBottom:J.formItemMarginBottomMD},children:(0,o.jsx)(Rt,{elementSettings:Ko(l),imageEnabled:Q.formButtonFieldBackgroundImageEnabled,desktopBackground:Tt(l)})}),Q.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:A("Borders"),collapsible:!0,open:n,onToggle:j,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),Q.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:A("Border radius"),collapsible:!0,open:d,onToggle:P,dividerTop:!0,children:(0,o.jsx)(Io,{form:e,oneBorderRadiusValue:b,setOneBorderRadiusValue:h,elementSettings:l,typeOfForm:"mobile"})}),Q.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:A("Box shadow"),collapsible:!0,open:c,onToggle:S,dividerTop:!0,children:(0,o.jsx)(No,{typeOfForm:"mobile"})}),Q.formFieldAmpVisibilityEnabled&&l.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:A("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})}),Q.formFieldAmpVisibilityEnabled&&l.isAmp&&(0,o.jsx)(t.ui_kit$FormSection,{title:A("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})};Cl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,mobileBordersShow:f.default.bool,mobileBorderRadiusShow:f.default.bool,mobileBoxShadowShow:f.default.bool,mobileSizeShow:f.default.bool,mobileBackgroundShow:f.default.bool,mobilePaddingShow:f.default.bool,mobilePaddingsExt:f.default.bool,setMobilePaddingsExt:f.default.func,oneMobileBorderRadiusValue:f.default.bool,setOneMobileBorderRadiusValue:f.default.func,linkProtocol:f.default.string,handleLinkProtocolsChange:f.default.func,setLinkProtocol:f.default.func,toggleShowMobileBorderHandler:f.default.func,toggleShowMobileBorderRadiusHandler:f.default.func,toggleShowMobileBoxShadowHandler:f.default.func,toggleShowMobileSizeHandler:f.default.func,toggleShowMobileBackgroundHandler:f.default.func,toggleShowMobilePaddingHandler:f.default.func};var vd=Object.freeze({}),Pl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),n=Do(),d=Do(),c=r.useDispatch(),[p,g]=(0,a.useState)({}),[m,_]=(0,a.useState)(!0),[E,b]=(0,a.useState)(!0),h=r.useSelector(r.selectEmailViewType),k=r.useSelector(r.selectMobileViewActive),[x,T]=(0,a.useState)(e.backgroundImage?.[0].value===""),j=r.useSelector(r.selectIsCodeMode),P=r.useSelector(r.selectCodeModeDirection),S=j&&P!=="bottom",y=(0,a.useRef)(null),V=(0,a.useRef)(null),[z,A]=(0,a.useState)(!1),[O,w]=(0,a.useState)(!1),[U,J]=(0,a.useState)(!1),[Q,I]=(0,a.useState)(!1),[le,xe]=(0,a.useState)(!1),[ve,Z]=(0,a.useState)(!1),[be,Ne]=(0,a.useState)(!1),[de,Fe]=(0,a.useState)(!1),[Ae,Ge]=(0,a.useState)(!1),[je,ye]=(0,a.useState)(!1),[_e,pe]=(0,a.useState)(!1),[fe,me]=(0,a.useState)(!1),[K,ee]=(0,a.useState)(!1),[ie,ae]=(0,a.useState)(void 0),[ne,Me]=(0,a.useState)("https://"),[te,Te]=(0,a.useState)({}),ke=e,[M,C]=(0,a.useState)(!!ke.textReplacer?.length),[G,L]=(0,a.useState)(e);e!==G&&(L(e),C(!!ke.textReplacer?.length));const re=r.useElementEntityKind(),ce=[{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"}],he=e.border,Ee=e.mobileBorder,$e=Object.keys(he).find(F=>he[F]?.width||he[F]?.style||he[F]?.color),Ce=Object.keys(Ee).find(F=>Ee[F]?.width||Ee[F]?.style||Ee[F]?.color),Y=F=>F&&(F?.width||F?.style||F?.color)?F:"",{remember:oe,fillFields:D,isOwnEcho:ue}=mt(e);(0,a.useEffect)(()=>{if(e){const F=e.boxShadow||vd,X=e.mobilePadding||{},we=e.mobileAlign||{};g(F);let q="",We="",Je=e.href||"https://";if(e.href){if(e.href.startsWith("mailto:")){const oo=Mr(e.href);q=oo.subject,We=oo.body,Je=oo.baseEmail}Yo(e.href,Me)}D(s,{...e,href:Je,subject:q,body:We,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:Y(e.mobileBorder.all)||!(Y(e.mobileBorder.top)||Y(e.mobileBorder.bottom)||Y(e.mobileBorder.right)||Y(e.mobileBorder.left))&&Y(e.border.all),mobileBorderTop:Y(e.mobileBorder.top)||!Y(e.mobileBorder.all)&&Y(e.border.top),mobileBorderBottom:Y(e.mobileBorder.bottom)||!Y(e.mobileBorder.all)&&Y(e.border.bottom),mobileBorderRight:Y(e.mobileBorder.right)||!Y(e.mobileBorder.all)&&Y(e.border.right),mobileBorderLeft:Y(e.mobileBorder.left)||!Y(e.mobileBorder.all)&&Y(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:Bo(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:Bo(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:Bo(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:Bo(e.mobileHeight?.value)?e.mobileHeight?.dim:e.height?.dim,mobileBorderRadiusAll:u(e.mobileBorderRadius?.all)||u(e.borderRadius?.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius?.topLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topLeft)||u(e.borderRadius?.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius?.bottomLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomLeft)||u(e.borderRadius?.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius?.topRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topRight)||u(e.borderRadius?.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius?.bottomRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomRight)||u(e.borderRadius?.all),mobileBoxShadowInset:e.mobileBoxShadow?.inset!=null?e.mobileBoxShadow.inset:e.boxShadow?.inset||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset)||u(e.boxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset)||u(e.boxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius)||u(e.boxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius)||u(e.boxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color)||u(e.boxShadow?.color),mobileAlign:u(we?.value)||e.align,mobileVerticalAlign:u(e.mobileVerticalAlign?.value||e.valign),mobileBackgroundColor:u(e.mobileBackgroundColor?.value||e.backgroundColor||""),...nt(e),mobilePaddingTop:u(X.all)||u(X.top)||u(e.padding?.all)||u(e.padding?.top),mobilePaddingLeft:u(X.all)||u(X.left)||u(e.padding?.all)||u(e.padding?.left),mobilePaddingRight:u(X.all)||u(X.right)||u(e.padding?.all)||u(e.padding?.right),mobilePaddingBottom:u(X.all)||u(X.bottom)||u(e.padding?.all)||u(e.padding?.bottom),mobilePaddingTopBottom:u(X.top)||u(X.bottom)||u(e.padding?.top)||u(e.padding?.bottom),mobilePaddingLeftRight:u(X.left)||u(X.right)||u(e.padding?.left)||u(e.padding?.right),mobileTextAlign:Dr(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))?_(!1):_(!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))?b(!1):b(!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)?A(!1):A(!0),!u(X.all)&&(u(X.top)||u(X.right)||u(X.bottom)||u(X.left))&&(X.top!==X.bottom||X.right!==X.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)?w(!1):w(!0);const Ue=n.isStaleBorderSnapshot(e,!!$e),eo=d.isStaleBorderSnapshot(e,!!Ce);if(Ue&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(eo||Ue&&!Ce)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),J(oo=>$e&&!Ue?!0:oo),I(oo=>$e&&!Ue||Ce&&!eo?!0:oo),ue())return;xe(!!e.borderRadius?.all||!!e.borderRadius?.topLeft||!!e.borderRadius?.bottomLeft||!!e.borderRadius?.topRight||!!e.borderRadius?.bottomRight),Z(!!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),Ne(!!e.boxShadow),Fe(!!e.mobileBoxShadow?.blurRadius||!!e.mobileBoxShadow?.color||!!e.mobileBoxShadow?.hOffset||!!e.mobileBoxShadow?.inset||!!e.mobileBoxShadow?.spreadRadius||!!e.mobileBoxShadow?.vOffset||!!e.boxShadow),Ge(!!e.mobileWidth?.value||!!e.mobileHeight?.value||!!e.width.value||!!e.height.value),ye(!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),pe(!!e.mobileBackgroundColor?.value||!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Ut(e)&&pe(!0),me(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),ee(!!e.mobilePadding?.all||!!e.mobilePadding?.top||!!e.mobilePadding?.bottom||!!e.mobilePadding?.left||!!e.mobilePadding?.right||!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right)}},[s,e,S,$e,Ce,n,d,D,ue]);const Ie=(0,a.useCallback)(F=>{oe(F),c(re==="email"?r.setElementSettings$1(F):r.setElementSettings(F))},[c,re,oe]),Ve=F=>{const X=s.getFieldsValue(!0),we=Object.keys(F)[0];let q;const{widthDim:We}=s.getFieldsValue(!0);switch(ae(We==="%"?100:void 0),we){case"exportAsPicture":q={exportAsPicture:X.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":q={boxShadow:{hOffset:X.boxShadowHOffset,vOffset:X.boxShadowVOffset,blurRadius:X.boxShadowBlurRadius,spreadRadius:X.boxShadowSpreadRadius,color:X.boxShadowColor,inset:X.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":X.borderPosition==="borderAll"?(q={border:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...X.borderAll}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER})):X.borderAll?.width||X.borderAll?.style||X.borderAll?.color?(q={border:{all:null,left:X.borderAll,right:X.borderAll,top:X.borderAll,bottom:X.borderAll,[W.REVERSE_BORDER_POSITIONS[we]]:{...X[we],...F[we]}}},s.setFieldsValue({borderAll:null,borderLeft:X.borderAll,borderRight:X.borderAll,borderTop:X.borderAll,borderBottom:X.borderAll,[we]:{...X[we],...F[we]}})):(q={border:{all:null,left:X.borderLeft,right:X.borderRight,top:X.borderTop,bottom:X.borderBottom,[W.REVERSE_BORDER_POSITIONS[we]]:{...X[we],...F[we]}}},s.setFieldsValue({border:q.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(X.mobileBorderPosition==="mobileBorderAll")q={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...W.NULL_BORDER,...X.mobileBorderAll,classNamePrefix:"em-mob-border_"+W.MOBILE_REVERSE_BORDER_POSITIONS[we]+"-"}}},s.setFieldsValue({borderLeft:W.NULL_BORDER,borderRight:W.NULL_BORDER,borderTop:W.NULL_BORDER,borderBottom:W.NULL_BORDER});else{const eo=W.MOBILE_REVERSE_BORDER_POSITIONS[we],oo={...X[we],...F[we]},yo=!oo?.width&&!oo?.style&&!oo?.color;if(X.mobileBorder?.all?.width||X.mobileBorder?.all?.style||X.mobileBorder?.all?.color){const Eo=X.mobileBorderAll;q={mobileBorder:{all:null,left:Eo,right:Eo,top:Eo,bottom:Eo,[eo]:yo?null:{...oo,classNamePrefix:"em-mob-border_"+eo+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:Eo,mobileBorderRight:Eo,mobileBorderTop:Eo,mobileBorderBottom:Eo,[we]:oo})}else{const Eo=e.mobileBorder||{},R=Re=>{const B=Eo[Re];return B&&(B?.width||B?.style||B?.color)?B:null};q={mobileBorder:{all:null,left:eo==="left"?yo?null:{...oo,classNamePrefix:"em-mob-border_left-"}:R("left"),right:eo==="right"?yo?null:{...oo,classNamePrefix:"em-mob-border_right-"}:R("right"),top:eo==="top"?yo?null:{...oo,classNamePrefix:"em-mob-border_top-"}:R("top"),bottom:eo==="bottom"?yo?null:{...oo,classNamePrefix:"em-mob-border_bottom-"}:R("bottom")}},s.setFieldsValue({[we]:oo})}}break;case"width":q={[we]:{value:F[we],dim:X.widthDim}};break;case"height":q={[we]:{value:F[we],dim:X.heightDim}};break;case"widthDim":q={width:{value:X.width,dim:F[we]}};break;case"heightDim":q={height:{value:X.height,dim:F[we]}};break;case"backgroundImage":T(F[we]===""),q={[we]:[{...e.backgroundImage[0],value:F[we]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":q={padding:{left:X.paddingLeft,right:X.paddingRight,top:X.paddingTop,bottom:X.paddingBottom,[W.PADDING_POSITION[we]]:+F[we]}};break;case"paddingTopBottom":q={padding:{left:X.paddingLeft,right:X.paddingRight,top:+F[we],bottom:+F[we]}},X.paddingTop=X.paddingBottom=+F[we];break;case"paddingLeftRight":q={padding:{top:X.paddingTop,bottom:X.paddingBottom,left:+F[we],right:+F[we]}},X.paddingLeft=X.paddingRight=+F[we];break;case"borderRadiusAll":q={borderRadius:{[W.BORDER_RADIUS_POSITION[we]]:+F[we]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":q={borderRadius:{topLeft:X.borderRadiusTopLeft,bottomLeft:X.borderRadiusBottomLeft,topRight:X.borderRadiusTopRight,bottomRight:X.borderRadiusBottomRight,[W.BORDER_RADIUS_POSITION[we]]:+F[we]}};break;case"mobileWidth":q={[we]:{classNamePrefix:"em-mob-width-",value:F[we],dim:X.mobileWidthDim}};break;case"mobileWidthDim":q={mobileWidth:{classNamePrefix:"em-mob-width-",value:X.mobileWidth||100,dim:F[we]}};break;case"mobileHeight":q=wd(F[we],X.mobileHeightDim,!!e.multiline);break;case"mobileHeightDim":q={mobileHeight:{classNamePrefix:"em-mob-height-",value:X.mobileHeight,dim:F[we]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":q={mobileBorderRadius:{[W.MOBILE_BORDER_RADIUS_POSITION[we]]:F[we],classNamePrefix:"em-mob-border_radius_"+W.MOBILE_BORDER_RADIUS_POSITION[we]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":q={mobileBoxShadow:{hOffset:X.mobileBoxShadowHOffset,vOffset:X.mobileBoxShadowVOffset,blurRadius:X.mobileBoxShadowBlurRadius,spreadRadius:X.mobileBoxShadowSpreadRadius,color:X.mobileBoxShadowColor,inset:X.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":q={[we]:{classNamePrefix:"em-mob-table_align-",value:F[we]}};break;case"mobileTextAlign":q={[we]:{classNamePrefix:"em-mob-text_align-",value:F[we]}};break;case"mobileVerticalAlign":q={[we]:{classNamePrefix:"em-mob-vertical_align-",value:F[we]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(q=St(F),!q)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":q={mobilePadding:{all:null,top:X.mobilePaddingTop!==""?X.mobilePaddingTop:null,right:X.mobilePaddingRight!==""?X.mobilePaddingRight:null,bottom:X.mobilePaddingBottom!==""?X.mobilePaddingBottom:null,left:X.mobilePaddingLeft!==""?X.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":X.mobilePaddingTop=X.mobilePaddingBottom=F[we],q={mobilePadding:{all:null,top:X.mobilePaddingTop!==""?X.mobilePaddingTop:null,right:X.mobilePaddingRight!==""?X.mobilePaddingRight:null,bottom:X.mobilePaddingBottom!==""?X.mobilePaddingBottom:null,left:X.mobilePaddingLeft!==""?X.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":X.mobilePaddingLeft=X.mobilePaddingRight=F[we],q={mobilePadding:{all:null,top:X.mobilePaddingTop!==""?X.mobilePaddingTop:null,right:X.mobilePaddingRight!==""?X.mobilePaddingRight:null,bottom:X.mobilePaddingBottom!==""?X.mobilePaddingBottom:null,left:X.mobilePaddingLeft!==""?X.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileFontSize":q={[we]:{classNamePrefix:"em-mob-font_size-",value:F[we],dim:X.mobileFontSizeDim}};break;case"href":let Je=rt(F[we]);Je!==F[we]&&(s.setFieldValue("href",Je),X.href=Je),Je.startsWith("mailto:")?q={[we]:Ii(Je,X.subject,X.body)}:q={[we]:Je},Yo(F[we],Me);break;case"subject":case"body":const Ue=X.href||"";if(Ue.startsWith("mailto:")){const eo=we==="subject"?F[we]:X.subject,oo=we==="body"?F[we]:X.body;q={href:Ii(Ue,eo,oo)}}else return;break;case"backgroundPositionX":case"backgroundPositionY":q={[we]:isNaN(parseFloat(F[we].position))?F[we].position:F[we].position+F[we].unit};break;default:q=F}we!=="borderPosition"&&we!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:q}),we!=="mobileBorderRadiusAll"&&we!=="mobileBorderRadiusTopLeft"&&we!=="mobileBorderRadiusTopRight"&&we!=="mobileBorderRadiusBottomLeft"&&we!=="mobileBorderRadiusBottomRight"&&Ie({...e,...q,mobileBorderRadius:{...e.mobileBorderRadius,...q?.mobileBorderRadius},activateSection:null,changeKey:we}))},to=()=>{A(X=>!X);const F=s.getFieldsValue(!0);z||(F.paddingLeftRight=F.paddingLeft,F.paddingTopBottom=F.paddingTop,F.paddingRight=F.paddingLeft,F.paddingBottom=F.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:F.paddingTopBottom,bottom:F.paddingTopBottom,left:F.paddingLeftRight,right:F.paddingLeftRight}}}))},io=()=>{const F=s.getFieldsValue(!0);n.markBorderToggled(!U),setTimeout(()=>{J(X=>!X),U?(F.borderAll=W.NULL_BORDER,F.borderTop=W.NULL_BORDER,F.borderBottom=W.NULL_BORDER,F.borderRight=W.NULL_BORDER,F.borderLeft=W.NULL_BORDER):F.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:F.borderAll.color,style:F.borderAll.style,width:F.borderAll.width}}}})})},uo=()=>{const F=s.getFieldsValue(!0);d.markBorderToggled(!Q),setTimeout(()=>{I(X=>!X),Q?(F.mobileBorderAll=W.NULL_BORDER,F.mobileBorderTop=W.NULL_BORDER,F.mobileBorderBottom=W.NULL_BORDER,F.mobileBorderRight=W.NULL_BORDER,F.mobileBorderLeft=W.NULL_BORDER):F.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:F.mobileBorderAll.color,style:F.mobileBorderAll.style,width:F.mobileBorderAll.width}}}})})},$=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{xe(X=>!X),le?(F.borderRadiusAll=0,_(!0)):F.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:F.borderRadiusAll}}})})},se=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{Z(X=>!X),ve?(F.mobileBorderRadiusAll=null,b(!0)):F.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:F.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},v=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{Ne(X=>!X),be?(F.boxShadowInset=!1,F.boxShadowHOffset=null,F.boxShadowVOffset=null,F.boxShadowBlurRadius=null,F.boxShadowSpreadRadius=null,F.boxShadowColor=""):(F.boxShadowInset=!1,F.boxShadowHOffset=5,F.boxShadowVOffset=5,F.boxShadowBlurRadius=10,F.boxShadowSpreadRadius=-5,F.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:F.boxShadowBlurRadius,color:F.boxShadowColor,hOffset:F.boxShadowHOffset,inset:F.boxShadowInset,spreadRadius:F.boxShadowSpreadRadius,vOffset:F.boxShadowVOffset}}})})},H=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{Fe(X=>!X),de?(F.mobileBoxShadowInset=!1,F.mobileBoxShadowHOffset=null,F.mobileBoxShadowVOffset=null,F.mobileBoxShadowBlurRadius=null,F.mobileBoxShadowSpreadRadius=null,F.mobileBoxShadowColor=""):(F.mobileBoxShadowInset=!1,F.mobileBoxShadowHOffset=5,F.mobileBoxShadowVOffset=5,F.mobileBoxShadowBlurRadius=10,F.mobileBoxShadowSpreadRadius=-5,F.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:F.mobileBoxShadowBlurRadius,color:F.mobileBoxShadowColor,hOffset:F.mobileBoxShadowHOffset,inset:F.mobileBoxShadowInset,spreadRadius:F.mobileBoxShadowSpreadRadius,vOffset:F.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Pe=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{Ge(X=>!X),Ae&&(F.mobileWidth="",F.mobileHeight="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"},mobileHeight:{value:null,dim:"px",classNamePrefix:"em-mob-height-"}}}))})},He=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{ye(X=>!X),je?(F.backgroundColor="",F.backgroundImage="",F.backgroundPositionX="",F.backgroundPositionY="",F.backgroundRepeat="none",F.backgroundSize="",T(!0)):(F.backgroundColor="#E5E5E5",F.backgroundSize="",F.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:F.backgroundColor,backgroundImage:[{type:"url",value:F.backgroundImage}],backgroundPositionX:F.backgroundPositionX,backgroundPositionY:F.backgroundPositionY,backgroundRepeat:F.backgroundRepeat,backgroundSize:F.backgroundSize}})})},ko=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{pe(X=>!X),_e?F.mobileBackgroundColor="":F.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:F.mobileBackgroundColor}}}),_e&&Wt(s,e,l)})},mo=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{me(X=>!X),fe&&(F.paddingLeftRight="",F.paddingLeft="",F.paddingRight="",F.paddingTopBottom="",F.paddingTop="",F.paddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},ao=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{ee(X=>!X),K&&(F.mobilePaddingLeftRight="",F.mobilePaddingLeft="",F.mobilePaddingRight="",F.mobilePaddingTopBottom="",F.mobilePaddingTop="",F.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_"}}}))})},ge=F=>{s.setFieldValue("href",F!=="mergetag"?F:""),Me(F)},Ye=(0,a.useCallback)(({target:F})=>{if(!F)return;const{selectionStart:X,selectionEnd:we}=F;Te(q=>q.target===F&&q.selection?.start===X&&q.selection?.end===we?q:{target:F,selection:{start:X,end:we}})},[]),qe=F=>{F.target.value!==""&&V.current.classList.add("selected-td-form__button--active")},lo=()=>{C(!M),M?(s.setFieldValue("textReplacer",""),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{textReplacer:""}})):setTimeout(()=>y.current.focus())},fo=F=>{const X=F.target,we=X.value,q=X.selectionStart;if(q===0&&F.key===" "){F.preventDefault();return}if(F.key===" "){if(q!==we.length){F.preventDefault();return}we.endsWith(" ")&&F.preventDefault()}};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_button_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",align:"",valign:"",border:"",boxShadow:"",show:"all",borderPosition:W.BORDER_POSITIONS[$e]||"borderAll",mobileBorderPosition:W.MOBILE_BORDER_POSITIONS[Ce]||"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:Ve,autoComplete:"off",className:"element-controls",children:[!S&&(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"})}),S?(0,o.jsx)(Ni,{form:s,elementSettings:e,showAddParagraph:!1,isButton:!0}):(0,o.jsx)(o.Fragment,{children:h==="mobile"&&k.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(Cl,{form:s,fillFields:D,elementSettings:e,boxShadow:p,mobileBordersShow:Q,mobileBorderRadiusShow:ve,mobileBoxShadowShow:de,mobileSizeShow:Ae,mobileBackgroundShow:_e,mobilePaddingShow:K,mobilePaddingsExt:O,setMobilePaddingsExt:w,oneMobileBorderRadiusValue:E,setOneMobileBorderRadiusValue:b,linkProtocol:ne,handleLinkProtocolsChange:ge,setLinkProtocol:Me,toggleShowMobileBorderHandler:uo,toggleShowMobileBorderRadiusHandler:se,toggleShowMobileBoxShadowHandler:H,toggleShowMobileSizeHandler:Pe,toggleShowMobileBackgroundHandler:ko,toggleShowMobilePaddingHandler:ao})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Il,{form:s,fillFields:D,elementSettings:e,boxShadow:p,bordersShow:U,borderRadiusShow:le,boxShadowShow:be,backgroundShow:je,backgroundImageEmpty:x,backgroundRepeatOptions:ce,paddingShow:fe,paddingsExt:z,maxWidthValue:ie,oneBorderRadiusValue:m,setOneBorderRadiusValue:_,linkProtocol:ne,linkTarget:te,isOpenTextReplacer:M,textReplacerButtonRef:V,textReplacerInputRef:y,handleLinkProtocolsChange:ge,handleSelect:Ye,textReplacerInputHandler:qe,handleTextReplacerKeyDown:fo,srcButtonHandler:lo,togglePaddingHandler:to,toggleShowPaddingHandler:mo,toggleShowBackgroundHandler:He,toggleShowBorderHandler:io,toggleShowBorderRadiusHandler:$,toggleShowBoxShadowHandler:v,setLinkProtocol:Me,handleChangeValues:Ve})})})]})};Pl.propTypes={elementSettings:f.default.object.isRequired};var Nl=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm(),s=r.useSendPostMessage();(0,a.useEffect)(()=>{e&&l.setFieldsValue({...e})},[l,e]);const n=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:n,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")})})})};Nl.propTypes={elementSettings:f.default.object.isRequired};function Id(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 Cd(e){const i=/^(.+)_(\d+)$/.exec(e);return i?{key:i[1],index:Number(i[2])}:void 0}function Pd(e,i,l){return(e??[]).map((s,n)=>n===i.index?{...s,[i.key]:l}:s)}function Al(e){return(e??[]).map((i,l)=>({...i,slideIndex:l}))}var Ll=({elementSettings:e,setElementSettings:i,postfix:l="",form:s,handleSelect:n,previewReloadSignal:d})=>{const{__:c}=r.useI18n(),{token:p}=(0,t.ui_kit$useToken)(),g=r.useAppConfig(),m=r.useSendPostMessage(),_="src"+l,E="title"+l,b="alt"+l,h="link"+l,k="imgReplacer"+l,x=(0,a.useRef)(null),T=(0,a.useRef)(null),j=(0,a.useRef)(null),P=(0,a.useRef)(null),S=(0,a.useRef)(null),y=(0,a.useRef)(null),V=(0,a.useRef)(null),z=(0,a.useRef)(null),[A,O]=(0,a.useState)(""),[w,U]=(0,a.useState)(""),[J,Q]=(0,a.useState)(""),[I,le]=(0,a.useState)(!1),[xe,ve]=(0,a.useState)("https://"),Z=(0,a.useRef)(!1),be=(0,a.useRef)(l);(0,a.useEffect)(()=>{l!==be.current&&(be.current=l,Z.current=!1),U(e.images?.[b]),Q(e.images?.[E]);const me=e.images?.[h];O(me||(Z.current?"...":""))},[e,b,E,h,l]);const Ne=()=>{A?(Z.current=!1,O(""),s.setFieldValue(h,""),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[h]:""}})):(Z.current=!0,O(x.current&&x.current.input.value?x.current.input.value:"..."),setTimeout(()=>{x.current.focus()}))},de=me=>{me.target.value===""?O("..."):(T.current.classList.add("selected-td-form__button--active"),O(me.target.value));const K=me.target.value;Yo(K,ve)},Fe=()=>{w?(U(""),s.setFieldValue("alt",""),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[b]:""}})):(U(j.current&&j.current.input.value?j.current.input.value:"..."),setTimeout(()=>{j.current.focus()}))},Ae=me=>{me.target.value===""?U("..."):(P.current.classList.add("selected-td-form__button--active"),U(me.target.value))},Ge=()=>{J?(Q(!1),s.setFieldValue("title",""),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[E]:""}})):(Q(S.current&&S.current.input.value?S.current.input.value:"..."),setTimeout(()=>{S.current.focus()}))},je=()=>{le(!I),I?(s.setFieldValue(k,""),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[k]:""}})):setTimeout(()=>V.current.focus())},ye=me=>{me.target.value!==""&&z.current.classList.add("selected-td-form__button--active")},_e=me=>{me.target.value===""?Q("..."):(y.current.classList.add("selected-td-form__button--active"),Q(me.target.value))},pe=me=>{s.setFieldValue("LinkName",me!=="mergetag"?me:""),ve(me)},fe=me=>{const K=s.getFieldsValue(!0),ee=+l.substring(1),ie=Object.keys(K?.images).reduce((ne,Me)=>(Me.includes(l)||(ne[Me]=K[Me]),ne),{}),ae=e.carouselImages?.filter((ne,Me)=>Me!==ee);i(ne=>({...ne,settings:{...ne.settings,carouselImages:Al(ae)}})),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:e.caption,settings:{...e,carouselImages:ae}}),s.setFieldsValue({images:ie})};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)(Fo,{form:s,label:c("Image path"),name:_,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:w||c("Alternative text"),placement:"bottom",getPopupContainer:me=>me.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":!!w}),onClick:Fe,ref:P,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),g.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:J||c("Tooltip text"),placement:"bottom",getPopupContainer:me=>me.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":!!J}),onClick:Ge,ref:y,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:A||c("Hyperlink URL"),placement:"bottom",getPopupContainer:me=>me.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":!!A}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:Ne,ref:T})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:c("Image replacer"),placement:"bottom",getPopupContainer:me=>me.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"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:je,ref:z})})]}),(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:fe,icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16})})})})]}),(!!A||!!w||!!J||!!I)&&(0,o.jsxs)("div",{children:[!!A&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(it,{show:xe==="#",__:c,style:{marginBottom:p.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:h,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(tt,{linkProtocol:xe,handleLinkProtocolsChange:pe,__:c}),placeholder:c("Hyperlink URL"),allowClear:!0,ref:x,onChange:de,onSelect:n,prefix:(0,o.jsx)(ot,{linkProtocol:xe})})})})]}),!!w&&(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:b,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:c("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:Ae,ref:j,onSelect:n})})}),g.formFieldImageTitleEnabled&&!!J&&(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:E,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:c("Enter the title of the image"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:_e,ref:S,onSelect:n})})}),!!I&&(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:p.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:c("Code that will replace the image `src`"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:c("Image src")}),onChange:ye,ref:V,onSelect:n})})})]})]})};Ll.propTypes={};var Ol=({form:e,elementSettings:i,formFields:l,setElementSettings:s,borderRadiusShow:n,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,linkProtocol:p,mergeTagItems:g,mergeMenuOpen:m,setMergeMenuOpen:_,cascaderRef:E,handleLinkProtocolsChange:b,handleSelect:h,onChange:k,filter:x,renderSearchOption:T,toggleShowBorderRadiusHandler:j,setNewSlide:P})=>{const{__:S}=r.useI18n(),{token:y}=(0,t.ui_kit$useToken)(),V=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(it,{show:p==="#",__:S,style:{marginBottom:y.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:S("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)(tt,{linkProtocol:p,handleLinkProtocolsChange:b,__:S}),placeholder:S("Link for all slides"),allowClear:!0,onSelect:h,prefix:(0,o.jsx)(ot,{linkProtocol:p})})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),V.mergeTagsShow&&g&&(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:y.formItemMarginBottomMD,marginTop:y.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:m?"none":"inline-flex"},onClick:()=>_(!0),children:S("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:E,classNames:{popup:{root:"merge-tags"}},options:g,placeholder:S("Start typing the title"),showSearch:{filter:x,render:T},spellCheck:"false",getPopupContainer:z=>z.closest(".email-pane__collapse-wrapper"),onChange:k,style:{display:m?"block":"none"},open:m,onKeyDown:z=>{z.key==="Escape"&&_(!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:y.formItemMarginBottomMD+4},children:i?.settings?.carouselImages?.map((z,A)=>(0,o.jsx)("div",{className:"carousel__slide",children:(0,o.jsx)(Ll,{elementSettings:l,setElementSettings:s,postfix:"_"+A,form:e,handleSelect:h})},A))})}),(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:y.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:()=>P(),children:S("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:y.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:y.formItemMarginBottomMD-6},children:(0,o.jsx)(t.ui_kit$Switch,{id:"Loop",label:S("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:y.formItemMarginBottomMD-6},children:(0,o.jsx)(t.ui_kit$Switch,{id:"Autoplay",label:S("Autoplay"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),V.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:S("Border radius"),collapsible:!0,open:n,onToggle:j,dividerTop:!0,children:(0,o.jsx)(Io,{form:e,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,elementSettings:i.settings})})]})};Ol.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,formFields:f.default.object,setElementSettings:f.default.func,borderRadiusShow:f.default.bool,oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func,linkProtocol:f.default.string,mergeTagItems:f.default.array,mergeMenuOpen:f.default.bool,setMergeMenuOpen:f.default.func,cascaderRef:f.default.object,handleLinkProtocolsChange:f.default.func,handleSelect:f.default.func,onChange:f.default.func,filter:f.default.func,renderSearchOption:f.default.func,toggleShowBorderRadiusHandler:f.default.func,setNewSlide:f.default.func};var $l=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("p",{children:e("No properties to edit.")})})};$l.propTypes={};var Nd={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 Ad(e){const i={...Ci(e)};return delete i.parent,delete i.path,delete i.nextElem,delete i.prevElem,i}var Fl=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm();let s=r.useDispatch();r.useAppConfig();const n=r.useSendPostMessage(),d=r.useSendPostMessageEx(),{openImagePicker:c}=r.useImagePicker(),p=r.useSelector(r.selectEmailViewType),g=r.useSelector(r.selectMobileViewActive),[m,_]=(0,a.useState)(!0),[E,b]=(0,a.useState)(!0),[h,k]=(0,a.useState)(!1),[x,T]=(0,a.useState)(!1),[j,P]=(0,a.useState)("https://"),[S,y]=(0,a.useState)(l?.getFieldsValue(!0)),[V,z]=(0,a.useState)(e),{remember:A,isOwnEcho:O}=zr(Ad),[w,U]=(0,a.useState)(e);e!==w&&(U(e),O(e?.settings)||z(e));const[J,Q]=(0,a.useState)({name:"",counter:0}),[I,le]=(0,a.useState)(null),[xe,ve]=(0,a.useState)(),[Z,be]=(0,a.useState)(!1),[Ne,de]=(0,a.useState)(!1),[Fe,Ae]=(0,a.useState)({start:0,end:0}),Ge=(0,a.useRef)(null),je=`selected_${V.type}_form_link`,ye=r.useSelector(r.selectIsCodeMode),_e=r.useSelector(r.selectCodeModeDirection),pe=ye&&_e!=="bottom";(0,a.useEffect)(()=>{Z&&Ge.current&&Ge.current.focus()},[Z]);const fe=(L,re)=>{const ce=document.getElementById(re);if(ce){const he=V,Ee=Id(he.type,re),$e=Cd(Ee),Ce=ce.value?.substring(0,Fe.start),Y=ce.value?.substring(Fe.end);let oe={[Ee]:Ce+L+Y};$e?oe={carouselImages:Pd(he.settings?.carouselImages,$e,Ce+L+Y)}:V.type===r.ELEMENT_TYPES.CAROUSEL&&je===re&&(oe={[Ee]:Ce+L+Y,carouselImages:[...V.settings?.carouselImages.map(D=>({...D,link:Ce+L+Y}))||[]]}),n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...V.settings,...oe}}),z(D=>({...D,settings:{...D.settings,...oe}})),l.setFieldValue(Ee,Ce+L+Y),ce.focus(),setTimeout(()=>{ce.selectionStart=Fe.start,ce.selectionEnd=Fe.start+L.length},400),de(!0)}},me=r.useAppConfig().mergeTags;(0,a.useEffect)(()=>{me?.items?.length&&ve(r.mapMargeTags(me.items))},[me,ve]);const K=(L,re)=>{if(be(!1),L){const ce=me.syntax.length>1?xe.findIndex($e=>$e.key===re[0].key):0,he=me.syntax[ce].replace("%value%",L[L.length-1]),Ee=`selected_${V.type}_form${V.type==="carousel"?"_images":""}`;["imgReplacer","title","alt","src","link"].some($e=>I?.getAttribute("id").includes(`${Ee}_${$e}`))||I?.getAttribute("id").includes(je)?fe(he,I?.getAttribute("id")):(l.setFieldValue("imgReplacer",he),n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...V.settings,imgReplacer:he}}),z($e=>({...$e,settings:{...$e.settings,imgReplacer:he}})))}},ee=r.useRootElement();(0,a.useEffect)(()=>{const L=({target:he})=>{he.closest('[id="merge_tags_wrapper"]')||le(he)},re=({target:he})=>{!he.closest(".merge-tags")&&!he.closest("#merge_tags_button")&&be(!1)},ce=new vo.Disposable;return ce.addDisposable(r.addWindowListenerFromShadow(ee,"focusin",L)),ce.addDisposable(r.addWindowListenerFromShadow(ee,"click",re)),()=>{ce.dispose()}},[ee]);const ie=(L,re)=>re.some(ce=>ce.label.toLowerCase().indexOf(L.toLowerCase())>-1),ae=(L,re)=>{const ce=re.map((he,Ee)=>{const $e=he.label.split(new RegExp(`(${L})`,"gi"));return(0,o.jsxs)("span",{children:[Ee!==0&&(0,o.jsx)("span",{children:" / "}),$e.map((Ce,Y)=>Ce.toLowerCase()===L.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:Ce},Y):Ce)]},he.value)});return(0,o.jsx)("div",{title:re.map(he=>he.label).join(" / "),children:ce})};(0,a.useEffect)(()=>{const L=l?.getFieldsValue(!0);y(L)},[l]);const ne=({target:L})=>{if(L&&!Ne){const{selectionStart:re,selectionEnd:ce}=L;Ae({start:re,end:ce})}de(!1)};(0,a.useEffect)(()=>{if(V.settings){const L=V.settings,re=Ci(L);l?.setFieldsValue(re),y(re),L.link&&P(Dt(L.link,"https://")),u(L.borderRadius?.all)||(u(L.borderRadius?.topLeft)||u(L.borderRadius?.bottomLeft)||u(L.borderRadius?.topRight)||u(L.borderRadius?.bottomRight)?_(!1):u(L.borderRadius?.all)||_(!0)),u(L.mobileBorderRadius?.topLeft)||u(L.mobileBorderRadius?.bottomLeft)||u(L.mobileBorderRadius?.topRight)||u(L.mobileBorderRadius?.bottomRight)?b(!1):b(!0),k(!!L.borderRadius?.all||!!L.borderRadius?.topLeft||!!L.borderRadius?.bottomLeft||!!L.borderRadius?.topRight||!!L.borderRadius?.bottomRight),T(!!L.mobileBorderRadius?.all||!!L.mobileBorderRadius?.topLeft||!!L.mobileBorderRadius?.bottomLeft||!!L.mobileBorderRadius?.topRight||!!L.mobileBorderRadius?.bottomRight)}},[l,V]);const Me=L=>{const re=Vr(V.settings,l,L);n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:re.caption,settings:re}),A({...V.settings,...re}),z(ce=>({...ce,settings:{...ce.settings,...re}}))},te=(L,re)=>{const ce=r.stripEmVersionFromUrlString(V.settings?.src||"")===r.stripEmVersionFromUrlString(L||"");(!ce||L!==V.settings?.src)&&Me({src:L}),re?.mode==="save"&&ce&&(Q(he=>({name:"src",counter:he.counter+1})),d(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(L)}))},Te=async L=>{const re=V.settings?.src||"",ce=r.stripEmVersionFromUrlString(re),he=await c({kind:"img",currentUrl:Et(ce)?"":ce,entryModal:L});he?.url&&te(he.url,he.meta)},ke=L=>{const re=L.data.operation;re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?Te(r.MODALS.UPLOAD_IMAGE_MODAL_AI):re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?Te(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?Te(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?Te(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):re===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?Te(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK):re===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(s(r.closeSecondModal()),s(r.closeModal$1()))};r.useListenPostMessage(ke);const M=()=>{setTimeout(()=>{k(L=>!L),l.setFieldValue("borderRadiusAll",h?0:5),n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...V.settings,borderRadius:{all:h?"":5}}}),z(L=>({...L,settings:{...L.settings,borderRadius:{all:h?null:5}}}))})},C=L=>{l.setFieldValue("link",L!=="mergetag"?L:""),P(L)},G=()=>{const{width:L,height:re,renderedWidth:ce,renderedHeight:he}=V?.settings?.carouselImages[0]||{width:{value:600},height:{value:600},renderedWidth:600,renderedHeight:600},Ee={src:"https://emcdn.ru/1865/231031_17_BGU9Mso.png",width:{value:L.value,dim:"px"},height:{value:re.value,dim:"px"},alt:"",title:"",link:null,renderedWidth:ce,renderedHeight:he,imgReplacer:"",mobileWidth:{value:null,dim:"px"},mobileHeight:{value:null,dim:"px"},mobileBorderRadius:{all:null,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}},$e=[...V?.settings?.carouselImages,Ee];n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...V.settings,carouselImages:$e}});const Ce=Al($e);z(Y=>({...Y,settings:{...Y.settings,carouselImages:Ce}}))};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_carousel_form",initialValues:Nd,onValuesChange:Me,autoComplete:"off",className:"element-controls",children:[!pe&&(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"&&g.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)($l,{})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Ol,{form:l,elementSettings:V,formFields:S,setElementSettings:z,borderRadiusShow:h,oneBorderRadiusValue:m,setOneBorderRadiusValue:_,linkProtocol:j,mergeTagItems:xe,mergeMenuOpen:Z,setMergeMenuOpen:be,cascaderRef:Ge,handleLinkProtocolsChange:C,handleSelect:ne,onChange:K,filter:ie,renderSearchOption:ae,toggleShowBorderRadiusHandler:M,setNewSlide:G})})]})};Fl.propTypes={};var Ld={animate:!0,expandSingleSection:!0,sections:[{expanded:!1,index:0}]},Ml=({elementSettings:e})=>{const{__:i}=r.useI18n(),{token:l}=(0,t.ui_kit$useToken)(),[s]=t.ui_kit$Form.useForm(),n=r.useSendPostMessage(),d=r.useAppConfig(),[c,p]=(0,a.useState)(e),[g,m]=(0,a.useState)(e);e!==g&&(m(e),p(e)),(0,a.useEffect)(()=>{if(c.settings){const h=c.settings,k=Ci(h);s?.setFieldsValue(k)}},[s,c]);const _=h=>{const k=Vr(c.settings,s,h);n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:c.type,caption:k.caption,settings:k}),p(x=>({...x,settings:{...x.settings,...k}}))},E=()=>{p(h=>({...h,sections:c?.settings?.sections.push({expanded:!1})})),n({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.")}})},b=h=>{p(k=>({...k,settings:{...k.settings,sections:c.settings.sections?.filter((x,T)=>T!==h)}})),n({operation:r.EVENT_TYPES.SANDBOX_ACCORDION_REMOVE_SECTION,settings:{index:h}})};return(0,o.jsx)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_carousel_form",initialValues:Ld,onValuesChange:_,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((h,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:()=>b(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:()=>E(),children:i(" Add section")})})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"})]})})};Ml.propTypes={};var{Text:Od}=t.ui_kit$Typography,$d="blocks",Dl="text/plain",Fd=(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),Md=(0,o.jsx)("span",{className:"addon-text-content",children:"Title"});function $o(e){return e.closest(".email-pane__collapse-wrapper")}function Xt({form:e,name:i,placeholder:l,usedColors:s,onColorChange:n}){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=>n(i,c)})}var Dd=/^[a-z][a-z0-9+.-]*:/i;function Vl(e){const i=rt(typeof e=="string"?e:String(e??""));return i?Dd.test(i)?i:`https://${i}`:""}function Vd(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 Hd(e){const i=Vl(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 Hl(e,i){if(i===r.MODALS.UPLOAD_IMAGE_MODAL_EDIT&&Et(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 n=await s.blob();return{entryModal:i,currentUrl:"",imageDataUrl:await new Promise((d,c)=>{const p=new FileReader;p.onload=()=>d(p.result),p.onerror=c,p.readAsDataURL(n)})}}}catch{}return{entryModal:r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,currentUrl:""}}return{entryModal:i,currentUrl:e}}function Ud(){const e=r.useSelector(r.selectEditorThemeColor$1),[i,l]=(0,a.useState)(()=>typeof document<"u"&&document.body.classList.contains("dark"));return(0,a.useEffect)(()=>{const s=()=>l(document.body.classList.contains("dark"));s();const n=new MutationObserver(s);return n.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>n.disconnect()},[]),e==="vs-dark"||i?"dark":"light"}function Wd(e){const i=String(e?.bgColor??"").trim();return{blockBgEnabled:!!(e?.bgEnabled&&i),blockBgColor:i}}function Kt(e,i,l){return{...e,buttonBgColor:i,hostCellBgForIconLuminance:String(l??"").trim()}}function Ul(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 Wl(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 qt(e,i){const l=String(e??"").trim(),s=String(i??"").trim();return s||l}function zd(e,i){const l=String(e??"").trim(),s=String(i??"").trim();return!s||l&&s===l?"":s}function Gd(e,i,l){const s=String(e??"").trim(),n=String(i??"").trim(),d=String(l??"").trim();return d&&(!s||d!==s)?d:n}function Yd(e,i){return(e||[]).map(l=>({...l,itemBorderColor:l.customIcon?"":i}))}function Xd(e,i,l){return(e||[]).map(s=>({...s,buttonBgColor:s.customIcon?"":Gd(i,l,s.buttonBgColor)}))}function Kd(e,i){if(e==null)return;const l=(s,n)=>{if(!n||!Object.prototype.hasOwnProperty.call(n,"platform"))return;const d=n.platform;d==null||d===""||i(s,d)};if(Array.isArray(e))e.forEach((s,n)=>{l(n,s)});else if(typeof e=="object")for(const s of Object.keys(e)){const n=Number.parseInt(s,10);Number.isNaN(n)||l(n,e[s])}}function zl({__:e,form:i,fieldName:l,pushSettingsToIframe:s,onMetaActiveChange:n}){const{token:d}=(0,t.ui_kit$useToken)(),c=t.ui_kit$Form.useWatch(["items",l],i),p=c&&typeof c=="object"?c:{},g=typeof p.alt=="string"?p.alt:"",m=typeof p.title=="string"?p.title:"",[_,E]=(0,a.useState)(!1),[b,h]=(0,a.useState)(!1),k=(0,a.useRef)(null),x=(0,a.useRef)(null),T=(0,a.useMemo)(()=>({clearIcon:(0,o.jsx)(t.ui_kit$ColorPickerClearGlyph,{})}),[]);(0,a.useEffect)(()=>{g.trim()&&E(!0)},[g]);const j=!!(g.trim()||_),P=!!(m.trim()||b),S=j||P;(0,a.useLayoutEffect)(()=>{n(l,{alt:j,title:P})},[j,l,n,P]);const y=(0,a.useMemo)(()=>({marginBottom:S?d.formItemMarginBottomXS:0}),[S,d.formItemMarginBottomXS]),V=(0,a.useMemo)(()=>[l,"alt"],[l]),z=(0,a.useMemo)(()=>[l,"title"],[l]),A=S?"selected-social-form__meta-fields":"selected-social-form__meta-fields is-hidden",O=j?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",w=P?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",U=(0,a.useMemo)(()=>g.trim()?g.trim():e("Alternative text"),[e,g]),J=(0,a.useMemo)(()=>m.trim()?m.trim():e("Tooltip text"),[e,m]),Q=(0,a.useMemo)(()=>(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":j}),[j]),I=(0,a.useMemo)(()=>(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":P}),[P]),le=(0,a.useCallback)(Z=>{setTimeout(()=>{const be=Z.current;if(be){if(typeof be.focus=="function"){be.focus();return}be.input&&typeof be.input.focus=="function"&&be.input.focus()}},0)},[]),xe=(0,a.useCallback)(()=>{j?(E(!1),g.trim()&&(i.setFieldValue(["items",l,"alt"],""),setTimeout(()=>s(),0))):(E(!0),le(k))},[j,g,l,le,i,s]),ve=(0,a.useCallback)(()=>{if(P)n(l,{title:!1}),h(!1),m.trim()&&(i.setFieldValue(["items",l,"title"],""),setTimeout(()=>s(),0));else{h(!0),n(l,{title:!0});const Z=g.trim();i.setFieldValue(["items",l,"title"],Z),setTimeout(()=>s(),0),le(x)}},[g,l,le,i,n,s,P,m]);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:y,children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:U,placement:"bottom",getPopupContainer:$o,children:(0,o.jsx)(t.ui_kit$Button,{type:"default",className:Q,onClick:xe,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:J,placement:"bottom",getPopupContainer:$o,children:(0,o.jsx)(t.ui_kit$Button,{type:"default",className:I,onClick:ve,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})})]}),(0,o.jsxs)("div",{className:A,children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:V,className:O,children:(0,o.jsx)(t.ui_kit$Input,{ref:k,placeholder:e("Alternative text"),allowClear:T,prefix:Fd})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:z,className:w,children:(0,o.jsx)(t.ui_kit$Input,{ref:x,placeholder:e("Social network name"),allowClear:T,prefix:Md})})]})]})}zl.propTypes={__:f.default.func.isRequired,form:f.default.object.isRequired,fieldName:f.default.oneOfType([f.default.number,f.default.string]).isRequired,pushSettingsToIframe:f.default.func.isRequired,onMetaActiveChange:f.default.func.isRequired};function qd(e,i){if(!Array.isArray(e)||e.length===0)return i;let l=null;for(const s of e){const n=s.iconWidth;if(n==null||Number.isNaN(n)||n<=0)return i;if(l===null)l=n;else if(n!==l)return i}return l??i}function Jd(e){if(!e)return{align:"center",iconSize:40,borderRadius:0,gap:8,globalBgColor:"",globalItemBorderColor:"",buttonBorderWidth:0,showLabel:!1,items:[]};const i=Wd(e),l=String(e?.hostCellBgForIconLuminance??"").trim(),s=qd(e.items,e.iconSize??40),n=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:Wl(e.items),buttonBorderWidth:n,showLabel:e.showLabel??!1,items:Array.isArray(e.items)?e.items.map(c=>{const p=!!c.customIcon,g=p?"":qt(d,c.buttonBgColor),m=c.platform&&!p?r.getSocialIconForBlockCell(c.platform,Kt(i,g,l)):null;return{...c,customIcon:p,title:String(c.title??"").trim(),...m?{iconSrc:m}:{},iconWidth:null,iconHeight:null,buttonBgColor:g,itemBorderColor:p?"":String(c.itemBorderColor??"").trim()}}):[]}}var Gl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useAppConfig(),s=r.useDispatch(),[n]=t.ui_kit$Form.useForm(),d=r.useSendPostMessage(),c=r.useSendPostMessageEx(),{openImagePicker:p}=r.useImagePicker(),[g,m]=(0,a.useState)(e),[_,E]=(0,a.useState)(null),[b,h]=(0,a.useState)(null),k=(0,a.useRef)(null),x=(0,a.useRef)(null),T=(0,a.useRef)(null),j=(0,a.useRef)(Ul(e)),P=r.useSelector(r.selectEmailSettings),S=(0,a.useRef)(null),y=(0,a.useRef)(!1),V=(0,a.useRef)(""),z=(0,a.useRef)({}),A=Ud(),O=P?.usedColors??[],w=t.ui_kit$Form.useWatch("items",n)||[],U=(0,a.useCallback)(()=>{S.current&&(document.removeEventListener("dragover",S.current,!0),S.current=null)},[]),J=(0,a.useCallback)(()=>{if(S.current)return;const M=C=>{C.preventDefault(),C.dataTransfer&&(C.dataTransfer.dropEffect="move")};document.addEventListener("dragover",M,!0),S.current=M},[]),Q=(0,a.useMemo)(()=>r.getSocialPresetsForBrand($d).filter(M=>r.SOCIAL_ICON_ORIGINAL_BY_PLATFORM[M.id]),[]),I=(0,a.useMemo)(()=>Q.map(M=>({value:M.id,label:(0,o.jsxs)("span",{className:"selected-social-form__platform-option",children:[(0,o.jsx)("img",{src:r.getSocialIcon(M.id,A),alt:""}),(0,o.jsx)("span",{className:"selected-social-form__platform-option-text",children:i(M.labelMsgid)})]})})),[i,Q,A]),le=(0,a.useCallback)((M,C)=>{z.current={...z.current,[M]:{...z.current[M],...C}}},[]);(0,a.useEffect)(()=>{const M=Ul(e);j.current!==M&&(j.current=M,z.current={},m(e))},[e]);const xe=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(g?.settings){if(xe.current){xe.current=!1;return}const M=g.settings;V.current=M.bgEnabled&&M.bgColor?String(M.bgColor).trim():"",n.setFieldsValue(Jd(g.settings))}},[g,n]),(0,a.useEffect)(()=>()=>U(),[U]);const ve=(0,a.useCallback)(()=>{const M=n.getFieldsValue(!0),C=g.settings||{},G=String(C.hostCellBgForIconLuminance??"").trim(),L=(M.globalBgColor||"").trim(),re=typeof M.iconSize=="number"&&!Number.isNaN(M.iconSize)?M.iconSize:C.iconSize??40,ce=typeof M.borderRadius=="number"&&!Number.isNaN(M.borderRadius)?M.borderRadius:C.borderRadius??0,he=typeof M.gap=="number"&&!Number.isNaN(M.gap)?M.gap:C.gap??8,Ee={blockBgEnabled:!!L,blockBgColor:L},$e=(M.globalItemBorderColor||"").trim();let Ce=typeof M.buttonBorderWidth=="number"&&!Number.isNaN(M.buttonBorderWidth)?M.buttonBorderWidth:0;Ce=Math.max(0,Math.min(24,Math.round(Ce)));const Y={...C,type:"social",align:M.align??C.align??"center",iconSize:re,borderRadius:ce,gap:he,bgEnabled:!!L,bgColor:L,hostCellBgForIconLuminance:G,borderWidth:typeof C.borderWidth=="number"?C.borderWidth:0,borderColor:typeof C.borderColor=="string"?C.borderColor:"",buttonBorderColor:"",buttonBorderWidth:Ce,showLabel:M.showLabel,items:(M.items||[]).filter(Boolean).map((oe,D)=>{const ue=!!oe.customIcon,Ie=z.current[D]||{},Ve=ue?"":zd(L,(oe.buttonBgColor||"").trim()),to=typeof oe.href=="string"?Vl(oe.href):oe.href,io=ue?"":qt(L,Ve),uo=!ue&&oe.platform?r.getSocialIconForBlockCell(oe.platform,Kt(Ee,io,G)):null,$=ue?"":$e||String(oe.itemBorderColor??"").trim(),se=Vd(ue?oe.iconSrc||"":uo||oe.iconSrc||"");return{...oe,customIcon:ue,href:to,iconSrc:se,iconWidth:null,iconHeight:null,buttonBgColor:Ve,itemBorderColor:$,title:Ie.title?String(oe.title??"").trim():""}})};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.SOCIAL,caption:g.caption,settings:Y}),V.current=L,xe.current=!0,m(oe=>({...oe,settings:Y}))},[g.caption,g.settings,n,d]),Z=(0,a.useCallback)(M=>{if(M==null||M==="")return-1;const C=r.stripEmVersionFromUrlString(String(M));return(n.getFieldValue("items")||[]).findIndex(G=>r.stripEmVersionFromUrlString(G&&G.iconSrc||"")===C)},[n]),be=(0,a.useCallback)((M,C,G,L)=>{const re=[...n.getFieldValue("items")||[]];if(M<0||M>=re.length)return;const ce=r.stripEmVersionFromUrlString(String(L||""))===r.stripEmVersionFromUrlString(String(C||""));(!ce||C!==re[M]?.iconSrc)&&(re[M]={...re[M],iconSrc:C,customIcon:!0,buttonBgColor:"",itemBorderColor:""},n.setFieldValue("items",re),setTimeout(()=>ve(),0)),G?.mode==="save"&&ce&&c(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(C)})},[n,ve,c]),Ne=(0,a.useCallback)(async(M,C)=>{const G=r.stripEmVersionFromUrlString(String(C||"")),L=Z(C);if(L<0)return;const re=(n.getFieldValue("items")||[])[L]?.iconSrc,{entryModal:ce,currentUrl:he,imageDataUrl:Ee}=await Hl(G,M),$e=await p({kind:"img",currentUrl:he,entryModal:ce,imageDataUrl:Ee});$e?.url&&be(L,$e.url,$e.meta,re)},[be,Z,n,p]),de=(0,a.useCallback)(async M=>{const C=(n.getFieldValue("items")||[])[M];if(!C)return;const{entryModal:G,currentUrl:L,imageDataUrl:re}=await Hl(r.stripEmVersionFromUrlString(String(C.iconSrc||"")),r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD),ce=C.iconSrc,he=await p({kind:"img",currentUrl:L,entryModal:G,imageDataUrl:re});he?.url&&be(M,he.url,he.meta,ce)},[be,n,p]),Fe=(0,a.useCallback)(M=>{const C=parseInt(M.currentTarget.dataset.socialEditIndex??"",10);Number.isNaN(C)||de(C)},[de]),Ae=(0,a.useCallback)(M=>{const C=M.data?.operation,G=M.data?.src;C===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?Ne(r.MODALS.UPLOAD_IMAGE_MODAL_AI,G):C===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?Ne(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,G):C===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?Ne(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT,G):C===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?Ne(r.MODALS.UPLOAD_IMAGE_MODAL_GIF,G):C===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?Ne(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK,G):C===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(s(r.closeSecondModal()),s(r.closeModal$1()))},[s,Ne]);r.useListenPostMessage(Ae);const Ge=(0,a.useCallback)(()=>{const M=n.getFieldValue("items")||[],C=Q[0],G=(n.getFieldValue("globalItemBorderColor")||"").trim(),L=(n.getFieldValue("globalBgColor")||"").trim();if(!C)n.setFieldsValue({items:[...M,{platform:void 0,customIcon:!1,href:"",alt:"",title:"",iconSrc:"",iconWidth:null,iconHeight:null,buttonBgColor:L,itemBorderColor:G}]});else{const re=String(g?.settings?.hostCellBgForIconLuminance??"").trim(),ce=qt(L,L),he=r.getSocialIconForBlockCell(C.id,Kt({blockBgEnabled:!!L,blockBgColor:L},ce,re)),Ee=i(C.labelMsgid);n.setFieldsValue({items:[...M,{platform:C.id,customIcon:!1,href:"",alt:Ee,title:"",iconSrc:he,iconWidth:null,iconHeight:null,buttonBgColor:L,itemBorderColor:G}]})}setTimeout(()=>ve(),0)},[i,g?.settings?.hostCellBgForIconLuminance,n,Q,ve]),je=(0,a.useCallback)((M,C)=>{M.dataTransfer.setData(Dl,String(C)),M.dataTransfer.setData(r.DND_SOCIAL_LIST_REORDER_MIME,String(C)),M.dataTransfer.effectAllowed="move",k.current=C,E(C),J()},[J]),ye=(0,a.useCallback)(()=>{U(),k.current=null,E(null),h(null)},[U]),_e=(0,a.useCallback)((M,C,G)=>{if(G<2)return;M.preventDefault(),M.dataTransfer.dropEffect="move";const L=k.current;L!==null&&L!==C&&h(C)},[]),pe=(0,a.useCallback)((M,C)=>{M.currentTarget.contains(M.relatedTarget)||h(G=>G===C?null:G)},[]),fe=(0,a.useCallback)((M,C,G)=>{M.preventDefault(),h(null);const L=M.dataTransfer.getData(Dl),re=parseInt(L,10);if(Number.isNaN(re)||re===C){U();return}G(re,C),U(),setTimeout(()=>ve(),0)},[U,ve]),me=(0,a.useCallback)(M=>{const C=M.currentTarget,G=parseInt(C.dataset.itemIndex??"",10);Number.isNaN(G)||je(M,G)},[je]),K=(0,a.useCallback)(M=>{const C=M.currentTarget,G=parseInt(C.dataset.itemIndex??"",10),L=parseInt(C.dataset.listLength??"",10);Number.isNaN(G)||Number.isNaN(L)||L<2||(M.preventDefault(),M.dataTransfer&&(M.dataTransfer.dropEffect="move"))},[]),ee=(0,a.useCallback)(M=>{const C=M.currentTarget,G=parseInt(C.dataset.itemIndex??"",10),L=parseInt(C.dataset.listLength??"",10);Number.isNaN(G)||Number.isNaN(L)||_e(M,G,L)},[_e]),ie=(0,a.useCallback)(M=>{const C=parseInt(M.currentTarget.dataset.itemIndex??"",10);Number.isNaN(C)||pe(M,C)},[pe]),ae=(0,a.useCallback)(M=>{const C=parseInt(M.currentTarget.dataset.itemIndex??"",10),G=x.current;Number.isNaN(C)||typeof G!="function"||fe(M,C,G)},[fe]),ne=(0,a.useCallback)(M=>{M.stopPropagation();const C=parseInt(M.currentTarget.dataset.fieldName??"",10),G=T.current;Number.isNaN(C)||typeof G!="function"||(G(C),queueMicrotask(ve))},[ve]),Me=(0,a.useCallback)((M,C)=>{const G=Q.find(Y=>Y.id===C);if(!G)return;const L=i(G.labelMsgid),re=z.current[M]||{},ce=String(n.getFieldValue(["items",M,"alt"])??"").trim();(re.alt||ce)&&n.setFieldValue(["items",M,"alt"],L),re.title&&n.setFieldValue(["items",M,"title"],L);const he=(n.getFieldValue("globalBgColor")||"").trim(),Ee=qt(he,(n.getFieldValue(["items",M,"buttonBgColor"])||"").trim()),$e=String(g?.settings?.hostCellBgForIconLuminance??"").trim(),Ce=r.getSocialIconForBlockCell(C,Kt({blockBgEnabled:!!he,blockBgColor:he},Ee,$e));Ce&&(n.setFieldValue(["items",M,"customIcon"],!1),n.setFieldValue(["items",M,"iconSrc"],Ce))},[i,g?.settings?.hostCellBgForIconLuminance,n,Q]),te=(0,a.useCallback)(M=>{if(Object.prototype.hasOwnProperty.call(M,"globalItemBorderColor")){if(!y.current){const C=String(M.globalItemBorderColor??"").trim(),G=n.getFieldValue("items")||[];n.setFieldsValue({items:Yd(G,C)})}}else if(Object.prototype.hasOwnProperty.call(M,"globalBgColor")){const C=V.current,G=String(M.globalBgColor??"").trim(),L=n.getFieldValue("items")||[];n.setFieldsValue({items:Xd(L,C,G)})}else if(M?.items!=null){const C=n.getFieldValue("items")||[],G=Wl(C);G!==(n.getFieldValue("globalItemBorderColor")||"").trim()&&(y.current=!0,n.setFieldValue("globalItemBorderColor",G),queueMicrotask(()=>{y.current=!1}));const L=g.settings?.items||[];C.forEach((re,ce)=>{const he=re?.platform,Ee=L[ce]?.platform;he&&he!==Ee&&Me(ce,he)})}Kd(M?.items,Me),ve()},[g.settings?.items,n,ve,Me]),Te=(0,a.useCallback)((M,C)=>{if(n.setFieldValue(M,C),Array.isArray(M)&&M[0]==="items"){te({items:{[M[1]]:{[M[2]]:C}}});return}te({[M]:C})},[n,te]),ke=(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)(Go,{form:n,elementSettings:{...g,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:$o,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:$o,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:$o,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:$o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"globalBgColor",className:"form-item-margin-xs",children:(0,o.jsx)(Xt,{form:n,name:"globalBgColor",placeholder:i("Background color"),usedColors:O,onColorChange:Te})})})})]}),(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:$o,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:$o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"globalItemBorderColor",className:"form-item-margin-xs",children:(0,o.jsx)(Xt,{form:n,name:"globalItemBorderColor",placeholder:i("Border color"),usedColors:O,onColorChange:Te})})})})]})]}),(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:(M,{remove:C,move:G})=>(x.current=G,T.current=C,(0,o.jsx)("div",{className:"selected-social-form__items",children:M.map((L,re)=>{const ce=!!(w[re]?.customIcon??w[L.name]?.customIcon);return(0,o.jsxs)("div",{className:(0,Ke.default)("selected-social-form__card",_===re&&"selected-social-form__card--dragging",b===re&&_!==re&&"selected-social-form__card--drag-over"),"data-item-index":re,"data-list-length":M.length,onDragEnterCapture:K,onDragOverCapture:ee,onDragLeave:ie,onDropCapture:ae,children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head",children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head-main",children:[M.length>1?(0,o.jsx)("span",{className:"selected-social-form__drag-handle",draggable:!0,"data-item-index":re,onDragStart:me,onDragEnd:ye,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)(Od,{className:"selected-social-form__card-title",children:[i("Button")," ",re+1]})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("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:l.iconStrokeWidth}),"aria-label":i("Delete"),"data-field-name":L.name,onClick:ne})})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[L.name,"iconSrc"],hidden:!0,children:(0,o.jsx)(t.ui_kit$Input,{})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[L.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:[L.name,"platform"],className:"selected-social-form__platform-field selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:I,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:$o,children:(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"selected-social-form__platform-edit","data-social-edit-index":re,icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,size:18,strokeWidth:l.iconStrokeWidth}),"aria-label":i("Edit icon"),onClick:Fe})})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[L.name,"href"],className:"selected-social-form__card-field",rules:[{required:!0,whitespace:!0,message:i("Please enter the URL.")},{validator:async(he,Ee)=>{const $e=typeof Ee=="string"?Ee.trim():String(Ee??"").trim();if($e&&!Hd($e))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,{})}})}),ce?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:$o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:[L.name,"buttonBgColor"],className:"selected-social-form__card-field",children:(0,o.jsx)(Xt,{form:n,name:["items",L.name,"buttonBgColor"],placeholder:i("Background color"),usedColors:O,onColorChange:Te})})})}),(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:$o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:[L.name,"itemBorderColor"],className:"selected-social-form__card-field",children:(0,o.jsx)(Xt,{form:n,name:["items",L.name,"itemBorderColor"],placeholder:i("Border color"),usedColors:O,onColorChange:Te})})})})]}),(0,o.jsx)(zl,{__:i,form:n,fieldName:L.name,pushSettingsToIframe:ve,onMetaActiveChange:le})]},L.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:Ge,children:i("Add button")})]})]});return(0,o.jsx)("div",{className:"selected-social-form",children:(0,o.jsx)(t.ui_kit$Form,{form:n,layout:"vertical",className:"selected-social-form__form element-controls",onValuesChange:te,autoComplete:"off",children:(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:ke})})})};Gl.propTypes={elementSettings:f.default.shape({settings:f.default.object,type:f.default.string,caption:f.default.string})};var jt=["borderAll","borderTop","borderRight","borderBottom","borderLeft"],Yl=["all","top","right","bottom","left"],Mi={width:1,style:"solid",color:"#E5E5E5"},Xl=["All","TopLeft","TopRight","BottomRight","BottomLeft"],so=e=>u(e),Oo=e=>e!==""&&e!==null&&e!==void 0;function wt(e,i=""){return typeof e=="number"?String(e):typeof e=="string"&&e?e:i}function Jt(e){return Oo(e?.width)||!!e?.style||!!e?.color}function Kl(e){const i=jt.find(l=>e[l]?.style);return i?e[i]:null}function Di(e){return Kl(e)??Mi}function Vi(e,i){const l=Yl.find(n=>Jt(i[n]))??"all",s=Jt(i[l])?i[l]:Kl(e)??{};return{mobileBorderPosition:l,mobileBorderWidth:s.width??"",mobileBorderColor:s.color??"",mobileBorderStyle:s.style??""}}var Qd=e=>so(e?.replace(/px$/,""));function ql(e,i){return Object.fromEntries(["LeftRight","TopBottom","Left","Right","Top","Bottom"].map(l=>{const s=`${i}padding${l}`;return[s,Qd(e[s])]}))}function Zd(e){return{borderRadiusAll:so(e.all),borderRadiusTopLeft:so(e.topLeft),borderRadiusTopRight:so(e.topRight),borderRadiusBottomRight:so(e.bottomRight),borderRadiusBottomLeft:so(e.bottomLeft)}}function ec(e){const i=l=>so(l!==null?l:e.all);return{mobileBorderRadiusAll:so(e.all),mobileBorderRadiusTopLeft:i(e.topLeft),mobileBorderRadiusTopRight:i(e.topRight),mobileBorderRadiusBottomRight:i(e.bottomRight),mobileBorderRadiusBottomLeft:i(e.bottomLeft)}}function Jl(e,i){return{[`${i}Inset`]:so(e?.inset)||!1,[`${i}HOffset`]:so(e?.hOffset),[`${i}VOffset`]:so(e?.vOffset),[`${i}BlurRadius`]:so(e?.blurRadius),[`${i}SpreadRadius`]:so(e?.spreadRadius),[`${i}Color`]:so(e?.color)}}function Ql(e,i){return Object.fromEntries(jt.map(l=>[`${i}${l}`,e[`${i}${l}`]]))}function oc(e){return{fontFamily:so(e.fontFamily),fontSize:so(e.fontSize),lineHeight:so(e.lineHeight),textStrong:so(e.textStrong),textItalic:so(e.textItalic),textStrikethrough:so(e.textStrikethrough),textUnderline:so(e.textUnderline),textLink:so(e.textLink),linkHref:so(e.linkHref),linkTarget:so(e.linkTarget),textColor:so(e.textColor),textBackgroundColor:so(e.textBackgroundColor),textAlign:so(e.textAlign),valign:so(e.textValign)}}function Zl(e){const i=e.customTable,l=i.mobileBackgroundColor;return{show:e.show||"all",outlookBackground:e.outlookBackground,...nt(e),mobileBackgroundColor:so(l?.value!=="none"?l?.value:""),...ql(i,""),...ql(i,"cell_"),backgroundColor:so(i.backgroundColor),backgroundImage:so(i.backgroundImage?.[0]?.value),backgroundPositionX:so(i.backgroundPositionX),backgroundPositionY:so(i.backgroundPositionY),backgroundRepeat:so(i.backgroundRepeat),backgroundSize:so(i.backgroundSize),...Ql(i,""),borderPosition:i.borderPosition||"borderAll",...Ql(i,"cell_"),cell_borderPosition:i.cell_borderPosition||"cell_borderAll",cellBackgroundColor:so(i.cellBackgroundColor),...Zd(i.borderRadius),...Jl(i.boxShadow,"boxShadow"),...Jl(i.mobileBoxShadow,"mobileBoxShadow"),mobileWidth:Bo(i.mobileWidth?.value),mobileWidthDim:i.mobileWidth?.dim,mobileHeight:Bo(i.mobileHeight?.value),mobileHeightDim:i.mobileHeight?.dim,...ec(i.mobileBorderRadius),...Vi(i,i.mobileBorder),...oc(i)}}function es(e,i){return Xl.some(l=>Number(e[`${i}Radius${l}`])>0)}function os(e,i){return["Color","HOffset","VOffset"].some(l=>Oo(e[`${i}${l}`]))}function tc(e){const i=e.mobileBackgroundRepeat;return["mobileBackgroundColor","mobileBackgroundImage","mobileBackgroundPositionX","mobileBackgroundPositionY"].some(l=>Oo(e[l]))||Oo(i)&&i!=="none"||Oo(e.mobileBackgroundSize)}function ts(e,i,l,s){switch(e){case"border":return jt.some(n=>!!i[`${s?"cell_":""}${n}`]?.style);case"background":return s?Oo(i.cellBackgroundColor):Oo(i.backgroundColor)||Oo(i.backgroundImage);case"borderRadius":return es(i,"border");case"boxShadow":return os(i,"boxShadow");case"mobileSize":return Oo(i.mobileWidth)||Oo(i.mobileHeight);case"mobileBackground":return tc(i);case"mobileBorder":return Yl.some(n=>Jt(l[n]));case"mobileBorderRadius":return es(i,"mobileBorder");case"mobileBoxShadow":return os(i,"mobileBoxShadow");default:return!1}}var is=["background","border","borderRadius","boxShadow","mobileSize","mobileBackground","mobileBorder","mobileBorderRadius","mobileBoxShadow"];function rs(e,i,l){const s={padding:!0,cellPadding:!0,background:!1,border:!1,borderRadius:!1,boxShadow:!1,mobileSize:!1,mobileBackground:!1,mobileBorder:!1,mobileBorderRadius:!1,mobileBoxShadow:!1};return is.forEach(n=>{s[n]=ts(n,e,i,l)}),s}function ic(e,i){const l={...e};return is.forEach(s=>{l[s]=e[s]||i[s]}),l}function Qt(e,i){const l=i==="mobile"?"mobileBorderRadius":"borderRadius",[s,...n]=Xl.map(d=>e[`${l}${d}`]);return!!s||!n.some(d=>!!d)}var rc=["borderRadius","mobileWidth","mobileHeight","mobileBoxShadow","mobileBorder","mobileBorderRadius"],lc=["textStrong","textItalic","textStrikethrough","textUnderline","textLink","linkHref","textAlign"];function ls(e,i){return Object.fromEntries(i.map(l=>[l,e[l]]))}function sc(e){return{...e,...ls(e.customTable,rc)}}function ac(e){return{...e,...ls(e.customTable,lc),valign:e.customTable.textValign}}var Zt={hOffset:5,vOffset:5,blurRadius:10,spreadRadius:-5,color:"#000000",inset:!1},ei={hOffset:null,vOffset:null,blurRadius:null,spreadRadius:null,inset:!1},oi=5,ti="#E5E5E5",ss="em-mob-box_shadow-",as="em-mob-border_radius_all-",nc={width:"",style:"",color:""},dc=["LeftRight","TopBottom","Left","Right","Top","Bottom"],ns=["All","TopLeft","TopRight","BottomRight","BottomLeft"],cc=["backgroundColor","backgroundImage","backgroundPositionX","backgroundPositionY","backgroundRepeat","backgroundSize"];function ii(e,i){return{[`${e}Inset`]:i.inset??!1,[`${e}HOffset`]:i.hOffset??null,[`${e}VOffset`]:i.vOffset??null,[`${e}BlurRadius`]:i.blurRadius??null,[`${e}SpreadRadius`]:i.spreadRadius??null,[`${e}Color`]:i.color??""}}var vt=(e,i="")=>Object.fromEntries(e.map(l=>[l,i])),uc={padding:{off:()=>({fields:vt(dc.map(e=>`padding${e}`)),settings:{padding:{all:0}}})},background:{on:({prefix:e})=>{const i=e?"cellBackgroundColor":"backgroundColor";return{fields:{[i]:ti},settings:{[i]:ti}}},off:({prefix:e})=>e?{fields:{cellBackgroundColor:""},settings:{cellBackgroundColor:""}}:{fields:vt(cc),backgroundImageEmpty:!0,settings:{backgroundColor:"",backgroundImage:[{type:"url",value:""}],backgroundRepeat:"",backgroundSize:""}}},border:{on:({prefix:e})=>({fields:{[`${e}borderPosition`]:`${e}borderAll`,[`${e}borderAll`]:Mi},settings:{[`${e}borderAll`]:Mi}}),off:({prefix:e})=>({fields:vt(jt.map(i=>`${e}${i}`),nc),settings:{[`${e}borderAll`]:{style:""}}})},borderRadius:{on:()=>({fields:{borderRadiusAll:oi},settings:{borderRadius:{all:oi}},uniformRadius:"desktop"}),off:()=>({fields:vt(ns.map(e=>`borderRadius${e}`)),settings:{borderRadius:{all:0}},uniformRadius:"desktop"})},boxShadow:{on:()=>({fields:ii("boxShadow",Zt),settings:{boxShadow:Zt}}),off:()=>({fields:ii("boxShadow",ei),settings:{boxShadow:{...ei,color:""}}})},mobileSize:{off:({fields:e})=>({fields:{mobileWidth:"",mobileHeight:""},settings:{mobileWidth:{value:null,dim:wt(e.mobileWidthDim,"px"),classNamePrefix:"em-mob-width-"},mobileHeight:{value:null,dim:"px",classNamePrefix:"em-mob-height-"}}})},mobileBackground:{on:()=>({fields:{mobileBackgroundColor:ti},settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:ti}}}),off:()=>({fields:{...nt({}),mobileBackgroundColor:""},settings:ol()})},mobileBorder:{on:({settings:e})=>{const i={...Di(e.customTable),classNamePrefix:"em-mob-border_all-"},l={...r.RESET_BORDER_PARAMS,all:i};return{fields:Vi(e.customTable,l),settings:{mobileBorder:{all:i}},mobileBorders:l}},off:({settings:e})=>({fields:Vi(e.customTable,r.RESET_BORDER_PARAMS),settings:{mobileBorder:r.RESET_BORDER_PARAMS},mobileBorders:r.RESET_BORDER_PARAMS})},mobileBorderRadius:{on:()=>({fields:{mobileBorderRadiusAll:oi},settings:{mobileBorderRadius:{all:oi,classNamePrefix:as}},uniformRadius:"mobile"}),off:()=>({fields:vt(ns.map(e=>`mobileBorderRadius${e}`)),settings:{mobileBorderRadius:{all:null,classNamePrefix:as}},uniformRadius:"mobile"})},mobileBoxShadow:{on:()=>({fields:ii("mobileBoxShadow",Zt),settings:{mobileBoxShadow:{...Zt,classNamePrefix:ss}}}),off:()=>({fields:ii("mobileBoxShadow",ei),settings:{mobileBoxShadow:{...ei,color:null,classNamePrefix:ss}}})}},mc=["padding","cellPadding","background","border","borderRadius","boxShadow","mobileSize","mobileBackground","mobileBorder","mobileBorderRadius","mobileBoxShadow"];function pc(e,i,l){const s=c=>`${i}padding${c}`;if(l){const[c,p]=[e[s("LeftRight")],e[s("TopBottom")]];return{fields:{[s("Left")]:c,[s("Right")]:c,[s("Top")]:p,[s("Bottom")]:p}}}const[n,d]=[e[s("Left")],e[s("Top")]];return{fields:{[s("LeftRight")]:n,[s("TopBottom")]:d,[s("Right")]:n,[s("Bottom")]:d},settings:{[`${i}padding`]:{top:d,bottom:d,left:n,right:n}}}}function hc(e){const{form:i,settings:l,send:s,isTableCells:n,mobileBorders:d,setMobileBorders:c,setBackgroundImageEmpty:p}=e,g=(0,a.useMemo)(()=>Zl(l),[l]),[m,_]=(0,a.useState)(()=>rs(g,l.customTable.mobileBorder,n)),[E,b]=(0,a.useState)(!0),[h,k]=(0,a.useState)(()=>Qt(g,"desktop")),[x,T]=(0,a.useState)(()=>Qt(g,"mobile"));(0,a.useEffect)(()=>{_(y=>ic(y,rs(g,l.customTable.mobileBorder,n))),k(Qt(g,"desktop")),T(Qt(g,"mobile"))},[g,l,n]);const j=n?"cell_":"",P=(0,a.useMemo)(()=>{const y=z=>{z&&(z.fields&&i.setFieldsValue(z.fields),z.mobileBorders&&c(z.mobileBorders),z.backgroundImageEmpty!==void 0&&p?.(z.backgroundImageEmpty),z.uniformRadius&&(z.uniformRadius==="mobile"?T:k)(!0),z.settings&&s(z.settings))},V=z=>{const A=i.getFieldsValue(!0),O=uc[z],w={fields:A,settings:l,prefix:j};m[z]?y(O?.off?.(w)):ts(z,A,d,n)||y(O?.on?.(w)),_(U=>({...U,[z]:!U[z]}))};return Object.fromEntries(mc.map(z=>[z,()=>V(z)]))},[i,l,s,n,d,c,p,m,j]);return{open:m,toggle:P,paddingsExt:E,togglePaddingMode:()=>{const y=pc(i.getFieldsValue(!0),j,E);i.setFieldsValue(y.fields??{}),y.settings&&s(y.settings),b(!E)},oneBorderRadiusValue:h,setOneBorderRadiusValue:k,oneMobileBorderRadiusValue:x,setOneMobileBorderRadiusValue:T}}var ri={width:"",style:"",color:""},bc="em-mob-box_shadow-",ds={mobileBorderWidth:"width",mobileBorderStyle:"style",mobileBorderColor:"color"},gc=(e,i)=>({settings:{[e]:i}});function cs(e,i){return{hOffset:e[`${i}HOffset`],vOffset:e[`${i}VOffset`],blurRadius:e[`${i}BlurRadius`],spreadRadius:e[`${i}SpreadRadius`],color:e[`${i}Color`],inset:e[`${i}Inset`]}}var li=e=>`em-mob-border_${e}-`,It=e=>({...r.RESET_BORDER_PARAMS[e],classNamePrefix:li(e)});function us(){return{top:It("top"),right:It("right"),bottom:It("bottom"),left:It("left")}}var fc=e=>e?.width!=null&&e?.style!=null&&e?.color!=null;function _c(e){const i=l=>({...e,classNamePrefix:li(l)});return{top:i("top"),right:i("right"),bottom:i("bottom"),left:i("left")}}function xc(e,i,l,s){const n=Di(s.settings.customTable),d=(c,p)=>{const g=c===i?l:e[p];return Oo(g)?g:n[c]};return{width:d("width","mobileBorderWidth"),style:d("style","mobileBorderStyle"),color:d("color","mobileBorderColor")}}var kc=(e,i,l,s)=>{const n=l.mobileBorderPosition||"all",d=ds[e],c=s.mobileBorders;if(!Oo(i)){const m=n==="all"?{...us(),all:{...c.all,[d]:null,classNamePrefix:li("all")}}:{...c,[n]:It(n),all:{...r.RESET_BORDER_PARAMS.all}};return{settings:{mobileBorder:m},mobileBorders:m}}const p={...xc(l,d,i,s),classNamePrefix:li(n)},g=n==="all"?{...us(),all:p}:{...c,...fc(c.all)?_c(c.all):{},[n]:p,all:{...r.RESET_BORDER_PARAMS.all}};return{settings:{mobileBorder:g},mobileBorders:g,fields:{mobileBorderWidth:p.width,mobileBorderStyle:p.style,mobileBorderColor:p.color}}},Ec=(e,i,l,s)=>{const n=s.mobileBorders[i],d=Jt(n)?n:Di(s.settings.customTable);return{fields:{mobileBorderWidth:d.width??"",mobileBorderColor:d.color??"",mobileBorderStyle:d.style??""}}},Bc=(e,i,l)=>{if(i?.style==="")return{settings:{[e]:i},fields:{[e]:ri}};const s=l[e]??{},n=l.borderAll??{},d={...s,width:s.width===""?n.width||"1":s.width,color:s.color===""?n.color||"#b9b1b1":s.color,style:s.style===""?n.style||"solid":s.style};return{settings:{[e]:i},fields:{[e]:d,borderAll:ri}}},Sc=(e,i)=>{const l=jt.filter(n=>n!=="borderAll"),s=i?.style===""?{borderAll:ri}:Object.fromEntries(l.map(n=>[n,ri]));return{settings:{[e]:i},fields:s}},Ho=(e,i)=>Object.fromEntries(e.map(l=>[l,i])),Hi=(e,i)=>i.map(l=>e+l),Tc=["textAlign","valign"],ms=["Inset","HOffset","VOffset","BlurRadius","SpreadRadius","Color"],Rc=["Color","Image","PositionX","PositionY","Repeat","Size"],yc={...Ho(Hi("boxShadow",ms),(e,i,l)=>({settings:{boxShadow:cs(l,"boxShadow")}})),...Ho(Hi("mobileBoxShadow",ms),(e,i,l)=>({settings:{mobileBoxShadow:{...cs(l,"mobileBoxShadow"),classNamePrefix:bc}}})),...Ho(Object.keys(W.BORDER_RADIUS_POSITION),(e,i)=>({settings:{borderRadius:{[W.BORDER_RADIUS_POSITION[e]]:+i}}})),...Ho(Object.keys(W.MOBILE_BORDER_RADIUS_POSITION),(e,i)=>{const l=W.MOBILE_BORDER_RADIUS_POSITION[e];return{settings:{mobileBorderRadius:{[l]:i,classNamePrefix:`em-mob-border_radius_${l}-`}}}}),...Ho(Hi("mobileBackground",Rc),(e,i)=>{const l=St({[e]:i});return l?{settings:l}:{}}),...Ho(Object.keys(ds),kc),...Ho(["borderTop","borderRight","borderBottom","borderLeft"],Bc),...Ho(["fontSize","lineHeight"],(e,i)=>Oo(i)?{settings:{[e]:i}}:{}),...Ho(Tc,()=>({})),borderAll:Sc,borderPosition:()=>({}),mobileBorderPosition:Ec,backgroundImage:(e,i,l,s)=>({settings:{backgroundImage:[{...s.settings.customTable.backgroundImage?.[0],type:"url",value:wt(i)}],...i?{backgroundSize:"cover"}:{}},backgroundImageEmpty:i===""}),mobileWidth:(e,i,l)=>({settings:{mobileWidth:{classNamePrefix:"em-mob-width-",value:i,dim:wt(l.mobileWidthDim)}}}),mobileWidthDim:(e,i,l)=>({settings:{mobileWidth:{classNamePrefix:"em-mob-width-",value:l.mobileWidth||100,dim:wt(i)}}}),mobileHeight:(e,i,l)=>({settings:{mobileHeight:{classNamePrefix:"em-mob-height-",value:i,dim:wt(l.mobileHeightDim)}}}),linkHref:(e,i)=>{const l=rt(i);return{settings:{linkHref:l},linkHref:l,...l!==i?{fields:{linkHref:l}}:{}}}};function jc(e,i,l){const[s]=Object.keys(e);return s?(yc[s]??gc)(s,e[s],i,l):{}}function wc(e){const{form:i,settings:l,send:s,mobileBorders:n,setMobileBorders:d,setBackgroundImageEmpty:c,onLinkHref:p}=e;return(0,a.useCallback)(g=>{const m=jc(g,i.getFieldsValue(!0),{settings:l,mobileBorders:n});m.fields&&i.setFieldsValue(m.fields),m.mobileBorders&&d(m.mobileBorders),m.backgroundImageEmpty!==void 0&&c(m.backgroundImageEmpty),m.linkHref!==void 0&&p(m.linkHref),m.settings&&s(m.settings)},[i,l,s,n,d,c,p])}function vc(e){const i=e.customTable.mobileBorder,[l,s]=(0,a.useState)(i);return(0,a.useEffect)(()=>s(i),[i]),[l,s]}function Ic(e,i){return(0,a.useCallback)(l=>e({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i,settings:l}),[e,i])}var dt=["hover"],ps={width:"100%"},hs={paddingBottom:4},Cc={textAlign:"right"},Ui=e=>e.parentNode,Pc=e=>e.closest(".selected-element-panel"),Nc=e=>e.closest(".email-pane__collapse-wrapper"),Ac=({elementSettings:e,__:i,token:l,sendAction:s,typografItems:n})=>{const d=W.useGoogleFontsLoader(),c=(0,a.useMemo)(()=>({marginBottom:l.formItemMarginBottomXS}),[l.formItemMarginBottomXS]),p=(0,a.useMemo)(()=>({items:n}),[n]),g=(0,a.useCallback)(()=>s("add_img"),[s]),m=(0,a.useCallback)(()=>s("typograf"),[s]);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,{name:"AddImage",style:c,children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"AddImage",component:t.icons$AddImage}),onClick:g,style:ps,children:i("Add image")})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"Typography",style:c,children:(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,menu:p,trigger:dt,placement:"bottom",getPopupContainer:Pc,children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Typograf",component:t.icons$Typograf}),onClick:m,style:ps,children:i("Typography")})})})})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:dt,title:i("Text font"),placement:"bottom",zIndex:1,getPopupContainer:Ui,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:d,getPopupContainer:Nc})})}),!e.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:dt,title:i("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: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:dt,title:i("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:i("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]})]})},Lc=({elementSettings:e,__:i,token:l,textInputRef:s,linkProtocol:n,handleLinkProtocolsChange:d})=>{const c=!!e.customTable?.isNewLink,p=(0,a.useMemo)(()=>({marginBottom:l.formItemMarginBottomXS}),[l.formItemMarginBottomXS]);return(0,a.useEffect)(()=>{c&&s.current?.focus()},[c,s]),(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsxs)(t.ui_kit$Col,{span:24,children:[(0,o.jsx)(it,{show:n==="#",__:i,style:p}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:dt,title:i("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:s,addonBefore:(0,o.jsx)(tt,{linkProtocol:n,handleLinkProtocolsChange:d,__:i}),allowClear:!0,placeholder:i("Hyperlink URL"),prefix:(0,o.jsx)(ot,{linkProtocol:n})})})})]})})},Oc=({form:e,elementSettings:i,__:l,token:s,isMacOS:n,formValues:d,textInputRef:c,linkProtocol:p,handleLinkProtocolsChange:g})=>(0,o.jsxs)(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)(no,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:l(n?"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)(no,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:l(n?"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)(no,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:l(n?"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)(no,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:l(n?"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)(no,{form:e,className:(0,Ke.default)("selected-text-common-form__button selected-text-common-form__button_style",{"selected-text-common-form__button--active":!!i.textLink}),elementSettings:i,name:"textLink",tooltipTitle:l("Link"),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"})})})]}),d?.textLink&&(0,o.jsx)(Lc,{elementSettings:i,__:l,token:s,textInputRef:c,linkProtocol:p,handleLinkProtocolsChange:g})]}),$c=({form:e,elementSettings:i,__:l})=>{const s=(0,a.useMemo)(()=>[{message:l("Please set the font color")}],[l]),n=(0,a.useMemo)(()=>[{message:l("Please set the background color")}],[l]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:hs,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:dt,title:l("Text color"),placement:"bottom",zIndex:2,getPopupContainer:Ui,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:s,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:dt,title:l("Text background"),placement:"bottom",zIndex:2,getPopupContainer:Ui,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:n,children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l("Background color"),usedColors:i.usedColors})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:hs,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(st,{form:e,elementSettings:i,name:"textAlign"})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:Cc,children:(0,o.jsx)(Vo,{form:e,elementSettings:i,name:"valign",isNewIconType:!0})})]})]})},Fc=e=>{const{form:i,elementSettings:l,__:s,token:n,appConfig:d,backgroundRepeatOptions:c,backgroundSizeOptions:p,handleToggleShowPaddingCell:g,handleTogglePaddingCell:m,handleToggleBackground:_,handleToggleBorder:E,handleToggleBorderRadius:b,paddingCellShow:h,paddingsExt:k,backgroundShow:x,cellBordersShow:T,borderRadiusShow:j,oneBorderRadiusValue:P,setOneBorderRadiusValue:S,backgroundImageEmpty:y}=e;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$FormSection,{title:s("Text"),dividerTop:!1,children:[d.formTextFieldTypografEnabled&&(0,o.jsx)(Ac,{...e}),(0,o.jsx)(Oc,{...e}),(0,o.jsx)($c,{...e})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:s("Padding"),collapsible:!0,open:h,onToggle:g,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{namePrefix:"cell_",extended:k,onToggleExtended:m,gutter:n.marginSM,rowStyle:{paddingBottom:4},labels:{horizontal:s("Horizontal padding"),vertical:s("Vertical padding"),left:s("Left padding"),right:s("Right padding"),top:s("Top padding"),bottom:s("Bottom padding"),individual:s("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:s("Background"),collapsible:!0,open:x,onToggle:_,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{colorFieldName:"cellBackgroundColor",imageEnabled:d.formTableFieldBackgroundImageEnabled&&!1,backgroundImageEmpty:y,usedColors:l.usedColors,colorPlaceholder:s("Background color"),horizontalPositionPlaceholder:s("Horizontal position"),horizontalPositionTooltip:s("Horizontal position"),verticalPositionPlaceholder:s("Vertical position"),verticalPositionTooltip:s("Vertical position"),backgroundRepeatTooltip:s("Background image repeat"),backgroundSizeTooltip:s("Background image size"),selectPlaceholder:s("Please choose"),backgroundRepeatOptions:c,backgroundSizeOptions:p,imageUploadSlot:(d.formTableFieldBackgroundImageEnabled,void 0)})}),(0,o.jsx)(t.ui_kit$FormSection,{title:s("Borders"),collapsible:!0,open:T,onToggle:E,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:i,namePrefix:"cell_"})}),d.formFieldBorderRadiusEnabled&&!1]})},bs=({form:e,elementSettings:i,paddingShow:l,paddingsExt:s,backgroundShow:n,bordersShow:d,borderRadiusShow:c,boxShadowShow:p,handleToggleShowPadding:g,handleTogglePadding:m,handleToggleBackground:_,handleToggleBorder:E,handleToggleBorderRadius:b,handleToggleBoxShadow:h,backgroundRepeatOptions:k,backgroundSizeOptions:x,backgroundImageEmpty:T,oneBorderRadiusValue:j,setOneBorderRadiusValue:P})=>{const{__:S}=r.useI18n(),y=r.useAppConfig(),{token:V}=(0,t.ui_kit$useToken)();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$FormSection,{title:S("Padding"),collapsible:!0,open:l,onToggle:g,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:s,onToggleExtended:m,gutter:V.marginSM,labels:{horizontal:S("Horizontal padding"),vertical:S("Vertical padding"),left:S("Left padding"),right:S("Right padding"),top:S("Top padding"),bottom:S("Bottom padding"),individual:S("Individual padding")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:S("Background"),collapsible:!0,open:n,onToggle:_,dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{imageEnabled:y.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:T,usedColors:i.usedColors,colorPlaceholder:S("Background color"),horizontalPositionPlaceholder:S("Horizontal position"),horizontalPositionTooltip:S("Horizontal position"),verticalPositionPlaceholder:S("Vertical position"),verticalPositionTooltip:S("Vertical position"),backgroundRepeatTooltip:S("Background image repeat"),backgroundSizeTooltip:S("Background image size"),selectPlaceholder:S("Please choose"),backgroundRepeatOptions:k,backgroundSizeOptions:x,imageUploadSlot:y.formTableFieldBackgroundImageEnabled?(0,o.jsx)(Fo,{form:e,label:S("Background image"),name:"backgroundImage",tooltipTitle:S("Background image"),placeholder:S("Background image link/route")}):void 0}),(0,o.jsx)(at,{form:e,showBackground:!0})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:S("Borders"),collapsible:!0,open:d,onToggle:E,dividerTop:!0,children:(0,o.jsx)(W.SelectedElementFormBorder,{form:e})}),y.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:S("Border radius"),collapsible:!0,open:c,onToggle:b,dividerTop:!0,children:(0,o.jsx)(Io,{form:e,oneBorderRadiusValue:j,setOneBorderRadiusValue:P,elementSettings:i})}),y.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:S("Box shadow"),collapsible:!0,open:p,onToggle:h,dividerTop:!0,children:(0,o.jsx)(No,{})}),y.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:S("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e})})]})};bs.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,paddingShow:f.default.bool,paddingsExt:f.default.bool,backgroundShow:f.default.bool,bordersShow:f.default.bool,borderRadiusShow:f.default.bool,boxShadowShow:f.default.bool,handleToggleShowPadding:f.default.func,handleTogglePadding:f.default.func,handleToggleBackground:f.default.func,handleToggleBorder:f.default.func,handleToggleBorderRadius:f.default.func,handleToggleBoxShadow:f.default.func,backgroundRepeatOptions:f.default.array,backgroundSizeOptions:f.default.array,backgroundImageEmpty:f.default.bool,oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func};var gs=({form:e,elementSettings:i,mobileSizeShow:l,mobileBackgroundShow:s,mobileBordersShow:n,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,handleToggleMobileSize:p,handleToggleMobileBackground:g,handleToggleMobileBorder:m,handleToggleMobileBorderRadius:_,handleToggleMobileBoxShadow:E,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:h,mobileBorders:k})=>{const{__:x,_x:T}=r.useI18n(),j=r.useAppConfig(),{token:P}=(0,t.ui_kit$useToken)(),S=r.useSelector(r.selectEmailSettings);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$FormSection,{title:x("Size"),collapsible:!0,open:l,onToggle:p,dividerTop:!0,children:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:x("Table width"),placement:"left",children:(0,o.jsx)("div",{style:{marginBottom:P.formItemMarginBottomMD+4},children:(0,o.jsx)(Xo,{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:P.formItemMarginBottomXS*2},children:(0,o.jsx)(t.ui_kit$Tooltip,{title:x("Height"),placement:"bottom",children:(0,o.jsx)(lt,{form:e,name:"mobileHeight",elementSettings:i})})})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:x("Background"),collapsible:!0,open:s,onToggle:g,dividerTop:!0,children:(0,o.jsx)(Rt,{elementSettings:Ko(i),imageEnabled:j.formTableFieldBackgroundImageEnabled,desktopBackground:Tt(i)})}),j.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Borders"),collapsible:!0,open:n,onToggle:m,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormBorderInputs,{form:e,fieldStructure:"flat",borderValues:k,usedColors:S.usedColors,labels:{color:x("Color"),width:T("Width","border"),none:x("None"),solid:x("Solid"),dashed:x("Dashed"),dotted:x("Dotted"),above:x("Above"),below:x("Below"),onLeft:x("On the left"),onRight:x("On the right"),around:x("Around"),usedColors:x("Used"),recommendedColors:x("Recommended")}})}),j.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Border radius"),collapsible:!0,open:d,onToggle:_,dividerTop:!0,children:(0,o.jsx)(Io,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:b,setOneBorderRadiusValue:h,elementSettings:i})}),j.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Box shadow"),collapsible:!0,open:c,onToggle:E,dividerTop:!0,children:(0,o.jsx)(No,{typeOfForm:"mobile",form:e,elementSettings:i,enableSwitch:!1})}),j.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e})})]})};gs.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,mobileSizeShow:f.default.bool,mobileBackgroundShow:f.default.bool,mobileBordersShow:f.default.bool,mobileBorderRadiusShow:f.default.bool,mobileBoxShadowShow:f.default.bool,handleToggleMobileSize:f.default.func,handleToggleMobileBackground:f.default.func,handleToggleMobileBorder:f.default.func,handleToggleMobileBorderRadius:f.default.func,handleToggleMobileBoxShadow:f.default.func,oneMobileBorderRadiusValue:f.default.bool,setOneMobileBorderRadiusValue:f.default.func,mobileBorders:f.default.object};var Mc=({form:e,elementViewType:i,mobileViewActive:l,elementSettings:s,paddingShow:n,paddingsExt:d,backgroundShow:c,bordersShow:p,borderRadiusShow:g,boxShadowShow:m,mobileSizeShow:_,mobileBackgroundShow:E,mobileBordersShow:b,mobileBorderRadiusShow:h,mobileBoxShadowShow:k,handleToggleShowPadding:x,handleTogglePadding:T,handleToggleBackground:j,handleToggleBorder:P,handleToggleBorderRadius:S,handleToggleBoxShadow:y,handleToggleMobileSize:V,handleToggleMobileBackground:z,handleToggleMobileBorder:A,handleToggleMobileBorderRadius:O,handleToggleMobileBoxShadow:w,backgroundRepeatOptions:U,backgroundSizeOptions:J,backgroundImageEmpty:Q,oneBorderRadiusValue:I,setOneBorderRadiusValue:le,oneMobileBorderRadiusValue:xe,setOneMobileBorderRadiusValue:ve,mobileBorders:Z})=>(0,o.jsx)(o.Fragment,{children:i==="mobile"&&l.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(gs,{form:e,elementSettings:s,mobileSizeShow:_,mobileBackgroundShow:E,mobileBordersShow:b,mobileBorderRadiusShow:h,mobileBoxShadowShow:k,handleToggleMobileSize:V,handleToggleMobileBackground:z,handleToggleMobileBorder:A,handleToggleMobileBorderRadius:O,handleToggleMobileBoxShadow:w,oneMobileBorderRadiusValue:xe,setOneMobileBorderRadiusValue:ve,mobileBorders:Z})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(bs,{form:e,elementSettings:s,paddingShow:n,paddingsExt:d,backgroundShow:c,bordersShow:p,borderRadiusShow:g,boxShadowShow:m,handleToggleShowPadding:x,handleTogglePadding:T,handleToggleBackground:j,handleToggleBorder:P,handleToggleBorderRadius:S,handleToggleBoxShadow:y,backgroundRepeatOptions:U,backgroundSizeOptions:J,backgroundImageEmpty:Q,oneBorderRadiusValue:I,setOneBorderRadiusValue:le})})}),fs=e=>e.customTable?.backgroundImage?.[0]?.value==="",_s=({elementSettings:e,formName:i})=>{const{__:l}=r.useI18n(),s=r.useSendPostMessage(),[n]=t.ui_kit$Form.useForm(),{token:d}=(0,t.ui_kit$useToken)(),c=r.useAppConfig(),p=r.useSelector(r.selectEmailViewType),g=r.useSelector(r.selectMobileViewActive),m=r.useSelector(r.selectIsCodeMode),_=r.useSelector(r.selectCodeModeDirection),E=i===r.EDIT_SELECTED_TABLE_CELLS,b=Ic(s,e.type),[h,k]=vc(e),[x,T]=(0,a.useState)(fs(e)),[j,P]=(0,a.useState)("https://"),S=hc({form:n,settings:e,send:b,isTableCells:E,mobileBorders:h,setMobileBorders:k,setBackgroundImageEmpty:T}),y=(0,a.useCallback)(Ne=>Yo(Ne,P),[]),V=wc({form:n,settings:e,send:b,mobileBorders:h,setMobileBorders:k,setBackgroundImageEmpty:T,onLinkHref:y}),z=(0,a.useMemo)(()=>({table:sc(e),cell:ac(e)}),[e]),A=(0,a.useRef)(),O=t.ui_kit$Form.useWatch([],n),w=[{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"}],U=[{label:l("Not defined"),value:""},{label:l("Contain"),value:"contain"},{label:l("Cover"),value:"cover"}],J=m&&_!=="bottom",[Q,I]=(0,a.useState)(null);(0,a.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&I(!0)},[]);const le=Ne=>{s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:Ne,locale:"en_US"})},xe=[{key:"1",label:l("This element"),onClick:()=>le("typograf")},{key:"2",label:l("The whole email"),onClick:()=>le("typograf_all")}];(0,a.useEffect)(()=>{n.setFieldsValue(Zl(e)),T(fs(e))},[n,e]),(0,a.useEffect)(()=>{n.getFieldValue("linkHref")||n.setFieldsValue({linkHref:null})},[O?.textLink,O?.linkHref,e.customTable?.linkHref,n]),(0,a.useEffect)(()=>{e.customTable?.linkHref&&Yo(e.customTable?.linkHref||"",P),n.setFieldsValue({linkHref:typeof e.customTable?.linkHref=="string"?e.customTable.linkHref:"https://"})},[n,e,P]);const ve=Ne=>{n.setFieldValue("linkHref",Ne!=="mergetag"?Ne:""),P(Ne)},{open:Z,toggle:be}=S;return(0,o.jsxs)(t.ui_kit$Form,{form:n,layout:"vertical",name:i,initialValues:{paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",cell_paddingTop:"",cell_paddingLeft:"",cell_paddingRight:"",cell_paddingBottom:"",cell_paddingLeftRight:"",cell_paddingTopBottom:"",borderAll:{width:"",style:"",color:""},borderTop:{width:"",style:"",color:""},borderBottom:{width:"",style:"",color:""},borderLeft:{width:"",style:"",color:""},borderRight:{width:"",style:"",color:""},cellBackgroundColor:"",backgroundImageForCell:"",backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",show:"all",borderPosition:"",borderRadiusAll:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"px",mobileBorderPosition:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBackgroundColor:"",mobileBackgroundImage:"",cell_borderPosition:"cell_borderAll",cell_borderAll:{color:"",width:"",style:""},cell_borderTop:{color:"",width:"",style:""},cell_borderBottom:{color:"",width:"",style:""},cell_borderLeft:{color:"",width:"",style:""},cell_borderRight:{color:"",width:"",style:""},cell_borderRadiusAll:"",fontFamily:"",fontSize:"",lineHeight:"",textStrong:"",textItalic:"",textStrikethrough:"",textUnderline:"",textLink:"",linkHref:"",textColor:"",textAlign:"",textBackgroundColor:"",valign:""},onValuesChange:V,autoComplete:"off",className:"element-controls",style:{padding:0,display:"flex",flexDirection:"column"},children:[!J&&(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"})}),E?(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Fc,{form:n,formValues:O,elementSettings:z.cell,appConfig:c,token:d,isMacOS:Q,__:l,handleToggleShowPaddingCell:be.cellPadding,handleTogglePaddingCell:S.togglePaddingMode,handleToggleBackground:be.background,handleToggleBorder:be.border,handleToggleBorderRadius:be.borderRadius,paddingCellShow:Z.cellPadding,paddingsExt:S.paddingsExt,backgroundShow:Z.background,cellBordersShow:Z.border,borderRadiusShow:Z.borderRadius,oneBorderRadiusValue:S.oneBorderRadiusValue,setOneBorderRadiusValue:S.setOneBorderRadiusValue,backgroundImageEmpty:x,backgroundRepeatOptions:w,backgroundSizeOptions:U,sendAction:le,typografItems:xe,textInputRef:A,linkProtocol:j,handleLinkProtocolsChange:ve})}):(0,o.jsx)(Mc,{form:n,elementSettings:z.table,handleToggleShowPadding:be.padding,handleTogglePadding:S.togglePaddingMode,handleToggleBackground:be.background,handleToggleBorder:be.border,handleToggleBorderRadius:be.borderRadius,handleToggleBoxShadow:be.boxShadow,handleToggleMobileSize:be.mobileSize,handleToggleMobileBackground:be.mobileBackground,handleToggleMobileBorder:be.mobileBorder,handleToggleMobileBorderRadius:be.mobileBorderRadius,handleToggleMobileBoxShadow:be.mobileBoxShadow,paddingShow:Z.padding,paddingsExt:S.paddingsExt,backgroundShow:Z.background,bordersShow:Z.border,borderRadiusShow:Z.borderRadius,boxShadowShow:Z.boxShadow,mobileSizeShow:Z.mobileSize,mobileBackgroundShow:Z.mobileBackground,mobileBordersShow:Z.mobileBorder,mobileBorderRadiusShow:Z.mobileBorderRadius,mobileBoxShadowShow:Z.mobileBoxShadow,oneBorderRadiusValue:S.oneBorderRadiusValue,setOneBorderRadiusValue:S.setOneBorderRadiusValue,oneMobileBorderRadiusValue:S.oneMobileBorderRadiusValue,setOneMobileBorderRadiusValue:S.setOneMobileBorderRadiusValue,backgroundImageEmpty:x,backgroundRepeatOptions:w,backgroundSizeOptions:U,mobileBorders:h,elementViewType:p,mobileViewActive:g})," "]})};_s.propTypes={elementSettings:f.default.object.isRequired,formName:f.default.string};var gt=({className:e=null,formSettings:i,emailElementType:l,formName:s})=>{const n=r.useDispatch(),d=r.useSendStyleToggleToIframe(),c=(0,a.useRef)(),p=r.useSelector(r.selectActiveSettingsTab),g=r.useSelector(r.selectElementSettings$1),m=r.useSelector(r.selectElementSettings),_=r.useContainer(),E=r.getComponentRegistry(_),b=l==="email"?g:m,h=b.type,k=h===r.ELEMENT_TYPES.CAROUSEL||h===r.ELEMENT_TYPES.IMG?i.settings:b,[x,T]=(0,a.useState)(k),[j,P]=(0,a.useState)(k);k!==j&&(P(k),T(k));const S=V=>{const z=V.data.operation,A=V.data.action;if(z===r.EVENT_TYPES.APPLICATION_ACTION){let w=function(U,J=null){const Q={[U]:J||!x[U]};d(Q,x.type),n(r.setEmailSettings(Q)),T(I=>({...I,...Q}))};var O=w;A==="toggle_strong"&&w("textStrong"),A==="toggle_italic"&&w("textItalic"),A==="toggle_underline"&&w("textUnderline"),A==="toggle_strikethrough"&&w("textStrikethrough"),A==="textAlign_left"&&w("textAlign","left"),A==="textAlign_right"&&w("textAlign","right"),A==="textAlign_center"&&w("textAlign","center")}};r.useListenPostMessage(S);const y=b;return(0,o.jsx)("div",{className:"selected-element-panel",children:(0,o.jsx)(r.CSSTransition,{nodeRef:c,in:p===r.PROPERTIES,timeout:300,classNames:"transition",children:(0,o.jsxs)("div",{ref:c,className:(0,Ke.default)("selected-element-panel-content",{[e]:e}),children:[i?.type==="advanced"&&i?.content?(0,o.jsx)(a.Fragment,{children:E.getReactElement(i.content)},i.instanceKey):null,(b.type===r.ELEMENT_TYPES.IMG||b.type===r.ELEMENT_TYPES.COUNTDOWN||b.type===r.ELEMENT_TYPES.VIDEO)&&(0,o.jsx)(Yr,{elementSettings:b}),b.type===r.ELEMENT_TYPES.TEXT&&(0,o.jsx)(Dn,{elementSettings:b}),b.type===r.ELEMENT_TYPES.LINK&&(0,o.jsx)(ul,{elementSettings:b}),b.type===r.ELEMENT_TYPES.TABLE&&(0,o.jsx)(cl,{elementSettings:b}),b.type===r.ELEMENT_TYPES.CUSTOM_TABLE&&(0,o.jsx)(_s,{elementSettings:y,formName:s},y.customTable.tableKey),(b.type===r.ELEMENT_TYPES.TD||b.type===r.ELEMENT_TYPES.STRUCTURE||b.type===r.ELEMENT_TYPES.GROUP||b.type===r.ELEMENT_TYPES.COLUMN)&&(0,o.jsx)(Bl,{elementSettings:b}),b.type===r.ELEMENT_TYPES.VAR&&(0,o.jsx)(Nl,{elementSettings:b}),b.type===r.ELEMENT_TYPES.BUTTON&&(0,o.jsx)(Pl,{elementSettings:b}),b.type===r.ELEMENT_TYPES.DIV&&(0,o.jsx)(Rl,{elementSettings:b}),b.type===r.ELEMENT_TYPES.VINDENT&&(0,o.jsx)(hl,{elementSettings:b}),b.type===r.ELEMENT_TYPES.FLOAT_BLOCK&&(0,o.jsx)(wl,{elementSettings:b}),i.type===r.ELEMENT_TYPES.CAROUSEL&&(0,o.jsx)(Fl,{elementSettings:i}),i.type===r.ELEMENT_TYPES.ACCORDION&&(0,o.jsx)(Ml,{elementSettings:i}),i.type===r.ELEMENT_TYPES.SOCIAL&&(0,o.jsx)(Gl,{elementSettings:i})]})})})};gt.propTypes={className:f.default.string,formName:f.default.string};var Dc=["hover"],Vc={color:"#ff4d4f"},xs=({index:e,count:i,iconStrokeWidth:l,onSwap:s,onRemove:n,onCopy:d,menu:c})=>{const{__:p}=r.useI18n();return(0,o.jsxs)(o.Fragment,{children:[e>0&&(0,o.jsx)(t.ui_kit$Tooltip,{title:p("Swap columns"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__swap",onClick:s,children:(0,o.jsx)(r.EmIcons,{icon:"SwapHorizontalIcon",component:t.icons$SwapHorizontalIcon,size:15,strokeWidth:l})})}),i>1&&(0,o.jsx)(t.ui_kit$Tooltip,{title:p("Delete column"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__remove",onClick:n,children:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:15,strokeWidth:l,style:Vc})})}),i<8&&(0,o.jsx)(t.ui_kit$Tooltip,{title:p("Copy column"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__copy",onClick:d,children:(0,o.jsx)(r.EmIcons,{icon:"CopyOutlined",component:t.icons$CopyOutlined,size:15,strokeWidth:l})})}),(0,o.jsx)(t.ui_kit$Dropdown,{trigger:Dc,menu:c,children:(0,o.jsx)("button",{type:"button","aria-label":p("Actions"),className:"selected-element-panel__columns-settings__controls__column__more",children:(0,o.jsx)(r.EmIcons,{icon:"EllipsisOutlined",component:t.icons$EllipsisOutlined,size:15,strokeWidth:l})})})]})},Kp=30;function ks(e,i){return i+1<e?i+1:0}function Hc(e,i=30){return e.map((l,s)=>{const n=ks(e.length,s);return n===s?l:l+e[n]-i})}function Uc(e,i,l,s=30){if(!e||typeof e!="object")return null;const n=e,d=Object.keys(n).filter(m=>/^width-\d+$/.test(m)).length,c=Number(i.slice(6)),p=ks(d,c);if(p===c)return null;const g=l-Object.keys(n).filter(m=>/^width-\d+$/.test(m)&&m!==i&&m!==`width-${p}`).reduce((m,_)=>m+(Number(n[_])||0),0)-s;return(Number(n[i])||0)<=g?null:(n[i]=g,g)}var Es=({values:e,minimum:i,step:l,renderPanel:s,children:n,onDrag:d,onCommit:c})=>{const[p,g]=(0,a.useState)(null),m=(0,a.useRef)(null),_=p??e,E=_.reduce((j,P)=>j+P,0)||1,b=(0,a.useMemo)(()=>a.Children.toArray(n),[n]),h=(0,a.useCallback)(j=>m.current?Td(e,m.current,j,i,l):e,[e,i,l]),k=(0,a.useCallback)(j=>{m.current=j},[]),x=(0,a.useCallback)(j=>{const P=h(j);g(P),d?.(P)},[h,d]),T=(0,a.useCallback)(j=>{const P=h(j);m.current=null,g(null),P.some((S,y)=>S!==e[y])&&c(P)},[h,e,c]);return(0,o.jsx)(t.ui_kit$Splitter,{onResizeStart:k,onResize:x,onResizeEnd:T,children:_.map((j,P)=>(0,o.jsx)(t.ui_kit$Splitter.Panel,{size:`${j/E*100}%`,min:`${i/E*100}%`,children:s?s(P,j):b[P]},P))})},Wc=e=>String(Math.round(e*10)/10),zc={marginBottom:0},Gc={paddingTop:20},Yc={marginBottom:20},Xc=(e,i)=>i?.userTyping?i.input:e==null||e===""?"":String(Number(e));function qo(){return!!document.querySelector(".selected-element-panel__columns-settings__links__add")?.closest(".selected-element-panel")}var Bs=({emailElementType:e,isSelectedElement:i=!1,selectedElement:l={parent:!1}})=>{const{__:s}=r.useI18n(),n=r.useDispatch(),d=r.useSendPostMessage(),[c]=t.ui_kit$Form.useForm(),p=(0,a.useRef)(),g=(0,a.useRef)(),m=(0,a.useRef)(null),_=r.useSelector(r.selectElementSettings$1),E=r.useSelector(r.selectElementSettings),b=r.useAppConfig(),h=l||(e==="email"?_:E),[k,x]=(0,a.useState)(h.floatBlocks?.wrap),[T,j]=(0,a.useState)(h.floatBlocks?.dirRevers),[P,S]=(0,a.useState)(null),[y,V]=(0,a.useState)(0),[z,A]=(0,a.useState)([]),O=r.useSelector(r.selectEmailViewType),w=(0,a.useCallback)(te=>{const Te=te.floatBlocks&&h.floatBlocks?{...te,floatBlocks:_d(h.floatBlocks,te.floatBlocks)}:te;n(e==="email"?r.setElementSettings$1(Te):r.setElementSettings(Te))},[n,e,h.floatBlocks]);(0,a.useEffect)(()=>{if(h&&JSON.stringify(h)!=="{}"&&c._init){const Te=h.floatBlocks?.items.length??0;if(m.current!==Te&&(m.current=Te,c.resetFields()),c.setFieldsValue({gap:h.floatBlocks?.gap,gapMobile:h.floatBlocks?.gapMobile,mobileGap:h.floatBlocks?.mobile?.gap,gapDim:"px",valign:h.floatBlocks?.valign,mobileValign:h.floatBlocks?.mobileValign??h.floatBlocks?.valign}),h.floatBlocks?.items.length>0){let C=function(G,L){if(G.length!==L.length)return!1;for(let re=0;re<G.length;re++)if(G[re]!==L[re])return!1;return!0};var te=C;const ke=h.floatBlocks.items.reduce((G,L)=>G+L.width,0),M=h.floatBlocks.items.map(G=>((G.width||0)/ke*100).toFixed(1));V(ke),!C(M,z)&&h.changeKey!=="gap"&&A(M),h.floatBlocks.items.forEach((G,L)=>c.setFieldsValue({["width-"+L]:G.width||0})),h.floatBlocks.items.length>=8?document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.add("noactive"):document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.contains("noactive")&&document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.remove("noactive")}x(h.floatBlocks?.wrap)}},[c,h,P,z]);let U=0;h.floatBlocks?.items.length>0&&(U=h.floatBlocks.items.length);const J=k===!1?h.floatBlocks?.mobile??null:null,Q=O!=="mobile"||!!J,I=U>1?(100-U*5)/(U-1):0,le=(te,Te)=>{Object.keys(Te).forEach(ke=>{if(ke.includes("width")){const M=parseInt(ke.match(/\d+/));c.setFieldsValue({[ke]:te.items[M]})}})},[xe,ve]=(0,a.useState)(!1);(0,a.useEffect)(()=>{const te=()=>ve(!0),Te=()=>ve(!1);return document.addEventListener("keyup",Te),document.addEventListener("keydown",te),()=>{document.removeEventListener("keyup",Te),document.removeEventListener("keydown",te)}},[]);const Z=te=>{g.current&&xe&&clearTimeout(g.current),g.current=setTimeout(()=>Te(te),50);function Te(ke){const M=c.getFieldsValue(!0),C=Object.keys(ke)[0];if(S(C),C.includes("width")){if(M[C]&&M[C]>=30){const G=Uc(M,C,y);G!==null&&c.setFieldsValue({[C]:G});let L={items:[],gap:M.gap,valign:M.valign,activateSection:i?void 0:"structure"},re=0;if(document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").length>1){re=parseFloat(Object.keys(ke)[0].substring(Object.keys(ke)[0].length-1));const ce=M["width-"+(re+1)]?re+1:0;let he=y;Object.keys(M).forEach(Ee=>{Ee.includes("width")&&Ee.indexOf("width-"+ce)===-1&&(he-=M[Ee])}),M["width-"+ce]=he}Object.keys(M).forEach(ce=>{ce.includes("width")&&L.items.push(M[ce])}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:L}),w({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...L,items:h.floatBlocks.items.map((ce,he)=>({...h.floatBlocks.items[he],width:L.items[he]}))},changeKey:C})}}else if(C==="gap"){const G={items:h.floatBlocks.items.map(he=>he.width),gap:h.floatBlocks.gap},L=G.items.reduce((he,Ee)=>he+Ee,0)+(G.items.length-1)*G.gap,re=M.gap,ce=L-(G.items.length-1)*re;if(ce>G.items.length*30||h.floatBlocks.gap-ke>=0){const he=(Y,oe)=>Math.round(oe*Y/100);let Ee=G.items.map((Y,oe)=>he(z[oe],ce));const $e=L-(Ee.reduce((Y,oe)=>Y+oe,0)+(G.items.length-1)*re);if($e!==0){const Y=Ee.length-Math.abs($e);Ee=Ee.map((oe,D)=>Y<=D?oe+($e>0?1:-1):oe)}let Ce={items:Ee,gap:re||0};le(Ce,M),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGap",settings:Ce,editFromStructure:qo()}),w({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...Ce,items:h.floatBlocks.items.map((Y,oe)=>({...Y,width:Ce.items[oe]}))},changeKey:C})}}else if(C==="mobileValign"){const G=bd(ke,C);if(G===null)return;d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksMobileValign",settings:{valign:G}}),w({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,mobileValign:G},changeKey:C})}else if(C==="valign"){let G={valign:M.valign};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksValign",settings:G,editFromStructure:qo()}),w({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...G},changeKey:C})}else if(C==="mobileGap"){const G=gd(ke,C);if(G===null)return;d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksMobileGap",settings:{gap:G}}),w({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,mobile:Ed(h.floatBlocks,G)},changeKey:C})}else if(C==="gapMobile"){let G={mobileHeight:{classNamePrefix:"em-mob-height-",value:ke[C],dim:"px"}};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGapMobile",settings:G}),w({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,gapMobile:G.mobileHeight.value},changeKey:C})}setTimeout(()=>p?.current&&p.current.focus({cursor:"end"}),600)}},be=(0,a.useMemo)(()=>(h.floatBlocks?.items??[]).map(te=>te.width||0),[h.floatBlocks?.items]),Ne=(0,a.useMemo)(()=>Hc(be),[be]),de=(0,a.useCallback)(te=>te.forEach((Te,ke)=>c.setFieldsValue({["width-"+ke]:Te})),[c]),Fe=(0,a.useCallback)(te=>{const Te=c.getFieldsValue(!0),ke={items:te,gap:Te.gap,valign:Te.valign,activateSection:i?void 0:"structure"};de(te),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:ke}),w({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...ke,items:h.floatBlocks.items.map((M,C)=>({...M,width:te[C]}))},changeKey:"width"})},[h,c,w,i,d,de]),Ae=(0,a.useCallback)(te=>{d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksMobileWidths",settings:{items:te}}),w({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,mobile:kd(h.floatBlocks,te)},changeKey:"mobileWidths"})},[h,w,i,d]),Ge=(0,a.useCallback)(()=>{d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksMobileReset",settings:{}}),w({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,mobile:Bd(h.floatBlocks)},changeKey:"mobileWidths"})},[h,w,i,d]),je=()=>{const te=c.getFieldsValue(!0),Te=h.floatBlocks.items.map(ce=>ce.width);let ke={items:[],gap:te.gap};const M=Te.reduce((ce,he)=>ce+he,0),C=Te.length,G=Math.ceil(y/C)*C,L=G/C,re=M-G;if(ke.items=Array(C).fill(L),re!==0){const ce=Te.length-Math.abs(re);ke.items=ke.items.map((he,Ee)=>ce<=Ee?he+(re>0?1:-1):he)}le(ke,te),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:ke,editFromStructure:qo()}),w({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...ke,items:h.floatBlocks.items.map((ce,he)=>({...ce,width:ke.items[he]}))},changeKey:"width"})},ye=te=>{const Te=c.getFieldsValue(!0),ke=h.floatBlocks.items.map(Ce=>Ce.width),M=h.floatBlocks.gap||20,C=te.cols-ke.length;let G=[],L=ke.reduce((Ce,Y)=>Ce+Y,0);te.cols>=ke.length?L-=M*C:L+=M*Math.abs(C);const re=Math.round(L/te.cols);function ce(Ce,Y){const oe=[];for(let D=0;D<Ce;D++)oe.push(te.width?.[D]?Math.round(L/100*te.width?.[D]):Y);return oe}G=ce(te.cols,re);const he=L-G.reduce((Ce,Y)=>Ce+Y,0);if(he!==0){let Ce=G.map((oe,D)=>[D,oe]).filter(oe=>oe[1]>30);const Y=Ce.length-Math.abs(he);Ce=Ce.map((oe,D)=>{const ue=Y<=D?oe[1]+(he>0?1:-1):oe[1];return[oe[0],ue]}),Ce.map(oe=>(G[oe[0]]=oe[1],oe))}let Ee={items:G,gap:Te.gap||20};const $e=G.reduce((Ce,Y)=>Ce+Y,0);A(G.map(Ce=>(Ce/$e*100).toFixed(1))),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksPreset",settings:Ee,editFromStructure:qo()}),w({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...Ee,items:Ee.items.map((Ce,Y)=>({width:Ce,current:!1}))},changeKey:"width"})},_e=()=>{const te=c.getFieldsValue(!0);if(U<8){const Te=h.floatBlocks.items.map(ce=>ce.width),ke=h.floatBlocks.gap,M=Te.reduce((ce,he)=>ce+(he>30?he:0),0),C=(M-30-ke)/M,G=Te.map(ce=>ce>30?Math.round(ce*C):ce).reduce((ce,he)=>ce+(he>30?he:0),0);let L=Te.map(ce=>ce>30?Math.round(ce*C):ce);L.push(30);const re=M-G-30-ke;if(re!==0){let ce=L.map((Ee,$e)=>[$e,Ee]).filter(Ee=>Ee[1]>30);const he=ce.length-Math.abs(re);ce=ce.map((Ee,$e)=>{const Ce=he<=$e?Ee[1]+(re>0?1:-1):Ee[1];return[Ee[0],Ce]}),ce.map(Ee=>(L[Ee[0]]=Ee[1],Ee))}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_ADD,settings:{gap:te.gap,gapMobile:te.gapMobile,minWidth:30},editFromStructure:qo()}),w({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,items:L.map((ce,he)=>({width:ce,current:h.floatBlocks.items[he]?.current||!1}))},changeKey:"width"})}else document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.add("noactive")},pe=te=>{const Te=c.getFieldsValue(!0);let ke=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((Ce,Y)=>{Ce===te.target.closest(".selected-element-panel__columns-settings__controls__column")&&(ke=Y)});const M=+h.floatBlocks.gap,C=+h.floatBlocks.items[ke].width+M,G=h.floatBlocks.items.map(Ce=>+Ce.width),L=(G.length-1)*M,re=G.reduce((Ce,Y)=>Ce+Y,0)+L,ce=G.length-1,he=Math.floor(C/ce);let Ee=G.filter((Ce,Y)=>Y!==ke).map(Ce=>Ce+he);const $e=re-(Ee.reduce((Ce,Y)=>Ce+Y,0)+(G.length-2)*M);if($e!==0){const Ce=Ee.length-Math.abs($e);Ee=Ee.map((Y,oe)=>Ce<=oe?Y+($e>0?1:-1):Y)}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_REMOVE,settings:{removedBlockIndex:ke,gap:Te.gap},editFromStructure:qo()}),w({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,items:Ee.map((Ce,Y)=>({width:Ce,current:h.floatBlocks.items.filter((oe,D)=>D!==ke)[Y].current}))},changeKey:"width"})},fe=te=>{if(U>=8)return;const Te=c.getFieldsValue(!0);let ke=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((oe,D)=>{oe===te.target.closest(".selected-element-panel__columns-settings__controls__column")&&(ke=D)});const M=parseFloat(Te.gap)||0,C=h.floatBlocks.items.map(oe=>+oe.width),G=C[ke],L=C.reduce((oe,D)=>oe+D,0),re=L-M,ce=L+G,he=ce>0?re/ce:1;let Ee=[];const $e=[];C.forEach((oe,D)=>{Ee.push(Math.max(30,Math.round(oe*he))),$e.push(h.floatBlocks.items[D]?.current||!1),D===ke&&(Ee.push(Math.max(30,Math.round(G*he))),$e.push(!1))});const Ce=re-Ee.reduce((oe,D)=>oe+D,0);if(Ce!==0){let oe=Ee.map((ue,Ie)=>[Ie,ue]).filter(ue=>ue[1]>30);const D=oe.length-Math.abs(Ce);oe=oe.map((ue,Ie)=>[ue[0],D<=Ie?ue[1]+(Ce>0?1:-1):ue[1]]),oe.forEach(ue=>Ee[ue[0]]=ue[1])}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_COPY,settings:{copiedBlockIndex:ke,gap:Te.gap,widths:Ee},editFromStructure:qo()});const Y=Ee.reduce((oe,D)=>oe+D,0);A(Ee.map(oe=>(oe/Y*100).toFixed(1))),w({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,items:Ee.map((oe,D)=>({width:oe,current:$e[D]||!1}))},changeKey:"width"})},me=(0,a.useCallback)(te=>{const Te=".selected-element-panel__columns-settings__controls__column",ke=Array.from(document.querySelectorAll(Te)).indexOf(te.target.closest(Te)),M=ke-1;if(M<0)return;const{floatBlocks:C}=h,G=C.items.map(({width:L,current:re})=>({width:L,current:re||!1}));[G[M],G[ke]]=[G[ke],G[M]],d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_SWAP,settings:{indexA:M,indexB:ke},editFromStructure:qo()}),w({...h,activateSection:i?void 0:"structure",floatBlocks:{...C,items:G,mobile:Sd(C.mobile,M,ke)},changeKey:"width"})},[h,w,i,d]),K=te=>{x(te),d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_WRAP,settings:{wrap:!k}}),w({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,wrap:!k,mobile:xd(h.floatBlocks,!k)},changeKey:"wrap"})},ee=te=>{j(te),d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_DIR,settings:{dirRevert:!T}}),w({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,dirRevert:!T},changeKey:"dir"})},ie=(0,a.useMemo)(()=>(h.floatBlocks?.items??[]).map((te,Te)=>({items:[{key:"copy",label:s("Copy column"),disabled:U>=8},{key:"remove",label:s("Delete column"),danger:!0}],onClick:({key:ke})=>{const M={target:document.querySelectorAll(".selected-element-panel__columns-settings__controls__column")[Te]};return ke==="copy"?fe(M):pe(M)}})),[h.floatBlocks?.items,U,s]),ae=(0,a.useCallback)(()=>{const te=h.floatBlocks?.mobile;if(!te)return;const Te=te.items.reduce((ke,M)=>ke+M,0);Ae(te.items.map(()=>Te/te.items.length))},[h.floatBlocks?.mobile,Ae]),ne=(0,a.useCallback)((te,Te)=>(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__controls__column"+(h.floatBlocks?.items[te]?.current?" current":""),children:[(0,o.jsx)(xs,{index:te,count:h.floatBlocks?.items.length??0,iconStrokeWidth:b.iconStrokeWidth,onSwap:me,onRemove:pe,onCopy:fe,menu:ie[te]}),(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__controls__field selected-element-panel__columns-settings__mobile-column",children:[Wc(Te),"%"]})]}),[h.floatBlocks?.items,b.iconStrokeWidth,ie]),Me=()=>setTimeout(()=>p?.current&&p.current.focus({cursor:"end"}),300);return h.floatBlocks&&h.floatBlocks.items.length>0&&(0,o.jsx)(t.ui_kit$Form,{layout:"vertical",form:c,name:"float_blocks_settings_form",autoComplete:"off",initialValues:{gap:h.floatBlocks?.gap||0,gapDim:"px",gapMobile:h.floatBlocks?.gapMobile||0,mobileGap:h.floatBlocks?.mobile?.gap??0,valign:h.floatBlocks?.valign||"top",mobileValign:h.floatBlocks?.mobileValign??(h.floatBlocks?.valign||"top"),...h.floatBlocks?.items.reduce((te,{width:Te},ke)=>(te[`width-${ke}`]=Te,te),{})},onValuesChange:Z,onFieldsChange:Me,className:"element-controls",children:(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings"+(O==="mobile"?" selected_form-mobile-props":""),style:{paddingTop:b.switchDesktopMobilePropsEnabled||b.stepToOtherElementEnabled||b.deleteButtonEnabled||h.type==="structure"?0:24},children:[h.floatBlocks.items.length===1&&(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:10},title:s('The selected element is in the block that supports a multicolumn structure. To add a new column, click the "Add a column" button.'),type:"info"}),O!=="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:_e,children:[(0,o.jsx)(r.EmIcons,{icon:"PlusCircleOutlined",component:t.icons$PlusCircleOutlined,size:16,strokeWidth:b.iconStrokeWidth})," ",s("Add column")]}),h.floatBlocks.items.length>1&&(0,o.jsx)("span",{onClick:je,children:(0,o.jsxs)(t.ui_kit$Tooltip,{title:s("Make columns the same width."),children:[(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined})," ",s("Equalize")]})})]})]}),h.floatBlocks.items.length>1&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:16},children:(0,o.jsx)("div",{className:"selected-element-panel__columns-settings__controls",children:(0,o.jsx)(Es,{values:be,minimum:30,step:1,onDrag:de,onCommit:Fe,children:h.floatBlocks.items.map((te,Te)=>(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__controls__column "+(te.current?"current":""),children:[(0,o.jsx)(xs,{index:Te,count:h.floatBlocks.items.length,iconStrokeWidth:b.iconStrokeWidth,onSwap:me,onRemove:pe,onCopy:fe,menu:ie[Te]}),(0,o.jsx)("div",{className:"selected-element-panel__columns-settings__controls__field",children:(0,o.jsx)(t.ui_kit$Form.Item,{label:"",name:"width-"+Te,children:(0,o.jsx)(t.ui_kit$InputNumber,{min:30,max:Ne[Te],value:te.width||0,placeholder:s("Width"),ref:P==="width-"+Te&&p})})})]},"floatblock-"+Te))})})}),(0,o.jsxs)("div",{className:"columns-presets",children:[(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{ye({cols:1})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol1",component:t.icons$LayoutCol1})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{ye({cols:2})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol2",component:t.icons$LayoutCol2})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{ye({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:()=>{ye({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:()=>{ye({cols:3})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol3",component:t.icons$LayoutCol3})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{ye({cols:4})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol4",component:t.icons$LayoutCol4})})]})]}),h.floatBlocks.items.length>1&&(0,o.jsxs)(o.Fragment,{children:[O==="mobile"&&(0,o.jsx)("div",{style:{marginBottom:24},children:(0,o.jsx)(t.ui_kit$Switch,{id:"column-wrap",label:s("Line break on mobile devices"),size:"small",disabled:h.floatBlocks?.wrap===void 0,checked:k,onChange:K,labelStyle:{position:"relative",top:2}})}),O==="mobile"&&J&&(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__mobile",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.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__links__add",onClick:_e,children:(0,o.jsxs)("span",{children:[(0,o.jsx)(r.EmIcons,{icon:"PlusCircleOutlined",component:t.icons$PlusCircleOutlined,size:16,strokeWidth:b.iconStrokeWidth})," ",s("Add column")]})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Make columns the same width."),children:(0,o.jsx)("button",{type:"button",onClick:ae,children:(0,o.jsxs)("span",{children:[(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined})," ",s("Equalize")]})})})]})]}),(0,o.jsx)("div",{className:"selected-element-panel__columns-settings__controls",children:(0,o.jsx)(Es,{values:J.items,minimum:5,step:.01,onCommit:Ae,renderPanel:ne})}),!J.linked&&(0,o.jsx)("div",{className:"selected-element-panel__columns-settings__links",children:(0,o.jsx)("button",{type:"button",onClick:Ge,children:(0,o.jsxs)("span",{children:[(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined})," ",s("Same as desktop")]})})})]}),O!=="mobile"&&(0,o.jsx)("div",{style:{marginBottom:24},children:(0,o.jsx)(t.ui_kit$Switch,{id:"column-dir-revers",label:s("Reverse order on desktop"),size:"small",disabled:h.floatBlocks?.wrap===void 0,checked:T,onChange:ee,labelStyle:{position:"relative",top:2}})})]}),h.floatBlocks.items.length>1&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[Q&&(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:J&&O==="mobile"?"mobileValign":"valign",style:zc,children:(0,o.jsx)(t.ui_kit$FormVerticalAlignControl,{disabled:h.floatBlocks.items.length<=1,strokeWidth:b.iconStrokeWidth,labels:{alignTop:s("Align top"),alignMiddle:s("Center vertically"),alignBottom:s("Align bottom")}})})})}),(0,o.jsxs)(o.Fragment,{children:[O!=="mobile"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:s("Indent between columns"),titleStyle:{paddingTop:20},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gap",style:{marginBottom:20},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,disabled:h.floatBlocks.items.length<=1,placeholder:s("Indent between columns"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px",ref:P==="gap"&&p})})})}),O==="mobile"&&J&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:s("Indent between columns"),titleStyle:Gc,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileGap",style:Yc,children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,max:I,step:.5,dragStep:.5,dragspeed:.1,formatter:Xc,placeholder:s("Indent between columns"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"%"})})})}),O==="mobile"&&!J&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:s("Indent in mobile"),titleStyle:{paddingTop:20},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gapMobile",style:{marginBottom:20},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,disabled:h.floatBlocks.items.length<=1,placeholder:s("Indent in mobile"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})})]})]})]})]})})};Bs.propTypes={selectedElement:f.default.shape({parent:f.default.string})};var Kc=()=>{},Ss=({email:e,formSettings:i={},onClosePanel:l=Kc})=>{const{__:s}=r.useI18n(),n=r.useRootElement(),d=r.useDispatch(),c=r.useSendPostMessage(),p=Object.prototype.hasOwnProperty.call(e,"type")?r.BLOCK:r.EMAIL,g=r.useSelector(r.selectElementSettings$1),m=r.useSelector(r.selectElementSettings),_=r.useSelector(r.selectPropertiesPanelKey),E=p==="email"?g:m,b=Object.keys(i).length>0?i.settings:E,h=i?.type==="advanced"&&!!i?.content,k=!!i?.extraTabs?.length,x=r.useAppConfig(),T=b.type==="customTable",j=r.useInspectorTabs(b.type||i.type,T),P=(0,a.useCallback)(le=>{j.activate(le),d(r.setPropertiesPanelKey(le||""))},[j,d]),S=!!b.type&&!!b.floatBlocks?.items.length>0&&!!b.floatBlocks?.items.filter(le=>!!le.width).length>0,y=(0,a.useRef)(null),V=(0,a.useRef)(_);V.current=_,(0,a.useEffect)(()=>{const le=Object.values(r.ELEMENT_TYPES),xe=b.type&&le.includes(b.type)?`${b.type}-${JSON.stringify(b.path||[])}`:null;if(h||k){const ve=n.querySelector(".email-pane .panel-form__body");ve&&(ve.scrollTop=0),d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else if(b.type&&le.includes(b.type)){const ve=y.current!==xe;if(y.current=xe,b.activateSection!=="structure"){if(ve){const Z=n.querySelector(".email-pane .panel-form__body");Z&&(Z.scrollTop=0)}r.keepsInspectorTab(String(V.current??""),ve)||d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else d(r.setPropertiesPanelKey(r.STRUCTURE))}else JSON.stringify(b)!=="{}"&&(y.current=null,d(r.setPropertiesPanelKey("")))},[b,d,n,h,k]);const z=(0,a.useMemo)(()=>{const le=[{key:r.EDIT_SELECTED_ELEMENT,label:(0,o.jsx)("span",{style:{textTransform:"capitalize"},children:b.caption?b.caption:s("Edit element")})}];return S&&le.push({key:r.STRUCTURE,label:s("Columns")}),le},[b.caption,S,s]),A=(0,a.useMemo)(()=>[...z,...j.tabs.map(({key:le,label:xe})=>({key:le,label:xe}))],[z,j.tabs]),O=(0,a.useMemo)(()=>[{key:r.EDIT_SELECTED_ELEMENT,label:s("Cell")},{key:r.TABLE_PROPERTIES,label:s("Table")}],[s]),w=le=>{le.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_REMOVE}),d(p==="email"?r.setElementSettings$1({}):r.setElementSettings({}))},U=le=>{le.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_PARENT_GET})},J=()=>{l(b),d(r.resetToLastActiveSettingsTab()),setTimeout(()=>{d(p==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET})},Q=(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:w,disabled:!b.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:U,disabled:!b.parent,icon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"GoToParent",component:t.icons$GoToParent,size:18,strokeWidth:x.iconStrokeWidth})})})]}),I=x.switchDesktopMobilePropsEnabled||x.stepToOtherElementEnabled||x.deleteButtonEnabled;return(0,o.jsxs)(t.ui_kit$PanelForm,{children:[(0,o.jsx)(t.ui_kit$PanelForm.Header,{onClose:J,closeIcon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"Close",component:t.icons$Close,size:24,strokeWidth:x.iconStrokeWidth}),extra:I?Q:void 0,children:(0,o.jsx)(t.ui_kit$Tabs,{items:T?O:A,activeKey:_,onChange:P})}),(0,o.jsx)(t.ui_kit$PanelForm.Body,{children:T?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{display:_==="Edit selected element"?void 0:"none"},children:(0,o.jsx)(gt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:p,formName:`${r.EDIT_SELECTED_TABLE_CELLS}`})}),(0,o.jsx)("div",{style:{display:_==="Table properties"?void 0:"none"},children:(0,o.jsx)(gt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:p,formName:`${r.TABLE_PROPERTIES}`})})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{display:_==="Edit selected element"?void 0:"none"},children:(0,o.jsx)(gt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:p})}),S&&(0,o.jsx)("div",{style:{display:_==="Structure"?void 0:"none"},children:(0,o.jsx)(Bs,{selectedElement:b,emailElementType:p,isSelectedElement:!1})}),j.tabs.map(le=>(0,o.jsx)("div",{className:le.className,hidden:_!==le.key,children:le.children},le.key))]})})]})},qc=({taxonomy:e})=>{const{__:i,_x:l}=r.useI18n(),s=r.useDispatch(),[n]=t.ui_kit$Form.useForm(),d=(0,a.useRef)(null),c=r.useSelector(r.selectActiveModal$1)===r.MODALS.ADD_NEW_GROUP_MODAL,p=r.useNotification(),g=r.useProjectData(),m=(0,a.useCallback)(()=>{n.resetFields(),setTimeout(()=>d.current?.focus({cursor:"start"}),0)},[n]);(0,a.useEffect)(()=>{c&&m()},[c,m]);const _=()=>s(r.closeModal$1()),[E,b]=r.useAddTermMutation(),[h,k]=(0,a.useState)(!1),x=()=>{n.validateFields().then(({name:T})=>(k(!0),E({project:g,kind:"group",name:T}).then(j=>{if("error"in j){p.error(j);return}p.success({title:i("The group “")+j.data.name+l("” was successfully created.",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:_,className:"new-group-modal",footer:[(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"large",loading:b.isLoading||h,onClick:x,children:i("Create group")},"submit")],children:(0,o.jsx)(t.ui_kit$Form,{form:n,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:b.isLoading,size:"large",placeholder:i("Enter the group name"),ref:d,style:{marginBottom:5}})})})})},Jc=({group:e,refetch:i})=>{const{__:l,_x:s}=r.useI18n(),n=r.useDispatch(),[d]=t.ui_kit$Form.useForm(),c=(0,a.useRef)(null),p=r.useSelector(r.selectActiveModal$1)===r.MODALS.EDIT_GROUP_NAME_MODAL,g=r.useNotification(),{id:m=null,name:_=""}=e,E=()=>n(r.closeModal$1()),[b,h]=r.useEditTermMutation();(0,a.useEffect)(()=>{p&&d.setFieldsValue({name:_})},[p,_,d]);const k=()=>{d.validateFields().then(({name:x})=>{b({kind:"group",id:m,name:x}).then(({data:T,error:j})=>{j?(g.error({error:j}),d.setFieldValue("name",x)):(i().then(({data:P})=>{if(P){const S=P[0]?.children?.find(y=>y.id===m)?.name;d.setFieldValue("name",S)}}),E(),g.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:p,onOk:k,onCancel:E,className:"new-group-name-modal",footer:[(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"large",loading:h.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:_},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:h.isLoading,size:"large",placeholder:l("Enter the group name"),ref:c,style:{marginBottom:5}})})})})},Wi={width:"100%"},Qc=["hover"],Zc={color:"#ff4d4f"},eu={color:t.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0},ou=({level:e,onRename:i,onRemove:l})=>{const{__:s}=r.useI18n(),n=(0,a.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:Zc,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:n,trigger:Qc,children:(0,o.jsx)("span",{className:"groups-management__actions",children:(0,o.jsx)(r.EmIcons,{icon:"MoreOutlined",component:t.icons$MoreOutlined})})})})},tu=({className:e,levels:i,readOnlyLevels:l=!1,levelsRead:s=!1,refetchProjectGroups:n,isLoading:d})=>{const{__:c,_x:p}=r.useI18n(),g=r.useDispatch(),m=r.useNotification(),{modal:_}=t.ui_kit$App.useApp(),{confirm:E}=_,{token:b}=(0,t.ui_kit$useToken)(),h=r.useSelector(r.selectProjectGroups),k=i??h,[x]=r.useDeleteTermMutation(),[T,j]=(0,a.useState)({id:null,name:""}),P=(0,a.useCallback)((A,O)=>{x({kind:"group",id:Number(A)}).unwrap().then(w=>{w?.deleted&&m.success({title:c("The group “")+O+p("” was successfully deleted.","recovery")})}).catch(w=>{m.error({error:w})})},[x,m,c,p]),S=(0,a.useCallback)(A=>{const O=A.name??"";E({mask:{closable:!0},centered:!0,title:p("Are you sure to delete “","group")+O+c("” group and all nested groups?"),icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:22,style:eu}),okText:c("Yes"),cancelText:c("No"),onOk:()=>P(String(A.id),O)})},[E,P,c,p]),y=(0,a.useCallback)(A=>{g(r.openModal$1(r.MODALS.EDIT_GROUP_NAME_MODAL)),j({id:A.id,name:A.name??""})},[g]),V=(0,a.useMemo)(()=>({marginBottom:b.formItemMarginBottomMD}),[b]),z=(0,a.useCallback)(()=>{g(r.openModal$1(r.MODALS.ADD_NEW_GROUP_MODAL))},[g]);return(0,o.jsxs)("div",{className:(0,Ke.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((A,O)=>(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:`group_${A.id}`,style:{marginBottom:b.formItemMarginBottomMD},label:(0,o.jsxs)(t.ui_kit$Flex,{justify:"space-between",align:"center",style:Wi,children:[(0,o.jsx)("span",{children:A.name}),!l&&(0,o.jsx)(ou,{level:A,onRename:y,onRemove:S})]}),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:Wi,placeholder:c(l?"Select a category":"Type category here"),options:A.children?.map(w=>({label:w.name,value:String(w.id)})),tagRender:w=>{const{label:U,closable:J,onClose:Q}=w,I=le=>{le.preventDefault(),le.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:b.colorPrimary,onMouseDown:I,closable:J,onClose:Q,style:{borderRadius:6},children:U})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})},A.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:V,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:V,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:Wi,onClick:z,children:c("Add group")})})})]}),(0,o.jsx)(qc,{taxonomy:r.ELEMENT_TYPES.GROUP}),(0,o.jsx)(Jc,{group:T,refetch:n})]})};function iu(e,{gallery:i=!1}={}){const l=r.isEmailsV2Enabled(),s=r.useGetTemplateSectionsQuery({scope:"gallery"},{skip:!l||!i}),n=r.useGetTemplateSectionsQuery({scope:"project",projectId:e},{skip:!l||!e});return{emailsOnV2:l,standardSections:s.data,projectSections:n.data,projectSectionsLoading:l&&!!e&&n.isLoading}}var{title:zi,description:si,tags:ai,type:Gi,is_template:ru,group:Ts}={title:"title",description:"description",tags:"tags",type:"type",is_template:"is_template",group:"group"},lu={[zi]:"",[si]:"",[ai]:[],[ru]:!1},su={[si]:"",[ai]:[],[Gi]:""};function au(e){const i=new Set;return e?.filter(l=>i.has(l.name)?!1:(i.add(l.name),!0))}var nu=e=>Array.isArray(e)&&e.length>0,Rs=({className:e="",element:i})=>{const{__:l}=r.useI18n(),s=r.useDispatch(),n=r.useEmailAttributesWriter(),[d]=t.ui_kit$Form.useForm(),{token:c}=(0,t.ui_kit$useToken)(),p=r.useAppConfig(),g=r.useEditorLocked(),m=r.useEditorLockCheck(),_=r.useSelector(r.selectProjectGroups),{data:E}=r.useGetBlockTypesQuery(),b=r.useProjectData(),h=i.hasOwnProperty("type")?r.BLOCK:r.EMAIL,k=i.hasOwnProperty("type")?r.BLOCK_TAGS:r.EMAIL_TAGS,{emailsOnV2:x,projectSections:T,projectSectionsLoading:j}=iu(b?.id),{data:P,refetch:S,isLoading:y,isFetching:V,isUninitialized:z,isSuccess:A}=r.useGetTermsQuery({project:b,kind:"group"},{skip:x||!b?.id}),O=(0,a.useMemo)(()=>x?T??[]:_,[x,T,_]);(0,a.useEffect)(()=>{P&&s(r.projectGroupsLoaded(P,h==="email"?i.group??[]:void 0))},[s,P,h,i.group]),(0,a.useEffect)(()=>{!z&&S()},[z,S]),(0,a.useEffect)(()=>{if(!x||!i.is_template)return;const je=new Set(i.projectCategories??[]),ye={};let _e=!1;for(const pe of T??[]){const fe=`group_${pe.id}`,me=(pe.children??[]).filter(ee=>je.has(String(ee.id))).map(ee=>String(ee.id)),K=d.getFieldValue(fe);(!K||K.length!==me.length||me.some((ee,ie)=>K[ie]!==ee))&&(_e=!0),ye[fe]=me}_e&&d.setFieldsValue(ye)},[d,x,i.is_template,i.projectCategories,T]);const[w,U]=(0,a.useState)([]),[J,Q]=(0,a.useState)([]),I=!!i.is_template,le=r.useProjectData();(0,a.useEffect)(()=>{!z&&S()},[i.group,S,z]),(0,a.useEffect)(()=>{if(A&&i.is_template&&nu(i.group)){const je=i.group;let ye={};je.length&&_.length&&je?.forEach(pe=>{_?.forEach(fe=>{let me=fe.children.find(K=>K.id===pe);me&&(ye.hasOwnProperty(fe.id)||(ye[fe.id]=[]),ye[fe.id].push({label:me.name,value:me.id}))})});let _e={};for(let pe in ye)ye.hasOwnProperty(+pe)&&(_e[`group_${pe}`]=ye[pe].map(fe=>({...fe,value:String(fe.value)})));d.setFieldsValue(_e)}},[d,_,i.is_template,i.group,A]);const{data:xe,isFetching:ve,refetch:Z}=r.useGetTermsQuery({project:le,kind:k},{skip:!le?.id});(0,a.useEffect)(()=>{Q(au(xe)?.map(je=>({value:je.name,key:je.id})))},[xe]),(0,a.useEffect)(()=>{if(i){const je=r.getTaxonomy(i,k)??[],ye=xe??[],_e=je.map(me=>me.name??""),pe=i.emailtags||i.blocktags||[],fe=je.concat(ye).filter(me=>pe.some(K=>r.sameTermId(me.id,K))).map(me=>me.name??"");d.setFieldsValue({title:i.title,description:i.description,tags:Array.isArray(i.tags)?i.tags:fe.length?Array.from(new Set(fe)):_e,type:i.type,is_template:!!i.is_template})}},[d,i,k,xe]);const be=(0,a.useMemo)(()=>{if(!(h==="email"?x:r.isBlocksV2Enabled())||!i)return[];const je=r.getTaxonomy(i,k)??[],ye=xe??[],_e=[...je,...ye];return((h==="email"?i.emailtags:i.blocktags)??[]).filter(pe=>!_e.some(fe=>fe.name&&r.sameTermId(fe.id,pe)))},[x,h,i,k,xe]),[Ne,de]=(0,a.useState)(void 0),Fe=!Array.isArray(i?.tags);(0,a.useEffect)(()=>{Fe&&be.length&&le?.id&&!ve&&Ne!==i?.id&&(de(i?.id),Z())},[Fe,be.length,le?.id,ve,Ne,i?.id,Z]);const Ae=Fe&&be.length>0&&(xe===void 0||ve||Ne!==i?.id),Ge=je=>{if(m())return;const ye=Object.keys(je)[0],_e=je,pe=ye.split("_")[0];if(pe===zi)n({title:_e[ye]});else if(pe===si)n({description:_e[ye]});else if(pe===ai){const fe=_e[ye],me=h==="email"&&(fe?.length??0)===0;n({tags:(fe??[]).map(K=>K.trim()),...me?{emailtags:[]}:{}})}else pe==="is"?n({is_template:_e[ye]}):pe===Gi&&h==="block"&&n({type:_e[ye]});switch(ye.split("_")[0]){case Ts:if(x){const fe=new Set((T??[]).flatMap(ie=>(ie.children??[]).map(ae=>String(ae.id)))),me=d.getFieldsValue(!0),K=Object.keys(me).filter(ie=>ie.startsWith(`${Ts}_`)).flatMap(ie=>me[ie]??[]).map(String).filter(ie=>fe.has(ie)),ee=(i.projectCategories??[]).map(String).filter(ie=>!fe.has(ie));n({projectCategories:[...new Set([...ee,...K])]});break}s(r.setEmailGroups({[ye.split("_")[1]]:je[ye]}));break;default:return}};return(0,a.useEffect)(()=>{if(E){const je=E;let ye=[];const _e={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"),Transactional:l("Transactional")};for(let pe in je)ye.push({label:_e[je[pe]],value:je[pe]});U(ye)}},[E,l]),(0,o.jsx)("div",{className:(0,Ke.default)("settings-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"settings_panel_form",initialValues:h==="email"?{EmailInitialValues:lu}:su,onValuesChange:Ge,autoComplete:"off",disabled:g,children:[p.subjectEnabled&&h==="email"&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Title"),name:zi,tooltip:{title:l("The title of the email is displayed in the list of the templates and usually matches the subject line, but you can change it."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$TextArea,{placeholder:l("Type title here"),autoSize:{minRows:1}})}),p.descriptionEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Description"),name:si,tooltip:{title:l("Description is used in other sections of the service."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$TextArea,{placeholder:l("Type your description here"),autoSize:{minRows:2}})}),p.tagsEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Tags"),name:ai,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:J,disabled:Ae||g,loading:Ae,tagRender:je=>{const{label:ye,closable:_e,onClose:pe}=je,fe=me=>{me.preventDefault(),me.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:c.colorPrimary,onMouseDown:fe,closable:_e,onClose:pe,style:{borderRadius:6},children:ye})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})}),p.isTemplateEnabled&&(h==="email"||!1)&&(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:h==="block"?l("Template blocks are shown in the common blocks of the project."):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:I,children:(0,o.jsx)(t.ui_kit$Switch,{id:"setIsTemplate",label:l("Is a template"),size:"small",disabled:h==="email"&&!!i.isNew||g,labelStyle:{position:"relative",top:2,fontSize:14,color:c.colorText}})})},"isTemplate")]}),h==="email"&&I&&(0,o.jsx)(tu,{element:i,levels:O,readOnlyLevels:x,levelsRead:T!==void 0,refetchProjectGroups:S,isLoading:x?j:y||V}),h==="block"&&(0,o.jsx)(t.ui_kit$Form.Item,{name:Gi,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:w,getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})]})})};Rs.propTypes={className:f.default.string,email:f.default.object};var{utm_source:ys,utm_medium:js,utm_campaign:ws,utm_term:vs,utm_content:Is}={utm_source:"utm_source",utm_medium:"utm_medium",utm_campaign:"utm_campaign",utm_term:"utm_term",utm_content:"utm_content"},du={[ys]:"",[js]:"",[ws]:"",[vs]:"",[Is]:""},Cs=({className:e="",email:i=void 0})=>{const{__:l}=r.useI18n(),s=r.useEmailAttributesWriter(),n=r.useEditorLocked(),d=r.useEditorLockCheck(),[c]=t.ui_kit$Form.useForm();(0,a.useEffect)(()=>{i&&c.setFieldsValue({utm_source:i.utm_parameters?.utm_source||"",utm_medium:i.utm_parameters?.utm_medium||"",utm_campaign:i.utm_parameters?.utm_campaign||"",utm_term:i.utm_parameters?.utm_term||"",utm_content:i.utm_parameters?.utm_content||""})},[c,i]);const p=g=>{if(d())return;const m=Object.keys(g)[0],_=g;s({utm_parameters:{...i?.utm_parameters,[m]:_[m]}})};return(0,o.jsx)("div",{className:(0,Ke.default)("settings-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:c,layout:"vertical",name:"settings_panel_form_utm",initialValues:du,onValuesChange:p,autoComplete:"off",disabled:n,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:ys,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:js,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:ws,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:vs,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:Is,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")})})]})})};Cs.propTypes={className:f.default.string,email:f.default.object};var cu={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 uu(e){return Number.isInteger(e)?String(e):e.toFixed(2)}function Ps(e){const i=e?.trim();return i?cu[i.toUpperCase()]??i:"$"}function Yi(e,i){return`${Ps(i)}${uu(e)}`}function mu(e){const i=parseFloat(e.price??""),l=parseFloat(e.discountValue??"");return!Number.isNaN(i)&&!Number.isNaN(l)&&l>0?{sale:Yi(i-l,e.priceCurrency),original:Yi(i,e.priceCurrency)}:Number.isNaN(i)?{}:{sale:Yi(i,e.priceCurrency)}}var go=({variant:e="line",width:i,height:l,className:s})=>{const n=(0,a.useMemo)(()=>({width:i,height:l}),[i,l]);return(0,o.jsx)("span",{className:(0,Ke.default)("preview-skeleton",`preview-skeleton--${e}`,s),style:n,"aria-hidden":"true"})};function Xi({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 Ns({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 pu({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 hu=2;function bu({card:e}){const i=mu(e),l=(0,a.useMemo)(()=>({backgroundImage:`url(${e.image})`}),[e.image]),s=!!e.headline?.trim(),n=!!e.image?.trim(),d=!i.sale&&!i.original;return(0,o.jsxs)("div",{className:"product-carousel-preview__card",children:[n?(0,o.jsx)("div",{className:"product-carousel-preview__card-image",style:l}):(0,o.jsx)(go,{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)(go,{height:12}),(0,o.jsx)(go,{height:12,width:"75%"})]}),d?(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,o.jsx)(go,{width:48,height:14}),(0,o.jsx)(go,{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 gu(){return(0,o.jsxs)("div",{className:"product-carousel-preview__card",children:[(0,o.jsx)(go,{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)(go,{height:12}),(0,o.jsx)(go,{height:12,width:"75%"})]}),(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,o.jsx)(go,{width:48,height:14}),(0,o.jsx)(go,{width:40,height:12})]})]})]})}var fu=({data:e,subjectLine:i,cards:l})=>{const{__:s}=r.useI18n(),n=!!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:[n?(0,o.jsx)("img",{src:e.logo,alt:"",className:"product-carousel-preview__logo"}):(0,o.jsx)(go,{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)(go,{height:14,className:"product-carousel-preview__subject-skeleton"}),(0,o.jsx)(Xi,{className:"product-carousel-preview__star-icon"})]})]})]})}),(0,o.jsx)("div",{className:"product-carousel-preview__carousel",children:l.length>0?l.map((c,p)=>(0,o.jsx)(bu,{card:c},c.id||p)):Array.from({length:hu},(c,p)=>(0,o.jsx)(gu,{},`skeleton-${p}`))})]})};function _u(e){const i=parseFloat(e?.price??""),l=parseFloat(e?.discountValue??"");if(!Number.isNaN(i)&&i>0&&!Number.isNaN(l)&&l>0){const n=Math.round(l/i*100);if(n>0)return`${n}% 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 xu=({data:e,subjectLine:i,card:l})=>{const{__:s}=r.useI18n(),n=!!e.logo?.trim(),d=!!i?.trim(),c=!!l?.image?.trim(),p=!!l?.headline?.trim(),g=_u(l),m=As(e.discountCode),_=!!(g||m),E=(0,a.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:[n?(0,o.jsx)("img",{src:e.logo,alt:"",className:"single-image-preview__logo"}):(0,o.jsx)(go,{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)(go,{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:[g?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Ns,{className:"single-image-preview__promo-icon"}),(0,o.jsx)("span",{className:"single-image-preview__promo-badge",children:g})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(go,{width:16,height:16,className:"single-image-preview__promo-icon-skeleton"}),(0,o.jsx)(go,{width:72,height:14})]}),_&&(0,o.jsx)("span",{className:"single-image-preview__promo-separator",children:"·"}),m?(0,o.jsx)("span",{className:"single-image-preview__promo-code",children:m}):(0,o.jsx)(go,{width:96,height:14,className:"single-image-preview__promo-skeleton"})]}),(0,o.jsx)(Xi,{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:E}):(0,o.jsx)(go,{variant:"block",className:"single-image-preview__card-image-skeleton"}),(0,o.jsx)("div",{className:"single-image-preview__card-body",children:p?(0,o.jsx)("div",{className:"single-image-preview__card-description",children:l?.headline}):(0,o.jsxs)("div",{className:"single-image-preview__card-description-skeleton",children:[(0,o.jsx)(go,{height:12}),(0,o.jsx)(go,{height:12,width:"92%"})]})})]})]})};function ku(e){const i=e?.trim();if(!i)return null;const l=(0,ct.default)(i);if(!l.isValid())return null;const s=(0,ct.default)().startOf("day"),n=l.startOf("day").diff(s,"day");return n===0?"Today":n===1?"Tomorrow":n>1&&n<=7?l.format("MMM D"):l.format("MMM D, YYYY")}function Ki(e){const i=e?.trim();return i||null}function Eu(e,i){return e?e==="Today"?i("Today"):e==="Tomorrow"?i("Tomorrow"):e:null}function Bu(e,i){return Eu(ku(e),i)}var Su=({data:e,subjectLine:i})=>{const{__:l}=r.useI18n(),s=!!e.logo?.trim(),n=!!i?.trim(),d=Ki(e.description),c=As(e.discountCode),p=!!(d||c);return(0,o.jsx)("div",{className:"deal-annotation-preview",children:(0,o.jsxs)("div",{className:"deal-annotation-preview__header-main",children:[s?(0,o.jsx)("img",{src:e.logo,alt:"",className:"deal-annotation-preview__logo"}):(0,o.jsx)(go,{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"})]}),n?(0,o.jsx)("div",{className:"deal-annotation-preview__subject-line",children:i}):(0,o.jsx)(go,{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)(Ns,{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)(go,{width:16,height:16,className:"deal-annotation-preview__promo-icon-skeleton"}),(0,o.jsx)(go,{width:72,height:14})]}),p&&(0,o.jsx)("span",{className:"deal-annotation-preview__promo-separator",children:"·"}),c?(0,o.jsx)("span",{className:"deal-annotation-preview__promo-code",children:c}):(0,o.jsx)(go,{width:96,height:14,className:"deal-annotation-preview__promo-skeleton"})]}),(0,o.jsx)(Xi,{className:"deal-annotation-preview__star-icon"})]})]})]})})},Tu=({data:e})=>{const{__:i}=r.useI18n(),l=Ki(e.description),s=Bu(e.availabilityEnds,i),n=Ki(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)(go,{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)(pu,{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)(go,{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")}),n?(0,o.jsx)("div",{className:"deal-card-preview__detail-value",children:n}):(0,o.jsx)(go,{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 Ru(e){return e.annotationType===Ze.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW?e.cards?.[0]?[e.cards[0]]:[]:e.annotationType===Ze.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL?e.cards||[]:[]}function yu(e,i){switch(e){case Ze.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW:return i("Single image preview");case Ze.GMAIL_ANNOTATION_TYPES.DEAL_ANNOTATION:return i("Deal Annotation");case Ze.GMAIL_ANNOTATION_TYPES.DEAL_CARD:return i("Deal Card");default:return i("Product carousel")}}var qi=300,Jo=16;function ju(e){if(!e||e.offsetParent===null)return!1;const i=e.getBoundingClientRect();return i.width>0&&i.height>0}function wu(e){const i=Array.from(document.querySelectorAll(e));for(const l of i){if(!(l instanceof HTMLElement))continue;const s=l.getBoundingClientRect(),n=window.getComputedStyle(l);if(s.width>0&&s.height>0&&n.display!=="none"&&n.visibility!=="hidden")return l}return null}var vu=({data:e,subjectLine:i,parentRef:l,overlayTargetSelector:s,onApply:n,applyDisabled:d=!1,applyBlockers:c=[],onRemove:p,visible:g=!0})=>{const{__:m}=r.useI18n(),[_,E]=(0,a.useState)(null),[b,h]=(0,a.useState)(null);(0,a.useEffect)(()=>{if(!g){E(null),h(null);return}const S=()=>{if(!ju(l?.current)){E(null),h(null);return}if(s){const I=l?.current?.closest(".email-pane__col_settings-inner")||wu(".email-pane__col_settings-inner");if(I){h(I),E({type:"popover"});return}}if(!l?.current)return;let U=l.current.getBoundingClientRect();if(U.width===0&&U.height===0){const I=l.current.closest(".email-pane__col");I&&(U=I.getBoundingClientRect())}const J=Math.max(Jo,Math.min(U.top,window.innerHeight-Jo));let Q=U.left-qi-Jo;Q<Jo&&(Q=U.right+Jo),Q+qi>window.innerWidth-Jo&&(Q=window.innerWidth-qi-Jo),h(document.body),E({type:"side",top:J,left:Math.max(Jo,Q)})};S();const y=window.requestAnimationFrame(S),V=[window],z=l?.current?.closest(".email-pane__collapse-wrapper"),A=l?.current?.closest(".email-pane__col");z&&V.push(z),A&&V.push(A),V.forEach(U=>{U.addEventListener("scroll",S,{passive:!0})}),window.addEventListener("resize",S);const O=l?.current,w=O&&typeof ResizeObserver<"u"?new ResizeObserver(S):null;return w?.observe(O),()=>{window.cancelAnimationFrame(y),w?.disconnect(),V.forEach(U=>{U.removeEventListener("scroll",S)}),window.removeEventListener("resize",S)}},[l,e,s,g]);const k=(0,a.useMemo)(()=>_?.type==="side"?{position:"fixed",top:_.top,left:_.left}:void 0,[_]);if(!g||!e||!Ze.hasGmailAnnotationsPreviewContent(e)&&!n||!_)return null;const x=Ru(e),T=e.annotationType||Ze.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL,j=(()=>{switch(T){case Ze.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL:return(0,o.jsx)(fu,{data:e,subjectLine:i,cards:x});case Ze.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW:return(0,o.jsx)(xu,{data:e,subjectLine:i,card:x[0]});case Ze.GMAIL_ANNOTATION_TYPES.DEAL_ANNOTATION:return(0,o.jsx)(Su,{data:e,subjectLine:i});case Ze.GMAIL_ANNOTATION_TYPES.DEAL_CARD:return(0,o.jsx)(Tu,{data:e});default:return null}})(),P=(0,o.jsxs)("div",{className:`annotations-preview${_.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:[m("Preview"),": ",yu(T,m)]}),j]}),(n||p)&&(0,o.jsxs)("div",{className:"annotations-preview__footer",children:[p&&(0,o.jsx)(t.ui_kit$Button,{type:"text",size:"small",danger:!0,onClick:p,children:m("Remove annotations")}),n&&(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:n,disabled:d,children:m("Apply")})})})]})]});return(0,mn.createPortal)(P,b||document.body)},{Text:Iu}=t.ui_kit$Typography,Cu=10,Pu=1,Ls={width:"100%"},Nu="https://developers.google.com/workspace/gmail/promotab",Co=["hover"],Au=["annotationLogo"],Os=["cards",0,"price"],Lu=["cards",0,"discountPercent"],Ou=["cards",0,"priceCurrency"];function jo(e){return e.closest(".email-pane__collapse-wrapper")??document.body}var Uo={clearIcon:(0,o.jsx)(t.ui_kit$ColorPickerClearGlyph,{})},$u={optionFilterProp:"label"};function Fu(e){return{value:e||void 0}}var Mu=Ze.POPULAR_PRICE_CURRENCIES.map(e=>{const i=Ps(e);return{value:e,label:i===e?e:`${e} (${i})`}}),$s=({name:e,pricePath:i,iconStrokeWidth:l})=>{const{__:s}=r.useI18n(),n=(0,a.useMemo)(()=>[i],[i]),d=(0,a.useMemo)(()=>[({getFieldValue:c})=>({validator:async(p,g)=>{const m=typeof g=="string"?g.trim():"";if(!m)return;if(Ze.parseDiscountPercent(m)===null)throw new Error(s("Discount must be a percentage greater than 0 and up to 100"));const _=Ze.parseDecimalInput(c(i));if(_===null||_<=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:Co,title:s("Discount, %"),placement:"bottom",getPopupContainer:jo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:e,dependencies:n,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:Uo})})})},Fs=({name:e,iconStrokeWidth:i})=>{const{__:l}=r.useI18n(),s=(0,a.useMemo)(()=>[{validator:async(n,d)=>{const c=typeof d=="string"?d.trim():"";if(c&&!Ze.isValidPriceCurrency(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:Co,title:l("Price currency"),placement:"bottom",getPopupContainer:jo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:e,rules:s,getValueProps:Fu,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:Mu,placeholder:l("Price currency"),prefix:(0,o.jsx)(r.EmIcons,{icon:"Globe02Icon",component:t.icons$Globe02Icon,size:16,strokeWidth:i}),showSearch:$u,allowClear:!0,getPopupContainer:jo})})})},Du=({onAdd:e})=>{const{__:i}=r.useI18n(),l=(0,a.useCallback)(()=>e(Ze.createEmptyAnnotationCard()),[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")})},Vu=({field:e,index:i,form:l,isSingleImagePreview:s,onRemove:n})=>{const{__:d}=r.useI18n(),c=r.useAppConfig(),p=(0,a.useMemo)(()=>[e.name,"image"],[e.name]),g=(0,a.useMemo)(()=>["cards",e.name,"image"],[e.name]),m=(0,a.useMemo)(()=>[e.name,"headline"],[e.name]),_=(0,a.useMemo)(()=>[e.name,"url"],[e.name]),E=(0,a.useMemo)(()=>[e.name,"price"],[e.name]),b=(0,a.useMemo)(()=>["cards",e.name,"price"],[e.name]),h=(0,a.useMemo)(()=>[e.name,"discountPercent"],[e.name]),k=(0,a.useMemo)(()=>[e.name,"priceCurrency"],[e.name]),x=(0,a.useMemo)(()=>[e.name,"id"],[e.name]),T=(0,a.useMemo)(()=>[{validator:async(P,S)=>{const y=typeof S=="string"?S.trim():"";if(y&&!/^https?:\/\//i.test(y))throw new Error(d("Please enter the correct URL."))}}],[d]),j=(0,a.useCallback)(()=>n(e.name),[n,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)(Iu,{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:Co,title:d("Delete"),placement:"top",getPopupContainer:jo,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:j})})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Co,title:d("Image"),placement:"top",getPopupContainer:jo,children:(0,o.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,o.jsx)(Fo,{form:l,label:d("Image"),name:p,watchPath:g})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Co,title:d("Headline"),placement:"bottom",getPopupContainer:jo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:m,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:Uo})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Co,title:d("Link"),placement:"bottom",getPopupContainer:jo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:_,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:Uo})})}),!s&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Co,title:d("Price"),placement:"bottom",getPopupContainer:jo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:E,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:Uo})})}),(0,o.jsx)($s,{name:h,pricePath:b,iconStrokeWidth:c.iconStrokeWidth}),(0,o.jsx)(Fs,{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 Ms({iconStrokeWidth:e}){const{__:i}=r.useI18n();return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Co,title:i("Discount code"),placement:"bottom",getPopupContainer:jo,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:Uo})})})}var Hu=({className:e="",isActive:i=!0,email:l})=>{const{__:s}=r.useI18n(),n=r.useAppConfig(),d=r.useEditorLocked(),c=r.useEditorLockCheck(),{document:p}=r.useDocumentSessionContext(),g=r.useNotification(),[m]=t.ui_kit$Form.useForm(),_=(0,a.useRef)(null),E=(0,a.useRef)(!1),b=(0,a.useRef)(null),[h,k]=(0,a.useState)(!1),x=t.ui_kit$Form.useWatch("annotationType",m),T=t.ui_kit$Form.useWatch("annotationLogo",m),j=t.ui_kit$Form.useWatch("description",m),P=t.ui_kit$Form.useWatch("discountCode",m),S=t.ui_kit$Form.useWatch("availabilityStarts",m),y=t.ui_kit$Form.useWatch("availabilityEnds",m),V=t.ui_kit$Form.useWatch("offerPageUrl",m),z=t.ui_kit$Form.useWatch("merchantHomepageUrl",m),A=t.ui_kit$Form.useWatch("cards",m),O=JSON.stringify(A??[]),w=(0,a.useMemo)(()=>JSON.parse(O)??[],[O]),U=x||Ze.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL,J=U===Ze.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL||U===Ze.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW,Q=U===Ze.GMAIL_ANNOTATION_TYPES.DEAL_ANNOTATION||U===Ze.GMAIL_ANNOTATION_TYPES.DEAL_CARD,I=U===Ze.GMAIL_ANNOTATION_TYPES.DEAL_CARD,le=U===Ze.GMAIL_ANNOTATION_TYPES.DEAL_ANNOTATION,xe=U===Ze.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW,ve=U===Ze.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW?Pu:Cu,Z=(0,a.useMemo)(()=>[{value:Ze.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL,label:s("Product carousel")},{value:Ze.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW,label:s("Single image preview")},{value:Ze.GMAIL_ANNOTATION_TYPES.DEAL_ANNOTATION,label:s("Deal Annotation")},{value:Ze.GMAIL_ANNOTATION_TYPES.DEAL_CARD,label:s("Deal Card")}],[s]),be=(0,a.useMemo)(()=>{let pe="";p&&(pe=p.getContent()),!pe&&l?.html&&(pe=l.html);const fe=pe.match(/<title[^>]*>([\s\S]*?)<\/title>/i),me=fe?fe[1].trim():l?.title||l?.subject||"";return Ze.formatPreviewSubjectLine(me)},[p,l?.html,l?.title,l?.subject]),Ne=(0,a.useMemo)(()=>Ze.buildAnnotationsData({annotationType:U,annotationLogo:T,description:j,discountCode:P,availabilityStarts:S,availabilityEnds:y,offerPageUrl:V,merchantHomepageUrl:z,cards:w}),[U,T,j,P,S,y,V,z,w]),de=(0,a.useMemo)(()=>J?Ze.getDiscountPercentBlockers(w,s):[],[J,w,s]),Fe=(0,a.useMemo)(()=>Ze.canApplyGmailAnnotations(Ne)&&de.length===0,[Ne,de]),Ae=(0,a.useMemo)(()=>[...Ze.getAnnotationsApplyBlockers(Ne,s),...de],[Ne,de,s]),Ge=(0,a.useMemo)(()=>s("Learn more about %s").split("%s"),[s]),je=(0,a.useCallback)(()=>{!p||c()||!Ze.removeAnnotationsFromDocument(p)||(m.setFieldsValue(Ze.getEmptyAnnotationsFormValues(U)),b.current={emailId:l?.id,markup:null},k(!1),g.success(s("Gmail annotations were removed from the template code.")))},[p,c,m,U,l?.id,g,s]);(0,a.useEffect)(()=>{if(!J)return;const pe=m.getFieldValue("cards")??[];if(U===Ze.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW){if(pe.length>1){m.setFieldsValue({cards:[pe[0]]});return}pe.length===0&&m.setFieldsValue({cards:[Ze.createEmptyAnnotationCard()]});return}pe.length===0&&m.setFieldsValue({cards:[Ze.createEmptyAnnotationCard()]})},[m,J,U,w]);const ye=(0,a.useCallback)(pe=>{if(!pe||!E.current||!p||c())return!1;const fe=Ze.applyAnnotationsEditToDocument(p,Ze.buildAnnotationsData(pe));if(fe){const me=Ze.readGmailAnnotationsScript(p.getContent());b.current={emailId:l?.id,markup:me},k(me!==null)}return fe},[p,c,l?.id]),_e=(0,a.useCallback)(()=>{ye(m.getFieldsValue(!0))&&g.success(s("Gmail annotation was successfully applied to the template code."))},[ye,m,g,s]);return(0,a.useEffect)(()=>{if(!i)return;const pe=Ze.normalizeEditorHtml(p?.getContent()||l?.html||""),fe={emailId:l?.id,markup:pe?Ze.readGmailAnnotationsScript(pe):null};if(k(fe.markup!==null),!Ze.shouldReloadAnnotationsForm(b.current,fe))return;b.current=fe,E.current=!1;const me=pe?Ze.parseGmailAnnotations(pe):null;m.setFieldsValue(me?Ze.mapParsedAnnotationsToFormValues(me):Ze.getEmptyAnnotationsFormValues()),E.current=!0},[i,l?.id,l?.html,p,m]),(0,o.jsxs)("div",{className:(0,Ke.default)("selected-social-form","annotations-panel",e),ref:_,children:[(0,o.jsx)(vu,{data:Ne,subjectLine:be,parentRef:_,overlayTargetSelector:"#pane-content-iframe",onApply:_e,applyDisabled:!Fe||d,applyBlockers:Ae,onRemove:h&&!d?je:void 0,visible:i}),(0,o.jsxs)(t.ui_kit$Form,{form:m,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:Co,title:s("Annotation type"),placement:"bottom",getPopupContainer:jo,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:Z,placeholder:s("Annotation type"),getPopupContainer:jo})})}),!I&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Co,title:s("Organization logo"),placement:"bottom",getPopupContainer:jo,children:(0,o.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,o.jsx)(Fo,{form:m,label:s("Organization logo"),name:"annotationLogo",watchPath:Au})})}),(xe||le)&&(0,o.jsx)(Ms,{iconStrokeWidth:n.iconStrokeWidth}),xe&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Co,title:s("Price"),placement:"bottom",getPopupContainer:jo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:Os,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:n.iconStrokeWidth}),placeholder:s("Price"),allowClear:Uo})})}),(0,o.jsx)($s,{name:Lu,pricePath:Os,iconStrokeWidth:n.iconStrokeWidth}),(0,o.jsx)(Fs,{name:Ou,iconStrokeWidth:n.iconStrokeWidth})]}),Q&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Co,title:s("Discount description"),placement:"bottom",getPopupContainer:jo,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:n.iconStrokeWidth}),placeholder:s("Discount description"),allowClear:Uo})})}),I&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Ms,{iconStrokeWidth:n.iconStrokeWidth}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Co,title:s("Offer page URL"),placement:"bottom",getPopupContainer:jo,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:n.iconStrokeWidth}),placeholder:s("Offer page URL"),allowClear:Uo})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Co,title:s("Merchant homepage URL"),placement:"bottom",getPopupContainer:jo,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:n.iconStrokeWidth}),placeholder:s("Merchant homepage URL"),allowClear:Uo})})})]}),(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:Co,title:s("Starts"),placement:"bottom",getPopupContainer:jo,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:Ls,getPopupContainer:jo})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Co,title:s("Ends"),placement:"bottom",getPopupContainer:jo,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:Ls,getPopupContainer:jo})})})})]})]})]}),J&&(0,o.jsxs)("div",{className:(0,Ke.default)("selected-social-form__section",{"selected-social-form__section--bordered":!xe,"annotations-panel__cards-section":xe}),children:[U===Ze.GMAIL_ANNOTATION_TYPES.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:(pe,{add:fe,remove:me})=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"selected-social-form__items",children:pe.map((K,ee)=>(0,o.jsx)(Vu,{field:K,index:ee,form:m,isSingleImagePreview:xe,onRemove:me},K.key))}),!xe&&w.length<ve&&(0,o.jsx)(Du,{onAdd:fe})]})})]}),(0,o.jsxs)("div",{className:"annotations-panel__docs-hint",children:[Ge[0],(0,o.jsx)("a",{href:Nu,target:"_blank",rel:"noopener noreferrer",children:s("Gmail annotations")}),Ge[1]]})]})]})},Uu={appearance:"title"},Ji=({email:e,pluginOnly:i=!1})=>{const{__:l}=r.useI18n(),s=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,[n,d]=(0,a.useState)(r.SETTINGS),c=r.useAppConfig(),p=r.usePluginViewTabs("documentSettings",Uu),{lastOpenedKey:g,lastOpenedStamp:m,claimNewest:_}=p,E=(0,a.useCallback)(A=>{p.activate(A),d(A||"")},[p]);(0,a.useEffect)(()=>{g&&(_(),d(g))},[g,m,_]);const b=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(!b.current&&p.openedKnown){b.current=!0;const A=_();A&&d(A)}},[p.openedKnown,_]);const h=!i&&c.settingsTabEnabled,k=!i&&c.UTMEnabled&&s==="email",x=!i&&c.annotationsEnabled&&s==="email",T=[h&&"Settings",k&&"UTM parameters",x&&"Annotations parameters"].filter(Boolean),j=[...T,...p.openedKeys].includes(n)?n:T[0]??"",P=p.keys[0],S=T.length===0,y=S&&p.openedKnown&&p.openedKeys.length===0,V=(0,a.useRef)(!1);(0,a.useEffect)(()=>{S||(V.current=!1)},[S]),(0,a.useEffect)(()=>{y&&P&&!V.current&&(V.current=!0,p.activate(P))},[y,P,p]);const z=(0,a.useMemo)(()=>{const A=[];return h&&A.push({label:(0,o.jsx)(o.Fragment,{children:l("Settings")}),key:r.SETTINGS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(Rs,{className:"email-settings__collapse-panel-content",element:e})}),k&&A.push({label:(0,o.jsx)(o.Fragment,{children:l("UTM parameters")}),key:r.UTM_PARAMETERS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(Cs,{className:"email-settings__collapse-panel-content",email:e})}),x&&A.push({label:(0,o.jsx)(o.Fragment,{children:l("Annotations")}),key:r.ANNOTATIONS_PARAMETERS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(Hu,{className:"email-settings__collapse-panel-content",email:e,isActive:j===r.ANNOTATIONS_PARAMETERS})}),A.push(...p.tabs()),A},[l,e,h,k,x,j,p]);return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse",size:"large",activeKey:j,onChange:E,items:z})})};Ji.propTypes={};var Ds=320,Wu=1200,zu=350,{backgroundColor:Vs,backgroundImage:Qi,backgroundPositionX:Zi,backgroundPositionY:er,backgroundRepeat:ni,backgroundSize:or,responsive:Gu,backgroundColorContent:Yu,width:tr}={backgroundColor:"backgroundColor",backgroundImage:"backgroundImage",backgroundPositionX:"backgroundPositionX",backgroundPositionY:"backgroundPositionY",backgroundRepeat:"backgroundRepeat",backgroundSize:"backgroundSize",responsive:"responsive",backgroundColorContent:"backgroundColorContent",width:"width"},Xu={[Vs]:"",[Qi]:"",[Zi]:"",[er]:"",[ni]:"checked",[or]:"",[Yu]:"",[tr]:""};function ir(e){const i=Number(e);return Number.isNaN(i)?null:{value:i,dim:"px"}}var Hs=({className:e=""})=>{const{__:i}=r.useI18n(),{token:l}=(0,t.ui_kit$useToken)(),s=r.useDispatch(),n=r.useAppConfig(),[d]=t.ui_kit$Form.useForm(),c=r.useSendPostMessage(),p=r.useEmailAttribute("common_styles"),g=r.useSelector(r.selectEmailSettings),m=r.useSelector(r.selectIsSettingsDisabled$1),_=r.useSelector(r.selectActiveSettingsTab),E=r.useSelector(r.selectIsNeedUpdateAppearance),[b,h]=(0,a.useState)(!0),k=(0,a.useRef)(!1),x=(0,a.useRef)(null),T=i("Email not yet loaded or global container not found.");(0,a.useEffect)(()=>{E&&(s(r.setIsNeedUpdateAppearance(!1)),c({operation:r.EVENT_TYPES.INIT_PREVIEW}))},[d,E,s,c,p]),(0,a.useEffect)(()=>()=>{x.current&&clearTimeout(x.current)},[]);const j=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],P=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}];(0,a.useEffect)(()=>{const{width:U,...J}=g,Q={...J,backgroundImage:g.backgroundImage?g.backgroundImage[0]?.value:"",backgroundRepeat:g[ni]===""?"repeat":g[ni],backgroundSize:g[or],responsive:g.responsive?.shutdown};k.current||(Q.width=U?.value,Q.widthDim=U?.dim),d.setFieldsValue(Q),h(!g.backgroundImage)},[g,d]);const S=(0,a.useCallback)(U=>{const J=ir(U);!J||J.value<Ds||c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{width:J}})},[c]),y=(0,a.useCallback)(U=>{const J=ir(U);J&&s(r.setEmailSettings({...g,width:J}))},[s,g]),V=(0,a.useCallback)(U=>{x.current&&clearTimeout(x.current),y(U),x.current=setTimeout(()=>{S(U)},zu)},[S,y]),z=U=>{const J=d.getFieldsValue(!0),Q=Object.keys(U)[0];switch(Q){case tr:V(U[Q]);break;case Zi:case er:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[Q]:U[Q]===""?"none":U[Q]}});break;case Qi:h(U[Q]===""),c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[Q]:[{...g?.backgroundImage?.[0],type:"url",value:U[Q]}],backgroundSize:"cover"}});break;case Gu:{const I=ir(J.width);c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{responsive:{shutdown:U[Q],styles:U[Q]},...I?{width:I}:{}}});break}default:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:U})}},A=U=>{s(r.setMobileViewActive({shutdown:U,styles:U})),c({operation:r.EVENT_TYPES.SANDBOX_IFRAME_SETSIZE,settings:{iframeWidth:document.querySelector(".email-pane__iframe").getBoundingClientRect().width}})},O=()=>{k.current=!0},w=()=>{x.current&&(clearTimeout(x.current),x.current=null);const U=d.getFieldValue(tr);y(U),S(U),requestAnimationFrame(()=>{k.current=!1})};return(0,o.jsx)("div",{className:(0,Ke.default)("appearance-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"appearance_panel_form",initialValues:{remember:!1,...Xu},onValuesChange:z,autoComplete:"off",className:"element-controls",children:[m?(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:g.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:Ds,max:Wu,placeholder:i("Width"),disabled:!g.width?.value,addonAfter:"px",onFocus:O,onBlur:w})})})})})}),n.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:g.responsive?.shutdown===void 0,onChange:A})})})}),(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:!n.emailResponsiveControlEnabled,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:b?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:Vs,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:g.usedColors,disabled:m})})})}),(0,o.jsx)(t.ui_kit$Col,{span:b?12:24,children:n.formEmailFieldBackgroundImageEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Fo,{form:d,label:i("Background image"),name:Qi,tooltipTitle:i("Background image"),disabled:m||_!=="Styles",elementSettings:g}),!b&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:"0"},children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Horizontal position"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:Zi,style:{marginBottom:l.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:i("Horizontal position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Vertical position"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:er,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:ni,children:(0,o.jsx)(t.ui_kit$Select,{placeholder:i("Please select"),disabled:m,options:j})})})}),(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:or,children:(0,o.jsx)(t.ui_kit$Select,{placeholder:i("Please select"),disabled:m,options:P})})})})]})]})]})})]})})]})})};Hs.propTypes={className:f.default.string};var{Option:Us}=t.ui_kit$Select,{width:Ws,widthDim:Ku}={width:"width",widthDim:"widthDim"},qu={[Ws]:"",[Ku]:""},zs=({className:e=""})=>{const{__:i}=r.useI18n(),l=r.useSelector(r.selectBlockSettings),s=r.useSelector(r.selectIsSettingsDisabled),[n]=t.ui_kit$Form.useForm(),d=r.useSendPostMessage(),c=i("Block not yet loaded or global container not found.");(0,a.useEffect)(()=>{n.setFieldsValue({width:l.width.value,widthDim:l.width.dim})},[l,n]);const p=g=>{const m=n.getFieldsValue(!0),_=Object.keys(g)[0];let E;switch(_){case"width":E={[_]:{value:g[_],dim:m.widthDim}};break;case"widthDim":E={width:{value:m.width,dim:g[_]}};break;default:return}d({operation:r.EVENT_TYPES.SANDBOX_BLOCK_SETTINGS_SET,settings:E})};return(0,o.jsx)("div",{className:(0,Ke.default)("block-appearance-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:n,layout:"vertical",name:"block_appearance_panel_form",initialValues:{remember:!1,...qu},onValuesChange:p,autoComplete:"off",children:[s?(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:"24px"},title:c,type:"error"}):null,(0,o.jsx)(t.ui_kit$Form.Item,{label:i("Container width"),name:Ws,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)(Us,{value:"px",children:"px"}),(0,o.jsx)(Us,{value:"%",children:"%"})]})})})})]})})};zs.propTypes={className:f.default.string};var Ju=()=>{};function Gs(){const e=r.useContainer(),i=(0,a.useCallback)(s=>{if(!e)return Ju;const n=r.provideDefaultCommonStyles(e).watch(s);return()=>n.dispose()},[e]),l=(0,a.useCallback)(()=>r.getDefaultCommonStyles(e),[e]);return(0,a.useSyncExternalStore)(i,l,l)}function Ys(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function rr(e,i){const l={...e};for(const s of Object.keys(i)){const n=i[s],d=e[s];Ys(n)&&Ys(d)?l[s]=rr(d,n):n!==void 0&&(l[s]=n)}return l}function Xs(e,i){const l=r.COMMON_STYLES;if(typeof e=="string"){const s=e.trim();if(s.startsWith("{"))try{const n=JSON.parse(s);if(n&&typeof n=="object"&&!Array.isArray(n)&&Object.keys(n).length>0)return rr(l,n)}catch{}}return i&&typeof i=="object"&&!Array.isArray(i)?rr(l,i):l}var Ks=e=>({textFontFamily:e.text.fontFamily,textFontSize:e.text.fontSize,textFontSizeDim:e.text.fontSizeDim,textLineHeight:e.text.lineHeight,textLineHeightDim:e.text.lineHeightDim,textColor:e.text.color,textContrastColor:e.text.contrastColor||"#FFFFFF",textAlign:e.text.textAlign,textPaddingBottom:e.text.paddingBottom,textPaddingBottomDim:e.text.paddingBottomDim,headingFontFamily:e.headings.fontFamily,headingFontSize:e.headings.fontSize,headingFontSizeDim:e.headings.fontSizeDim,headingLineHeight:e.headings.lineHeight,headingLineHeightDim:e.headings.lineHeightDim,headingColor:e.headings.color,headingContrastColor:e.headings.contrastColor||"#FFFFFF",headingAlign:e.headings.textAlign,headingPaddingTop:e.headings.paddingTop,headingPaddingTopDim:e.headings.paddingTopDim,headingPaddingBottom:e.headings.paddingBottom,headingPaddingBottomDim:e.headings.paddingBottomDim,headingLetterSpacing:e.headings.letterSpacing,headingLetterSpacingDim:e.headings.letterSpacingDim,headingBold:e.headings.bold,headingItalic:e.headings.italic,linkColor:e.links.color,linkContrastColor:e.links.contrastColor||"#FFFFFF",linkUnderline:e.links.underline,buttonsFontFamily:e.buttons.fontFamily,buttonsFontSize:e.buttons.fontSize,buttonsFontSizeDim:e.buttons.fontSizeDim,buttonsLetterSpacing:e.buttons.letterSpacing,buttonsLetterSpacingDim:e.buttons.letterSpacingDim,buttonsColor:e.buttons.color,buttonsContrastColor:e.buttons.contrastColor||"#1890ff",buttonsBold:e.buttons.bold,buttonsItalic:e.buttons.italic,buttonsBackgroundColor:e.buttons.backgroundColor,buttonsContrastBackgroundColor:e.buttons.contrastBackgroundColor||"#FFFFFF",buttonsMarginTop:e.buttons.marginTop,buttonsMarginTopDim:e.buttons.marginTopDim,buttonsMarginBottom:e.buttons.marginBottom,buttonsMarginBottomDim:e.buttons.marginBottomDim,buttonsBorder:e.buttons.border,buttonsAlign:e.buttons.textAlign,buttonsBorderRadius:e.buttons.borderRadius,buttonsPadding:e.buttons.padding,cardsContrastBackgroundColor:e.cards?.contrastBackgroundColor||"#1890ff",cardsBaseBackgroundColor:e.cards?.baseBackgroundColor||"#F8F8F8",cardsContrastTextColor:e.cards?.contrastTextColor||"#FFFFFF",cardsBaseTextColor:e.cards?.baseTextColor||"#5A5A5A",cardsBorder:e.cards?.border||{all:null,top:null,right:null,bottom:null,left:null},cardsBorderRadius:e.cards?.borderRadius||{all:10,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},blockBackgroundColor:e.block?.backgroundColor||"",blockContrastBackgroundColor:e.block?.contrastBackgroundColor||"#1890ff",blockPaddingAll:e.block?.padding?.all,blockPaddingTop:e.block?.padding?.top,blockPaddingRight:e.block?.padding?.right,blockPaddingBottom:e.block?.padding?.bottom,blockPaddingLeft:e.block?.padding?.left}),Qu={buttons_borderRadiusAll:"all",buttons_borderRadiusTopLeft:"topLeft",buttons_borderRadiusBottomLeft:"bottomLeft",buttons_borderRadiusTopRight:"topRight",buttons_borderRadiusBottomRight:"bottomRight"},Zu={cards_borderRadiusAll:"all",cards_borderRadiusTopLeft:"topLeft",cards_borderRadiusBottomLeft:"bottomLeft",cards_borderRadiusTopRight:"topRight",cards_borderRadiusBottomRight:"bottomRight"},em={blockPaddingTop:"top",blockPaddingLeft:"left",blockPaddingRight:"right",blockPaddingBottom:"bottom"},om=({className:e})=>{const{__:i}=r.useI18n(),l=W.useGoogleFontsLoader(),s=r.useDispatch(),n=r.useSendPostMessage(),[d]=t.ui_kit$Form.useForm(),c=r.useSelector(r.selectEmailSettings),p=r.useSelector(r.selectIsNeedUpdateContentAppearance),g=Gs(),m=r.useEmailAttribute("common_styles"),_=r.useAppConfig(),{token:E}=(0,t.ui_kit$useToken)(),[b,h]=(0,a.useState)({}),[k,x]=(0,a.useState)({}),[T,j]=(0,a.useState)(!0),[P,S]=(0,a.useState)(!0),[y,V]=(0,a.useState)(!1),[z,A]=(0,a.useState)(!1),O={buttonsPaddingTop:"top",buttonsPaddingLeft:"left",buttonsPaddingRight:"right",buttonsPaddingBottom:"bottom"},w=Xs(m,g),[U,J]=(0,a.useState)(w.headings.bold),[Q,I]=(0,a.useState)(w.headings.italic),[le,xe]=(0,a.useState)(w.links.underline),[ve,Z]=(0,a.useState)(w.buttons.bold),[be,Ne]=(0,a.useState)(w.buttons.italic),[de,Fe]=(0,a.useState)(null),Ae=r.useSelector(r.selectIsPanelHistoryCollapsed);(0,a.useEffect)(()=>{Ae||Fe(null)},[w,Fe,Ae]),(0,a.useEffect)(()=>{Ae&&!de&&Fe(Ks(w))},[w,de,Ae]),(0,a.useEffect)(()=>{p&&(s(r.setIsNeedUpdateContentAppearance(!1)),d.setFieldsValue(Ks(w)))},[d,p,s,w]);const[Ge,je]=(0,a.useState)(Math.min(w.headings.fontSize-1,19)),[ye,_e]=(0,a.useState)(Math.max(w.text.fontSize+1,20));(0,a.useEffect)(()=>{if(de){const K=de.buttonsBorder;h(K);const ee=Object.keys(K).find(ne=>K[ne]?.width||K[ne]?.style||K[ne]?.color),ie=de.cardsBorder;x(ie);const ae=Object.keys(ie).find(ne=>ie[ne]?.width||ie[ne]?.style||ie[ne]?.color);d.setFieldsValue({buttons_borderPosition:ee||"all",buttons_borderWidth:K[ee]?.width!==null?K[ee]?.width:"",buttons_borderColor:K[ee]?.color||"",buttons_borderStyle:K[ee]?.style||"",cards_borderPosition:ae||"all",cards_borderWidth:ie[ae]?.width!==null?ie[ae]?.width:"",cards_borderColor:ie[ae]?.color||"",cards_borderStyle:ie[ae]?.style||"",buttons_borderRadiusAll:u(de.buttonsBorderRadius.all),buttons_borderRadiusTopLeft:u(de.buttonsBorderRadius.topLeft),buttons_borderRadiusBottomLeft:u(de.buttonsBorderRadius.bottomLeft),buttons_borderRadiusTopRight:u(de.buttonsBorderRadius.topRight),buttons_borderRadiusBottomRight:u(de.buttonsBorderRadius.bottomRight),cards_borderRadiusAll:u(de.cardsBorderRadius.all),cards_borderRadiusTopLeft:u(de.cardsBorderRadius.topLeft),cards_borderRadiusBottomLeft:u(de.cardsBorderRadius.bottomLeft),cards_borderRadiusTopRight:u(de.cardsBorderRadius.topRight),cards_borderRadiusBottomRight:u(de.cardsBorderRadius.bottomRight),blockPaddingAll:u(de.blockPaddingAll),blockPaddingTop:u(de.blockPaddingTop),blockPaddingRight:u(de.blockPaddingRight),blockPaddingBottom:u(de.blockPaddingBottom),blockPaddingLeft:u(de.blockPaddingLeft),blockPaddingLeftRight:u(de.blockPaddingRight)||u(de.blockPaddingLeft),blockPaddingTopBottom:u(de.blockPaddingTop)||u(de.blockPaddingBottom)}),!u(de.blockPaddingAll)&&(u(de.blockPaddingTop)||u(de.blockPaddingRight)||u(de.blockPaddingBottom)||u(de.blockPaddingLeft))&&(de.blockPaddingTop!==de.blockPaddingBottom||de.blockPaddingRight!==de.blockPaddingLeft)?A(!1):A(!0),!u(de.buttonsBorderRadius.all)&&(u(de.buttonsBorderRadius.topLeft)||u(de.buttonsBorderRadius.bottomLeft)||u(de.buttonsBorderRadius.topRight)||u(de.buttonsBorderRadius.bottomRight))?j(!1):j(!0),de.buttonsPadding&&!u(de.buttonsPadding.all)&&(u(de.buttonsPadding.bottom)||u(de.buttonsPadding.right)||u(de.buttonsPadding.left)||u(de.buttonsPadding.top))&&V(!1),!u(de.cardsBorderRadius?.all)&&(u(de.cardsBorderRadius?.topLeft)||u(de.cardsBorderRadius?.bottomLeft)||u(de.cardsBorderRadius?.topRight)||u(de.cardsBorderRadius?.bottomRight))?S(!1):S(!0)}},[d,de]);const pe=()=>{A(ee=>!ee);const K=d.getFieldsValue(!0);if(!z){K.blockPaddingLeftRight=K.blockPaddingLeft,K.blockPaddingTopBottom=K.blockPaddingTop,K.blockPaddingRight=K.blockPaddingLeft,K.blockPaddingBottom=K.blockPaddingTop;const ee=Number(K.blockPaddingTopBottom),ie=Number(K.blockPaddingLeftRight);n({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{blockPadding:{top:Number.isFinite(ee)?ee:0,bottom:Number.isFinite(ee)?ee:0,left:Number.isFinite(ie)?ie:0,right:Number.isFinite(ie)?ie:0}}})}},fe=K=>{const ee=K.target.closest("button");if(!ee)return;const ie=ee.name,ae=ee.classList.contains("selected-td-form__button--active");ee.className=ae?"ant-btn ant-btn-default":"ant-btn ant-btn-default selected-td-form__button--active";try{ee.blur()}catch{}ie==="headingBold"?J(!ae):ie==="headingItalic"?I(!ae):ie==="linkUnderline"?xe(!ae):ie==="buttonsBold"?Z(!ae):ie==="buttonsItalic"&&Ne(!ae),n({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[ie]:!ae}})},me=K=>{const ee=d.getFieldsValue(!0),ie=Object.keys(K)[0];let ae={};switch(ie){case"headingFontSize":je(Math.min(ee.headingFontSize-1,19)),ae=K;break;case"textFontSize":_e(Math.max(ee.textFontSize+1,20)),ae=K;break;case"buttons_borderStyle":ae={buttonsBorder:{[ee.buttons_borderPosition]:{...b[ee.buttons_borderPosition],style:K[ie]}}},ee.buttons_borderPosition==="all"?h(ne=>({...r.RESET_BORDER_PARAMS,[ee.buttons_borderPosition]:{...ne[ee.buttons_borderPosition],style:K[ie]}})):h(ne=>({...ne,[ee.buttons_borderPosition]:{...ne[ee.buttons_borderPosition],style:K[ie]}}));break;case"buttons_borderColor":ae={buttonsBorder:{[ee.buttons_borderPosition]:{...b[ee.buttonsBorderPosition],color:K[ie]}}},ee.buttons_borderPosition==="all"?h(ne=>({...r.RESET_BORDER_PARAMS,[ee.buttons_borderPosition]:{...ne[ee.buttons_borderPosition],color:K[ie]}})):h(ne=>({...ne,[ee.buttons_borderPosition]:{...ne[ee.buttons_borderPosition],color:K[ie]}}));break;case"buttons_borderWidth":ae={buttonsBorder:{[ee.buttons_borderPosition]:{...b[ee.buttons_borderPosition],width:K[ie]}}},ee.buttonsBorderPosition==="all"?h(ne=>({...r.RESET_BORDER_PARAMS,[ee.buttons_borderPosition]:{...ne[ee.buttons_borderPosition],width:K[ie]}})):h(ne=>({...ne,[ee.buttons_borderPosition]:{...ne[ee.buttons_borderPosition],width:K[ie]}}));break;case"buttons_borderPosition":d.setFieldsValue({buttons_borderWidth:b[K[ie]]?.width||"",buttons_borderColor:b[K[ie]]?.color||"",buttons_borderStyle:b[K[ie]]?.style||""});break;case"cards_borderStyle":ae={cardsBorder:{[ee.cards_borderPosition]:{...k[ee.cards_borderPosition],style:K[ie]}}},ee.cards_borderPosition==="all"?x(ne=>({...r.RESET_BORDER_PARAMS,[ee.cards_borderPosition]:{...ne[ee.cards_borderPosition],style:K[ie]}})):x(ne=>({...ne,[ee.cards_borderPosition]:{...ne[ee.cards_borderPosition],style:K[ie]}}));break;case"cards_borderColor":ae={cardsBorder:{[ee.cards_borderPosition]:{...k[ee.cardsBorderPosition],color:K[ie]}}},ee.cards_borderPosition==="all"?x(ne=>({...r.RESET_BORDER_PARAMS,[ee.cards_borderPosition]:{...ne[ee.cards_borderPosition],color:K[ie]}})):x(ne=>({...ne,[ee.cards_borderPosition]:{...ne[ee.cards_borderPosition],color:K[ie]}}));break;case"cards_borderWidth":ae={cardsBorder:{[ee.cards_borderPosition]:{...k[ee.cards_borderPosition],width:K[ie]}}},ee.cardsBorderPosition==="all"?x(ne=>({...r.RESET_BORDER_PARAMS,[ee.cards_borderPosition]:{...ne[ee.cards_borderPosition],width:K[ie]}})):x(ne=>({...ne,[ee.cards_borderPosition]:{...ne[ee.cards_borderPosition],width:K[ie]}}));break;case"cards_borderPosition":d.setFieldsValue({cards_borderWidth:k[K[ie]]?.width||"",cards_borderColor:k[K[ie]]?.color||"",cards_borderStyle:k[K[ie]]?.style||""});break;case"buttons_borderRadiusAll":case"buttons_borderRadiusTopLeft":case"buttons_borderRadiusBottomLeft":case"buttons_borderRadiusTopRight":case"buttons_borderRadiusBottomRight":ae={buttonsBorderRadius:{[Qu[ie]]:+K[ie]}};break;case"cards_borderRadiusAll":case"cards_borderRadiusTopLeft":case"cards_borderRadiusBottomLeft":case"cards_borderRadiusTopRight":case"cards_borderRadiusBottomRight":ae={cardsBorderRadius:{[Zu[ie]]:+K[ie]}};break;case"buttonsPaddingTop":case"buttonsPaddingLeft":case"buttonsPaddingRight":case"buttonsPaddingBottom":y?(ae={padding:{all:+K[ie]}},d.setFieldsValue({paddingTop:K[ie],paddingLeft:K[ie],paddingRight:K[ie],paddingBottom:K[ie]})):ae={buttonsPadding:{[O[ie]]:+K[ie]}};break;case"blockPaddingTop":case"blockPaddingLeft":case"blockPaddingRight":case"blockPaddingBottom":ae={blockPadding:{[em[ie]]:+K[ie]}};break;case"blockPaddingTopBottom":ae={blockPadding:{top:+K[ie],bottom:+K[ie]}},ee.blockPaddingTop=ee.blockPaddingBottom=+K[ie];break;case"blockPaddingLeftRight":ae={blockPadding:{left:+K[ie],right:+K[ie]}},ee.blockPaddingLeft=ee.blockPaddingRight=+K[ie];break;default:ae=K}ie!=="buttons_borderPosition"&&n({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:ae})};return de&&(0,o.jsx)("div",{className:(0,Ke.default)("appearance-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"content_appearance_panel_form",initialValues:de,onValuesChange:me,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:E.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:E.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:z,onToggleExtended:pe,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:E.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{loadGoogleFonts:l,getPopupContainer:K=>K.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:Ge,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:E.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{loadGoogleFonts:l,getPopupContainer:K=>K.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:E.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:ye,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:E.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,Ke.default)({"selected-td-form__button--active":U}),type:"default",name:"headingBold",onClick:fe,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,Ke.default)({"selected-td-form__button--active":Q}),type:"default",name:"headingItalic",onClick:fe,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:E.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,Ke.default)({"selected-td-form__button--active":le}),type:"default",name:"linkUnderline",onClick:fe,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:E.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{loadGoogleFonts:l,getPopupContainer:K=>K.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:E.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:E.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:E.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:E.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})})})}),_.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(st,{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,Ke.default)({"selected-td-form__button--active":ve}),type:"default",name:"buttonsBold",onClick:fe,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,Ke.default)({"selected-td-form__button--active":be}),type:"default",name:"buttonsItalic",onClick:fe,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined})})})]})})]})]}),_.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Borders")]}),dividerTop:!0,children:(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(W.SelectedElementFormBorder,{form:d,borders:b,namePrefix:"buttons_"})})}),_.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)(Io,{form:d,oneBorderRadiusValue:T,setOneBorderRadiusValue:j,elementSettings:de,namePrefix:"buttons_"})})}),(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Margins")]}),dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Top margin"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsMarginTop",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Top margin"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingTop",component:t.icons$PaddingTop}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom margin"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsMarginBottom",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom margin"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingBottom",component:t.icons$PaddingBottom}),addonAfter:"px"})})})})]})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Cards")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Colors")]}),dividerTop:!0,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:i("Base colors"),compact:!0,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Base background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsBaseBackgroundColor",style:{marginBottom:E.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:E.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})})})})]})]}),_.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Cards")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Borders")]}),dividerTop:!0,children:(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(W.SelectedElementFormBorder,{form:d,borders:k,namePrefix:"cards_"})})}),_.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)(Io,{form:d,oneBorderRadiusValue:P,setOneBorderRadiusValue:S,elementSettings:de,namePrefix:"cards_"})})})]})})},lr=({email:e})=>{const{__:i}=r.useI18n(),l=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,[s,n]=(0,a.useState)(r.APPEARANCE),d=r.useAppConfig(),c=m=>n(m||"");e.common_styles&&e.common_styles;const p=l==="email"&&d.commonStylesEnabled&&!0;let g=[{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)(Hs,{className:"email-settings__collapse-panel-content"}):(0,o.jsx)(zs,{className:"email-settings__collapse-panel-content"})}];return p&&g.push({label:(0,o.jsx)(o.Fragment,{children:i("Content styles")}),key:"contentStyles",forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(om,{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:g})})};lr.propTypes={};var tm=bo.__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 im(e){return e.type===po.Tag||e.type===po.Script||e.type===po.Style}var po,rm,lm,sm,am,nm,dm,cm,um,mm,qs=bo.__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"})(po||(po={})),rm=po.Root,lm=po.Text,sm=po.Directive,am=po.Comment,nm=po.Script,dm=po.Style,cm=po.Tag,um=po.CDATA,mm=po.Doctype}));function Js(e){return im(e)}function Qs(e){return e.type===po.CDATA}function Zs(e){return e.type===po.Text}function ea(e){return e.type===po.Comment}function oa(e){return e.type===po.Directive}function ta(e){return e.type===po.Root}function pm(e){return Object.hasOwn(e,"children")}function sr(e,i=!1){let l;if(Zs(e))l=new Pt(e.data);else if(ea(e))l=new ci(e.data);else if(Js(e)){const s=i?ar(e.children):[],n=new pi(e.name,{...e.attribs},s);for(const d of s)d.parent=n;e.namespace!=null&&(n.namespace=e.namespace),e["x-attribsNamespace"]&&(n["x-attribsNamespace"]={...e["x-attribsNamespace"]}),e["x-attribsPrefix"]&&(n["x-attribsPrefix"]={...e["x-attribsPrefix"]}),l=n}else if(Qs(e)){const s=i?ar(e.children):[],n=new mi(s);for(const d of s)d.parent=n;l=n}else if(ta(e)){const s=i?ar(e.children):[],n=new At(s);for(const d of s)d.parent=n;e["x-mode"]&&(n["x-mode"]=e["x-mode"]),l=n}else if(oa(e)){const s=new ui(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 ar(e){const i=e.map(l=>sr(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 di,Ct,Pt,ci,ui,Nt,mi,At,pi,ia=bo.__esmMin((()=>{qs(),di=class{parent=null;prev=null;next=null;startIndex=null;endIndex=null;get parentNode(){return this.parent}set parentNode(e){this.parent=e}get previousSibling(){return this.prev}set previousSibling(e){this.prev=e}get nextSibling(){return this.next}set nextSibling(e){this.next=e}cloneNode(e=!1){return sr(this,e)}},Ct=class extends di{data;constructor(e){super(),this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}},Pt=class extends Ct{type=po.Text;get nodeType(){return 3}},ci=class extends Ct{type=po.Comment;get nodeType(){return 8}},ui=class extends Ct{type=po.Directive;name;constructor(e,i){super(i),this.name=e}get nodeType(){return 1}"x-name";"x-publicId";"x-systemId"},Nt=class extends di{children;constructor(e){super(),this.children=e}get firstChild(){return this.children[0]??null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(e){this.children=e}},mi=class extends Nt{type=po.CDATA;get nodeType(){return 4}},At=class extends Nt{type=po.Root;get nodeType(){return 9}},pi=class extends Nt{name;attribs;type;constructor(e,i,l=[],s=e==="script"?po.Script:e==="style"?po.Style:po.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"}})),nr=bo.__exportAll({CDATA:()=>mi,Comment:()=>ci,DataNode:()=>Ct,Document:()=>At,DomHandler:()=>cr,Element:()=>pi,Node:()=>di,NodeWithChildren:()=>Nt,ProcessingInstruction:()=>ui,Text:()=>Pt,cloneNode:()=>sr,default:()=>cr,hasChildren:()=>pm,isCDATA:()=>Qs,isComment:()=>ea,isDirective:()=>oa,isDocument:()=>ta,isTag:()=>Js,isText:()=>Zs}),dr,cr,ur=bo.__esmMin((()=>{qs(),ia(),ia(),dr={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},cr=class{dom=[];root=new At(this.dom);callback;options;elementCB;done=!1;tagStack=[this.root];lastNode=null;parser=null;constructor(e,i,l){typeof i=="function"&&(l=i,i=dr),typeof e=="object"&&(i=e,e=void 0),this.callback=e??null,this.options=i??dr,this.elementCB=l??null}onparserinit(e){this.parser=e}onreset(){this.dom=[],this.root=new At(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?po.Tag:void 0,s=new pi(e,i,void 0,l);this.addNode(s),this.tagStack.push(s)}ontext(e){const{lastNode:i}=this;if(i&&i.type===po.Text)i.data+=e,this.options.withEndIndices&&this.parser&&(i.endIndex=this.parser.endIndex);else{const l=new Pt(e);this.addNode(l),this.lastNode=l}}oncomment(e){if(this.lastNode&&this.lastNode.type===po.Comment){this.lastNode.data+=e;return}const i=new ci(e);this.addNode(i),this.lastNode=i}oncommentend(){this.lastNode=null}oncdatastart(){const e=new Pt(""),i=new mi([e]);this.addNode(i),e.parent=i,this.lastNode=e}oncdataend(){this.lastNode=null}onprocessinginstruction(e,i){const l=new ui(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}}})),ra=bo.__commonJSMin((e=>{var i=tm(),l=(ur(),bo.__toCommonJS(nr)),s="\r",n=new RegExp(s,"g"),d=`__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_${Date.now().toString()}__`,c=new RegExp(d,"g");function p(k){return i.CASE_SENSITIVE_TAG_NAMES_MAP[k]}function g(k){const x={};let T=0;const j=k.length;for(;T<j;T++){const P=k[T];x[P.name]=P.value}return x}function m(k){k=k.toLowerCase();const x=p(k);return x||k}function _(k,x){const T="<"+x,j=k.toLowerCase().indexOf(T);if(j===-1)return!1;const P=k[j+T.length];return P===">"||P===" "||P===" "||P===`
|
|
10
|
+
`||P==="\r"||P==="/"}function E(k){return k.replace(n,d)}function b(k){return k.replace(c,s)}function h(k,x=null,T){const j=[];let P,S=0;const y=k.length;for(;S<y;S++){const V=k[S];switch(V.nodeType){case 1:{const A=m(V.nodeName);P=new l.Element(A,g(V.attributes)),P.children=h(A==="template"?V.content.childNodes:V.childNodes,P);break}case 3:P=new l.Text(b(V.nodeValue??""));break;case 8:P=new l.Comment(V.nodeValue??"");break;default:continue}const z=j[S-1]??null;z&&(z.next=P),P.parent=x,P.prev=z,P.next=null,j.push(P)}return T&&(P=new l.ProcessingInstruction(T.substring(0,T.indexOf(" ")).toLowerCase(),T),P.next=j[0]??null,P.parent=x,j.unshift(P),j[1]&&(j[1].prev=j[0])),j}e.escapeSpecialCharacters=E,e.formatDOM=h,e.hasOpenTag=_})),hm=bo.__commonJSMin((e=>{var i=ra(),l="html",s="head",n="body",d=/<([a-zA-Z]+[0-9]?)/;function c(k,x){return x?x.createHTML(k):k}var p=(k,x,T)=>{throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},g=(k,x,T)=>{throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},m=typeof window=="object"&&window.DOMParser;if(typeof m=="function"){const k=new m,x="text/html";g=(T,j,P)=>(j&&(T=`<${j}>${T}</${j}>`),k.parseFromString(T,x)),p=g}if(typeof document=="object"&&document.implementation){const k=document.implementation.createHTMLDocument();p=function(x,T,j){if(T){const P=k.documentElement.querySelector(T);return P&&(P.innerHTML=c(x,j)),k}return k.documentElement.innerHTML=c(x,j),k}}var _=typeof document=="object"&&document.createElement("template"),E;_&&_.content&&(E=(k,x)=>(_.innerHTML=c(k,x),_.content.childNodes));var b=()=>document.createDocumentFragment().childNodes;function h(k,x){k=i.escapeSpecialCharacters(k);const T=d.exec(k)?.[1]?.toLowerCase();switch(T){case l:{const j=g(k);if(!i.hasOpenTag(k,s)){const P=j.querySelector(s);P?.parentNode?.removeChild(P)}if(!i.hasOpenTag(k,n)){const P=j.querySelector(n);P?.parentNode?.removeChild(P)}return j.querySelectorAll(l)}case s:case n:{const j=p(k,void 0,x).querySelectorAll(T);return i.hasOpenTag(k,n)&&i.hasOpenTag(k,s)?j[0].parentNode?.childNodes??b():j}default:return E?E(k,x):p(k,n,x).querySelector(n)?.childNodes??b()}}e.default=h})),bm=bo.__commonJSMin((e=>{Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var i=ra(),l=hm(),s=/<(![a-zA-Z\s]+)>/;function n(d,c){if(typeof d!="string")throw new TypeError("First argument must be a string");if(!d)return[];const p=s.exec(d),g=p?p[1]:void 0;return i.formatDOM(l.default(d,c?.trustedTypePolicy),null,g)}e.default=n})),gm=bo.__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}})),fm=bo.__commonJSMin((e=>{var i=0,l=1,s=2,n=3,d=4,c=5,p=6;function g(S){return _.hasOwnProperty(S)?_[S]:null}function m(S,y,V,z,A,O,w){this.acceptsBooleans=y===s||y===n||y===d,this.attributeName=z,this.attributeNamespace=A,this.mustUseProperty=V,this.propertyName=S,this.type=y,this.sanitizeURL=O,this.removeEmptyString=w}var _={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(S=>{_[S]=new m(S,i,!1,S,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([S,y])=>{_[S]=new m(S,l,!1,y,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(S=>{_[S]=new m(S,s,!1,S.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(S=>{_[S]=new m(S,s,!1,S,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(S=>{_[S]=new m(S,n,!1,S.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(S=>{_[S]=new m(S,n,!0,S,null,!1,!1)}),["capture","download"].forEach(S=>{_[S]=new m(S,d,!1,S,null,!1,!1)}),["cols","rows","size","span"].forEach(S=>{_[S]=new m(S,p,!1,S,null,!1,!1)}),["rowSpan","start"].forEach(S=>{_[S]=new m(S,c,!1,S.toLowerCase(),null,!1,!1)});var E=/[\-\:]([a-z])/g,b=S=>S[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(S=>{const y=S.replace(E,b);_[y]=new m(y,l,!1,S,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(S=>{const y=S.replace(E,b);_[y]=new m(y,l,!1,S,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(S=>{const y=S.replace(E,b);_[y]=new m(y,l,!1,S,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(S=>{_[S]=new m(S,l,!1,S.toLowerCase(),null,!1,!1)});var h="xlinkHref";_[h]=new m("xlinkHref",l,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(S=>{_[S]=new m(S,l,!1,S.toLowerCase(),null,!0,!0)});var{CAMELCASE:k,SAME:x,possibleStandardNames:T}=gm(),j=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]*$")),P=Object.keys(T).reduce((S,y)=>{const V=T[y];return V===x?S[y]=y:V===k?S[y.toLowerCase()]=y:S[y]=V,S},{});e.BOOLEAN=n,e.BOOLEANISH_STRING=s,e.NUMERIC=c,e.OVERLOADED_BOOLEAN=d,e.POSITIVE_NUMERIC=p,e.RESERVED=i,e.STRING=l,e.getPropertyInfo=g,e.isCustomAttribute=j,e.possibleStandardNames=P}));function _m(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 n(k){var x=k.match(sa);x&&(l+=x.length);var T=k.lastIndexOf(pa);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),m(),x}}function c(k){this.start=k,this.end={line:l,column:s},this.source=i.source}c.prototype.content=e;function p(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 g(k){var x=k.exec(e);if(x){var T=x[0];return n(T),e=e.slice(T.length),x}}function m(){g(aa)}function _(k){var x;for(k=k||[];x=E();)x!==!1&&k.push(x);return k}function E(){var k=d();if(!(pr!=e.charAt(0)||hr!=e.charAt(1))){for(var x=2;Qo!=e.charAt(x)&&(hr!=e.charAt(x)||pr!=e.charAt(x+1));)++x;if(x+=2,Qo===e.charAt(x-1))return p("End of comment missing");var T=e.slice(2,x-2);return s+=2,n(T),e=e.slice(x),s+=2,k({type:ha,comment:T})}}function b(){var k=d(),x=g(na);if(x){if(E(),!g(da))return p("property missing ':'");var T=g(ca),j=k({type:ba,property:la(x[0].replace(mr,Qo)),value:T?la(T[0].replace(mr,Qo)):Qo});return g(ua),j}}function h(){var k=[];_(k);for(var x;x=b();)x!==!1&&(k.push(x),_(k));return k}return m(),h()}function la(e){return e?e.replace(ma,Qo):Qo}var mr,sa,aa,na,da,ca,ua,ma,pa,pr,hr,Qo,ha,ba,xm=bo.__esmMin((()=>{mr=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,sa=/\n/g,aa=/^\s*/,na=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,da=/^:\s*/,ca=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,ua=/^[;\s]*/,ma=/^\s+|\s+$/g,pa=`
|
|
11
|
+
`,pr="/",hr="*",Qo="",ha="comment",ba="declaration"}));function km(e,i){let l=null;if(!e||typeof e!="string")return l;const s=_m(e),n=typeof i=="function";return s.forEach(d=>{if(d.type!=="declaration")return;const{property:c,value:p}=d;n?i(c,p,d):p&&(l=l??{},l[c]=p)}),l}var Em=bo.__esmMin((()=>{xm()})),Bm=bo.__exportAll({default:()=>Sm});function Sm(e,i){const l={};return!e||typeof e!="string"||km(e,(s,n)=>{s&&n&&(l[Sa(s,i)]=n)}),l}var ga,fa,_a,xa,ka,Ea,Ba,br,Sa,Tm=bo.__esmMin((()=>{Em(),ga=/^--[a-zA-Z0-9_-]+$/,fa=/-([a-z])/g,_a=/^[^-]+$/,xa=/^-(webkit|moz|ms|o|khtml)-/,ka=/^-(ms)-/,Ea=e=>!e||_a.test(e)||ga.test(e),Ba=(e,i)=>i.toUpperCase(),br=(e,i)=>`${i}-`,Sa=(e,i={})=>Ea(e)?e:(e=e.toLowerCase(),i.reactCompat?e=e.replace(ka,br):e=e.replace(xa,br),e.replace(fa,Ba))})),Ta=bo.__commonJSMin((e=>{var i=e&&e.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(e,"__esModule",{value:!0}),e.returnFirstArg=e.canTextBeChildOfNode=e.ELEMENTS_WITH_NO_TEXT_CHILDREN=e.PRESERVE_CUSTOM_ATTRIBUTES=void 0,e.isCustomComponent=d,e.setStyleProp=p;var l=xo("react"),s=i((Tm(),bo.__toCommonJS(Bm))),n=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){return _.includes("-")?!n.has(_):!!(E&&typeof E.is=="string")}var c={reactCompat:!0};function p(_,E){if(typeof _=="string"){if(!_.trim()){E.style={};return}try{E.style=(0,s.default)(_,c)}catch{E.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 g=_=>!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(_.name);e.canTextBeChildOfNode=g;var m=_=>_;e.returnFirstArg=m})),Ra=bo.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var i=fm(),l=Ta(),s=["checked","value"],n=["input","select","textarea"],d={reset:!0,submit:!0};function c(g={},m){const _={},E=!!(g.type&&d[g.type]);for(const b in g){const h=g[b];if((0,i.isCustomAttribute)(b)){_[b]=h;continue}const k=b.toLowerCase();let x=p(k);if(x){const T=(0,i.getPropertyInfo)(x);switch(s.includes(x)&&n.includes(m)&&!E&&(x=p("default"+k)),_[x]=h,T?.type){case i.BOOLEAN:_[x]=!0;break;case i.OVERLOADED_BOOLEAN:h===""&&(_[x]=!0)}continue}l.PRESERVE_CUSTOM_ATTRIBUTES&&(_[b]=h)}return(0,l.setStyleProp)(g.style,_),_}function p(g){return i.possibleStandardNames[g]}})),Rm=bo.__commonJSMin((e=>{var i=e&&e.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=p;var l=(ur(),bo.__toCommonJS(nr)),s=xo("react"),n=i(Ra()),d=Ta(),c={cloneElement:s.cloneElement,createElement:s.createElement,isValidElement:s.isValidElement};function p(_,E={}){var b,h,k,x,T;const j=[],P=typeof E.replace=="function",S=(b=E.transform)!==null&&b!==void 0?b:d.returnFirstArg,{cloneElement:y,createElement:V,isValidElement:z}=(h=E.library)!==null&&h!==void 0?h:c,A=_.length;g(_);for(let O=0;O<A;O++){const w=_[O];if(P){let I=(k=E.replace)===null||k===void 0?void 0:k.call(E,w,O);if(z(I)){A>1&&(I=y(I,{key:(x=I.key)!==null&&x!==void 0?x:O})),j.push(S(I,w,O));continue}}if(w.type==="text"){const I=!w.data.trim().length;if(I&&w.parent&&!(0,d.canTextBeChildOfNode)(w.parent)||E.trim&&I)continue;j.push(S(w.data,w,O));continue}const U=w;let J={};m(U)?((0,d.setStyleProp)(U.attribs.style,U.attribs),J=U.attribs):U.attribs&&(J=(0,n.default)(U.attribs,U.name));let Q;switch(w.type){case"script":case"style":w.children[0]&&(J.dangerouslySetInnerHTML={__html:w.children[0].data});break;case"tag":w.name==="textarea"&&w.children[0]?J.defaultValue=w.children[0].data:!((T=w.children)===null||T===void 0)&&T.length&&(Q=p(w.children,E));break;default:continue}A>1&&(J.key=O),j.push(S(V(w.name,J,Q),w,O))}return j.length===1?j[0]:j}function g(_){for(const E of _)(E.type==="tag"||E.type==="script"||E.type==="style")&&(Object.setPrototypeOf(E,l.Element.prototype),g(E.children))}function m(_){return d.PRESERVE_CUSTOM_ATTRIBUTES&&_.type==="tag"&&(0,d.isCustomComponent)(_.name,_.attribs)}})),ym=bo.__commonJSMin((e=>{var i=e&&e.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(e,"__esModule",{value:!0}),e.htmlToDOM=e.domToReact=e.attributesToProps=e.Text=e.ProcessingInstruction=e.Element=e.Comment=void 0,e.default=p;var l=i(bm());e.htmlToDOM=l.default;var s=i(Ra());e.attributesToProps=s.default;var n=i(Rm());e.domToReact=n.default;var d=(ur(),bo.__toCommonJS(nr));Object.defineProperty(e,"Comment",{enumerable:!0,get:function(){return d.Comment}}),Object.defineProperty(e,"Element",{enumerable:!0,get:function(){return d.Element}}),Object.defineProperty(e,"ProcessingInstruction",{enumerable:!0,get:function(){return d.ProcessingInstruction}}),Object.defineProperty(e,"Text",{enumerable:!0,get:function(){return d.Text}});var c={lowerCaseAttributeNames:!1};function p(g,m){var _;if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];const E=Object.assign(Object.assign({},(_=m?.htmlparser2)!==null&&_!==void 0?_:c),{trustedTypePolicy:m?.trustedTypePolicy});return(0,n.default)((0,l.default)(g,E),m)}})),ft=bo.__toESM(ym(),1),jm=ft.default.default||ft.default,gr=new Set;function wm(e,i){gr.has(e)||(gr.add(e),Promise.resolve(i()).finally(()=>{gr.delete(e)}))}var vm={subject:"insert_generated_subject",preheader:"insert_generated_preheader"};function ya(e,i,l){l.document&&(r.writeEmailAttributes(l.document,{[e]:i}),l.pushToDataLayer({event:"submit",action:vm[e],entity_type:l.entityType,entity_id:l.entityId,project_id:l.projectId,context:"editor"}))}function fr({limitsInPlugin:e,hostedAiActive:i}){return e&&!i}function ja({limitsInPlugin:e,hostedAiActive:i,counter:l,limit:s}){return fr({limitsInPlugin:e,hostedAiActive:i})?s>0&&l>=s:!1}function wa(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"),n=s.querySelector("editor");if(n){n.innerHTML=i;const d=e.match(/^[\s\uFEFF]*<!DOCTYPE[^>]*>/i);return`${d?`${d[0]}
|
|
12
|
+
`:""}${s.documentElement.outerHTML}`}}catch{}return i}var Im=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")]})}]},Cm={background:r.emCssVar("colorInfo"),color:"#ffffff"},va=({messages:e,newEmailAiGeneratorRef:i})=>{const l=r.useElementEntityKind(),{document:s}=r.useDocumentSessionContext(),n=r.useContentReader(),d=r.useUserContentReplacer(),{__:c,_n:p}=r.useI18n(),g=r.useDispatch(),m=r.useAppNavigate(),_=(0,a.useRef)(null),E=r.useAppConfig(),b=r.useEditorLocked(),h=r.useEditorLockCheck(),k=r.useNotification(),x=r.useEditorProjectId(),T=r.useWpEntityId(),j=r.usePushToDataLayer(),P={document:s,pushToDataLayer:j,entityType:l==="block"?"block":"email",entityId:T,projectId:x},S=r.useEventEmitter(vo.events.ON_LIMIT_ID),[y,V]=(0,a.useState)(null),[z,A]=(0,a.useState)(0),[O,w]=(0,a.useState)(!1),[U,J]=(0,a.useState)(""),[Q,I]=(0,a.useState)([]),[le,xe]=(0,a.useState)(!1),[ve,Z]=(0,a.useState)(!1),[be,Ne]=(0,a.useState)(null),[de,Fe]=(0,a.useState)(0),[Ae,Ge]=(0,a.useState)(null),je=r.useEmailAttribute("subject"),ye=r.useEmailAttribute("preheader"),_e=r.useCurrentUser(),pe=r.toLanguageCode(r.useInterfaceLocale()),fe=_e.avatar_url||_e.avatar_urls?.[24],me=[_e.first_name,_e.last_name].filter(Boolean).join(" ")||_e.username,K=r.useMessageService(),[ee]=r.useLazyGetDialogQuery(),ie=r.useSendPostMessage(),[ae,ne]=r.useSendMessageMutation(),Me=(0,a.useRef)(new Set),te=(0,a.useCallback)(q=>{const We=ae(q),Je=Me.current;Je.add(We);const Ue=()=>Je.delete(We);return We.then(Ue,Ue),We},[ae]);(0,a.useEffect)(()=>{const q=Me.current;return()=>{q.forEach(We=>We.abort?.()),q.clear()}},[]);const[Te,{reset:ke}]=r.useGetAiGenerateStatusMutation(),[M,{data:C=[]}]=r.useLazyGetGeneratedContentQuery(),[G]=r.useLazyGetLimitsStatsByTypeQuery(),L={cursor:O?"not-allowed":"default",pointerEvents:O?"none":"auto"};(0,a.useEffect)(()=>{Ae&&le&&(i.current=!0),le||(i.current=!1)},[Ae,le]);const re=!!(E.limits&&E.counters)&&!0,{limits:ce}=E.limits?E:{limits:{ai_limit:0,ai_generator_limit:0}},{ai_limit:he,ai_generator_limit:Ee}=ce,$e=r.useEventEmitter(vo.events.AI_TEXT_REQUEST_ID).hasListeners(),Ce=fr({limitsInPlugin:re,hostedAiActive:$e}),Y=ja({limitsInPlugin:re,hostedAiActive:$e,counter:z,limit:he}),oe=ja({limitsInPlugin:re,hostedAiActive:$e,counter:de,limit:Ee}),D=(0,a.useCallback)(()=>{S.fire({name:"AiChatCount",count:z+1})},[S,z]),ue=(0,a.useCallback)(()=>{S.fire({name:"AiGeneratorCount",count:de+1})},[S,de]),Ie=(0,a.useCallback)(async q=>!0,[c,G,k]);(0,a.useEffect)(()=>{re&&(A(E?.counters?.ai_counter||0),Fe(E?.counters?.ai_generator_counter||0))},[E,re]),(0,a.useEffect)(()=>{Ge(Q.length<=0?!1:Q.toReversed().find(We=>We.data?.context)?.data.context==="email-generator")},[Q]);const Ve=(0,a.useCallback)(async()=>await K.sendAsync(r.EVENT_TYPES.SANDBOX_IS_EMAIL_EMPTY),[K]),to=(0,a.useCallback)(()=>{const q=_.current?.closest(".ant-tabs-content.ant-tabs-content-top");setTimeout(()=>{q?.scrollTo({top:q.scrollHeight,behavior:"smooth"})},0)},[_]),io=(0,a.useCallback)(()=>{r.swallowPromiseRejection(ee({entity_id:T}).then(q=>{I(q.data.documents),to()}))},[T,ee,I,to]),uo=(0,a.useCallback)(q=>{if(!q?.data?._eventResult)return!1;const{aiMessage:We,aiHtml:Je}=q.data;if(I(Ue=>{const eo=[...Ue];for(let oo=eo.length-1;oo>=0;oo--)if(eo[oo]?.data?.isLoading&&eo[oo]?.data?.role==="assistant"){eo[oo]={data:{role:"assistant",message:We,isLoading:!1}};break}return eo}),Je){const Ue=wa(n(),String(Je));d(Ue,{undoable:!0})}return to(),!0},[n,d,to]),$=(0,a.useCallback)(q=>{I(We=>{for(let Je=We.length-1;Je>=0;Je--)if(We[Je]?.data?.isLoading&&We[Je]?.data?.role==="assistant"){const Ue=[...We];return q?Ue[Je]={data:{role:"assistant",message:q}}:Ue.splice(Je,1),Ue}return We})},[]),se=(0,a.useCallback)(q=>{const We=q?.message==="ERROR"?void 0:q?.message;return[q?.data?.message,We].find(Je=>typeof Je=="string"&&Je)||c("Something went wrong.")},[c]),v=s?.get().docId,H=r.useEventEmitter(vo.events.AI_TEXT_PROGRESS_ID);(0,a.useEffect)(()=>{const q=H.event(({progress:We,status:Je,docId:Ue})=>{if(Ue!==v)return;const eo=Je||`${Math.round(We)}%`;I(oo=>{const yo=[...oo];for(let Eo=yo.length-1;Eo>=0;Eo--)if(yo[Eo]?.data?.isLoading&&yo[Eo]?.data?.role==="assistant"){yo[Eo]={data:{...yo[Eo].data,message:eo}};break}return yo})});return()=>q.dispose()},[H,v]);const Pe=r.useEventEmitter(vo.events.AI_TEXT_STREAM_ID);(0,a.useEffect)(()=>{const q=Pe.event(({partialHtml:We,docId:Je})=>{if(Je!==v)return;const Ue=wa(n(),String(We));d(Ue,{undoable:!0})});return()=>q.dispose()},[Pe,n,d,g,v]);const He=(0,a.useCallback)(q=>{xe(!0),w(!0),r.swallowPromiseRejection(Te({task_id:q||y,entity_id:T,status:"started"}).then(()=>{io()}))},[T,Te,y,io]),ko=(0,a.useCallback)(()=>{Te({task_id:y,entity_id:T,status:"completed"}).then(q=>{q.data.status===403&&ke(),io()}).catch(q=>{}),w(!1),xe(!1)},[T,Te,y,io,ke]);(0,a.useEffect)(()=>{let q;if(le){const We=C[C.length-1]?.processing?.email;if(We){let Je=C[C.length-1].status;d(String(We),{undoable:!0}),Je===0&&ko()}be&&(clearInterval(q),xe(!1),Ne(!1),w(!1),$())}return()=>{clearInterval(q)}},[d,be,g,C,le,je,ye,T,y,io,Te,ne,ko,$]),(0,a.useEffect)(to,[to]),(0,a.useEffect)(()=>{e?.length>0&&I(e),ie({operation:r.EVENT_TYPES.SANDBOX_EMAIL_CONTENT_GET})},[e,ie]),(0,a.useEffect)(()=>{const q=K.onInit(()=>{K.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:O}),K.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_DISCUSS,value:O})});return()=>q.dispose()},[O,K]);const mo=async()=>{if(U&&!h()){const q=U.replaceAll(/\n/g,"<br>"),We={project_id:x,connection:"chat",entity_id:T,message:q,locale:pe,subject:je||"",preheader:ye||"",textContent:bi.extractDocumentTextContent(n())};if(Ae&&oe||Y){k.error({title:c(Ae?"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 Je={data:{role:"assistant",message:c(Ae?"You have reached the limit of AI generator usage.":"You have reached the limit of AI chat usage.")}};I(Ue=>[...Ue,Je])}else{if(!await Ie(Ae?"email_generate":"ai")){J("");return}Ce&&(Ae&&de!==Ee?(ue(),Fe(Ue=>Ue+1)):z!==he&&(D(),A(Ue=>Ue+1))),j({event:"submit_form",action:"chat_whit_ai_assistant",entity_id:We.entity_id,project_id:We.project_id});const Je=[{data:{role:"user",message:q,userInfo:{display_name:me,avatar_url:fe}}},{data:{role:"assistant",message:c("Typing..."),isLoading:!0}}];I(Ue=>[...Ue,...Je]),te({body:We}).then(Ue=>{if(Ue?.error)throw Ue.error;if(!Ue?.data||Ue.data.status===401)throw new Error(r.ERROR);if(!uo(Ue)){if(j({event:"submit",action:"send_discussion_chat_message",entity_type:l==="block"?"block":"email",entity_id:T,project_id:x,context:"editor"}),Ue.data.task_id){let eo=Ue.data.task_id;V(eo),M({id:eo,setError:Ne}),r.swallowPromiseRejection(Ve().then(oo=>{oo?He(eo):Z(!0)}))}io()}}).catch(Ue=>{const eo=se(Ue);k.error({title:Ue?.data?.code||c("Error"),description:eo}),$(eo)})}J("")}},ao=async q=>{if(h())return;const We={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};I(Ue=>[...Ue,We]);const Je={project_id:x,connection:"chat",entity_id:T,context:q,locale:pe,subject:je||"",preheader:ye||"",textContent:bi.extractDocumentTextContent(n())};if(Ce&&(Ae&&de!==Ee?(ue(),Fe(Ue=>Ue+1)):z!==he&&(D(),A(Ue=>Ue+1))),Y)k.error({title:c("You have reached the limit of AI chat usage."),description:c("Please upgrade your plan.")}),$(c("You have reached the limit of AI chat usage."));else{if(!await Ie("ai")){$();return}j({event:"select",action:"select_ai_assistant_role",context:Je.context,entity_id:Je.entity_id,project_id:Je.project_id}),te({body:Je}).then(Ue=>{if(Ue?.error)throw Ue.error;if(!Ue?.data||Ue.data.status===401)throw new Error(r.ERROR);uo(Ue)||io()}).catch(Ue=>{const eo=se(Ue);k.error({title:Ue?.data?.code||c("Error"),description:eo}),$(eo)})}},ge=(0,a.useCallback)(async q=>{const We={data:{role:"user",message:q,userInfo:{display_name:me,avatar_url:fe}}},Je={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};I(eo=>[...eo,We,Je]);const Ue={project_id:x,connection:"chat",entity_id:T,message:q,locale:pe,subject:je||"",preheader:ye||"",textContent:bi.extractDocumentTextContent(n())};if(oe)k.error({title:c("You have reached the limit of AI generator usage."),description:c("Please upgrade your plan.")}),$(c("You have reached the limit of AI chat usage."));else{if(!await Ie(Ae?"email_generate":"ai")){$();return}te({body:Ue}).then(eo=>{if(eo?.error)throw eo.error;if(!eo?.data||eo.data.status===401)throw new Error(r.ERROR);if(!uo(eo)){if(j({event:"submit",action:"send_discussion_chat_message",entity_type:l==="block"?"block":"email",entity_id:T,project_id:x,context:"editor"}),eo.data.task_id){let oo=eo.data.task_id;V(oo),M({id:oo,setError:Ne}),r.swallowPromiseRejection(Ve().then(yo=>{yo?He(oo):Z(!0)}))}Ce&&(Ae&&de!==Ee?(ue(),Fe(oo=>oo+1)):z!==he&&(D(),A(oo=>oo+1))),io()}}).catch(eo=>{const oo=se(eo);k.error({title:eo?.data?.code||c("Error"),description:oo}),$(oo)})}},[c,z,de,fe,Ve,$,He,se,me,he,Ee,_e,je,ye,T,Ae,oe,pe,D,ue,Ce,n,k,Ie,x,te,M,io]);(0,a.useEffect)(()=>{const q=new vo.Disposable,We=window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings);if((!e?.length||e.length===1&&e[0]?.data?.role==="assistant")&&We&&T&&!b){const Je={project_id:x,connection:"chat",entity_id:T,context:"email-generator",locale:pe};wm(`discuss-ai-generator-context:${T}`,()=>{if($e){window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),ge(We);return}r.swallowPromiseRejection(ae({body:Je}).then(()=>{window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),q.isDisposed()||ge(We)}))})}return()=>q.dispose()},[e,ge,T,pe,x,ae,$e,b]);const Ye=q=>{typeof q.target.className=="string"&&q.target.className.includes("ai-response-change-context")&&(ne.isLoading||ao(q.target.role))},qe=q=>{if(h())return;const We=q.children[0].data??"";ya("subject",We,P),k.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Title copied to email settings"),data:We})},lo=q=>{if(h())return;const We=q.children[0].data??"";ya("preheader",We,P),k.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Preheader copied to email settings"),data:We,duration:300})},fo=q=>{const We=q.children[0].data;navigator.clipboard.writeText(We).then(()=>{k.success({id:"TEXT_COPIED_TO_CLIPBOARD",title:c("Text copied to clipboard"),data:We})}).catch(Je=>{})},F={replace:q=>{if(q.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:()=>qe(q),children:(0,o.jsx)("span",{className:"ai-response-title",children:(0,ft.domToReact)(q.children,F)})})});if(q.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:()=>lo(q),children:(0,o.jsx)("span",{className:"ai-response-preheader",children:(0,ft.domToReact)(q.children,F)})})});if(q.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:()=>fo(q),children:(0,o.jsx)("span",{className:"ai-response-copy",children:(0,ft.domToReact)(q.children,F)})})});if(q.attribs?.class?.split(" ").includes("ai-response-user-message")){const We=q.attribs?.data||q.children?.[0]?.data;return(0,o.jsx)("li",{className:q.attribs?.class,data:q.attribs?.data,onClick:()=>ge(We),children:(0,ft.domToReact)(q.children,F)})}}},X=()=>{He(),Z(!1)},we=()=>{ko(),Z(!1)};return(0,o.jsxs)("div",{ref:_,className:"discuss-main",children:[Q.length>0&&(0,o.jsx)(t.ui_kit$List,{onClick:Ye,className:"comment-list",itemLayout:"horizontal",dataSource:Q,renderItem:q=>(0,o.jsx)("li",{id:q._id,children:(0,o.jsx)(t.ui_kit$Comment,{className:q.data.userInfo?"":"ai-comment",avatar:q.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"}}):q.data.userInfo&&q.data._modified?q.data.userInfo.avatar_url:fe||(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:L,children:q?.data?.role==="user"?_e?.username||c("User"):c("AI Assistant")}),datetime:q._created?(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:r.formatDate(r.parseISO(q._created),p,!0)}}):null,content:q.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:L,children:jm(q.data.message,F)})})},q._id)}),re&&(Ae?(0,o.jsx)(t.ui_kit$LimitsCounter,{text:`${de} ${c("of")} ${Ee>0?Ee:"∞"} ${c("mail generator")} ${p("was used","were used",de)}`,exceeded:Ee>0&&de>=Ee,style:{marginTop:-25},extra:(0,o.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>m(E.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})}):(0,o.jsx)(t.ui_kit$LimitsCounter,{text:`${z} ${c("of")} ${he>0?he:"∞"} ${c("messeges")} ${p("was used","were used",z)}`,exceeded:he>0&&z>=he,style:{marginTop:-25},extra:(0,o.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>m(E.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})})),(0,o.jsxs)(t.ui_kit$Form,{onFinish:mo,className:"addMode",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{disabled:O||b,value:U,onChange:q=>J(q.target.value),rows:4,placeholder:c("Type your request"),className:"textarea-comment",onPressEnter:q=>q.key==="Enter"&&q.ctrlKey&&mo(),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:ne.isLoading||O||b,type:"default",style:Cm,className:"button-target",children:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"top",disabled:O,arrow:{pointAtCenter:!0},menu:{items:Im(ao)},children:(0,o.jsxs)("div",{disabled:O,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:ne.isLoading||O||b,className:"button-add",type:"primary",htmlType:"submit",children:[c("Send")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:E.iconStrokeWidth})]})]})})]}),(0,o.jsx)(t.ui_kit$Modal,{title:c("Warning"),open:ve,onOk:X,onCancel:we,children:(0,o.jsx)("p",{children:c("The current template will be changed to the generated one, are you sure about this?")})})]})},Pm=[r.VALID,r.ERRORS,r.WARNINGS],Ia=({summary:e,__:i,selectedTags:l,setSelectedTags:s})=>{const n=(0,a.useCallback)((c,p)=>{s(p?l.length===2?[]:[...l,c]:l.filter(g=>g!==c))},[l,s]),d=(0,a.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:Pm.map((c,p)=>(0,o.jsxs)(t.ui_kit$CheckableTag,{checked:l?.includes(c),onChange:g=>n(c,g),className:(0,Ke.default)(`${c} optimise__button`,{[`${c}_active`]:l.includes(c)}),children:[d(c),": ",e?.[c]||0]},c+p))})})},{LINKS:Nm}=r.OPTIMISE_TABS,Ca=(0,a.memo)(({__:e,activeTab:i,validateLinksResult:l,validateLinks:s,selectedTags:n,setSelectedTags:d,isLoading:c,disabled:p,iconStrokeWidth:g,onValidate:m,goToLinkHandler:_})=>i!==Nm||!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)(Ia,{__:e,summary:l.summary,setSelectedTags:d,selectedTags:n}),(0,o.jsx)(t.ui_kit$Button,{disabled:p,loading:c,onClick:m,icon:(0,o.jsx)(r.EmIcons,{icon:"SyncOutlined",component:t.icons$SyncOutlined,size:16,strokeWidth:g}),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:(E,b)=>(0,o.jsx)(t.ui_kit$List.Item,{className:t.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{avatar:E.status==="valid"?(0,o.jsx)(r.EmIcons,{icon:"CheckCircleFilled",component:t.icons$CheckCircleFilled,className:r.VALID}):E.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.linkId,600>(E.statusCode||0)&&(E.statusCode||0)>399||!E.statusCode),children:E.url===""?e("empty link"):E.url}),description:(0,o.jsxs)(o.Fragment,{children:[!!E.text?.length&&(0,o.jsx)(t.ui_kit$Text,{type:"secondary",children:E.text}),E.page?.title&&E.page.title,E.page?.secure&&E.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")})]}),!E.resolvedUrl&&!E.statusCode&&E.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")})]})]})})},b+"_"+E.linkId)})})})]}));Ca.displayName="LinksSection";var{IMAGES:Am}=r.OPTIMISE_TABS,Pa=(0,a.memo)(({__:e,activeTab:i,validateImagesResult:l,validateImages:s,selectedTags:n,setSelectedTags:d,isLoading:c,disabled:p,iconStrokeWidth:g,onValidate:m,goToImageHandler:_,showImgPreviewHandler:E,hideBlockPreviewHandler:b})=>i!==Am||!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(h=>h.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)(Ia,{__:e,summary:l.summary,setSelectedTags:d,selectedTags:n}),(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"SyncOutlined",component:t.icons$SyncOutlined,size:16,strokeWidth:g}),disabled:p,loading:c,onClick:m,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:(h,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,Ke.default)("image-item__meta",{"image-item__meta_fail":!h.resolvedUrl&&!h.statusCode}),avatar:(0,o.jsx)(t.ui_kit$Image,{className:(0,Ke.default)("image-item__image optimise__image-auto-height",{"image-item__image_fail":!h.resolvedUrl||!h.valid}),width:92,height:"auto",src:h.resolvedUrl||"",preview:!1,onMouseEnter:()=>E(h.url,h.image.dimensions?.width),onMouseLeave:()=>b()}),title:h.url?(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:h.message,children:(0,o.jsx)(t.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>_(h.imageId,600>(h.statusCode||0)&&(h.statusCode||0)>399||!h.statusCode),children:h?.url===""?e("empty src"):h.url})}):h.message,description:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"image-size",children:[h.image.dimensions&&(0,o.jsxs)(o.Fragment,{children:[h.image.dimensions.width+" × "+h.image.dimensions.height,(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsxs)("span",{children:[Math.round(h.image.bytes/1024),e("kB")]}),(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsxs)("span",{children:[h.image.responseTime,e("ms")]}),(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)("span",{className:"image-size-format",children:et.normalizeImageFormatForDisplay(h.image.contentType)})]}),h.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")})]}),h.resolvedUrl&&!h.valid&&(0,o.jsx)(t.ui_kit$Text,{type:"danger",children:e("not valid")})]}),!h.resolvedUrl&&!h.statusCode&&(0,o.jsx)(t.ui_kit$Text,{type:"danger",children:e("Failed to load")})]})})},k)})})})]}));Pa.displayName="ImagesSection";var{SPAM_ASSASSIN:Lm}=r.OPTIMISE_TABS,Na=(0,a.memo)(({__:e,activeTab:i,validateSpamResult:l,isLoading:s,disabled:n,iconStrokeWidth:d,onValidate:c})=>{const p=l?.report?.length||Object.prototype.hasOwnProperty.call(l,"spamScore");if(i!==Lm||!p)return null;const g=l.spamScore||0,m=l.baseSpamScore||0,_=g<2||!l.spamScore||g<=m-1?"success":g<m-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:_,children:[(0,o.jsx)("span",{className:"optimise__spam-score-value",children:g}),(0,o.jsx)(t.ui_kit$Text,{className:"optimise__spam-score-text",children:"Score"})]}),(0,o.jsx)(t.ui_kit$Button,{disabled:n,icon:(0,o.jsx)(r.EmIcons,{icon:"SyncOutlined",component:t.icons$SyncOutlined,size:16,strokeWidth:d}),loading:s,onClick:c,children:e("Refresh")})]}),g>m-1&&(0,o.jsx)(t.ui_kit$Text,{children:e("Lower scores are better. Aim for a score less than ")+(m-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:E=>(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:E.score}),(0,o.jsx)("span",{className:"optimise__spam-report-description",children:E.description})]})})})}):(0,o.jsx)(o.Fragment,{children:l.spamScore===0&&e("Your email doesn't look like spam.")})})})]})});Na.displayName="SpamSection";var{PROBLEMS:Om}=r.OPTIMISE_TABS,Aa=(0,a.memo)(({__:e,activeTab:i,problemsList:l,onSetMonacoPosition:s})=>i!==Om?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:n=>(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:n.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(n),className:(0,Ke.default)("optimise__text-clickable",{warning:n.severity<6,error:n.severity>=6}),children:["Line: ",n.startLineNumber," ",n.startLineNumber!==n.endLineNumber&&" – "+n.endLineNumber]}),description:(0,o.jsx)(t.ui_kit$Text,{children:n.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"})}));Aa.displayName="ProblemsSection";var $m={activeTab:"",selectedTags:[],validateLinks:[],validateImages:[],validateSpamResult:{},validateLinksResult:{},validateImagesResult:{}},Fm=(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_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}};function Mm(){const e=r.useContainer(),i=(0,a.useMemo)(()=>{if(!e)throw new Error("[optimise] нет DI-контейнера стора");return gi.getOptimiseChecks(e)},[e]),l=(0,a.useCallback)(n=>{const d=i.watch(n);return()=>d.dispose()},[i]),s=(0,a.useSyncExternalStore)(l,()=>i.snapshot());return(0,a.useMemo)(()=>({...s,checks:i}),[s,i])}var Dm=()=>{const e=(0,a.useRef)(null);return{showImgPreviewHandler:(0,a.useCallback)((i,l)=>{e.current&&clearTimeout(e.current);let s=document.querySelector(".img-preview"),n=document.querySelector(".img-preview-content");document.querySelector(".img-preview")||(s=document.createElement("div"),s.classList.add("img-preview"),n=document.createElement("div"),n.classList.add("img-preview-content"),s.append(n),document.querySelector(".email-pane__col_settings-inner")?.append(s)),n&&(n.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,a.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:Vm,IMAGES:Hm}=r.OPTIMISE_TABS,Um=({activeTab:e,selectedTags:i,validateLinksResult:l,validateImagesResult:s,setValidateLinks:n,setValidateImages:d})=>{(0,a.useEffect)(()=>{e===Vm&&l.links&&n(i.length>0?l.links.filter(c=>i.includes(c.status)):l.links),e===Hm&&s.images&&d(i.length>0?s.images.filter(c=>i.includes(c.status)):s.images)},[l.links,s.images,i,e,n,d])},Wm={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}),layout_conversion:(0,o.jsx)(r.EmIcons,{icon:"EmailEnvelope",component:t.icons$EmailEnvelope}),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 La(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 hi=({open:e,onClose:i,title:l,subtitle:s,usageResource:n,icon:d,previousDisplay:c,nextDisplay:p,onChangePlan:g,secondaryAction:m,changePlanLabel:_})=>{const{__:E}=r.useI18n(),b=_??E("Change plan"),h=!!m,k=n!=null?Wm[n]: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":E("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}),La(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"})}),La(p,"new")]})]}),(0,o.jsx)("hr",{className:"limit-upgrade-modal__divider"}),(0,o.jsx)("div",{className:h?"limit-upgrade-modal__footer limit-upgrade-modal__footer--dual":"limit-upgrade-modal__footer",children:m?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Button,{className:"limit-upgrade-modal__cta-secondary",onClick:m.onClick,children:m.label}),(0,o.jsx)(t.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:g,children:b})]}):(0,o.jsx)(t.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:g,children:b})})]})})},{LINKS:_r,IMAGES:xr,SPAM_ASSASSIN:Oa,PROBLEMS:kr}=r.OPTIMISE_TABS,$a={textDecoration:"underline",cursor:"pointer",background:"none",border:"none",padding:0,font:"inherit",color:"inherit"},Fa={link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"},Ma=(e,i,l,s)=>`${e} ${l("of")} ${i>0?i:"∞"} ${s("test","tests",i>0?i:e)} ${s("was used","were used",e)}`,Da=()=>{const{__:e,_n:i}=r.useI18n(),l=r.useDispatch(),s=r.useOpenPlanCatalog(),n=r.useAppNavigate(),d=r.useNotification(),c=r.useContentReader(),p=r.useAppConfig(),g=r.useEditorProjectId(),m=r.useRouteEmailId(),{document:_}=r.useDocumentSessionContext(),E=r.useEmailOfDocument(_,void 0),b=m||(E?.id!=null?String(E.id):void 0);r.useWpEntityId(),r.isChecksV2Enabled();const h=b||E?.renderGuid,k=g||(E?.project!=null?String(E.project):void 0),[x,T]=(0,a.useState)(null),j=(0,a.useRef)(!1),P=(0,a.useRef)({link_check:!1,image_check:!1,spam_check:!1}),S=(0,a.useCallback)(C=>{T(C)},[]),y=r.useMessageService(),V=r.useSelector(r.selectProblemsList),z=r.usePushToDataLayer(),[A,O]=(0,a.useReducer)(Fm,$m),{checks:w,limits:U,running:J}=Mm(),{limitsInPlugin:Q,perTypeAvailable:I,aggregateLimit:le,aggregateCounter:xe,disableFields:ve,typeLimits:Z}=U,be=(0,a.useCallback)(C=>gi.isOptimiseTypeDisabled(U,C),[U]),Ne=(0,a.useCallback)(C=>O({type:"SET_VALIDATE_LINKS",payload:C}),[]),de=(0,a.useCallback)(C=>O({type:"SET_VALIDATE_IMAGES",payload:C}),[]),Fe=(0,a.useCallback)(C=>O({type:"SET_SELECTED_TAGS",payload:C}),[]);Um({activeTab:A.activeTab,selectedTags:A.selectedTags,validateLinksResult:A.validateLinksResult,validateImagesResult:A.validateImagesResult,setValidateLinks:Ne,setValidateImages:de});const{showImgPreviewHandler:Ae,hideBlockPreviewHandler:Ge}=Dm(),je=(0,a.useCallback)(C=>{if(I){const{limit:G}=Z[C];S({presetId:Fa[C],previousDisplay:G>0?G:r.presetLimitDisplay("infinity"),nextDisplay:r.presetLimitDisplay("infinity")});return}S({presetId:"optimization_exceeded",previousDisplay:le,nextDisplay:r.presetLimitDisplay("infinity")})},[I,Z,S,le]),ye=(0,a.useCallback)((C,G)=>{switch(C.reason){case"notSaved":d.error({title:"Save the mail first."});return;case"typeLimit":je(C.type);return;case"planLimit":S({presetId:C.exceeded.presetId,previousDisplay:C.exceeded.previousLimit,nextDisplay:r.presetLimitDisplay(C.exceeded.nextLimit)});return;case"usageLimit":S({presetId:Fa[C.type],previousDisplay:e("—"),nextDisplay:r.presetLimitDisplay("infinity")});return;case"failed":{if("error"in C){d.error({error:C.error});return}const L=C.data;(L?.statusCode??0)>300||!L?.success?d.error({error:{data:L}}):d.error({title:e("Something went wrong.")}),G();return}default:return}},[d,je,S,e]),_e=(0,a.useCallback)(C=>{C!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${C}`})},[d,e]),pe=(0,a.useCallback)(()=>{n(p.billingPageUrl||r.APP_ROUTES.billing)},[p.billingPageUrl,n]),fe=C=>{if(!Q||!I)return null;const{counter:G,limit:L,disabled:re}=Z[C];return(0,o.jsx)(t.ui_kit$LimitsCounter,{text:Ma(G,L,e,i),exceeded:re,extra:(0,o.jsx)("button",{type:"button",style:$a,onClick:pe,children:e("Need more?")})})},me=(0,a.useCallback)((C,G)=>{y.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_LINK,settings:{elementId:C,isError:G}})},[y]),K=(0,a.useCallback)((C,G)=>{y.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_IMG,settings:{elementId:C,isError:G}})},[y]),ee=(0,a.useCallback)(C=>{const G={startColumn:C.startColumn,startLineNumber:C.startLineNumber,endColumn:C.endColumn,endLineNumber:C.endLineNumber};l(r.setActiveProblemRange(G))},[l]),ie=(0,a.useCallback)(C=>{O({type:"SET_ACTIVE_TAB",payload:C}),O({type:"RESET_SELECTED_TAGS"}),C===kr&&V?.length>0&&z({event:"check",action:"check_email_code",email_id:b,project_id:k,problems_count:V?.length||0})},[V,z,b,k]),ae=(0,a.useCallback)(C=>({entityId:h??"",readContent:c,beforeRequest:C}),[h,c]),ne=(0,a.useCallback)(async()=>{const C=await w.run("link_check",ae(()=>y.send({operation:"sandbox_set_attr_to_links"})));if(C.ok===!1){ye(C,()=>!A.validateLinksResult.links&&ie(""));return}O({type:"SET_VALIDATE_LINKS_RESULT",payload:C.value}),d.success(e("Links validation was successfully completed")),_e(C.limitRemaining),z({event:"check",action:"check_email_links",email_id:b,project_id:k,links_count:C.value.links?.length||0})},[w,ae,y,ye,A.validateLinksResult.links,ie,d,e,_e,z,b,k]),Me=(0,a.useCallback)(async()=>{const C=await w.run("image_check",ae(()=>y.send({operation:"sandbox_set_attr_to_images"})));if(C.ok===!1){ye(C,()=>!A.validateImagesResult?.images?.length&&ie(""));return}const{images:G,summary:L,totalKb:re}=C.value,ce={images:G||[],summary:L,summaryTime:{value:(re>1200?re/1e3:re).toFixed(1),name:re>1200?e("MB"):e("KB")}};O({type:"SET_VALIDATE_IMAGES_RESULT",payload:ce}),d.success(e("Images validation was successfully completed")),_e(C.limitRemaining),z({event:"check",action:"check_email_images",email_id:b,project_id:k,images_count:ce.images?.length||0})},[w,ae,y,ye,A.validateImagesResult,ie,d,e,_e,z,b,k]),te=(0,a.useCallback)(async()=>{const C=await w.run("spam_check",ae());if(C.ok===!1){ye(C,()=>!A.validateSpamResult?.report?.length&&ie(""));return}O({type:"SET_VALIDATE_SPAM_RESULT",payload:C.value}),d.success(e("Spam validation was successfully completed")),_e(C.limitRemaining),z({event:"check",action:"check_email_spam",email_id:b,project_id:k,spam_score:C.value.spamScore||0})},[w,ae,ye,A.validateSpamResult,ie,d,e,_e,z,b,k]);(0,a.useEffect)(()=>{if(Q){if(I){gi.OPTIMISE_LIMIT_TYPES.forEach(C=>{const{limit:G,counter:L,disabled:re}=Z[C];if(!re){P.current[C]=!1;return}P.current[C]||G>0&&L>=G&&(P.current[C]=!0,je(C))});return}if(!(le>0&&xe>=le)){j.current=!1;return}j.current||(j.current=!0,je("link_check"))}},[Q,I,Z,xe,le,je]);const Te=x?r.getLimitUpgradePresetDefinition(x.presetId):null,ke=(0,a.useCallback)(()=>T(null),[]),M=r.useNativeExtraBuyAction(Te?.usageResource,ke);return(0,o.jsxs)("div",{className:"optimise selected_form-props-wrapper selected_form-props-wrapper_optimize",children:[Te&&x?(0,o.jsx)(hi,{open:!0,onClose:ke,title:e(Te.titleKey),subtitle:e(Te.subtitleKey),usageResource:Te.usageResource,previousDisplay:x.previousDisplay,nextDisplay:x.nextDisplay,secondaryAction:M,onChangePlan:()=>{T(null),s()}}):null,Q&&!I&&(0,o.jsx)(t.ui_kit$LimitsCounter,{text:Ma(xe,le,e,i),exceeded:ve,extra:(0,o.jsx)("button",{type:"button",style:$a,onClick:pe,children:e("Need more?")})}),p.optimizeLinksEnabled&&(0,o.jsxs)(o.Fragment,{children:[fe("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:C=>C.preventDefault(),onClick:()=>{ie(_r),!A.validateLinksResult?.links?.length&&A.activeTab!==_r&&ne()},loading:J.link_check,disabled:be("link_check")&&!A.validateLinksResult?.links?.length,children:!J.link_check&&(A.activeTab===_r?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth}))})})]}),(0,o.jsx)(Ca,{__:e,activeTab:A.activeTab,validateLinksResult:A.validateLinksResult,validateLinks:A.validateLinks,selectedTags:A.selectedTags,setSelectedTags:Fe,isLoading:J.link_check,disabled:be("link_check"),iconStrokeWidth:p.iconStrokeWidth,onValidate:ne,goToLinkHandler:me})]}),p.optimizeImagesEnabled&&(0,o.jsxs)(o.Fragment,{children:[fe("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:C=>C.preventDefault(),onClick:()=>{ie(xr),!A.validateImagesResult?.images?.length&&A.activeTab!==xr&&Me()},loading:J.image_check,children:!J.image_check&&(A.activeTab===xr?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth}))})})]}),(0,o.jsx)(Pa,{__:e,activeTab:A.activeTab,validateImagesResult:A.validateImagesResult,validateImages:A.validateImages,selectedTags:A.selectedTags,setSelectedTags:Fe,isLoading:J.image_check,disabled:be("image_check"),iconStrokeWidth:p.iconStrokeWidth,onValidate:Me,goToImageHandler:K,showImgPreviewHandler:Ae,hideBlockPreviewHandler:Ge})]}),p.optimizeSpamAssassinEnabled&&(0,o.jsxs)(o.Fragment,{children:[fe("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:C=>C.preventDefault(),loading:J.spam_check,onClick:()=>{ie(Oa),A.validateSpamResult.report?.length||Object.prototype.hasOwnProperty.call(A.validateSpamResult,"spamScore")||te()},disabled:be("spam_check")&&!(A.validateSpamResult?.report?.length||Object.prototype.hasOwnProperty.call(A.validateSpamResult,"spamScore")),children:!J.spam_check&&(A.activeTab===Oa?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth}))})})]}),(0,o.jsx)(Na,{__:e,activeTab:A.activeTab,validateSpamResult:A.validateSpamResult,isLoading:J.spam_check,disabled:be("spam_check"),iconStrokeWidth:p.iconStrokeWidth,onValidate:te})]}),p.optimizeCheckCodeEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,align:"middle",children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsx)("div",{style:{padding:"15px 0"},children:e("Source code validation")})}),(0,o.jsx)(t.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,o.jsx)(t.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:C=>C.preventDefault(),onClick:()=>ie(kr),children:A.activeTab===kr?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth})})})]}),(0,o.jsx)(Aa,{__:e,activeTab:A.activeTab,problemsList:V,onSetMonacoPosition:ee})]})]})},zm=({state:e,onCancel:i,onRetry:l,onDismiss:s})=>{const{__:n}=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:[Gm(e,n),(0,o.jsx)(t.ui_kit$Flex,{justify:"flex-end",children:Ym(e,{onCancel:i,onRetry:l,onDismiss:s},n)})]})})})};function Gm(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 Ym(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 Xm=2500,Va=48,Km=4e3;function qm(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 Jm(e){return e.kind==="done"||e.kind==="failed"||e.kind==="cancelled"}function Qm({projectId:e,api:i,triggered:l,onCompleted:s}){const[n,d]=(0,a.useState)({kind:"hidden"}),c=(0,a.useRef)(!1),p=(0,a.useRef)(!0),g=(0,a.useRef)(e);g.current=e;const m=(0,a.useRef)(l);m.current=l;const _=(0,a.useRef)(s);_.current=s,(0,a.useEffect)(()=>(p.current=!0,()=>{p.current=!1}),[]),(0,a.useEffect)(()=>{d({kind:"hidden"})},[e]);const E=(0,a.useCallback)(async()=>{try{const h=await i.files.backfillList({project_id:e});return!h.ok||h.error?null:qm(h.data)}catch{return null}},[i,e]),b=(0,a.useCallback)(async()=>{if(c.current)return;c.current=!0;const h=g.current;let k=0;try{for(;p.current&&g.current===h&&m.current;){const x=await E();if(!p.current)break;if(x)if(x.kind==="hidden"){if(k+=1,k>=Va){d({kind:"failed"});break}}else{if(k=0,d(x),x.kind==="done")try{await _.current?.()}catch{}if(Jm(x))break}else if(k+=1,k>=Va){d({kind:"failed"});break}await new Promise(T=>setTimeout(T,Xm))}}finally{c.current=!1}},[E]);return(0,a.useEffect)(()=>{l&&b()},[l,b]),(0,a.useEffect)(()=>{if(n.kind!=="done")return;const h=setTimeout(()=>{p.current&&d({kind:"hidden"})},Km);return()=>clearTimeout(h)},[n.kind]),{state:n,cancel:(0,a.useCallback)(()=>{d(h=>h.kind==="scanning"||h.kind==="indexing"?{...h,cancelling:!0}:h),i.files.backfillCancelCreate({project_id:e})},[i,e]),retry:(0,a.useCallback)(()=>{m.current=!0,i.files.backfillCreate({project_id:e}),b()},[i,e,b]),dismiss:(0,a.useCallback)(()=>d({kind:"hidden"}),[])}}var Zm=r.lazyRoute(()=>(0,Mt.__vitePreload)(()=>Promise.resolve().then(()=>xo("./bff175af.js")),void 0,{}.url)),ep=r.lazyRoute(()=>(0,Mt.__vitePreload)(()=>Promise.resolve().then(()=>xo("./5661be7c.js")),void 0,{}.url)),Ha={height:"100%"};function op(e){(e?(0,Mt.__vitePreload)(()=>Promise.resolve().then(()=>xo("./1a17438d.js")),void 0,{}.url):(0,Mt.__vitePreload)(()=>Promise.resolve().then(()=>xo("./18b86617.js")),void 0,{}.url)).catch(()=>{})}var tp=({storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,contentKey:n})=>{const d=r.useAppConfig(),c=r.isImageEditModal(r.useSelector(r.selectActiveModal$1)),p=!!d.imageCenterFileManagerView;(0,a.useEffect)(()=>{c&&op(p)},[c,p]);let g=(0,o.jsx)(t.ui_kit$PageLoader,{style:Ha});return e&&i&&d.imageCenterFileManagerView?g=(0,o.jsx)(Zm,{storageProvider:e,dataProvider:i,pathProxy:l},n):e&&i&&(g=(0,o.jsx)(ep,{dataProvider:i,usesBuiltInStorage:s},n)),(0,o.jsx)(a.Suspense,{fallback:(0,o.jsx)(t.ui_kit$PageLoader,{style:Ha}),children:g})};function ip(){const e=r.useAppConfig(),i=r.useIsStandalone(),l=r.useStorageProvider(),s=r.useProjectData(),n=r.useRestClient(r.EM_FILES_MODULES),d=r.useStore(),c=(0,a.useMemo)(()=>r.createRestClientV2(d),[d]),p=r.useI18n(),g=r.useCurrentUser(),m=s?.id?String(s.id):"",_=g?.id!=="0"?String(g.id):"",E=r.isFileManagerV2Enabled(e),[b,h]=(0,a.useState)(null),k=E&&!!m&&b===m,[x,T]=(0,a.useState)(0),[j,P]=(0,a.useState)(0),S=(0,a.useRef)(m);(0,a.useEffect)(()=>{S.current!==m&&(S.current=m,h(null))},[m]);const y=(0,a.useCallback)(O=>{O&&m&&h(m)},[m]),V=(0,a.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:l,projectId:m,restApi:n,restApiV2:c,i18n:p,pathPostfix:_,appConfig:e,isStandalone:i,onIndexingStateChange:y}),[e,y,p,i,m,x,n,c,l,_]),z=(0,a.useCallback)(async()=>{try{typeof V.dataProvider?.clearCache=="function"&&await V.dataProvider.clearCache()}catch{}h(null),T(O=>O+1),P(O=>O+1)},[V.dataProvider]),A=(0,a.useCallback)(()=>{m&&h(m)},[m]);return{...V,projectId:m,restApiV2:c,v2Enabled:E,backfillTriggered:k,contentKey:`${m}:${j}`,handleIndexingCompleted:z,markIndexingStarted:A}}var rp={height:"100%"},Ua=()=>{const{storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,projectId:n,restApiV2:d,v2Enabled:c,backfillTriggered:p,contentKey:g,handleIndexingCompleted:m,markIndexingStarted:_}=ip(),E=r.useSelector(r.selectActiveModal$1),b=r.isImageCenterModal(E),{state:h,cancel:k,retry:x,dismiss:T}=Qm({projectId:n,api:d,triggered:p,onCompleted:m}),j=a.default.useCallback(()=>{_(),x()},[_,x]);return(0,o.jsxs)(o.Fragment,{children:[b&&(0,o.jsx)(a.Suspense,{fallback:(0,o.jsx)(t.ui_kit$PageLoader,{style:rp}),children:(0,o.jsx)(tp,{storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,contentKey:g})}),c&&(0,o.jsx)(zm,{state:h,onCancel:k,onRetry:j,onDismiss:T})]})},lp=(function(){var e=window.__useblocks__;if(e&&e.assetUrl)return e.assetUrl("icon-menu-block-welcome.1c534a003522feadd2e7.png");if(e&&e.publicPath)try{return new URL("static/media/icon-menu-block-welcome.1c534a003522feadd2e7.png",e.publicPath).href}catch{}try{return new URL("/static/media/icon-menu-block-welcome.1c534a003522feadd2e7.png",typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"").href}catch{return"/static/media/icon-menu-block-welcome.1c534a003522feadd2e7.png"}})();function sp(e){return!!(e?.global_block??e?.acf?.global_block)}var ap=({className:e,size:i=16})=>{const l=r.useAppConfig(),{__:s}=r.useI18n(),n=s("Global block");return(0,o.jsx)(t.ui_kit$Tooltip,{title:n,placement:"top",trigger:["hover"],children:(0,o.jsx)("span",{className:(0,Ke.default)("block-global-badge",e),"aria-label":n,role:"img",children:(0,o.jsx)(r.EmIcons,{icon:"Globe02Icon",component:t.icons$Globe02Icon,size:i,strokeWidth:l.iconStrokeWidth})})})},Wa=new Map;function za(e){return`<table cellspacing="0" cellpadding="0" border="0" width="100%">${e}</table>`}function Er(e,i){const l=i??"";if(e===void 0)return r.sanitizeHtml(za(l));const s=String(e),n=Wa.get(s);if(n&&n.source===l)return n.markup;const d=r.sanitizeHtml(za(l));return Wa.set(s,{source:l,markup:d}),d}function np(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Br(e){return!r.isBlocksV2Enabled()||e.html&&e.html.trim()!==""?e.html:`<tr><td style="padding:16px 20px;font-family:Arial,sans-serif;font-size:14px;line-height:20px;color:#5b6370;background:#f4f5f7">${np(e.title??"")}</td></tr>`}function dp(e,i){return e?i.openBlockFromEmailEnabled===!0?"over-email":null:"link"}var cp={fontSize:"16px",margin:0},{name:Sr,type:Ga,tags:Ya}={name:"name",type:"type",tags:"tags"},Xa={[Sr]:"",[Ga]:[],[Ya]:[]},_t={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},Tr=({parentEmailId:e,blocksTab:i,templateBlocksEnabled:l=!1,search:s,reloadBlockScreens:n,setIsShowAddAllBlocksModal:d})=>{const{parentId:c}=r.useBlocksParentId(e),p=r.useEditorProjectId(),g=r.useSetHtmlElementInIframeHandler(),m=r.useDragStartBlockToIframeHandler(),[_]=t.ui_kit$Form.useForm(),{data:E}=r.useGetBlockTypesQuery(),{token:b}=(0,t.ui_kit$useToken)(),{__:h,_x:k}=r.useI18n(),x=r.useNotification(),{modal:T}=t.ui_kit$App.useApp(),{confirm:j}=T,P={pathname:r.useRoutePathname()},S=r.useAppConfig(),y=r.useSelector(R=>r.selectParentBlocks(R,c)),V=Gs(),z=(0,a.useRef)(null),A=(0,a.useRef)(null),O=r.useRootElement(),w=640,U=207/w,J=R=>sp(R)?(0,o.jsx)("div",{className:"blocks-search__result-global-mark",children:(0,o.jsx)(ap,{className:"block-global-badge--tile",size:14})}):null,Q=r.useEmailAttribute("common_styles"),I=(0,a.useMemo)(()=>Xs(Q,V),[Q,V]),le=(0,a.useRef)(null),xe=(0,a.useRef)(null),ve=(0,a.useRef)(null),Z=r.useStore(),be=(R,Re=!1)=>(B,Le,ze,ho,Xe)=>{if(!r.isBlocksV2Enabled()){R(B,Le,ze,ho,Xe);return}const Wo=zo=>{if(zo===void 0){x.error({id:"BLOCK_GET_ERROR",title:h("Failed to load")});return}if(zo===Xe.html){R(B,Le,ze,ho,Xe);return}R(B,ze==="common"?we({html:zo}):zo,ze,ho,{...Xe,html:zo})},xt=()=>Z.getState();if(!Ft.waitsForWrite(Xe)){Wo(Ft.freshBlockHtml(xt,Xe));return}(Re?Ft.blockHtmlForInsertOnce(xt,Xe):Ft.blockHtmlForInsert(xt,Xe))?.then(Wo)},Ne=be(g,!0),de=be(m);(0,a.useEffect)(()=>{A.current?.scrollTo({top:0})},[i,s]);const Fe=r.useProjectData(),{data:Ae}=r.useGetTermsQuery({project:Fe,kind:r.BLOCK_TAGS},{skip:!Fe?.id}),[Ge,je]=(0,a.useState)(()=>r.projectBlocksArgs(p));(0,a.useEffect)(()=>{s||(_.setFieldsValue(Xa),H({type:null,name:null}),n())},[s,_,n]),(0,a.useEffect)(()=>{if(E){const R=E;let Re=[];for(let B in R)Re.push({label:h(r.TYPES_TRANSLATE[R[B]]),value:R[B]})}},[E,h]);const{isSuccess:ye,isError:_e,isLoading:pe,isFetching:fe,data:me,currentData:K,error:ee}=r.useGetBlocksQuery({...Ge,projectId:p,page:1}),ie=(pe||fe)&&!(ye&&K!==void 0),ae=(0,a.useMemo)(()=>{if(ye&&me)return[...me].sort((R,Re)=>_t[R.type]-_t[Re.type])},[ye,me]),[ne,Me]=(0,a.useState)({list:void 0,ids:[]}),te=(0,a.useMemo)(()=>ne.list!==void 0&&ne.list===K?ae?.filter(R=>!ne.ids.includes(R.id)):ae,[ne,K,ae]),[Te,ke]=(0,a.useState)([]);r.usePrevious(R=>{R!==_e&&x.fromError("BLOCK_GET_ERROR",{},ee,!0)},[_e,ee,x]);const[M,C]=(0,a.useState)(()=>r.parentEmailBlocksArgs(c,p)),{isSuccess:G,isError:L,isLoading:re,isFetching:ce}=r.useGetParentEmailBlocksQuery({...M,emailId:c,page:1,...r.pageProjectKey(p)},{skip:!l||!c||y.length}),he=(0,a.useMemo)(()=>{if(G||y.length)return[...y].sort((R,Re)=>_t[R.type]-_t[Re.type])},[G,y]),[Ee,$e]=(0,a.useState)([]);(0,a.useEffect)(()=>{const R=new Set;if(y.length&&he){for(const Re of he)Re.type&&R.add(Re.type);$e(Array.from(R))}else $e([])},[y,he]);const[Ce,Y]=(0,a.useState)(()=>r.templateBlocksArgs(p)),{isSuccess:oe,isError:D,isLoading:ue,isFetching:Ie,data:Ve=[],currentData:to}=r.useGetTemplateBlocksQuery({...Ce,page:1,...r.pageProjectKey(p)}),io=(ue||Ie)&&!(oe&&to!==void 0),uo=(0,a.useMemo)(()=>{if(Ve.length)return[...Ve].sort((R,Re)=>_t[R.type]-_t[Re.type])},[Ve]),[$,se]=(0,a.useState)([]);(0,a.useEffect)(()=>{const R=new Set;if(uo&&Ve.length){for(const Re of uo)Re.type&&R.add(Re.type);se(Array.from(R))}},[Ve.length,uo]);const v=(0,a.useMemo)(()=>{const R=new Set;for(const Re of Te)R.add(Re);for(const Re of Ee)R.add(Re);for(const Re of $)R.add(Re);return Array.from(R)},[$,Ee,Te]),H=R=>{je(Re=>({...Re,...R,page:1})),C(Re=>({...Re,...R,page:1})),Y(Re=>({...Re,...R,page:1}))},Pe=r.useFitBlockPreviewHeight(U),He=(0,a.useCallback)(()=>{O.querySelector(".blocks-search__result-wrapper.is_search")&&(O.querySelector(".blocks-search__result-wrapper").style.removeProperty("transition"),O.querySelector(".blocks-search__result-wrapper").style.opacity=0,r.measureBlockPreviews(O,207/w),O.querySelector(".blocks-search__result-wrapper").style.transition="opacity 0.2s",O.querySelectorAll(".blocks-search__result-wrapper").forEach(R=>R.style.opacity=1))},[w,O]);(0,a.useEffect)(()=>{!(Ie||ue)&&oe&&i!=="template"&&(s?He():n())},[Ie,ue,oe,He,Ge.name,n,s,i]),(0,a.useEffect)(()=>{const R=new Set;if(ye&&ae){for(const Re of ae)Re.type&&R.add(Re.type);ke(Array.from(R))}},[ye,ae]);const ko=R=>{const Re=Object.keys(R)[0],B=_.getFieldsValue(!0);switch(Re){case Ya:const Le=(Ae||[]).filter(ze=>R[Re].includes(ze.name)).map(ze=>ze.id)||null;H({tags:Le});break;case Ga:H({type:B.type||null});break;case Sr:z.current&&window.clearTimeout(z.current),z.current=window.setTimeout(function(){H({name:B.name||null})},300)}},mo=R=>{n(),R.target.getAttribute("data-type")?(R.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(Re=>Re.style.display="none"),R.target.closest(".blocks-search").querySelectorAll(`[data-type="${R.target.getAttribute("data-type")}"]`).forEach(Re=>Re.style.display="block")):R.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(Re=>Re.style.display="block"),R.target.parentElement.querySelector(".active").classList.remove("active"),R.target.classList.add("active")};let ao=null;const ge=R=>{clearTimeout(ao);let Re=O.querySelector(".block-search__preview")?O.querySelector(".block-search__preview"):null,B=O.querySelector(".block-search__preview-title")?O.querySelector(".block-search__preview-title"):null,Le=O.querySelector(".block-search__preview-content")?O.querySelector(".block-search__preview-content"):null;O.querySelector(".block-search__preview")||(Re=document.createElement("div"),Re.classList.add("block-search__preview"),B=document.createElement("div"),B.classList.add("block-search__preview-title"),Le=document.createElement("div"),Le.classList.add("block-search__preview-content"),Re.append(Le),Re.append(B),O.querySelector(".email-pane__col_settings-inner").append(Re)),B.innerHTML="",Le.innerHTML="",B.innerHTML=R.title;let ze=R.html.replaceAll(/<style((.|\n|\r)*?)<\/style>/gi,"").trim();Le.innerHTML=r.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+ze+"</table>"),Re.style.opacity!=="1"&&setTimeout(function(){Re.style.opacity="1",Re.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(100%)":"translateX(-100%)"},10)},Ye=()=>{let R=O.querySelector(".block-search__preview");R&&(ao=setTimeout(()=>{R.style.opacity="0",R.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(99%)":"translateX(-99%)",setTimeout(function(){R.remove()},300)},300))};(0,a.useEffect)(()=>{O.querySelectorAll(".blocks-search__result").forEach(R=>{R.style.display="block"})},[i]);const qe=!me?.length&&(!c||!y?.length)&&!Ve?.length&&(Ge.tags||Ge.name||Ge.type)&&!(pe||fe),lo=R=>Z.dispatch(r.blocksApi.endpoints.deleteBlock.initiate(R.id)).then(Re=>{if(Re.error){x.fromError("BLOCK_REMOVING_ERROR",r.getBlockDesc(R),Re.error);return}Me(B=>({list:K,ids:B.list===K?[...B.ids,R.id]:[R.id]})),x.success({id:"BLOCK_REMOVING_SUCCESS",data:r.getBlockDesc(R),title:h('The block "')+R.title+k('" was successfully removed.',"block")})});(0,a.useEffect)(()=>{!pe&&!fe&&n()},[pe,fe,n]),(0,a.useEffect)(()=>{(i==="common"||s)&&setTimeout(n,50)},[me,n,i,s]);const fo=R=>{j({mask:{closable:!0},centered:!0,title:k("Are you sure you want to delete the “","block")+R.title+h("” block?"),icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:22,style:{color:t.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0}}),okText:h("Yes"),cancelText:h("No"),onOk:()=>lo(R)})},F=(R,Re)=>`${R.pathname.split("emails")[0]}blocks/${Re.id}`,X=R=>{let Re=[{key:"Delete block",className:"blocks-search__result__menu-item",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16,style:{margin:0}}),style:{color:b.colorError},onClick:()=>fo(R)}];const B=dp(!0,S);return B==="link"&&Re.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:F(P,R),children:" "})}),B==="over-email"&&Re.unshift({key:"Edit block",className:"blocks-search__result__menu-item",icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,style:cp}),onClick:()=>{r.getEmitter(vo.getContainer(Z),vo.events.OPEN_BLOCK_REQUEST_ID).fireSettled(String(R.id)).then(({errors:Le})=>{Le.length&&x.fromError("BLOCK_GET_ERROR",r.getBlockDesc(R),Le[0])})}}),Re},we=R=>{let Re=R.html.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");if(Re.replaceChildren(...r.parseFromString(R.html)),Object.keys(I).length!==0&&(Re.querySelectorAll(".em-contrast-card").forEach(B=>{I.cards?.contrastBackgroundColor&&(B.getAttribute("bgcolor")?I.cards.contrastBackgroundColor?B.setAttribute("bgcolor",I.cards.contrastBackgroundColor):B.removeAttribute("bgcolor"):I.cards.contrastBackgroundColor?B.style.backgroundColor=I.cards.contrastBackgroundColor:B.style.removeProperty("background-color")),I.cards?.contrastTextColor&&B.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(Le=>{if(We(Le.style.color).toLowerCase()!=="#ffffff"){let ze=Le.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.cards.contrastTextColor};`);Le.setAttribute("style",ze)}})}),Re.querySelectorAll(".em-card").forEach(B=>{I.cards?.baseBackgroundColor&&(B.getAttribute("bgcolor")?I.cards.baseBackgroundColor?B.setAttribute("bgcolor",I.cards.baseBackgroundColor):B.removeAttribute("bgcolor"):I.cards.baseBackgroundColor?B.style.backgroundColor=I.cards.baseBackgroundColor:B.style.removeProperty("background-color")),I.cards?.baseTextColor&&B.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(Le=>{if(We(Le.style.color).toLowerCase()!=="#ffffff"){let ze=Le.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.cards.baseTextColor};`);Le.setAttribute("style",ze)}})}),Re.querySelectorAll(".em-card, .em-contrast-card").forEach(B=>{I.cards?.border&&Ue({settings:{border:I.cards?.border},elem:B}),I.cards?.borderRadius?.all?(B.style.borderBottomLeftRadius&&B.style.borderBottomLeftRadius!=="0px"&&(B.style.borderBottomLeftRadius=I.cards?.borderRadius.all+"px"),B.style.borderBottomRightRadius&&B.style.borderBottomRightRadius!=="0px"&&(B.style.borderBottomRightRadius=I.cards?.borderRadius.all+"px"),B.style.borderTopLeftRadius&&B.style.borderTopLeftRadius!=="0px"&&(B.style.borderTopLeftRadius=I.cards?.borderRadius.all+"px"),B.style.borderTopRightRadius&&B.style.borderTopRightRadius!=="0px"&&(B.style.borderTopRightRadius=I.cards?.borderRadius.all+"px")):I.cards?.borderRadius?.all===""?B.style.removeProperty("border-radius"):(I.cards?.borderRadius?.topLeft&&B.style.borderTopLeftRadius&&B.style.borderTopLeftRadius!=="0px"?B.style.borderTopLeftRadius=I.cards?.borderRadius.topLeft+"px":I.cards?.borderRadius?.topLeft===""&&B.style.removeProperty("border-top-left-radius"),I.cards?.borderRadius?.topRight&&B.style.borderTopRightRadius&&B.style.borderTopRightRadius!=="0px"?B.style.borderTopRightRadius=I.cards?.borderRadius.topRight+"px":I.cards?.borderRadius?.topRight===""&&B.style.removeProperty("border-top-right-radius"),I.cards?.borderRadius?.bottomRight&&B.style.borderBottomRightRadius&&B.style.borderBottomRightRadius!=="0px"?B.style.borderBottomRightRadius=I.cards?.borderRadius.bottomRight+"px":I.cards?.borderRadius?.bottomRight===""&&B.style.removeProperty("border-bottom-right-radius"),I.cards?.borderRadius?.bottomLeft&&B.style.borderBottomLeftRadius&&B.style.borderBottomLeftRadius!=="0px"?B.style.borderBottomLeftRadius=I.cards?.borderRadius.bottomLeft+"px":I.cards?.borderRadius?.bottomLeft===""&&B.style.removeProperty("border-bottom-left-radius"))}),Re.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(B=>{if(!B.style.display&&parseFloat(B.style.fontSize)<=20){let Le="",ze=I.text.fontFamily;if(parseFloat(B.style.fontSize)>14&&(Le=B.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${I.text.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${I.text.lineHeight}px`),B.setAttribute("style",Le)),!B.closest(".em-contrast-card, .em-card")&&We(B.style.color).toLowerCase()!=="#ffffff"&&(Le=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.text.color};`),B.setAttribute("style",Le)),B.closest(".em-contrast-block")&&!B.closest(".em-contrast-card, .em-card")&&(Le=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.text.contrastColor};`),B.setAttribute("style",Le)),ze[0]==="Safe Fonts"?(B.style.fontFamily=ze[1],q({elem:Re})):ze[0]==="Google Fonts"&&(ze[1]==="Sans Serif"?B.style.fontFamily="Helvetica, Arial, sans-serif":ze[1]==="Serif"&&(B.style.fontFamily='"Times New Roman", Times, serif'),B.classList.remove(...[...B.classList].filter(ho=>ho.startsWith("em-font"))),B.classList.add(`em-font-${ze[2].replace(/\s/g,"")}-${ze[3].replace(/\s/g,"")}`),Je({elem:Re,fontFamilyArray:ze})),B.closest('[em="atom"] > tr > td')&&B.closest('[em="atom"] > tr > td').style.paddingBottom)B.closest('[em="atom"] > tr > td').style.paddingBottom=I.text.paddingBottom+"px";else if(B.nextElementSibling||B.closest("table")&&B.closest("table").nextElementSibling){let ho=B.nextElementSibling??B.closest("table").nextElementSibling;ho&&ho.tagName==="TABLE"&&(ho.classList.contains("em-vindent-table")||ho.querySelector("td").innerHTML==="")&&ho.querySelector("td").setAttribute("height",I.text.paddingBottom)}}else if(!B.style.display&&parseFloat(B.style.fontSize)>=20&&We(B.style.color).toLowerCase()!=="#eb3737"){let Le="",ze=I.headings.fontFamily;parseFloat(B.style.fontSize)<40&&(Le=B.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${I.headings.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${I.headings.lineHeight}px`),B.setAttribute("style",Le)),!B.closest(".em-contrast-card, .em-card")&&We(B.style.color).toLowerCase()!=="#ffffff"&&(Le=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.headings.color};`),B.setAttribute("style",Le)),B.closest(".em-contrast-block")&&!B.closest(".em-contrast-card, .em-card")&&(Le=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.headings.contrastColor};`),B.setAttribute("style",Le)),ze[0]==="Safe Fonts"?(B.style.fontFamily=ze[1],q({elem:Re})):ze[0]==="Google Fonts"&&(ze[1]==="Sans Serif"?B.style.fontFamily="Helvetica, Arial, sans-serif":ze[1]==="Serif"&&(B.style.fontFamily='"Times New Roman", Times, serif'),B.classList.remove(...[...B.classList].filter(Xe=>Xe.startsWith("em-font"))),B.classList.add(`em-font-${ze[2].replace(/\s/g,"")}-${ze[3].replace(/\s/g,"")}`),Je({elem:Re,fontFamilyArray:ze}));let ho="";if(I.headings.letterSpacing>0?ho=B.style.letterSpacing?B.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${I.headings.letterSpacing}px`):B.getAttribute("style")+` letter-spacing: ${I.headings.letterSpacing}px;`:ho=B.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),B.setAttribute("style",ho),I.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 Xe=B.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");B.setAttribute("style",Xe)}if(I.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 Xe=B.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");B.setAttribute("style",Xe)}if(B.closest('[em="atom"] > tr > td')&&B.closest('[em="atom"] > tr > td').style.paddingTop)B.closest('[em="atom"] > tr > td').style.paddingTop=I.headings.paddingTop+"px";else if(B.previousElementSibling){let Xe=B.previousElementSibling;Xe&&Xe.tagName==="TABLE"&&(Xe.classList.contains("em-vindent-table")||Xe.querySelector("td").innerHTML==="")&&Xe.querySelector("td").setAttribute("height",I.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=I.headings.paddingBottom+"px";else if(B.nextElementSibling){let Xe=B.nextElementSibling;Xe&&Xe.tagName==="TABLE"&&(Xe.classList.contains("em-vindent-table")||Xe.querySelector("td").innerHTML==="")&&Xe.querySelector("td").setAttribute("height",I.headings.paddingBottom)}}}),Re.querySelectorAll('a[style*="color"]').forEach(B=>{if(B.style.display){if(B.style.display&&B.style.display==="block"){let Le="";if(Le=B.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${I.buttons.fontSize}px`),B.setAttribute("style",Le),B.closest("td").style.backgroundColor&&!B.closest("td").style.borderWidth&&!B.closest(".em-contrast-card"))if(B.closest(".em-contrast-block")?Le=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.buttons.contrastColor};`):Le=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.buttons.color};`),B.setAttribute("style",Le),B.closest(".em-contrast-block"))if(I.buttons.contrastBackgroundColor){let Xe=B.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${I.buttons.contrastBackgroundColor};`);B.closest("td").setAttribute("style",Xe)}else B.closest("td").style.removeProperty("background-color");else if(I.buttons.backgroundColor){let Xe=B.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${I.buttons.backgroundColor};`);B.closest("td").setAttribute("style",Xe)}else B.closest("td").style.removeProperty("background-color");else if(B.closest("td").style.borderWidth)if(Object.values(I.buttons.border).every(Xe=>Xe===null)){if(B.closest(".em-contrast-block")){if(I.buttons.contrastBackgroundColor){let Xe=B.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,Wo=>Wo.replace(/#[A-Fa-f0-9]{6}/,`${I.buttons.contrastBackgroundColor}`));B.closest("td").setAttribute("style",Xe),Le=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.buttons.contrastBackgroundColor};`),B.setAttribute("style",Le)}}else if(I.buttons.backgroundColor){let Xe=B.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,Wo=>Wo.replace(/#[A-Fa-f0-9]{6}/,`${I.buttons.backgroundColor}`));B.closest("td").setAttribute("style",Xe),Le=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.buttons.backgroundColor};`),B.setAttribute("style",Le)}}else for(const Xe in I.buttons.border)I.buttons.border[Xe]&&I.buttons.border[Xe].color!==void 0&&(Le=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.buttons.border[Xe].color};`),B.setAttribute("style",Le));else B.closest(".em-contrast-block")?I.buttons.contrastBackgroundColor&&(Le=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.buttons.contrastBackgroundColor};`),B.setAttribute("style",Le)):I.buttons.backgroundColor&&(Le=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.buttons.backgroundColor};`),B.setAttribute("style",Le));let ze=I.buttons.fontFamily;ze[0]==="Safe Fonts"?(B.style.fontFamily=ze[1],q({elem:Re})):ze[0]==="Google Fonts"&&(ze[1]==="Sans Serif"?B.style.fontFamily="Helvetica, Arial, sans-serif":ze[1]==="Serif"&&(B.style.fontFamily='"Times New Roman", Times, serif'),B.classList.remove(...[...B.classList].filter(Xe=>Xe.startsWith("em-font"))),B.classList.add(`em-font-${ze[2].replace(/\s/g,"")}-${ze[3].replace(/\s/g,"")}`),Je({elem:Re,fontFamilyArray:ze})),B.closest("td").setAttribute("align",I.buttons.textAlign);let ho="";if(I.buttons.letterSpacing>0?ho=B.style.letterSpacing?B.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${I.buttons.letterSpacing}px`):B.getAttribute("style")+` letter-spacing: ${I.buttons.letterSpacing}px;`:ho=B.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),B.setAttribute("style",ho),I.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 Xe=B.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");B.setAttribute("style",Xe)}if(I.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 Xe=B.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");B.setAttribute("style",Xe)}if(B.closest('[em="atom"] > tr > td')&&B.closest('[em="atom"] > tr > td').style.paddingTop)B.closest('[em="atom"] > tr > td').style.paddingTop=I.buttons.marginTop+"px";else if(B.closest("table").previousElementSibling){let Xe=B.closest("table").previousElementSibling;Xe&&Xe.tagName==="TABLE"&&(Xe.classList.contains("em-vindent-table")||Xe.querySelector("td").innerHTML==="")&&Xe.querySelector("td").setAttribute("height",I.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=I.buttons.marginBottom+"px";else if(B.closest("table").previousElementSibling){let Xe=B.closest("table").nextElementSibling;Xe&&Xe.tagName==="TABLE"&&(Xe.classList.contains("em-vindent-table")||Xe.querySelector("td").innerHTML==="")&&Xe.querySelector("td").setAttribute("height",I.buttons.marginBottom)}I.buttons.padding.all&&(B.style.padding=I.buttons.padding.all+"px"),I.buttons.padding.top&&(B.style.paddingTop=I.buttons.padding.top+"px"),I.buttons.padding.right&&(B.style.paddingRight=I.buttons.padding.right+"px"),I.buttons.padding.bottom&&(B.style.paddingBottom=I.buttons.padding.bottom+"px"),I.buttons.padding.left&&(B.style.paddingLeft=I.buttons.padding.left+"px"),Ue({settings:{border:I.buttons.border},elem:B.closest("td")}),eo({settings:{borderRadius:I.buttons.borderRadius},elem:B.closest("td")})}}else{let Le=I.text.fontFamily;if(We(B.style.color).toLowerCase()==="#1c52dc"){let ho=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.links.color};`);B.setAttribute("style",ho)}else{let ho=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.text.color};`);B.setAttribute("style",ho)}if(B.closest(".em-contrast-block")){let ho=B.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.links.contrastColor};`);B.setAttribute("style",ho)}let ze="";I.links.underline?ze=B.style.textDecoration?B.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: underline;"):B.getAttribute("style")+" text-decoration: underline;":ze=B.style.textDecoration?B.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: none;"):B.getAttribute("style")+" text-decoration: none;",B.setAttribute("style",ze),Le[0]==="Safe Fonts"?(B.style.fontFamily=Le[1],q({elem:Re})):Le[0]==="Google Fonts"&&(Le[1]==="Sans Serif"?B.style.fontFamily="Helvetica, Arial, sans-serif":Le[1]==="Serif"&&(B.style.fontFamily='"Times New Roman", Times, serif'),B.classList.remove(...[...B.classList].filter(ho=>ho.startsWith("em-font"))),B.classList.add(`em-font-${Le[2].replace(/\s/g,"")}-${Le[3].replace(/\s/g,"")}`),Je({elem:Re,fontFamilyArray:Le}))}}),Re.querySelector('[em="block"]'))){const B=Re.querySelectorAll('[em="block"]');I.block?.backgroundColor&&B.forEach(Le=>{Le.querySelectorAll(":scope > td").forEach(ze=>{ze.setAttribute("bgcolor",I.block.backgroundColor)})}),I.block?.padding&&B.forEach(Le=>{Le.querySelectorAll(":scope > td").forEach(ze=>{ze.style.paddingTop=I.block.padding.top+"px",ze.style.paddingRight=I.block.padding.right+"px",ze.style.paddingBottom=I.block.padding.bottom+"px",ze.style.paddingLeft=I.block.padding.left+"px"})})}return Re.tagName==="DIV"?r.getElementInnerHTML(Re):r.getElementInnerHTML(Re.querySelector("tbody")||Re)},q=R=>{R.elem.querySelectorAll("link[em-class]").forEach(Re=>{R.elem.querySelector("."+Re.getAttribute("em-class"))||Re.remove()})};function We(R){if(R&&R.charAt(0)==="r"){if(R.charAt(3)==="a")return R=R.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i),R&&R.length===4?"#"+("0"+parseInt(R[1],10).toString(16)).slice(-2)+("0"+parseInt(R[2],10).toString(16)).slice(-2)+("0"+parseInt(R[3],10).toString(16)).slice(-2):"";{R=R.replace("rgb(","").replace(")","").split(",");let Re=parseInt(R[0],10).toString(16),B=parseInt(R[1],10).toString(16),Le=parseInt(R[2],10).toString(16);return Re=Re.length===1?"0"+Re:Re,B=B.length===1?"0"+B:B,Le=Le.length===1?"0"+Le:Le,"#"+Re+B+Le}}else if(R&&R.charAt(0)==="#")return R}const Je=R=>{const Re=R.elem.querySelectorAll("link"),B=`em-font-${R.fontFamilyArray[2].replace(/\s/g,"")}-${R.fontFamilyArray[3].replace(/\s/g,"")}`;if(!Array.from(Re)?.find(ze=>ze.getAttribute("em-class")===B)){let ze=document.createElement("link");ze.setAttribute("rel","stylesheet"),ze.setAttribute("href",`https://fonts.googleapis.com/css2?family=${R.fontFamilyArray[2]}:ital,wght@${oo[R.fontFamilyArray[3]].indexOf("i")>-1?"1":"0"},${oo[R.fontFamilyArray[3]].replaceAll("i","")}&display=swap`),ze.setAttribute("em-class",B),R.elem.insertAdjacentElement("afterbegin",ze)}Eo({elem:R.elem});let Le=`font-family: '${R.fontFamilyArray[2]}', ${yo[R.fontFamilyArray[1]]}!important;`;Le+=` font-weight: ${oo[R.fontFamilyArray[3]].replaceAll("i","")}!important;`,oo[R.fontFamilyArray[3]].indexOf("i")>-1&&(Le+=" font-style: italic!important;"),R.elem.querySelector('style[em="styles"]').insertAdjacentHTML("beforeend",`
|
|
13
|
+
.em-font-${R.fontFamilyArray[2].replace(/\s/g,"")}-${R.fontFamilyArray[3].replace(/\s/g,"")} { ${Le} }`),setTimeout(()=>q({elem:R.elem}),0)},Ue=R=>{R.settings.border.all?R.settings.border.all.width!=null&&(R.settings.border.all.style||R.settings.border.all.color)?(R.elem.style.borderWidth=R.settings.border.all.width+"px",R.elem.style.borderStyle=R.settings.border.all.style,R.elem.style.borderColor=R.settings.border.all.color):R.elem.style.removeProperty("border"):(R.settings.border.top&&(R.settings.border.top.width!=null&&(R.settings.border.top.style||R.settings.border.top.color)?(R.elem.style.borderTopWidth=R.settings.border.top.width+"px",R.elem.style.borderTopStyle=R.settings.border.top.style,R.elem.style.borderTopColor=R.settings.border.top.color):R.elem.style.removeProperty("border-top")),R.settings.border.right&&(R.settings.border.right.width!=null&&(R.settings.border.right.style||R.settings.border.right.color)?(R.elem.style.borderRightWidth=R.settings.border.right.width+"px",R.elem.style.borderRightStyle=R.settings.border.right.style,R.elem.style.borderRightColor=R.settings.border.right.color):R.elem.style.removeProperty("border-right")),R.settings.border.bottom&&(R.settings.border.bottom.width!=null&&(R.settings.border.bottom.style||R.settings.border.bottom.color)?(R.elem.style.borderBottomWidth=R.settings.border.bottom.width+"px",R.elem.style.borderBottomStyle=R.settings.border.bottom.style,R.elem.style.borderBottomColor=R.settings.border.bottom.color):R.elem.style.removeProperty("border-bottom")),R.settings.border.left&&(R.settings.border.left.width!=null&&(R.settings.border.left.style||R.settings.border.left.color)?(R.elem.style.borderLeftWidth=R.settings.border.left.width+"px",R.elem.style.borderLeftStyle=R.settings.border.left.style,R.elem.style.borderLeftColor=R.settings.border.left.color):R.elem.style.removeProperty("border-left")))},eo=R=>{R.settings.borderRadius.all?R.elem.style.borderRadius=R.settings.borderRadius.all+"px":R.settings.borderRadius.all===""?R.elem.style.removeProperty("border-radius"):(R.settings.borderRadius.topLeft?R.elem.style.borderTopLeftRadius=R.settings.borderRadius.topLeft+"px":R.settings.borderRadius.topLeft===""&&R.elem.style.removeProperty("border-top-left-radius"),R.settings.borderRadius.topRight?R.elem.style.borderTopRightRadius=R.settings.borderRadius.topRight+"px":R.settings.borderRadius.topRight===""&&R.elem.style.removeProperty("border-top-right-radius"),R.settings.borderRadius.bottomRight?R.elem.style.borderBottomRightRadius=R.settings.borderRadius.bottomRight+"px":R.settings.borderRadius.bottomRight===""&&R.elem.style.removeProperty("border-bottom-right-radius"),R.settings.borderRadius.bottomLeft?R.elem.style.borderBottomLeftRadius=R.settings.borderRadius.bottomLeft+"px":R.settings.borderRadius.bottomLeft===""&&R.elem.style.removeProperty("border-bottom-left-radius"))},oo={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"},yo={"Sans Serif":"sans-serif",Serif:"serif"};function Eo(R){if(!R.elem.querySelector('style[em="styles"]')){let Re=document.createElement("style");Re.setAttribute("em","styles"),R.elem.append(Re)}}return(0,o.jsxs)("div",{className:(0,Ke.default)("blocks-search",{is_search:s}),children:[(0,o.jsx)(t.ui_kit$Form,{className:(0,Ke.default)("blocks-search__form",{is_search:s}),form:_,layout:"vertical",name:"blocks_search_form",initialValues:{...Xa},onValuesChange:ko,autoComplete:"off",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:Sr,children:(0,o.jsx)(t.ui_kit$SearchInput,{placeholder:h("Search by title"),allowClear:!0,enterButton:!1})})}),((s||i==="project")&&_e||(s||i==="template")&&L||(s||i==="common")&&D)&&(0,o.jsx)(t.ui_kit$Alert,{title:h("Error"),description:h("Error when receiving data. Try again (reload page) or contact support."),type:"error",showIcon:!0}),s&&!qe&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:mo,children:h("All")},"search_All"),v.map(R=>(0,o.jsx)("li",{"data-type":R,onClick:mo,children:h(r.TYPES_TRANSLATE[R])},"search_"+R))]})}),(0,o.jsxs)("div",{ref:A,className:(0,Ke.default)("blocks-search__result-wrapper",{is_search:s}),children:[(i==="project"||s)&&(0,o.jsxs)(o.Fragment,{children:[!!Te.length&&!s&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:mo,children:h("All")},"blocksSections_All"),Te.map(R=>(0,o.jsx)("li",{"data-type":R,onClick:mo,children:h(r.TYPES_TRANSLATE[R])},"blocksSections_"+R))]})}),(0,o.jsxs)("div",{className:(0,Ke.default)("blocks-search__blocks-wrapper",{is_search:s}),ref:le,children:[(0,o.jsx)("div",{className:"blocks-search__result-holder project",children:!ie&&(te?.length?te.map(R=>{const Re=Er(R.id,Br(R));return(0,o.jsx)("div",{className:"blocks-search__result","data-type":R.type,children:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"leftTop",menu:{items:X(R)},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:B=>Ne(B,R.html,"project",R.title,R),onDragStart:B=>de(B,R.html,"project",R.title,R),onMouseEnter:()=>ge({html:R.html,title:R.title}),onMouseLeave:Ye,children:[J(R),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:Re,onContentLoad:Pe,style:{transform:`scale(${U})`}})]})},"commenMenu")},R.id)}):!(Ge.tags||Ge.name||Ge.type)&&ye&&!ie&&!s&&(0,o.jsxs)("div",{style:{padding:"10px 0 20px",display:"flex",flexDirection:"row",justifyContent:"space-between"},children:[(0,o.jsxs)("div",{style:{width:"110%"},children:[(0,o.jsx)("h3",{style:{lineHeight:"1.2"},children:h("You don`t have any saved blocks yet.")}),h("To add a block from the dashboard click the"),' "',h("Save to Blocks button."),'" ',(0,o.jsx)(r.EmIcons,{icon:"SaveBlock",component:t.icons$SaveBlock,style:{position:"relative",top:"2px"}}),(0,o.jsx)("br",{}),(0,o.jsx)("br",{}),h("You can also save all blocks at once. The AI assistant will automatically determine the type and create a name for each block when saving."),(0,o.jsx)("br",{}),(0,o.jsx)("br",{}),(0,o.jsx)(t.ui_kit$Flex,{justify:"left",children:(0,o.jsx)(t.ui_kit$Button,{type:"primary",onClick:()=>d(!0),style:{cursor:"pointer"},children:h("Save all blocks")})})]}),(0,o.jsx)("div",{style:{width:"80px",height:"200px"},children:(0,o.jsx)("img",{src:lp,style:{display:"block",width:80,position:"absolute",right:5}})})]}))}),ie&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),s&&me?.length>0&&y?.length>0&&(0,o.jsx)(t.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="template"||s)&&(0,o.jsxs)(o.Fragment,{children:[!!Ee.length&&!s&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:mo,children:h("All")},"templateBlocksSections_All"),Ee.map(R=>(0,o.jsx)("li",{"data-type":R,onClick:mo,children:h(r.TYPES_TRANSLATE[R])},"templateBlocksSections_"+R))]})}),(0,o.jsxs)("div",{className:(0,Ke.default)("blocks-search__blocks-wrapper",{is_search:s}),ref:xe,children:[(0,o.jsxs)("div",{className:"blocks-search__result-holder template",children:[y&&!(re||ce)&&he?.length?(0,o.jsx)(o.Fragment,{children:he.map((R,Re)=>{const B=Er(R.id,Br(R));return(0,o.jsx)("div",{className:"blocks-search__result","data-type":R.type,children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:Le=>Ne(Le,R.html,"template",R.title,R),onDragStart:Le=>de(Le,R.html,"template",R.title,R),onMouseEnter:()=>ge({html:R.html,title:R.title}),onMouseLeave:()=>Ye(),children:[J(R),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:B,onContentLoad:Pe,style:{transform:`scale(${U})`}})]})},R.id+Re.toString())})}):!s&&!ue&&!ce&&!L&&(0,o.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:h("No related blocks found.")})," "]}),(re||ce)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),s&&y?.length>0&&Ve?.length>0&&(0,o.jsx)(t.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="common"||s)&&(0,o.jsxs)(o.Fragment,{children:[!!$?.length&&!s&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:mo,children:h("All")},"commonBlocksSections_All"),$.map(R=>(0,o.jsx)("li",{"data-type":R,onClick:mo,children:h(r.TYPES_TRANSLATE[R])},"commonBlocksSections_"+R))]})}),(0,o.jsxs)("div",{className:(0,Ke.default)("blocks-search__blocks-wrapper",{is_search:s}),ref:ve,children:[(0,o.jsxs)("div",{className:"blocks-search__result-holder common",children:[oe&&!!uo?.length&&!io&&(0,o.jsx)(o.Fragment,{children:uo.map((R,Re)=>{const B=we({html:Er(R.id,Br(R))});return(0,o.jsx)("div",{className:"blocks-search__result","data-type":R.type,children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:Le=>Ne(Le,we({html:R.html}),"common",R.title,R),onDragStart:Le=>de(Le,we({html:R.html}),"common",R.title,R),onMouseEnter:()=>ge({html:we({html:r.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+R.html+"</table>")}),title:R.title}),onMouseLeave:()=>Ye(),children:[J(R),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:B,onContentLoad:Pe,style:{transform:`scale(${U})`}})]})},R.id+Re.toString())})})," "]}),io&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),qe&&(0,o.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:h("There are no blocks for this request.")})]})]})};Tr.propTypes={};function up(e,i){return e==="email"||r.isBlocksV2Enabled()?!0:i!==void 0&&r.isPluginGoHistory(i)}var Ka=({comments:e,subjectId:i,isLoggedIn:l,projectTitle:s="",emailElementType:n,email:d})=>{const{__:c,_n:p}=r.useI18n(),g=r.useSendPostMessage(),m=r.useNotification(),{token:_}=(0,t.ui_kit$useToken)(),E=r.useAppConfig(),b=r.usePushToDataLayer(),h=(0,a.useRef)(null),[k,x]=(0,a.useState)(""),[T,j]=(0,a.useState)("ADD"),[P,S]=(0,a.useState)(!1),[y,V]=(0,a.useState)(null),[z,A]=(0,a.useState)(null),[O,w]=(0,a.useState)(""),[U,J]=(0,a.useState)(""),[Q,I]=(0,a.useState)(!1),[le,xe]=(0,a.useState)(""),[ve,Z]=r.useAddCommentMutation(),[be,Ne]=r.useDeleteCommentMutation(),[de,Fe]=r.useEditCommentMutation(),[Ae,Ge]=r.useDeleteTargetMutation(),[je]=r.useAutoSaveBlockMutation(),ye=r.useDispatch(),_e=r.useStore(),pe=r.useCurrentUser(),fe=r.useCurrentProjectRequested(),me=r.useContentReader(),K=Y=>{const oe=r.getEmailDocuments(vo.getContainer(_e));oe.save("anchor",{project:Y}).then(D=>{const ue=D?oe.revisionFacts()?.lastRevisionAt:void 0;ue!==void 0&&d?.id!=null&&ye(r.rememberAutosaveTime({emailId:d.id,modified:new Date(ue).toISOString()}))})},ee=()=>{const Y=fe;if(up(n,vo.getContainer(_e))){K(Y);return}const oe={...d?.meta!==void 0?{meta:d.meta}:{},title:d?.title,emailId:d?.id,project:Y,html:me(),excerpt:d?.date_gmt};d?.id!=null&&je({blockId:d.id,body:oe}).catch(D=>{})};function ie(Y){I(!1),xe(""),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:le}),S(!0),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!0})}function ae(){A(y),e.filter(Y=>Y.parent===y).length?de({commentId:y,status:"deleted"}).unwrap():be(y),document.querySelector('.discuss-main li[id="'+y+'"] .comment-icon-target')?.getAttribute("target-id")&&g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:document.querySelector('.discuss-main li[id="'+y+'"] .comment-icon-target')?.getAttribute("target-id")}),ee(),xe("")}function ne(Y){A(y);const oe=e.find(ue=>ue.id?.toString()===y),D=oe?.target_id?.toString()||"";I(!!D),xe(D),J(oe?.content?.slice(3,-5)?.toString()),j("EDIT")}function Me(Y){A(y),w(""),j("REPLY")}const te=()=>{m.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 Te(){l?(await de({commentId:z,content:U,targetId:le}).unwrap(),j("ADD"),J(""),A(0),I(!1),S(!1),xe(""),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):te()}const ke=Y=>{j("ADD"),J(""),A(0),I(!1),S(!1),xe(""),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})},M=async()=>{l?((k||O)&&await ve({subjectId:i,author:pe.id,parent:T==="ADD"?"0":z,content:k||O,author_name:pe.name,author_email:pe.email,targetId:le}).then(Y=>{if(Y.error){const{data:oe}=Y.error;m.error({title:oe?.code??c("Error"),description:oe?.message??c("Something went wrong. Try again later.")})}else b({event:"submit",action:"send_discussion_chat_message",entity_type:n==="block"?"block":"email",entity_id:d?.id,project_id:d?.project,context:"editor"},void 0,{analyticsName:"editor_comment_sent"})}),xe(""),j("ADD"),w(""),x(""),A(0),I(!1),S(!1),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):te()};function C(){Q?(S(!1),I(!1),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:le})):(S(!P),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!P}),P&&I(!1))}function G(Y){let oe=JSON.parse(JSON.stringify(Y));if(!oe||!oe.length)return[];let D=[],ue=new Map;for(let Ie=0,Ve=oe.length;Ie<Ve;++Ie){let to=oe[Ie],io=ue.get(to.id);if((!io||Array.isArray(io))&&(io&&(to.children=io),ue.set(to.id,to)),String(to.parent)==="0")D.push(to);else{let uo=ue.get(to.parent);uo?(Array.isArray(uo)?uo:uo.children=uo.children||[]).push(to):ue.set(to.parent,[to])}}return D.forEach(Ie=>{Ie.status==="deleted"&&!Ie.children&&(Ne.isUninitialized||Ne.isSuccess)&&be(Ie.id).unwrap().catch(Ve=>{})}),D}const L=Y=>{const oe=Y.data.operation;if(oe===r.EVENT_TYPES.APPLICATION_DISCUSS_SET_ID&&(xe(Y.data.settings.value),Y.data.settings.value!==""?(I(!0),S(!1)):(I(!1),S(!0))),oe===r.EVENT_TYPES.APPLICATION_DISCUSS_SAVE_TARGET&&ee(),oe===r.EVENT_TYPES.APPLICATION_DISCUSS_GET_COMMENT)if(document.querySelector('.comment-icon-target[target-id="'+Y.data.settings.targetId+'"]')){let D=document.querySelector('.comment-icon-target[target-id="'+Y.data.settings.targetId+'"]').closest(".ant-comment");document.querySelector(".comment-block")?document.querySelector(".comment-block").scrollTo(0,D.offsetTop):document.querySelector(".em-analytics__email-tab-discuss .ant-tabs-content").scrollTo(0,D.offsetTop),D.classList.add("active"),setTimeout(()=>{D.classList.remove("active")},2e3)}else g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:Y.data.settings.targetId}),m.error({title:c("There's no such comment.")});oe===r.EVENT_TYPES.APPLICATION_DISCUSS_NO_COMMENT&&m.error({title:c("There's no such element in the email.")})};r.useListenPostMessage(L);const re=Y=>{g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_GET_TARGET,value:Y})},ce=Y=>(Y?.sort((oe,D)=>oe.date>D.date?1:-1),(0,o.jsx)(o.Fragment,{children:Y&&!!Y.length&&(0,o.jsx)(t.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:Y,renderItem:oe=>(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("li",{id:oe.id,children:(0,o.jsxs)(o.Fragment,{children:[oe.status==="deleted"&&oe.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:ce(oe.children)}),oe.status!=="deleted"&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Comment,{author_id:oe.author_id,author:oe.author_name,avatar:oe.author_avatar_urls&&oe.author_avatar_urls[48]||"",className:(0,Ke.default)(oe.target_id&&"targetted-comment-item",(!oe.author_avatar_urls||!oe.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>V(oe.id),menu:{items:oe.author===pe.id?$e:Ce},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,o.jsx)("div",{onClick:()=>oe.target_id&&re(oe.target_id),dangerouslySetInnerHTML:{__html:oe.content}})},"commenMenu"),datetime:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:oe.date&&r.formatDate(r.tryParseISO(oe.date),p,!0)}}),oe.target_id&&(0,o.jsx)("span",{className:"comment-icon-target","target-id":oe.target_id,onClick:()=>re(oe.target_id),children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,style:{color:_.colorInfo,top:-2,position:"relative"}})})]}),children:(0,o.jsxs)(o.Fragment,{children:[T==="REPLY"&&z===oe.id&&Ee,T==="EDIT"&&z===oe.id&&he,ce(oe.children)]})})})]})})})})})),he=(0,o.jsxs)(t.ui_kit$Form,{onFinish:Te,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:U,onChange:Y=>J(Y.target.value),rows:4,placeholder:c("Editing comments"),onKeyDown:Y=>Y.key==="Escape"&&ke(),onPressEnter:Y=>Y.key==="Enter"&&Y.ctrlKey&&Te(),ref:h})}),(0,o.jsx)(t.ui_kit$Form.Item,{className:"buttons",children:(0,o.jsxs)(t.ui_kit$Space,{children:[Q?(0,o.jsx)(t.ui_kit$Popconfirm,{title:c("Are you sure?"),okText:c("Yes"),cancelText:c("No"),onConfirm:ie,children:(0,o.jsx)(t.ui_kit$Button,{loading:Ge.isLoading,type:P||Q&&T==="EDIT"&&le!==""?"primary":"default",className:"button-target "+(P&&!Q?"button-target_choose":""),style:Q&&T==="EDIT"&&le!==""?{background:_.colorInfo}:{},children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,className:"icon-target"})})}):(0,o.jsx)(t.ui_kit$Button,{onClick:C,loading:Ge.isLoading,type:P||Q&&T==="EDIT"&&le!==""?"primary":"default",className:"button-target "+(P&&!Q?"button-target_choose":""),style:Q&&T==="EDIT"&&le!==""?{background:_.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:Fe.isLoading,htmlType:"submit",children:[c("Save")," ",(0,o.jsx)(r.EmIcons,{icon:"SaveOutlined",component:t.icons$SaveOutlined,size:16,strokeWidth:E.iconStrokeWidth})]}),(0,o.jsx)(t.ui_kit$Button,{onClick:ke,className:"button-reply",children:c("Cancel")})]})})]}),Ee=(0,o.jsxs)(t.ui_kit$Form,{name:"reply",className:"commentForm",onFinish:M,children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{className:"textarea-reply",value:O,onChange:Y=>w(Y.target.value),rows:4,placeholder:c("Reply to the comment"),onKeyDown:Y=>Y.key==="Escape"&&ke(),onPressEnter:Y=>Y.key==="Enter"&&Y.ctrlKey&&M(),ref:h})}),(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:C,type:P||Q&&T==="REPLY"&&le!==""?"primary":"default",className:"button-target "+(P&&!Q?"button-target_choose":""),style:Q&&T==="REPLY"&&le!==""?{background:_.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"&&Z.isLoading,htmlType:"submit",children:[c("Reply")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:E.iconStrokeWidth})]}),(0,o.jsx)(t.ui_kit$Button,{onClick:ke,className:"button-reply",ghost:!0,type:"primary",children:c("Cancel")})]})})]});(0,a.useEffect)(()=>{T==="REPLY"&&h.current.focus({cursor:"start"}),T==="EDIT"&&h.current.focus({cursor:"end"})},[T]);let $e=[];$e.push({key:"Reply to comment",icon:(0,o.jsx)(r.EmIcons,{icon:"RollbackOutlined",component:t.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:Me},{key:"Edit comment",icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,style:{fontSize:"16px"}}),label:c("Edit"),onClick:ne},{key:"Delete comment",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16}),label:c("Delete"),style:{color:_.colorError},onClick:ae});let Ce=[];return Ce.push({key:"Reply to comment",icon:(0,o.jsx)(r.EmIcons,{icon:"RollbackOutlined",component:t.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:Me}),(0,o.jsxs)("div",{className:"discuss-main",children:[e.length>0&&(0,o.jsx)(t.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:G(e),renderItem:Y=>(0,o.jsxs)("li",{id:Y.id,children:[Y.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:ce(Y.children)}),Y.comment_status!=="deleted"&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Comment,{author_id:Y.author_id,author:Y.author_name,avatar:Y.author_avatar_urls&&Y.author_avatar_urls[48]||"",className:(0,Ke.default)(Y.target_id&&"targetted-comment-item",(!Y.author_avatar_urls||!Y.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>V(Y.id),menu:{items:Y.author===pe.id?$e:Ce},styles:{root:{minWidth:"auto"}},children:(0,o.jsx)("div",{onClick:()=>Y.target_id&&re(Y.target_id),dangerouslySetInnerHTML:{__html:Y.content}})},"commenMenu"),datetime:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:Y.date&&r.formatDate(r.tryParseISO(Y.date),p,!0)}}),Y.target_id&&(0,o.jsx)("span",{className:"comment-icon-target","target-id":Y.target_id,onClick:()=>re(Y.target_id),children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,style:{color:_.colorInfo,top:-2,position:"relative"}})})]}),children:(0,o.jsxs)(o.Fragment,{children:[T==="REPLY"&&z===Y.id&&Ee,T==="EDIT"&&z===Y.id&&he,ce(Y.children)]})})})]})}),(0,o.jsxs)(t.ui_kit$Form,{onFinish:M,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:Y=>x(Y.target.value),rows:4,placeholder:c("Leave your comment"),className:"textarea-comment",onPressEnter:Y=>Y.key==="Enter"&&Y.ctrlKey&&M()})}),(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:C,type:P||Q&&T==="ADD"&&le!==""?"primary":"default",className:"button-target "+(P&&!Q?"button-target_choose":""),style:Q&&T==="ADD"&&le!==""?{background:_.colorInfo}:{},icon:(0,o.jsx)(r.EmIcons,{icon:"Target",component:t.icons$Target,size:16,strokeWidth:E.iconStrokeWidth,className:"icon-target"})})}),(0,o.jsxs)(t.ui_kit$Button,{className:"button-add",type:"primary",loading:T==="ADD"&&Z.isLoading,htmlType:"submit",children:[c("Send")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:E.iconStrokeWidth})]})]})})]})]})};function mp(e,i){return{ID:e.userId,userId:e.userId,display_name:e.displayName,user_email:e.email,user_firstname:e.firstName,user_lastname:e.lastName,avatar_url:e.avatarUrl,...i?{role:i}:{}}}var pp=["common_styles","subject","preheader","meta"];function hp(e,i){r.writeSourceReport(e,r.fromRevision(i))}function bp(e){if(!e)return null;const i=e.get().attributes??{},l={};for(const s of pp)i[s]!==void 0&&(l[s]=i[s]);return{content:e.getContent(),attributes:l}}function qa(e,i){i&&r.writeSourceReport(e,{content:i.content,attributes:i.attributes})}var Ja=(e,i)=>({key:e.id,id:e.id,author:e.author,authorName:e.authorName,date:r.formatDate(r.tryParseISO(e.date||e.modified),i),title:e.title,html:e.html,common_styles:e.common_styles,loading:!1,isAutosave:e.isAutosave===!0}),Rr=({emailElement:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),s=r.useDispatch(),n=r.useEditorProjectId(),d=r.useEmailAttributesWriter(),c=r.useContentReplacer(),p=r.useEditorLocked(),g=r.useEditorLockCheck(),{document:m}=r.useDocumentSessionContext(),_=r.useSelector(r.selectHistoryData),E=r.useDocumentHistoryReader(),b=r.useRevisionContent(),h=r.useNotification(),k=(0,a.useRef)({preview:0,apply:0}),x=r.useProjectData()?.members,T=r.useSelector(r.selectElementHistoryHasMore),j=r.useSelector(r.selectIsPanelHistoryCollapsed),[P,S]=(0,a.useState)(!0),[y,V]=(0,a.useState)(!1),[z,A]=(0,a.useState)([]),[O,w]=(0,a.useState)([]),U=ae=>s(r.switchIsPanelHistoryCollapsed(ae)),J=(0,a.useCallback)(ae=>{if(!ae?.html||g())return;const ne=r.fromRevision(ae);ne?.attributes&&d(ne.attributes),s(r.markAppearanceNeedsUpdate());const Me=m?.get().version;c(ae.html,{undoable:!0}),m&&m.get().version===Me&&m.markUnsaved()},[c,s,d,m,g]),Q=(0,a.useCallback)(ae=>{hp(m,ae),s(r.markAppearanceNeedsUpdate())},[m,s]),{data:I}=r.projectsApi.useGetProjectQuery(Number(n),{skip:!n}),[le,xe]=(0,a.useState)([]);(0,a.useEffect)(()=>{if(I){const{owner:ae,admins:ne,users:Me}=I?.members;xe([ae&&{...ae},ne&&Array.isArray(ne)&&ne.map(te=>({...te})),Me&&Array.isArray(Me)&&Me.map(te=>({...te}))].filter(te=>te).flat(1).map(te=>({id:te.ID,display_name:te.display_name})))}},[I,I?.members,i]);const[ve,Z]=(0,a.useState)(1),[be,Ne]=(0,a.useState)(!1);(0,a.useEffect)(()=>{const ae=Array.isArray(_)&&_.length&&_?.map(ne=>Ja(ne,i));w(ae||[]),A(ae),S(!1),T||Ne(!0)},[_,T,i]);const de=()=>{V(!0),w(z.concat([...new Array(3)].map(()=>({loading:!0})))),E(e.id,ve+1).then(ae=>{if(ae.isStale)return;const{data:ne,hasMore:Me}=ae.data,te=Array.isArray(ne)&&ne?.map(ke=>Ja(ke,i)),Te=z.concat(te);w(Te),A(Te),V(!1),window.dispatchEvent(new Event("resize")),Me||Ne(!0),Z(ve+1)})},Fe=!P&&!y&&!be?(0,o.jsx)("div",{style:{textAlign:"center",marginTop:24,marginBottom:24,height:32,lineHeight:"32px"},children:(0,o.jsx)(t.ui_kit$Button,{onClick:de,children:i("loading more")})}):null,[Ae,Ge]=(0,a.useState)(),[je,ye]=(0,a.useState)(null),_e=(0,a.useCallback)(ae=>{J(ae),Ge(null),ye(null),l({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),s(r.resetToLastActiveSettingsTab())},[J,l,s]),pe=(0,a.useCallback)((ae,ne)=>Me=>{const te=k.current;te[ne]+=1,ne==="apply"&&(te.preview+=1);const Te=te[ne],ke=()=>Te===k.current[ne];if(Me?.html||!Me?.id){ae(Me);return}b(e.id,Me).then(M=>{ke()&&ae(M)},M=>{ke()&&(Ge(null),h.error({message:i("Failed to load"),innerException:M}))})},[b,e.id,h,i]),fe=pe(_e,"apply"),me=pe(Q,"preview"),K=({author:ae,authorName:ne})=>{if(ie.revisionService)return ne||ae||"–";const Me=le.find(Te=>Te.id?.toString()===ae?.toString())?.display_name;if(Me)return Me;const te=r.authorFromMembers(ae,x);return te?mp(te).display_name||te.email||"–":ne||"–"},ee=(0,a.useRef)(void 0);(0,a.useEffect)(()=>{!j&&!je&&(ee.current=m,ye(bp(m)))},[j,ye,m,je]),(0,a.useEffect)(()=>{j&&(k.current.preview+=1),j&&je&&(ee.current===m&&(qa(m,je),s(r.markAppearanceNeedsUpdate())),ye(null))},[j,je,m,s]);const ie=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:P,itemLayout:"horizontal",loadMore:Fe,dataSource:O,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:(ae,ne)=>(0,o.jsx)(t.ui_kit$List.Item,{onClick:()=>{ne!==Ae&&(Ge(ne),me(z[ne])),s(r.setBlockSettingsDisable(!0))},className:(0,Ke.default)("history-panel__item",{"history-panel__item_active":ne===Ae}),children:(0,o.jsxs)(t.ui_kit$Skeleton,{title:!1,loading:ae.loading||!1,active:!0,children:[(0,o.jsx)("div",{className:"history-panel__list-date",children:ae.date}),(0,o.jsx)("div",{className:"history-panel__list-author",children:K(ae)}),ae.isAutosave&&Ae!==ne&&(0,o.jsx)("div",{style:{opacity:.45},className:"history-panel__list-autosave",children:i("Auto")}),!ae.isAutosave&&(0,o.jsx)(t.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",disabled:p,onClick:Me=>{Ae===ne&&Me.stopPropagation(),fe(z[ne])},children:i("Set")}),ae.isAutosave&&Ae===ne&&(0,o.jsx)(t.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",disabled:p,onClick:Me=>{Ae===ne&&Me.stopPropagation(),fe(z[ne])},children:i("Set")})]})})})}]}),(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"ant-modal-close","aria-label":"Close",onClick:()=>{s(r.resetToLastActiveSettingsTab()),je&&qa(m,je),ye(null),U(!0),l({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1})},children:(0,o.jsx)(r.EmIcons,{icon:"Close",component:t.icons$Close})})]})};Rr.propTypes={};var Qa=async({blockTags:e,projectTagsArray:i,addTerm:l,project:s,notification:n})=>{if(!e||e.length===0)return[];const d=e.map(c=>{const p=i.find(g=>g.name===c);return p?Promise.resolve(p.id):l({project:s,kind:r.BLOCK_TAGS,name:c}).then(({error:g,data:m})=>{if(g?.status===400)return r.existingTermIdFromError(g);if(m)return m.id;if(g)return n.fromError("TAG_CREATING_ERROR",c,g),null})});return(await Promise.all(d)).filter(c=>c!=null)},Za=()=>{document.querySelector(".blocks-search__blocks-wrapper")&&(document.querySelector(".blocks-search__blocks-wrapper").style.removeProperty("transition"),document.querySelector(".blocks-search__blocks-wrapper").style.opacity=0,document.querySelectorAll(".blocks-search__result-body").forEach(e=>e.style.removeProperty("height")),setTimeout(()=>{document.querySelectorAll(".blocks-search__result-body").forEach(e=>{e.style.height=e.offsetHeight*207/640+"px"}),document.querySelector(".blocks-search__blocks-wrapper")&&(document.querySelector(".blocks-search__blocks-wrapper").style.transition="opacity 0.2s",document.querySelectorAll(".blocks-search__blocks-wrapper").forEach(e=>e.style.opacity=1))},1500))},gp=async e=>{const{block:i,form:l,projectData:s,projectTagsArray:n,projectId:d,addBlock:c,editBlock:p,editProject:g,addTerm:m,notification:_,__:E,handleCloseModal:b,htmlContent:h,reloadBlockScreens:k,onGlobalBlockTemplateSynced:x,onPlainBlockCreated:T}=e;try{const{valid:j,values:P,blockTags:S}=await en({form:l,notification:_,__:E});if(!j)return;const y=await Qa({blockTags:S,projectTagsArray:n,addTerm:m,project:s,notification:_});await r.createBlock({block:i,form:l,projectId:d,htmlContent:h,values:P,tagIds:y,addBlock:c,editBlock:p,editProject:g,notification:_,reloadBlockScreens:k,projectTagsArray:n,__:E,handleCloseModal:b,onGlobalBlockTemplateSynced:x,onPlainBlockCreated:T})}catch{}},en=async({form:e,notification:i,__:l})=>{let s=!0;const n=await e.validateFields(),d=n.tags;return d?.length>10&&(i.error({id:"BLOCK_TOO_MANY_TAGS_ERROR",data:r.getBlockDesc(n),title:l("Maximum 10 tags available.")}),s=!1),{valid:s,values:n,blockTags:d}},yr=({isModalVisible:e,htmlContent:i,projectId:l,setIsShowAddAllBlocksModal:s,setIsShowAddAllBlocksModalForNewEmail:n})=>{const{__:d}=r.useI18n(),c=r.useDispatch(),[p]=t.ui_kit$Form.useForm(),[g,m]=(0,a.useState)([]),[_,E]=r.useAddBlockMutation(),[b]=r.useEditBlockMutation(),{data:h}=r.useGetBlockTypesQuery(),k=r.useNotification(),x=r.useAppConfig(),[T,j]=(0,a.useState)([]),P=r.useProjectData(),[S,y]=r.useAddTermMutation(),[V,z]=r.useEditProjectMutation(),A=r.useSendPostMessage(),O=(0,a.useCallback)((Z,be)=>{A({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:Z,...be?{emBlockVersion:be}:{}}})},[A]),w=(0,a.useCallback)(()=>{A({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_CLEAR_EM_BLOCK_ID})},[A]),{data:U}=r.useGetTermsQuery({project:P,kind:r.BLOCK_TAGS},{skip:!P?.id});(0,a.useEffect)(()=>{j((U||[]).map(Z=>({value:Z.name})))},[U]),(0,a.useEffect)(()=>{if(h){const Z=h;let be=[];for(let Ne in Z)be.push({label:d(r.TYPES_TRANSLATE[Z[Ne]]),value:Z[Ne]});m(be)}},[h,d]);const J=()=>{c(r.closeModal())},Q=(0,a.useRef)(!1),I=(0,a.useCallback)(()=>{Q.current&&(Q.current=!1,p.resetFields())},[p]),le=()=>{Q.current=!0,J()};(0,a.useLayoutEffect)(()=>{e&&I()},[e,I]);const xe=()=>{s(!0),n(!1),J()},ve=async()=>{await gp({form:p,projectData:P,projectTagsArray:U||[],projectId:l,addBlock:_,editBlock:b,editProject:V,addTerm:S,notification:k,__:d,handleCloseModal:le,htmlContent:i,reloadBlockScreens:Za,onGlobalBlockTemplateSynced:O,onPlainBlockCreated:w})};return(0,o.jsx)(t.ui_kit$Modal,{title:(0,o.jsx)("div",{className:"ant-modal-title",children:d("Save block")}),open:e,afterClose:I,onOk:()=>xe(),onCancel:J,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:xe,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:E.isLoading,onClick:ve,icon:(0,o.jsx)(r.EmIcons,{icon:"CreateBlock",component:t.icons$CreateBlock,style:{fontSize:22}}),children:d("Save block")},"submit")]}),children:(0,o.jsxs)(t.ui_kit$Form,{form:p,layout:"vertical",name:"add_new_block_form",onFinish:ve,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:E.isLoading||y.isLoading||z.isLoading,size:"large",placeholder:d("Enter block name"),spellCheck:"false"})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Type"),name:"type",rules:[{required:!0,message:d("Please choose block type")}],style:{marginBottom:15},children:(0,o.jsx)(t.ui_kit$Select,{disabled:E.isLoading||y.isLoading||z.isLoading,size:"large",placeholder:d("Choose block type"),options:g})})})]}),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:E.isLoading||y.isLoading||z.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:E.isLoading||y.isLoading||z.isLoading})})]})})};yr.propTypes={};var fp="https://app.useblocks.io/api".replace(/\/+$/,""),_p=`${fp}/wp-json/ai-generator/v1/identificate_blocks`,xp=["Menu","Header","Content","Banners","Lists","Buttons","Promocodes","Feature","Call to Action","E-Commerce","Articles","Polls","Applications","Separators","Contacts","Footer","Other"];async function kp(e){return await e.getInstance(vo.TOKEN_ID)}async function Ep(e,i,l,s,n){const d={blocks:s,types:xp,locale:i};l.current=d;try{const c=await kp(n),p=await fetch(_p,{method:"POST",headers:{"Content-Type":"application/json",...c?{Authorization:`Bearer ${c}`}:{}},body:JSON.stringify(d)});if(!p.ok||p.status!==200)throw new Error(`${p.statusText}`);return await p.json()}catch(c){throw c}}var Bp=(e,i="block")=>{const l=new DOMParser,s=l.parseFromString(e,"text/html"),n=s.querySelectorAll(`[em="${i}"]`),d=s.querySelectorAll("link");return{parser:l,document:s,blockElements:n,styleElement:s.querySelector('[em="styles"]'),linksElements:d}};function Sp(e){return Array.from(e).map(i=>i.outerHTML).join("")}var Tp=(e,i="block",l=!1)=>{if(!e?.html)return[];const{document:s,blockElements:n,styleElement:d,linksElements:c}=Bp(e.html,i),p=Sp(c);if(!(n instanceof NodeList))return[];const g=s.querySelector("head"),m=g?g.innerHTML:"";return Array.from(n).map((_,E)=>{if(!(_ instanceof Element)||!_.outerHTML)return null;const b=d?d.outerHTML:"";return{id:`${e.id}-${E}`,html:l?`<!DOCTYPE html>
|
|
14
|
+
<html>
|
|
15
|
+
<head>${m}</head>
|
|
16
|
+
<body>
|
|
17
|
+
<table>${_.outerHTML}</table>
|
|
18
|
+
</body>
|
|
19
|
+
</html>`:r.minifyHtml(`${p}${b}${_.outerHTML.replace(/class="em-structure"/,'class=""')}`)}}).filter(Boolean)};function Rp(e,i,l){const{images:s}=e,{blocks:n}=i;return s?.map(d=>{const c=n.find(p=>p.id===d.block_id);return{blockType:d.classification,blockTitle:d.name,htmlContent:c?.html||"",projectId:l}})}var yp=e=>e.replace(/<div\s+[^>]*style="font-family:[^>]*>(.*?)<\/div>/gs,i=>i.replace(/>(.*?)<\/div>/s,"></div>")),jp=e=>e.replace(/src="[^"]*"/g,'src=""'),wp=e=>/<div\s+[^>]*style="font-family:/i.test(e),vp=e=>{const i=new Set,l=[];for(const s of e)if(wp(s.html)){const n=jp(yp(s.html));i.has(n)||(i.add(n),l.push(s))}else l.push(s);return l},Ip=async e=>{const{block:i,form:l,projectData:s,projectId:n,addBlock:d,editProject:c,notification:p,__:g,handleCloseModal:m,htmlContent:_,reloadBlockScreens:E,values:b,tagIds:h,projectTagsArray:k}=e;try{return await r.createBlock({block:i,form:l,projectId:n,htmlContent:_,values:b,tagIds:h,addBlock:d,editProject:c,notification:p,reloadBlockScreens:E,projectTagsArray:k,__:g,handleCloseModal:m})}catch(x){throw x}},Cp=({projectData:e,addTerm:i,addBlock:l,editProject:s,reloadBlockScreens:n,notification:d,__:c,handleCloseModal:p,setTriggerOpenSavedBlocksTab:g,setTagsOptions:m,form:_,projectId:E})=>{const[b,h]=(0,a.useState)(!1),k=r.useInvalidateProject(),{data:x}=r.useGetTermsQuery({project:e,kind:r.BLOCK_TAGS},{skip:!e?.id});return(0,a.useEffect)(()=>{m((x||[]).map(j=>({value:j.name})))},[x,m]),{bulkSave:async(j,P,S,y)=>{h(!0);try{if(!P)return;const V=await Qa({blockTags:y,projectTagsArray:x||[],addTerm:i,project:e,notification:d});let z=!0,A=0;for(const O of j)try{await Ip({block:O,form:_,projectData:e,projectId:E,addBlock:l,editProject:s,notification:d,__:c,handleCloseModal:p,values:S,tagIds:V,projectTagsArray:x||[]})}catch{z=!1,A++}if(z&&d.success({id:"BULK_SAVE_SUCCESS",title:c("All blocks saved successfully."),placement:"bottomRight"}),!z){if(A===j.length)throw new Error;d.warning({id:"BULK_SAVE_PARTIAL_SUCCESS",title:c("Some blocks were not saved successfully."),placement:"bottomRight"})}g(!0),k(E),n()}catch(V){throw V}finally{h(!1),_.resetFields(),p()}},confirmSavingBlocksLoading:b}},jr=({isModalVisible:e,currentEmail:i,setIsShowAddAllBlocksModal:l,setTriggerOpenSavedBlocksTab:s,projectId:n})=>{const{__:d,_n:c,sprintf:p}=r.useI18n(),g=r.useContainer(),m=r.useProjectData(),{tagsEnabled:_}=r.useAppConfig(),[E,b]=(0,a.useState)(!1),[h]=t.ui_kit$Form.useForm(),[k,x]=(0,a.useState)([]),[T,j]=(0,a.useState)([]),P=(0,a.useRef)({}),[S]=r.useAddTermMutation(),[y]=r.useEditProjectMutation(),[V,z]=r.useAddBlockMutation(),A=r.useEditorLocale()||void 0,O=Tp(i),w=vp(O).map(ve=>ve),U=w.length,J=r.useNotification(),Q=()=>{E||le||l(!1)},{bulkSave:I,confirmSavingBlocksLoading:le}=Cp({projectData:m,addTerm:S,addBlock:V,editProject:y,reloadBlockScreens:Za,notification:J,__:d,handleCloseModal:Q,setTriggerOpenSavedBlocksTab:s,setTagsOptions:j,form:h,projectId:n}),xe=async()=>{try{const{valid:ve,values:Z,blockTags:be}=await en({form:h,notification:J,__:d});s(!1),b(!0);const Ne=await Ep(i,A,P,w,g),de=r.wpProjectId(i.project,n??m?.id),Fe=Rp(Ne,P.current,String(de??""));b(!1),await I(Fe,ve,Z,be)}catch{b(!1),l(!1),J.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:xe,onCancel:Q,footer:(0,o.jsx)("div",{className:"modal-footer",children:!(E||le)&&(0,o.jsx)(t.ui_kit$Button,{size:"large",type:"primary",disabled:E||le,onClick:xe,children:p(c("Save %d block","Save %d blocks",U),U)},"submit")}),children:[E||le?(0,o.jsx)("div",{children:d("All blocks saved at this point can be found in the “Saved Blocks” section in the sidebar.")}):(0,o.jsx)("div",{children:p(c("Your letter contains %d block that can be saved for future use.","Your letter contains %d blocks that can be saved for future use.",U),U)}),!(E||le)&&_&&(0,o.jsx)(t.ui_kit$Form,{form:h,name:"add_all_blocks_form",layout:"vertical",onFinish:xe,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:z.isLoading,options:T})})}),(le||E)&&(0,o.jsx)("div",{className:"modal-spinner",children:(0,o.jsx)(t.ui_kit$Spin,{size:"large"})})]})};jr.propTypes={};var wr=({isModalVisible:e=!1,email:i=null})=>{const{__:l}=r.useI18n(),[s]=t.ui_kit$Form.useForm(),n=r.useDispatch(),d=r.useRouteEmailId(),c=r.useNotification(),p=r.useCurrentUser(),g=r.useProjectData()?.projects_test_emails,[m,_]=r.useSendTestEmailMutation(),{token:E}=(0,t.ui_kit$useToken)(),[b,h]=(0,a.useState)(!1);r.useAppConfig(),r.useCookieManager();const k=r.useProjectData(),x=r.testEmailProject(i,k?.id),T=r.testEmailId(d,i,x),{data:j}=r.useGetProjectTestRecipientsQuery(x??0,{skip:!0}),[P,S]=r.useEditProjectMutation(),[y]=r.usePutProjectTestRecipientsMutation(),V=r.useProjectData(),{testEmails:z}=r.useAppConfig(),A=r.usePushToDataLayer(),[O,w]=(0,a.useState)([]),[U,J]=(0,a.useState)(!1),Q=r.useEventEmitter(vo.events.ON_SEND_EMAIL_MODAL_ID);(0,a.useEffect)(()=>{e?Q.fire(i).then(Z=>{Z.some(be=>be===!1)?n(r.closeModal$1()):h(e)}):h(e)},[e,n,h,i,Q]),(0,a.useEffect)(()=>{},[V,x,j]),(0,a.useEffect)(()=>{w(z.map(Z=>({value:Z})))},[z]),(0,a.useEffect)(()=>{const Z=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails);if(Z&&b&&s.getFieldValue("recipients")?.length===0){const be=JSON.parse(Z);be?.[x]&&s.setFieldsValue({recipients:be[x]})}},[x,b,s]),(0,a.useEffect)(()=>{s.setFieldsValue({subject:i.subject})},[s,i.subject]);const I=()=>{n(r.closeModal$1()),s.resetFields()},le=r.useContentReader(),xe=()=>{s.validateFields().then(()=>{const Z={user_id:p.id,project_id:x,email_id:T,subject:s.getFieldValue("subject"),email:s.getFieldValue("recipients").join(","),html:r.encodedHtml(le())};m(Z).unwrap().catch(be=>{c.error({error:{data:{code:be?.data?.code,message:be?.data?.message}}})}),J(!0),A({event:"submit",action:"send_test_email",entity_id:d,project_id:x,recipients_count:s.getFieldValue("recipients").length})}).catch(Z=>{})},ve=a.default.useRef(g);return ve.current=g,(0,a.useEffect)(()=>{const Z=ve.current;if(_.isSuccess&&U){_.data?.status;{const be=[...new Set([...O.map(je=>je.value),...s.getFieldValue("recipients")])],Ne=be.map(je=>({projects_test_email:je}));((je,ye)=>{if(!je||!ye)return je===ye;if(je.length!==ye.length)return!1;const _e=je.map(fe=>fe.projects_test_email).sort(),pe=ye.map(fe=>fe.projects_test_email).sort();return _e.every((fe,me)=>fe===pe[me])})(Ne,r.isProjectsV2Enabled()?(j||[]).map(je=>({projects_test_email:je})):Z)||(r.isProjectsV2Enabled()?y({projectId:x,emails:be}):P({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 Ae=s.getFieldValue("recipients");localStorage.setItem(r.LOCAL_STORAGE_ITEMS.em_test_emails,JSON.stringify({...Fe,[x]:[...new Set(Ae)]}));const Ge=i.title||i.subject||l("Untitled email.").replace(/\.$/,"");c.success(l("The email “")+Ge+l("” was successfully sent."))}J(!1),s.resetFields(),n(r.closeModal$1())}},[_,s,x,P,y,j,O,U,n,i.title,i.subject,c,S,l]),(0,a.useEffect)(()=>{S.isError&&(c.error(S),J(!1),s.resetFields(),n(r.closeModal$1()))},[n,S,s]),(0,a.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:b,onCancel:I,footer:[(0,o.jsx)(t.ui_kit$Button,{size:"large",className:"em-analytics__email-send-test",type:"primary",htmlType:"submit",form:"Send mail",loading:S.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:xe,disabled:_.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:(Z,be)=>be.length>10?Promise.reject(new Error(l("A test email can be sent to a maximum of 10 addresses."))):be.length!==0?be.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:O,tagRender:Z=>{const{label:be,closable:Ne,onClose:de}=Z,Fe=Ae=>{Ae.preventDefault(),Ae.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:E.colorPrimary,onMouseDown:Fe,closable:Ne,onClose:de,style:{borderRadius:6},children:be})},getPopupContainer:()=>document.getElementById("send_mail_form")})})]})})};wr.propTypes={isModalVisible:f.default.bool,email:f.default.shape({html:f.default.string,subject:f.default.string})};var Pp=bo.__exportAll({AddAllBlocksModal:()=>jr,AddNewBlockModal:()=>yr,BlocksSearch:()=>Tr,Discuss:()=>Ka,DiscussAi:()=>va,EmailProperties:()=>Ss,EmailSettings:()=>Ji,EmailStyles:()=>lr,FileManagerDataLayer:()=>Ua,HistoryPanel:()=>Rr,LimitUpgradeModal:()=>hi,Optimise:()=>Da,SaveBlockBtn:()=>Pr.SaveBlockBtn,SelectedElementPanel:()=>gt,SendTestEmailModal:()=>wr});Ro.AddAllBlocksModal=jr,Ro.AddNewBlockModal=yr,Ro.BlocksSearch=Tr,Ro.Discuss=Ka,Ro.DiscussAi=va,Ro.EmailProperties=Ss,Ro.EmailSettings=Ji,Ro.EmailStyles=lr,Ro.FileManagerDataLayer=Ua,Ro.HistoryPanel=Rr,Ro.LimitUpgradeModal=hi,Ro.LimitUpgradeModal$1=hi,Ro.Optimise=Da,Ro.SaveBlockBtn=Pr.SaveBlockBtn,Ro.SelectedElementPanel=gt,Ro.SendTestEmailModal=wr,Ro.getImageDimensionsFromBlob=Nr,Object.defineProperty(Ro,"panels_exports",{enumerable:!0,get:function(){return Pp}}),Ro.resolveDataProviderPreview=Ar,Ro.shouldCountAiUsage=fr,Ro.useImageBlobFetch=Lr});
|