useblocks 1.3.11-dev.2 → 1.3.11-dev.3

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 (68) hide show
  1. package/README.md +1 -1
  2. package/iframe/.vite/manifest.json +4 -4
  3. package/iframe/{iframe-eblock.fd4347fc.html → iframe-eblock.5751e42b.html} +2 -2
  4. package/iframe/{iframe.fd4347fc.html → iframe.5751e42b.html} +2 -2
  5. package/iframe/js/elMarkupHelper.BpDXO-hq.js +279 -0
  6. package/iframe/js/{iframe-eblock.body.fd4347fc.js → iframe-eblock.body.5751e42b.js} +1 -1
  7. package/iframe/js/iframe-eblock.js +2 -2
  8. package/iframe/js/{iframe.body.fd4347fc.js → iframe.body.5751e42b.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/{6ec347ff.js → 11009bdf.js} +1 -1
  13. package/static/core/{846cd365.js → 11dadbc0.js} +1 -1
  14. package/static/core/{31d22827.js → 1c06cdb7.js} +1 -1
  15. package/static/core/{31da6da0.js → 1c3a16fc.js} +1 -1
  16. package/static/core/{d48488c4.js → 1c7a6d45.js} +1 -1
  17. package/static/core/{ab741434.js → 257745eb.js} +1 -1
  18. package/static/core/{939d4a62.js → 261a3a42.js} +1 -1
  19. package/static/core/2bed6a18.js +7 -0
  20. package/static/core/347b0a0b.js +1 -0
  21. package/static/core/{2865f716.js → 3b65bc50.js} +1 -1
  22. package/static/core/{bbf48eb9.js → 3d8e2478.js} +1 -1
  23. package/static/core/{5fd45688.js → 3eeb4445.js} +1 -1
  24. package/static/core/{17c8ebc4.js → 467344d4.js} +1 -1
  25. package/static/core/{c5128299.js → 513e36bd.js} +1 -1
  26. package/static/core/{579d4466.js → 516f59e7.js} +1 -1
  27. package/static/core/{9d57053a.js → 58dca22f.js} +1 -1
  28. package/static/core/{9438888a.js → 5da33486.js} +1 -1
  29. package/static/core/{752288e6.js → 6172f09a.js} +1 -1
  30. package/static/core/{12963ed5.js → 62855b97.js} +1 -1
  31. package/static/core/{1fcc0627.js → 66113a18.js} +1 -1
  32. package/static/core/{7934ed7e.js → 71727873.js} +1 -1
  33. package/static/core/{c33a9c36.js → 76543cb2.js} +1 -1
  34. package/static/core/{e9281a4c.js → 7e329493.js} +1 -1
  35. package/static/core/{70749936.js → 8406bab5.js} +1 -1
  36. package/static/core/{925b75fb.js → 8845436d.js} +2 -2
  37. package/static/core/{e37da9a7.js → 94f9492b.js} +1 -1
  38. package/static/core/{153a5a27.js → aee84e3d.js} +1 -1
  39. package/static/core/{78500214.js → b55ae539.js} +1 -1
  40. package/static/core/{8d0796c1.js → b59c63d2.js} +1 -1
  41. package/static/core/{37bf0f7a.js → b9f553d7.js} +1 -1
  42. package/static/core/{b0edd3a1.js → bda2d9d5.js} +1 -1
  43. package/static/core/{9916b298.js → c0a3f7d0.js} +2 -2
  44. package/static/core/{4181d334.js → c13b3d4f.js} +1 -1
  45. package/static/core/{2d58a94b.js → d2cf6b4b.js} +1 -1
  46. package/static/core/{983a408d.js → d343e46e.js} +1 -1
  47. package/static/core/{3a5bea82.js → d9d5b376.js} +1 -1
  48. package/static/core/{cc4657d9.js → dd008ec2.js} +1 -1
  49. package/static/core/{3ca0af3d.js → e037a420.js} +1 -1
  50. package/static/core/{f8f52e6d.js → e698ec22.js} +1 -1
  51. package/static/core/{13a6a2d3.js → e7e888c1.js} +1 -1
  52. package/static/core/ed65b5c3.js +19 -0
  53. package/static/core/{66b856ca.js → ef035f6b.js} +1 -1
  54. package/static/core/{dda98b73.js → f1b8515a.js} +1 -1
  55. package/static/core/{ae251a52.js → f8585ce6.js} +1 -1
  56. package/static/esm/{f97f42d1.js → c5372168.js} +1 -1
  57. package/static/umd-runtime/{runtime.CQCs2kHH.js → runtime.Lgfb59e0.js} +1 -1
  58. package/useblocks-core.5751e42b.js +875 -0
  59. package/useblocks-esm.js +6 -6
  60. package/{useblocks-po.fd4347fc.js → useblocks-po.5751e42b.js} +1 -1
  61. package/useblocks.d.ts +2 -2
  62. package/useblocks.js +12 -12
  63. package/vendor/useblocks-ui-kit/package.json +1 -1
  64. package/iframe/js/elMarkupHelper.DLCHSWwj.js +0 -279
  65. package/static/core/4f5add14.js +0 -1
  66. package/static/core/68e393e4.js +0 -19
  67. package/static/core/f126c14c.js +0 -7
  68. package/useblocks-core.fd4347fc.js +0 -875
@@ -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/eb2aeda1.js",["require","exports","module","static/core/2ff39ddf.js","static/core/a42ab03f.js","static/core/43bfb22e.js","react","react/jsx-runtime","__delivery__/libs","classnames"],function(B,I,De){const J=B("./2ff39ddf.js"),r=B("./a42ab03f.js"),u=B("./43bfb22e.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/43bfb22e.js",["require","exports","module","static/core/2ff39ddf.js","static/core/a42ab03f.js","react","react/jsx-runtime","__delivery__/libs"],function(t,e,S){const i=t("./2ff39ddf.js"),o=t("./a42ab03f.js");let r=t("react");r=i.__toESM(r);let l=t("react/jsx-runtime"),d=t("__delivery__/libs");function n(){return o.usePlanFeatureGate("google_fonts").isLocked?void 0:o.loadGFonts}var u=c=>{const{form:g,namePrefix:s="",typeOfForm:I="desktop"}=c,E=o.useSelector(o.selectEmailSettings).usedColors;return(0,l.jsx)(d.ui_kit$FormBorderInputs,{form:g,namePrefix:s,typeOfForm:I,usedColors:E})},b={paddingTop:"top",paddingLeft:"left",paddingRight:"right",paddingBottom:"bottom",mobilePaddingTop:"top",mobilePaddingLeft:"left",mobilePaddingRight:"right",mobilePaddingBottom:"bottom"},m={borderRadiusAll:"all",borderRadiusTopLeft:"topLeft",borderRadiusBottomLeft:"bottomLeft",borderRadiusTopRight:"topRight",borderRadiusBottomRight:"bottomRight"},R={mobileBorderRadiusAll:"all",mobileBorderRadiusTopLeft:"topLeft",mobileBorderRadiusBottomLeft:"bottomLeft",mobileBorderRadiusTopRight:"topRight",mobileBorderRadiusBottomRight:"bottomRight"},a={all:"borderAll",top:"borderTop",right:"borderRight",bottom:"borderBottom",left:"borderLeft"},O={all:"mobileBorderAll",top:"mobileBorderTop",right:"mobileBorderRight",bottom:"mobileBorderBottom",left:"mobileBorderLeft"},_={width:null,style:null,color:null},B={borderAll:"all",borderTop:"top",borderRight:"right",borderBottom:"bottom",borderLeft:"left"},f={mobileBorderAll:"all",mobileBorderTop:"top",mobileBorderRight:"right",mobileBorderBottom:"bottom",mobileBorderLeft:"left"};Object.defineProperty(e,"BORDER_POSITIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"BORDER_RADIUS_POSITION",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"MOBILE_BORDER_POSITIONS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"MOBILE_BORDER_RADIUS_POSITION",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"MOBILE_REVERSE_BORDER_POSITIONS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"NULL_BORDER",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"PADDING_POSITION",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"REVERSE_BORDER_POSITIONS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"SelectedElementFormBorder",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"useGoogleFontsLoader",{enumerable:!0,get:function(){return n}})});
5
+
6
+ __useblocks__.define("static/core/a36f6cb5.js",["require","exports","module","static/core/2ff39ddf.js","static/core/a42ab03f.js","static/core/b503e1b2.js","vite/preload-helper"],function(h,I,B){const D=h("./2ff39ddf.js"),n=h("./a42ab03f.js"),p=h("./b503e1b2.js");let R=h("vite/preload-helper");var b=D.__exportAll({IMPORT_UPLOAD_CONCURRENCY:()=>15,createDocumentProcessor:()=>W,createFileProcessor:()=>T,createImportFileNamer:()=>_,ensureFileExtension:()=>$,extractUploadResult:()=>F,fetchFileData:()=>U,getExt:()=>C,handleUploadResult:()=>j,importEmail:()=>L,importHtml:()=>x,importZip:()=>P,splitFileName:()=>M,uploadFile:()=>n.uploadFile});function C(e){const t=e.split(".");return t[t.length-1].toLowerCase()}function M(e){const t=e.split(".");return t[t.length-1].toLowerCase()}var w="index.html";function H(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function _(){const e=new Map;return(t,r)=>{const s=r.toLowerCase(),a=e.get(s);if(a===void 0)return e.set(s,t),r;if(a===t)return r;const i=r.lastIndexOf("."),l=`-${H(t)}`;return i>0?`${r.slice(0,i)}${l}${r.slice(i)}`:`${r}${l}`}}function E(e,t){return e.find(r=>r.toLowerCase().endsWith(t))}async function P(e,t,r){const s=await n.readZip(e),a=Object.keys(s),i=s[w]&&w||E(a,w)||E(a,".html")||E(a,".htm");if(i){const l=i.split("/"),d=document.location.pathname.split("/"),u=document.location.origin+d.slice(0,d.length-l.length).join("/")+"/",f=n.zipEntryToText(s[i]),{html:N,hasBrowserExtensionArtifacts:m}=n.prepareEmailHtmlForEditor(f),g=l.slice(0,l.length-1).join("/"),v=_();return{html:await p.changeHtml(N,async c=>{const y=c.document;await p.replaceImagesInDocument(y,async o=>{o=o.replace("\\","/"),o.startsWith(".")&&(o=o.substring(1)),o.startsWith("/")&&(o=o.substring(1)),o.startsWith(u)&&(o=o.substring(u.length)),g&&!o.match("^(ht|f)tp(s?)://")&&(o=`${g}/${o}`);const A=s[o];return A?t(n.zipEntryToBlob(A),o):t(o,v(o,p.getFileNameWithExt(o)))}),r&&r(c)}),hasBrowserExtensionArtifacts:m,sourceHtml:f}}}async function x(e,t,r){const{html:s,hasBrowserExtensionArtifacts:a}=n.prepareEmailHtmlForEditor(e),i=_();return{html:await p.changeHtml(s,async l=>{const d=l.document;await p.replaceImagesInDocument(d,async u=>(u=u.replace("\\","/"),t(u,i(u,p.getFileNameWithExt(u))))),r&&r(l)}),hasBrowserExtensionArtifacts:a,sourceHtml:e}}async function L(e,t,r){if(e)switch(C(e.name)){case"zip":return P(e,t,r);case"eml":{const s=await e.arrayBuffer(),{default:a}=await(0,R.__vitePreload)(async()=>{const{default:l}=await Promise.resolve().then(()=>h("./6561b34a.js"));return{default:l}},void 0,{}.url),i=(await a.parse(s)).html??void 0;if(typeof i>"u")throw new Error("Eml does not contain text/html");return x(i,t,r)}default:return x(await e.text(),t,r)}}async function U(e,t){if(typeof e!="string")return e;try{const r=await t({url:n.normalizeUrl(e)});return r?.data,r?.data||null}catch{return null}}async function $(e,t){if(!e||typeof e!="string")return`default.${await n.getMimeExtension(t)||"bin"}`;if(e.split(".").length<2){const r=await n.getMimeExtension(t);if(r)return`${e}.${r}`}return e}function F(e){if(e&&typeof e=="object"&&!Array.isArray(e)&&"code"in e&&"message"in e&&e.data){if(e.data.status===400)return{file_url:null,error:{code:e.code,message:e.message,status:e.data.status}};if(e.data.file_url)return{file_url:e.data.file_url,error:null}}if(Array.isArray(e)&&e.length>0){const t=e[0];if(t&&typeof t=="object"){if("code"in t&&"message"in t&&t.data?.status===400)return{file_url:null,error:{code:t.code,message:t.message,status:t.data.status}};if("file_url"in t&&t.file_url)return{file_url:t.file_url,error:null}}}if(e&&typeof e=="object"&&!Array.isArray(e)&&0 in e){if(e.data?.status===400)return{file_url:null,error:{status:e.data.status}};if(e[0]?.file_url)return{file_url:e[0].file_url,error:null}}return{file_url:null,error:null}}function j(e,t){if(!e||e.error)return typeof t=="string"?t:"";const r=F(e.data);return r.error?typeof t=="string"?t:"":r.file_url?r.file_url:typeof t=="string"?t:""}var z=15;function O(e){let t=0;const r=[],s=()=>{t--,r.shift()?.()};return async a=>{t>=e&&await new Promise(i=>r.push(i)),t++;try{return await a()}finally{s()}}}var T=(e,t,r,s,a)=>{const{maxSizeMB:i,maxWidthOrHeight:l}=n.resolveImageCompressionLimits(a),d=n.getBrowserImageCompressionLibUrl(),u=O(15);return(f,N)=>u(async()=>{try{const m=await U(f,e);if(!m)return typeof f=="string"?f:"";const g=await $(N,m.type),v=m.type?.trim()||n.inferImageMimeFromFileName(g)||"";let c=new File([m],g.toLowerCase(),{type:v});if(n.isAllowedImageUploadFile(c)){const y=c.type?.trim()||n.inferImageMimeFromFileName(c.name)||m.type||"";try{c=await n.prepareImageForUpload(c,{maxSizeMB:i,maxWidthOrHeight:l,mimeType:y||m.type,fileName:c.name,libURL:d,enableCompression:n.shouldEnableImageCompression(a,y),convertSvgToPng:!0})}catch{}}return j(await t({user_id:r.id,folder:s.id,file:c}),f)}catch{return typeof f=="string"?f:""}})},W=e=>t=>{const r=t.document;r.title=(r.querySelector("title")?.textContent??"").replace(/\s+/g," ").trim()||p.getFileNameAndExt(e.name)[0]};Object.defineProperty(I,"extractUploadResult",{enumerable:!0,get:function(){return F}}),Object.defineProperty(I,"import_exports",{enumerable:!0,get:function(){return b}})});
7
+
8
+ (function(){try{if(typeof document<"u"){var t='.blocks-app .upload-bg-image{margin-bottom:calc(var(--ub-formItemMarginBottomXS) * 1px)}.blocks-app .upload-bg-image__inner-wrap{border:calc(var(--ub-borderWidth) * 1px) solid var(--ub-colorFillSecondaryDarken);border-radius:calc(var(--ub-borderRadius) * 1px);cursor:pointer;background-color:var(--ub-colorBgContainer);justify-content:space-between;align-items:center;transition:all .2s linear .2s;display:flex}.blocks-app .upload-bg-image__inner-wrap:hover{border-color:var(--ub-borderColorHover)}.blocks-app .upload-bg-image__uploader{width:calc((var(--ub-formControlHeight) - var(--ub-borderWidth) * 2 + 1) * 1px);height:calc((var(--ub-formControlHeight) - var(--ub-borderWidth) * 2) * 1px);border-radius:calc(var(--ub-borderRadius) * .8px);border:none;border-right:1px solid var(--ub-colorFillSecondaryDarken);flex-shrink:0;margin-right:10px;overflow:hidden}.blocks-app .upload-bg-image__uploader-content{background:0 0;flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%;font-size:11px;display:flex}.blocks-app .upload-bg-image__uploader-content-inner{width:inherit;height:inherit;position:relative}.blocks-app .upload-bg-image__uploader-img-wrap{width:inherit;height:inherit;z-index:1;border:none;position:absolute;overflow:hidden}.blocks-app .upload-bg-image__uploader-img-wrap:after{opacity:0;content:"";transition:opacity .3s;position:absolute;inset:0}.blocks-app .upload-bg-image__uploader-content:hover .upload-bg-image__uploader-img-wrap:after{opacity:1}.blocks-app .upload-bg-image .upload-bg-image__empty{border-top:2px solid var(--ub-colorError);z-index:2;width:27px;position:absolute;top:16px;left:3px;transform:rotate(-45deg)}.blocks-app .upload-bg-image .inputGroup{flex-direction:column;width:100%;display:flex}.blocks-app .upload-bg-image .image-size{color:var(--ub-colorTextTertiary);padding-right:15px;font-size:12px}.blocks-app .upload-bg-image .image-empty-text,.blocks-app .upload-bg-image .image-size-splitter{color:var(--ub-colorTextQuaternary)}.blocks-app .upload-bg-image__edit,.blocks-app .upload-bg-image__edit-menu{color:var(--ub-colorLink);right:calc((var(--ub-borderWidth) + 2) * 1px);padding:6px;line-height:1;position:absolute}.blocks-app .upload-bg-image__edit{right:calc((var(--ub-borderWidth) + 32) * 1px);position:absolute}.blocks-app .upload-bg-image__uploader-icons-wrap{z-index:2;width:inherit;height:inherit;opacity:1;cursor:pointer;justify-content:center;align-items:center;transition:opacity .3s;display:flex;position:relative}.blocks-app .upload-bg-image__uploader-content:hover .upload-bg-image__uploader-icons-wrap{opacity:.85}.blocks-app .upload-bg-image__uploader-icons-wrap-upload{z-index:1;width:inherit;height:inherit;opacity:.8;cursor:pointer;justify-content:center;align-items:center;transition:opacity .3s;display:flex;position:relative}.blocks-app .upload-bg-image__uploader-content:hover .upload-bg-image__uploader-icons-wrap-upload{opacity:.85}.blocks-app .upload-bg-image__uploader-icons-wrap-upload .upload-bg-image__uploader-content:empty{background-color:var(--ub-colorFillSecondary);border-radius:calc(var(--ub-borderRadius) * 1px)}.blocks-app .upload-bg-image__uploader-link,.blocks-app .upload-bg-image__uploader-link:hover{color:#fff}.blocks-app .upload-bg-image__uploader-icon{color:#fff;margin:0 3px;font-size:14px}.blocks-app .upload-bg-image__uploader-img{object-fit:cover;width:100%;height:100%;display:block!important}.blocks-app .upload-bg-image__uploader-img-placeholder{width:100%;height:100%;display:block}.blocks-app .upload-bg-image__uploader-icon-btn{cursor:pointer;background:0 0;border:0;margin:0;padding:0}.blocks-app .upload-bg-image__input{border-color:var(--ub-colorFillSecondaryDarken)}.blocks-app .upload-bg-image__uploader .ant-upload-select{cursor:pointer;width:100%;height:100%;display:block}.blocks-app .upload-bg-image__uploader .ant-upload-select .ant-upload{width:100%;height:100%;display:block}.dark .blocks-app .upload-bg-image__uploader{border-right:1px solid var(--ub-colorBorder)}.blocks-app .countdown-color .color-picker-input__picker-holder{z-index:auto;left:auto;right:-10px}.blocks-app .email-pane .box-shadow-control .ant-collapse-panel,.blocks-app .email-pane .border-control .ant-collapse-panel,.blocks-app .box-shadow-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body,.blocks-app .border-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body{overflow:visible}.blocks-app .selected-image-form_busy{position:relative}.blocks-app .selected-image-form__loader{z-index:5;background-color:color-mix(in srgb, var(--ub-colorBgContainer) 60%, transparent);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);box-shadow:28px 0 0 0 color-mix(in srgb, var(--ub-colorBgContainer) 60%, transparent), -28px 0 0 0 color-mix(in srgb, var(--ub-colorBgContainer) 60%, transparent);position:absolute;inset:0}.blocks-app .selected-image-form__loader-body{flex-direction:column;justify-content:center;align-items:center;gap:16px;height:100%;display:flex;position:absolute;top:0;left:0;right:0}.blocks-app .selected-image-form__loader-title{color:var(--ub-colorTextSecondary);text-align:center;padding:0 24px;font-size:13px}.blocks-app .selected-text-common-form__border-radio{position:relative}.blocks-app .selected-text-common-form__border-radio:after{content:"·";border:3px solid var(--ub-colorPrimary);border-radius:50%;font-size:0;line-height:0;position:absolute;top:2px;right:2px}.blocks-app .selected-text-common-form__border-col{margin-top:22px;margin-bottom:10px}@media (width<=1840px){.blocks-app .selected-text-common-form__border-col{margin-top:0}}.blocks-app .selected-text-common-form__border-item.ant-form-item .ant-row{flex-direction:row;align-items:center}.blocks-app .selected-text-common-form__border-item.ant-form-item .ant-row .ant-col.ant-form-item-label{white-space:nowrap;padding-top:6px}.blocks-app .selected-text-common-form__padding-input{max-width:46px;margin-bottom:0}.blocks-app .selected-text-common-form__padding-input input{text-align:center;padding:4px 8px}.blocks-app .selected-text-common-form__padding-input .ant-input-number-focused input{text-align:left}.blocks-app .selected-text-common-form__button--active,.blocks-app .selected-text-common-form__button--active:focus{color:#40a9ff;border-color:#40a9ff}.blocks-app .selected-text-common-form__br-input{margin-bottom:10px}.blocks-app .selected-text-common-form__tooltip{margin-left:4px}.blocks-app .selected-text-common-form__icon-radius{width:16px;height:100%}.blocks-app .selected-text-common-form__block{margin-bottom:24px}.blocks-app .selected-text-common-form__button_style{padding-left:10px;padding-right:10px;transition:none}.blocks-app .selected-text-common-form__format-toolbar{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:4px;display:flex}.blocks-app .selected-text-common-form__format-toolbar .ant-form-item{margin-bottom:0}.blocks-app .ant-app .bullet-type .ant-select-selector{padding-left:5px}.blocks-app .selected_text_common_form_mobile .ant-form-item{margin:0}.blocks-app .selected_text_common_form_mobile .ant-input-number-affix-wrapper{padding-inline-start:7px}.blocks-app .selected_text_common_form_mobile .ant-select-single:not(.ant-select-customize-input) .ant-select-selector,.blocks-app .selected_text_common_form_mobile .ant-input-number-group .ant-input-number-group-addon{padding:0 7px}.blocks-app .selected_text_common_form_mobile .ant-input-number .ant-input-number-handler-wrap{width:16px}.blocks-app .selected_text_common_form_mobile .ant-select .ant-select-arrow{inset-inline-end:7px;font-size:10px!important}.blocks-app .selected_text_common_form_mobile .ant-divider-vertical{height:46px;top:0}.blocks-app .selected_text_common_form_mobile .selected_text_common_form_mobile__group{padding:6px 0}.blocks-app .selected_text_common_form_mobile .selected-td-form__button{background:var(--ub-colorFillSecondary);width:34px;height:34px;border:1px solid #0000!important}.blocks-app .selected_text_common_form_mobile .ant-btn-default:not(:disabled,.ant-btn-disabled,.email-pane__content-col .selected-td-form__button--active):hover{background:var(--ub-colorFillSecondaryDarken);color:inherit;border-color:#0000}.blocks-app .selected_text_common_form_mobile .selected-td-form__button--active{background:var(--ub-colorPrimaryBg);color:var(--ub-colorPrimary);border-color:#0000}.blocks-app .selected_text_common_form_mobile .selected-td-form__button--active:hover{background:var(--ub-colorPrimaryBgHover)!important;color:var(--ub-colorPrimaryTextHover)!important}.blocks-app .selected_text_common_form_mobile .color-picker-input{width:34px;height:34px}.blocks-app .selected_text_common_form_mobile .color-picker-input .ant-input-affix-wrapper{display:none}.blocks-app .selected_text_common_form_mobile .color-picker-input__control-wrap .ant-color-picker-trigger{border:1px solid var(--ub-colorFillSecondaryDarken);width:34px;height:34px;top:0;left:0}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper{background:var(--ub-colorFillSecondary);height:34px;padding:0 9px;border:1px solid #0000!important}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper:not(.ant-radio-button-wrapper-checked):hover{color:inherit;background:var(--ub-colorFillSecondaryDarken)}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper.ant-radio-button-wrapper-checked{background:var(--ub-colorPrimaryBg);color:var(--ub-colorPrimary)}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper.ant-radio-button-wrapper-checked:hover{background:var(--ub-colorPrimaryBgHover);color:var(--ub-colorPrimaryTextHover)}.blocks-app .selected_text_common_form_mobile .codemode-textalign-dropdown{background-color:var(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadius) * 1px);box-shadow:var(--ub-boxShadowSecondary);padding:6px}.blocks-app .mobile-background-image-field .upload-bg-image{margin-bottom:0}.blocks-app .selected_element_vindent_values{font-size:12px}.blocks-app .selected_element_vindent_values span{cursor:pointer;margin-right:10px}.blocks-app .selected_element_vindent_values span:hover{color:#40a9ff}.blocks-app .selected-td-form__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/ed65b5c3.js",["require","exports","module","static/core/2ff39ddf.js","static/core/cf7d1dd7.js","static/core/a42ab03f.js","static/core/b503e1b2.js","static/core/a36f6cb5.js","static/core/43bfb22e.js","static/core/1c3a16fc.js","static/core/1c06cdb7.js","static/core/b59c63d2.js","static/core/76543cb2.js","static/core/347b0a0b.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("./a42ab03f.js"),ui=fo("./b503e1b2.js"),Qa=fo("./a36f6cb5.js"),D=fo("./43bfb22e.js"),Zo=fo("./1c3a16fc.js"),Qe=fo("./1c06cdb7.js"),mi=fo("./b59c63d2.js"),Nt=fo("./76543cb2.js"),vr=fo("./347b0a0b.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 Ir(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):"",v=_?.id!=="0"?String(_.id):"",{dataProvider:$}=(0,a.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:j,projectId:E,restApi:N,i18n:{__:k},pathPostfix:v,appConfig:p,isStandalone:B}),[p,B,E,N,j,v,k]),H=Pr(),[I]=r.useLazyGetImageInfoQuery(),[L,P]=(0,a.useState)({width:"",height:"",size:""}),[z,le]=(0,a.useState)(!1),[C,oe]=(0,a.useState)(0),[ne,ge]=(0,a.useState)(""),ye=(0,a.useRef)(""),te=(0,a.useRef)(g?.counter||0),pe=Zo.useImageBlobResolver(),we=(0,a.useRef)(""),me=(0,a.useRef)(""),[Me,Le]=(0,a.useState)(0),ve=r.usePlanFeatureGate("image_editor"),re=()=>{we.current&&(URL.revokeObjectURL(we.current),we.current="")};(0,a.useEffect)(()=>{if(!i){P({width:"",height:"",size:"",format:""}),ye.current="",ge(""),re();return}if(i.startsWith("data:")||i.startsWith("blob:")){re(),ye.current=i,ge(i),P({width:"",height:"",size:"",format:""});return}const G=r.stripEmVersionFromUrlString(i);me.current=G;const U=Zo.canonicalImageUrlKey(G),Y=new AbortController;let q=!1;const se=async Se=>{re();const Ee=Me?r.appendEmVersionForPreviewReload(Se):Se;ye.current=Ee,ge(Ee);try{const{data:Oe}=await I(G);return q||!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}},ue=async()=>{const Se=await pe.resolve(U,Y.signal,H);if(q)return;const{width:Ee,height:Oe}=await Ir(Se);if(q)return;re();const X=URL.createObjectURL(Se);we.current=X,ye.current=X,ge(X),P({width:Ee,height:Oe,size:(Se.size/1024).toFixed(0),format:Zo.normalizeImageFormatForDisplay(Se.type)})};return(async()=>{try{if(!B){const Se=await Cr($,G);if(Se?.previewUrl&&await se(Se.previewUrl))return}await ue()}catch{q||(re(),ye.current="",ge(""),P({width:"",height:"",size:"",format:""}))}})(),()=>{q=!0,Y.abort()}},[i,$,H,I,B,pe,Me]);const ie=(0,a.useCallback)(()=>{const G=me.current;G&&pe.abandonKey(Zo.canonicalImageUrlKey(G)),Le(Date.now())},[pe]);(0,a.useEffect)(()=>{!g?.counter||g.name!==d||g.counter!==te.current&&(te.current=g.counter,ie())},[d,g,ie]),(0,a.useEffect)(()=>()=>re(),[]);const ee=!!i&&!_t(r.stripEmVersionFromUrlString(String(i))),Q=async(G=null)=>{const U=d.startsWith("src"),Y=G||(U?r.MODALS.UPLOAD_IMAGE_MODAL:r.MODALS.UPLOAD_BACKGROUND_MODAL),q=r.stripEmVersionFromUrlString(i||""),se=await R({kind:U?"img":"background",currentUrl:_t(q)?"":q,entryModal:Y});if(!se?.url)return;const ue=q===r.stripEmVersionFromUrlString(se.url);(!ue||se.url!==i)&&e(se.url),se.meta?.mode==="save"&&ue&&(ie(),U&&x(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(se.url)}))},K=[{label:k("Upload"),key:"Upload",onClick:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}];p.imageCenterStockEnabled&&K.push({label:k("Stock"),key:"Stock",onClick:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_STOCK:r.MODALS.UPLOAD_BACKGROUND_MODAL_STOCK)}),p.imageCenterGifEnabled&&K.push({label:k("GIF"),key:"GIF",onClick:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_GIF:r.MODALS.UPLOAD_BACKGROUND_MODAL_GIF)}),p.elementAIimageEnabled&&K.push({label:k("AI"),key:"AI",onClick:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_AI:r.MODALS.UPLOAD_BACKGROUND_MODAL_AI)});const Z=()=>{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:G=>{G.target?.closest(".upload-bg-image__edit")||G.target?.closest(".upload-bg-image__edit-menu")||G.target?.closest(".upload-bg-image__menu")||G.target?.closest(".inputGroup")||Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)},children:[(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,popupRender:()=>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:G=>G.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:ne?(0,o.jsx)("img",{className:"upload-bg-image__uploader-img",src:ne,alt:"",onLoad:()=>{b&&Ar(r.stripEmVersionFromUrlString(i||""))&&b("success")},onError:()=>{const G=me.current,U=r.stripEmVersionFromUrlString(ne||""),Y=r.stripEmVersionFromUrlString(G||"");if(G&&U!==Y){ye.current=G,ge(G);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&&ee?(le(!0),oe(r.FEATURE_UPSELL_SLIDE.image_editor)):Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_EDIT:r.MODALS.UPLOAD_BACKGROUND_MODAL_EDIT)}})})}),(0,o.jsx)(t.ui_kit$Dropdown,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:K},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:()=>Q(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:()=>Q(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD),icon:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image,size:16,strokeWidth:p.iconStrokeWidth}),children:k("Add image")}),z&&(0,o.jsx)(r.PlanUpgradePrompt,{open:!0,onCancel:Z,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?D.MOBILE_BORDER_RADIUS_POSITION:D.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,v=P=>{x(P)},$=()=>{const P=!c;e.setFieldValue("countdownNumbersStrong",P),l({countdownNumbersStrong:P}),m(P)},H=()=>{const P=!g;e.setFieldValue("countdownNumbersItalic",P),l({countdownNumbersItalic:P}),b(P)},I=()=>{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:v})})})]}),(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:H,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:I,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,[D.BORDER_RADIUS_POSITION[Ti]]:g[Ti],[D.BORDER_RADIUS_POSITION[Si]]:g[Si],[D.BORDER_RADIUS_POSITION[Bi]]:g[Bi],[D.BORDER_RADIUS_POSITION[Ei]]:g[Ei],[D.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case Ti:case Si:case Bi:case Ei:m={borderRadius:{...e.borderRadius,[D.BORDER_RADIUS_POSITION[Lr]]:null,[D.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case nn:case fi:case _i:case xi:case ki:m={mobileBorderRadius:{...e.mobileBorderRadius,[D.MOBILE_BORDER_RADIUS_POSITION[fi]]:g[fi],[D.MOBILE_BORDER_RADIUS_POSITION[_i]]:g[_i],[D.MOBILE_BORDER_RADIUS_POSITION[xi]]:g[xi],[D.MOBILE_BORDER_RADIUS_POSITION[ki]]:g[ki],[D.MOBILE_BORDER_RADIUS_POSITION[d]]:c[d],classNamePrefix:"em-mob-border_radius_"+D.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:v,titleButtonRef:$,srcReplacerInputRef:H,srcReplacerButtonRef:I,linkProtocol:L,handleLinkProtocolsChange:P,linkButtonHandler:z,linkInputHandler:le,altButtonHandler:C,altInputHandler:oe,titleButtonHandler:ne,titleInputHandler:ge,srcReplacerButtonHandler:ye,srcInputHandler:te,handleSelect:pe,onChange:we,filter:me,renderSearchOption:Me,handleChangeValues:Le,toggleShowBorderHandler:ve,toggleShowBorderRadiusHandler:re,toggleShowBoxShadowHandler:ie})=>{const{__:ee}=r.useI18n(),{token:Q}=(0,t.ui_kit$useToken)(),K=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})}),K.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}})]}),K.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:ee("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:x,classNames:{popup:{root:"merge-tags"}},options:p,placeholder:ee("Start typing the title"),showSearch:{filter:me,render:Me},spellCheck:"false",getPopupContainer:Z=>Z.closest(".email-pane__collapse-wrapper"),onChange:we,style:{display:B?"block":"none"},open:B,onKeyDown:Z=>{Z.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:ee("Image path"),name:"src",placeholder:ee("Image path"),elementSettings:i,tooltipTitle:""})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,style:{marginBottom:!b&&!g&&!_&&!h?Q.formItemMarginBottomMD+4:Q.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:b||ee("Alternative text"),placement:"bottom",getPopupContainer:Z=>Z.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"})})}),K.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:_||ee("Tooltip text"),placement:"bottom",getPopupContainer:Z=>Z.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:ne,ref:$,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:g||ee("Hyperlink URL"),placement:"bottom",getPopupContainer:Z=>Z.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})}),K.formImageFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:ee("Image replacer"),placement:"bottom",getPopupContainer:Z=>Z.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:ye,ref:I})})]}),(!!g||!!b||!!_||!!h)&&(0,o.jsxs)("div",{style:{marginBottom:Q.formItemMarginBottomMD+4},children:[!!g&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(tt,{show:L==="#",__:ee,style:{marginBottom:Q.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:ee("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:Q.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(ot,{linkProtocol:L,handleLinkProtocolsChange:P,__:ee}),placeholder:ee("Hyperlink URL"),allowClear:!0,ref:R,onChange:le,onSelect:pe,prefix:(0,o.jsx)(et,{linkProtocol:L})})})})]}),!!b&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:ee("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:Q.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:ee("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:oe,ref:N,onSelect:pe})})}),K.formFieldImageTitleEnabled&&!!_&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:ee("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:Q.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:ee("Enter the title of the image"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:ge,ref:v,onSelect:pe})})}),!!h&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:ee("Image src"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"imgReplacer",className:"selected-image-form__alt",style:{marginBottom:Q.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:ee("Code that will replace the image `src`"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:ee("Image src")}),onChange:te,ref:H,onSelect:pe})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:ee("Size"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:i.maxWidth,showHeight:K.formImageFieldHeightEnabled,showMinMax:!1,gutter:Q.marginSM,rowStyle:{marginBottom:K.formImageFieldHeightEnabled?4:24},labels:{width:ee("Width"),height:ee("Height"),minWidth:ee("Minimum width"),maxWidth:ee("Maximum width")}})}),K.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:ee("Borders"),collapsible:!0,open:s,onToggle:ve,dividerTop:!0,children:(0,o.jsx)(D.SelectedElementFormBorder,{form:e,elementSettings:i})}),K.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:ee("Border radius"),collapsible:!0,open:n,onToggle:re,dividerTop:!0,children:(0,o.jsx)(wo,{form:e,oneBorderRadiusValue:c,setOneBorderRadiusValue:m,elementSettings:i})}),K.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:ee("Box shadow"),collapsible:!0,open:d,onToggle:ie,dividerTop:!0,children:(0,o.jsx)(Po,{})}),K.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:ee("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e})}),K.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:ee("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:v,altInputHandler:$,titleButtonHandler:H,titleInputHandler:I,linkButtonHandler:L,toggleShowMobileBorderHandler:P,toggleShowMobileBorderRadiusHandler:z,toggleShowMobileBoxShadowHandler:le,toggleShowMobileSizeHandler:C})=>{const{__:oe}=r.useI18n(),{token:ne}=(0,t.ui_kit$useToken)(),ge=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"})}),ge.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:oe("Image path"),name:"src",placeholder:oe("Image path"),elementSettings:i,tooltipTitle:""})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,style:{marginBottom:!h&&!_&&!p?ne.formItemMarginBottomMD+4:ne.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:h||oe("Alternative text"),placement:"bottom",getPopupContainer:ye=>ye.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:v,ref:R,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),ge.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:p||oe("Tooltip text"),placement:"bottom",getPopupContainer:ye=>ye.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:H,ref:N,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:_||oe("Hyperlink URL"),placement:"bottom",getPopupContainer:ye=>ye.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:ne.formItemMarginBottomMD+4},children:[!!_&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:oe("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:ne.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{ref:B,allowClear:!0,placeholder:oe("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:oe("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:ne.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:oe("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:$,ref:x})})}),ge.formFieldImageTitleEnabled&&!!p&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:oe("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:ne.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:oe("Tooltip text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:I,ref:j})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:oe("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:oe("Width")})}),ge.formImageFieldHeightEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(rt,{form:e,name:"mobileHeight",elementSettings:i,isPicture:"true",tooltipTitle:oe("Height")})})]})}),ge.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:oe("Borders"),collapsible:!0,open:n,onToggle:P,dividerTop:!0,children:(0,o.jsx)(D.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),ge.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:oe("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"})}),ge.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:oe("Box shadow"),collapsible:!0,open:c,onToggle:le,dividerTop:!0,children:(0,o.jsx)(Po,{typeOfForm:"mobile"})}),ge.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:oe("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e})}),ge.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:oe("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(),[v,$]=(0,a.useState)({name:"",counter:0}),H=(0,a.useRef)(null),I=(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),oe=(0,a.useRef)(null),ne=(0,a.useRef)(null),[ge,ye]=(0,a.useState)({}),[te,pe]=(0,a.useState)(!0),[we,me]=(0,a.useState)(!0),[Me,Le]=(0,a.useState)(""),[ve,re]=(0,a.useState)(""),[ie,ee]=(0,a.useState)(""),[Q,K]=(0,a.useState)(!1),[Z,G]=(0,a.useState)(!1),[U,Y]=(0,a.useState)(!1),[q,se]=(0,a.useState)(!1),[ue,Se]=(0,a.useState)(!1),[Ee,Oe]=(0,a.useState)(!1),[X,F]=(0,a.useState)(!1),[Be,V]=(0,a.useState)(!1),[fe,Ne]=(0,a.useState)("https://"),Pe=(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]),[Ie,W]=(0,a.useState)(),[he,Ce]=(0,a.useState)(!1),[We,to]=(0,a.useState)(null),[eo,no]=(0,a.useState)({start:0,end:0}),[O,ae]=(0,a.useState)(!1),[w,y]=(0,a.useState)(!1),[ce,je]=(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),vo=Xe||ce||Be;(0,a.useEffect)(()=>()=>clearTimeout(po.current),[]);const Co=(0,a.useRef)(null);(0,a.useEffect)(()=>{const A=Co.current,Ae=A?.firstElementChild??null;if(!vo||!A||!Ae)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),Io=`${Math.round(go)}/${Math.round(Ro)}`;Io!==$e&&($e=Io,Ae.style.top=`${go}px`,Ae.style.height=`${Ro}px`),ke=requestAnimationFrame(Je)};return Je(),()=>cancelAnimationFrame(ke)},[vo]);const M=()=>{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",Re=r.useElementEntityKind();(0,a.useEffect)(()=>{he&&ne.current&&ne.current.focus()},[he]);const De=(A,Ae)=>{const xe=document.getElementById(Ae);if(xe){const ke=Ae.substring(Ae.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),ae(!0)}},be=r.useAppConfig().mergeTags;(0,a.useEffect)(()=>{be?.items?.length&&W(r.mapMargeTags(be.items))},[be,W]);const He=(A,Ae)=>{if(Ce(!1),A){const xe=be.syntax.length>1?Ie.findIndex($e=>$e.key===Ae[0].key):0,ke=be.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"?De(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,Ae)=>Ae.some(xe=>xe.label.toLowerCase().indexOf(A.toLowerCase())>-1),Fe=(A,Ae)=>{const xe=Ae.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:Ae.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))},Ae=({target:ke})=>{!ke.closest(".merge-tags")&&!ke.closest("#merge_tags_button")&&Ce(!1)},xe=new yo.Disposable;return xe.addDisposable(r.addWindowListenerFromShadow(qe,"focusin",A)),xe.addDisposable(r.addWindowListenerFromShadow(qe,"click",Ae)),()=>{xe.dispose()}},[qe]);const so=({target:A})=>{if(A&&!O){const{selectionStart:Ae,selectionEnd:xe}=A;no({start:Ae,end:xe})}ae(!1)},To=e.border,T=e.mobileBorder,_e=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),Te=A=>A&&(A?.width||A?.style||A?.color)?A:"",{remember:Ve,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 Ae=Uo(e)?()=>{}:mo;e.src!==Ge.current&&(Ge.current=e.src,Pe.current=!1);const xe=e.boxShadow;if(ye(xe),e.link&&Ne(Ot(e.link,"https://")),Ae(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:Te(e.mobileBorder.all)||!(Te(e.mobileBorder.top)||Te(e.mobileBorder.bottom)||Te(e.mobileBorder.right)||Te(e.mobileBorder.left))&&Te(e.border.all),mobileBorderTop:Te(e.mobileBorder.top)||!Te(e.mobileBorder.all)&&Te(e.border.top),mobileBorderBottom:Te(e.mobileBorder.bottom)||!Te(e.mobileBorder.all)&&Te(e.border.bottom),mobileBorderRight:Te(e.mobileBorder.right)||!Te(e.mobileBorder.all)&&Te(e.border.right),mobileBorderLeft:Te(e.mobileBorder.left)||!Te(e.mobileBorder.all)&&Te(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),Ae(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))?pe(!1):pe(!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))?me(!1):me(!0);const ke=s.isStaleBorderSnapshot(e,!!_e),$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}),K(Je=>_e&&!ke?!0:Je),G(Je=>_e&&!ke||S&&!$e?!0:Je),Y(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),se(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight||!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),Se(!!e.boxShadow),Oe(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),F(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value||!!e.height.value),e.link?Le(e.link):Le(Pe.current?"...":""),re(e.alt),ee(e.title),y(e.imgReplacer?.length)}},[l,e,mo,Uo,gt,Ye,_e,S,s,n]),(0,a.useEffect)(()=>{if(vo)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))},[vo]);const Rr=async(A,Ae,xe)=>{const ke={};ke.user_id=k.id,ke.folder=A,Ae&&(Ae=await r.prepareImageForEditorUpload(Ae,c),ke.file=Ae),xe&&(ke.page_url=xe);const $e=await j(ke);if($e.error)g.fromError("IMAGE_UPLOAD_ERROR",Ae,$e.error,!0);else{const Je=Qa.extractUploadResult($e.data);if(Je.error)return;if(Je.file_url)return Je.file_url}},Ua=(A,Ae)=>new Promise((xe,ke)=>{const $e=new Image,Je=new Image;$e.crossOrigin="Anonymous",Je.crossOrigin="Anonymous";let io=Ae?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:Ae?Je:null}))},ao=setTimeout(ko,kn);$e.onload=Eo,$e.onerror=ko,$e.src=A,Ae&&(Je.onload=Eo,Je.onerror=ko,Je.src=Ae)}),za=(A,Ae,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),!Ae)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=Ae.width/Ae.height;let go,Ro;ao>=1?(go=Eo,Ro=Eo/ao):(Ro=Eo,go=Eo*ao);const Io=($e.width-go)/2,Qo=($e.height-Ro)/2;return Je.drawImage(Ae,Io,Qo,go,Ro),$e},Wa=A=>new Promise(Ae=>{A.toBlob(xe=>Ae(xe?new File([xe],"image.jpeg",{type:"image/jpeg"}):null),"image/jpg",1)}),Dm=async A=>{const Ae=l.getFieldsValue(!0).video?.playButton||e.video?.playButton;if(!(!A||!Ae||Ae==="none"||ce)){M(),je(!0);try{const{frame:xe,button:ke}=await Ua(A,`${Ur}${Ae}.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{je(!1)}}},Vm=async()=>{const A=de(),Ae=A?.source,xe=A?.playButton;if(!Ae)return;const ke=()=>de()?.source!==Ae;M(),oo(!0);try{const $e=await Rr("tmp",null,Ae);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 Ae=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"),Ae.searchParams.set("time",new Date(A.countdownTime.$d-A.countdownTimeZone*36e5-new Date().getTimezoneOffset()/60*36e5).toISOString()),Ae.searchParams.set("bg",A.countdownBackgroundColor.substring(1)||"#FFFFFF"),Ae.searchParams.set("tp",!!A.countdownTransparency),Ae.searchParams.set("font1",xe),Ae.searchParams.set("size1",A.countdownNumbersFontSize*2||12),Ae.searchParams.set("color1",A.countdownNumbersColor.substring(1)||"#000000"),Ae.searchParams.set("font2",ke),Ae.searchParams.set("size2",A.countdownLabelsFontSize*2||8),Ae.searchParams.set("color2",A.countdownLabelsColor.substring(1)||"#959595"),Ae.searchParams.set("spacing",Math.round(A.countdownNumbersFontSize*.4)||5),Ae.searchParams.set("locale",A.countdownLanguage.replace("_","-")),Ae.searchParams.set("timezone",A.countdownTimeZone),Ae.searchParams.set("frames",A.countdownDuration),N({link:JSON.stringify({target:Ae.href})}),M(),V(!0)},Ct=(0,a.useCallback)(A=>{Ve(A),Ue(A),d(Re==="email"?r.setElementSettings$1(A):r.setElementSettings(A))},[d,Re,Ve,Ue]),wr=(0,a.useCallback)((A,Ae)=>{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)),Ae?.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 Ae=e.src||"",xe=r.stripEmVersionFromUrlString(Ae),ke=await h({kind:"img",currentUrl:_t(xe)?"":xe,entryModal:A});ke?.url&&wr(ke.url,ke.meta)},[wr,e.src,h]),jr=(A,...Ae)=>{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:{...D.NULL_BORDER,...xe.borderAll}}},l.setFieldsValue({borderLeft:D.NULL_BORDER,borderRight:D.NULL_BORDER,borderTop:D.NULL_BORDER,borderBottom:D.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,[D.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,[D.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:{...D.NULL_BORDER,...xe.mobileBorderAll,classNamePrefix:"em-mob-border_"+D.MOBILE_REVERSE_BORDER_POSITIONS[ke]+"-"}}},l.setFieldsValue({borderLeft:D.NULL_BORDER,borderRight:D.NULL_BORDER,borderTop:D.NULL_BORDER,borderBottom:D.NULL_BORDER});else{const ao=D.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 Io=xe.mobileBorderAll;$e={mobileBorder:{all:null,left:Io,right:Io,top:Io,bottom:Io,[ao]:Ro?null:{...go,classNamePrefix:"em-mob-border_"+ao+"-"}}},l.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:Io,mobileBorderRight:Io,mobileBorderTop:Io,mobileBorderBottom:Io,[ke]:go})}else{const Io=e.mobileBorder||{},Qo=ft=>{const At=Io[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:{[D.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,[D.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:{[D.MOBILE_BORDER_RADIUS_POSITION[ke]]:A[ke],classNamePrefix:"em-mob-border_radius_"+D.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),V(!1))},[E]),(0,a.useEffect)(()=>{if(E.isSuccess&&Be){if(E.data.data?.status===400)g.error({title:E.data.code,description:E.data.message});else{let A=new URL(E.data.target),Ae={countdown:{link:E.data.link,params:A.search.substring(1)}};b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Ae})}V(!1)}},[E,Be,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(!Q),setTimeout(()=>{K(Ae=>!Ae),Q?(A.borderAll=D.NULL_BORDER,A.borderTop=D.NULL_BORDER,A.borderBottom=D.NULL_BORDER,A.borderRight=D.NULL_BORDER,A.borderLeft=D.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(!Z),setTimeout(()=>{G(Ae=>!Ae),Z?(A.mobileBorderAll=D.NULL_BORDER,A.mobileBorderTop=D.NULL_BORDER,A.mobileBorderBottom=D.NULL_BORDER,A.mobileBorderRight=D.NULL_BORDER,A.mobileBorderLeft=D.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(Ae=>!Ae),U?(A.borderRadiusAll=0,pe(!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(()=>{se(Ae=>!Ae),q?(A.mobileBorderRadiusAll=null,me(!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(()=>{Se(Ae=>!Ae),ue?(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(Ae=>!Ae),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(()=>{F(Ae=>!Ae),X&&(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=()=>{Me?(Pe.current=!1,Le(""),l.setFieldValue("link",""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{link:""}})):(Pe.current=!0,Le(H.current&&H.current.input.value?H.current.input.value:"..."),setTimeout(()=>{H.current.focus()}))},Ya=A=>{A.target.value===""?Le("..."):(I.current.classList.add("selected-td-form__button--active"),Le(A.target.value)),Wo(A.target.value,Ne)},Xa=()=>{const A=l.getFieldsValue(!0);ve?(re(""),A.alt="",b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{alt:""}})):(re(L.current&&L.current.input.value?L.current.input.value:"..."),setTimeout(()=>{L.current.focus()}))},Ka=A=>{A.target.value===""?re("..."):(P.current.classList.add("selected-td-form__button--active"),re(A.target.value))},qa=()=>{const A=l.getFieldsValue(!0);ie?(ee(""),A.title="",b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{title:""}})):(ee(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!==""&&oe.current.classList.add("selected-td-form__button--active")},Ja=A=>{A.target.value===""?ee("..."):(le.current.classList.add("selected-td-form__button--active"),ee(A.target.value))},Zm=A=>{l.setFieldValue("link",A!=="mergetag"?A:""),Ne(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:D.BORDER_POSITIONS[_e]||"borderAll",mobileBorderPosition:D.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:vo,className:vo?"element-controls selected-image-form_busy":"element-controls",children:[vo&&(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:ge,mobileBordersShow:Z,mobileBorderRadiusShow:q,mobileBoxShadowShow:Ee,mobileSizeShow:X,oneMobileBorderRadiusValue:we,setOneMobileBorderRadiusValue:me,hasLink:Me,hasAlt:ve,hasTitle:ie,linkInputRef:H,linkButtonRef:I,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:ge,bordersShow:Q,borderRadiusShow:U,boxShadowShow:ue,oneBorderRadiusValue:te,setOneBorderRadiusValue:pe,hasLink:Me,hasAlt:ve,hasTitle:ie,isOpenSrcReplacer:w,mergeTagItems:Ie,mergeMenuOpen:he,setMergeMenuOpen:Ce,cascaderRef:ne,linkInputRef:H,linkButtonRef:I,altInputRef:L,altButtonRef:P,titleInputRef:z,titleButtonRef:le,srcReplacerInputRef:C,srcReplacerButtonRef:oe,linkProtocol:fe,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=D.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),v=(0,a.useRef)(null),$=(0,a.useRef)(null),H=(0,a.useRef)(!1),I=l,[L,P]=(0,a.useState)(!!I.textReplacer?.length),[z,le]=(0,a.useState)(!!I.textAnchor?.length),[C,oe]=(0,a.useState)(null),[ne,ge]=(0,a.useState)({start:0,end:0}),[ye,te]=(0,a.useState)(!1),[pe,we]=(0,a.useState)([]),[me,Me]=(0,a.useState)(I.list?.bulletsColor),[Le,ve]=(0,a.useState)(l);l!==Le&&(ve(l),Me(I.list?.bulletsColor),P(!!I.textReplacer?.length),le(!!I.textAnchor?.length));const[re,ie]=(0,a.useState)(!1),[ee,Q]=(0,a.useState)(!1),K=(0,a.useRef)(null),Z=(0,a.useRef)(""),G=Gr(),U=(0,a.useMemo)(()=>G,[]),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 q=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"&&ie(!0),K&&!y&&(ie(!1),e.setFieldsValue({linkHref:null})),K.current=y||null},[Y?.textLink,Y?.linkHref,l.linkHref,e]),(0,a.useEffect)(()=>{const y=e.getFieldValue("listUL"),ce=e.getFieldValue("listOL");y&&Z.current!=="listUL"?(e.setFieldValue("listOL",!1),Z.current="listUL"):ce&&Z.current!=="listOL"&&(e.setFieldValue("listUL",!1),Z.current="listOL"),!y&&!ce&&(Z.current="")},[Y?.listUL,Y?.listOL,e]);const se=y=>{y.data.operation===r.EVENT_TYPES.APPLICATION_FOCUS_IN_IFRAME&&oe(null)};r.useListenPostMessage(se);const[ue,Se]=(0,a.useState)(null);(0,a.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&Se(!0)},[]);const Ee=(0,a.useRef)(null);function Oe(y){const ce=y.key.toLowerCase();let je=!1;return((q==="control"||q==="meta")&&(ce==="a"||ce==="A")||(q==="a"||q==="A")&&(ce==="control"||ce==="meta"))&&(je=!0),q=ce,ce!=="control"&&ce!=="a"&&ce!=="A"&&ce!=="meta"&&(q=null),je}const X=y=>{x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:y,locale:"en_US"}),k.success({title:h("It`s done!")})},F=[{key:"1",label:h("This element"),onClick:()=>X("typograf")},{key:"2",label:h("The whole email"),onClick:()=>X("typograf_all")}],[Be,V]=(0,a.useState)(),[fe,Ne]=(0,a.useState)(!1);(0,a.useEffect)(()=>{const y=Rn(U,me,{});we(y)},[U,me]),(0,a.useEffect)(()=>{const y=l.linkHref||l.href;y&&Wo(y,c);const ce=l.linkHref||l.href,je=ce&&Ri(ce)?ce.slice(1):ce||"https://";(i??((Xe,oo)=>Xe.setFieldsValue(oo)))(e,{linkHref:je})},[e,l,c,i]);const Pe=r.useAppConfig().mergeTags;(0,a.useEffect)(()=>{Pe?.items?.length&&V(r.mapMargeTags(Pe.items))},[Pe,V]);const Ge=y=>{e.setFieldValue("linkHref",y!=="mergetag"?y:""),c(y)},Ye=(y,ce)=>{if(Ne(!1),y){const je=Pe.syntax.length>1?Be.findIndex(oo=>oo.key===ce[0].key):0,Xe=Pe.syntax[je].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")Ce(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(je=>je.label.toLowerCase().indexOf(y.toLowerCase())>-1),de=(y,ce)=>{const je=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:je})};(0,a.useEffect)(()=>{fe&&Ee.current&&Ee.current.focus()},[fe]);const Ie=r.useRootElement();(0,a.useEffect)(()=>{const y=({target:Xe})=>{Xe.closest('[id="merge_tags_wrapper"]')||oe(Xe)},ce=({target:Xe})=>{!Xe.closest(".merge-tags")&&!Xe.closest("#merge_tags_button")&&Ne(!1)},je=new yo.Disposable;return je.addDisposable(r.addWindowListenerFromShadow(Ie,"focusin",y)),je.addDisposable(r.addWindowListenerFromShadow(Ie,"click",ce)),()=>{je.dispose()}},[Ie]);const W=(0,a.useCallback)(()=>{const y=window.getSelection();y&&y.toString().length>0&&(H.current=!0)},[]),he=(0,a.useCallback)(({target:y})=>{if(y&&!ye){const{selectionStart:ce,selectionEnd:je}=y;ge(Xe=>Xe?.start===ce&&Xe?.end===je?Xe:{start:ce,end:je})}te(!1)},[ye]);(0,a.useEffect)(()=>he({target:m?.target}),[m,he]);const Ce=(y,ce)=>{const je=document.getElementById(ce);if(je){const Xe=je.value?.substring(0,ne.start),oo=je.value?.substring(ne.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),je.focus(),setTimeout(()=>{je.selectionStart=ne.start,je.selectionEnd=ne.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!==""&&v.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,je=ce.value,Xe=ce.selectionStart,oo=Oe(y);if(H.current&&Xe===0&&x({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:`${je}~`}}),H.current=oo,Xe===0&&y.key===" "){y.preventDefault();return}if(y.key===" "){if(Xe!==je.length){y.preventDefault();return}je.endsWith(" ")&&y.preventDefault()}},O=y=>{Me(y),g&&b(!1)},ae=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"})})})}),ae||w||j.mergeTagsShow&&Be?(0,o.jsx)(t.ui_kit$FormSection,{title:null,dividerTop:_,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginTop:4},children:[ae&&(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:()=>X("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:F},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:()=>X("typograf"),style:{width:"100%"},children:h("Typography")})})})})}),j.mergeTagsShow&&Be&&(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:fe?"none":"inline-flex"},onClick:()=>Ne(!0),children:h("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:Ee,classNames:{popup:{root:"merge-tags"}},options:Be,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:fe?"block":"none",width:"100%"},open:fe,onKeyDown:y=>{y.key==="Escape"&&Ne(!1)}})]})]})}):null,(0,o.jsxs)(t.ui_kit$FormSection,{title:null,dividerTop:_||ae||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(ue?"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(ue?"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(ue?"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(ue?"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(ue?"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(ue?"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(ue?"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(ue?"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:he})}),!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:he})}),(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:he})}),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:v})})}),(!l?.list?.isList||s&&l?.list?.isList)&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title: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":ee||z}),icon:(0,o.jsx)(r.EmIcons,{icon:"DotsHoriz",component:t.icons$DotsHoriz,className:"selected-td-form__icon-radius"}),onClick:()=>Q(!ee)})})})]})]}),!n&&ee&&(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(ue?"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:v})})})]}),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"&&re&&(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:he,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:he})}),(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:he})})]})]}),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:he,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:W,ref:E,onSelect:he})})})]})}),!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:pe})})})})}),(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(ue?"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(ue?"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(ue?"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(ue?"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"})})})})]})]})]})},vi=({form:e,elementSettings:i,showAddParagraph:l=!0,isButton:s=!1})=>{const{__:n}=r.useI18n(),d=D.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:H,baseEmail:I}=Or(e.linkHref),L=e.linkHref,P=typeof L=="string"&&Ri(L),z=typeof L=="string"&&L.startsWith("mailto:")?I:P?L.slice(1):typeof L=="string"?L:"https://";h(Ot(L||"","https://")),N(n,{...e,lineHeight:u(e.lineHeight),linkHref:z,subject:$,body:H,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 v=$=>{const H=n.getFieldsValue(!0),I=Object.keys($)[0];let L;switch(I){case"mobileFontSize":L={[I]:{classNamePrefix:"em-mob-font_size-",value:$[I],dim:H.mobileFontSizeDim}};break;case"mobileLineHeight":L={[I]:{classNamePrefix:"em-mob-line_height-",value:$[I],dim:H.mobileLineHeightDim}};break;case"mobileTextAlign":L={[I]:{classNamePrefix:"em-mob-text_align-",value:$[I]}};break;case"linkHref":let P=it($[I]);if(P!==$[I]&&n.setFieldValue("linkHref",P),_==="#"&&P&&!P.startsWith("#")&&(P="#"+P),P.startsWith("mailto:")){const le=n.getFieldValue("subject"),C=n.getFieldValue("body");L={[I]:yi(P,le,C)}}else L={[I]: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=I==="subject"?$[I]:n.getFieldValue("subject"),oe=I==="body"?$[I]:n.getFieldValue("body"),ne=[];C&&ne.push(`subject=${encodeURIComponent(C)}`),oe&&ne.push(`body=${encodeURIComponent(oe)}`),L={linkHref:ne.length>0?`${le}?${ne.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:I})};return(0,o.jsxs)(t.ui_kit$Form,{form:n,layout:"vertical",name:"selected_text_form",autoComplete:"off",onValuesChange:v,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)(vi,{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"})})})]})]})]})},Ii=(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{__:v}=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:v("The align attribute sets the horizontal alignment of the table.")})}),(0,o.jsx)(t.ui_kit$FormSection,{title:v("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:v("Width"),height:v("Height"),minWidth:v("Minimum width"),maxWidth:v("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:v("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:v("Background color"),horizontalPositionPlaceholder:v("Horizontal position"),horizontalPositionTooltip:v("Horizontal position"),verticalPositionPlaceholder:v("Vertical position"),verticalPositionTooltip:v("Vertical position"),backgroundRepeatTooltip:v("Background image repeat"),backgroundSizeTooltip:v("Background image size"),selectPlaceholder:v("Please choose"),backgroundRepeatOptions:g,backgroundSizeOptions:b,imageUploadSlot:$.formTableFieldBackgroundImageEnabled?(0,o.jsx)($o,{form:e,label:v("Background image"),name:"backgroundImage",tooltipTitle:v("Background image"),placeholder:v("Background image link/route")}):void 0}),(0,o.jsx)(st,{form:e,showBackground:!0})]}),$.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:v("Borders"),collapsible:!0,open:s,onToggle:k,dividerTop:!0,children:(0,o.jsx)(D.SelectedElementFormBorder,{form:e,elementSettings:i})}),$.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:v("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:v("Box shadow"),collapsible:!0,open:d,onToggle:R,dividerTop:!0,children:(0,o.jsx)(Po,{})}),$.formFieldExportAsPictureEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:v("Export settings"),collapsible:!0,open:h,onToggle:E,dividerTop:!0,children:(0,o.jsx)(Ii,{form:e,elementSettings:i})}),$.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:v("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e})}),$.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:v("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,vn=/^(\d*\.?\d+)(%|px)$/;function In(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||!In(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(vn);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)(v=>{_(v),d.setFieldsValue({mobileBackgroundImage:""}),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Pi("mobileBackgroundImage",v?"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)(D.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===""),v=r.useSelector(r.selectIsCodeMode),$=r.useSelector(r.selectCodeModeDirection),H=v&&$!=="bottom",[I,L]=(0,a.useState)(!1),[P,z]=(0,a.useState)(!1),[le,C]=(0,a.useState)(!1),[oe,ne]=(0,a.useState)(!1),[ge,ye]=(0,a.useState)(!1),[te,pe]=(0,a.useState)(!1),[we,me]=(0,a.useState)(!1),[Me,Le]=(0,a.useState)(!1),[ve,re]=(0,a.useState)(!1),[ie,ee]=(0,a.useState)(!1),[Q,K]=(0,a.useState)(!1),Z=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],G=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}],U=W=>W&&(W?.width||W?.style||W?.color)?W:"",Y=e.border,q=e.mobileBorder,se=Object.keys(Y).find(W=>Y[W]?.width||Y[W]?.style||Y[W]?.color),ue=Object.keys(q).find(W=>q[W]?.width||q[W]?.style||q[W]?.color),{remember:Se,fillFields:Ee}=ut(e);(0,a.useEffect)(()=>{if(e){const W=e.boxShadow,he=e.mobileBoxShadow;b(W),B(he),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:U(e.mobileBorder.all)||!(U(e.mobileBorder.top)||U(e.mobileBorder.bottom)||U(e.mobileBorder.right)||U(e.mobileBorder.left))&&U(e.border.all),mobileBorderTop:U(e.mobileBorder.top)||!U(e.mobileBorder.all)&&U(e.border.top),mobileBorderBottom:U(e.mobileBorder.bottom)||!U(e.mobileBorder.all)&&U(e.border.bottom),mobileBorderRight:U(e.mobileBorder.right)||!U(e.mobileBorder.all)&&U(e.border.right),mobileBorderLeft:U(e.mobileBorder.left)||!U(e.mobileBorder.all)&&U(e.border.left),mobileBorderRadiusAll:u(e.mobileBorderRadius.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius.topLeft!==null?e.mobileBorderRadius.topLeft:e.mobileBorderRadius.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius.bottomLeft!==null?e.mobileBorderRadius.bottomLeft:e.mobileBorderRadius.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius.topRight!==null?e.mobileBorderRadius.topRight:e.mobileBorderRadius.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius.bottomRight!==null?e.mobileBorderRadius.bottomRight:e.mobileBorderRadius.all),mobileBoxShadowInset:u(e.mobileBoxShadow?.inset)||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color),mobileBackgroundColor:u(e.mobileBackgroundColor?.value!=="none"?e.mobileBackgroundColor?.value:""),...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 Ce=n.isStaleBorderSnapshot(e,!!se),We=d.isStaleBorderSnapshot(e,!!ue);Ce&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(We||Ce&&!ue)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),L(to=>se&&!Ce?!0:to),z(to=>se&&!Ce||ue&&!We?!0:to),C(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),ne(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),ye(!!e.boxShadow),pe(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),me(!!e.width?.value||!!e.minWidth?.value||!!e.maxWidth?.value),Le(!!e.mobileWidth.value),re(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),ee(Mt(e)),K(!!e.exportAsPicture)}},[s,e,se,ue,n,d,Ee]);const Oe=(0,a.useCallback)(W=>{Se(W),c(m==="email"?r.setElementSettings$1(W):r.setElementSettings(W))},[c,m,Se]),X=W=>{const he=s.getFieldsValue(!0),Ce=Object.keys(W)[0];let We;switch(Ce){case"exportAsPicture":We={exportAsPicture:he.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":We={boxShadow:{hOffset:he.boxShadowHOffset,vOffset:he.boxShadowVOffset,blurRadius:he.boxShadowBlurRadius,spreadRadius:he.boxShadowSpreadRadius,color:he.boxShadowColor,inset:he.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":he.borderPosition==="borderAll"?(We={border:{...r.RESET_BORDER_PARAMS,all:{...D.NULL_BORDER,...he.borderAll}}},s.setFieldsValue({borderLeft:D.NULL_BORDER,borderRight:D.NULL_BORDER,borderTop:D.NULL_BORDER,borderBottom:D.NULL_BORDER})):he.borderAll?.width||he.borderAll?.style||he.borderAll?.color?(We={border:{all:null,left:he.borderAll,right:he.borderAll,top:he.borderAll,bottom:he.borderAll,[D.REVERSE_BORDER_POSITIONS[Ce]]:{...he[Ce],...W[Ce]}}},s.setFieldsValue({borderAll:null,borderLeft:he.borderAll,borderRight:he.borderAll,borderTop:he.borderAll,borderBottom:he.borderAll,[Ce]:{...he[Ce],...W[Ce]}})):(We={border:{all:null,left:he.borderLeft,right:he.borderRight,top:he.borderTop,bottom:he.borderBottom,[D.REVERSE_BORDER_POSITIONS[Ce]]:{...he[Ce],...W[Ce]}}},s.setFieldsValue({border:We.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(he.mobileBorderPosition==="mobileBorderAll")We={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...D.NULL_BORDER,...he.mobileBorderAll,classNamePrefix:"em-mob-border_"+D.MOBILE_REVERSE_BORDER_POSITIONS[Ce]+"-"}}},s.setFieldsValue({borderLeft:D.NULL_BORDER,borderRight:D.NULL_BORDER,borderTop:D.NULL_BORDER,borderBottom:D.NULL_BORDER});else{const to=D.MOBILE_REVERSE_BORDER_POSITIONS[Ce],eo={...he[Ce],...W[Ce]},no=!eo?.width&&!eo?.style&&!eo?.color;if(he.mobileBorder?.all?.width||he.mobileBorder?.all?.style||he.mobileBorder?.all?.color){const O=he.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,[Ce]:eo})}else{const O=e.mobileBorder||{},ae=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-"}:ae("left"),right:to==="right"?no?null:{...eo,classNamePrefix:"em-mob-border_right-"}:ae("right"),top:to==="top"?no?null:{...eo,classNamePrefix:"em-mob-border_top-"}:ae("top"),bottom:to==="bottom"?no?null:{...eo,classNamePrefix:"em-mob-border_bottom-"}:ae("bottom")}},s.setFieldsValue({[Ce]:eo})}}break;case"width":We={[Ce]:{value:W[Ce],dim:he.widthDim}};break;case"widthDim":We={width:{value:he.width,dim:W[Ce]}};break;case"maxWidth":We={[Ce]:{value:W[Ce],dim:he.maxWidthDim}};break;case"maxWidthDim":We={maxWidth:{value:he.maxWidth,dim:W[Ce]}};break;case"minWidth":We={[Ce]:{value:W[Ce],dim:he.minWidthDim}};break;case"minWidthDim":We={minWidth:{value:he.minWidth,dim:W[Ce]}};break;case"backgroundImage":E(W[Ce]===""),We={[Ce]:[{...e.backgroundImage[0],value:W[Ce]}],backgroundSize:"cover"};break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":We={borderRadius:{[D.BORDER_RADIUS_POSITION[Ce]]:+W[Ce]}};break;case"mobileWidth":We={[Ce]:{classNamePrefix:"em-mob-width-",value:W[Ce],dim:he.mobileWidthDim}};break;case"mobileWidthDim":We={mobileWidth:{classNamePrefix:"em-mob-width-",value:he.mobileWidth||100,dim:W[Ce]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":We={mobileBorderRadius:{[D.MOBILE_BORDER_RADIUS_POSITION[Ce]]:W[Ce],classNamePrefix:"em-mob-border_radius_"+D.MOBILE_BORDER_RADIUS_POSITION[Ce]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":We={mobileBoxShadow:{hOffset:he.mobileBoxShadowHOffset,vOffset:he.mobileBoxShadowVOffset,blurRadius:he.mobileBoxShadowBlurRadius,spreadRadius:he.mobileBoxShadowSpreadRadius,color:he.mobileBoxShadowColor,inset:he.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(We=kt(W),!We)return;break;case"mobileAlign":We={[Ce]:{classNamePrefix:"em-mob-table_align-",value:W[Ce]}};break;default:We=W}Ce!=="borderPosition"&&Ce!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:We}),Ce!=="mobileBorderRadiusAll"&&Ce!=="mobileBorderRadiusTopLeft"&&Ce!=="mobileBorderRadiusTopRight"&&Ce!=="mobileBorderRadiusBottomLeft"&&Ce!=="mobileBorderRadiusBottomRight"&&Oe({...e,...We,mobileBorderRadius:{...e.mobileBorderRadius,...We?.mobileBorderRadius},activateSection:null,changeKey:Ce}))},F=()=>{const W=s.getFieldsValue(!0);n.markBorderToggled(!I),setTimeout(()=>{L(he=>!he),I?(W.borderAll=D.NULL_BORDER,W.borderTop=D.NULL_BORDER,W.borderBottom=D.NULL_BORDER,W.borderRight=D.NULL_BORDER,W.borderLeft=D.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}}}})})},Be=()=>{const W=s.getFieldsValue(!0);d.markBorderToggled(!P),setTimeout(()=>{z(he=>!he),P?(W.mobileBorderAll=D.NULL_BORDER,W.mobileBorderTop=D.NULL_BORDER,W.mobileBorderBottom=D.NULL_BORDER,W.mobileBorderRight=D.NULL_BORDER,W.mobileBorderLeft=D.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}}}})})},V=()=>{const W=s.getFieldsValue(!0);setTimeout(()=>{C(he=>!he),le?(W.borderRadiusAll=0,h(!0)):W.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:W.borderRadiusAll}}})})},fe=()=>{const W=s.getFieldsValue(!0);setTimeout(()=>{ne(he=>!he),oe?(W.mobileBorderRadiusAll=null,x(!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-"}}})})},Ne=()=>{const W=s.getFieldsValue(!0);setTimeout(()=>{ye(he=>!he),ge?(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=s.getFieldsValue(!0);setTimeout(()=>{pe(he=>!he),te?(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-"}}})})},Ge=()=>{const W=s.getFieldsValue(!0);setTimeout(()=>{me(he=>!he),we&&(W.width="",W.minWidth="",W.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 W=s.getFieldsValue(!0);setTimeout(()=>{Le(he=>!he),Me&&(W.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 W=s.getFieldsValue(!0);setTimeout(()=>{re(he=>!he),ve?(W.backgroundColor="",W.backgroundImage="",W.backgroundPositionX="",W.backgroundPositionY="",W.backgroundRepeat="none",W.backgroundSize="",E(!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}})})},de=()=>{const W=s.getFieldsValue(!0);setTimeout(()=>{ee(he=>!he),ie?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}}}),ie&&Dt(s,e,l)})},Ie=()=>{const W=s.getFieldsValue(!0);setTimeout(()=>{K(he=>!he),Q&&(W.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:D.BORDER_POSITIONS[se]||"borderAll",mobileBorderPosition:D.MOBILE_BORDER_POSITIONS[ue]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileBackgroundColor:"",mobileBackgroundImage:""},onValuesChange:X,autoComplete:"off",className:"element-controls",children:[!H&&(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:oe,mobileBoxShadowShow:te,mobileSizeShow:Me,mobileBackgroundShow:ie,oneMobileBorderRadiusValue:k,setOneMobileBorderRadiusValue:x,toggleShowMobileBorderHandler:Be,toggleShowMobileBorderRadiusHandler:fe,toggleShowMobileBoxShadowHandler:Pe,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:I,borderRadiusShow:le,boxShadowShow:ge,backgroundShow:ve,backgroundImageEmpty:N,backgroundRepeatOptions:Z,backgroundSizeOptions:G,sizeShow:we,modificationShow:Q,oneBorderRadiusValue:_,setOneBorderRadiusValue:h,toggleShowBorderHandler:F,toggleShowBorderRadiusHandler:V,toggleShowBoxShadowHandler:Ne,toggleShowSizeHandler:Ge,toggleShowBackgroundHandler:Ze,toggleShowModificationHandler:Ie})})]})};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"),v=[];N&&v.push(`subject=${encodeURIComponent(N)}`),E&&v.push(`body=${encodeURIComponent(E)}`),R={href:v.length>0?`${j}?${v.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"),v=x==="body"?k[x]:s.getFieldValue("body"),$=[];E&&$.push(`subject=${encodeURIComponent(E)}`),v&&$.push(`body=${encodeURIComponent(v)}`),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)(vi,{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=v=>{if(!v||typeof v!="string")return{value:"",unit:"px"};v=v.trim();const $=v.match(/^(\d*\.?\d+)(%|px)$/);return $?{value:$[1],unit:$[2]}:{value:v,unit:"px"}};(0,a.useEffect)(()=>{const v=e.getFieldValue("backgroundPositionX"),$=e.getFieldValue("backgroundPositionY"),H=j(v),I=j($);b(String(H.value)),h(H.unit),B(String(I.value)),x(I.unit)},[e]);const N=(v,$)=>{b(String(v)),h($),c&&c({backgroundPositionX:{position:v,unit:$}})},E=(v,$)=>{B(String(v)),x($),c&&c({backgroundPositionY:{position:v,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:v=>N(v,_),unit:_,setUnit:v=>N(g,v),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:v=>E(v,k),unit:k,setUnit:v=>E(p,v),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=D.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:v,toggleShowBackgroundHandler:$,toggleShowModificationHandler:H,handleChangeValues:I})=>{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:v,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:I}),(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)(D.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:H,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)(Ii,{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(),v=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"})}),v.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"})})]}),v.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"&&v.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:v.formCellFieldBackgroundImageEnabled,desktopBackground:Et(i)})}),v.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:E("Borders"),collapsible:!0,open:s,onToggle:B,dividerTop:!0,children:(0,o.jsx)(D.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),v.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"})}),v.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"})}),v.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})}),v.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),v=r.useSelector(r.selectCodeModeDirection),$=E&&v!=="bottom",[H,I]=(0,a.useState)(!1),[L,P]=(0,a.useState)(!1),[z,le]=(0,a.useState)(!1),[C,oe]=(0,a.useState)(!1),[ne,ge]=(0,a.useState)(!1),[ye,te]=(0,a.useState)(!1),[pe,we]=(0,a.useState)(!1),[me,Me]=(0,a.useState)(!1),[Le,ve]=(0,a.useState)(!1),[re,ie]=(0,a.useState)(!1),[ee,Q]=(0,a.useState)(!1),[K,Z]=(0,a.useState)(!1),[G,U]=(0,a.useState)(!1),[Y,q]=(0,a.useState)(!1),[se,ue]=(0,a.useState)(!1),Se=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,X=e.mobileBorder,F=Object.keys(Oe).find(w=>Oe[w]?.width||Oe[w]?.style||Oe[w]?.color),Be=Object.keys(X).find(w=>X[w]?.width||X[w]?.style||X[w]?.color),V=w=>w&&(w?.width||w?.style||w?.color)?w:"",{remember:fe,fillFields:Ne}=ut(e);(0,a.useEffect)(()=>{if(e){const w=e.boxShadow;_(w),Ne(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:V(e.mobileBorder.all)||!(V(e.mobileBorder.top)||V(e.mobileBorder.bottom)||V(e.mobileBorder.right)||V(e.mobileBorder.left))&&V(e.border.all),mobileBorderTop:V(e.mobileBorder.top)||!V(e.mobileBorder.all)&&V(e.border.top),mobileBorderBottom:V(e.mobileBorder.bottom)||!V(e.mobileBorder.all)&&V(e.border.bottom),mobileBorderRight:V(e.mobileBorder.right)||!V(e.mobileBorder.all)&&V(e.border.right),mobileBorderLeft:V(e.mobileBorder.left)||!V(e.mobileBorder.all)&&V(e.border.left),paddingTop:u(e.padding?.all)||u(e.padding?.top),paddingLeft:u(e.padding?.all)||u(e.padding?.left),paddingRight:u(e.padding?.all)||u(e.padding?.right),paddingBottom:u(e.padding?.all)||u(e.padding?.bottom),paddingLeftRight:u(e.padding?.left)||u(e.padding?.right),paddingTopBottom:u(e.padding?.top)||u(e.padding?.bottom),borderRadiusAll:u(e.borderRadius.all),borderRadiusTopLeft:u(e.borderRadius.topLeft),borderRadiusBottomLeft:u(e.borderRadius.bottomLeft),borderRadiusTopRight:u(e.borderRadius.topRight),borderRadiusBottomRight:u(e.borderRadius.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth: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)?I(!1):I(!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,!!F),ce=c.isStaleBorderSnapshot(e,!!Be);y&&n.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(ce||y&&!Be)&&n.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),le(je=>F&&!y?!0:je),oe(je=>F&&!y||Be&&!ce?!0:je),ge(!!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),we(!!e.boxShadow),Me(!!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),ie(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value&&e.type!=="column"||!!e.height.value),Q(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Z(!!e.mobileBackgroundColor.value||!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Mt(e)&&Z(!0),U(!!e.exportAsPicture||!!e.isContrastBlock),q(!!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"?ue(!0):ue(!1)}},[n,e,F,Be,d,c,Ne]);const Pe=(0,a.useCallback)(w=>{fe(w),s(Se==="email"?r.setElementSettings$1(w):r.setElementSettings(w))},[s,Se,fe]),Ge=w=>{const y=n.getFieldsValue(!0),ce=Object.keys(w)[0];let je;switch(g(n.getFieldsValue(!0).widthDim==="%"?100:""),ce){case"exportAsPicture":je={exportAsPicture:y.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":je={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"?(je={border:{...r.RESET_BORDER_PARAMS,all:{...D.NULL_BORDER,...y.borderAll}}},n.setFieldsValue({borderLeft:D.NULL_BORDER,borderRight:D.NULL_BORDER,borderTop:D.NULL_BORDER,borderBottom:D.NULL_BORDER})):y.borderAll?.width||y.borderAll?.style||y.borderAll?.color?(je={border:{all:null,left:y.borderAll,right:y.borderAll,top:y.borderAll,bottom:y.borderAll,[D.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]}})):(je={border:{all:null,left:y.borderLeft,right:y.borderRight,top:y.borderTop,bottom:y.borderBottom,[D.REVERSE_BORDER_POSITIONS[ce]]:{...y[ce],...w[ce]}}},n.setFieldsValue({border:je.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(y.mobileBorderPosition==="mobileBorderAll")je={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...D.NULL_BORDER,...y.mobileBorderAll,classNamePrefix:"em-mob-border_"+D.MOBILE_REVERSE_BORDER_POSITIONS[ce]+"-"}}},n.setFieldsValue({borderLeft:D.NULL_BORDER,borderRight:D.NULL_BORDER,borderTop:D.NULL_BORDER,borderBottom:D.NULL_BORDER});else{const Xe=D.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;je={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=vo=>{const Co=co[vo];return Co&&(Co?.width||Co?.style||Co?.color)?Co:null};je={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":je={[ce]:{value:w[ce],dim:y.widthDim}};break;case"height":je={[ce]:{value:w[ce],dim:y.heightDim}};break;case"widthDim":je={width:{value:y.width,dim:w[ce]}};break;case"heightDim":je={height:{value:y.height,dim:w[ce]}};break;case"backgroundImage":N(w[ce]===""),je={[ce]:[{...e.backgroundImage[0],value:w[ce]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":je={padding:{left:y.paddingLeft,right:y.paddingRight,top:y.paddingTop,bottom:y.paddingBottom,[D.PADDING_POSITION[ce]]:+w[ce]}};break;case"paddingTopBottom":je={padding:{left:y.paddingLeft,right:y.paddingRight,top:+w[ce],bottom:+w[ce]}},y.paddingTop=y.paddingBottom=+w[ce];break;case"paddingLeftRight":je={padding:{top:y.paddingTop,bottom:y.paddingBottom,left:+w[ce],right:+w[ce]}},y.paddingLeft=y.paddingRight=+w[ce];break;case"borderRadiusAll":je={borderRadius:{[D.BORDER_RADIUS_POSITION[ce]]:+w[ce]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":je={borderRadius:{topLeft:y.borderRadiusTopLeft,bottomLeft:y.borderRadiusBottomLeft,topRight:y.borderRadiusTopRight,bottomRight:y.borderRadiusBottomRight,[D.BORDER_RADIUS_POSITION[ce]]:+w[ce]}};break;case"mobileWidth":je={[ce]:{classNamePrefix:"em-mob-width-",value:w[ce],dim:y.mobileWidthDim}};break;case"mobileWidthDim":je={mobileWidth:{classNamePrefix:"em-mob-width-",value:y.mobileWidth||100,dim:w[ce]}};break;case"mobileHeight":je={[ce]:{classNamePrefix:"em-mob-height-",value:w[ce],dim:y.mobileHeightDim}};break;case"mobileHeightDim":je={mobileHeight:{classNamePrefix:"em-mob-height-",value:y.mobileHeight,dim:w[ce]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":je={mobileBorderRadius:{[D.MOBILE_BORDER_RADIUS_POSITION[ce]]:w[ce],classNamePrefix:"em-mob-border_radius_"+D.MOBILE_BORDER_RADIUS_POSITION[ce]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":je={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":je={[ce]:{classNamePrefix:"em-mob-text_align-",value:w[ce]}};break;case"mobileVerticalAlign":je={[ce]:{classNamePrefix:"em-mob-vertical_align-",value:w[ce]}};break;case"mobileDirection":je={[ce]:{classNamePrefix:"em-mob-direction-",value:w[ce]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(je=kt(w),!je)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":je={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],je={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],je={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":je={[ce]:isNaN(parseFloat(w[ce].position))?w[ce].position:w[ce].position+w[ce].unit};break;default:je=w}ce!=="borderPosition"&&ce!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:je}),ce!=="mobileBorderRadiusAll"&&ce!=="mobileBorderRadiusTopLeft"&&ce!=="mobileBorderRadiusTopRight"&&ce!=="mobileBorderRadiusBottomLeft"&&ce!=="mobileBorderRadiusBottomRight"&&Pe({...e,...je,mobileBorderRadius:{...e.mobileBorderRadius,...je?.mobileBorderRadius},activateSection:null,changeKey:ce}))},Ye=()=>{I(y=>!y);const w=n.getFieldsValue(!0);H||(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=D.NULL_BORDER,w.borderTop=D.NULL_BORDER,w.borderBottom=D.NULL_BORDER,w.borderRight=D.NULL_BORDER,w.borderLeft=D.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(()=>{oe(y=>!y),C?(w.mobileBorderAll=D.NULL_BORDER,w.mobileBorderTop=D.NULL_BORDER,w.mobileBorderBottom=D.NULL_BORDER,w.mobileBorderRight=D.NULL_BORDER,w.mobileBorderLeft=D.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}}}})})},Ie=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{ge(y=>!y),ne?(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}}})})},W=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{te(y=>!y),ye?(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-"}}})})},he=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{we(y=>!y),pe?(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}}})})},Ce=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{Me(y=>!y),me?(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(()=>{ie(y=>!y),re&&(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(()=>{Q(y=>!y),ee?(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(()=>{Z(y=>!y),K?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}}}),K&&Dt(n,e,l)})},O=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{U(y=>!y),G&&(w.exportAsPicture=!1,w.isContrastBlock=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1,isContrastBlock:!1}}))})},ae=()=>{const w=n.getFieldsValue(!0);setTimeout(()=>{q(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:D.BORDER_POSITIONS[F]||"borderAll",mobileBorderPosition:D.MOBILE_BORDER_POSITIONS[Be]||"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:ye,mobileBoxShadowShow:me,mobileSizeShow:re,mobileBackgroundShow:K,mobilePaddingShow:Y,mobilePaddingsExt:L,setMobilePaddingsExt:P,oneMobileBorderRadiusValue:B,setOneMobileBorderRadiusValue:k,toggleShowMobileBorderHandler:de,toggleShowMobileBorderRadiusHandler:W,toggleShowMobileBoxShadowHandler:Ce,toggleShowMobileSizeHandler:to,toggleShowMobileBackgroundHandler:no,toggleShowMobilePaddingHandler:ae})})]}):(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:ne,boxShadowShow:pe,backgroundShow:ee,backgroundImageEmpty:j,backgroundRepeatOptions:Ee,sizeShow:Le,maxWidthValue:m,modificationShow:G,paddingsExt:H,oneBorderRadiusValue:h,setOneBorderRadiusValue:p,elementListShow:se,togglePaddingHandler:Ye,toggleShowBorderHandler:Ze,toggleShowBorderRadiusHandler:Ie,toggleShowBoxShadowHandler:he,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:v,toggleShowSizeHandler:$,toggleShowBackgroundHandler:H,toggleShowModificationHandler:I,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:H,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)(D.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:v,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:I,dividerTop:!0,children:(0,o.jsx)(Ii,{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:v}=(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:v.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:v.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)(D.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),v=N&&E!=="bottom",[$,H]=(0,a.useState)(!1),[I,L]=(0,a.useState)(!1),[P,z]=(0,a.useState)(!1),[le,C]=(0,a.useState)(!1),[oe,ne]=(0,a.useState)(!1),[ge,ye]=(0,a.useState)(!1),[te,pe]=(0,a.useState)(!1),[we,me]=(0,a.useState)(!1),[Me,Le]=(0,a.useState)(!1),[ve,re]=(0,a.useState)(!1),[ie,ee]=(0,a.useState)(!1),[Q,K]=(0,a.useState)(!1),[Z,G]=(0,a.useState)(!1),[U,Y]=(0,a.useState)(!1),[q,se]=(0,a.useState)(!1),[ue,Se]=(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,X=e.mobileBorder,F=Object.keys(Oe).find(O=>Oe[O]?.width||Oe[O]?.style||Oe[O]?.color),Be=Object.keys(X).find(O=>X[O]?.width||X[O]?.style||X[O]?.color),V=O=>O&&(O?.width||O?.style||O?.color)?O:"";(0,a.useEffect)(()=>{if(e){const O=e.boxShadow,ae=e.mobileBoxShadow;m(O),h(ae),s.setFieldsValue({...e,width:e.width?.value,widthDim:e.width?.dim,height:e.height?.value,heightDim:e.height?.dim,maxWidth:e.maxWidth?.value,maxWidthDim:e.maxWidth?.dim,minWidth:e.minWidth?.value,minWidthDim:e.minWidth?.dim,backgroundImage:e.backgroundImage[0].value,show:e.show?e.show:"all",borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),mobileBorderAll:V(e.mobileBorder.all)||!(V(e.mobileBorder.top)||V(e.mobileBorder.bottom)||V(e.mobileBorder.right)||V(e.mobileBorder.left))&&V(e.border.all),mobileBorderTop:V(e.mobileBorder.top)||!V(e.mobileBorder.all)&&V(e.border.top),mobileBorderBottom:V(e.mobileBorder.bottom)||!V(e.mobileBorder.all)&&V(e.border.bottom),mobileBorderRight:V(e.mobileBorder.right)||!V(e.mobileBorder.all)&&V(e.border.right),mobileBorderLeft:V(e.mobileBorder.left)||!V(e.mobileBorder.all)&&V(e.border.left),paddingTop:u(e.padding.all)||u(e.padding.top),paddingLeft:u(e.padding.all)||u(e.padding.left),paddingRight:u(e.padding.all)||u(e.padding.right),paddingBottom:u(e.padding.all)||u(e.padding.bottom),paddingLeftRight:u(e.padding?.left)||u(e.padding?.right),paddingTopBottom:u(e.padding?.top)||u(e.padding?.bottom),borderRadiusAll:u(e.borderRadius.all),borderRadiusTopLeft:u(e.borderRadius.topLeft),borderRadiusBottomLeft:u(e.borderRadius.bottomLeft),borderRadiusTopRight:u(e.borderRadius.topRight),borderRadiusBottomRight:u(e.borderRadius.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth: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)?H(!1):H(!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,!!F),y=d.isStaleBorderSnapshot(e,!!Be);w&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(y||w&&!Be)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),z(ce=>F&&!w?!0:ce),C(ce=>F&&!w||Be&&!y?!0:ce),ne(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),ye(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),pe(!!e.boxShadow),me(!!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),re(!!e.mobileWidth.value||!!e.mobileHeight.value),ee(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),K(Mt(e)),G(!!e.exportAsPicture),Y(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),se(!!e.mobilePadding.all||!!e.mobilePadding.top||!!e.mobilePadding.bottom||!!e.mobilePadding.left||!!e.mobilePadding.right)}},[s,e,F,Be,n,d]);const fe=O=>{const ae=s.getFieldsValue(!0),w=Object.keys(O)[0];let y;switch(Se(s.getFieldsValue(!0).widthDim==="%"?100:""),w){case"exportAsPicture":y={exportAsPicture:ae.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":y={boxShadow:{hOffset:ae.boxShadowHOffset,vOffset:ae.boxShadowVOffset,blurRadius:ae.boxShadowBlurRadius,spreadRadius:ae.boxShadowSpreadRadius,color:ae.boxShadowColor,inset:ae.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":ae.borderPosition==="borderAll"?(y={border:{...r.RESET_BORDER_PARAMS,all:{...D.NULL_BORDER,...ae.borderAll}}},s.setFieldsValue({borderLeft:D.NULL_BORDER,borderRight:D.NULL_BORDER,borderTop:D.NULL_BORDER,borderBottom:D.NULL_BORDER})):ae.borderAll?.width||ae.borderAll?.style||ae.borderAll?.color?(y={border:{all:null,left:ae.borderAll,right:ae.borderAll,top:ae.borderAll,bottom:ae.borderAll,[D.REVERSE_BORDER_POSITIONS[w]]:{...ae[w],...O[w]}}},s.setFieldsValue({borderAll:null,borderLeft:ae.borderAll,borderRight:ae.borderAll,borderTop:ae.borderAll,borderBottom:ae.borderAll,[w]:{...ae[w],...O[w]}})):(y={border:{all:null,left:ae.borderLeft,right:ae.borderRight,top:ae.borderTop,bottom:ae.borderBottom,[D.REVERSE_BORDER_POSITIONS[w]]:{...ae[w],...O[w]}}},s.setFieldsValue({border:y.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(ae.mobileBorderPosition==="mobileBorderAll")y={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...D.NULL_BORDER,...ae.mobileBorderAll,classNamePrefix:"em-mob-border_"+D.MOBILE_REVERSE_BORDER_POSITIONS[w]+"-"}}},s.setFieldsValue({borderLeft:D.NULL_BORDER,borderRight:D.NULL_BORDER,borderTop:D.NULL_BORDER,borderBottom:D.NULL_BORDER});else{const ce=D.MOBILE_REVERSE_BORDER_POSITIONS[w],je={...ae[w],...O[w]},Xe=!je?.width&&!je?.style&&!je?.color;if(ae.mobileBorder?.all?.width||ae.mobileBorder?.all?.style||ae.mobileBorder?.all?.color){const oo=ae.mobileBorderAll;y={mobileBorder:{all:null,left:oo,right:oo,top:oo,bottom:oo,[ce]:Xe?null:{...je,classNamePrefix:"em-mob-border_"+ce+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:oo,mobileBorderRight:oo,mobileBorderTop:oo,mobileBorderBottom:oo,[w]:je})}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:{...je,classNamePrefix:"em-mob-border_left-"}:po("left"),right:ce==="right"?Xe?null:{...je,classNamePrefix:"em-mob-border_right-"}:po("right"),top:ce==="top"?Xe?null:{...je,classNamePrefix:"em-mob-border_top-"}:po("top"),bottom:ce==="bottom"?Xe?null:{...je,classNamePrefix:"em-mob-border_bottom-"}:po("bottom")}},s.setFieldsValue({[w]:je})}}break;case"width":y={[w]:{value:O[w],dim:ae.widthDim}};break;case"height":y={[w]:{value:O[w],dim:ae.heightDim}};break;case"widthDim":y={width:{value:ae.width,dim:O[w]}};break;case"heightDim":y={height:{value:ae.height,dim:O[w]}};break;case"maxWidth":y={[w]:{value:O[w],dim:ae.maxWidthDim}};break;case"maxWidthDim":y={maxWidth:{value:ae.maxWidth,dim:O[w]}};break;case"minWidth":y={[w]:{value:O[w],dim:ae.minWidthDim}};break;case"minWidthDim":y={minWidth:{value:ae.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:{[D.PADDING_POSITION[w]]:+O[w]}};break;case"paddingTopBottom":y={padding:{top:+O[w],bottom:+O[w]}},ae.paddingTop=ae.paddingBottom=+O[w];break;case"paddingLeftRight":y={padding:{left:+O[w],right:+O[w]}},ae.paddingLeft=ae.paddingRight=+O[w];break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":y={borderRadius:{[D.BORDER_RADIUS_POSITION[w]]:+O[w]}};break;case"mobileWidth":y={[w]:{classNamePrefix:"em-mob-width-",value:O[w],dim:ae.mobileWidthDim}};break;case"mobileWidthDim":y={mobileWidth:{classNamePrefix:"em-mob-width-",value:ae.mobileWidth||100,dim:O[w]}};break;case"mobileHeight":y={[w]:{classNamePrefix:"em-mob-height-",value:O[w],dim:ae.mobileHeightDim}};break;case"mobileHeightDim":y={mobileHeight:{classNamePrefix:"em-mob-height-",value:ae.mobileHeight,dim:O[w]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":y={mobileBorderRadius:{[D.MOBILE_BORDER_RADIUS_POSITION[w]]:O[w],classNamePrefix:"em-mob-border_radius_"+D.MOBILE_BORDER_RADIUS_POSITION[w]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":y={mobileBoxShadow:{hOffset:ae.mobileBoxShadowHOffset,vOffset:ae.mobileBoxShadowVOffset,blurRadius:ae.mobileBoxShadowBlurRadius,spreadRadius:ae.mobileBoxShadowSpreadRadius,color:ae.mobileBoxShadowColor,inset:ae.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:ae.mobilePaddingTop!==""?ae.mobilePaddingTop:null,right:ae.mobilePaddingRight!==""?ae.mobilePaddingRight:null,bottom:ae.mobilePaddingBottom!==""?ae.mobilePaddingBottom:null,left:ae.mobilePaddingLeft!==""?ae.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":ae.mobilePaddingTop=ae.mobilePaddingBottom=O[w],y={mobilePadding:{all:null,top:ae.mobilePaddingTop!==""?ae.mobilePaddingTop:null,right:ae.mobilePaddingRight!==""?ae.mobilePaddingRight:null,bottom:ae.mobilePaddingBottom!==""?ae.mobilePaddingBottom:null,left:ae.mobilePaddingLeft!==""?ae.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":ae.mobilePaddingLeft=ae.mobilePaddingRight=O[w],y={mobilePadding:{all:null,top:ae.mobilePaddingTop!==""?ae.mobilePaddingTop:null,right:ae.mobilePaddingRight!==""?ae.mobilePaddingRight:null,bottom:ae.mobilePaddingBottom!==""?ae.mobilePaddingBottom:null,left:ae.mobilePaddingLeft!==""?ae.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})},Ne=()=>{H(ae=>!ae);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}}}))},Pe=()=>{const O=s.getFieldsValue(!0);n.markBorderToggled(!P),setTimeout(()=>{z(ae=>!ae),P?(O.borderAll=D.NULL_BORDER,O.borderTop=D.NULL_BORDER,O.borderBottom=D.NULL_BORDER,O.borderRight=D.NULL_BORDER,O.borderLeft=D.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(ae=>!ae),le?(O.mobileBorderAll=D.NULL_BORDER,O.mobileBorderTop=D.NULL_BORDER,O.mobileBorderBottom=D.NULL_BORDER,O.mobileBorderRight=D.NULL_BORDER,O.mobileBorderLeft=D.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(()=>{ne(ae=>!ae),oe?(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(()=>{ye(ae=>!ae),ge?(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(()=>{pe(ae=>!ae),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}}})})},Ie=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{me(ae=>!ae),we?(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-"}}})})},W=()=>{setTimeout(()=>{Le(O=>!O)})},he=()=>{setTimeout(()=>{re(O=>!O)})},Ce=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{ee(ae=>!ae),ie?(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(()=>{K(ae=>!ae),Q?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}}}),Q&&Dt(s,e,l)})},to=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{G(ae=>!ae),Z&&(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(ae=>!ae),U&&(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(()=>{se(ae=>!ae),q&&(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:D.BORDER_POSITIONS[F]||"borderAll",mobileBorderPosition:D.MOBILE_BORDER_POSITIONS[Be]||"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:fe,autoComplete:"off",className:"element-controls",children:[!v&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),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:ge,mobileBoxShadowShow:we,mobileSizeShow:ve,mobileBackgroundShow:Q,mobilePaddingShow:q,mobilePaddingsExt:I,setMobilePaddingsExt:L,oneMobileBorderRadiusValue:p,setOneMobileBorderRadiusValue:B,toggleShowMobileBorderHandler:Ge,toggleShowMobileBorderRadiusHandler:Ze,toggleShowMobileBoxShadowHandler:Ie,toggleShowMobileSizeHandler:he,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:oe,boxShadowShow:te,backgroundShow:ie,backgroundImageEmpty:R,backgroundRepeatOptions:Ee,sizeShow:Me,maxWidthValue:ue,modificationShow:Z,paddingShow:U,paddingsExt:$,oneBorderRadiusValue:g,setOneBorderRadiusValue:b,togglePaddingHandler:Ne,toggleShowPaddingHandler:eo,toggleShowBorderHandler:Pe,toggleShowBorderRadiusHandler:Ye,toggleShowBoxShadowHandler:de,toggleShowSizeHandler:W,toggleShowBackgroundHandler:Ce,toggleShowModificationHandler:to,handleChangeValues:fe})})]})};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:v,handleSelect:$,textReplacerInputHandler:H,handleTextReplacerKeyDown:I,srcButtonHandler:L,togglePaddingHandler:P,toggleShowPaddingHandler:z,toggleShowBackgroundHandler:le,toggleShowBorderHandler:C,toggleShowBorderRadiusHandler:oe,toggleShowBoxShadowHandler:ne,setLinkProtocol:ge,handleChangeValues:ye})=>{const{__:te}=r.useI18n(),{token:pe}=(0,t.ui_kit$useToken)(),we=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})}),we.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:pe.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:we.formButtonFieldReplacerEnabled?pe.formItemMarginBottomXS:pe.formItemMarginBottomMD+4},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(ot,{linkProtocol:x,handleLinkProtocolsChange:v,__: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:pe.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:te("Subject")})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:pe.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:te("Body")})})]}),we.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:me=>me.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:H,onKeyDown:I,ref:E,onSelect:$})})})})]})}),we.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:pe.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:pe.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:ge,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:we,token:pe,elementSettings:l,backgroundRepeatOptions:b,handleChangeValues:ye}),(0,o.jsx)(st,{form:e,showBackground:!0})]}),we.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:te("Borders"),collapsible:!0,open:n,onToggle:C,dividerTop:!0,children:(0,o.jsx)(D.SelectedElementFormBorder,{form:e,elementSettings:l})}),we.formFieldBorderRadiusEnabled&&(0,o.jsxs)(t.ui_kit$FormSection,{title:te("Border radius"),collapsible:!0,open:d,onToggle:oe,dividerTop:!0,children:[(0,o.jsx)(wo,{form:e,oneBorderRadiusValue:B,setOneBorderRadiusValue:k,elementSettings:l}),(0,o.jsx)(st,{form:e,showRounding:!0})]}),we.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:te("Box shadow"),collapsible:!0,open:c,onToggle:ne,dividerTop:!0,children:(0,o.jsx)(Po,{})}),we.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:te("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:l,form:e})}),we.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:v,toggleShowMobileBackgroundHandler:$,toggleShowMobilePaddingHandler:H})=>{const{__:I}=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==="#",__:I,style:{marginBottom:L.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:I("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"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,__:I}),placeholder:I("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:I("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:I("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:I("Padding"),collapsible:!0,open:b,onToggle:H,dividerTop:!0,children:(0,o.jsx)(Ut,{form:e,elementSettings:l,mobilePaddingsExt:_,setMobilePaddingsExt:h})}),(0,o.jsx)(t.ui_kit$FormSection,{title:I("Size"),collapsible:!0,open:m,onToggle:v,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:I("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:I("Height"),placement:"bottom",children:(0,o.jsx)(rt,{form:e,name:"mobileHeight",elementSettings:l})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:I("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:I("Borders"),collapsible:!0,open:n,onToggle:j,dividerTop:!0,children:(0,o.jsx)(D.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),P.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("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:I("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:I("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(No,{})}),P.formFieldAmpVisibilityEnabled&&l.isAmp&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("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",v=(0,a.useRef)(null),$=(0,a.useRef)(null),[H,I]=(0,a.useState)(!1),[L,P]=(0,a.useState)(!1),[z,le]=(0,a.useState)(!1),[C,oe]=(0,a.useState)(!1),[ne,ge]=(0,a.useState)(!1),[ye,te]=(0,a.useState)(!1),[pe,we]=(0,a.useState)(!1),[me,Me]=(0,a.useState)(!1),[Le,ve]=(0,a.useState)(!1),[re,ie]=(0,a.useState)(!1),[ee,Q]=(0,a.useState)(!1),[K,Z]=(0,a.useState)(!1),[G,U]=(0,a.useState)(!1),[Y,q]=(0,a.useState)(""),[se,ue]=(0,a.useState)("https://"),[Se,Ee]=(0,a.useState)({}),Oe=e,[X,F]=(0,a.useState)(!!Oe.textReplacer?.length),[Be,V]=(0,a.useState)(e);e!==Be&&(V(e),F(!!Oe.textReplacer?.length));const fe=r.useElementEntityKind(),Ne=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],Pe=e.border,Ge=e.mobileBorder,Ye=Object.keys(Pe).find(M=>Pe[M]?.width||Pe[M]?.style||Pe[M]?.color),Ze=Object.keys(Ge).find(M=>Ge[M]?.width||Ge[M]?.style||Ge[M]?.color),de=M=>M&&(M?.width||M?.style||M?.color)?M:"",{remember:Ie,fillFields:W}=ut(e);(0,a.useEffect)(()=>{if(e){const M=e.boxShadow||Wn,J=e.mobilePadding||{},Re=e.mobileAlign||{};g(M);let De="",be="",He=e.href||"https://";if(e.href){if(e.href.startsWith("mailto:")){const qe=Or(e.href);De=qe.subject,be=qe.body,He=qe.baseEmail}Wo(e.href,ue)}W(s,{...e,href:He,subject:De,body:be,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(Re?.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)?I(!1):I(!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),oe(qe=>Ye&&!Ke||Ze&&!Fe?!0:qe),ge(!!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),we(!!e.boxShadow),Me(!!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),ie(!!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),Z(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),U(!!e.mobilePadding?.all||!!e.mobilePadding?.top||!!e.mobilePadding?.bottom||!!e.mobilePadding?.left||!!e.mobilePadding?.right||!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right)}},[s,e,E,Ye,Ze,n,d,W]);const he=(0,a.useCallback)(M=>{Ie(M),c(fe==="email"?r.setElementSettings$1(M):r.setElementSettings(M))},[c,fe,Ie]),Ce=M=>{const J=s.getFieldsValue(!0),Re=Object.keys(M)[0];let De;switch(q(s.getFieldsValue(!0).widthDim==="%"?100:""),Re){case"exportAsPicture":De={exportAsPicture:J.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":De={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"?(De={border:{...r.RESET_BORDER_PARAMS,all:{...D.NULL_BORDER,...J.borderAll}}},s.setFieldsValue({borderLeft:D.NULL_BORDER,borderRight:D.NULL_BORDER,borderTop:D.NULL_BORDER,borderBottom:D.NULL_BORDER})):J.borderAll?.width||J.borderAll?.style||J.borderAll?.color?(De={border:{all:null,left:J.borderAll,right:J.borderAll,top:J.borderAll,bottom:J.borderAll,[D.REVERSE_BORDER_POSITIONS[Re]]:{...J[Re],...M[Re]}}},s.setFieldsValue({borderAll:null,borderLeft:J.borderAll,borderRight:J.borderAll,borderTop:J.borderAll,borderBottom:J.borderAll,[Re]:{...J[Re],...M[Re]}})):(De={border:{all:null,left:J.borderLeft,right:J.borderRight,top:J.borderTop,bottom:J.borderBottom,[D.REVERSE_BORDER_POSITIONS[Re]]:{...J[Re],...M[Re]}}},s.setFieldsValue({border:De.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(J.mobileBorderPosition==="mobileBorderAll")De={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...D.NULL_BORDER,...J.mobileBorderAll,classNamePrefix:"em-mob-border_"+D.MOBILE_REVERSE_BORDER_POSITIONS[Re]+"-"}}},s.setFieldsValue({borderLeft:D.NULL_BORDER,borderRight:D.NULL_BORDER,borderTop:D.NULL_BORDER,borderBottom:D.NULL_BORDER});else{const Ke=D.MOBILE_REVERSE_BORDER_POSITIONS[Re],Fe={...J[Re],...M[Re]},qe=!Fe?.width&&!Fe?.style&&!Fe?.color;if(J.mobileBorder?.all?.width||J.mobileBorder?.all?.style||J.mobileBorder?.all?.color){const so=J.mobileBorderAll;De={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,[Re]:Fe})}else{const so=e.mobileBorder||{},To=T=>{const _e=so[T];return _e&&(_e?.width||_e?.style||_e?.color)?_e:null};De={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({[Re]:Fe})}}break;case"width":De={[Re]:{value:M[Re],dim:J.widthDim}};break;case"height":De={[Re]:{value:M[Re],dim:J.heightDim}};break;case"widthDim":De={width:{value:J.width,dim:M[Re]}};break;case"heightDim":De={height:{value:J.height,dim:M[Re]}};break;case"backgroundImage":R(M[Re]===""),De={[Re]:[{...e.backgroundImage[0],value:M[Re]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":De={padding:{left:J.paddingLeft,right:J.paddingRight,top:J.paddingTop,bottom:J.paddingBottom,[D.PADDING_POSITION[Re]]:+M[Re]}};break;case"paddingTopBottom":De={padding:{left:J.paddingLeft,right:J.paddingRight,top:+M[Re],bottom:+M[Re]}},J.paddingTop=J.paddingBottom=+M[Re];break;case"paddingLeftRight":De={padding:{top:J.paddingTop,bottom:J.paddingBottom,left:+M[Re],right:+M[Re]}},J.paddingLeft=J.paddingRight=+M[Re];break;case"borderRadiusAll":De={borderRadius:{[D.BORDER_RADIUS_POSITION[Re]]:+M[Re]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":De={borderRadius:{topLeft:J.borderRadiusTopLeft,bottomLeft:J.borderRadiusBottomLeft,topRight:J.borderRadiusTopRight,bottomRight:J.borderRadiusBottomRight,[D.BORDER_RADIUS_POSITION[Re]]:+M[Re]}};break;case"mobileWidth":De={[Re]:{classNamePrefix:"em-mob-width-",value:M[Re],dim:J.mobileWidthDim}};break;case"mobileWidthDim":De={mobileWidth:{classNamePrefix:"em-mob-width-",value:J.mobileWidth||100,dim:M[Re]}};break;case"mobileHeight":De={[Re]:{classNamePrefix:"em-mob-height-",value:M[Re],dim:J.mobileHeightDim},mobileLineHeight:{classNamePrefix:"em-mob-line_height-",value:M[Re],dim:J.mobileHeightDim}};break;case"mobileHeightDim":De={mobileHeight:{classNamePrefix:"em-mob-height-",value:J.mobileHeight,dim:M[Re]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":De={mobileBorderRadius:{[D.MOBILE_BORDER_RADIUS_POSITION[Re]]:M[Re],classNamePrefix:"em-mob-border_radius_"+D.MOBILE_BORDER_RADIUS_POSITION[Re]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":De={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":De={[Re]:{classNamePrefix:"em-mob-table_align-",value:M[Re]}};break;case"mobileTextAlign":De={[Re]:{classNamePrefix:"em-mob-text_align-",value:M[Re]}};break;case"mobileVerticalAlign":De={[Re]:{classNamePrefix:"em-mob-vertical_align-",value:M[Re]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(De=kt(M),!De)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":De={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=M[Re],De={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=M[Re],De={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":De={[Re]:{classNamePrefix:"em-mob-font_size-",value:M[Re],dim:J.mobileFontSizeDim}};break;case"href":let be=it(M[Re]);be!==M[Re]&&(s.setFieldValue("href",be),J.href=be),be.startsWith("mailto:")?De={[Re]:yi(be,J.subject,J.body)}:De={[Re]:be},Wo(M[Re],ue);break;case"subject":case"body":const He=J.href||"";if(He.startsWith("mailto:")){const Ke=Re==="subject"?M[Re]:J.subject,Fe=Re==="body"?M[Re]:J.body;De={href:yi(He,Ke,Fe)}}else return;break;case"backgroundPositionX":case"backgroundPositionY":De={[Re]:isNaN(parseFloat(M[Re].position))?M[Re].position:M[Re].position+M[Re].unit};break;default:De=M}Re!=="borderPosition"&&Re!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:De}),Re!=="mobileBorderRadiusAll"&&Re!=="mobileBorderRadiusTopLeft"&&Re!=="mobileBorderRadiusTopRight"&&Re!=="mobileBorderRadiusBottomLeft"&&Re!=="mobileBorderRadiusBottomRight"&&he({...e,...De,mobileBorderRadius:{...e.mobileBorderRadius,...De?.mobileBorderRadius},activateSection:null,changeKey:Re}))},We=()=>{I(J=>!J);const M=s.getFieldsValue(!0);H||(M.paddingLeftRight=M.paddingLeft,M.paddingTopBottom=M.paddingTop,M.paddingRight=M.paddingLeft,M.paddingBottom=M.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:M.paddingTopBottom,bottom:M.paddingTopBottom,left:M.paddingLeftRight,right:M.paddingLeftRight}}}))},to=()=>{const M=s.getFieldsValue(!0);n.markBorderToggled(!z),setTimeout(()=>{le(J=>!J),z?(M.borderAll=D.NULL_BORDER,M.borderTop=D.NULL_BORDER,M.borderBottom=D.NULL_BORDER,M.borderRight=D.NULL_BORDER,M.borderLeft=D.NULL_BORDER):M.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:M.borderAll.color,style:M.borderAll.style,width:M.borderAll.width}}}})})},eo=()=>{const M=s.getFieldsValue(!0);d.markBorderToggled(!C),setTimeout(()=>{oe(J=>!J),C?(M.mobileBorderAll=D.NULL_BORDER,M.mobileBorderTop=D.NULL_BORDER,M.mobileBorderBottom=D.NULL_BORDER,M.mobileBorderRight=D.NULL_BORDER,M.mobileBorderLeft=D.NULL_BORDER):M.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:M.mobileBorderAll.color,style:M.mobileBorderAll.style,width:M.mobileBorderAll.width}}}})})},no=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{ge(J=>!J),ne?(M.borderRadiusAll=0,_(!0)):M.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:M.borderRadiusAll}}})})},O=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{te(J=>!J),ye?(M.mobileBorderRadiusAll=null,p(!0)):M.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:M.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},ae=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{we(J=>!J),pe?(M.boxShadowInset=!1,M.boxShadowHOffset=null,M.boxShadowVOffset=null,M.boxShadowBlurRadius=null,M.boxShadowSpreadRadius=null,M.boxShadowColor=""):(M.boxShadowInset=!1,M.boxShadowHOffset=5,M.boxShadowVOffset=5,M.boxShadowBlurRadius=10,M.boxShadowSpreadRadius=-5,M.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:M.boxShadowBlurRadius,color:M.boxShadowColor,hOffset:M.boxShadowHOffset,inset:M.boxShadowInset,spreadRadius:M.boxShadowSpreadRadius,vOffset:M.boxShadowVOffset}}})})},w=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{Me(J=>!J),me?(M.mobileBoxShadowInset=!1,M.mobileBoxShadowHOffset=null,M.mobileBoxShadowVOffset=null,M.mobileBoxShadowBlurRadius=null,M.mobileBoxShadowSpreadRadius=null,M.mobileBoxShadowColor=""):(M.mobileBoxShadowInset=!1,M.mobileBoxShadowHOffset=5,M.mobileBoxShadowVOffset=5,M.mobileBoxShadowBlurRadius=10,M.mobileBoxShadowSpreadRadius=-5,M.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:M.mobileBoxShadowBlurRadius,color:M.mobileBoxShadowColor,hOffset:M.mobileBoxShadowHOffset,inset:M.mobileBoxShadowInset,spreadRadius:M.mobileBoxShadowSpreadRadius,vOffset:M.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},y=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{ve(J=>!J),Le&&(M.mobileWidth="",M.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 M=s.getFieldsValue(!0);setTimeout(()=>{ie(J=>!J),re?(M.backgroundColor="",M.backgroundImage="",M.backgroundPositionX="",M.backgroundPositionY="",M.backgroundRepeat="none",M.backgroundSize="",R(!0)):(M.backgroundColor="#E5E5E5",M.backgroundSize="",M.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:M.backgroundColor,backgroundImage:[{type:"url",value:M.backgroundImage}],backgroundPositionX:M.backgroundPositionX,backgroundPositionY:M.backgroundPositionY,backgroundRepeat:M.backgroundRepeat,backgroundSize:M.backgroundSize}})})},je=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{Q(J=>!J),ee?M.mobileBackgroundColor="":M.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:M.mobileBackgroundColor}}}),ee&&Dt(s,e,l)})},Xe=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{Z(J=>!J),K&&(M.paddingLeftRight="",M.paddingLeft="",M.paddingRight="",M.paddingTopBottom="",M.paddingTop="",M.paddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},oo=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{U(J=>!J),G&&(M.mobilePaddingLeftRight="",M.mobilePaddingLeft="",M.mobilePaddingRight="",M.mobilePaddingTopBottom="",M.mobilePaddingTop="",M.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=M=>{s.setFieldValue("href",M!=="mergetag"?M:""),ue(M)},co=(0,a.useCallback)(({target:M})=>{if(!M)return;const{selectionStart:J,selectionEnd:Re}=M;Ee(De=>De.target===M&&De.selection?.start===J&&De.selection?.end===Re?De:{target:M,selection:{start:J,end:Re}})},[]),_o=M=>{M.target.value!==""&&$.current.classList.add("selected-td-form__button--active")},vo=()=>{F(!X),X?(s.setFieldValue("textReplacer",""),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{textReplacer:""}})):setTimeout(()=>v.current.focus())},Co=M=>{const J=M.target,Re=J.value,De=J.selectionStart;if(De===0&&M.key===" "){M.preventDefault();return}if(M.key===" "){if(De!==Re.length){M.preventDefault();return}Re.endsWith(" ")&&M.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:D.BORDER_POSITIONS[Ye]||"borderAll",mobileBorderPosition:D.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:Ce,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)(vi,{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:W,elementSettings:e,boxShadow:m,mobileBordersShow:C,mobileBorderRadiusShow:ye,mobileBoxShadowShow:me,mobileSizeShow:Le,mobileBackgroundShow:ee,mobilePaddingShow:G,mobilePaddingsExt:L,setMobilePaddingsExt:P,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:p,linkProtocol:se,handleLinkProtocolsChange:po,setLinkProtocol:ue,toggleShowMobileBorderHandler:eo,toggleShowMobileBorderRadiusHandler:O,toggleShowMobileBoxShadowHandler:w,toggleShowMobileSizeHandler:y,toggleShowMobileBackgroundHandler:je,toggleShowMobilePaddingHandler:oo})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(El,{form:s,fillFields:W,elementSettings:e,boxShadow:m,bordersShow:z,borderRadiusShow:ne,boxShadowShow:pe,backgroundShow:re,backgroundImageEmpty:x,backgroundRepeatOptions:Ne,paddingShow:K,paddingsExt:H,maxWidthValue:Y,oneBorderRadiusValue:b,setOneBorderRadiusValue:_,linkProtocol:se,linkTarget:Se,isOpenTextReplacer:X,textReplacerButtonRef:$,textReplacerInputRef:v,handleLinkProtocolsChange:po,handleSelect:co,textReplacerInputHandler:_o,handleTextReplacerKeyDown:Co,srcButtonHandler:vo,togglePaddingHandler:We,toggleShowPaddingHandler:Xe,toggleShowBackgroundHandler:ce,toggleShowBorderHandler:to,toggleShowBorderRadiusHandler:no,toggleShowBoxShadowHandler:ae,setLinkProtocol:ue,handleChangeValues:Ce})})})]})};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),v=(0,a.useRef)(null),$=(0,a.useRef)(null),H=(0,a.useRef)(null),[I,L]=(0,a.useState)(""),[P,z]=(0,a.useState)(""),[le,C]=(0,a.useState)(""),[oe,ne]=(0,a.useState)(!1),[ge,ye]=(0,a.useState)("https://"),te=(0,a.useRef)(!1),pe=(0,a.useRef)(l);(0,a.useEffect)(()=>{l!==pe.current&&(pe.current=l,te.current=!1),z(e.images?.[p]),C(e.images?.[h]);const Z=e.images?.[B];L(Z||(te.current?"...":""))},[e,p,h,B,l]);const we=()=>{I?(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()}))},me=Z=>{Z.target.value===""?L("..."):(R.current.classList.add("selected-td-form__button--active"),L(Z.target.value));const G=Z.target.value;Wo(G,ye)},Me=()=>{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=Z=>{Z.target.value===""?z("..."):(N.current.classList.add("selected-td-form__button--active"),z(Z.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()}))},re=()=>{ne(!oe),oe?(s.setFieldValue(k,""),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[k]:""}})):setTimeout(()=>$.current.focus())},ie=Z=>{Z.target.value!==""&&H.current.classList.add("selected-td-form__button--active")},ee=Z=>{Z.target.value===""?C("..."):(v.current.classList.add("selected-td-form__button--active"),C(Z.target.value))},Q=Z=>{s.setFieldValue("LinkName",Z!=="mergetag"?Z:""),ye(Z)},K=Z=>{const G=s.getFieldsValue(!0),U=+l.substring(1),Y=Object.keys(G?.images).reduce((se,ue)=>(ue.includes(l)||(se[ue]=G[ue]),se),{}),q=e.carouselImages?.filter((se,ue)=>ue!==U);i(se=>({...se,settings:{...se.settings,carouselImages:Rl(q)}})),b({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:e.caption,settings:{...e,carouselImages:q}}),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:Z=>Z.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:Me,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:Z=>Z.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:v,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:I||c("Hyperlink URL"),placement:"bottom",getPopupContainer:Z=>Z.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":!!I}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:we,ref:R})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:c("Image replacer"),placement:"bottom",getPopupContainer:Z=>Z.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,ze.default)("selected-td-form__button",{"selected-td-form__button--active":oe}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:re,ref:H})})]}),(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:K,icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16})})})})]}),(!!I||!!P||!!le||!!oe)&&(0,o.jsxs)("div",{children:[!!I&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(tt,{show:ge==="#",__: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:ge,handleLinkProtocolsChange:Q,__:c}),placeholder:c("Hyperlink URL"),allowClear:!0,ref:x,onChange:me,onSelect:n,prefix:(0,o.jsx)(et,{linkProtocol:ge})})})})]}),!!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:ee,ref:E,onSelect:n})})}),!!oe&&(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:ie,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:v}=(0,t.ui_kit$useToken)(),$=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(tt,{show:m==="#",__:E,style:{marginBottom:v.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:v.formItemMarginBottomMD,marginTop:v.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:H=>H.closest(".email-pane__collapse-wrapper"),onChange:k,style:{display:b?"block":"none"},open:b,onKeyDown:H=>{H.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:v.formItemMarginBottomMD+4},children:i?.settings?.carouselImages?.map((H,I)=>(0,o.jsx)("div",{className:"carousel__slide",children:(0,o.jsx)(yl,{elementSettings:l,setElementSettings:s,postfix:"_"+I,form:e,handleSelect:B})},I))})}),(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:v.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:v.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:v.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:v.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 vl=({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,v]=(0,a.useState)(l?.getFieldsValue(!0)),[$,H]=(0,a.useState)(e),{remember:I,isOwnEcho:L}=Hr(qn),[P,z]=(0,a.useState)(e);e!==P&&(z(e),L(e?.settings)||H(e));const[le,C]=(0,a.useState)({name:"",counter:0}),[oe,ne]=(0,a.useState)(null),[ge,ye]=(0,a.useState)(),[te,pe]=(0,a.useState)(!1),[we,me]=(0,a.useState)(!1),[Me,Le]=(0,a.useState)({start:0,end:0}),ve=(0,a.useRef)(null),re=`selected_${$.type}_form_link`,ie=r.useSelector(r.selectIsCodeMode),ee=r.useSelector(r.selectCodeModeDirection),Q=ie&&ee!=="bottom";(0,a.useEffect)(()=>{te&&ve.current&&ve.current.focus()},[te]);const K=(V,fe)=>{const Ne=document.getElementById(fe);if(Ne){const Pe=$,Ge=Gn(Pe.type,fe),Ye=Yn(Ge),Ze=Ne.value?.substring(0,Me.start),de=Ne.value?.substring(Me.end);let Ie={[Ge]:Ze+V+de};Ye?Ie={carouselImages:Xn(Pe.settings?.carouselImages,Ye,Ze+V+de)}:$.type===r.ELEMENT_TYPES.CAROUSEL&&re===fe&&(Ie={[Ge]:Ze+V+de,carouselImages:[...$.settings?.carouselImages.map(W=>({...W,link:Ze+V+de}))||[]]}),n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...$.settings,...Ie}}),H(W=>({...W,settings:{...W.settings,...Ie}})),l.setFieldValue(Ge,Ze+V+de),Ne.focus(),setTimeout(()=>{Ne.selectionStart=Me.start,Ne.selectionEnd=Me.start+V.length},400),me(!0)}},Z=r.useAppConfig().mergeTags;(0,a.useEffect)(()=>{Z?.items?.length&&ye(r.mapMargeTags(Z.items))},[Z,ye]);const G=(V,fe)=>{if(pe(!1),V){const Ne=Z.syntax.length>1?ge.findIndex(Ye=>Ye.key===fe[0].key):0,Pe=Z.syntax[Ne].replace("%value%",V[V.length-1]),Ge=`selected_${$.type}_form${$.type==="carousel"?"_images":""}`;["imgReplacer","title","alt","src","link"].some(Ye=>oe?.getAttribute("id").includes(`${Ge}_${Ye}`))||oe?.getAttribute("id").includes(re)?K(Pe,oe?.getAttribute("id")):(l.setFieldValue("imgReplacer",Pe),n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...$.settings,imgReplacer:Pe}}),H(Ye=>({...Ye,settings:{...Ye.settings,imgReplacer:Pe}})))}},U=r.useRootElement();(0,a.useEffect)(()=>{const V=({target:Pe})=>{Pe.closest('[id="merge_tags_wrapper"]')||ne(Pe)},fe=({target:Pe})=>{!Pe.closest(".merge-tags")&&!Pe.closest("#merge_tags_button")&&pe(!1)},Ne=new yo.Disposable;return Ne.addDisposable(r.addWindowListenerFromShadow(U,"focusin",V)),Ne.addDisposable(r.addWindowListenerFromShadow(U,"click",fe)),()=>{Ne.dispose()}},[U]);const Y=(V,fe)=>fe.some(Ne=>Ne.label.toLowerCase().indexOf(V.toLowerCase())>-1),q=(V,fe)=>{const Ne=fe.map((Pe,Ge)=>{const Ye=Pe.label.split(new RegExp(`(${V})`,"gi"));return(0,o.jsxs)("span",{children:[Ge!==0&&(0,o.jsx)("span",{children:" / "}),Ye.map((Ze,de)=>Ze.toLowerCase()===V.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:Ze},de):Ze)]},Pe.value)});return(0,o.jsx)("div",{title:fe.map(Pe=>Pe.label).join(" / "),children:Ne})};(0,a.useEffect)(()=>{const V=l?.getFieldsValue(!0);v(V)},[l]);const se=({target:V})=>{if(V&&!we){const{selectionStart:fe,selectionEnd:Ne}=V;Le({start:fe,end:Ne})}me(!1)};(0,a.useEffect)(()=>{if($.settings){const V=$.settings,fe=wi(V);l?.setFieldsValue(fe),v(fe),V.link&&N(Ot(V.link,"https://")),u(V.borderRadius?.all)||(u(V.borderRadius?.topLeft)||u(V.borderRadius?.bottomLeft)||u(V.borderRadius?.topRight)||u(V.borderRadius?.bottomRight)?_(!1):u(V.borderRadius?.all)||_(!0)),u(V.mobileBorderRadius?.topLeft)||u(V.mobileBorderRadius?.bottomLeft)||u(V.mobileBorderRadius?.topRight)||u(V.mobileBorderRadius?.bottomRight)?p(!1):p(!0),k(!!V.borderRadius?.all||!!V.borderRadius?.topLeft||!!V.borderRadius?.bottomLeft||!!V.borderRadius?.topRight||!!V.borderRadius?.bottomRight),R(!!V.mobileBorderRadius?.all||!!V.mobileBorderRadius?.topLeft||!!V.mobileBorderRadius?.bottomLeft||!!V.mobileBorderRadius?.topRight||!!V.mobileBorderRadius?.bottomRight)}},[l,$]);const ue=V=>{const fe=Fr($.settings,l,V);n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:fe.caption,settings:fe}),I({...$.settings,...fe}),H(Ne=>({...Ne,settings:{...Ne.settings,...fe}}))},Se=(V,fe)=>{const Ne=r.stripEmVersionFromUrlString($.settings?.src||"")===r.stripEmVersionFromUrlString(V||"");(!Ne||V!==$.settings?.src)&&ue({src:V}),fe?.mode==="save"&&Ne&&(C(Pe=>({name:"src",counter:Pe.counter+1})),d(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(V)}))},Ee=async V=>{const fe=$.settings?.src||"",Ne=r.stripEmVersionFromUrlString(fe),Pe=await c({kind:"img",currentUrl:_t(Ne)?"":Ne,entryModal:V});Pe?.url&&Se(Pe.url,Pe.meta)},Oe=V=>{const fe=V.data.operation;fe===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?Ee(r.MODALS.UPLOAD_IMAGE_MODAL_AI):fe===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?Ee(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):fe===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?Ee(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):fe===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?Ee(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):fe===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?Ee(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK):fe===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(s(r.closeSecondModal()),s(r.closeModal$1()))};r.useListenPostMessage(Oe);const X=()=>{setTimeout(()=>{k(V=>!V),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}}}),H(V=>({...V,settings:{...V.settings,borderRadius:{all:B?null:5}}}))})},F=V=>{l.setFieldValue("link",V!=="mergetag"?V:""),N(V)},Be=()=>{const{width:V,height:fe,renderedWidth:Ne,renderedHeight:Pe}=$?.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:V.value,dim:"px"},height:{value:fe.value,dim:"px"},alt:"",title:"",link:null,renderedWidth:Ne,renderedHeight:Pe,imgReplacer:"",mobileWidth:{value:null,dim:"px"},mobileHeight:{value:null,dim:"px"},mobileBorderRadius:{all:null,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}},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);H(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:ue,autoComplete:"off",className:"element-controls",children:[!Q&&(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:H,borderRadiusShow:B,oneBorderRadiusValue:b,setOneBorderRadiusValue:_,linkProtocol:j,mergeTagItems:ge,mergeMenuOpen:te,setMergeMenuOpen:pe,cascaderRef:ve,handleLinkProtocolsChange:F,handleSelect:se,onChange:G,filter:Y,renderSearchOption:q,toggleShowBorderRadiusHandler:X,setNewSlide:Be})})]})};vl.propTypes={};var Jn={animate:!0,expandSingleSection:!0,sections:[{expanded:!1,index:0}]},Il=({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"})]})})};Il.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 v=(0,a.useMemo)(()=>({marginBottom:E?d.formItemMarginBottomXS:0}),[E,d.formItemMarginBottomXS]),$=(0,a.useMemo)(()=>[l,"alt"],[l]),H=(0,a.useMemo)(()=>[l,"title"],[l]),I=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]),oe=(0,a.useMemo)(()=>(0,ze.default)("selected-td-form__button",{"selected-td-form__button--active":N}),[N]),ne=(0,a.useCallback)(te=>{setTimeout(()=>{const pe=te.current;if(pe){if(typeof pe.focus=="function"){pe.focus();return}pe.input&&typeof pe.input.focus=="function"&&pe.input.focus()}},0)},[]),ge=(0,a.useCallback)(()=>{j?(h(!1),g.trim()&&(i.setFieldValue(["items",l,"alt"],""),setTimeout(()=>s(),0))):(h(!0),ne(k))},[j,g,l,ne,i,s]),ye=(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),ne(x)}},[g,l,ne,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:v,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:ge,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:oe,onClick:ye,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})})]}),(0,o.jsxs)("div",{className:I,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:H,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),v=(0,a.useRef)(!1),$=(0,a.useRef)(""),H=(0,a.useRef)({}),I=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 X=F=>{F.preventDefault(),F.dataTransfer&&(F.dataTransfer.dropEffect="move")};document.addEventListener("dragover",X,!0),E.current=X},[]),C=(0,a.useMemo)(()=>r.getSocialPresetsForBrand(Zn).filter(X=>r.SOCIAL_ICON_ORIGINAL_BY_PLATFORM[X.id]),[]),oe=(0,a.useMemo)(()=>C.map(X=>({value:X.id,label:(0,o.jsxs)("span",{className:"selected-social-form__platform-option",children:[(0,o.jsx)("img",{src:r.getSocialIcon(X.id,I),alt:""}),(0,o.jsx)("span",{className:"selected-social-form__platform-option-text",children:i(X.labelMsgid)})]})})),[i,C,I]),ne=(0,a.useCallback)((X,F)=>{H.current={...H.current,[X]:{...H.current[X],...F}}},[]);(0,a.useEffect)(()=>{const X=Nl(e);j.current!==X&&(j.current=X,H.current={},b(e))},[e]);const ge=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(g?.settings){if(ge.current){ge.current=!1;return}const X=g.settings;$.current=X.bgEnabled&&X.bgColor?String(X.bgColor).trim():"",n.setFieldsValue(pd(g.settings))}},[g,n]),(0,a.useEffect)(()=>()=>z(),[z]);const ye=(0,a.useCallback)(()=>{const X=n.getFieldsValue(!0),F=g.settings||{},Be=String(F.hostCellBgForIconLuminance??"").trim(),V=(X.globalBgColor||"").trim(),fe=typeof X.iconSize=="number"&&!Number.isNaN(X.iconSize)?X.iconSize:F.iconSize??40,Ne=typeof X.borderRadius=="number"&&!Number.isNaN(X.borderRadius)?X.borderRadius:F.borderRadius??0,Pe=typeof X.gap=="number"&&!Number.isNaN(X.gap)?X.gap:F.gap??8,Ge={blockBgEnabled:!!V,blockBgColor:V},Ye=(X.globalItemBorderColor||"").trim();let Ze=typeof X.buttonBorderWidth=="number"&&!Number.isNaN(X.buttonBorderWidth)?X.buttonBorderWidth:0;Ze=Math.max(0,Math.min(24,Math.round(Ze)));const de={...F,type:"social",align:X.align??F.align??"center",iconSize:fe,borderRadius:Ne,gap:Pe,bgEnabled:!!V,bgColor:V,hostCellBgForIconLuminance:Be,borderWidth:typeof F.borderWidth=="number"?F.borderWidth:0,borderColor:typeof F.borderColor=="string"?F.borderColor:"",buttonBorderColor:"",buttonBorderWidth:Ze,showLabel:X.showLabel,items:(X.items||[]).filter(Boolean).map((Ie,W)=>{const he=!!Ie.customIcon,Ce=H.current[W]||{},We=he?"":ad(V,(Ie.buttonBgColor||"").trim()),to=typeof Ie.href=="string"?Pl(Ie.href):Ie.href,eo=he?"":Gt(V,We),no=!he&&Ie.platform?r.getSocialIconForBlockCell(Ie.platform,Wt(Ge,eo,Be)):null,O=he?"":Ye||String(Ie.itemBorderColor??"").trim(),ae=id(he?Ie.iconSrc||"":no||Ie.iconSrc||"");return{...Ie,customIcon:he,href:to,iconSrc:ae,iconWidth:null,iconHeight:null,buttonBgColor:We,itemBorderColor:O,title:Ce.title?String(Ie.title??"").trim():""}})};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.SOCIAL,caption:g.caption,settings:de}),$.current=V,ge.current=!0,b(Ie=>({...Ie,settings:de}))},[g.caption,g.settings,n,d]),te=(0,a.useCallback)(X=>{if(X==null||X==="")return-1;const F=r.stripEmVersionFromUrlString(String(X));return(n.getFieldValue("items")||[]).findIndex(Be=>r.stripEmVersionFromUrlString(Be&&Be.iconSrc||"")===F)},[n]),pe=(0,a.useCallback)((X,F,Be,V)=>{const fe=[...n.getFieldValue("items")||[]];if(X<0||X>=fe.length)return;const Ne=r.stripEmVersionFromUrlString(String(V||""))===r.stripEmVersionFromUrlString(String(F||""));(!Ne||F!==fe[X]?.iconSrc)&&(fe[X]={...fe[X],iconSrc:F,customIcon:!0,buttonBgColor:"",itemBorderColor:""},n.setFieldValue("items",fe),setTimeout(()=>ye(),0)),Be?.mode==="save"&&Ne&&c(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(F)})},[n,ye,c]),we=(0,a.useCallback)(async(X,F)=>{const Be=r.stripEmVersionFromUrlString(String(F||"")),V=te(F);if(V<0)return;const fe=(n.getFieldValue("items")||[])[V]?.iconSrc,{entryModal:Ne,currentUrl:Pe,imageDataUrl:Ge}=await Al(Be,X),Ye=await m({kind:"img",currentUrl:Pe,entryModal:Ne,imageDataUrl:Ge});Ye?.url&&pe(V,Ye.url,Ye.meta,fe)},[pe,te,n,m]),me=(0,a.useCallback)(async X=>{const F=(n.getFieldValue("items")||[])[X];if(!F)return;const{entryModal:Be,currentUrl:V,imageDataUrl:fe}=await Al(r.stripEmVersionFromUrlString(String(F.iconSrc||"")),r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD),Ne=F.iconSrc,Pe=await m({kind:"img",currentUrl:V,entryModal:Be,imageDataUrl:fe});Pe?.url&&pe(X,Pe.url,Pe.meta,Ne)},[pe,n,m]),Me=(0,a.useCallback)(X=>{const F=parseInt(X.currentTarget.dataset.socialEditIndex??"",10);Number.isNaN(F)||me(F)},[me]),Le=(0,a.useCallback)(X=>{const F=X.data?.operation,Be=X.data?.src;F===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_AI,Be):F===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,Be):F===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT,Be):F===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_GIF,Be):F===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?we(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK,Be):F===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(s(r.closeSecondModal()),s(r.closeModal$1()))},[s,we]);r.useListenPostMessage(Le);const ve=(0,a.useCallback)(()=>{const X=n.getFieldValue("items")||[],F=C[0],Be=(n.getFieldValue("globalItemBorderColor")||"").trim(),V=(n.getFieldValue("globalBgColor")||"").trim();if(!F)n.setFieldsValue({items:[...X,{platform:void 0,customIcon:!1,href:"",alt:"",title:"",iconSrc:"",iconWidth:null,iconHeight:null,buttonBgColor:V,itemBorderColor:Be}]});else{const fe=String(g?.settings?.hostCellBgForIconLuminance??"").trim(),Ne=Gt(V,V),Pe=r.getSocialIconForBlockCell(F.id,Wt({blockBgEnabled:!!V,blockBgColor:V},Ne,fe)),Ge=i(F.labelMsgid);n.setFieldsValue({items:[...X,{platform:F.id,customIcon:!1,href:"",alt:Ge,title:"",iconSrc:Pe,iconWidth:null,iconHeight:null,buttonBgColor:V,itemBorderColor:Be}]})}setTimeout(()=>ye(),0)},[i,g?.settings?.hostCellBgForIconLuminance,n,C,ye]),re=(0,a.useCallback)((X,F)=>{X.dataTransfer.setData(Cl,String(F)),X.dataTransfer.setData(r.DND_SOCIAL_LIST_REORDER_MIME,String(F)),X.dataTransfer.effectAllowed="move",k.current=F,h(F),le()},[le]),ie=(0,a.useCallback)(()=>{z(),k.current=null,h(null),B(null)},[z]),ee=(0,a.useCallback)((X,F,Be)=>{if(Be<2)return;X.preventDefault(),X.dataTransfer.dropEffect="move";const V=k.current;V!==null&&V!==F&&B(F)},[]),Q=(0,a.useCallback)((X,F)=>{X.currentTarget.contains(X.relatedTarget)||B(Be=>Be===F?null:Be)},[]),K=(0,a.useCallback)((X,F,Be)=>{X.preventDefault(),B(null);const V=X.dataTransfer.getData(Cl),fe=parseInt(V,10);if(Number.isNaN(fe)||fe===F){z();return}Be(fe,F),z(),setTimeout(()=>ye(),0)},[z,ye]),Z=(0,a.useCallback)(X=>{const F=X.currentTarget,Be=parseInt(F.dataset.itemIndex??"",10);Number.isNaN(Be)||re(X,Be)},[re]),G=(0,a.useCallback)(X=>{const F=X.currentTarget,Be=parseInt(F.dataset.itemIndex??"",10),V=parseInt(F.dataset.listLength??"",10);Number.isNaN(Be)||Number.isNaN(V)||V<2||(X.preventDefault(),X.dataTransfer&&(X.dataTransfer.dropEffect="move"))},[]),U=(0,a.useCallback)(X=>{const F=X.currentTarget,Be=parseInt(F.dataset.itemIndex??"",10),V=parseInt(F.dataset.listLength??"",10);Number.isNaN(Be)||Number.isNaN(V)||ee(X,Be,V)},[ee]),Y=(0,a.useCallback)(X=>{const F=parseInt(X.currentTarget.dataset.itemIndex??"",10);Number.isNaN(F)||Q(X,F)},[Q]),q=(0,a.useCallback)(X=>{const F=parseInt(X.currentTarget.dataset.itemIndex??"",10),Be=x.current;Number.isNaN(F)||typeof Be!="function"||K(X,F,Be)},[K]),se=(0,a.useCallback)(X=>{X.stopPropagation();const F=parseInt(X.currentTarget.dataset.fieldName??"",10),Be=R.current;Number.isNaN(F)||typeof Be!="function"||(Be(F),queueMicrotask(ye))},[ye]),ue=(0,a.useCallback)((X,F)=>{const Be=C.find(de=>de.id===F);if(!Be)return;const V=i(Be.labelMsgid),fe=H.current[X]||{},Ne=String(n.getFieldValue(["items",X,"alt"])??"").trim();(fe.alt||Ne)&&n.setFieldValue(["items",X,"alt"],V),fe.title&&n.setFieldValue(["items",X,"title"],V);const Pe=(n.getFieldValue("globalBgColor")||"").trim(),Ge=Gt(Pe,(n.getFieldValue(["items",X,"buttonBgColor"])||"").trim()),Ye=String(g?.settings?.hostCellBgForIconLuminance??"").trim(),Ze=r.getSocialIconForBlockCell(F,Wt({blockBgEnabled:!!Pe,blockBgColor:Pe},Ge,Ye));Ze&&(n.setFieldValue(["items",X,"customIcon"],!1),n.setFieldValue(["items",X,"iconSrc"],Ze))},[i,g?.settings?.hostCellBgForIconLuminance,n,C]),Se=(0,a.useCallback)(X=>{if(Object.prototype.hasOwnProperty.call(X,"globalItemBorderColor")){if(!v.current){const F=String(X.globalItemBorderColor??"").trim(),Be=n.getFieldValue("items")||[];n.setFieldsValue({items:dd(Be,F)})}}else if(Object.prototype.hasOwnProperty.call(X,"globalBgColor")){const F=$.current,Be=String(X.globalBgColor??"").trim(),V=n.getFieldValue("items")||[];n.setFieldsValue({items:cd(V,F,Be)})}else if(X?.items!=null){const F=n.getFieldValue("items")||[],Be=Ll(F);Be!==(n.getFieldValue("globalItemBorderColor")||"").trim()&&(v.current=!0,n.setFieldValue("globalItemBorderColor",Be),queueMicrotask(()=>{v.current=!1}));const V=g.settings?.items||[];F.forEach((fe,Ne)=>{const Pe=fe?.platform,Ge=V[Ne]?.platform;Pe&&Pe!==Ge&&ue(Ne,Pe)})}ud(X?.items,ue),ye()},[g.settings?.items,n,ye,ue]),Ee=(0,a.useCallback)((X,F)=>{if(n.setFieldValue(X,F),Array.isArray(X)&&X[0]==="items"){Se({items:{[X[1]]:{[X[2]]:F}}});return}Se({[X]:F})},[n,Se]),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:(X,{remove:F,move:Be})=>(x.current=Be,R.current=F,(0,o.jsx)("div",{className:"selected-social-form__items",children:X.map((V,fe)=>{const Ne=!!(P[fe]?.customIcon??P[V.name]?.customIcon);return(0,o.jsxs)("div",{className:(0,ze.default)("selected-social-form__card",_===fe&&"selected-social-form__card--dragging",p===fe&&_!==fe&&"selected-social-form__card--drag-over"),"data-item-index":fe,"data-list-length":X.length,onDragEnterCapture:G,onDragOverCapture:U,onDragLeave:Y,onDropCapture:q,children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head",children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head-main",children:[X.length>1?(0,o.jsx)("span",{className:"selected-social-form__drag-handle",draggable:!0,"data-item-index":fe,onDragStart:Z,onDragEnd:ie,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")," ",fe+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":V.name,onClick:se})})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[V.name,"iconSrc"],hidden:!0,children:(0,o.jsx)(t.ui_kit$Input,{})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[V.name,"customIcon"],valuePropName:"checked",hidden:!0,children:(0,o.jsx)(t.ui_kit$Checkbox,{})}),(0,o.jsxs)("div",{className:"selected-social-form__platform-row",children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:[V.name,"platform"],className:"selected-social-form__platform-field selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:oe,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":fe,icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,size:18,strokeWidth:l.iconStrokeWidth}),"aria-label":i("Edit icon"),onClick:Me})})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[V.name,"href"],className:"selected-social-form__card-field",rules:[{required:!0,whitespace:!0,message:i("Please enter the URL.")},{validator:async(Pe,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,{})}})}),Ne?null:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__card-field selected-social-form__bg-color-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",getPopupContainer:Oo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:[V.name,"buttonBgColor"],className:"selected-social-form__card-field",children:(0,o.jsx)(zt,{form:n,name:["items",V.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:[V.name,"itemBorderColor"],className:"selected-social-form__card-field",children:(0,o.jsx)(zt,{form:n,name:["items",V.name,"itemBorderColor"],placeholder:i("Border color"),usedColors:L,onColorChange:Ee})})})})]}),(0,o.jsx)(Ol,{__:i,form:n,fieldName:V.name,pushSettingsToIframe:ye,onMetaActiveChange:ne})]},V.key)})}))}),(0,o.jsx)(t.ui_kit$Button,{type:"text",block:!0,className:"selected-social-form__add-bar",icon:(0,o.jsx)(r.EmIcons,{icon:"PlusSquareOutlined",component:t.icons$PlusSquareOutlined}),onClick: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:Se,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 vd(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 Id(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)(()=>{_(v=>xd(v,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 v=H=>{H&&(H.fields&&i.setFieldsValue(H.fields),H.mobileBorders&&c(H.mobileBorders),H.backgroundImageEmpty!==void 0&&m?.(H.backgroundImageEmpty),H.uniformRadius&&(H.uniformRadius==="mobile"?R:k)(!0),H.settings&&s(H.settings))},$=H=>{const I=i.getFieldsValue(!0),L=wd[H],P={fields:I,settings:l,prefix:j};b[H]?v(L?.off?.(P)):Yl(H,I,d,n)||v(L?.on?.(P)),_(z=>({...z,[H]:!z[H]}))};return Object.fromEntries(jd.map(H=>[H,()=>$(H)]))},[i,l,s,n,d,c,m,b,j]);return{open:b,toggle:N,paddingsExt:h,togglePaddingMode:()=>{const v=vd(i.getFieldsValue(!0),j,h);i.setFieldsValue(v.fields??{}),v.settings&&s(v.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(D.BORDER_RADIUS_POSITION),(e,i)=>({settings:{borderRadius:{[D.BORDER_RADIUS_POSITION[e]]:+i}}})),...Vo(Object.keys(D.MOBILE_BORDER_RADIUS_POSITION),(e,i)=>{const l=D.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=D.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:v}=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:v,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)(D.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(),v=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:v.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:v.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)(D.SelectedElementFormBorder,{form:e})}),v.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})}),v.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,{})}),v.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:v,handleToggleMobileSize:$,handleToggleMobileBackground:H,handleToggleMobileBorder:I,handleToggleMobileBorderRadius:L,handleToggleMobileBoxShadow:P,backgroundRepeatOptions:z,backgroundSizeOptions:le,backgroundImageEmpty:C,oneBorderRadiusValue:oe,setOneBorderRadiusValue:ne,oneMobileBorderRadiusValue:ge,setOneMobileBorderRadiusValue:ye,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:H,handleToggleMobileBorder:I,handleToggleMobileBorderRadius:L,handleToggleMobileBoxShadow:P,oneMobileBorderRadiusValue:ge,setOneMobileBorderRadiusValue:ye,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:v,backgroundRepeatOptions:z,backgroundSizeOptions:le,backgroundImageEmpty:C,oneBorderRadiusValue:oe,setOneBorderRadiusValue:ne})})}),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=Id({form:n,settings:e,send:p,isTableCells:h,mobileBorders:B,setMobileBorders:k,setBackgroundImageEmpty:R}),v=(0,a.useCallback)(we=>Wo(we,N),[]),$=zd({form:n,settings:e,send:p,mobileBorders:B,setMobileBorders:k,setBackgroundImageEmpty:R,onLinkHref:v}),H=(0,a.useMemo)(()=>({table:Bd(e),cell:Sd(e)}),[e]),I=(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,oe]=(0,a.useState)(null);(0,a.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&oe(!0)},[]);const ne=we=>{s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:we,locale:"en_US"})},ge=[{key:"1",label:l("This element"),onClick:()=>ne("typograf")},{key:"2",label:l("The whole email"),onClick:()=>ne("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 ye=we=>{n.setFieldValue("linkHref",we!=="mergetag"?we:""),N(we)},{open:te,toggle:pe}=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:H.cell,appConfig:c,token:d,isMacOS:C,__:l,handleToggleShowPaddingCell:pe.cellPadding,handleTogglePaddingCell:E.togglePaddingMode,handleToggleBackground:pe.background,handleToggleBorder:pe.border,handleToggleBorderRadius:pe.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:ne,typografItems:ge,textInputRef:I,linkProtocol:j,handleLinkProtocolsChange:ye})}):(0,o.jsx)(oc,{form:n,elementSettings:H.table,handleToggleShowPadding:pe.padding,handleTogglePadding:E.togglePaddingMode,handleToggleBackground:pe.background,handleToggleBorder:pe.border,handleToggleBorderRadius:pe.borderRadius,handleToggleBoxShadow:pe.boxShadow,handleToggleMobileSize:pe.mobileSize,handleToggleMobileBackground:pe.mobileBackground,handleToggleMobileBorder:pe.mobileBorder,handleToggleMobileBorderRadius:pe.mobileBorderRadius,handleToggleMobileBoxShadow:pe.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 H=$.data.operation,I=$.data.action;if(H===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(oe=>({...oe,...C}))};var L=P;I==="toggle_strong"&&P("textStrong"),I==="toggle_italic"&&P("textItalic"),I==="toggle_underline"&&P("textUnderline"),I==="toggle_strikethrough"&&P("textStrikethrough"),I==="textAlign_left"&&P("textAlign","left"),I==="textAlign_right"&&P("textAlign","right"),I==="textAlign_center"&&P("textAlign","center")}};r.useListenPostMessage(E);const v=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:v,formName:s},v.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)(vl,{elementSettings:i}),i.type===r.ELEMENT_TYPES.ACCORDION&&(0,o.jsx)(Il,{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,v]=(0,a.useState)(0),[$,H]=(0,a.useState)([]),I=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 ee=function(Q,K){if(Q.length!==K.length)return!1;for(let Z=0;Z<Q.length;Z++)if(Q[Z]!==K[Z])return!1;return!0};var ve=ee;const re=p.floatBlocks.items.reduce((Q,K)=>Q+K.width,0),ie=p.floatBlocks.items.map(Q=>((Q.width||0)/re*100).toFixed(1));v(re),!ee(ie,$)&&p.changeKey!=="gap"&&H(ie),p.floatBlocks.items.forEach((Q,K)=>c.setFieldsValue({["width-"+K]:Q.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,re)=>{Object.keys(re).forEach(ie=>{if(ie.includes("width")){const ee=parseInt(ie.match(/\d+/));c.setFieldsValue({[ie]:ve.items[ee]})}})},[le,C]=(0,a.useState)(!1);(0,a.useEffect)(()=>{const ve=()=>C(!0),re=()=>C(!1);return document.addEventListener("keyup",re),document.addEventListener("keydown",ve),()=>{document.removeEventListener("keyup",re),document.removeEventListener("keydown",ve)}},[]);const oe=ve=>{g.current&&le&&clearTimeout(g.current),g.current=setTimeout(()=>re(ve),50);function re(ie){const ee=c.getFieldsValue(!0),Q=Object.keys(ie)[0];if(N(Q),Q.includes("width")){if(ee[Q]&&ee[Q]>=30){let K={items:[],gap:ee.gap,valign:ee.valign,activateSection:i?void 0:"structure"},Z=0;if(document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").length>1){Z=parseFloat(Object.keys(ie)[0].substring(Object.keys(ie)[0].length-1));const G=ee["width-"+(Z+1)]?Z+1:0;let U=E;Object.keys(ee).forEach(Y=>{Y.includes("width")&&Y.indexOf("width-"+G)===-1&&(U-=ee[Y])}),ee["width-"+G]=U}Object.keys(ee).forEach(G=>{G.includes("width")&&K.items.push(ee[G])}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:K}),L({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...K,items:p.floatBlocks.items.map((G,U)=>({...p.floatBlocks.items[U],width:K.items[U]}))},changeKey:Q})}}else if(Q==="gap"){const K={items:p.floatBlocks.items.map(Y=>Y.width),gap:p.floatBlocks.gap},Z=K.items.reduce((Y,q)=>Y+q,0)+(K.items.length-1)*K.gap,G=ee.gap,U=Z-(K.items.length-1)*G;if(U>K.items.length*30||p.floatBlocks.gap-ie>=0){const Y=(Se,Ee)=>Math.round(Ee*Se/100);let q=K.items.map((Se,Ee)=>Y($[Ee],U));const se=Z-(q.reduce((Se,Ee)=>Se+Ee,0)+(K.items.length-1)*G);if(se!==0){const Se=q.length-Math.abs(se);q=q.map((Ee,Oe)=>Se<=Oe?Ee+(se>0?1:-1):Ee)}let ue={items:q,gap:G||0};z(ue,ee),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGap",settings:ue,editFromStructure:Xo()}),L({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...ue,items:p.floatBlocks.items.map((Se,Ee)=>({...Se,width:ue.items[Ee]}))},changeKey:Q})}}else if(Q==="valign"){let K={valign:ee.valign};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksValign",settings:K,editFromStructure:Xo()}),L({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...K},changeKey:Q})}else if(Q==="gapMobile"){let K={mobileHeight:{classNamePrefix:"em-mob-height-",value:ie[Q],dim:"px"}};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGapMobile",settings:K}),L({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,gapMobile:K.mobileHeight.value},changeKey:Q})}setTimeout(()=>m?.current&&m.current.focus({cursor:"end"}),600)}},ne=()=>{const ve=c.getFieldsValue(!0),re=p.floatBlocks.items.map(U=>U.width);let ie={items:[],gap:ve.gap};const ee=re.reduce((U,Y)=>U+Y,0),Q=re.length,K=Math.ceil(E/Q)*Q,Z=K/Q,G=ee-K;if(ie.items=Array(Q).fill(Z),G!==0){const U=re.length-Math.abs(G);ie.items=ie.items.map((Y,q)=>U<=q?Y+(G>0?1:-1):Y)}z(ie,ve),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:ie,editFromStructure:Xo()}),L({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...ie,items:p.floatBlocks.items.map((U,Y)=>({...U,width:ie.items[Y]}))},changeKey:"width"})},ge=ve=>{const re=c.getFieldsValue(!0),ie=p.floatBlocks.items.map(ue=>ue.width),ee=p.floatBlocks.gap||20,Q=ve.cols-ie.length;let K=[],Z=ie.reduce((ue,Se)=>ue+Se,0);ve.cols>=ie.length?Z-=ee*Q:Z+=ee*Math.abs(Q);const G=Math.round(Z/ve.cols);function U(ue,Se){const Ee=[];for(let Oe=0;Oe<ue;Oe++)Ee.push(ve.width?.[Oe]?Math.round(Z/100*ve.width?.[Oe]):Se);return Ee}K=U(ve.cols,G);const Y=Z-K.reduce((ue,Se)=>ue+Se,0);if(Y!==0){let ue=K.map((Ee,Oe)=>[Oe,Ee]).filter(Ee=>Ee[1]>30);const Se=ue.length-Math.abs(Y);ue=ue.map((Ee,Oe)=>{const X=Se<=Oe?Ee[1]+(Y>0?1:-1):Ee[1];return[Ee[0],X]}),ue.map(Ee=>(K[Ee[0]]=Ee[1],Ee))}let q={items:K,gap:re.gap||20};const se=K.reduce((ue,Se)=>ue+Se,0);H(K.map(ue=>(ue/se*100).toFixed(1))),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksPreset",settings:q,editFromStructure:Xo()}),L({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,...q,items:q.items.map((ue,Se)=>({width:ue,current:!1}))},changeKey:"width"})},ye=()=>{const ve=c.getFieldsValue(!0);if(P<8){const re=p.floatBlocks.items.map(U=>U.width),ie=p.floatBlocks.gap,ee=re.reduce((U,Y)=>U+(Y>30?Y:0),0),Q=(ee-30-ie)/ee,K=re.map(U=>U>30?Math.round(U*Q):U).reduce((U,Y)=>U+(Y>30?Y:0),0);let Z=re.map(U=>U>30?Math.round(U*Q):U);Z.push(30);const G=ee-K-30-ie;if(G!==0){let U=Z.map((q,se)=>[se,q]).filter(q=>q[1]>30);const Y=U.length-Math.abs(G);U=U.map((q,se)=>{const ue=Y<=se?q[1]+(G>0?1:-1):q[1];return[q[0],ue]}),U.map(q=>(Z[q[0]]=q[1],q))}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:Z.map((U,Y)=>({width:U,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 re=c.getFieldsValue(!0);let ie=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((ue,Se)=>{ue===ve.target.closest(".selected-element-panel__columns-settings__controls__column")&&(ie=Se)});const ee=+p.floatBlocks.gap,Q=+p.floatBlocks.items[ie].width+ee,K=p.floatBlocks.items.map(ue=>+ue.width),Z=(K.length-1)*ee,G=K.reduce((ue,Se)=>ue+Se,0)+Z,U=K.length-1,Y=Math.floor(Q/U);let q=K.filter((ue,Se)=>Se!==ie).map(ue=>ue+Y);const se=G-(q.reduce((ue,Se)=>ue+Se,0)+(K.length-2)*ee);if(se!==0){const ue=q.length-Math.abs(se);q=q.map((Se,Ee)=>ue<=Ee?Se+(se>0?1:-1):Se)}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_REMOVE,settings:{removedBlockIndex:ie,gap:re.gap},editFromStructure:Xo()}),L({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,items:q.map((ue,Se)=>({width:ue,current:p.floatBlocks.items.filter((Ee,Oe)=>Oe!==ie)[Se].current}))},changeKey:"width"})},pe=ve=>{if(P>=8)return;const re=c.getFieldsValue(!0);let ie=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((Ee,Oe)=>{Ee===ve.target.closest(".selected-element-panel__columns-settings__controls__column")&&(ie=Oe)});const ee=parseFloat(re.gap)||0,Q=p.floatBlocks.items.map(Ee=>+Ee.width),K=Q[ie],Z=Q.reduce((Ee,Oe)=>Ee+Oe,0),G=Z-ee,U=Z+K,Y=U>0?G/U:1;let q=[];const se=[];Q.forEach((Ee,Oe)=>{q.push(Math.max(30,Math.round(Ee*Y))),se.push(p.floatBlocks.items[Oe]?.current||!1),Oe===ie&&(q.push(Math.max(30,Math.round(K*Y))),se.push(!1))});const ue=G-q.reduce((Ee,Oe)=>Ee+Oe,0);if(ue!==0){let Ee=q.map((X,F)=>[F,X]).filter(X=>X[1]>30);const Oe=Ee.length-Math.abs(ue);Ee=Ee.map((X,F)=>[X[0],Oe<=F?X[1]+(ue>0?1:-1):X[1]]),Ee.forEach(X=>q[X[0]]=X[1])}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_COPY,settings:{copiedBlockIndex:ie,gap:re.gap,widths:q},editFromStructure:Xo()});const Se=q.reduce((Ee,Oe)=>Ee+Oe,0);H(q.map(Ee=>(Ee/Se*100).toFixed(1))),L({...p,activateSection:i?void 0:"structure",floatBlocks:{...p.floatBlocks,items:q.map((Ee,Oe)=>({width:Ee,current:se[Oe]||!1}))},changeKey:"width"})},we=(0,a.useCallback)(ve=>{const re=".selected-element-panel__columns-settings__controls__column",ie=Array.from(document.querySelectorAll(re)).indexOf(ve.target.closest(re)),ee=ie-1;if(ee<0)return;const Q=p.floatBlocks,K=Q.items.map(({width:Z,current:G})=>({width:Z,current:G||!1}));[K[ee],K[ie]]=[K[ie],K[ee]],d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_SWAP,settings:{indexA:ee,indexB:ie},editFromStructure:Xo()}),L({...p,activateSection:i?void 0:"structure",floatBlocks:{...Q,items:K},changeKey:"width"})},[p,L,i,d]),me=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"})},Me=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:re},ie)=>(ve[`width-${ie}`]=re,ve),{})},onValuesChange:oe,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"}),I!=="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:ye,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:ne,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,re)=>(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__controls__column "+(ve.current?"current":""),style:{width:ve.width/E*100+"%"},children:[re>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:we,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:pe,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-"+re,children:(0,o.jsx)(t.ui_kit$InputNumber,{min:30,value:ve.width||0,placeholder:s("Width"),ref:j==="width-"+re&&m})})})]},"floatblock-"+re))})}),(0,o.jsxs)("div",{className:"columns-presets",children:[(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{ge({cols:1})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol1",component:t.icons$LayoutCol1})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{ge({cols:2})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol2",component:t.icons$LayoutCol2})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{ge({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:()=>{ge({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:()=>{ge({cols:3})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol3",component:t.icons$LayoutCol3})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{ge({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:[I==="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:me,labelStyle:{position:"relative",top:2}})}),I!=="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:Me,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:[I!=="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})})})}),I==="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)(ne=>{j.activate(ne),d(r.setPropertiesPanelKey(ne||""))},[j,d]),E=!!p.type&&!!p.floatBlocks?.items.length>0&&!!p.floatBlocks?.items.filter(ne=>!!ne.width).length>0,v=(0,a.useRef)(null),$=(0,a.useRef)(_);$.current=_,(0,a.useEffect)(()=>{const ne=Object.values(r.ELEMENT_TYPES),ge=p.type&&ne.includes(p.type)?`${p.type}-${JSON.stringify(p.path||[])}`:null;if(B||k){const ye=n.querySelector(".email-pane .panel-form__body");ye&&(ye.scrollTop=0),d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else if(p.type&&ne.includes(p.type)){const ye=v.current!==ge;if(v.current=ge,p.activateSection!=="structure"){if(ye){const te=n.querySelector(".email-pane .panel-form__body");te&&(te.scrollTop=0)}r.keepsInspectorTab(String($.current??""),ye)||d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else d(r.setPropertiesPanelKey(r.STRUCTURE))}else JSON.stringify(p)!=="{}"&&(v.current=null,d(r.setPropertiesPanelKey("")))},[p,d,n,B,k]);const H=(0,a.useMemo)(()=>{const ne=[{key:r.EDIT_SELECTED_ELEMENT,label:(0,o.jsx)("span",{style:{textTransform:"capitalize"},children:p.caption?p.caption:s("Edit element")})}];return E&&ne.push({key:r.STRUCTURE,label:s("Columns")}),ne},[p.caption,E,s]),I=(0,a.useMemo)(()=>[...H,...j.tabs.map(({key:ne,label:ge})=>({key:ne,label:ge}))],[H,j.tabs]),L=(0,a.useMemo)(()=>[{key:r.EDIT_SELECTED_ELEMENT,label:s("Cell")},{key:r.TABLE_PROPERTIES,label:s("Table")}],[s]),P=ne=>{ne.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_REMOVE}),d(m==="email"?r.setElementSettings$1({}):r.setElementSettings({}))},z=ne=>{ne.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})})})]}),oe=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:oe?C:void 0,children:(0,o.jsx)(t.ui_kit$Tabs,{items:R?L:I,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(ne=>(0,o.jsx)("div",{className:ne.className,hidden:_!==ne.key,children:ne.children},ne.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(v=>v.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)((I,L)=>{x({kind:"group",id:Number(I)}).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)(I=>{const L=I.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(I.id),L)})},[h,N,c,m]),v=(0,a.useCallback)(I=>{g(r.openModal$1(r.MODALS.EDIT_GROUP_NAME_MODAL)),j({id:I.id,name:I.name??""})},[g]),$=(0,a.useMemo)(()=>({marginBottom:p.formItemMarginBottomMD}),[p]),H=(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((I,L)=>(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:`group_${I.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:I.name}),!l&&(0,o.jsx)(nc,{level:I,onRename:v,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:I.children?.map(P=>({label:P.name,value:String(P.id)})),tagRender:P=>{const{label:z,closable:le,onClose:C}=P,oe=ne=>{ne.preventDefault(),ne.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:p.colorPrimary,onMouseDown:oe,closable:le,onClose:C,style:{borderRadius:6},children:z})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})},I.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:H,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:v,isFetching:$,isUninitialized:H,isSuccess:I}=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)(()=>{!H&&E()},[H,E]),(0,a.useEffect)(()=>{if(!x||!i.is_template)return;const re=new Set(i.projectCategories??[]),ie={};let ee=!1;for(const Q of R??[]){const K=`group_${Q.id}`,Z=(Q.children??[]).filter(U=>re.has(String(U.id))).map(U=>String(U.id)),G=d.getFieldValue(K);(!G||G.length!==Z.length||Z.some((U,Y)=>G[Y]!==U))&&(ee=!0),ie[K]=Z}ee&&d.setFieldsValue(ie)},[d,x,i.is_template,i.projectCategories,R]);const[P,z]=(0,a.useState)([]),[le,C]=(0,a.useState)([]),oe=!!i.is_template,ne=r.useProjectData();(0,a.useEffect)(()=>{!H&&E()},[i.group,E,H]),(0,a.useEffect)(()=>{if(I&&i.is_template&&bc(i.group)){const re=i.group;let ie={};re.length&&_.length&&re?.forEach(Q=>{_?.forEach(K=>{let Z=K.children.find(G=>G.id===Q);Z&&(ie.hasOwnProperty(K.id)||(ie[K.id]=[]),ie[K.id].push({label:Z.name,value:Z.id}))})});let ee={};for(let Q in ie)ie.hasOwnProperty(+Q)&&(ee[`group_${Q}`]=ie[Q].map(K=>({...K,value:String(K.value)})));d.setFieldsValue(ee)}},[d,_,i.is_template,i.group,I]);const{data:ge,isFetching:ye,refetch:te}=r.useGetTermsQuery({project:ne,kind:k},{skip:!ne?.id});(0,a.useEffect)(()=>{C(hc(ge)?.map(re=>({value:re.name,key:re.id})))},[ge]),(0,a.useEffect)(()=>{if(i){const re=r.getTaxonomy(i,k)??[],ie=ge??[],ee=re.map(Z=>Z.name??""),Q=i.emailtags||i.blocktags||[],K=re.concat(ie).filter(Z=>Q.some(G=>r.sameTermId(Z.id,G))).map(Z=>Z.name??"");d.setFieldsValue({title:i.title,description:i.description,tags:Array.isArray(i.tags)?i.tags:K.length?Array.from(new Set(K)):ee,type:i.type,is_template:!!i.is_template})}},[d,i,k,ge]);const pe=(0,a.useMemo)(()=>{if(!(B==="email"?x:r.isBlocksV2Enabled())||!i)return[];const re=r.getTaxonomy(i,k)??[],ie=ge??[],ee=[...re,...ie];return((B==="email"?i.emailtags:i.blocktags)??[]).filter(Q=>!ee.some(K=>K.name&&r.sameTermId(K.id,Q)))},[x,B,i,k,ge]),[we,me]=(0,a.useState)(void 0),Me=!Array.isArray(i?.tags);(0,a.useEffect)(()=>{Me&&pe.length&&ne?.id&&!ye&&we!==i?.id&&(me(i?.id),te())},[Me,pe.length,ne?.id,ye,we,i?.id,te]);const Le=Me&&pe.length>0&&(ge===void 0||ye||we!==i?.id),ve=re=>{if(b())return;const ie=Object.keys(re)[0],ee=re,Q=ie.split("_")[0];if(Q===Vi)n({title:ee[ie]});else if(Q===ti)n({description:ee[ie]});else if(Q===ii){const K=ee[ie],Z=B==="email"&&(K?.length??0)===0;n({tags:(K??[]).map(G=>G.trim()),...Z?{emailtags:[]}:{}})}else Q==="is"?n({is_template:ee[ie]}):Q===Hi&&B==="block"&&n({type:ee[ie]});switch(ie.split("_")[0]){case ms:if(x){const K=new Set((R??[]).flatMap(Y=>(Y.children??[]).map(q=>String(q.id)))),Z=d.getFieldsValue(!0),G=Object.keys(Z).filter(Y=>Y.startsWith(`${ms}_`)).flatMap(Y=>Z[Y]??[]).map(String).filter(Y=>K.has(Y)),U=(i.projectCategories??[]).map(String).filter(Y=>!K.has(Y));n({projectCategories:[...new Set([...U,...G])]});break}s(r.setEmailGroups({[ie.split("_")[1]]:re[ie]}));break;default:return}};return(0,a.useEffect)(()=>{if(h){const re=h;let ie=[];const ee={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 re)ie.push({label:ee[re[Q]],value:re[Q]});z(ie)}},[h,l]),(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:ve,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:Le||g,loading:Le,tagRender:re=>{const{label:ie,closable:ee,onClose:Q}=re,K=Z=>{Z.preventDefault(),Z.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:c.colorPrimary,onMouseDown:K,closable:ee,onClose:Q,style:{borderRadius:6},children:ie})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})}),m.isTemplateEnabled&&(B==="email"||!1)&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:16}}),(0,o.jsx)(t.ui_kit$Tooltip,{title:B==="block"?l("Template blocks are shown in the common blocks of the project."):i.isNew?l("Save email first."):l("Use this email as a template for creating future emails."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"is_template",valuePropName:"checked",initialValue:oe,children:(0,o.jsx)(t.ui_kit$Switch,{id:"setIsTemplate",label:l("Is a template"),size:"small",disabled:B==="email"&&!!i.isNew||g,labelStyle:{position:"relative",top:2,fontSize:14,color:c.colorText}})})},"isTemplate")]}),B==="email"&&oe&&(0,o.jsx)(dc,{element:i,levels:L,readOnlyLevels:x,levelsRead:R!==void 0,refetchProjectGroups:E,isLoading:x?j:v||$}),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 vc(e,i){return jc(wc(e),i)}var Ic=({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=vc(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 oe=l?.current?.closest(".email-pane__col_settings-inner")||Lc(".email-pane__col_settings-inner");if(oe){B(oe),h({type:"popover"});return}}if(!l?.current)return;let z=l.current.getBoundingClientRect();if(z.width===0&&z.height===0){const oe=l.current.closest(".email-pane__col");oe&&(z=oe.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 v=window.requestAnimationFrame(E),$=[window],H=l?.current?.closest(".email-pane__collapse-wrapper"),I=l?.current?.closest(".email-pane__col");H&&$.push(H),I&&$.push(I),$.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(v),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)(Ic,{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 v=typeof E=="string"?E.trim():"";if(v&&!/^https?:\/\//i.test(v))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),v=t.ui_kit$Form.useWatch("availabilityEnds",b),$=t.ui_kit$Form.useWatch("offerPageUrl",b),H=t.ui_kit$Form.useWatch("merchantHomepageUrl",b),I=t.ui_kit$Form.useWatch("cards",b),L=JSON.stringify(I??[]),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,oe=z===Qe.GMAIL_ANNOTATION_TYPES.DEAL_CARD,ne=z===Qe.GMAIL_ANNOTATION_TYPES.DEAL_ANNOTATION,ge=z===Qe.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW,ye=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]),pe=(0,a.useMemo)(()=>{let Q="";m&&(Q=m.getContent()),!Q&&l?.html&&(Q=l.html);const K=Q.match(/<title[^>]*>([\s\S]*?)<\/title>/i),Z=K?K[1].trim():l?.title||l?.subject||"";return Qe.formatPreviewSubjectLine(Z)},[m,l?.html,l?.title,l?.subject]),we=(0,a.useMemo)(()=>Qe.buildAnnotationsData({annotationType:z,annotationLogo:R,description:j,discountCode:N,availabilityStarts:E,availabilityEnds:v,offerPageUrl:$,merchantHomepageUrl:H,cards:P}),[z,R,j,N,E,v,$,H,P]),me=(0,a.useMemo)(()=>le?Qe.getDiscountPercentBlockers(P,s):[],[le,P,s]),Me=(0,a.useMemo)(()=>Qe.canApplyGmailAnnotations(we)&&me.length===0,[we,me]),Le=(0,a.useMemo)(()=>[...Qe.getAnnotationsApplyBlockers(we,s),...me],[we,me,s]),ve=(0,a.useMemo)(()=>s("Learn more about %s").split("%s"),[s]),re=(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 Q=b.getFieldValue("cards")??[];if(z===Qe.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW){if(Q.length>1){b.setFieldsValue({cards:[Q[0]]});return}Q.length===0&&b.setFieldsValue({cards:[Qe.createEmptyAnnotationCard()]});return}Q.length===0&&b.setFieldsValue({cards:[Qe.createEmptyAnnotationCard()]})},[b,le,z,P]);const ie=(0,a.useCallback)(Q=>{if(!Q||!h.current||!m||c())return!1;const K=Qe.applyAnnotationsEditToDocument(m,Qe.buildAnnotationsData(Q));if(K){const Z=Qe.readGmailAnnotationsScript(m.getContent());p.current={emailId:l?.id,markup:Z},k(Z!==null)}return K},[m,c,l?.id]),ee=(0,a.useCallback)(()=>{ie(b.getFieldsValue(!0))&&g.success(s("Gmail annotation was successfully applied to the template code."))},[ie,b,g,s]);return(0,a.useEffect)(()=>{if(!i)return;const Q=Qe.normalizeEditorHtml(m?.getContent()||l?.html||""),K={emailId:l?.id,markup:Q?Qe.readGmailAnnotationsScript(Q):null};if(k(K.markup!==null),!Qe.shouldReloadAnnotationsForm(p.current,K))return;p.current=K,h.current=!1;const Z=Q?Qe.parseGmailAnnotations(Q):null;b.setFieldsValue(Z?Qe.mapParsedAnnotationsToFormValues(Z):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:we,subjectLine:pe,parentRef:_,overlayTargetSelector:"#pane-content-iframe",onApply:ee,applyDisabled:!Me||d,applyBlockers:Le,onRemove:B&&!d?re: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})})}),!oe&&(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})})}),(ge||ne)&&(0,o.jsx)(ws,{iconStrokeWidth:n.iconStrokeWidth}),ge&&(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})})}),oe&&(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":!ge,"annotations-panel__cards-section":ge}),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:(Q,{add:K,remove:Z})=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"selected-social-form__items",children:Q.map((G,U)=>(0,o.jsx)(Xc,{field:G,index:U,form:b,isSingleImagePreview:ge,onRemove:Z},G.key))}),!ge&&P.length<ye&&(0,o.jsx)(Yc,{onAdd:K})]})})]}),(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)(I=>{m.activate(I),d(I||"")},[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 I=_();I&&d(I)}},[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,v=E&&m.openedKnown&&m.openedKeys.length===0,$=(0,a.useRef)(!1);(0,a.useEffect)(()=>{E||($.current=!1)},[E]),(0,a.useEffect)(()=>{v&&N&&!$.current&&($.current=!0,m.activate(N))},[v,N,m]);const H=(0,a.useMemo)(()=>{const I=[];return B&&I.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&&I.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&&I.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})}),I.push(...m.tabs()),I},[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:H})})};Yi.propTypes={};var js=320,Jc=1200,Qc=350,{backgroundColor:vs,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={[vs]:"",[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 Is=({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]),v=(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),v(z),x.current=setTimeout(()=>{E(z)},Qc)},[E,v]),H=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 oe=Zi(le.width);c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{responsive:{shutdown:z[C],styles:z[C]},...oe?{width:oe}:{}}});break}default:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:z})}},I=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);v(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:H,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:I})})})}),(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:vs,style:{marginBottom:l.formItemMarginBottomXS},rules:[{message:i("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:g.usedColors,disabled: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})})})})]})]})]})})]})})]})})};Is.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=D.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),[v,$]=(0,a.useState)(!1),[H,I]=(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,oe]=(0,a.useState)(P.headings.italic),[ne,ge]=(0,a.useState)(P.links.underline),[ye,te]=(0,a.useState)(P.buttons.bold),[pe,we]=(0,a.useState)(P.buttons.italic),[me,Me]=(0,a.useState)(null),Le=r.useSelector(r.selectIsPanelHistoryCollapsed);(0,a.useEffect)(()=>{Le||Me(null)},[P,Me,Le]),(0,a.useEffect)(()=>{Le&&!me&&Me($s(P))},[P,me,Le]),(0,a.useEffect)(()=>{m&&(s(r.setIsNeedUpdateContentAppearance(!1)),d.setFieldsValue($s(P)))},[d,m,s,P]);const[ve,re]=(0,a.useState)(Math.min(P.headings.fontSize-1,19)),[ie,ee]=(0,a.useState)(Math.max(P.text.fontSize+1,20));(0,a.useEffect)(()=>{if(me){const G=me.buttonsBorder;B(G);const U=Object.keys(G).find(se=>G[se]?.width||G[se]?.style||G[se]?.color),Y=me.cardsBorder;x(Y);const q=Object.keys(Y).find(se=>Y[se]?.width||Y[se]?.style||Y[se]?.color);d.setFieldsValue({buttons_borderPosition:U||"all",buttons_borderWidth:G[U]?.width!==null?G[U]?.width:"",buttons_borderColor:G[U]?.color||"",buttons_borderStyle:G[U]?.style||"",cards_borderPosition:q||"all",cards_borderWidth:Y[q]?.width!==null?Y[q]?.width:"",cards_borderColor:Y[q]?.color||"",cards_borderStyle:Y[q]?.style||"",buttons_borderRadiusAll:u(me.buttonsBorderRadius.all),buttons_borderRadiusTopLeft:u(me.buttonsBorderRadius.topLeft),buttons_borderRadiusBottomLeft:u(me.buttonsBorderRadius.bottomLeft),buttons_borderRadiusTopRight:u(me.buttonsBorderRadius.topRight),buttons_borderRadiusBottomRight:u(me.buttonsBorderRadius.bottomRight),cards_borderRadiusAll:u(me.cardsBorderRadius.all),cards_borderRadiusTopLeft:u(me.cardsBorderRadius.topLeft),cards_borderRadiusBottomLeft:u(me.cardsBorderRadius.bottomLeft),cards_borderRadiusTopRight:u(me.cardsBorderRadius.topRight),cards_borderRadiusBottomRight:u(me.cardsBorderRadius.bottomRight),blockPaddingAll:u(me.blockPaddingAll),blockPaddingTop:u(me.blockPaddingTop),blockPaddingRight:u(me.blockPaddingRight),blockPaddingBottom:u(me.blockPaddingBottom),blockPaddingLeft:u(me.blockPaddingLeft),blockPaddingLeftRight:u(me.blockPaddingRight)||u(me.blockPaddingLeft),blockPaddingTopBottom:u(me.blockPaddingTop)||u(me.blockPaddingBottom)}),!u(me.blockPaddingAll)&&(u(me.blockPaddingTop)||u(me.blockPaddingRight)||u(me.blockPaddingBottom)||u(me.blockPaddingLeft))&&(me.blockPaddingTop!==me.blockPaddingBottom||me.blockPaddingRight!==me.blockPaddingLeft)?I(!1):I(!0),!u(me.buttonsBorderRadius.all)&&(u(me.buttonsBorderRadius.topLeft)||u(me.buttonsBorderRadius.bottomLeft)||u(me.buttonsBorderRadius.topRight)||u(me.buttonsBorderRadius.bottomRight))?j(!1):j(!0),me.buttonsPadding&&!u(me.buttonsPadding.all)&&(u(me.buttonsPadding.bottom)||u(me.buttonsPadding.right)||u(me.buttonsPadding.left)||u(me.buttonsPadding.top))&&$(!1),!u(me.cardsBorderRadius?.all)&&(u(me.cardsBorderRadius?.topLeft)||u(me.cardsBorderRadius?.bottomLeft)||u(me.cardsBorderRadius?.topRight)||u(me.cardsBorderRadius?.bottomRight))?E(!1):E(!0)}},[d,me]);const Q=()=>{I(U=>!U);const G=d.getFieldsValue(!0);if(!H){G.blockPaddingLeftRight=G.blockPaddingLeft,G.blockPaddingTopBottom=G.blockPaddingTop,G.blockPaddingRight=G.blockPaddingLeft,G.blockPaddingBottom=G.blockPaddingTop;const U=Number(G.blockPaddingTopBottom),Y=Number(G.blockPaddingLeftRight);n({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{blockPadding:{top:Number.isFinite(U)?U:0,bottom:Number.isFinite(U)?U:0,left:Number.isFinite(Y)?Y:0,right:Number.isFinite(Y)?Y:0}}})}},K=G=>{const U=G.target.closest("button");if(!U)return;const Y=U.name,q=U.classList.contains("selected-td-form__button--active");U.className=q?"ant-btn ant-btn-default":"ant-btn ant-btn-default selected-td-form__button--active";try{U.blur()}catch{}Y==="headingBold"?le(!q):Y==="headingItalic"?oe(!q):Y==="linkUnderline"?ge(!q):Y==="buttonsBold"?te(!q):Y==="buttonsItalic"&&we(!q),n({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[Y]:!q}})},Z=G=>{const U=d.getFieldsValue(!0),Y=Object.keys(G)[0];let q={};switch(Y){case"headingFontSize":re(Math.min(U.headingFontSize-1,19)),q=G;break;case"textFontSize":ee(Math.max(U.textFontSize+1,20)),q=G;break;case"buttons_borderStyle":q={buttonsBorder:{[U.buttons_borderPosition]:{...p[U.buttons_borderPosition],style:G[Y]}}},U.buttons_borderPosition==="all"?B(se=>({...r.RESET_BORDER_PARAMS,[U.buttons_borderPosition]:{...se[U.buttons_borderPosition],style:G[Y]}})):B(se=>({...se,[U.buttons_borderPosition]:{...se[U.buttons_borderPosition],style:G[Y]}}));break;case"buttons_borderColor":q={buttonsBorder:{[U.buttons_borderPosition]:{...p[U.buttonsBorderPosition],color:G[Y]}}},U.buttons_borderPosition==="all"?B(se=>({...r.RESET_BORDER_PARAMS,[U.buttons_borderPosition]:{...se[U.buttons_borderPosition],color:G[Y]}})):B(se=>({...se,[U.buttons_borderPosition]:{...se[U.buttons_borderPosition],color:G[Y]}}));break;case"buttons_borderWidth":q={buttonsBorder:{[U.buttons_borderPosition]:{...p[U.buttons_borderPosition],width:G[Y]}}},U.buttonsBorderPosition==="all"?B(se=>({...r.RESET_BORDER_PARAMS,[U.buttons_borderPosition]:{...se[U.buttons_borderPosition],width:G[Y]}})):B(se=>({...se,[U.buttons_borderPosition]:{...se[U.buttons_borderPosition],width:G[Y]}}));break;case"buttons_borderPosition":d.setFieldsValue({buttons_borderWidth:p[G[Y]]?.width||"",buttons_borderColor:p[G[Y]]?.color||"",buttons_borderStyle:p[G[Y]]?.style||""});break;case"cards_borderStyle":q={cardsBorder:{[U.cards_borderPosition]:{...k[U.cards_borderPosition],style:G[Y]}}},U.cards_borderPosition==="all"?x(se=>({...r.RESET_BORDER_PARAMS,[U.cards_borderPosition]:{...se[U.cards_borderPosition],style:G[Y]}})):x(se=>({...se,[U.cards_borderPosition]:{...se[U.cards_borderPosition],style:G[Y]}}));break;case"cards_borderColor":q={cardsBorder:{[U.cards_borderPosition]:{...k[U.cardsBorderPosition],color:G[Y]}}},U.cards_borderPosition==="all"?x(se=>({...r.RESET_BORDER_PARAMS,[U.cards_borderPosition]:{...se[U.cards_borderPosition],color:G[Y]}})):x(se=>({...se,[U.cards_borderPosition]:{...se[U.cards_borderPosition],color:G[Y]}}));break;case"cards_borderWidth":q={cardsBorder:{[U.cards_borderPosition]:{...k[U.cards_borderPosition],width:G[Y]}}},U.cardsBorderPosition==="all"?x(se=>({...r.RESET_BORDER_PARAMS,[U.cards_borderPosition]:{...se[U.cards_borderPosition],width:G[Y]}})):x(se=>({...se,[U.cards_borderPosition]:{...se[U.cards_borderPosition],width:G[Y]}}));break;case"cards_borderPosition":d.setFieldsValue({cards_borderWidth:k[G[Y]]?.width||"",cards_borderColor:k[G[Y]]?.color||"",cards_borderStyle:k[G[Y]]?.style||""});break;case"buttons_borderRadiusAll":case"buttons_borderRadiusTopLeft":case"buttons_borderRadiusBottomLeft":case"buttons_borderRadiusTopRight":case"buttons_borderRadiusBottomRight":q={buttonsBorderRadius:{[lu[Y]]:+G[Y]}};break;case"cards_borderRadiusAll":case"cards_borderRadiusTopLeft":case"cards_borderRadiusBottomLeft":case"cards_borderRadiusTopRight":case"cards_borderRadiusBottomRight":q={cardsBorderRadius:{[su[Y]]:+G[Y]}};break;case"buttonsPaddingTop":case"buttonsPaddingLeft":case"buttonsPaddingRight":case"buttonsPaddingBottom":v?(q={padding:{all:+G[Y]}},d.setFieldsValue({paddingTop:G[Y],paddingLeft:G[Y],paddingRight:G[Y],paddingBottom:G[Y]})):q={buttonsPadding:{[L[Y]]:+G[Y]}};break;case"blockPaddingTop":case"blockPaddingLeft":case"blockPaddingRight":case"blockPaddingBottom":q={blockPadding:{[au[Y]]:+G[Y]}};break;case"blockPaddingTopBottom":q={blockPadding:{top:+G[Y],bottom:+G[Y]}},U.blockPaddingTop=U.blockPaddingBottom=+G[Y];break;case"blockPaddingLeftRight":q={blockPadding:{left:+G[Y],right:+G[Y]}},U.blockPaddingLeft=U.blockPaddingRight=+G[Y];break;default:q=G}Y!=="buttons_borderPosition"&&n({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:q})};return me&&(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:me,onValuesChange:Z,autoComplete:"off",className:"element-controls",children:[null,(0,o.jsxs)(t.ui_kit$FormSection,{title:i("Blocks"),dividerTop:!1,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Blocks background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"blockBackgroundColor",style:{marginBottom:h.formItemMarginBottomMD+4},rules:[{message:i("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color of the contrast blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"blockContrastBackgroundColor",style:{marginBottom:h.formItemMarginBottomMD+4},rules:[{message:i("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})})]}),(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:H,onToggleExtended:Q,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:G=>G.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:G=>G.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:ie,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:K,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:K,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":ne}),type:"default",name:"linkUnderline",onClick:K,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:G=>G.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":ye}),type:"default",name:"buttonsBold",onClick:K,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":pe}),type:"default",name:"buttonsItalic",onClick:K,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)(D.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:me,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)(D.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:me,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)(Is,{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 It(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,vt,ni,It,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"},vt=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 vt{type=uo.CDATA;get nodeType(){return 4}},It=class extends vt{type=uo.Root;get nodeType(){return 9}},di=class extends vt{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:()=>It,DomHandler:()=>sr,Element:()=>di,Node:()=>li,NodeWithChildren:()=>vt,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 It(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 It(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 v=k.length;for(;E<v;E++){const $=k[E];switch($.nodeType){case 1:{const I=b($.nodeName);N=new l.Element(I,g($.attributes)),N.children=B(I==="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 H=j[E-1]??null;H&&(H.next=N),N.parent=x,N.prev=H,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,v,$,H,I,L,P){this.acceptsBooleans=v===s||v===n||v===d,this.attributeName=H,this.attributeNamespace=I,this.mustUseProperty=$,this.propertyName=E,this.type=v,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,v])=>{_[E]=new b(E,l,!1,v,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 v=E.replace(h,p);_[v]=new b(v,l,!1,E,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(E=>{const v=E.replace(h,p);_[v]=new b(v,l,!1,E,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(E=>{const v=E.replace(h,p);_[v]=new b(v,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,v)=>{const $=R[v];return $===x?E[v]=v:$===k?E[v.toLowerCase()]=v:E[v]=$,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()})),vu=ho.__exportAll({default:()=>Iu});function Iu(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(vu))),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:v,createElement:$,isValidElement:H}=(B=h.library)!==null&&B!==void 0?B:c,I=_.length;g(_);for(let L=0;L<I;L++){const P=_[L];if(N){let oe=(k=h.replace)===null||k===void 0?void 0:k.call(h,P,L);if(H(oe)){I>1&&(oe=v(oe,{key:(x=oe.key)!==null&&x!==void 0?x:L})),j.push(E(oe,P,L));continue}}if(P.type==="text"){const oe=!P.data.trim().length;if(oe&&P.parent&&!(0,d.canTextBeChildOfNode)(P.parent)||h.trim&&oe)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}I>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),[v,$]=(0,a.useState)(null),[H,I]=(0,a.useState)(0),[L,P]=(0,a.useState)(!1),[z,le]=(0,a.useState)(""),[C,oe]=(0,a.useState)([]),[ne,ge]=(0,a.useState)(!1),[ye,te]=(0,a.useState)(!1),[pe,we]=(0,a.useState)(null),[me,Me]=(0,a.useState)(0),[Le,ve]=(0,a.useState)(null),re=r.useEmailAttribute("subject"),ie=r.useEmailAttribute("preheader"),ee=r.useCurrentUser(),Q=r.toLanguageCode(r.useInterfaceLocale()),K=ee.avatar_url||ee.avatar_urls?.[24],Z=[ee.first_name,ee.last_name].filter(Boolean).join(" ")||ee.username,G=r.useMessageService(),[U]=r.useLazyGetDialogQuery(),Y=r.useSendPostMessage(),[q,se]=r.useSendMessageMutation(),ue=(0,a.useRef)(new Set),Se=(0,a.useCallback)(be=>{const He=q(be),Ke=ue.current;Ke.add(He);const Fe=()=>Ke.delete(He);return He.then(Fe,Fe),He},[q]);(0,a.useEffect)(()=>{const be=ue.current;return()=>{be.forEach(He=>He.abort?.()),be.clear()}},[]);const[Ee,{reset:Oe}]=r.useGetAiGenerateStatusMutation(),[X,{data:F=[]}]=r.useLazyGetGeneratedContentQuery(),[Be]=r.useLazyGetLimitsStatsByTypeQuery(),V={cursor:L?"not-allowed":"default",pointerEvents:L?"none":"auto"};(0,a.useEffect)(()=>{Le&&ne&&(i.current=!0),ne||(i.current=!1)},[Le,ne]);const fe=!!(h.limits&&h.counters)&&!0,{limits:Ne}=h.limits?h:{limits:{ai_limit:0,ai_generator_limit:0}},{ai_limit:Pe,ai_generator_limit:Ge}=Ne,Ye=r.useEventEmitter(yo.events.AI_TEXT_REQUEST_ID).hasListeners(),Ze=pr({limitsInPlugin:fe,hostedAiActive:Ye}),de=ba({limitsInPlugin:fe,hostedAiActive:Ye,counter:H,limit:Pe}),Ie=ba({limitsInPlugin:fe,hostedAiActive:Ye,counter:me,limit:Ge}),W=(0,a.useCallback)(()=>{E.fire({name:"AiChatCount",count:H+1})},[E,H]),he=(0,a.useCallback)(()=>{E.fire({name:"AiGeneratorCount",count:me+1})},[E,me]),Ce=(0,a.useCallback)(async be=>!0,[c,Be,k]);(0,a.useEffect)(()=>{fe&&(I(h?.counters?.ai_counter||0),Me(h?.counters?.ai_generator_counter||0))},[h,fe]),(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 G.sendAsync(r.EVENT_TYPES.SANDBOX_IS_EMAIL_EMPTY),[G]),to=(0,a.useCallback)(()=>{const be=_.current?.closest(".ant-tabs-content.ant-tabs-content-top");setTimeout(()=>{be?.scrollTo({top:be.scrollHeight,behavior:"smooth"})},0)},[_]),eo=(0,a.useCallback)(()=>{r.swallowPromiseRejection(U({entity_id:R}).then(be=>{oe(be.data.documents),to()}))},[R,U,oe,to]),no=(0,a.useCallback)(be=>{if(!be?.data?._eventResult)return!1;const{aiMessage:He,aiHtml:Ke}=be.data;if(oe(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)(be=>{oe(He=>{for(let Ke=He.length-1;Ke>=0;Ke--)if(He[Ke]?.data?.isLoading&&He[Ke]?.data?.role==="assistant"){const Fe=[...He];return be?Fe[Ke]={data:{role:"assistant",message:be}}:Fe.splice(Ke,1),Fe}return He})},[]),ae=(0,a.useCallback)(be=>{const He=be?.message==="ERROR"?void 0:be?.message;return[be?.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 be=y.event(({progress:He,status:Ke,docId:Fe})=>{if(Fe!==w)return;const qe=Ke||`${Math.round(He)}%`;oe(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()=>be.dispose()},[y,w]);const ce=r.useEventEmitter(yo.events.AI_TEXT_STREAM_ID);(0,a.useEffect)(()=>{const be=ce.event(({partialHtml:He,docId:Ke})=>{if(Ke!==w)return;const Fe=ga(n(),String(He));d(Fe,{undoable:!0})});return()=>be.dispose()},[ce,n,d,g,w]);const je=(0,a.useCallback)(be=>{ge(!0),P(!0),r.swallowPromiseRejection(Ee({task_id:be||v,entity_id:R,status:"started"}).then(()=>{eo()}))},[R,Ee,v,eo]),Xe=(0,a.useCallback)(()=>{Ee({task_id:v,entity_id:R,status:"completed"}).then(be=>{be.data.status===403&&Oe(),eo()}).catch(be=>{}),P(!1),ge(!1)},[R,Ee,v,eo,Oe]);(0,a.useEffect)(()=>{let be;if(ne){const He=F[F.length-1]?.processing?.email;if(He){let Ke=F[F.length-1].status;d(String(He),{undoable:!0}),Ke===0&&Xe()}pe&&(clearInterval(be),ge(!1),we(!1),P(!1),O())}return()=>{clearInterval(be)}},[d,pe,g,F,ne,re,ie,R,v,eo,Ee,se,Xe,O]),(0,a.useEffect)(to,[to]),(0,a.useEffect)(()=>{e?.length>0&&oe(e),Y({operation:r.EVENT_TYPES.SANDBOX_EMAIL_CONTENT_GET})},[e,Y]),(0,a.useEffect)(()=>{const be=G.onInit(()=>{G.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:L}),G.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_DISCUSS,value:L})});return()=>be.dispose()},[L,G]);const oo=async()=>{if(z&&!B()){const be=z.replaceAll(/\n/g,"<br>"),He={project_id:x,connection:"chat",entity_id:R,message:be,locale:Q,subject:re||"",preheader:ie||"",textContent:ui.extractDocumentTextContent(n())};if(Le&&Ie||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.")}};oe(Fe=>[...Fe,Ke])}else{if(!await Ce(Le?"email_generate":"ai")){le("");return}Ze&&(Le&&me!==Ge?(he(),Me(Fe=>Fe+1)):H!==Pe&&(W(),I(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:be,userInfo:{display_name:Z,avatar_url:K}}},{data:{role:"assistant",message:c("Typing..."),isLoading:!0}}];oe(Fe=>[...Fe,...Ke]),Se({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),X({id:qe,setError:we}),r.swallowPromiseRejection(We().then(so=>{so?je(qe):te(!0)}))}eo()}}).catch(Fe=>{const qe=ae(Fe);k.error({title:Fe?.data?.code||c("Error"),description:qe}),O(qe)})}le("")}},po=async be=>{if(B())return;const He={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};oe(Fe=>[...Fe,He]);const Ke={project_id:x,connection:"chat",entity_id:R,context:be,locale:Q,subject:re||"",preheader:ie||"",textContent:ui.extractDocumentTextContent(n())};if(Ze&&(Le&&me!==Ge?(he(),Me(Fe=>Fe+1)):H!==Pe&&(W(),I(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 Ce("ai")){O();return}j({event:"select",action:"select_ai_assistant_role",context:Ke.context,entity_id:Ke.entity_id,project_id:Ke.project_id}),Se({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=ae(Fe);k.error({title:Fe?.data?.code||c("Error"),description:qe}),O(qe)})}},co=(0,a.useCallback)(async be=>{const He={data:{role:"user",message:be,userInfo:{display_name:Z,avatar_url:K}}},Ke={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};oe(qe=>[...qe,He,Ke]);const Fe={project_id:x,connection:"chat",entity_id:R,message:be,locale:Q,subject:re||"",preheader:ie||"",textContent:ui.extractDocumentTextContent(n())};if(Ie)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 Ce(Le?"email_generate":"ai")){O();return}Se({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),X({id:so,setError:we}),r.swallowPromiseRejection(We().then(To=>{To?je(so):te(!0)}))}Ze&&(Le&&me!==Ge?(he(),Me(so=>so+1)):H!==Pe&&(W(),I(so=>so+1))),eo()}}).catch(qe=>{const so=ae(qe);k.error({title:qe?.data?.code||c("Error"),description:so}),O(so)})}},[c,H,me,K,We,O,je,ae,Z,Pe,Ge,ee,re,ie,R,Le,Ie,Q,W,he,Ze,n,k,Ce,x,Se,X,eo]);(0,a.useEffect)(()=>{const be=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:Q};Lu(`discuss-ai-generator-context:${R}`,()=>{if(Ye){window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),co(He);return}r.swallowPromiseRejection(q({body:Ke}).then(()=>{window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),be.isDisposed()||co(He)}))})}return()=>be.dispose()},[e,co,R,Q,x,q,Ye,p]);const _o=be=>{typeof be.target.className=="string"&&be.target.className.includes("ai-response-change-context")&&(se.isLoading||po(be.target.role))},vo=be=>{if(B())return;const He=be.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=be=>{if(B())return;const He=be.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})},M=be=>{const He=be.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:be=>{if(be.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:()=>vo(be),children:(0,o.jsx)("span",{className:"ai-response-title",children:(0,ht.domToReact)(be.children,J)})})});if(be.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(be),children:(0,o.jsx)("span",{className:"ai-response-preheader",children:(0,ht.domToReact)(be.children,J)})})});if(be.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:()=>M(be),children:(0,o.jsx)("span",{className:"ai-response-copy",children:(0,ht.domToReact)(be.children,J)})})});if(be.attribs?.class?.split(" ").includes("ai-response-user-message")){const He=be.attribs?.data||be.children?.[0]?.data;return(0,o.jsx)("li",{className:be.attribs?.class,data:be.attribs?.data,onClick:()=>co(He),children:(0,ht.domToReact)(be.children,J)})}}},Re=()=>{je(),te(!1)},De=()=>{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:be=>(0,o.jsx)("li",{id:be._id,children:(0,o.jsx)(t.ui_kit$Comment,{className:be.data.userInfo?"":"ai-comment",avatar:be.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"}}):be.data.userInfo&&be.data._modified?be.data.userInfo.avatar_url:K||(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:V,children:be?.data?.role==="user"?ee?.username||c("User"):c("AI Assistant")}),datetime:be._created?(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:r.formatDate(r.parseISO(be._created),m,!0)}}):null,content:be.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:V,children:Nu(be.data.message,J)})})},be._id)}),fe&&(Le?(0,o.jsx)(t.ui_kit$LimitsCounter,{text:`${me} ${c("of")} ${Ge>0?Ge:"∞"} ${c("mail generator")} ${m("was used","were used",me)}`,exceeded:Ge>0&&me>=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:`${H} ${c("of")} ${Pe>0?Pe:"∞"} ${c("messeges")} ${m("was used","were used",H)}`,exceeded:Pe>0&&H>=Pe,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:be=>le(be.target.value),rows:4,placeholder:c("Type your request"),className:"textarea-comment",onPressEnter:be=>be.key==="Enter"&&be.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:se.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:se.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:ye,onOk:Re,onCancel:De,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}),layout_conversion:(0,o.jsx)(r.EmIcons,{icon:"EmailEnvelope",component:t.icons$EmailEnvelope}),projects:(0,o.jsx)(r.EmIcons,{icon:"FolderOpen",component:t.icons$FolderOpen}),emails:(0,o.jsx)(r.EmIcons,{icon:"EmailEnvelope",component:t.icons$EmailEnvelope}),blocks:(0,o.jsx)(r.EmIcons,{icon:"Block",component:t.icons$Block}),users:(0,o.jsx)(r.EmIcons,{icon:"SliderGroup",component:t.icons$SliderGroup})};function 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(),r.isChecksV2Enabled();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)(F=>{R(F)},[]),v=r.useMessageService(),$=r.useSelector(r.selectProblemsList),H=r.usePushToDataLayer(),[I,L]=(0,a.useReducer)(Wu,zu),{checks:P,limits:z,running:le}=Gu(),{limitsInPlugin:C,perTypeAvailable:oe,aggregateLimit:ne,aggregateCounter:ge,disableFields:ye,typeLimits:te}=z,pe=(0,a.useCallback)(F=>mi.isOptimiseTypeDisabled(z,F),[z]),we=(0,a.useCallback)(F=>L({type:"SET_VALIDATE_LINKS",payload:F}),[]),me=(0,a.useCallback)(F=>L({type:"SET_VALIDATE_IMAGES",payload:F}),[]),Me=(0,a.useCallback)(F=>L({type:"SET_SELECTED_TAGS",payload:F}),[]);qu({activeTab:I.activeTab,selectedTags:I.selectedTags,validateLinksResult:I.validateLinksResult,validateImagesResult:I.validateImagesResult,setValidateLinks:we,setValidateImages:me});const{showImgPreviewHandler:Le,hideBlockPreviewHandler:ve}=Yu(),re=(0,a.useCallback)(F=>{if(oe){const{limit:Be}=te[F];E({presetId:ya[F],previousDisplay:Be>0?Be:r.presetLimitDisplay("infinity"),nextDisplay:r.presetLimitDisplay("infinity")});return}E({presetId:"optimization_exceeded",previousDisplay:ne,nextDisplay:r.presetLimitDisplay("infinity")})},[oe,te,E,ne]),ie=(0,a.useCallback)((F,Be)=>{switch(F.reason){case"notSaved":d.error({title:"Save the mail first."});return;case"typeLimit":re(F.type);return;case"planLimit":E({presetId:F.exceeded.presetId,previousDisplay:F.exceeded.previousLimit,nextDisplay:r.presetLimitDisplay(F.exceeded.nextLimit)});return;case"usageLimit":E({presetId:ya[F.type],previousDisplay:e("—"),nextDisplay:r.presetLimitDisplay("infinity")});return;case"failed":{if("error"in F){d.error({error:F.error});return}const V=F.data;(V?.statusCode??0)>300||!V?.success?d.error({error:{data:V}}):d.error({title:e("Something went wrong.")}),Be();return}default:return}},[d,re,E,e]),ee=(0,a.useCallback)(F=>{F!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${F}`})},[d,e]),Q=(0,a.useCallback)(()=>{n(m.billingPageUrl||r.APP_ROUTES.billing)},[m.billingPageUrl,n]),K=F=>{if(!C||!oe)return null;const{counter:Be,limit:V,disabled:fe}=te[F];return(0,o.jsx)(t.ui_kit$LimitsCounter,{text:wa(Be,V,e,i),exceeded:fe,extra:(0,o.jsx)("button",{type:"button",style:Ra,onClick:Q,children:e("Need more?")})})},Z=(0,a.useCallback)((F,Be)=>{v.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_LINK,settings:{elementId:F,isError:Be}})},[v]),G=(0,a.useCallback)((F,Be)=>{v.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_IMG,settings:{elementId:F,isError:Be}})},[v]),U=(0,a.useCallback)(F=>{const Be={startColumn:F.startColumn,startLineNumber:F.startLineNumber,endColumn:F.endColumn,endLineNumber:F.endLineNumber};l(r.setActiveProblemRange(Be))},[l]),Y=(0,a.useCallback)(F=>{L({type:"SET_ACTIVE_TAB",payload:F}),L({type:"RESET_SELECTED_TAGS"}),F===gr&&$?.length>0&&H({event:"check",action:"check_email_code",email_id:p,project_id:k,problems_count:$?.length||0})},[$,H,p,k]),q=(0,a.useCallback)(F=>({entityId:B??"",readContent:c,beforeRequest:F}),[B,c]),se=(0,a.useCallback)(async()=>{const F=await P.run("link_check",q(()=>v.send({operation:"sandbox_set_attr_to_links"})));if(F.ok===!1){ie(F,()=>!I.validateLinksResult.links&&Y(""));return}L({type:"SET_VALIDATE_LINKS_RESULT",payload:F.value}),d.success(e("Links validation was successfully completed")),ee(F.limitRemaining),H({event:"check",action:"check_email_links",email_id:p,project_id:k,links_count:F.value.links?.length||0})},[P,q,v,ie,I.validateLinksResult.links,Y,d,e,ee,H,p,k]),ue=(0,a.useCallback)(async()=>{const F=await P.run("image_check",q(()=>v.send({operation:"sandbox_set_attr_to_images"})));if(F.ok===!1){ie(F,()=>!I.validateImagesResult?.images?.length&&Y(""));return}const{images:Be,summary:V,totalKb:fe}=F.value,Ne={images:Be||[],summary:V,summaryTime:{value:(fe>1200?fe/1e3:fe).toFixed(1),name:fe>1200?e("MB"):e("KB")}};L({type:"SET_VALIDATE_IMAGES_RESULT",payload:Ne}),d.success(e("Images validation was successfully completed")),ee(F.limitRemaining),H({event:"check",action:"check_email_images",email_id:p,project_id:k,images_count:Ne.images?.length||0})},[P,q,v,ie,I.validateImagesResult,Y,d,e,ee,H,p,k]),Se=(0,a.useCallback)(async()=>{const F=await P.run("spam_check",q());if(F.ok===!1){ie(F,()=>!I.validateSpamResult?.report?.length&&Y(""));return}L({type:"SET_VALIDATE_SPAM_RESULT",payload:F.value}),d.success(e("Spam validation was successfully completed")),ee(F.limitRemaining),H({event:"check",action:"check_email_spam",email_id:p,project_id:k,spam_score:F.value.spamScore||0})},[P,q,ie,I.validateSpamResult,Y,d,e,ee,H,p,k]);(0,a.useEffect)(()=>{if(C){if(oe){mi.OPTIMISE_LIMIT_TYPES.forEach(F=>{const{limit:Be,counter:V,disabled:fe}=te[F];if(!fe){N.current[F]=!1;return}N.current[F]||Be>0&&V>=Be&&(N.current[F]=!0,re(F))});return}if(!(ne>0&&ge>=ne)){j.current=!1;return}j.current||(j.current=!0,re("link_check"))}},[C,oe,te,ge,ne,re]);const Ee=x?r.getLimitUpgradePresetDefinition(x.presetId):null,Oe=(0,a.useCallback)(()=>R(null),[]),X=r.useNativeExtraBuyAction(Ee?.usageResource,Oe);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:Oe,title:e(Ee.titleKey),subtitle:e(Ee.subtitleKey),usageResource:Ee.usageResource,previousDisplay:x.previousDisplay,nextDisplay:x.nextDisplay,secondaryAction:X,onChangePlan:()=>{R(null),s()}}):null,C&&!oe&&(0,o.jsx)(t.ui_kit$LimitsCounter,{text:wa(ge,ne,e,i),exceeded:ye,extra:(0,o.jsx)("button",{type:"button",style:Ra,onClick:Q,children:e("Need more?")})}),m.optimizeLinksEnabled&&(0,o.jsxs)(o.Fragment,{children:[K("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:F=>F.preventDefault(),onClick:()=>{Y(hr),!I.validateLinksResult?.links?.length&&I.activeTab!==hr&&se()},loading:le.link_check,disabled:pe("link_check")&&!I.validateLinksResult?.links?.length,children:!le.link_check&&(I.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:I.activeTab,validateLinksResult:I.validateLinksResult,validateLinks:I.validateLinks,selectedTags:I.selectedTags,setSelectedTags:Me,isLoading:le.link_check,disabled:pe("link_check"),iconStrokeWidth:m.iconStrokeWidth,onValidate:se,goToLinkHandler:Z})]}),m.optimizeImagesEnabled&&(0,o.jsxs)(o.Fragment,{children:[K("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:F=>F.preventDefault(),onClick:()=>{Y(br),!I.validateImagesResult?.images?.length&&I.activeTab!==br&&ue()},loading:le.image_check,children:!le.image_check&&(I.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:I.activeTab,validateImagesResult:I.validateImagesResult,validateImages:I.validateImages,selectedTags:I.selectedTags,setSelectedTags:Me,isLoading:le.image_check,disabled:pe("image_check"),iconStrokeWidth:m.iconStrokeWidth,onValidate:ue,goToImageHandler:G,showImgPreviewHandler:Le,hideBlockPreviewHandler:ve})]}),m.optimizeSpamAssassinEnabled&&(0,o.jsxs)(o.Fragment,{children:[K("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:F=>F.preventDefault(),loading:le.spam_check,onClick:()=>{Y(Ta),I.validateSpamResult.report?.length||Object.prototype.hasOwnProperty.call(I.validateSpamResult,"spamScore")||Se()},disabled:pe("spam_check")&&!(I.validateSpamResult?.report?.length||Object.prototype.hasOwnProperty.call(I.validateSpamResult,"spamScore")),children:!le.spam_check&&(I.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:I.activeTab,validateSpamResult:I.validateSpamResult,isLoading:le.spam_check,disabled:pe("spam_check"),iconStrokeWidth:m.iconStrokeWidth,onValidate:Se})]}),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:F=>F.preventDefault(),onClick:()=>Y(gr),children:I.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:I.activeTab,problemsList:$,onSetMonacoPosition:U})]})]})},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,va=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>=va){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>=va){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("./c0a3f7d0.js")),void 0,{}.url)),am=r.lazyRoute(()=>(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>fo("./2bed6a18.js")),void 0,{}.url)),Ia={height:"100%"};function nm(e){(e?(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>fo("./1c7a6d45.js")),void 0,{}.url):(0,Lt.__vitePreload)(()=>Promise.resolve().then(()=>fo("./e037a420.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:Ia});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:Ia}),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 v=(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:v}),[e,v,m,i,b,x,n,c,l,_]),H=(0,a.useCallback)(async()=>{try{typeof $.dataProvider?.clearCache=="function"&&await $.dataProvider.clearCache()}catch{}B(null),R(L=>L+1),N(L=>L+1)},[$.dataProvider]),I=(0,a.useCallback)(()=>{b&&B(b)},[b]);return{...$,projectId:b,restApiV2:c,v2Enabled:h,backfillTriggered:k,contentKey:`${b}:${j}`,handleIndexingCompleted:H,markIndexingStarted:I}}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(T=>r.selectParentBlocks(T,d)),v=Ns(),$=(0,a.useRef)(null),H=(0,a.useRef)(null),I=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,v),[le,v]),oe=(0,a.useRef)(null),ne=(0,a.useRef)(null),ge=(0,a.useRef)(null),ye=r.useStore(),te=(T,_e=!1)=>(S,Te,Ve,mo,Ue)=>{if(!r.isBlocksV2Enabled()){T(S,Te,Ve,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,Te,Ve,mo,Ue);return}T(S,Ve==="common"?Re({html:Jo}):Jo,Ve,mo,{...Ue,html:Jo})},gt=()=>ye.getState();if(!Nt.waitsForWrite(Ue)){Uo(Nt.freshBlockHtml(gt,Ue));return}(_e?Nt.blockHtmlForInsertOnce(gt,Ue):Nt.blockHtmlForInsert(gt,Ue))?.then(Uo)},pe=te(m,!0),we=te(g);(0,a.useEffect)(()=>{H.current?.scrollTo({top:0})},[i,l]);const me=r.useProjectData(),{data:Me}=r.useGetTermsQuery({project:me,kind:r.BLOCK_TAGS},{skip:!me?.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 _e=[];for(let S in T)_e.push({label:p(r.TYPES_TRANSLATE[T[S]]),value:T[S]})}},[_,p]);const{isSuccess:re,isError:ie,isLoading:ee,isFetching:Q,data:K,currentData:Z,error:G}=r.useGetBlocksQuery({...Le,projectId:c,page:1}),U=(ee||Q)&&!(re&&Z!==void 0),Y=(0,a.useMemo)(()=>{if(re&&K)return[...K].sort((T,_e)=>bt[T.type]-bt[_e.type])},[re,K]),[q,se]=(0,a.useState)({list:void 0,ids:[]}),ue=(0,a.useMemo)(()=>q.list!==void 0&&q.list===Z?Y?.filter(T=>!q.ids.includes(T.id)):Y,[q,Z,Y]),[Se,Ee]=(0,a.useState)([]);r.usePrevious(T=>{T!==ie&&k.fromError("BLOCK_GET_ERROR",{},G,!0)},[ie,G,k]);const[Oe,X]=(0,a.useState)(()=>r.parentEmailBlocksArgs(d,c)),{isSuccess:F,isError:Be,isLoading:V,isFetching:fe}=r.useGetParentEmailBlocksQuery({...Oe,emailId:d,page:1,...r.pageProjectKey(c)},{skip:!d||E.length}),Ne=(0,a.useMemo)(()=>{if(F||E.length)return[...E].sort((T,_e)=>bt[T.type]-bt[_e.type])},[F,E]),[Pe,Ge]=(0,a.useState)([]);(0,a.useEffect)(()=>{const T=new Set;if(E.length&&Ne){for(const _e of Ne)_e.type&&T.add(_e.type);Ge(Array.from(T))}else Ge([])},[E,Ne]);const[Ye,Ze]=(0,a.useState)(()=>r.templateBlocksArgs(c)),{isSuccess:de,isError:Ie,isLoading:W,isFetching:he,data:Ce=[],currentData:We}=r.useGetTemplateBlocksQuery({...Ye,page:1,...r.pageProjectKey(c)}),to=(W||he)&&!(de&&We!==void 0),eo=(0,a.useMemo)(()=>{if(Ce.length)return[...Ce].sort((T,_e)=>bt[T.type]-bt[_e.type])},[Ce]),[no,O]=(0,a.useState)([]);(0,a.useEffect)(()=>{const T=new Set;if(eo&&Ce.length){for(const _e of eo)_e.type&&T.add(_e.type);O(Array.from(T))}},[Ce.length,eo]);const ae=(0,a.useMemo)(()=>{const T=new Set;for(const _e of Se)T.add(_e);for(const _e of Pe)T.add(_e);for(const _e of no)T.add(_e);return Array.from(T)},[no,Pe,Se]),w=T=>{ve(_e=>({..._e,...T,page:1})),X(_e=>({..._e,...T,page:1})),Ze(_e=>({..._e,...T,page:1}))},y=r.useFitBlockPreviewHeight(P),ce=(0,a.useCallback)(()=>{I.querySelector(".blocks-search__result-wrapper.is_search")&&(I.querySelector(".blocks-search__result-wrapper").style.removeProperty("transition"),I.querySelector(".blocks-search__result-wrapper").style.opacity=0,r.measureBlockPreviews(I,207/L),I.querySelector(".blocks-search__result-wrapper").style.transition="opacity 0.2s",I.querySelectorAll(".blocks-search__result-wrapper").forEach(T=>T.style.opacity=1))},[L,I]);(0,a.useEffect)(()=>{!(he||W)&&de&&i!=="template"&&(l?ce():s())},[he,W,de,ce,Le.name,s,l,i]),(0,a.useEffect)(()=>{const T=new Set;if(re&&Y){for(const _e of Y)_e.type&&T.add(_e.type);Ee(Array.from(T))}},[re,Y]);const je=T=>{const _e=Object.keys(T)[0],S=b.getFieldsValue(!0);switch(_e){case La:const Te=(Me||[]).filter(Ve=>T[_e].includes(Ve.name)).map(Ve=>Ve.id)||null;w({tags:Te});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(_e=>_e.style.display="none"),T.target.closest(".blocks-search").querySelectorAll(`[data-type="${T.target.getAttribute("data-type")}"]`).forEach(_e=>_e.style.display="block")):T.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(_e=>_e.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 _e=I.querySelector(".block-search__preview")?I.querySelector(".block-search__preview"):null,S=I.querySelector(".block-search__preview-title")?I.querySelector(".block-search__preview-title"):null,Te=I.querySelector(".block-search__preview-content")?I.querySelector(".block-search__preview-content"):null;I.querySelector(".block-search__preview")||(_e=document.createElement("div"),_e.classList.add("block-search__preview"),S=document.createElement("div"),S.classList.add("block-search__preview-title"),Te=document.createElement("div"),Te.classList.add("block-search__preview-content"),_e.append(Te),_e.append(S),I.querySelector(".email-pane__col_settings-inner").append(_e)),S.innerHTML="",Te.innerHTML="",S.innerHTML=T.title;let Ve=T.html.replaceAll(/<style((.|\n|\r)*?)<\/style>/gi,"").trim();Te.innerHTML=r.sanitizeHtml('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+Ve+"</table>"),_e.style.opacity!=="1"&&setTimeout(function(){_e.style.opacity="1",_e.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(100%)":"translateX(-100%)"},10)},co=()=>{let T=I.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)(()=>{I.querySelectorAll(".blocks-search__result").forEach(T=>{T.style.display="block"})},[i]);const _o=!K?.length&&(!d||!E?.length)&&!Ce?.length&&(Le.tags||Le.name||Le.type)&&!(ee||Q),vo=T=>ye.dispatch(r.blocksApi.endpoints.deleteBlock.initiate(T.id)).then(_e=>{if(_e.error){k.fromError("BLOCK_REMOVING_ERROR",r.getBlockDesc(T),_e.error);return}se(S=>({list:Z,ids:S.list===Z?[...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)(()=>{!ee&&!Q&&s()},[ee,Q,s]),(0,a.useEffect)(()=>{(i==="common"||l)&&setTimeout(s,50)},[K,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:()=>vo(T)})},M=(T,_e)=>`${T.pathname.split("emails")[0]}blocks/${_e.id}`,J=T=>{let _e=[{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"&&_e.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:M(j,T),children:" "})}),S==="over-email"&&_e.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(ye),yo.events.OPEN_BLOCK_REQUEST_ID).fireSettled(String(T.id)).then(({errors:Te})=>{Te.length&&k.fromError("BLOCK_GET_ERROR",r.getBlockDesc(T),Te[0])})}}),_e},Re=T=>{let _e=T.html.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");if(_e.replaceChildren(...r.parseFromString(T.html)),Object.keys(C).length!==0&&(_e.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(Te=>{if(be(Te.style.color).toLowerCase()!=="#ffffff"){let Ve=Te.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.cards.contrastTextColor};`);Te.setAttribute("style",Ve)}})}),_e.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(Te=>{if(be(Te.style.color).toLowerCase()!=="#ffffff"){let Ve=Te.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.cards.baseTextColor};`);Te.setAttribute("style",Ve)}})}),_e.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"))}),_e.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(S=>{if(!S.style.display&&parseFloat(S.style.fontSize)<=20){let Te="",Ve=C.text.fontFamily;if(parseFloat(S.style.fontSize)>14&&(Te=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",Te)),!S.closest(".em-contrast-card, .em-card")&&be(S.style.color).toLowerCase()!=="#ffffff"&&(Te=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.text.color};`),S.setAttribute("style",Te)),S.closest(".em-contrast-block")&&!S.closest(".em-contrast-card, .em-card")&&(Te=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.text.contrastColor};`),S.setAttribute("style",Te)),Ve[0]==="Safe Fonts"?(S.style.fontFamily=Ve[1],De({elem:_e})):Ve[0]==="Google Fonts"&&(Ve[1]==="Sans Serif"?S.style.fontFamily="Helvetica, Arial, sans-serif":Ve[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-${Ve[2].replace(/\s/g,"")}-${Ve[3].replace(/\s/g,"")}`),He({elem:_e,fontFamilyArray:Ve})),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&&be(S.style.color).toLowerCase()!=="#eb3737"){let Te="",Ve=C.headings.fontFamily;parseFloat(S.style.fontSize)<40&&(Te=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",Te)),!S.closest(".em-contrast-card, .em-card")&&be(S.style.color).toLowerCase()!=="#ffffff"&&(Te=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.headings.color};`),S.setAttribute("style",Te)),S.closest(".em-contrast-block")&&!S.closest(".em-contrast-card, .em-card")&&(Te=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.headings.contrastColor};`),S.setAttribute("style",Te)),Ve[0]==="Safe Fonts"?(S.style.fontFamily=Ve[1],De({elem:_e})):Ve[0]==="Google Fonts"&&(Ve[1]==="Sans Serif"?S.style.fontFamily="Helvetica, Arial, sans-serif":Ve[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-${Ve[2].replace(/\s/g,"")}-${Ve[3].replace(/\s/g,"")}`),He({elem:_e,fontFamilyArray:Ve}));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)}}}),_e.querySelectorAll('a[style*="color"]').forEach(S=>{if(S.style.display){if(S.style.display&&S.style.display==="block"){let Te="";if(Te=S.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${C.buttons.fontSize}px`),S.setAttribute("style",Te),S.closest("td").style.backgroundColor&&!S.closest("td").style.borderWidth&&!S.closest(".em-contrast-card"))if(S.closest(".em-contrast-block")?Te=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.buttons.contrastColor};`):Te=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.buttons.color};`),S.setAttribute("style",Te),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),Te=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.buttons.contrastBackgroundColor};`),S.setAttribute("style",Te)}}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),Te=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.buttons.backgroundColor};`),S.setAttribute("style",Te)}}else for(const Ue in C.buttons.border)C.buttons.border[Ue]&&C.buttons.border[Ue].color!==void 0&&(Te=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.buttons.border[Ue].color};`),S.setAttribute("style",Te));else S.closest(".em-contrast-block")?C.buttons.contrastBackgroundColor&&(Te=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.buttons.contrastBackgroundColor};`),S.setAttribute("style",Te)):C.buttons.backgroundColor&&(Te=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${C.buttons.backgroundColor};`),S.setAttribute("style",Te));let Ve=C.buttons.fontFamily;Ve[0]==="Safe Fonts"?(S.style.fontFamily=Ve[1],De({elem:_e})):Ve[0]==="Google Fonts"&&(Ve[1]==="Sans Serif"?S.style.fontFamily="Helvetica, Arial, sans-serif":Ve[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-${Ve[2].replace(/\s/g,"")}-${Ve[3].replace(/\s/g,"")}`),He({elem:_e,fontFamilyArray:Ve})),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 Te=C.text.fontFamily;if(be(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 Ve="";C.links.underline?Ve=S.style.textDecoration?S.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: underline;"):S.getAttribute("style")+" text-decoration: underline;":Ve=S.style.textDecoration?S.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: none;"):S.getAttribute("style")+" text-decoration: none;",S.setAttribute("style",Ve),Te[0]==="Safe Fonts"?(S.style.fontFamily=Te[1],De({elem:_e})):Te[0]==="Google Fonts"&&(Te[1]==="Sans Serif"?S.style.fontFamily="Helvetica, Arial, sans-serif":Te[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-${Te[2].replace(/\s/g,"")}-${Te[3].replace(/\s/g,"")}`),He({elem:_e,fontFamilyArray:Te}))}}),_e.querySelector('[em="block"]'))){const S=_e.querySelectorAll('[em="block"]');C.block?.backgroundColor&&S.forEach(Te=>{Te.querySelectorAll(":scope > td").forEach(Ve=>{Ve.setAttribute("bgcolor",C.block.backgroundColor)})}),C.block?.padding&&S.forEach(Te=>{Te.querySelectorAll(":scope > td").forEach(Ve=>{Ve.style.paddingTop=C.block.padding.top+"px",Ve.style.paddingRight=C.block.padding.right+"px",Ve.style.paddingBottom=C.block.padding.bottom+"px",Ve.style.paddingLeft=C.block.padding.left+"px"})})}return _e.tagName==="DIV"?r.getElementInnerHTML(_e):r.getElementInnerHTML(_e.querySelector("tbody")||_e)},De=T=>{T.elem.querySelectorAll("link[em-class]").forEach(_e=>{T.elem.querySelector("."+_e.getAttribute("em-class"))||_e.remove()})};function be(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 _e=parseInt(T[0],10).toString(16),S=parseInt(T[1],10).toString(16),Te=parseInt(T[2],10).toString(16);return _e=_e.length===1?"0"+_e:_e,S=S.length===1?"0"+S:S,Te=Te.length===1?"0"+Te:Te,"#"+_e+S+Te}}else if(T&&T.charAt(0)==="#")return T}const He=T=>{const _e=T.elem.querySelectorAll("link"),S=`em-font-${T.fontFamilyArray[2].replace(/\s/g,"")}-${T.fontFamilyArray[3].replace(/\s/g,"")}`;if(!Array.from(_e)?.find(Ve=>Ve.getAttribute("em-class")===S)){let Ve=document.createElement("link");Ve.setAttribute("rel","stylesheet"),Ve.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`),Ve.setAttribute("em-class",S),T.elem.insertAdjacentElement("afterbegin",Ve)}To({elem:T.elem});let Te=`font-family: '${T.fontFamilyArray[2]}', ${so[T.fontFamilyArray[1]]}!important;`;Te+=` font-weight: ${qe[T.fontFamilyArray[3]].replaceAll("i","")}!important;`,qe[T.fontFamilyArray[3]].indexOf("i")>-1&&(Te+=" 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,"")} { ${Te} }`),setTimeout(()=>De({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 _e=document.createElement("style");_e.setAttribute("em","styles"),T.elem.append(_e)}}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:je,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})})}),((l||i==="project")&&ie||(l||i==="template")&&Be||(l||i==="common")&&Ie)&&(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"),ae.map(T=>(0,o.jsx)("li",{"data-type":T,onClick:Xe,children:p(r.TYPES_TRANSLATE[T])},"search_"+T))]})}),(0,o.jsxs)("div",{ref:H,className:(0,ze.default)("blocks-search__result-wrapper",{is_search:l}),children:[(i==="project"||l)&&(0,o.jsxs)(o.Fragment,{children:[!!Se.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"),Se.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:oe,children:[(0,o.jsx)("div",{className:"blocks-search__result-holder project",children:!U&&(ue?.length?ue.map(T=>{const _e=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=>pe(S,T.html,"project",T.title,T),onDragStart:S=>we(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:_e,onContentLoad:y,style:{transform:`scale(${P})`}})]})},"commenMenu")},T.id)}):!(Le.tags||Le.name||Le.type)&&re&&!U&&!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}})})]}))}),U&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),l&&K?.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:[!!Pe.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"),Pe.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:ne,children:[(0,o.jsxs)("div",{className:"blocks-search__result-holder template",children:[E&&!(V||fe)&&Ne?.length?(0,o.jsx)(o.Fragment,{children:Ne.map((T,_e)=>{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:Te=>pe(Te,T.html,"template",T.title,T),onDragStart:Te=>we(Te,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+_e.toString())})}):!l&&!W&&!fe&&!Be&&(0,o.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:p("No related blocks found.")})," "]}),(V||fe)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),l&&E?.length>0&&Ce?.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:ge,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,_e)=>{const S=Re({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:Te=>pe(Te,Re({html:T.html}),"common",T.title,T),onDragStart:Te=>we(Te,Re({html:T.html}),"common",T.title,T),onMouseEnter:()=>po({html:Re({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+_e.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),[v,$]=(0,a.useState)(null),[H,I]=(0,a.useState)(null),[L,P]=(0,a.useState)(""),[z,le]=(0,a.useState)(""),[C,oe]=(0,a.useState)(!1),[ne,ge]=(0,a.useState)(""),[ye,te]=r.useAddCommentMutation(),[pe,we]=r.useDeleteCommentMutation(),[me,Me]=r.useEditCommentMutation(),[Le,ve]=r.useDeleteTargetMutation(),[re]=r.useAutoSaveBlockMutation(),ie=r.useDispatch(),ee=r.useStore(),Q=r.useCurrentUser(),K=r.useCurrentProjectRequested(),Z=r.useContentReader(),G=de=>{const Ie=r.getEmailDocuments(yo.getContainer(ee));Ie.save("anchor",{project:de}).then(W=>{const he=W?Ie.revisionFacts()?.lastRevisionAt:void 0;he!==void 0&&d?.id!=null&&ie(r.rememberAutosaveTime({emailId:d.id,modified:new Date(he).toISOString()}))})},U=()=>{const de=K;if(_m(n,yo.getContainer(ee))){G(de);return}const Ie={...d?.meta!==void 0?{meta:d.meta}:{},title:d?.title,emailId:d?.id,project:de,html:Z(),excerpt:d?.date_gmt};d?.id!=null&&re({blockId:d.id,body:Ie}).catch(W=>{})};function Y(de){oe(!1),ge(""),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:ne}),E(!0),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!0})}function q(){I(v),e.filter(de=>de.parent===v).length?me({commentId:v,status:"deleted"}).unwrap():pe(v),document.querySelector('.discuss-main li[id="'+v+'"] .comment-icon-target')?.getAttribute("target-id")&&g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:document.querySelector('.discuss-main li[id="'+v+'"] .comment-icon-target')?.getAttribute("target-id")}),U(),ge("")}function se(de){I(v);const Ie=e.find(he=>he.id?.toString()===v),W=Ie?.target_id?.toString()||"";oe(!!W),ge(W),le(Ie?.content?.slice(3,-5)?.toString()),j("EDIT")}function ue(de){I(v),P(""),j("REPLY")}const Se=()=>{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 me({commentId:H,content:z,targetId:ne}).unwrap(),j("ADD"),le(""),I(0),oe(!1),E(!1),ge(""),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Se()}const Oe=de=>{j("ADD"),le(""),I(0),oe(!1),E(!1),ge(""),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})},X=async()=>{l?((k||L)&&await ye({subjectId:i,author:Q.id,parent:R==="ADD"?"0":H,content:k||L,author_name:Q.name,author_email:Q.email,targetId:ne}).then(de=>{if(de.error){const{data:Ie}=de.error;b.error({title:Ie?.code??c("Error"),description:Ie?.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"})}),ge(""),j("ADD"),P(""),x(""),I(0),oe(!1),E(!1),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):Se()};function F(){C?(E(!1),oe(!1),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:ne})):(E(!N),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!N}),N&&oe(!1))}function Be(de){let Ie=JSON.parse(JSON.stringify(de));if(!Ie||!Ie.length)return[];let W=[],he=new Map;for(let Ce=0,We=Ie.length;Ce<We;++Ce){let to=Ie[Ce],eo=he.get(to.id);if((!eo||Array.isArray(eo))&&(eo&&(to.children=eo),he.set(to.id,to)),String(to.parent)==="0")W.push(to);else{let no=he.get(to.parent);no?(Array.isArray(no)?no:no.children=no.children||[]).push(to):he.set(to.parent,[to])}}return W.forEach(Ce=>{Ce.status==="deleted"&&!Ce.children&&(we.isUninitialized||we.isSuccess)&&pe(Ce.id).unwrap().catch(We=>{})}),W}const V=de=>{const Ie=de.data.operation;if(Ie===r.EVENT_TYPES.APPLICATION_DISCUSS_SET_ID&&(ge(de.data.settings.value),de.data.settings.value!==""?(oe(!0),E(!1)):(oe(!1),E(!0))),Ie===r.EVENT_TYPES.APPLICATION_DISCUSS_SAVE_TARGET&&U(),Ie===r.EVENT_TYPES.APPLICATION_DISCUSS_GET_COMMENT)if(document.querySelector('.comment-icon-target[target-id="'+de.data.settings.targetId+'"]')){let W=document.querySelector('.comment-icon-target[target-id="'+de.data.settings.targetId+'"]').closest(".ant-comment");document.querySelector(".comment-block")?document.querySelector(".comment-block").scrollTo(0,W.offsetTop):document.querySelector(".em-analytics__email-tab-discuss .ant-tabs-content").scrollTo(0,W.offsetTop),W.classList.add("active"),setTimeout(()=>{W.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.")});Ie===r.EVENT_TYPES.APPLICATION_DISCUSS_NO_COMMENT&&b.error({title:c("There's no such element in the email.")})};r.useListenPostMessage(V);const fe=de=>{g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_GET_TARGET,value:de})},Ne=de=>(de?.sort((Ie,W)=>Ie.date>W.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:Ie=>(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("li",{id:Ie.id,children:(0,o.jsxs)(o.Fragment,{children:[Ie.status==="deleted"&&Ie.clildren&&(0,o.jsx)(t.ui_kit$Comment,{className:"deletedComment",content:(0,o.jsx)(t.ui_kit$Alert,{description:c("Comment was removed."),type:"info"}),children:Ne(Ie.children)}),Ie.status!=="deleted"&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Comment,{author_id:Ie.author_id,author:Ie.author_name,avatar:Ie.author_avatar_urls&&Ie.author_avatar_urls[48]||"",className:(0,ze.default)(Ie.target_id&&"targetted-comment-item",(!Ie.author_avatar_urls||!Ie.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>$(Ie.id),menu:{items:Ie.author===Q.id?Ye:Ze},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,o.jsx)("div",{onClick:()=>Ie.target_id&&fe(Ie.target_id),dangerouslySetInnerHTML:{__html:Ie.content}})},"commenMenu"),datetime:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:Ie.date&&r.formatDate(r.tryParseISO(Ie.date),m,!0)}}),Ie.target_id&&(0,o.jsx)("span",{className:"comment-icon-target","target-id":Ie.target_id,onClick:()=>fe(Ie.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"&&H===Ie.id&&Ge,R==="EDIT"&&H===Ie.id&&Pe,Ne(Ie.children)]})})})]})})})})})),Pe=(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"&&ne!==""?"primary":"default",className:"button-target "+(N&&!C?"button-target_choose":""),style:C&&R==="EDIT"&&ne!==""?{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:F,loading:ve.isLoading,type:N||C&&R==="EDIT"&&ne!==""?"primary":"default",className:"button-target "+(N&&!C?"button-target_choose":""),style:C&&R==="EDIT"&&ne!==""?{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:Me.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:X,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&&X(),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:F,type:N||C&&R==="REPLY"&&ne!==""?"primary":"default",className:"button-target "+(N&&!C?"button-target_choose":""),style:C&&R==="REPLY"&&ne!==""?{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:ue},{key:"Edit comment",icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,style:{fontSize:"16px"}}),label:c("Edit"),onClick:se},{key:"Delete comment",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16}),label:c("Delete"),style:{color:_.colorError},onClick:q});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:ue}),(0,o.jsxs)("div",{className:"discuss-main",children:[e.length>0&&(0,o.jsx)(t.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:Be(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:Ne(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===Q.id?Ye:Ze},styles:{root:{minWidth:"auto"}},children:(0,o.jsx)("div",{onClick:()=>de.target_id&&fe(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:()=>fe(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"&&H===de.id&&Ge,R==="EDIT"&&H===de.id&&Pe,Ne(de.children)]})})})]})}),(0,o.jsxs)(t.ui_kit$Form,{onFinish:X,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&&X()})}),(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:F,type:N||C&&R==="ADD"&&ne!==""?"primary":"default",className:"button-target "+(N&&!C?"button-target_choose":""),style:C&&R==="ADD"&&ne!==""?{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),[v,$]=(0,a.useState)(!1),[H,I]=(0,a.useState)([]),[L,P]=(0,a.useState)([]),z=q=>s(r.switchIsPanelHistoryCollapsed(q)),le=(0,a.useCallback)(q=>{if(!q?.html||g())return;const se=r.fromRevision(q);se?.attributes&&d(se.attributes),s(r.markAppearanceNeedsUpdate());const ue=b?.get().version;c(q.html,{undoable:!0}),b&&b.get().version===ue&&b.markUnsaved()},[c,s,d,b,g]),C=(0,a.useCallback)(q=>{Em(b,q),s(r.markAppearanceNeedsUpdate())},[b,s]),{data:oe}=r.projectsApi.useGetProjectQuery(Number(n),{skip:!n}),[ne,ge]=(0,a.useState)([]);(0,a.useEffect)(()=>{if(oe){const{owner:q,admins:se,users:ue}=oe?.members;ge([q&&{...q},se&&Array.isArray(se)&&se.map(Se=>({...Se})),ue&&Array.isArray(ue)&&ue.map(Se=>({...Se}))].filter(Se=>Se).flat(1).map(Se=>({id:Se.ID,display_name:Se.display_name})))}},[oe,oe?.members,i]);const[ye,te]=(0,a.useState)(1),[pe,we]=(0,a.useState)(!1);(0,a.useEffect)(()=>{const q=Array.isArray(_)&&_.length&&_?.map(se=>Ma(se,i));P(q||[]),I(q),E(!1),R||we(!0)},[_,R,i]);const me=()=>{$(!0),P(H.concat([...new Array(3)].map(()=>({loading:!0})))),h(e.id,ye+1).then(q=>{if(q.isStale)return;const{data:se,hasMore:ue}=q.data,Se=Array.isArray(se)&&se?.map(Oe=>Ma(Oe,i)),Ee=H.concat(Se);P(Ee),I(Ee),$(!1),window.dispatchEvent(new Event("resize")),ue||we(!0),te(ye+1)})},Me=!N&&!v&&!pe?(0,o.jsx)("div",{style:{textAlign:"center",marginTop:24,marginBottom:24,height:32,lineHeight:"32px"},children:(0,o.jsx)(t.ui_kit$Button,{onClick:me,children:i("loading more")})}):null,[Le,ve]=(0,a.useState)(),[re,ie]=(0,a.useState)(null),ee=(0,a.useCallback)(q=>{le(q),ve(null),ie(null),l({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),s(r.resetToLastActiveSettingsTab())},[le,l,s]),Q=(0,a.useCallback)((q,se)=>ue=>{const Se=k.current;Se[se]+=1,se==="apply"&&(Se.preview+=1);const Ee=Se[se],Oe=()=>Ee===k.current[se];if(ue?.html||!ue?.id){q(ue);return}p(e.id,ue).then(X=>{Oe()&&q(X)},X=>{Oe()&&(ve(null),B.error({message:i("Failed to load"),innerException:X}))})},[p,e.id,B,i]),K=Q(ee,"apply"),Z=Q(C,"preview"),G=({author:q,authorName:se})=>{if(Y.revisionService)return se||q||"–";const ue=ne.find(Ee=>Ee.id?.toString()===q?.toString())?.display_name;if(ue)return ue;const Se=r.authorFromMembers(q,x);return Se?xm(Se).display_name||Se.email||"–":se||"–"},U=(0,a.useRef)(void 0);(0,a.useEffect)(()=>{!j&&!re&&(U.current=b,ie(Bm(b)))},[j,ie,b,re]),(0,a.useEffect)(()=>{j&&(k.current.preview+=1),j&&re&&(U.current===b&&(Fa(b,re),s(r.markAppearanceNeedsUpdate())),ie(null))},[j,re,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:Me,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:(q,se)=>(0,o.jsx)(t.ui_kit$List.Item,{onClick:()=>{se!==Le&&(ve(se),Z(H[se])),s(r.setBlockSettingsDisable(!0))},className:(0,ze.default)("history-panel__item",{"history-panel__item_active":se===Le}),children:(0,o.jsxs)(t.ui_kit$Skeleton,{title:!1,loading:q.loading||!1,active:!0,children:[(0,o.jsx)("div",{className:"history-panel__list-date",children:q.date}),(0,o.jsx)("div",{className:"history-panel__list-author",children:G(q)}),q.isAutosave&&Le!==se&&(0,o.jsx)("div",{style:{opacity:.45},className:"history-panel__list-autosave",children:i("Auto")}),!q.isAutosave&&(0,o.jsx)(t.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",disabled:m,onClick:ue=>{Le===se&&ue.stopPropagation(),K(H[se])},children:i("Set")}),q.isAutosave&&Le===se&&(0,o.jsx)(t.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",disabled:m,onClick:ue=>{Le===se&&ue.stopPropagation(),K(H[se])},children:i("Set")})]})})})}]}),(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"ant-modal-close","aria-label":"Close",onClick:()=>{s(r.resetToLastActiveSettingsTab()),re&&Fa(b,re),ie(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 v=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:v,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,v]=r.useAddTermMutation(),[$,H]=r.useEditProjectMutation(),I=r.useSendPostMessage(),L=(0,a.useCallback)((te,pe)=>{I({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:te,...pe?{emBlockVersion:pe}:{}}})},[I]),P=(0,a.useCallback)(()=>{I({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_CLEAR_EM_BLOCK_ID})},[I]),{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 pe=[];for(let we in te)pe.push({label:d(r.TYPES_TRANSLATE[te[we]]),value:te[we]});b(pe)}},[B,d]);const le=()=>{c(r.closeModal())},C=(0,a.useRef)(!1),oe=(0,a.useCallback)(()=>{C.current&&(C.current=!1,m.resetFields())},[m]),ne=()=>{C.current=!0,le()};(0,a.useLayoutEffect)(()=>{e&&oe()},[e,oe]);const ge=()=>{s(!0),n(!1),le()},ye=async()=>{await Sm({form:m,projectData:N,projectTagsArray:z||[],projectId:l,addBlock:_,editBlock:p,editProject:$,addTerm:E,notification:k,__:d,handleCloseModal:ne,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:oe,onOk:()=>ge(),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:ge,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:ye,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:ye,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||v.isLoading||H.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||v.isLoading||H.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||v.isLoading||H.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||v.isLoading||H.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 vm=(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 Im(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}=vm(e.html,i),m=Im(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,v)=>{B(!0);try{if(!N)return;const $=await Da({blockTags:v,projectTagsArray:x||[],addTerm:i,project:e,notification:d});let H=!0,I=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{H=!1,I++}if(H&&d.success({id:"BULK_SAVE_SUCCESS",title:c("All blocks saved successfully."),placement:"bottomRight"}),!H){if(I===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(),[v]=r.useEditProjectMutation(),[$,H]=r.useAddBlockMutation(),I=r.useEditorLocale()||void 0,L=Cm(i),P=Om(L).map(ye=>ye),z=P.length,le=r.useNotification(),C=()=>{h||ne||l(!1)},{bulkSave:oe,confirmSavingBlocksLoading:ne}=Fm({projectData:b,addTerm:E,addBlock:$,editProject:v,reloadBlockScreens:Va,notification:le,__:d,handleCloseModal:C,setTriggerOpenSavedBlocksTab:s,setTagsOptions:j,form:B,projectId:n}),ge=async()=>{try{const{valid:ye,values:te,blockTags:pe}=await Ha({form:B,notification:le,__:d});s(!1),p(!0);const we=await jm(i,I,N,P,g),me=r.wpProjectId(i.project,n??b?.id),Me=Pm(we,N.current,String(me??""));p(!1),await oe(Me,ye,te,pe)}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:ge,onCancel:C,footer:(0,o.jsx)("div",{className:"modal-footer",children:!(h||ne)&&(0,o.jsx)(t.ui_kit$Button,{size:"large",type:"primary",disabled:h||ne,onClick:ge,children:m(c("Save %d block","Save %d blocks",z),z)},"submit")}),children:[h||ne?(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||ne)&&_&&(0,o.jsx)(t.ui_kit$Form,{form:B,name:"add_all_blocks_form",layout:"vertical",onFinish:ge,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:H.isLoading,options:R})})}),(ne||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(),[v]=r.usePutProjectTestRecipientsMutation(),$=r.useProjectData(),{testEmails:H}=r.useAppConfig(),I=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(pe=>pe===!1)?n(r.closeModal$1()):B(e)}):B(e)},[e,n,B,i,C]),(0,a.useEffect)(()=>{},[$,x,j]),(0,a.useEffect)(()=>{P(H.map(te=>({value:te})))},[H]),(0,a.useEffect)(()=>{const te=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails);if(te&&p&&s.getFieldValue("recipients")?.length===0){const pe=JSON.parse(te);pe?.[x]&&s.setFieldsValue({recipients:pe[x]})}},[x,p,s]),(0,a.useEffect)(()=>{s.setFieldsValue({subject:i.subject})},[s,i.subject]);const oe=()=>{n(r.closeModal$1()),s.resetFields()},ne=r.useContentReader(),ge=()=>{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(ne())};b(te).unwrap().catch(pe=>{c.error({error:{data:{code:pe?.data?.code,message:pe?.data?.message}}})}),le(!0),I({event:"submit",action:"send_test_email",entity_id:d,project_id:x,recipients_count:s.getFieldValue("recipients").length})}).catch(te=>{})},ye=a.default.useRef(g);return ye.current=g,(0,a.useEffect)(()=>{const te=ye.current;if(_.isSuccess&&z){_.data?.status;{const pe=[...new Set([...L.map(re=>re.value),...s.getFieldValue("recipients")])],we=pe.map(re=>({projects_test_email:re}));((re,ie)=>{if(!re||!ie)return re===ie;if(re.length!==ie.length)return!1;const ee=re.map(K=>K.projects_test_email).sort(),Q=ie.map(K=>K.projects_test_email).sort();return ee.every((K,Z)=>K===Q[Z])})(we,r.isProjectsV2Enabled()?(j||[]).map(re=>({projects_test_email:re})):te)||(r.isProjectsV2Enabled()?v({projectId:x,emails:pe}):N({projectId:x,projects_test_emails:we}));const Me=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({...Me,[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,v,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:oe,footer:[(0,o.jsx)(t.ui_kit$Button,{size:"large",className:"em-analytics__email-send-test",type:"primary",htmlType:"submit",form:"Send mail",loading: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:ge,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,pe)=>pe.length>10?Promise.reject(new Error(l("A test email can be sent to a maximum of 10 addresses."))):pe.length!==0?pe.every(we=>r.emailValidation.test(we.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:pe,closable:we,onClose:me}=te,Me=Le=>{Le.preventDefault(),Le.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:h.colorPrimary,onMouseDown:Me,closable:we,onClose:me,style:{borderRadius:6},children:pe})},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:()=>vr.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=vr.SaveBlockBtn,Bo.SelectedElementPanel=pt,Bo.SendTestEmailModal=Tr,Bo.getImageDimensionsFromBlob=Ir,Object.defineProperty(Bo,"panels_exports",{enumerable:!0,get:function(){return Mm}}),Bo.resolveDataProviderPreview=Cr,Bo.shouldCountAiUsage=pr,Bo.useImageBlobFetch=Pr});