useblocks 1.3.8 → 1.3.10

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.
Files changed (64) hide show
  1. package/iframe/.vite/manifest.json +4 -4
  2. package/iframe/css/sandbox.css +6 -0
  3. package/iframe/{iframe-eblock.a0b8903e.html → iframe-eblock.5455e870.html} +2 -2
  4. package/iframe/{iframe.a0b8903e.html → iframe.5455e870.html} +2 -2
  5. package/iframe/js/{elMarkupHelper.C1NUEUOF.js → elMarkupHelper.Cv72GdwF.js} +90 -90
  6. package/iframe/js/{iframe-eblock.body.a0b8903e.js → iframe-eblock.body.5455e870.js} +1 -1
  7. package/iframe/js/iframe-eblock.js +2 -2
  8. package/iframe/js/{iframe.body.a0b8903e.js → iframe.body.5455e870.js} +1 -1
  9. package/iframe/js/iframe.js +2 -2
  10. package/package.json +1 -1
  11. package/runtime/react/index.js +1 -1
  12. package/static/core/{c015f53f.js → 19270609.js} +1 -1
  13. package/static/core/233f23fd.js +1 -0
  14. package/static/core/{31aad6a0.js → 2cf7ee08.js} +1 -1
  15. package/static/core/{d5cd129a.js → 32f12150.js} +1 -1
  16. package/static/core/{ffabcd69.js → 38606c7d.js} +1 -1
  17. package/static/core/{cad7dc27.js → 395f9635.js} +1 -1
  18. package/static/core/{d4aa63e7.js → 4030ef2c.js} +1 -1
  19. package/static/core/{9f12c233.js → 4274a244.js} +1 -1
  20. package/static/core/{a2fb7ae9.js → 43305d10.js} +1 -1
  21. package/static/core/{f06286dd.js → 48def854.js} +1 -1
  22. package/static/core/{64a5118e.js → 4de0fff7.js} +1 -1
  23. package/static/core/{91a91433.js → 4fec552e.js} +1 -1
  24. package/static/core/{b79eddad.js → 5a290fb6.js} +1 -1
  25. package/static/core/{e6079a68.js → 630febfd.js} +1 -1
  26. package/static/core/{3fc88c79.js → 6539262f.js} +1 -1
  27. package/static/core/{1b6e3017.js → 710be2de.js} +1 -1
  28. package/static/core/{e85778fc.js → 7774d8cb.js} +1 -1
  29. package/static/core/{4a69114d.js → 791b9022.js} +1 -1
  30. package/static/core/{d7ccd97b.js → 7a43af5d.js} +1 -1
  31. package/static/core/{addbb53c.js → 7d2c1fd4.js} +1 -1
  32. package/static/core/{e4ebcc13.js → 7da32d21.js} +1 -1
  33. package/static/core/{d5774798.js → 84c5ed0d.js} +1 -1
  34. package/static/core/{ec23adac.js → 8606910e.js} +1 -1
  35. package/static/core/{4f9f6515.js → 91017e83.js} +1 -1
  36. package/static/core/{5bf0cc25.js → 97db045b.js} +1 -1
  37. package/static/core/{851da4d1.js → 9ccecd4a.js} +1 -1
  38. package/static/core/{7a1ca179.js → 9f336cc6.js} +1 -1
  39. package/static/core/{3d73b614.js → a802b68f.js} +1 -1
  40. package/static/core/{4e869a27.js → acf08b55.js} +1 -1
  41. package/static/core/{74b30e13.js → bf6643b0.js} +1 -1
  42. package/static/core/{88ed7988.js → c24c3d6b.js} +1 -1
  43. package/static/core/{3e55fbd4.js → c41fa010.js} +1 -1
  44. package/static/core/{75b3d05d.js → c8cfd469.js} +2 -2
  45. package/static/core/{3339abc3.js → cbfe265e.js} +1 -1
  46. package/static/core/d8d10299.js +19 -0
  47. package/static/core/{2d458997.js → dd82fe37.js} +1 -1
  48. package/static/core/{f370243f.js → e0f9c94e.js} +1 -1
  49. package/static/core/{a7e83e25.js → e532cd8d.js} +1 -1
  50. package/static/core/{80f29ed0.js → e7f50492.js} +1 -1
  51. package/static/core/{55a6e3bc.js → eeba774d.js} +3 -3
  52. package/static/core/{c0f26c01.js → ef13a2d7.js} +1 -1
  53. package/static/core/{6584ba9a.js → f033fd82.js} +1 -1
  54. package/static/core/{58b98b23.js → f615b5d9.js} +2 -2
  55. package/static/core/{bd188fca.js → fe47306c.js} +1 -1
  56. package/static/umd-runtime/runtime.C1l7PfWP.js +1 -0
  57. package/{useblocks-core.a0b8903e.js → useblocks-core.5455e870.js} +43 -42
  58. package/useblocks-esm.js +12 -12
  59. package/{useblocks-po.a0b8903e.js → useblocks-po.5455e870.js} +1 -1
  60. package/useblocks.js +12 -12
  61. package/vendor/useblocks-ui-kit/package.json +1 -1
  62. package/static/core/2ca6f0ad.js +0 -19
  63. package/static/core/d67c9b4e.js +0 -2
  64. package/static/umd-runtime/runtime.B77pxBrU.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/2dc8efce.js",["require","exports","module","static/core/2ff39ddf.js","static/core/b8eb1c3a.js","static/core/f65bd194.js","react","react/jsx-runtime","__delivery__/libs","classnames"],function(B,I,De){const J=B("./2ff39ddf.js"),r=B("./b8eb1c3a.js"),u=B("./f65bd194.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/d9907c79.js",["require","exports","module","static/core/2ff39ddf.js","static/core/b8eb1c3a.js","static/core/483ce33c.js","vite/preload-helper"],function(h,I,B){const D=h("./2ff39ddf.js"),n=h("./b8eb1c3a.js"),p=h("./483ce33c.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}})});
5
+
6
+ __useblocks__.define("static/core/f65bd194.js",["require","exports","module","static/core/2ff39ddf.js","static/core/b8eb1c3a.js","react","react/jsx-runtime","__delivery__/libs"],function(t,e,S){const i=t("./2ff39ddf.js"),o=t("./b8eb1c3a.js");let r=t("react");r=i.__toESM(r);let l=t("react/jsx-runtime"),d=t("__delivery__/libs");function n(){return o.usePlanFeatureGate("google_fonts").isLocked?void 0:o.loadGFonts}var u=c=>{const{form:g,namePrefix:s="",typeOfForm:I="desktop"}=c,E=o.useSelector(o.selectEmailSettings).usedColors;return(0,l.jsx)(d.ui_kit$FormBorderInputs,{form:g,namePrefix:s,typeOfForm:I,usedColors:E})},b={paddingTop:"top",paddingLeft:"left",paddingRight:"right",paddingBottom:"bottom",mobilePaddingTop:"top",mobilePaddingLeft:"left",mobilePaddingRight:"right",mobilePaddingBottom:"bottom"},m={borderRadiusAll:"all",borderRadiusTopLeft:"topLeft",borderRadiusBottomLeft:"bottomLeft",borderRadiusTopRight:"topRight",borderRadiusBottomRight:"bottomRight"},R={mobileBorderRadiusAll:"all",mobileBorderRadiusTopLeft:"topLeft",mobileBorderRadiusBottomLeft:"bottomLeft",mobileBorderRadiusTopRight:"topRight",mobileBorderRadiusBottomRight:"bottomRight"},a={all:"borderAll",top:"borderTop",right:"borderRight",bottom:"borderBottom",left:"borderLeft"},O={all:"mobileBorderAll",top:"mobileBorderTop",right:"mobileBorderRight",bottom:"mobileBorderBottom",left:"mobileBorderLeft"},_={width:null,style:null,color:null},B={borderAll:"all",borderTop:"top",borderRight:"right",borderBottom:"bottom",borderLeft:"left"},f={mobileBorderAll:"all",mobileBorderTop:"top",mobileBorderRight:"right",mobileBorderBottom:"bottom",mobileBorderLeft:"left"};Object.defineProperty(e,"BORDER_POSITIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"BORDER_RADIUS_POSITION",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"MOBILE_BORDER_POSITIONS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"MOBILE_BORDER_RADIUS_POSITION",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"MOBILE_REVERSE_BORDER_POSITIONS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"NULL_BORDER",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"PADDING_POSITION",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"REVERSE_BORDER_POSITIONS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"SelectedElementFormBorder",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"useGoogleFontsLoader",{enumerable:!0,get:function(){return n}})});
7
+
8
+ (function(){try{if(typeof document<"u"){var t='.blocks-app .upload-bg-image{margin-bottom:calc(var(--ub-formItemMarginBottomXS) * 1px)}.blocks-app .upload-bg-image__inner-wrap{border:calc(var(--ub-borderWidth) * 1px) solid var(--ub-colorFillSecondaryDarken);border-radius:calc(var(--ub-borderRadius) * 1px);cursor:pointer;background-color:var(--ub-colorBgContainer);justify-content:space-between;align-items:center;transition:all .2s linear .2s;display:flex}.blocks-app .upload-bg-image__inner-wrap:hover{border-color:var(--ub-borderColorHover)}.blocks-app .upload-bg-image__uploader{width:calc((var(--ub-formControlHeight) - var(--ub-borderWidth) * 2 + 1) * 1px);height:calc((var(--ub-formControlHeight) - var(--ub-borderWidth) * 2) * 1px);border-radius:calc(var(--ub-borderRadius) * .8px);border:none;border-right:1px solid var(--ub-colorFillSecondaryDarken);flex-shrink:0;margin-right:10px;overflow:hidden}.blocks-app .upload-bg-image__uploader-content{background:0 0;flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%;font-size:11px;display:flex}.blocks-app .upload-bg-image__uploader-content-inner{width:inherit;height:inherit;position:relative}.blocks-app .upload-bg-image__uploader-img-wrap{width:inherit;height:inherit;z-index:1;border:none;position:absolute;overflow:hidden}.blocks-app .upload-bg-image__uploader-img-wrap:after{opacity:0;content:"";transition:opacity .3s;position:absolute;inset:0}.blocks-app .upload-bg-image__uploader-content:hover .upload-bg-image__uploader-img-wrap:after{opacity:1}.blocks-app .upload-bg-image .upload-bg-image__empty{border-top:2px solid var(--ub-colorError);z-index:2;width:27px;position:absolute;top:16px;left:3px;transform:rotate(-45deg)}.blocks-app .upload-bg-image .inputGroup{flex-direction:column;width:100%;display:flex}.blocks-app .upload-bg-image .image-size{color:var(--ub-colorTextTertiary);padding-right:15px;font-size:12px}.blocks-app .upload-bg-image .image-empty-text,.blocks-app .upload-bg-image .image-size-splitter{color:var(--ub-colorTextQuaternary)}.blocks-app .upload-bg-image__edit,.blocks-app .upload-bg-image__edit-menu{color:var(--ub-colorLink);right:calc((var(--ub-borderWidth) + 2) * 1px);padding:6px;line-height:1;position:absolute}.blocks-app .upload-bg-image__edit{right:calc((var(--ub-borderWidth) + 32) * 1px);position:absolute}.blocks-app .upload-bg-image__uploader-icons-wrap{z-index:2;width:inherit;height:inherit;opacity:1;cursor:pointer;justify-content:center;align-items:center;transition:opacity .3s;display:flex;position:relative}.blocks-app .upload-bg-image__uploader-content:hover .upload-bg-image__uploader-icons-wrap{opacity:.85}.blocks-app .upload-bg-image__uploader-icons-wrap-upload{z-index:1;width:inherit;height:inherit;opacity:.8;cursor:pointer;justify-content:center;align-items:center;transition:opacity .3s;display:flex;position:relative}.blocks-app .upload-bg-image__uploader-content:hover .upload-bg-image__uploader-icons-wrap-upload{opacity:.85}.blocks-app .upload-bg-image__uploader-icons-wrap-upload .upload-bg-image__uploader-content:empty{background-color:var(--ub-colorFillSecondary);border-radius:calc(var(--ub-borderRadius) * 1px)}.blocks-app .upload-bg-image__uploader-link,.blocks-app .upload-bg-image__uploader-link:hover{color:#fff}.blocks-app .upload-bg-image__uploader-icon{color:#fff;margin:0 3px;font-size:14px}.blocks-app .upload-bg-image__uploader-img{object-fit:cover;width:100%;height:100%;display:block!important}.blocks-app .upload-bg-image__uploader-img-placeholder{width:100%;height:100%;display:block}.blocks-app .upload-bg-image__uploader-icon-btn{cursor:pointer;background:0 0;border:0;margin:0;padding:0}.blocks-app .upload-bg-image__input{border-color:var(--ub-colorFillSecondaryDarken)}.blocks-app .upload-bg-image__uploader .ant-upload-select{cursor:pointer;width:100%;height:100%;display:block}.blocks-app .upload-bg-image__uploader .ant-upload-select .ant-upload{width:100%;height:100%;display:block}.dark .blocks-app .upload-bg-image__uploader{border-right:1px solid var(--ub-colorBorder)}.blocks-app .countdown-color .color-picker-input__picker-holder{z-index:auto;left:auto;right:-10px}.blocks-app .email-pane .box-shadow-control .ant-collapse-panel,.blocks-app .email-pane .border-control .ant-collapse-panel,.blocks-app .box-shadow-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body,.blocks-app .border-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body{overflow:visible}.blocks-app .selected-image-form_busy{position:relative}.blocks-app .selected-image-form__loader{z-index:5;background-color:color-mix(in srgb, var(--ub-colorBgContainer) 60%, transparent);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);box-shadow:28px 0 0 0 color-mix(in srgb, var(--ub-colorBgContainer) 60%, transparent), -28px 0 0 0 color-mix(in srgb, var(--ub-colorBgContainer) 60%, transparent);position:absolute;inset:0}.blocks-app .selected-image-form__loader-body{flex-direction:column;justify-content:center;align-items:center;gap:16px;height:100%;display:flex;position:absolute;top:0;left:0;right:0}.blocks-app .selected-image-form__loader-title{color:var(--ub-colorTextSecondary);text-align:center;padding:0 24px;font-size:13px}.blocks-app .selected-text-common-form__border-radio{position:relative}.blocks-app .selected-text-common-form__border-radio:after{content:"·";border:3px solid var(--ub-colorPrimary);border-radius:50%;font-size:0;line-height:0;position:absolute;top:2px;right:2px}.blocks-app .selected-text-common-form__border-col{margin-top:22px;margin-bottom:10px}@media (width<=1840px){.blocks-app .selected-text-common-form__border-col{margin-top:0}}.blocks-app .selected-text-common-form__border-item.ant-form-item .ant-row{flex-direction:row;align-items:center}.blocks-app .selected-text-common-form__border-item.ant-form-item .ant-row .ant-col.ant-form-item-label{white-space:nowrap;padding-top:6px}.blocks-app .selected-text-common-form__padding-input{max-width:46px;margin-bottom:0}.blocks-app .selected-text-common-form__padding-input input{text-align:center;padding:4px 8px}.blocks-app .selected-text-common-form__padding-input .ant-input-number-focused input{text-align:left}.blocks-app .selected-text-common-form__button--active,.blocks-app .selected-text-common-form__button--active:focus{color:#40a9ff;border-color:#40a9ff}.blocks-app .selected-text-common-form__br-input{margin-bottom:10px}.blocks-app .selected-text-common-form__tooltip{margin-left:4px}.blocks-app .selected-text-common-form__icon-radius{width:16px;height:100%}.blocks-app .selected-text-common-form__block{margin-bottom:24px}.blocks-app .selected-text-common-form__button_style{padding-left:10px;padding-right:10px;transition:none}.blocks-app .selected-text-common-form__format-toolbar{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:4px;display:flex}.blocks-app .selected-text-common-form__format-toolbar .ant-form-item{margin-bottom:0}.blocks-app .ant-app .bullet-type .ant-select-selector{padding-left:5px}.blocks-app .selected_text_common_form_mobile .ant-form-item{margin:0}.blocks-app .selected_text_common_form_mobile .ant-input-number-affix-wrapper{padding-inline-start:7px}.blocks-app .selected_text_common_form_mobile .ant-select-single:not(.ant-select-customize-input) .ant-select-selector,.blocks-app .selected_text_common_form_mobile .ant-input-number-group .ant-input-number-group-addon{padding:0 7px}.blocks-app .selected_text_common_form_mobile .ant-input-number .ant-input-number-handler-wrap{width:16px}.blocks-app .selected_text_common_form_mobile .ant-select .ant-select-arrow{inset-inline-end:7px;font-size:10px!important}.blocks-app .selected_text_common_form_mobile .ant-divider-vertical{height:46px;top:0}.blocks-app .selected_text_common_form_mobile .selected_text_common_form_mobile__group{padding:6px 0}.blocks-app .selected_text_common_form_mobile .selected-td-form__button{background:var(--ub-colorFillSecondary);width:34px;height:34px;border:1px solid #0000!important}.blocks-app .selected_text_common_form_mobile .ant-btn-default:not(:disabled,.ant-btn-disabled,.email-pane__content-col .selected-td-form__button--active):hover{background:var(--ub-colorFillSecondaryDarken);color:inherit;border-color:#0000}.blocks-app .selected_text_common_form_mobile .selected-td-form__button--active{background:var(--ub-colorPrimaryBg);color:var(--ub-colorPrimary);border-color:#0000}.blocks-app .selected_text_common_form_mobile .selected-td-form__button--active:hover{background:var(--ub-colorPrimaryBgHover)!important;color:var(--ub-colorPrimaryTextHover)!important}.blocks-app .selected_text_common_form_mobile .color-picker-input{width:34px;height:34px}.blocks-app .selected_text_common_form_mobile .color-picker-input .ant-input-affix-wrapper{display:none}.blocks-app .selected_text_common_form_mobile .color-picker-input__control-wrap .ant-color-picker-trigger{border:1px solid var(--ub-colorFillSecondaryDarken);width:34px;height:34px;top:0;left:0}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper{background:var(--ub-colorFillSecondary);height:34px;padding:0 9px;border:1px solid #0000!important}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper:not(.ant-radio-button-wrapper-checked):hover{color:inherit;background:var(--ub-colorFillSecondaryDarken)}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper.ant-radio-button-wrapper-checked{background:var(--ub-colorPrimaryBg);color:var(--ub-colorPrimary)}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper.ant-radio-button-wrapper-checked:hover{background:var(--ub-colorPrimaryBgHover);color:var(--ub-colorPrimaryTextHover)}.blocks-app .selected_text_common_form_mobile .codemode-textalign-dropdown{background-color:var(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadius) * 1px);box-shadow:var(--ub-boxShadowSecondary);padding:6px}.blocks-app .mobile-background-image-field .upload-bg-image{margin-bottom:0}.blocks-app .selected_element_vindent_values{font-size:12px}.blocks-app .selected_element_vindent_values span{cursor:pointer;margin-right:10px}.blocks-app .selected_element_vindent_values span:hover{color:#40a9ff}.blocks-app .selected-td-form__border-side-wrapper{display:inline-flex;position:relative}.blocks-app .selected-td-form__border-side-wrapper label{border-radius:calc(var(--ub-borderRadius) * 1px)}.blocks-app .selected-td-form__border-side-wrapper:hover .selected-td-form__border-side-clear{opacity:1}.blocks-app .selected-td-form__border-side-clear{z-index:1;opacity:0;cursor:pointer;color:var(--ub-colorTextSecondary);background-color:var(--ub-colorBgLayout);border-radius:50%;width:20px;height:20px;transition:opacity .15s;position:absolute;top:-6px;right:-4px}.blocks-app .selected-td-form__border-side-clear:hover{color:var(--ub-colorError)}.blocks-app .selected-td-form__border-radio:after{content:"·";border:3px solid var(--ub-colorPrimary);border-radius:50%;font-size:0;line-height:0;position:absolute;top:2px;right:2px}@media (width<=1840px){.blocks-app .selected-td-form__border-col{margin-top:0}}.blocks-app .selected-td-form__border-item.ant-form-item .ant-row{flex-direction:row;align-items:center}.blocks-app .selected-td-form__border-item.ant-form-item .ant-row .ant-col.ant-form-item-label{white-space:nowrap;padding-top:6px}.blocks-app .selected-td-form__padding-input input{text-align:center;padding:4px 8px}.blocks-app .selected-td-form__padding-input .ant-input-number-focused input{text-align:left}.blocks-app .selected-td-form__button--active,.blocks-app .selected-td-form__button--active:focus{color:#40a9ff;border-color:#40a9ff}.blocks-app .selected-td-form__tooltip{margin-left:4px}.blocks-app .selected-td-form__icon-radius{flex-shrink:0;justify-content:center;align-items:center;width:16px;height:16px;display:inline-flex}.blocks-app .selected-td-form__button_style{padding-left:10px;padding-right:10px;transition:none}.blocks-app .selected-td-form__border-radio{position:relative}.blocks-app .selected-td-form__border-radio:after{content:"·";border:3px solid var(--ub-colorPrimary);border-radius:50%;font-size:0;line-height:0;position:absolute;top:2px;left:2px;right:auto}.blocks-app .selected-td-form__border-col{margin-top:0;margin-bottom:0}@media (width<=1840px){.blocks-app .selected-td-form__border-col{margin-top:0}}.blocks-app .selected-td-form__border-item.ant-form-item .ant-col.ant-form-item-label{white-space:nowrap;padding-top:6px}.blocks-app .selected-td-form__padding-input{max-width:50px;margin-bottom:0}.blocks-app .selected-td-form__padding-input input{padding:4px 8px}.blocks-app .selected-td-form__br-input{margin-bottom:10px}.blocks-app .selected-td-form__tooltip{vertical-align:baseline;margin-left:4px}.blocks-app .selected-td-form__icon-radius{width:16px;height:100%}.blocks-app .selected-td-form__block{margin-bottom:24px}.blocks-app .carousel__slide{background-color:var(--ub-colorFillQuaternary);border-radius:calc(var(--ub-borderRadius) * 1px);margin-bottom:calc(var(--ub-formItemMarginBottomXS) * 1px);border:calc(var(--ub-borderWidth) * 1px) solid var(--ub-colorFillSecondaryDarken);padding:10px}.blocks-app .email-pane .box-shadow-control .ant-collapse-panel,.blocks-app .email-pane .border-control .ant-collapse-panel,.blocks-app .box-shadow-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body,.blocks-app .border-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body{overflow:visible}.blocks-app .selected-image-form__add-title{margin-top:-15px;margin-bottom:30px}.blocks-app .selected-image-form__add-title span{cursor:pointer}.blocks-app .selected-image-form__add-title span:hover{color:#40a9ff}.blocks-app .email-pane .box-shadow-control .ant-collapse-panel,.blocks-app .email-pane .border-control .ant-collapse-panel,.blocks-app .box-shadow-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body,.blocks-app .border-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body{overflow:visible}.blocks-app .selected-social-form{box-sizing:border-box;min-width:0;padding:0 0 16px}.blocks-app .selected-social-form .selected-social-form__form{padding:0 0 8px}.blocks-app .selected-social-form .selected-social-form__align-block{margin-bottom:16px}.blocks-app .selected-social-form .selected-social-form__align-block .ant-form-item,.blocks-app .selected-social-form .selected-social-form__section{margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__section--bordered{border-top:1px solid var(--ub-colorBorderSecondary,#f0f0f0);margin-top:16px;padding-top:16px}.blocks-app .selected-social-form .selected-social-form__section-title{color:var(--ub-colorText,#000000e0);margin:0 0 16px;font-size:14px;font-weight:400;line-height:1.2}.blocks-app .selected-social-form .selected-social-form__field-row{margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__field-icon{color:var(--ub-colorTextSecondary,#8c8c8c)}.blocks-app .selected-social-form .selected-social-form__input-full{width:100%}.blocks-app .selected-social-form .selected-social-form__items{flex-direction:column;gap:6px;margin-bottom:6px;display:flex}.blocks-app .selected-social-form .selected-social-form__card{border:1px solid var(--ub-colorBorderSecondary,#f0f0f0);background:var(--ub-colorFillTertiary,#f8f8f8);border-radius:6px;padding:12px;transition:border-color .15s,box-shadow .15s,opacity .15s}.blocks-app .selected-social-form .selected-social-form__card--dragging{opacity:.72}.blocks-app .selected-social-form .selected-social-form__card--drag-over{border-color:var(--ub-colorPrimary);box-shadow:0 0 0 1px var(--ub-colorPrimary)}.blocks-app .selected-social-form .selected-social-form__card-head{justify-content:space-between;align-items:center;gap:8px;margin-bottom:12px;display:flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-main{flex:auto;align-items:center;gap:8px;min-width:0;display:flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle{width:24px;height:24px;color:var(--ub-colorTextSecondary,#8c8c8c);cursor:grab;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;margin:0;padding:0;transition:color .15s,background-color .15s;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle:hover{color:var(--ub-colorText,#000000e0);background:var(--ub-colorFillSecondary,#f0f0f0)}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle:active{cursor:grabbing}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle:focus-visible{outline:2px solid var(--ub-colorPrimary);outline-offset:1px}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle .anticon{font-size:14px;transform:rotate(90deg)}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn{box-sizing:border-box;aspect-ratio:1;width:24px;min-width:24px;max-width:24px;height:24px;min-height:24px;max-height:24px;color:var(--ub-colorTextSecondary,#8c8c8c);background:0 0;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;padding:0;line-height:1;transition:color .15s,background-color .15s;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn .anticon{justify-content:center;align-items:center;line-height:0;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn svg{width:18px;height:18px;display:block}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn:hover{color:var(--ub-colorText,#000000e0);background:var(--ub-colorFillSecondary,#f0f0f0)}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn:focus-visible{outline:2px solid var(--ub-colorPrimary);outline-offset:1px}.blocks-app .selected-social-form .selected-social-form__card-title{min-width:0;color:var(--ub-colorText,#000000e0);flex:auto;font-size:14px;font-weight:300;line-height:1.2}.blocks-app .selected-social-form .selected-social-form__card-field.ant-row{margin-bottom:8px}.blocks-app .selected-social-form .selected-social-form__card-field.ant-row:last-child{margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__bg-color-row{width:100%;margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__bg-color-row .ant-col .ant-form-item{max-width:none;margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__bg-color-row .ant-form-item-control-input-content,.blocks-app .selected-social-form .selected-social-form__meta-block{width:100%}.blocks-app .selected-social-form .selected-social-form__meta-toggle-row{flex-wrap:wrap;align-items:center;display:flex}.blocks-app .selected-social-form .selected-social-form__meta-fields.is-hidden,.blocks-app .selected-social-form .selected-social-form__card-field.is-hidden{display:none}.blocks-app .selected-social-form .selected-social-form__meta-fields{flex-direction:column;gap:6px;width:100%;display:flex}.blocks-app .selected-social-form .selected-social-form__meta-fields .ant-form-item{margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__meta-fields .ant-form-item-control-input-content{width:100%}.blocks-app .selected-social-form .selected-social-form__platform-row{align-items:flex-start;gap:8px;width:100%;margin-bottom:8px;display:flex}.blocks-app .selected-social-form .selected-social-form__platform-field{flex:auto;min-width:0;margin-bottom:0!important}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn{box-sizing:border-box;width:calc(var(--ub-formControlHeight) * 1px);min-width:calc(var(--ub-formControlHeight) * 1px);max-width:calc(var(--ub-formControlHeight) * 1px);height:calc(var(--ub-formControlHeight) * 1px);min-height:calc(var(--ub-formControlHeight) * 1px);max-height:calc(var(--ub-formControlHeight) * 1px);line-height:calc((var(--ub-formControlHeight) - 2) * 1px);color:var(--ub-colorTextSecondary,#8c8c8c);border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;margin:0;padding:0;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn.ant-btn-icon-only .ant-btn-icon{justify-content:center;align-items:center;width:100%;height:100%;line-height:0;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn.ant-btn-icon-only .ant-btn-icon svg{display:block}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn:hover{color:var(--ub-colorText,#000000e0);background:var(--ub-colorFillSecondary,#f0f0f0)}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn:focus-visible{outline:2px solid var(--ub-colorPrimary);outline-offset:1px}.blocks-app .selected-social-form .selected-social-form__platform-select{width:100%}.blocks-app .selected-social-form .selected-social-form__platform-select.ant-select-single .ant-select-selector .ant-select-selection-item{align-self:center;align-items:center;line-height:1.2;display:flex}.blocks-app .selected-social-form .selected-social-form__platform-select .ant-select-arrow{color:var(--ub-colorTextSecondary,#8c8c8c)}.blocks-app .selected-social-form .selected-social-form__platform-select .ant-select-arrow svg{width:16px;height:16px}.blocks-app .selected-social-form .selected-social-form__platform-option{align-items:center;gap:4px;min-width:0;line-height:1.2;display:flex}.blocks-app .selected-social-form .selected-social-form__platform-option img{flex-shrink:0;width:30px;height:30px;margin-left:-6px;display:block}.blocks-app .selected-social-form .selected-social-form__platform-option-text{white-space:nowrap;text-overflow:ellipsis;line-height:1.2;overflow:hidden}.blocks-app .selected-social-form .selected-social-form__add-bar{background:var(--ub-colorFillTertiary,#f8f8f8);height:32px;color:var(--ub-colorText,#000000e0);border-radius:6px;justify-content:center;align-items:center;gap:8px;margin-top:0;padding:8px 12px;font-size:14px;font-weight:300;line-height:1.2;display:flex}.blocks-app .selected-social-form .selected-social-form__add-bar:not(:disabled):hover{background:var(--ub-colorFillSecondary,#f0f0f0);color:var(--ub-colorText,#000000e0)}.blocks-app .selected-social-form__platform-dropdown .ant-select-item-option{align-items:center}.blocks-app .selected-social-form__platform-dropdown .ant-select-item-option-content{align-items:center;min-height:0;line-height:1.2;display:flex}.blocks-app .selected-social-form__platform-dropdown .selected-social-form__platform-option{gap:0}.blocks-app .selected-social-form__platform-dropdown .selected-social-form__platform-option img{width:30px;height:30px;margin-left:-6px}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-suffix{flex-shrink:0;align-items:center;display:inline-flex}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-clear-icon:not(.ant-input-clear-icon-hidden){color:var(--ub-colorTextSecondary,#8c8c8c)}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-clear-icon:not(.ant-input-clear-icon-hidden) .anticon{vertical-align:0;justify-content:center;align-items:center;line-height:0;display:inline-flex}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-clear-icon:not(.ant-input-clear-icon-hidden) svg{width:16px;height:16px;display:block}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-clear-icon:not(.ant-input-clear-icon-hidden):hover{color:var(--ub-colorText,#000000e0)}.blocks-app .ant-app .email-pane__content-col .selected-social-form .ant-form-item.selected-social-form__card-field{margin-bottom:8px}.blocks-app .ant-app .email-pane__content-col .selected-social-form .ant-form-item.selected-social-form__card-field:last-child{margin-bottom:0}.blocks-app .email-pane .selected-social-form form.selected-social-form__form.element-controls,.blocks-app .email-pane .email-pane__collapse-wrapper.mobile-properties .selected-social-form form.selected-social-form__form.element-controls{height:auto;max-height:none}.blocks-app .ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-header{padding:20px 0;font-size:14px}.blocks-app .ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body{padding-left:0;padding-right:0}.blocks-app .ant-collapse.hidden-props .ant-alert{margin-bottom:24px}.blocks-app .selected_form-mobile-props{padding:24px 14px 0 24px}.blocks-app .email-pane_code-mode:not(.email-pane_code-mode-bottom) .selected-element-panel-content.selected-element-panel__hidden{visibility:hidden;opacity:0;height:0}.blocks-app .email-properties__collapse-panel .selected-element-panel-content{height:100%}.blocks-app .email-pane_code-mode:not(.email-pane_code-mode-bottom) .selected-element-panel-content{width:auto;box-shadow:var(--ub-boxShadowSecondary);border-radius:calc(var(--ub-borderRadius) * 1px);border:none;margin:0;padding:0 6px;transition:opacity .2s;position:absolute;top:-60px;left:50%;transform:translate(-50%)}.blocks-app .em-analytics__email-tab-properties,.blocks-app .em-analytics__email-tab-history{z-index:999;position:absolute}.blocks-app .em-analytics__email-tab-properties .email-pane__collapse-wrapper,.blocks-app .em-analytics__email-tab-history .email-pane__collapse-wrapper{z-index:999;box-shadow:0 1px 2px -2px #00000029,0 3px 6px #0000001f,0 5px 12px 4px #0000000f}.blocks-app .email-pane__col-wrapper_pinch .em-analytics__email-tab-properties .email-pane__collapse-wrapper,.blocks-app .email-pane__col-wrapper_pinch .em-analytics__email-tab-history .email-pane__collapse-wrapper{box-shadow:none}.blocks-app .selected-element-panel{height:100%;overflow:visible}.blocks-app .selected-element-panel button.selected-element-panel__extra-btn,.blocks-app .selected-element-panel__extra-btn button{height:24px;padding:0 7px}.blocks-app .selected-element-panel-content{position:relative}.blocks-app .selected-element-panel-content.column-settings-show_onecol{padding-top:75px}.blocks-app .selected-element-panel__columns-settings{z-index:1;width:100%;position:relative}.blocks-app .selected-element-panel__columns-settings__header{justify-content:space-between;align-items:center;gap:12px;margin-bottom:15px;display:flex}.blocks-app .selected-element-panel__columns-settings__header-title{color:var(--ub-colorText);font-size:14px;line-height:1.5}.blocks-app .selected-element-panel__columns-settings__title{white-space:nowrap;text-overflow:ellipsis;margin-bottom:20px;font-size:16px;font-weight:500;line-height:20px;overflow:hidden}.blocks-app .selected-element-panel__columns-settings__links{white-space:nowrap;justify-content:flex-end;align-items:center;gap:8px;margin-left:auto;font-size:14px;display:flex}.blocks-app .selected-element-panel__columns-settings__links span{color:var(--ub-colorLink);cursor:pointer}.blocks-app .selected-element-panel__columns-settings__links span:hover{color:#40a9ff}.blocks-app .selected-element-panel__columns-settings__links__add{align-items:center;gap:4px;display:inline-flex}.blocks-app .selected-element-panel__columns-settings__links__add.noactive,.blocks-app .selected-element-panel__columns-settings__links__add.noactive span{color:#00000073;cursor:not-allowed}.blocks-app .selected-element-panel__columns-settings__controls{align-items:center;gap:8px;display:flex}.blocks-app .selected-element-panel__columns-settings__controls__column{align-items:center;min-width:40px;display:flex;position:relative}.blocks-app .selected-element-panel__columns-settings__controls__column:first-child .selected-element-panel__columns-settings__controls__divider{visibility:hidden}.blocks-app .selected-element-panel__columns-settings__controls__column__remove,.blocks-app .selected-element-panel__columns-settings__controls__column__copy,.blocks-app .selected-element-panel__columns-settings__controls__column__swap{text-align:center;box-sizing:border-box;cursor:pointer;z-index:1;color:#000000d9;background-color:#fff;border:none;border-radius:50%;justify-content:center;align-items:center;width:25px;height:25px;padding:0;font-size:14px;display:none;position:absolute;left:-10px;box-shadow:0 0 7px -2px #00000059}.blocks-app .selected-element-panel__columns-settings__controls__column__remove{top:-11px}.blocks-app .selected-element-panel__columns-settings__controls__column__copy{color:#000000a6;top:20px}.blocks-app .selected-element-panel__columns-settings__controls__column__swap{color:#000000a6;top:10px;left:-16px}.blocks-app .selected-element-panel__columns-settings__controls__column__remove:hover,.blocks-app .selected-element-panel__columns-settings__controls__column__copy:hover,.blocks-app .selected-element-panel__columns-settings__controls__column__swap:hover{box-shadow:0 0 7px -2px #000000b3}.blocks-app .selected-element-panel__columns-settings__controls:hover .selected-element-panel__columns-settings__controls__column__swap,:is(.blocks-app .selected-element-panel__columns-settings__controls__column:hover:not(:has(.selected-element-panel__columns-settings__controls__column__swap:hover)) .selected-element-panel__columns-settings__controls__column__remove,.blocks-app .selected-element-panel__columns-settings__controls__column:hover:not(:has(.selected-element-panel__columns-settings__controls__column__swap:hover)) .selected-element-panel__columns-settings__controls__column__copy){display:flex}.blocks-app .selected-element-panel__columns-settings__controls__column:hover:not(:has(.selected-element-panel__columns-settings__controls__column__swap:hover)) .selected-element-panel__columns-settings__controls__column__swap{display:none}.blocks-app .selected-element-panel__columns-settings__controls__field{text-align:center;border-radius:6px;width:100%;height:45px}.blocks-app .selected-element-panel__columns-settings__controls__field .ant-input-number{background:0 0;border:none}.blocks-app .selected-element-panel__columns-settings__controls__field .ant-input-number .ant-input-number-input{text-align:center;height:43px}.blocks-app .selected-element-panel__columns-settings__controls__divider{cursor:w-resize}.blocks-app .selected-element-panel__columns-settings__divider-wrapper{display:none}.blocks-app .selected-element-panel .selected-element-panel__columns-settings__divider-wrapper{display:block;position:relative}.blocks-app .selected-element-panel .selected-element-panel__columns-settings__divider{width:calc(100% + 80px);height:20px;margin:24px -40px 0;position:absolute;bottom:-20px}.blocks-app .selected-element-panel__content_abs{border:1px solid var(--ub-colorBorder);z-index:100;background-color:var(--ub-colorBgContainer);border-top:none;border-radius:0 0 8px 8px;width:100%;max-width:1400px;min-height:15px;margin-bottom:15px;transition:all .5s;display:flex;position:sticky;top:0;left:0}.blocks-app .selected-element-panel__mobile-switch{background-color:var(--ub-colorPrimary)}.blocks-app .selected-element-panel__mobile-switch.ant-switch-checked{background-color:var(--ub-colorInfo)}.blocks-app #selected_element_form_desktop_props .ant-alert-info .ant-alert-title{color:var(--ub-colorInfoText)}.blocks-app .ant-app .selected_form-mobile-switch{margin-bottom:20px;font-size:16px;font-weight:500}.blocks-app .ant-app .selected_form-mobile-props{--ub-colorPrimaryBorder:var(--ub-colorInfo);--ub-controlOutline:var(--ub-colorInfoBgHover)}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number:focus,.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-focused,.blocks-app .ant-app .selected_form-mobile-props .ant-input:focus,.blocks-app .ant-app .selected_form-mobile-props .ant-select-focused:not(.ant-select-disabled).ant-select:not(.ant-select-customize-input) .ant-select-selector,.blocks-app .ant-app .selected_form-mobile-props .ant-input-affix-wrapper:focus,.blocks-app .ant-app .selected_form-mobile-props .ant-input-affix-wrapper-focused{border-color:var(--ub-colorInfo);box-shadow:0 0 0 calc(var(--ub-controlOutlineWidth) * 1px) var(--ub-controlOutline)!important}:is(.blocks-app .ant-app .selected_form-mobile-props .ant-input-affix-wrapper>.ant-input:focus,.blocks-app .ant-app .selected_form-mobile-props .ant-space-compact:has(>.ant-input-number):focus-within>.ant-input-number,.blocks-app .ant-app .selected_form-mobile-props .input-select:focus-within .ant-input-affix-wrapper){box-shadow:none!important}.blocks-app .ant-app .selected_form-mobile-props .ant-select:not(.ant-select-disabled):hover .ant-select-selector{border-color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-select-item-option-selected:not(.ant-select-item-option-disabled){background-color:#edd3ed}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within{box-shadow:var(--ub-colorInfoBg) 0 0 0 2px!important}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within .ant-input-number-affix-wrapper:not(:last-child),.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within .ant-input-number-group-addon:last-child,.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within>.ant-input-number:first-child{border-color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within .ant-input-number-affix-wrapper:not(:last-child){border-right-color:var(--ub-colorFillSecondaryDarken)}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group-addon .ant-select-open .ant-select-selector,.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group-addon .ant-select-focused .ant-select-selector,.blocks-app .ant-app .selected_form-mobile-props .ant-radio-button-wrapper:hover,.blocks-app .ant-app .selected_form-mobile-props .ant-collapse>.ant-collapse-item>.ant-collapse-header:hover{color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-btn-background-ghost.ant-btn-primary{color:var(--ub-colorInfo);border-color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):first-child,.blocks-app .ant-app .selected_form-mobile-props .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled),.blocks-app .ant-app .selected_form-mobile-props .selected-td-form__button--active{background-color:var(--ub-colorInfoBg)!important;color:var(--ub-colorInfoText)!important}.blocks-app .ant-app .selected_form-mobile-props .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):before,.blocks-app .ant-app .selected_form-mobile-props .ant-switch-checked{background-color:var(--ub-colorInfoTextActive)}.blocks-app .ant-app .selected_form-mobile-props .ant-switch.ant-switch-checked:hover:not(.ant-switch-disabled){background-color:var(--ub-colorInfoHover)}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-action:hover .ant-input-number-action-up-inner,.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-action:hover .ant-input-number-action-down-inner{color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-alert-info{background-color:var(--ub-colorInfoBg);border:none}.blocks-app .ant-app .selected_form-mobile-props .ant-alert-info .ant-alert-title{color:var(--ub-colorInfoText)}.blocks-app .selected-element-panel__extra-btn-container{position:absolute;top:13px;right:50px}.blocks-app .selected-element-panel__extra-btn-container .ant-btn-text:disabled{color:var(--ub-colorTextQuaternary)}.blocks-app .email-properties__collapse .ant-tabs-content>.ant-tabs-tabpane{height:100%}.blocks-app .ant-app .columns-presets{width:100%;margin-bottom:calc(var(--ub-formItemMarginBottomMD) * 1px);align-items:center;gap:7px;display:flex}.blocks-app .ant-app .columns-presets .ant-btn{flex:1;min-width:0;padding:7px 9px;line-height:1!important}.blocks-app .email-pane__collapse-wrapper .ant-modal-close{width:24px;height:24px;font-size:16px}.blocks-app .email-pane__collapse-wrapper .ant-modal-close .anticon{line-height:0}.blocks-app .groups-management__group-select label{width:100%}.blocks-app .groups-management__group-select label:after{display:none}.blocks-app .groups-management__group_menu{border-color:var(--ub-colorFillSecondaryDarken)}.blocks-app .annotations-preview{z-index:1100;pointer-events:auto;background:#fff;border-radius:8px;width:300px;padding:16px;position:absolute;top:0;box-shadow:0 4px 12px #00000026}.blocks-app .annotations-preview--popover{opacity:1;z-index:1;pointer-events:auto;width:420px;max-height:calc(100vh - 48px);position:absolute;top:0;left:-15px;overflow:hidden;transform:translate(-100%)}.blocks-app .annotations-preview__content{pointer-events:none}.blocks-app .annotations-preview__type{color:#202124;margin-bottom:10px;font-size:13px;font-weight:600}.blocks-app .annotations-preview__footer{pointer-events:auto;justify-content:space-between;align-items:center;gap:8px;margin-top:12px;display:flex}.blocks-app .annotations-preview__apply-wrap{margin-left:auto;display:inline-flex}.blocks-app .email-pane__col-wrapper_reverse .annotations-preview--popover{left:auto;right:-15px;transform:translate(100%)}.blocks-app .preview-skeleton{background:linear-gradient(90deg,#f1f3f4 25%,#e8eaed 50%,#f1f3f4 75%) 0 0/200% 100%;border-radius:4px;flex-shrink:0;animation:1.4s ease-in-out infinite preview-skeleton-shimmer;display:block}.blocks-app .preview-skeleton--circle{border-radius:50%}.blocks-app .preview-skeleton--block{border-radius:0}@keyframes preview-skeleton-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}.blocks-app .product-carousel-preview__header{margin-bottom:12px}.blocks-app .product-carousel-preview__header-main{align-items:flex-start;gap:12px;display:flex}.blocks-app .product-carousel-preview__logo{object-fit:cover;border:1px solid #f0f0f0;border-radius:50%;flex-shrink:0;width:40px;height:40px}.blocks-app .product-carousel-preview__logo-skeleton{border:none}.blocks-app .product-carousel-preview__subject-skeleton{flex:1;min-width:0;max-width:220px}.blocks-app .product-carousel-preview__header-text{flex:1;min-width:0}.blocks-app .product-carousel-preview__header-row{justify-content:space-between;align-items:center;gap:8px;display:flex}.blocks-app .product-carousel-preview__header-row--subject{align-items:flex-start;margin-top:2px}.blocks-app .product-carousel-preview__brand-name{color:#202124;font-size:14px;font-weight:600;line-height:20px}.blocks-app .product-carousel-preview__time{color:#5f6368;flex-shrink:0;font-size:11px;line-height:16px}.blocks-app .product-carousel-preview__subject-line{color:#202124;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-size:13px;line-height:18px;overflow:hidden}.blocks-app .product-carousel-preview__star-icon{color:#5f6368;flex-shrink:0}.blocks-app .product-carousel-preview__carousel{gap:8px;margin:0 -2px;padding-bottom:4px;display:flex;overflow-x:auto}.blocks-app .product-carousel-preview__carousel::-webkit-scrollbar{display:none}.blocks-app .product-carousel-preview__carousel{-ms-overflow-style:none;scrollbar-width:none}.blocks-app .product-carousel-preview__card{background:#fff;border:1px solid #dadce0;border-radius:8px;flex:0 0 128px;width:128px;overflow:hidden}.blocks-app .product-carousel-preview__card-image{aspect-ratio:1;background-color:#f1f3f4;background-position:50%;background-size:cover;width:100%}.blocks-app .product-carousel-preview__card-image-skeleton{aspect-ratio:1;width:100%}.blocks-app .product-carousel-preview__card-body{padding:8px}.blocks-app .product-carousel-preview__card-headline{color:#3c4043;-webkit-line-clamp:2;-webkit-box-orient:vertical;min-height:32px;font-size:12px;line-height:16px;display:-webkit-box;overflow:hidden}.blocks-app .product-carousel-preview__card-headline-skeleton{flex-direction:column;gap:4px;min-height:32px;display:flex}.blocks-app .product-carousel-preview__card-prices{flex-wrap:wrap;align-items:baseline;gap:6px;margin-top:6px;display:flex}.blocks-app .product-carousel-preview__card-sale-price{color:#202124;font-size:13px;font-weight:600;line-height:16px}.blocks-app .product-carousel-preview__card-original-price{color:#5f6368;font-size:12px;line-height:16px;text-decoration:line-through}.blocks-app .single-image-preview__header{margin-bottom:10px}.blocks-app .single-image-preview__header-main{align-items:flex-start;gap:12px;display:flex}.blocks-app .single-image-preview__logo{object-fit:cover;border:1px solid #f0f0f0;border-radius:50%;flex-shrink:0;width:40px;height:40px}.blocks-app .single-image-preview__logo-skeleton{border:none}.blocks-app .single-image-preview__header-text{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.blocks-app .single-image-preview__header-row{justify-content:space-between;align-items:center;gap:8px;display:flex}.blocks-app .single-image-preview__brand-name{color:#202124;font-size:14px;font-weight:600;line-height:20px}.blocks-app .single-image-preview__time{color:#5f6368;flex-shrink:0;font-size:11px;line-height:16px}.blocks-app .single-image-preview__subject-line{color:#202124;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:600;line-height:18px;overflow:hidden}.blocks-app .single-image-preview__subject-skeleton{max-width:100%}.blocks-app .single-image-preview__promo-row{justify-content:space-between;align-items:center;gap:8px;min-height:18px;display:flex}.blocks-app .single-image-preview__promo-content{flex:1;align-items:center;gap:4px;min-width:0;display:flex}.blocks-app .single-image-preview__promo-icon{color:#188038;flex-shrink:0}.blocks-app .single-image-preview__promo-icon-skeleton{border-radius:4px;flex-shrink:0}.blocks-app .single-image-preview__promo-badge{color:#188038;flex-shrink:0;font-size:13px;font-weight:500;line-height:16px}.blocks-app .single-image-preview__promo-separator{color:#5f6368;flex-shrink:0;font-size:13px;line-height:16px}.blocks-app .single-image-preview__promo-code{text-overflow:ellipsis;white-space:nowrap;color:#5f6368;min-width:0;font-size:13px;line-height:16px;overflow:hidden}.blocks-app .single-image-preview__promo-skeleton{flex-shrink:0}.blocks-app .single-image-preview__star-icon{color:#5f6368;flex-shrink:0}.blocks-app .single-image-preview__card{background:#fff;border:1px solid #dadce0;border-radius:10px;width:calc(100% - 76px);max-width:100%;margin-left:52px;margin-right:24px;overflow:hidden}.blocks-app .single-image-preview__card-image{aspect-ratio:1.91;background-color:#f1f3f4;background-position:50%;background-size:cover;width:100%}.blocks-app .single-image-preview__card-image-skeleton{aspect-ratio:1.91;width:100%}.blocks-app .single-image-preview__card-body{padding:10px 12px 12px}.blocks-app .single-image-preview__card-description{color:#3c4043;-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:14px;line-height:16px;display:-webkit-box;overflow:hidden}.blocks-app .single-image-preview__card-description-skeleton{flex-direction:column;gap:6px;min-height:34px;display:flex}.blocks-app .deal-annotation-preview__header-main{align-items:flex-start;gap:12px;display:flex}.blocks-app .deal-annotation-preview__logo{object-fit:cover;border:1px solid #f0f0f0;border-radius:50%;flex-shrink:0;width:40px;height:40px}.blocks-app .deal-annotation-preview__logo-skeleton{border:none}.blocks-app .deal-annotation-preview__header-text{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.blocks-app .deal-annotation-preview__header-row{justify-content:space-between;align-items:center;gap:8px;display:flex}.blocks-app .deal-annotation-preview__brand-name{color:#202124;font-size:14px;font-weight:600;line-height:20px}.blocks-app .deal-annotation-preview__time{color:#5f6368;flex-shrink:0;font-size:11px;line-height:16px}.blocks-app .deal-annotation-preview__subject-line{color:#202124;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:600;line-height:18px;overflow:hidden}.blocks-app .deal-annotation-preview__subject-skeleton{max-width:100%}.blocks-app .deal-annotation-preview__promo-row{justify-content:space-between;align-items:center;gap:8px;min-height:18px;display:flex}.blocks-app .deal-annotation-preview__promo-content{flex:1;align-items:center;gap:4px;min-width:0;display:flex}.blocks-app .deal-annotation-preview__promo-icon{color:#188038;flex-shrink:0}.blocks-app .deal-annotation-preview__promo-icon-skeleton{border-radius:4px;flex-shrink:0}.blocks-app .deal-annotation-preview__promo-badge{color:#188038;flex-shrink:0;font-size:13px;font-weight:500;line-height:16px}.blocks-app .deal-annotation-preview__promo-separator{color:#5f6368;flex-shrink:0;font-size:13px;line-height:16px}.blocks-app .deal-annotation-preview__promo-code{text-overflow:ellipsis;white-space:nowrap;color:#5f6368;min-width:0;font-size:13px;line-height:16px;overflow:hidden}.blocks-app .deal-annotation-preview__promo-skeleton{flex-shrink:0}.blocks-app .deal-annotation-preview__star-icon{color:#5f6368;flex-shrink:0}.blocks-app .deal-card-preview{background:#f1f3f4;border-radius:12px;flex-direction:column;gap:12px;padding:16px;display:flex}.blocks-app .deal-card-preview__sender{color:#202124;font-size:12px;font-weight:600;line-height:16px}.blocks-app .deal-card-preview__headline{color:#202124;word-break:break-word;font-size:22px;font-weight:400;line-height:28px}.blocks-app .deal-card-preview__headline-skeleton{max-width:100%}.blocks-app .deal-card-preview__details{align-items:flex-start;gap:24px;display:flex}.blocks-app .deal-card-preview__expires{align-items:flex-start;gap:8px;min-width:0;display:flex}.blocks-app .deal-card-preview__clock-icon{color:#5f6368;flex-shrink:0;margin-top:1px}.blocks-app .deal-card-preview__code{min-width:0}.blocks-app .deal-card-preview__detail-text{flex-direction:column;gap:2px;min-width:0;display:flex}.blocks-app .deal-card-preview__detail-label{color:#202124;font-size:12px;font-weight:600;line-height:16px}.blocks-app .deal-card-preview__detail-value{color:#5f6368;word-break:break-word;font-size:12px;font-weight:400;line-height:16px}.blocks-app .deal-card-preview__detail-skeleton{margin-top:1px}.blocks-app .deal-card-preview__actions{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.blocks-app .deal-card-preview__button{color:#001d35;white-space:nowrap;background:#c2e7ff;border-radius:999px;justify-content:center;align-items:center;padding:8px 16px;font-size:13px;font-weight:500;line-height:16px;display:inline-flex}.blocks-app .annotations-panel .selected-social-form__section-title{align-items:baseline;gap:6px;display:flex}.blocks-app .annotations-panel__docs-hint{color:var(--ub-colorTextSecondary,#8c8c8c);margin-top:16px;font-size:12px;font-weight:300;line-height:1.4}.blocks-app .annotations-panel__section-hint{color:var(--ub-colorTextSecondary,#8c8c8c);font-size:12px;font-weight:300}.blocks-app .annotations-panel__field-tooltip-wrap{width:100%;margin-bottom:8px;display:block}.blocks-app .annotations-panel__cards-section{margin-top:16px}.blocks-app .email-pane__content-col .selected-social-form.annotations-panel .selected-social-form__form .ant-form-item.selected-social-form__card-field:last-child{margin-bottom:8px}.blocks-app .email-settings{height:100%;display:flex}.blocks-app .email-settings__collapse{flex-direction:column;width:100%;height:100%;min-height:0;max-height:100%;display:flex;overflow:hidden}.blocks-app .email-settings__collapse.ant-collapse{border:0}.blocks-app .email-settings__collapse.secondary-tabs.ant-tabs .ant-tabs-content-holder{flex:1;min-height:0;overflow:hidden auto}.blocks-app .email-settings__collapse.secondary-tabs.ant-tabs .ant-tabs-content,.blocks-app .email-settings__collapse.secondary-tabs.ant-tabs .ant-tabs-tabpane-active{overflow:visible}.blocks-app .email-settings__collapse-panel:last-child.ant-collapse-item-active{padding-bottom:12px}.blocks-app .email-settings__collapse-panel.ant-collapse-item{min-height:50px;overflow:hidden}.blocks-app .email-settings__collapse-panel-content{width:100%}.blocks-app .email-settings .ant-collapse-body{padding:0 2px 0 12px;overflow:hidden}.blocks-app #content_appearance_panel_form button.ant-btn:not(.ant-btn-primary):hover{border-color:#d9d9d9}.blocks-app .section-title-bull{color:var(--ub-colorTextQuaternary)}.blocks-app .appearance-panel__content-styles{flex-direction:column;height:100%;min-height:0;display:flex}.blocks-app .appearance-panel__content-styles.ant-tabs{height:100%;min-height:0}.blocks-app .appearance-panel__content-styles .ant-tabs-content-holder,.blocks-app .appearance-panel__content-styles .ant-tabs-content,.blocks-app .appearance-panel__content-styles .ant-tabs-tabpane,.blocks-app .appearance-panel__content-styles .ant-tabs-tabpane-active,.blocks-app .appearance-panel__content-styles .email-settings__collapse-panel-content,.blocks-app .appearance-panel__content-styles .appearance-panel,.blocks-app .appearance-panel__content-styles .element-controls{min-height:0}.blocks-app .appearance-panel__content-styles .ant-tabs-content-holder,.blocks-app .appearance-panel__content-styles .ant-tabs-content,.blocks-app .appearance-panel__content-styles .ant-tabs-tabpane-active,.blocks-app .appearance-panel__content-styles .email-settings__collapse-panel-content,.blocks-app .appearance-panel__content-styles .appearance-panel{flex-direction:column;flex:1;display:flex}.blocks-app .appearance-panel__content-styles .ant-tabs-content-holder{overflow:hidden auto}.blocks-app .appearance-panel__content-styles .ant-tabs-content,.blocks-app .appearance-panel__content-styles .ant-tabs-tabpane-active{overflow:visible}.blocks-app .modal-select-role__cards-grid{grid-gap:20px;grid-template-columns:repeat(auto-fit,322px);padding:10px 24px 24px;display:grid}.blocks-app .modal-select-role .element-card__select-role{cursor:pointer;height:300px}.blocks-app .modal-select-role .element-card__select-role img{cursor:pointer;background-color:#fff;width:100%}.blocks-app .modal-select-role .element-card__select-role .ant-card-body{height:50px}.blocks-app .modal-select-role__title-wrapper{display:inline-block}.blocks-app .ai-response-paragraph{margin-bottom:16px}.blocks-app .em-analytics__email-tab-discuss{overflow:auto!important}.blocks-app .discuss-ai-wrapper{flex-direction:column;flex:1;height:100%;min-height:0;display:flex}.blocks-app .discuss-ai-wrapper .ant-tabs-content-holder,.blocks-app .discuss-ai-wrapper .ant-tabs-content,.blocks-app .discuss-ai-wrapper .ant-tabs-tabpane,.blocks-app .discuss-ai-wrapper .ant-tabs-tabpane-active{flex-direction:column;flex:1;min-height:0;display:flex}.blocks-app .discuss-ai-wrapper .ant-tabs-content{overflow:hidden auto}.blocks-app .discuss-ai-wrapper .discuss-main{min-height:0}.blocks-app .ant-tabs-content .discuss-ai{background-color:#fafafa;border:1px solid #f1ebeb;border-radius:8px;margin:0 0 20px;padding:24px 36px 0}.dark .blocks-app .ant-tabs-content .discuss-ai{background-color:#181818;border-color:#262626}.blocks-app .discuss-main{margin:0}.blocks-app .discuss-main__form{position:relative}.blocks-app .discuss-main__buttons{justify-content:space-between;display:flex}.blocks-app .discuss-main>.comment-list{margin-bottom:16px}.blocks-app .discuss-main>form{padding-bottom:20px}.blocks-app .discuss-main .ant-comment-actions{opacity:.6;transition:all .3s cubic-bezier(.645,.045,.355,1)}.blocks-app .discuss-main .replyEditMode{opacity:.5}.blocks-app .modal-select-role{max-height:1400px}.blocks-app .modal-select-role .element-card.element-card_select-role .ant-card-cover{border:none;height:auto}.blocks-app .modal-select-role .element-card .ant-card-body{height:auto}.blocks-app .modal-select-role__cards-grid{grid-gap:20px;grid-template-columns:repeat(3,260px);width:auto;padding:10px 24px 24px;display:grid}.blocks-app .modal-select-role .element-card_select-role{cursor:pointer}.blocks-app .modal-select-role .element-card_select-role img,.blocks-app .modal-select-role .element-card__no-img{background-color:#fff}@media (width<=1200px){.blocks-app .modal-select-role__cards-grid{grid-template-columns:repeat(4,240px);width:auto}.blocks-app .modal-select-role .element-card__title{font-size:15px}}.blocks-app .ant-comment .ant-comment-avatar{cursor:auto}.blocks-app .ant-comment .ant-comment-avatar .anticon-robot{background:var(--ub-colorInfo)}.blocks-app .ant-comment .ant-comment-avatar .anticon-user{background:var(--ub-colorPrimary)}.blocks-app .ant-comment.ai-comment .ant-comment-avatar .anticon-robot{background:var(--ub-colorInfo)}.blocks-app .ant-comment.ai-comment .ant-comment-avatar .anticon-user{background:var(--ub-colorPrimary)}.blocks-app .ant-comment.ai-comment .ai-guide__example{border-left:1px solid #3b91ff;padding-left:15px;font-style:italic}.blocks-app .ant-comment.ai-comment .ai-guide__example strong{font-weight:500}.blocks-app .ant-comment-content-detail{margin-top:16px;margin-left:-30px}.blocks-app .ant-comment-content-detail p{white-space:normal;margin:16px 0;line-height:1.4}.blocks-app .ant-comment-content-detail ul{margin:16px 0}.blocks-app .ant-comment-content-detail .buttons-variants{white-space:normal;margin-left:0;padding-left:0}.blocks-app body.dark .ant-comment-content-detail .buttons-variants .ant-btn-default:hover{background:#e6f7ff}.blocks-app .ant-comment-content-detail .buttons-variants li{white-space:normal;margin-bottom:4px}.blocks-app .ant-comment-content-detail .buttons-variants .ant-btn.ant-btn-sm{text-align:left;height:auto;padding:4px 7px;line-height:1.4}.blocks-app .ant-comment-content-detail .ai-response-variant{margin:15px 0}.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-title,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-preheader,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-copy{cursor:pointer;background-color:#1890ff33;border-radius:4px;margin:4px 0;padding:3px 8px;line-height:1.4;transition:all .3s;display:block}.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-title:hover,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-preheader:hover,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-copy:hover{color:#000}.blocks-app body.dark .ant-comment-content-detail .ai-response-variant .ai-response-title:hover,.blocks-app body.dark .ant-comment-content-detail .ai-response-variant .ai-response-preheader:hover,.blocks-app body.dark .ant-comment-content-detail .ai-response-variant .ai-response-copy:hover{color:#fff}.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-title:hover,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-preheader:hover,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-copy:hover{background-color:#1890ff55}.blocks-app .limit-upgrade-modal.ant-modal{max-width:calc(100vw - 24px)}.blocks-app .limit-upgrade-modal .ant-modal-content{border-radius:16px;padding:0;overflow:hidden;box-shadow:0 12px 24px -4px #191d3a14}.blocks-app .limit-upgrade-modal .ant-modal-header{display:none}.blocks-app .limit-upgrade-modal .ant-modal-content .ant-modal-body{padding:0}.blocks-app .limit-upgrade-modal__wrap{background:var(--ub-colorBgContainer);flex-direction:column;align-items:center;width:400px;max-width:100%;display:flex}.blocks-app .limit-upgrade-modal__header{z-index:1;box-sizing:border-box;justify-content:flex-end;align-items:center;display:flex;position:absolute;top:20px;right:20px}.blocks-app .limit-upgrade-modal__close{background:var(--ub-colorBgContainer);width:34px;height:34px;color:var(--ub-colorTextSecondary);cursor:pointer;border:none;border-radius:6px;justify-content:center;align-items:center;margin:0;padding:0;transition:background .15s,color .15s;display:flex}.blocks-app .limit-upgrade-modal__close:hover{background:var(--ub-colorFillTertiary);color:var(--ub-colorText)}.blocks-app .limit-upgrade-modal__close .anticon{font-size:16px}.blocks-app .limit-upgrade-modal__body{box-sizing:border-box;flex-direction:column;align-items:center;gap:16px;width:100%;padding:44px 40px 24px;display:flex}.blocks-app .limit-upgrade-modal__title{text-align:center;max-width:320px;color:var(--ub-colorText);margin:0;font-size:18px;font-weight:400;line-height:130%}.blocks-app .limit-upgrade-modal__subtitle{text-align:center;max-width:320px;color:var(--ub-colorTextSecondary);margin:0;font-size:14px;font-weight:100;line-height:120%}.blocks-app .limit-upgrade-modal__limits-row{flex-flow:wrap;justify-content:center;align-items:center;gap:8px;width:100%;max-width:320px;display:flex}.blocks-app .limit-upgrade-modal__icon-circle{box-sizing:border-box;border:1px solid var(--ub-colorText);width:34px;height:34px;color:var(--ub-colorText);border-radius:32px;flex:none;justify-content:center;align-items:center;padding:8px;display:flex}.blocks-app .limit-upgrade-modal__icon-circle .anticon{font-size:18px}.blocks-app .limit-upgrade-modal__icon-circle svg{flex-shrink:0;width:18px;height:18px;display:block}.blocks-app .limit-upgrade-modal__limit-old{color:#f85243;flex-shrink:0;font-size:40px;font-weight:100;line-height:100%}.blocks-app .limit-upgrade-modal__arrow-btn{color:#fff;background:#8946fb;border-radius:38px;flex:none;justify-content:center;align-items:center;width:34px;height:34px;display:flex}.blocks-app .limit-upgrade-modal__arrow-icon{font-size:16px;transform:rotate(45deg)}.blocks-app .limit-upgrade-modal__limit-new{color:#7ed846;flex-shrink:0;font-size:40px;font-weight:400;line-height:100%}.blocks-app .limit-upgrade-modal__limit-new--infinity{font-size:36px;line-height:40px}.blocks-app .limit-upgrade-modal__divider{border:none;border-top:1px solid var(--ub-colorBorderSecondary);width:100%;height:0;margin:0}.blocks-app .limit-upgrade-modal__footer{box-sizing:border-box;flex-direction:column;justify-content:center;align-items:center;width:100%;padding:16px 0;display:flex}.blocks-app .limit-upgrade-modal__footer--dual{flex-flow:wrap;justify-content:center;align-items:center;gap:8px;padding:16px}.blocks-app .limit-upgrade-modal__cta.ant-btn-primary{min-width:147px;height:32px;box-shadow:none;background:#2884ff;border-color:#2884ff;border-radius:6px;padding:8px 16px;font-size:14px;font-weight:400;line-height:19px}.blocks-app .limit-upgrade-modal__cta.ant-btn-primary:hover{background:#1a75f0;border-color:#1a75f0}.blocks-app .limit-upgrade-modal__cta-secondary.ant-btn-default{border-color:var(--ub-colorBorder);min-width:147px;height:32px;color:var(--ub-colorText);box-shadow:none;border-radius:6px;padding:8px 16px;font-size:14px;font-weight:400;line-height:19px}.blocks-app .limit-upgrade-modal__cta-secondary.ant-btn-default:hover{color:#2884ff;border-color:#2884ff}.blocks-app .optimise-wrapper{flex-direction:column;flex:1;height:100%;min-height:0;display:flex}.blocks-app .optimise-wrapper .ant-tabs-content-holder,.blocks-app .optimise-wrapper .ant-tabs-content,.blocks-app .optimise-wrapper .ant-tabs-tabpane,.blocks-app .optimise-wrapper .ant-tabs-tabpane-active{flex-direction:column;flex:1;min-height:0;display:flex}.blocks-app .optimise-wrapper .ant-tabs-content{overflow:hidden auto}.blocks-app .optimise{background:0 0;border:none;min-height:0}.blocks-app .optimise.ant-collapse>.ant-collapse-item:last-child{border-bottom:none!important}.blocks-app .optimise .ant-list-item-meta-title{-webkit-user-select:text;user-select:text}.blocks-app .optimise__summary{justify-content:space-between;width:100%;display:flex}.blocks-app .optimise__summary>div:not(:last-child){margin-right:10px}.blocks-app .optimise__summary h4{line-height:1}.blocks-app .optimise .ant-divider.ant-divider-horizontal{border-top:1px solid var(--ub-colorBorderSecondary);background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);width:calc(100% + 50px);margin:26px -25px}.blocks-app .optimise.ant-collapse>.ant-collapse-item{border-bottom:1px solid var(--ub-colorBorderSecondary)}.blocks-app .optimise.ant-collapse>.ant-collapse-item .ant-collapse-header{padding:12px 0 12px 24px}.blocks-app .optimise.ant-collapse>.ant-collapse-item .ant-collapse-panel{border-top:none}.blocks-app .optimise.ant-collapse>.ant-collapse-item .ant-collapse-body{padding:24px 14px 12px 24px;overflow-y:hidden;padding-top:0!important;padding-right:24px!important}.blocks-app .optimise .valid{white-space:nowrap;color:var(--ub-colorSuccessText)}.blocks-app .optimise .error{white-space:nowrap;color:var(--ub-colorErrorText)}.blocks-app .optimise .warning{white-space:nowrap;color:var(--ub-colorWarningText)}.blocks-app .optimise__title-wrapper{justify-content:space-between;align-items:flex-start;width:100%;display:flex}.blocks-app .optimise__title-wrapper h5{width:70%}.blocks-app .optimise__link{-webkit-user-select:text;user-select:text}.blocks-app .optimise__link:hover{color:var(--ub-colorLinkHover)!important}.blocks-app .email-pane .optimise .ant-collapse-panel{height:calc(100% - 184px)}.blocks-app .optimise__image-item .image-item__meta_fail .ant-list-item-meta-avatar{background:linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-colorBorder) 0), linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-colorBorder) 0);background-position:0 0,4px 4px;background-size:8px 8px;border-radius:6px}.blocks-app .optimise__image-item .image-item__meta.ant-list-item-meta{align-items:stretch}.blocks-app .optimise__image-item .image-item__image{cursor:pointer;object-fit:contain;border-radius:calc(var(--ub-borderRadius) * 1px);background:linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-colorBorder) 0), linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-colorBorder) 0);background-position:0 0,4px 4px;background-size:8px 8px}.blocks-app .optimise__image-item .image-item__image+.ant-image-mask{border-radius:calc(var(--ub-borderRadius) * 1px)}.blocks-app .optimise__image-item .image-item__image_fail{height:92px!important}.blocks-app .optimise .ant-list .ant-list-item .ant-list-item-meta .ant-list-item-meta-avatar{margin-inline-end:12px}.blocks-app .optimise .warnings{color:var(--ub-colorWarningText)}.blocks-app .optimise .errors{color:var(--ub-colorErrorText)}.blocks-app .optimise .valid{color:var(--ub-colorSuccessText)}.blocks-app .optimise__button.warnings{border-color:var(--ub-colorWarningBorder);background:var(--ub-colorWarningBg)}.blocks-app .optimise__button.warnings:not(.ant-tag-checkable-checked):hover{border-color:var(--ub-colorWarningBorderHover);color:var(--ub-colorWarningTextHover);background:var(--ub-colorWarningBgHover)}.blocks-app .optimise__button.warnings_active{color:#fff;background-color:var(--ub-colorWarningActive);border-color:var(--ub-colorWarningActive)}.blocks-app .optimise__button.errors{border-color:var(--ub-colorErrorBorder);background:var(--ub-colorErrorBg)}.blocks-app .optimise__button.errors:not(.ant-tag-checkable-checked):hover{border-color:var(--ub-colorErrorBorderHover);color:var(--ub-colorErrorTextHover);background:var(--ub-colorErrorBgHover)}.blocks-app .optimise__button.errors_active{color:#fff;background-color:var(--ub-colorErrorActive);border-color:var(--ub-colorErrorActive)}.blocks-app .optimise__button.valid{border-color:var(--ub-colorSuccessBorder);background:var(--ub-colorSuccessBg)}.blocks-app .optimise__button.valid:not(.ant-tag-checkable-checked):hover{border-color:var(--ub-colorSuccessBorderHover);color:var(--ub-colorSuccessTextHover);background:var(--ub-colorSuccessBgHover)}.blocks-app .optimise__button.valid_active{color:#fff;background-color:var(--ub-colorSuccessActive);border-color:var(--ub-colorSuccessActive)}.blocks-app .optimise .ant-alert-info{width:100%;margin-top:5px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__divider-no-margin.selected-td-form__divider{margin-top:0;margin-bottom:0}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-col.optimise__col-align-right{text-align:right}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-24{margin-bottom:24px}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-16{margin-bottom:16px}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-14{margin-bottom:14px}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-12{margin-bottom:12px}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-8{margin-bottom:8px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__link-blue.ant-typography{color:#177ddc;text-decoration:underline}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-image.optimise__image-auto-height{height:auto}.blocks-app .ant-app .email-pane .ant-tabs .optimise__text-clickable.ant-typography{cursor:pointer}.blocks-app .ant-app .email-pane .ant-tabs .optimise__valid-title.ant-typography{margin:0;font-size:14px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__valid-title-space.ant-space{flex-wrap:wrap}.blocks-app .ant-app .email-pane .ant-tabs .optimise__alert-custom.ant-alert{width:100%;padding:14px 14px 10px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__summary-title.ant-typography{margin-bottom:0}.blocks-app .ant-app .email-pane .ant-tabs .optimise__summary-label{font-size:12px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-score-title.ant-typography{margin:0}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-score-value{margin-right:12px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-score-text.ant-typography{margin-right:12px;font-size:20px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-report-score.ant-typography{font-size:20px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-report-description{margin-left:12px}.blocks-app .img-preview{background-color:var(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadiusXL) * 1px);box-shadow:var(--ub-boxShadow);opacity:0;border:1px solid #fff;max-width:668px;padding:3px;transition:opacity .3s,transform .3s;position:absolute;top:0;left:-15px;transform:translate(-99%)}.blocks-app .img-preview-content{border:1px solid var(--ub-colorBorderSecondary);border-radius:calc(var(--ub-borderRadiusLG) * 1px);background:linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 25%, transparent 75%, var(--ub-colorBorder) 75%), linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 25%, transparent 75%, var(--ub-colorBorder) 75%);background-position:0 0,4px 4px;background-size:8px 8px;overflow:hidden}.blocks-app .img-preview-content table{border-collapse:initial}.dark .blocks-app .img-preview{border-color:#4f4f4f}.blocks-app .indexing-tray{z-index:4010;width:360px;max-width:calc(100vw - 40px);position:fixed;bottom:20px;right:20px}.blocks-app .indexing-tray__card{box-shadow:0 6px 16px #0000001f}.blocks-app .indexing-tray__title{font-size:14px;margin:0!important}.blocks-app .blocks-search{height:100%;min-height:0;overflow:visible}.blocks-app .blocks-search .ant-select-clear{right:30px}.blocks-app .blocks-search form{z-index:1;width:85%;padding:16px 0 0 24px;position:absolute;top:0;left:0}.blocks-app .blocks-search__form{display:none}.blocks-app .blocks-search__form.is_search{display:block}.blocks-app .blocks-search__divider-wrapper{z-index:1;margin-top:12px;position:relative}.blocks-app .blocks-search__divider{pointer-events:none;width:auto;height:20px;margin:24px 0 0;position:absolute;bottom:-20px;left:-24px;right:-13px}.blocks-app .blocks-search__type-wrapper{min-width:35%;min-height:0;padding:20px 24px 14px 0;overflow-y:auto}.blocks-app .blocks-search__type-wrapper ul{padding:0}.blocks-app .blocks-search__type-wrapper li{cursor:pointer;color:var(--ub-colorTextSecondary);text-align:left;margin-bottom:12px;line-height:1.2;list-style:none}.blocks-app .blocks-search__type-wrapper li.active{color:var(--ub-colorLink)}.blocks-app .blocks-search__type-wrapper li:hover{color:var(--ub-colorLinkHover)}.blocks-app .blocks-search__result-wrapper{height:100%;min-height:0;margin-left:0;margin-right:0;padding-left:24px;display:flex;position:relative}.blocks-app .blocks-search__result-wrapper:after{content:"";background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);z-index:1;width:100%;height:20px;position:absolute;top:0;left:0}.blocks-app .blocks-search__result-wrapper.is_search:after{top:72px}.dark .blocks-app .blocks-search__result-wrapper:after{background:linear-gradient(180deg, var(--ub-colorBgBase) -100%, transparent 50%)}.blocks-app .blocks-search__result-wrapper.is_search{flex:auto;min-width:0;margin-left:0;margin-right:0;padding-top:20px;padding-left:0;padding-right:6px;display:block;position:static;overflow:hidden auto}.blocks-app .blocks-search__blocks-wrapper{min-width:65%;min-height:0;padding-top:20px;padding-left:10px;padding-right:14px;overflow-y:scroll}.blocks-app .blocks-search__result-holder{opacity:0}.blocks-app .blocks-search__blocks-wrapper{overflow-anchor:none}.blocks-app .blocks-search__blocks-wrapper.is_search{box-sizing:border-box;width:100%;min-width:0;padding-top:0;padding-left:4px;padding-right:0}.blocks-app .blocks-search__result{margin-bottom:14px}.blocks-app .ant-dropdown .ant-dropdown-menu .blocks-search__result__menu-item{padding:9px}.blocks-app .blocks-search__result-header{z-index:2;justify-content:space-between;padding:4px 10px;font-size:13px;display:none;position:relative;box-shadow:0 5px 20px #00000012}.blocks-app .blocks-search__result-global-mark{z-index:10;pointer-events:none;position:absolute;top:1px;right:1px}.blocks-app .blocks-search__result-body{background:var(--ub-colorBgElevated);border:1px solid var(--ub-colorBorder);border-radius:calc(var(--ub-borderRadiusSM) * 1px);text-align:center;cursor:grab;background-color:var(--ub-controlTmpOutline);min-height:13px;padding:0;transition:border-color .3s cubic-bezier(.645,.045,.355,1),background-color .3s cubic-bezier(.645,.045,.355,1),box-shadow .3s cubic-bezier(.645,.045,.355,1);position:relative;overflow:hidden}.blocks-app .blocks-search__result-body:hover{border-color:var(--ub-colorTextDisabled);cursor:grab!important}.blocks-app .blocks-search__result-body:active{cursor:grabbing}.blocks-app .blocks-search__result-body:not([data-preview-measured]){min-height:180px}.blocks-app .blocks-search__result-body:after{content:"";z-index:1;width:100%;height:100%;display:block;position:absolute;top:0;left:0}.blocks-app .blocks-search__result-html{transform-origin:0 0;text-align:left;min-width:660px;height:100%;overflow-x:visible}.blocks-app .blocks-search__result-body:not([data-preview-measured]) .blocks-search__result-html{min-height:1px}.blocks-app .blocks-search .em-dragging-element .blocks-search__result-body{background-color:var(--ub-controlTmpOutline)}.blocks-app .blocks-search .em-ghost-element{border-radius:calc(var(--ub-borderRadiusXL) * 1px);overflow:hidden;background-color:var(--ub-colorBgContainer)!important}.blocks-app .email-pane .ant-tabs .blocks-search__result-divider.ant-divider-horizontal{width:100%;margin-left:0;margin-right:0}.blocks-app .blocks-search.is_search{display:flex}.blocks-app .blocks-search.is_search .blocks-search__type-wrapper{min-width:33%;padding-left:24px;padding-right:0}.blocks-app .block-search__preview{background-color:var(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadiusXL) * 1px);box-shadow:var(--ub-boxShadow);opacity:0;border:1px solid #fff;width:668px;padding:3px;transition:opacity .3s,transform .3s;position:absolute;top:0;left:-15px;transform:translate(-99%)}.blocks-app .block-search__preview-title{color:var(--ub-colorTextSecondary);padding:8px 15px;font-size:14px}.blocks-app .block-search__preview-content{border:1px solid var(--ub-colorBorderSecondary);border-radius:calc(var(--ub-borderRadiusLG) * 1px);overflow:hidden}.blocks-app .block-search__preview-content table{border-collapse:initial}.dark .blocks-app .block-search__preview{border-color:#4f4f4f}.blocks-app .email-pane__col-wrapper_reverse .block-search__preview{left:auto;right:-15px;transform:translate(99%)}.blocks-app .block-global-badge{color:var(--ub-colorTextSecondary);pointer-events:auto;justify-content:center;align-items:center;line-height:0;display:inline-flex}.blocks-app .block-global-badge svg{display:block}.blocks-app .block-global-badge--tile{box-sizing:border-box;background-color:#ffffffb8;border-radius:6px;width:24px;min-width:24px;height:24px;min-height:24px;padding:0;box-shadow:0 1px 2px #0000001a}.blocks-app .block-global-badge--tile svg{flex-shrink:0}.blocks-app body.dark .block-global-badge--tile,.dark .blocks-app .block-global-badge--tile{color:#ffffffe0;background-color:#0000008c;box-shadow:0 1px 3px #00000059}.blocks-app .discuss-wrapper{flex-direction:column;flex:1;height:100%;min-height:0;display:flex}.blocks-app .discuss-wrapper .ant-tabs-content-holder,.blocks-app .discuss-wrapper .ant-tabs-content,.blocks-app .discuss-wrapper .ant-tabs-tabpane,.blocks-app .discuss-wrapper .ant-tabs-tabpane-active{flex-direction:column;flex:1;min-height:0;display:flex}.blocks-app .discuss-wrapper .ant-tabs-tabpane-active{overflow:hidden}.blocks-app .discuss-wrapper .discuss-main{flex-direction:column;height:100%;min-height:0;display:flex;position:relative;overflow:hidden}.blocks-app .discuss-main>.comment-list{flex:auto;min-height:0;margin-bottom:24px;overflow:hidden auto}.blocks-app .discuss-main>form{flex-shrink:0}.blocks-app .discuss-main .ant-comment-content{flex:1;min-width:0}.blocks-app .discuss-main .ant-comment-content-author{flex-wrap:wrap;align-items:baseline;gap:8px;margin-bottom:4px;display:flex}.blocks-app .discuss-main .ant-comment .ant-comment-content-author-name{color:var(--ub-colorTextBase);font-weight:500;transition:color .3s;font-size:14px!important;line-height:1.4!important}.blocks-app .discuss-main .ant-comment-content-author-time{color:var(--ub-colorTextSecondary);white-space:nowrap;font-size:12px;line-height:1.4}.blocks-app .discuss-main .comment-item-noavatar .ant-comment-content-detail{margin-left:0}.blocks-app .discuss-main .ant-comment-content-detail p{white-space:normal;color:var(--ub-colorText);margin:0 0 16px;line-height:1.4}.blocks-app .discuss-main .ant-comment-content-detail :not(.ant-btn,.buttons-variants,.buttons-variants *){-webkit-user-select:text;user-select:text}.blocks-app .discuss-main .ant-dropdown-trigger{z-index:1;color:var(--ub-colorText);margin:-36px 0 -1px -24px;padding:36px 0 1px 24px;position:relative}.blocks-app .discuss-main .ant-comment-nested .ant-dropdown-trigger{margin-left:-18px;padding-left:18px}.blocks-app .discuss-main .ant-comment-inner{transition:all .5s}.blocks-app .discuss-main .ant-comment.active>.ant-comment-inner{background:#efdbff}.blocks-app .discuss-main .targetted-comment-item>.ant-comment-inner{background:var(--ub-colorInfoBg);cursor:pointer}.blocks-app .discuss-main .ant-comment-actions{opacity:.6;margin-top:6px;transition:all .3s cubic-bezier(.645,.045,.355,1);display:none}.blocks-app .discuss-main .ant-form-item-control-input-content{margin-left:2px}.blocks-app .discuss-main .ant-tooltip-container{text-align:center}.blocks-app .discuss-main .ant-comment-content:hover .ant-comment-actions{opacity:1}.blocks-app .discuss-main .replyEditMode{opacity:.5;display:none}.blocks-app .discuss-main .icon-target{font-size:16px;transform:translateY(5%)}.blocks-app .discuss-main .comment-icon-target{border-radius:8px;margin-left:5px;padding:0 8px 2px}.blocks-app .discuss-main .comment-icon-target:hover{cursor:pointer}.blocks-app .discuss-main .ant-btn.ant-btn-primary.button-target.button-target_choose{background:var(--ub-colorInfo)}.blocks-app .discuss-main .ant-space button{margin-right:0}.blocks-app .anticon-history{transform:scaleX(-1)}.blocks-app .history-panel{border-right:1px solid var(--ub-colorBorder);flex-direction:column;justify-content:space-between;height:100%;display:flex;box-shadow:-12px 0 48px 16px #00000008,-9px 0 28px #0000000d,-6px 0 16px -8px #00000014}.blocks-app .history-panel__sider{z-index:11;background:var(--ub-colorBgContainer);height:100%;position:absolute;top:0;bottom:0;left:80px}.blocks-app .history-panel__list-header,.blocks-app .history-panel__header{justify-content:space-between;align-items:center;padding:0 24px 9px;font-weight:500;display:flex}.blocks-app .history-panel__list-header :last-child{min-width:60px}.blocks-app .history-panel__header{padding-left:24px;padding-right:24px}.blocks-app .history-panel__list-header:before{background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);border-top:1px solid var(--ub-colorBorderSecondary);content:"";z-index:1;background-position:0 -2px;background-repeat:no-repeat;border-bottom:none;height:20px;position:absolute;inset:30px 0 -20px}.dark .blocks-app .history-panel__list-header:before{background:linear-gradient(180deg, var(--ub-colorBgBase), transparent 40%)}.blocks-app .history-panel__header-title{font-size:14px;font-style:normal;line-height:24px}.blocks-app body.dark .history-panel__header-title{color:#fff}.blocks-app .history-panel__header-close{color:#00000073;margin-right:-16px}.blocks-app body.dark .history-panel__header-close{color:#fff}.blocks-app .history-panel__list{height:100%;margin:10px -24px 0}.blocks-app .history-panel__list .ant-list-header{border:none;margin-bottom:5px;padding:0;font-weight:500}.blocks-app .history-panel__list .ant-spin-nested-loading,.blocks-app .history-panel__list .ant-spin-container{height:100%}.blocks-app .history-panel__list .ant-list-items{height:calc(100% - 30px);overflow:auto}.blocks-app .history-panel__list .ant-list-item{cursor:pointer;border:none;padding:9px 24px}.blocks-app .history-panel__list .ant-list-item:hover{background-color:var(--ub-colorFillQuaternary)}.blocks-app .history-panel__list .ant-btn.ant-btn-sm{--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/d8d10299.js",["require","exports","module","static/core/2ff39ddf.js","static/core/cf7d1dd7.js","static/core/b8eb1c3a.js","static/core/483ce33c.js","static/core/d9907c79.js","static/core/f65bd194.js","static/core/4030ef2c.js","static/core/e532cd8d.js","static/core/9f336cc6.js","static/core/cbfe265e.js","static/core/8606910e.js","react","react/jsx-runtime","__delivery__/libs","react-dom","vite/preload-helper","classnames","dayjs"],function(fo,Bo,ep){const ho=fo("./2ff39ddf.js"),yo=fo("./cf7d1dd7.js"),r=fo("./b8eb1c3a.js"),ui=fo("./483ce33c.js"),Qa=fo("./d9907c79.js"),H=fo("./f65bd194.js"),Zo=fo("./4030ef2c.js"),Qe=fo("./e532cd8d.js"),mi=fo("./9f336cc6.js"),Nt=fo("./cbfe265e.js"),Ir=fo("./8606910e.js");let a=fo("react");a=ho.__toESM(a);let o=fo("react/jsx-runtime"),t=fo("__delivery__/libs"),Za=fo("react-dom"),Lt=fo("vite/preload-helper"),ze=fo("classnames");ze=ho.__toESM(ze);let dt=fo("dayjs");dt=ho.__toESM(dt);var f=ho.__toESM(r.require_prop_types());async function vr(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 Cr(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 _t(e){if(!e)return!1;try{return new URL(e,typeof window<"u"&&window.location?window.location.origin:"http://localhost").pathname.includes("/static/media/")}catch{return!1}}function Pr(){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(yo.events.FILE_PROXY_EVENT_ID),c=r.useEventEmitter(yo.events.PROXY_URL_EVENT_ID);return(0,a.useCallback)(async(m,g)=>Zo.fetchEditorImageBlobByUrl(m,{appConfig:e,isStandalone:i,fireFileProxy:b=>d.fire({url:b,project:n}),fireProxyUrl:b=>c.fire({url:b,project:n})},g),[e,n,i,d,c])}var Ar=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),pi=({onChange:e,value:i,validateStatus:l,placeholder:s,disabled:n,name:d,elementSettings:c,imageInfo:m,previewReloadSignal:g,onRemotePreviewValidate:b})=>{const _=r.useCurrentUser(),h=r.useProjectData(),p=r.useAppConfig(),B=r.useIsStandalone(),{__:k}=r.useI18n();r.useSendPostMessage();const x=r.useSendPostMessageEx(),{openImagePicker:R}=r.useImagePicker(),j=r.useStorageProvider(),N=r.useRestClient(),E=h?.id!==void 0?String(h?.id):"",I=_?.id!=="0"?String(_.id):"",{dataProvider:$}=(0,a.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:j,projectId:E,restApi:N,i18n:{__:k},pathPostfix:I,appConfig:p,isStandalone:B}),[p,B,E,N,j,I,k]),U=Pr(),[v]=r.useLazyGetImageInfoQuery(),[L,P]=(0,a.useState)({width:"",height:"",size:""}),[z,le]=(0,a.useState)(!1),[C,re]=(0,a.useState)(0),[ae,_e]=(0,a.useState)(""),Te=(0,a.useRef)(""),te=(0,a.useRef)(g?.counter||0),me=Zo.useImageBlobResolver(),je=(0,a.useRef)(""),ue=(0,a.useRef)(""),[Ve,Le]=(0,a.useState)(0),ve=r.usePlanFeatureGate("image_editor"),he=()=>{je.current&&(URL.revokeObjectURL(je.current),je.current="")};(0,a.useEffect)(()=>{if(!i){P({width:"",height:"",size:"",format:""}),Te.current="",_e(""),he();return}if(i.startsWith("data:")||i.startsWith("blob:")){he(),Te.current=i,_e(i),P({width:"",height:"",size:"",format:""});return}const V=r.stripEmVersionFromUrlString(i);ue.current=V;const M=Zo.canonicalImageUrlKey(V),Y=new AbortController;let X=!1;const ee=async Be=>{he();const Ee=Ve?r.appendEmVersionForPreviewReload(Be):Be;Te.current=Ee,_e(Ee);try{const{data:oe}=await v(V);return X||!oe?!1:(P({width:oe?.width,height:oe?.height,size:oe?.fileSize!=null?(oe.fileSize/1024).toFixed(0):"",format:Zo.normalizeImageFormatForDisplay(oe?.format)}),!0)}catch{return!1}},ne=async()=>{const Be=await me.resolve(M,Y.signal,U);if(X)return;const{width:Ee,height:oe}=await vr(Be);if(X)return;he();const D=URL.createObjectURL(Be);je.current=D,Te.current=D,_e(D),P({width:Ee,height:oe,size:(Be.size/1024).toFixed(0),format:Zo.normalizeImageFormatForDisplay(Be.type)})};return(async()=>{try{if(!B){const Be=await Cr($,V);if(Be?.previewUrl&&await ee(Be.previewUrl))return}await ne()}catch{X||(he(),Te.current="",_e(""),P({width:"",height:"",size:"",format:""}))}})(),()=>{X=!0,Y.abort()}},[i,$,U,v,B,me,Ve]);const be=(0,a.useCallback)(()=>{const V=ue.current;V&&me.abandonKey(Zo.canonicalImageUrlKey(V)),Le(Date.now())},[me]);(0,a.useEffect)(()=>{!g?.counter||g.name!==d||g.counter!==te.current&&(te.current=g.counter,be())},[d,g,be]),(0,a.useEffect)(()=>()=>he(),[]);const Z=!!i&&!_t(r.stripEmVersionFromUrlString(String(i))),K=async(V=null)=>{const M=d.startsWith("src"),Y=V||(M?r.MODALS.UPLOAD_IMAGE_MODAL:r.MODALS.UPLOAD_BACKGROUND_MODAL),X=r.stripEmVersionFromUrlString(i||""),ee=await R({kind:M?"img":"background",currentUrl:_t(X)?"":X,entryModal:Y});if(!ee?.url)return;const ne=X===r.stripEmVersionFromUrlString(ee.url);(!ne||ee.url!==i)&&e(ee.url),ee.meta?.mode==="save"&&ne&&(be(),M&&x(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(ee.url)}))},q=[{label:k("Upload"),key:"Upload",onClick:()=>K(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}];p.imageCenterStockEnabled&&q.push({label:k("Stock"),key:"Stock",onClick:()=>K(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_STOCK:r.MODALS.UPLOAD_BACKGROUND_MODAL_STOCK)}),p.imageCenterGifEnabled&&q.push({label:k("GIF"),key:"GIF",onClick:()=>K(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_GIF:r.MODALS.UPLOAD_BACKGROUND_MODAL_GIF)}),p.elementAIimageEnabled&&q.push({label:k("AI"),key:"AI",onClick:()=>K(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_AI:r.MODALS.UPLOAD_BACKGROUND_MODAL_AI)});const Q=()=>{le(!1)};return(0,o.jsxs)("div",{className:(0,ze.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:V=>{V.target?.closest(".upload-bg-image__edit")||V.target?.closest(".upload-bg-image__edit-menu")||V.target?.closest(".upload-bg-image__menu")||V.target?.closest(".inputGroup")||K(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)},children:[(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,popupRender:()=>p.imagePathDropdownEnabled?(0,o.jsx)("div",{className:"inputGroup",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image,size:20,strokeWidth:p.iconStrokeWidth,style:{verticalAlign:"text-top"}}),allowClear:!0,onChange:e,value:i,placeholder:s,name:d,disabled: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:V=>V.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:ae?(0,o.jsx)("img",{className:"upload-bg-image__uploader-img",src:ae,alt:"",onLoad:()=>{b&&Ar(r.stripEmVersionFromUrlString(i||""))&&b("success")},onError:()=>{const V=ue.current,M=r.stripEmVersionFromUrlString(ae||""),Y=r.stripEmVersionFromUrlString(V||"");if(V&&M!==Y){Te.current=V,_e(V);return}b&&Ar(Y)&&b("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"})})]})})}),L.width&&L.height?(0,o.jsxs)("div",{className:"image-size",children:[L.width," × ",L.height,!!c&&(c.type===r.ELEMENT_TYPES.IMG||c.type===r.ELEMENT_TYPES.CAROUSEL)&&" → "+m.renderedWidth+" × "+m.renderedHeight,(0,o.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,o.jsxs)("span",{children:[L.size," ",k("kB")]}),L.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:L.format})]})]}):(0,o.jsx)(t.ui_kit$Text,{type:"secondary",className:"image-empty-text",children:s})]})}),(0,o.jsx)("div",{style:{flexGrow:1}}),L.format!=="gif"&&p.imageCenterEditorEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:k("Edit"),children:(0,o.jsx)(t.ui_kit$Text,{type:"link",className:"upload-bg-image__edit",children:(0,o.jsx)(r.EmIcons,{icon:"Edit",component:t.icons$Edit,size:16,strokeWidth:p.iconStrokeWidth,onClick:()=>{ve.isLocked&&Z?(le(!0),re(r.FEATURE_UPSELL_SLIDE.image_editor)):K(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_EDIT:r.MODALS.UPLOAD_BACKGROUND_MODAL_EDIT)}})})}),(0,o.jsx)(t.ui_kit$Dropdown,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:q},classNames:{root:"upload-bg-image__menu"},children:(0,o.jsx)(t.ui_kit$Text,{type:"link",className:"upload-bg-image__edit-menu image-change",children:i?(0,o.jsx)(r.EmIcons,{size:16,strokeWidth:p.iconStrokeWidth,icon:"SyncOutlined",component:t.icons$SyncOutlined,onClick:()=>K(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:()=>K(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD),icon:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image,size:16,strokeWidth:p.iconStrokeWidth}),children:k("Add image")}),z&&(0,o.jsx)(r.PlanUpgradePrompt,{open:!0,onCancel:Q,initialSlide:C})]})};pi.propTypes={};var en=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),on=(e,i,l)=>i||(l?.type===r.ELEMENT_TYPES.CAROUSEL?["images",e]:Array.isArray(e)?e:[e]),Nr=e=>Array.isArray(e)?e.join("_"):e,$o=({form:e,label:i,name:l,watchPath:s,disabled:n=!1,elementSettings:d,previewReloadSignal:c=void 0})=>{const{token:m}=(0,t.ui_kit$useToken)(),[g,b]=(0,a.useState)("success"),_=(0,a.useMemo)(()=>({marginBottom:m.formItemMarginBottomXS}),[m.formItemMarginBottomXS]),h=t.ui_kit$Form.useWatch(on(l,s,d),e);return(0,a.useEffect)(()=>{if(!h){b("");return}if(typeof h=="string"&&(h.startsWith("data:")||h.startsWith("blob:"))){b("success");return}if(en(h)){b("validating");return}b("success")},[h]),(0,o.jsx)(t.ui_kit$Form.Item,{name:l,validateStatus:g,style:_,children:(0,o.jsx)(pi,{validateStatus:g,placeholder:i,name:Nr(l),disabled:n,elementSettings:d,imageInfo:d?.type===r.ELEMENT_TYPES.CAROUSEL?d?.carouselImages?.[Nr(l).split("_")[1]]:d,previewReloadSignal:c,onRemotePreviewValidate:b})})};$o.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},$o.defaulProps={disabled:!1,previewReloadSignal:null};var wo=({form:e,oneBorderRadiusValue:i,setOneBorderRadiusValue:l,elementSettings:s,namePrefix:n="",typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),m=d==="mobile",g=m?"mobileBorderRadius":"borderRadius",b=m?"mobileBorderRadiusAll":"borderRadiusAll",_=m?"mobileBorderRadiusTopLeft":"borderRadiusTopLeft",h=m?"mobileBorderRadiusTopRight":"borderRadiusTopRight",p=m?"mobileBorderRadiusBottomRight":"borderRadiusBottomRight",B=m?"mobileBorderRadiusBottomLeft":"borderRadiusBottomLeft",k=m?H.MOBILE_BORDER_RADIUS_POSITION:H.BORDER_RADIUS_POSITION,x=()=>{const R=e.getFieldsValue(!0);let j;i?(e.setFieldsValue({[_]:R[b]||null,[B]:R[b]||null,[h]:R[b]||null,[p]:R[b]||null}),j={[g]:{[k[_]]:R[b]||0,[k[B]]:R[b]||0,[k[h]]:R[b]||0,[k[p]]:R[b]||0}}):R[_]===R[B]&&R[_]===R[h]&&R[_]===R[p]?(e.setFieldsValue({[b]:R[_]}),j={[g]:{[k[b]]:R[_]}}):(e.setFieldsValue({[_]:null,[B]:null,[h]:null,[p]:null}),j={[g]:{[k[b]]:0,[k[_]]:0,[k[B]]:0,[k[h]]:0,[k[p]]:0}});const N=m?{mobileBorderRadius:{all:R.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:N}),l(E=>!E)};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"})})};wo.displayName="SelectedElementFormBorderRadius";var tn="em-mob-text_align-",rn=({value:e,onChange:i,onSync:l,fieldName:s,...n})=>{const d=(typeof e=="object"?e?.value:e)??"",c=m=>{const g={classNamePrefix:tn,value:m};i?.(g),l?.({[s]:g})};return(0,o.jsx)(t.ui_kit$FormAlignControl,{value:d,onChange:c,...n})},zo=({form:e,elementSettings:i,imgParent:l=!1,name:s="align",tooltipTitle:n,typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),m=r.useAppConfig(),g=d==="mobile",b=g?"mobileAlign":s;if(g){const _=h=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:h})};return(0,o.jsx)(t.ui_kit$Form.Item,{name:b,children:(0,o.jsx)(rn,{fieldName:b,onSync:_,disabled:l&&!i.parent,strokeWidth:m.iconStrokeWidth,tooltipTitle:n})})}return(0,o.jsx)(t.ui_kit$Form.Item,{name:b,children:(0,o.jsx)(t.ui_kit$FormAlignControl,{disabled:l&&!i.parent,strokeWidth:m.iconStrokeWidth,tooltipTitle:n})})},Do=({form:e,elementSettings:i,tooltipTitle:l,disabled:s=!1,isNewIconType:n=!1,typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),m=r.useAppConfig(),g=d==="mobile",b=g?"mobileVerticalAlign":"valign",_=h=>{e.setFieldsValue({[b]:h}),g||c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[b]:h}})};return(0,o.jsx)(t.ui_kit$Form.Item,{name:b,children:(0,o.jsx)(t.ui_kit$FormVerticalAlignControl,{...!g&&{value:i.valign,onChange:_},disabled:s,isNewIconType:n,strokeWidth:m.iconStrokeWidth})})},ln=["mobileBoxShadowHOffset","mobileBoxShadowVOffset","mobileBoxShadowBlurRadius","mobileBoxShadowSpreadRadius","mobileBoxShadowColor","mobileBoxShadowInset"],sn=({form:e,elementSettings:i,enableSwitch:l,usedColors:s,withoutShadowLabel:n})=>{const d=r.useSendPostMessage(),c=i.mobileBoxShadow,[m,g]=(0,a.useState)(!c||c.hOffset===0&&c.vOffset===0&&c.blurRadius===0&&c.spreadRadius===0),b=t.ui_kit$Form.useWatch(ln,e);(0,a.useEffect)(()=>{if(!b)return;const[h,p,B,k,x,R]=b;(h===0||h===void 0||h===null)&&(p===0||p===void 0||p===null)&&(B===0||B===void 0||B===null)&&(k===0||k===void 0||k===null)&&(x===""||x===void 0||x===null)&&(R===!1||R===void 0)||g(!1)},[b]);const _=()=>{g(h=>!h),e.setFieldsValue({mobileBoxShadowHOffset:m?"":0,mobileBoxShadowVOffset:m?"":0,mobileBoxShadowBlurRadius:m?"":0,mobileBoxShadowSpreadRadius:m?"":0,mobileBoxShadowColor:"",mobileBoxShadowInset:!1}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBoxShadow:{classNamePrefix:"em-mob-box_shadow-",hOffset:m?null:0,vOffset:m?null:0,blurRadius:m?null:0,spreadRadius:m?null:0,color:null,inset:!1}}})};return(0,o.jsxs)(o.Fragment,{children:[l&&(0,o.jsx)("div",{style:{float:"right",marginTop:-9,marginRight:50},children:(0,o.jsx)(t.ui_kit$Switch,{id:"without-shadow",label:n,labelSize:"small",size:"small",checked:m,onChange:_})}),(0,o.jsx)("p",{style:{paddingBottom:"8px",margin:"-30px 0 0"},children:" "}),(0,o.jsx)(t.ui_kit$FormBoxShadowInputs,{typeOfForm:"mobile",usedColors:s})]})},Po=({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)(sn,{form:i,elementSettings:l,enableSwitch:s,usedColors:d,withoutShadowLabel:n("Without shadow")}):(0,o.jsx)(t.ui_kit$FormBoxShadowInputs,{typeOfForm:e,usedColors:d})};Po.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})})})]})})})})},hi=({form:e,elementSettings:i,handleChangeValues:l})=>{const{__:s}=r.useI18n(),n=(0,a.useRef)(),{token:d}=(0,t.ui_kit$useToken)(),[c,m]=(0,a.useState)(!1),[g,b]=(0,a.useState)(!1),[_,h]=(0,a.useState)(!1),[p,B]=(0,a.useState)(!1),[k,x]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let P=new URL("https://emailmaker.ru/?"+i.countdown);m(P.searchParams.get("font1").endsWith("-b")||P.searchParams.get("font1").endsWith("-bi")),b(P.searchParams.get("font1").endsWith("-i")||P.searchParams.get("font1").endsWith("-bi")),h(P.searchParams.get("font2").endsWith("-b")||P.searchParams.get("font2").endsWith("-bi")),B(P.searchParams.get("font2").endsWith("-i")||P.searchParams.get("font2").endsWith("-bi")),x(P.searchParams.get("tp")==="true")},[i]);const R=[{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")}],N=[{value:"arial",label:"Arial"},{value:"courier-new",label:"Courier New"},{value:"georgia",label:"Georgia"},{value:"helvetica",label:"Helvetica"},{value:"tahoma",label:"Tahoma"},{value:"times-new-roman",label:"Times New Roman"},{value:"trebuchet-ms",label:"Trebuchet MS"},{value:"verdana",label:"Verdana"},{value:"open-sans",label:"Open Sans"},{value:"roboto",label:"Roboto"}],E=P=>P&&P<(0,dt.default)().endOf("day")-864e5,I=P=>{x(P)},$=()=>{const P=!c;e.setFieldValue("countdownNumbersStrong",P),l({countdownNumbersStrong:P}),m(P)},U=()=>{const P=!g;e.setFieldValue("countdownNumbersItalic",P),l({countdownNumbersItalic:P}),b(P)},v=()=>{const P=!_;e.setFieldValue("countdownLabelsStrong",P),l({countdownLabelsStrong:P}),h(P)},L=()=>{const P=!p;e.setFieldValue("countdownLabelsItalic",P),l({countdownLabelsItalic:P}),B(P)};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:E,showTime:!0,placement:"bottomRight",getPopupContainer:P=>{const z=P?.closest(".blocks-app");return z||(P?.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:R.map(P=>(0,o.jsx)(t.ui_kit$Select.Option,{value:P.value,children:P.label},P.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:I})})})]}),(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:N})})}),(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,ze.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":c}),onClick:$,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,ze.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":g}),onClick:U,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:N})})}),(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,ze.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":_}),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:"countdownLabelsItalic",children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":p}),onClick:L,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})})})]})]})};hi.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string};var bi=({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")]})]})})]})};bi.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string};var an={marginBottom:10},No=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(t.ui_kit$Row,{gutter:20,style:an,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:gi}=t.ui_kit$Select,{mobileBorderRadiusAll:nn,mobileBorderRadiusTopLeft:fi,mobileBorderRadiusBottomLeft:_i,mobileBorderRadiusTopRight:xi,mobileBorderRadiusBottomRight:ki,borderRadiusBottomRight:Ei,borderRadiusTopRight:Bi,borderRadiusBottomLeft:Si,borderRadiusTopLeft:Ti,alt:dn,src:cn,title:un,link:ct,borderRadiusAll:Lr,imgReplacer:mn,expanded:pn}={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"},et=({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})}},hn=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")}],ot=({handleLinkProtocolsChange:e,linkProtocol:i,__:l})=>{const s=a.default.useMemo(()=>hn(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})},tt=({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},Ri=e=>!(!e.startsWith("#")||e.indexOf("#",1)!==-1),bn=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*(["'])((?:\\.|(?!\1).)*?)\1(?:\s*\/?>)?\s*$/i,gn=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*([^\s/>]+)(?:\s*\/?>)?\s*$/i;function it(e){if(typeof e!="string")return e;let i=e.trim();if(!i)return i;const l=i.match(bn);if(l)i=l[2];else{const s=i.match(gn);s&&(i=s[1])}return i.startsWith("https://http")&&(i=i.substring(8)),i}var Ot=(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://":Ri(e)?"#":"":i,Wo=(e,i)=>{const l=Ot(e,"");return i(l),l},Or=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]}}},yi=(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":""),xo=e=>e&&e!=="auto"?e:e===0?"0":"",$r=(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 wi(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 Fr(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 m={};const g=i.getFieldsValue(!0);switch(d.split("_")[0]){case un:case cn:case dn:case mn:if(s){const _=[...e.carouselImages];_[d.split("_")[1]][d.split("_")[0]]=c[d],m={carouselImages:_}}else m=c;break;case pn:if(n){const _=[...e.sections];_[d.split("_")[1]][d.split("_")[0]]=c[d],m={sections:_}}break;case ct:let b=it(c[d]);e.type===r.ELEMENT_TYPES.CAROUSEL?(m.carouselImages=e.carouselImages,s?(i.setFieldValue(["images",[ct+"_"+d.split("_")[1]]],b),m.carouselImages[d.split("_")[1]].link=b,m.link="",i.setFieldValue(ct,"")):(e.carouselImages.forEach((_,h)=>{i.setFieldValue(["images",ct+"_"+h],b),m.carouselImages[h].link=b,m.link=b}),i.setFieldValue(ct,b))):(i.setFieldValue(ct,b),m.link=b);break;case Lr:m={borderRadius:{...e.borderRadius,[H.BORDER_RADIUS_POSITION[Ti]]:g[Ti],[H.BORDER_RADIUS_POSITION[Si]]:g[Si],[H.BORDER_RADIUS_POSITION[Bi]]:g[Bi],[H.BORDER_RADIUS_POSITION[Ei]]:g[Ei],[H.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case Ti:case Si:case Bi:case Ei:m={borderRadius:{...e.borderRadius,[H.BORDER_RADIUS_POSITION[Lr]]:null,[H.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case nn:case fi:case _i:case xi:case ki:m={mobileBorderRadius:{...e.mobileBorderRadius,[H.MOBILE_BORDER_RADIUS_POSITION[fi]]:g[fi],[H.MOBILE_BORDER_RADIUS_POSITION[_i]]:g[_i],[H.MOBILE_BORDER_RADIUS_POSITION[xi]]:g[xi],[H.MOBILE_BORDER_RADIUS_POSITION[ki]]:g[ki],[H.MOBILE_BORDER_RADIUS_POSITION[d]]:c[d],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[d]+"-"}};break;default:m=c}return{...e,...m}}var Fo=(0,o.jsxs)(t.ui_kit$Select,{className:"select-after",children:[(0,o.jsx)(gi,{value:"px",children:"px"}),(0,o.jsx)(gi,{value:"%",children:"%"})]}),fn=(0,o.jsx)(t.ui_kit$Select,{className:"select-after",children:(0,o.jsx)(gi,{value:"px",children:"px"})}),Mr=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:n,boxShadowShow:d,oneBorderRadiusValue:c,setOneBorderRadiusValue:m,hasLink:g,hasAlt:b,hasTitle:_,isOpenSrcReplacer:h,mergeTagItems:p,mergeMenuOpen:B,setMergeMenuOpen:k,cascaderRef:x,linkInputRef:R,linkButtonRef:j,altInputRef:N,altButtonRef:E,titleInputRef:I,titleButtonRef:$,srcReplacerInputRef:U,srcReplacerButtonRef:v,linkProtocol:L,handleLinkProtocolsChange:P,linkButtonHandler:z,linkInputHandler:le,altButtonHandler:C,altInputHandler:re,titleButtonHandler:ae,titleInputHandler:_e,srcReplacerButtonHandler:Te,srcInputHandler:te,handleSelect:me,onChange:je,filter:ue,renderSearchOption:Ve,handleChangeValues:Le,toggleShowBorderHandler:ve,toggleShowBorderRadiusHandler:he,toggleShowBoxShadowHandler:be})=>{const{__:Z}=r.useI18n(),{token:K}=(0,t.ui_kit$useToken)(),q=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(zo,{form:e,elementSettings:i,imgParent:!0})}),q.formImageFieldVerticalAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,align:"right",children:(0,o.jsx)(Do,{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)(hi,{form:e,elementSettings:i,handleChangeValues:Le}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),q.mergeTagsShow&&p&&(0,o.jsx)(t.ui_kit$Col,{span:24,id:"merge_tags_wrapper",children:(0,o.jsxs)(t.ui_kit$Form.Item,{style:{marginBottom:24},children:[(0,o.jsx)(t.ui_kit$Button,{id:"merge_tags_button",icon:(0,o.jsx)(r.EmIcons,{icon:"MergeTags",component:t.icons$MergeTags}),style:{width:"100%",display:B?"none":"inline-flex"},onClick:()=>k(!0),children:Z("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:x,classNames:{popup:{root:"merge-tags"}},options:p,placeholder:Z("Start typing the title"),showSearch:{filter:ue,render:Ve},spellCheck:"false",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),onChange:je,style:{display:B?"block":"none"},open:B,onKeyDown:Q=>{Q.key==="Escape"&&k(!1)}})]})}),i.type==="video"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(bi,{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)($o,{form:e,label:Z("Image path"),name:"src",placeholder:Z("Image path"),elementSettings:i,tooltipTitle:""})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,style:{marginBottom:!b&&!g&&!_&&!h?K.formItemMarginBottomMD+4:K.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:b||Z("Alternative text"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.default)("selected-td-form__button",{"selected-td-form__button--active":!!b}),onClick:C,ref:E,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),q.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:_||Z("Tooltip text"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.default)("selected-td-form__button",{"selected-td-form__button--active":!!_}),onClick:ae,ref:$,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:g||Z("Hyperlink URL"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.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:z,ref:j})}),q.formImageFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:Z("Image replacer"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.default)("selected-td-form__button",{"selected-td-form__button--active":h}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:Te,ref:v})})]}),(!!g||!!b||!!_||!!h)&&(0,o.jsxs)("div",{style:{marginBottom:K.formItemMarginBottomMD+4},children:[!!g&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(tt,{show:L==="#",__:Z,style:{marginBottom:K.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:"link",className:"selected-image-form__alt",style:{marginBottom:K.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(ot,{linkProtocol:L,handleLinkProtocolsChange:P,__:Z}),placeholder:Z("Hyperlink URL"),allowClear:!0,ref:R,onChange:le,onSelect:me,prefix:(0,o.jsx)(et,{linkProtocol:L})})})})]}),!!b&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Z("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:K.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:Z("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:re,ref:N,onSelect:me})})}),q.formFieldImageTitleEnabled&&!!_&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Z("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:K.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:Z("Enter the title of the image"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:_e,ref:I,onSelect:me})})}),!!h&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Z("Image src"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"imgReplacer",className:"selected-image-form__alt",style:{marginBottom:K.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:Z("Code that will replace the image `src`"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:Z("Image src")}),onChange:te,ref:U,onSelect:me})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:Z("Size"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:i.maxWidth,showHeight:q.formImageFieldHeightEnabled,showMinMax:!1,gutter:K.marginSM,rowStyle:{marginBottom:q.formImageFieldHeightEnabled?4:24},labels:{width:Z("Width"),height:Z("Height"),minWidth:Z("Minimum width"),maxWidth:Z("Maximum width")}})}),q.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Z("Borders"),collapsible:!0,open:s,onToggle:ve,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e,elementSettings:i})}),q.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Z("Border radius"),collapsible:!0,open:n,onToggle:he,dividerTop:!0,children:(0,o.jsx)(wo,{form:e,oneBorderRadiusValue:c,setOneBorderRadiusValue:m,elementSettings:i})}),q.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Z("Box shadow"),collapsible:!0,open:d,onToggle:be,dividerTop:!0,children:(0,o.jsx)(Po,{})}),q.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Z("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e})}),q.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:Z("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(No,{})})]})};Mr.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 Go=({form:e,name:i,elementSettings:l,isPicture:s,tooltipTitle:n})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),m=(0,a.useRef)(),[g,b]=(0,a.useState)(l[i]?.value==="auto"),{token:_}=(0,t.ui_kit$useToken)(),[h,p]=(0,a.useState)(""),B=x=>{e.setFieldsValue({[i]:"",[i+"Dim"]:"px"}),b(R=>!R),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=>{b(!1),p(e.getFieldsValue(!0)[i+"Dim"]==="%"?100:"")};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:m,min:0,max:h,placeholder:d("Width"),onChange:k,prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:(0,o.jsx)(t.ui_kit$Form.Item,{name:i+"Dim",noStyle:!0,children:Fo})})})})}),!s&&(0,o.jsx)(t.ui_kit$Switch,{id:"auto-width",label:d("Auto"),labelSize:"small",size:"small",checked:g,onChange:B})]})};Go.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string};var rt=({form:e,name:i,elementSettings:l,isPicture:s,tooltipTitle:n})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),m=(0,a.useRef)(),[g,b]=(0,a.useState)(l.mobileHeight?.value==="auto"),{token:_}=(0,t.ui_kit$useToken)(),h=B=>{e.setFieldsValue({mobileHeight:"",mobileHeightDim:"px"}),b(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:""}}})},p=B=>{b(!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:m,min:0,placeholder:d("Height"),onChange:p,prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})}),!s&&(0,o.jsx)(t.ui_kit$Switch,{id:"auto-height",label:d("Auto"),labelSize:"small",size:"small",checked:g,onChange:h})]})};rt.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string};var Dr=({form:e,elementSettings:i,handleChangeValues:l,boxShadow:s,mobileBordersShow:n,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:m,oneMobileBorderRadiusValue:g,setOneMobileBorderRadiusValue:b,hasLink:_,hasAlt:h,hasTitle:p,linkInputRef:B,linkButtonRef:k,altInputRef:x,altButtonRef:R,titleInputRef:j,titleButtonRef:N,linkInputHandler:E,altButtonHandler:I,altInputHandler:$,titleButtonHandler:U,titleInputHandler:v,linkButtonHandler:L,toggleShowMobileBorderHandler:P,toggleShowMobileBorderRadiusHandler:z,toggleShowMobileBoxShadowHandler:le,toggleShowMobileSizeHandler:C})=>{const{__:re}=r.useI18n(),{token:ae}=(0,t.ui_kit$useToken)(),_e=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)(zo,{form:e,elementSettings:i,imgParent:!0,typeOfForm:"mobile"})}),_e.formImageFieldVerticalAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,align:"right",children:(0,o.jsx)(Do,{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)(hi,{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)(bi,{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)($o,{form:e,label:re("Image path"),name:"src",placeholder:re("Image path"),elementSettings:i,tooltipTitle:""})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,style:{marginBottom:!h&&!_&&!p?ae.formItemMarginBottomMD+4:ae.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:h||re("Alternative text"),placement:"bottom",getPopupContainer:Te=>Te.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.default)("selected-td-form__button",{"selected-td-form__button--active":!!h}),onClick:I,ref:R,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),_e.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:p||re("Tooltip text"),placement:"bottom",getPopupContainer:Te=>Te.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.default)("selected-td-form__button",{"selected-td-form__button--active":!!p}),onClick:U,ref:N,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:_||re("Hyperlink URL"),placement:"bottom",getPopupContainer:Te=>Te.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.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:L,ref:k})})]}),(!!_||!!h||!!p)&&(0,o.jsxs)("div",{style:{marginBottom:ae.formItemMarginBottomMD+4},children:[!!_&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:re("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:ae.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{ref:B,allowClear:!0,placeholder:re("Hyperlink URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined}),onChange:E})})}),!!h&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:re("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:ae.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:re("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:$,ref:x})})}),_e.formFieldImageTitleEnabled&&!!p&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:re("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:ae.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:re("Tooltip text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:v,ref:j})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:re("Size"),collapsible:!0,open:m,onToggle:C,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)(Go,{form:e,name:"mobileWidth",elementSettings:i,isPicture:"true",tooltipTitle:re("Width")})}),_e.formImageFieldHeightEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(rt,{form:e,name:"mobileHeight",elementSettings:i,isPicture:"true",tooltipTitle:re("Height")})})]})}),_e.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:re("Borders"),collapsible:!0,open:n,onToggle:P,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),_e.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:re("Border radius"),collapsible:!0,open:d,onToggle:z,dividerTop:!0,children:(0,o.jsx)(wo,{form:e,oneBorderRadiusValue:g,setOneBorderRadiusValue:b,elementSettings:i,typeOfForm:"mobile"})}),_e.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:re("Box shadow"),collapsible:!0,open:c,onToggle:le,dividerTop:!0,children:(0,o.jsx)(Po,{typeOfForm:"mobile"})}),_e.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:re("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e})}),_e.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:re("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(No,{})})]})};Dr.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 _n=e=>typeof e=="object"&&e!==null?e.path:void 0;function Mo(){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(_n(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 ut(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)},[])}}var Vr=2e3;function Hr(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(),m=l.current.filter(g=>c-g.at<Vr);m.push({key:JSON.stringify(n.current(d)),at:c}),l.current=m.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(),m=JSON.stringify(n.current(d)),g=l.current.filter(h=>c-h.at<Vr);if(!i)return g.some(h=>h.key===m);const b=s.current.get(d);if(b!==void 0)return b;const _=g.findIndex(h=>h.key===m);return _>=0&&(l.current=g.slice(_)),s.current.set(d,_>=0),_>=0},[i]),forget:(0,a.useCallback)(()=>{l.current=[],s.current=new WeakMap},[])}}var xn=1e3,kn=2e4,Ur="https://useblocks.io/app/",En=["activateSection","changeKey","parent","path","nextElem","prevElem"];function ji(e){if(Array.isArray(e))return e.map(ji);if(e&&typeof e=="object"){const i=e;return Object.fromEntries(Object.keys(i).sort().map(l=>[l,ji(i[l])]))}return e}function Bn(e){const i={...e};return En.forEach(l=>delete i[l]),ji(i)}var zr=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm(),s=Mo(),n=Mo();let d=r.useDispatch();const c=r.useAppConfig(),m=r.useEditorProjectId(),g=r.useNotification(),b=r.useSendPostMessage(),_=r.useSendPostMessageEx(),{openImagePicker:h}=r.useImagePicker(),p=r.useSelector(r.selectEmailViewType),B=r.useSelector(r.selectMobileViewActive),k=r.useCurrentUser(),x=r.useSelector(r.selectIsCodeMode),R=r.useSelector(r.selectCodeModeDirection),[j]=r.useUploadImageMutation(),[N,E]=r.useSendShortLinkMutation(),[I,$]=(0,a.useState)({name:"",counter:0}),U=(0,a.useRef)(null),v=(0,a.useRef)(null),L=(0,a.useRef)(null),P=(0,a.useRef)(null),z=(0,a.useRef)(null),le=(0,a.useRef)(null),C=(0,a.useRef)(null),re=(0,a.useRef)(null),ae=(0,a.useRef)(null),[_e,Te]=(0,a.useState)({}),[te,me]=(0,a.useState)(!0),[je,ue]=(0,a.useState)(!0),[Ve,Le]=(0,a.useState)(""),[ve,he]=(0,a.useState)(""),[be,Z]=(0,a.useState)(""),[K,q]=(0,a.useState)(!1),[Q,V]=(0,a.useState)(!1),[M,Y]=(0,a.useState)(!1),[X,ee]=(0,a.useState)(!1),[ne,Be]=(0,a.useState)(!1),[Ee,oe]=(0,a.useState)(!1),[D,ie]=(0,a.useState)(!1),[we,W]=(0,a.useState)(!1),[Se,Oe]=(0,a.useState)("https://"),Ae=(0,a.useRef)(!1),Ge=(0,a.useRef)(),Ye=e,Ze=(0,a.useRef)(Ye);Ze.current=Ye;const de=(0,a.useCallback)(()=>l.getFieldsValue(!0).video,[l]),[Ce,G]=(0,a.useState)(),[pe,Pe]=(0,a.useState)(!1),[We,to]=(0,a.useState)(null),[eo,no]=(0,a.useState)({start:0,end:0}),[O,se]=(0,a.useState)(!1),[w,y]=(0,a.useState)(!1),[ce,Ie]=(0,a.useState)(!1),[Xe,oo]=(0,a.useState)(!1),po=(0,a.useRef)(void 0),co=(0,a.useRef)(null),_o=(0,a.useRef)(null),Io=Xe||ce||we;(0,a.useEffect)(()=>()=>clearTimeout(po.current),[]);const Co=(0,a.useRef)(null);(0,a.useEffect)(()=>{const A=Co.current,Ne=A?.firstElementChild??null;if(!Io||!A||!Ne)return;const xe=[];for(let io=A.parentElement;io;io=io.parentElement)getComputedStyle(io).overflowY!=="visible"&&xe.push(io);let ke=0,$e="";const Je=()=>{const io=A.getBoundingClientRect(),ko=A.offsetHeight>0?io.height/A.offsetHeight:1;let Eo=Math.max(io.top,0),ao=Math.min(io.bottom,window.innerHeight);xe.forEach(Qo=>{const ft=Qo.getBoundingClientRect();Eo=Math.max(Eo,ft.top),ao=Math.min(ao,ft.bottom)});const go=(Eo-io.top)/(ko||1),Ro=Math.max(ao-Eo,0)/(ko||1),vo=`${Math.round(go)}/${Math.round(Ro)}`;vo!==$e&&($e=vo,Ne.style.top=`${go}px`,Ne.style.height=`${Ro}px`),ke=requestAnimationFrame(Je)};return Je(),()=>cancelAnimationFrame(ke)},[Io]);const F=()=>{const A=co.current;_o.current=A?.isConnected&&typeof A.selectionStart=="number"?{element:A,start:A.selectionStart,end:A.selectionEnd??A.selectionStart}:null},J=x&&R!=="bottom",ye=r.useElementEntityKind();(0,a.useEffect)(()=>{pe&&ae.current&&ae.current.focus()},[pe]);const Me=(A,Ne)=>{const xe=document.getElementById(Ne);if(xe){const ke=Ne.substring(Ne.indexOf("selected_image_form_")+20),$e=xe.value?.substring(0,eo.start),Je=xe.value?.substring(eo.end);b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{...e,[ke]:$e+A+Je}}),l.setFieldValue(ke,$e+A+Je),xe.focus(),setTimeout(()=>{xe.selectionStart=eo.start,xe.selectionEnd=eo.start+A.length},400),se(!0)}},ge=r.useAppConfig().mergeTags;(0,a.useEffect)(()=>{ge?.items?.length&&G(r.mapMargeTags(ge.items))},[ge,G]);const He=(A,Ne)=>{if(Pe(!1),A){const xe=ge.syntax.length>1?Ce.findIndex($e=>$e.key===Ne[0].key):0,ke=ge.syntax[xe].replace("%value%",A[A.length-1]);We?.getAttribute("id")==="selected_image_form_title"||We?.getAttribute("id")==="selected_image_form_alt"||We?.getAttribute("id")==="selected_image_form_link"||We?.getAttribute("id")==="selected_image_form_imgReplacer"?Me(ke,We?.getAttribute("id")):(l.setFieldValue("imgReplacer",ke),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:ke}}))}},Ke=(A,Ne)=>Ne.some(xe=>xe.label.toLowerCase().indexOf(A.toLowerCase())>-1),Fe=(A,Ne)=>{const xe=Ne.map((ke,$e)=>{const Je=ke.label.split(new RegExp(`(${A})`,"gi"));return(0,o.jsxs)("span",{children:[$e!==0&&(0,o.jsx)("span",{children:" / "}),Je.map((io,ko)=>io.toLowerCase()===A.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:io},ko):io)]},ke.value)});return(0,o.jsx)("div",{title:Ne.map(ke=>ke.label).join(" / "),children:xe})},qe=r.useRootElement();(0,a.useEffect)(()=>{const A=({target:ke})=>{ke.closest('[id="merge_tags_wrapper"]')||(co.current=ke,to(ke))},Ne=({target:ke})=>{!ke.closest(".merge-tags")&&!ke.closest("#merge_tags_button")&&Pe(!1)},xe=new yo.Disposable;return xe.addDisposable(r.addWindowListenerFromShadow(qe,"focusin",A)),xe.addDisposable(r.addWindowListenerFromShadow(qe,"click",Ne)),()=>{xe.dispose()}},[qe]);const so=({target:A})=>{if(A&&!O){const{selectionStart:Ne,selectionEnd:xe}=A;no({start:Ne,end:xe})}se(!1)},To=e.border,T=e.mobileBorder,fe=Object.keys(To).find(A=>To[A]?.width||To[A]?.style||To[A]?.color),S=Object.keys(T).find(A=>T[A]?.width||T[A]?.style||T[A]?.color),Re=A=>A&&(A?.width||A?.style||A?.color)?A:"",{remember:De,fillFields:mo}=ut(e),{remember:Ue,isOwnEcho:Uo,forget:gt}=Hr(Bn,{ordered:!0}),Jo=(0,a.useRef)(void 0);(0,a.useEffect)(()=>{if(e){const A=e.path;A!==Jo.current&&(Jo.current=A,gt());const Ne=Uo(e)?()=>{}:mo;e.src!==Ge.current&&(Ge.current=e.src,Ae.current=!1);const xe=e.boxShadow;if(Te(xe),e.link&&Oe(Ot(e.link,"https://")),Ne(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:Re(e.mobileBorder.all)||!(Re(e.mobileBorder.top)||Re(e.mobileBorder.bottom)||Re(e.mobileBorder.right)||Re(e.mobileBorder.left))&&Re(e.border.all),mobileBorderTop:Re(e.mobileBorder.top)||!Re(e.mobileBorder.all)&&Re(e.border.top),mobileBorderBottom:Re(e.mobileBorder.bottom)||!Re(e.mobileBorder.all)&&Re(e.border.bottom),mobileBorderRight:Re(e.mobileBorder.right)||!Re(e.mobileBorder.all)&&Re(e.border.right),mobileBorderLeft:Re(e.mobileBorder.left)||!Re(e.mobileBorder.all)&&Re(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:xo(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:xo(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:xo(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:xo(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",...Ye.video}}),e.countdown){let Je=new URL("https://emailmaker.ru/?"+e.countdown),io=Je.searchParams.get("font1"),ko=!1,Eo=!1;io.endsWith("-b")?(io=io.substring(0,io.length-2),ko=!0):io.endsWith("-i")?(io=io.substring(0,io.length-2),Eo=!0):io.endsWith("-bi")&&(io=io.substring(0,io.length-3),ko=!0,Eo=!0);let ao=Je.searchParams.get("font2"),go=!1,Ro=!1;ao.endsWith("-b")?(ao=ao.substring(0,ao.length-2),go=!0):ao.endsWith("-i")?(ao=ao.substring(0,ao.length-2),Ro=!0):ao.endsWith("-bi")&&(ao=ao.substring(0,ao.length-3),go=!0,Ro=!0),Ne(l,{countdownTime:(0,dt.default)(new Date(Date.parse(Je.searchParams.get("time"))+Je.searchParams.get("timezone")*36e5+new Date().getTimezoneOffset()/60*36e5).toISOString()),countdownDuration:Je.searchParams.get("frames")||20,countdownTimeZone:Je.searchParams.get("timezone"),countdownLanguage:Je.searchParams.get("locale").replace("-","_"),countdownBackgroundColor:"#"+Je.searchParams.get("bg"),countdownTransparency:Je.searchParams.get("tp")==="true"?"checked":"",countdownNumbersFont:io,countdownNumbersFontSize:Je.searchParams.get("size1")/2,countdownNumbersFontSizeDim:"px",countdownNumbersColor:"#"+Je.searchParams.get("color1"),countdownLabelsFont:ao,countdownLabelsFontSize:Je.searchParams.get("size2")/2,countdownLabelsFontSizeDim:"px",countdownLabelsColor:"#"+Je.searchParams.get("color2"),countdownNumbersStrong:ko,countdownNumbersItalic:Eo,countdownLabelsStrong:go,countdownLabelsItalic:Ro})}!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?me(!1):me(!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))?ue(!1):ue(!0);const ke=s.isStaleBorderSnapshot(e,!!fe),$e=n.isStaleBorderSnapshot(e,!!S);ke&&l.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),($e||ke&&!S)&&l.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),q(Je=>fe&&!ke?!0:Je),V(Je=>fe&&!ke||S&&!$e?!0:Je),Y(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),ee(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight||!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),Be(!!e.boxShadow),oe(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),ie(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value||!!e.height.value),e.link?Le(e.link):Le(Ae.current?"...":""),he(e.alt),Z(e.title),y(e.imgReplacer?.length)}},[l,e,mo,Uo,gt,Ye,fe,S,s,n]),(0,a.useEffect)(()=>{if(Io)return;const A=_o.current;_o.current=null,!(!A||!A.element.isConnected||A.element.disabled)&&co.current===A.element&&(A.element.focus(),A.element.setSelectionRange(A.start,A.end))},[Io]);const Rr=async(A,Ne,xe)=>{const ke={};ke.user_id=k.id,ke.folder=A,Ne&&(Ne=await r.prepareImageForEditorUpload(Ne,c),ke.file=Ne),xe&&(ke.page_url=xe);const $e=await j(ke);if($e.error)g.fromError("IMAGE_UPLOAD_ERROR",Ne,$e.error,!0);else{const Je=Qa.extractUploadResult($e.data);if(Je.error)return;if(Je.file_url)return Je.file_url}},Ua=(A,Ne)=>new Promise((xe,ke)=>{const $e=new Image,Je=new Image;$e.crossOrigin="Anonymous",Je.crossOrigin="Anonymous";let io=Ne?2:1;const ko=()=>{clearTimeout(ao),ke(new Error("video preview images are not loaded"))},Eo=()=>{io-=1,io===0&&(clearTimeout(ao),xe({frame:$e,button:Ne?Je:null}))},ao=setTimeout(ko,kn);$e.onload=Eo,$e.onerror=ko,$e.src=A,Ne&&(Je.onload=Eo,Je.onerror=ko,Je.src=Ne)}),za=(A,Ne,xe,ke)=>{const $e=document.createElement("canvas"),Je=$e.getContext("2d");if($e.width=A.width,$e.height=A.height,Je.clearRect(0,0,$e.width,$e.height),Je.drawImage(A,0,0,A.width,A.height),!Ne)return $e;const io=Math.min($e.width,$e.height);let ko;if(A.height>A.width)ko=.3;else{const ft=A.width/A.height;ko=Math.min(ke,.3+(ft-1)/(xe-1)*.1)}const Eo=io*ko,ao=Ne.width/Ne.height;let go,Ro;ao>=1?(go=Eo,Ro=Eo/ao):(Ro=Eo,go=Eo*ao);const vo=($e.width-go)/2,Qo=($e.height-Ro)/2;return Je.drawImage(Ne,vo,Qo,go,Ro),$e},Wa=A=>new Promise(Ne=>{A.toBlob(xe=>Ne(xe?new File([xe],"image.jpeg",{type:"image/jpeg"}):null),"image/jpg",1)}),Dm=async A=>{const Ne=l.getFieldsValue(!0).video?.playButton||e.video?.playButton;if(!(!A||!Ne||Ne==="none"||ce)){F(),Ie(!0);try{const{frame:xe,button:ke}=await Ua(A,`${Ur}${Ne}.png`),$e=await Wa(za(xe,ke,2,.4)),Je=$e&&await Rr(m,$e);if(!Je)return;b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Ze.current.type,settings:{src:Je}}),Ct({...Ze.current,src:Je,video:de()||Ze.current.video,activateSection:null,changeKey:"src"}),setTimeout(()=>{l.setFieldValue("src",Je)},100)}catch{}finally{Ie(!1)}}},Vm=async()=>{const A=de(),Ne=A?.source,xe=A?.playButton;if(!Ne)return;const ke=()=>de()?.source!==Ne;F(),oo(!0);try{const $e=await Rr("tmp",null,Ne);if(!$e||ke())return;const{frame:Je,button:io}=await Ua($e,xe&&xe!=="none"?`${Ur}${xe}.png`:null);if(ke())return;const ko=await Wa(za(Je,io,2.5,.35)),Eo=ko&&await Rr(m,ko);Eo&&!ke()&&wr(Eo)}catch{}finally{oo(!1)}},yr=A=>{clearTimeout(po.current),po.current=setTimeout(()=>{A()},xn)},Hm=()=>{const A=l.getFieldsValue(!0);let Ne=new URL("https://cdt3.useblocks.io/rndt?"+e.countdown),xe=A.countdownNumbersFont;A.countdownNumbersStrong&&A.countdownNumbersItalic?xe+="-bi":A.countdownNumbersStrong?xe+="-b":A.countdownNumbersItalic&&(xe+="-i");let ke=A.countdownLabelsFont;A.countdownLabelsStrong&&A.countdownLabelsItalic?ke+="-bi":A.countdownLabelsStrong?ke+="-b":A.countdownLabelsItalic&&(ke+="-i"),Ne.searchParams.set("time",new Date(A.countdownTime.$d-A.countdownTimeZone*36e5-new Date().getTimezoneOffset()/60*36e5).toISOString()),Ne.searchParams.set("bg",A.countdownBackgroundColor.substring(1)||"#FFFFFF"),Ne.searchParams.set("tp",!!A.countdownTransparency),Ne.searchParams.set("font1",xe),Ne.searchParams.set("size1",A.countdownNumbersFontSize*2||12),Ne.searchParams.set("color1",A.countdownNumbersColor.substring(1)||"#000000"),Ne.searchParams.set("font2",ke),Ne.searchParams.set("size2",A.countdownLabelsFontSize*2||8),Ne.searchParams.set("color2",A.countdownLabelsColor.substring(1)||"#959595"),Ne.searchParams.set("spacing",Math.round(A.countdownNumbersFontSize*.4)||5),Ne.searchParams.set("locale",A.countdownLanguage.replace("_","-")),Ne.searchParams.set("timezone",A.countdownTimeZone),Ne.searchParams.set("frames",A.countdownDuration),N({link:JSON.stringify({target:Ne.href})}),F(),W(!0)},Ct=(0,a.useCallback)(A=>{De(A),Ue(A),d(ye==="email"?r.setElementSettings$1(A):r.setElementSettings(A))},[d,ye,De,Ue]),wr=(0,a.useCallback)((A,Ne)=>{const xe=Ze.current,ke=r.stripEmVersionFromUrlString(xe.src||"")===r.stripEmVersionFromUrlString(A||"");(!ke||A!==xe.src)&&(b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:xe.type,settings:{src:A}}),Ct({...xe,src:A,...xe.type==="video"?{video:de()||xe.video}:{},activateSection:null,changeKey:"src"}),l.setFieldValue("src",A)),Ne?.mode==="save"&&ke&&($($e=>({name:"src",counter:$e.counter+1})),_(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(A)}))},[l,de,Ct,b,_]),Pt=(0,a.useCallback)(async A=>{const Ne=e.src||"",xe=r.stripEmVersionFromUrlString(Ne),ke=await h({kind:"img",currentUrl:_t(xe)?"":xe,entryModal:A});ke?.url&&wr(ke.url,ke.meta)},[wr,e.src,h]),jr=(A,...Ne)=>{const xe=l.getFieldsValue(!0),ke=Object.keys(A)[0];let $e;switch(ke){case"link":let Je=it(A[ke]);Je!==A[ke]&&l.setFieldValue("link",Je),$e={link:Je};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":$e={boxShadow:{hOffset:xe.boxShadowHOffset,vOffset:xe.boxShadowVOffset,blurRadius:xe.boxShadowBlurRadius,spreadRadius:xe.boxShadowSpreadRadius,color:xe.boxShadowColor,inset:xe.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":xe.borderPosition==="borderAll"?($e={border:{...r.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...xe.borderAll}}},l.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER})):xe.borderAll?.width||xe.borderAll?.style||xe.borderAll?.color?($e={border:{all:null,left:xe.borderAll,right:xe.borderAll,top:xe.borderAll,bottom:xe.borderAll,[H.REVERSE_BORDER_POSITIONS[ke]]:{...xe[ke],...A[ke]}}},l.setFieldsValue({borderAll:null,borderLeft:xe.borderAll,borderRight:xe.borderAll,borderTop:xe.borderAll,borderBottom:xe.borderAll,[ke]:{...xe[ke],...A[ke]}})):($e={border:{all:null,left:xe.borderLeft,right:xe.borderRight,top:xe.borderTop,bottom:xe.borderBottom,[H.REVERSE_BORDER_POSITIONS[ke]]:{...xe[ke],...A[ke]}}},l.setFieldsValue({border:$e.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(xe.mobileBorderPosition==="mobileBorderAll")$e={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...xe.mobileBorderAll,classNamePrefix:"em-mob-border_"+H.MOBILE_REVERSE_BORDER_POSITIONS[ke]+"-"}}},l.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER});else{const ao=H.MOBILE_REVERSE_BORDER_POSITIONS[ke],go={...xe[ke],...A[ke]},Ro=!go?.width&&!go?.style&&!go?.color;if(xe.mobileBorder?.all?.width||xe.mobileBorder?.all?.style||xe.mobileBorder?.all?.color){const vo=xe.mobileBorderAll;$e={mobileBorder:{all:null,left:vo,right:vo,top:vo,bottom:vo,[ao]:Ro?null:{...go,classNamePrefix:"em-mob-border_"+ao+"-"}}},l.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:vo,mobileBorderRight:vo,mobileBorderTop:vo,mobileBorderBottom:vo,[ke]:go})}else{const vo=e.mobileBorder||{},Qo=ft=>{const At=vo[ft];return At&&(At?.width||At?.style||At?.color)?At:null};$e={mobileBorder:{all:null,left:ao==="left"?Ro?null:{...go,classNamePrefix:"em-mob-border_left-"}:Qo("left"),right:ao==="right"?Ro?null:{...go,classNamePrefix:"em-mob-border_right-"}:Qo("right"),top:ao==="top"?Ro?null:{...go,classNamePrefix:"em-mob-border_top-"}:Qo("top"),bottom:ao==="bottom"?Ro?null:{...go,classNamePrefix:"em-mob-border_bottom-"}:Qo("bottom")}},l.setFieldsValue({[ke]:go})}}break;case"width":$e={[ke]:{value:A[ke],dim:xe.widthDim}};break;case"widthDim":$e={width:{value:xe.width,dim:A[ke]}};break;case"height":$e={[ke]:{value:A[ke],dim:xe.heightDim}};break;case"heightDim":$e={height:{value:xe.height,dim:A[ke]}};break;case"borderRadiusAll":$e={borderRadius:{[H.BORDER_RADIUS_POSITION[ke]]:+A[ke]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":$e={borderRadius:{topLeft:xe.borderRadiusTopLeft,bottomLeft:xe.borderRadiusBottomLeft,topRight:xe.borderRadiusTopRight,bottomRight:xe.borderRadiusBottomRight,[H.BORDER_RADIUS_POSITION[ke]]:+A[ke]}};break;case"mobileWidth":$e={[ke]:{classNamePrefix:"em-mob-width-",value:A[ke],dim:xe.mobileWidthDim}};break;case"mobileWidthDim":$e={mobileWidth:{classNamePrefix:"em-mob-width-",value:xe.mobileWidth||100,dim:A[ke]}};break;case"mobileHeight":$e={[ke]:{classNamePrefix:"em-mob-height-",value:A[ke],dim:xe.mobileHeightDim}};break;case"mobileHeightDim":$e={mobileHeight:{classNamePrefix:"em-mob-height-",value:xe.mobileHeight,dim:A[ke]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":$e={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[ke]]:A[ke],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[ke]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":$e={mobileBoxShadow:{hOffset:xe.mobileBoxShadowHOffset,vOffset:xe.mobileBoxShadowVOffset,blurRadius:xe.mobileBoxShadowBlurRadius,spreadRadius:xe.mobileBoxShadowSpreadRadius,color:xe.mobileBoxShadowColor,inset:xe.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":$e={[ke]:{classNamePrefix:"em-mob-text_align-",value:A[ke]}};break;case"mobileVerticalAlign":$e={[ke]:{classNamePrefix:"em-mob-vertical_align-",value:A[ke]}};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":yr(Hm);break;case"video":{const ao={...e.video,...xe.video,...A.video},go=ao.source??xe.link;yr(Vm),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"video",settings:{video:ao,link:go}}),Ct({...e,video:ao,link:go,activateSection:null,changeKey:"video"});break}case"src":const io=A[ke],ko=e.src,Eo=xe.video?.playButton||e.video?.playButton;if(e.type==="video"&&Eo&&Eo!=="none"&&!ce&&io&&(!ko||io!==ko)){yr(()=>Dm(io));return}$e=A;break;default:$e=A}ke!=="borderPosition"&&ke!=="mobileBorderPosition"&&ke.indexOf("countdown")===-1&&ke!=="video"&&(b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:$e}),ke!=="video"&&ke.indexOf("countdown")===-1&&ke!=="mobileBorderRadiusAll"&&ke!=="mobileBorderRadiusTopLeft"&&ke!=="mobileBorderRadiusTopRight"&&ke!=="mobileBorderRadiusBottomLeft"&&ke!=="mobileBorderRadiusBottomRight"&&Ct({...e,...$e,mobileBorderRadius:{...e.mobileBorderRadius,...$e?.mobileBorderRadius},activateSection:null,changeKey:ke}))};(0,a.useEffect)(()=>{E.isError&&(g.error(E),W(!1))},[E]),(0,a.useEffect)(()=>{if(E.isSuccess&&we){if(E.data.data?.status===400)g.error({title:E.data.code,description:E.data.message});else{let A=new URL(E.data.target),Ne={countdown:{link:E.data.link,params:A.search.substring(1)}};b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ne})}W(!1)}},[E,we,e,g,b]);const Um=A=>{A.data.operation===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(d(r.closeSecondModal()),d(r.closeModal$1()))};r.useListenPostMessage(Um),r.useImageControlRequest(e.src,A=>{A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?Pt(r.MODALS.UPLOAD_IMAGE_MODAL_AI):A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?Pt(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?Pt(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?Pt(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):A===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP&&Pt(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK)});const zm=()=>{const A=l.getFieldsValue(!0);s.markBorderToggled(!K),setTimeout(()=>{q(Ne=>!Ne),K?(A.borderAll=H.NULL_BORDER,A.borderTop=H.NULL_BORDER,A.borderBottom=H.NULL_BORDER,A.borderRight=H.NULL_BORDER,A.borderLeft=H.NULL_BORDER):A.borderAll={width:1,color:"#E5E5E5",style:"solid"},b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:A.borderAll.color,style:A.borderAll.style,width:A.borderAll.width}}}})})},Wm=()=>{const A=l.getFieldsValue(!0);n.markBorderToggled(!Q),setTimeout(()=>{V(Ne=>!Ne),Q?(A.mobileBorderAll=H.NULL_BORDER,A.mobileBorderTop=H.NULL_BORDER,A.mobileBorderBottom=H.NULL_BORDER,A.mobileBorderRight=H.NULL_BORDER,A.mobileBorderLeft=H.NULL_BORDER):A.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:A.mobileBorderAll.color,style:A.mobileBorderAll.style,width:A.mobileBorderAll.width}}}})})},Gm=()=>{const A=l.getFieldsValue(!0);setTimeout(()=>{Y(Ne=>!Ne),M?(A.borderRadiusAll=0,me(!0)):A.borderRadiusAll=5,b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:A.borderRadiusAll}}})})},Ym=()=>{const A=l.getFieldsValue(!0);setTimeout(()=>{ee(Ne=>!Ne),X?(A.mobileBorderRadiusAll=null,ue(!0)):A.mobileBorderRadiusAll=5,b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:A.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},Xm=()=>{const A=l.getFieldsValue(!0);setTimeout(()=>{Be(Ne=>!Ne),ne?(A.boxShadowInset=!1,A.boxShadowHOffset=null,A.boxShadowVOffset=null,A.boxShadowBlurRadius=null,A.boxShadowSpreadRadius=null,A.boxShadowColor=""):(A.boxShadowInset=!1,A.boxShadowHOffset=5,A.boxShadowVOffset=5,A.boxShadowBlurRadius=10,A.boxShadowSpreadRadius=-5,A.boxShadowColor="#000000"),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:A.boxShadowBlurRadius,color:A.boxShadowColor,hOffset:A.boxShadowHOffset,inset:A.boxShadowInset,spreadRadius:A.boxShadowSpreadRadius,vOffset:A.boxShadowVOffset}}})})},Km=()=>{const A=l.getFieldsValue(!0);setTimeout(()=>{oe(Ne=>!Ne),Ee?(A.mobileBoxShadowInset=!1,A.mobileBoxShadowHOffset=null,A.mobileBoxShadowVOffset=null,A.mobileBoxShadowBlurRadius=null,A.mobileBoxShadowSpreadRadius=null,A.mobileBoxShadowColor=""):(A.mobileBoxShadowInset=!1,A.mobileBoxShadowHOffset=5,A.mobileBoxShadowVOffset=5,A.mobileBoxShadowBlurRadius=10,A.mobileBoxShadowSpreadRadius=-5,A.mobileBoxShadowColor="#000000"),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:A.mobileBoxShadowBlurRadius,color:A.mobileBoxShadowColor,hOffset:A.mobileBoxShadowHOffset,inset:A.mobileBoxShadowInset,spreadRadius:A.mobileBoxShadowSpreadRadius,vOffset:A.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},qm=()=>{const A=l.getFieldsValue(!0);setTimeout(()=>{ie(Ne=>!Ne),D&&(A.mobileWidth="",A.mobileHeight="",b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"},mobileHeight:{value:null,dim:"px",classNamePrefix:"em-mob-height-"}}}))})},Ga=()=>{Ve?(Ae.current=!1,Le(""),l.setFieldValue("link",""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{link:""}})):(Ae.current=!0,Le(U.current&&U.current.input.value?U.current.input.value:"..."),setTimeout(()=>{U.current.focus()}))},Ya=A=>{A.target.value===""?Le("..."):(v.current.classList.add("selected-td-form__button--active"),Le(A.target.value)),Wo(A.target.value,Oe)},Xa=()=>{const A=l.getFieldsValue(!0);ve?(he(""),A.alt="",b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{alt:""}})):(he(L.current&&L.current.input.value?L.current.input.value:"..."),setTimeout(()=>{L.current.focus()}))},Ka=A=>{A.target.value===""?he("..."):(P.current.classList.add("selected-td-form__button--active"),he(A.target.value))},qa=()=>{const A=l.getFieldsValue(!0);be?(Z(""),A.title="",b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{title:""}})):(Z(z.current&&z.current.input.value?z.current.input.value:"..."),setTimeout(()=>{z.current.focus()}))},Jm=()=>{y(!w),w?(l.setFieldValue("imgReplacer",""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:""}})):setTimeout(()=>C.current.focus())},Qm=A=>{A.target.value!==""&&re.current.classList.add("selected-td-form__button--active")},Ja=A=>{A.target.value===""?Z("..."):(le.current.classList.add("selected-td-form__button--active"),Z(A.target.value))},Zm=A=>{l.setFieldValue("link",A!=="mergetag"?A:""),Oe(A)};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:H.BORDER_POSITIONS[fe]||"borderAll",mobileBorderPosition:H.MOBILE_BORDER_POSITIONS[S]||"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:jr,autoComplete:"off",disabled:Io,className:Io?"element-controls selected-image-form_busy":"element-controls",children:[Io&&(0,o.jsx)("div",{className:"selected-image-form__loader",ref:Co,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:Ye.type==="countdown"?i("Preparing countdown preview…"):i("Preparing video preview…")})]})}),!J&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),p==="mobile"&&B.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(Dr,{form:l,elementSettings:e,handleChangeValues:jr,boxShadow:_e,mobileBordersShow:Q,mobileBorderRadiusShow:X,mobileBoxShadowShow:Ee,mobileSizeShow:D,oneMobileBorderRadiusValue:je,setOneMobileBorderRadiusValue:ue,hasLink:Ve,hasAlt:ve,hasTitle:be,linkInputRef:U,linkButtonRef:v,altInputRef:L,altButtonRef:P,titleInputRef:z,titleButtonRef:le,linkInputHandler:Ya,altButtonHandler:Xa,altInputHandler:Ka,titleButtonHandler:qa,titleInputHandler:Ja,linkButtonHandler:Ga,toggleShowMobileBorderHandler:Wm,toggleShowMobileBorderRadiusHandler:Ym,toggleShowMobileBoxShadowHandler:Km,toggleShowMobileSizeHandler:qm})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Mr,{form:l,elementSettings:e,boxShadow:_e,bordersShow:K,borderRadiusShow:M,boxShadowShow:ne,oneBorderRadiusValue:te,setOneBorderRadiusValue:me,hasLink:Ve,hasAlt:ve,hasTitle:be,isOpenSrcReplacer:w,mergeTagItems:Ce,mergeMenuOpen:pe,setMergeMenuOpen:Pe,cascaderRef:ae,linkInputRef:U,linkButtonRef:v,altInputRef:L,altButtonRef:P,titleInputRef:z,titleButtonRef:le,srcReplacerInputRef:C,srcReplacerButtonRef:re,linkProtocol:Se,handleLinkProtocolsChange:Zm,linkButtonHandler:Ga,linkInputHandler:Ya,altButtonHandler:Xa,altInputHandler:Ka,titleButtonHandler:qa,titleInputHandler:Ja,srcReplacerButtonHandler:Jm,srcInputHandler:Qm,handleSelect:so,onChange:He,filter:Ke,renderSearchOption:Fe,handleChangeValues:jr,toggleShowBorderHandler:zm,toggleShowBorderRadiusHandler:Gm,toggleShowBoxShadowHandler:Xm})})]})};zr.propTypes={elementSettings:f.default.object.isRequired};var Wr=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:e("The font-size CSS property sets the size of the font."),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileFontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:e("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})},lt=({form:e,elementSettings:i,imgParent:l=!1,name:s="align",setAlignStateHandle:n=()=>{},withHotKeys:d=!0})=>{const{__:c}=r.useI18n(),m=r.useSendPostMessage(),g=r.useAppConfig(),[b,_]=(0,a.useState)(null);(0,a.useEffect)(()=>{globalThis?.navigator?.userAgent.includes("Macintosh")&&_(!0)},[]);const h=j=>{n(j),e.setFieldsValue({[s]:j}),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[s]:j}})},p=d?{alignLeft:c("Text align left ( ⌘+Shift+L )"),alignCenter:c("Text align center ( ⌘+Shift+E )"),alignRight:c("Text align right ( ⌘+Shift+R )"),alignJustify:c("Text align justify ( ⌘+Shift+J )")}:void 0,B=d?{alignLeft:c("Text align left ( Ctrl+Shift+L )"),alignCenter:c("Text align center ( Ctrl+Shift+E )"),alignRight:c("Text align right ( Ctrl+Shift+R )"),alignJustify:c("Text align justify ( Ctrl+Shift+J )")}:void 0,k=d?b?p:B:void 0,x=i[s],R=typeof x=="string"?x:"";return(0,o.jsx)(t.ui_kit$Form.Item,{name:s,children:(0,o.jsx)(t.ui_kit$FormAlignTextControl,{value:R,onChange:h,disabled:l&&!i.parent,strokeWidth:g?.iconStrokeWidth,labels:k})})},lo=({form:e,elementSettings:i,name:l,icon:s,tooltipTitle:n=null,showTooltip:d=!0,forceInactive:c=!1})=>{const{__:m}=r.useI18n(),g=e.getFieldValue(l),b=r.useSendPostMessage(),[_,h]=(0,a.useState)(i[l]);(0,a.useEffect)(()=>{i[l]!==e.getFieldValue(l)&&(e.setFieldValue(l,i[l]),h(i[l]))},[i,e,l]),(0,a.useEffect)(()=>{_!==g&&h(g)},[g,_,l]);const p=()=>{const B={[l]:!_};e.setFieldValue(l,!_),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:B}),l==="textSuperscript"?e.setFieldValue("textSubscript",!1):l==="textSubscript"&&e.setFieldValue("textSuperscript",!1),h(k=>!k)};return(0,o.jsx)(t.ui_kit$Form.Item,{name:l,children:d?(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:n||m(l.substring(4)),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":_&&!c}),onClick:p,children:s})}):(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":_&&!c}),onClick:p,children:s})})};lo.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 Sn=["email","block"];function Tn(e){const i=r.getMessageService(e).getTarget(),l=r.getCanvasService(e);Sn.map(s=>l?.peek(s)?.element).find(s=>!!i&&s?.contentWindow===i)?.focus({preventScroll:!0})}var Gr=()=>{const{__:e}=r.useI18n();return[{symbol:"•",code:"&bull;",description:e("Bullet")},{symbol:"+",code:"&plus;",description:e("Plus")},{symbol:"»",code:"&raquo;",description:e("Double quotation")},{symbol:"×",code:"&times;",description:e("Cross")},{symbol:"–",code:"&mdash;",description:e("Dash")},{symbol:"›",code:"&rsaquo;",description:e("Single quotation")},{symbol:"→",code:"&rarr;",description:e("Arrow")},{symbol:"⇒",code:"&rArr;",description:e("Double arrow")},{symbol:"►",code:"&blacktriangleright;",description:e("Pointer")},{symbol:"−",code:"&minus;",description:e("Minus")},{symbol:"∗",code:"&lowast;",description:e("Star")},{symbol:"♦",code:"&diams;",description:e("Diamond")}]},Rn=(e,i="#c6c3c3",l={},s)=>{const{symbolSize:n="25px",marginRight:d="5px",marginBottom:c="5px",textStyle:m={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",...m},children:g.symbol}),(0,o.jsx)("span",{style:m,children:g.description})]})}))},xt=({form:e,fillFields:i,elementSettings:l,showAddParagraph:s=!0,isButton:n=!1,linkProtocol:d,setLinkProtocol:c,linkTarget:m,isBulletFontColorChecked:g=!1,setIsBulletFontColorChecked:b=()=>{},showTopDivider:_=!0})=>{const{__:h}=r.useI18n(),p=H.useGoogleFontsLoader(),{token:B}=(0,t.ui_kit$useToken)(),k=r.useNotification(),x=r.useSendPostMessage(),R=r.useContainer(),j=r.useAppConfig(),N=(0,a.useRef)(),E=(0,a.useRef)(null),I=(0,a.useRef)(null),$=(0,a.useRef)(null),U=(0,a.useRef)(!1),v=l,[L,P]=(0,a.useState)(!!v.textReplacer?.length),[z,le]=(0,a.useState)(!!v.textAnchor?.length),[C,re]=(0,a.useState)(null),[ae,_e]=(0,a.useState)({start:0,end:0}),[Te,te]=(0,a.useState)(!1),[me,je]=(0,a.useState)([]),[ue,Ve]=(0,a.useState)(v.list?.bulletsColor),[Le,ve]=(0,a.useState)(l);l!==Le&&(ve(l),Ve(v.list?.bulletsColor),P(!!v.textReplacer?.length),le(!!v.textAnchor?.length));const[he,be]=(0,a.useState)(!1),[Z,K]=(0,a.useState)(!1),q=(0,a.useRef)(null),Q=(0,a.useRef)(""),V=Gr(),M=(0,a.useMemo)(()=>V,[]),Y={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 X=null;(0,a.useEffect)(()=>{if(Y?.textColor&&g){const y=e.getFieldValue("textColor");x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{ColorBullets:y}})}},[Y?.textColor]),(0,a.useEffect)(()=>{const y=e.getFieldValue("textLink");typeof l.linkHref=="string"&&be(!0),q&&!y&&(be(!1),e.setFieldsValue({linkHref:null})),q.current=y||null},[Y?.textLink,Y?.linkHref,l.linkHref,e]),(0,a.useEffect)(()=>{const y=e.getFieldValue("listUL"),ce=e.getFieldValue("listOL");y&&Q.current!=="listUL"?(e.setFieldValue("listOL",!1),Q.current="listUL"):ce&&Q.current!=="listOL"&&(e.setFieldValue("listUL",!1),Q.current="listOL"),!y&&!ce&&(Q.current="")},[Y?.listUL,Y?.listOL,e]);const ee=y=>{y.data.operation===r.EVENT_TYPES.APPLICATION_FOCUS_IN_IFRAME&&re(null)};r.useListenPostMessage(ee);const[ne,Be]=(0,a.useState)(null);(0,a.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&Be(!0)},[]);const Ee=(0,a.useRef)(null);function oe(y){const ce=y.key.toLowerCase();let Ie=!1;return((X==="control"||X==="meta")&&(ce==="a"||ce==="A")||(X==="a"||X==="A")&&(ce==="control"||ce==="meta"))&&(Ie=!0),X=ce,ce!=="control"&&ce!=="a"&&ce!=="A"&&ce!=="meta"&&(X=null),Ie}const D=y=>{x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:y,locale:"en_US"}),k.success({title:h("It`s done!")})},ie=[{key:"1",label:h("This element"),onClick:()=>D("typograf")},{key:"2",label:h("The whole email"),onClick:()=>D("typograf_all")}],[we,W]=(0,a.useState)(),[Se,Oe]=(0,a.useState)(!1);(0,a.useEffect)(()=>{const y=Rn(M,ue,{});je(y)},[M,ue]),(0,a.useEffect)(()=>{const y=l.linkHref||l.href;y&&Wo(y,c);const ce=l.linkHref||l.href,Ie=ce&&Ri(ce)?ce.slice(1):ce||"https://";(i??((Xe,oo)=>Xe.setFieldsValue(oo)))(e,{linkHref:Ie})},[e,l,c,i]);const Ae=r.useAppConfig().mergeTags;(0,a.useEffect)(()=>{Ae?.items?.length&&W(r.mapMargeTags(Ae.items))},[Ae,W]);const Ge=y=>{e.setFieldValue("linkHref",y!=="mergetag"?y:""),c(y)},Ye=(y,ce)=>{if(Oe(!1),y){const Ie=Ae.syntax.length>1?we.findIndex(oo=>oo.key===ce[0].key):0,Xe=Ae.syntax[Ie].replace("%value%",y[y.length-1]);if(C?.getAttribute("id")==="selected_button_form_href"||C?.getAttribute("id")==="selected_text_form_linkHref"||C?.getAttribute("id")==="selected_text_form_textReplacer")Pe(Xe,C?.getAttribute("id"));else{e.setFieldValue("textReplacer",Xe);const oo=Date.now();x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:`${Xe}~~${oo}`}}),R&&setTimeout(()=>Tn(R))}}},Ze=(y,ce)=>ce.some(Ie=>Ie.label.toLowerCase().indexOf(y.toLowerCase())>-1),de=(y,ce)=>{const Ie=ce.map((Xe,oo)=>{const po=Xe.label.split(new RegExp(`(${y})`,"gi"));return(0,o.jsxs)("span",{children:[oo!==0&&(0,o.jsx)("span",{children:" / "}),po.map((co,_o)=>co.toLowerCase()===y.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:co},_o):co)]},Xe.value)});return(0,o.jsx)("div",{title:ce.map(Xe=>Xe.label).join(" / "),children:Ie})};(0,a.useEffect)(()=>{Se&&Ee.current&&Ee.current.focus()},[Se]);const Ce=r.useRootElement();(0,a.useEffect)(()=>{const y=({target:Xe})=>{Xe.closest('[id="merge_tags_wrapper"]')||re(Xe)},ce=({target:Xe})=>{!Xe.closest(".merge-tags")&&!Xe.closest("#merge_tags_button")&&Oe(!1)},Ie=new yo.Disposable;return Ie.addDisposable(r.addWindowListenerFromShadow(Ce,"focusin",y)),Ie.addDisposable(r.addWindowListenerFromShadow(Ce,"click",ce)),()=>{Ie.dispose()}},[Ce]);const G=(0,a.useCallback)(()=>{const y=window.getSelection();y&&y.toString().length>0&&(U.current=!0)},[]),pe=(0,a.useCallback)(({target:y})=>{if(y&&!Te){const{selectionStart:ce,selectionEnd:Ie}=y;_e(Xe=>Xe?.start===ce&&Xe?.end===Ie?Xe:{start:ce,end:Ie})}te(!1)},[Te]);(0,a.useEffect)(()=>pe({target:m?.target}),[m,pe]);const Pe=(y,ce)=>{const Ie=document.getElementById(ce);if(Ie){const Xe=Ie.value?.substring(0,ae.start),oo=Ie.value?.substring(ae.end),po=ce.substring(ce.lastIndexOf("_")+1);x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{[po]:Xe+y+oo}}),e.setFieldValue(po,Xe+y+oo),Ie.focus(),setTimeout(()=>{Ie.selectionStart=ae.start,Ie.selectionEnd=ae.start+y.length},400),te(!0)}},We=()=>{P(!L),L?(e.setFieldValue("textReplacer",""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:""}})):setTimeout(()=>E.current.focus())},to=y=>{y.target.value!==""&&I.current?.classList.add("selected-td-form__button--active")},eo=(y="unknown")=>{le(!z),z?(e.setFieldValue("textAnchor",""),x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textAnchor:""}})):setTimeout(()=>$.current?.focus())},no=y=>{const ce=y.target,Ie=ce.value,Xe=ce.selectionStart,oo=oe(y);if(U.current&&Xe===0&&x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:`${Ie}~`}}),U.current=oo,Xe===0&&y.key===" "){y.preventDefault();return}if(y.key===" "){if(Xe!==Ie.length){y.preventDefault();return}Ie.endsWith(" ")&&y.preventDefault()}},O=y=>{Ve(y),g&&b(!1)},se=n?j.formButtonFieldInsertImageEnabled:j.formTextFieldTypografEnabled,w=j.formTextFieldTypografEnabled&&!n;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)(lt,{form:e,elementSettings:l,name:"textAlign"})})})}),se||w||j.mergeTagsShow&&we?(0,o.jsx)(t.ui_kit$FormSection,{title:null,dividerTop:_,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginTop:4},children:[se&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Col,{span:w?12:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"AddImage",style:{marginBottom:B.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"AddImage",component:t.icons$AddImage}),onClick:()=>D("add_img"),style:{width:"100%"},children:h("Add image")})})})}),w&&(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:B.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,menu:{items:ie},trigger:["hover"],placement:"bottom",getPopupContainer:y=>y.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:()=>D("typograf"),style:{width:"100%"},children:h("Typography")})})})})}),j.mergeTagsShow&&we&&(0,o.jsxs)(t.ui_kit$Col,{span:24,id:"merge_tags_wrapper",style:{marginBottom:B.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Button,{id:"merge_tags_button",icon:(0,o.jsx)(r.EmIcons,{icon:"MergeTags",component:t.icons$MergeTags}),style:{width:"100%",display:Se?"none":"inline-flex"},onClick:()=>Oe(!0),children:h("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:Ee,classNames:{popup:{root:"merge-tags"}},options:we,placeholder:h("Start typing the title"),showSearch:{filter:Ze,render:de},spellCheck:"false",getPopupContainer:y=>y.closest(".email-pane__collapse-wrapper"),onChange:Ye,style:{display:Se?"block":"none",width:"100%"},open:Se,onKeyDown:y=>{y.key==="Escape"&&Oe(!1)}})]})]})}):null,(0,o.jsxs)(t.ui_kit$FormSection,{title:null,dividerTop:_||se||w,bodyStyle:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Text font"),placement:"bottom",zIndex:1,getPopupContainer:y=>y.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:p,getPopupContainer:y=>y.closest(".email-pane__collapse-wrapper")})})}),!l.showOnMobile&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:h("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:h("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{marginBottom:10,marginTop:5},children:(0,o.jsxs)(t.ui_kit$Col,{span:24,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:-10},children:[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)(lo,{form:e,elementSettings:l,name:"textStrong",tooltipTitle:h(ne?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})}),(0,o.jsx)(lo,{form:e,elementSettings:l,name:"textItalic",tooltipTitle:h(ne?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})}),(0,o.jsx)(lo,{form:e,elementSettings:l,name:"textUnderline",tooltipTitle:h(ne?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})}),(0,o.jsx)(lo,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:h(ne?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Text color"),placement:"bottom",zIndex:1,getPopupContainer:y=>y.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:h("Please set the font color")}],className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:h("Color"),usedColors:l.usedColors})})})})]}),!n&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(lo,{form:e,elementSettings:l,name:"textStrong",tooltipTitle:h(ne?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(lo,{form:e,elementSettings:l,name:"textItalic",tooltipTitle:h(ne?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(lo,{form:e,elementSettings:l,name:"textUnderline",tooltipTitle:h(ne?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})}),l?.list?.isList&&(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(lo,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:h(ne?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]}),!l?.list?.isList&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(lo,{form:e,elementSettings:l,name:"listUL",tooltipTitle:h("Unordered list"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnorderedListOutlined",component:t.icons$UnorderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:pe})}),!l?.list?.isList&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(lo,{form:e,elementSettings:l,name:"listOL",tooltipTitle:h("Ordered list"),icon:(0,o.jsx)(r.EmIcons,{icon:"OrderedListOutlined",component:t.icons$OrderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:pe})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(lo,{form:e,elementSettings:l,name:"textSuperscript",tooltipTitle:h("Text superscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Superscript",component:t.icons$Superscript})})}),l?.list?.isList&&(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(lo,{form:e,elementSettings:l,name:"textSubscript",tooltipTitle:h("Text subscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Subscript",component:t.icons$Subscript})})]}),s&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(lo,{form:e,className:(0,ze.default)("selected-text-common-form__button selected-text-common-form__button_style",{"selected-text-common-form__button--active":typeof l.linkHref=="string"}),elementSettings:l,name:"textLink",forceInactive:!!l.textAnchor,tooltipTitle:h("Link"),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"}),onSelect:pe})}),l?.list?.isList&&j.formTextFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:h("Text replacer"),placement:"bottom",getPopupContainer:y=>y.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":L}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:We,ref:I})})}),(!l?.list?.isList||s&&l?.list?.isList)&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:h("More options"),placement:"bottom",getPopupContainer:y=>y.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":Z||z}),icon:(0,o.jsx)(r.EmIcons,{icon:"DotsHoriz",component:t.icons$DotsHoriz,className:"selected-td-form__icon-radius"}),onClick:()=>K(!Z)})})})]})]}),!n&&Z&&(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)(lo,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:h(ne?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]}),(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(lo,{form:e,elementSettings:l,name:"textSubscript",tooltipTitle:h("Text subscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Subscript",component:t.icons$Subscript})})]}),j.formTextFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:h("Text replacer"),placement:"bottom",getPopupContainer:y=>y.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":L}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:We,ref:I})})})]}),s&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:h("Anchor"),placement:"bottom",getPopupContainer:y=>y.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":z}),icon:(0,o.jsx)(r.EmIcons,{icon:"Anchor",component:t.icons$Anchor,className:"selected-text-common-form__icon-radius"}),onMouseDown:y=>{y.preventDefault(),eo("mouseDown")}})})})]}),s&&typeof l.linkHref=="string"&&he&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(tt,{show:d==="#",__:h,style:{marginBottom:B.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h(d==="#"?"Anchor name":"The URL that the hyperlink directs to."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkHref",style:{marginBottom:d==="mailto:"?B.formItemMarginBottomXS:""},children:(0,o.jsx)(t.ui_kit$Input,{ref:N,addonBefore:(0,o.jsx)(ot,{linkProtocol:d,handleLinkProtocolsChange:Ge,__:h}),allowClear:!0,placeholder:h(d==="#"?"Anchor name":"Hyperlink URL"),autoFocus:l?.isNewLink,onSelect:pe,prefix:(0,o.jsx)(et,{linkProtocol:d})})})}),d==="mailto:"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"subject",style:{marginBottom:B.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:h("Subject"),onSelect:pe})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:B.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:h("Body"),onSelect:pe})})]})]}),s&&z&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Anchor name"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textAnchor",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:h("Anchor name"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content addon-text-content--icon",title:h("Anchor"),"aria-hidden":!0,children:(0,o.jsx)(r.EmIcons,{icon:"Anchor",component:t.icons$Anchor,className:"selected-text-common-form__icon-radius",size:18})}),ref:$,onSelect:pe,onBlur:()=>{e.getFieldValue("textAnchor")?.trim()||le(!1)}})})}),!n&&L&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textReplacer",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:h("The code that will replace this text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:h("Text")}),onChange:to,onKeyDown:no,onDoubleClick:G,ref:E,onSelect:pe})})})]})}),!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:h("Text color"),placement:"bottom",zIndex:1,getPopupContainer:y=>y.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:h("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:h("Color"),usedColors:l.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Text background"),placement:"bottom",zIndex:1,getPopupContainer:y=>y.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:h("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:h("Background color"),usedColors:l.usedColors})})})})]})]}),!n&&l?.list?.isList&&(0,o.jsxs)(t.ui_kit$FormSection,{title:h("List settings"),dividerTop:!0,children:[l?.list?.listType==="OL"&&(0,o.jsx)(t.ui_kit$Row,{children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Bullets font"),placement:"bottom",zIndex:1,getPopupContainer:y=>y.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"BulletsFontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:p,getPopupContainer:y=>y.closest(".email-pane__collapse-wrapper"),style:{marginTop:"-9px"}})})})})}),(0,o.jsx)(t.ui_kit$Row,{gutter:[10],children:l?.list?.listType==="UL"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Bullets type"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"BulletType",className:"bullet-type",children:(0,o.jsx)(t.ui_kit$Select,{size:"medium",placeholder:h("Bullets type"),onClick:y=>y.stopPropagation(),options:me})})})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:[10],children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Bullets color"),placement:"bottom",zIndex:1,getPopupContainer:y=>y.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"ColorBullets",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:h("Bullets color"),usedColors:l.usedColors,disabled:g,onChange:O,externalValue:g?Y?.textColor:void 0})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Bullets size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"BulletsSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,defaultValue:l?.list?.bulletFontSize,placeholder:h("Bullets size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})})]}),l?.list?.listType==="OL"&&(0,o.jsxs)(t.ui_kit$Row,{children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(lo,{form:e,elementSettings:l,name:"BulletTextStrong",tooltipTitle:h(ne?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(lo,{form:e,elementSettings:l,name:"BulletTextItalic",tooltipTitle:h(ne?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(lo,{form:e,elementSettings:l,name:"BulletTextStrikethrough",tooltipTitle:h(ne?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(lo,{form:e,elementSettings:l,name:"BulletTextUnderline",tooltipTitle:h(ne?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:[10],style:{marginTop:"-8px"},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Between list items"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"SpacingBetweenParagraphs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:5,max:100,placeholder:h("Between list items"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:h("Between bullets and text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"SpacingBetweenBulletsAndText",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:1,max:100,placeholder:h("Between bullets and text"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px"})})})})]})]})]})},Ii=({form:e,elementSettings:i,showAddParagraph:l=!0,isButton:s=!1})=>{const{__:n}=r.useI18n(),d=H.useGoogleFontsLoader(),c=r.useSendPostMessage(),m=r.useDispatch(),g=r.useElementEntityKind(),b=r.useAppConfig(),[_,h]=(0,a.useState)(null);(0,a.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&h(!0)},[]);const p=N=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:N,locale:"en_US"})},[B,k]=(0,a.useState)(i.textAlign),[x,R]=(0,a.useState)(i.linkHref),j=N=>k(N);return(0,a.useEffect)(()=>{k(i.textAlign),R(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:N=>N.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:N=>N.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)(lo,{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)(lo,{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)(lo,{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)(lo,{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:N=>N.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:N=>N.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:N=>N.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:N=>N.closest(".selected_text_common_form_mobile"),children:(0,o.jsx)("div",{children:(0,o.jsx)(lo,{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)(lo,{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)(lt,{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:N=>N.closest(".selected_text_common_form_mobile"),children:(0,o.jsx)(t.ui_kit$Button,{icon:B==="right"?(0,o.jsx)(r.EmIcons,{icon:"AlignRightOutlined",component:t.icons$AlignRightOutlined,size:18,strokeWidth:b.iconStrokeWidth}):B==="center"?(0,o.jsx)(r.EmIcons,{icon:"AlignCenterOutlined",component:t.icons$AlignCenterOutlined,size:18,strokeWidth:b.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"AlignLeftOutlined",component:t.icons$AlignLeftOutlined,size:18,strokeWidth:b.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:()=>p("add_p"),className:"selected-td-form__button"})}),(!s||b.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:b.iconStrokeWidth}),onClick:()=>p("add_img"),className:"selected-td-form__button"})})}),!s&&(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Typograf",component:t.icons$Typograf}),className:"selected-td-form__button"}),(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"CloseOutlined",component:t.icons$CloseOutlined}),type:"icon",style:{marginLeft:26},onClick:()=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),m(r.resetToLastActiveSettingsTab()),setTimeout(()=>{m(g==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300)}})]})]})})},$t=({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")}})})};$t.propTypes={elementSettings:f.default.object.isRequired,imgParent:f.default.bool,name:f.default.string};var yn=({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),m=r.useSelector(r.selectIsCodeMode),g=r.useSelector(r.selectCodeModeDirection),b=m&&g!=="bottom",[_,h]=(0,a.useState)("https://"),[p,B]=(0,a.useState)(!1),k=Gr(),x=(0,a.useMemo)(()=>k,[]),R=r.useElementEntityKind(),{remember:j,fillFields:N}=ut(e),E=(0,a.useCallback)($=>{j($),l(R==="email"?r.setElementSettings$1($):r.setElementSettings($))},[l,R,j]);(0,a.useEffect)(()=>{if(e){const{subject:$,body:U,baseEmail:v}=Or(e.linkHref),L=e.linkHref,P=typeof L=="string"&&Ri(L),z=typeof L=="string"&&L.startsWith("mailto:")?v:P?L.slice(1):typeof L=="string"?L:"https://";h(Ot(L||"","https://")),N(n,{...e,lineHeight:u(e.lineHeight),linkHref:z,subject:$,body:U,mobileFontSize:u(e.mobileFontSize?.value||e.fontSize),mobileFontSizeDim:e.mobileFontSize?.dim||e.fontSizeDim,mobileLineHeight:u(e.mobileLineHeight?.value??e.lineHeight),mobileLineHeightDim:e.mobileLineHeight?.dim||e.lineHeightDim,mobileTextAlign:$r(e.mobileTextAlign,e.textAlign),SpacingBetweenBulletsAndText:e?.list?.betweenRowCell,SpacingBetweenParagraphs:e?.list?.betweenParagraphs,BulletsSize:e?.list?.bulletFontSize,ColorBullets:e?.list?.bulletsColor,BulletTextStrong:e?.list?.bulletFontBold,BulletTextItalic:e?.list?.bulletFontItalic,CheckboxColor:p,BulletsFontFamily:e?.list?.bulletFontFamily,BulletTextUnderline:e?.list?.bulletFontUnderline,BulletTextStrikethrough:e?.list?.bulletFontStrikethrough,BulletType:x.find(le=>le.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 I=$=>{const U=n.getFieldsValue(!0),v=Object.keys($)[0];let L;switch(v){case"mobileFontSize":L={[v]:{classNamePrefix:"em-mob-font_size-",value:$[v],dim:U.mobileFontSizeDim}};break;case"mobileLineHeight":L={[v]:{classNamePrefix:"em-mob-line_height-",value:$[v],dim:U.mobileLineHeightDim}};break;case"mobileTextAlign":L={[v]:{classNamePrefix:"em-mob-text_align-",value:$[v]}};break;case"linkHref":let P=it($[v]);if(P!==$[v]&&n.setFieldValue("linkHref",P),_==="#"&&P&&!P.startsWith("#")&&(P="#"+P),P.startsWith("mailto:")){const le=n.getFieldValue("subject"),C=n.getFieldValue("body");L={[v]:yi(P,le,C)}}else L={[v]:P};Wo(P,h);break;case"subject":case"body":const z=n.getFieldValue("linkHref")||"";if(z.substring(0,7)==="mailto:"){const le=z.split("?")[0],C=v==="subject"?$[v]:n.getFieldValue("subject"),re=v==="body"?$[v]:n.getFieldValue("body"),ae=[];C&&ae.push(`subject=${encodeURIComponent(C)}`),re&&ae.push(`body=${encodeURIComponent(re)}`),L={linkHref:ae.length>0?`${le}?${ae.join("&")}`:le}}else return;break;default:L=$}s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:L}),E({...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(P=>P.code===n.getFieldValue("BulletType"))?.symbol??x[0].symbol},...L,activateSection:null,changeKey:v})};return(0,o.jsxs)(t.ui_kit$Form,{form:n,layout:"vertical",name:"selected_text_form",autoComplete:"off",onValuesChange:I,className:"element-controls",initialValues:{textAlign:"left",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1,textColor:"",textBackgroundColor:"",textLink:!1,textReplacer:"",textAnchor:"",subject:"",body:"",SpacingBetweenBulletsAndText:0,SpacingBetweenParagraphs:0,BulletsSize:0,ColorBullets:"",BulletTextStrong:!1,BulletTextItalic:!1,CheckboxColor:!1,BulletsFontFamily:"",BulletTextUnderline:!1,BulletTextStrikethrough:!1,BulletType:"",textSuperscript:!1,textSubscript:!1,listOL:!1,listUL:!1},children:[!b&&(0,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"&&!b&&c.styles)&&(0,o.jsx)("div",{id:"selected_element_form_desktop_props",style:{paddingRight:0},children:b?(0,o.jsx)(Ii,{form:n,elementSettings:e}):(0,o.jsx)(xt,{form:n,fillFields:N,elementSettings:e,linkProtocol:_,setLinkProtocol:h,isBulletFontColorChecked:p,setIsBulletFontColorChecked:B})}),!b&&(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)($t,{form:n,elementSettings:e,name:"mobileTextAlign"})})}),!!e.showOnMobile&&(0,o.jsx)(xt,{form:n,fillFields:N,elementSettings:e,linkProtocol:_,setLinkProtocol:h}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Wr,{})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileLineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})]})]})]})},vi=(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")},Yr={marginBottom:10},Xr={position:"relative",top:2};function wn(e){return Array.isArray(e)?!!e[0]?.value:typeof e=="string"?e.trim()!=="":!!e}var st=({form:e,showRounding:i=!1,showBackground:l=!1})=>{const{__:s}=r.useI18n(),n=wn(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:Yr,children:(0,o.jsx)(t.ui_kit$Switch,{id:"outlook-rounding",label:s("Rounded corners in Outlook (VML)"),size:"small",labelStyle:Xr})})},"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:Yr,children:(0,o.jsx)(t.ui_kit$Switch,{id:"outlook-background",label:s("Background image in Outlook (VML)"),size:"small",labelStyle:Xr})})},"outlookBackground")]})};st.propTypes={form:f.default.object,showRounding:f.default.bool,showBackground:f.default.bool};var Kr=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:n,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:m,backgroundRepeatOptions:g,backgroundSizeOptions:b,sizeShow:_,modificationShow:h,oneBorderRadiusValue:p,setOneBorderRadiusValue:B,toggleShowBorderHandler:k,toggleShowBorderRadiusHandler:x,toggleShowBoxShadowHandler:R,toggleShowSizeHandler:j,toggleShowBackgroundHandler:N,toggleShowModificationHandler:E})=>{const{__:I}=r.useI18n(),$=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(zo,{form:e,elementSettings:i,tooltipTitle:I("The align attribute sets the horizontal alignment of the table.")})}),(0,o.jsx)(t.ui_kit$FormSection,{title:I("Size"),collapsible:!0,open:_,onToggle:j,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{showHeight:!1,showMinMax:!0,columnsPerRow:2,dimensionSelect:Fo,minWidthDimensionSelect:Fo,maxWidthDimensionSelect:Fo,rowStyle:{marginBottom:4},labels:{width:I("Width"),height:I("Height"),minWidth:I("Minimum width"),maxWidth:I("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:I("Background"),collapsible:!0,open:c,onToggle:N,dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{imageEnabled:$.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:m,usedColors:i.usedColors,colorPlaceholder:I("Background color"),horizontalPositionPlaceholder:I("Horizontal position"),horizontalPositionTooltip:I("Horizontal position"),verticalPositionPlaceholder:I("Vertical position"),verticalPositionTooltip:I("Vertical position"),backgroundRepeatTooltip:I("Background image repeat"),backgroundSizeTooltip:I("Background image size"),selectPlaceholder:I("Please choose"),backgroundRepeatOptions:g,backgroundSizeOptions:b,imageUploadSlot:$.formTableFieldBackgroundImageEnabled?(0,o.jsx)($o,{form:e,label:I("Background image"),name:"backgroundImage",tooltipTitle:I("Background image"),placeholder:I("Background image link/route")}):void 0}),(0,o.jsx)(st,{form:e,showBackground:!0})]}),$.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Borders"),collapsible:!0,open:s,onToggle:k,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e,elementSettings:i})}),$.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Border radius"),collapsible:!0,open:n,onToggle:x,dividerTop:!0,children:(0,o.jsx)(wo,{form:e,oneBorderRadiusValue:p,setOneBorderRadiusValue:B,elementSettings:i})}),$.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Box shadow"),collapsible:!0,open:d,onToggle:R,dividerTop:!0,children:(0,o.jsx)(Po,{})}),$.formFieldExportAsPictureEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Export settings"),collapsible:!0,open:h,onToggle:E,dividerTop:!0,children:(0,o.jsx)(vi,{form:e,elementSettings:i})}),$.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e})}),$.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(No,{})})]})};Kr.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 qr=({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)(),m=r.useSendPostMessage(),g=_=>{e.setFieldsValue({mobileBackgroundColor:""}),d(h=>!h),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:n?"":"none"}}})},b=_=>{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:b,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})]})})};qr.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired};var Ft={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"}]},Ci={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-"},mt="none",jn=/^(https?:)?\/\//i,In=/^(\d*\.?\d+)(%|px)$/;function vn(e){return e in Ci}function Jr(e){return jn.test(e.trim())}function Pi(e,i){const l=Ci[e],s=typeof i=="string"?i:"";return e==="mobileBackgroundImage"?s&&s!==mt&&!Jr(s)?null:{[e]:[{classNamePrefix:l,value:s,type:"url"}]}:e==="mobileBackgroundRepeat"?{[e]:{classNamePrefix:l,value:s||mt}}:{[e]:{classNamePrefix:l,value:s}}}function kt(e){const[i]=Object.keys(e??{});return!i||!vn(i)?null:Pi(i,e[i])}function Qr(){return Object.keys(Ci).reduce((e,i)=>({...e,...Pi(i,"")}),{})}function Zr(e){const i=(e??"").trim(),l=i.match(In);return l?{position:l[1],unit:l[2]}:{position:i,unit:"px"}}function el(e,i){return e?isNaN(parseFloat(e))?e:e+i:""}function Yo(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 Et(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 at(e){const i=Yo(e),l=i.mobileBackgroundImage?.[0]?.value??"";return{mobileBackgroundImage:l===mt?"":l,mobileBackgroundPositionX:i.mobileBackgroundPositionX?.value??"",mobileBackgroundPositionY:i.mobileBackgroundPositionY?.value??"",mobileBackgroundRepeat:i.mobileBackgroundRepeat?.value||mt,mobileBackgroundSize:i.mobileBackgroundSize?.value??""}}function Mt(e){const i=Yo(e),l=i.mobileBackgroundRepeat?.value;return!!i.mobileBackgroundColor?.value||!!i.mobileBackgroundImage?.[0]?.value||!!i.mobileBackgroundPositionX?.value||!!i.mobileBackgroundPositionY?.value||!!l&&l!==mt||!!i.mobileBackgroundSize?.value}function Cn(e,i){return e===mt?!1:!!e||!!i}function Dt(e,i,l){e.setFieldsValue({...at({}),mobileBackgroundColor:""}),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Yo(i).type,settings:Qr()})}var Pn=/^\d*\.?\d+$/,An={bottom:"auto"},ol={marginBottom:0},Nn=(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal}),Ln=(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical}),On=e=>e.closest(".email-pane__collapse-wrapper")??e.parentNode,tl=({value:e,onChange:i,inheritedValue:l,options:s,placeholder:n,prefix:d})=>{const c=e||l,[m,g]=(0,a.useState)(()=>Zr(c));(0,a.useEffect)(()=>{g(p=>el(p.position,p.unit)===c?p:Zr(c))},[c]);const b=(0,a.useCallback)((p,B)=>{g({position:p,unit:B});const k=s.some(x=>x.value===p);(p===""||k||Pn.test(p))&&i?.(el(p,B))},[i,s]),_=(0,a.useCallback)(p=>b(p,m.unit),[b,m.unit]),h=(0,a.useCallback)(p=>b(m.position,p),[b,m.position]);return(0,o.jsx)(t.ui_kit$InputSelect,{options:s,position:m.position,setPosition:_,unit:m.unit,setUnit:h,placeholder:n,prefix:d,dropdownStyle:An,tooltipTitle:n,getTooltipPopupContainer:On})},$n=({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:ol,children:(0,o.jsx)(tl,{inheritedValue:e,options:Ft.horizontal,placeholder:l("Horizontal position"),prefix:Nn})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundPositionY",style:ol,children:(0,o.jsx)(tl,{inheritedValue:i,options:Ft.vertical,placeholder:l("Vertical position"),prefix:Ln})})})]})},il=["hover"],rl=e=>document.querySelector(".email-properties__collapse-panel")??e.parentNode,ll=({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})},Fn=({desktopPositionX:e,desktopPositionY:i,desktopRepeat:l,desktopSize:s,backgroundRepeatOptions:n,backgroundSizeOptions:d})=>{const{__:c}=r.useI18n(),{token:m}=(0,t.ui_kit$useToken)(),g=m.formItemMarginBottomXS,b=(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)($n,{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:il,title:c("Background image repeat"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundRepeat",style:b,children:(0,o.jsx)(ll,{emptyValue:"none",inheritedValue:l,options:n,placeholder:c("Please choose"),getPopupContainer:rl})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:il,title:c("Background image size"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundSize",style:b,children:(0,o.jsx)(ll,{emptyValue:"",inheritedValue:s,options:d,placeholder:c("Please choose"),getPopupContainer:rl})})})})]})]})},Mn=pi,Dn=({value:e,inheritedImage:i,...l})=>(0,o.jsx)(Mn,{...l,value:e||i}),Vn=e=>/^https?:\/\//i.test(e.trim()),Hn=({form:e,name:i="mobileBackgroundImage",placeholder:l="",disabled:s=!1,elementSettings:n,inheritedImage:d="",isImageNone:c=!1,onImageNoneChange:m})=>{const{__:g}=r.useI18n(),{token:b}=(0,t.ui_kit$useToken)(),_=t.ui_kit$Form.useWatch(i,e),[h,p]=(0,a.useState)(""),B=_||d,k=b.formItemMarginBottomXS??0,x=(0,a.useMemo)(()=>({marginBottom:k/2}),[k]);(0,a.useEffect)(()=>{if(!B){p("");return}p(Vn(B)?"validating":"success")},[B]);const R=!!_&&!Jr(_),j=R?"error":h;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:i,className:"mobile-background-image-field",validateStatus:j,help:R?g("Enter a URL starting with http:// or https://"):void 0,style:x,children:(0,o.jsx)(Dn,{inheritedImage:d,validateStatus:j,placeholder:l,name:i,disabled:s,elementSettings:n,imageInfo:n,onRemotePreviewValidate:p})}),(0,o.jsx)(t.ui_kit$Switch,{label:g("Without image"),labelSize:"small",size:"small",checked:c,onChange:m})]})},Un={image:"",positionX:"",positionY:"",repeat:"",size:""},Bt=({elementSettings:e,imageEnabled:i=!1,desktopBackground:l=Un})=>{const{__:s}=r.useI18n(),{token:n}=(0,t.ui_kit$useToken)(),d=t.ui_kit$Form.useFormInstance(),c=n.formItemMarginBottomMD,m=r.useSendPostMessage(),g=e.mobileBackgroundImage?.[0]?.value,[b,_]=(0,a.useState)(g==="none"),h=t.ui_kit$Form.useWatch("mobileBackgroundImage",d);(0,a.useEffect)(()=>{_(g==="none")},[g]),(0,a.useEffect)(()=>{h&&_(!1)},[h]);const p=(0,a.useCallback)(I=>{_(I),d.setFieldsValue({mobileBackgroundImage:""}),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Pi("mobileBackgroundImage",I?"none":"")})},[e.type,d,m]),B=(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=Cn(b?"none":h,l.image),R=(0,a.useMemo)(()=>({marginBottom:x?c:0}),[c,x]),j=(0,a.useMemo)(()=>(0,o.jsx)("div",{style:R,children:(0,o.jsx)(qr,{form:d,elementSettings:e,label:s("Background color")})}),[s,e,d,R]),N=(0,a.useMemo)(()=>(0,o.jsx)("div",{style:R,children:(0,o.jsx)(Hn,{form:d,placeholder:s("Background image"),elementSettings:e,inheritedImage:b?"":l.image,isImageNone:b,onImageNoneChange:p})}),[s,l.image,e,d,p,b,R]),E=(0,a.useMemo)(()=>(0,o.jsx)(Fn,{desktopPositionX:l.positionX,desktopPositionY:l.positionY,desktopRepeat:l.repeat,desktopSize:l.size,backgroundRepeatOptions:B,backgroundSizeOptions:k}),[B,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:N,imageControlsSlot:E,usedColors:e.usedColors})},sl=({form:e,elementSettings:i,mobileBoxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:n,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:m,oneMobileBorderRadiusValue:g,setOneMobileBorderRadiusValue:b,toggleShowMobileBorderHandler:_,toggleShowMobileBorderRadiusHandler:h,toggleShowMobileBoxShadowHandler:p,toggleShowMobileSizeHandler:B,toggleShowMobileBackgroundHandler:k})=>{const{__:x}=r.useI18n(),{token:R}=(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)(zo,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,o.jsx)(t.ui_kit$FormSection,{title:x("Size"),collapsible:!0,open:c,onToggle:B,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:R.formItemMarginBottomMD+4},children:(0,o.jsx)(Go,{form:e,name:"mobileWidth",elementSettings:i})})})})})}),(0,o.jsx)(t.ui_kit$FormSection,{title:x("Background"),collapsible:!0,open:m,onToggle:k,dividerTop:!0,children:(0,o.jsx)(Bt,{elementSettings:Yo(i),imageEnabled:j.formTableFieldBackgroundImageEnabled,desktopBackground:Et(i)})}),j.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Borders"),collapsible:!0,open:s,onToggle:_,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),j.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Border radius"),collapsible:!0,open:n,onToggle:h,dividerTop:!0,children:(0,o.jsx)(wo,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:g,setOneBorderRadiusValue:b,elementSettings:i})}),j.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Box shadow"),collapsible:!0,open:d,onToggle:p,dividerTop:!0,children:(0,o.jsx)(Po,{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)(No,{})})]})};sl.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 al=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),n=Mo(),d=Mo(),c=r.useDispatch(),m=r.useElementEntityKind(),[g,b]=(0,a.useState)({}),[_,h]=(0,a.useState)(!0),[p,B]=(0,a.useState)({}),[k,x]=(0,a.useState)(!0),R=r.useSelector(r.selectEmailViewType),j=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[N,E]=(0,a.useState)(e.backgroundImage[0].value===""),I=r.useSelector(r.selectIsCodeMode),$=r.useSelector(r.selectCodeModeDirection),U=I&&$!=="bottom",[v,L]=(0,a.useState)(!1),[P,z]=(0,a.useState)(!1),[le,C]=(0,a.useState)(!1),[re,ae]=(0,a.useState)(!1),[_e,Te]=(0,a.useState)(!1),[te,me]=(0,a.useState)(!1),[je,ue]=(0,a.useState)(!1),[Ve,Le]=(0,a.useState)(!1),[ve,he]=(0,a.useState)(!1),[be,Z]=(0,a.useState)(!1),[K,q]=(0,a.useState)(!1),Q=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],V=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}],M=G=>G&&(G?.width||G?.style||G?.color)?G:"",Y=e.border,X=e.mobileBorder,ee=Object.keys(Y).find(G=>Y[G]?.width||Y[G]?.style||Y[G]?.color),ne=Object.keys(X).find(G=>X[G]?.width||X[G]?.style||X[G]?.color),{remember:Be,fillFields:Ee}=ut(e);(0,a.useEffect)(()=>{if(e){const G=e.boxShadow,pe=e.mobileBoxShadow;b(G),B(pe),Ee(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:xo(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileAlign:e.mobileAlign?.value,mobileBorderAll:M(e.mobileBorder.all)||!(M(e.mobileBorder.top)||M(e.mobileBorder.bottom)||M(e.mobileBorder.right)||M(e.mobileBorder.left))&&M(e.border.all),mobileBorderTop:M(e.mobileBorder.top)||!M(e.mobileBorder.all)&&M(e.border.top),mobileBorderBottom:M(e.mobileBorder.bottom)||!M(e.mobileBorder.all)&&M(e.border.bottom),mobileBorderRight:M(e.mobileBorder.right)||!M(e.mobileBorder.all)&&M(e.border.right),mobileBorderLeft:M(e.mobileBorder.left)||!M(e.mobileBorder.all)&&M(e.border.left),mobileBorderRadiusAll:u(e.mobileBorderRadius.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius.topLeft!==null?e.mobileBorderRadius.topLeft:e.mobileBorderRadius.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius.bottomLeft!==null?e.mobileBorderRadius.bottomLeft:e.mobileBorderRadius.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius.topRight!==null?e.mobileBorderRadius.topRight:e.mobileBorderRadius.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius.bottomRight!==null?e.mobileBorderRadius.bottomRight:e.mobileBorderRadius.all),mobileBoxShadowInset:u(e.mobileBoxShadow?.inset)||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color),mobileBackgroundColor:u(e.mobileBackgroundColor?.value!=="none"?e.mobileBackgroundColor?.value:""),...at(e),exportAsPicture:e?.exportAsPicture}),!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?h(!1):h(!0),u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight)?x(!1):x(!0),E(e.backgroundImage[0].value==="");const Pe=n.isStaleBorderSnapshot(e,!!ee),We=d.isStaleBorderSnapshot(e,!!ne);Pe&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(We||Pe&&!ne)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),L(to=>ee&&!Pe?!0:to),z(to=>ee&&!Pe||ne&&!We?!0:to),C(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),ae(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),Te(!!e.boxShadow),me(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),ue(!!e.width?.value||!!e.minWidth?.value||!!e.maxWidth?.value),Le(!!e.mobileWidth.value),he(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Z(Mt(e)),q(!!e.exportAsPicture)}},[s,e,ee,ne,n,d,Ee]);const oe=(0,a.useCallback)(G=>{Be(G),c(m==="email"?r.setElementSettings$1(G):r.setElementSettings(G))},[c,m,Be]),D=G=>{const pe=s.getFieldsValue(!0),Pe=Object.keys(G)[0];let We;switch(Pe){case"exportAsPicture":We={exportAsPicture:pe.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":We={boxShadow:{hOffset:pe.boxShadowHOffset,vOffset:pe.boxShadowVOffset,blurRadius:pe.boxShadowBlurRadius,spreadRadius:pe.boxShadowSpreadRadius,color:pe.boxShadowColor,inset:pe.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":pe.borderPosition==="borderAll"?(We={border:{...r.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...pe.borderAll}}},s.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER})):pe.borderAll?.width||pe.borderAll?.style||pe.borderAll?.color?(We={border:{all:null,left:pe.borderAll,right:pe.borderAll,top:pe.borderAll,bottom:pe.borderAll,[H.REVERSE_BORDER_POSITIONS[Pe]]:{...pe[Pe],...G[Pe]}}},s.setFieldsValue({borderAll:null,borderLeft:pe.borderAll,borderRight:pe.borderAll,borderTop:pe.borderAll,borderBottom:pe.borderAll,[Pe]:{...pe[Pe],...G[Pe]}})):(We={border:{all:null,left:pe.borderLeft,right:pe.borderRight,top:pe.borderTop,bottom:pe.borderBottom,[H.REVERSE_BORDER_POSITIONS[Pe]]:{...pe[Pe],...G[Pe]}}},s.setFieldsValue({border:We.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(pe.mobileBorderPosition==="mobileBorderAll")We={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...pe.mobileBorderAll,classNamePrefix:"em-mob-border_"+H.MOBILE_REVERSE_BORDER_POSITIONS[Pe]+"-"}}},s.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER});else{const to=H.MOBILE_REVERSE_BORDER_POSITIONS[Pe],eo={...pe[Pe],...G[Pe]},no=!eo?.width&&!eo?.style&&!eo?.color;if(pe.mobileBorder?.all?.width||pe.mobileBorder?.all?.style||pe.mobileBorder?.all?.color){const O=pe.mobileBorderAll;We={mobileBorder:{all:null,left:O,right:O,top:O,bottom:O,[to]:no?null:{...eo,classNamePrefix:"em-mob-border_"+to+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:O,mobileBorderRight:O,mobileBorderTop:O,mobileBorderBottom:O,[Pe]:eo})}else{const O=e.mobileBorder||{},se=w=>{const y=O[w];return y&&(y?.width||y?.style||y?.color)?y:null};We={mobileBorder:{all:null,left:to==="left"?no?null:{...eo,classNamePrefix:"em-mob-border_left-"}:se("left"),right:to==="right"?no?null:{...eo,classNamePrefix:"em-mob-border_right-"}:se("right"),top:to==="top"?no?null:{...eo,classNamePrefix:"em-mob-border_top-"}:se("top"),bottom:to==="bottom"?no?null:{...eo,classNamePrefix:"em-mob-border_bottom-"}:se("bottom")}},s.setFieldsValue({[Pe]:eo})}}break;case"width":We={[Pe]:{value:G[Pe],dim:pe.widthDim}};break;case"widthDim":We={width:{value:pe.width,dim:G[Pe]}};break;case"maxWidth":We={[Pe]:{value:G[Pe],dim:pe.maxWidthDim}};break;case"maxWidthDim":We={maxWidth:{value:pe.maxWidth,dim:G[Pe]}};break;case"minWidth":We={[Pe]:{value:G[Pe],dim:pe.minWidthDim}};break;case"minWidthDim":We={minWidth:{value:pe.minWidth,dim:G[Pe]}};break;case"backgroundImage":E(G[Pe]===""),We={[Pe]:[{...e.backgroundImage[0],value:G[Pe]}],backgroundSize:"cover"};break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":We={borderRadius:{[H.BORDER_RADIUS_POSITION[Pe]]:+G[Pe]}};break;case"mobileWidth":We={[Pe]:{classNamePrefix:"em-mob-width-",value:G[Pe],dim:pe.mobileWidthDim}};break;case"mobileWidthDim":We={mobileWidth:{classNamePrefix:"em-mob-width-",value:pe.mobileWidth||100,dim:G[Pe]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":We={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[Pe]]:G[Pe],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[Pe]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":We={mobileBoxShadow:{hOffset:pe.mobileBoxShadowHOffset,vOffset:pe.mobileBoxShadowVOffset,blurRadius:pe.mobileBoxShadowBlurRadius,spreadRadius:pe.mobileBoxShadowSpreadRadius,color:pe.mobileBoxShadowColor,inset:pe.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(We=kt(G),!We)return;break;case"mobileAlign":We={[Pe]:{classNamePrefix:"em-mob-table_align-",value:G[Pe]}};break;default:We=G}Pe!=="borderPosition"&&Pe!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:We}),Pe!=="mobileBorderRadiusAll"&&Pe!=="mobileBorderRadiusTopLeft"&&Pe!=="mobileBorderRadiusTopRight"&&Pe!=="mobileBorderRadiusBottomLeft"&&Pe!=="mobileBorderRadiusBottomRight"&&oe({...e,...We,mobileBorderRadius:{...e.mobileBorderRadius,...We?.mobileBorderRadius},activateSection:null,changeKey:Pe}))},ie=()=>{const G=s.getFieldsValue(!0);n.markBorderToggled(!v),setTimeout(()=>{L(pe=>!pe),v?(G.borderAll=H.NULL_BORDER,G.borderTop=H.NULL_BORDER,G.borderBottom=H.NULL_BORDER,G.borderRight=H.NULL_BORDER,G.borderLeft=H.NULL_BORDER):G.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:G.borderAll.color,style:G.borderAll.style,width:G.borderAll.width}}}})})},we=()=>{const G=s.getFieldsValue(!0);d.markBorderToggled(!P),setTimeout(()=>{z(pe=>!pe),P?(G.mobileBorderAll=H.NULL_BORDER,G.mobileBorderTop=H.NULL_BORDER,G.mobileBorderBottom=H.NULL_BORDER,G.mobileBorderRight=H.NULL_BORDER,G.mobileBorderLeft=H.NULL_BORDER):G.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:G.mobileBorderAll.color,style:G.mobileBorderAll.style,width:G.mobileBorderAll.width}}}})})},W=()=>{const G=s.getFieldsValue(!0);setTimeout(()=>{C(pe=>!pe),le?(G.borderRadiusAll=0,h(!0)):G.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:G.borderRadiusAll}}})})},Se=()=>{const G=s.getFieldsValue(!0);setTimeout(()=>{ae(pe=>!pe),re?(G.mobileBorderRadiusAll=null,x(!0)):G.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:G.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},Oe=()=>{const G=s.getFieldsValue(!0);setTimeout(()=>{Te(pe=>!pe),_e?(G.boxShadowInset=!1,G.boxShadowHOffset=null,G.boxShadowVOffset=null,G.boxShadowBlurRadius=null,G.boxShadowSpreadRadius=null,G.boxShadowColor=""):(G.boxShadowInset=!1,G.boxShadowHOffset=5,G.boxShadowVOffset=5,G.boxShadowBlurRadius=10,G.boxShadowSpreadRadius=-5,G.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:G.boxShadowBlurRadius,color:G.boxShadowColor,hOffset:G.boxShadowHOffset,inset:G.boxShadowInset,spreadRadius:G.boxShadowSpreadRadius,vOffset:G.boxShadowVOffset}}})})},Ae=()=>{const G=s.getFieldsValue(!0);setTimeout(()=>{me(pe=>!pe),te?(G.mobileBoxShadowInset=!1,G.mobileBoxShadowHOffset=null,G.mobileBoxShadowVOffset=null,G.mobileBoxShadowBlurRadius=null,G.mobileBoxShadowSpreadRadius=null,G.mobileBoxShadowColor=""):(G.mobileBoxShadowInset=!1,G.mobileBoxShadowHOffset=5,G.mobileBoxShadowVOffset=5,G.mobileBoxShadowBlurRadius=10,G.mobileBoxShadowSpreadRadius=-5,G.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:G.mobileBoxShadowBlurRadius,color:G.mobileBoxShadowColor,hOffset:G.mobileBoxShadowHOffset,inset:G.mobileBoxShadowInset,spreadRadius:G.mobileBoxShadowSpreadRadius,vOffset:G.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Ge=()=>{const G=s.getFieldsValue(!0);setTimeout(()=>{ue(pe=>!pe),je&&(G.width="",G.minWidth="",G.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"}}}))})},Ye=()=>{const G=s.getFieldsValue(!0);setTimeout(()=>{Le(pe=>!pe),Ve&&(G.mobileWidth="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"}}}))})},Ze=()=>{const G=s.getFieldsValue(!0);setTimeout(()=>{he(pe=>!pe),ve?(G.backgroundColor="",G.backgroundImage="",G.backgroundPositionX="",G.backgroundPositionY="",G.backgroundRepeat="none",G.backgroundSize="",E(!0)):(G.backgroundColor="#E5E5E5",G.backgroundSize="",G.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:G.backgroundColor,backgroundImage:[{type:"url",value:G.backgroundImage}],backgroundPositionX:G.backgroundPositionX,backgroundPositionY:G.backgroundPositionY,backgroundRepeat:G.backgroundRepeat,backgroundSize:G.backgroundSize}})})},de=()=>{const G=s.getFieldsValue(!0);setTimeout(()=>{Z(pe=>!pe),be?G.mobileBackgroundColor="":G.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:G.mobileBackgroundColor}}}),be&&Dt(s,e,l)})},Ce=()=>{const G=s.getFieldsValue(!0);setTimeout(()=>{q(pe=>!pe),K&&(G.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:H.BORDER_POSITIONS[ee]||"borderAll",mobileBorderPosition:H.MOBILE_BORDER_POSITIONS[ne]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileBackgroundColor:"",mobileBackgroundImage:""},onValuesChange:D,autoComplete:"off",className:"element-controls",children:[!U&&(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"})}),R==="mobile"&&j.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(sl,{form:s,elementSettings:e,mobileBoxShadow:p,mobileBordersShow:P,mobileBorderRadiusShow:re,mobileBoxShadowShow:te,mobileSizeShow:Ve,mobileBackgroundShow:be,oneMobileBorderRadiusValue:k,setOneMobileBorderRadiusValue:x,toggleShowMobileBorderHandler:we,toggleShowMobileBorderRadiusHandler:Se,toggleShowMobileBoxShadowHandler:Ae,toggleShowMobileSizeHandler:Ye,toggleShowMobileBackgroundHandler:de})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Kr,{form:s,elementSettings:e,boxShadow:g,bordersShow:v,borderRadiusShow:le,boxShadowShow:_e,backgroundShow:ve,backgroundImageEmpty:N,backgroundRepeatOptions:Q,backgroundSizeOptions:V,sizeShow:je,modificationShow:K,oneBorderRadiusValue:_,setOneBorderRadiusValue:h,toggleShowBorderHandler:ie,toggleShowBorderRadiusHandler:W,toggleShowBoxShadowHandler:Oe,toggleShowSizeHandler:Ge,toggleShowBackgroundHandler:Ze,toggleShowModificationHandler:Ce})})]})};al.propTypes={elementSettings:f.default.object.isRequired};var nl=({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),[m,g]=(0,a.useState)({}),[b,_]=(0,a.useState)("https://"),h=({target:k})=>{const{selectionStart:x,selectionEnd:R}=k;k&&g({target:k,selection:{start:x,end:R}})};(0,a.useEffect)(()=>{if(e){let k="",x="",R=e.href==null?"https://":e.href;if(R&&R.substring(0,7)==="mailto:"){const j=new URL(e.href);k=j.searchParams.get("subject")||"",x=j.searchParams.get("body")||"",R=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:R,subject:k,body:x})}},[s,e]);const p=k=>{const x=Object.keys(k)[0];let R=k;if(x==="href"){const j=it(k[x]);if(j!==k[x]&&s.setFieldValue("href",j),j.substring(0,7)==="mailto:"){const N=s.getFieldValue("subject"),E=s.getFieldValue("body"),I=[];N&&I.push(`subject=${encodeURIComponent(N)}`),E&&I.push(`body=${encodeURIComponent(E)}`),R={href:I.length>0?`${j}?${I.join("&")}`:j}}else R={href:j}}if(x==="subject"||x==="body"){const j=s.getFieldValue("href")||"";if(j.substring(0,7)==="mailto:"){const N=j.split("?")[0],E=x==="subject"?k[x]:s.getFieldValue("subject"),I=x==="body"?k[x]:s.getFieldValue("body"),$=[];E&&$.push(`subject=${encodeURIComponent(E)}`),I&&$.push(`body=${encodeURIComponent(I)}`),R={href:$.length>0?`${N}?${$.join("&")}`:N}}else return}l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:R})},B=k=>{l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:k})};return(0,o.jsx)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_link_form",initialValues:{href:"https://",target:"",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1,textReplacer:"",subject:"",body:""},onValuesChange:p,autoComplete:"off",className:"element-controls",children:!d||c==="bottom"?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Hyperlink URL"),placement:"left",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:24,paddingRight:10},children:(0,o.jsx)(t.ui_kit$Input,{allowClear:!0,placeholder:i("Hyperlink URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined}),onSelect:h})})}),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:()=>B("add_img"),children:i("Add inline image")})})}),(0,o.jsx)(xt,{form:s,elementSettings:e,showAddParagraph:!1,linkTarget:m,linkProtocol:b,setLinkProtocol:_})]}):(0,o.jsx)(Ii,{form:s,elementSettings:e,showAddParagraph:!1})})};nl.propTypes={elementSettings:f.default.object.isRequired};var dl=()=>{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"})})})})};dl.propTypes={};var cl=({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)(rt,{form:e,name:"mobileHeight",elementSettings:i})})});cl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired};var ul=({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),m=r.useSelector(r.selectIsCodeMode),g=r.useSelector(r.selectCodeModeDirection),b=m&&g!=="bottom",_=r.useElementEntityKind(),{remember:h,fillFields:p}=ut(e);(0,a.useEffect)(()=>{e&&p(l,{...e,height:e.height?.value,heightDim:e.height?.dim,mobileHeight:xo(e.mobileHeight?.value||e.height?.value),mobileHeightDim:e.mobileHeight?.dim||e.height?.dim})},[l,e,p]);const B=(0,a.useCallback)(x=>{h(x),s(_==="email"?r.setElementSettings$1(x):r.setElementSettings(x))},[s,_,h]),k=x=>{const R=l.getFieldsValue(!0),j=Object.keys(x)[0];let N;switch(j){case"height":N={[j]:{value:x[j],dim:R.heightDim}};break;case"heightDim":N={height:{value:R.height,dim:x[j]}};break;case"mobileHeight":N={[j]:{classNamePrefix:"em-mob-height-",value:x[j],dim:R.mobileHeightDim}};break;case"mobileHeightDim":N={mobileHeight:{classNamePrefix:"em-mob-height-",value:R.mobileHeight,dim:x[j]}};break;default:N=x}n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:N}),B({...e,...N,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:[!b&&(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)(cl,{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)(dl,{})})]})};ul.propTypes={elementSettings:f.default.object.isRequired};var Vt=({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}})},m=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:m,onChange:c})})},Ht=e=>e.closest(".email-pane__collapse-wrapper")||e.parentNode,Ai=({form:e,backgroundImageEmpty:i,appConfig:l,token:s,elementSettings:n,backgroundRepeatOptions:d,handleChangeValues:c})=>{const{__:m}=r.useI18n(),[g,b]=(0,a.useState)(""),[_,h]=(0,a.useState)("px"),[p,B]=(0,a.useState)(""),[k,x]=(0,a.useState)("px"),R=[{label:m("Not defined"),value:""},{label:m("Contain"),value:"contain"},{label:m("Cover"),value:"cover"}],j=I=>{if(!I||typeof I!="string")return{value:"",unit:"px"};I=I.trim();const $=I.match(/^(\d*\.?\d+)(%|px)$/);return $?{value:$[1],unit:$[2]}:{value:I,unit:"px"}};(0,a.useEffect)(()=>{const I=e.getFieldValue("backgroundPositionX"),$=e.getFieldValue("backgroundPositionY"),U=j(I),v=j($);b(String(U.value)),h(U.unit),B(String(v.value)),x(v.unit)},[e]);const N=(I,$)=>{b(String(I)),h($),c&&c({backgroundPositionX:{position:I,unit:$}})},E=(I,$)=>{B(String(I)),x($),c&&c({backgroundPositionY:{position:I,unit:$}})};return(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:8},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:m("Background color"),placement:"bottom",getPopupContainer:Ht,children:(0,o.jsx)("div",{children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"backgroundColor",style:{marginBottom:s.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:m("Background color"),usedColors: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:m("Background image"),placement:"bottom",getPopupContainer:Ht,children:(0,o.jsx)("div",{children:(0,o.jsx)($o,{form:e,label:m("Background image"),name:"backgroundImage",tooltipTitle:m("Background image"),placeholder:m("Background image link/route")})})}),!i&&(0,o.jsxs)(t.ui_kit$Form.Item,{style:{marginBottom:"0"},children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:s.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$InputSelect,{options:Ft.horizontal,position:g,setPosition:I=>N(I,_),unit:_,setUnit:I=>N(g,I),placeholder:m("Horizontal position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal}),dropdownStyle:{bottom:"auto"},tooltipTitle:m("Horizontal position"),getTooltipPopupContainer:Ht})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$InputSelect,{options:Ft.vertical,position:p,setPosition:I=>E(I,k),unit:k,setUnit:I=>E(p,I),placeholder:m("Vertical position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical}),dropdownStyle:{bottom:"auto"},tooltipTitle:m("Vertical position"),getTooltipPopupContainer:Ht})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:m("Background image repeat"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"backgroundRepeat",style:{marginBottom:s.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{placeholder:m("Please choose"),options:d,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:m("Background image size"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"backgroundSize",style:{marginBottom:s.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{placeholder:m("Please choose"),options:R,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})})]})]})]})]})},zn=({form:e,elementSettings:i,__:l,appConfig:s})=>{const n=H.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:m=>m.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:n,getPopupContainer:m=>m.closest(".email-pane__collapse-wrapper")})})}),!i.showOnMobile&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:l("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:l("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(lo,{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)(lo,{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)(lo,{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)(lo,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:l(d?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Text color"),placement:"bottom",zIndex:2,getPopupContainer:m=>m.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:l("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l("Color"),usedColors:i.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Text background"),placement:"bottom",zIndex:2,getPopupContainer:m=>m.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:l("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l("Background color"),usedColors:i.usedColors})})})})]})]})},ml=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:n,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:m,backgroundRepeatOptions:g,sizeShow:b,maxWidthValue:_,modificationShow:h,paddingsExt:p,oneBorderRadiusValue:B,setOneBorderRadiusValue:k,elementListShow:x,togglePaddingHandler:R,toggleShowBorderHandler:j,toggleShowBorderRadiusHandler:N,toggleShowBoxShadowHandler:E,toggleShowSizeHandler:I,toggleShowBackgroundHandler:$,toggleShowModificationHandler:U,handleChangeValues:v})=>{const{__:L}=r.useI18n(),{token:P}=(0,t.ui_kit$useToken)(),z=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)(lt,{form:e,elementSettings:i})}),z.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)(Do,{form:e,elementSettings:i})})]}),z.formCellFieldPaddingsEnabled&&(0,o.jsxs)(o.Fragment,{children:[x&&(0,o.jsx)("div",{style:{marginTop:"15px"},children:(0,o.jsx)(zn,{form:e,elementSettings:i,appConfig:z,__:L})}),(0,o.jsx)(t.ui_kit$FormSection,{title:L("Padding"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:p,onToggleExtended:R,showHorizontal:i.type!=="group"&&i.type!=="column",rowStyle:{paddingBottom:4},labels:{horizontal:L("Horizontal padding"),vertical:L("Vertical padding"),left:L("Left padding"),right:L("Right padding"),top:L("Top padding"),bottom:L("Bottom padding"),individual:L("Individual padding")}})})]}),i.type!=="group"&&z.formCellFieldSizeEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:L("Size"),collapsible:!0,open:b,onToggle:I,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{showWidth:i.type!=="structure"&&i.type!=="column",maxWidth:_,dimensionSelect:Fo,rowStyle:{paddingBottom:4},labels:{width:L("Width"),height:L("Height"),minWidth:L("Minimum width"),maxWidth:L("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:L("Background"),collapsible:!0,open:c,onToggle:$,dividerTop:!0,children:[(0,o.jsx)(Ai,{form:e,backgroundImageEmpty:m,appConfig:z,token:P,elementSettings:i,backgroundRepeatOptions:g,handleChangeValues:v}),(0,o.jsx)(st,{form:e,showBackground:!0})]}),z.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:L("Borders"),collapsible:!0,open:s,onToggle:j,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e,elementSettings:i})}),z.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:L("Border radius"),collapsible:!0,open:n,onToggle:N,dividerTop:!0,children:(0,o.jsx)(wo,{form:e,oneBorderRadiusValue:B,setOneBorderRadiusValue:k,elementSettings:i})}),z.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:L("Box shadow"),collapsible:!0,open:d,onToggle:E,dividerTop:!0,children:(0,o.jsx)(Po,{})}),z.formFieldExportAsPictureEnabled&&i.type!=="group"&&(0,o.jsxs)(t.ui_kit$FormSection,{title:L("Settings"),collapsible:!0,open:h,onToggle:U,dividerTop:!0,children:[i.type==="structure"&&(0,o.jsx)(t.ui_kit$Tooltip,{title:L("The block will change its colors to contrasting colors. You can change them in the Content Styles section."),children:(0,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:L("Contrast block"),size:"small",labelStyle:{position:"relative",top:2}})})},"isContrastBlock"),(0,o.jsx)(vi,{form:e,elementSettings:i})]}),z.formFieldVisibilityEnabled&&i.type!=="column"&&(0,o.jsx)(t.ui_kit$FormSection,{title:L(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)(Vt,{elementSettings:i,form:e}):void 0})}),z.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:L("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(No,{})})]})};ml.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 Ut=({form:e,elementSettings:i,mobilePaddingsExt:l,setMobilePaddingsExt:s,rowStyle:n})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),m=()=>{s(b=>!b);const g=e.getFieldsValue(!0);l||(g.mobilePaddingLeftRight=g.mobilePaddingLeft,g.mobilePaddingTopBottom=g.mobilePaddingTop,g.mobilePaddingRight=g.mobilePaddingLeft,g.mobilePaddingBottom=g.mobilePaddingTop,c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobilePadding:{top:g.mobilePaddingTop!==""?g.mobilePaddingTop:null,bottom:g.mobilePaddingTopBottom!==""?g.mobilePaddingTopBottom:null,left:g.mobilePaddingLeft!==""?g.mobilePaddingLeft:null,right:g.mobilePaddingRight!==""?g.mobilePaddingRight:null,classNamePrefix:"em-mob-padding_"}}}))};return(0,o.jsx)(t.ui_kit$FormPaddingInputs,{typeOfForm:"mobile",extended:l,onToggleExtended:m,showHorizontal:!0,gutter:10,rowStyle:n,labels:{horizontal:d("Horizontal padding"),vertical:d("Vertical padding"),left:d("Left padding"),right:d("Right padding"),top:d("Top padding"),bottom:d("Bottom padding"),individual:d("Individual padding")}})};Ut.propTypes={form: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};var pl=({form:e,elementSettings:i,boxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:n,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:m,mobilePaddingShow:g,mobilePaddingsExt:b,setMobilePaddingsExt:_,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:p,toggleShowMobileBorderHandler:B,toggleShowMobileBorderRadiusHandler:k,toggleShowMobileBoxShadowHandler:x,toggleShowMobileSizeHandler:R,toggleShowMobileBackgroundHandler:j,toggleShowMobilePaddingHandler:N})=>{const{__:E}=r.useI18n(),I=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(zo,{form:e,elementSettings:i,imgParent:!0,typeOfForm:"mobile"})}),I.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)(Do,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),I.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Padding"),collapsible:!0,open:g,onToggle:N,dividerTop:!0,children:(0,o.jsx)(Ut,{form:e,elementSettings:i,mobilePaddingsExt:b,setMobilePaddingsExt:_,rowStyle:{paddingBottom:4}})}),i.type!=="group"&&I.formCellFieldSizeEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Size"),collapsible:!0,open:c,onToggle:R,dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:9},children:[i.type!=="structure"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:15},children:(0,o.jsx)(Go,{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)(rt,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:E("Background"),collapsible:!0,open:m,onToggle:j,dividerTop:!0,children:(0,o.jsx)(Bt,{elementSettings:Yo(i),imageEnabled:I.formCellFieldBackgroundImageEnabled,desktopBackground:Et(i)})}),I.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Borders"),collapsible:!0,open:s,onToggle:B,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),I.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Border radius"),collapsible:!0,open:n,onToggle:k,dividerTop:!0,children:(0,o.jsx)(wo,{form:e,oneBorderRadiusValue:h,setOneBorderRadiusValue:p,elementSettings:i,typeOfForm:"mobile"})}),I.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Box shadow"),collapsible:!0,open:d,onToggle:x,dividerTop:!0,children:(0,o.jsx)(Po,{typeOfForm:"mobile"})}),I.formFieldVisibilityEnabled&&i.type!=="column"&&(0,o.jsx)(t.ui_kit$FormSection,{title:E(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)(Vt,{elementSettings:i,form:e,typeOfForm:"mobile"}):void 0})}),I.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(No,{})})]})};pl.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};var hl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),s=r.useDispatch(),[n]=t.ui_kit$Form.useForm(),d=Mo(),c=Mo(),[m,g]=(0,a.useState)(""),[b,_]=(0,a.useState)({}),[h,p]=(0,a.useState)(!0),[B,k]=(0,a.useState)(!0),x=r.useSelector(r.selectEmailViewType),R=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[j,N]=(0,a.useState)(e.backgroundImage[0].value===""),E=r.useSelector(r.selectIsCodeMode),I=r.useSelector(r.selectCodeModeDirection),$=E&&I!=="bottom",[U,v]=(0,a.useState)(!1),[L,P]=(0,a.useState)(!1),[z,le]=(0,a.useState)(!1),[C,re]=(0,a.useState)(!1),[ae,_e]=(0,a.useState)(!1),[Te,te]=(0,a.useState)(!1),[me,je]=(0,a.useState)(!1),[ue,Ve]=(0,a.useState)(!1),[Le,ve]=(0,a.useState)(!1),[he,be]=(0,a.useState)(!1),[Z,K]=(0,a.useState)(!1),[q,Q]=(0,a.useState)(!1),[V,M]=(0,a.useState)(!1),[Y,X]=(0,a.useState)(!1),[ee,ne]=(0,a.useState)(!1),Be=r.useElementEntityKind(),Ee=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],oe=e.border,D=e.mobileBorder,ie=Object.keys(oe).find(w=>oe[w]?.width||oe[w]?.style||oe[w]?.color),we=Object.keys(D).find(w=>D[w]?.width||D[w]?.style||D[w]?.color),W=w=>w&&(w?.width||w?.style||w?.color)?w:"",{remember:Se,fillFields:Oe}=ut(e);(0,a.useEffect)(()=>{if(e){const w=e.boxShadow;_(w),Oe(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:W(e.mobileBorder.all)||!(W(e.mobileBorder.top)||W(e.mobileBorder.bottom)||W(e.mobileBorder.right)||W(e.mobileBorder.left))&&W(e.border.all),mobileBorderTop:W(e.mobileBorder.top)||!W(e.mobileBorder.all)&&W(e.border.top),mobileBorderBottom:W(e.mobileBorder.bottom)||!W(e.mobileBorder.all)&&W(e.border.bottom),mobileBorderRight:W(e.mobileBorder.right)||!W(e.mobileBorder.all)&&W(e.border.right),mobileBorderLeft:W(e.mobileBorder.left)||!W(e.mobileBorder.all)&&W(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:xo(e.mobileWidth?.value)||xo(e.width?.value),mobileWidthDim:xo(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:xo(e.mobileHeight?.value)||xo(e.height?.value),mobileHeightDim:xo(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||""),...at(e),mobilePaddingTop:u(e.mobilePadding.all)||u(e.mobilePadding.top)||u(e.padding?.all)||u(e.padding?.top),mobilePaddingLeft:u(e.mobilePadding.all)||u(e.mobilePadding.left)||u(e.padding?.all)||u(e.padding?.left),mobilePaddingRight:u(e.mobilePadding.all)||u(e.mobilePadding.right)||u(e.padding?.all)||u(e.padding?.right),mobilePaddingBottom:u(e.mobilePadding.all)||u(e.mobilePadding.bottom)||u(e.padding?.all)||u(e.padding?.bottom),mobilePaddingTopBottom:u(e.mobilePadding.top)||u(e.mobilePadding.bottom)||u(e.padding?.top)||u(e.padding?.bottom),mobilePaddingLeftRight:u(e.mobilePadding.left)||u(e.mobilePadding.right)||u(e.padding?.left)||u(e.padding?.right),exportAsPicture:e?.exportAsPicture}),!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?p(!1):p(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||!u(e.borderRadius.all)&&!u(e.mobileBorderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?k(!1):k(!0),N(e.backgroundImage[0].value===""),!u(e.padding.all)&&(u(e.padding.top)||u(e.padding.right)||u(e.padding.bottom)||u(e.padding.left))&&(e.padding.top!==e.padding.bottom||e.padding.right!==e.padding.left)?v(!1):v(!0),!u(e.mobilePadding.all)&&(u(e.mobilePadding.top)||u(e.mobilePadding.right)||u(e.mobilePadding.bottom)||u(e.mobilePadding.left))&&(e.mobilePadding.top!==e.mobilePadding.bottom||e.mobilePadding.right!==e.mobilePadding.left)||!u(e.padding?.all)&&(u(e.padding?.top)||u(e.padding?.right)||u(e.padding?.bottom)||u(e.padding?.left))&&(e.padding?.top!==e.padding?.bottom||e.padding?.right!==e.padding?.left)?P(!1):P(!0);const y=d.isStaleBorderSnapshot(e,!!ie),ce=c.isStaleBorderSnapshot(e,!!we);y&&n.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(ce||y&&!we)&&n.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),le(Ie=>ie&&!y?!0:Ie),re(Ie=>ie&&!y||we&&!ce?!0:Ie),_e(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),te(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight||!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),je(!!e.boxShadow),Ve(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),ve(!!e.width.value&&e.type!=="column"||!!e.height.value),be(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value&&e.type!=="column"||!!e.height.value),K(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Q(!!e.mobileBackgroundColor.value||!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Mt(e)&&Q(!0),M(!!e.exportAsPicture||!!e.isContrastBlock),X(!!e.mobilePadding.all||e.mobilePadding.all===0||!!e.mobilePadding.top||e.mobilePadding.top===0||!!e.mobilePadding.bottom||e.mobilePadding.bottom===0||!!e.mobilePadding.left||e.mobilePadding.left===0||!!e.mobilePadding.right||e.mobilePadding.right===0||!!e.padding.all||e.padding.all===0||!!e.padding.top||e.padding.top===0||!!e.padding.bottom||e.padding.bottom===0||!!e.padding.left||e.padding.left===0||!!e.padding.right||e.padding.right===0),e.elementName==="List"?ne(!0):ne(!1)}},[n,e,ie,we,d,c,Oe]);const Ae=(0,a.useCallback)(w=>{Se(w),s(Be==="email"?r.setElementSettings$1(w):r.setElementSettings(w))},[s,Be,Se]),Ge=w=>{const y=n.getFieldsValue(!0),ce=Object.keys(w)[0];let Ie;switch(g(n.getFieldsValue(!0).widthDim==="%"?100:""),ce){case"exportAsPicture":Ie={exportAsPicture:y.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Ie={boxShadow:{hOffset:y.boxShadowHOffset,vOffset:y.boxShadowVOffset,blurRadius:y.boxShadowBlurRadius,spreadRadius:y.boxShadowSpreadRadius,color:y.boxShadowColor,inset:y.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":y.borderPosition==="borderAll"?(Ie={border:{...r.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...y.borderAll}}},n.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER})):y.borderAll?.width||y.borderAll?.style||y.borderAll?.color?(Ie={border:{all:null,left:y.borderAll,right:y.borderAll,top:y.borderAll,bottom:y.borderAll,[H.REVERSE_BORDER_POSITIONS[ce]]:{...y[ce],...w[ce]}}},n.setFieldsValue({borderAll:null,borderLeft:y.borderAll,borderRight:y.borderAll,borderTop:y.borderAll,borderBottom:y.borderAll,[ce]:{...y[ce],...w[ce]}})):(Ie={border:{all:null,left:y.borderLeft,right:y.borderRight,top:y.borderTop,bottom:y.borderBottom,[H.REVERSE_BORDER_POSITIONS[ce]]:{...y[ce],...w[ce]}}},n.setFieldsValue({border:Ie.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(y.mobileBorderPosition==="mobileBorderAll")Ie={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...y.mobileBorderAll,classNamePrefix:"em-mob-border_"+H.MOBILE_REVERSE_BORDER_POSITIONS[ce]+"-"}}},n.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER});else{const Xe=H.MOBILE_REVERSE_BORDER_POSITIONS[ce],oo={...y[ce],...w[ce]},po=!oo?.width&&!oo?.style&&!oo?.color;if(y.mobileBorder?.all?.width||y.mobileBorder?.all?.style||y.mobileBorder?.all?.color){const co=y.mobileBorderAll;Ie={mobileBorder:{all:null,left:co,right:co,top:co,bottom:co,[Xe]:po?null:{...oo,classNamePrefix:"em-mob-border_"+Xe+"-"}}},n.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:co,mobileBorderRight:co,mobileBorderTop:co,mobileBorderBottom:co,[ce]:oo})}else{const co=e.mobileBorder||{},_o=Io=>{const Co=co[Io];return Co&&(Co?.width||Co?.style||Co?.color)?Co:null};Ie={mobileBorder:{all:null,left:Xe==="left"?po?null:{...oo,classNamePrefix:"em-mob-border_left-"}:_o("left"),right:Xe==="right"?po?null:{...oo,classNamePrefix:"em-mob-border_right-"}:_o("right"),top:Xe==="top"?po?null:{...oo,classNamePrefix:"em-mob-border_top-"}:_o("top"),bottom:Xe==="bottom"?po?null:{...oo,classNamePrefix:"em-mob-border_bottom-"}:_o("bottom")}},n.setFieldsValue({[ce]:oo})}}break;case"width":Ie={[ce]:{value:w[ce],dim:y.widthDim}};break;case"height":Ie={[ce]:{value:w[ce],dim:y.heightDim}};break;case"widthDim":Ie={width:{value:y.width,dim:w[ce]}};break;case"heightDim":Ie={height:{value:y.height,dim:w[ce]}};break;case"backgroundImage":N(w[ce]===""),Ie={[ce]:[{...e.backgroundImage[0],value:w[ce]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":Ie={padding:{left:y.paddingLeft,right:y.paddingRight,top:y.paddingTop,bottom:y.paddingBottom,[H.PADDING_POSITION[ce]]:+w[ce]}};break;case"paddingTopBottom":Ie={padding:{left:y.paddingLeft,right:y.paddingRight,top:+w[ce],bottom:+w[ce]}},y.paddingTop=y.paddingBottom=+w[ce];break;case"paddingLeftRight":Ie={padding:{top:y.paddingTop,bottom:y.paddingBottom,left:+w[ce],right:+w[ce]}},y.paddingLeft=y.paddingRight=+w[ce];break;case"borderRadiusAll":Ie={borderRadius:{[H.BORDER_RADIUS_POSITION[ce]]:+w[ce]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Ie={borderRadius:{topLeft:y.borderRadiusTopLeft,bottomLeft:y.borderRadiusBottomLeft,topRight:y.borderRadiusTopRight,bottomRight:y.borderRadiusBottomRight,[H.BORDER_RADIUS_POSITION[ce]]:+w[ce]}};break;case"mobileWidth":Ie={[ce]:{classNamePrefix:"em-mob-width-",value:w[ce],dim:y.mobileWidthDim}};break;case"mobileWidthDim":Ie={mobileWidth:{classNamePrefix:"em-mob-width-",value:y.mobileWidth||100,dim:w[ce]}};break;case"mobileHeight":Ie={[ce]:{classNamePrefix:"em-mob-height-",value:w[ce],dim:y.mobileHeightDim}};break;case"mobileHeightDim":Ie={mobileHeight:{classNamePrefix:"em-mob-height-",value:y.mobileHeight,dim:w[ce]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Ie={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[ce]]:w[ce],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[ce]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Ie={mobileBoxShadow:{hOffset:y.mobileBoxShadowHOffset,vOffset:y.mobileBoxShadowVOffset,blurRadius:y.mobileBoxShadowBlurRadius,spreadRadius:y.mobileBoxShadowSpreadRadius,color:y.mobileBoxShadowColor,inset:y.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":Ie={[ce]:{classNamePrefix:"em-mob-text_align-",value:w[ce]}};break;case"mobileVerticalAlign":Ie={[ce]:{classNamePrefix:"em-mob-vertical_align-",value:w[ce]}};break;case"mobileDirection":Ie={[ce]:{classNamePrefix:"em-mob-direction-",value:w[ce]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Ie=kt(w),!Ie)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":Ie={mobilePadding:{all:null,top:y.mobilePaddingTop!==""?y.mobilePaddingTop:null,right:y.mobilePaddingRight!==""?y.mobilePaddingRight:null,bottom:y.mobilePaddingBottom!==""?y.mobilePaddingBottom:null,left:y.mobilePaddingLeft!==""?y.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":y.mobilePaddingTop=y.mobilePaddingBottom=w[ce],Ie={mobilePadding:{all:null,top:y.mobilePaddingTop!==""?y.mobilePaddingTop:null,right:y.mobilePaddingRight!==""?y.mobilePaddingRight:null,bottom:y.mobilePaddingBottom!==""?y.mobilePaddingBottom:null,left:y.mobilePaddingLeft!==""?y.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":y.mobilePaddingLeft=y.mobilePaddingRight=w[ce],Ie={mobilePadding:{all:null,top:y.mobilePaddingTop!==""?y.mobilePaddingTop:null,right:y.mobilePaddingRight!==""?y.mobilePaddingRight:null,bottom:y.mobilePaddingBottom!==""?y.mobilePaddingBottom:null,left:y.mobilePaddingLeft!==""?y.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"backgroundPositionX":case"backgroundPositionY":Ie={[ce]:isNaN(parseFloat(w[ce].position))?w[ce].position:w[ce].position+w[ce].unit};break;default:Ie=w}ce!=="borderPosition"&&ce!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ie}),ce!=="mobileBorderRadiusAll"&&ce!=="mobileBorderRadiusTopLeft"&&ce!=="mobileBorderRadiusTopRight"&&ce!=="mobileBorderRadiusBottomLeft"&&ce!=="mobileBorderRadiusBottomRight"&&Ae({...e,...Ie,mobileBorderRadius:{...e.mobileBorderRadius,...Ie?.mobileBorderRadius},activateSection:null,changeKey:ce}))},Ye=()=>{v(y=>!y);const w=n.getFieldsValue(!0);U||(w.paddingLeftRight=w.paddingLeft,w.paddingTopBottom=w.paddingTop,w.paddingRight=w.paddingLeft,w.paddingBottom=w.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:w.paddingTopBottom,bottom:w.paddingTopBottom,left:w.paddingLeftRight,right:w.paddingLeftRight}}}))},Ze=()=>{const w=n.getFieldsValue(!0);d.markBorderToggled(!z),setTimeout(()=>{le(y=>!y),z?(w.borderAll=H.NULL_BORDER,w.borderTop=H.NULL_BORDER,w.borderBottom=H.NULL_BORDER,w.borderRight=H.NULL_BORDER,w.borderLeft=H.NULL_BORDER):w.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:w.borderAll.color,style:w.borderAll.style,width:w.borderAll.width}}}})})},de=()=>{const w=n.getFieldsValue(!0);c.markBorderToggled(!C),setTimeout(()=>{re(y=>!y),C?(w.mobileBorderAll=H.NULL_BORDER,w.mobileBorderTop=H.NULL_BORDER,w.mobileBorderBottom=H.NULL_BORDER,w.mobileBorderRight=H.NULL_BORDER,w.mobileBorderLeft=H.NULL_BORDER):w.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:w.mobileBorderAll.color,style:w.mobileBorderAll.style,width:w.mobileBorderAll.width}}}})})},Ce=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{_e(y=>!y),ae?(w.borderRadiusAll=0,p(!0)):w.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:w.borderRadiusAll}}})})},G=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{te(y=>!y),Te?(w.mobileBorderRadiusAll=null,k(!0)):w.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:w.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},pe=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{je(y=>!y),me?(w.boxShadowInset=!1,w.boxShadowHOffset=null,w.boxShadowVOffset=null,w.boxShadowBlurRadius=null,w.boxShadowSpreadRadius=null,w.boxShadowColor=""):(w.boxShadowInset=!1,w.boxShadowHOffset=5,w.boxShadowVOffset=5,w.boxShadowBlurRadius=10,w.boxShadowSpreadRadius=-5,w.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:w.boxShadowBlurRadius,color:w.boxShadowColor,hOffset:w.boxShadowHOffset,inset:w.boxShadowInset,spreadRadius:w.boxShadowSpreadRadius,vOffset:w.boxShadowVOffset}}})})},Pe=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{Ve(y=>!y),ue?(w.mobileBoxShadowInset=!1,w.mobileBoxShadowHOffset=null,w.mobileBoxShadowVOffset=null,w.mobileBoxShadowBlurRadius=null,w.mobileBoxShadowSpreadRadius=null,w.mobileBoxShadowColor=""):(w.mobileBoxShadowInset=!1,w.mobileBoxShadowHOffset=5,w.mobileBoxShadowVOffset=5,w.mobileBoxShadowBlurRadius=10,w.mobileBoxShadowSpreadRadius=-5,w.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:w.mobileBoxShadowBlurRadius,color:w.mobileBoxShadowColor,hOffset:w.mobileBoxShadowHOffset,inset:w.mobileBoxShadowInset,spreadRadius:w.mobileBoxShadowSpreadRadius,vOffset:w.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},We=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{ve(y=>!y),Le&&(w.width="",w.height="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{width:{value:null,dim:"px"},height:{value:null,dim:"px"}}}))})},to=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{be(y=>!y),he&&(w.mobileWidth="",w.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-"}}}))})},eo=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{K(y=>!y),Z?(w.backgroundColor="",w.backgroundImage="",w.backgroundPositionX="",w.backgroundPositionY="",w.backgroundRepeat="none",w.backgroundSize="",N(!0)):(w.backgroundColor="#E5E5E5",w.backgroundSize="",w.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:w.backgroundColor,backgroundImage:[{type:"url",value:w.backgroundImage}],backgroundPositionX:w.backgroundPositionX,backgroundPositionY:w.backgroundPositionY,backgroundRepeat:w.backgroundRepeat,backgroundSize:w.backgroundSize}})})},no=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{Q(y=>!y),q?w.mobileBackgroundColor="":w.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:w.mobileBackgroundColor}}}),q&&Dt(n,e,l)})},O=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{M(y=>!y),V&&(w.exportAsPicture=!1,w.isContrastBlock=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1,isContrastBlock:!1}}))})},se=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{X(y=>!y),Y&&(w.mobilePaddingLeftRight="",w.mobilePaddingLeft="",w.mobilePaddingRight="",w.mobilePaddingTopBottom="",w.mobilePaddingTop="",w.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:H.BORDER_POSITIONS[ie]||"borderAll",mobileBorderPosition:H.MOBILE_BORDER_POSITIONS[we]||"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:Ge,autoComplete:"off",className:"element-controls",children:x==="mobile"&&R.styles?(0,o.jsxs)("div",{className:"selected_form-mobile-props-wrapper",style:{display:x==="mobile"&&R.styles?"flex":"none"},children:[(0,o.jsx)("div",{className:"selected_form-mobile-props-header",children:!$&&(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)(pl,{form:n,elementSettings:e,boxShadow:b,mobileBordersShow:C,mobileBorderRadiusShow:Te,mobileBoxShadowShow:ue,mobileSizeShow:he,mobileBackgroundShow:q,mobilePaddingShow:Y,mobilePaddingsExt:L,setMobilePaddingsExt:P,oneMobileBorderRadiusValue:B,setOneMobileBorderRadiusValue:k,toggleShowMobileBorderHandler:de,toggleShowMobileBorderRadiusHandler:G,toggleShowMobileBoxShadowHandler:Pe,toggleShowMobileSizeHandler:to,toggleShowMobileBackgroundHandler:no,toggleShowMobilePaddingHandler:se})})]}):(0,o.jsxs)(o.Fragment,{children:[!$&&(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)(ml,{form:n,elementSettings:e,boxShadow:b,bordersShow:z,borderRadiusShow:ae,boxShadowShow:me,backgroundShow:Z,backgroundImageEmpty:j,backgroundRepeatOptions:Ee,sizeShow:Le,maxWidthValue:m,modificationShow:V,paddingsExt:U,oneBorderRadiusValue:h,setOneBorderRadiusValue:p,elementListShow:ee,togglePaddingHandler:Ye,toggleShowBorderHandler:Ze,toggleShowBorderRadiusHandler:Ce,toggleShowBoxShadowHandler:pe,toggleShowSizeHandler:We,toggleShowBackgroundHandler:eo,toggleShowModificationHandler:O,handleChangeValues:Ge})})]})})};hl.propTypes={elementSettings:f.default.object.isRequired};var bl=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:n,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:m,backgroundRepeatOptions:g,sizeShow:b,maxWidthValue:_,modificationShow:h,paddingShow:p,paddingsExt:B,oneBorderRadiusValue:k,setOneBorderRadiusValue:x,togglePaddingHandler:R,toggleShowPaddingHandler:j,toggleShowBorderHandler:N,toggleShowBorderRadiusHandler:E,toggleShowBoxShadowHandler:I,toggleShowSizeHandler:$,toggleShowBackgroundHandler:U,toggleShowModificationHandler:v,handleChangeValues:L})=>{const{__:P}=r.useI18n(),{token:z}=(0,t.ui_kit$useToken)(),le=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:P("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)(lt,{form:e,elementSettings:i})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Do,{form:e,elementSettings:i})})]}),le.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("Padding"),collapsible:!0,open:p,onToggle:j,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:B,onToggleExtended:R,labels:{horizontal:P("Horizontal padding"),vertical:P("Vertical padding"),left:P("Left padding"),right:P("Right padding"),top:P("Top padding"),bottom:P("Bottom padding"),individual:P("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:P("Size"),collapsible:!0,open:b,onToggle:$,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:_,dimensionSelect:Fo,showMinMax:!0,minWidthDimensionSelect:Fo,maxWidthDimensionSelect:Fo,labels:{width:P("Width"),height:P("Height"),minWidth:P("Minimum width"),maxWidth:P("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:P("Background"),collapsible:!0,open:c,onToggle:U,dividerTop:!0,children:[(0,o.jsx)(Ai,{form:e,backgroundImageEmpty:m,appConfig:le,token:z,elementSettings:i,backgroundRepeatOptions:g,handleChangeValues:L}),(0,o.jsx)(st,{form:e,showBackground:!0})]}),le.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("Borders"),collapsible:!0,open:s,onToggle:N,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e,elementSettings:i})}),le.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("Border radius"),collapsible:!0,open:n,onToggle:E,dividerTop:!0,children:(0,o.jsx)(wo,{form:e,oneBorderRadiusValue:k,setOneBorderRadiusValue:x,elementSettings:i})}),le.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("Box shadow"),collapsible:!0,open:d,onToggle:I,dividerTop:!0,children:(0,o.jsx)(Po,{})}),le.formFieldExportAsPictureEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("Export settings"),collapsible:!0,open:h,onToggle:v,dividerTop:!0,children:(0,o.jsx)(vi,{form:e,elementSettings:i})}),le.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("Display control & Direction"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e,directionControl:(0,o.jsx)(Vt,{elementSettings:i,form:e})})}),le.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:P("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(No,{})})]})};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,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 gl=({form:e,elementSettings:i,mobileBoxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:n,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:m,mobilePaddingShow:g,mobilePaddingsExt:b,setMobilePaddingsExt:_,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:p,toggleShowMobileBorderHandler:B,toggleShowMobileBorderRadiusHandler:k,toggleShowMobileBoxShadowHandler:x,toggleShowMobileSizeHandler:R,toggleShowMobileBackgroundHandler:j,toggleShowMobilePaddingHandler:N})=>{const{__:E}=r.useI18n(),{token:I}=(0,t.ui_kit$useToken)(),$=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)($t,{form:e,elementSettings:i,imgParent:!0})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Do,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),$.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Padding"),collapsible:!0,open:g,onToggle:N,dividerTop:!0,children:(0,o.jsx)(Ut,{form:e,elementSettings:i,mobilePaddingsExt:b,setMobilePaddingsExt:_})}),(0,o.jsx)(t.ui_kit$FormSection,{title:E("Size"),collapsible:!0,open:c,onToggle:R,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:I.formItemMarginBottomXS*2},children:(0,o.jsx)(Go,{form:e,name:"mobileWidth",elementSettings:i})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:I.formItemMarginBottomXS},children:(0,o.jsx)(rt,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:E("Background"),collapsible:!0,open:m,onToggle:j,dividerTop:!0,children:(0,o.jsx)(Bt,{elementSettings:Yo(i),imageEnabled:$.formDivFieldBackgroundImageEnabled,desktopBackground:Et(i)})}),$.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Borders"),collapsible:!0,open:s,onToggle:B,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),$.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Border radius"),collapsible:!0,open:n,onToggle:k,dividerTop:!0,children:(0,o.jsx)(wo,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:h,setOneBorderRadiusValue:p,elementSettings:i})}),$.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Box shadow"),collapsible:!0,open:d,onToggle:x,dividerTop:!0,children:(0,o.jsx)(Po,{typeOfForm:"mobile",form:e,elementSettings:i})}),$.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Display control & Direction"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e,directionControl:(0,o.jsx)(Vt,{elementSettings:i,form:e,typeOfForm:"mobile"})})}),$.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(No,{})})]})};gl.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 fl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),n=Mo(),d=Mo(),[c,m]=(0,a.useState)({}),[g,b]=(0,a.useState)(!0),[_,h]=(0,a.useState)({}),[p,B]=(0,a.useState)(!0),k=r.useSelector(r.selectEmailViewType),x=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[R,j]=(0,a.useState)(e.backgroundImage[0].value===""),N=r.useSelector(r.selectIsCodeMode),E=r.useSelector(r.selectCodeModeDirection),I=N&&E!=="bottom",[$,U]=(0,a.useState)(!1),[v,L]=(0,a.useState)(!1),[P,z]=(0,a.useState)(!1),[le,C]=(0,a.useState)(!1),[re,ae]=(0,a.useState)(!1),[_e,Te]=(0,a.useState)(!1),[te,me]=(0,a.useState)(!1),[je,ue]=(0,a.useState)(!1),[Ve,Le]=(0,a.useState)(!1),[ve,he]=(0,a.useState)(!1),[be,Z]=(0,a.useState)(!1),[K,q]=(0,a.useState)(!1),[Q,V]=(0,a.useState)(!1),[M,Y]=(0,a.useState)(!1),[X,ee]=(0,a.useState)(!1),[ne,Be]=(0,a.useState)(""),Ee=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}];i("Not defined"),i("Contain"),i("Cover");const oe=e.border,D=e.mobileBorder,ie=Object.keys(oe).find(O=>oe[O]?.width||oe[O]?.style||oe[O]?.color),we=Object.keys(D).find(O=>D[O]?.width||D[O]?.style||D[O]?.color),W=O=>O&&(O?.width||O?.style||O?.color)?O:"";(0,a.useEffect)(()=>{if(e){const O=e.boxShadow,se=e.mobileBoxShadow;m(O),h(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:W(e.mobileBorder.all)||!(W(e.mobileBorder.top)||W(e.mobileBorder.bottom)||W(e.mobileBorder.right)||W(e.mobileBorder.left))&&W(e.border.all),mobileBorderTop:W(e.mobileBorder.top)||!W(e.mobileBorder.all)&&W(e.border.top),mobileBorderBottom:W(e.mobileBorder.bottom)||!W(e.mobileBorder.all)&&W(e.border.bottom),mobileBorderRight:W(e.mobileBorder.right)||!W(e.mobileBorder.all)&&W(e.border.right),mobileBorderLeft:W(e.mobileBorder.left)||!W(e.mobileBorder.all)&&W(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:xo(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileHeight:xo(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:""),...at(e),mobilePaddingTop:u(e.mobilePadding.all)||u(e.mobilePadding.top),mobilePaddingLeft:u(e.mobilePadding.all)||u(e.mobilePadding.left),mobilePaddingRight:u(e.mobilePadding.all)||u(e.mobilePadding.right),mobilePaddingBottom:u(e.mobilePadding.all)||u(e.mobilePadding.bottom),mobilePaddingTopBottom:u(e.mobilePadding.top)||u(e.mobilePadding.bottom),mobilePaddingLeftRight:u(e.mobilePadding.left)||u(e.mobilePadding.right),exportAsPicture:e?.exportAsPicture}),!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?b(!1):b(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))?B(!1):B(!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)?U(!1):U(!0),!u(e.mobilePadding.all)&&(u(e.mobilePadding.top)||u(e.mobilePadding.right)||u(e.mobilePadding.bottom)||u(e.mobilePadding.left))&&(e.mobilePadding.top!==e.mobilePadding.bottom||e.mobilePadding.right!==e.mobilePadding.left)?L(!1):L(!0);const w=n.isStaleBorderSnapshot(e,!!ie),y=d.isStaleBorderSnapshot(e,!!we);w&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(y||w&&!we)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),z(ce=>ie&&!w?!0:ce),C(ce=>ie&&!w||we&&!y?!0:ce),ae(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),Te(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),me(!!e.boxShadow),ue(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),Le(!!e.width.value||!!e.height.value||!!e.minWidth.value||!!e.maxWidth.value),he(!!e.mobileWidth.value||!!e.mobileHeight.value),Z(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),q(Mt(e)),V(!!e.exportAsPicture),Y(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),ee(!!e.mobilePadding.all||!!e.mobilePadding.top||!!e.mobilePadding.bottom||!!e.mobilePadding.left||!!e.mobilePadding.right)}},[s,e,ie,we,n,d]);const Se=O=>{const se=s.getFieldsValue(!0),w=Object.keys(O)[0];let y;switch(Be(s.getFieldsValue(!0).widthDim==="%"?100:""),w){case"exportAsPicture":y={exportAsPicture:se.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":y={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"?(y={border:{...r.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...se.borderAll}}},s.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER})):se.borderAll?.width||se.borderAll?.style||se.borderAll?.color?(y={border:{all:null,left:se.borderAll,right:se.borderAll,top:se.borderAll,bottom:se.borderAll,[H.REVERSE_BORDER_POSITIONS[w]]:{...se[w],...O[w]}}},s.setFieldsValue({borderAll:null,borderLeft:se.borderAll,borderRight:se.borderAll,borderTop:se.borderAll,borderBottom:se.borderAll,[w]:{...se[w],...O[w]}})):(y={border:{all:null,left:se.borderLeft,right:se.borderRight,top:se.borderTop,bottom:se.borderBottom,[H.REVERSE_BORDER_POSITIONS[w]]:{...se[w],...O[w]}}},s.setFieldsValue({border:y.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(se.mobileBorderPosition==="mobileBorderAll")y={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...se.mobileBorderAll,classNamePrefix:"em-mob-border_"+H.MOBILE_REVERSE_BORDER_POSITIONS[w]+"-"}}},s.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER});else{const ce=H.MOBILE_REVERSE_BORDER_POSITIONS[w],Ie={...se[w],...O[w]},Xe=!Ie?.width&&!Ie?.style&&!Ie?.color;if(se.mobileBorder?.all?.width||se.mobileBorder?.all?.style||se.mobileBorder?.all?.color){const oo=se.mobileBorderAll;y={mobileBorder:{all:null,left:oo,right:oo,top:oo,bottom:oo,[ce]:Xe?null:{...Ie,classNamePrefix:"em-mob-border_"+ce+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:oo,mobileBorderRight:oo,mobileBorderTop:oo,mobileBorderBottom:oo,[w]:Ie})}else{const oo=e.mobileBorder||{},po=co=>{const _o=oo[co];return _o&&(_o?.width||_o?.style||_o?.color)?_o:null};y={mobileBorder:{all:null,left:ce==="left"?Xe?null:{...Ie,classNamePrefix:"em-mob-border_left-"}:po("left"),right:ce==="right"?Xe?null:{...Ie,classNamePrefix:"em-mob-border_right-"}:po("right"),top:ce==="top"?Xe?null:{...Ie,classNamePrefix:"em-mob-border_top-"}:po("top"),bottom:ce==="bottom"?Xe?null:{...Ie,classNamePrefix:"em-mob-border_bottom-"}:po("bottom")}},s.setFieldsValue({[w]:Ie})}}break;case"width":y={[w]:{value:O[w],dim:se.widthDim}};break;case"height":y={[w]:{value:O[w],dim:se.heightDim}};break;case"widthDim":y={width:{value:se.width,dim:O[w]}};break;case"heightDim":y={height:{value:se.height,dim:O[w]}};break;case"maxWidth":y={[w]:{value:O[w],dim:se.maxWidthDim}};break;case"maxWidthDim":y={maxWidth:{value:se.maxWidth,dim:O[w]}};break;case"minWidth":y={[w]:{value:O[w],dim:se.minWidthDim}};break;case"minWidthDim":y={minWidth:{value:se.minWidth,dim:O[w]}};break;case"backgroundImage":j(O[w]===""),y={[w]:[{...e.backgroundImage[0],value:O[w]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":y={padding:{[H.PADDING_POSITION[w]]:+O[w]}};break;case"paddingTopBottom":y={padding:{top:+O[w],bottom:+O[w]}},se.paddingTop=se.paddingBottom=+O[w];break;case"paddingLeftRight":y={padding:{left:+O[w],right:+O[w]}},se.paddingLeft=se.paddingRight=+O[w];break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":y={borderRadius:{[H.BORDER_RADIUS_POSITION[w]]:+O[w]}};break;case"mobileWidth":y={[w]:{classNamePrefix:"em-mob-width-",value:O[w],dim:se.mobileWidthDim}};break;case"mobileWidthDim":y={mobileWidth:{classNamePrefix:"em-mob-width-",value:se.mobileWidth||100,dim:O[w]}};break;case"mobileHeight":y={[w]:{classNamePrefix:"em-mob-height-",value:O[w],dim:se.mobileHeightDim}};break;case"mobileHeightDim":y={mobileHeight:{classNamePrefix:"em-mob-height-",value:se.mobileHeight,dim:O[w]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":y={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[w]]:O[w],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[w]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":y={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":y={[w]:{classNamePrefix:"em-mob-text_align-",value:O[w]}};break;case"mobileVerticalAlign":y={[w]:{classNamePrefix:"em-mob-vertical_align-",value:O[w]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(y=kt(O),!y)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":y={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=O[w],y={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=O[w],y={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":y={[w]:{classNamePrefix:"em-mob-direction-",value:O[w]}};break;case"backgroundPositionX":case"backgroundPositionY":y={[w]:isNaN(parseFloat(O[w].position))?O[w].position:O[w].position+O[w].unit};break;default:y=O}w!=="borderPosition"&&w!=="mobileBorderPosition"&&l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:y})},Oe=()=>{U(se=>!se);const O=s.getFieldsValue(!0);$||(O.paddingLeftRight=O.paddingLeft,O.paddingTopBottom=O.paddingTop,O.paddingRight=O.paddingLeft,O.paddingBottom=O.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:O.paddingTopBottom,bottom:O.paddingTopBottom,left:O.paddingLeftRight,right:O.paddingLeftRight}}}))},Ae=()=>{const O=s.getFieldsValue(!0);n.markBorderToggled(!P),setTimeout(()=>{z(se=>!se),P?(O.borderAll=H.NULL_BORDER,O.borderTop=H.NULL_BORDER,O.borderBottom=H.NULL_BORDER,O.borderRight=H.NULL_BORDER,O.borderLeft=H.NULL_BORDER):O.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:O.borderAll.color,style:O.borderAll.style,width:O.borderAll.width}}}})})},Ge=()=>{const O=s.getFieldsValue(!0);d.markBorderToggled(!le),setTimeout(()=>{C(se=>!se),le?(O.mobileBorderAll=H.NULL_BORDER,O.mobileBorderTop=H.NULL_BORDER,O.mobileBorderBottom=H.NULL_BORDER,O.mobileBorderRight=H.NULL_BORDER,O.mobileBorderLeft=H.NULL_BORDER):O.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:O.mobileBorderAll.color,style:O.mobileBorderAll.style,width:O.mobileBorderAll.width}}}})})},Ye=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{ae(se=>!se),re?(O.borderRadiusAll=0,b(!0)):O.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:O.borderRadiusAll}}})})},Ze=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{Te(se=>!se),_e?(O.mobileBorderRadiusAll=null,B(!0)):O.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:O.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},de=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{me(se=>!se),te?(O.boxShadowInset=!1,O.boxShadowHOffset=null,O.boxShadowVOffset=null,O.boxShadowBlurRadius=null,O.boxShadowSpreadRadius=null,O.boxShadowColor=""):(O.boxShadowInset=!1,O.boxShadowHOffset=5,O.boxShadowVOffset=5,O.boxShadowBlurRadius=10,O.boxShadowSpreadRadius=-5,O.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:O.boxShadowBlurRadius,color:O.boxShadowColor,hOffset:O.boxShadowHOffset,inset:O.boxShadowInset,spreadRadius:O.boxShadowSpreadRadius,vOffset:O.boxShadowVOffset}}})})},Ce=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{ue(se=>!se),je?(O.mobileBoxShadowInset=!1,O.mobileBoxShadowHOffset=null,O.mobileBoxShadowVOffset=null,O.mobileBoxShadowBlurRadius=null,O.mobileBoxShadowSpreadRadius=null,O.mobileBoxShadowColor=""):(O.mobileBoxShadowInset=!1,O.mobileBoxShadowHOffset=5,O.mobileBoxShadowVOffset=5,O.mobileBoxShadowBlurRadius=10,O.mobileBoxShadowSpreadRadius=-5,O.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:O.mobileBoxShadowBlurRadius,color:O.mobileBoxShadowColor,hOffset:O.mobileBoxShadowHOffset,inset:O.mobileBoxShadowInset,spreadRadius:O.mobileBoxShadowSpreadRadius,vOffset:O.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},G=()=>{setTimeout(()=>{Le(O=>!O)})},pe=()=>{setTimeout(()=>{he(O=>!O)})},Pe=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{Z(se=>!se),be?(O.backgroundColor="",O.backgroundImage="",O.backgroundPositionX="",O.backgroundPositionY="",O.backgroundRepeat="none",O.backgroundSize="",j(!0)):(O.backgroundColor="#E5E5E5",O.backgroundSize="",O.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:O.backgroundColor,backgroundImage:[{type:"url",value:O.backgroundImage}],backgroundPositionX:O.backgroundPositionX,backgroundPositionY:O.backgroundPositionY,backgroundRepeat:O.backgroundRepeat,backgroundSize:O.backgroundSize}})})},We=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{q(se=>!se),K?O.mobileBackgroundColor="":O.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:O.mobileBackgroundColor}}}),K&&Dt(s,e,l)})},to=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{V(se=>!se),Q&&(O.exportAsPicture=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})},eo=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{Y(se=>!se),M&&(O.paddingLeftRight="",O.paddingLeft="",O.paddingRight="",O.paddingTopBottom="",O.paddingTop="",O.paddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},no=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{ee(se=>!se),X&&(O.mobilePaddingLeftRight="",O.mobilePaddingLeft="",O.mobilePaddingRight="",O.mobilePaddingTopBottom="",O.mobilePaddingTop="",O.mobilePaddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobilePadding:{all:null,top:null,right:null,bottom:null,left:null,classNamePrefix:"em-mob-padding_"}}}))})};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_div_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",valign:"",border:"",boxShadow:"",show:"all",borderPosition:H.BORDER_POSITIONS[ie]||"borderAll",mobileBorderPosition:H.MOBILE_BORDER_POSITIONS[we]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",borderRadiusAll:"",borderRadiusTopLeft:"",borderRadiusBottomLeft:"",borderRadiusTopRight:"",borderRadiusBottomRight:"",direction:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileAlign:"",mobileDirection:"",mobileVerticalAlign:"",mobileBackgroundColor:"",mobileBackgroundImage:"",mobilePaddingTop:"",mobilePaddingLeft:"",mobilePaddingRight:"",mobilePaddingBottom:""},onValuesChange:Se,autoComplete:"off",className:"element-controls",children:[!I&&(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)(gl,{form:s,elementSettings:e,mobileBoxShadow:_,mobileBordersShow:le,mobileBorderRadiusShow:_e,mobileBoxShadowShow:je,mobileSizeShow:ve,mobileBackgroundShow:K,mobilePaddingShow:X,mobilePaddingsExt:v,setMobilePaddingsExt:L,oneMobileBorderRadiusValue:p,setOneMobileBorderRadiusValue:B,toggleShowMobileBorderHandler:Ge,toggleShowMobileBorderRadiusHandler:Ze,toggleShowMobileBoxShadowHandler:Ce,toggleShowMobileSizeHandler:pe,toggleShowMobileBackgroundHandler:We,toggleShowMobilePaddingHandler:no})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(bl,{form:s,elementSettings:e,boxShadow:c,bordersShow:P,borderRadiusShow:re,boxShadowShow:te,backgroundShow:be,backgroundImageEmpty:R,backgroundRepeatOptions:Ee,sizeShow:Ve,maxWidthValue:ne,modificationShow:Q,paddingShow:M,paddingsExt:$,oneBorderRadiusValue:g,setOneBorderRadiusValue:b,togglePaddingHandler:Oe,toggleShowPaddingHandler:eo,toggleShowBorderHandler:Ae,toggleShowBorderRadiusHandler:Ye,toggleShowBoxShadowHandler:de,toggleShowSizeHandler:G,toggleShowBackgroundHandler:Pe,toggleShowModificationHandler:to,handleChangeValues:Se})})]})};fl.propTypes={elementSettings:f.default.object.isRequired};var _l=({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:Fo})})})})}),(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:fn})})})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Vertical alignment"),dividerTop:!0,children:(0,o.jsx)(Do,{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)(No,{})})]})};_l.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired};var xl=({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)(Go,{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)(Do,{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)(No,{})})]})};xl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired};var Ni=0,kl=({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),m=r.useSelector(r.selectCodeModeDirection),g=c&&m!=="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:xo(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileContentWidth:xo(e.mobileContentWidth?.value),mobileContentWidthDim:e.mobileContentWidth?.dim,mobileVerticalAlign:u(e.mobileVerticalAlign?.value)}),Ni=e.width.value+e.gap.value)},[s,e]);const b=_=>{const h=s.getFieldsValue(!0),p=Object.keys(_)[0];let B;switch(p){case"width":Ni=_[p]+h.gap,B={[p]:{value:_[p],dim:h.widthDim},gap:{value:h.gap}};break;case"widthDim":B={width:{value:h.width,dim:_[p]},gap:{value:h.gap}};break;case"gap":h.width=Ni-_[p],B={[p]:{value:_[p],dim:"px"}};break;case"mobileWidth":B={[p]:{classNamePrefix:"em-mob-width-",value:_[p],dim:h.mobileWidthDim}};break;case"mobileWidthDim":B={mobileWidth:{classNamePrefix:"em-mob-width-",value:h.mobileWidth||100,dim:_[p]}};break;case"mobileContentWidth":B={[p]:{classNamePrefix:"em-mob-width-",value:_[p],dim:h.mobileContentWidthDim}};break;case"mobileContentWidthDim":B={mobileContentWidth:{classNamePrefix:"em-mob-width-",value:100,dim:_[p]}};break;case"mobileVerticalAlign":B={[p]:{classNamePrefix:"em-mob-vertical_align-",value:_[p]}};break;default:B=_}l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:B})};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:b,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)(xl,{form:s,elementSettings:e})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(_l,{form:s,elementSettings:e})})]})};kl.propTypes={elementSettings:f.default.object.isRequired};var El=({form:e,fillFields:i,elementSettings:l,boxShadow:s,bordersShow:n,borderRadiusShow:d,boxShadowShow:c,backgroundShow:m,backgroundImageEmpty:g,backgroundRepeatOptions:b,paddingShow:_,paddingsExt:h,maxWidthValue:p,oneBorderRadiusValue:B,setOneBorderRadiusValue:k,linkProtocol:x,linkTarget:R,isOpenTextReplacer:j,textReplacerButtonRef:N,textReplacerInputRef:E,handleLinkProtocolsChange:I,handleSelect:$,textReplacerInputHandler:U,handleTextReplacerKeyDown:v,srcButtonHandler:L,togglePaddingHandler:P,toggleShowPaddingHandler:z,toggleShowBackgroundHandler:le,toggleShowBorderHandler:C,toggleShowBorderRadiusHandler:re,toggleShowBoxShadowHandler:ae,setLinkProtocol:_e,handleChangeValues:Te})=>{const{__:te}=r.useI18n(),{token:me}=(0,t.ui_kit$useToken)(),je=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:te("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)(zo,{form:e,elementSettings:l})}),je.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(lt,{form:e,name:"textAlign",elementSettings:l})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}}),(0,o.jsx)(tt,{show:x==="#",__:te,style:{marginBottom:me.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:te("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:je.formButtonFieldReplacerEnabled?me.formItemMarginBottomXS:me.formItemMarginBottomMD+4},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(ot,{linkProtocol:x,handleLinkProtocolsChange:I,__:te}),placeholder:te("Hyperlink URL"),allowClear:!0,onSelect:$,prefix:(0,o.jsx)(et,{linkProtocol:x})})})}),x==="mailto:"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"subject",style:{marginBottom:me.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:te("Subject")})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:me.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:te("Body")})})]}),je.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:te("Text replacer"),placement:"bottom",getPopupContainer:ue=>ue.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.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:L,ref:N})})}),(0,o.jsx)(t.ui_kit$Col,{span:21,children:j&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:te("Text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textReplacer",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:te("The code that will replace this text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:te("Text")}),onChange:U,onKeyDown:v,ref:E,onSelect:$})})})})]})}),je.formButtonFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:te("Padding"),collapsible:!0,open:_,onToggle:z,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:h,onToggleExtended:P,gutter:me.marginSM,labels:{horizontal:te("Horizontal padding"),vertical:te("Vertical padding"),left:te("Left padding"),right:te("Right padding"),top:te("Top padding"),bottom:te("Bottom padding"),individual:te("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:te("Size"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:p,dimensionSelect:Fo,gutter:me.marginSM,labels:{width:te("Width"),height:te("Height"),minWidth:te("Minimum width"),maxWidth:te("Maximum width")}})}),(0,o.jsx)(xt,{form:e,fillFields:i,elementSettings:l,showAddParagraph:!1,isButton:!0,setLinkProtocol:_e,linkProtocol:x,linkTarget:R}),(0,o.jsxs)(t.ui_kit$FormSection,{title:te("Background"),collapsible:!0,open:m,onToggle:le,dividerTop:!0,children:[(0,o.jsx)(Ai,{form:e,backgroundImageEmpty:g,appConfig:je,token:me,elementSettings:l,backgroundRepeatOptions:b,handleChangeValues:Te}),(0,o.jsx)(st,{form:e,showBackground:!0})]}),je.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:te("Borders"),collapsible:!0,open:n,onToggle:C,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e,elementSettings:l})}),je.formFieldBorderRadiusEnabled&&(0,o.jsxs)(t.ui_kit$FormSection,{title:te("Border radius"),collapsible:!0,open:d,onToggle:re,dividerTop:!0,children:[(0,o.jsx)(wo,{form:e,oneBorderRadiusValue:B,setOneBorderRadiusValue:k,elementSettings:l}),(0,o.jsx)(st,{form:e,showRounding:!0})]}),je.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:te("Box shadow"),collapsible:!0,open:c,onToggle:ae,dividerTop:!0,children:(0,o.jsx)(Po,{})}),je.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:te("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:l,form:e})}),je.formFieldAmpVisibilityEnabled&&l.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:te("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(No,{})})]})]})};El.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 Bl=({form:e,fillFields:i,elementSettings:l,boxShadow:s,mobileBordersShow:n,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:m,mobileBackgroundShow:g,mobilePaddingShow:b,mobilePaddingsExt:_,setMobilePaddingsExt:h,oneMobileBorderRadiusValue:p,setOneMobileBorderRadiusValue:B,linkProtocol:k,handleLinkProtocolsChange:x,setLinkProtocol:R,toggleShowMobileBorderHandler:j,toggleShowMobileBorderRadiusHandler:N,toggleShowMobileBoxShadowHandler:E,toggleShowMobileSizeHandler:I,toggleShowMobileBackgroundHandler:$,toggleShowMobilePaddingHandler:U})=>{const{__:v}=r.useI18n(),{token:L}=(0,t.ui_kit$useToken)(),P=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(zo,{form:e,elementSettings:l,imgParent:!0,typeOfForm:"mobile"})}),P.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)($t,{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)(tt,{show:k==="#",__:v,style:{marginBottom:L.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:v("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:k==="mailto:"?L.formItemMarginBottomXS:L.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(ot,{linkProtocol:k,handleLinkProtocolsChange:x,__:v}),placeholder:v("Hyperlink URL"),allowClear:!0,prefix:(0,o.jsx)(et,{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:v("Subject")})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:L.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:v("Body")})})]})]}),!!l.showOnMobile&&(0,o.jsx)(xt,{form:e,fillFields:i,elementSettings:l,setLinkProtocol:R,linkProtocol:k,showAddParagraph:!1,isButton:!0}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Wr,{})})}),P.formButtonFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:v("Padding"),collapsible:!0,open:b,onToggle:U,dividerTop:!0,children:(0,o.jsx)(Ut,{form:e,elementSettings:l,mobilePaddingsExt:_,setMobilePaddingsExt:h})}),(0,o.jsx)(t.ui_kit$FormSection,{title:v("Size"),collapsible:!0,open:m,onToggle:I,dividerTop:!0,bodyStyle:{paddingBottom:L.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:v("Width"),placement:"bottom",children:(0,o.jsx)(Go,{form:e,name:"mobileWidth",elementSettings:l})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:v("Height"),placement:"bottom",children:(0,o.jsx)(rt,{form:e,name:"mobileHeight",elementSettings:l})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:v("Background"),collapsible:!0,open:g,onToggle:$,dividerTop:!0,bodyStyle:{paddingBottom:L.formItemMarginBottomMD},children:(0,o.jsx)(Bt,{elementSettings:Yo(l),imageEnabled:P.formButtonFieldBackgroundImageEnabled,desktopBackground:Et(l)})}),P.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:v("Borders"),collapsible:!0,open:n,onToggle:j,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),P.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:v("Border radius"),collapsible:!0,open:d,onToggle:N,dividerTop:!0,children:(0,o.jsx)(wo,{form:e,oneBorderRadiusValue:p,setOneBorderRadiusValue:B,elementSettings:l,typeOfForm:"mobile"})}),P.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:v("Box shadow"),collapsible:!0,open:c,onToggle:E,dividerTop:!0,children:(0,o.jsx)(Po,{typeOfForm:"mobile"})}),P.formFieldAmpVisibilityEnabled&&l.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:v("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(No,{})}),P.formFieldAmpVisibilityEnabled&&l.isAmp&&(0,o.jsx)(t.ui_kit$FormSection,{title:v("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(No,{})})]})};Bl.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 Wn=Object.freeze({}),Sl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),n=Mo(),d=Mo(),c=r.useDispatch(),[m,g]=(0,a.useState)({}),[b,_]=(0,a.useState)(!0),[h,p]=(0,a.useState)(!0),B=r.useSelector(r.selectEmailViewType),k=r.useSelector(r.selectMobileViewActive),[x,R]=(0,a.useState)(e.backgroundImage?.[0].value===""),j=r.useSelector(r.selectIsCodeMode),N=r.useSelector(r.selectCodeModeDirection),E=j&&N!=="bottom",I=(0,a.useRef)(null),$=(0,a.useRef)(null),[U,v]=(0,a.useState)(!1),[L,P]=(0,a.useState)(!1),[z,le]=(0,a.useState)(!1),[C,re]=(0,a.useState)(!1),[ae,_e]=(0,a.useState)(!1),[Te,te]=(0,a.useState)(!1),[me,je]=(0,a.useState)(!1),[ue,Ve]=(0,a.useState)(!1),[Le,ve]=(0,a.useState)(!1),[he,be]=(0,a.useState)(!1),[Z,K]=(0,a.useState)(!1),[q,Q]=(0,a.useState)(!1),[V,M]=(0,a.useState)(!1),[Y,X]=(0,a.useState)(""),[ee,ne]=(0,a.useState)("https://"),[Be,Ee]=(0,a.useState)({}),oe=e,[D,ie]=(0,a.useState)(!!oe.textReplacer?.length),[we,W]=(0,a.useState)(e);e!==we&&(W(e),ie(!!oe.textReplacer?.length));const Se=r.useElementEntityKind(),Oe=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],Ae=e.border,Ge=e.mobileBorder,Ye=Object.keys(Ae).find(F=>Ae[F]?.width||Ae[F]?.style||Ae[F]?.color),Ze=Object.keys(Ge).find(F=>Ge[F]?.width||Ge[F]?.style||Ge[F]?.color),de=F=>F&&(F?.width||F?.style||F?.color)?F:"",{remember:Ce,fillFields:G}=ut(e);(0,a.useEffect)(()=>{if(e){const F=e.boxShadow||Wn,J=e.mobilePadding||{},ye=e.mobileAlign||{};g(F);let Me="",ge="",He=e.href||"https://";if(e.href){if(e.href.startsWith("mailto:")){const qe=Or(e.href);Me=qe.subject,ge=qe.body,He=qe.baseEmail}Wo(e.href,ne)}G(s,{...e,href:He,subject:Me,body:ge,width:e.width?.value,widthDim:e.width?.dim,height:e.height?.value,heightDim:e.height?.dim,backgroundImage:e.backgroundImage?.[0].value,show:e.show?e.show:"all",textAlign:e.textAlign,borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),mobileBorderAll:de(e.mobileBorder.all)||!(de(e.mobileBorder.top)||de(e.mobileBorder.bottom)||de(e.mobileBorder.right)||de(e.mobileBorder.left))&&de(e.border.all),mobileBorderTop:de(e.mobileBorder.top)||!de(e.mobileBorder.all)&&de(e.border.top),mobileBorderBottom:de(e.mobileBorder.bottom)||!de(e.mobileBorder.all)&&de(e.border.bottom),mobileBorderRight:de(e.mobileBorder.right)||!de(e.mobileBorder.all)&&de(e.border.right),mobileBorderLeft:de(e.mobileBorder.left)||!de(e.mobileBorder.all)&&de(e.border.left),paddingTop:u(e.padding?.all)||u(e.padding?.top),paddingLeft:u(e.padding?.all)||u(e.padding?.left),paddingRight:u(e.padding?.all)||u(e.padding?.right),paddingBottom:u(e.padding?.all)||u(e.padding?.bottom),paddingLeftRight:u(e.padding?.left)||u(e.padding?.right),paddingTopBottom:u(e.padding?.top)||u(e.padding?.bottom),borderRadiusAll:u(e.borderRadius?.all),borderRadiusTopLeft:u(e.borderRadius?.topLeft),borderRadiusBottomLeft:u(e.borderRadius?.bottomLeft),borderRadiusTopRight:u(e.borderRadius?.topRight),borderRadiusBottomRight:u(e.borderRadius?.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:xo(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:xo(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:xo(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:xo(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(ye?.value)||e.align,mobileVerticalAlign:u(e.mobileVerticalAlign?.value||e.valign),mobileBackgroundColor:u(e.mobileBackgroundColor?.value||e.backgroundColor||""),...at(e),mobilePaddingTop:u(J.all)||u(J.top)||u(e.padding?.all)||u(e.padding?.top),mobilePaddingLeft:u(J.all)||u(J.left)||u(e.padding?.all)||u(e.padding?.left),mobilePaddingRight:u(J.all)||u(J.right)||u(e.padding?.all)||u(e.padding?.right),mobilePaddingBottom:u(J.all)||u(J.bottom)||u(e.padding?.all)||u(e.padding?.bottom),mobilePaddingTopBottom:u(J.top)||u(J.bottom)||u(e.padding?.top)||u(e.padding?.bottom),mobilePaddingLeftRight:u(J.left)||u(J.right)||u(e.padding?.left)||u(e.padding?.right),mobileTextAlign:$r(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))?p(!1):p(!0),R(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)?v(!1):v(!0),!u(J.all)&&(u(J.top)||u(J.right)||u(J.bottom)||u(J.left))&&(J.top!==J.bottom||J.right!==J.left)||!u(e.padding?.all)&&(u(e.padding?.top)||u(e.padding?.right)||u(e.padding?.bottom)||u(e.padding?.left))&&(e.padding?.top!==e.padding?.bottom||e.padding?.right!==e.padding?.left)?P(!1):P(!0);const Ke=n.isStaleBorderSnapshot(e,!!Ye),Fe=d.isStaleBorderSnapshot(e,!!Ze);Ke&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Fe||Ke&&!Ze)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),le(qe=>Ye&&!Ke?!0:qe),re(qe=>Ye&&!Ke||Ze&&!Fe?!0:qe),_e(!!e.borderRadius?.all||!!e.borderRadius?.topLeft||!!e.borderRadius?.bottomLeft||!!e.borderRadius?.topRight||!!e.borderRadius?.bottomRight),te(!!e.mobileBorderRadius?.all||!!e.mobileBorderRadius?.topLeft||!!e.mobileBorderRadius?.bottomLeft||!!e.mobileBorderRadius?.topRight||!!e.mobileBorderRadius?.bottomRight||!!e.borderRadius?.all||!!e.borderRadius?.topLeft||!!e.borderRadius?.bottomLeft||!!e.borderRadius?.topRight||!!e.borderRadius?.bottomRight),je(!!e.boxShadow),Ve(!!e.mobileBoxShadow?.blurRadius||!!e.mobileBoxShadow?.color||!!e.mobileBoxShadow?.hOffset||!!e.mobileBoxShadow?.inset||!!e.mobileBoxShadow?.spreadRadius||!!e.mobileBoxShadow?.vOffset||!!e.boxShadow),ve(!!e.mobileWidth?.value||!!e.mobileHeight?.value||!!e.width.value||!!e.height.value),be(!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),K(!!e.mobileBackgroundColor?.value||!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Mt(e)&&K(!0),Q(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),M(!!e.mobilePadding?.all||!!e.mobilePadding?.top||!!e.mobilePadding?.bottom||!!e.mobilePadding?.left||!!e.mobilePadding?.right||!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right)}},[s,e,E,Ye,Ze,n,d,G]);const pe=(0,a.useCallback)(F=>{Ce(F),c(Se==="email"?r.setElementSettings$1(F):r.setElementSettings(F))},[c,Se,Ce]),Pe=F=>{const J=s.getFieldsValue(!0),ye=Object.keys(F)[0];let Me;switch(X(s.getFieldsValue(!0).widthDim==="%"?100:""),ye){case"exportAsPicture":Me={exportAsPicture:J.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Me={boxShadow:{hOffset:J.boxShadowHOffset,vOffset:J.boxShadowVOffset,blurRadius:J.boxShadowBlurRadius,spreadRadius:J.boxShadowSpreadRadius,color:J.boxShadowColor,inset:J.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":J.borderPosition==="borderAll"?(Me={border:{...r.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...J.borderAll}}},s.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER})):J.borderAll?.width||J.borderAll?.style||J.borderAll?.color?(Me={border:{all:null,left:J.borderAll,right:J.borderAll,top:J.borderAll,bottom:J.borderAll,[H.REVERSE_BORDER_POSITIONS[ye]]:{...J[ye],...F[ye]}}},s.setFieldsValue({borderAll:null,borderLeft:J.borderAll,borderRight:J.borderAll,borderTop:J.borderAll,borderBottom:J.borderAll,[ye]:{...J[ye],...F[ye]}})):(Me={border:{all:null,left:J.borderLeft,right:J.borderRight,top:J.borderTop,bottom:J.borderBottom,[H.REVERSE_BORDER_POSITIONS[ye]]:{...J[ye],...F[ye]}}},s.setFieldsValue({border:Me.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(J.mobileBorderPosition==="mobileBorderAll")Me={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...H.NULL_BORDER,...J.mobileBorderAll,classNamePrefix:"em-mob-border_"+H.MOBILE_REVERSE_BORDER_POSITIONS[ye]+"-"}}},s.setFieldsValue({borderLeft:H.NULL_BORDER,borderRight:H.NULL_BORDER,borderTop:H.NULL_BORDER,borderBottom:H.NULL_BORDER});else{const Ke=H.MOBILE_REVERSE_BORDER_POSITIONS[ye],Fe={...J[ye],...F[ye]},qe=!Fe?.width&&!Fe?.style&&!Fe?.color;if(J.mobileBorder?.all?.width||J.mobileBorder?.all?.style||J.mobileBorder?.all?.color){const so=J.mobileBorderAll;Me={mobileBorder:{all:null,left:so,right:so,top:so,bottom:so,[Ke]:qe?null:{...Fe,classNamePrefix:"em-mob-border_"+Ke+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:so,mobileBorderRight:so,mobileBorderTop:so,mobileBorderBottom:so,[ye]:Fe})}else{const so=e.mobileBorder||{},To=T=>{const fe=so[T];return fe&&(fe?.width||fe?.style||fe?.color)?fe:null};Me={mobileBorder:{all:null,left:Ke==="left"?qe?null:{...Fe,classNamePrefix:"em-mob-border_left-"}:To("left"),right:Ke==="right"?qe?null:{...Fe,classNamePrefix:"em-mob-border_right-"}:To("right"),top:Ke==="top"?qe?null:{...Fe,classNamePrefix:"em-mob-border_top-"}:To("top"),bottom:Ke==="bottom"?qe?null:{...Fe,classNamePrefix:"em-mob-border_bottom-"}:To("bottom")}},s.setFieldsValue({[ye]:Fe})}}break;case"width":Me={[ye]:{value:F[ye],dim:J.widthDim}};break;case"height":Me={[ye]:{value:F[ye],dim:J.heightDim}};break;case"widthDim":Me={width:{value:J.width,dim:F[ye]}};break;case"heightDim":Me={height:{value:J.height,dim:F[ye]}};break;case"backgroundImage":R(F[ye]===""),Me={[ye]:[{...e.backgroundImage[0],value:F[ye]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":Me={padding:{left:J.paddingLeft,right:J.paddingRight,top:J.paddingTop,bottom:J.paddingBottom,[H.PADDING_POSITION[ye]]:+F[ye]}};break;case"paddingTopBottom":Me={padding:{left:J.paddingLeft,right:J.paddingRight,top:+F[ye],bottom:+F[ye]}},J.paddingTop=J.paddingBottom=+F[ye];break;case"paddingLeftRight":Me={padding:{top:J.paddingTop,bottom:J.paddingBottom,left:+F[ye],right:+F[ye]}},J.paddingLeft=J.paddingRight=+F[ye];break;case"borderRadiusAll":Me={borderRadius:{[H.BORDER_RADIUS_POSITION[ye]]:+F[ye]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Me={borderRadius:{topLeft:J.borderRadiusTopLeft,bottomLeft:J.borderRadiusBottomLeft,topRight:J.borderRadiusTopRight,bottomRight:J.borderRadiusBottomRight,[H.BORDER_RADIUS_POSITION[ye]]:+F[ye]}};break;case"mobileWidth":Me={[ye]:{classNamePrefix:"em-mob-width-",value:F[ye],dim:J.mobileWidthDim}};break;case"mobileWidthDim":Me={mobileWidth:{classNamePrefix:"em-mob-width-",value:J.mobileWidth||100,dim:F[ye]}};break;case"mobileHeight":Me={[ye]:{classNamePrefix:"em-mob-height-",value:F[ye],dim:J.mobileHeightDim},mobileLineHeight:{classNamePrefix:"em-mob-line_height-",value:F[ye],dim:J.mobileHeightDim}};break;case"mobileHeightDim":Me={mobileHeight:{classNamePrefix:"em-mob-height-",value:J.mobileHeight,dim:F[ye]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Me={mobileBorderRadius:{[H.MOBILE_BORDER_RADIUS_POSITION[ye]]:F[ye],classNamePrefix:"em-mob-border_radius_"+H.MOBILE_BORDER_RADIUS_POSITION[ye]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Me={mobileBoxShadow:{hOffset:J.mobileBoxShadowHOffset,vOffset:J.mobileBoxShadowVOffset,blurRadius:J.mobileBoxShadowBlurRadius,spreadRadius:J.mobileBoxShadowSpreadRadius,color:J.mobileBoxShadowColor,inset:J.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":Me={[ye]:{classNamePrefix:"em-mob-table_align-",value:F[ye]}};break;case"mobileTextAlign":Me={[ye]:{classNamePrefix:"em-mob-text_align-",value:F[ye]}};break;case"mobileVerticalAlign":Me={[ye]:{classNamePrefix:"em-mob-vertical_align-",value:F[ye]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(Me=kt(F),!Me)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":Me={mobilePadding:{all:null,top:J.mobilePaddingTop!==""?J.mobilePaddingTop:null,right:J.mobilePaddingRight!==""?J.mobilePaddingRight:null,bottom:J.mobilePaddingBottom!==""?J.mobilePaddingBottom:null,left:J.mobilePaddingLeft!==""?J.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":J.mobilePaddingTop=J.mobilePaddingBottom=F[ye],Me={mobilePadding:{all:null,top:J.mobilePaddingTop!==""?J.mobilePaddingTop:null,right:J.mobilePaddingRight!==""?J.mobilePaddingRight:null,bottom:J.mobilePaddingBottom!==""?J.mobilePaddingBottom:null,left:J.mobilePaddingLeft!==""?J.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":J.mobilePaddingLeft=J.mobilePaddingRight=F[ye],Me={mobilePadding:{all:null,top:J.mobilePaddingTop!==""?J.mobilePaddingTop:null,right:J.mobilePaddingRight!==""?J.mobilePaddingRight:null,bottom:J.mobilePaddingBottom!==""?J.mobilePaddingBottom:null,left:J.mobilePaddingLeft!==""?J.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileFontSize":Me={[ye]:{classNamePrefix:"em-mob-font_size-",value:F[ye],dim:J.mobileFontSizeDim}};break;case"href":let ge=it(F[ye]);ge!==F[ye]&&(s.setFieldValue("href",ge),J.href=ge),ge.startsWith("mailto:")?Me={[ye]:yi(ge,J.subject,J.body)}:Me={[ye]:ge},Wo(F[ye],ne);break;case"subject":case"body":const He=J.href||"";if(He.startsWith("mailto:")){const Ke=ye==="subject"?F[ye]:J.subject,Fe=ye==="body"?F[ye]:J.body;Me={href:yi(He,Ke,Fe)}}else return;break;case"backgroundPositionX":case"backgroundPositionY":Me={[ye]:isNaN(parseFloat(F[ye].position))?F[ye].position:F[ye].position+F[ye].unit};break;default:Me=F}ye!=="borderPosition"&&ye!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Me}),ye!=="mobileBorderRadiusAll"&&ye!=="mobileBorderRadiusTopLeft"&&ye!=="mobileBorderRadiusTopRight"&&ye!=="mobileBorderRadiusBottomLeft"&&ye!=="mobileBorderRadiusBottomRight"&&pe({...e,...Me,mobileBorderRadius:{...e.mobileBorderRadius,...Me?.mobileBorderRadius},activateSection:null,changeKey:ye}))},We=()=>{v(J=>!J);const F=s.getFieldsValue(!0);U||(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}}}))},to=()=>{const F=s.getFieldsValue(!0);n.markBorderToggled(!z),setTimeout(()=>{le(J=>!J),z?(F.borderAll=H.NULL_BORDER,F.borderTop=H.NULL_BORDER,F.borderBottom=H.NULL_BORDER,F.borderRight=H.NULL_BORDER,F.borderLeft=H.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}}}})})},eo=()=>{const F=s.getFieldsValue(!0);d.markBorderToggled(!C),setTimeout(()=>{re(J=>!J),C?(F.mobileBorderAll=H.NULL_BORDER,F.mobileBorderTop=H.NULL_BORDER,F.mobileBorderBottom=H.NULL_BORDER,F.mobileBorderRight=H.NULL_BORDER,F.mobileBorderLeft=H.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}}}})})},no=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{_e(J=>!J),ae?(F.borderRadiusAll=0,_(!0)):F.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:F.borderRadiusAll}}})})},O=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{te(J=>!J),Te?(F.mobileBorderRadiusAll=null,p(!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-"}}})})},se=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{je(J=>!J),me?(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}}})})},w=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{Ve(J=>!J),ue?(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-"}}})})},y=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{ve(J=>!J),Le&&(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-"}}}))})},ce=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{be(J=>!J),he?(F.backgroundColor="",F.backgroundImage="",F.backgroundPositionX="",F.backgroundPositionY="",F.backgroundRepeat="none",F.backgroundSize="",R(!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}})})},Ie=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{K(J=>!J),Z?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}}}),Z&&Dt(s,e,l)})},Xe=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{Q(J=>!J),q&&(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}}}))})},oo=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{M(J=>!J),V&&(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_"}}}))})},po=F=>{s.setFieldValue("href",F!=="mergetag"?F:""),ne(F)},co=(0,a.useCallback)(({target:F})=>{if(!F)return;const{selectionStart:J,selectionEnd:ye}=F;Ee(Me=>Me.target===F&&Me.selection?.start===J&&Me.selection?.end===ye?Me:{target:F,selection:{start:J,end:ye}})},[]),_o=F=>{F.target.value!==""&&$.current.classList.add("selected-td-form__button--active")},Io=()=>{ie(!D),D?(s.setFieldValue("textReplacer",""),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{textReplacer:""}})):setTimeout(()=>I.current.focus())},Co=F=>{const J=F.target,ye=J.value,Me=J.selectionStart;if(Me===0&&F.key===" "){F.preventDefault();return}if(F.key===" "){if(Me!==ye.length){F.preventDefault();return}ye.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:H.BORDER_POSITIONS[Ye]||"borderAll",mobileBorderPosition:H.MOBILE_BORDER_POSITIONS[Ze]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileAlign:"",mobileVerticalAlign:"",mobileBackgroundColor:"",mobileBackgroundImage:"",mobilePaddingTop:"",mobilePaddingLeft:"",mobilePaddingRight:"",mobilePaddingBottom:"",borderRadiusTopLeft:"",borderRadiusBottomLeft:"",borderRadiusTopRight:"",borderRadiusBottomRight:"",href:"https://",subject:"",body:""},onValuesChange:Pe,autoComplete:"off",className:"element-controls",children:[!E&&(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"})}),E?(0,o.jsx)(Ii,{form:s,elementSettings:e,showAddParagraph:!1,isButton:!0}):(0,o.jsx)(o.Fragment,{children:B==="mobile"&&k.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(Bl,{form:s,fillFields:G,elementSettings:e,boxShadow:m,mobileBordersShow:C,mobileBorderRadiusShow:Te,mobileBoxShadowShow:ue,mobileSizeShow:Le,mobileBackgroundShow:Z,mobilePaddingShow:V,mobilePaddingsExt:L,setMobilePaddingsExt:P,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:p,linkProtocol:ee,handleLinkProtocolsChange:po,setLinkProtocol:ne,toggleShowMobileBorderHandler:eo,toggleShowMobileBorderRadiusHandler:O,toggleShowMobileBoxShadowHandler:w,toggleShowMobileSizeHandler:y,toggleShowMobileBackgroundHandler:Ie,toggleShowMobilePaddingHandler:oo})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(El,{form:s,fillFields:G,elementSettings:e,boxShadow:m,bordersShow:z,borderRadiusShow:ae,boxShadowShow:me,backgroundShow:he,backgroundImageEmpty:x,backgroundRepeatOptions:Oe,paddingShow:q,paddingsExt:U,maxWidthValue:Y,oneBorderRadiusValue:b,setOneBorderRadiusValue:_,linkProtocol:ee,linkTarget:Be,isOpenTextReplacer:D,textReplacerButtonRef:$,textReplacerInputRef:I,handleLinkProtocolsChange:po,handleSelect:co,textReplacerInputHandler:_o,handleTextReplacerKeyDown:Co,srcButtonHandler:Io,togglePaddingHandler:We,toggleShowPaddingHandler:Xe,toggleShowBackgroundHandler:ce,toggleShowBorderHandler:to,toggleShowBorderRadiusHandler:no,toggleShowBoxShadowHandler:se,setLinkProtocol:ne,handleChangeValues:Pe})})})]})};Sl.propTypes={elementSettings:f.default.object.isRequired};var Tl=({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")})})})};Tl.propTypes={elementSettings:f.default.object.isRequired};function Gn(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 Yn(e){const i=/^(.+)_(\d+)$/.exec(e);return i?{key:i[1],index:Number(i[2])}:void 0}function Xn(e,i,l){return(e??[]).map((s,n)=>n===i.index?{...s,[i.key]:l}:s)}function Rl(e){return(e??[]).map((i,l)=>({...i,slideIndex:l}))}var yl=({elementSettings:e,setElementSettings:i,postfix:l="",form:s,handleSelect:n,previewReloadSignal:d})=>{const{__:c}=r.useI18n(),{token:m}=(0,t.ui_kit$useToken)(),g=r.useAppConfig(),b=r.useSendPostMessage(),_="src"+l,h="title"+l,p="alt"+l,B="link"+l,k="imgReplacer"+l,x=(0,a.useRef)(null),R=(0,a.useRef)(null),j=(0,a.useRef)(null),N=(0,a.useRef)(null),E=(0,a.useRef)(null),I=(0,a.useRef)(null),$=(0,a.useRef)(null),U=(0,a.useRef)(null),[v,L]=(0,a.useState)(""),[P,z]=(0,a.useState)(""),[le,C]=(0,a.useState)(""),[re,ae]=(0,a.useState)(!1),[_e,Te]=(0,a.useState)("https://"),te=(0,a.useRef)(!1),me=(0,a.useRef)(l);(0,a.useEffect)(()=>{l!==me.current&&(me.current=l,te.current=!1),z(e.images?.[p]),C(e.images?.[h]);const Q=e.images?.[B];L(Q||(te.current?"...":""))},[e,p,h,B,l]);const je=()=>{v?(te.current=!1,L(""),s.setFieldValue(B,""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[B]:""}})):(te.current=!0,L(x.current&&x.current.input.value?x.current.input.value:"..."),setTimeout(()=>{x.current.focus()}))},ue=Q=>{Q.target.value===""?L("..."):(R.current.classList.add("selected-td-form__button--active"),L(Q.target.value));const V=Q.target.value;Wo(V,Te)},Ve=()=>{P?(z(""),s.setFieldValue("alt",""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[p]:""}})):(z(j.current&&j.current.input.value?j.current.input.value:"..."),setTimeout(()=>{j.current.focus()}))},Le=Q=>{Q.target.value===""?z("..."):(N.current.classList.add("selected-td-form__button--active"),z(Q.target.value))},ve=()=>{le?(C(!1),s.setFieldValue("title",""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[h]:""}})):(C(E.current&&E.current.input.value?E.current.input.value:"..."),setTimeout(()=>{E.current.focus()}))},he=()=>{ae(!re),re?(s.setFieldValue(k,""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[k]:""}})):setTimeout(()=>$.current.focus())},be=Q=>{Q.target.value!==""&&U.current.classList.add("selected-td-form__button--active")},Z=Q=>{Q.target.value===""?C("..."):(I.current.classList.add("selected-td-form__button--active"),C(Q.target.value))},K=Q=>{s.setFieldValue("LinkName",Q!=="mergetag"?Q:""),Te(Q)},q=Q=>{const V=s.getFieldsValue(!0),M=+l.substring(1),Y=Object.keys(V?.images).reduce((ee,ne)=>(ne.includes(l)||(ee[ne]=V[ne]),ee),{}),X=e.carouselImages?.filter((ee,ne)=>ne!==M);i(ee=>({...ee,settings:{...ee.settings,carouselImages:Rl(X)}})),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:e.caption,settings:{...e,carouselImages:X}}),s.setFieldsValue({images:Y})};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)($o,{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:P||c("Alternative text"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.default)("selected-td-form__button",{"selected-td-form__button--active":!!P}),onClick:Ve,ref:N,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),g.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:le||c("Tooltip text"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.default)("selected-td-form__button",{"selected-td-form__button--active":!!le}),onClick:ve,ref:I,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:v||c("Hyperlink URL"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.default)("selected-td-form__button",{"selected-td-form__button--active":!!v}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:je,ref:R})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:c("Image replacer"),placement:"bottom",getPopupContainer:Q=>Q.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.default)("selected-td-form__button",{"selected-td-form__button--active":re}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:he,ref:U})})]}),(0,o.jsx)(t.ui_kit$Space,{size:8,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:c("Remove slide"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{type:"text",onClick:q,icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16})})})})]}),(!!v||!!P||!!le||!!re)&&(0,o.jsxs)("div",{children:[!!v&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(tt,{show:_e==="#",__:c,style:{marginBottom:m.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:B,className:"selected-image-form__alt",style:{marginTop:m.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(ot,{linkProtocol:_e,handleLinkProtocolsChange:K,__:c}),placeholder:c("Hyperlink URL"),allowClear:!0,ref:x,onChange:ue,onSelect:n,prefix:(0,o.jsx)(et,{linkProtocol:_e})})})})]}),!!P&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:p,className:"selected-image-form__alt",style:{marginTop:m.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:c("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:Le,ref:j,onSelect:n})})}),g.formFieldImageTitleEnabled&&!!le&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:h,className:"selected-image-form__alt",style:{marginTop:m.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:c("Enter the title of the image"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:Z,ref:E,onSelect:n})})}),!!re&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Image src"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:k,className:"selected-image-form__alt",style:{marginTop:m.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:c("Code that will replace the image `src`"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:c("Image src")}),onChange:be,ref:$,onSelect:n})})})]})]})};yl.propTypes={};var wl=({form:e,elementSettings:i,formFields:l,setElementSettings:s,borderRadiusShow:n,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,linkProtocol:m,mergeTagItems:g,mergeMenuOpen:b,setMergeMenuOpen:_,cascaderRef:h,handleLinkProtocolsChange:p,handleSelect:B,onChange:k,filter:x,renderSearchOption:R,toggleShowBorderRadiusHandler:j,setNewSlide:N})=>{const{__:E}=r.useI18n(),{token:I}=(0,t.ui_kit$useToken)(),$=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(tt,{show:m==="#",__:E,style:{marginBottom:I.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:E("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)(ot,{linkProtocol:m,handleLinkProtocolsChange:p,__:E}),placeholder:E("Link for all slides"),allowClear:!0,onSelect:B,prefix:(0,o.jsx)(et,{linkProtocol:m})})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),$.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:I.formItemMarginBottomMD,marginTop:I.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:b?"none":"inline-flex"},onClick:()=>_(!0),children:E("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:h,classNames:{popup:{root:"merge-tags"}},options:g,placeholder:E("Start typing the title"),showSearch:{filter:x,render:R},spellCheck:"false",getPopupContainer:U=>U.closest(".email-pane__collapse-wrapper"),onChange:k,style:{display:b?"block":"none"},open:b,onKeyDown:U=>{U.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:I.formItemMarginBottomMD+4},children:i?.settings?.carouselImages?.map((U,v)=>(0,o.jsx)("div",{className:"carousel__slide",children:(0,o.jsx)(yl,{elementSettings:l,setElementSettings:s,postfix:"_"+v,form:e,handleSelect:B})},v))})}),(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:I.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:()=>N(),children:E("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:I.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:I.formItemMarginBottomMD-6},children:(0,o.jsx)(t.ui_kit$Switch,{id:"Loop",label:E("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:I.formItemMarginBottomMD-6},children:(0,o.jsx)(t.ui_kit$Switch,{id:"Autoplay",label:E("Autoplay"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),$.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Border radius"),collapsible:!0,open:n,onToggle:j,dividerTop:!0,children:(0,o.jsx)(wo,{form:e,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,elementSettings:i.settings})})]})};wl.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 jl=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("p",{children:e("No properties to edit.")})})};jl.propTypes={};var Kn={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 qn(e){const i={...wi(e)};return delete i.parent,delete i.path,delete i.nextElem,delete i.prevElem,i}var Il=({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(),m=r.useSelector(r.selectEmailViewType),g=r.useSelector(r.selectMobileViewActive),[b,_]=(0,a.useState)(!0),[h,p]=(0,a.useState)(!0),[B,k]=(0,a.useState)(!1),[x,R]=(0,a.useState)(!1),[j,N]=(0,a.useState)("https://"),[E,I]=(0,a.useState)(l?.getFieldsValue(!0)),[$,U]=(0,a.useState)(e),{remember:v,isOwnEcho:L}=Hr(qn),[P,z]=(0,a.useState)(e);e!==P&&(z(e),L(e?.settings)||U(e));const[le,C]=(0,a.useState)({name:"",counter:0}),[re,ae]=(0,a.useState)(null),[_e,Te]=(0,a.useState)(),[te,me]=(0,a.useState)(!1),[je,ue]=(0,a.useState)(!1),[Ve,Le]=(0,a.useState)({start:0,end:0}),ve=(0,a.useRef)(null),he=`selected_${$.type}_form_link`,be=r.useSelector(r.selectIsCodeMode),Z=r.useSelector(r.selectCodeModeDirection),K=be&&Z!=="bottom";(0,a.useEffect)(()=>{te&&ve.current&&ve.current.focus()},[te]);const q=(W,Se)=>{const Oe=document.getElementById(Se);if(Oe){const Ae=$,Ge=Gn(Ae.type,Se),Ye=Yn(Ge),Ze=Oe.value?.substring(0,Ve.start),de=Oe.value?.substring(Ve.end);let Ce={[Ge]:Ze+W+de};Ye?Ce={carouselImages:Xn(Ae.settings?.carouselImages,Ye,Ze+W+de)}:$.type===r.ELEMENT_TYPES.CAROUSEL&&he===Se&&(Ce={[Ge]:Ze+W+de,carouselImages:[...$.settings?.carouselImages.map(G=>({...G,link:Ze+W+de}))||[]]}),n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...$.settings,...Ce}}),U(G=>({...G,settings:{...G.settings,...Ce}})),l.setFieldValue(Ge,Ze+W+de),Oe.focus(),setTimeout(()=>{Oe.selectionStart=Ve.start,Oe.selectionEnd=Ve.start+W.length},400),ue(!0)}},Q=r.useAppConfig().mergeTags;(0,a.useEffect)(()=>{Q?.items?.length&&Te(r.mapMargeTags(Q.items))},[Q,Te]);const V=(W,Se)=>{if(me(!1),W){const Oe=Q.syntax.length>1?_e.findIndex(Ye=>Ye.key===Se[0].key):0,Ae=Q.syntax[Oe].replace("%value%",W[W.length-1]),Ge=`selected_${$.type}_form${$.type==="carousel"?"_images":""}`;["imgReplacer","title","alt","src","link"].some(Ye=>re?.getAttribute("id").includes(`${Ge}_${Ye}`))||re?.getAttribute("id").includes(he)?q(Ae,re?.getAttribute("id")):(l.setFieldValue("imgReplacer",Ae),n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...$.settings,imgReplacer:Ae}}),U(Ye=>({...Ye,settings:{...Ye.settings,imgReplacer:Ae}})))}},M=r.useRootElement();(0,a.useEffect)(()=>{const W=({target:Ae})=>{Ae.closest('[id="merge_tags_wrapper"]')||ae(Ae)},Se=({target:Ae})=>{!Ae.closest(".merge-tags")&&!Ae.closest("#merge_tags_button")&&me(!1)},Oe=new yo.Disposable;return Oe.addDisposable(r.addWindowListenerFromShadow(M,"focusin",W)),Oe.addDisposable(r.addWindowListenerFromShadow(M,"click",Se)),()=>{Oe.dispose()}},[M]);const Y=(W,Se)=>Se.some(Oe=>Oe.label.toLowerCase().indexOf(W.toLowerCase())>-1),X=(W,Se)=>{const Oe=Se.map((Ae,Ge)=>{const Ye=Ae.label.split(new RegExp(`(${W})`,"gi"));return(0,o.jsxs)("span",{children:[Ge!==0&&(0,o.jsx)("span",{children:" / "}),Ye.map((Ze,de)=>Ze.toLowerCase()===W.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:Ze},de):Ze)]},Ae.value)});return(0,o.jsx)("div",{title:Se.map(Ae=>Ae.label).join(" / "),children:Oe})};(0,a.useEffect)(()=>{const W=l?.getFieldsValue(!0);I(W)},[l]);const ee=({target:W})=>{if(W&&!je){const{selectionStart:Se,selectionEnd:Oe}=W;Le({start:Se,end:Oe})}ue(!1)};(0,a.useEffect)(()=>{if($.settings){const W=$.settings,Se=wi(W);l?.setFieldsValue(Se),I(Se),W.link&&N(Ot(W.link,"https://")),u(W.borderRadius?.all)||(u(W.borderRadius?.topLeft)||u(W.borderRadius?.bottomLeft)||u(W.borderRadius?.topRight)||u(W.borderRadius?.bottomRight)?_(!1):u(W.borderRadius?.all)||_(!0)),u(W.mobileBorderRadius?.topLeft)||u(W.mobileBorderRadius?.bottomLeft)||u(W.mobileBorderRadius?.topRight)||u(W.mobileBorderRadius?.bottomRight)?p(!1):p(!0),k(!!W.borderRadius?.all||!!W.borderRadius?.topLeft||!!W.borderRadius?.bottomLeft||!!W.borderRadius?.topRight||!!W.borderRadius?.bottomRight),R(!!W.mobileBorderRadius?.all||!!W.mobileBorderRadius?.topLeft||!!W.mobileBorderRadius?.bottomLeft||!!W.mobileBorderRadius?.topRight||!!W.mobileBorderRadius?.bottomRight)}},[l,$]);const ne=W=>{const Se=Fr($.settings,l,W);n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:Se.caption,settings:Se}),v({...$.settings,...Se}),U(Oe=>({...Oe,settings:{...Oe.settings,...Se}}))},Be=(W,Se)=>{const Oe=r.stripEmVersionFromUrlString($.settings?.src||"")===r.stripEmVersionFromUrlString(W||"");(!Oe||W!==$.settings?.src)&&ne({src:W}),Se?.mode==="save"&&Oe&&(C(Ae=>({name:"src",counter:Ae.counter+1})),d(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(W)}))},Ee=async W=>{const Se=$.settings?.src||"",Oe=r.stripEmVersionFromUrlString(Se),Ae=await c({kind:"img",currentUrl:_t(Oe)?"":Oe,entryModal:W});Ae?.url&&Be(Ae.url,Ae.meta)},oe=W=>{const Se=W.data.operation;Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?Ee(r.MODALS.UPLOAD_IMAGE_MODAL_AI):Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?Ee(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?Ee(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?Ee(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):Se===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?Ee(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK):Se===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(s(r.closeSecondModal()),s(r.closeModal$1()))};r.useListenPostMessage(oe);const D=()=>{setTimeout(()=>{k(W=>!W),l.setFieldValue("borderRadiusAll",B?0:5),n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...$.settings,borderRadius:{all:B?"":5}}}),U(W=>({...W,settings:{...W.settings,borderRadius:{all:B?null:5}}}))})},ie=W=>{l.setFieldValue("link",W!=="mergetag"?W:""),N(W)},we=()=>{const{width:W,height:Se,renderedWidth:Oe,renderedHeight:Ae}=$?.settings?.carouselImages[0]||{width:{value:600},height:{value:600},renderedWidth:600,renderedHeight:600},Ge={src:"https://emcdn.ru/1865/231031_17_BGU9Mso.png",width:{value:W.value,dim:"px"},height:{value:Se.value,dim:"px"},alt:"",title:"",link:null,renderedWidth:Oe,renderedHeight:Ae,imgReplacer:"",mobileWidth:{value:null,dim:"px"},mobileHeight:{value:null,dim:"px"},mobileBorderRadius:{all:null,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}},Ye=[...$?.settings?.carouselImages,Ge];n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...$.settings,carouselImages:Ye}});const Ze=Rl(Ye);U(de=>({...de,settings:{...de.settings,carouselImages:Ze}}))};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_carousel_form",initialValues:Kn,onValuesChange:ne,autoComplete:"off",className:"element-controls",children:[!K&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),m==="mobile"&&g.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(jl,{})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(wl,{form:l,elementSettings:$,formFields:E,setElementSettings:U,borderRadiusShow:B,oneBorderRadiusValue:b,setOneBorderRadiusValue:_,linkProtocol:j,mergeTagItems:_e,mergeMenuOpen:te,setMergeMenuOpen:me,cascaderRef:ve,handleLinkProtocolsChange:ie,handleSelect:ee,onChange:V,filter:Y,renderSearchOption:X,toggleShowBorderRadiusHandler:D,setNewSlide:we})})]})};Il.propTypes={};var Jn={animate:!0,expandSingleSection:!0,sections:[{expanded:!1,index:0}]},vl=({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,m]=(0,a.useState)(e),[g,b]=(0,a.useState)(e);e!==g&&(b(e),m(e)),(0,a.useEffect)(()=>{if(c.settings){const B=c.settings,k=wi(B);s?.setFieldsValue(k)}},[s,c]);const _=B=>{const k=Fr(c.settings,s,B);n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:c.type,caption:k.caption,settings:k}),m(x=>({...x,settings:{...x.settings,...k}}))},h=()=>{m(B=>({...B,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.")}})},p=B=>{m(k=>({...k,settings:{...k.settings,sections:c.settings.sections?.filter((x,R)=>R!==B)}})),n({operation:r.EVENT_TYPES.SANDBOX_ACCORDION_REMOVE_SECTION,settings:{index:B}})};return(0,o.jsx)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_carousel_form",initialValues:Jn,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((B,k)=>(0,o.jsxs)(t.ui_kit$Row,{gutter:24,children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsxs)(t.ui_kit$Space,{size:10,align:"baseline",children:[(0,o.jsx)("span",{style:{position:"relative",top:2},children:i("Section ")+(k+1)}),(0,o.jsx)(t.ui_kit$Form.Item,{name:`expanded_${k}`,valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:`expanded_${k}`,label:i("expanded"),labelSize:"small",size:"small"})})]})}),(0,o.jsx)(t.ui_kit$Col,{children:c?.settings?.sections?.length>1&&(0,o.jsx)(t.ui_kit$Button,{type:"text",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16}),style:{marginRight:"auto"},onClick:()=>p(k)})})]},`expanded_${k}`))})}),(0,o.jsx)(t.ui_kit$Row,{gutter:20,children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:l.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Button,{style:{display:"inline-flex",alignItems:"center",width:"100%"},icon:(0,o.jsx)(r.EmIcons,{icon:"PlusCircleOutlined",component:t.icons$PlusCircleOutlined,size:16,strokeWidth:d.iconStrokeWidth}),onClick:()=>h(),children:i(" Add section")})})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"})]})})};vl.propTypes={};var{Text:Qn}=t.ui_kit$Typography,Zn="blocks",Cl="text/plain",ed=(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),od=(0,o.jsx)("span",{className:"addon-text-content",children:"Title"});function Oo(e){return e.closest(".email-pane__collapse-wrapper")}function zt({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 td=/^[a-z][a-z0-9+.-]*:/i;function Pl(e){const i=it(typeof e=="string"?e:String(e??""));return i?td.test(i)?i:`https://${i}`:""}function id(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 rd(e){const i=Pl(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 Al(e,i){if(i===r.MODALS.UPLOAD_IMAGE_MODAL_EDIT&&_t(e)){try{const l=new URL(e,typeof window<"u"&&window.location?window.location.origin:"http://localhost").href,s=await fetch(l);if(s.ok){const n=await s.blob();return{entryModal:i,currentUrl:"",imageDataUrl:await new Promise((d,c)=>{const m=new FileReader;m.onload=()=>d(m.result),m.onerror=c,m.readAsDataURL(n)})}}}catch{}return{entryModal:r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,currentUrl:""}}return{entryModal:i,currentUrl:e}}function ld(){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 sd(e){const i=String(e?.bgColor??"").trim();return{blockBgEnabled:!!(e?.bgEnabled&&i),blockBgColor:i}}function Wt(e,i,l){return{...e,buttonBgColor:i,hostCellBgForIconLuminance:String(l??"").trim()}}function Nl(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 Ll(e){if(!Array.isArray(e)||e.length===0)return"";const i=e.map(s=>s.customIcon?"":String(s?.itemBorderColor??"").trim()),l=i[0];return i.every(s=>s===l)?l:""}function Gt(e,i){const l=String(e??"").trim(),s=String(i??"").trim();return s||l}function ad(e,i){const l=String(e??"").trim(),s=String(i??"").trim();return!s||l&&s===l?"":s}function nd(e,i,l){const s=String(e??"").trim(),n=String(i??"").trim(),d=String(l??"").trim();return d&&(!s||d!==s)?d:n}function dd(e,i){return(e||[]).map(l=>({...l,itemBorderColor:l.customIcon?"":i}))}function cd(e,i,l){return(e||[]).map(s=>({...s,buttonBgColor:s.customIcon?"":nd(i,l,s.buttonBgColor)}))}function ud(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 Ol({__: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),m=c&&typeof c=="object"?c:{},g=typeof m.alt=="string"?m.alt:"",b=typeof m.title=="string"?m.title:"",[_,h]=(0,a.useState)(!1),[p,B]=(0,a.useState)(!1),k=(0,a.useRef)(null),x=(0,a.useRef)(null),R=(0,a.useMemo)(()=>({clearIcon:(0,o.jsx)(t.ui_kit$ColorPickerClearGlyph,{})}),[]);(0,a.useEffect)(()=>{g.trim()&&h(!0)},[g]);const j=!!(g.trim()||_),N=!!(b.trim()||p),E=j||N;(0,a.useLayoutEffect)(()=>{n(l,{alt:j,title:N})},[j,l,n,N]);const I=(0,a.useMemo)(()=>({marginBottom:E?d.formItemMarginBottomXS:0}),[E,d.formItemMarginBottomXS]),$=(0,a.useMemo)(()=>[l,"alt"],[l]),U=(0,a.useMemo)(()=>[l,"title"],[l]),v=E?"selected-social-form__meta-fields":"selected-social-form__meta-fields is-hidden",L=j?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",P=N?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",z=(0,a.useMemo)(()=>g.trim()?g.trim():e("Alternative text"),[e,g]),le=(0,a.useMemo)(()=>b.trim()?b.trim():e("Tooltip text"),[e,b]),C=(0,a.useMemo)(()=>(0,ze.default)("selected-td-form__button",{"selected-td-form__button--active":j}),[j]),re=(0,a.useMemo)(()=>(0,ze.default)("selected-td-form__button",{"selected-td-form__button--active":N}),[N]),ae=(0,a.useCallback)(te=>{setTimeout(()=>{const me=te.current;if(me){if(typeof me.focus=="function"){me.focus();return}me.input&&typeof me.input.focus=="function"&&me.input.focus()}},0)},[]),_e=(0,a.useCallback)(()=>{j?(h(!1),g.trim()&&(i.setFieldValue(["items",l,"alt"],""),setTimeout(()=>s(),0))):(h(!0),ae(k))},[j,g,l,ae,i,s]),Te=(0,a.useCallback)(()=>{if(N)n(l,{title:!1}),B(!1),b.trim()&&(i.setFieldValue(["items",l,"title"],""),setTimeout(()=>s(),0));else{B(!0),n(l,{title:!0});const te=g.trim();i.setFieldValue(["items",l,"title"],te),setTimeout(()=>s(),0),ae(x)}},[g,l,ae,i,n,s,N,b]);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:I,children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:z,placement:"bottom",getPopupContainer:Oo,children:(0,o.jsx)(t.ui_kit$Button,{type:"default",className:C,onClick:_e,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:le,placement:"bottom",getPopupContainer:Oo,children:(0,o.jsx)(t.ui_kit$Button,{type:"default",className:re,onClick:Te,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})})]}),(0,o.jsxs)("div",{className:v,children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:$,className:L,children:(0,o.jsx)(t.ui_kit$Input,{ref:k,placeholder:e("Alternative text"),allowClear:R,prefix:ed})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:U,className:P,children:(0,o.jsx)(t.ui_kit$Input,{ref:x,placeholder:e("Social network name"),allowClear:R,prefix:od})})]})]})}Ol.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 md(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 pd(e){if(!e)return{align:"center",iconSize:40,borderRadius:0,gap:8,globalBgColor:"",globalItemBorderColor:"",buttonBorderWidth:0,showLabel:!1,items:[]};const i=sd(e),l=String(e?.hostCellBgForIconLuminance??"").trim(),s=md(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:Ll(e.items),buttonBorderWidth:n,showLabel:e.showLabel??!1,items:Array.isArray(e.items)?e.items.map(c=>{const m=!!c.customIcon,g=m?"":Gt(d,c.buttonBgColor),b=c.platform&&!m?r.getSocialIconForBlockCell(c.platform,Wt(i,g,l)):null;return{...c,customIcon:m,title:String(c.title??"").trim(),...b?{iconSrc:b}:{},iconWidth:null,iconHeight:null,buttonBgColor:g,itemBorderColor:m?"":String(c.itemBorderColor??"").trim()}}):[]}}var $l=({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:m}=r.useImagePicker(),[g,b]=(0,a.useState)(e),[_,h]=(0,a.useState)(null),[p,B]=(0,a.useState)(null),k=(0,a.useRef)(null),x=(0,a.useRef)(null),R=(0,a.useRef)(null),j=(0,a.useRef)(Nl(e)),N=r.useSelector(r.selectEmailSettings),E=(0,a.useRef)(null),I=(0,a.useRef)(!1),$=(0,a.useRef)(""),U=(0,a.useRef)({}),v=ld(),L=N?.usedColors??[],P=t.ui_kit$Form.useWatch("items",n)||[],z=(0,a.useCallback)(()=>{E.current&&(document.removeEventListener("dragover",E.current,!0),E.current=null)},[]),le=(0,a.useCallback)(()=>{if(E.current)return;const D=ie=>{ie.preventDefault(),ie.dataTransfer&&(ie.dataTransfer.dropEffect="move")};document.addEventListener("dragover",D,!0),E.current=D},[]),C=(0,a.useMemo)(()=>r.getSocialPresetsForBrand(Zn).filter(D=>r.SOCIAL_ICON_ORIGINAL_BY_PLATFORM[D.id]),[]),re=(0,a.useMemo)(()=>C.map(D=>({value:D.id,label:(0,o.jsxs)("span",{className:"selected-social-form__platform-option",children:[(0,o.jsx)("img",{src:r.getSocialIcon(D.id,v),alt:""}),(0,o.jsx)("span",{className:"selected-social-form__platform-option-text",children:i(D.labelMsgid)})]})})),[i,C,v]),ae=(0,a.useCallback)((D,ie)=>{U.current={...U.current,[D]:{...U.current[D],...ie}}},[]);(0,a.useEffect)(()=>{const D=Nl(e);j.current!==D&&(j.current=D,U.current={},b(e))},[e]);const _e=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(g?.settings){if(_e.current){_e.current=!1;return}const D=g.settings;$.current=D.bgEnabled&&D.bgColor?String(D.bgColor).trim():"",n.setFieldsValue(pd(g.settings))}},[g,n]),(0,a.useEffect)(()=>()=>z(),[z]);const Te=(0,a.useCallback)(()=>{const D=n.getFieldsValue(!0),ie=g.settings||{},we=String(ie.hostCellBgForIconLuminance??"").trim(),W=(D.globalBgColor||"").trim(),Se=typeof D.iconSize=="number"&&!Number.isNaN(D.iconSize)?D.iconSize:ie.iconSize??40,Oe=typeof D.borderRadius=="number"&&!Number.isNaN(D.borderRadius)?D.borderRadius:ie.borderRadius??0,Ae=typeof D.gap=="number"&&!Number.isNaN(D.gap)?D.gap:ie.gap??8,Ge={blockBgEnabled:!!W,blockBgColor:W},Ye=(D.globalItemBorderColor||"").trim();let Ze=typeof D.buttonBorderWidth=="number"&&!Number.isNaN(D.buttonBorderWidth)?D.buttonBorderWidth:0;Ze=Math.max(0,Math.min(24,Math.round(Ze)));const de={...ie,type:"social",align:D.align??ie.align??"center",iconSize:Se,borderRadius:Oe,gap:Ae,bgEnabled:!!W,bgColor:W,hostCellBgForIconLuminance:we,borderWidth:typeof ie.borderWidth=="number"?ie.borderWidth:0,borderColor:typeof ie.borderColor=="string"?ie.borderColor:"",buttonBorderColor:"",buttonBorderWidth:Ze,showLabel:D.showLabel,items:(D.items||[]).filter(Boolean).map((Ce,G)=>{const pe=!!Ce.customIcon,Pe=U.current[G]||{},We=pe?"":ad(W,(Ce.buttonBgColor||"").trim()),to=typeof Ce.href=="string"?Pl(Ce.href):Ce.href,eo=pe?"":Gt(W,We),no=!pe&&Ce.platform?r.getSocialIconForBlockCell(Ce.platform,Wt(Ge,eo,we)):null,O=pe?"":Ye||String(Ce.itemBorderColor??"").trim(),se=id(pe?Ce.iconSrc||"":no||Ce.iconSrc||"");return{...Ce,customIcon:pe,href:to,iconSrc:se,iconWidth:null,iconHeight:null,buttonBgColor:We,itemBorderColor:O,title:Pe.title?String(Ce.title??"").trim():""}})};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.SOCIAL,caption:g.caption,settings:de}),$.current=W,_e.current=!0,b(Ce=>({...Ce,settings:de}))},[g.caption,g.settings,n,d]),te=(0,a.useCallback)(D=>{if(D==null||D==="")return-1;const ie=r.stripEmVersionFromUrlString(String(D));return(n.getFieldValue("items")||[]).findIndex(we=>r.stripEmVersionFromUrlString(we&&we.iconSrc||"")===ie)},[n]),me=(0,a.useCallback)((D,ie,we,W)=>{const Se=[...n.getFieldValue("items")||[]];if(D<0||D>=Se.length)return;const Oe=r.stripEmVersionFromUrlString(String(W||""))===r.stripEmVersionFromUrlString(String(ie||""));(!Oe||ie!==Se[D]?.iconSrc)&&(Se[D]={...Se[D],iconSrc:ie,customIcon:!0,buttonBgColor:"",itemBorderColor:""},n.setFieldValue("items",Se),setTimeout(()=>Te(),0)),we?.mode==="save"&&Oe&&c(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(ie)})},[n,Te,c]),je=(0,a.useCallback)(async(D,ie)=>{const we=r.stripEmVersionFromUrlString(String(ie||"")),W=te(ie);if(W<0)return;const Se=(n.getFieldValue("items")||[])[W]?.iconSrc,{entryModal:Oe,currentUrl:Ae,imageDataUrl:Ge}=await Al(we,D),Ye=await m({kind:"img",currentUrl:Ae,entryModal:Oe,imageDataUrl:Ge});Ye?.url&&me(W,Ye.url,Ye.meta,Se)},[me,te,n,m]),ue=(0,a.useCallback)(async D=>{const ie=(n.getFieldValue("items")||[])[D];if(!ie)return;const{entryModal:we,currentUrl:W,imageDataUrl:Se}=await Al(r.stripEmVersionFromUrlString(String(ie.iconSrc||"")),r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD),Oe=ie.iconSrc,Ae=await m({kind:"img",currentUrl:W,entryModal:we,imageDataUrl:Se});Ae?.url&&me(D,Ae.url,Ae.meta,Oe)},[me,n,m]),Ve=(0,a.useCallback)(D=>{const ie=parseInt(D.currentTarget.dataset.socialEditIndex??"",10);Number.isNaN(ie)||ue(ie)},[ue]),Le=(0,a.useCallback)(D=>{const ie=D.data?.operation,we=D.data?.src;ie===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?je(r.MODALS.UPLOAD_IMAGE_MODAL_AI,we):ie===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?je(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,we):ie===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?je(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT,we):ie===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?je(r.MODALS.UPLOAD_IMAGE_MODAL_GIF,we):ie===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?je(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK,we):ie===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(s(r.closeSecondModal()),s(r.closeModal$1()))},[s,je]);r.useListenPostMessage(Le);const ve=(0,a.useCallback)(()=>{const D=n.getFieldValue("items")||[],ie=C[0],we=(n.getFieldValue("globalItemBorderColor")||"").trim(),W=(n.getFieldValue("globalBgColor")||"").trim();if(!ie)n.setFieldsValue({items:[...D,{platform:void 0,customIcon:!1,href:"",alt:"",title:"",iconSrc:"",iconWidth:null,iconHeight:null,buttonBgColor:W,itemBorderColor:we}]});else{const Se=String(g?.settings?.hostCellBgForIconLuminance??"").trim(),Oe=Gt(W,W),Ae=r.getSocialIconForBlockCell(ie.id,Wt({blockBgEnabled:!!W,blockBgColor:W},Oe,Se)),Ge=i(ie.labelMsgid);n.setFieldsValue({items:[...D,{platform:ie.id,customIcon:!1,href:"",alt:Ge,title:"",iconSrc:Ae,iconWidth:null,iconHeight:null,buttonBgColor:W,itemBorderColor:we}]})}setTimeout(()=>Te(),0)},[i,g?.settings?.hostCellBgForIconLuminance,n,C,Te]),he=(0,a.useCallback)((D,ie)=>{D.dataTransfer.setData(Cl,String(ie)),D.dataTransfer.setData(r.DND_SOCIAL_LIST_REORDER_MIME,String(ie)),D.dataTransfer.effectAllowed="move",k.current=ie,h(ie),le()},[le]),be=(0,a.useCallback)(()=>{z(),k.current=null,h(null),B(null)},[z]),Z=(0,a.useCallback)((D,ie,we)=>{if(we<2)return;D.preventDefault(),D.dataTransfer.dropEffect="move";const W=k.current;W!==null&&W!==ie&&B(ie)},[]),K=(0,a.useCallback)((D,ie)=>{D.currentTarget.contains(D.relatedTarget)||B(we=>we===ie?null:we)},[]),q=(0,a.useCallback)((D,ie,we)=>{D.preventDefault(),B(null);const W=D.dataTransfer.getData(Cl),Se=parseInt(W,10);if(Number.isNaN(Se)||Se===ie){z();return}we(Se,ie),z(),setTimeout(()=>Te(),0)},[z,Te]),Q=(0,a.useCallback)(D=>{const ie=D.currentTarget,we=parseInt(ie.dataset.itemIndex??"",10);Number.isNaN(we)||he(D,we)},[he]),V=(0,a.useCallback)(D=>{const ie=D.currentTarget,we=parseInt(ie.dataset.itemIndex??"",10),W=parseInt(ie.dataset.listLength??"",10);Number.isNaN(we)||Number.isNaN(W)||W<2||(D.preventDefault(),D.dataTransfer&&(D.dataTransfer.dropEffect="move"))},[]),M=(0,a.useCallback)(D=>{const ie=D.currentTarget,we=parseInt(ie.dataset.itemIndex??"",10),W=parseInt(ie.dataset.listLength??"",10);Number.isNaN(we)||Number.isNaN(W)||Z(D,we,W)},[Z]),Y=(0,a.useCallback)(D=>{const ie=parseInt(D.currentTarget.dataset.itemIndex??"",10);Number.isNaN(ie)||K(D,ie)},[K]),X=(0,a.useCallback)(D=>{const ie=parseInt(D.currentTarget.dataset.itemIndex??"",10),we=x.current;Number.isNaN(ie)||typeof we!="function"||q(D,ie,we)},[q]),ee=(0,a.useCallback)(D=>{D.stopPropagation();const ie=parseInt(D.currentTarget.dataset.fieldName??"",10),we=R.current;Number.isNaN(ie)||typeof we!="function"||(we(ie),queueMicrotask(Te))},[Te]),ne=(0,a.useCallback)((D,ie)=>{const we=C.find(de=>de.id===ie);if(!we)return;const W=i(we.labelMsgid),Se=U.current[D]||{},Oe=String(n.getFieldValue(["items",D,"alt"])??"").trim();(Se.alt||Oe)&&n.setFieldValue(["items",D,"alt"],W),Se.title&&n.setFieldValue(["items",D,"title"],W);const Ae=(n.getFieldValue("globalBgColor")||"").trim(),Ge=Gt(Ae,(n.getFieldValue(["items",D,"buttonBgColor"])||"").trim()),Ye=String(g?.settings?.hostCellBgForIconLuminance??"").trim(),Ze=r.getSocialIconForBlockCell(ie,Wt({blockBgEnabled:!!Ae,blockBgColor:Ae},Ge,Ye));Ze&&(n.setFieldValue(["items",D,"customIcon"],!1),n.setFieldValue(["items",D,"iconSrc"],Ze))},[i,g?.settings?.hostCellBgForIconLuminance,n,C]),Be=(0,a.useCallback)(D=>{if(Object.prototype.hasOwnProperty.call(D,"globalItemBorderColor")){if(!I.current){const ie=String(D.globalItemBorderColor??"").trim(),we=n.getFieldValue("items")||[];n.setFieldsValue({items:dd(we,ie)})}}else if(Object.prototype.hasOwnProperty.call(D,"globalBgColor")){const ie=$.current,we=String(D.globalBgColor??"").trim(),W=n.getFieldValue("items")||[];n.setFieldsValue({items:cd(W,ie,we)})}else if(D?.items!=null){const ie=n.getFieldValue("items")||[],we=Ll(ie);we!==(n.getFieldValue("globalItemBorderColor")||"").trim()&&(I.current=!0,n.setFieldValue("globalItemBorderColor",we),queueMicrotask(()=>{I.current=!1}));const W=g.settings?.items||[];ie.forEach((Se,Oe)=>{const Ae=Se?.platform,Ge=W[Oe]?.platform;Ae&&Ae!==Ge&&ne(Oe,Ae)})}ud(D?.items,ne),Te()},[g.settings?.items,n,Te,ne]),Ee=(0,a.useCallback)((D,ie)=>{if(n.setFieldValue(D,ie),Array.isArray(D)&&D[0]==="items"){Be({items:{[D[1]]:{[D[2]]:ie}}});return}Be({[D]:ie})},[n,Be]),oe=(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)(zo,{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:Oo,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:Oo,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:Oo,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:Oo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"globalBgColor",className:"form-item-margin-xs",children:(0,o.jsx)(zt,{form:n,name:"globalBgColor",placeholder:i("Background color"),usedColors:L,onColorChange:Ee})})})})]}),(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:Oo,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:Oo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"globalItemBorderColor",className:"form-item-margin-xs",children:(0,o.jsx)(zt,{form:n,name:"globalItemBorderColor",placeholder:i("Border color"),usedColors:L,onColorChange:Ee})})})})]})]}),(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:(D,{remove:ie,move:we})=>(x.current=we,R.current=ie,(0,o.jsx)("div",{className:"selected-social-form__items",children:D.map((W,Se)=>{const Oe=!!(P[Se]?.customIcon??P[W.name]?.customIcon);return(0,o.jsxs)("div",{className:(0,ze.default)("selected-social-form__card",_===Se&&"selected-social-form__card--dragging",p===Se&&_!==Se&&"selected-social-form__card--drag-over"),"data-item-index":Se,"data-list-length":D.length,onDragEnterCapture:V,onDragOverCapture:M,onDragLeave:Y,onDropCapture:X,children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head",children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head-main",children:[D.length>1?(0,o.jsx)("span",{className:"selected-social-form__drag-handle",draggable:!0,"data-item-index":Se,onDragStart:Q,onDragEnd:be,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)(Qn,{className:"selected-social-form__card-title",children:[i("Button")," ",Se+1]})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Delete"),placement:"top",getPopupContainer:Oo,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":W.name,onClick:ee})})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[W.name,"iconSrc"],hidden:!0,children:(0,o.jsx)(t.ui_kit$Input,{})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[W.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:[W.name,"platform"],className:"selected-social-form__platform-field selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:re,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:Oo,children:(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"selected-social-form__platform-edit","data-social-edit-index":Se,icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,size:18,strokeWidth:l.iconStrokeWidth}),"aria-label":i("Edit icon"),onClick:Ve})})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[W.name,"href"],className:"selected-social-form__card-field",rules:[{required:!0,whitespace:!0,message:i("Please enter the URL.")},{validator:async(Ae,Ge)=>{const Ye=typeof Ge=="string"?Ge.trim():String(Ge??"").trim();if(Ye&&!rd(Ye))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,{})}})}),Oe?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:Oo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:[W.name,"buttonBgColor"],className:"selected-social-form__card-field",children:(0,o.jsx)(zt,{form:n,name:["items",W.name,"buttonBgColor"],placeholder:i("Background color"),usedColors:L,onColorChange:Ee})})})}),(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:Oo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:[W.name,"itemBorderColor"],className:"selected-social-form__card-field",children:(0,o.jsx)(zt,{form:n,name:["items",W.name,"itemBorderColor"],placeholder:i("Border color"),usedColors:L,onColorChange:Ee})})})})]}),(0,o.jsx)(Ol,{__:i,form:n,fieldName:W.name,pushSettingsToIframe:Te,onMetaActiveChange:ae})]},W.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:ve,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:Be,autoComplete:"off",children:(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:oe})})})};$l.propTypes={elementSettings:f.default.shape({settings:f.default.object,type:f.default.string,caption:f.default.string})};var St=["borderAll","borderTop","borderRight","borderBottom","borderLeft"],Fl=["all","top","right","bottom","left"],Li={width:1,style:"solid",color:"#E5E5E5"},Ml=["All","TopLeft","TopRight","BottomRight","BottomLeft"],ro=e=>u(e),Lo=e=>e!==""&&e!==null&&e!==void 0;function Tt(e,i=""){return typeof e=="number"?String(e):typeof e=="string"&&e?e:i}function Yt(e){return Lo(e?.width)||!!e?.style||!!e?.color}function Dl(e){const i=St.find(l=>e[l]?.style);return i?e[i]:null}function Oi(e){return Dl(e)??Li}function $i(e,i){const l=Fl.find(n=>Yt(i[n]))??"all",s=Yt(i[l])?i[l]:Dl(e)??{};return{mobileBorderPosition:l,mobileBorderWidth:s.width??"",mobileBorderColor:s.color??"",mobileBorderStyle:s.style??""}}var hd=e=>ro(e?.replace(/px$/,""));function Vl(e,i){return Object.fromEntries(["LeftRight","TopBottom","Left","Right","Top","Bottom"].map(l=>{const s=`${i}padding${l}`;return[s,hd(e[s])]}))}function bd(e){return{borderRadiusAll:ro(e.all),borderRadiusTopLeft:ro(e.topLeft),borderRadiusTopRight:ro(e.topRight),borderRadiusBottomRight:ro(e.bottomRight),borderRadiusBottomLeft:ro(e.bottomLeft)}}function gd(e){const i=l=>ro(l!==null?l:e.all);return{mobileBorderRadiusAll:ro(e.all),mobileBorderRadiusTopLeft:i(e.topLeft),mobileBorderRadiusTopRight:i(e.topRight),mobileBorderRadiusBottomRight:i(e.bottomRight),mobileBorderRadiusBottomLeft:i(e.bottomLeft)}}function Hl(e,i){return{[`${i}Inset`]:ro(e?.inset)||!1,[`${i}HOffset`]:ro(e?.hOffset),[`${i}VOffset`]:ro(e?.vOffset),[`${i}BlurRadius`]:ro(e?.blurRadius),[`${i}SpreadRadius`]:ro(e?.spreadRadius),[`${i}Color`]:ro(e?.color)}}function Ul(e,i){return Object.fromEntries(St.map(l=>[`${i}${l}`,e[`${i}${l}`]]))}function fd(e){return{fontFamily:ro(e.fontFamily),fontSize:ro(e.fontSize),lineHeight:ro(e.lineHeight),textStrong:ro(e.textStrong),textItalic:ro(e.textItalic),textStrikethrough:ro(e.textStrikethrough),textUnderline:ro(e.textUnderline),textLink:ro(e.textLink),linkHref:ro(e.linkHref),linkTarget:ro(e.linkTarget),textColor:ro(e.textColor),textBackgroundColor:ro(e.textBackgroundColor),textAlign:ro(e.textAlign),valign:ro(e.textValign)}}function zl(e){const i=e.customTable,l=i.mobileBackgroundColor;return{show:e.show||"all",outlookBackground:e.outlookBackground,...at(e),mobileBackgroundColor:ro(l?.value!=="none"?l?.value:""),...Vl(i,""),...Vl(i,"cell_"),backgroundColor:ro(i.backgroundColor),backgroundImage:ro(i.backgroundImage?.[0]?.value),backgroundPositionX:ro(i.backgroundPositionX),backgroundPositionY:ro(i.backgroundPositionY),backgroundRepeat:ro(i.backgroundRepeat),backgroundSize:ro(i.backgroundSize),...Ul(i,""),borderPosition:i.borderPosition||"borderAll",...Ul(i,"cell_"),cell_borderPosition:i.cell_borderPosition||"cell_borderAll",cellBackgroundColor:ro(i.cellBackgroundColor),...bd(i.borderRadius),...Hl(i.boxShadow,"boxShadow"),...Hl(i.mobileBoxShadow,"mobileBoxShadow"),mobileWidth:xo(i.mobileWidth?.value),mobileWidthDim:i.mobileWidth?.dim,mobileHeight:xo(i.mobileHeight?.value),mobileHeightDim:i.mobileHeight?.dim,...gd(i.mobileBorderRadius),...$i(i,i.mobileBorder),...fd(i)}}function Wl(e,i){return Ml.some(l=>Number(e[`${i}Radius${l}`])>0)}function Gl(e,i){return["Color","HOffset","VOffset"].some(l=>Lo(e[`${i}${l}`]))}function _d(e){const i=e.mobileBackgroundRepeat;return["mobileBackgroundColor","mobileBackgroundImage","mobileBackgroundPositionX","mobileBackgroundPositionY"].some(l=>Lo(e[l]))||Lo(i)&&i!=="none"||Lo(e.mobileBackgroundSize)}function Yl(e,i,l,s){switch(e){case"border":return St.some(n=>!!i[`${s?"cell_":""}${n}`]?.style);case"background":return s?Lo(i.cellBackgroundColor):Lo(i.backgroundColor)||Lo(i.backgroundImage);case"borderRadius":return Wl(i,"border");case"boxShadow":return Gl(i,"boxShadow");case"mobileSize":return Lo(i.mobileWidth)||Lo(i.mobileHeight);case"mobileBackground":return _d(i);case"mobileBorder":return Fl.some(n=>Yt(l[n]));case"mobileBorderRadius":return Wl(i,"mobileBorder");case"mobileBoxShadow":return Gl(i,"mobileBoxShadow");default:return!1}}var Xl=["background","border","borderRadius","boxShadow","mobileSize","mobileBackground","mobileBorder","mobileBorderRadius","mobileBoxShadow"];function Kl(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 Xl.forEach(n=>{s[n]=Yl(n,e,i,l)}),s}function xd(e,i){const l={...e};return Xl.forEach(s=>{l[s]=e[s]||i[s]}),l}function Xt(e,i){const l=i==="mobile"?"mobileBorderRadius":"borderRadius",[s,...n]=Ml.map(d=>e[`${l}${d}`]);return!!s||!n.some(d=>!!d)}var kd=["borderRadius","mobileWidth","mobileHeight","mobileBoxShadow","mobileBorder","mobileBorderRadius"],Ed=["textStrong","textItalic","textStrikethrough","textUnderline","textLink","linkHref","textAlign"];function ql(e,i){return Object.fromEntries(i.map(l=>[l,e[l]]))}function Bd(e){return{...e,...ql(e.customTable,kd)}}function Sd(e){return{...e,...ql(e.customTable,Ed),valign:e.customTable.textValign}}var Kt={hOffset:5,vOffset:5,blurRadius:10,spreadRadius:-5,color:"#000000",inset:!1},qt={hOffset:null,vOffset:null,blurRadius:null,spreadRadius:null,inset:!1},Jt=5,Qt="#E5E5E5",Jl="em-mob-box_shadow-",Ql="em-mob-border_radius_all-",Td={width:"",style:"",color:""},Rd=["LeftRight","TopBottom","Left","Right","Top","Bottom"],Zl=["All","TopLeft","TopRight","BottomRight","BottomLeft"],yd=["backgroundColor","backgroundImage","backgroundPositionX","backgroundPositionY","backgroundRepeat","backgroundSize"];function Zt(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 Rt=(e,i="")=>Object.fromEntries(e.map(l=>[l,i])),wd={padding:{off:()=>({fields:Rt(Rd.map(e=>`padding${e}`)),settings:{padding:{all:0}}})},background:{on:({prefix:e})=>{const i=e?"cellBackgroundColor":"backgroundColor";return{fields:{[i]:Qt},settings:{[i]:Qt}}},off:({prefix:e})=>e?{fields:{cellBackgroundColor:""},settings:{cellBackgroundColor:""}}:{fields:Rt(yd),backgroundImageEmpty:!0,settings:{backgroundColor:"",backgroundImage:[{type:"url",value:""}],backgroundRepeat:"",backgroundSize:""}}},border:{on:({prefix:e})=>({fields:{[`${e}borderPosition`]:`${e}borderAll`,[`${e}borderAll`]:Li},settings:{[`${e}borderAll`]:Li}}),off:({prefix:e})=>({fields:Rt(St.map(i=>`${e}${i}`),Td),settings:{[`${e}borderAll`]:{style:""}}})},borderRadius:{on:()=>({fields:{borderRadiusAll:Jt},settings:{borderRadius:{all:Jt}},uniformRadius:"desktop"}),off:()=>({fields:Rt(Zl.map(e=>`borderRadius${e}`)),settings:{borderRadius:{all:0}},uniformRadius:"desktop"})},boxShadow:{on:()=>({fields:Zt("boxShadow",Kt),settings:{boxShadow:Kt}}),off:()=>({fields:Zt("boxShadow",qt),settings:{boxShadow:{...qt,color:""}}})},mobileSize:{off:({fields:e})=>({fields:{mobileWidth:"",mobileHeight:""},settings:{mobileWidth:{value:null,dim:Tt(e.mobileWidthDim,"px"),classNamePrefix:"em-mob-width-"},mobileHeight:{value:null,dim:"px",classNamePrefix:"em-mob-height-"}}})},mobileBackground:{on:()=>({fields:{mobileBackgroundColor:Qt},settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:Qt}}}),off:()=>({fields:{...at({}),mobileBackgroundColor:""},settings:Qr()})},mobileBorder:{on:({settings:e})=>{const i={...Oi(e.customTable),classNamePrefix:"em-mob-border_all-"},l={...r.RESET_BORDER_PARAMS,all:i};return{fields:$i(e.customTable,l),settings:{mobileBorder:{all:i}},mobileBorders:l}},off:({settings:e})=>({fields:$i(e.customTable,r.RESET_BORDER_PARAMS),settings:{mobileBorder:r.RESET_BORDER_PARAMS},mobileBorders:r.RESET_BORDER_PARAMS})},mobileBorderRadius:{on:()=>({fields:{mobileBorderRadiusAll:Jt},settings:{mobileBorderRadius:{all:Jt,classNamePrefix:Ql}},uniformRadius:"mobile"}),off:()=>({fields:Rt(Zl.map(e=>`mobileBorderRadius${e}`)),settings:{mobileBorderRadius:{all:null,classNamePrefix:Ql}},uniformRadius:"mobile"})},mobileBoxShadow:{on:()=>({fields:Zt("mobileBoxShadow",Kt),settings:{mobileBoxShadow:{...Kt,classNamePrefix:Jl}}}),off:()=>({fields:Zt("mobileBoxShadow",qt),settings:{mobileBoxShadow:{...qt,color:null,classNamePrefix:Jl}}})}},jd=["padding","cellPadding","background","border","borderRadius","boxShadow","mobileSize","mobileBackground","mobileBorder","mobileBorderRadius","mobileBoxShadow"];function Id(e,i,l){const s=c=>`${i}padding${c}`;if(l){const[c,m]=[e[s("LeftRight")],e[s("TopBottom")]];return{fields:{[s("Left")]:c,[s("Right")]:c,[s("Top")]:m,[s("Bottom")]:m}}}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 vd(e){const{form:i,settings:l,send:s,isTableCells:n,mobileBorders:d,setMobileBorders:c,setBackgroundImageEmpty:m}=e,g=(0,a.useMemo)(()=>zl(l),[l]),[b,_]=(0,a.useState)(()=>Kl(g,l.customTable.mobileBorder,n)),[h,p]=(0,a.useState)(!0),[B,k]=(0,a.useState)(()=>Xt(g,"desktop")),[x,R]=(0,a.useState)(()=>Xt(g,"mobile"));(0,a.useEffect)(()=>{_(I=>xd(I,Kl(g,l.customTable.mobileBorder,n))),k(Xt(g,"desktop")),R(Xt(g,"mobile"))},[g,l,n]);const j=n?"cell_":"",N=(0,a.useMemo)(()=>{const I=U=>{U&&(U.fields&&i.setFieldsValue(U.fields),U.mobileBorders&&c(U.mobileBorders),U.backgroundImageEmpty!==void 0&&m?.(U.backgroundImageEmpty),U.uniformRadius&&(U.uniformRadius==="mobile"?R:k)(!0),U.settings&&s(U.settings))},$=U=>{const v=i.getFieldsValue(!0),L=wd[U],P={fields:v,settings:l,prefix:j};b[U]?I(L?.off?.(P)):Yl(U,v,d,n)||I(L?.on?.(P)),_(z=>({...z,[U]:!z[U]}))};return Object.fromEntries(jd.map(U=>[U,()=>$(U)]))},[i,l,s,n,d,c,m,b,j]);return{open:b,toggle:N,paddingsExt:h,togglePaddingMode:()=>{const I=Id(i.getFieldsValue(!0),j,h);i.setFieldsValue(I.fields??{}),I.settings&&s(I.settings),p(!h)},oneBorderRadiusValue:B,setOneBorderRadiusValue:k,oneMobileBorderRadiusValue:x,setOneMobileBorderRadiusValue:R}}var ei={width:"",style:"",color:""},Cd="em-mob-box_shadow-",es={mobileBorderWidth:"width",mobileBorderStyle:"style",mobileBorderColor:"color"},Pd=(e,i)=>({settings:{[e]:i}});function os(e,i){return{hOffset:e[`${i}HOffset`],vOffset:e[`${i}VOffset`],blurRadius:e[`${i}BlurRadius`],spreadRadius:e[`${i}SpreadRadius`],color:e[`${i}Color`],inset:e[`${i}Inset`]}}var oi=e=>`em-mob-border_${e}-`,yt=e=>({...r.RESET_BORDER_PARAMS[e],classNamePrefix:oi(e)});function ts(){return{top:yt("top"),right:yt("right"),bottom:yt("bottom"),left:yt("left")}}var Ad=e=>e?.width!=null&&e?.style!=null&&e?.color!=null;function Nd(e){const i=l=>({...e,classNamePrefix:oi(l)});return{top:i("top"),right:i("right"),bottom:i("bottom"),left:i("left")}}function Ld(e,i,l,s){const n=Oi(s.settings.customTable),d=(c,m)=>{const g=c===i?l:e[m];return Lo(g)?g:n[c]};return{width:d("width","mobileBorderWidth"),style:d("style","mobileBorderStyle"),color:d("color","mobileBorderColor")}}var Od=(e,i,l,s)=>{const n=l.mobileBorderPosition||"all",d=es[e],c=s.mobileBorders;if(!Lo(i)){const b=n==="all"?{...ts(),all:{...c.all,[d]:null,classNamePrefix:oi("all")}}:{...c,[n]:yt(n),all:{...r.RESET_BORDER_PARAMS.all}};return{settings:{mobileBorder:b},mobileBorders:b}}const m={...Ld(l,d,i,s),classNamePrefix:oi(n)},g=n==="all"?{...ts(),all:m}:{...c,...Ad(c.all)?Nd(c.all):{},[n]:m,all:{...r.RESET_BORDER_PARAMS.all}};return{settings:{mobileBorder:g},mobileBorders:g,fields:{mobileBorderWidth:m.width,mobileBorderStyle:m.style,mobileBorderColor:m.color}}},$d=(e,i,l,s)=>{const n=s.mobileBorders[i],d=Yt(n)?n:Oi(s.settings.customTable);return{fields:{mobileBorderWidth:d.width??"",mobileBorderColor:d.color??"",mobileBorderStyle:d.style??""}}},Fd=(e,i,l)=>{if(i?.style==="")return{settings:{[e]:i},fields:{[e]:ei}};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:ei}}},Md=(e,i)=>{const l=St.filter(n=>n!=="borderAll"),s=i?.style===""?{borderAll:ei}:Object.fromEntries(l.map(n=>[n,ei]));return{settings:{[e]:i},fields:s}},Vo=(e,i)=>Object.fromEntries(e.map(l=>[l,i])),Fi=(e,i)=>i.map(l=>e+l),Dd=["textAlign","valign"],is=["Inset","HOffset","VOffset","BlurRadius","SpreadRadius","Color"],Vd=["Color","Image","PositionX","PositionY","Repeat","Size"],Hd={...Vo(Fi("boxShadow",is),(e,i,l)=>({settings:{boxShadow:os(l,"boxShadow")}})),...Vo(Fi("mobileBoxShadow",is),(e,i,l)=>({settings:{mobileBoxShadow:{...os(l,"mobileBoxShadow"),classNamePrefix:Cd}}})),...Vo(Object.keys(H.BORDER_RADIUS_POSITION),(e,i)=>({settings:{borderRadius:{[H.BORDER_RADIUS_POSITION[e]]:+i}}})),...Vo(Object.keys(H.MOBILE_BORDER_RADIUS_POSITION),(e,i)=>{const l=H.MOBILE_BORDER_RADIUS_POSITION[e];return{settings:{mobileBorderRadius:{[l]:i,classNamePrefix:`em-mob-border_radius_${l}-`}}}}),...Vo(Fi("mobileBackground",Vd),(e,i)=>{const l=kt({[e]:i});return l?{settings:l}:{}}),...Vo(Object.keys(es),Od),...Vo(["borderTop","borderRight","borderBottom","borderLeft"],Fd),...Vo(["fontSize","lineHeight"],(e,i)=>Lo(i)?{settings:{[e]:i}}:{}),...Vo(Dd,()=>({})),borderAll:Md,borderPosition:()=>({}),mobileBorderPosition:$d,backgroundImage:(e,i,l,s)=>({settings:{backgroundImage:[{...s.settings.customTable.backgroundImage?.[0],type:"url",value:Tt(i)}],...i?{backgroundSize:"cover"}:{}},backgroundImageEmpty:i===""}),mobileWidth:(e,i,l)=>({settings:{mobileWidth:{classNamePrefix:"em-mob-width-",value:i,dim:Tt(l.mobileWidthDim)}}}),mobileWidthDim:(e,i,l)=>({settings:{mobileWidth:{classNamePrefix:"em-mob-width-",value:l.mobileWidth||100,dim:Tt(i)}}}),mobileHeight:(e,i,l)=>({settings:{mobileHeight:{classNamePrefix:"em-mob-height-",value:i,dim:Tt(l.mobileHeightDim)}}}),linkHref:(e,i)=>{const l=it(i);return{settings:{linkHref:l},linkHref:l,...l!==i?{fields:{linkHref:l}}:{}}}};function Ud(e,i,l){const[s]=Object.keys(e);return s?(Hd[s]??Pd)(s,e[s],i,l):{}}function zd(e){const{form:i,settings:l,send:s,mobileBorders:n,setMobileBorders:d,setBackgroundImageEmpty:c,onLinkHref:m}=e;return(0,a.useCallback)(g=>{const b=Ud(g,i.getFieldsValue(!0),{settings:l,mobileBorders:n});b.fields&&i.setFieldsValue(b.fields),b.mobileBorders&&d(b.mobileBorders),b.backgroundImageEmpty!==void 0&&c(b.backgroundImageEmpty),b.linkHref!==void 0&&m(b.linkHref),b.settings&&s(b.settings)},[i,l,s,n,d,c,m])}function Wd(e){const i=e.customTable.mobileBorder,[l,s]=(0,a.useState)(i);return(0,a.useEffect)(()=>s(i),[i]),[l,s]}function Gd(e,i){return(0,a.useCallback)(l=>e({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i,settings:l}),[e,i])}var nt=["hover"],rs={width:"100%"},ls={paddingBottom:4},Yd={textAlign:"right"},Mi=e=>e.parentNode,Xd=e=>e.closest(".selected-element-panel"),Kd=e=>e.closest(".email-pane__collapse-wrapper"),qd=({elementSettings:e,__:i,token:l,sendAction:s,typografItems:n})=>{const d=H.useGoogleFontsLoader(),c=(0,a.useMemo)(()=>({marginBottom:l.formItemMarginBottomXS}),[l.formItemMarginBottomXS]),m=(0,a.useMemo)(()=>({items:n}),[n]),g=(0,a.useCallback)(()=>s("add_img"),[s]),b=(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:rs,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:m,trigger:nt,placement:"bottom",getPopupContainer:Xd,children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Typograf",component:t.icons$Typograf}),onClick:b,style:rs,children:i("Typography")})})})})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:nt,title:i("Text font"),placement:"bottom",zIndex:1,getPopupContainer:Mi,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:Kd})})}),!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:nt,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:nt,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"})})})})]})]})},Jd=({elementSettings:e,__:i,token:l,textInputRef:s,linkProtocol:n,handleLinkProtocolsChange:d})=>{const c=!!e.customTable?.isNewLink,m=(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)(tt,{show:n==="#",__:i,style:m}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:nt,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)(ot,{linkProtocol:n,handleLinkProtocolsChange:d,__:i}),allowClear:!0,placeholder:i("Hyperlink URL"),prefix:(0,o.jsx)(et,{linkProtocol:n})})})})]})})},Qd=({form:e,elementSettings:i,__:l,token:s,isMacOS:n,formValues:d,textInputRef:c,linkProtocol:m,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)(lo,{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)(lo,{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)(lo,{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)(lo,{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)(lo,{form:e,className:(0,ze.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)(Jd,{elementSettings:i,__:l,token:s,textInputRef:c,linkProtocol:m,handleLinkProtocolsChange:g})]}),Zd=({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:ls,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:nt,title:l("Text color"),placement:"bottom",zIndex:2,getPopupContainer:Mi,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:nt,title:l("Text background"),placement:"bottom",zIndex:2,getPopupContainer:Mi,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:ls,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(lt,{form:e,elementSettings:i,name:"textAlign"})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:Yd,children:(0,o.jsx)(Do,{form:e,elementSettings:i,name:"valign",isNewIconType:!0})})]})]})},ec=e=>{const{form:i,elementSettings:l,__:s,token:n,appConfig:d,backgroundRepeatOptions:c,backgroundSizeOptions:m,handleToggleShowPaddingCell:g,handleTogglePaddingCell:b,handleToggleBackground:_,handleToggleBorder:h,handleToggleBorderRadius:p,paddingCellShow:B,paddingsExt:k,backgroundShow:x,cellBordersShow:R,borderRadiusShow:j,oneBorderRadiusValue:N,setOneBorderRadiusValue:E,backgroundImageEmpty:I}=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)(qd,{...e}),(0,o.jsx)(Qd,{...e}),(0,o.jsx)(Zd,{...e})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:s("Padding"),collapsible:!0,open:B,onToggle:g,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{namePrefix:"cell_",extended:k,onToggleExtended:b,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:I,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:m,imageUploadSlot:(d.formTableFieldBackgroundImageEnabled,void 0)})}),(0,o.jsx)(t.ui_kit$FormSection,{title:s("Borders"),collapsible:!0,open:R,onToggle:h,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:i,namePrefix:"cell_"})}),d.formFieldBorderRadiusEnabled&&!1]})},ss=({form:e,elementSettings:i,paddingShow:l,paddingsExt:s,backgroundShow:n,bordersShow:d,borderRadiusShow:c,boxShadowShow:m,handleToggleShowPadding:g,handleTogglePadding:b,handleToggleBackground:_,handleToggleBorder:h,handleToggleBorderRadius:p,handleToggleBoxShadow:B,backgroundRepeatOptions:k,backgroundSizeOptions:x,backgroundImageEmpty:R,oneBorderRadiusValue:j,setOneBorderRadiusValue:N})=>{const{__:E}=r.useI18n(),I=r.useAppConfig(),{token:$}=(0,t.ui_kit$useToken)();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$FormSection,{title:E("Padding"),collapsible:!0,open:l,onToggle:g,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:s,onToggleExtended:b,gutter:$.marginSM,labels:{horizontal:E("Horizontal padding"),vertical:E("Vertical padding"),left:E("Left padding"),right:E("Right padding"),top:E("Top padding"),bottom:E("Bottom padding"),individual:E("Individual padding")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:E("Background"),collapsible:!0,open:n,onToggle:_,dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{imageEnabled:I.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:R,usedColors:i.usedColors,colorPlaceholder:E("Background color"),horizontalPositionPlaceholder:E("Horizontal position"),horizontalPositionTooltip:E("Horizontal position"),verticalPositionPlaceholder:E("Vertical position"),verticalPositionTooltip:E("Vertical position"),backgroundRepeatTooltip:E("Background image repeat"),backgroundSizeTooltip:E("Background image size"),selectPlaceholder:E("Please choose"),backgroundRepeatOptions:k,backgroundSizeOptions:x,imageUploadSlot:I.formTableFieldBackgroundImageEnabled?(0,o.jsx)($o,{form:e,label:E("Background image"),name:"backgroundImage",tooltipTitle:E("Background image"),placeholder:E("Background image link/route")}):void 0}),(0,o.jsx)(st,{form:e,showBackground:!0})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:E("Borders"),collapsible:!0,open:d,onToggle:h,dividerTop:!0,children:(0,o.jsx)(H.SelectedElementFormBorder,{form:e})}),I.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Border radius"),collapsible:!0,open:c,onToggle:p,dividerTop:!0,children:(0,o.jsx)(wo,{form:e,oneBorderRadiusValue:j,setOneBorderRadiusValue:N,elementSettings:i})}),I.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Box shadow"),collapsible:!0,open:m,onToggle:B,dividerTop:!0,children:(0,o.jsx)(Po,{})}),I.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e})})]})};ss.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 as=({form:e,elementSettings:i,mobileSizeShow:l,mobileBackgroundShow:s,mobileBordersShow:n,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,handleToggleMobileSize:m,handleToggleMobileBackground:g,handleToggleMobileBorder:b,handleToggleMobileBorderRadius:_,handleToggleMobileBoxShadow:h,oneMobileBorderRadiusValue:p,setOneMobileBorderRadiusValue:B,mobileBorders:k})=>{const{__:x,_x:R}=r.useI18n(),j=r.useAppConfig(),{token:N}=(0,t.ui_kit$useToken)(),E=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:m,dividerTop:!0,children:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:x("Table width"),placement:"left",children:(0,o.jsx)("div",{style:{marginBottom:N.formItemMarginBottomMD+4},children:(0,o.jsx)(Go,{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:N.formItemMarginBottomXS*2},children:(0,o.jsx)(t.ui_kit$Tooltip,{title:x("Height"),placement:"bottom",children:(0,o.jsx)(rt,{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)(Bt,{elementSettings:Yo(i),imageEnabled:j.formTableFieldBackgroundImageEnabled,desktopBackground:Et(i)})}),j.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Borders"),collapsible:!0,open:n,onToggle:b,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormBorderInputs,{form:e,fieldStructure:"flat",borderValues:k,usedColors:E.usedColors,labels:{color:x("Color"),width:R("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)(wo,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:p,setOneBorderRadiusValue:B,elementSettings:i})}),j.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Box shadow"),collapsible:!0,open:c,onToggle:h,dividerTop:!0,children:(0,o.jsx)(Po,{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})})]})};as.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 oc=({form:e,elementViewType:i,mobileViewActive:l,elementSettings:s,paddingShow:n,paddingsExt:d,backgroundShow:c,bordersShow:m,borderRadiusShow:g,boxShadowShow:b,mobileSizeShow:_,mobileBackgroundShow:h,mobileBordersShow:p,mobileBorderRadiusShow:B,mobileBoxShadowShow:k,handleToggleShowPadding:x,handleTogglePadding:R,handleToggleBackground:j,handleToggleBorder:N,handleToggleBorderRadius:E,handleToggleBoxShadow:I,handleToggleMobileSize:$,handleToggleMobileBackground:U,handleToggleMobileBorder:v,handleToggleMobileBorderRadius:L,handleToggleMobileBoxShadow:P,backgroundRepeatOptions:z,backgroundSizeOptions:le,backgroundImageEmpty:C,oneBorderRadiusValue:re,setOneBorderRadiusValue:ae,oneMobileBorderRadiusValue:_e,setOneMobileBorderRadiusValue:Te,mobileBorders:te})=>(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)(as,{form:e,elementSettings:s,mobileSizeShow:_,mobileBackgroundShow:h,mobileBordersShow:p,mobileBorderRadiusShow:B,mobileBoxShadowShow:k,handleToggleMobileSize:$,handleToggleMobileBackground:U,handleToggleMobileBorder:v,handleToggleMobileBorderRadius:L,handleToggleMobileBoxShadow:P,oneMobileBorderRadiusValue:_e,setOneMobileBorderRadiusValue:Te,mobileBorders:te})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(ss,{form:e,elementSettings:s,paddingShow:n,paddingsExt:d,backgroundShow:c,bordersShow:m,borderRadiusShow:g,boxShadowShow:b,handleToggleShowPadding:x,handleTogglePadding:R,handleToggleBackground:j,handleToggleBorder:N,handleToggleBorderRadius:E,handleToggleBoxShadow:I,backgroundRepeatOptions:z,backgroundSizeOptions:le,backgroundImageEmpty:C,oneBorderRadiusValue:re,setOneBorderRadiusValue:ae})})}),ns=e=>e.customTable?.backgroundImage?.[0]?.value==="",ds=({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(),m=r.useSelector(r.selectEmailViewType),g=r.useSelector(r.selectMobileViewActive),b=r.useSelector(r.selectIsCodeMode),_=r.useSelector(r.selectCodeModeDirection),h=i===r.EDIT_SELECTED_TABLE_CELLS,p=Gd(s,e.type),[B,k]=Wd(e),[x,R]=(0,a.useState)(ns(e)),[j,N]=(0,a.useState)("https://"),E=vd({form:n,settings:e,send:p,isTableCells:h,mobileBorders:B,setMobileBorders:k,setBackgroundImageEmpty:R}),I=(0,a.useCallback)(je=>Wo(je,N),[]),$=zd({form:n,settings:e,send:p,mobileBorders:B,setMobileBorders:k,setBackgroundImageEmpty:R,onLinkHref:I}),U=(0,a.useMemo)(()=>({table:Bd(e),cell:Sd(e)}),[e]),v=(0,a.useRef)(),L=t.ui_kit$Form.useWatch([],n),P=[{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"}],z=[{label:l("Not defined"),value:""},{label:l("Contain"),value:"contain"},{label:l("Cover"),value:"cover"}],le=b&&_!=="bottom",[C,re]=(0,a.useState)(null);(0,a.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&re(!0)},[]);const ae=je=>{s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:je,locale:"en_US"})},_e=[{key:"1",label:l("This element"),onClick:()=>ae("typograf")},{key:"2",label:l("The whole email"),onClick:()=>ae("typograf_all")}];(0,a.useEffect)(()=>{n.setFieldsValue(zl(e)),R(ns(e))},[n,e]),(0,a.useEffect)(()=>{n.getFieldValue("linkHref")||n.setFieldsValue({linkHref:null})},[L?.textLink,L?.linkHref,e.customTable?.linkHref,n]),(0,a.useEffect)(()=>{e.customTable?.linkHref&&Wo(e.customTable?.linkHref||"",N),n.setFieldsValue({linkHref:typeof e.customTable?.linkHref=="string"?e.customTable.linkHref:"https://"})},[n,e,N]);const Te=je=>{n.setFieldValue("linkHref",je!=="mergetag"?je:""),N(je)},{open:te,toggle:me}=E;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:$,autoComplete:"off",className:"element-controls",style:{padding:0,display:"flex",flexDirection:"column"},children:[!le&&(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"})}),h?(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(ec,{form:n,formValues:L,elementSettings:U.cell,appConfig:c,token:d,isMacOS:C,__:l,handleToggleShowPaddingCell:me.cellPadding,handleTogglePaddingCell:E.togglePaddingMode,handleToggleBackground:me.background,handleToggleBorder:me.border,handleToggleBorderRadius:me.borderRadius,paddingCellShow:te.cellPadding,paddingsExt:E.paddingsExt,backgroundShow:te.background,cellBordersShow:te.border,borderRadiusShow:te.borderRadius,oneBorderRadiusValue:E.oneBorderRadiusValue,setOneBorderRadiusValue:E.setOneBorderRadiusValue,backgroundImageEmpty:x,backgroundRepeatOptions:P,backgroundSizeOptions:z,sendAction:ae,typografItems:_e,textInputRef:v,linkProtocol:j,handleLinkProtocolsChange:Te})}):(0,o.jsx)(oc,{form:n,elementSettings:U.table,handleToggleShowPadding:me.padding,handleTogglePadding:E.togglePaddingMode,handleToggleBackground:me.background,handleToggleBorder:me.border,handleToggleBorderRadius:me.borderRadius,handleToggleBoxShadow:me.boxShadow,handleToggleMobileSize:me.mobileSize,handleToggleMobileBackground:me.mobileBackground,handleToggleMobileBorder:me.mobileBorder,handleToggleMobileBorderRadius:me.mobileBorderRadius,handleToggleMobileBoxShadow:me.mobileBoxShadow,paddingShow:te.padding,paddingsExt:E.paddingsExt,backgroundShow:te.background,bordersShow:te.border,borderRadiusShow:te.borderRadius,boxShadowShow:te.boxShadow,mobileSizeShow:te.mobileSize,mobileBackgroundShow:te.mobileBackground,mobileBordersShow:te.mobileBorder,mobileBorderRadiusShow:te.mobileBorderRadius,mobileBoxShadowShow:te.mobileBoxShadow,oneBorderRadiusValue:E.oneBorderRadiusValue,setOneBorderRadiusValue:E.setOneBorderRadiusValue,oneMobileBorderRadiusValue:E.oneMobileBorderRadiusValue,setOneMobileBorderRadiusValue:E.setOneMobileBorderRadiusValue,backgroundImageEmpty:x,backgroundRepeatOptions:P,backgroundSizeOptions:z,mobileBorders:B,elementViewType:m,mobileViewActive:g})," "]})};ds.propTypes={elementSettings:f.default.object.isRequired,formName:f.default.string};var pt=({className:e=null,formSettings:i,emailElementType:l,formName:s})=>{const n=r.useDispatch(),d=r.useSendStyleToggleToIframe(),c=(0,a.useRef)(),m=r.useSelector(r.selectActiveSettingsTab),g=r.useSelector(r.selectElementSettings$1),b=r.useSelector(r.selectElementSettings),_=r.useContainer(),h=r.getComponentRegistry(_),p=l==="email"?g:b,B=p.type,k=B===r.ELEMENT_TYPES.CAROUSEL||B===r.ELEMENT_TYPES.IMG?i.settings:p,[x,R]=(0,a.useState)(k),[j,N]=(0,a.useState)(k);k!==j&&(N(k),R(k));const E=$=>{const U=$.data.operation,v=$.data.action;if(U===r.EVENT_TYPES.APPLICATION_ACTION){let P=function(z,le=null){const C={[z]:le||!x[z]};d(C,x.type),n(r.setEmailSettings(C)),R(re=>({...re,...C}))};var L=P;v==="toggle_strong"&&P("textStrong"),v==="toggle_italic"&&P("textItalic"),v==="toggle_underline"&&P("textUnderline"),v==="toggle_strikethrough"&&P("textStrikethrough"),v==="textAlign_left"&&P("textAlign","left"),v==="textAlign_right"&&P("textAlign","right"),v==="textAlign_center"&&P("textAlign","center")}};r.useListenPostMessage(E);const I=p;return(0,o.jsx)("div",{className:"selected-element-panel",children:(0,o.jsx)(r.CSSTransition,{nodeRef:c,in:m===r.PROPERTIES,timeout:300,classNames:"transition",children:(0,o.jsxs)("div",{ref:c,className:(0,ze.default)("selected-element-panel-content",{[e]:e}),children:[i?.type==="advanced"&&i?.content?(0,o.jsx)(a.Fragment,{children:h.getReactElement(i.content)},i.instanceKey):null,(p.type===r.ELEMENT_TYPES.IMG||p.type===r.ELEMENT_TYPES.COUNTDOWN||p.type===r.ELEMENT_TYPES.VIDEO)&&(0,o.jsx)(zr,{elementSettings:p}),p.type===r.ELEMENT_TYPES.TEXT&&(0,o.jsx)(yn,{elementSettings:p}),p.type===r.ELEMENT_TYPES.LINK&&(0,o.jsx)(nl,{elementSettings:p}),p.type===r.ELEMENT_TYPES.TABLE&&(0,o.jsx)(al,{elementSettings:p}),p.type===r.ELEMENT_TYPES.CUSTOM_TABLE&&(0,o.jsx)(ds,{elementSettings:I,formName:s},I.customTable.tableKey),(p.type===r.ELEMENT_TYPES.TD||p.type===r.ELEMENT_TYPES.STRUCTURE||p.type===r.ELEMENT_TYPES.GROUP||p.type===r.ELEMENT_TYPES.COLUMN)&&(0,o.jsx)(hl,{elementSettings:p}),p.type===r.ELEMENT_TYPES.VAR&&(0,o.jsx)(Tl,{elementSettings:p}),p.type===r.ELEMENT_TYPES.BUTTON&&(0,o.jsx)(Sl,{elementSettings:p}),p.type===r.ELEMENT_TYPES.DIV&&(0,o.jsx)(fl,{elementSettings:p}),p.type===r.ELEMENT_TYPES.VINDENT&&(0,o.jsx)(ul,{elementSettings:p}),p.type===r.ELEMENT_TYPES.FLOAT_BLOCK&&(0,o.jsx)(kl,{elementSettings:p}),i.type===r.ELEMENT_TYPES.CAROUSEL&&(0,o.jsx)(Il,{elementSettings:i}),i.type===r.ELEMENT_TYPES.ACCORDION&&(0,o.jsx)(vl,{elementSettings:i}),i.type===r.ELEMENT_TYPES.SOCIAL&&(0,o.jsx)($l,{elementSettings:i})]})})})};pt.propTypes={className:f.default.string,formName:f.default.string};function Xo(){return!!document.querySelector(".selected-element-panel__columns-settings__links__add")?.closest(".selected-element-panel")}var cs=({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(),m=(0,a.useRef)(),g=(0,a.useRef)(),b=r.useSelector(r.selectElementSettings$1),_=r.useSelector(r.selectElementSettings),h=r.useAppConfig(),p=l||(e==="email"?b:_),[B,k]=(0,a.useState)(p.floatBlocks?.wrap),[x,R]=(0,a.useState)(p.floatBlocks?.dirRevers),[j,N]=(0,a.useState)(null),[E,I]=(0,a.useState)(0),[$,U]=(0,a.useState)([]),v=r.useSelector(r.selectEmailViewType),L=(0,a.useCallback)(ve=>{n(e==="email"?r.setElementSettings$1(ve):r.setElementSettings(ve))},[n,e]);(0,a.useEffect)(()=>{if(p&&JSON.stringify(p)!=="{}"&&c._init){if(c.resetFields(),c.setFieldsValue({gap:p.floatBlocks?.gap,gapMobile:p.floatBlocks?.gapMobile,gapDim:"px",valign:p.floatBlocks?.valign}),p.floatBlocks?.items.length>0){let Z=function(K,q){if(K.length!==q.length)return!1;for(let Q=0;Q<K.length;Q++)if(K[Q]!==q[Q])return!1;return!0};var ve=Z;const he=p.floatBlocks.items.reduce((K,q)=>K+q.width,0),be=p.floatBlocks.items.map(K=>((K.width||0)/he*100).toFixed(1));I(he),!Z(be,$)&&p.changeKey!=="gap"&&U(be),p.floatBlocks.items.forEach((K,q)=>c.setFieldsValue({["width-"+q]:K.width||0})),p.floatBlocks.items.length>=8?document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.add("noactive"):document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.contains("noactive")&&document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.remove("noactive")}k(p.floatBlocks?.wrap)}},[c,p,j,$]);let P=0;p.floatBlocks?.items.length>0&&(P=p.floatBlocks.items.length);const z=(ve,he)=>{Object.keys(he).forEach(be=>{if(be.includes("width")){const Z=parseInt(be.match(/\d+/));c.setFieldsValue({[be]:ve.items[Z]})}})},[le,C]=(0,a.useState)(!1);(0,a.useEffect)(()=>{const ve=()=>C(!0),he=()=>C(!1);return document.addEventListener("keyup",he),document.addEventListener("keydown",ve),()=>{document.removeEventListener("keyup",he),document.removeEventListener("keydown",ve)}},[]);const re=ve=>{g.current&&le&&clearTimeout(g.current),g.current=setTimeout(()=>he(ve),50);function he(be){const Z=c.getFieldsValue(!0),K=Object.keys(be)[0];if(N(K),K.includes("width")){if(Z[K]&&Z[K]>=30){let q={items:[],gap:Z.gap,valign:Z.valign,activateSection:i?void 0:"structure"},Q=0;if(document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").length>1){Q=parseFloat(Object.keys(be)[0].substring(Object.keys(be)[0].length-1));const V=Z["width-"+(Q+1)]?Q+1:0;let M=E;Object.keys(Z).forEach(Y=>{Y.includes("width")&&Y.indexOf("width-"+V)===-1&&(M-=Z[Y])}),Z["width-"+V]=M}Object.keys(Z).forEach(V=>{V.includes("width")&&q.items.push(Z[V])}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:q}),L({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...q,items:p.floatBlocks.items.map((V,M)=>({...p.floatBlocks.items[M],width:q.items[M]}))},changeKey:K})}}else if(K==="gap"){const q={items:p.floatBlocks.items.map(Y=>Y.width),gap:p.floatBlocks.gap},Q=q.items.reduce((Y,X)=>Y+X,0)+(q.items.length-1)*q.gap,V=Z.gap,M=Q-(q.items.length-1)*V;if(M>q.items.length*30||p.floatBlocks.gap-be>=0){const Y=(Be,Ee)=>Math.round(Ee*Be/100);let X=q.items.map((Be,Ee)=>Y($[Ee],M));const ee=Q-(X.reduce((Be,Ee)=>Be+Ee,0)+(q.items.length-1)*V);if(ee!==0){const Be=X.length-Math.abs(ee);X=X.map((Ee,oe)=>Be<=oe?Ee+(ee>0?1:-1):Ee)}let ne={items:X,gap:V||0};z(ne,Z),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGap",settings:ne,editFromStructure:Xo()}),L({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...ne,items:p.floatBlocks.items.map((Be,Ee)=>({...Be,width:ne.items[Ee]}))},changeKey:K})}}else if(K==="valign"){let q={valign:Z.valign};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksValign",settings:q,editFromStructure:Xo()}),L({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...q},changeKey:K})}else if(K==="gapMobile"){let q={mobileHeight:{classNamePrefix:"em-mob-height-",value:be[K],dim:"px"}};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGapMobile",settings:q}),L({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,gapMobile:q.mobileHeight.value},changeKey:K})}setTimeout(()=>m?.current&&m.current.focus({cursor:"end"}),600)}},ae=()=>{const ve=c.getFieldsValue(!0),he=p.floatBlocks.items.map(M=>M.width);let be={items:[],gap:ve.gap};const Z=he.reduce((M,Y)=>M+Y,0),K=he.length,q=Math.ceil(E/K)*K,Q=q/K,V=Z-q;if(be.items=Array(K).fill(Q),V!==0){const M=he.length-Math.abs(V);be.items=be.items.map((Y,X)=>M<=X?Y+(V>0?1:-1):Y)}z(be,ve),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:be,editFromStructure:Xo()}),L({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...be,items:p.floatBlocks.items.map((M,Y)=>({...M,width:be.items[Y]}))},changeKey:"width"})},_e=ve=>{const he=c.getFieldsValue(!0),be=p.floatBlocks.items.map(ne=>ne.width),Z=p.floatBlocks.gap||20,K=ve.cols-be.length;let q=[],Q=be.reduce((ne,Be)=>ne+Be,0);ve.cols>=be.length?Q-=Z*K:Q+=Z*Math.abs(K);const V=Math.round(Q/ve.cols);function M(ne,Be){const Ee=[];for(let oe=0;oe<ne;oe++)Ee.push(ve.width?.[oe]?Math.round(Q/100*ve.width?.[oe]):Be);return Ee}q=M(ve.cols,V);const Y=Q-q.reduce((ne,Be)=>ne+Be,0);if(Y!==0){let ne=q.map((Ee,oe)=>[oe,Ee]).filter(Ee=>Ee[1]>30);const Be=ne.length-Math.abs(Y);ne=ne.map((Ee,oe)=>{const D=Be<=oe?Ee[1]+(Y>0?1:-1):Ee[1];return[Ee[0],D]}),ne.map(Ee=>(q[Ee[0]]=Ee[1],Ee))}let X={items:q,gap:he.gap||20};const ee=q.reduce((ne,Be)=>ne+Be,0);U(q.map(ne=>(ne/ee*100).toFixed(1))),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksPreset",settings:X,editFromStructure:Xo()}),L({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...X,items:X.items.map((ne,Be)=>({width:ne,current:!1}))},changeKey:"width"})},Te=()=>{const ve=c.getFieldsValue(!0);if(P<8){const he=p.floatBlocks.items.map(M=>M.width),be=p.floatBlocks.gap,Z=he.reduce((M,Y)=>M+(Y>30?Y:0),0),K=(Z-30-be)/Z,q=he.map(M=>M>30?Math.round(M*K):M).reduce((M,Y)=>M+(Y>30?Y:0),0);let Q=he.map(M=>M>30?Math.round(M*K):M);Q.push(30);const V=Z-q-30-be;if(V!==0){let M=Q.map((X,ee)=>[ee,X]).filter(X=>X[1]>30);const Y=M.length-Math.abs(V);M=M.map((X,ee)=>{const ne=Y<=ee?X[1]+(V>0?1:-1):X[1];return[X[0],ne]}),M.map(X=>(Q[X[0]]=X[1],X))}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_ADD,settings:{gap:ve.gap,gapMobile:ve.gapMobile,minWidth:30},editFromStructure:Xo()}),L({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,items:Q.map((M,Y)=>({width:M,current:p.floatBlocks.items[Y]?.current||!1}))},changeKey:"width"})}else document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.add("noactive")},te=ve=>{const he=c.getFieldsValue(!0);let be=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((ne,Be)=>{ne===ve.target.closest(".selected-element-panel__columns-settings__controls__column")&&(be=Be)});const Z=+p.floatBlocks.gap,K=+p.floatBlocks.items[be].width+Z,q=p.floatBlocks.items.map(ne=>+ne.width),Q=(q.length-1)*Z,V=q.reduce((ne,Be)=>ne+Be,0)+Q,M=q.length-1,Y=Math.floor(K/M);let X=q.filter((ne,Be)=>Be!==be).map(ne=>ne+Y);const ee=V-(X.reduce((ne,Be)=>ne+Be,0)+(q.length-2)*Z);if(ee!==0){const ne=X.length-Math.abs(ee);X=X.map((Be,Ee)=>ne<=Ee?Be+(ee>0?1:-1):Be)}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_REMOVE,settings:{removedBlockIndex:be,gap:he.gap},editFromStructure:Xo()}),L({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,items:X.map((ne,Be)=>({width:ne,current:p.floatBlocks.items.filter((Ee,oe)=>oe!==be)[Be].current}))},changeKey:"width"})},me=ve=>{if(P>=8)return;const he=c.getFieldsValue(!0);let be=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((Ee,oe)=>{Ee===ve.target.closest(".selected-element-panel__columns-settings__controls__column")&&(be=oe)});const Z=parseFloat(he.gap)||0,K=p.floatBlocks.items.map(Ee=>+Ee.width),q=K[be],Q=K.reduce((Ee,oe)=>Ee+oe,0),V=Q-Z,M=Q+q,Y=M>0?V/M:1;let X=[];const ee=[];K.forEach((Ee,oe)=>{X.push(Math.max(30,Math.round(Ee*Y))),ee.push(p.floatBlocks.items[oe]?.current||!1),oe===be&&(X.push(Math.max(30,Math.round(q*Y))),ee.push(!1))});const ne=V-X.reduce((Ee,oe)=>Ee+oe,0);if(ne!==0){let Ee=X.map((D,ie)=>[ie,D]).filter(D=>D[1]>30);const oe=Ee.length-Math.abs(ne);Ee=Ee.map((D,ie)=>[D[0],oe<=ie?D[1]+(ne>0?1:-1):D[1]]),Ee.forEach(D=>X[D[0]]=D[1])}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_COPY,settings:{copiedBlockIndex:be,gap:he.gap,widths:X},editFromStructure:Xo()});const Be=X.reduce((Ee,oe)=>Ee+oe,0);U(X.map(Ee=>(Ee/Be*100).toFixed(1))),L({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,items:X.map((Ee,oe)=>({width:Ee,current:ee[oe]||!1}))},changeKey:"width"})},je=(0,a.useCallback)(ve=>{const he=".selected-element-panel__columns-settings__controls__column",be=Array.from(document.querySelectorAll(he)).indexOf(ve.target.closest(he)),Z=be-1;if(Z<0)return;const K=p.floatBlocks,q=K.items.map(({width:Q,current:V})=>({width:Q,current:V||!1}));[q[Z],q[be]]=[q[be],q[Z]],d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_SWAP,settings:{indexA:Z,indexB:be},editFromStructure:Xo()}),L({...p,activateSection:i?void 0:"structure",floatBlocks:{...K,items:q},changeKey:"width"})},[p,L,i,d]),ue=ve=>{k(ve),d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_WRAP,settings:{wrap:!B}}),L({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,wrap:!B},changeKey:"wrap"})},Ve=ve=>{R(ve),d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_DIR,settings:{dirRevert:!x}}),L({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,dirRevert:!x},changeKey:"dir"})},Le=()=>setTimeout(()=>m?.current&&m.current.focus({cursor:"end"}),300);return p.floatBlocks&&p.floatBlocks.items.length>0&&(0,o.jsx)(t.ui_kit$Form,{layout:"vertical",form:c,name:"float_blocks_settings_form",autoComplete:"off",initialValues:{gap:p.floatBlocks?.gap||0,gapDim:"px",gapMobile:p.floatBlocks?.gapMobile||0,valign:p.floatBlocks?.valign||"top",...p.floatBlocks?.items.reduce((ve,{width:he},be)=>(ve[`width-${be}`]=he,ve),{})},onValuesChange:re,onFieldsChange:Le,className:"element-controls",children:(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings",style:{paddingTop:h.switchDesktopMobilePropsEnabled||h.stepToOtherElementEnabled||h.deleteButtonEnabled||p.type==="structure"?0:24},children:[p.floatBlocks.items.length===1&&(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:10},title:s('The selected element is in the block that supports a multicolumn structure. To add a new column, click the "Add a column" button.'),type:"info"}),v!=="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:Te,children:[(0,o.jsx)(r.EmIcons,{icon:"PlusCircleOutlined",component:t.icons$PlusCircleOutlined,size:16,strokeWidth:h.iconStrokeWidth})," ",s("Add column")]}),p.floatBlocks.items.length>1&&(0,o.jsx)("span",{onClick:ae,children:(0,o.jsxs)(t.ui_kit$Tooltip,{title:s("Make columns the same width."),children:[(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined})," ",s("Equalize")]})})]})]}),p.floatBlocks.items.length>1&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:16},children:(0,o.jsx)("div",{className:"selected-element-panel__columns-settings__controls",children:p.floatBlocks.items.map((ve,he)=>(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__controls__column "+(ve.current?"current":""),style:{width:ve.width/E*100+"%"},children:[he>0&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Swap columns"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__swap",onClick:je,children:(0,o.jsx)(r.EmIcons,{icon:"SwapHorizontalIcon",component:t.icons$SwapHorizontalIcon,size:15,strokeWidth:h.iconStrokeWidth})})}),p.floatBlocks.items.length>1&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Delete column"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__remove",onClick:te,children:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:15,strokeWidth:h.iconStrokeWidth,style:{color:"#ff4d4f"}})})}),p.floatBlocks.items.length<8&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Copy column"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__copy",onClick:me,children:(0,o.jsx)(r.EmIcons,{icon:"CopyOutlined",component:t.icons$CopyOutlined,size:15,strokeWidth:h.iconStrokeWidth})})}),(0,o.jsx)("div",{className:"selected-element-panel__columns-settings__controls__field",children:(0,o.jsx)(t.ui_kit$Form.Item,{label:"",name:"width-"+he,children:(0,o.jsx)(t.ui_kit$InputNumber,{min:30,value:ve.width||0,placeholder:s("Width"),ref:j==="width-"+he&&m})})})]},"floatblock-"+he))})}),(0,o.jsxs)("div",{className:"columns-presets",children:[(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{_e({cols:1})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol1",component:t.icons$LayoutCol1})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{_e({cols:2})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol2",component:t.icons$LayoutCol2})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{_e({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:()=>{_e({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:()=>{_e({cols:3})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol3",component:t.icons$LayoutCol3})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{_e({cols:4})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol4",component:t.icons$LayoutCol4})})]})]}),p.floatBlocks.items.length>1&&(0,o.jsxs)(o.Fragment,{children:[v==="mobile"&&(0,o.jsx)("div",{style:{marginBottom:24},children:(0,o.jsx)(t.ui_kit$Switch,{id:"column-wrap",label:s("Line break on mobile devices"),size:"small",disabled:p.floatBlocks?.wrap===void 0,checked:B,onChange:ue,labelStyle:{position:"relative",top:2}})}),v!=="mobile"&&(0,o.jsx)("div",{style:{marginBottom:24},children:(0,o.jsx)(t.ui_kit$Switch,{id:"column-dir-revers",label:s("Reverse order on desktop"),size:"small",disabled:p.floatBlocks?.wrap===void 0,checked:x,onChange:Ve,labelStyle:{position:"relative",top:2}})})]}),p.floatBlocks.items.length>1&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:s("Vertical alignment"),titleStyle:{paddingTop:20},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"valign",style:{marginBottom:0},children:(0,o.jsx)(t.ui_kit$FormVerticalAlignControl,{disabled:p.floatBlocks.items.length<=1,strokeWidth:h.iconStrokeWidth,labels:{alignTop:s("Align top"),alignMiddle:s("Center vertically"),alignBottom:s("Align bottom")}})})})}),(0,o.jsxs)(o.Fragment,{children:[v!=="mobile"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:s("Indent between columns"),titleStyle:{paddingTop:20},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gap",style:{marginBottom:20},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,disabled:p.floatBlocks.items.length<=1,placeholder:s("Indent between columns"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px",ref:j==="gap"&&m})})})}),v==="mobile"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:s("Indent in mobile"),titleStyle:{paddingTop:20},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gapMobile",style:{marginBottom:20},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,disabled:p.floatBlocks.items.length<=1,placeholder:s("Indent in mobile"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})})]})]})]})]})})};cs.propTypes={selectedElement:f.default.shape({parent:f.default.string})};var tc=()=>{},us=({email:e,formSettings:i={},onClosePanel:l=tc})=>{const{__:s}=r.useI18n(),n=r.useRootElement(),d=r.useDispatch(),c=r.useSendPostMessage(),m=Object.prototype.hasOwnProperty.call(e,"type")?r.BLOCK:r.EMAIL,g=r.useSelector(r.selectElementSettings$1),b=r.useSelector(r.selectElementSettings),_=r.useSelector(r.selectPropertiesPanelKey),h=m==="email"?g:b,p=Object.keys(i).length>0?i.settings:h,B=i?.type==="advanced"&&!!i?.content,k=!!i?.extraTabs?.length,x=r.useAppConfig(),R=p.type==="customTable",j=r.useInspectorTabs(p.type||i.type,R),N=(0,a.useCallback)(ae=>{j.activate(ae),d(r.setPropertiesPanelKey(ae||""))},[j,d]),E=!!p.type&&!!p.floatBlocks?.items.length>0&&!!p.floatBlocks?.items.filter(ae=>!!ae.width).length>0,I=(0,a.useRef)(null),$=(0,a.useRef)(_);$.current=_,(0,a.useEffect)(()=>{const ae=Object.values(r.ELEMENT_TYPES),_e=p.type&&ae.includes(p.type)?`${p.type}-${JSON.stringify(p.path||[])}`:null;if(B||k){const Te=n.querySelector(".email-pane .panel-form__body");Te&&(Te.scrollTop=0),d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else if(p.type&&ae.includes(p.type)){const Te=I.current!==_e;if(I.current=_e,p.activateSection!=="structure"){if(Te){const te=n.querySelector(".email-pane .panel-form__body");te&&(te.scrollTop=0)}r.keepsInspectorTab(String($.current??""),Te)||d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else d(r.setPropertiesPanelKey(r.STRUCTURE))}else JSON.stringify(p)!=="{}"&&(I.current=null,d(r.setPropertiesPanelKey("")))},[p,d,n,B,k]);const U=(0,a.useMemo)(()=>{const ae=[{key:r.EDIT_SELECTED_ELEMENT,label:(0,o.jsx)("span",{style:{textTransform:"capitalize"},children:p.caption?p.caption:s("Edit element")})}];return E&&ae.push({key:r.STRUCTURE,label:s("Columns")}),ae},[p.caption,E,s]),v=(0,a.useMemo)(()=>[...U,...j.tabs.map(({key:ae,label:_e})=>({key:ae,label:_e}))],[U,j.tabs]),L=(0,a.useMemo)(()=>[{key:r.EDIT_SELECTED_ELEMENT,label:s("Cell")},{key:r.TABLE_PROPERTIES,label:s("Table")}],[s]),P=ae=>{ae.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_REMOVE}),d(m==="email"?r.setElementSettings$1({}):r.setElementSettings({}))},z=ae=>{ae.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_PARENT_GET})},le=()=>{l(p),d(r.resetToLastActiveSettingsTab()),setTimeout(()=>{d(m==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET})},C=(0,o.jsxs)(o.Fragment,{children:[x.deleteButtonEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Remove element by Delete Key"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{type:"text",onClick:P,disabled:!p.deletable,icon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:18,strokeWidth:x.iconStrokeWidth})})}),x.stepToOtherElementEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Up to parent element"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{type:"text",onClick:z,disabled:!p.parent,icon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"GoToParent",component:t.icons$GoToParent,size:18,strokeWidth:x.iconStrokeWidth})})})]}),re=x.switchDesktopMobilePropsEnabled||x.stepToOtherElementEnabled||x.deleteButtonEnabled;return(0,o.jsxs)(t.ui_kit$PanelForm,{children:[(0,o.jsx)(t.ui_kit$PanelForm.Header,{onClose:le,closeIcon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"Close",component:t.icons$Close,size:24,strokeWidth:x.iconStrokeWidth}),extra:re?C:void 0,children:(0,o.jsx)(t.ui_kit$Tabs,{items:R?L:v,activeKey:_,onChange:N})}),(0,o.jsx)(t.ui_kit$PanelForm.Body,{children:R?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{display:_==="Edit selected element"?void 0:"none"},children:(0,o.jsx)(pt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:m,formName:`${r.EDIT_SELECTED_TABLE_CELLS}`})}),(0,o.jsx)("div",{style:{display:_==="Table properties"?void 0:"none"},children:(0,o.jsx)(pt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:m,formName:`${r.TABLE_PROPERTIES}`})})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{display:_==="Edit selected element"?void 0:"none"},children:(0,o.jsx)(pt,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:m})}),E&&(0,o.jsx)("div",{style:{display:_==="Structure"?void 0:"none"},children:(0,o.jsx)(cs,{selectedElement:p,emailElementType:m,isSelectedElement:!1})}),j.tabs.map(ae=>(0,o.jsx)("div",{className:ae.className,hidden:_!==ae.key,children:ae.children},ae.key))]})})]})},ic=({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,m=r.useNotification(),g=r.useProjectData(),b=(0,a.useCallback)(()=>{n.resetFields(),setTimeout(()=>d.current?.focus({cursor:"start"}),0)},[n]);(0,a.useEffect)(()=>{c&&b()},[c,b]);const _=()=>s(r.closeModal$1()),[h,p]=r.useAddTermMutation(),[B,k]=(0,a.useState)(!1),x=()=>{n.validateFields().then(({name:R})=>(k(!0),h({project:g,kind:"group",name:R}).then(j=>{if("error"in j){m.error(j);return}m.success({title:i("The group “")+j.data.name+l("” was successfully created.",e)}),_()}))).catch(R=>{}).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:p.isLoading||B,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:p.isLoading,size:"large",placeholder:i("Enter the group name"),ref:d,style:{marginBottom:5}})})})})},rc=({group:e,refetch:i})=>{const{__:l,_x:s}=r.useI18n(),n=r.useDispatch(),[d]=t.ui_kit$Form.useForm(),c=(0,a.useRef)(null),m=r.useSelector(r.selectActiveModal$1)===r.MODALS.EDIT_GROUP_NAME_MODAL,g=r.useNotification(),{id:b=null,name:_=""}=e,h=()=>n(r.closeModal$1()),[p,B]=r.useEditTermMutation();(0,a.useEffect)(()=>{m&&d.setFieldsValue({name:_})},[m,_,d]);const k=()=>{d.validateFields().then(({name:x})=>{p({kind:"group",id:b,name:x}).then(({data:R,error:j})=>{j?(g.error({error:j}),d.setFieldValue("name",x)):(i().then(({data:N})=>{if(N){const E=N[0]?.children?.find(I=>I.id===b)?.name;d.setFieldValue("name",E)}}),h(),g.success({title:l("The group “")+x+s("” was successfully changed to “","group")+R.name+l("”.")}))})})};return(0,o.jsx)(t.ui_kit$Modal,{title:l("Change group name"),open:m,onOk:k,onCancel:h,className:"new-group-name-modal",footer:[(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"large",loading:B.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:B.isLoading,size:"large",placeholder:l("Enter the group name"),ref:c,style:{marginBottom:5}})})})})},Di={width:"100%"},lc=["hover"],sc={color:"#ff4d4f"},ac={color:t.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0},nc=({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:sc,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:lc,children:(0,o.jsx)("span",{className:"groups-management__actions",children:(0,o.jsx)(r.EmIcons,{icon:"MoreOutlined",component:t.icons$MoreOutlined})})})})},dc=({className:e,levels:i,readOnlyLevels:l=!1,levelsRead:s=!1,refetchProjectGroups:n,isLoading:d})=>{const{__:c,_x:m}=r.useI18n(),g=r.useDispatch(),b=r.useNotification(),{modal:_}=t.ui_kit$App.useApp(),{confirm:h}=_,{token:p}=(0,t.ui_kit$useToken)(),B=r.useSelector(r.selectProjectGroups),k=i??B,[x]=r.useDeleteTermMutation(),[R,j]=(0,a.useState)({id:null,name:""}),N=(0,a.useCallback)((v,L)=>{x({kind:"group",id:Number(v)}).unwrap().then(P=>{P?.deleted&&b.success({title:c("The group “")+L+m("” was successfully deleted.","recovery")})}).catch(P=>{b.error({error:P})})},[x,b,c,m]),E=(0,a.useCallback)(v=>{const L=v.name??"";h({mask:{closable:!0},centered:!0,title:m("Are you sure to delete “","group")+L+c("” group and all nested groups?"),icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:22,style:ac}),okText:c("Yes"),cancelText:c("No"),onOk:()=>N(String(v.id),L)})},[h,N,c,m]),I=(0,a.useCallback)(v=>{g(r.openModal$1(r.MODALS.EDIT_GROUP_NAME_MODAL)),j({id:v.id,name:v.name??""})},[g]),$=(0,a.useMemo)(()=>({marginBottom:p.formItemMarginBottomMD}),[p]),U=(0,a.useCallback)(()=>{g(r.openModal$1(r.MODALS.ADD_NEW_GROUP_MODAL))},[g]);return(0,o.jsxs)("div",{className:(0,ze.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((v,L)=>(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:`group_${v.id}`,style:{marginBottom:p.formItemMarginBottomMD},label:(0,o.jsxs)(t.ui_kit$Flex,{justify:"space-between",align:"center",style:Di,children:[(0,o.jsx)("span",{children:v.name}),!l&&(0,o.jsx)(nc,{level:v,onRename:I,onRemove:E})]}),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:Di,placeholder:c(l?"Select a category":"Type category here"),options:v.children?.map(P=>({label:P.name,value:String(P.id)})),tagRender:P=>{const{label:z,closable:le,onClose:C}=P,re=ae=>{ae.preventDefault(),ae.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:p.colorPrimary,onMouseDown:re,closable:le,onClose:C,style:{borderRadius:6},children:z})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})},v.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:$,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:$,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:Di,onClick:U,children:c("Add group")})})})]}),(0,o.jsx)(ic,{taxonomy:r.ELEMENT_TYPES.GROUP}),(0,o.jsx)(rc,{group:R,refetch:n})]})};function cc(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:Vi,description:ti,tags:ii,type:Hi,is_template:uc,group:ms}={title:"title",description:"description",tags:"tags",type:"type",is_template:"is_template",group:"group"},mc={[Vi]:"",[ti]:"",[ii]:[],[uc]:!1},pc={[ti]:"",[ii]:[],[Hi]:""};function hc(e){const i=new Set;return e?.filter(l=>i.has(l.name)?!1:(i.add(l.name),!0))}var bc=e=>Array.isArray(e)&&e.length>0,ps=({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)(),m=r.useAppConfig(),g=r.useEditorLocked(),b=r.useEditorLockCheck(),_=r.useSelector(r.selectProjectGroups),{data:h}=r.useGetBlockTypesQuery(),p=r.useProjectData(),B=i.hasOwnProperty("type")?r.BLOCK:r.EMAIL,k=i.hasOwnProperty("type")?r.BLOCK_TAGS:r.EMAIL_TAGS,{emailsOnV2:x,projectSections:R,projectSectionsLoading:j}=cc(p?.id),{data:N,refetch:E,isLoading:I,isFetching:$,isUninitialized:U,isSuccess:v}=r.useGetTermsQuery({project:p,kind:"group"},{skip:x||!p?.id}),L=(0,a.useMemo)(()=>x?R??[]:_,[x,R,_]);(0,a.useEffect)(()=>{N&&s(r.projectGroupsLoaded(N,B==="email"?i.group??[]:void 0))},[s,N,B,i.group]),(0,a.useEffect)(()=>{!U&&E()},[U,E]),(0,a.useEffect)(()=>{if(!x||!i.is_template)return;const Z=new Set(i.projectCategories??[]),K={};let q=!1;for(const Q of R??[]){const V=`group_${Q.id}`,M=(Q.children??[]).filter(X=>Z.has(String(X.id))).map(X=>String(X.id)),Y=d.getFieldValue(V);(!Y||Y.length!==M.length||M.some((X,ee)=>Y[ee]!==X))&&(q=!0),K[V]=M}q&&d.setFieldsValue(K)},[d,x,i.is_template,i.projectCategories,R]);const[P,z]=(0,a.useState)([]),[le,C]=(0,a.useState)([]),[re,ae]=(0,a.useState)(i.is_template||!1),_e=r.useProjectData();(0,a.useEffect)(()=>{!U&&E()},[i.group,E,U]),(0,a.useEffect)(()=>{if(v&&i.is_template&&bc(i.group)){const Z=i.group;let K={};Z.length&&_.length&&Z?.forEach(Q=>{_?.forEach(V=>{let M=V.children.find(Y=>Y.id===Q);M&&(K.hasOwnProperty(V.id)||(K[V.id]=[]),K[V.id].push({label:M.name,value:M.id}))})});let q={};for(let Q in K)K.hasOwnProperty(+Q)&&(q[`group_${Q}`]=K[Q].map(V=>({...V,value:String(V.value)})));d.setFieldsValue(q)}},[d,_,i.is_template,i.group,v]);const{data:Te,isFetching:te,refetch:me}=r.useGetTermsQuery({project:_e,kind:k},{skip:!_e?.id});(0,a.useEffect)(()=>{C(hc(Te)?.map(Z=>({value:Z.name,key:Z.id})))},[Te]),(0,a.useEffect)(()=>{if(i){const Z=r.getTaxonomy(i,k)??[],K=Te??[],q=Z.map(M=>M.name??""),Q=i.emailtags||i.blocktags||[],V=Z.concat(K).filter(M=>Q.some(Y=>r.sameTermId(M.id,Y))).map(M=>M.name??"");d.setFieldsValue({title:i.title,description:i.description,tags:Array.isArray(i.tags)?i.tags:V.length?Array.from(new Set(V)):q,type:i.type})}},[d,i,k,Te]);const je=(0,a.useMemo)(()=>{if(!(B==="email"?x:r.isBlocksV2Enabled())||!i)return[];const Z=r.getTaxonomy(i,k)??[],K=Te??[],q=[...Z,...K];return((B==="email"?i.emailtags:i.blocktags)??[]).filter(Q=>!q.some(V=>V.name&&r.sameTermId(V.id,Q)))},[x,B,i,k,Te]),[ue,Ve]=(0,a.useState)(void 0),Le=!Array.isArray(i?.tags);(0,a.useEffect)(()=>{Le&&je.length&&_e?.id&&!te&&ue!==i?.id&&(Ve(i?.id),me())},[Le,je.length,_e?.id,te,ue,i?.id,me]);const ve=Le&&je.length>0&&(Te===void 0||te||ue!==i?.id),he=Z=>{if(b())return;const K=Object.keys(Z)[0],q=Z,Q=K.split("_")[0];if(Q===Vi)n({title:q[K]});else if(Q===ti)n({description:q[K]});else if(Q===ii){const V=q[K],M=B==="email"&&(V?.length??0)===0;n({tags:(V??[]).map(Y=>Y.trim()),...M?{emailtags:[]}:{}})}else Q==="is"&&B==="email"?n({is_template:q[K]}):Q===Hi&&B==="block"&&n({type:q[K]});switch(K.split("_")[0]){case ms:if(x){const V=new Set((R??[]).flatMap(ee=>(ee.children??[]).map(ne=>String(ne.id)))),M=d.getFieldsValue(!0),Y=Object.keys(M).filter(ee=>ee.startsWith(`${ms}_`)).flatMap(ee=>M[ee]??[]).map(String).filter(ee=>V.has(ee)),X=(i.projectCategories??[]).map(String).filter(ee=>!V.has(ee));n({projectCategories:[...new Set([...X,...Y])]});break}s(r.setEmailGroups({[K.split("_")[1]]:Z[K]}));break;default:return}};(0,a.useEffect)(()=>{if(h){const Z=h;let K=[];const q={Applications:l("Apps"),Articles:l("Article"),Banners:l("Banners"),Buttons:l("Buttons"),"Call to Action":l("Call to Action"),Contacts:l("Contacts"),Content:l("Content"),"E-Commerce":l("E-Commerce"),Feature:l("Features"),Footer:l("Footers"),Header:l("Headers"),Lists:l("Lists"),Menu:l("Menus"),Other:l("Others"),Polls:l("Polls"),Promocodes:l("Promocodes"),Separators:l("Separators"),Transactional:l("Transactional")};for(let Q in Z)K.push({label:q[Z[Q]],value:Z[Q]});z(K)}},[h,l]);const be=Z=>{ae(Z)};return(0,o.jsx)("div",{className:(0,ze.default)("settings-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"settings_panel_form",initialValues:B==="email"?{EmailInitialValues:mc}:pc,onValuesChange:he,autoComplete:"off",disabled:g,children:[m.subjectEnabled&&B==="email"&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Title"),name:Vi,tooltip:{title:l("The title of the email is displayed in the list of the templates and usually matches the subject line, but you can change it."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$TextArea,{placeholder:l("Type title here"),autoSize:{minRows:1}})}),m.descriptionEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Description"),name:ti,tooltip:{title:l("Description is used in other sections of the service."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$TextArea,{placeholder:l("Type your description here"),autoSize:{minRows:2}})}),m.tagsEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Tags"),name:ii,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:le,disabled:ve||g,loading:ve,tagRender:Z=>{const{label:K,closable:q,onClose:Q}=Z,V=M=>{M.preventDefault(),M.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:c.colorPrimary,onMouseDown:V,closable:q,onClose:Q,style:{borderRadius:6},children:K})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})}),B==="email"&&m.isTemplateEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:16}}),(0,o.jsx)(t.ui_kit$Tooltip,{title:i.isNew?l("Save email first."):l("Use this email as a template for creating future emails."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"is_template",valuePropName:"checked",initialValue:re,children:(0,o.jsx)(t.ui_kit$Switch,{id:"setIsTemplate",label:l("Is a template"),size:"small",onChange:be,disabled:!!i.isNew||g,labelStyle:{position:"relative",top:2,fontSize:14,color:c.colorText}})})},"isTemplate")]}),re&&(0,o.jsx)(dc,{element:i,levels:L,readOnlyLevels:x,levelsRead:R!==void 0,refetchProjectGroups:E,isLoading:x?j:I||$}),B==="block"&&(0,o.jsx)(t.ui_kit$Form.Item,{name:Hi,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:P,getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})]})})};ps.propTypes={className:f.default.string,email:f.default.object};var{utm_source:hs,utm_medium:bs,utm_campaign:gs,utm_term:fs,utm_content:_s}={utm_source:"utm_source",utm_medium:"utm_medium",utm_campaign:"utm_campaign",utm_term:"utm_term",utm_content:"utm_content"},gc={[hs]:"",[bs]:"",[gs]:"",[fs]:"",[_s]:""},xs=({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 m=g=>{if(d())return;const b=Object.keys(g)[0],_=g;s({utm_parameters:{...i?.utm_parameters,[b]:_[b]}})};return(0,o.jsx)("div",{className:(0,ze.default)("settings-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:c,layout:"vertical",name:"settings_panel_form_utm",initialValues:gc,onValuesChange:m,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:hs,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:bs,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:gs,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:fs,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:_s,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")})})]})})};xs.propTypes={className:f.default.string,email:f.default.object};var fc={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 _c(e){return Number.isInteger(e)?String(e):e.toFixed(2)}function ks(e){const i=e?.trim();return i?fc[i.toUpperCase()]??i:"$"}function Ui(e,i){return`${ks(i)}${_c(e)}`}function xc(e){const i=parseFloat(e.price??""),l=parseFloat(e.discountValue??"");return!Number.isNaN(i)&&!Number.isNaN(l)&&l>0?{sale:Ui(i-l,e.priceCurrency),original:Ui(i,e.priceCurrency)}:Number.isNaN(i)?{}:{sale:Ui(i,e.priceCurrency)}}var bo=({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,ze.default)("preview-skeleton",`preview-skeleton--${e}`,s),style:n,"aria-hidden":"true"})};function zi({className:e}){return(0,o.jsx)("svg",{className:e,width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:(0,o.jsx)("path",{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})})}function Es({className:e}){return(0,o.jsxs)("svg",{className:e,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,o.jsx)("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),(0,o.jsx)("circle",{cx:"7",cy:"7",r:"1.5",fill:"currentColor"})]})}function kc({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 Ec=2;function Bc({card:e}){const i=xc(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)(bo,{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)(bo,{height:12}),(0,o.jsx)(bo,{height:12,width:"75%"})]}),d?(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,o.jsx)(bo,{width:48,height:14}),(0,o.jsx)(bo,{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 Sc(){return(0,o.jsxs)("div",{className:"product-carousel-preview__card",children:[(0,o.jsx)(bo,{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)(bo,{height:12}),(0,o.jsx)(bo,{height:12,width:"75%"})]}),(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,o.jsx)(bo,{width:48,height:14}),(0,o.jsx)(bo,{width:40,height:12})]})]})]})}var Tc=({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)(bo,{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)(bo,{height:14,className:"product-carousel-preview__subject-skeleton"}),(0,o.jsx)(zi,{className:"product-carousel-preview__star-icon"})]})]})]})}),(0,o.jsx)("div",{className:"product-carousel-preview__carousel",children:l.length>0?l.map((c,m)=>(0,o.jsx)(Bc,{card:c},c.id||m)):Array.from({length:Ec},(c,m)=>(0,o.jsx)(Sc,{},`skeleton-${m}`))})]})};function Rc(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 Bs(e){const i=e?.trim();return i?/^code\s/i.test(i)?i:`Code ${i}`:null}var yc=({data:e,subjectLine:i,card:l})=>{const{__:s}=r.useI18n(),n=!!e.logo?.trim(),d=!!i?.trim(),c=!!l?.image?.trim(),m=!!l?.headline?.trim(),g=Rc(l),b=Bs(e.discountCode),_=!!(g||b),h=(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)(bo,{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)(bo,{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)(Es,{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)(bo,{width:16,height:16,className:"single-image-preview__promo-icon-skeleton"}),(0,o.jsx)(bo,{width:72,height:14})]}),_&&(0,o.jsx)("span",{className:"single-image-preview__promo-separator",children:"·"}),b?(0,o.jsx)("span",{className:"single-image-preview__promo-code",children:b}):(0,o.jsx)(bo,{width:96,height:14,className:"single-image-preview__promo-skeleton"})]}),(0,o.jsx)(zi,{className:"single-image-preview__star-icon"})]})]})]})}),(0,o.jsxs)("div",{className:"single-image-preview__card",children:[c?(0,o.jsx)("div",{className:"single-image-preview__card-image",style:h}):(0,o.jsx)(bo,{variant:"block",className:"single-image-preview__card-image-skeleton"}),(0,o.jsx)("div",{className:"single-image-preview__card-body",children:m?(0,o.jsx)("div",{className:"single-image-preview__card-description",children:l?.headline}):(0,o.jsxs)("div",{className:"single-image-preview__card-description-skeleton",children:[(0,o.jsx)(bo,{height:12}),(0,o.jsx)(bo,{height:12,width:"92%"})]})})]})]})};function wc(e){const i=e?.trim();if(!i)return null;const l=(0,dt.default)(i);if(!l.isValid())return null;const s=(0,dt.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 Wi(e){const i=e?.trim();return i||null}function jc(e,i){return e?e==="Today"?i("Today"):e==="Tomorrow"?i("Tomorrow"):e:null}function Ic(e,i){return jc(wc(e),i)}var vc=({data:e,subjectLine:i})=>{const{__:l}=r.useI18n(),s=!!e.logo?.trim(),n=!!i?.trim(),d=Wi(e.description),c=Bs(e.discountCode),m=!!(d||c);return(0,o.jsx)("div",{className:"deal-annotation-preview",children:(0,o.jsxs)("div",{className:"deal-annotation-preview__header-main",children:[s?(0,o.jsx)("img",{src:e.logo,alt:"",className:"deal-annotation-preview__logo"}):(0,o.jsx)(bo,{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)(bo,{height:14,className:"deal-annotation-preview__subject-skeleton"}),(0,o.jsxs)("div",{className:"deal-annotation-preview__promo-row",children:[(0,o.jsxs)("div",{className:"deal-annotation-preview__promo-content",children:[d?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Es,{className:"deal-annotation-preview__promo-icon"}),(0,o.jsx)("span",{className:"deal-annotation-preview__promo-badge",children:d})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(bo,{width:16,height:16,className:"deal-annotation-preview__promo-icon-skeleton"}),(0,o.jsx)(bo,{width:72,height:14})]}),m&&(0,o.jsx)("span",{className:"deal-annotation-preview__promo-separator",children:"·"}),c?(0,o.jsx)("span",{className:"deal-annotation-preview__promo-code",children:c}):(0,o.jsx)(bo,{width:96,height:14,className:"deal-annotation-preview__promo-skeleton"})]}),(0,o.jsx)(zi,{className:"deal-annotation-preview__star-icon"})]})]})]})})},Cc=({data:e})=>{const{__:i}=r.useI18n(),l=Wi(e.description),s=Ic(e.availabilityEnds,i),n=Wi(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)(bo,{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)(kc,{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)(bo,{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)(bo,{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 Pc(e){return e.annotationType===Qe.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW?e.cards?.[0]?[e.cards[0]]:[]:e.annotationType===Qe.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL?e.cards||[]:[]}function Ac(e,i){switch(e){case Qe.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW:return i("Single image preview");case Qe.GMAIL_ANNOTATION_TYPES.DEAL_ANNOTATION:return i("Deal Annotation");case Qe.GMAIL_ANNOTATION_TYPES.DEAL_CARD:return i("Deal Card");default:return i("Product carousel")}}var Gi=300,Ko=16;function Nc(e){if(!e||e.offsetParent===null)return!1;const i=e.getBoundingClientRect();return i.width>0&&i.height>0}function Lc(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 Oc=({data:e,subjectLine:i,parentRef:l,overlayTargetSelector:s,onApply:n,applyDisabled:d=!1,applyBlockers:c=[],onRemove:m,visible:g=!0})=>{const{__:b}=r.useI18n(),[_,h]=(0,a.useState)(null),[p,B]=(0,a.useState)(null);(0,a.useEffect)(()=>{if(!g){h(null),B(null);return}const E=()=>{if(!Nc(l?.current)){h(null),B(null);return}if(s){const re=l?.current?.closest(".email-pane__col_settings-inner")||Lc(".email-pane__col_settings-inner");if(re){B(re),h({type:"popover"});return}}if(!l?.current)return;let z=l.current.getBoundingClientRect();if(z.width===0&&z.height===0){const re=l.current.closest(".email-pane__col");re&&(z=re.getBoundingClientRect())}const le=Math.max(Ko,Math.min(z.top,window.innerHeight-Ko));let C=z.left-Gi-Ko;C<Ko&&(C=z.right+Ko),C+Gi>window.innerWidth-Ko&&(C=window.innerWidth-Gi-Ko),B(document.body),h({type:"side",top:le,left:Math.max(Ko,C)})};E();const I=window.requestAnimationFrame(E),$=[window],U=l?.current?.closest(".email-pane__collapse-wrapper"),v=l?.current?.closest(".email-pane__col");U&&$.push(U),v&&$.push(v),$.forEach(z=>{z.addEventListener("scroll",E,{passive:!0})}),window.addEventListener("resize",E);const L=l?.current,P=L&&typeof ResizeObserver<"u"?new ResizeObserver(E):null;return P?.observe(L),()=>{window.cancelAnimationFrame(I),P?.disconnect(),$.forEach(z=>{z.removeEventListener("scroll",E)}),window.removeEventListener("resize",E)}},[l,e,s,g]);const k=(0,a.useMemo)(()=>_?.type==="side"?{position:"fixed",top:_.top,left:_.left}:void 0,[_]);if(!g||!e||!Qe.hasGmailAnnotationsPreviewContent(e)&&!n||!_)return null;const x=Pc(e),R=e.annotationType||Qe.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL,j=(()=>{switch(R){case Qe.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL:return(0,o.jsx)(Tc,{data:e,subjectLine:i,cards:x});case Qe.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW:return(0,o.jsx)(yc,{data:e,subjectLine:i,card:x[0]});case Qe.GMAIL_ANNOTATION_TYPES.DEAL_ANNOTATION:return(0,o.jsx)(vc,{data:e,subjectLine:i});case Qe.GMAIL_ANNOTATION_TYPES.DEAL_CARD:return(0,o.jsx)(Cc,{data:e});default:return null}})(),N=(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:[b("Preview"),": ",Ac(R,b)]}),j]}),(n||m)&&(0,o.jsxs)("div",{className:"annotations-preview__footer",children:[m&&(0,o.jsx)(t.ui_kit$Button,{type:"text",size:"small",danger:!0,onClick:m,children:b("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:b("Apply")})})})]})]});return(0,Za.createPortal)(N,p||document.body)},{Text:$c}=t.ui_kit$Typography,Fc=10,Mc=1,Ss={width:"100%"},Dc="https://developers.google.com/workspace/gmail/promotab",jo=["hover"],Vc=["annotationLogo"],Ts=["cards",0,"price"],Hc=["cards",0,"discountPercent"],Uc=["cards",0,"priceCurrency"];function So(e){return e.closest(".email-pane__collapse-wrapper")??document.body}var Ho={clearIcon:(0,o.jsx)(t.ui_kit$ColorPickerClearGlyph,{})},zc={optionFilterProp:"label"};function Wc(e){return{value:e||void 0}}var Gc=Qe.POPULAR_PRICE_CURRENCIES.map(e=>{const i=ks(e);return{value:e,label:i===e?e:`${e} (${i})`}}),Rs=({name:e,pricePath:i,iconStrokeWidth:l})=>{const{__:s}=r.useI18n(),n=(0,a.useMemo)(()=>[i],[i]),d=(0,a.useMemo)(()=>[({getFieldValue:c})=>({validator:async(m,g)=>{const b=typeof g=="string"?g.trim():"";if(!b)return;if(Qe.parseDiscountPercent(b)===null)throw new Error(s("Discount must be a percentage greater than 0 and up to 100"));const _=Qe.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:jo,title:s("Discount, %"),placement:"bottom",getPopupContainer:So,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:Ho})})})},ys=({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&&!Qe.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:jo,title:l("Price currency"),placement:"bottom",getPopupContainer:So,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:e,rules:s,getValueProps:Wc,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:Gc,placeholder:l("Price currency"),prefix:(0,o.jsx)(r.EmIcons,{icon:"Globe02Icon",component:t.icons$Globe02Icon,size:16,strokeWidth:i}),showSearch:zc,allowClear:!0,getPopupContainer:So})})})},Yc=({onAdd:e})=>{const{__:i}=r.useI18n(),l=(0,a.useCallback)(()=>e(Qe.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")})},Xc=({field:e,index:i,form:l,isSingleImagePreview:s,onRemove:n})=>{const{__:d}=r.useI18n(),c=r.useAppConfig(),m=(0,a.useMemo)(()=>[e.name,"image"],[e.name]),g=(0,a.useMemo)(()=>["cards",e.name,"image"],[e.name]),b=(0,a.useMemo)(()=>[e.name,"headline"],[e.name]),_=(0,a.useMemo)(()=>[e.name,"url"],[e.name]),h=(0,a.useMemo)(()=>[e.name,"price"],[e.name]),p=(0,a.useMemo)(()=>["cards",e.name,"price"],[e.name]),B=(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]),R=(0,a.useMemo)(()=>[{validator:async(N,E)=>{const I=typeof E=="string"?E.trim():"";if(I&&!/^https?:\/\//i.test(I))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)($c,{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:jo,title:d("Delete"),placement:"top",getPopupContainer:So,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:jo,title:d("Image"),placement:"top",getPopupContainer:So,children:(0,o.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,o.jsx)($o,{form:l,label:d("Image"),name:m,watchPath:g})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:jo,title:d("Headline"),placement:"bottom",getPopupContainer:So,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:b,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"ElementTitle",component:t.icons$ElementTitle,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Headline"),allowClear:Ho})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:jo,title:d("Link"),placement:"bottom",getPopupContainer:So,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:_,className:"selected-social-form__card-field",rules:R,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:Ho})})}),!s&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:jo,title:d("Price"),placement:"bottom",getPopupContainer:So,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:h,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"CreditCard02Icon",component:t.icons$CreditCard02Icon,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Price"),allowClear:Ho})})}),(0,o.jsx)(Rs,{name:B,pricePath:p,iconStrokeWidth:c.iconStrokeWidth}),(0,o.jsx)(ys,{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 ws({iconStrokeWidth:e}){const{__:i}=r.useI18n();return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:jo,title:i("Discount code"),placement:"bottom",getPopupContainer:So,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:Ho})})})}var Kc=({className:e="",isActive:i=!0,email:l})=>{const{__:s}=r.useI18n(),n=r.useAppConfig(),d=r.useEditorLocked(),c=r.useEditorLockCheck(),{document:m}=r.useDocumentSessionContext(),g=r.useNotification(),[b]=t.ui_kit$Form.useForm(),_=(0,a.useRef)(null),h=(0,a.useRef)(!1),p=(0,a.useRef)(null),[B,k]=(0,a.useState)(!1),x=t.ui_kit$Form.useWatch("annotationType",b),R=t.ui_kit$Form.useWatch("annotationLogo",b),j=t.ui_kit$Form.useWatch("description",b),N=t.ui_kit$Form.useWatch("discountCode",b),E=t.ui_kit$Form.useWatch("availabilityStarts",b),I=t.ui_kit$Form.useWatch("availabilityEnds",b),$=t.ui_kit$Form.useWatch("offerPageUrl",b),U=t.ui_kit$Form.useWatch("merchantHomepageUrl",b),v=t.ui_kit$Form.useWatch("cards",b),L=JSON.stringify(v??[]),P=(0,a.useMemo)(()=>JSON.parse(L)??[],[L]),z=x||Qe.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL,le=z===Qe.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL||z===Qe.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW,C=z===Qe.GMAIL_ANNOTATION_TYPES.DEAL_ANNOTATION||z===Qe.GMAIL_ANNOTATION_TYPES.DEAL_CARD,re=z===Qe.GMAIL_ANNOTATION_TYPES.DEAL_CARD,ae=z===Qe.GMAIL_ANNOTATION_TYPES.DEAL_ANNOTATION,_e=z===Qe.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW,Te=z===Qe.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW?Mc:Fc,te=(0,a.useMemo)(()=>[{value:Qe.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL,label:s("Product carousel")},{value:Qe.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW,label:s("Single image preview")},{value:Qe.GMAIL_ANNOTATION_TYPES.DEAL_ANNOTATION,label:s("Deal Annotation")},{value:Qe.GMAIL_ANNOTATION_TYPES.DEAL_CARD,label:s("Deal Card")}],[s]),me=(0,a.useMemo)(()=>{let K="";m&&(K=m.getContent()),!K&&l?.html&&(K=l.html);const q=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i),Q=q?q[1].trim():l?.title||l?.subject||"";return Qe.formatPreviewSubjectLine(Q)},[m,l?.html,l?.title,l?.subject]),je=(0,a.useMemo)(()=>Qe.buildAnnotationsData({annotationType:z,annotationLogo:R,description:j,discountCode:N,availabilityStarts:E,availabilityEnds:I,offerPageUrl:$,merchantHomepageUrl:U,cards:P}),[z,R,j,N,E,I,$,U,P]),ue=(0,a.useMemo)(()=>le?Qe.getDiscountPercentBlockers(P,s):[],[le,P,s]),Ve=(0,a.useMemo)(()=>Qe.canApplyGmailAnnotations(je)&&ue.length===0,[je,ue]),Le=(0,a.useMemo)(()=>[...Qe.getAnnotationsApplyBlockers(je,s),...ue],[je,ue,s]),ve=(0,a.useMemo)(()=>s("Learn more about %s").split("%s"),[s]),he=(0,a.useCallback)(()=>{!m||c()||!Qe.removeAnnotationsFromDocument(m)||(b.setFieldsValue(Qe.getEmptyAnnotationsFormValues(z)),p.current={emailId:l?.id,markup:null},k(!1),g.success(s("Gmail annotations were removed from the template code.")))},[m,c,b,z,l?.id,g,s]);(0,a.useEffect)(()=>{if(!le)return;const K=b.getFieldValue("cards")??[];if(z===Qe.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW){if(K.length>1){b.setFieldsValue({cards:[K[0]]});return}K.length===0&&b.setFieldsValue({cards:[Qe.createEmptyAnnotationCard()]});return}K.length===0&&b.setFieldsValue({cards:[Qe.createEmptyAnnotationCard()]})},[b,le,z,P]);const be=(0,a.useCallback)(K=>{if(!K||!h.current||!m||c())return!1;const q=Qe.applyAnnotationsEditToDocument(m,Qe.buildAnnotationsData(K));if(q){const Q=Qe.readGmailAnnotationsScript(m.getContent());p.current={emailId:l?.id,markup:Q},k(Q!==null)}return q},[m,c,l?.id]),Z=(0,a.useCallback)(()=>{be(b.getFieldsValue(!0))&&g.success(s("Gmail annotation was successfully applied to the template code."))},[be,b,g,s]);return(0,a.useEffect)(()=>{if(!i)return;const K=Qe.normalizeEditorHtml(m?.getContent()||l?.html||""),q={emailId:l?.id,markup:K?Qe.readGmailAnnotationsScript(K):null};if(k(q.markup!==null),!Qe.shouldReloadAnnotationsForm(p.current,q))return;p.current=q,h.current=!1;const Q=K?Qe.parseGmailAnnotations(K):null;b.setFieldsValue(Q?Qe.mapParsedAnnotationsToFormValues(Q):Qe.getEmptyAnnotationsFormValues()),h.current=!0},[i,l?.id,l?.html,m,b]),(0,o.jsxs)("div",{className:(0,ze.default)("selected-social-form","annotations-panel",e),ref:_,children:[(0,o.jsx)(Oc,{data:je,subjectLine:me,parentRef:_,overlayTargetSelector:"#pane-content-iframe",onApply:Z,applyDisabled:!Ve||d,applyBlockers:Le,onRemove:B&&!d?he:void 0,visible:i}),(0,o.jsxs)(t.ui_kit$Form,{form:b,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:jo,title:s("Annotation type"),placement:"bottom",getPopupContainer:So,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:te,placeholder:s("Annotation type"),getPopupContainer:So})})}),!re&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:jo,title:s("Organization logo"),placement:"bottom",getPopupContainer:So,children:(0,o.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,o.jsx)($o,{form:b,label:s("Organization logo"),name:"annotationLogo",watchPath:Vc})})}),(_e||ae)&&(0,o.jsx)(ws,{iconStrokeWidth:n.iconStrokeWidth}),_e&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:jo,title:s("Price"),placement:"bottom",getPopupContainer:So,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:Ts,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:Ho})})}),(0,o.jsx)(Rs,{name:Hc,pricePath:Ts,iconStrokeWidth:n.iconStrokeWidth}),(0,o.jsx)(ys,{name:Uc,iconStrokeWidth:n.iconStrokeWidth})]}),C&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:jo,title:s("Discount description"),placement:"bottom",getPopupContainer:So,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:Ho})})}),re&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(ws,{iconStrokeWidth:n.iconStrokeWidth}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:jo,title:s("Offer page URL"),placement:"bottom",getPopupContainer:So,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:Ho})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:jo,title:s("Merchant homepage URL"),placement:"bottom",getPopupContainer:So,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:Ho})})})]}),(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:jo,title:s("Starts"),placement:"bottom",getPopupContainer:So,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"availabilityStarts",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DatePicker,{showTime:!0,placeholder:s("Starts"),style:Ss,getPopupContainer:So})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:jo,title:s("Ends"),placement:"bottom",getPopupContainer:So,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"availabilityEnds",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DatePicker,{showTime:!0,placeholder:s("Ends"),style:Ss,getPopupContainer:So})})})})]})]})]}),le&&(0,o.jsxs)("div",{className:(0,ze.default)("selected-social-form__section",{"selected-social-form__section--bordered":!_e,"annotations-panel__cards-section":_e}),children:[z===Qe.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:(K,{add:q,remove:Q})=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"selected-social-form__items",children:K.map((V,M)=>(0,o.jsx)(Xc,{field:V,index:M,form:b,isSingleImagePreview:_e,onRemove:Q},V.key))}),!_e&&P.length<Te&&(0,o.jsx)(Yc,{onAdd:q})]})})]}),(0,o.jsxs)("div",{className:"annotations-panel__docs-hint",children:[ve[0],(0,o.jsx)("a",{href:Dc,target:"_blank",rel:"noopener noreferrer",children:s("Gmail annotations")}),ve[1]]})]})]})},qc={appearance:"title"},Yi=({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(),m=r.usePluginViewTabs("documentSettings",qc),{lastOpenedKey:g,lastOpenedStamp:b,claimNewest:_}=m,h=(0,a.useCallback)(v=>{m.activate(v),d(v||"")},[m]);(0,a.useEffect)(()=>{g&&(_(),d(g))},[g,b,_]);const p=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(!p.current&&m.openedKnown){p.current=!0;const v=_();v&&d(v)}},[m.openedKnown,_]);const B=!i&&c.settingsTabEnabled,k=!i&&c.UTMEnabled&&s==="email",x=!i&&c.annotationsEnabled&&s==="email",R=[B&&"Settings",k&&"UTM parameters",x&&"Annotations parameters"].filter(Boolean),j=[...R,...m.openedKeys].includes(n)?n:R[0]??"",N=m.keys[0],E=R.length===0,I=E&&m.openedKnown&&m.openedKeys.length===0,$=(0,a.useRef)(!1);(0,a.useEffect)(()=>{E||($.current=!1)},[E]),(0,a.useEffect)(()=>{I&&N&&!$.current&&($.current=!0,m.activate(N))},[I,N,m]);const U=(0,a.useMemo)(()=>{const v=[];return B&&v.push({label:(0,o.jsx)(o.Fragment,{children:l("Settings")}),key:r.SETTINGS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(ps,{className:"email-settings__collapse-panel-content",element:e})}),k&&v.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)(xs,{className:"email-settings__collapse-panel-content",email:e})}),x&&v.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)(Kc,{className:"email-settings__collapse-panel-content",email:e,isActive:j===r.ANNOTATIONS_PARAMETERS})}),v.push(...m.tabs()),v},[l,e,B,k,x,j,m]);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:h,items:U})})};Yi.propTypes={};var js=320,Jc=1200,Qc=350,{backgroundColor:Is,backgroundImage:Xi,backgroundPositionX:Ki,backgroundPositionY:qi,backgroundRepeat:ri,backgroundSize:Ji,responsive:Zc,backgroundColorContent:eu,width:Qi}={backgroundColor:"backgroundColor",backgroundImage:"backgroundImage",backgroundPositionX:"backgroundPositionX",backgroundPositionY:"backgroundPositionY",backgroundRepeat:"backgroundRepeat",backgroundSize:"backgroundSize",responsive:"responsive",backgroundColorContent:"backgroundColorContent",width:"width"},ou={[Is]:"",[Xi]:"",[Ki]:"",[qi]:"",[ri]:"checked",[Ji]:"",[eu]:"",[Qi]:""};function Zi(e){const i=Number(e);return Number.isNaN(i)?null:{value:i,dim:"px"}}var vs=({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(),m=r.useEmailAttribute("common_styles"),g=r.useSelector(r.selectEmailSettings),b=r.useSelector(r.selectIsSettingsDisabled$1),_=r.useSelector(r.selectActiveSettingsTab),h=r.useSelector(r.selectIsNeedUpdateAppearance),[p,B]=(0,a.useState)(!0),k=(0,a.useRef)(!1),x=(0,a.useRef)(null),R=i("Email not yet loaded or global container not found.");(0,a.useEffect)(()=>{h&&(s(r.setIsNeedUpdateAppearance(!1)),c({operation:r.EVENT_TYPES.INIT_PREVIEW}))},[d,h,s,c,m]),(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"}],N=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}];(0,a.useEffect)(()=>{const{width:z,...le}=g,C={...le,backgroundImage:g.backgroundImage?g.backgroundImage[0]?.value:"",backgroundRepeat:g[ri]===""?"repeat":g[ri],backgroundSize:g[Ji],responsive:g.responsive?.shutdown};k.current||(C.width=z?.value,C.widthDim=z?.dim),d.setFieldsValue(C),B(!g.backgroundImage)},[g,d]);const E=(0,a.useCallback)(z=>{const le=Zi(z);!le||le.value<js||c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{width:le}})},[c]),I=(0,a.useCallback)(z=>{const le=Zi(z);le&&s(r.setEmailSettings({...g,width:le}))},[s,g]),$=(0,a.useCallback)(z=>{x.current&&clearTimeout(x.current),I(z),x.current=setTimeout(()=>{E(z)},Qc)},[E,I]),U=z=>{const le=d.getFieldsValue(!0),C=Object.keys(z)[0];switch(C){case Qi:$(z[C]);break;case Ki:case qi:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[C]:z[C]===""?"none":z[C]}});break;case Xi:B(z[C]===""),c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[C]:[{...g?.backgroundImage?.[0],type:"url",value:z[C]}],backgroundSize:"cover"}});break;case Zc:{const re=Zi(le.width);c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{responsive:{shutdown:z[C],styles:z[C]},...re?{width:re}:{}}});break}default:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:z})}},v=z=>{s(r.setMobileViewActive({shutdown:z,styles:z})),c({operation:r.EVENT_TYPES.SANDBOX_IFRAME_SETSIZE,settings:{iframeWidth:document.querySelector(".email-pane__iframe").getBoundingClientRect().width}})},L=()=>{k.current=!0},P=()=>{x.current&&(clearTimeout(x.current),x.current=null);const z=d.getFieldValue(Qi);I(z),E(z),requestAnimationFrame(()=>{k.current=!1})};return(0,o.jsx)("div",{className:(0,ze.default)("appearance-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"appearance_panel_form",initialValues:{remember:!1,...ou},onValuesChange:U,autoComplete:"off",className:"element-controls",children:[b?(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:"24px"},title:R,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:js,max:Jc,placeholder:i("Width"),disabled:!g.width?.value,addonAfter:"px",onFocus:L,onBlur:P})})})})})}),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:v})})})}),(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:p?16:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:Is,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:b})})})}),(0,o.jsx)(t.ui_kit$Col,{span:p?12:24,children:n.formEmailFieldBackgroundImageEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)($o,{form:d,label:i("Background image"),name:Xi,tooltipTitle:i("Background image"),disabled:b||_!=="Styles",elementSettings:g}),!p&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:"0"},children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Horizontal position"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:Ki,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:qi,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:ri,children:(0,o.jsx)(t.ui_kit$Select,{placeholder:i("Please select"),disabled:b,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:Ji,children:(0,o.jsx)(t.ui_kit$Select,{placeholder:i("Please select"),disabled:b,options:N})})})})]})]})]})})]})})]})})};vs.propTypes={className:f.default.string};var{Option:Cs}=t.ui_kit$Select,{width:Ps,widthDim:tu}={width:"width",widthDim:"widthDim"},iu={[Ps]:"",[tu]:""},As=({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 m=g=>{const b=n.getFieldsValue(!0),_=Object.keys(g)[0];let h;switch(_){case"width":h={[_]:{value:g[_],dim:b.widthDim}};break;case"widthDim":h={width:{value:b.width,dim:g[_]}};break;default:return}d({operation:r.EVENT_TYPES.SANDBOX_BLOCK_SETTINGS_SET,settings:h})};return(0,o.jsx)("div",{className:(0,ze.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,...iu},onValuesChange:m,autoComplete:"off",children:[s?(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:"24px"},title:c,type:"error"}):null,(0,o.jsx)(t.ui_kit$Form.Item,{label:i("Container width"),name:Ps,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)(Cs,{value:"px",children:"px"}),(0,o.jsx)(Cs,{value:"%",children:"%"})]})})})})]})})};As.propTypes={className:f.default.string};var ru=()=>{};function Ns(){const e=r.useContainer(),i=(0,a.useCallback)(s=>{if(!e)return ru;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 Ls(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function er(e,i){const l={...e};for(const s of Object.keys(i)){const n=i[s],d=e[s];Ls(n)&&Ls(d)?l[s]=er(d,n):n!==void 0&&(l[s]=n)}return l}function Os(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 er(l,n)}catch{}}return i&&typeof i=="object"&&!Array.isArray(i)?er(l,i):l}var $s=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}),lu={buttons_borderRadiusAll:"all",buttons_borderRadiusTopLeft:"topLeft",buttons_borderRadiusBottomLeft:"bottomLeft",buttons_borderRadiusTopRight:"topRight",buttons_borderRadiusBottomRight:"bottomRight"},su={cards_borderRadiusAll:"all",cards_borderRadiusTopLeft:"topLeft",cards_borderRadiusBottomLeft:"bottomLeft",cards_borderRadiusTopRight:"topRight",cards_borderRadiusBottomRight:"bottomRight"},au={blockPaddingTop:"top",blockPaddingLeft:"left",blockPaddingRight:"right",blockPaddingBottom:"bottom"},nu=({className:e})=>{const{__:i}=r.useI18n(),l=H.useGoogleFontsLoader(),s=r.useDispatch(),n=r.useSendPostMessage(),[d]=t.ui_kit$Form.useForm(),c=r.useSelector(r.selectEmailSettings),m=r.useSelector(r.selectIsNeedUpdateContentAppearance),g=Ns(),b=r.useEmailAttribute("common_styles"),_=r.useAppConfig(),{token:h}=(0,t.ui_kit$useToken)(),[p,B]=(0,a.useState)({}),[k,x]=(0,a.useState)({}),[R,j]=(0,a.useState)(!0),[N,E]=(0,a.useState)(!0),[I,$]=(0,a.useState)(!1),[U,v]=(0,a.useState)(!1),L={buttonsPaddingTop:"top",buttonsPaddingLeft:"left",buttonsPaddingRight:"right",buttonsPaddingBottom:"bottom"},P=Os(b,g),[z,le]=(0,a.useState)(P.headings.bold),[C,re]=(0,a.useState)(P.headings.italic),[ae,_e]=(0,a.useState)(P.links.underline),[Te,te]=(0,a.useState)(P.buttons.bold),[me,je]=(0,a.useState)(P.buttons.italic),[ue,Ve]=(0,a.useState)(null),Le=r.useSelector(r.selectIsPanelHistoryCollapsed);(0,a.useEffect)(()=>{Le||Ve(null)},[P,Ve,Le]),(0,a.useEffect)(()=>{Le&&!ue&&Ve($s(P))},[P,ue,Le]),(0,a.useEffect)(()=>{m&&(s(r.setIsNeedUpdateContentAppearance(!1)),d.setFieldsValue($s(P)))},[d,m,s,P]);const[ve,he]=(0,a.useState)(Math.min(P.headings.fontSize-1,19)),[be,Z]=(0,a.useState)(Math.max(P.text.fontSize+1,20));(0,a.useEffect)(()=>{if(ue){const V=ue.buttonsBorder;B(V);const M=Object.keys(V).find(ee=>V[ee]?.width||V[ee]?.style||V[ee]?.color),Y=ue.cardsBorder;x(Y);const X=Object.keys(Y).find(ee=>Y[ee]?.width||Y[ee]?.style||Y[ee]?.color);d.setFieldsValue({buttons_borderPosition:M||"all",buttons_borderWidth:V[M]?.width!==null?V[M]?.width:"",buttons_borderColor:V[M]?.color||"",buttons_borderStyle:V[M]?.style||"",cards_borderPosition:X||"all",cards_borderWidth:Y[X]?.width!==null?Y[X]?.width:"",cards_borderColor:Y[X]?.color||"",cards_borderStyle:Y[X]?.style||"",buttons_borderRadiusAll:u(ue.buttonsBorderRadius.all),buttons_borderRadiusTopLeft:u(ue.buttonsBorderRadius.topLeft),buttons_borderRadiusBottomLeft:u(ue.buttonsBorderRadius.bottomLeft),buttons_borderRadiusTopRight:u(ue.buttonsBorderRadius.topRight),buttons_borderRadiusBottomRight:u(ue.buttonsBorderRadius.bottomRight),cards_borderRadiusAll:u(ue.cardsBorderRadius.all),cards_borderRadiusTopLeft:u(ue.cardsBorderRadius.topLeft),cards_borderRadiusBottomLeft:u(ue.cardsBorderRadius.bottomLeft),cards_borderRadiusTopRight:u(ue.cardsBorderRadius.topRight),cards_borderRadiusBottomRight:u(ue.cardsBorderRadius.bottomRight),blockPaddingAll:u(ue.blockPaddingAll),blockPaddingTop:u(ue.blockPaddingTop),blockPaddingRight:u(ue.blockPaddingRight),blockPaddingBottom:u(ue.blockPaddingBottom),blockPaddingLeft:u(ue.blockPaddingLeft),blockPaddingLeftRight:u(ue.blockPaddingRight)||u(ue.blockPaddingLeft),blockPaddingTopBottom:u(ue.blockPaddingTop)||u(ue.blockPaddingBottom)}),!u(ue.blockPaddingAll)&&(u(ue.blockPaddingTop)||u(ue.blockPaddingRight)||u(ue.blockPaddingBottom)||u(ue.blockPaddingLeft))&&(ue.blockPaddingTop!==ue.blockPaddingBottom||ue.blockPaddingRight!==ue.blockPaddingLeft)?v(!1):v(!0),!u(ue.buttonsBorderRadius.all)&&(u(ue.buttonsBorderRadius.topLeft)||u(ue.buttonsBorderRadius.bottomLeft)||u(ue.buttonsBorderRadius.topRight)||u(ue.buttonsBorderRadius.bottomRight))?j(!1):j(!0),ue.buttonsPadding&&!u(ue.buttonsPadding.all)&&(u(ue.buttonsPadding.bottom)||u(ue.buttonsPadding.right)||u(ue.buttonsPadding.left)||u(ue.buttonsPadding.top))&&$(!1),!u(ue.cardsBorderRadius?.all)&&(u(ue.cardsBorderRadius?.topLeft)||u(ue.cardsBorderRadius?.bottomLeft)||u(ue.cardsBorderRadius?.topRight)||u(ue.cardsBorderRadius?.bottomRight))?E(!1):E(!0)}},[d,ue]);const K=()=>{v(M=>!M);const V=d.getFieldsValue(!0);if(!U){V.blockPaddingLeftRight=V.blockPaddingLeft,V.blockPaddingTopBottom=V.blockPaddingTop,V.blockPaddingRight=V.blockPaddingLeft,V.blockPaddingBottom=V.blockPaddingTop;const M=Number(V.blockPaddingTopBottom),Y=Number(V.blockPaddingLeftRight);n({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{blockPadding:{top:Number.isFinite(M)?M:0,bottom:Number.isFinite(M)?M:0,left:Number.isFinite(Y)?Y:0,right:Number.isFinite(Y)?Y:0}}})}},q=V=>{const M=V.target.closest("button");if(!M)return;const Y=M.name,X=M.classList.contains("selected-td-form__button--active");M.className=X?"ant-btn ant-btn-default":"ant-btn ant-btn-default selected-td-form__button--active";try{M.blur()}catch{}Y==="headingBold"?le(!X):Y==="headingItalic"?re(!X):Y==="linkUnderline"?_e(!X):Y==="buttonsBold"?te(!X):Y==="buttonsItalic"&&je(!X),n({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[Y]:!X}})},Q=V=>{const M=d.getFieldsValue(!0),Y=Object.keys(V)[0];let X={};switch(Y){case"headingFontSize":he(Math.min(M.headingFontSize-1,19)),X=V;break;case"textFontSize":Z(Math.max(M.textFontSize+1,20)),X=V;break;case"buttons_borderStyle":X={buttonsBorder:{[M.buttons_borderPosition]:{...p[M.buttons_borderPosition],style:V[Y]}}},M.buttons_borderPosition==="all"?B(ee=>({...r.RESET_BORDER_PARAMS,[M.buttons_borderPosition]:{...ee[M.buttons_borderPosition],style:V[Y]}})):B(ee=>({...ee,[M.buttons_borderPosition]:{...ee[M.buttons_borderPosition],style:V[Y]}}));break;case"buttons_borderColor":X={buttonsBorder:{[M.buttons_borderPosition]:{...p[M.buttonsBorderPosition],color:V[Y]}}},M.buttons_borderPosition==="all"?B(ee=>({...r.RESET_BORDER_PARAMS,[M.buttons_borderPosition]:{...ee[M.buttons_borderPosition],color:V[Y]}})):B(ee=>({...ee,[M.buttons_borderPosition]:{...ee[M.buttons_borderPosition],color:V[Y]}}));break;case"buttons_borderWidth":X={buttonsBorder:{[M.buttons_borderPosition]:{...p[M.buttons_borderPosition],width:V[Y]}}},M.buttonsBorderPosition==="all"?B(ee=>({...r.RESET_BORDER_PARAMS,[M.buttons_borderPosition]:{...ee[M.buttons_borderPosition],width:V[Y]}})):B(ee=>({...ee,[M.buttons_borderPosition]:{...ee[M.buttons_borderPosition],width:V[Y]}}));break;case"buttons_borderPosition":d.setFieldsValue({buttons_borderWidth:p[V[Y]]?.width||"",buttons_borderColor:p[V[Y]]?.color||"",buttons_borderStyle:p[V[Y]]?.style||""});break;case"cards_borderStyle":X={cardsBorder:{[M.cards_borderPosition]:{...k[M.cards_borderPosition],style:V[Y]}}},M.cards_borderPosition==="all"?x(ee=>({...r.RESET_BORDER_PARAMS,[M.cards_borderPosition]:{...ee[M.cards_borderPosition],style:V[Y]}})):x(ee=>({...ee,[M.cards_borderPosition]:{...ee[M.cards_borderPosition],style:V[Y]}}));break;case"cards_borderColor":X={cardsBorder:{[M.cards_borderPosition]:{...k[M.cardsBorderPosition],color:V[Y]}}},M.cards_borderPosition==="all"?x(ee=>({...r.RESET_BORDER_PARAMS,[M.cards_borderPosition]:{...ee[M.cards_borderPosition],color:V[Y]}})):x(ee=>({...ee,[M.cards_borderPosition]:{...ee[M.cards_borderPosition],color:V[Y]}}));break;case"cards_borderWidth":X={cardsBorder:{[M.cards_borderPosition]:{...k[M.cards_borderPosition],width:V[Y]}}},M.cardsBorderPosition==="all"?x(ee=>({...r.RESET_BORDER_PARAMS,[M.cards_borderPosition]:{...ee[M.cards_borderPosition],width:V[Y]}})):x(ee=>({...ee,[M.cards_borderPosition]:{...ee[M.cards_borderPosition],width:V[Y]}}));break;case"cards_borderPosition":d.setFieldsValue({cards_borderWidth:k[V[Y]]?.width||"",cards_borderColor:k[V[Y]]?.color||"",cards_borderStyle:k[V[Y]]?.style||""});break;case"buttons_borderRadiusAll":case"buttons_borderRadiusTopLeft":case"buttons_borderRadiusBottomLeft":case"buttons_borderRadiusTopRight":case"buttons_borderRadiusBottomRight":X={buttonsBorderRadius:{[lu[Y]]:+V[Y]}};break;case"cards_borderRadiusAll":case"cards_borderRadiusTopLeft":case"cards_borderRadiusBottomLeft":case"cards_borderRadiusTopRight":case"cards_borderRadiusBottomRight":X={cardsBorderRadius:{[su[Y]]:+V[Y]}};break;case"buttonsPaddingTop":case"buttonsPaddingLeft":case"buttonsPaddingRight":case"buttonsPaddingBottom":I?(X={padding:{all:+V[Y]}},d.setFieldsValue({paddingTop:V[Y],paddingLeft:V[Y],paddingRight:V[Y],paddingBottom:V[Y]})):X={buttonsPadding:{[L[Y]]:+V[Y]}};break;case"blockPaddingTop":case"blockPaddingLeft":case"blockPaddingRight":case"blockPaddingBottom":X={blockPadding:{[au[Y]]:+V[Y]}};break;case"blockPaddingTopBottom":X={blockPadding:{top:+V[Y],bottom:+V[Y]}},M.blockPaddingTop=M.blockPaddingBottom=+V[Y];break;case"blockPaddingLeftRight":X={blockPadding:{left:+V[Y],right:+V[Y]}},M.blockPaddingLeft=M.blockPaddingRight=+V[Y];break;default:X=V}Y!=="buttons_borderPosition"&&n({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:X})};return ue&&(0,o.jsx)("div",{className:(0,ze.default)("appearance-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"content_appearance_panel_form",initialValues:ue,onValuesChange:Q,autoComplete:"off",className:"element-controls",children:[null,(0,o.jsxs)(t.ui_kit$FormSection,{title:i("Blocks"),dividerTop:!1,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Blocks background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"blockBackgroundColor",style:{marginBottom:h.formItemMarginBottomMD+4},rules:[{message:i("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color of the contrast blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"blockContrastBackgroundColor",style:{marginBottom:h.formItemMarginBottomMD+4},rules:[{message:i("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})})]}),(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:U,onToggleExtended:K,fieldNames:{paddingLeftRight:"blockPaddingLeftRight",paddingLeft:"blockPaddingLeft",paddingRight:"blockPaddingRight",paddingTopBottom:"blockPaddingTopBottom",paddingTop:"blockPaddingTop",paddingBottom:"blockPaddingBottom"},labels:{horizontal:i("Horizontal padding"),vertical:i("Vertical padding"),left:i("Left padding"),right:i("Right padding"),top:i("Top padding"),bottom:i("Bottom padding"),individual:i("Individual padding")},gutter:10,rowStyle:{paddingBottom:4}})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:i("General text"),dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Font of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textFontFamily",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{loadGoogleFonts:l,getPopupContainer:V=>V.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:ve,placeholder:i("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Line height of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textLineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Color of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrast block text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textContrastColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Text color"),usedColors:c.usedColors})})})})]}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom padding of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textPaddingBottom",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom padding"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingBottom",component:t.icons$PaddingBottom}),addonAfter:"px"})})})})})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:i("Headings"),dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading font"),placement:"left",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingFontFamily",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{loadGoogleFonts:l,getPopupContainer:V=>V.closest(".email-pane__content-col")})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingFontSize",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:be,max:40,placeholder:i("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingLineHeight",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading letter spacing"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingLetterSpacing",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Letter spacing"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsxs)(t.ui_kit$Space,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Strong"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.default)({"selected-td-form__button--active":z}),type:"default",name:"headingBold",onClick:q,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined})})}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Italic"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.default)({"selected-td-form__button--active":C}),type:"default",name:"headingItalic",onClick:q,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined})})})]})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Heading color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrast block header color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingContrastColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Heading color"),usedColors:c.usedColors})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Top padding"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingPaddingTop",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Top padding"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingTop",component:t.icons$PaddingTop}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom padding"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingPaddingBottom",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom padding"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingBottom",component:t.icons$PaddingBottom}),addonAfter:"px"})})})})]})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:i("Links"),dividerTop:!0,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Link color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkColor",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Link color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Underline"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.default)({"selected-td-form__button--active":ae}),type:"default",name:"linkUnderline",onClick:q,children:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined})})})})]}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Link color in contrasting blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkContrastColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Link color"),usedColors:c.usedColors})})})})})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Text & background")]}),dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons font"),placement:"left",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsFontFamily",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{loadGoogleFonts:l,getPopupContainer:V=>V.closest(".email-pane__content-col")})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsFontSize",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons letter spacing"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsLetterSpacing",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Letter spacing"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsColor",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Buttons text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Button text color in contrasting blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsContrastColor",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Buttons text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsBackgroundColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Button background color in contrasting blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsContrastBackgroundColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),_.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(lt,{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,ze.default)({"selected-td-form__button--active":Te}),type:"default",name:"buttonsBold",onClick:q,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined})})}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Italic"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.default)({"selected-td-form__button--active":me}),type:"default",name:"buttonsItalic",onClick:q,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)(H.SelectedElementFormBorder,{form:d,borders:p,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)(wo,{form:d,oneBorderRadiusValue:R,setOneBorderRadiusValue:j,elementSettings:ue,namePrefix:"buttons_"})})}),(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Margins")]}),dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Top margin"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsMarginTop",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Top margin"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingTop",component:t.icons$PaddingTop}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom margin"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsMarginBottom",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom margin"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingBottom",component:t.icons$PaddingBottom}),addonAfter:"px"})})})})]})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Cards")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Colors")]}),dividerTop:!0,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:i("Base colors"),compact:!0,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Base background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsBaseBackgroundColor",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Base background color"),usedColors:c.usedColors})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:i("Contrasting colors"),compact:!0,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrasting background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsContrastBackgroundColor",style:{marginBottom:h.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Contrasting background color"),usedColors:c.usedColors})})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Base text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsBaseTextColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Base text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrasting text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsContrastTextColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Contrasting text color"),usedColors:c.usedColors})})})})]})]}),_.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)(H.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)(wo,{form:d,oneBorderRadiusValue:N,setOneBorderRadiusValue:E,elementSettings:ue,namePrefix:"cards_"})})})]})})},or=({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=b=>n(b||"");e.common_styles&&e.common_styles;const m=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)(vs,{className:"email-settings__collapse-panel-content"}):(0,o.jsx)(As,{className:"email-settings__collapse-panel-content"})}];return m&&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)(nu,{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})})};or.propTypes={};var du=ho.__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 cu(e){return e.type===uo.Tag||e.type===uo.Script||e.type===uo.Style}var uo,uu,mu,pu,hu,bu,gu,fu,_u,xu,Fs=ho.__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"})(uo||(uo={})),uu=uo.Root,mu=uo.Text,pu=uo.Directive,hu=uo.Comment,bu=uo.Script,gu=uo.Style,fu=uo.Tag,_u=uo.CDATA,xu=uo.Doctype}));function Ms(e){return cu(e)}function Ds(e){return e.type===uo.CDATA}function Vs(e){return e.type===uo.Text}function Hs(e){return e.type===uo.Comment}function Us(e){return e.type===uo.Directive}function zs(e){return e.type===uo.Root}function ku(e){return Object.hasOwn(e,"children")}function tr(e,i=!1){let l;if(Vs(e))l=new jt(e.data);else if(Hs(e))l=new si(e.data);else if(Ms(e)){const s=i?ir(e.children):[],n=new di(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(Ds(e)){const s=i?ir(e.children):[],n=new ni(s);for(const d of s)d.parent=n;l=n}else if(zs(e)){const s=i?ir(e.children):[],n=new vt(s);for(const d of s)d.parent=n;e["x-mode"]&&(n["x-mode"]=e["x-mode"]),l=n}else if(Us(e)){const s=new ai(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 ir(e){const i=e.map(l=>tr(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 li,wt,jt,si,ai,It,ni,vt,di,Ws=ho.__esmMin((()=>{Fs(),li=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 tr(this,e)}},wt=class extends li{data;constructor(e){super(),this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}},jt=class extends wt{type=uo.Text;get nodeType(){return 3}},si=class extends wt{type=uo.Comment;get nodeType(){return 8}},ai=class extends wt{type=uo.Directive;name;constructor(e,i){super(i),this.name=e}get nodeType(){return 1}"x-name";"x-publicId";"x-systemId"},It=class extends li{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}},ni=class extends It{type=uo.CDATA;get nodeType(){return 4}},vt=class extends It{type=uo.Root;get nodeType(){return 9}},di=class extends It{name;attribs;type;constructor(e,i,l=[],s=e==="script"?uo.Script:e==="style"?uo.Style:uo.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"}})),rr=ho.__exportAll({CDATA:()=>ni,Comment:()=>si,DataNode:()=>wt,Document:()=>vt,DomHandler:()=>sr,Element:()=>di,Node:()=>li,NodeWithChildren:()=>It,ProcessingInstruction:()=>ai,Text:()=>jt,cloneNode:()=>tr,default:()=>sr,hasChildren:()=>ku,isCDATA:()=>Ds,isComment:()=>Hs,isDirective:()=>Us,isDocument:()=>zs,isTag:()=>Ms,isText:()=>Vs}),lr,sr,ar=ho.__esmMin((()=>{Fs(),Ws(),Ws(),lr={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},sr=class{dom=[];root=new vt(this.dom);callback;options;elementCB;done=!1;tagStack=[this.root];lastNode=null;parser=null;constructor(e,i,l){typeof i=="function"&&(l=i,i=lr),typeof e=="object"&&(i=e,e=void 0),this.callback=e??null,this.options=i??lr,this.elementCB=l??null}onparserinit(e){this.parser=e}onreset(){this.dom=[],this.root=new vt(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null}onend(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))}onerror(e){this.handleCallback(e)}onclosetag(){this.lastNode=null;const e=this.tagStack.pop();this.options.withEndIndices&&this.parser&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)}onopentag(e,i){const l=this.options.xmlMode?uo.Tag:void 0,s=new di(e,i,void 0,l);this.addNode(s),this.tagStack.push(s)}ontext(e){const{lastNode:i}=this;if(i&&i.type===uo.Text)i.data+=e,this.options.withEndIndices&&this.parser&&(i.endIndex=this.parser.endIndex);else{const l=new jt(e);this.addNode(l),this.lastNode=l}}oncomment(e){if(this.lastNode&&this.lastNode.type===uo.Comment){this.lastNode.data+=e;return}const i=new si(e);this.addNode(i),this.lastNode=i}oncommentend(){this.lastNode=null}oncdatastart(){const e=new jt(""),i=new ni([e]);this.addNode(i),e.parent=i,this.lastNode=e}oncdataend(){this.lastNode=null}onprocessinginstruction(e,i){const l=new ai(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}}})),Gs=ho.__commonJSMin((e=>{var i=du(),l=(ar(),ho.__toCommonJS(rr)),s="\r",n=new RegExp(s,"g"),d=`__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_${Date.now().toString()}__`,c=new RegExp(d,"g");function m(k){return i.CASE_SENSITIVE_TAG_NAMES_MAP[k]}function g(k){const x={};let R=0;const j=k.length;for(;R<j;R++){const N=k[R];x[N.name]=N.value}return x}function b(k){k=k.toLowerCase();const x=m(k);return x||k}function _(k,x){const R="<"+x,j=k.toLowerCase().indexOf(R);if(j===-1)return!1;const N=k[j+R.length];return N===">"||N===" "||N===" "||N===`
10
+ `||N==="\r"||N==="/"}function h(k){return k.replace(n,d)}function p(k){return k.replace(c,s)}function B(k,x=null,R){const j=[];let N,E=0;const I=k.length;for(;E<I;E++){const $=k[E];switch($.nodeType){case 1:{const v=b($.nodeName);N=new l.Element(v,g($.attributes)),N.children=B(v==="template"?$.content.childNodes:$.childNodes,N);break}case 3:N=new l.Text(p($.nodeValue??""));break;case 8:N=new l.Comment($.nodeValue??"");break;default:continue}const U=j[E-1]??null;U&&(U.next=N),N.parent=x,N.prev=U,N.next=null,j.push(N)}return R&&(N=new l.ProcessingInstruction(R.substring(0,R.indexOf(" ")).toLowerCase(),R),N.next=j[0]??null,N.parent=x,j.unshift(N),j[1]&&(j[1].prev=j[0])),j}e.escapeSpecialCharacters=h,e.formatDOM=B,e.hasOpenTag=_})),Eu=ho.__commonJSMin((e=>{var i=Gs(),l="html",s="head",n="body",d=/<([a-zA-Z]+[0-9]?)/;function c(k,x){return x?x.createHTML(k):k}var m=(k,x,R)=>{throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},g=(k,x,R)=>{throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},b=typeof window=="object"&&window.DOMParser;if(typeof b=="function"){const k=new b,x="text/html";g=(R,j,N)=>(j&&(R=`<${j}>${R}</${j}>`),k.parseFromString(R,x)),m=g}if(typeof document=="object"&&document.implementation){const k=document.implementation.createHTMLDocument();m=function(x,R,j){if(R){const N=k.documentElement.querySelector(R);return N&&(N.innerHTML=c(x,j)),k}return k.documentElement.innerHTML=c(x,j),k}}var _=typeof document=="object"&&document.createElement("template"),h;_&&_.content&&(h=(k,x)=>(_.innerHTML=c(k,x),_.content.childNodes));var p=()=>document.createDocumentFragment().childNodes;function B(k,x){k=i.escapeSpecialCharacters(k);const R=d.exec(k)?.[1]?.toLowerCase();switch(R){case l:{const j=g(k);if(!i.hasOpenTag(k,s)){const N=j.querySelector(s);N?.parentNode?.removeChild(N)}if(!i.hasOpenTag(k,n)){const N=j.querySelector(n);N?.parentNode?.removeChild(N)}return j.querySelectorAll(l)}case s:case n:{const j=m(k,void 0,x).querySelectorAll(R);return i.hasOpenTag(k,n)&&i.hasOpenTag(k,s)?j[0].parentNode?.childNodes??p():j}default:return h?h(k,x):m(k,n,x).querySelector(n)?.childNodes??p()}}e.default=B})),Bu=ho.__commonJSMin((e=>{Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var i=Gs(),l=Eu(),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 m=s.exec(d),g=m?m[1]:void 0;return i.formatDOM(l.default(d,c?.trustedTypePolicy),null,g)}e.default=n})),Su=ho.__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}})),Tu=ho.__commonJSMin((e=>{var i=0,l=1,s=2,n=3,d=4,c=5,m=6;function g(E){return _.hasOwnProperty(E)?_[E]:null}function b(E,I,$,U,v,L,P){this.acceptsBooleans=I===s||I===n||I===d,this.attributeName=U,this.attributeNamespace=v,this.mustUseProperty=$,this.propertyName=E,this.type=I,this.sanitizeURL=L,this.removeEmptyString=P}var _={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(E=>{_[E]=new b(E,i,!1,E,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([E,I])=>{_[E]=new b(E,l,!1,I,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(E=>{_[E]=new b(E,s,!1,E.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(E=>{_[E]=new b(E,s,!1,E,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(E=>{_[E]=new b(E,n,!1,E.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(E=>{_[E]=new b(E,n,!0,E,null,!1,!1)}),["capture","download"].forEach(E=>{_[E]=new b(E,d,!1,E,null,!1,!1)}),["cols","rows","size","span"].forEach(E=>{_[E]=new b(E,m,!1,E,null,!1,!1)}),["rowSpan","start"].forEach(E=>{_[E]=new b(E,c,!1,E.toLowerCase(),null,!1,!1)});var h=/[\-\:]([a-z])/g,p=E=>E[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(E=>{const I=E.replace(h,p);_[I]=new b(I,l,!1,E,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(E=>{const I=E.replace(h,p);_[I]=new b(I,l,!1,E,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(E=>{const I=E.replace(h,p);_[I]=new b(I,l,!1,E,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(E=>{_[E]=new b(E,l,!1,E.toLowerCase(),null,!1,!1)});var B="xlinkHref";_[B]=new b("xlinkHref",l,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(E=>{_[E]=new b(E,l,!1,E.toLowerCase(),null,!0,!0)});var{CAMELCASE:k,SAME:x,possibleStandardNames:R}=Su(),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]*$")),N=Object.keys(R).reduce((E,I)=>{const $=R[I];return $===x?E[I]=I:$===k?E[I.toLowerCase()]=I:E[I]=$,E},{});e.BOOLEAN=n,e.BOOLEANISH_STRING=s,e.NUMERIC=c,e.OVERLOADED_BOOLEAN=d,e.POSITIVE_NUMERIC=m,e.RESERVED=i,e.STRING=l,e.getPropertyInfo=g,e.isCustomAttribute=j,e.possibleStandardNames=N}));function Ru(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(Xs);x&&(l+=x.length);var R=k.lastIndexOf(oa);s=~R?k.length-R:s+k.length}function d(){var k={line:l,column:s};return function(x){return x.position=new c(k),b(),x}}function c(k){this.start=k,this.end={line:l,column:s},this.source=i.source}c.prototype.content=e;function m(k){var x=new Error(i.source+":"+l+":"+s+": "+k);if(x.reason=k,x.filename=i.source,x.line=l,x.column=s,x.source=e,!i.silent)throw x}function g(k){var x=k.exec(e);if(x){var R=x[0];return n(R),e=e.slice(R.length),x}}function b(){g(Ks)}function _(k){var x;for(k=k||[];x=h();)x!==!1&&k.push(x);return k}function h(){var k=d();if(!(dr!=e.charAt(0)||cr!=e.charAt(1))){for(var x=2;qo!=e.charAt(x)&&(cr!=e.charAt(x)||dr!=e.charAt(x+1));)++x;if(x+=2,qo===e.charAt(x-1))return m("End of comment missing");var R=e.slice(2,x-2);return s+=2,n(R),e=e.slice(x),s+=2,k({type:ta,comment:R})}}function p(){var k=d(),x=g(qs);if(x){if(h(),!g(Js))return m("property missing ':'");var R=g(Qs),j=k({type:ia,property:Ys(x[0].replace(nr,qo)),value:R?Ys(R[0].replace(nr,qo)):qo});return g(Zs),j}}function B(){var k=[];_(k);for(var x;x=p();)x!==!1&&(k.push(x),_(k));return k}return b(),B()}function Ys(e){return e?e.replace(ea,qo):qo}var nr,Xs,Ks,qs,Js,Qs,Zs,ea,oa,dr,cr,qo,ta,ia,yu=ho.__esmMin((()=>{nr=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Xs=/\n/g,Ks=/^\s*/,qs=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Js=/^:\s*/,Qs=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Zs=/^[;\s]*/,ea=/^\s+|\s+$/g,oa=`
11
+ `,dr="/",cr="*",qo="",ta="comment",ia="declaration"}));function wu(e,i){let l=null;if(!e||typeof e!="string")return l;const s=Ru(e),n=typeof i=="function";return s.forEach(d=>{if(d.type!=="declaration")return;const{property:c,value:m}=d;n?i(c,m,d):m&&(l=l??{},l[c]=m)}),l}var ju=ho.__esmMin((()=>{yu()})),Iu=ho.__exportAll({default:()=>vu});function vu(e,i){const l={};return!e||typeof e!="string"||wu(e,(s,n)=>{s&&n&&(l[ua(s,i)]=n)}),l}var ra,la,sa,aa,na,da,ca,ur,ua,Cu=ho.__esmMin((()=>{ju(),ra=/^--[a-zA-Z0-9_-]+$/,la=/-([a-z])/g,sa=/^[^-]+$/,aa=/^-(webkit|moz|ms|o|khtml)-/,na=/^-(ms)-/,da=e=>!e||sa.test(e)||ra.test(e),ca=(e,i)=>i.toUpperCase(),ur=(e,i)=>`${i}-`,ua=(e,i={})=>da(e)?e:(e=e.toLowerCase(),i.reactCompat?e=e.replace(na,ur):e=e.replace(aa,ur),e.replace(la,ca))})),ma=ho.__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=m;var l=fo("react"),s=i((Cu(),ho.__toCommonJS(Iu))),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(_,h){return _.includes("-")?!n.has(_):!!(h&&typeof h.is=="string")}var c={reactCompat:!0};function m(_,h){if(typeof _=="string"){if(!_.trim()){h.style={};return}try{h.style=(0,s.default)(_,c)}catch{h.style={}}}}e.PRESERVE_CUSTOM_ATTRIBUTES=Number(l.version.split(".")[0])>=16,e.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var g=_=>!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(_.name);e.canTextBeChildOfNode=g;var b=_=>_;e.returnFirstArg=b})),pa=ho.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var i=Tu(),l=ma(),s=["checked","value"],n=["input","select","textarea"],d={reset:!0,submit:!0};function c(g={},b){const _={},h=!!(g.type&&d[g.type]);for(const p in g){const B=g[p];if((0,i.isCustomAttribute)(p)){_[p]=B;continue}const k=p.toLowerCase();let x=m(k);if(x){const R=(0,i.getPropertyInfo)(x);switch(s.includes(x)&&n.includes(b)&&!h&&(x=m("default"+k)),_[x]=B,R?.type){case i.BOOLEAN:_[x]=!0;break;case i.OVERLOADED_BOOLEAN:B===""&&(_[x]=!0)}continue}l.PRESERVE_CUSTOM_ATTRIBUTES&&(_[p]=B)}return(0,l.setStyleProp)(g.style,_),_}function m(g){return i.possibleStandardNames[g]}})),Pu=ho.__commonJSMin((e=>{var i=e&&e.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=m;var l=(ar(),ho.__toCommonJS(rr)),s=fo("react"),n=i(pa()),d=ma(),c={cloneElement:s.cloneElement,createElement:s.createElement,isValidElement:s.isValidElement};function m(_,h={}){var p,B,k,x,R;const j=[],N=typeof h.replace=="function",E=(p=h.transform)!==null&&p!==void 0?p:d.returnFirstArg,{cloneElement:I,createElement:$,isValidElement:U}=(B=h.library)!==null&&B!==void 0?B:c,v=_.length;g(_);for(let L=0;L<v;L++){const P=_[L];if(N){let re=(k=h.replace)===null||k===void 0?void 0:k.call(h,P,L);if(U(re)){v>1&&(re=I(re,{key:(x=re.key)!==null&&x!==void 0?x:L})),j.push(E(re,P,L));continue}}if(P.type==="text"){const re=!P.data.trim().length;if(re&&P.parent&&!(0,d.canTextBeChildOfNode)(P.parent)||h.trim&&re)continue;j.push(E(P.data,P,L));continue}const z=P;let le={};b(z)?((0,d.setStyleProp)(z.attribs.style,z.attribs),le=z.attribs):z.attribs&&(le=(0,n.default)(z.attribs,z.name));let C;switch(P.type){case"script":case"style":P.children[0]&&(le.dangerouslySetInnerHTML={__html:P.children[0].data});break;case"tag":P.name==="textarea"&&P.children[0]?le.defaultValue=P.children[0].data:!((R=P.children)===null||R===void 0)&&R.length&&(C=m(P.children,h));break;default:continue}v>1&&(le.key=L),j.push(E($(P.name,le,C),P,L))}return j.length===1?j[0]:j}function g(_){for(const h of _)(h.type==="tag"||h.type==="script"||h.type==="style")&&(Object.setPrototypeOf(h,l.Element.prototype),g(h.children))}function b(_){return d.PRESERVE_CUSTOM_ATTRIBUTES&&_.type==="tag"&&(0,d.isCustomComponent)(_.name,_.attribs)}})),Au=ho.__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=m;var l=i(Bu());e.htmlToDOM=l.default;var s=i(pa());e.attributesToProps=s.default;var n=i(Pu());e.domToReact=n.default;var d=(ar(),ho.__toCommonJS(rr));Object.defineProperty(e,"Comment",{enumerable:!0,get:function(){return d.Comment}}),Object.defineProperty(e,"Element",{enumerable:!0,get:function(){return d.Element}}),Object.defineProperty(e,"ProcessingInstruction",{enumerable:!0,get:function(){return d.ProcessingInstruction}}),Object.defineProperty(e,"Text",{enumerable:!0,get:function(){return d.Text}});var c={lowerCaseAttributeNames:!1};function m(g,b){var _;if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];const h=Object.assign(Object.assign({},(_=b?.htmlparser2)!==null&&_!==void 0?_:c),{trustedTypePolicy:b?.trustedTypePolicy});return(0,n.default)((0,l.default)(g,h),b)}})),ht=ho.__toESM(Au(),1),Nu=ht.default.default||ht.default,mr=new Set;function Lu(e,i){mr.has(e)||(mr.add(e),Promise.resolve(i()).finally(()=>{mr.delete(e)}))}var Ou={subject:"insert_generated_subject",preheader:"insert_generated_preheader"};function ha(e,i,l){l.document&&(r.writeEmailAttributes(l.document,{[e]:i}),l.pushToDataLayer({event:"submit",action:Ou[e],entity_type:l.entityType,entity_id:l.entityId,project_id:l.projectId,context:"editor"}))}function pr({limitsInPlugin:e,hostedAiActive:i}){return e&&!i}function ba({limitsInPlugin:e,hostedAiActive:i,counter:l,limit:s}){return pr({limitsInPlugin:e,hostedAiActive:i})?s>0&&l>=s:!1}function ga(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 $u=e=>{const{__:i}=r.useI18n();return[{key:"📧",label:(0,o.jsxs)("div",{onClick:()=>{e("theme-and-preheader-generator")},children:["📧 ",i("Subject line & preheader generator")]})},{key:"🌎",label:(0,o.jsxs)("div",{onClick:()=>{e("translator")},children:["🌎 ",i("Translator")]})},{key:"📄",label:(0,o.jsxs)("div",{onClick:()=>{e("writer")},children:["📄 ",i("Copywriter")]})},{key:"🔎",label:(0,o.jsxs)("div",{onClick:()=>{e("corrector")},children:["🔎 ",i("Proofreader")]})},{key:"🧠",label:(0,o.jsxs)("div",{onClick:()=>{e("psychologist")},children:["🧠 ",i("Psychologist")]})},{key:"📈",label:(0,o.jsxs)("div",{onClick:()=>{e("marketolog")},children:["📈 ",i("Marketer")]})},{key:"✨",label:(0,o.jsxs)("div",{onClick:()=>{e("email-generator")},children:["✨ ",i("Email generator")]})}]},Fu={background:r.emCssVar("colorInfo"),color:"#ffffff"},fa=({messages:e,newEmailAiGeneratorRef:i})=>{const l=r.useElementEntityKind(),{document:s}=r.useDocumentSessionContext(),n=r.useContentReader(),d=r.useUserContentReplacer(),{__:c,_n:m}=r.useI18n(),g=r.useDispatch(),b=r.useAppNavigate(),_=(0,a.useRef)(null),h=r.useAppConfig(),p=r.useEditorLocked(),B=r.useEditorLockCheck(),k=r.useNotification(),x=r.useEditorProjectId(),R=r.useWpEntityId(),j=r.usePushToDataLayer(),N={document:s,pushToDataLayer:j,entityType:l==="block"?"block":"email",entityId:R,projectId:x},E=r.useEventEmitter(yo.events.ON_LIMIT_ID),[I,$]=(0,a.useState)(null),[U,v]=(0,a.useState)(0),[L,P]=(0,a.useState)(!1),[z,le]=(0,a.useState)(""),[C,re]=(0,a.useState)([]),[ae,_e]=(0,a.useState)(!1),[Te,te]=(0,a.useState)(!1),[me,je]=(0,a.useState)(null),[ue,Ve]=(0,a.useState)(0),[Le,ve]=(0,a.useState)(null),he=r.useEmailAttribute("subject"),be=r.useEmailAttribute("preheader"),Z=r.useCurrentUser(),K=r.toLanguageCode(r.useInterfaceLocale()),q=Z.avatar_url||Z.avatar_urls?.[24],Q=[Z.first_name,Z.last_name].filter(Boolean).join(" ")||Z.username,V=r.useMessageService(),[M]=r.useLazyGetDialogQuery(),Y=r.useSendPostMessage(),[X,ee]=r.useSendMessageMutation(),ne=(0,a.useRef)(new Set),Be=(0,a.useCallback)(ge=>{const He=X(ge),Ke=ne.current;Ke.add(He);const Fe=()=>Ke.delete(He);return He.then(Fe,Fe),He},[X]);(0,a.useEffect)(()=>{const ge=ne.current;return()=>{ge.forEach(He=>He.abort?.()),ge.clear()}},[]);const[Ee,{reset:oe}]=r.useGetAiGenerateStatusMutation(),[D,{data:ie=[]}]=r.useLazyGetGeneratedContentQuery(),[we]=r.useLazyGetLimitsStatsByTypeQuery(),W={cursor:L?"not-allowed":"default",pointerEvents:L?"none":"auto"};(0,a.useEffect)(()=>{Le&&ae&&(i.current=!0),ae||(i.current=!1)},[Le,ae]);const Se=!!(h.limits&&h.counters)&&!0,{limits:Oe}=h.limits?h:{limits:{ai_limit:0,ai_generator_limit:0}},{ai_limit:Ae,ai_generator_limit:Ge}=Oe,Ye=r.useEventEmitter(yo.events.AI_TEXT_REQUEST_ID).hasListeners(),Ze=pr({limitsInPlugin:Se,hostedAiActive:Ye}),de=ba({limitsInPlugin:Se,hostedAiActive:Ye,counter:U,limit:Ae}),Ce=ba({limitsInPlugin:Se,hostedAiActive:Ye,counter:ue,limit:Ge}),G=(0,a.useCallback)(()=>{E.fire({name:"AiChatCount",count:U+1})},[E,U]),pe=(0,a.useCallback)(()=>{E.fire({name:"AiGeneratorCount",count:ue+1})},[E,ue]),Pe=(0,a.useCallback)(async ge=>!0,[c,we,k]);(0,a.useEffect)(()=>{Se&&(v(h?.counters?.ai_counter||0),Ve(h?.counters?.ai_generator_counter||0))},[h,Se]),(0,a.useEffect)(()=>{ve(C.length<=0?!1:C.toReversed().find(He=>He.data?.context)?.data.context==="email-generator")},[C]);const We=(0,a.useCallback)(async()=>await V.sendAsync(r.EVENT_TYPES.SANDBOX_IS_EMAIL_EMPTY),[V]),to=(0,a.useCallback)(()=>{const ge=_.current?.closest(".ant-tabs-content.ant-tabs-content-top");setTimeout(()=>{ge?.scrollTo({top:ge.scrollHeight,behavior:"smooth"})},0)},[_]),eo=(0,a.useCallback)(()=>{r.swallowPromiseRejection(M({entity_id:R}).then(ge=>{re(ge.data.documents),to()}))},[R,M,re,to]),no=(0,a.useCallback)(ge=>{if(!ge?.data?._eventResult)return!1;const{aiMessage:He,aiHtml:Ke}=ge.data;if(re(Fe=>{const qe=[...Fe];for(let so=qe.length-1;so>=0;so--)if(qe[so]?.data?.isLoading&&qe[so]?.data?.role==="assistant"){qe[so]={data:{role:"assistant",message:He,isLoading:!1}};break}return qe}),Ke){const Fe=ga(n(),String(Ke));d(Fe,{undoable:!0})}return to(),!0},[n,d,to]),O=(0,a.useCallback)(ge=>{re(He=>{for(let Ke=He.length-1;Ke>=0;Ke--)if(He[Ke]?.data?.isLoading&&He[Ke]?.data?.role==="assistant"){const Fe=[...He];return ge?Fe[Ke]={data:{role:"assistant",message:ge}}:Fe.splice(Ke,1),Fe}return He})},[]),se=(0,a.useCallback)(ge=>{const He=ge?.message==="ERROR"?void 0:ge?.message;return[ge?.data?.message,He].find(Ke=>typeof Ke=="string"&&Ke)||c("Something went wrong.")},[c]),w=s?.get().docId,y=r.useEventEmitter(yo.events.AI_TEXT_PROGRESS_ID);(0,a.useEffect)(()=>{const ge=y.event(({progress:He,status:Ke,docId:Fe})=>{if(Fe!==w)return;const qe=Ke||`${Math.round(He)}%`;re(so=>{const To=[...so];for(let T=To.length-1;T>=0;T--)if(To[T]?.data?.isLoading&&To[T]?.data?.role==="assistant"){To[T]={data:{...To[T].data,message:qe}};break}return To})});return()=>ge.dispose()},[y,w]);const ce=r.useEventEmitter(yo.events.AI_TEXT_STREAM_ID);(0,a.useEffect)(()=>{const ge=ce.event(({partialHtml:He,docId:Ke})=>{if(Ke!==w)return;const Fe=ga(n(),String(He));d(Fe,{undoable:!0})});return()=>ge.dispose()},[ce,n,d,g,w]);const Ie=(0,a.useCallback)(ge=>{_e(!0),P(!0),r.swallowPromiseRejection(Ee({task_id:ge||I,entity_id:R,status:"started"}).then(()=>{eo()}))},[R,Ee,I,eo]),Xe=(0,a.useCallback)(()=>{Ee({task_id:I,entity_id:R,status:"completed"}).then(ge=>{ge.data.status===403&&oe(),eo()}).catch(ge=>{}),P(!1),_e(!1)},[R,Ee,I,eo,oe]);(0,a.useEffect)(()=>{let ge;if(ae){const He=ie[ie.length-1]?.processing?.email;if(He){let Ke=ie[ie.length-1].status;d(String(He),{undoable:!0}),Ke===0&&Xe()}me&&(clearInterval(ge),_e(!1),je(!1),P(!1),O())}return()=>{clearInterval(ge)}},[d,me,g,ie,ae,he,be,R,I,eo,Ee,ee,Xe,O]),(0,a.useEffect)(to,[to]),(0,a.useEffect)(()=>{e?.length>0&&re(e),Y({operation:r.EVENT_TYPES.SANDBOX_EMAIL_CONTENT_GET})},[e,Y]),(0,a.useEffect)(()=>{const ge=V.onInit(()=>{V.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:L}),V.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_DISCUSS,value:L})});return()=>ge.dispose()},[L,V]);const oo=async()=>{if(z&&!B()){const ge=z.replaceAll(/\n/g,"<br>"),He={project_id:x,connection:"chat",entity_id:R,message:ge,locale:K,subject:he||"",preheader:be||"",textContent:ui.extractDocumentTextContent(n())};if(Le&&Ce||de){k.error({title:c(Le?"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 Ke={data:{role:"assistant",message:c(Le?"You have reached the limit of AI generator usage.":"You have reached the limit of AI chat usage.")}};re(Fe=>[...Fe,Ke])}else{if(!await Pe(Le?"email_generate":"ai")){le("");return}Ze&&(Le&&ue!==Ge?(pe(),Ve(Fe=>Fe+1)):U!==Ae&&(G(),v(Fe=>Fe+1))),j({event:"submit_form",action:"chat_whit_ai_assistant",entity_id:He.entity_id,project_id:He.project_id});const Ke=[{data:{role:"user",message:ge,userInfo:{display_name:Q,avatar_url:q}}},{data:{role:"assistant",message:c("Typing..."),isLoading:!0}}];re(Fe=>[...Fe,...Ke]),Be({body:He}).then(Fe=>{if(Fe?.error)throw Fe.error;if(!Fe?.data||Fe.data.status===401)throw new Error(r.ERROR);if(!no(Fe)){if(j({event:"submit",action:"send_discussion_chat_message",entity_type:l==="block"?"block":"email",entity_id:R,project_id:x,context:"editor"}),Fe.data.task_id){let qe=Fe.data.task_id;$(qe),D({id:qe,setError:je}),r.swallowPromiseRejection(We().then(so=>{so?Ie(qe):te(!0)}))}eo()}}).catch(Fe=>{const qe=se(Fe);k.error({title:Fe?.data?.code||c("Error"),description:qe}),O(qe)})}le("")}},po=async ge=>{if(B())return;const He={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};re(Fe=>[...Fe,He]);const Ke={project_id:x,connection:"chat",entity_id:R,context:ge,locale:K,subject:he||"",preheader:be||"",textContent:ui.extractDocumentTextContent(n())};if(Ze&&(Le&&ue!==Ge?(pe(),Ve(Fe=>Fe+1)):U!==Ae&&(G(),v(Fe=>Fe+1))),de)k.error({title:c("You have reached the limit of AI chat usage."),description:c("Please upgrade your plan.")}),O(c("You have reached the limit of AI chat usage."));else{if(!await Pe("ai")){O();return}j({event:"select",action:"select_ai_assistant_role",context:Ke.context,entity_id:Ke.entity_id,project_id:Ke.project_id}),Be({body:Ke}).then(Fe=>{if(Fe?.error)throw Fe.error;if(!Fe?.data||Fe.data.status===401)throw new Error(r.ERROR);no(Fe)||eo()}).catch(Fe=>{const qe=se(Fe);k.error({title:Fe?.data?.code||c("Error"),description:qe}),O(qe)})}},co=(0,a.useCallback)(async ge=>{const He={data:{role:"user",message:ge,userInfo:{display_name:Q,avatar_url:q}}},Ke={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};re(qe=>[...qe,He,Ke]);const Fe={project_id:x,connection:"chat",entity_id:R,message:ge,locale:K,subject:he||"",preheader:be||"",textContent:ui.extractDocumentTextContent(n())};if(Ce)k.error({title:c("You have reached the limit of AI generator usage."),description:c("Please upgrade your plan.")}),O(c("You have reached the limit of AI chat usage."));else{if(!await Pe(Le?"email_generate":"ai")){O();return}Be({body:Fe}).then(qe=>{if(qe?.error)throw qe.error;if(!qe?.data||qe.data.status===401)throw new Error(r.ERROR);if(!no(qe)){if(j({event:"submit",action:"send_discussion_chat_message",entity_type:l==="block"?"block":"email",entity_id:R,project_id:x,context:"editor"}),qe.data.task_id){let so=qe.data.task_id;$(so),D({id:so,setError:je}),r.swallowPromiseRejection(We().then(To=>{To?Ie(so):te(!0)}))}Ze&&(Le&&ue!==Ge?(pe(),Ve(so=>so+1)):U!==Ae&&(G(),v(so=>so+1))),eo()}}).catch(qe=>{const so=se(qe);k.error({title:qe?.data?.code||c("Error"),description:so}),O(so)})}},[c,U,ue,q,We,O,Ie,se,Q,Ae,Ge,Z,he,be,R,Le,Ce,K,G,pe,Ze,n,k,Pe,x,Be,D,eo]);(0,a.useEffect)(()=>{const ge=new yo.Disposable,He=window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings);if((!e?.length||e.length===1&&e[0]?.data?.role==="assistant")&&He&&R&&!p){const Ke={project_id:x,connection:"chat",entity_id:R,context:"email-generator",locale:K};Lu(`discuss-ai-generator-context:${R}`,()=>{if(Ye){window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),co(He);return}r.swallowPromiseRejection(X({body:Ke}).then(()=>{window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),ge.isDisposed()||co(He)}))})}return()=>ge.dispose()},[e,co,R,K,x,X,Ye,p]);const _o=ge=>{typeof ge.target.className=="string"&&ge.target.className.includes("ai-response-change-context")&&(ee.isLoading||po(ge.target.role))},Io=ge=>{if(B())return;const He=ge.children[0].data??"";ha("subject",He,N),k.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Title copied to email settings"),data:He})},Co=ge=>{if(B())return;const He=ge.children[0].data??"";ha("preheader",He,N),k.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Preheader copied to email settings"),data:He,duration:300})},F=ge=>{const He=ge.children[0].data;navigator.clipboard.writeText(He).then(()=>{k.success({id:"TEXT_COPIED_TO_CLIPBOARD",title:c("Text copied to clipboard"),data:He})}).catch(Ke=>{})},J={replace:ge=>{if(ge.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:()=>Io(ge),children:(0,o.jsx)("span",{className:"ai-response-title",children:(0,ht.domToReact)(ge.children,J)})})});if(ge.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:()=>Co(ge),children:(0,o.jsx)("span",{className:"ai-response-preheader",children:(0,ht.domToReact)(ge.children,J)})})});if(ge.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:()=>F(ge),children:(0,o.jsx)("span",{className:"ai-response-copy",children:(0,ht.domToReact)(ge.children,J)})})});if(ge.attribs?.class?.split(" ").includes("ai-response-user-message")){const He=ge.attribs?.data||ge.children?.[0]?.data;return(0,o.jsx)("li",{className:ge.attribs?.class,data:ge.attribs?.data,onClick:()=>co(He),children:(0,ht.domToReact)(ge.children,J)})}}},ye=()=>{Ie(),te(!1)},Me=()=>{Xe(),te(!1)};return(0,o.jsxs)("div",{ref:_,className:"discuss-main",children:[C.length>0&&(0,o.jsx)(t.ui_kit$List,{onClick:_o,className:"comment-list",itemLayout:"horizontal",dataSource:C,renderItem:ge=>(0,o.jsx)("li",{id:ge._id,children:(0,o.jsx)(t.ui_kit$Comment,{className:ge.data.userInfo?"":"ai-comment",avatar:ge.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"}}):ge.data.userInfo&&ge.data._modified?ge.data.userInfo.avatar_url:q||(0,o.jsx)(r.EmIcons,{icon:"UserOutlined",component:t.icons$UserOutlined,className:"anticon-user",style:{color:"#ffffff",fontSize:16,width:24,height:24,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"}}),author:(0,o.jsx)("div",{style:W,children:ge?.data?.role==="user"?Z?.username||c("User"):c("AI Assistant")}),datetime:ge._created?(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:r.formatDate(r.parseISO(ge._created),m,!0)}}):null,content:ge.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:W,children:Nu(ge.data.message,J)})})},ge._id)}),Se&&(Le?(0,o.jsx)(t.ui_kit$LimitsCounter,{text:`${ue} ${c("of")} ${Ge>0?Ge:"∞"} ${c("mail generator")} ${m("was used","were used",ue)}`,exceeded:Ge>0&&ue>=Ge,style:{marginTop:-25},extra:(0,o.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>b(h.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})}):(0,o.jsx)(t.ui_kit$LimitsCounter,{text:`${U} ${c("of")} ${Ae>0?Ae:"∞"} ${c("messeges")} ${m("was used","were used",U)}`,exceeded:Ae>0&&U>=Ae,style:{marginTop:-25},extra:(0,o.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>b(h.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})})),(0,o.jsxs)(t.ui_kit$Form,{onFinish:oo,className:"addMode",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{disabled:L||p,value:z,onChange:ge=>le(ge.target.value),rows:4,placeholder:c("Type your request"),className:"textarea-comment",onPressEnter:ge=>ge.key==="Enter"&&ge.ctrlKey&&oo(),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:ee.isLoading||L||p,type:"default",style:Fu,className:"button-target",children:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"top",disabled:L,arrow:{pointAtCenter:!0},menu:{items:$u(po)},children:(0,o.jsxs)("div",{disabled:L,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:ee.isLoading||L||p,className:"button-add",type:"primary",htmlType:"submit",children:[c("Send")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:h.iconStrokeWidth})]})]})})]}),(0,o.jsx)(t.ui_kit$Modal,{title:c("Warning"),open:Te,onOk:ye,onCancel:Me,children:(0,o.jsx)("p",{children:c("The current template will be changed to the generated one, are you sure about this?")})})]})},Mu=[r.VALID,r.ERRORS,r.WARNINGS],_a=({summary:e,__:i,selectedTags:l,setSelectedTags:s})=>{const n=(0,a.useCallback)((c,m)=>{s(m?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:Mu.map((c,m)=>(0,o.jsxs)(t.ui_kit$CheckableTag,{checked:l?.includes(c),onChange:g=>n(c,g),className:(0,ze.default)(`${c} optimise__button`,{[`${c}_active`]:l.includes(c)}),children:[d(c),": ",e?.[c]||0]},c+m))})})},{LINKS:Du}=r.OPTIMISE_TABS,xa=(0,a.memo)(({__:e,activeTab:i,validateLinksResult:l,validateLinks:s,selectedTags:n,setSelectedTags:d,isLoading:c,disabled:m,iconStrokeWidth:g,onValidate:b,goToLinkHandler:_})=>i!==Du||!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)(_a,{__:e,summary:l.summary,setSelectedTags:d,selectedTags:n}),(0,o.jsx)(t.ui_kit$Button,{disabled:m,loading:c,onClick:b,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:(h,p)=>(0,o.jsx)(t.ui_kit$List.Item,{className:t.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{avatar:h.status==="valid"?(0,o.jsx)(r.EmIcons,{icon:"CheckCircleFilled",component:t.icons$CheckCircleFilled,className:r.VALID}):h.status==="warnings"?(0,o.jsx)(r.EmIcons,{icon:"CheckCircleFilled",component:t.icons$CheckCircleFilled,className:r.WARNINGS}):(0,o.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:t.icons$CloseCircleFilled,className:r.ERRORS}),title:(0,o.jsx)(t.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>_(h.linkId,600>(h.statusCode||0)&&(h.statusCode||0)>399||!h.statusCode),children:h.url===""?e("empty link"):h.url}),description:(0,o.jsxs)(o.Fragment,{children:[!!h.text?.length&&(0,o.jsx)(t.ui_kit$Text,{type:"secondary",children:h.text}),h.page?.title&&h.page.title,h.page?.secure&&h.status==="valid"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)("span",{className:"valid",children:e("secure")})]}),!h.resolvedUrl&&!h.statusCode&&h.type==="url"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)(t.ui_kit$Text,{type:"secondary",children:e("Failed to load")})]})]})})},p+"_"+h.linkId)})})})]}));xa.displayName="LinksSection";var{IMAGES:Vu}=r.OPTIMISE_TABS,ka=(0,a.memo)(({__:e,activeTab:i,validateImagesResult:l,validateImages:s,selectedTags:n,setSelectedTags:d,isLoading:c,disabled:m,iconStrokeWidth:g,onValidate:b,goToImageHandler:_,showImgPreviewHandler:h,hideBlockPreviewHandler:p})=>i!==Vu||!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(B=>B.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)(_a,{__: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:m,loading:c,onClick:b,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:(B,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,ze.default)("image-item__meta",{"image-item__meta_fail":!B.resolvedUrl&&!B.statusCode}),avatar:(0,o.jsx)(t.ui_kit$Image,{className:(0,ze.default)("image-item__image optimise__image-auto-height",{"image-item__image_fail":!B.resolvedUrl||!B.valid}),width:92,height:"auto",src:B.resolvedUrl||"",preview:!1,onMouseEnter:()=>h(B.url,B.image.dimensions?.width),onMouseLeave:()=>p()}),title:B.url?(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:B.message,children:(0,o.jsx)(t.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>_(B.imageId,600>(B.statusCode||0)&&(B.statusCode||0)>399||!B.statusCode),children:B?.url===""?e("empty src"):B.url})}):B.message,description:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"image-size",children:[B.image.dimensions&&(0,o.jsxs)(o.Fragment,{children:[B.image.dimensions.width+" × "+B.image.dimensions.height,(0,o.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,o.jsxs)("span",{children:[Math.round(B.image.bytes/1024),e("kB")]}),(0,o.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,o.jsxs)("span",{children:[B.image.responseTime,e("ms")]}),(0,o.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,o.jsx)("span",{className:"image-size-format",children:Zo.normalizeImageFormatForDisplay(B.image.contentType)})]}),B.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")})]}),B.resolvedUrl&&!B.valid&&(0,o.jsx)(t.ui_kit$Text,{type:"danger",children:e("not valid")})]}),!B.resolvedUrl&&!B.statusCode&&(0,o.jsx)(t.ui_kit$Text,{type:"danger",children:e("Failed to load")})]})})},k)})})})]}));ka.displayName="ImagesSection";var{SPAM_ASSASSIN:Hu}=r.OPTIMISE_TABS,Ea=(0,a.memo)(({__:e,activeTab:i,validateSpamResult:l,isLoading:s,disabled:n,iconStrokeWidth:d,onValidate:c})=>{const m=l?.report?.length||Object.prototype.hasOwnProperty.call(l,"spamScore");if(i!==Hu||!m)return null;const g=l.spamScore||0,b=l.baseSpamScore||0,_=g<2||!l.spamScore||g<=b-1?"success":g<b-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>b-1&&(0,o.jsx)(t.ui_kit$Text,{children:e("Lower scores are better. Aim for a score less than ")+(b-1)+"."})]}),(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-8",children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(l.report?.length||0)>0?(0,o.jsx)(t.ui_kit$List,{itemLayout:"horizontal",dataSource:l.report,renderItem:h=>(0,o.jsx)(t.ui_kit$List.Item,{className:t.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{title:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Text,{className:"optimise__spam-report-score",children:h.score}),(0,o.jsx)("span",{className:"optimise__spam-report-description",children:h.description})]})})})}):(0,o.jsx)(o.Fragment,{children:l.spamScore===0&&e("Your email doesn't look like spam.")})})})]})});Ea.displayName="SpamSection";var{PROBLEMS:Uu}=r.OPTIMISE_TABS,Ba=(0,a.memo)(({__:e,activeTab:i,problemsList:l,onSetMonacoPosition:s})=>i!==Uu?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,ze.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"})}));Ba.displayName="ProblemsSection";var zu={activeTab:"",selectedTags:[],validateLinks:[],validateImages:[],validateSpamResult:{},validateLinksResult:{},validateImagesResult:{}},Wu=(e,i)=>{switch(i.type){case"SET_ACTIVE_TAB":return{...e,activeTab:i.payload!==e.activeTab?i.payload:""};case"SET_SELECTED_TAGS":return{...e,selectedTags:i.payload};case"SET_VALIDATE_LINKS":return{...e,validateLinks:i.payload};case"SET_VALIDATE_IMAGES":return{...e,validateImages:i.payload};case"SET_VALIDATE_SPAM_RESULT":return{...e,validateSpamResult:i.payload};case"SET_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 Gu(){const e=r.useContainer(),i=(0,a.useMemo)(()=>{if(!e)throw new Error("[optimise] нет DI-контейнера стора");return mi.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 Yu=()=>{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:Xu,IMAGES:Ku}=r.OPTIMISE_TABS,qu=({activeTab:e,selectedTags:i,validateLinksResult:l,validateImagesResult:s,setValidateLinks:n,setValidateImages:d})=>{(0,a.useEffect)(()=>{e===Xu&&l.links&&n(i.length>0?l.links.filter(c=>i.includes(c.status)):l.links),e===Ku&&s.images&&d(i.length>0?s.images.filter(c=>i.includes(c.status)):s.images)},[l.links,s.images,i,e,n,d])},Ju={ai:(0,o.jsx)(r.EmIcons,{icon:"AIRequests",component:t.icons$AIRequests}),email_generate:(0,o.jsx)(r.EmIcons,{icon:"EmailEnvelope",component:t.icons$EmailEnvelope}),image_generate:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image}),optimization:(0,o.jsx)(r.EmIcons,{icon:"Optimization",component:t.icons$Optimization}),preview:(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined}),test_sends:(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined}),link_check:(0,o.jsx)(r.EmIcons,{icon:"Web",component:t.icons$Web}),image_check:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image}),spam_check:(0,o.jsx)(r.EmIcons,{icon:"Block",component:t.icons$Block}),projects:(0,o.jsx)(r.EmIcons,{icon:"FolderOpen",component:t.icons$FolderOpen}),emails:(0,o.jsx)(r.EmIcons,{icon:"EmailEnvelope",component:t.icons$EmailEnvelope}),blocks:(0,o.jsx)(r.EmIcons,{icon:"Block",component:t.icons$Block}),users:(0,o.jsx)(r.EmIcons,{icon:"SliderGroup",component:t.icons$SliderGroup})};function Sa(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 ci=({open:e,onClose:i,title:l,subtitle:s,usageResource:n,icon:d,previousDisplay:c,nextDisplay:m,onChangePlan:g,secondaryAction:b,changePlanLabel:_})=>{const{__:h}=r.useI18n(),p=_??h("Change plan"),B=!!b,k=n!=null?Ju[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":h("Close"),children:(0,o.jsx)(r.EmIcons,{icon:"CloseOutlined",component:t.icons$CloseOutlined})})}),(0,o.jsxs)("div",{className:"limit-upgrade-modal__body",children:[(0,o.jsx)("h1",{className:"limit-upgrade-modal__title",children:l}),(0,o.jsx)("p",{className:"limit-upgrade-modal__subtitle",children:s}),(0,o.jsxs)("div",{className:"limit-upgrade-modal__limits-row",children:[(0,o.jsx)("div",{className:"limit-upgrade-modal__icon-circle","aria-hidden":!0,children:k}),Sa(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"})}),Sa(m,"new")]})]}),(0,o.jsx)("hr",{className:"limit-upgrade-modal__divider"}),(0,o.jsx)("div",{className:B?"limit-upgrade-modal__footer limit-upgrade-modal__footer--dual":"limit-upgrade-modal__footer",children:b?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Button,{className:"limit-upgrade-modal__cta-secondary",onClick:b.onClick,children:b.label}),(0,o.jsx)(t.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:g,children:p})]}):(0,o.jsx)(t.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:g,children:p})})]})})},{LINKS:hr,IMAGES:br,SPAM_ASSASSIN:Ta,PROBLEMS:gr}=r.OPTIMISE_TABS,Ra={textDecoration:"underline",cursor:"pointer",background:"none",border:"none",padding:0,font:"inherit",color:"inherit"},ya={link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"},wa=(e,i,l,s)=>`${e} ${l("of")} ${i>0?i:"∞"} ${s("test","tests",i>0?i:e)} ${s("was used","were used",e)}`,ja=()=>{const{__:e,_n:i}=r.useI18n(),l=r.useDispatch(),s=r.useOpenPlanCatalog(),n=r.useAppNavigate(),d=r.useNotification(),c=r.useContentReader(),m=r.useAppConfig(),g=r.useEditorProjectId(),b=r.useRouteEmailId(),{document:_}=r.useDocumentSessionContext(),h=r.useEmailOfDocument(_,void 0),p=b||(h?.id!=null?String(h.id):void 0);r.useWpEntityId();const B=p||h?.renderGuid,k=g||(h?.project!=null?String(h.project):void 0),[x,R]=(0,a.useState)(null),j=(0,a.useRef)(!1),N=(0,a.useRef)({link_check:!1,image_check:!1,spam_check:!1}),E=(0,a.useCallback)(oe=>{R(oe)},[]),I=r.useMessageService(),$=r.useSelector(r.selectProblemsList),U=r.usePushToDataLayer(),[v,L]=(0,a.useReducer)(Wu,zu),{checks:P,limits:z,running:le}=Gu(),{limitsInPlugin:C,perTypeAvailable:re,aggregateLimit:ae,aggregateCounter:_e,disableFields:Te,typeLimits:te}=z,me=(0,a.useCallback)(oe=>mi.isOptimiseTypeDisabled(z,oe),[z]),je=(0,a.useCallback)(oe=>L({type:"SET_VALIDATE_LINKS",payload:oe}),[]),ue=(0,a.useCallback)(oe=>L({type:"SET_VALIDATE_IMAGES",payload:oe}),[]),Ve=(0,a.useCallback)(oe=>L({type:"SET_SELECTED_TAGS",payload:oe}),[]);qu({activeTab:v.activeTab,selectedTags:v.selectedTags,validateLinksResult:v.validateLinksResult,validateImagesResult:v.validateImagesResult,setValidateLinks:je,setValidateImages:ue});const{showImgPreviewHandler:Le,hideBlockPreviewHandler:ve}=Yu(),he=(0,a.useCallback)(oe=>{if(re){const{limit:D}=te[oe];E({presetId:ya[oe],previousDisplay:D>0?D:r.presetLimitDisplay("infinity"),nextDisplay:r.presetLimitDisplay("infinity")});return}E({presetId:"optimization_exceeded",previousDisplay:ae,nextDisplay:r.presetLimitDisplay("infinity")})},[re,te,E,ae]),be=(0,a.useCallback)((oe,D)=>{switch(oe.reason){case"notSaved":d.error({title:"Save the mail first."});return;case"typeLimit":he(oe.type);return;case"planLimit":E({presetId:oe.exceeded.presetId,previousDisplay:oe.exceeded.previousLimit,nextDisplay:r.presetLimitDisplay(oe.exceeded.nextLimit)});return;case"usageLimit":E({presetId:ya[oe.type],previousDisplay:e("—"),nextDisplay:r.presetLimitDisplay("infinity")});return;case"failed":{if("error"in oe){d.error({error:oe.error});return}const ie=oe.data;(ie?.statusCode??0)>300||!ie?.success?d.error({error:{data:ie}}):d.error({title:e("Something went wrong.")}),D();return}default:return}},[d,he,E,e]),Z=(0,a.useCallback)(oe=>{oe!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${oe}`})},[d,e]),K=(0,a.useCallback)(()=>{n(m.billingPageUrl||r.APP_ROUTES.billing)},[m.billingPageUrl,n]),q=oe=>{if(!C||!re)return null;const{counter:D,limit:ie,disabled:we}=te[oe];return(0,o.jsx)(t.ui_kit$LimitsCounter,{text:wa(D,ie,e,i),exceeded:we,extra:(0,o.jsx)("button",{type:"button",style:Ra,onClick:K,children:e("Need more?")})})},Q=(0,a.useCallback)((oe,D)=>{I.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_LINK,settings:{elementId:oe,isError:D}})},[I]),V=(0,a.useCallback)((oe,D)=>{I.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_IMG,settings:{elementId:oe,isError:D}})},[I]),M=(0,a.useCallback)(oe=>{const D={startColumn:oe.startColumn,startLineNumber:oe.startLineNumber,endColumn:oe.endColumn,endLineNumber:oe.endLineNumber};l(r.setActiveProblemRange(D))},[l]),Y=(0,a.useCallback)(oe=>{L({type:"SET_ACTIVE_TAB",payload:oe}),L({type:"RESET_SELECTED_TAGS"}),oe===gr&&$?.length>0&&U({event:"check",action:"check_email_code",email_id:p,project_id:k,problems_count:$?.length||0})},[$,U,p,k]),X=(0,a.useCallback)(oe=>({entityId:B??"",readContent:c,beforeRequest:oe}),[B,c]),ee=(0,a.useCallback)(async()=>{const oe=await P.run("link_check",X(()=>I.send({operation:"sandbox_set_attr_to_links"})));if(oe.ok===!1){be(oe,()=>!v.validateLinksResult.links&&Y(""));return}L({type:"SET_VALIDATE_LINKS_RESULT",payload:oe.value}),d.success(e("Links validation was successfully completed")),Z(oe.limitRemaining),U({event:"check",action:"check_email_links",email_id:p,project_id:k,links_count:oe.value.links?.length||0})},[P,X,I,be,v.validateLinksResult.links,Y,d,e,Z,U,p,k]),ne=(0,a.useCallback)(async()=>{const oe=await P.run("image_check",X(()=>I.send({operation:"sandbox_set_attr_to_images"})));if(oe.ok===!1){be(oe,()=>!v.validateImagesResult?.images?.length&&Y(""));return}const{images:D,summary:ie,totalKb:we}=oe.value,W={images:D||[],summary:ie,summaryTime:{value:(we>1200?we/1e3:we).toFixed(1),name:we>1200?e("MB"):e("KB")}};L({type:"SET_VALIDATE_IMAGES_RESULT",payload:W}),d.success(e("Images validation was successfully completed")),Z(oe.limitRemaining),U({event:"check",action:"check_email_images",email_id:p,project_id:k,images_count:W.images?.length||0})},[P,X,I,be,v.validateImagesResult,Y,d,e,Z,U,p,k]),Be=(0,a.useCallback)(async()=>{const oe=await P.run("spam_check",X());if(oe.ok===!1){be(oe,()=>!v.validateSpamResult?.report?.length&&Y(""));return}L({type:"SET_VALIDATE_SPAM_RESULT",payload:oe.value}),d.success(e("Spam validation was successfully completed")),Z(oe.limitRemaining),U({event:"check",action:"check_email_spam",email_id:p,project_id:k,spam_score:oe.value.spamScore||0})},[P,X,be,v.validateSpamResult,Y,d,e,Z,U,p,k]);(0,a.useEffect)(()=>{if(C){if(re){mi.OPTIMISE_LIMIT_TYPES.forEach(oe=>{const{limit:D,counter:ie,disabled:we}=te[oe];if(!we){N.current[oe]=!1;return}N.current[oe]||D>0&&ie>=D&&(N.current[oe]=!0,he(oe))});return}if(!(ae>0&&_e>=ae)){j.current=!1;return}j.current||(j.current=!0,he("link_check"))}},[C,re,te,_e,ae,he]);const Ee=x?r.getLimitUpgradePresetDefinition(x.presetId):null;return(0,o.jsxs)("div",{className:"optimise selected_form-props-wrapper selected_form-props-wrapper_optimize",children:[Ee&&x?(0,o.jsx)(ci,{open:!0,onClose:()=>R(null),title:e(Ee.titleKey),subtitle:e(Ee.subtitleKey),usageResource:Ee.usageResource,previousDisplay:x.previousDisplay,nextDisplay:x.nextDisplay,onChangePlan:()=>{R(null),s()}}):null,C&&!re&&(0,o.jsx)(t.ui_kit$LimitsCounter,{text:wa(_e,ae,e,i),exceeded:Te,extra:(0,o.jsx)("button",{type:"button",style:Ra,onClick:K,children:e("Need more?")})}),m.optimizeLinksEnabled&&(0,o.jsxs)(o.Fragment,{children:[q("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:oe=>oe.preventDefault(),onClick:()=>{Y(hr),!v.validateLinksResult?.links?.length&&v.activeTab!==hr&&ee()},loading:le.link_check,disabled:me("link_check")&&!v.validateLinksResult?.links?.length,children:!le.link_check&&(v.activeTab===hr?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:m.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:m.iconStrokeWidth}))})})]}),(0,o.jsx)(xa,{__:e,activeTab:v.activeTab,validateLinksResult:v.validateLinksResult,validateLinks:v.validateLinks,selectedTags:v.selectedTags,setSelectedTags:Ve,isLoading:le.link_check,disabled:me("link_check"),iconStrokeWidth:m.iconStrokeWidth,onValidate:ee,goToLinkHandler:Q})]}),m.optimizeImagesEnabled&&(0,o.jsxs)(o.Fragment,{children:[q("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:oe=>oe.preventDefault(),onClick:()=>{Y(br),!v.validateImagesResult?.images?.length&&v.activeTab!==br&&ne()},loading:le.image_check,children:!le.image_check&&(v.activeTab===br?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:m.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:m.iconStrokeWidth}))})})]}),(0,o.jsx)(ka,{__:e,activeTab:v.activeTab,validateImagesResult:v.validateImagesResult,validateImages:v.validateImages,selectedTags:v.selectedTags,setSelectedTags:Ve,isLoading:le.image_check,disabled:me("image_check"),iconStrokeWidth:m.iconStrokeWidth,onValidate:ne,goToImageHandler:V,showImgPreviewHandler:Le,hideBlockPreviewHandler:ve})]}),m.optimizeSpamAssassinEnabled&&(0,o.jsxs)(o.Fragment,{children:[q("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:oe=>oe.preventDefault(),loading:le.spam_check,onClick:()=>{Y(Ta),v.validateSpamResult.report?.length||Object.prototype.hasOwnProperty.call(v.validateSpamResult,"spamScore")||Be()},disabled:me("spam_check")&&!(v.validateSpamResult?.report?.length||Object.prototype.hasOwnProperty.call(v.validateSpamResult,"spamScore")),children:!le.spam_check&&(v.activeTab===Ta?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:m.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:m.iconStrokeWidth}))})})]}),(0,o.jsx)(Ea,{__:e,activeTab:v.activeTab,validateSpamResult:v.validateSpamResult,isLoading:le.spam_check,disabled:me("spam_check"),iconStrokeWidth:m.iconStrokeWidth,onValidate:Be})]}),m.optimizeCheckCodeEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,align:"middle",children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsx)("div",{style:{padding:"15px 0"},children:e("Source code validation")})}),(0,o.jsx)(t.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,o.jsx)(t.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:oe=>oe.preventDefault(),onClick:()=>Y(gr),children:v.activeTab===gr?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:m.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:m.iconStrokeWidth})})})]}),(0,o.jsx)(Ba,{__:e,activeTab:v.activeTab,problemsList:$,onSetMonacoPosition:M})]})]})},Qu=({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:[Zu(e,n),(0,o.jsx)(t.ui_kit$Flex,{justify:"flex-end",children:em(e,{onCancel:i,onRetry:l,onDismiss:s},n)})]})})})};function Zu(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 em(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 om=2500,Ia=48,tm=4e3;function im(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 rm(e){return e.kind==="done"||e.kind==="failed"||e.kind==="cancelled"}function lm({projectId:e,api:i,triggered:l,onCompleted:s}){const[n,d]=(0,a.useState)({kind:"hidden"}),c=(0,a.useRef)(!1),m=(0,a.useRef)(!0),g=(0,a.useRef)(e);g.current=e;const b=(0,a.useRef)(l);b.current=l;const _=(0,a.useRef)(s);_.current=s,(0,a.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]),(0,a.useEffect)(()=>{d({kind:"hidden"})},[e]);const h=(0,a.useCallback)(async()=>{try{const B=await i.files.backfillList({project_id:e});return!B.ok||B.error?null:im(B.data)}catch{return null}},[i,e]),p=(0,a.useCallback)(async()=>{if(c.current)return;c.current=!0;const B=g.current;let k=0;try{for(;m.current&&g.current===B&&b.current;){const x=await h();if(!m.current)break;if(x)if(x.kind==="hidden"){if(k+=1,k>=Ia){d({kind:"failed"});break}}else{if(k=0,d(x),x.kind==="done")try{await _.current?.()}catch{}if(rm(x))break}else if(k+=1,k>=Ia){d({kind:"failed"});break}await new Promise(R=>setTimeout(R,om))}}finally{c.current=!1}},[h]);return(0,a.useEffect)(()=>{l&&p()},[l,p]),(0,a.useEffect)(()=>{if(n.kind!=="done")return;const B=setTimeout(()=>{m.current&&d({kind:"hidden"})},tm);return()=>clearTimeout(B)},[n.kind]),{state:n,cancel:(0,a.useCallback)(()=>{d(B=>B.kind==="scanning"||B.kind==="indexing"?{...B,cancelling:!0}:B),i.files.backfillCancelCreate({project_id:e})},[i,e]),retry:(0,a.useCallback)(()=>{b.current=!0,i.files.backfillCreate({project_id:e}),p()},[i,e,p]),dismiss:(0,a.useCallback)(()=>d({kind:"hidden"}),[])}}var sm=r.lazyRoute(()=>(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>fo("./c8cfd469.js")),void 0,{}.url)),am=r.lazyRoute(()=>(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>fo("./38606c7d.js")),void 0,{}.url)),va={height:"100%"};function nm(e){(e?(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>fo("./c41fa010.js")),void 0,{}.url):(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>fo("./7a43af5d.js")),void 0,{}.url)).catch(()=>{})}var dm=({storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,contentKey:n})=>{const d=r.useAppConfig(),c=r.isImageEditModal(r.useSelector(r.selectActiveModal$1)),m=!!d.imageCenterFileManagerView;(0,a.useEffect)(()=>{c&&nm(m)},[c,m]);let g=(0,o.jsx)(t.ui_kit$PageLoader,{style:va});return e&&i&&d.imageCenterFileManagerView?g=(0,o.jsx)(sm,{storageProvider:e,dataProvider:i,pathProxy:l},n):e&&i&&(g=(0,o.jsx)(am,{dataProvider:i,usesBuiltInStorage:s},n)),(0,o.jsx)(a.Suspense,{fallback:(0,o.jsx)(t.ui_kit$PageLoader,{style:va}),children:g})};function cm(){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]),m=r.useI18n(),g=r.useCurrentUser(),b=s?.id?String(s.id):"",_=g?.id!=="0"?String(g.id):"",h=r.isFileManagerV2Enabled(e),[p,B]=(0,a.useState)(null),k=h&&!!b&&p===b,[x,R]=(0,a.useState)(0),[j,N]=(0,a.useState)(0),E=(0,a.useRef)(b);(0,a.useEffect)(()=>{E.current!==b&&(E.current=b,B(null))},[b]);const I=(0,a.useCallback)(L=>{L&&b&&B(b)},[b]),$=(0,a.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:l,projectId:b,restApi:n,restApiV2:c,i18n:m,pathPostfix:_,appConfig:e,isStandalone:i,onIndexingStateChange:I}),[e,I,m,i,b,x,n,c,l,_]),U=(0,a.useCallback)(async()=>{try{typeof $.dataProvider?.clearCache=="function"&&await $.dataProvider.clearCache()}catch{}B(null),R(L=>L+1),N(L=>L+1)},[$.dataProvider]),v=(0,a.useCallback)(()=>{b&&B(b)},[b]);return{...$,projectId:b,restApiV2:c,v2Enabled:h,backfillTriggered:k,contentKey:`${b}:${j}`,handleIndexingCompleted:U,markIndexingStarted:v}}var um={height:"100%"},Ca=()=>{const{storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,projectId:n,restApiV2:d,v2Enabled:c,backfillTriggered:m,contentKey:g,handleIndexingCompleted:b,markIndexingStarted:_}=cm(),h=r.useSelector(r.selectActiveModal$1),p=r.isImageCenterModal(h),{state:B,cancel:k,retry:x,dismiss:R}=lm({projectId:n,api:d,triggered:m,onCompleted:b}),j=a.default.useCallback(()=>{_(),x()},[_,x]);return(0,o.jsxs)(o.Fragment,{children:[p&&(0,o.jsx)(a.Suspense,{fallback:(0,o.jsx)(t.ui_kit$PageLoader,{style:um}),children:(0,o.jsx)(dm,{storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,contentKey:g})}),c&&(0,o.jsx)(Qu,{state:B,onCancel:k,onRetry:j,onDismiss:R})]})},mm=(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 pm(e){return!!(e?.global_block??e?.acf?.global_block)}var hm=({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,ze.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})})})},Pa=new Map;function Aa(e){return`<table cellspacing="0" cellpadding="0" border="0" width="100%">${e}</table>`}function fr(e,i){const l=i??"";if(e===void 0)return r.sanitizeHtml(Aa(l));const s=String(e),n=Pa.get(s);if(n&&n.source===l)return n.markup;const d=r.sanitizeHtml(Aa(l));return Pa.set(s,{source:l,markup:d}),d}function bm(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function _r(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">${bm(e.title??"")}</td></tr>`}function gm(e,i){return e?i.openBlockFromEmailEnabled===!0?"over-email":null:"link"}var fm={fontSize:"16px",margin:0},{name:xr,type:Na,tags:La}={name:"name",type:"type",tags:"tags"},Oa={[xr]:"",[Na]:[],[La]:[]},bt={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},kr=({parentEmailId:e,blocksTab:i,search:l,reloadBlockScreens:s,setIsShowAddAllBlocksModal:n})=>{const{parentId:d}=r.useBlocksParentId(e),c=r.useEditorProjectId(),m=r.useSetHtmlElementInIframeHandler(),g=r.useDragStartBlockToIframeHandler(),[b]=t.ui_kit$Form.useForm(),{data:_}=r.useGetBlockTypesQuery(),{token:h}=(0,t.ui_kit$useToken)(),{__:p,_x:B}=r.useI18n(),k=r.useNotification(),{modal:x}=t.ui_kit$App.useApp(),{confirm:R}=x,j={pathname:r.useRoutePathname()},N=r.useAppConfig(),E=r.useSelector(r.selectParentBlocks),I=Ns(),$=(0,a.useRef)(null),U=(0,a.useRef)(null),v=r.useRootElement(),L=640,P=207/L,z=T=>pm(T)?(0,o.jsx)("div",{className:"blocks-search__result-global-mark",children:(0,o.jsx)(hm,{className:"block-global-badge--tile",size:14})}):null,le=r.useEmailAttribute("common_styles"),C=(0,a.useMemo)(()=>Os(le,I),[le,I]),re=(0,a.useRef)(null),ae=(0,a.useRef)(null),_e=(0,a.useRef)(null),Te=r.useStore(),te=(T,fe=!1)=>(S,Re,De,mo,Ue)=>{if(!r.isBlocksV2Enabled()){T(S,Re,De,mo,Ue);return}const Uo=Jo=>{if(Jo===void 0){k.error({id:"BLOCK_GET_ERROR",title:p("Failed to load")});return}if(Jo===Ue.html){T(S,Re,De,mo,Ue);return}T(S,De==="common"?ye({html:Jo}):Jo,De,mo,{...Ue,html:Jo})},gt=()=>Te.getState();if(!Nt.waitsForWrite(Ue)){Uo(Nt.freshBlockHtml(gt,Ue));return}(fe?Nt.blockHtmlForInsertOnce(gt,Ue):Nt.blockHtmlForInsert(gt,Ue))?.then(Uo)},me=te(m,!0),je=te(g);(0,a.useEffect)(()=>{U.current?.scrollTo({top:0})},[i,l]);const ue=r.useProjectData(),{data:Ve}=r.useGetTermsQuery({project:ue,kind:r.BLOCK_TAGS},{skip:!ue?.id}),[Le,ve]=(0,a.useState)(()=>r.projectBlocksArgs(c));(0,a.useEffect)(()=>{l||(b.setFieldsValue(Oa),w({type:null,name:null}),s())},[l,b,s]),(0,a.useEffect)(()=>{if(_){const T=_;let fe=[];for(let S in T)fe.push({label:p(r.TYPES_TRANSLATE[T[S]]),value:T[S]})}},[_,p]);const{isSuccess:he,isError:be,isLoading:Z,isFetching:K,data:q,currentData:Q,error:V}=r.useGetBlocksQuery({...Le,projectId:c,page:1}),M=(Z||K)&&!(he&&Q!==void 0),Y=(0,a.useMemo)(()=>{if(he&&q)return[...q].sort((T,fe)=>bt[T.type]-bt[fe.type])},[he,q]),[X,ee]=(0,a.useState)({list:void 0,ids:[]}),ne=(0,a.useMemo)(()=>X.list!==void 0&&X.list===Q?Y?.filter(T=>!X.ids.includes(T.id)):Y,[X,Q,Y]),[Be,Ee]=(0,a.useState)([]);r.usePrevious(T=>{T!==be&&k.fromError("BLOCK_GET_ERROR",{},V,!0)},[be,V,k]);const[oe,D]=(0,a.useState)(()=>r.parentEmailBlocksArgs(d,c)),{isSuccess:ie,isError:we,isLoading:W,isFetching:Se}=r.useGetParentEmailBlocksQuery({...oe,emailId:d,page:1,...r.pageProjectKey(c)},{skip:!d||E.length}),Oe=(0,a.useMemo)(()=>{if(ie||E.length)return[...E].sort((T,fe)=>bt[T.type]-bt[fe.type])},[ie,E]),[Ae,Ge]=(0,a.useState)([]);(0,a.useEffect)(()=>{const T=new Set;if(E.length&&Oe){for(const fe of Oe)fe.type&&T.add(fe.type);Ge(Array.from(T))}else Ge([])},[E,Oe]);const[Ye,Ze]=(0,a.useState)(()=>r.templateBlocksArgs(c)),{isSuccess:de,isError:Ce,isLoading:G,isFetching:pe,data:Pe=[],currentData:We}=r.useGetTemplateBlocksQuery({...Ye,page:1,...r.pageProjectKey(c)}),to=(G||pe)&&!(de&&We!==void 0),eo=(0,a.useMemo)(()=>{if(Pe.length)return[...Pe].sort((T,fe)=>bt[T.type]-bt[fe.type])},[Pe]),[no,O]=(0,a.useState)([]);(0,a.useEffect)(()=>{const T=new Set;if(eo&&Pe.length){for(const fe of eo)fe.type&&T.add(fe.type);O(Array.from(T))}},[Pe.length,eo]);const se=(0,a.useMemo)(()=>{const T=new Set;for(const fe of Be)T.add(fe);for(const fe of Ae)T.add(fe);for(const fe of no)T.add(fe);return Array.from(T)},[no,Ae,Be]),w=T=>{ve(fe=>({...fe,...T,page:1})),D(fe=>({...fe,...T,page:1})),Ze(fe=>({...fe,...T,page:1}))},y=r.useFitBlockPreviewHeight(P),ce=(0,a.useCallback)(()=>{v.querySelector(".blocks-search__result-wrapper.is_search")&&(v.querySelector(".blocks-search__result-wrapper").style.removeProperty("transition"),v.querySelector(".blocks-search__result-wrapper").style.opacity=0,r.measureBlockPreviews(v,207/L),v.querySelector(".blocks-search__result-wrapper").style.transition="opacity 0.2s",v.querySelectorAll(".blocks-search__result-wrapper").forEach(T=>T.style.opacity=1))},[L,v]);(0,a.useEffect)(()=>{!(pe||G)&&de&&i!=="template"&&(l?ce():s())},[pe,G,de,ce,Le.name,s,l,i]),(0,a.useEffect)(()=>{const T=new Set;if(he&&Y){for(const fe of Y)fe.type&&T.add(fe.type);Ee(Array.from(T))}},[he,Y]);const Ie=T=>{const fe=Object.keys(T)[0],S=b.getFieldsValue(!0);switch(fe){case La:const Re=(Ve||[]).filter(De=>T[fe].includes(De.name)).map(De=>De.id)||null;w({tags:Re});break;case Na:w({type:S.type||null});break;case xr:$.current&&window.clearTimeout($.current),$.current=window.setTimeout(function(){w({name:S.name||null})},300)}},Xe=T=>{s(),T.target.getAttribute("data-type")?(T.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(fe=>fe.style.display="none"),T.target.closest(".blocks-search").querySelectorAll(`[data-type="${T.target.getAttribute("data-type")}"]`).forEach(fe=>fe.style.display="block")):T.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(fe=>fe.style.display="block"),T.target.parentElement.querySelector(".active").classList.remove("active"),T.target.classList.add("active")};let oo=null;const po=T=>{clearTimeout(oo);let fe=v.querySelector(".block-search__preview")?v.querySelector(".block-search__preview"):null,S=v.querySelector(".block-search__preview-title")?v.querySelector(".block-search__preview-title"):null,Re=v.querySelector(".block-search__preview-content")?v.querySelector(".block-search__preview-content"):null;v.querySelector(".block-search__preview")||(fe=document.createElement("div"),fe.classList.add("block-search__preview"),S=document.createElement("div"),S.classList.add("block-search__preview-title"),Re=document.createElement("div"),Re.classList.add("block-search__preview-content"),fe.append(Re),fe.append(S),v.querySelector(".email-pane__col_settings-inner").append(fe)),S.innerHTML="",Re.innerHTML="",S.innerHTML=T.title;let De=T.html.replaceAll(/<style((.|\n|\r)*?)<\/style>/gi,"").trim();Re.innerHTML=r.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+De+"</table>"),fe.style.opacity!=="1"&&setTimeout(function(){fe.style.opacity="1",fe.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(100%)":"translateX(-100%)"},10)},co=()=>{let T=v.querySelector(".block-search__preview");T&&(oo=setTimeout(()=>{T.style.opacity="0",T.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(99%)":"translateX(-99%)",setTimeout(function(){T.remove()},300)},300))};(0,a.useEffect)(()=>{v.querySelectorAll(".blocks-search__result").forEach(T=>{T.style.display="block"})},[i]);const _o=!q?.length&&(!d||!E?.length)&&!Pe?.length&&(Le.tags||Le.name||Le.type)&&!(Z||K),Io=T=>Te.dispatch(r.blocksApi.endpoints.deleteBlock.initiate(T.id)).then(fe=>{if(fe.error){k.fromError("BLOCK_REMOVING_ERROR",r.getBlockDesc(T),fe.error);return}ee(S=>({list:Q,ids:S.list===Q?[...S.ids,T.id]:[T.id]})),k.success({id:"BLOCK_REMOVING_SUCCESS",data:r.getBlockDesc(T),title:p('The block "')+T.title+B('" was successfully removed.',"block")})});(0,a.useEffect)(()=>{!Z&&!K&&s()},[Z,K,s]),(0,a.useEffect)(()=>{(i==="common"||l)&&setTimeout(s,50)},[q,s,i,l]);const Co=T=>{R({mask:{closable:!0},centered:!0,title:B("Are you sure you want to delete the “","block")+T.title+p("” block?"),icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:22,style:{color:t.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0}}),okText:p("Yes"),cancelText:p("No"),onOk:()=>Io(T)})},F=(T,fe)=>`${T.pathname.split("emails")[0]}blocks/${fe.id}`,J=T=>{let fe=[{key:"Delete block",className:"blocks-search__result__menu-item",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16,style:{margin:0}}),style:{color:h.colorError},onClick:()=>Co(T)}];const S=gm(!0,N);return S==="link"&&fe.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(j,T),children:" "})}),S==="over-email"&&fe.unshift({key:"Edit block",className:"blocks-search__result__menu-item",icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,style:fm}),onClick:()=>{r.getEmitter(yo.getContainer(Te),yo.events.OPEN_BLOCK_REQUEST_ID).fireSettled(String(T.id)).then(({errors:Re})=>{Re.length&&k.fromError("BLOCK_GET_ERROR",r.getBlockDesc(T),Re[0])})}}),fe},ye=T=>{let fe=T.html.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");if(fe.replaceChildren(...r.parseFromString(T.html)),Object.keys(C).length!==0&&(fe.querySelectorAll(".em-contrast-card").forEach(S=>{C.cards?.contrastBackgroundColor&&(S.getAttribute("bgcolor")?C.cards.contrastBackgroundColor?S.setAttribute("bgcolor",C.cards.contrastBackgroundColor):S.removeAttribute("bgcolor"):C.cards.contrastBackgroundColor?S.style.backgroundColor=C.cards.contrastBackgroundColor:S.style.removeProperty("background-color")),C.cards?.contrastTextColor&&S.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(Re=>{if(ge(Re.style.color).toLowerCase()!=="#ffffff"){let De=Re.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.cards.contrastTextColor};`);Re.setAttribute("style",De)}})}),fe.querySelectorAll(".em-card").forEach(S=>{C.cards?.baseBackgroundColor&&(S.getAttribute("bgcolor")?C.cards.baseBackgroundColor?S.setAttribute("bgcolor",C.cards.baseBackgroundColor):S.removeAttribute("bgcolor"):C.cards.baseBackgroundColor?S.style.backgroundColor=C.cards.baseBackgroundColor:S.style.removeProperty("background-color")),C.cards?.baseTextColor&&S.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(Re=>{if(ge(Re.style.color).toLowerCase()!=="#ffffff"){let De=Re.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.cards.baseTextColor};`);Re.setAttribute("style",De)}})}),fe.querySelectorAll(".em-card, .em-contrast-card").forEach(S=>{C.cards?.border&&Ke({settings:{border:C.cards?.border},elem:S}),C.cards?.borderRadius?.all?(S.style.borderBottomLeftRadius&&S.style.borderBottomLeftRadius!=="0px"&&(S.style.borderBottomLeftRadius=C.cards?.borderRadius.all+"px"),S.style.borderBottomRightRadius&&S.style.borderBottomRightRadius!=="0px"&&(S.style.borderBottomRightRadius=C.cards?.borderRadius.all+"px"),S.style.borderTopLeftRadius&&S.style.borderTopLeftRadius!=="0px"&&(S.style.borderTopLeftRadius=C.cards?.borderRadius.all+"px"),S.style.borderTopRightRadius&&S.style.borderTopRightRadius!=="0px"&&(S.style.borderTopRightRadius=C.cards?.borderRadius.all+"px")):C.cards?.borderRadius?.all===""?S.style.removeProperty("border-radius"):(C.cards?.borderRadius?.topLeft&&S.style.borderTopLeftRadius&&S.style.borderTopLeftRadius!=="0px"?S.style.borderTopLeftRadius=C.cards?.borderRadius.topLeft+"px":C.cards?.borderRadius?.topLeft===""&&S.style.removeProperty("border-top-left-radius"),C.cards?.borderRadius?.topRight&&S.style.borderTopRightRadius&&S.style.borderTopRightRadius!=="0px"?S.style.borderTopRightRadius=C.cards?.borderRadius.topRight+"px":C.cards?.borderRadius?.topRight===""&&S.style.removeProperty("border-top-right-radius"),C.cards?.borderRadius?.bottomRight&&S.style.borderBottomRightRadius&&S.style.borderBottomRightRadius!=="0px"?S.style.borderBottomRightRadius=C.cards?.borderRadius.bottomRight+"px":C.cards?.borderRadius?.bottomRight===""&&S.style.removeProperty("border-bottom-right-radius"),C.cards?.borderRadius?.bottomLeft&&S.style.borderBottomLeftRadius&&S.style.borderBottomLeftRadius!=="0px"?S.style.borderBottomLeftRadius=C.cards?.borderRadius.bottomLeft+"px":C.cards?.borderRadius?.bottomLeft===""&&S.style.removeProperty("border-bottom-left-radius"))}),fe.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(S=>{if(!S.style.display&&parseFloat(S.style.fontSize)<=20){let Re="",De=C.text.fontFamily;if(parseFloat(S.style.fontSize)>14&&(Re=S.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${C.text.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${C.text.lineHeight}px`),S.setAttribute("style",Re)),!S.closest(".em-contrast-card, .em-card")&&ge(S.style.color).toLowerCase()!=="#ffffff"&&(Re=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.text.color};`),S.setAttribute("style",Re)),S.closest(".em-contrast-block")&&!S.closest(".em-contrast-card, .em-card")&&(Re=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.text.contrastColor};`),S.setAttribute("style",Re)),De[0]==="Safe Fonts"?(S.style.fontFamily=De[1],Me({elem:fe})):De[0]==="Google Fonts"&&(De[1]==="Sans Serif"?S.style.fontFamily="Helvetica, Arial, sans-serif":De[1]==="Serif"&&(S.style.fontFamily='"Times New Roman", Times, serif'),S.classList.remove(...[...S.classList].filter(mo=>mo.startsWith("em-font"))),S.classList.add(`em-font-${De[2].replace(/\s/g,"")}-${De[3].replace(/\s/g,"")}`),He({elem:fe,fontFamilyArray:De})),S.closest('[em="atom"] > tr > td')&&S.closest('[em="atom"] > tr > td').style.paddingBottom)S.closest('[em="atom"] > tr > td').style.paddingBottom=C.text.paddingBottom+"px";else if(S.nextElementSibling||S.closest("table")&&S.closest("table").nextElementSibling){let mo=S.nextElementSibling??S.closest("table").nextElementSibling;mo&&mo.tagName==="TABLE"&&(mo.classList.contains("em-vindent-table")||mo.querySelector("td").innerHTML==="")&&mo.querySelector("td").setAttribute("height",C.text.paddingBottom)}}else if(!S.style.display&&parseFloat(S.style.fontSize)>=20&&ge(S.style.color).toLowerCase()!=="#eb3737"){let Re="",De=C.headings.fontFamily;parseFloat(S.style.fontSize)<40&&(Re=S.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${C.headings.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${C.headings.lineHeight}px`),S.setAttribute("style",Re)),!S.closest(".em-contrast-card, .em-card")&&ge(S.style.color).toLowerCase()!=="#ffffff"&&(Re=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.headings.color};`),S.setAttribute("style",Re)),S.closest(".em-contrast-block")&&!S.closest(".em-contrast-card, .em-card")&&(Re=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.headings.contrastColor};`),S.setAttribute("style",Re)),De[0]==="Safe Fonts"?(S.style.fontFamily=De[1],Me({elem:fe})):De[0]==="Google Fonts"&&(De[1]==="Sans Serif"?S.style.fontFamily="Helvetica, Arial, sans-serif":De[1]==="Serif"&&(S.style.fontFamily='"Times New Roman", Times, serif'),S.classList.remove(...[...S.classList].filter(Ue=>Ue.startsWith("em-font"))),S.classList.add(`em-font-${De[2].replace(/\s/g,"")}-${De[3].replace(/\s/g,"")}`),He({elem:fe,fontFamilyArray:De}));let mo="";if(C.headings.letterSpacing>0?mo=S.style.letterSpacing?S.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${C.headings.letterSpacing}px`):S.getAttribute("style")+` letter-spacing: ${C.headings.letterSpacing}px;`:mo=S.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),S.setAttribute("style",mo),C.headings.bold?S.querySelector("b")?S.querySelector("b").replaceWith(...S.querySelector("b").childNodes):S.querySelector("strong")||(S.innerHTML="<strong>"+S.innerHTML+"</strong>"):S.querySelector("strong")?S.querySelector("strong").replaceWith(...S.querySelector("strong").childNodes):S.querySelector("b")&&S.querySelector("b").replaceWith(...S.querySelector("b").childNodes),S.style.fontWeight){let Ue=S.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");S.setAttribute("style",Ue)}if(C.headings.italic?S.querySelector("i")?S.querySelector("i").replaceWith(...S.querySelector("i").childNodes):S.querySelector("em")||(S.innerHTML="<em>"+S.innerHTML+"</em>"):S.querySelector("em")?S.querySelector("em").replaceWith(...S.querySelector("em").childNodes):S.querySelector("i")&&S.querySelector("i").replaceWith(...S.querySelector("i").childNodes),S.style.fontStyle){let Ue=S.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");S.setAttribute("style",Ue)}if(S.closest('[em="atom"] > tr > td')&&S.closest('[em="atom"] > tr > td').style.paddingTop)S.closest('[em="atom"] > tr > td').style.paddingTop=C.headings.paddingTop+"px";else if(S.previousElementSibling){let Ue=S.previousElementSibling;Ue&&Ue.tagName==="TABLE"&&(Ue.classList.contains("em-vindent-table")||Ue.querySelector("td").innerHTML==="")&&Ue.querySelector("td").setAttribute("height",C.headings.paddingTop)}if(S.closest('[em="atom"] > tr > td')&&S.closest('[em="atom"] > tr > td').style.paddingBottom)S.closest('[em="atom"] > tr > td').style.paddingBottom=C.headings.paddingBottom+"px";else if(S.nextElementSibling){let Ue=S.nextElementSibling;Ue&&Ue.tagName==="TABLE"&&(Ue.classList.contains("em-vindent-table")||Ue.querySelector("td").innerHTML==="")&&Ue.querySelector("td").setAttribute("height",C.headings.paddingBottom)}}}),fe.querySelectorAll('a[style*="color"]').forEach(S=>{if(S.style.display){if(S.style.display&&S.style.display==="block"){let Re="";if(Re=S.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${C.buttons.fontSize}px`),S.setAttribute("style",Re),S.closest("td").style.backgroundColor&&!S.closest("td").style.borderWidth&&!S.closest(".em-contrast-card"))if(S.closest(".em-contrast-block")?Re=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.buttons.contrastColor};`):Re=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.buttons.color};`),S.setAttribute("style",Re),S.closest(".em-contrast-block"))if(C.buttons.contrastBackgroundColor){let Ue=S.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${C.buttons.contrastBackgroundColor};`);S.closest("td").setAttribute("style",Ue)}else S.closest("td").style.removeProperty("background-color");else if(C.buttons.backgroundColor){let Ue=S.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${C.buttons.backgroundColor};`);S.closest("td").setAttribute("style",Ue)}else S.closest("td").style.removeProperty("background-color");else if(S.closest("td").style.borderWidth)if(Object.values(C.buttons.border).every(Ue=>Ue===null)){if(S.closest(".em-contrast-block")){if(C.buttons.contrastBackgroundColor){let Ue=S.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,Uo=>Uo.replace(/#[A-Fa-f0-9]{6}/,`${C.buttons.contrastBackgroundColor}`));S.closest("td").setAttribute("style",Ue),Re=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.buttons.contrastBackgroundColor};`),S.setAttribute("style",Re)}}else if(C.buttons.backgroundColor){let Ue=S.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,Uo=>Uo.replace(/#[A-Fa-f0-9]{6}/,`${C.buttons.backgroundColor}`));S.closest("td").setAttribute("style",Ue),Re=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.buttons.backgroundColor};`),S.setAttribute("style",Re)}}else for(const Ue in C.buttons.border)C.buttons.border[Ue]&&C.buttons.border[Ue].color!==void 0&&(Re=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.buttons.border[Ue].color};`),S.setAttribute("style",Re));else S.closest(".em-contrast-block")?C.buttons.contrastBackgroundColor&&(Re=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.buttons.contrastBackgroundColor};`),S.setAttribute("style",Re)):C.buttons.backgroundColor&&(Re=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.buttons.backgroundColor};`),S.setAttribute("style",Re));let De=C.buttons.fontFamily;De[0]==="Safe Fonts"?(S.style.fontFamily=De[1],Me({elem:fe})):De[0]==="Google Fonts"&&(De[1]==="Sans Serif"?S.style.fontFamily="Helvetica, Arial, sans-serif":De[1]==="Serif"&&(S.style.fontFamily='"Times New Roman", Times, serif'),S.classList.remove(...[...S.classList].filter(Ue=>Ue.startsWith("em-font"))),S.classList.add(`em-font-${De[2].replace(/\s/g,"")}-${De[3].replace(/\s/g,"")}`),He({elem:fe,fontFamilyArray:De})),S.closest("td").setAttribute("align",C.buttons.textAlign);let mo="";if(C.buttons.letterSpacing>0?mo=S.style.letterSpacing?S.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${C.buttons.letterSpacing}px`):S.getAttribute("style")+` letter-spacing: ${C.buttons.letterSpacing}px;`:mo=S.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),S.setAttribute("style",mo),C.buttons.bold?S.querySelector("b")?S.querySelector("b").replaceWith(...S.querySelector("b").childNodes):S.querySelector("strong")||(S.innerHTML="<strong>"+S.innerHTML+"</strong>"):S.querySelector("strong")?S.querySelector("strong").replaceWith(...S.querySelector("strong").childNodes):S.querySelector("b")&&S.querySelector("b").replaceWith(...S.querySelector("b").childNodes),S.style.fontWeight){let Ue=S.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");S.setAttribute("style",Ue)}if(C.buttons.italic?S.querySelector("i")?S.querySelector("i").replaceWith(...S.querySelector("i").childNodes):S.querySelector("em")||(S.innerHTML="<em>"+S.innerHTML+"</em>"):S.querySelector("em")?S.querySelector("em").replaceWith(...S.querySelector("em").childNodes):S.querySelector("i")&&S.querySelector("i").replaceWith(...S.querySelector("i").childNodes),S.style.fontStyle){let Ue=S.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");S.setAttribute("style",Ue)}if(S.closest('[em="atom"] > tr > td')&&S.closest('[em="atom"] > tr > td').style.paddingTop)S.closest('[em="atom"] > tr > td').style.paddingTop=C.buttons.marginTop+"px";else if(S.closest("table").previousElementSibling){let Ue=S.closest("table").previousElementSibling;Ue&&Ue.tagName==="TABLE"&&(Ue.classList.contains("em-vindent-table")||Ue.querySelector("td").innerHTML==="")&&Ue.querySelector("td").setAttribute("height",C.buttons.marginTop)}if(S.closest('[em="atom"] > tr > td')&&S.closest('[em="atom"] > tr > td').style.paddingBottom)S.closest('[em="atom"] > tr > td').style.paddingBottom=C.buttons.marginBottom+"px";else if(S.closest("table").previousElementSibling){let Ue=S.closest("table").nextElementSibling;Ue&&Ue.tagName==="TABLE"&&(Ue.classList.contains("em-vindent-table")||Ue.querySelector("td").innerHTML==="")&&Ue.querySelector("td").setAttribute("height",C.buttons.marginBottom)}C.buttons.padding.all&&(S.style.padding=C.buttons.padding.all+"px"),C.buttons.padding.top&&(S.style.paddingTop=C.buttons.padding.top+"px"),C.buttons.padding.right&&(S.style.paddingRight=C.buttons.padding.right+"px"),C.buttons.padding.bottom&&(S.style.paddingBottom=C.buttons.padding.bottom+"px"),C.buttons.padding.left&&(S.style.paddingLeft=C.buttons.padding.left+"px"),Ke({settings:{border:C.buttons.border},elem:S.closest("td")}),Fe({settings:{borderRadius:C.buttons.borderRadius},elem:S.closest("td")})}}else{let Re=C.text.fontFamily;if(ge(S.style.color).toLowerCase()==="#1c52dc"){let mo=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.links.color};`);S.setAttribute("style",mo)}else{let mo=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.text.color};`);S.setAttribute("style",mo)}if(S.closest(".em-contrast-block")){let mo=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.links.contrastColor};`);S.setAttribute("style",mo)}let De="";C.links.underline?De=S.style.textDecoration?S.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: underline;"):S.getAttribute("style")+" text-decoration: underline;":De=S.style.textDecoration?S.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: none;"):S.getAttribute("style")+" text-decoration: none;",S.setAttribute("style",De),Re[0]==="Safe Fonts"?(S.style.fontFamily=Re[1],Me({elem:fe})):Re[0]==="Google Fonts"&&(Re[1]==="Sans Serif"?S.style.fontFamily="Helvetica, Arial, sans-serif":Re[1]==="Serif"&&(S.style.fontFamily='"Times New Roman", Times, serif'),S.classList.remove(...[...S.classList].filter(mo=>mo.startsWith("em-font"))),S.classList.add(`em-font-${Re[2].replace(/\s/g,"")}-${Re[3].replace(/\s/g,"")}`),He({elem:fe,fontFamilyArray:Re}))}}),fe.querySelector('[em="block"]'))){const S=fe.querySelectorAll('[em="block"]');C.block?.backgroundColor&&S.forEach(Re=>{Re.querySelectorAll(":scope > td").forEach(De=>{De.setAttribute("bgcolor",C.block.backgroundColor)})}),C.block?.padding&&S.forEach(Re=>{Re.querySelectorAll(":scope > td").forEach(De=>{De.style.paddingTop=C.block.padding.top+"px",De.style.paddingRight=C.block.padding.right+"px",De.style.paddingBottom=C.block.padding.bottom+"px",De.style.paddingLeft=C.block.padding.left+"px"})})}return fe.tagName==="DIV"?r.getElementInnerHTML(fe):r.getElementInnerHTML(fe.querySelector("tbody")||fe)},Me=T=>{T.elem.querySelectorAll("link[em-class]").forEach(fe=>{T.elem.querySelector("."+fe.getAttribute("em-class"))||fe.remove()})};function ge(T){if(T&&T.charAt(0)==="r"){if(T.charAt(3)==="a")return T=T.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i),T&&T.length===4?"#"+("0"+parseInt(T[1],10).toString(16)).slice(-2)+("0"+parseInt(T[2],10).toString(16)).slice(-2)+("0"+parseInt(T[3],10).toString(16)).slice(-2):"";{T=T.replace("rgb(","").replace(")","").split(",");let fe=parseInt(T[0],10).toString(16),S=parseInt(T[1],10).toString(16),Re=parseInt(T[2],10).toString(16);return fe=fe.length===1?"0"+fe:fe,S=S.length===1?"0"+S:S,Re=Re.length===1?"0"+Re:Re,"#"+fe+S+Re}}else if(T&&T.charAt(0)==="#")return T}const He=T=>{const fe=T.elem.querySelectorAll("link"),S=`em-font-${T.fontFamilyArray[2].replace(/\s/g,"")}-${T.fontFamilyArray[3].replace(/\s/g,"")}`;if(!Array.from(fe)?.find(De=>De.getAttribute("em-class")===S)){let De=document.createElement("link");De.setAttribute("rel","stylesheet"),De.setAttribute("href",`https://fonts.googleapis.com/css2?family=${T.fontFamilyArray[2]}:ital,wght@${qe[T.fontFamilyArray[3]].indexOf("i")>-1?"1":"0"},${qe[T.fontFamilyArray[3]].replaceAll("i","")}&display=swap`),De.setAttribute("em-class",S),T.elem.insertAdjacentElement("afterbegin",De)}To({elem:T.elem});let Re=`font-family: '${T.fontFamilyArray[2]}', ${so[T.fontFamilyArray[1]]}!important;`;Re+=` font-weight: ${qe[T.fontFamilyArray[3]].replaceAll("i","")}!important;`,qe[T.fontFamilyArray[3]].indexOf("i")>-1&&(Re+=" font-style: italic!important;"),T.elem.querySelector('style[em="styles"]').insertAdjacentHTML("beforeend",`
13
+ .em-font-${T.fontFamilyArray[2].replace(/\s/g,"")}-${T.fontFamilyArray[3].replace(/\s/g,"")} { ${Re} }`),setTimeout(()=>Me({elem:T.elem}),0)},Ke=T=>{T.settings.border.all?T.settings.border.all.width!=null&&(T.settings.border.all.style||T.settings.border.all.color)?(T.elem.style.borderWidth=T.settings.border.all.width+"px",T.elem.style.borderStyle=T.settings.border.all.style,T.elem.style.borderColor=T.settings.border.all.color):T.elem.style.removeProperty("border"):(T.settings.border.top&&(T.settings.border.top.width!=null&&(T.settings.border.top.style||T.settings.border.top.color)?(T.elem.style.borderTopWidth=T.settings.border.top.width+"px",T.elem.style.borderTopStyle=T.settings.border.top.style,T.elem.style.borderTopColor=T.settings.border.top.color):T.elem.style.removeProperty("border-top")),T.settings.border.right&&(T.settings.border.right.width!=null&&(T.settings.border.right.style||T.settings.border.right.color)?(T.elem.style.borderRightWidth=T.settings.border.right.width+"px",T.elem.style.borderRightStyle=T.settings.border.right.style,T.elem.style.borderRightColor=T.settings.border.right.color):T.elem.style.removeProperty("border-right")),T.settings.border.bottom&&(T.settings.border.bottom.width!=null&&(T.settings.border.bottom.style||T.settings.border.bottom.color)?(T.elem.style.borderBottomWidth=T.settings.border.bottom.width+"px",T.elem.style.borderBottomStyle=T.settings.border.bottom.style,T.elem.style.borderBottomColor=T.settings.border.bottom.color):T.elem.style.removeProperty("border-bottom")),T.settings.border.left&&(T.settings.border.left.width!=null&&(T.settings.border.left.style||T.settings.border.left.color)?(T.elem.style.borderLeftWidth=T.settings.border.left.width+"px",T.elem.style.borderLeftStyle=T.settings.border.left.style,T.elem.style.borderLeftColor=T.settings.border.left.color):T.elem.style.removeProperty("border-left")))},Fe=T=>{T.settings.borderRadius.all?T.elem.style.borderRadius=T.settings.borderRadius.all+"px":T.settings.borderRadius.all===""?T.elem.style.removeProperty("border-radius"):(T.settings.borderRadius.topLeft?T.elem.style.borderTopLeftRadius=T.settings.borderRadius.topLeft+"px":T.settings.borderRadius.topLeft===""&&T.elem.style.removeProperty("border-top-left-radius"),T.settings.borderRadius.topRight?T.elem.style.borderTopRightRadius=T.settings.borderRadius.topRight+"px":T.settings.borderRadius.topRight===""&&T.elem.style.removeProperty("border-top-right-radius"),T.settings.borderRadius.bottomRight?T.elem.style.borderBottomRightRadius=T.settings.borderRadius.bottomRight+"px":T.settings.borderRadius.bottomRight===""&&T.elem.style.removeProperty("border-bottom-right-radius"),T.settings.borderRadius.bottomLeft?T.elem.style.borderBottomLeftRadius=T.settings.borderRadius.bottomLeft+"px":T.settings.borderRadius.bottomLeft===""&&T.elem.style.removeProperty("border-bottom-left-radius"))},qe={Thin:"100","Thin Italic":"100i",ExtraLight:"200","ExtraLight Italic":"200i",Light:"300","Light Italic":"300i",Regular:"400","Regular Italic":"400i",Medium:"500","Medium Italic":"500i",SemiBold:"600","SemiBold Italic":"600i",Bold:"700","Bold Italic":"700i",ExtraBold:"800","ExtraBold Italic":"800i",Black:"900","Black Italic":"900i"},so={"Sans Serif":"sans-serif",Serif:"serif"};function To(T){if(!T.elem.querySelector('style[em="styles"]')){let fe=document.createElement("style");fe.setAttribute("em","styles"),T.elem.append(fe)}}return(0,o.jsxs)("div",{className:(0,ze.default)("blocks-search",{is_search:l}),children:[(0,o.jsx)(t.ui_kit$Form,{className:(0,ze.default)("blocks-search__form",{is_search:l}),form:b,layout:"vertical",name:"blocks_search_form",initialValues:{...Oa},onValuesChange:Ie,autoComplete:"off",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:xr,children:(0,o.jsx)(t.ui_kit$SearchInput,{placeholder:p("Search by title"),allowClear:!0,enterButton:!1})})}),(be||we||Ce)&&(0,o.jsx)(t.ui_kit$Alert,{title:p("Error"),description:p("Error when receiving data. Try again (reload page) or contact support."),type:"error",showIcon:!0}),l&&!_o&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:Xe,children:p("All")},"search_All"),se.map(T=>(0,o.jsx)("li",{"data-type":T,onClick:Xe,children:p(r.TYPES_TRANSLATE[T])},"search_"+T))]})}),(0,o.jsxs)("div",{ref:U,className:(0,ze.default)("blocks-search__result-wrapper",{is_search:l}),children:[(i==="project"||l)&&(0,o.jsxs)(o.Fragment,{children:[!!Be.length&&!l&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:Xe,children:p("All")},"blocksSections_All"),Be.map(T=>(0,o.jsx)("li",{"data-type":T,onClick:Xe,children:p(r.TYPES_TRANSLATE[T])},"blocksSections_"+T))]})}),(0,o.jsxs)("div",{className:(0,ze.default)("blocks-search__blocks-wrapper",{is_search:l}),ref:re,children:[(0,o.jsx)("div",{className:"blocks-search__result-holder project",children:!M&&(ne?.length?ne.map(T=>{const fe=fr(T.id,_r(T));return(0,o.jsx)("div",{className:"blocks-search__result","data-type":T.type,children:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"leftTop",menu:{items:J(T)},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:S=>me(S,T.html,"project",T.title,T),onDragStart:S=>je(S,T.html,"project",T.title,T),onMouseEnter:()=>po({html:T.html,title:T.title}),onMouseLeave:co,children:[z(T),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:fe,onContentLoad:y,style:{transform:`scale(${P})`}})]})},"commenMenu")},T.id)}):!(Le.tags||Le.name||Le.type)&&he&&!M&&!l&&(0,o.jsxs)("div",{style:{padding:"10px 0 20px",display:"flex",flexDirection:"row",justifyContent:"space-between"},children:[(0,o.jsxs)("div",{style:{width:"110%"},children:[(0,o.jsx)("h3",{style:{lineHeight:"1.2"},children:p("You don`t have any saved blocks yet.")}),p("To add a block from the dashboard click the"),' "',p("Save to Blocks button."),'" ',(0,o.jsx)(r.EmIcons,{icon:"SaveBlock",component:t.icons$SaveBlock,style:{position:"relative",top:"2px"}}),(0,o.jsx)("br",{}),(0,o.jsx)("br",{}),p("You can also save all blocks at once. The AI assistant will automatically determine the type and create a name for each block when saving."),(0,o.jsx)("br",{}),(0,o.jsx)("br",{}),(0,o.jsx)(t.ui_kit$Flex,{justify:"left",children:(0,o.jsx)(t.ui_kit$Button,{type:"primary",onClick:()=>n(!0),style:{cursor:"pointer"},children:p("Save all blocks")})})]}),(0,o.jsx)("div",{style:{width:"80px",height:"200px"},children:(0,o.jsx)("img",{src:mm,style:{display:"block",width:80,position:"absolute",right:5}})})]}))}),M&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),l&&q?.length>0&&E?.length>0&&(0,o.jsx)(t.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="template"||l)&&(0,o.jsxs)(o.Fragment,{children:[!!Ae.length&&!l&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:Xe,children:p("All")},"templateBlocksSections_All"),Ae.map(T=>(0,o.jsx)("li",{"data-type":T,onClick:Xe,children:p(r.TYPES_TRANSLATE[T])},"templateBlocksSections_"+T))]})}),(0,o.jsxs)("div",{className:(0,ze.default)("blocks-search__blocks-wrapper",{is_search:l}),ref:ae,children:[(0,o.jsxs)("div",{className:"blocks-search__result-holder template",children:[E&&!(W||Se)&&Oe?.length?(0,o.jsx)(o.Fragment,{children:Oe.map((T,fe)=>{const S=fr(T.id,_r(T));return(0,o.jsx)("div",{className:"blocks-search__result","data-type":T.type,children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:Re=>me(Re,T.html,"template",T.title,T),onDragStart:Re=>je(Re,T.html,"template",T.title,T),onMouseEnter:()=>po({html:T.html,title:T.title}),onMouseLeave:()=>co(),children:[z(T),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:S,onContentLoad:y,style:{transform:`scale(${P})`}})]})},T.id+fe.toString())})}):!l&&!G&&!Se&&(0,o.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:p("No related blocks found.")})," "]}),(W||Se)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),l&&E?.length>0&&Pe?.length>0&&(0,o.jsx)(t.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="common"||l)&&(0,o.jsxs)(o.Fragment,{children:[!!no?.length&&!l&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:Xe,children:p("All")},"commonBlocksSections_All"),no.map(T=>(0,o.jsx)("li",{"data-type":T,onClick:Xe,children:p(r.TYPES_TRANSLATE[T])},"commonBlocksSections_"+T))]})}),(0,o.jsxs)("div",{className:(0,ze.default)("blocks-search__blocks-wrapper",{is_search:l}),ref:_e,children:[(0,o.jsxs)("div",{className:"blocks-search__result-holder common",children:[de&&!!eo?.length&&!to&&(0,o.jsx)(o.Fragment,{children:eo.map((T,fe)=>{const S=ye({html:fr(T.id,_r(T))});return(0,o.jsx)("div",{className:"blocks-search__result","data-type":T.type,children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:Re=>me(Re,ye({html:T.html}),"common",T.title,T),onDragStart:Re=>je(Re,ye({html:T.html}),"common",T.title,T),onMouseEnter:()=>po({html:ye({html:r.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+T.html+"</table>")}),title:T.title}),onMouseLeave:()=>co(),children:[z(T),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:S,onContentLoad:y,style:{transform:`scale(${P})`}})]})},T.id+fe.toString())})})," "]}),to&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),_o&&(0,o.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:p("There are no blocks for this request.")})]})]})};kr.propTypes={};function _m(e,i){return e==="email"||r.isBlocksV2Enabled()?!0:i!==void 0&&r.isPluginGoHistory(i)}var $a=({comments:e,subjectId:i,isLoggedIn:l,projectTitle:s="",emailElementType:n,email:d})=>{const{__:c,_n:m}=r.useI18n(),g=r.useSendPostMessage(),b=r.useNotification(),{token:_}=(0,t.ui_kit$useToken)(),h=r.useAppConfig(),p=r.usePushToDataLayer(),B=(0,a.useRef)(null),[k,x]=(0,a.useState)(""),[R,j]=(0,a.useState)("ADD"),[N,E]=(0,a.useState)(!1),[I,$]=(0,a.useState)(null),[U,v]=(0,a.useState)(null),[L,P]=(0,a.useState)(""),[z,le]=(0,a.useState)(""),[C,re]=(0,a.useState)(!1),[ae,_e]=(0,a.useState)(""),[Te,te]=r.useAddCommentMutation(),[me,je]=r.useDeleteCommentMutation(),[ue,Ve]=r.useEditCommentMutation(),[Le,ve]=r.useDeleteTargetMutation(),[he]=r.useAutoSaveBlockMutation(),be=r.useDispatch(),Z=r.useStore(),K=r.useCurrentUser(),q=r.useCurrentProjectRequested(),Q=r.useContentReader(),V=de=>{const Ce=r.getEmailDocuments(yo.getContainer(Z));Ce.save("anchor",{project:de}).then(G=>{const pe=G?Ce.revisionFacts()?.lastRevisionAt:void 0;pe!==void 0&&d?.id!=null&&be(r.rememberAutosaveTime({emailId:d.id,modified:new Date(pe).toISOString()}))})},M=()=>{const de=q;if(_m(n,yo.getContainer(Z))){V(de);return}const Ce={...d?.meta!==void 0?{meta:d.meta}:{},title:d?.title,emailId:d?.id,project:de,html:Q(),excerpt:d?.date_gmt};d?.id!=null&&he({blockId:d.id,body:Ce}).catch(G=>{})};function Y(de){re(!1),_e(""),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:ae}),E(!0),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!0})}function X(){v(I),e.filter(de=>de.parent===I).length?ue({commentId:I,status:"deleted"}).unwrap():me(I),document.querySelector('.discuss-main li[id="'+I+'"] .comment-icon-target')?.getAttribute("target-id")&&g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:document.querySelector('.discuss-main li[id="'+I+'"] .comment-icon-target')?.getAttribute("target-id")}),M(),_e("")}function ee(de){v(I);const Ce=e.find(pe=>pe.id?.toString()===I),G=Ce?.target_id?.toString()||"";re(!!G),_e(G),le(Ce?.content?.slice(3,-5)?.toString()),j("EDIT")}function ne(de){v(I),P(""),j("REPLY")}const Be=()=>{b.error({mask:{closable:!0},centered:!0,title:c("Please log in"),content:(r.isUseBlocksBuild()?c("To leave comments you must be logged into Blocks and added to the project "):c("To leave comments you must be logged into EmailMaker and added to the project "))+`${s}.`,okText:c("Okay. I'll log in.")})};async function Ee(){l?(await ue({commentId:U,content:z,targetId:ae}).unwrap(),j("ADD"),le(""),v(0),re(!1),E(!1),_e(""),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Be()}const oe=de=>{j("ADD"),le(""),v(0),re(!1),E(!1),_e(""),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})},D=async()=>{l?((k||L)&&await Te({subjectId:i,author:K.id,parent:R==="ADD"?"0":U,content:k||L,author_name:K.name,author_email:K.email,targetId:ae}).then(de=>{if(de.error){const{data:Ce}=de.error;b.error({title:Ce?.code??c("Error"),description:Ce?.message??c("Something went wrong. Try again later.")})}else p({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"})}),_e(""),j("ADD"),P(""),x(""),v(0),re(!1),E(!1),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Be()};function ie(){C?(E(!1),re(!1),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:ae})):(E(!N),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!N}),N&&re(!1))}function we(de){let Ce=JSON.parse(JSON.stringify(de));if(!Ce||!Ce.length)return[];let G=[],pe=new Map;for(let Pe=0,We=Ce.length;Pe<We;++Pe){let to=Ce[Pe],eo=pe.get(to.id);if((!eo||Array.isArray(eo))&&(eo&&(to.children=eo),pe.set(to.id,to)),String(to.parent)==="0")G.push(to);else{let no=pe.get(to.parent);no?(Array.isArray(no)?no:no.children=no.children||[]).push(to):pe.set(to.parent,[to])}}return G.forEach(Pe=>{Pe.status==="deleted"&&!Pe.children&&(je.isUninitialized||je.isSuccess)&&me(Pe.id).unwrap().catch(We=>{})}),G}const W=de=>{const Ce=de.data.operation;if(Ce===r.EVENT_TYPES.APPLICATION_DISCUSS_SET_ID&&(_e(de.data.settings.value),de.data.settings.value!==""?(re(!0),E(!1)):(re(!1),E(!0))),Ce===r.EVENT_TYPES.APPLICATION_DISCUSS_SAVE_TARGET&&M(),Ce===r.EVENT_TYPES.APPLICATION_DISCUSS_GET_COMMENT)if(document.querySelector('.comment-icon-target[target-id="'+de.data.settings.targetId+'"]')){let G=document.querySelector('.comment-icon-target[target-id="'+de.data.settings.targetId+'"]').closest(".ant-comment");document.querySelector(".comment-block")?document.querySelector(".comment-block").scrollTo(0,G.offsetTop):document.querySelector(".em-analytics__email-tab-discuss .ant-tabs-content").scrollTo(0,G.offsetTop),G.classList.add("active"),setTimeout(()=>{G.classList.remove("active")},2e3)}else g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:de.data.settings.targetId}),b.error({title:c("There's no such comment.")});Ce===r.EVENT_TYPES.APPLICATION_DISCUSS_NO_COMMENT&&b.error({title:c("There's no such element in the email.")})};r.useListenPostMessage(W);const Se=de=>{g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_GET_TARGET,value:de})},Oe=de=>(de?.sort((Ce,G)=>Ce.date>G.date?1:-1),(0,o.jsx)(o.Fragment,{children:de&&!!de.length&&(0,o.jsx)(t.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:de,renderItem:Ce=>(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("li",{id:Ce.id,children:(0,o.jsxs)(o.Fragment,{children:[Ce.status==="deleted"&&Ce.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:Oe(Ce.children)}),Ce.status!=="deleted"&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Comment,{author_id:Ce.author_id,author:Ce.author_name,avatar:Ce.author_avatar_urls&&Ce.author_avatar_urls[48]||"",className:(0,ze.default)(Ce.target_id&&"targetted-comment-item",(!Ce.author_avatar_urls||!Ce.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>$(Ce.id),menu:{items:Ce.author===K.id?Ye:Ze},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,o.jsx)("div",{onClick:()=>Ce.target_id&&Se(Ce.target_id),dangerouslySetInnerHTML:{__html:Ce.content}})},"commenMenu"),datetime:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:Ce.date&&r.formatDate(r.tryParseISO(Ce.date),m,!0)}}),Ce.target_id&&(0,o.jsx)("span",{className:"comment-icon-target","target-id":Ce.target_id,onClick:()=>Se(Ce.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:[R==="REPLY"&&U===Ce.id&&Ge,R==="EDIT"&&U===Ce.id&&Ae,Oe(Ce.children)]})})})]})})})})})),Ae=(0,o.jsxs)(t.ui_kit$Form,{onFinish:Ee,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:z,onChange:de=>le(de.target.value),rows:4,placeholder:c("Editing comments"),onKeyDown:de=>de.key==="Escape"&&oe(),onPressEnter:de=>de.key==="Enter"&&de.ctrlKey&&Ee(),ref:B})}),(0,o.jsx)(t.ui_kit$Form.Item,{className:"buttons",children:(0,o.jsxs)(t.ui_kit$Space,{children:[C?(0,o.jsx)(t.ui_kit$Popconfirm,{title:c("Are you sure?"),okText:c("Yes"),cancelText:c("No"),onConfirm:Y,children:(0,o.jsx)(t.ui_kit$Button,{loading:ve.isLoading,type:N||C&&R==="EDIT"&&ae!==""?"primary":"default",className:"button-target "+(N&&!C?"button-target_choose":""),style:C&&R==="EDIT"&&ae!==""?{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:ie,loading:ve.isLoading,type:N||C&&R==="EDIT"&&ae!==""?"primary":"default",className:"button-target "+(N&&!C?"button-target_choose":""),style:C&&R==="EDIT"&&ae!==""?{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:Ve.isLoading,htmlType:"submit",children:[c("Save")," ",(0,o.jsx)(r.EmIcons,{icon:"SaveOutlined",component:t.icons$SaveOutlined,size:16,strokeWidth:h.iconStrokeWidth})]}),(0,o.jsx)(t.ui_kit$Button,{onClick:oe,className:"button-reply",children:c("Cancel")})]})})]}),Ge=(0,o.jsxs)(t.ui_kit$Form,{name:"reply",className:"commentForm",onFinish:D,children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{className:"textarea-reply",value:L,onChange:de=>P(de.target.value),rows:4,placeholder:c("Reply to the comment"),onKeyDown:de=>de.key==="Escape"&&oe(),onPressEnter:de=>de.key==="Enter"&&de.ctrlKey&&D(),ref:B})}),(0,o.jsx)(t.ui_kit$Form.Item,{hidden:!0,name:"targetId",children:(0,o.jsx)(t.ui_kit$Input,{type:"hidden"})}),(0,o.jsx)(t.ui_kit$Form.Item,{className:"buttons",children:(0,o.jsxs)(t.ui_kit$Space,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:c("Add a note"),styles:{body:{maxWidth:"150px"}},children:(0,o.jsx)(t.ui_kit$Button,{onClick:ie,type:N||C&&R==="REPLY"&&ae!==""?"primary":"default",className:"button-target "+(N&&!C?"button-target_choose":""),style:C&&R==="REPLY"&&ae!==""?{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:R==="REPLY"&&te.isLoading,htmlType:"submit",children:[c("Reply")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:h.iconStrokeWidth})]}),(0,o.jsx)(t.ui_kit$Button,{onClick:oe,className:"button-reply",ghost:!0,type:"primary",children:c("Cancel")})]})})]});(0,a.useEffect)(()=>{R==="REPLY"&&B.current.focus({cursor:"start"}),R==="EDIT"&&B.current.focus({cursor:"end"})},[R]);let Ye=[];Ye.push({key:"Reply to comment",icon:(0,o.jsx)(r.EmIcons,{icon:"RollbackOutlined",component:t.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:ne},{key:"Edit comment",icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,style:{fontSize:"16px"}}),label:c("Edit"),onClick:ee},{key:"Delete comment",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16}),label:c("Delete"),style:{color:_.colorError},onClick:X});let Ze=[];return Ze.push({key:"Reply to comment",icon:(0,o.jsx)(r.EmIcons,{icon:"RollbackOutlined",component:t.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:ne}),(0,o.jsxs)("div",{className:"discuss-main",children:[e.length>0&&(0,o.jsx)(t.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:we(e),renderItem:de=>(0,o.jsxs)("li",{id:de.id,children:[de.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:Oe(de.children)}),de.comment_status!=="deleted"&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Comment,{author_id:de.author_id,author:de.author_name,avatar:de.author_avatar_urls&&de.author_avatar_urls[48]||"",className:(0,ze.default)(de.target_id&&"targetted-comment-item",(!de.author_avatar_urls||!de.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>$(de.id),menu:{items:de.author===K.id?Ye:Ze},styles:{root:{minWidth:"auto"}},children:(0,o.jsx)("div",{onClick:()=>de.target_id&&Se(de.target_id),dangerouslySetInnerHTML:{__html:de.content}})},"commenMenu"),datetime:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:de.date&&r.formatDate(r.tryParseISO(de.date),m,!0)}}),de.target_id&&(0,o.jsx)("span",{className:"comment-icon-target","target-id":de.target_id,onClick:()=>Se(de.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:[R==="REPLY"&&U===de.id&&Ge,R==="EDIT"&&U===de.id&&Ae,Oe(de.children)]})})})]})}),(0,o.jsxs)(t.ui_kit$Form,{onFinish:D,className:R==="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:de=>x(de.target.value),rows:4,placeholder:c("Leave your comment"),className:"textarea-comment",onPressEnter:de=>de.key==="Enter"&&de.ctrlKey&&D()})}),(0,o.jsx)(t.ui_kit$Form.Item,{children:(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:c("Add a note"),styles:{body:{maxWidth:"150px"}},children:(0,o.jsx)(t.ui_kit$Button,{onClick:ie,type:N||C&&R==="ADD"&&ae!==""?"primary":"default",className:"button-target "+(N&&!C?"button-target_choose":""),style:C&&R==="ADD"&&ae!==""?{background:_.colorInfo}:{},icon:(0,o.jsx)(r.EmIcons,{icon:"Target",component:t.icons$Target,size:16,strokeWidth:h.iconStrokeWidth,className:"icon-target"})})}),(0,o.jsxs)(t.ui_kit$Button,{className:"button-add",type:"primary",loading:R==="ADD"&&te.isLoading,htmlType:"submit",children:[c("Send")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:h.iconStrokeWidth})]})]})})]})]})};function xm(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 km=["common_styles","subject","preheader","meta"];function Em(e,i){r.writeSourceReport(e,r.fromRevision(i))}function Bm(e){if(!e)return null;const i=e.get().attributes??{},l={};for(const s of km)i[s]!==void 0&&(l[s]=i[s]);return{content:e.getContent(),attributes:l}}function Fa(e,i){i&&r.writeSourceReport(e,{content:i.content,attributes:i.attributes})}var Ma=(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}),Er=({emailElement:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),s=r.useDispatch(),n=r.useEditorProjectId(),d=r.useEmailAttributesWriter(),c=r.useContentReplacer(),m=r.useEditorLocked(),g=r.useEditorLockCheck(),{document:b}=r.useDocumentSessionContext(),_=r.useSelector(r.selectHistoryData),h=r.useDocumentHistoryReader(),p=r.useRevisionContent(),B=r.useNotification(),k=(0,a.useRef)({preview:0,apply:0}),x=r.useProjectData()?.members,R=r.useSelector(r.selectElementHistoryHasMore),j=r.useSelector(r.selectIsPanelHistoryCollapsed),[N,E]=(0,a.useState)(!0),[I,$]=(0,a.useState)(!1),[U,v]=(0,a.useState)([]),[L,P]=(0,a.useState)([]),z=X=>s(r.switchIsPanelHistoryCollapsed(X)),le=(0,a.useCallback)(X=>{if(!X?.html||g())return;const ee=r.fromRevision(X);ee?.attributes&&d(ee.attributes),s(r.markAppearanceNeedsUpdate());const ne=b?.get().version;c(X.html,{undoable:!0}),b&&b.get().version===ne&&b.markUnsaved()},[c,s,d,b,g]),C=(0,a.useCallback)(X=>{Em(b,X),s(r.markAppearanceNeedsUpdate())},[b,s]),{data:re}=r.projectsApi.useGetProjectQuery(Number(n),{skip:!n}),[ae,_e]=(0,a.useState)([]);(0,a.useEffect)(()=>{if(re){const{owner:X,admins:ee,users:ne}=re?.members;_e([X&&{...X},ee&&Array.isArray(ee)&&ee.map(Be=>({...Be})),ne&&Array.isArray(ne)&&ne.map(Be=>({...Be}))].filter(Be=>Be).flat(1).map(Be=>({id:Be.ID,display_name:Be.display_name})))}},[re,re?.members,i]);const[Te,te]=(0,a.useState)(1),[me,je]=(0,a.useState)(!1);(0,a.useEffect)(()=>{const X=Array.isArray(_)&&_.length&&_?.map(ee=>Ma(ee,i));P(X||[]),v(X),E(!1),R||je(!0)},[_,R,i]);const ue=()=>{$(!0),P(U.concat([...new Array(3)].map(()=>({loading:!0})))),h(e.id,Te+1).then(X=>{if(X.isStale)return;const{data:ee,hasMore:ne}=X.data,Be=Array.isArray(ee)&&ee?.map(oe=>Ma(oe,i)),Ee=U.concat(Be);P(Ee),v(Ee),$(!1),window.dispatchEvent(new Event("resize")),ne||je(!0),te(Te+1)})},Ve=!N&&!I&&!me?(0,o.jsx)("div",{style:{textAlign:"center",marginTop:24,marginBottom:24,height:32,lineHeight:"32px"},children:(0,o.jsx)(t.ui_kit$Button,{onClick:ue,children:i("loading more")})}):null,[Le,ve]=(0,a.useState)(),[he,be]=(0,a.useState)(null),Z=(0,a.useCallback)(X=>{le(X),ve(null),be(null),l({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),s(r.resetToLastActiveSettingsTab())},[le,l,s]),K=(0,a.useCallback)((X,ee)=>ne=>{const Be=k.current;Be[ee]+=1,ee==="apply"&&(Be.preview+=1);const Ee=Be[ee],oe=()=>Ee===k.current[ee];if(ne?.html||!ne?.id){X(ne);return}p(e.id,ne).then(D=>{oe()&&X(D)},D=>{oe()&&(ve(null),B.error({message:i("Failed to load"),innerException:D}))})},[p,e.id,B,i]),q=K(Z,"apply"),Q=K(C,"preview"),V=({author:X,authorName:ee})=>{if(Y.revisionService)return ee||X||"–";const ne=ae.find(Ee=>Ee.id?.toString()===X?.toString())?.display_name;if(ne)return ne;const Be=r.authorFromMembers(X,x);return Be?xm(Be).display_name||Be.email||"–":ee||"–"},M=(0,a.useRef)(void 0);(0,a.useEffect)(()=>{!j&&!he&&(M.current=b,be(Bm(b)))},[j,be,b,he]),(0,a.useEffect)(()=>{j&&(k.current.preview+=1),j&&he&&(M.current===b&&(Fa(b,he),s(r.markAppearanceNeedsUpdate())),be(null))},[j,he,b,s]);const Y=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:N,itemLayout:"horizontal",loadMore:Ve,dataSource:L,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:(X,ee)=>(0,o.jsx)(t.ui_kit$List.Item,{onClick:()=>{ee!==Le&&(ve(ee),Q(U[ee])),s(r.setBlockSettingsDisable(!0))},className:(0,ze.default)("history-panel__item",{"history-panel__item_active":ee===Le}),children:(0,o.jsxs)(t.ui_kit$Skeleton,{title:!1,loading:X.loading||!1,active:!0,children:[(0,o.jsx)("div",{className:"history-panel__list-date",children:X.date}),(0,o.jsx)("div",{className:"history-panel__list-author",children:V(X)}),X.isAutosave&&Le!==ee&&(0,o.jsx)("div",{style:{opacity:.45},className:"history-panel__list-autosave",children:i("Auto")}),!X.isAutosave&&(0,o.jsx)(t.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",disabled:m,onClick:ne=>{Le===ee&&ne.stopPropagation(),q(U[ee])},children:i("Set")}),X.isAutosave&&Le===ee&&(0,o.jsx)(t.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",disabled:m,onClick:ne=>{Le===ee&&ne.stopPropagation(),q(U[ee])},children:i("Set")})]})})})}]}),(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"ant-modal-close","aria-label":"Close",onClick:()=>{s(r.resetToLastActiveSettingsTab()),he&&Fa(b,he),be(null),z(!0),l({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1})},children:(0,o.jsx)(r.EmIcons,{icon:"Close",component:t.icons$Close})})]})};Er.propTypes={};var Da=async({blockTags:e,projectTagsArray:i,addTerm:l,project:s,notification:n})=>{if(!e||e.length===0)return[];const d=e.map(c=>{const m=i.find(g=>g.name===c);return m?Promise.resolve(m.id):l({project:s,kind:r.BLOCK_TAGS,name:c}).then(({error:g,data:b})=>{if(g?.status===400)return r.existingTermIdFromError(g);if(b)return b.id;if(g)return n.fromError("TAG_CREATING_ERROR",c,g),null})});return(await Promise.all(d)).filter(c=>c!=null)},Va=()=>{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))},Sm=async e=>{const{block:i,form:l,projectData:s,projectTagsArray:n,projectId:d,addBlock:c,editBlock:m,editProject:g,addTerm:b,notification:_,__:h,handleCloseModal:p,htmlContent:B,reloadBlockScreens:k,onGlobalBlockTemplateSynced:x,onPlainBlockCreated:R}=e;try{const{valid:j,values:N,blockTags:E}=await Ha({form:l,notification:_,__:h});if(!j)return;const I=await Da({blockTags:E,projectTagsArray:n,addTerm:b,project:s,notification:_});await r.createBlock({block:i,form:l,projectId:d,htmlContent:B,values:N,tagIds:I,addBlock:c,editBlock:m,editProject:g,notification:_,reloadBlockScreens:k,projectTagsArray:n,__:h,handleCloseModal:p,onGlobalBlockTemplateSynced:x,onPlainBlockCreated:R})}catch{}},Ha=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}},Br=({isModalVisible:e,htmlContent:i,projectId:l,setIsShowAddAllBlocksModal:s,setIsShowAddAllBlocksModalForNewEmail:n})=>{const{__:d}=r.useI18n(),c=r.useDispatch(),[m]=t.ui_kit$Form.useForm(),[g,b]=(0,a.useState)([]),[_,h]=r.useAddBlockMutation(),[p]=r.useEditBlockMutation(),{data:B}=r.useGetBlockTypesQuery(),k=r.useNotification(),x=r.useAppConfig(),[R,j]=(0,a.useState)([]),N=r.useProjectData(),[E,I]=r.useAddTermMutation(),[$,U]=r.useEditProjectMutation(),v=r.useSendPostMessage(),L=(0,a.useCallback)((te,me)=>{v({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:te,...me?{emBlockVersion:me}:{}}})},[v]),P=(0,a.useCallback)(()=>{v({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_CLEAR_EM_BLOCK_ID})},[v]),{data:z}=r.useGetTermsQuery({project:N,kind:r.BLOCK_TAGS},{skip:!N?.id});(0,a.useEffect)(()=>{j((z||[]).map(te=>({value:te.name})))},[z]),(0,a.useEffect)(()=>{if(B){const te=B;let me=[];for(let je in te)me.push({label:d(r.TYPES_TRANSLATE[te[je]]),value:te[je]});b(me)}},[B,d]);const le=()=>{c(r.closeModal())},C=(0,a.useRef)(!1),re=(0,a.useCallback)(()=>{C.current&&(C.current=!1,m.resetFields())},[m]),ae=()=>{C.current=!0,le()};(0,a.useLayoutEffect)(()=>{e&&re()},[e,re]);const _e=()=>{s(!0),n(!1),le()},Te=async()=>{await Sm({form:m,projectData:N,projectTagsArray:z||[],projectId:l,addBlock:_,editBlock:p,editProject:$,addTerm:E,notification:k,__:d,handleCloseModal:ae,htmlContent:i,reloadBlockScreens:Va,onGlobalBlockTemplateSynced:L,onPlainBlockCreated:P})};return(0,o.jsx)(t.ui_kit$Modal,{title:(0,o.jsx)("div",{className:"ant-modal-title",children:d("Save block")}),open:e,afterClose:re,onOk:()=>_e(),onCancel:le,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:_e,children:d("Save all blocks")},"create-all-blocks"),(0,o.jsx)(t.ui_kit$Button,{className:"add-new-block-modal__save-btn",size:"large",type:"primary",loading:h.isLoading,onClick:Te,icon:(0,o.jsx)(r.EmIcons,{icon:"CreateBlock",component:t.icons$CreateBlock,style:{fontSize:22}}),children:d("Save block")},"submit")]}),children:(0,o.jsxs)(t.ui_kit$Form,{form:m,layout:"vertical",name:"add_new_block_form",onFinish:Te,initialValues:{title:"",type:"",tags:[],global_block:!1},autoComplete:"off",children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:16,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Block name"),name:"title",rules:[{required:!0,message:d("Please input block name")}],style:{marginBottom:15},children:(0,o.jsx)(t.ui_kit$Input,{disabled:h.isLoading||I.isLoading||U.isLoading,size:"large",placeholder:d("Enter block name"),spellCheck:"false"})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Type"),name:"type",rules:[{required:!0,message:d("Please choose block type")}],style:{marginBottom:15},children:(0,o.jsx)(t.ui_kit$Select,{disabled:h.isLoading||I.isLoading||U.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:h.isLoading||I.isLoading||U.isLoading,options:R})}),x.globalBlockCheckboxEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{name:"global_block",valuePropName:"checked",style:{marginBottom:15},children:(0,o.jsx)(t.ui_kit$Switch,{label:d("Global block"),disabled:h.isLoading||I.isLoading||U.isLoading})})]})})};Br.propTypes={};var Tm="https://app.useblocks.io/api".replace(/\/+$/,""),Rm=`${Tm}/wp-json/ai-generator/v1/identificate_blocks`,ym=["Menu","Header","Content","Banners","Lists","Buttons","Promocodes","Feature","Call to Action","E-Commerce","Articles","Polls","Applications","Separators","Contacts","Footer","Other"];async function wm(e){return await e.getInstance(yo.TOKEN_ID)}async function jm(e,i,l,s,n){const d={blocks:s,types:ym,locale:i};l.current=d;try{const c=await wm(n),m=await fetch(Rm,{method:"POST",headers:{"Content-Type":"application/json",...c?{Authorization:`Bearer ${c}`}:{}},body:JSON.stringify(d)});if(!m.ok||m.status!==200)throw new Error(`${m.statusText}`);return await m.json()}catch(c){throw c}}var Im=(e,i="block")=>{const l=new DOMParser,s=l.parseFromString(e,"text/html"),n=s.querySelectorAll(`[em="${i}"]`),d=s.querySelectorAll("link");return{parser:l,document:s,blockElements:n,styleElement:s.querySelector('[em="styles"]'),linksElements:d}};function vm(e){return Array.from(e).map(i=>i.outerHTML).join("")}var Cm=(e,i="block",l=!1)=>{if(!e?.html)return[];const{document:s,blockElements:n,styleElement:d,linksElements:c}=Im(e.html,i),m=vm(c);if(!(n instanceof NodeList))return[];const g=s.querySelector("head"),b=g?g.innerHTML:"";return Array.from(n).map((_,h)=>{if(!(_ instanceof Element)||!_.outerHTML)return null;const p=d?d.outerHTML:"";return{id:`${e.id}-${h}`,html:l?`<!DOCTYPE html>
14
+ <html>
15
+ <head>${b}</head>
16
+ <body>
17
+ <table>${_.outerHTML}</table>
18
+ </body>
19
+ </html>`:r.minifyHtml(`${m}${p}${_.outerHTML.replace(/class="em-structure"/,'class=""')}`)}}).filter(Boolean)};function Pm(e,i,l){const{images:s}=e,{blocks:n}=i;return s?.map(d=>{const c=n.find(m=>m.id===d.block_id);return{blockType:d.classification,blockTitle:d.name,htmlContent:c?.html||"",projectId:l}})}var Am=e=>e.replace(/<div\s+[^>]*style="font-family:[^>]*>(.*?)<\/div>/gs,i=>i.replace(/>(.*?)<\/div>/s,"></div>")),Nm=e=>e.replace(/src="[^"]*"/g,'src=""'),Lm=e=>/<div\s+[^>]*style="font-family:/i.test(e),Om=e=>{const i=new Set,l=[];for(const s of e)if(Lm(s.html)){const n=Nm(Am(s.html));i.has(n)||(i.add(n),l.push(s))}else l.push(s);return l},$m=async e=>{const{block:i,form:l,projectData:s,projectId:n,addBlock:d,editProject:c,notification:m,__:g,handleCloseModal:b,htmlContent:_,reloadBlockScreens:h,values:p,tagIds:B,projectTagsArray:k}=e;try{return await r.createBlock({block:i,form:l,projectId:n,htmlContent:_,values:p,tagIds:B,addBlock:d,editProject:c,notification:m,reloadBlockScreens:h,projectTagsArray:k,__:g,handleCloseModal:b})}catch(x){throw x}},Fm=({projectData:e,addTerm:i,addBlock:l,editProject:s,reloadBlockScreens:n,notification:d,__:c,handleCloseModal:m,setTriggerOpenSavedBlocksTab:g,setTagsOptions:b,form:_,projectId:h})=>{const[p,B]=(0,a.useState)(!1),k=r.useInvalidateProject(),{data:x}=r.useGetTermsQuery({project:e,kind:r.BLOCK_TAGS},{skip:!e?.id});return(0,a.useEffect)(()=>{b((x||[]).map(j=>({value:j.name})))},[x,b]),{bulkSave:async(j,N,E,I)=>{B(!0);try{if(!N)return;const $=await Da({blockTags:I,projectTagsArray:x||[],addTerm:i,project:e,notification:d});let U=!0,v=0;for(const L of j)try{await $m({block:L,form:_,projectData:e,projectId:h,addBlock:l,editProject:s,notification:d,__:c,handleCloseModal:m,values:E,tagIds:$,projectTagsArray:x||[]})}catch{U=!1,v++}if(U&&d.success({id:"BULK_SAVE_SUCCESS",title:c("All blocks saved successfully."),placement:"bottomRight"}),!U){if(v===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(h),n()}catch($){throw $}finally{B(!1),_.resetFields(),m()}},confirmSavingBlocksLoading:p}},Sr=({isModalVisible:e,currentEmail:i,setIsShowAddAllBlocksModal:l,setTriggerOpenSavedBlocksTab:s,projectId:n})=>{const{__:d,_n:c,sprintf:m}=r.useI18n(),g=r.useContainer(),b=r.useProjectData(),{tagsEnabled:_}=r.useAppConfig(),[h,p]=(0,a.useState)(!1),[B]=t.ui_kit$Form.useForm(),[k,x]=(0,a.useState)([]),[R,j]=(0,a.useState)([]),N=(0,a.useRef)({}),[E]=r.useAddTermMutation(),[I]=r.useEditProjectMutation(),[$,U]=r.useAddBlockMutation(),v=r.useEditorLocale()||void 0,L=Cm(i),P=Om(L).map(Te=>Te),z=P.length,le=r.useNotification(),C=()=>{h||ae||l(!1)},{bulkSave:re,confirmSavingBlocksLoading:ae}=Fm({projectData:b,addTerm:E,addBlock:$,editProject:I,reloadBlockScreens:Va,notification:le,__:d,handleCloseModal:C,setTriggerOpenSavedBlocksTab:s,setTagsOptions:j,form:B,projectId:n}),_e=async()=>{try{const{valid:Te,values:te,blockTags:me}=await Ha({form:B,notification:le,__:d});s(!1),p(!0);const je=await jm(i,v,N,P,g),ue=r.wpProjectId(i.project,n??b?.id),Ve=Pm(je,N.current,String(ue??""));p(!1),await re(Ve,Te,te,me)}catch{p(!1),l(!1),le.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:_e,onCancel:C,footer:(0,o.jsx)("div",{className:"modal-footer",children:!(h||ae)&&(0,o.jsx)(t.ui_kit$Button,{size:"large",type:"primary",disabled:h||ae,onClick:_e,children:m(c("Save %d block","Save %d blocks",z),z)},"submit")}),children:[h||ae?(0,o.jsx)("div",{children:d("All blocks saved at this point can be found in the “Saved Blocks” section in the sidebar.")}):(0,o.jsx)("div",{children:m(c("Your letter contains %d block that can be saved for future use.","Your letter contains %d blocks that can be saved for future use.",z),z)}),!(h||ae)&&_&&(0,o.jsx)(t.ui_kit$Form,{form:B,name:"add_all_blocks_form",layout:"vertical",onFinish:_e,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:U.isLoading,options:R})})}),(ae||h)&&(0,o.jsx)("div",{className:"modal-spinner",children:(0,o.jsx)(t.ui_kit$Spin,{size:"large"})})]})};Sr.propTypes={};var Tr=({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(),m=r.useCurrentUser(),g=r.useProjectData()?.projects_test_emails,[b,_]=r.useSendTestEmailMutation(),{token:h}=(0,t.ui_kit$useToken)(),[p,B]=(0,a.useState)(!1);r.useAppConfig(),r.useCookieManager();const k=r.useProjectData(),x=r.testEmailProject(i,k?.id),R=r.testEmailId(d,i,x),{data:j}=r.useGetProjectTestRecipientsQuery(x??0,{skip:!0}),[N,E]=r.useEditProjectMutation(),[I]=r.usePutProjectTestRecipientsMutation(),$=r.useProjectData(),{testEmails:U}=r.useAppConfig(),v=r.usePushToDataLayer(),[L,P]=(0,a.useState)([]),[z,le]=(0,a.useState)(!1),C=r.useEventEmitter(yo.events.ON_SEND_EMAIL_MODAL_ID);(0,a.useEffect)(()=>{e?C.fire(i).then(te=>{te.some(me=>me===!1)?n(r.closeModal$1()):B(e)}):B(e)},[e,n,B,i,C]),(0,a.useEffect)(()=>{},[$,x,j]),(0,a.useEffect)(()=>{P(U.map(te=>({value:te})))},[U]),(0,a.useEffect)(()=>{const te=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails);if(te&&p&&s.getFieldValue("recipients")?.length===0){const me=JSON.parse(te);me?.[x]&&s.setFieldsValue({recipients:me[x]})}},[x,p,s]),(0,a.useEffect)(()=>{s.setFieldsValue({subject:i.subject})},[s,i.subject]);const re=()=>{n(r.closeModal$1()),s.resetFields()},ae=r.useContentReader(),_e=()=>{s.validateFields().then(()=>{const te={user_id:m.id,project_id:x,email_id:R,subject:s.getFieldValue("subject"),email:s.getFieldValue("recipients").join(","),html:r.encodedHtml(ae())};b(te).unwrap().catch(me=>{c.error({error:{data:{code:me?.data?.code,message:me?.data?.message}}})}),le(!0),v({event:"submit",action:"send_test_email",entity_id:d,project_id:x,recipients_count:s.getFieldValue("recipients").length})}).catch(te=>{})},Te=a.default.useRef(g);return Te.current=g,(0,a.useEffect)(()=>{const te=Te.current;if(_.isSuccess&&z){_.data?.status;{const me=[...new Set([...L.map(he=>he.value),...s.getFieldValue("recipients")])],je=me.map(he=>({projects_test_email:he}));((he,be)=>{if(!he||!be)return he===be;if(he.length!==be.length)return!1;const Z=he.map(q=>q.projects_test_email).sort(),K=be.map(q=>q.projects_test_email).sort();return Z.every((q,Q)=>q===K[Q])})(je,r.isProjectsV2Enabled()?(j||[]).map(he=>({projects_test_email:he})):te)||(r.isProjectsV2Enabled()?I({projectId:x,emails:me}):N({projectId:x,projects_test_emails:je}));const Ve=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails)?JSON.parse(localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails)):[];let Le=s.getFieldValue("recipients");localStorage.setItem(r.LOCAL_STORAGE_ITEMS.em_test_emails,JSON.stringify({...Ve,[x]:[...new Set(Le)]}));const ve=i.title||i.subject||l("Untitled email.").replace(/\.$/,"");c.success(l("The email “")+ve+l("” was successfully sent."))}le(!1),s.resetFields(),n(r.closeModal$1())}},[_,s,x,N,I,j,L,z,n,i.title,i.subject,c,E,l]),(0,a.useEffect)(()=>{E.isError&&(c.error(E),le(!1),s.resetFields(),n(r.closeModal$1()))},[n,E,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:p,onCancel:re,footer:[(0,o.jsx)(t.ui_kit$Button,{size:"large",className:"em-analytics__email-send-test",type:"primary",htmlType:"submit",form:"Send mail",loading:E.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:_e,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:(te,me)=>me.length>10?Promise.reject(new Error(l("A test email can be sent to a maximum of 10 addresses."))):me.length!==0?me.every(je=>r.emailValidation.test(je.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:L,tagRender:te=>{const{label:me,closable:je,onClose:ue}=te,Ve=Le=>{Le.preventDefault(),Le.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:h.colorPrimary,onMouseDown:Ve,closable:je,onClose:ue,style:{borderRadius:6},children:me})},getPopupContainer:()=>document.getElementById("send_mail_form")})})]})})};Tr.propTypes={isModalVisible:f.default.bool,email:f.default.shape({html:f.default.string,subject:f.default.string})};var Mm=ho.__exportAll({AddAllBlocksModal:()=>Sr,AddNewBlockModal:()=>Br,BlocksSearch:()=>kr,Discuss:()=>$a,DiscussAi:()=>fa,EmailProperties:()=>us,EmailSettings:()=>Yi,EmailStyles:()=>or,FileManagerDataLayer:()=>Ca,HistoryPanel:()=>Er,LimitUpgradeModal:()=>ci,Optimise:()=>ja,SaveBlockBtn:()=>Ir.SaveBlockBtn,SelectedElementPanel:()=>pt,SendTestEmailModal:()=>Tr});Bo.AddAllBlocksModal=Sr,Bo.AddNewBlockModal=Br,Bo.BlocksSearch=kr,Bo.Discuss=$a,Bo.DiscussAi=fa,Bo.EmailProperties=us,Bo.EmailSettings=Yi,Bo.EmailStyles=or,Bo.FileManagerDataLayer=Ca,Bo.HistoryPanel=Er,Bo.LimitUpgradeModal=ci,Bo.LimitUpgradeModal$1=ci,Bo.Optimise=ja,Bo.SaveBlockBtn=Ir.SaveBlockBtn,Bo.SelectedElementPanel=pt,Bo.SendTestEmailModal=Tr,Bo.getImageDimensionsFromBlob=vr,Object.defineProperty(Bo,"panels_exports",{enumerable:!0,get:function(){return Mm}}),Bo.resolveDataProviderPreview=Cr,Bo.shouldCountAiUsage=pr,Bo.useImageBlobFetch=Pr});