useblocks 1.3.11-dev.3 → 1.3.16

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 (110) hide show
  1. package/CHANGELOG.md +50 -1
  2. package/README.md +1 -1
  3. package/compat-globals.js +1 -1
  4. package/iframe/.vite/manifest.json +4 -4
  5. package/iframe/css/sandbox-dark.css +1 -1
  6. package/iframe/css/sandbox-light.css +1 -1
  7. package/iframe/css/sandbox.css +47 -17
  8. package/iframe/{iframe-eblock.5751e42b.html → iframe-eblock.7594857d.html} +2 -2
  9. package/iframe/{iframe.5751e42b.html → iframe.7594857d.html} +2 -2
  10. package/iframe/js/elMarkupHelper.CsLyPjC1.js +278 -0
  11. package/iframe/js/{iframe-eblock.body.5751e42b.js → iframe-eblock.body.7594857d.js} +1 -1
  12. package/iframe/js/iframe-eblock.js +2 -2
  13. package/iframe/js/iframe.body.7594857d.js +129 -0
  14. package/iframe/js/iframe.js +2 -2
  15. package/package.json +1 -1
  16. package/runtime/react/index.js +1 -1
  17. package/static/core/{5da33486.js → 16612c9f.js} +1 -1
  18. package/static/core/{516f59e7.js → 1e160f23.js} +1 -1
  19. package/static/core/{b5da36e5.js → 23e22cd2.js} +1 -1
  20. package/static/core/25562e5d.js +1 -0
  21. package/static/core/2633e871.js +1 -0
  22. package/static/core/{ef035f6b.js → 2740933f.js} +3 -3
  23. package/static/core/{f1b8515a.js → 2a8b14c0.js} +1 -1
  24. package/static/core/{66113a18.js → 2ae78ac6.js} +1 -1
  25. package/static/core/{3b65bc50.js → 31e587ab.js} +1 -1
  26. package/static/core/3454ca99.js +1 -0
  27. package/static/core/36071466.js +2 -0
  28. package/static/core/{e037a420.js → 3cd95e0a.js} +1 -1
  29. package/static/core/{94f9492b.js → 3e1acefc.js} +1 -1
  30. package/static/core/3e80379e.js +4 -0
  31. package/static/core/{b55ae539.js → 3f3feb86.js} +1 -1
  32. package/static/core/{3d8e2478.js → 4adb5ee9.js} +7 -7
  33. package/static/core/4e07805d.js +19 -0
  34. package/static/core/{c13b3d4f.js → 4f8847e6.js} +1 -1
  35. package/static/core/519dfcc7.js +4 -0
  36. package/static/core/{a6303cb2.js → 53c22855.js} +1 -1
  37. package/static/core/{6172f09a.js → 552f7d30.js} +2 -2
  38. package/static/core/{e698ec22.js → 5de3cd2c.js} +1 -1
  39. package/static/core/{76543cb2.js → 66853555.js} +1 -1
  40. package/static/core/{b1edf5c5.js → 69688fad.js} +6 -6
  41. package/static/core/713de1e1.js +1 -0
  42. package/static/core/{d343e46e.js → 7ae6cf52.js} +7 -7
  43. package/static/core/{bda2d9d5.js → 80907514.js} +1 -1
  44. package/static/core/{513e36bd.js → 86f73ee9.js} +1 -1
  45. package/static/core/{aee84e3d.js → 8b9a4f49.js} +1 -1
  46. package/static/core/9348ac64.js +1 -0
  47. package/static/core/9da6c313.js +1 -0
  48. package/static/core/{62855b97.js → a004861a.js} +1 -1
  49. package/static/core/aeec5659.js +1 -0
  50. package/static/core/b492a9b0.js +93 -0
  51. package/static/core/{11009bdf.js → b6418818.js} +1 -1
  52. package/static/core/{467344d4.js → beebdf4d.js} +1 -1
  53. package/static/core/c03fc17e.js +7 -0
  54. package/static/core/c3344bbc.js +1 -0
  55. package/static/core/{8406bab5.js → c3544cf4.js} +1 -1
  56. package/static/core/{e7e888c1.js → cc4458d8.js} +1 -1
  57. package/static/core/{58dca22f.js → d551e71d.js} +1 -1
  58. package/static/core/{f8585ce6.js → d5be6857.js} +1 -1
  59. package/static/core/{347b0a0b.js → d6c7eb44.js} +1 -1
  60. package/static/core/d9ff5568.js +1 -0
  61. package/static/core/{257745eb.js → e2710fd3.js} +1 -1
  62. package/static/core/{71727873.js → e7c7173a.js} +3 -3
  63. package/static/core/{1c06cdb7.js → e81b521f.js} +3 -3
  64. package/static/core/{d2cf6b4b.js → e94e24b5.js} +1 -1
  65. package/static/core/{1c7a6d45.js → e98b0c61.js} +2 -2
  66. package/static/core/{7e329493.js → ec079650.js} +1 -1
  67. package/static/core/ecc4d431.js +1 -0
  68. package/static/core/f0f20c47.js +1 -0
  69. package/static/core/{d9d5b376.js → f5d42c73.js} +1 -1
  70. package/static/core/{ff7d14e8.js → f674f125.js} +1 -1
  71. package/static/core/{3eeb4445.js → f97efb0a.js} +1 -1
  72. package/static/core/{261a3a42.js → ff0af9ff.js} +1 -1
  73. package/static/esm/1d0ba521.js +1 -0
  74. package/static/esm/delivery-libs.js +1 -1
  75. package/static/umd-runtime/{Cvm7BS4_.js → CyULsN57.js} +31 -31
  76. package/static/umd-runtime/DdK5piwW.js +1 -0
  77. package/static/umd-runtime/delivery-libs.BJHA1QD4.js +1 -0
  78. package/static/umd-runtime/runtime.8gUPr0nE.js +1 -0
  79. package/static/umd-runtime/{ui-kit.CoVNet0I.js → ui-kit.BZ4Y4jr2.js} +2 -2
  80. package/useblocks-core.7594857d.js +875 -0
  81. package/useblocks-esm.js +12 -12
  82. package/{useblocks-po.5751e42b.js → useblocks-po.7594857d.js} +1 -1
  83. package/useblocks.d.ts +1 -1
  84. package/useblocks.js +13 -13
  85. package/vendor/useblocks-ui-kit/es/components/Custom/FormBackgroundSettings/index.js +3 -3
  86. package/vendor/useblocks-ui-kit/es/components/Custom/FormBorderRadiusInputs/index.js +6 -6
  87. package/vendor/useblocks-ui-kit/es/components/Custom/FormBoxShadowInputs/index.js +5 -5
  88. package/vendor/useblocks-ui-kit/es/components/Custom/FormPanel/FormPaddingInputs/index.js +69 -64
  89. package/vendor/useblocks-ui-kit/es/components/Custom/FormPanel/FormSizeInputs/index.js +5 -5
  90. package/vendor/useblocks-ui-kit/es/components/Custom/FormPanel/FormTypographyFields/index.js +5 -5
  91. package/vendor/useblocks-ui-kit/es/components/Custom/Inputs/DraggableInputNumber/index.js +41 -35
  92. package/vendor/useblocks-ui-kit/es/components/Layout/Splitter/index.js +5 -0
  93. package/vendor/useblocks-ui-kit/index.js +12 -11
  94. package/vendor/useblocks-ui-kit/package.json +1 -1
  95. package/iframe/js/elMarkupHelper.BpDXO-hq.js +0 -279
  96. package/iframe/js/iframe.body.5751e42b.js +0 -129
  97. package/static/core/11dadbc0.js +0 -1
  98. package/static/core/1c3a16fc.js +0 -1
  99. package/static/core/2bed6a18.js +0 -7
  100. package/static/core/8845436d.js +0 -4
  101. package/static/core/b59c63d2.js +0 -1
  102. package/static/core/b9f553d7.js +0 -93
  103. package/static/core/c0a3f7d0.js +0 -4
  104. package/static/core/dd008ec2.js +0 -2
  105. package/static/core/ed65b5c3.js +0 -19
  106. package/static/esm/c5372168.js +0 -1
  107. package/static/umd-runtime/B7h7P1Np.js +0 -1
  108. package/static/umd-runtime/delivery-libs.BymXnePv.js +0 -1
  109. package/static/umd-runtime/runtime.Lgfb59e0.js +0 -1
  110. package/useblocks-core.5751e42b.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/50b377c7.js",["require","exports","module","static/core/2ff39ddf.js","static/core/3fb28e82.js","static/core/523ea2ec.js","react","react/jsx-runtime","__delivery__/libs","classnames"],function(B,I,De){const J=B("./2ff39ddf.js"),r=B("./3fb28e82.js"),u=B("./523ea2ec.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]),F=(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:F,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 ve=()=>{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}),[]),F=(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:F,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`,Fe="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:Fe,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}),[]),F=(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:F,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})]})},v={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===v.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===v.PHONE&&(0,e.jsx)(i.ui_kit$FormSwitchRow,{name:"countryCodeSelector",label:t("Country selector (flag+code)")}),l===v.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===v.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:v.TEXT,label:t("Text")},{value:v.EMAIL,label:t("Email")},{value:v.PHONE,label:t("Phone number")},{value:v.NAME,label:t("Name")},{value:v.URL,label:t("URL")},{value:v.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}),[]),F=(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:F,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}),[]),F=(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:F,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=ve,I.FormEditorDropdownListPanel=Ce,I.FormEditorInputPanel=Le,I.FormEditorRadioPanel=Pe});
3
+
4
+ __useblocks__.define("static/core/523ea2ec.js",["require","exports","module","static/core/2ff39ddf.js","static/core/3fb28e82.js","react","react/jsx-runtime","__delivery__/libs"],function(t,e,S){const i=t("./2ff39ddf.js"),o=t("./3fb28e82.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/88cd6d99.js",["require","exports","module","static/core/2ff39ddf.js","static/core/3fb28e82.js","static/core/b6bccb63.js","vite/preload-helper"],function(h,I,B){const R=h("./2ff39ddf.js"),n=h("./3fb28e82.js"),p=h("./b6bccb63.js");let b=h("vite/preload-helper");var D=R.__exportAll({IMPORT_UPLOAD_CONCURRENCY:()=>15,createDocumentProcessor:()=>T,createFileProcessor:()=>W,createImportFileNamer:()=>_,ensureFileExtension:()=>$,extractUploadResult:()=>F,fetchFileData:()=>U,getExt:()=>C,handleUploadResult:()=>j,importEmail:()=>H,importHtml:()=>x,importZip:()=>P,splitFileName:()=>L,uploadFile:()=>n.uploadFile});function C(e){const t=e.split(".");return t[t.length-1].toLowerCase()}function L(e){const t=e.split(".");return t[t.length-1].toLowerCase()}var w="index.html";function M(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 a=r.toLowerCase(),i=e.get(a);if(i===void 0)return e.set(a,t),r;if(i===t)return r;const s=r.lastIndexOf("."),l=`-${M(t)}`;return s>0?`${r.slice(0,s)}${l}${r.slice(s)}`:`${r}${l}`}}function E(e,t){return e.find(r=>r.toLowerCase().endsWith(t))}async function P(e,t,r){const a=await n.readZip(e),i=Object.keys(a),s=a[w]&&w||E(i,w)||E(i,".html")||E(i,".htm");if(s){const l=s.split("/"),d=document.location.pathname.split("/"),u=document.location.origin+d.slice(0,d.length-l.length).join("/")+"/",f=n.zipEntryToText(a[s]),{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=a[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:a,hasBrowserExtensionArtifacts:i}=n.prepareEmailHtmlForEditor(e),s=_();return{html:await p.changeHtml(a,async l=>{const d=l.document;await p.replaceImagesInDocument(d,async u=>(u=u.replace("\\","/"),t(u,s(u,p.getFileNameWithExt(u))))),r&&r(l)}),hasBrowserExtensionArtifacts:i,sourceHtml:e}}async function H(e,t,r){if(e)switch(C(e.name)){case"zip":return P(e,t,r);case"eml":{const a=await e.arrayBuffer(),{default:i}=await(0,b.__vitePreload)(async()=>{const{default:l}=await Promise.resolve().then(()=>h("./6561b34a.js"));return{default:l}},void 0,{}.url),s=(await i.parse(a)).html??void 0;if(typeof s>"u")throw new Error("Eml does not contain text/html");return x(s,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=[],a=()=>{t--,r.shift()?.()};return async i=>{t>=e&&await new Promise(s=>r.push(s)),t++;try{return await i()}finally{a()}}}var W=(e,t,r,a,i)=>{const{maxSizeMB:s,maxWidthOrHeight:l}=n.resolveImageCompressionLimits(i),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:s,maxWidthOrHeight:l,mimeType:y||m.type,fileName:c.name,libURL:d,enableCompression:n.shouldEnableImageCompression(i,y),convertSvgToPng:!0,recompressWithinLimits:i?.recompressWithinLimits})}catch{}}return j(await t({user_id:r.id,folder:a.id,file:c}),f)}catch{return typeof f=="string"?f:""}})},T=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 D}})});
7
+
8
+ (function(){try{if(typeof document<"u"){var t='.blocks-app .upload-bg-image{margin-bottom:calc(var(--ub-formItemMarginBottomXS) * 1px)}.blocks-app .upload-bg-image__inner-wrap{border:calc(var(--ub-borderWidth) * 1px) solid var(--ub-colorFillSecondaryDarken);border-radius:calc(var(--ub-borderRadius) * 1px);cursor:pointer;background-color:var(--ub-colorBgContainer);justify-content:space-between;align-items:center;transition:all .2s linear .2s;display:flex}.blocks-app .upload-bg-image__inner-wrap:hover{border-color:var(--ub-borderColorHover)}.blocks-app .upload-bg-image__uploader{width:calc((var(--ub-formControlHeight) - var(--ub-borderWidth) * 2 + 1) * 1px);height:calc((var(--ub-formControlHeight) - var(--ub-borderWidth) * 2) * 1px);border-radius:calc(var(--ub-borderRadius) * .8px);border:none;border-right:1px solid var(--ub-colorFillSecondaryDarken);flex-shrink:0;margin-right:10px;overflow:hidden}.blocks-app .upload-bg-image__uploader-content{background:0 0;flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%;font-size:11px;display:flex}.blocks-app .upload-bg-image__uploader-content-inner{width:inherit;height:inherit;position:relative}.blocks-app .upload-bg-image__uploader-img-wrap{width:inherit;height:inherit;z-index:1;border:none;position:absolute;overflow:hidden}.blocks-app .upload-bg-image__uploader-img-wrap:after{opacity:0;content:"";transition:opacity .3s;position:absolute;inset:0}.blocks-app .upload-bg-image__uploader-content:hover .upload-bg-image__uploader-img-wrap:after{opacity:1}.blocks-app .upload-bg-image .upload-bg-image__empty{border-top:2px solid var(--ub-colorError);z-index:2;width:27px;position:absolute;top:16px;left:3px;transform:rotate(-45deg)}.blocks-app .upload-bg-image .inputGroup{flex-direction:column;width:100%;display:flex}.blocks-app .upload-bg-image .image-size{color:var(--ub-colorTextTertiary);padding-right:15px;font-size:12px}.blocks-app .upload-bg-image .image-empty-text,.blocks-app .upload-bg-image .image-size-splitter{color:var(--ub-colorTextQuaternary)}.blocks-app .upload-bg-image__edit,.blocks-app .upload-bg-image__edit-menu{color:var(--ub-colorLink);right:calc((var(--ub-borderWidth) + 2) * 1px);padding:6px;line-height:1;position:absolute}.blocks-app .upload-bg-image__edit{right:calc((var(--ub-borderWidth) + 32) * 1px);position:absolute}.blocks-app .upload-bg-image__uploader-icons-wrap{z-index:2;width:inherit;height:inherit;opacity:1;cursor:pointer;justify-content:center;align-items:center;transition:opacity .3s;display:flex;position:relative}.blocks-app .upload-bg-image__uploader-content:hover .upload-bg-image__uploader-icons-wrap{opacity:.85}.blocks-app .upload-bg-image__uploader-icons-wrap-upload{z-index:1;width:inherit;height:inherit;opacity:.8;cursor:pointer;justify-content:center;align-items:center;transition:opacity .3s;display:flex;position:relative}.blocks-app .upload-bg-image__uploader-content:hover .upload-bg-image__uploader-icons-wrap-upload{opacity:.85}.blocks-app .upload-bg-image__uploader-icons-wrap-upload .upload-bg-image__uploader-content:empty{background-color:var(--ub-colorFillSecondary);border-radius:calc(var(--ub-borderRadius) * 1px)}.blocks-app .upload-bg-image__uploader-link,.blocks-app .upload-bg-image__uploader-link:hover{color:#fff}.blocks-app .upload-bg-image__uploader-icon{color:#fff;margin:0 3px;font-size:14px}.blocks-app .upload-bg-image__uploader-img{object-fit:cover;width:100%;height:100%;display:block!important}.blocks-app .upload-bg-image__uploader-img-placeholder{width:100%;height:100%;display:block}.blocks-app .upload-bg-image__uploader-icon-btn{cursor:pointer;background:0 0;border:0;margin:0;padding:0}.blocks-app .upload-bg-image__input{border-color:var(--ub-colorFillSecondaryDarken)}.blocks-app .upload-bg-image__uploader .ant-upload-select{cursor:pointer;width:100%;height:100%;display:block}.blocks-app .upload-bg-image__uploader .ant-upload-select .ant-upload{width:100%;height:100%;display:block}.dark .blocks-app .upload-bg-image__uploader{border-right:1px solid var(--ub-colorBorder)}.blocks-app .countdown-color .color-picker-input__picker-holder{z-index:auto;left:auto;right:-10px}.blocks-app .email-pane .box-shadow-control .ant-collapse-panel,.blocks-app .email-pane .border-control .ant-collapse-panel,.blocks-app .box-shadow-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body,.blocks-app .border-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body{overflow:visible}.blocks-app .selected-image-form_busy{position:relative}.blocks-app .selected-image-form__loader{z-index:5;background-color:color-mix(in srgb, var(--ub-colorBgContainer) 60%, transparent);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);box-shadow:28px 0 0 0 color-mix(in srgb, var(--ub-colorBgContainer) 60%, transparent), -28px 0 0 0 color-mix(in srgb, var(--ub-colorBgContainer) 60%, transparent);position:absolute;inset:0}.blocks-app .selected-image-form__loader-body{flex-direction:column;justify-content:center;align-items:center;gap:16px;height:100%;display:flex;position:absolute;top:0;left:0;right:0}.blocks-app .selected-image-form__loader-title{color:var(--ub-colorTextSecondary);text-align:center;padding:0 24px;font-size:13px}.blocks-app .selected-text-common-form__border-radio{position:relative}.blocks-app .selected-text-common-form__border-radio:after{content:"·";border:3px solid var(--ub-colorPrimary);border-radius:50%;font-size:0;line-height:0;position:absolute;top:2px;right:2px}.blocks-app .selected-text-common-form__border-col{margin-top:22px;margin-bottom:10px}@media (width<=1840px){.blocks-app .selected-text-common-form__border-col{margin-top:0}}.blocks-app .selected-text-common-form__border-item.ant-form-item .ant-row{flex-direction:row;align-items:center}.blocks-app .selected-text-common-form__border-item.ant-form-item .ant-row .ant-col.ant-form-item-label{white-space:nowrap;padding-top:6px}.blocks-app .selected-text-common-form__padding-input{max-width:46px;margin-bottom:0}.blocks-app .selected-text-common-form__padding-input input{text-align:center;padding:4px 8px}.blocks-app .selected-text-common-form__padding-input .ant-input-number-focused input{text-align:left}.blocks-app .selected-text-common-form__button--active,.blocks-app .selected-text-common-form__button--active:focus{color:#40a9ff;border-color:#40a9ff}.blocks-app .selected-text-common-form__br-input{margin-bottom:10px}.blocks-app .selected-text-common-form__tooltip{margin-left:4px}.blocks-app .selected-text-common-form__icon-radius{width:16px;height:100%}.blocks-app .selected-text-common-form__block{margin-bottom:24px}.blocks-app .selected-text-common-form__button_style{padding-left:10px;padding-right:10px;transition:none}.blocks-app .selected-text-common-form__format-toolbar{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:4px;display:flex}.blocks-app .selected-text-common-form__format-toolbar .ant-form-item{margin-bottom:0}.blocks-app .ant-app .bullet-type .ant-select-selector{padding-left:5px}.blocks-app .selected_text_common_form_mobile .ant-form-item{margin:0}.blocks-app .selected_text_common_form_mobile .ant-input-number-affix-wrapper{padding-inline-start:7px}.blocks-app .selected_text_common_form_mobile .ant-select-single:not(.ant-select-customize-input) .ant-select-selector,.blocks-app .selected_text_common_form_mobile .ant-input-number-group .ant-input-number-group-addon{padding:0 7px}.blocks-app .selected_text_common_form_mobile .ant-input-number .ant-input-number-handler-wrap{width:16px}.blocks-app .selected_text_common_form_mobile .ant-select .ant-select-arrow{inset-inline-end:7px;font-size:10px!important}.blocks-app .selected_text_common_form_mobile .ant-divider-vertical{height:46px;top:0}.blocks-app .selected_text_common_form_mobile .selected_text_common_form_mobile__group{padding:6px 0}.blocks-app .selected_text_common_form_mobile .selected-td-form__button{background:var(--ub-colorFillSecondary);width:34px;height:34px;border:1px solid #0000!important}.blocks-app .selected_text_common_form_mobile .ant-btn-default:not(:disabled,.ant-btn-disabled,.email-pane__content-col .selected-td-form__button--active):hover{background:var(--ub-colorFillSecondaryDarken);color:inherit;border-color:#0000}.blocks-app .selected_text_common_form_mobile .selected-td-form__button--active{background:var(--ub-colorPrimaryBg);color:var(--ub-colorPrimary);border-color:#0000}.blocks-app .selected_text_common_form_mobile .selected-td-form__button--active:hover{background:var(--ub-colorPrimaryBgHover)!important;color:var(--ub-colorPrimaryTextHover)!important}.blocks-app .selected_text_common_form_mobile .color-picker-input{width:34px;height:34px}.blocks-app .selected_text_common_form_mobile .color-picker-input .ant-input-affix-wrapper{display:none}.blocks-app .selected_text_common_form_mobile .color-picker-input__control-wrap .ant-color-picker-trigger{border:1px solid var(--ub-colorFillSecondaryDarken);width:34px;height:34px;top:0;left:0}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper{background:var(--ub-colorFillSecondary);height:34px;padding:0 9px;border:1px solid #0000!important}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper:not(.ant-radio-button-wrapper-checked):hover{color:inherit;background:var(--ub-colorFillSecondaryDarken)}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper.ant-radio-button-wrapper-checked{background:var(--ub-colorPrimaryBg);color:var(--ub-colorPrimary)}.blocks-app .selected_text_common_form_mobile .ant-radio-button-wrapper.ant-radio-button-wrapper-checked:hover{background:var(--ub-colorPrimaryBgHover);color:var(--ub-colorPrimaryTextHover)}.blocks-app .selected_text_common_form_mobile .codemode-textalign-dropdown{background-color:var(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadius) * 1px);box-shadow:var(--ub-boxShadowSecondary);padding:6px}.blocks-app .mobile-background-image-field .upload-bg-image{margin-bottom:0}.blocks-app .selected_element_vindent_values{font-size:12px}.blocks-app .selected_element_vindent_values span{cursor:pointer;margin-right:10px}.blocks-app .selected_element_vindent_values span:hover{color:#40a9ff}.blocks-app .selected-td-form__mobile-width-hint{color:var(--ub-colorTextSecondary);margin-bottom:15px;font-size:12px;line-height:18px}.blocks-app .selected-td-form__border-side-wrapper{display:inline-flex;position:relative}.blocks-app .selected-td-form__border-side-wrapper label{border-radius:calc(var(--ub-borderRadius) * 1px)}.blocks-app .selected-td-form__border-side-wrapper:hover .selected-td-form__border-side-clear{opacity:1}.blocks-app .selected-td-form__border-side-clear{z-index:1;opacity:0;cursor:pointer;color:var(--ub-colorTextSecondary);background-color:var(--ub-colorBgLayout);border-radius:50%;width:20px;height:20px;transition:opacity .15s;position:absolute;top:-6px;right:-4px}.blocks-app .selected-td-form__border-side-clear:hover{color:var(--ub-colorError)}.blocks-app .selected-td-form__border-radio:after{content:"·";border:3px solid var(--ub-colorPrimary);border-radius:50%;font-size:0;line-height:0;position:absolute;top:2px;right:2px}@media (width<=1840px){.blocks-app .selected-td-form__border-col{margin-top:0}}.blocks-app .selected-td-form__border-item.ant-form-item .ant-row{flex-direction:row;align-items:center}.blocks-app .selected-td-form__border-item.ant-form-item .ant-row .ant-col.ant-form-item-label{white-space:nowrap;padding-top:6px}.blocks-app .selected-td-form__padding-input input{text-align:center;padding:4px 8px}.blocks-app .selected-td-form__padding-input .ant-input-number-focused input{text-align:left}.blocks-app .selected-td-form__button--active,.blocks-app .selected-td-form__button--active:focus{color:#40a9ff;border-color:#40a9ff}.blocks-app .selected-td-form__tooltip{margin-left:4px}.blocks-app .selected-td-form__icon-radius{flex-shrink:0;justify-content:center;align-items:center;width:16px;height:16px;display:inline-flex}.blocks-app .selected-td-form__button_style{padding-left:10px;padding-right:10px;transition:none}.blocks-app .selected-td-form__border-radio{position:relative}.blocks-app .selected-td-form__border-radio:after{content:"·";border:3px solid var(--ub-colorPrimary);border-radius:50%;font-size:0;line-height:0;position:absolute;top:2px;left:2px;right:auto}.blocks-app .selected-td-form__border-col{margin-top:0;margin-bottom:0}@media (width<=1840px){.blocks-app .selected-td-form__border-col{margin-top:0}}.blocks-app .selected-td-form__border-item.ant-form-item .ant-col.ant-form-item-label{white-space:nowrap;padding-top:6px}.blocks-app .selected-td-form__padding-input{max-width:50px;margin-bottom:0}.blocks-app .selected-td-form__padding-input input{padding:4px 8px}.blocks-app .selected-td-form__br-input{margin-bottom:10px}.blocks-app .selected-td-form__tooltip{vertical-align:baseline;margin-left:4px}.blocks-app .selected-td-form__icon-radius{width:16px;height:100%}.blocks-app .selected-td-form__block{margin-bottom:24px}.blocks-app .carousel__slide{background-color:var(--ub-colorFillQuaternary);border-radius:calc(var(--ub-borderRadius) * 1px);margin-bottom:calc(var(--ub-formItemMarginBottomXS) * 1px);border:calc(var(--ub-borderWidth) * 1px) solid var(--ub-colorFillSecondaryDarken);padding:10px}.blocks-app .email-pane .box-shadow-control .ant-collapse-panel,.blocks-app .email-pane .border-control .ant-collapse-panel,.blocks-app .box-shadow-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body,.blocks-app .border-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body{overflow:visible}.blocks-app .selected-image-form__add-title{margin-top:-15px;margin-bottom:30px}.blocks-app .selected-image-form__add-title span{cursor:pointer}.blocks-app .selected-image-form__add-title span:hover{color:#40a9ff}.blocks-app .email-pane .box-shadow-control .ant-collapse-panel,.blocks-app .email-pane .border-control .ant-collapse-panel,.blocks-app .box-shadow-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body,.blocks-app .border-control.ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body{overflow:visible}.blocks-app .selected-social-form{box-sizing:border-box;min-width:0;padding:0 0 16px}.blocks-app .selected-social-form .selected-social-form__form{padding:0 0 8px}.blocks-app .selected-social-form .selected-social-form__align-block{margin-bottom:16px}.blocks-app .selected-social-form .selected-social-form__align-block .ant-form-item,.blocks-app .selected-social-form .selected-social-form__section{margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__section--bordered{border-top:1px solid var(--ub-colorBorderSecondary,#f0f0f0);margin-top:16px;padding-top:16px}.blocks-app .selected-social-form .selected-social-form__section-title{color:var(--ub-colorText,#000000e0);margin:0 0 16px;font-size:14px;font-weight:400;line-height:1.2}.blocks-app .selected-social-form .selected-social-form__field-row{margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__field-icon{color:var(--ub-colorTextSecondary,#8c8c8c)}.blocks-app .selected-social-form .selected-social-form__input-full{width:100%}.blocks-app .selected-social-form .selected-social-form__items{flex-direction:column;gap:6px;margin-bottom:6px;display:flex}.blocks-app .selected-social-form .selected-social-form__card{border:1px solid var(--ub-colorBorderSecondary,#f0f0f0);background:var(--ub-colorFillTertiary,#f8f8f8);border-radius:6px;padding:12px;transition:border-color .15s,box-shadow .15s,opacity .15s}.blocks-app .selected-social-form .selected-social-form__card--dragging{opacity:.72}.blocks-app .selected-social-form .selected-social-form__card--drag-over{border-color:var(--ub-colorPrimary);box-shadow:0 0 0 1px var(--ub-colorPrimary)}.blocks-app .selected-social-form .selected-social-form__card-head{justify-content:space-between;align-items:center;gap:8px;margin-bottom:12px;display:flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-main{flex:auto;align-items:center;gap:8px;min-width:0;display:flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle{width:24px;height:24px;color:var(--ub-colorTextSecondary,#8c8c8c);cursor:grab;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;margin:0;padding:0;transition:color .15s,background-color .15s;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle:hover{color:var(--ub-colorText,#000000e0);background:var(--ub-colorFillSecondary,#f0f0f0)}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle:active{cursor:grabbing}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle:focus-visible{outline:2px solid var(--ub-colorPrimary);outline-offset:1px}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__drag-handle .anticon{font-size:14px;transform:rotate(90deg)}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn{box-sizing:border-box;aspect-ratio:1;width:24px;min-width:24px;max-width:24px;height:24px;min-height:24px;max-height:24px;color:var(--ub-colorTextSecondary,#8c8c8c);background:0 0;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;padding:0;line-height:1;transition:color .15s,background-color .15s;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn .anticon{justify-content:center;align-items:center;line-height:0;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn svg{width:18px;height:18px;display:block}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn:hover{color:var(--ub-colorText,#000000e0);background:var(--ub-colorFillSecondary,#f0f0f0)}.blocks-app .selected-social-form .selected-social-form__card-head .selected-social-form__card-head-remove.ant-btn:focus-visible{outline:2px solid var(--ub-colorPrimary);outline-offset:1px}.blocks-app .selected-social-form .selected-social-form__card-title{min-width:0;color:var(--ub-colorText,#000000e0);flex:auto;font-size:14px;font-weight:300;line-height:1.2}.blocks-app .selected-social-form .selected-social-form__card-field.ant-row{margin-bottom:8px}.blocks-app .selected-social-form .selected-social-form__card-field.ant-row:last-child{margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__bg-color-row{width:100%;margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__bg-color-row .ant-col .ant-form-item{max-width:none;margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__bg-color-row .ant-form-item-control-input-content,.blocks-app .selected-social-form .selected-social-form__meta-block{width:100%}.blocks-app .selected-social-form .selected-social-form__meta-toggle-row{flex-wrap:wrap;align-items:center;display:flex}.blocks-app .selected-social-form .selected-social-form__meta-fields.is-hidden,.blocks-app .selected-social-form .selected-social-form__card-field.is-hidden{display:none}.blocks-app .selected-social-form .selected-social-form__meta-fields{flex-direction:column;gap:6px;width:100%;display:flex}.blocks-app .selected-social-form .selected-social-form__meta-fields .ant-form-item{margin-bottom:0}.blocks-app .selected-social-form .selected-social-form__meta-fields .ant-form-item-control-input-content{width:100%}.blocks-app .selected-social-form .selected-social-form__platform-row{align-items:flex-start;gap:8px;width:100%;margin-bottom:8px;display:flex}.blocks-app .selected-social-form .selected-social-form__platform-field{flex:auto;min-width:0;margin-bottom:0!important}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn{box-sizing:border-box;width:calc(var(--ub-formControlHeight) * 1px);min-width:calc(var(--ub-formControlHeight) * 1px);max-width:calc(var(--ub-formControlHeight) * 1px);height:calc(var(--ub-formControlHeight) * 1px);min-height:calc(var(--ub-formControlHeight) * 1px);max-height:calc(var(--ub-formControlHeight) * 1px);line-height:calc((var(--ub-formControlHeight) - 2) * 1px);color:var(--ub-colorTextSecondary,#8c8c8c);border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;margin:0;padding:0;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn.ant-btn-icon-only .ant-btn-icon{justify-content:center;align-items:center;width:100%;height:100%;line-height:0;display:inline-flex}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn.ant-btn-icon-only .ant-btn-icon svg{display:block}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn:hover{color:var(--ub-colorText,#000000e0);background:var(--ub-colorFillSecondary,#f0f0f0)}.blocks-app .selected-social-form .selected-social-form__platform-edit.ant-btn:focus-visible{outline:2px solid var(--ub-colorPrimary);outline-offset:1px}.blocks-app .selected-social-form .selected-social-form__platform-select{width:100%}.blocks-app .selected-social-form .selected-social-form__platform-select.ant-select-single .ant-select-selector .ant-select-selection-item{align-self:center;align-items:center;line-height:1.2;display:flex}.blocks-app .selected-social-form .selected-social-form__platform-select .ant-select-arrow{color:var(--ub-colorTextSecondary,#8c8c8c)}.blocks-app .selected-social-form .selected-social-form__platform-select .ant-select-arrow svg{width:16px;height:16px}.blocks-app .selected-social-form .selected-social-form__platform-option{align-items:center;gap:4px;min-width:0;line-height:1.2;display:flex}.blocks-app .selected-social-form .selected-social-form__platform-option img{flex-shrink:0;width:30px;height:30px;margin-left:-6px;display:block}.blocks-app .selected-social-form .selected-social-form__platform-option-text{white-space:nowrap;text-overflow:ellipsis;line-height:1.2;overflow:hidden}.blocks-app .selected-social-form .selected-social-form__add-bar{background:var(--ub-colorFillTertiary,#f8f8f8);height:32px;color:var(--ub-colorText,#000000e0);border-radius:6px;justify-content:center;align-items:center;gap:8px;margin-top:0;padding:8px 12px;font-size:14px;font-weight:300;line-height:1.2;display:flex}.blocks-app .selected-social-form .selected-social-form__add-bar:not(:disabled):hover{background:var(--ub-colorFillSecondary,#f0f0f0);color:var(--ub-colorText,#000000e0)}.blocks-app .selected-social-form__platform-dropdown .ant-select-item-option{align-items:center}.blocks-app .selected-social-form__platform-dropdown .ant-select-item-option-content{align-items:center;min-height:0;line-height:1.2;display:flex}.blocks-app .selected-social-form__platform-dropdown .selected-social-form__platform-option{gap:0}.blocks-app .selected-social-form__platform-dropdown .selected-social-form__platform-option img{width:30px;height:30px;margin-left:-6px}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-suffix{flex-shrink:0;align-items:center;display:inline-flex}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-clear-icon:not(.ant-input-clear-icon-hidden){color:var(--ub-colorTextSecondary,#8c8c8c)}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-clear-icon:not(.ant-input-clear-icon-hidden) .anticon{vertical-align:0;justify-content:center;align-items:center;line-height:0;display:inline-flex}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-clear-icon:not(.ant-input-clear-icon-hidden) svg{width:16px;height:16px;display:block}.blocks-app .selected-social-form .ant-input-affix-wrapper .ant-input-clear-icon:not(.ant-input-clear-icon-hidden):hover{color:var(--ub-colorText,#000000e0)}.blocks-app .ant-app .email-pane__content-col .selected-social-form .ant-form-item.selected-social-form__card-field{margin-bottom:8px}.blocks-app .ant-app .email-pane__content-col .selected-social-form .ant-form-item.selected-social-form__card-field:last-child{margin-bottom:0}.blocks-app .email-pane .selected-social-form form.selected-social-form__form.element-controls,.blocks-app .email-pane .email-pane__collapse-wrapper.mobile-properties .selected-social-form form.selected-social-form__form.element-controls{height:auto;max-height:none}.blocks-app .ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-header{padding:20px 0;font-size:14px}.blocks-app .ant-collapse.hidden-props>.ant-collapse-item>.ant-collapse-panel>.ant-collapse-body{padding-left:0;padding-right:0}.blocks-app .ant-collapse.hidden-props .ant-alert{margin-bottom:24px}.blocks-app .selected_form-mobile-props{padding:24px 14px 0 24px}.blocks-app .email-pane_code-mode:not(.email-pane_code-mode-bottom) .selected-element-panel-content.selected-element-panel__hidden{visibility:hidden;opacity:0;height:0}.blocks-app .email-properties__collapse-panel .selected-element-panel-content{height:100%}.blocks-app .email-pane_code-mode:not(.email-pane_code-mode-bottom) .selected-element-panel-content{width:auto;box-shadow:var(--ub-boxShadowSecondary);border-radius:calc(var(--ub-borderRadius) * 1px);border:none;margin:0;padding:0 6px;transition:opacity .2s;position:absolute;top:-60px;left:50%;transform:translate(-50%)}.blocks-app .em-analytics__email-tab-properties,.blocks-app .em-analytics__email-tab-history{z-index:999;position:absolute}.blocks-app .em-analytics__email-tab-properties .email-pane__collapse-wrapper,.blocks-app .em-analytics__email-tab-history .email-pane__collapse-wrapper{z-index:999;box-shadow:0 1px 2px -2px #00000029,0 3px 6px #0000001f,0 5px 12px 4px #0000000f}.blocks-app .email-pane__col-wrapper_pinch .em-analytics__email-tab-properties .email-pane__collapse-wrapper,.blocks-app .email-pane__col-wrapper_pinch .em-analytics__email-tab-history .email-pane__collapse-wrapper{box-shadow:none}.blocks-app .selected-element-panel{height:100%;overflow:visible}.blocks-app .selected-element-panel button.selected-element-panel__extra-btn,.blocks-app .selected-element-panel__extra-btn button{height:24px;padding:0 7px}.blocks-app .selected-element-panel-content{position:relative}.blocks-app .selected-element-panel-content.column-settings-show_onecol{padding-top:75px}.blocks-app .selected-element-panel__columns-settings{z-index:1;width:100%;position:relative}.blocks-app .selected-element-panel__columns-settings__header{justify-content:space-between;align-items:center;gap:12px;margin-bottom:15px;display:flex}.blocks-app .selected-element-panel__columns-settings__header-title{color:var(--ub-colorText);font-size:14px;line-height:1.5}.blocks-app .selected-element-panel__columns-settings__title{white-space:nowrap;text-overflow:ellipsis;margin-bottom:20px;font-size:16px;font-weight:500;line-height:20px;overflow:hidden}.blocks-app .selected-element-panel__columns-settings__links{white-space:nowrap;justify-content:flex-end;align-items:center;gap:8px;margin-left:auto;font-size:14px;display:flex}.blocks-app .selected-element-panel__columns-settings__links span,.blocks-app .selected-element-panel__columns-settings__links button{align-items:center;gap:4px;display:inline-flex}.blocks-app .selected-element-panel__columns-settings__links span{color:var(--ub-colorLink);cursor:pointer}.blocks-app .selected-element-panel__columns-settings__links span:hover{color:#40a9ff}.blocks-app .selected-element-panel__columns-settings__links button{font:inherit;cursor:pointer;background:0 0;border:none;align-items:center;padding:0;display:inline-flex}.blocks-app .selected-element-panel__columns-settings__links__add{align-items:center;gap:4px;display:inline-flex}.blocks-app .selected-element-panel__columns-settings__links__add.noactive,.blocks-app .selected-element-panel__columns-settings__links__add.noactive span{color:#00000073;cursor:not-allowed}.blocks-app .selected-element-panel__columns-settings__controls{align-items:center;gap:8px;display:flex}.blocks-app .selected-element-panel__columns-settings__controls .ant-splitter{width:100%}.blocks-app .selected-element-panel__columns-settings__controls .ant-splitter-panel{min-width:44px;padding:0 4px;overflow:visible;container-type:inline-size}.blocks-app .selected-element-panel__columns-settings__controls__column{align-items:center;width:100%;min-width:36px;display:flex;position:relative}.blocks-app .selected-element-panel__columns-settings__controls__column:first-child .selected-element-panel__columns-settings__controls__divider{visibility:hidden}.blocks-app .selected-element-panel__columns-settings__controls__column__remove,.blocks-app .selected-element-panel__columns-settings__controls__column__copy,.blocks-app .selected-element-panel__columns-settings__controls__column__swap,.blocks-app .selected-element-panel__columns-settings__controls__column__more{text-align:center;box-sizing:border-box;cursor:pointer;z-index:1;color:#000000d9;background-color:#fff;border:none;border-radius:50%;justify-content:center;align-items:center;width:25px;height:25px;padding:0;font-size:14px;display:none;position:absolute;left:-10px;box-shadow:0 0 7px -2px #00000059}.blocks-app .selected-element-panel__columns-settings__controls__column__remove{top:-11px;left:auto;right:16px}.blocks-app .selected-element-panel__columns-settings__controls__column__copy{color:#000000a6;top:-11px;left:auto;right:46px}.blocks-app .selected-element-panel__columns-settings__controls__column__swap{color:#000000a6;top:-12.5px;left:-16.5px}.blocks-app .selected-element-panel__columns-settings__controls__column__more{color:#000000a6;top:-12.5px;left:50%;transform:translate(-50%)}.blocks-app .selected-element-panel__columns-settings__controls__column__remove:hover,.blocks-app .selected-element-panel__columns-settings__controls__column__copy:hover,.blocks-app .selected-element-panel__columns-settings__controls__column__swap:hover,.blocks-app .selected-element-panel__columns-settings__controls__column__more:hover{box-shadow:0 0 7px -2px #000000b3}.blocks-app .selected-element-panel__columns-settings__controls:hover .selected-element-panel__columns-settings__controls__column__swap,:is(.blocks-app .selected-element-panel__columns-settings__controls__column:hover:not(:has(.selected-element-panel__columns-settings__controls__column__swap:hover)) .selected-element-panel__columns-settings__controls__column__remove,.blocks-app .selected-element-panel__columns-settings__controls__column:hover:not(:has(.selected-element-panel__columns-settings__controls__column__swap:hover)) .selected-element-panel__columns-settings__controls__column__copy){display:flex}@container (width<=140px){:is(.blocks-app .selected-element-panel__columns-settings__controls__column:hover:not(:has(.selected-element-panel__columns-settings__controls__column__swap:hover)) .selected-element-panel__columns-settings__controls__column__remove,.blocks-app .selected-element-panel__columns-settings__controls__column:hover:not(:has(.selected-element-panel__columns-settings__controls__column__swap:hover)) .selected-element-panel__columns-settings__controls__column__copy){display:none}.blocks-app .selected-element-panel__columns-settings__controls__column__more.ant-dropdown-open{display:flex}.blocks-app .selected-element-panel__columns-settings__controls__column:hover:not(:has(.selected-element-panel__columns-settings__controls__column__swap:hover)) .selected-element-panel__columns-settings__controls__column__more{display:flex}}.blocks-app .selected-element-panel__columns-settings__controls__field{text-align:center;border-radius:6px;width:100%;height:45px}.blocks-app .selected-element-panel__columns-settings__controls__field .ant-input-number{background:0 0;border:none;padding:0 4px}.blocks-app .selected-element-panel__columns-settings__controls__field .ant-input-number .ant-input-number-input{text-align:center;height:43px;padding:0}@container (width<=60px){.blocks-app .selected-element-panel__columns-settings__controls__field .ant-input-number-actions{display:none}}.blocks-app .selected-element-panel__columns-settings__controls__divider{cursor:w-resize}.blocks-app .selected-element-panel__columns-settings__divider-wrapper{display:none}.blocks-app .selected-element-panel__columns-settings__mobile{margin-bottom:16px}.blocks-app .selected-element-panel__columns-settings__mobile>.selected-element-panel__columns-settings__links{margin-top:6px;line-height:20px}.blocks-app .selected-element-panel__columns-settings__mobile-column{white-space:nowrap;justify-content:center;align-items:center;display:flex;overflow:hidden}.blocks-app .selected-element-panel .selected-element-panel__columns-settings__divider-wrapper{display:block;position:relative}.blocks-app .selected-element-panel .selected-element-panel__columns-settings__divider{width:calc(100% + 80px);height:20px;margin:24px -40px 0;position:absolute;bottom:-20px}.blocks-app .selected-element-panel__content_abs{border:1px solid var(--ub-colorBorder);z-index:100;background-color:var(--ub-colorBgContainer);border-top:none;border-radius:0 0 8px 8px;width:100%;max-width:1400px;min-height:15px;margin-bottom:15px;transition:all .5s;display:flex;position:sticky;top:0;left:0}.blocks-app .selected-element-panel__mobile-switch{background-color:var(--ub-colorPrimary)}.blocks-app .selected-element-panel__mobile-switch.ant-switch-checked{background-color:var(--ub-colorInfo)}.blocks-app #selected_element_form_desktop_props .ant-alert-info .ant-alert-title{color:var(--ub-colorInfoText)}.blocks-app .ant-app .selected_form-mobile-switch{margin-bottom:20px;font-size:16px;font-weight:500}.blocks-app .ant-app .selected_form-mobile-props{--ub-colorPrimaryBorder:var(--ub-colorInfo);--ub-controlOutline:var(--ub-colorInfoBgHover)}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number:focus,.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-focused,.blocks-app .ant-app .selected_form-mobile-props .ant-input:focus,.blocks-app .ant-app .selected_form-mobile-props .ant-select-focused:not(.ant-select-disabled).ant-select:not(.ant-select-customize-input) .ant-select-selector,.blocks-app .ant-app .selected_form-mobile-props .ant-input-affix-wrapper:focus,.blocks-app .ant-app .selected_form-mobile-props .ant-input-affix-wrapper-focused{border-color:var(--ub-colorInfo);box-shadow:0 0 0 calc(var(--ub-controlOutlineWidth) * 1px) var(--ub-controlOutline)!important}:is(.blocks-app .ant-app .selected_form-mobile-props .ant-input-affix-wrapper>.ant-input:focus,.blocks-app .ant-app .selected_form-mobile-props .ant-space-compact:has(>.ant-input-number):focus-within>.ant-input-number,.blocks-app .ant-app .selected_form-mobile-props .input-select:focus-within .ant-input-affix-wrapper){box-shadow:none!important}.blocks-app .ant-app .selected_form-mobile-props .ant-select:not(.ant-select-disabled):hover .ant-select-selector{border-color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-select-item-option-selected:not(.ant-select-item-option-disabled){background-color:#edd3ed}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within{box-shadow:var(--ub-colorInfoBg) 0 0 0 2px!important}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within .ant-input-number-affix-wrapper:not(:last-child),.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within .ant-input-number-group-addon:last-child,.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within>.ant-input-number:first-child{border-color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group:not(.ant-input-number-wrapper-disabled):focus-within .ant-input-number-affix-wrapper:not(:last-child){border-right-color:var(--ub-colorFillSecondaryDarken)}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group-addon .ant-select-open .ant-select-selector,.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-group-addon .ant-select-focused .ant-select-selector,.blocks-app .ant-app .selected_form-mobile-props .ant-radio-button-wrapper:hover,.blocks-app .ant-app .selected_form-mobile-props .ant-collapse>.ant-collapse-item>.ant-collapse-header:hover{color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-btn-background-ghost.ant-btn-primary{color:var(--ub-colorInfo);border-color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):first-child,.blocks-app .ant-app .selected_form-mobile-props .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled),.blocks-app .ant-app .selected_form-mobile-props .selected-td-form__button--active{background-color:var(--ub-colorInfoBg)!important;color:var(--ub-colorInfoText)!important}.blocks-app .ant-app .selected_form-mobile-props .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):before,.blocks-app .ant-app .selected_form-mobile-props .ant-switch-checked{background-color:var(--ub-colorInfoTextActive)}.blocks-app .ant-app .selected_form-mobile-props .ant-switch.ant-switch-checked:hover:not(.ant-switch-disabled){background-color:var(--ub-colorInfoHover)}.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-action:hover .ant-input-number-action-up-inner,.blocks-app .ant-app .selected_form-mobile-props .ant-input-number-action:hover .ant-input-number-action-down-inner{color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .ant-alert-info{background-color:var(--ub-colorInfoBg);border:none}.blocks-app .ant-app .selected_form-mobile-props .ant-alert-info .ant-alert-title{color:var(--ub-colorInfoText)}.blocks-app .ant-app .selected_form-mobile-props .selected-element-panel__columns-settings__controls__column.current .selected-element-panel__columns-settings__controls__field{background:var(--ub-colorInfoBg);border-color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .selected-element-panel__columns-settings__links span{color:var(--ub-colorInfo)}.blocks-app .ant-app .selected_form-mobile-props .selected-element-panel__columns-settings__links span:hover{color:var(--ub-colorInfoHover)}.blocks-app .selected-element-panel__columns-settings.selected_form-mobile-props{padding:0}.blocks-app .selected-element-panel__extra-btn-container{position:absolute;top:13px;right:50px}.blocks-app .selected-element-panel__extra-btn-container .ant-btn-text:disabled{color:var(--ub-colorTextQuaternary)}.blocks-app .email-properties__collapse .ant-tabs-content>.ant-tabs-tabpane{height:100%}.blocks-app .ant-app .columns-presets{width:100%;margin-bottom:calc(var(--ub-formItemMarginBottomMD) * 1px);align-items:center;gap:7px;display:flex}.blocks-app .ant-app .columns-presets .ant-btn{flex:1;min-width:0;padding:7px 9px;line-height:1!important}.blocks-app .email-pane__collapse-wrapper .ant-modal-close{width:24px;height:24px;font-size:16px}.blocks-app .email-pane__collapse-wrapper .ant-modal-close .anticon{line-height:0}.blocks-app .groups-management__group-select label{width:100%}.blocks-app .groups-management__group-select label:after{display:none}.blocks-app .groups-management__group_menu{border-color:var(--ub-colorFillSecondaryDarken)}.blocks-app .annotations-preview{z-index:1100;pointer-events:auto;background:#fff;border-radius:8px;width:300px;padding:16px;position:absolute;top:0;box-shadow:0 4px 12px #00000026}.blocks-app .annotations-preview--popover{opacity:1;z-index:1;pointer-events:auto;width:420px;max-height:calc(100vh - 48px);position:absolute;top:0;left:-15px;overflow:hidden;transform:translate(-100%)}.blocks-app .annotations-preview__content{pointer-events:none}.blocks-app .annotations-preview__type{color:#202124;margin-bottom:10px;font-size:13px;font-weight:600}.blocks-app .annotations-preview__footer{pointer-events:auto;justify-content:space-between;align-items:center;gap:8px;margin-top:12px;display:flex}.blocks-app .annotations-preview__apply-wrap{margin-left:auto;display:inline-flex}.blocks-app .email-pane__col-wrapper_reverse .annotations-preview--popover{left:auto;right:-15px;transform:translate(100%)}.blocks-app .preview-skeleton{background:linear-gradient(90deg,#f1f3f4 25%,#e8eaed 50%,#f1f3f4 75%) 0 0/200% 100%;border-radius:4px;flex-shrink:0;animation:1.4s ease-in-out infinite preview-skeleton-shimmer;display:block}.blocks-app .preview-skeleton--circle{border-radius:50%}.blocks-app .preview-skeleton--block{border-radius:0}@keyframes preview-skeleton-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}.blocks-app .product-carousel-preview__header{margin-bottom:12px}.blocks-app .product-carousel-preview__header-main{align-items:flex-start;gap:12px;display:flex}.blocks-app .product-carousel-preview__logo{object-fit:cover;border:1px solid #f0f0f0;border-radius:50%;flex-shrink:0;width:40px;height:40px}.blocks-app .product-carousel-preview__logo-skeleton{border:none}.blocks-app .product-carousel-preview__subject-skeleton{flex:1;min-width:0;max-width:220px}.blocks-app .product-carousel-preview__header-text{flex:1;min-width:0}.blocks-app .product-carousel-preview__header-row{justify-content:space-between;align-items:center;gap:8px;display:flex}.blocks-app .product-carousel-preview__header-row--subject{align-items:flex-start;margin-top:2px}.blocks-app .product-carousel-preview__brand-name{color:#202124;font-size:14px;font-weight:600;line-height:20px}.blocks-app .product-carousel-preview__time{color:#5f6368;flex-shrink:0;font-size:11px;line-height:16px}.blocks-app .product-carousel-preview__subject-line{color:#202124;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-size:13px;line-height:18px;overflow:hidden}.blocks-app .product-carousel-preview__star-icon{color:#5f6368;flex-shrink:0}.blocks-app .product-carousel-preview__carousel{gap:8px;margin:0 -2px;padding-bottom:4px;display:flex;overflow-x:auto}.blocks-app .product-carousel-preview__carousel::-webkit-scrollbar{display:none}.blocks-app .product-carousel-preview__carousel{-ms-overflow-style:none;scrollbar-width:none}.blocks-app .product-carousel-preview__card{background:#fff;border:1px solid #dadce0;border-radius:8px;flex:0 0 128px;width:128px;overflow:hidden}.blocks-app .product-carousel-preview__card-image{aspect-ratio:1;background-color:#f1f3f4;background-position:50%;background-size:cover;width:100%}.blocks-app .product-carousel-preview__card-image-skeleton{aspect-ratio:1;width:100%}.blocks-app .product-carousel-preview__card-body{padding:8px}.blocks-app .product-carousel-preview__card-headline{color:#3c4043;-webkit-line-clamp:2;-webkit-box-orient:vertical;min-height:32px;font-size:12px;line-height:16px;display:-webkit-box;overflow:hidden}.blocks-app .product-carousel-preview__card-headline-skeleton{flex-direction:column;gap:4px;min-height:32px;display:flex}.blocks-app .product-carousel-preview__card-prices{flex-wrap:wrap;align-items:baseline;gap:6px;margin-top:6px;display:flex}.blocks-app .product-carousel-preview__card-sale-price{color:#202124;font-size:13px;font-weight:600;line-height:16px}.blocks-app .product-carousel-preview__card-original-price{color:#5f6368;font-size:12px;line-height:16px;text-decoration:line-through}.blocks-app .single-image-preview__header{margin-bottom:10px}.blocks-app .single-image-preview__header-main{align-items:flex-start;gap:12px;display:flex}.blocks-app .single-image-preview__logo{object-fit:cover;border:1px solid #f0f0f0;border-radius:50%;flex-shrink:0;width:40px;height:40px}.blocks-app .single-image-preview__logo-skeleton{border:none}.blocks-app .single-image-preview__header-text{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.blocks-app .single-image-preview__header-row{justify-content:space-between;align-items:center;gap:8px;display:flex}.blocks-app .single-image-preview__brand-name{color:#202124;font-size:14px;font-weight:600;line-height:20px}.blocks-app .single-image-preview__time{color:#5f6368;flex-shrink:0;font-size:11px;line-height:16px}.blocks-app .single-image-preview__subject-line{color:#202124;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:600;line-height:18px;overflow:hidden}.blocks-app .single-image-preview__subject-skeleton{max-width:100%}.blocks-app .single-image-preview__promo-row{justify-content:space-between;align-items:center;gap:8px;min-height:18px;display:flex}.blocks-app .single-image-preview__promo-content{flex:1;align-items:center;gap:4px;min-width:0;display:flex}.blocks-app .single-image-preview__promo-icon{color:#188038;flex-shrink:0}.blocks-app .single-image-preview__promo-icon-skeleton{border-radius:4px;flex-shrink:0}.blocks-app .single-image-preview__promo-badge{color:#188038;flex-shrink:0;font-size:13px;font-weight:500;line-height:16px}.blocks-app .single-image-preview__promo-separator{color:#5f6368;flex-shrink:0;font-size:13px;line-height:16px}.blocks-app .single-image-preview__promo-code{text-overflow:ellipsis;white-space:nowrap;color:#5f6368;min-width:0;font-size:13px;line-height:16px;overflow:hidden}.blocks-app .single-image-preview__promo-skeleton{flex-shrink:0}.blocks-app .single-image-preview__star-icon{color:#5f6368;flex-shrink:0}.blocks-app .single-image-preview__card{background:#fff;border:1px solid #dadce0;border-radius:10px;width:calc(100% - 76px);max-width:100%;margin-left:52px;margin-right:24px;overflow:hidden}.blocks-app .single-image-preview__card-image{aspect-ratio:1.91;background-color:#f1f3f4;background-position:50%;background-size:cover;width:100%}.blocks-app .single-image-preview__card-image-skeleton{aspect-ratio:1.91;width:100%}.blocks-app .single-image-preview__card-body{padding:10px 12px 12px}.blocks-app .single-image-preview__card-description{color:#3c4043;-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:14px;line-height:16px;display:-webkit-box;overflow:hidden}.blocks-app .single-image-preview__card-description-skeleton{flex-direction:column;gap:6px;min-height:34px;display:flex}.blocks-app .deal-annotation-preview__header-main{align-items:flex-start;gap:12px;display:flex}.blocks-app .deal-annotation-preview__logo{object-fit:cover;border:1px solid #f0f0f0;border-radius:50%;flex-shrink:0;width:40px;height:40px}.blocks-app .deal-annotation-preview__logo-skeleton{border:none}.blocks-app .deal-annotation-preview__header-text{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.blocks-app .deal-annotation-preview__header-row{justify-content:space-between;align-items:center;gap:8px;display:flex}.blocks-app .deal-annotation-preview__brand-name{color:#202124;font-size:14px;font-weight:600;line-height:20px}.blocks-app .deal-annotation-preview__time{color:#5f6368;flex-shrink:0;font-size:11px;line-height:16px}.blocks-app .deal-annotation-preview__subject-line{color:#202124;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:600;line-height:18px;overflow:hidden}.blocks-app .deal-annotation-preview__subject-skeleton{max-width:100%}.blocks-app .deal-annotation-preview__promo-row{justify-content:space-between;align-items:center;gap:8px;min-height:18px;display:flex}.blocks-app .deal-annotation-preview__promo-content{flex:1;align-items:center;gap:4px;min-width:0;display:flex}.blocks-app .deal-annotation-preview__promo-icon{color:#188038;flex-shrink:0}.blocks-app .deal-annotation-preview__promo-icon-skeleton{border-radius:4px;flex-shrink:0}.blocks-app .deal-annotation-preview__promo-badge{color:#188038;flex-shrink:0;font-size:13px;font-weight:500;line-height:16px}.blocks-app .deal-annotation-preview__promo-separator{color:#5f6368;flex-shrink:0;font-size:13px;line-height:16px}.blocks-app .deal-annotation-preview__promo-code{text-overflow:ellipsis;white-space:nowrap;color:#5f6368;min-width:0;font-size:13px;line-height:16px;overflow:hidden}.blocks-app .deal-annotation-preview__promo-skeleton{flex-shrink:0}.blocks-app .deal-annotation-preview__star-icon{color:#5f6368;flex-shrink:0}.blocks-app .deal-card-preview{background:#f1f3f4;border-radius:12px;flex-direction:column;gap:12px;padding:16px;display:flex}.blocks-app .deal-card-preview__sender{color:#202124;font-size:12px;font-weight:600;line-height:16px}.blocks-app .deal-card-preview__headline{color:#202124;word-break:break-word;font-size:22px;font-weight:400;line-height:28px}.blocks-app .deal-card-preview__headline-skeleton{max-width:100%}.blocks-app .deal-card-preview__details{align-items:flex-start;gap:24px;display:flex}.blocks-app .deal-card-preview__expires{align-items:flex-start;gap:8px;min-width:0;display:flex}.blocks-app .deal-card-preview__clock-icon{color:#5f6368;flex-shrink:0;margin-top:1px}.blocks-app .deal-card-preview__code{min-width:0}.blocks-app .deal-card-preview__detail-text{flex-direction:column;gap:2px;min-width:0;display:flex}.blocks-app .deal-card-preview__detail-label{color:#202124;font-size:12px;font-weight:600;line-height:16px}.blocks-app .deal-card-preview__detail-value{color:#5f6368;word-break:break-word;font-size:12px;font-weight:400;line-height:16px}.blocks-app .deal-card-preview__detail-skeleton{margin-top:1px}.blocks-app .deal-card-preview__actions{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.blocks-app .deal-card-preview__button{color:#001d35;white-space:nowrap;background:#c2e7ff;border-radius:999px;justify-content:center;align-items:center;padding:8px 16px;font-size:13px;font-weight:500;line-height:16px;display:inline-flex}.blocks-app .annotations-panel .selected-social-form__section-title{align-items:baseline;gap:6px;display:flex}.blocks-app .annotations-panel__docs-hint{color:var(--ub-colorTextSecondary,#8c8c8c);margin-top:16px;font-size:12px;font-weight:300;line-height:1.4}.blocks-app .annotations-panel__section-hint{color:var(--ub-colorTextSecondary,#8c8c8c);font-size:12px;font-weight:300}.blocks-app .annotations-panel__field-tooltip-wrap{width:100%;margin-bottom:8px;display:block}.blocks-app .annotations-panel__cards-section{margin-top:16px}.blocks-app .email-pane__content-col .selected-social-form.annotations-panel .selected-social-form__form .ant-form-item.selected-social-form__card-field:last-child{margin-bottom:8px}.blocks-app .email-settings{height:100%;display:flex}.blocks-app .email-settings__collapse{flex-direction:column;width:100%;height:100%;min-height:0;max-height:100%;display:flex;overflow:hidden}.blocks-app .email-settings__collapse.ant-collapse{border:0}.blocks-app .email-settings__collapse.secondary-tabs.ant-tabs .ant-tabs-content-holder{flex:1;min-height:0;overflow:hidden auto}.blocks-app .email-settings__collapse.secondary-tabs.ant-tabs .ant-tabs-content,.blocks-app .email-settings__collapse.secondary-tabs.ant-tabs .ant-tabs-tabpane-active{overflow:visible}.blocks-app .email-settings__collapse-panel:last-child.ant-collapse-item-active{padding-bottom:12px}.blocks-app .email-settings__collapse-panel.ant-collapse-item{min-height:50px;overflow:hidden}.blocks-app .email-settings__collapse-panel-content{width:100%}.blocks-app .email-settings .ant-collapse-body{padding:0 2px 0 12px;overflow:hidden}.blocks-app #content_appearance_panel_form button.ant-btn:not(.ant-btn-primary):hover{border-color:#d9d9d9}.blocks-app .section-title-bull{color:var(--ub-colorTextQuaternary)}.blocks-app .appearance-panel__content-styles{flex-direction:column;height:100%;min-height:0;display:flex}.blocks-app .appearance-panel__content-styles.ant-tabs{height:100%;min-height:0}.blocks-app .appearance-panel__content-styles .ant-tabs-content-holder,.blocks-app .appearance-panel__content-styles .ant-tabs-content,.blocks-app .appearance-panel__content-styles .ant-tabs-tabpane,.blocks-app .appearance-panel__content-styles .ant-tabs-tabpane-active,.blocks-app .appearance-panel__content-styles .email-settings__collapse-panel-content,.blocks-app .appearance-panel__content-styles .appearance-panel,.blocks-app .appearance-panel__content-styles .element-controls{min-height:0}.blocks-app .appearance-panel__content-styles .ant-tabs-content-holder,.blocks-app .appearance-panel__content-styles .ant-tabs-content,.blocks-app .appearance-panel__content-styles .ant-tabs-tabpane-active,.blocks-app .appearance-panel__content-styles .email-settings__collapse-panel-content,.blocks-app .appearance-panel__content-styles .appearance-panel{flex-direction:column;flex:1;display:flex}.blocks-app .appearance-panel__content-styles .ant-tabs-content-holder{overflow:hidden auto}.blocks-app .appearance-panel__content-styles .ant-tabs-content,.blocks-app .appearance-panel__content-styles .ant-tabs-tabpane-active{overflow:visible}.blocks-app .modal-select-role__cards-grid{grid-gap:20px;grid-template-columns:repeat(auto-fit,322px);padding:10px 24px 24px;display:grid}.blocks-app .modal-select-role .element-card__select-role{cursor:pointer;height:300px}.blocks-app .modal-select-role .element-card__select-role img{cursor:pointer;background-color:#fff;width:100%}.blocks-app .modal-select-role .element-card__select-role .ant-card-body{height:50px}.blocks-app .modal-select-role__title-wrapper{display:inline-block}.blocks-app .ai-response-paragraph{margin-bottom:16px}.blocks-app .em-analytics__email-tab-discuss{overflow:auto!important}.blocks-app .discuss-ai-wrapper{flex-direction:column;flex:1;height:100%;min-height:0;display:flex}.blocks-app .discuss-ai-wrapper .ant-tabs-content-holder,.blocks-app .discuss-ai-wrapper .ant-tabs-content,.blocks-app .discuss-ai-wrapper .ant-tabs-tabpane,.blocks-app .discuss-ai-wrapper .ant-tabs-tabpane-active{flex-direction:column;flex:1;min-height:0;display:flex}.blocks-app .discuss-ai-wrapper .ant-tabs-content{overflow:hidden auto}.blocks-app .discuss-ai-wrapper .discuss-main{min-height:0}.blocks-app .ant-tabs-content .discuss-ai{background-color:#fafafa;border:1px solid #f1ebeb;border-radius:8px;margin:0 0 20px;padding:24px 36px 0}.dark .blocks-app .ant-tabs-content .discuss-ai{background-color:#181818;border-color:#262626}.blocks-app .discuss-main{margin:0}.blocks-app .discuss-main__form{position:relative}.blocks-app .discuss-main__buttons{justify-content:space-between;display:flex}.blocks-app .discuss-main>.comment-list{margin-bottom:16px}.blocks-app .discuss-main>form{padding-bottom:20px}.blocks-app .discuss-main .ant-comment-actions{opacity:.6;transition:all .3s cubic-bezier(.645,.045,.355,1)}.blocks-app .discuss-main .replyEditMode{opacity:.5}.blocks-app .modal-select-role{max-height:1400px}.blocks-app .modal-select-role .element-card.element-card_select-role .ant-card-cover{border:none;height:auto}.blocks-app .modal-select-role .element-card .ant-card-body{height:auto}.blocks-app .modal-select-role__cards-grid{grid-gap:20px;grid-template-columns:repeat(3,260px);width:auto;padding:10px 24px 24px;display:grid}.blocks-app .modal-select-role .element-card_select-role{cursor:pointer}.blocks-app .modal-select-role .element-card_select-role img,.blocks-app .modal-select-role .element-card__no-img{background-color:#fff}@media (width<=1200px){.blocks-app .modal-select-role__cards-grid{grid-template-columns:repeat(4,240px);width:auto}.blocks-app .modal-select-role .element-card__title{font-size:15px}}.blocks-app .ant-comment .ant-comment-avatar{cursor:auto}.blocks-app .ant-comment .ant-comment-avatar .anticon-robot{background:var(--ub-colorInfo)}.blocks-app .ant-comment .ant-comment-avatar .anticon-user{background:var(--ub-colorPrimary)}.blocks-app .ant-comment.ai-comment .ant-comment-avatar .anticon-robot{background:var(--ub-colorInfo)}.blocks-app .ant-comment.ai-comment .ant-comment-avatar .anticon-user{background:var(--ub-colorPrimary)}.blocks-app .ant-comment.ai-comment .ai-guide__example{border-left:1px solid #3b91ff;padding-left:15px;font-style:italic}.blocks-app .ant-comment.ai-comment .ai-guide__example strong{font-weight:500}.blocks-app .ant-comment-content-detail{margin-top:16px;margin-left:-30px}.blocks-app .ant-comment-content-detail p{white-space:normal;margin:16px 0;line-height:1.4}.blocks-app .ant-comment-content-detail ul{margin:16px 0}.blocks-app .ant-comment-content-detail .buttons-variants{white-space:normal;margin-left:0;padding-left:0}.blocks-app body.dark .ant-comment-content-detail .buttons-variants .ant-btn-default:hover{background:#e6f7ff}.blocks-app .ant-comment-content-detail .buttons-variants li{white-space:normal;margin-bottom:4px}.blocks-app .ant-comment-content-detail .buttons-variants .ant-btn.ant-btn-sm{text-align:left;height:auto;padding:4px 7px;line-height:1.4}.blocks-app .ant-comment-content-detail .ai-response-variant{margin:15px 0}.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-title,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-preheader,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-copy{cursor:pointer;background-color:#1890ff33;border-radius:4px;margin:4px 0;padding:3px 8px;line-height:1.4;transition:all .3s;display:block}.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-title:hover,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-preheader:hover,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-copy:hover{color:#000}.blocks-app body.dark .ant-comment-content-detail .ai-response-variant .ai-response-title:hover,.blocks-app body.dark .ant-comment-content-detail .ai-response-variant .ai-response-preheader:hover,.blocks-app body.dark .ant-comment-content-detail .ai-response-variant .ai-response-copy:hover{color:#fff}.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-title:hover,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-preheader:hover,.blocks-app .ant-comment-content-detail .ai-response-variant .ai-response-copy:hover{background-color:#1890ff55}.blocks-app .limit-upgrade-modal.ant-modal{max-width:calc(100vw - 24px)}.blocks-app .limit-upgrade-modal .ant-modal-content{border-radius:16px;padding:0;overflow:hidden;box-shadow:0 12px 24px -4px #191d3a14}.blocks-app .limit-upgrade-modal .ant-modal-header{display:none}.blocks-app .limit-upgrade-modal .ant-modal-content .ant-modal-body{padding:0}.blocks-app .limit-upgrade-modal__wrap{background:var(--ub-colorBgContainer);flex-direction:column;align-items:center;width:400px;max-width:100%;display:flex}.blocks-app .limit-upgrade-modal__header{z-index:1;box-sizing:border-box;justify-content:flex-end;align-items:center;display:flex;position:absolute;top:20px;right:20px}.blocks-app .limit-upgrade-modal__close{background:var(--ub-colorBgContainer);width:34px;height:34px;color:var(--ub-colorTextSecondary);cursor:pointer;border:none;border-radius:6px;justify-content:center;align-items:center;margin:0;padding:0;transition:background .15s,color .15s;display:flex}.blocks-app .limit-upgrade-modal__close:hover{background:var(--ub-colorFillTertiary);color:var(--ub-colorText)}.blocks-app .limit-upgrade-modal__close .anticon{font-size:16px}.blocks-app .limit-upgrade-modal__body{box-sizing:border-box;flex-direction:column;align-items:center;gap:16px;width:100%;padding:44px 40px 24px;display:flex}.blocks-app .limit-upgrade-modal__title{text-align:center;max-width:320px;color:var(--ub-colorText);margin:0;font-size:18px;font-weight:400;line-height:130%}.blocks-app .limit-upgrade-modal__subtitle{text-align:center;max-width:320px;color:var(--ub-colorTextSecondary);margin:0;font-size:14px;font-weight:100;line-height:120%}.blocks-app .limit-upgrade-modal__limits-row{flex-flow:wrap;justify-content:center;align-items:center;gap:8px;width:100%;max-width:320px;display:flex}.blocks-app .limit-upgrade-modal__icon-circle{box-sizing:border-box;border:1px solid var(--ub-colorText);width:34px;height:34px;color:var(--ub-colorText);border-radius:32px;flex:none;justify-content:center;align-items:center;padding:8px;display:flex}.blocks-app .limit-upgrade-modal__icon-circle .anticon{font-size:18px}.blocks-app .limit-upgrade-modal__icon-circle svg{flex-shrink:0;width:18px;height:18px;display:block}.blocks-app .limit-upgrade-modal__limit-old{color:#f85243;flex-shrink:0;font-size:40px;font-weight:100;line-height:100%}.blocks-app .limit-upgrade-modal__arrow-btn{color:#fff;background:#8946fb;border-radius:38px;flex:none;justify-content:center;align-items:center;width:34px;height:34px;display:flex}.blocks-app .limit-upgrade-modal__arrow-icon{font-size:16px;transform:rotate(45deg)}.blocks-app .limit-upgrade-modal__limit-new{color:#7ed846;flex-shrink:0;font-size:40px;font-weight:400;line-height:100%}.blocks-app .limit-upgrade-modal__limit-new--infinity{font-size:36px;line-height:40px}.blocks-app .limit-upgrade-modal__divider{border:none;border-top:1px solid var(--ub-colorBorderSecondary);width:100%;height:0;margin:0}.blocks-app .limit-upgrade-modal__footer{box-sizing:border-box;flex-direction:column;justify-content:center;align-items:center;width:100%;padding:16px 0;display:flex}.blocks-app .limit-upgrade-modal__footer--dual{flex-flow:wrap;justify-content:center;align-items:center;gap:8px;padding:16px}.blocks-app .limit-upgrade-modal__cta.ant-btn-primary{min-width:147px;height:32px;box-shadow:none;background:#2884ff;border-color:#2884ff;border-radius:6px;padding:8px 16px;font-size:14px;font-weight:400;line-height:19px}.blocks-app .limit-upgrade-modal__cta.ant-btn-primary:hover{background:#1a75f0;border-color:#1a75f0}.blocks-app .limit-upgrade-modal__cta-secondary.ant-btn-default{border-color:var(--ub-colorBorder);min-width:147px;height:32px;color:var(--ub-colorText);box-shadow:none;border-radius:6px;padding:8px 16px;font-size:14px;font-weight:400;line-height:19px}.blocks-app .limit-upgrade-modal__cta-secondary.ant-btn-default:hover{color:#2884ff;border-color:#2884ff}.blocks-app .optimise-wrapper{flex-direction:column;flex:1;height:100%;min-height:0;display:flex}.blocks-app .optimise-wrapper .ant-tabs-content-holder,.blocks-app .optimise-wrapper .ant-tabs-content,.blocks-app .optimise-wrapper .ant-tabs-tabpane,.blocks-app .optimise-wrapper .ant-tabs-tabpane-active{flex-direction:column;flex:1;min-height:0;display:flex}.blocks-app .optimise-wrapper .ant-tabs-content{overflow:hidden auto}.blocks-app .optimise{background:0 0;border:none;min-height:0}.blocks-app .optimise.ant-collapse>.ant-collapse-item:last-child{border-bottom:none!important}.blocks-app .optimise .ant-list-item-meta-title{-webkit-user-select:text;user-select:text}.blocks-app .optimise__summary{justify-content:space-between;width:100%;display:flex}.blocks-app .optimise__summary>div:not(:last-child){margin-right:10px}.blocks-app .optimise__summary h4{line-height:1}.blocks-app .optimise .ant-divider.ant-divider-horizontal{border-top:1px solid var(--ub-colorBorderSecondary);background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);width:calc(100% + 50px);margin:26px -25px}.blocks-app .optimise.ant-collapse>.ant-collapse-item{border-bottom:1px solid var(--ub-colorBorderSecondary)}.blocks-app .optimise.ant-collapse>.ant-collapse-item .ant-collapse-header{padding:12px 0 12px 24px}.blocks-app .optimise.ant-collapse>.ant-collapse-item .ant-collapse-panel{border-top:none}.blocks-app .optimise.ant-collapse>.ant-collapse-item .ant-collapse-body{padding:24px 14px 12px 24px;overflow-y:hidden;padding-top:0!important;padding-right:24px!important}.blocks-app .optimise .valid{white-space:nowrap;color:var(--ub-colorSuccessText)}.blocks-app .optimise .error{white-space:nowrap;color:var(--ub-colorErrorText)}.blocks-app .optimise .warning{white-space:nowrap;color:var(--ub-colorWarningText)}.blocks-app .optimise__title-wrapper{justify-content:space-between;align-items:flex-start;width:100%;display:flex}.blocks-app .optimise__title-wrapper h5{width:70%}.blocks-app .optimise__link{-webkit-user-select:text;user-select:text}.blocks-app .optimise__link:hover{color:var(--ub-colorLinkHover)!important}.blocks-app .email-pane .optimise .ant-collapse-panel{height:calc(100% - 184px)}.blocks-app .optimise__image-item .image-item__meta_fail .ant-list-item-meta-avatar{background:linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-colorBorder) 0), linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-colorBorder) 0);background-position:0 0,4px 4px;background-size:8px 8px;border-radius:6px}.blocks-app .optimise__image-item .image-item__meta.ant-list-item-meta{align-items:stretch}.blocks-app .optimise__image-item .image-item__image{cursor:pointer;object-fit:contain;border-radius:calc(var(--ub-borderRadius) * 1px);background:linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-colorBorder) 0), linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 0, transparent 75%, var(--ub-colorBorder) 0);background-position:0 0,4px 4px;background-size:8px 8px}.blocks-app .optimise__image-item .image-item__image+.ant-image-mask{border-radius:calc(var(--ub-borderRadius) * 1px)}.blocks-app .optimise__image-item .image-item__image_fail{height:92px!important}.blocks-app .optimise .ant-list .ant-list-item .ant-list-item-meta .ant-list-item-meta-avatar{margin-inline-end:12px}.blocks-app .optimise .warnings{color:var(--ub-colorWarningText)}.blocks-app .optimise .errors{color:var(--ub-colorErrorText)}.blocks-app .optimise .valid{color:var(--ub-colorSuccessText)}.blocks-app .optimise__button.warnings{border-color:var(--ub-colorWarningBorder);background:var(--ub-colorWarningBg)}.blocks-app .optimise__button.warnings:not(.ant-tag-checkable-checked):hover{border-color:var(--ub-colorWarningBorderHover);color:var(--ub-colorWarningTextHover);background:var(--ub-colorWarningBgHover)}.blocks-app .optimise__button.warnings_active{color:#fff;background-color:var(--ub-colorWarningActive);border-color:var(--ub-colorWarningActive)}.blocks-app .optimise__button.errors{border-color:var(--ub-colorErrorBorder);background:var(--ub-colorErrorBg)}.blocks-app .optimise__button.errors:not(.ant-tag-checkable-checked):hover{border-color:var(--ub-colorErrorBorderHover);color:var(--ub-colorErrorTextHover);background:var(--ub-colorErrorBgHover)}.blocks-app .optimise__button.errors_active{color:#fff;background-color:var(--ub-colorErrorActive);border-color:var(--ub-colorErrorActive)}.blocks-app .optimise__button.valid{border-color:var(--ub-colorSuccessBorder);background:var(--ub-colorSuccessBg)}.blocks-app .optimise__button.valid:not(.ant-tag-checkable-checked):hover{border-color:var(--ub-colorSuccessBorderHover);color:var(--ub-colorSuccessTextHover);background:var(--ub-colorSuccessBgHover)}.blocks-app .optimise__button.valid_active{color:#fff;background-color:var(--ub-colorSuccessActive);border-color:var(--ub-colorSuccessActive)}.blocks-app .optimise .ant-alert-info{width:100%;margin-top:5px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__divider-no-margin.selected-td-form__divider{margin-top:0;margin-bottom:0}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-col.optimise__col-align-right{text-align:right}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-24{margin-bottom:24px}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-16{margin-bottom:16px}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-14{margin-bottom:14px}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-12{margin-bottom:12px}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-row.optimise__row-mb-8{margin-bottom:8px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__link-blue.ant-typography{color:#177ddc;text-decoration:underline}.blocks-app .ant-app .email-pane .ant-tabs .optimise .ant-image.optimise__image-auto-height{height:auto}.blocks-app .ant-app .email-pane .ant-tabs .optimise__text-clickable.ant-typography{cursor:pointer}.blocks-app .ant-app .email-pane .ant-tabs .optimise__valid-title.ant-typography{margin:0;font-size:14px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__valid-title-space.ant-space{flex-wrap:wrap}.blocks-app .ant-app .email-pane .ant-tabs .optimise__alert-custom.ant-alert{width:100%;padding:14px 14px 10px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__summary-title.ant-typography{margin-bottom:0}.blocks-app .ant-app .email-pane .ant-tabs .optimise__summary-label{font-size:12px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-score-title.ant-typography{margin:0}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-score-value{margin-right:12px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-score-text.ant-typography{margin-right:12px;font-size:20px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-report-score.ant-typography{font-size:20px}.blocks-app .ant-app .email-pane .ant-tabs .optimise__spam-report-description{margin-left:12px}.blocks-app .img-preview{background-color:var(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadiusXL) * 1px);box-shadow:var(--ub-boxShadow);opacity:0;border:1px solid #fff;max-width:668px;padding:3px;transition:opacity .3s,transform .3s;position:absolute;top:0;left:-15px;transform:translate(-99%)}.blocks-app .img-preview-content{border:1px solid var(--ub-colorBorderSecondary);border-radius:calc(var(--ub-borderRadiusLG) * 1px);background:linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 25%, transparent 75%, var(--ub-colorBorder) 75%), linear-gradient(45deg, var(--ub-colorBorder) 25%, transparent 25%, transparent 75%, var(--ub-colorBorder) 75%);background-position:0 0,4px 4px;background-size:8px 8px;overflow:hidden}.blocks-app .img-preview-content table{border-collapse:initial}.dark .blocks-app .img-preview{border-color:#4f4f4f}.blocks-app .indexing-tray{z-index:4010;width:360px;max-width:calc(100vw - 40px);position:fixed;bottom:20px;right:20px}.blocks-app .indexing-tray__card{box-shadow:0 6px 16px #0000001f}.blocks-app .indexing-tray__title{font-size:14px;margin:0!important}.blocks-app .blocks-search{height:100%;min-height:0;overflow:visible}.blocks-app .blocks-search .ant-select-clear{right:30px}.blocks-app .blocks-search form{z-index:1;width:85%;padding:16px 0 0 24px;position:absolute;top:0;left:0}.blocks-app .blocks-search__form{display:none}.blocks-app .blocks-search__form.is_search{display:block}.blocks-app .blocks-search__divider-wrapper{z-index:1;margin-top:12px;position:relative}.blocks-app .blocks-search__divider{pointer-events:none;width:auto;height:20px;margin:24px 0 0;position:absolute;bottom:-20px;left:-24px;right:-13px}.blocks-app .blocks-search__type-wrapper{min-width:35%;min-height:0;padding:20px 24px 14px 0;overflow-y:auto}.blocks-app .blocks-search__type-wrapper ul{padding:0}.blocks-app .blocks-search__type-wrapper li{cursor:pointer;color:var(--ub-colorTextSecondary);text-align:left;margin-bottom:12px;line-height:1.2;list-style:none}.blocks-app .blocks-search__type-wrapper li.active{color:var(--ub-colorLink)}.blocks-app .blocks-search__type-wrapper li:hover{color:var(--ub-colorLinkHover)}.blocks-app .blocks-search__result-wrapper{height:100%;min-height:0;margin-left:0;margin-right:0;padding-left:24px;display:flex;position:relative}.blocks-app .blocks-search__result-wrapper:after{content:"";background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);z-index:1;width:100%;height:20px;position:absolute;top:0;left:0}.blocks-app .blocks-search__result-wrapper.is_search:after{top:72px}.dark .blocks-app .blocks-search__result-wrapper:after{background:linear-gradient(180deg, var(--ub-colorBgBase) -100%, transparent 50%)}.blocks-app .blocks-search__result-wrapper.is_search{flex:auto;min-width:0;margin-left:0;margin-right:0;padding-top:20px;padding-left:0;padding-right:6px;display:block;position:static;overflow:hidden auto}.blocks-app .blocks-search__blocks-wrapper{min-width:65%;min-height:0;padding-top:20px;padding-left:10px;padding-right:14px;overflow-y:scroll}.blocks-app .blocks-search__result-holder{opacity:0}.blocks-app .blocks-search__blocks-wrapper{overflow-anchor:none}.blocks-app .blocks-search__blocks-wrapper.is_search{box-sizing:border-box;width:100%;min-width:0;padding-top:0;padding-left:4px;padding-right:0}.blocks-app .blocks-search__result{margin-bottom:14px}.blocks-app .ant-dropdown .ant-dropdown-menu .blocks-search__result__menu-item{padding:9px}.blocks-app .blocks-search__result-header{z-index:2;justify-content:space-between;padding:4px 10px;font-size:13px;display:none;position:relative;box-shadow:0 5px 20px #00000012}.blocks-app .blocks-search__result-global-mark{z-index:10;pointer-events:none;position:absolute;top:1px;right:1px}.blocks-app .blocks-search__result-body{background:var(--ub-colorBgElevated);border:1px solid var(--ub-colorBorder);border-radius:calc(var(--ub-borderRadiusSM) * 1px);text-align:center;cursor:grab;background-color:var(--ub-controlTmpOutline);min-height:13px;padding:0;transition:border-color .3s cubic-bezier(.645,.045,.355,1),background-color .3s cubic-bezier(.645,.045,.355,1),box-shadow .3s cubic-bezier(.645,.045,.355,1);position:relative;overflow:hidden}.blocks-app .blocks-search__result-body:hover{border-color:var(--ub-colorTextDisabled);cursor:grab!important}.blocks-app .blocks-search__result-body:active{cursor:grabbing}.blocks-app .blocks-search__result-body:not([data-preview-measured]){min-height:180px}.blocks-app .blocks-search__result-body:after{content:"";z-index:1;width:100%;height:100%;display:block;position:absolute;top:0;left:0}.blocks-app .blocks-search__result-html{transform-origin:0 0;text-align:left;min-width:660px;height:100%;overflow-x:visible}.blocks-app .blocks-search__result-body:not([data-preview-measured]) .blocks-search__result-html{min-height:1px}.blocks-app .blocks-search .em-dragging-element .blocks-search__result-body{background-color:var(--ub-controlTmpOutline)}.blocks-app .blocks-search .em-ghost-element{border-radius:calc(var(--ub-borderRadiusXL) * 1px);overflow:hidden;background-color:var(--ub-colorBgContainer)!important}.blocks-app .email-pane .ant-tabs .blocks-search__result-divider.ant-divider-horizontal{width:100%;margin-left:0;margin-right:0}.blocks-app .blocks-search.is_search{display:flex}.blocks-app .blocks-search.is_search .blocks-search__type-wrapper{min-width:33%;padding-left:24px;padding-right:0}.blocks-app .block-search__preview{background-color:var(--ub-colorBgContainer);border-radius:calc(var(--ub-borderRadiusXL) * 1px);box-shadow:var(--ub-boxShadow);opacity:0;border:1px solid #fff;width:668px;padding:3px;transition:opacity .3s,transform .3s;position:absolute;top:0;left:-15px;transform:translate(-99%)}.blocks-app .block-search__preview-title{color:var(--ub-colorTextSecondary);padding:8px 15px;font-size:14px}.blocks-app .block-search__preview-content{border:1px solid var(--ub-colorBorderSecondary);border-radius:calc(var(--ub-borderRadiusLG) * 1px);overflow:hidden}.blocks-app .block-search__preview-content table{border-collapse:initial}.dark .blocks-app .block-search__preview{border-color:#4f4f4f}.blocks-app .email-pane__col-wrapper_reverse .block-search__preview{left:auto;right:-15px;transform:translate(99%)}.blocks-app .block-global-badge{color:var(--ub-colorTextSecondary);pointer-events:auto;justify-content:center;align-items:center;line-height:0;display:inline-flex}.blocks-app .block-global-badge svg{display:block}.blocks-app .block-global-badge--tile{box-sizing:border-box;background-color:#ffffffb8;border-radius:6px;width:24px;min-width:24px;height:24px;min-height:24px;padding:0;box-shadow:0 1px 2px #0000001a}.blocks-app .block-global-badge--tile svg{flex-shrink:0}.blocks-app body.dark .block-global-badge--tile,.dark .blocks-app .block-global-badge--tile{color:#ffffffe0;background-color:#0000008c;box-shadow:0 1px 3px #00000059}.blocks-app .discuss-wrapper{flex-direction:column;flex:1;height:100%;min-height:0;display:flex}.blocks-app .discuss-wrapper .ant-tabs-content-holder,.blocks-app .discuss-wrapper .ant-tabs-content,.blocks-app .discuss-wrapper .ant-tabs-tabpane,.blocks-app .discuss-wrapper .ant-tabs-tabpane-active{flex-direction:column;flex:1;min-height:0;display:flex}.blocks-app .discuss-wrapper .ant-tabs-tabpane-active{overflow:hidden}.blocks-app .discuss-wrapper .discuss-main{flex-direction:column;height:100%;min-height:0;display:flex;position:relative;overflow:hidden}.blocks-app .discuss-main>.comment-list{flex:auto;min-height:0;margin-bottom:24px;overflow:hidden auto}.blocks-app .discuss-main>form{flex-shrink:0}.blocks-app .discuss-main .ant-comment-content{flex:1;min-width:0}.blocks-app .discuss-main .ant-comment-content-author{flex-wrap:wrap;align-items:baseline;gap:8px;margin-bottom:4px;display:flex}.blocks-app .discuss-main .ant-comment .ant-comment-content-author-name{color:var(--ub-colorTextBase);font-weight:500;transition:color .3s;font-size:14px!important;line-height:1.4!important}.blocks-app .discuss-main .ant-comment-content-author-time{color:var(--ub-colorTextSecondary);white-space:nowrap;font-size:12px;line-height:1.4}.blocks-app .discuss-main .comment-item-noavatar .ant-comment-content-detail{margin-left:0}.blocks-app .discuss-main .ant-comment-content-detail p{white-space:normal;color:var(--ub-colorText);margin:0 0 16px;line-height:1.4}.blocks-app .discuss-main .ant-comment-content-detail :not(.ant-btn,.buttons-variants,.buttons-variants *){-webkit-user-select:text;user-select:text}.blocks-app .discuss-main .ant-dropdown-trigger{z-index:1;color:var(--ub-colorText);margin:-36px 0 -1px -24px;padding:36px 0 1px 24px;position:relative}.blocks-app .discuss-main .ant-comment-nested .ant-dropdown-trigger{margin-left:-18px;padding-left:18px}.blocks-app .discuss-main .ant-comment-inner{transition:all .5s}.blocks-app .discuss-main .ant-comment.active>.ant-comment-inner{background:#efdbff}.blocks-app .discuss-main .targetted-comment-item>.ant-comment-inner{background:var(--ub-colorInfoBg);cursor:pointer}.blocks-app .discuss-main .ant-comment-actions{opacity:.6;margin-top:6px;transition:all .3s cubic-bezier(.645,.045,.355,1);display:none}.blocks-app .discuss-main .ant-form-item-control-input-content{margin-left:2px}.blocks-app .discuss-main .ant-tooltip-container{text-align:center}.blocks-app .discuss-main .ant-comment-content:hover .ant-comment-actions{opacity:1}.blocks-app .discuss-main .replyEditMode{opacity:.5;display:none}.blocks-app .discuss-main .icon-target{font-size:16px;transform:translateY(5%)}.blocks-app .discuss-main .comment-icon-target{border-radius:8px;margin-left:5px;padding:0 8px 2px}.blocks-app .discuss-main .comment-icon-target:hover{cursor:pointer}.blocks-app .discuss-main .ant-btn.ant-btn-primary.button-target.button-target_choose{background:var(--ub-colorInfo)}.blocks-app .discuss-main .ant-space button{margin-right:0}.blocks-app .anticon-history{transform:scaleX(-1)}.blocks-app .history-panel{border-right:1px solid var(--ub-colorBorder);flex-direction:column;justify-content:space-between;height:100%;display:flex;box-shadow:-12px 0 48px 16px #00000008,-9px 0 28px #0000000d,-6px 0 16px -8px #00000014}.blocks-app .history-panel__sider{z-index:11;background:var(--ub-colorBgContainer);height:100%;position:absolute;top:0;bottom:0;left:80px}.blocks-app .history-panel__list-header,.blocks-app .history-panel__header{justify-content:space-between;align-items:center;padding:0 24px 9px;font-weight:500;display:flex}.blocks-app .history-panel__list-header :last-child{min-width:60px}.blocks-app .history-panel__header{padding-left:24px;padding-right:24px}.blocks-app .history-panel__list-header:before{background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);border-top:1px solid var(--ub-colorBorderSecondary);content:"";z-index:1;background-position:0 -2px;background-repeat:no-repeat;border-bottom:none;height:20px;position:absolute;inset:30px 0 -20px}.dark .blocks-app .history-panel__list-header:before{background:linear-gradient(180deg, var(--ub-colorBgBase), transparent 40%)}.blocks-app .history-panel__header-title{font-size:14px;font-style:normal;line-height:24px}.blocks-app body.dark .history-panel__header-title{color:#fff}.blocks-app .history-panel__header-close{color:#00000073;margin-right:-16px}.blocks-app body.dark .history-panel__header-close{color:#fff}.blocks-app .history-panel__list{height:100%;margin:10px -24px 0}.blocks-app .history-panel__list .ant-list-header{border:none;margin-bottom:5px;padding:0;font-weight:500}.blocks-app .history-panel__list .ant-spin-nested-loading,.blocks-app .history-panel__list .ant-spin-container{height:100%}.blocks-app .history-panel__list .ant-list-items{height:calc(100% - 30px);overflow:auto}.blocks-app .history-panel__list .ant-list-item{cursor:pointer;border:none;padding:9px 24px}.blocks-app .history-panel__list .ant-list-item:hover{background-color:var(--ub-colorFillQuaternary)}.blocks-app .history-panel__list .ant-btn.ant-btn-sm{--ant-btn-border-width:0;height:22px;line-height:1;padding:0!important}.blocks-app .history-panel .ant-list-item{padding:9px 0}.blocks-app .history-panel__list-date,.blocks-app .history-panel__list-header .history-panel__list-date{min-width:130px}.blocks-app .history-panel__list-author{white-space:nowrap;text-overflow:ellipsis;flex:1;overflow:hidden}.blocks-app .history-panel__restore{opacity:0;visibility:hidden}.blocks-app .history-panel__item_active{background-color:var(--ub-colorFillSecondary)}.blocks-app body.dark .history-panel__item_active{background:#111b26}.blocks-app .history-panel__item_active .history-panel__restore{opacity:1;visibility:visible}.blocks-app .ant-layout-sider.history-panel__sider .ant-layout-sider-children{opacity:1;width:500px;height:100%;transition:opacity .5s;position:absolute;right:0}.blocks-app .ant-layout-sider-collapsed.history-panel__sider .ant-layout-sider-children{opacity:0}.blocks-app .add-new-block-modal__save-btn .ant-btn-icon .anticon{font-size:22px;line-height:0}.blocks-app .add-new-block-modal__save-btn .ant-btn-icon .anticon svg{width:22px;height:22px}.blocks-app .modal-footer{justify-content:flex-end;padding:8px 0;display:flex}.blocks-app .modal-spinner{justify-content:center;align-items:center;height:108px;display:flex}',e=window.__useblocks_styles__||(window.__useblocks_styles__={sheets:{},order:[]}),p=t;if(!e.sheets[p]){var a=null;try{typeof CSSStyleSheet=="function"&&"replaceSync"in CSSStyleSheet.prototype&&(a=new CSSStyleSheet,a.replaceSync(t))}catch{a=null}if(a){if(!e.host||!e.host.isConnected||!e.host.sheet){var o=document.createElement("style");o.setAttribute("data-useblocks","true"),document.head.appendChild(o),e.host=o}for(var i=e.host.sheet,r=0;r<a.cssRules.length;r++)try{i.insertRule(a.cssRules[r].cssText,i.cssRules.length)}catch{}(e.texts||(e.texts=[])).push(t),(e.listeners||[]).forEach(function(l){try{l(t)}catch{}})}else{var o=document.createElement("style");o.setAttribute("data-useblocks","true"),o.appendChild(document.createTextNode(t)),document.head.appendChild(o)}e.sheets[p]=!0,e.order.push(p)}}}catch(l){console.error("vite-plugin-css-injected-by-js",l)}})();
9
+ __useblocks__.define("static/core/4e07805d.js",["require","exports","module","static/core/2ff39ddf.js","static/core/d3e42889.js","static/core/3fb28e82.js","static/core/b6bccb63.js","static/core/88cd6d99.js","static/core/523ea2ec.js","static/core/9da6c313.js","static/core/e81b521f.js","static/core/f0f20c47.js","static/core/66853555.js","static/core/d6c7eb44.js","react","react/jsx-runtime","__delivery__/libs","react-dom","vite/preload-helper","classnames","dayjs"],function(ko,Ro,lh){const bo=ko("./2ff39ddf.js"),Po=ko("./d3e42889.js"),r=ko("./3fb28e82.js"),gi=ko("./b6bccb63.js"),bn=ko("./88cd6d99.js"),U=ko("./523ea2ec.js"),et=ko("./9da6c313.js"),eo=ko("./e81b521f.js"),fi=ko("./f0f20c47.js"),Ft=ko("./66853555.js"),Ar=ko("./d6c7eb44.js");let a=ko("react");a=bo.__toESM(a);let o=ko("react/jsx-runtime"),t=ko("__delivery__/libs"),gn=ko("react-dom"),Mt=ko("vite/preload-helper"),Ke=ko("classnames");Ke=bo.__toESM(Ke);let ct=ko("dayjs");ct=bo.__toESM(ct);var f=bo.__toESM(r.require_prop_types());async function Lr(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 Or(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 ut(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 $r(){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(Po.events.FILE_PROXY_EVENT_ID),c=r.useEventEmitter(Po.events.PROXY_URL_EVENT_ID);return(0,a.useCallback)(async(p,g)=>et.fetchEditorImageBlobByUrl(p,{appConfig:e,isStandalone:i,fireFileProxy:m=>d.fire({url:m,project:n}),fireProxyUrl:m=>c.fire({url:m,project:n})},g),[e,n,i,d,c])}var Fr=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),_i=({onChange:e,value:i,validateStatus:l,placeholder:s,disabled:n,name:d,elementSettings:c,imageInfo:p,previewReloadSignal:g,onRemotePreviewValidate:m})=>{const _=r.useCurrentUser(),E=r.useProjectData(),b=r.useAppConfig(),h=r.useIsStandalone(),{__:k}=r.useI18n();r.useSendPostMessage();const x=r.useSendPostMessageEx(),{openImagePicker:T}=r.useImagePicker(),v=r.useStorageProvider(),P=r.useRestClient(),B=E?.id!==void 0?String(E?.id):"",y=_?.id!=="0"?String(_.id):"",{dataProvider:D}=(0,a.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:v,projectId:B,restApi:P,i18n:{__:k},pathPostfix:y,appConfig:b,isStandalone:h}),[b,h,B,P,v,y,k]),z=$r(),[A]=r.useLazyGetImageInfoQuery(),[$,j]=(0,a.useState)({width:"",height:"",size:""}),[W,Y]=(0,a.useState)(!1),[ee,I]=(0,a.useState)(0),[le,ke]=(0,a.useState)(""),Ne=(0,a.useRef)(""),Q=(0,a.useRef)(g?.counter||0),fe=et.useImageBlobResolver(),Ae=(0,a.useRef)(""),ne=(0,a.useRef)(""),[Fe,Le]=(0,a.useState)(0),Ue=r.usePlanFeatureGate("image_editor"),ve=()=>{Ae.current&&(URL.revokeObjectURL(Ae.current),Ae.current="")};(0,a.useEffect)(()=>{if(!i){j({width:"",height:"",size:"",format:""}),Ne.current="",ke(""),ve();return}if(i.startsWith("data:")||i.startsWith("blob:")){ve(),Ne.current=i,ke(i),j({width:"",height:"",size:"",format:""});return}const q=r.stripEmVersionFromUrlString(i);ne.current=q;const Z=et.canonicalImageUrlKey(q),te=new AbortController;let ae=!1;const de=async oe=>{ve();const Te=Fe?r.appendEmVersionForPreviewReload(oe):oe;Ne.current=Te,ke(Te);try{const{data:_e}=await A(q);return ae||!_e?!1:(j({width:_e?.width,height:_e?.height,size:_e?.fileSize!=null?(_e.fileSize/1024).toFixed(0):"",format:et.normalizeImageFormatForDisplay(_e?.format)}),!0)}catch{return!1}},De=async()=>{const oe=await fe.resolve(Z,te.signal,z);if(ae)return;const{width:Te,height:_e}=await Lr(oe);if(ae)return;ve();const Ce=URL.createObjectURL(oe);Ae.current=Ce,Ne.current=Ce,ke(Ce),j({width:Te,height:_e,size:(oe.size/1024).toFixed(0),format:et.normalizeImageFormatForDisplay(oe.type)})};return(async()=>{try{if(!h){const oe=await Or(D,q);if(oe?.previewUrl&&await de(oe.previewUrl))return}await De()}catch{ae||(ve(),Ne.current="",ke(""),j({width:"",height:"",size:"",format:""}))}})(),()=>{ae=!0,te.abort()}},[i,D,z,A,h,fe,Fe]);const Be=(0,a.useCallback)(()=>{const q=ne.current;q&&fe.abandonKey(et.canonicalImageUrlKey(q)),Le(Date.now())},[fe]);(0,a.useEffect)(()=>{!g?.counter||g.name!==d||g.counter!==Q.current&&(Q.current=g.counter,Be())},[d,g,Be]),(0,a.useEffect)(()=>()=>ve(),[]);const xe=!!i&&!ut(r.stripEmVersionFromUrlString(String(i))),ce=async(q=null)=>{const Z=d.startsWith("src"),te=q||(Z?r.MODALS.UPLOAD_IMAGE_MODAL:r.MODALS.UPLOAD_BACKGROUND_MODAL),ae=r.stripEmVersionFromUrlString(i||""),de=await T({kind:Z?"img":"background",currentUrl:ut(ae)?"":ae,entryModal:te});if(!de?.url)return;const De=ae===r.stripEmVersionFromUrlString(de.url);(!De||de.url!==i)&&e(de.url),de.meta?.mode==="save"&&De&&(Be(),Z&&x(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(de.url)}))},be=[{label:k("Upload"),key:"Upload",onClick:()=>ce(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)}];b.imageCenterStockEnabled&&be.push({label:k("Stock"),key:"Stock",onClick:()=>ce(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_STOCK:r.MODALS.UPLOAD_BACKGROUND_MODAL_STOCK)}),b.imageCenterGifEnabled&&be.push({label:k("GIF"),key:"GIF",onClick:()=>ce(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_GIF:r.MODALS.UPLOAD_BACKGROUND_MODAL_GIF)}),b.elementAIimageEnabled&&be.push({label:k("AI"),key:"AI",onClick:()=>ce(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_AI:r.MODALS.UPLOAD_BACKGROUND_MODAL_AI)});const ue=()=>{Y(!1)};return(0,o.jsxs)("div",{className:(0,Ke.default)("upload-bg-image",{"upload-bg-image_disabled":n}),children:[i?(0,o.jsxs)("div",{className:"ant-input-file-uploader upload-bg-image__inner-wrap",onClick:q=>{q.target?.closest(".upload-bg-image__edit")||q.target?.closest(".upload-bg-image__edit-menu")||q.target?.closest(".upload-bg-image__menu")||q.target?.closest(".inputGroup")||ce(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD)},children:[(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,popupRender:()=>b.imagePathDropdownEnabled?(0,o.jsx)("div",{className:"inputGroup",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image,size:20,strokeWidth:b.iconStrokeWidth,style:{verticalAlign:"text-top"}}),allowClear:!0,onChange:e,value:i,placeholder:s,name:d,disabled:n,className:"upload-bg-image__input"})}):(0,o.jsx)(o.Fragment,{}),classNames:{root:"upload-bg-image__dropdown-overlay"},styles:{root:{top:32,marginTop:"8px",width:347,left:0}},trigger:["hover"],placement:"bottom",getPopupContainer:q=>q.closest(".upload-bg-image__inner-wrap"),children:(0,o.jsxs)("div",{className:"upload-bg-image__hover-container",style:{display:"flex",alignItems:"center"},children:[(0,o.jsx)("div",{className:"upload-bg-image__uploader",children:(0,o.jsx)("div",{className:"upload-bg-image__uploader-content",children:(0,o.jsxs)("div",{className:"upload-bg-image__uploader-content-inner",children:[(0,o.jsx)("div",{className:"upload-bg-image__uploader-img-wrap",children:le?(0,o.jsx)("img",{className:"upload-bg-image__uploader-img",src:le,alt:"",onLoad:()=>{m&&Fr(r.stripEmVersionFromUrlString(i||""))&&m("success")},onError:()=>{const q=ne.current,Z=r.stripEmVersionFromUrlString(le||""),te=r.stripEmVersionFromUrlString(q||"");if(q&&Z!==te){Ne.current=q,ke(q);return}m&&Fr(te)&&m("error")}}):(0,o.jsx)("div",{className:"upload-bg-image__uploader-img-placeholder","aria-hidden":!0})}),(0,o.jsx)("div",{className:"upload-bg-image__uploader-icons-wrap",children:(0,o.jsx)("div",{className:"upload-bg-image__uploader-content"})})]})})}),$.width&&$.height?(0,o.jsxs)("div",{className:"image-size",children:[$.width," × ",$.height,!!c&&(c.type===r.ELEMENT_TYPES.IMG||c.type===r.ELEMENT_TYPES.CAROUSEL)&&" → "+p.renderedWidth+" × "+p.renderedHeight,(0,o.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,o.jsxs)("span",{children:[$.size," ",k("kB")]}),$.format&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,o.jsx)("span",{className:"image-size-format",children:$.format})]})]}):(0,o.jsx)(t.ui_kit$Text,{type:"secondary",className:"image-empty-text",children:s})]})}),(0,o.jsx)("div",{style:{flexGrow:1}}),$.format!=="gif"&&b.imageCenterEditorEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:k("Edit"),children:(0,o.jsx)(t.ui_kit$Text,{type:"link",className:"upload-bg-image__edit",children:(0,o.jsx)(r.EmIcons,{icon:"Edit",component:t.icons$Edit,size:16,strokeWidth:b.iconStrokeWidth,onClick:()=>{Ue.isLocked&&xe?(Y(!0),I(r.FEATURE_UPSELL_SLIDE.image_editor)):ce(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:be},classNames:{root:"upload-bg-image__menu"},children:(0,o.jsx)(t.ui_kit$Text,{type:"link",className:"upload-bg-image__edit-menu image-change",children:i?(0,o.jsx)(r.EmIcons,{size:16,strokeWidth:b.iconStrokeWidth,icon:"SyncOutlined",component:t.icons$SyncOutlined,onClick:()=>ce(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:()=>ce(d.startsWith("src")?r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD:r.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD),icon:(0,o.jsx)(r.EmIcons,{icon:"Image",component:t.icons$Image,size:16,strokeWidth:b.iconStrokeWidth}),children:k("Add image")}),W&&(0,o.jsx)(r.PlanUpgradePrompt,{open:!0,onCancel:ue,initialSlide:ee})]})};_i.propTypes={};var fn=e=>typeof e=="string"&&/^https?:\/\//i.test(e.trim()),_n=(e,i,l)=>i||(l?.type===r.ELEMENT_TYPES.CAROUSEL?["images",e]:Array.isArray(e)?e:[e]),Mr=e=>Array.isArray(e)?e.join("_"):e,Fo=({form:e,label:i,name:l,watchPath:s,disabled:n=!1,elementSettings:d,previewReloadSignal:c=void 0})=>{const{token:p}=(0,t.ui_kit$useToken)(),[g,m]=(0,a.useState)("success"),_=(0,a.useMemo)(()=>({marginBottom:p.formItemMarginBottomXS}),[p.formItemMarginBottomXS]),E=t.ui_kit$Form.useWatch(_n(l,s,d),e);return(0,a.useEffect)(()=>{if(!E){m("");return}if(typeof E=="string"&&(E.startsWith("data:")||E.startsWith("blob:"))){m("success");return}if(fn(E)){m("validating");return}m("success")},[E]),(0,o.jsx)(t.ui_kit$Form.Item,{name:l,validateStatus:g,style:_,children:(0,o.jsx)(_i,{validateStatus:g,placeholder:i,name:Mr(l),disabled:n,elementSettings:d,imageInfo:d?.type===r.ELEMENT_TYPES.CAROUSEL?d?.carouselImages?.[Mr(l).split("_")[1]]:d,previewReloadSignal:c,onRemotePreviewValidate:m})})};Fo.propTypes={label:f.default.string.isRequired,name:f.default.oneOfType([f.default.string,f.default.arrayOf(f.default.oneOfType([f.default.string,f.default.number]))]).isRequired,watchPath:f.default.arrayOf(f.default.oneOfType([f.default.string,f.default.number])),tooltipTitle:f.default.string,disabled:f.default.bool,previewReloadSignal:f.default.shape({name:f.default.string,counter:f.default.number}),form:f.default.shape({getFieldValue:f.default.func.isRequired}).isRequired},Fo.defaulProps={disabled:!1,previewReloadSignal:null};var vo=({form:e,oneBorderRadiusValue:i,setOneBorderRadiusValue:l,elementSettings:s,namePrefix:n="",typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),p=d==="mobile",g=p?"mobileBorderRadius":"borderRadius",m=p?"mobileBorderRadiusAll":"borderRadiusAll",_=p?"mobileBorderRadiusTopLeft":"borderRadiusTopLeft",E=p?"mobileBorderRadiusTopRight":"borderRadiusTopRight",b=p?"mobileBorderRadiusBottomRight":"borderRadiusBottomRight",h=p?"mobileBorderRadiusBottomLeft":"borderRadiusBottomLeft",k=p?U.MOBILE_BORDER_RADIUS_POSITION:U.BORDER_RADIUS_POSITION,x=()=>{const T=e.getFieldsValue(!0);let v;i?(e.setFieldsValue({[_]:T[m]||null,[h]:T[m]||null,[E]:T[m]||null,[b]:T[m]||null}),v={[g]:{[k[_]]:T[m]||0,[k[h]]:T[m]||0,[k[E]]:T[m]||0,[k[b]]:T[m]||0}}):T[_]===T[h]&&T[_]===T[E]&&T[_]===T[b]?(e.setFieldsValue({[m]:T[_]}),v={[g]:{[k[m]]:T[_]}}):(e.setFieldsValue({[_]:null,[h]:null,[E]:null,[b]:null}),v={[g]:{[k[m]]:0,[k[_]]:0,[k[h]]:0,[k[E]]:0,[k[b]]:0}});const P=p?{mobileBorderRadius:{all:T.mobileBorderRadiusAll||null,classNamePrefix:"em-mob-border_radius_all-"}}:{[`${n}${g}`]:{...s[`${n}${g}`],...v[`${n}${g}`]}};c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:P}),l(B=>!B)};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"})})};vo.displayName="SelectedElementFormBorderRadius";var xn="em-mob-text_align-",kn=({value:e,onChange:i,onSync:l,fieldName:s,...n})=>{const d=(typeof e=="object"?e?.value:e)??"",c=p=>{const g={classNamePrefix:xn,value:p};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(),p=r.useAppConfig(),g=d==="mobile",m=g?"mobileAlign":s;if(g){const _=E=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:E})};return(0,o.jsx)(t.ui_kit$Form.Item,{name:m,children:(0,o.jsx)(kn,{fieldName:m,onSync:_,disabled:l&&!i.parent,strokeWidth:p.iconStrokeWidth,tooltipTitle:n})})}return(0,o.jsx)(t.ui_kit$Form.Item,{name:m,children:(0,o.jsx)(t.ui_kit$FormAlignControl,{disabled:l&&!i.parent,strokeWidth:p.iconStrokeWidth,tooltipTitle:n})})},Vo=({form:e,elementSettings:i,tooltipTitle:l,disabled:s=!1,isNewIconType:n=!1,typeOfForm:d="desktop"})=>{const c=r.useSendPostMessage(),p=r.useAppConfig(),g=d==="mobile",m=g?"mobileVerticalAlign":"valign",_=E=>{e.setFieldsValue({[m]:E}),g||c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[m]:E}})};return(0,o.jsx)(t.ui_kit$Form.Item,{name:m,children:(0,o.jsx)(t.ui_kit$FormVerticalAlignControl,{...!g&&{value:i.valign,onChange:_},disabled:s,isNewIconType:n,strokeWidth:p.iconStrokeWidth})})},En=["mobileBoxShadowHOffset","mobileBoxShadowVOffset","mobileBoxShadowBlurRadius","mobileBoxShadowSpreadRadius","mobileBoxShadowColor","mobileBoxShadowInset"],Sn=({form:e,elementSettings:i,enableSwitch:l,usedColors:s,withoutShadowLabel:n})=>{const d=r.useSendPostMessage(),c=i.mobileBoxShadow,[p,g]=(0,a.useState)(!c||c.hOffset===0&&c.vOffset===0&&c.blurRadius===0&&c.spreadRadius===0),m=t.ui_kit$Form.useWatch(En,e);(0,a.useEffect)(()=>{if(!m)return;const[E,b,h,k,x,T]=m;(E===0||E===void 0||E===null)&&(b===0||b===void 0||b===null)&&(h===0||h===void 0||h===null)&&(k===0||k===void 0||k===null)&&(x===""||x===void 0||x===null)&&(T===!1||T===void 0)||g(!1)},[m]);const _=()=>{g(E=>!E),e.setFieldsValue({mobileBoxShadowHOffset:p?"":0,mobileBoxShadowVOffset:p?"":0,mobileBoxShadowBlurRadius:p?"":0,mobileBoxShadowSpreadRadius:p?"":0,mobileBoxShadowColor:"",mobileBoxShadowInset:!1}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBoxShadow:{classNamePrefix:"em-mob-box_shadow-",hOffset:p?null:0,vOffset:p?null:0,blurRadius:p?null:0,spreadRadius:p?null:0,color:null,inset:!1}}})};return(0,o.jsxs)(o.Fragment,{children:[l&&(0,o.jsx)("div",{style:{float:"right",marginTop:-9,marginRight:50},children:(0,o.jsx)(t.ui_kit$Switch,{id:"without-shadow",label:n,labelSize:"small",size:"small",checked:p,onChange:_})}),(0,o.jsx)("p",{style:{paddingBottom:"8px",margin:"-30px 0 0"},children:" "}),(0,o.jsx)(t.ui_kit$FormBoxShadowInputs,{typeOfForm:"mobile",usedColors:s})]})},No=({typeOfForm:e="desktop",form:i,elementSettings:l,enableSwitch:s=!0})=>{const{__:n}=r.useI18n(),d=r.useSelector(r.selectEmailSettings).usedColors;return e==="mobile"&&i&&l?(0,o.jsx)(Sn,{form:i,elementSettings:l,enableSwitch:s,usedColors:d,withoutShadowLabel:n("Without shadow")}):(0,o.jsx)(t.ui_kit$FormBoxShadowInputs,{typeOfForm:e,usedColors:d})};No.displayName="SelectedElementFormBoxShadow";var Ao=({form:e,elementSettings:i,directionControl:l})=>{const{__:s}=r.useI18n();return(0,o.jsx)(t.ui_kit$FormDisplayControl,{directionControl:l,className:"selected-element-form-show",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"show",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$Radio.Group,{children:(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Radio.Button,{value:"all",children:s("Both")}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:s("Desktop"),children:(0,o.jsx)(t.ui_kit$Radio.Button,{value:"desktop",children:(0,o.jsx)(r.EmIcons,{icon:"DesktopOutlined",component:t.icons$DesktopOutlined})})}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:s("Mobile"),children:(0,o.jsx)(t.ui_kit$Radio.Button,{value:"mobile",children:(0,o.jsx)(r.EmIcons,{icon:"MobileOutlined",component:t.icons$MobileOutlined})})})]})})})})},xi=({form:e,elementSettings:i,handleChangeValues:l})=>{const{__:s}=r.useI18n(),n=(0,a.useRef)(),{token:d}=(0,t.ui_kit$useToken)(),[c,p]=(0,a.useState)(!1),[g,m]=(0,a.useState)(!1),[_,E]=(0,a.useState)(!1),[b,h]=(0,a.useState)(!1),[k,x]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let j=new URL("https://emailmaker.ru/?"+i.countdown);p(j.searchParams.get("font1").endsWith("-b")||j.searchParams.get("font1").endsWith("-bi")),m(j.searchParams.get("font1").endsWith("-i")||j.searchParams.get("font1").endsWith("-bi")),E(j.searchParams.get("font2").endsWith("-b")||j.searchParams.get("font2").endsWith("-bi")),h(j.searchParams.get("font2").endsWith("-i")||j.searchParams.get("font2").endsWith("-bi")),x(j.searchParams.get("tp")==="true")},[i]);const T=[{value:"-12",label:s("-12:00 Apia")},{value:"-11",label:s("-11:00 Pago Pago, Midway Atoll")},{value:"-10",label:s("-10:00 Honolulu, Anchorage")},{value:"-9",label:s("-9:00 Anchorage, Yukon")},{value:"-8",label:s("-8:00 Los Angeles, Vancouver")},{value:"-7",label:s("-7:00 Denver, Phoenix")},{value:"-6",label:s("-6:00 Mexico City, Guadalajara")},{value:"-5",label:s("-5:00 New York, Toronto, Havana")},{value:"-4",label:s("-4:00 Caracas, Santo Domingo")},{value:"-3",label:s("-3:00 Buenos Aires, Santiago, Montevideo")},{value:"-2",label:s("-2:00 South Georgia, Saint Helena")},{value:"-1",label:s("-1:00 Azores, Cape Verde")},{value:"0",label:s("+0:00 London, Lisbon, Dublin")},{value:"1",label:s("+1:00 Paris, Berlin, Rome")},{value:"2",label:s("+2:00 Athens, Kiev, Istanbul")},{value:"3",label:s("+3:00 Istanbul, Doha, Baghdad")},{value:"4",label:s("+4:00 Baku, Dubai, Tbilisi")},{value:"5",label:s("+5:00 Karachi, Tashkent, Islamabad")},{value:"6",label:s("+6:00 Almaty, Dhaka, Bishkek")},{value:"7",label:s("+7:00 Bangkok, Ho Chi Minh City, Jakarta")},{value:"8",label:s("+8:00 Beijing, Hong Kong, Singapore")},{value:"9",label:s("+9:00 Tokyo, Seoul, Jayapura")},{value:"10",label:s("+10:00 Sydney, Melbourne, Port Moresby")},{value:"11",label:s("+11:00 Honiara, Nuku'alofa, Apia")}],v=[{value:"20",label:s("20 s")},{value:"40",label:s("40 s")},{value:"60",label:s("60 s")}],P=[{value:"arial",label:"Arial"},{value:"courier-new",label:"Courier New"},{value:"georgia",label:"Georgia"},{value:"helvetica",label:"Helvetica"},{value:"tahoma",label:"Tahoma"},{value:"times-new-roman",label:"Times New Roman"},{value:"trebuchet-ms",label:"Trebuchet MS"},{value:"verdana",label:"Verdana"},{value:"open-sans",label:"Open Sans"},{value:"roboto",label:"Roboto"}],B=j=>j&&j<(0,ct.default)().endOf("day")-864e5,y=j=>{x(j)},D=()=>{const j=!c;e.setFieldValue("countdownNumbersStrong",j),l({countdownNumbersStrong:j}),p(j)},z=()=>{const j=!g;e.setFieldValue("countdownNumbersItalic",j),l({countdownNumbersItalic:j}),m(j)},A=()=>{const j=!_;e.setFieldValue("countdownLabelsStrong",j),l({countdownLabelsStrong:j}),E(j)},$=()=>{const j=!b;e.setFieldValue("countdownLabelsItalic",j),l({countdownLabelsItalic:j}),h(j)};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:B,showTime:!0,placement:"bottomRight",getPopupContainer:j=>{const W=j?.closest(".blocks-app");return W||(j?.ownerDocument?.body??document.body)},allowClear:!1,allowEmpty:!1})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("Time zone"),name:"countdownTimeZone",style:{width:"100%"},children:(0,o.jsx)(t.ui_kit$Select,{placeholder:s("Select the time zone"),getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),children:T.map(j=>(0,o.jsx)(t.ui_kit$Select.Option,{value:j.value,children:j.label},j.value))})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:20,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:s("Background color"),name:"countdownBackgroundColor",className:"countdown-color",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:s("Background color"),usedColors:i.usedColors})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownTransparency",valuePropName:"checked",style:{paddingTop:29},children:(0,o.jsx)(t.ui_kit$Switch,{id:"countdownTransparency",label:s("Transparency"),labelSize:"small",size:"small",onChange:y})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:s("Countdown font settings"),compact:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersFont",style:{marginBottom:d.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:P})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersColor",className:"countdown-color",style:{marginBottom:d.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{usedColors:i.usedColors})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersFontSize",children:(0,o.jsx)(t.ui_kit$InputNumber,{min:12,placeholder:s("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:s("Strong"),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersStrong",children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":c}),onClick:D,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-td-form__icon-radius"})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:s("Italic"),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownNumbersItalic",children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":g}),onClick:z,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})})})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:s("Time units font settings"),compact:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsFont",style:{marginBottom:d.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:P})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsColor",className:"countdown-color",style:{marginBottom:d.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{usedColors:i.usedColors})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsFontSize",children:(0,o.jsx)(t.ui_kit$InputNumber,{min:8,placeholder:s("Font size"),addonAfter:"px",prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined})})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:s("Strong"),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsStrong",children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":_}),onClick:A,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-td-form__icon-radius"})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:s("Italic"),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"countdownLabelsItalic",children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":b}),onClick:$,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:v})})})]})]})};xi.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string};var ki=({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")]})]})})]})};ki.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string};var Bn={marginBottom:10},Lo=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(t.ui_kit$Row,{gutter:20,style:Bn,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:Ei}=t.ui_kit$Select,{mobileBorderRadiusAll:Tn,mobileBorderRadiusTopLeft:Si,mobileBorderRadiusBottomLeft:Bi,mobileBorderRadiusTopRight:Ti,mobileBorderRadiusBottomRight:Ri,borderRadiusBottomRight:yi,borderRadiusTopRight:wi,borderRadiusBottomLeft:ji,borderRadiusTopLeft:vi,alt:Rn,src:yn,title:wn,link:mt,borderRadiusAll:Dr,imgReplacer:jn,expanded:vn}={link:"link",borderRadiusBottomRight:"borderRadiusBottomRight",borderRadiusTopRight:"borderRadiusTopRight",borderRadiusBottomLeft:"borderRadiusBottomLeft",borderRadiusTopLeft:"borderRadiusTopLeft",mobileBorderRadiusAll:"mobileBorderRadiusAll",mobileBorderRadiusTopLeft:"mobileBorderRadiusTopLeft",mobileBorderRadiusBottomLeft:"mobileBorderRadiusBottomLeft",mobileBorderRadiusTopRight:"mobileBorderRadiusTopRight",mobileBorderRadiusBottomRight:"mobileBorderRadiusBottomRight",alt:"alt",imgReplacer:"imgReplacer",src:"src",title:"title",borderRadiusAll:"borderRadiusAll",expanded:"expanded"},ot=({linkProtocol:e})=>{switch(e){case"https://":return(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined});case"mailto:":return(0,o.jsx)(r.EmIcons,{icon:"MailOutlined",component:t.icons$MailOutlined});case"tel:":return(0,o.jsx)(r.EmIcons,{icon:"PhoneOutlined",component:t.icons$PhoneOutlined});case"sms:":return(0,o.jsx)(r.EmIcons,{icon:"CommentOutlined",component:t.icons$CommentOutlined});case"ftp://":return(0,o.jsx)(r.EmIcons,{icon:"FileOutlined",component:t.icons$FileOutlined});case"#":return(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined});default:return(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined})}},In=e=>[{value:"https://",label:e("Site")},{value:"mailto:",label:e("E-mail")},{value:"tel:",label:e("Phone")},{value:"sms:",label:e("SMS")},{value:"ftp://",label:e("File")},{value:"#",label:e("Anchor")},{value:"",label:e("Other")}],tt=({handleLinkProtocolsChange:e,linkProtocol:i,__:l})=>{const s=a.default.useMemo(()=>In(l),[l]);return(0,o.jsx)(t.ui_kit$Select,{style:{width:90,textAlign:"left"},value:i,onChange:e,options:s,popupMatchSelectWidth:!1,listHeight:320})},it=({show:e,__:i,style:l,className:s})=>{const n=a.default.useMemo(()=>({marginBottom:8,...l}),[l]);return e?(0,o.jsx)(t.ui_kit$Alert,{className:s,title:i("Anchor links do not work in Outlook, Gmail, and several other email clients."),type:"warning",showIcon:!0,style:n}):null},Ii=e=>!(!e.startsWith("#")||e.indexOf("#",1)!==-1),Cn=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*(["'])((?:\\.|(?!\1).)*?)\1(?:\s*\/?>)?\s*$/i,Pn=/^(?:<\s*[a-z][\w:-]*\b[^>]*\s+)?href\s*=\s*([^\s/>]+)(?:\s*\/?>)?\s*$/i;function rt(e){if(typeof e!="string")return e;let i=e.trim();if(!i)return i;const l=i.match(Cn);if(l)i=l[2];else{const s=i.match(Pn);s&&(i=s[1])}return i.startsWith("https://http")&&(i=i.substring(8)),i}var Dt=(e,i="https://")=>e?e.startsWith("https://")||e.startsWith("http://")?"https://":e.startsWith("mailto:")?"mailto:":e.startsWith("tel:")?"tel:":e.startsWith("sms:")?"sms:":e.startsWith("ftp://")?"ftp://":Ii(e)?"#":"":i,Go=(e,i)=>{const l=Dt(e,"");return i(l),l},Vr=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]}}},Ci=(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":""),So=e=>e&&e!=="auto"?e:e===0?"0":"",Hr=(e,i)=>{if(typeof e=="object"&&e!==null&&"value"in e){if(e.value)return e.value;if(e.value==="")return""}return typeof e=="string"&&e?e:i||""};function Pi(e){const i={...e,link:e.link==null?"https://":e.link,borderRadiusAll:u(e.borderRadius?.all),borderRadiusTopLeft:u(e.borderRadius?.topLeft),borderRadiusBottomLeft:u(e.borderRadius?.bottomLeft),borderRadiusTopRight:u(e.borderRadius?.topRight),borderRadiusBottomRight:u(e.borderRadius?.bottomRight),mobileBorderRadiusAll:u(e.mobileBorderRadius?.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius?.topLeft!==null?e.mobileBorderRadius?.topLeft:e.mobileBorderRadius?.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius?.bottomLeft!==null?e.mobileBorderRadius?.bottomLeft:e.mobileBorderRadius?.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius?.topRight!==null?e.mobileBorderRadius?.topRight:e.mobileBorderRadius?.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius?.bottomRight!==null?e.mobileBorderRadius?.bottomRight:e.mobileBorderRadius?.all),show:e.show?e.show:"all",altSrc:e.src};if(e.video&&(i.videoPlayButton=e.video.playButton??"youtube_red",i.videoSource=e.video.source??""),e.carouselImages?.length>0){const 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 Ur(e,i,l){const s=l.hasOwnProperty("images"),n=l.hasOwnProperty("sections"),d=Object.keys(s?l.images:n?l.sections:l)[0],c=s?l.images:n?l.sections:l;let p={};const g=i.getFieldsValue(!0);switch(d.split("_")[0]){case wn:case yn:case Rn:case jn:if(s){const _=[...e.carouselImages];_[d.split("_")[1]][d.split("_")[0]]=c[d],p={carouselImages:_}}else p=c;break;case vn:if(n){const _=[...e.sections];_[d.split("_")[1]][d.split("_")[0]]=c[d],p={sections:_}}break;case mt:let m=rt(c[d]);e.type===r.ELEMENT_TYPES.CAROUSEL?(p.carouselImages=e.carouselImages,s?(i.setFieldValue(["images",[mt+"_"+d.split("_")[1]]],m),p.carouselImages[d.split("_")[1]].link=m,p.link="",i.setFieldValue(mt,"")):(e.carouselImages.forEach((_,E)=>{i.setFieldValue(["images",mt+"_"+E],m),p.carouselImages[E].link=m,p.link=m}),i.setFieldValue(mt,m))):(i.setFieldValue(mt,m),p.link=m);break;case Dr:p={borderRadius:{...e.borderRadius,[U.BORDER_RADIUS_POSITION[vi]]:g[vi],[U.BORDER_RADIUS_POSITION[ji]]:g[ji],[U.BORDER_RADIUS_POSITION[wi]]:g[wi],[U.BORDER_RADIUS_POSITION[yi]]:g[yi],[U.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case vi:case ji:case wi:case yi:p={borderRadius:{...e.borderRadius,[U.BORDER_RADIUS_POSITION[Dr]]:null,[U.BORDER_RADIUS_POSITION[d]]:+c[d]}};break;case Tn:case Si:case Bi:case Ti:case Ri:p={mobileBorderRadius:{...e.mobileBorderRadius,[U.MOBILE_BORDER_RADIUS_POSITION[Si]]:g[Si],[U.MOBILE_BORDER_RADIUS_POSITION[Bi]]:g[Bi],[U.MOBILE_BORDER_RADIUS_POSITION[Ti]]:g[Ti],[U.MOBILE_BORDER_RADIUS_POSITION[Ri]]:g[Ri],[U.MOBILE_BORDER_RADIUS_POSITION[d]]:c[d],classNamePrefix:"em-mob-border_radius_"+U.MOBILE_BORDER_RADIUS_POSITION[d]+"-"}};break;default:p=c}return{...e,...p}}var Mo=(0,o.jsxs)(t.ui_kit$Select,{className:"select-after",children:[(0,o.jsx)(Ei,{value:"px",children:"px"}),(0,o.jsx)(Ei,{value:"%",children:"%"})]}),Nn=(0,o.jsx)(t.ui_kit$Select,{className:"select-after",children:(0,o.jsx)(Ei,{value:"px",children:"px"})}),Wr=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:n,boxShadowShow:d,oneBorderRadiusValue:c,setOneBorderRadiusValue:p,hasLink:g,hasAlt:m,hasTitle:_,isOpenSrcReplacer:E,mergeTagItems:b,mergeMenuOpen:h,setMergeMenuOpen:k,cascaderRef:x,linkInputRef:T,linkButtonRef:v,altInputRef:P,altButtonRef:B,titleInputRef:y,titleButtonRef:D,srcReplacerInputRef:z,srcReplacerButtonRef:A,linkProtocol:$,handleLinkProtocolsChange:j,linkButtonHandler:W,linkInputHandler:Y,altButtonHandler:ee,altInputHandler:I,titleButtonHandler:le,titleInputHandler:ke,srcReplacerButtonHandler:Ne,srcInputHandler:Q,handleSelect:fe,onChange:Ae,filter:ne,renderSearchOption:Fe,handleChangeValues:Le,toggleShowBorderHandler:Ue,toggleShowBorderRadiusHandler:ve,toggleShowBoxShadowHandler:Be})=>{const{__:xe}=r.useI18n(),{token:ce}=(0,t.ui_kit$useToken)(),be=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})}),be.formImageFieldVerticalAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,align:"right",children:(0,o.jsx)(Vo,{form:e,elementSettings:i})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:i.type==="countdown"?15:24}}),i.type==="countdown"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(xi,{form:e,elementSettings:i,handleChangeValues:Le}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),be.mergeTagsShow&&b&&(0,o.jsx)(t.ui_kit$Col,{span:24,id:"merge_tags_wrapper",children:(0,o.jsxs)(t.ui_kit$Form.Item,{style:{marginBottom:24},children:[(0,o.jsx)(t.ui_kit$Button,{id:"merge_tags_button",icon:(0,o.jsx)(r.EmIcons,{icon:"MergeTags",component:t.icons$MergeTags}),style:{width:"100%",display:h?"none":"inline-flex"},onClick:()=>k(!0),children:xe("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:x,classNames:{popup:{root:"merge-tags"}},options:b,placeholder:xe("Start typing the title"),showSearch:{filter:ne,render:Fe},spellCheck:"false",getPopupContainer:ue=>ue.closest(".email-pane__collapse-wrapper"),onChange:Ae,style:{display:h?"block":"none"},open:h,onKeyDown:ue=>{ue.key==="Escape"&&k(!1)}})]})}),i.type==="video"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(ki,{form:e,elementSettings:i}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),(i.type==="img"||i.type==="video")&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,o.jsx)(Fo,{form:e,label:xe("Image path"),name:"src",placeholder:xe("Image path"),elementSettings:i,tooltipTitle:""})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,style:{marginBottom:!m&&!g&&!_&&!E?ce.formItemMarginBottomMD+4:ce.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:m||xe("Alternative text"),placement:"bottom",getPopupContainer:ue=>ue.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":!!m}),onClick:ee,ref:B,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),be.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:_||xe("Tooltip text"),placement:"bottom",getPopupContainer:ue=>ue.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":!!_}),onClick:le,ref:D,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:g||xe("Hyperlink URL"),placement:"bottom",getPopupContainer:ue=>ue.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":!!g}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:W,ref:v})}),be.formImageFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:xe("Image replacer"),placement:"bottom",getPopupContainer:ue=>ue.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":E}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:Ne,ref:A})})]}),(!!g||!!m||!!_||!!E)&&(0,o.jsxs)("div",{style:{marginBottom:ce.formItemMarginBottomMD+4},children:[!!g&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(it,{show:$==="#",__:xe,style:{marginBottom:ce.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:xe("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:ce.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(tt,{linkProtocol:$,handleLinkProtocolsChange:j,__:xe}),placeholder:xe("Hyperlink URL"),allowClear:!0,ref:T,onChange:Y,onSelect:fe,prefix:(0,o.jsx)(ot,{linkProtocol:$})})})})]}),!!m&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:xe("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:ce.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:xe("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:I,ref:P,onSelect:fe})})}),be.formFieldImageTitleEnabled&&!!_&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:xe("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:ce.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:xe("Enter the title of the image"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:ke,ref:y,onSelect:fe})})}),!!E&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:xe("Image src"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"imgReplacer",className:"selected-image-form__alt",style:{marginBottom:ce.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:xe("Code that will replace the image `src`"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:xe("Image src")}),onChange:Q,ref:z,onSelect:fe})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:xe("Size"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:i.maxWidth,showHeight:be.formImageFieldHeightEnabled,showMinMax:!1,gutter:ce.marginSM,rowStyle:{marginBottom:be.formImageFieldHeightEnabled?4:24},labels:{width:xe("Width"),height:xe("Height"),minWidth:xe("Minimum width"),maxWidth:xe("Maximum width")}})}),be.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:xe("Borders"),collapsible:!0,open:s,onToggle:Ue,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,elementSettings:i})}),be.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:xe("Border radius"),collapsible:!0,open:n,onToggle:ve,dividerTop:!0,children:(0,o.jsx)(vo,{form:e,oneBorderRadiusValue:c,setOneBorderRadiusValue:p,elementSettings:i})}),be.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:xe("Box shadow"),collapsible:!0,open:d,onToggle:Be,dividerTop:!0,children:(0,o.jsx)(No,{})}),be.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:xe("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e})}),be.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:xe("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})};Wr.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 Yo=({form:e,name:i,elementSettings:l,isPicture:s,tooltipTitle:n})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),p=(0,a.useRef)(),[g,m]=(0,a.useState)(l[i]?.value==="auto"),{token:_}=(0,t.ui_kit$useToken)(),[E,b]=(0,a.useState)(void 0),h=x=>{e.setFieldsValue({[i]:"",[i+"Dim"]:"px"}),m(T=>!T),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{[i]:{classNamePrefix:"em-mob-width-",value:g?null:"auto",dim:""}}})},k=x=>{m(!1);const T=e.getFieldsValue(!0);b(T[`${String(i)}Dim`]==="%"?100:void 0)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:n,placement:"bottom",children:(0,o.jsx)("div",{children:(0,o.jsx)(t.ui_kit$Form.Item,{name:i,style:{marginBottom:_.formItemMarginBottomXS/2},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{ref:p,min:0,max:E,placeholder:d("Width"),onChange:k,prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:(0,o.jsx)(t.ui_kit$Form.Item,{name:i+"Dim",noStyle:!0,children:Mo})})})})}),!s&&(0,o.jsx)(t.ui_kit$Switch,{id:"auto-width",label:d("Auto"),labelSize:"small",size:"small",checked:g,onChange:h})]})};Yo.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string};var lt=({form:e,name:i,elementSettings:l,isPicture:s,tooltipTitle:n})=>{const{__:d}=r.useI18n(),c=r.useSendPostMessage(),p=(0,a.useRef)(),[g,m]=(0,a.useState)(l.mobileHeight?.value==="auto"),{token:_}=(0,t.ui_kit$useToken)(),E=h=>{e.setFieldsValue({mobileHeight:"",mobileHeightDim:"px"}),m(k=>!k),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{mobileHeight:{classNamePrefix:"em-mob-height-",value:g?null:"auto",dim:""}}})},b=h=>{m(!1)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:n,placement:"bottom",children:(0,o.jsx)("div",{children:(0,o.jsx)(t.ui_kit$Form.Item,{name:i,style:{marginBottom:_.formItemMarginBottomXS/2},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{ref:p,min:0,placeholder:d("Height"),onChange:b,prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})}),!s&&(0,o.jsx)(t.ui_kit$Switch,{id:"auto-height",label:d("Auto"),labelSize:"small",size:"small",checked:g,onChange:E})]})};lt.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string};var zr=({form:e,elementSettings:i,handleChangeValues:l,boxShadow:s,mobileBordersShow:n,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:p,oneMobileBorderRadiusValue:g,setOneMobileBorderRadiusValue:m,hasLink:_,hasAlt:E,hasTitle:b,linkInputRef:h,linkButtonRef:k,altInputRef:x,altButtonRef:T,titleInputRef:v,titleButtonRef:P,linkInputHandler:B,altButtonHandler:y,altInputHandler:D,titleButtonHandler:z,titleInputHandler:A,linkButtonHandler:$,toggleShowMobileBorderHandler:j,toggleShowMobileBorderRadiusHandler:W,toggleShowMobileBoxShadowHandler:Y,toggleShowMobileSizeHandler:ee})=>{const{__:I}=r.useI18n(),{token:le}=(0,t.ui_kit$useToken)(),ke=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"})}),ke.formImageFieldVerticalAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,align:"right",children:(0,o.jsx)(Vo,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:i.type==="countdown"?15:24}}),i.type==="countdown"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(xi,{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)(ki,{form:e,elementSettings:i}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}})]}),(i.type==="img"||i.type==="video")&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,o.jsx)(Fo,{form:e,label:I("Image path"),name:"src",placeholder:I("Image path"),elementSettings:i,tooltipTitle:""})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,style:{marginBottom:!E&&!_&&!b?le.formItemMarginBottomMD+4:le.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:E||I("Alternative text"),placement:"bottom",getPopupContainer:Ne=>Ne.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":!!E}),onClick:y,ref:T,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),ke.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:b||I("Tooltip text"),placement:"bottom",getPopupContainer:Ne=>Ne.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":!!b}),onClick:z,ref:P,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:_||I("Hyperlink URL"),placement:"bottom",getPopupContainer:Ne=>Ne.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":!!_}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:$,ref:k})})]}),(!!_||!!E||!!b)&&(0,o.jsxs)("div",{style:{marginBottom:le.formItemMarginBottomMD+4},children:[!!_&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:I("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:le.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{ref:h,allowClear:!0,placeholder:I("Hyperlink URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined}),onChange:B})})}),!!E&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:I("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:le.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:I("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:D,ref:x})})}),ke.formFieldImageTitleEnabled&&!!b&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:I("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:le.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:I("Tooltip text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:A,ref:v})})})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:I("Size"),collapsible:!0,open:p,onToggle:ee,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)(Yo,{form:e,name:"mobileWidth",elementSettings:i,isPicture:"true",tooltipTitle:I("Width")})}),ke.formImageFieldHeightEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(lt,{form:e,name:"mobileHeight",elementSettings:i,isPicture:"true",tooltipTitle:I("Height")})})]})}),ke.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Borders"),collapsible:!0,open:n,onToggle:j,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),ke.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Border radius"),collapsible:!0,open:d,onToggle:W,dividerTop:!0,children:(0,o.jsx)(vo,{form:e,oneBorderRadiusValue:g,setOneBorderRadiusValue:m,elementSettings:i,typeOfForm:"mobile"})}),ke.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Box shadow"),collapsible:!0,open:c,onToggle:Y,dividerTop:!0,children:(0,o.jsx)(No,{typeOfForm:"mobile"})}),ke.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e})}),ke.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:I("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})};zr.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 An=e=>typeof e=="object"&&e!==null?e.path:void 0;function Do(){const e=(0,a.useRef)(!1),i=(0,a.useRef)(null),l=(0,a.useCallback)(n=>{e.current=!n},[]),s=(0,a.useCallback)((n,d)=>{const c=JSON.stringify(An(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 pt(e){const i=(0,a.useRef)(null),l=(0,a.useRef)(e);return l.current=e,{remember:(0,a.useCallback)(s=>{i.current=s},[]),fillFields:(0,a.useCallback)((s,n)=>{l.current!==i.current&&s.setFieldsValue(n)},[]),isOwnEcho:(0,a.useCallback)(()=>l.current===i.current,[])}}var Gr=2e3;function Yr(e,{ordered:i=!1}={}){const l=(0,a.useRef)([]),s=(0,a.useRef)(new WeakMap),n=(0,a.useRef)(e);return n.current=e,{remember:(0,a.useCallback)(d=>{const c=Date.now(),p=l.current.filter(g=>c-g.at<Gr);p.push({key:JSON.stringify(n.current(d)),at:c}),l.current=p.slice(-10),i&&d&&typeof d=="object"&&s.current.set(d,!1)},[i]),isOwnEcho:(0,a.useCallback)(d=>{if(!d)return!1;const c=Date.now(),p=JSON.stringify(n.current(d)),g=l.current.filter(E=>c-E.at<Gr);if(!i)return g.some(E=>E.key===p);const m=s.current.get(d);if(m!==void 0)return m;const _=g.findIndex(E=>E.key===p);return _>=0&&(l.current=g.slice(_)),s.current.set(d,_>=0),_>=0},[i]),forget:(0,a.useCallback)(()=>{l.current=[],s.current=new WeakMap},[])}}var Ln=1e3,On=2e4,Xr="https://useblocks.io/app/",$n=["activateSection","changeKey","parent","path","nextElem","prevElem"];function Ni(e){if(Array.isArray(e))return e.map(Ni);if(e&&typeof e=="object"){const i=e;return Object.fromEntries(Object.keys(i).sort().map(l=>[l,Ni(i[l])]))}return e}function Fn(e){const i={...e};return $n.forEach(l=>delete i[l]),Ni(i)}var Kr=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm(),s=Do(),n=Do();let d=r.useDispatch();const c=r.useAppConfig(),p=r.useContainer(),g=r.useEditorProjectId(),m=r.useNotification(),_=r.useSendPostMessage(),E=r.useSendPostMessageEx(),{openImagePicker:b}=r.useImagePicker(),h=r.useSelector(r.selectEmailViewType),k=r.useSelector(r.selectMobileViewActive),x=r.useCurrentUser(),T=r.useSelector(r.selectIsCodeMode),v=r.useSelector(r.selectCodeModeDirection),[P]=r.useUploadImageMutation(),[B,y]=r.useSendShortLinkMutation(),[D,z]=(0,a.useState)({name:"",counter:0}),A=(0,a.useRef)(null),$=(0,a.useRef)(null),j=(0,a.useRef)(null),W=(0,a.useRef)(null),Y=(0,a.useRef)(null),ee=(0,a.useRef)(null),I=(0,a.useRef)(null),le=(0,a.useRef)(null),ke=(0,a.useRef)(null),[Ne,Q]=(0,a.useState)({}),[fe,Ae]=(0,a.useState)(!0),[ne,Fe]=(0,a.useState)(!0),[Le,Ue]=(0,a.useState)(""),[ve,Be]=(0,a.useState)(""),[xe,ce]=(0,a.useState)(""),[be,ue]=(0,a.useState)(!1),[q,Z]=(0,a.useState)(!1),[te,ae]=(0,a.useState)(!1),[de,De]=(0,a.useState)(!1),[oe,Te]=(0,a.useState)(!1),[_e,Ce]=(0,a.useState)(!1),[R,V]=(0,a.useState)(!1),[L,X]=(0,a.useState)(!1),[ie,me]=(0,a.useState)("https://"),he=(0,a.useRef)(!1),$e=(0,a.useRef)(),je=e,G=(0,a.useRef)(je);G.current=je;const re=(0,a.useCallback)(()=>l.getFieldsValue(!0).video,[l]),[O,pe]=(0,a.useState)(),[ye,ze]=(0,a.useState)(!1),[oo,ro]=(0,a.useState)(null),[ao,M]=(0,a.useState)({start:0,end:0}),[se,C]=(0,a.useState)(!1),[H,Pe]=(0,a.useState)(!1),[He,_o]=(0,a.useState)(!1),[mo,co]=(0,a.useState)(!1),ge=(0,a.useRef)(void 0),Ge=(0,a.useRef)(null),Je=(0,a.useRef)(null),io=mo||He||L;(0,a.useEffect)(()=>()=>clearTimeout(ge.current),[]);const fo=(0,a.useRef)(null);(0,a.useEffect)(()=>{const N=fo.current,Oe=N?.firstElementChild??null;if(!io||!N||!Oe)return;const Ee=[];for(let lo=N.parentElement;lo;lo=lo.parentElement)getComputedStyle(lo).overflowY!=="visible"&&Ee.push(lo);let Se=0,Me="";const Ze=()=>{const lo=N.getBoundingClientRect(),Bo=N.offsetHeight>0?lo.height/N.offsetHeight:1;let To=Math.max(lo.top,0),uo=Math.min(lo.bottom,window.innerHeight);Ee.forEach(Zo=>{const Et=Zo.getBoundingClientRect();To=Math.max(To,Et.top),uo=Math.min(uo,Et.bottom)});const xo=(To-lo.top)/(Bo||1),jo=Math.max(uo-To,0)/(Bo||1),Co=`${Math.round(xo)}/${Math.round(jo)}`;Co!==Me&&(Me=Co,Oe.style.top=`${xo}px`,Oe.style.height=`${jo}px`),Se=requestAnimationFrame(Ze)};return Ze(),()=>cancelAnimationFrame(Se)},[io]);const F=()=>{const N=Ge.current;Je.current=N?.isConnected&&typeof N.selectionStart=="number"?{element:N,start:N.selectionStart,end:N.selectionEnd??N.selectionStart}:null},K=T&&v!=="bottom",Ie=r.useElementEntityKind();(0,a.useEffect)(()=>{ye&&ke.current&&ke.current.focus()},[ye]);const J=(N,Oe)=>{const Ee=document.getElementById(Oe);if(Ee){const Se=Oe.substring(Oe.indexOf("selected_image_form_")+20),Me=Ee.value?.substring(0,ao.start),Ze=Ee.value?.substring(ao.end);_({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{...e,[Se]:Me+N+Ze}}),l.setFieldValue(Se,Me+N+Ze),Ee.focus(),setTimeout(()=>{Ee.selectionStart=ao.start,Ee.selectionEnd=ao.start+N.length},400),C(!0)}},Ve=r.useAppConfig().mergeTags;(0,a.useEffect)(()=>{Ve?.items?.length&&pe(r.mapMargeTags(Ve.items))},[Ve,pe]);const qe=(N,Oe)=>{if(ze(!1),N){const Ee=Ve.syntax.length>1?O.findIndex(Me=>Me.key===Oe[0].key):0,Se=Ve.syntax[Ee].replace("%value%",N[N.length-1]);oo?.getAttribute("id")==="selected_image_form_title"||oo?.getAttribute("id")==="selected_image_form_alt"||oo?.getAttribute("id")==="selected_image_form_link"||oo?.getAttribute("id")==="selected_image_form_imgReplacer"?J(Se,oo?.getAttribute("id")):(l.setFieldValue("imgReplacer",Se),_({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:Se}}))}},We=(N,Oe)=>Oe.some(Ee=>Ee.label.toLowerCase().indexOf(N.toLowerCase())>-1),to=(N,Oe)=>{const Ee=Oe.map((Se,Me)=>{const Ze=Se.label.split(new RegExp(`(${N})`,"gi"));return(0,o.jsxs)("span",{children:[Me!==0&&(0,o.jsx)("span",{children:" / "}),Ze.map((lo,Bo)=>lo.toLowerCase()===N.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:lo},Bo):lo)]},Se.value)});return(0,o.jsx)("div",{title:Oe.map(Se=>Se.label).join(" / "),children:Ee})},Qe=r.useRootElement();(0,a.useEffect)(()=>{const N=({target:Se})=>{Se.closest('[id="merge_tags_wrapper"]')||(Ge.current=Se,ro(Se))},Oe=({target:Se})=>{!Se.closest(".merge-tags")&&!Se.closest("#merge_tags_button")&&ze(!1)},Ee=new Po.Disposable;return Ee.addDisposable(r.addWindowListenerFromShadow(Qe,"focusin",N)),Ee.addDisposable(r.addWindowListenerFromShadow(Qe,"click",Oe)),()=>{Ee.dispose()}},[Qe]);const wo=({target:N})=>{if(N&&!se){const{selectionStart:Oe,selectionEnd:Ee}=N;M({start:Oe,end:Ee})}C(!1)},Eo=e.border,w=e.mobileBorder,Re=Object.keys(Eo).find(N=>Eo[N]?.width||Eo[N]?.style||Eo[N]?.color),S=Object.keys(w).find(N=>w[N]?.width||w[N]?.style||w[N]?.color),we=N=>N&&(N?.width||N?.style||N?.color)?N:"",{remember:Xe,fillFields:ho}=pt(e),{remember:Ye,isOwnEcho:Wo,forget:kt}=Yr(Fn,{ordered:!0}),Qo=(0,a.useRef)(void 0);(0,a.useEffect)(()=>{if(e){const N=e.path;N!==Qo.current&&(Qo.current=N,kt());const Oe=Wo(e)?()=>{}:ho;e.src!==$e.current&&($e.current=e.src,he.current=!1);const Ee=e.boxShadow;if(Q(Ee),e.link&&me(Dt(e.link,"https://")),Oe(l,{...e,link:e.link==null?"https://":e.link,width:e.width?.value,widthDim:e.width?.dim,height:e.height?.value,heightDim:e.height?.dim,borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),mobileBorderAll:we(e.mobileBorder.all)||!(we(e.mobileBorder.top)||we(e.mobileBorder.bottom)||we(e.mobileBorder.right)||we(e.mobileBorder.left))&&we(e.border.all),mobileBorderTop:we(e.mobileBorder.top)||!we(e.mobileBorder.all)&&we(e.border.top),mobileBorderBottom:we(e.mobileBorder.bottom)||!we(e.mobileBorder.all)&&we(e.border.bottom),mobileBorderRight:we(e.mobileBorder.right)||!we(e.mobileBorder.all)&&we(e.border.right),mobileBorderLeft:we(e.mobileBorder.left)||!we(e.mobileBorder.all)&&we(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:So(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:So(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:So(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:So(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",...je.video}}),e.countdown){let Ze=new URL("https://emailmaker.ru/?"+e.countdown),lo=Ze.searchParams.get("font1"),Bo=!1,To=!1;lo.endsWith("-b")?(lo=lo.substring(0,lo.length-2),Bo=!0):lo.endsWith("-i")?(lo=lo.substring(0,lo.length-2),To=!0):lo.endsWith("-bi")&&(lo=lo.substring(0,lo.length-3),Bo=!0,To=!0);let uo=Ze.searchParams.get("font2"),xo=!1,jo=!1;uo.endsWith("-b")?(uo=uo.substring(0,uo.length-2),xo=!0):uo.endsWith("-i")?(uo=uo.substring(0,uo.length-2),jo=!0):uo.endsWith("-bi")&&(uo=uo.substring(0,uo.length-3),xo=!0,jo=!0),Oe(l,{countdownTime:(0,ct.default)(new Date(Date.parse(Ze.searchParams.get("time"))+Ze.searchParams.get("timezone")*36e5+new Date().getTimezoneOffset()/60*36e5).toISOString()),countdownDuration:Ze.searchParams.get("frames")||20,countdownTimeZone:Ze.searchParams.get("timezone"),countdownLanguage:Ze.searchParams.get("locale").replace("-","_"),countdownBackgroundColor:"#"+Ze.searchParams.get("bg"),countdownTransparency:Ze.searchParams.get("tp")==="true"?"checked":"",countdownNumbersFont:lo,countdownNumbersFontSize:Ze.searchParams.get("size1")/2,countdownNumbersFontSizeDim:"px",countdownNumbersColor:"#"+Ze.searchParams.get("color1"),countdownLabelsFont:uo,countdownLabelsFontSize:Ze.searchParams.get("size2")/2,countdownLabelsFontSizeDim:"px",countdownLabelsColor:"#"+Ze.searchParams.get("color2"),countdownNumbersStrong:Bo,countdownNumbersItalic:To,countdownLabelsStrong:xo,countdownLabelsItalic:jo})}!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?Ae(!1):Ae(!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))?Fe(!1):Fe(!0);const Se=s.isStaleBorderSnapshot(e,!!Re),Me=n.isStaleBorderSnapshot(e,!!S);Se&&l.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Me||Se&&!S)&&l.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),ue(Ze=>Re&&!Se?!0:Ze),Z(Ze=>Re&&!Se||S&&!Me?!0:Ze),ae(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),De(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight||!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),Te(!!e.boxShadow),Ce(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),V(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value||!!e.height.value),e.link?Ue(e.link):Ue(he.current?"...":""),Be(e.alt),ce(e.title),Pe(e.imgReplacer?.length)}},[l,e,ho,Wo,kt,je,Re,S,s,n]),(0,a.useEffect)(()=>{if(io)return;const N=Je.current;Je.current=null,!(!N||!N.element.isConnected||N.element.disabled)&&Ge.current===N.element&&(N.element.focus(),N.element.setSelectionRange(N.start,N.end))},[io]);const Ir=async(N,Oe,Ee)=>{const Se={};Se.user_id=x.id,Se.folder=N,Oe&&(Oe=await r.prepareImageForEditorUpload(Oe,r.withCompressImagesChoice(p,c)),Se.file=Oe),Ee&&(Se.page_url=Ee);const Me=await P(Se);if(Me.error)m.fromError("IMAGE_UPLOAD_ERROR",Oe,Me.error,!0);else{const Ze=bn.extractUploadResult(Me.data);if(Ze.error)return;if(Ze.file_url)return Ze.file_url}},sn=(N,Oe)=>new Promise((Ee,Se)=>{const Me=new Image,Ze=new Image;Me.crossOrigin="Anonymous",Ze.crossOrigin="Anonymous";let lo=Oe?2:1;const Bo=()=>{clearTimeout(uo),Se(new Error("video preview images are not loaded"))},To=()=>{lo-=1,lo===0&&(clearTimeout(uo),Ee({frame:Me,button:Oe?Ze:null}))},uo=setTimeout(Bo,On);Me.onload=To,Me.onerror=Bo,Me.src=N,Oe&&(Ze.onload=To,Ze.onerror=Bo,Ze.src=Oe)}),an=(N,Oe,Ee,Se)=>{const Me=document.createElement("canvas"),Ze=Me.getContext("2d");if(Me.width=N.width,Me.height=N.height,Ze.clearRect(0,0,Me.width,Me.height),Ze.drawImage(N,0,0,N.width,N.height),!Oe)return Me;const lo=Math.min(Me.width,Me.height);let Bo;if(N.height>N.width)Bo=.3;else{const Et=N.width/N.height;Bo=Math.min(Se,.3+(Et-1)/(Ee-1)*.1)}const To=lo*Bo,uo=Oe.width/Oe.height;let xo,jo;uo>=1?(xo=To,jo=To/uo):(jo=To,xo=To*uo);const Co=(Me.width-xo)/2,Zo=(Me.height-jo)/2;return Ze.drawImage(Oe,Co,Zo,xo,jo),Me},nn=N=>new Promise(Oe=>{N.toBlob(Ee=>Oe(Ee?new File([Ee],"image.jpeg",{type:"image/jpeg"}):null),"image/jpg",1)}),zp=async N=>{const Oe=l.getFieldsValue(!0).video?.playButton||e.video?.playButton;if(!(!N||!Oe||Oe==="none"||He)){F(),_o(!0);try{const{frame:Ee,button:Se}=await sn(N,`${Xr}${Oe}.png`),Me=await nn(an(Ee,Se,2,.4)),Ze=Me&&await Ir(g,Me);if(!Ze)return;_({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:G.current.type,settings:{src:Ze}}),Lt({...G.current,src:Ze,video:re()||G.current.video,activateSection:null,changeKey:"src"}),setTimeout(()=>{l.setFieldValue("src",Ze)},100)}catch{}finally{_o(!1)}}},Gp=async()=>{const N=re(),Oe=N?.source,Ee=N?.playButton;if(!Oe)return;const Se=()=>re()?.source!==Oe;F(),co(!0);try{const Me=await Ir("tmp",null,Oe);if(!Me||Se())return;const{frame:Ze,button:lo}=await sn(Me,Ee&&Ee!=="none"?`${Xr}${Ee}.png`:null);if(Se())return;const Bo=await nn(an(Ze,lo,2.5,.35)),To=Bo&&await Ir(g,Bo);To&&!Se()&&Pr(To)}catch{}finally{co(!1)}},Cr=N=>{clearTimeout(ge.current),ge.current=setTimeout(()=>{N()},Ln)},Yp=()=>{const N=l.getFieldsValue(!0);let Oe=new URL("https://cdt3.useblocks.io/rndt?"+e.countdown),Ee=N.countdownNumbersFont;N.countdownNumbersStrong&&N.countdownNumbersItalic?Ee+="-bi":N.countdownNumbersStrong?Ee+="-b":N.countdownNumbersItalic&&(Ee+="-i");let Se=N.countdownLabelsFont;N.countdownLabelsStrong&&N.countdownLabelsItalic?Se+="-bi":N.countdownLabelsStrong?Se+="-b":N.countdownLabelsItalic&&(Se+="-i"),Oe.searchParams.set("time",new Date(N.countdownTime.$d-N.countdownTimeZone*36e5-new Date().getTimezoneOffset()/60*36e5).toISOString()),Oe.searchParams.set("bg",N.countdownBackgroundColor.substring(1)||"#FFFFFF"),Oe.searchParams.set("tp",!!N.countdownTransparency),Oe.searchParams.set("font1",Ee),Oe.searchParams.set("size1",N.countdownNumbersFontSize*2||12),Oe.searchParams.set("color1",N.countdownNumbersColor.substring(1)||"#000000"),Oe.searchParams.set("font2",Se),Oe.searchParams.set("size2",N.countdownLabelsFontSize*2||8),Oe.searchParams.set("color2",N.countdownLabelsColor.substring(1)||"#959595"),Oe.searchParams.set("spacing",Math.round(N.countdownNumbersFontSize*.4)||5),Oe.searchParams.set("locale",N.countdownLanguage.replace("_","-")),Oe.searchParams.set("timezone",N.countdownTimeZone),Oe.searchParams.set("frames",N.countdownDuration),B({link:JSON.stringify({target:Oe.href})}),F(),X(!0)},Lt=(0,a.useCallback)(N=>{Xe(N),Ye(N),d(Ie==="email"?r.setElementSettings$1(N):r.setElementSettings(N))},[d,Ie,Xe,Ye]),Pr=(0,a.useCallback)((N,Oe)=>{const Ee=G.current,Se=r.stripEmVersionFromUrlString(Ee.src||"")===r.stripEmVersionFromUrlString(N||"");(!Se||N!==Ee.src)&&(_({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Ee.type,settings:{src:N}}),Lt({...Ee,src:N,...Ee.type==="video"?{video:re()||Ee.video}:{},activateSection:null,changeKey:"src"}),l.setFieldValue("src",N)),Oe?.mode==="save"&&Se&&(z(Me=>({name:"src",counter:Me.counter+1})),E(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(N)}))},[l,re,Lt,_,E]),Ot=(0,a.useCallback)(async N=>{const Oe=e.src||"",Ee=r.stripEmVersionFromUrlString(Oe),Se=await b({kind:"img",currentUrl:ut(Ee)?"":Ee,entryModal:N});Se?.url&&Pr(Se.url,Se.meta)},[Pr,e.src,b]),Nr=(N,...Oe)=>{const Ee=l.getFieldsValue(!0),Se=Object.keys(N)[0];let Me;switch(Se){case"link":let Ze=rt(N[Se]);Ze!==N[Se]&&l.setFieldValue("link",Ze),Me={link:Ze};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":Me={boxShadow:{hOffset:Ee.boxShadowHOffset,vOffset:Ee.boxShadowVOffset,blurRadius:Ee.boxShadowBlurRadius,spreadRadius:Ee.boxShadowSpreadRadius,color:Ee.boxShadowColor,inset:Ee.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":Ee.borderPosition==="borderAll"?(Me={border:{...r.RESET_BORDER_PARAMS,all:{...U.NULL_BORDER,...Ee.borderAll}}},l.setFieldsValue({borderLeft:U.NULL_BORDER,borderRight:U.NULL_BORDER,borderTop:U.NULL_BORDER,borderBottom:U.NULL_BORDER})):Ee.borderAll?.width||Ee.borderAll?.style||Ee.borderAll?.color?(Me={border:{all:null,left:Ee.borderAll,right:Ee.borderAll,top:Ee.borderAll,bottom:Ee.borderAll,[U.REVERSE_BORDER_POSITIONS[Se]]:{...Ee[Se],...N[Se]}}},l.setFieldsValue({borderAll:null,borderLeft:Ee.borderAll,borderRight:Ee.borderAll,borderTop:Ee.borderAll,borderBottom:Ee.borderAll,[Se]:{...Ee[Se],...N[Se]}})):(Me={border:{all:null,left:Ee.borderLeft,right:Ee.borderRight,top:Ee.borderTop,bottom:Ee.borderBottom,[U.REVERSE_BORDER_POSITIONS[Se]]:{...Ee[Se],...N[Se]}}},l.setFieldsValue({border:Me.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(Ee.mobileBorderPosition==="mobileBorderAll")Me={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...U.NULL_BORDER,...Ee.mobileBorderAll,classNamePrefix:"em-mob-border_"+U.MOBILE_REVERSE_BORDER_POSITIONS[Se]+"-"}}},l.setFieldsValue({borderLeft:U.NULL_BORDER,borderRight:U.NULL_BORDER,borderTop:U.NULL_BORDER,borderBottom:U.NULL_BORDER});else{const uo=U.MOBILE_REVERSE_BORDER_POSITIONS[Se],xo={...Ee[Se],...N[Se]},jo=!xo?.width&&!xo?.style&&!xo?.color;if(Ee.mobileBorder?.all?.width||Ee.mobileBorder?.all?.style||Ee.mobileBorder?.all?.color){const Co=Ee.mobileBorderAll;Me={mobileBorder:{all:null,left:Co,right:Co,top:Co,bottom:Co,[uo]:jo?null:{...xo,classNamePrefix:"em-mob-border_"+uo+"-"}}},l.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:Co,mobileBorderRight:Co,mobileBorderTop:Co,mobileBorderBottom:Co,[Se]:xo})}else{const Co=e.mobileBorder||{},Zo=Et=>{const $t=Co[Et];return $t&&($t?.width||$t?.style||$t?.color)?$t:null};Me={mobileBorder:{all:null,left:uo==="left"?jo?null:{...xo,classNamePrefix:"em-mob-border_left-"}:Zo("left"),right:uo==="right"?jo?null:{...xo,classNamePrefix:"em-mob-border_right-"}:Zo("right"),top:uo==="top"?jo?null:{...xo,classNamePrefix:"em-mob-border_top-"}:Zo("top"),bottom:uo==="bottom"?jo?null:{...xo,classNamePrefix:"em-mob-border_bottom-"}:Zo("bottom")}},l.setFieldsValue({[Se]:xo})}}break;case"width":Me={[Se]:{value:N[Se],dim:Ee.widthDim}};break;case"widthDim":Me={width:{value:Ee.width,dim:N[Se]}};break;case"height":Me={[Se]:{value:N[Se],dim:Ee.heightDim}};break;case"heightDim":Me={height:{value:Ee.height,dim:N[Se]}};break;case"borderRadiusAll":Me={borderRadius:{[U.BORDER_RADIUS_POSITION[Se]]:+N[Se]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":Me={borderRadius:{topLeft:Ee.borderRadiusTopLeft,bottomLeft:Ee.borderRadiusBottomLeft,topRight:Ee.borderRadiusTopRight,bottomRight:Ee.borderRadiusBottomRight,[U.BORDER_RADIUS_POSITION[Se]]:+N[Se]}};break;case"mobileWidth":Me={[Se]:{classNamePrefix:"em-mob-width-",value:N[Se],dim:Ee.mobileWidthDim}};break;case"mobileWidthDim":Me={mobileWidth:{classNamePrefix:"em-mob-width-",value:Ee.mobileWidth||100,dim:N[Se]}};break;case"mobileHeight":Me={[Se]:{classNamePrefix:"em-mob-height-",value:N[Se],dim:Ee.mobileHeightDim}};break;case"mobileHeightDim":Me={mobileHeight:{classNamePrefix:"em-mob-height-",value:Ee.mobileHeight,dim:N[Se]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":Me={mobileBorderRadius:{[U.MOBILE_BORDER_RADIUS_POSITION[Se]]:N[Se],classNamePrefix:"em-mob-border_radius_"+U.MOBILE_BORDER_RADIUS_POSITION[Se]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":Me={mobileBoxShadow:{hOffset:Ee.mobileBoxShadowHOffset,vOffset:Ee.mobileBoxShadowVOffset,blurRadius:Ee.mobileBoxShadowBlurRadius,spreadRadius:Ee.mobileBoxShadowSpreadRadius,color:Ee.mobileBoxShadowColor,inset:Ee.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":Me={[Se]:{classNamePrefix:"em-mob-text_align-",value:N[Se]}};break;case"mobileVerticalAlign":Me={[Se]:{classNamePrefix:"em-mob-vertical_align-",value:N[Se]}};break;case"countdownTime":case"countdownTimeZone":case"countdownBackgroundColor":case"countdownNumbersFont":case"countdownNumbersFontSize":case"countdownNumbersColor":case"countdownLabelsFont":case"countdownLabelsFontSize":case"countdownLabelsColor":case"countdownLanguage":case"countdownDuration":case"countdownTransparency":case"countdownNumbersStrong":case"countdownNumbersItalic":case"countdownLabelsStrong":case"countdownLabelsItalic":Cr(Yp);break;case"video":{const uo={...e.video,...Ee.video,...N.video},xo=uo.source??Ee.link;Cr(Gp),_({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"video",settings:{video:uo,link:xo}}),Lt({...e,video:uo,link:xo,activateSection:null,changeKey:"video"});break}case"src":const lo=N[Se],Bo=e.src,To=Ee.video?.playButton||e.video?.playButton;if(e.type==="video"&&To&&To!=="none"&&!He&&lo&&(!Bo||lo!==Bo)){Cr(()=>zp(lo));return}Me=N;break;default:Me=N}Se!=="borderPosition"&&Se!=="mobileBorderPosition"&&Se.indexOf("countdown")===-1&&Se!=="video"&&(_({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Me}),Se!=="video"&&Se.indexOf("countdown")===-1&&Se!=="mobileBorderRadiusAll"&&Se!=="mobileBorderRadiusTopLeft"&&Se!=="mobileBorderRadiusTopRight"&&Se!=="mobileBorderRadiusBottomLeft"&&Se!=="mobileBorderRadiusBottomRight"&&Lt({...e,...Me,mobileBorderRadius:{...e.mobileBorderRadius,...Me?.mobileBorderRadius},activateSection:null,changeKey:Se}))};(0,a.useEffect)(()=>{y.isError&&(m.error(y),X(!1))},[y]),(0,a.useEffect)(()=>{if(y.isSuccess&&L){if(y.data.data?.status===400)m.error({title:y.data.code,description:y.data.message});else{let N=new URL(y.data.target),Oe={countdown:{link:y.data.link,params:N.search.substring(1)}};_({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:Oe})}X(!1)}},[y,L,e,m,_]);const Xp=N=>{N.data.operation===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(d(r.closeSecondModal()),d(r.closeModal$1()))};r.useListenPostMessage(Xp),r.useImageControlRequest(e.src,N=>{N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?Ot(r.MODALS.UPLOAD_IMAGE_MODAL_AI):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?Ot(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?Ot(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?Ot(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):N===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP&&Ot(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK)});const Kp=()=>{const N=l.getFieldsValue(!0);s.markBorderToggled(!be),setTimeout(()=>{ue(Oe=>!Oe),be?(N.borderAll=U.NULL_BORDER,N.borderTop=U.NULL_BORDER,N.borderBottom=U.NULL_BORDER,N.borderRight=U.NULL_BORDER,N.borderLeft=U.NULL_BORDER):N.borderAll={width:1,color:"#E5E5E5",style:"solid"},_({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:N.borderAll.color,style:N.borderAll.style,width:N.borderAll.width}}}})})},qp=()=>{const N=l.getFieldsValue(!0);n.markBorderToggled(!q),setTimeout(()=>{Z(Oe=>!Oe),q?(N.mobileBorderAll=U.NULL_BORDER,N.mobileBorderTop=U.NULL_BORDER,N.mobileBorderBottom=U.NULL_BORDER,N.mobileBorderRight=U.NULL_BORDER,N.mobileBorderLeft=U.NULL_BORDER):N.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},_({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:N.mobileBorderAll.color,style:N.mobileBorderAll.style,width:N.mobileBorderAll.width}}}})})},Jp=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{ae(Oe=>!Oe),te?(N.borderRadiusAll=0,Ae(!0)):N.borderRadiusAll=5,_({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:N.borderRadiusAll}}})})},Qp=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{De(Oe=>!Oe),de?(N.mobileBorderRadiusAll=null,Fe(!0)):N.mobileBorderRadiusAll=5,_({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:N.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},Zp=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{Te(Oe=>!Oe),oe?(N.boxShadowInset=!1,N.boxShadowHOffset=null,N.boxShadowVOffset=null,N.boxShadowBlurRadius=null,N.boxShadowSpreadRadius=null,N.boxShadowColor=""):(N.boxShadowInset=!1,N.boxShadowHOffset=5,N.boxShadowVOffset=5,N.boxShadowBlurRadius=10,N.boxShadowSpreadRadius=-5,N.boxShadowColor="#000000"),_({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:N.boxShadowBlurRadius,color:N.boxShadowColor,hOffset:N.boxShadowHOffset,inset:N.boxShadowInset,spreadRadius:N.boxShadowSpreadRadius,vOffset:N.boxShadowVOffset}}})})},eh=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{Ce(Oe=>!Oe),_e?(N.mobileBoxShadowInset=!1,N.mobileBoxShadowHOffset=null,N.mobileBoxShadowVOffset=null,N.mobileBoxShadowBlurRadius=null,N.mobileBoxShadowSpreadRadius=null,N.mobileBoxShadowColor=""):(N.mobileBoxShadowInset=!1,N.mobileBoxShadowHOffset=5,N.mobileBoxShadowVOffset=5,N.mobileBoxShadowBlurRadius=10,N.mobileBoxShadowSpreadRadius=-5,N.mobileBoxShadowColor="#000000"),_({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:N.mobileBoxShadowBlurRadius,color:N.mobileBoxShadowColor,hOffset:N.mobileBoxShadowHOffset,inset:N.mobileBoxShadowInset,spreadRadius:N.mobileBoxShadowSpreadRadius,vOffset:N.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},oh=()=>{const N=l.getFieldsValue(!0);setTimeout(()=>{V(Oe=>!Oe),R&&(N.mobileWidth="",N.mobileHeight="",_({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-"}}}))})},dn=()=>{Le?(he.current=!1,Ue(""),l.setFieldValue("link",""),_({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{link:""}})):(he.current=!0,Ue(A.current&&A.current.input.value?A.current.input.value:"..."),setTimeout(()=>{A.current.focus()}))},cn=N=>{N.target.value===""?Ue("..."):($.current.classList.add("selected-td-form__button--active"),Ue(N.target.value)),Go(N.target.value,me)},un=()=>{const N=l.getFieldsValue(!0);ve?(Be(""),N.alt="",_({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{alt:""}})):(Be(j.current&&j.current.input.value?j.current.input.value:"..."),setTimeout(()=>{j.current.focus()}))},mn=N=>{N.target.value===""?Be("..."):(W.current.classList.add("selected-td-form__button--active"),Be(N.target.value))},pn=()=>{const N=l.getFieldsValue(!0);xe?(ce(""),N.title="",_({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{title:""}})):(ce(Y.current&&Y.current.input.value?Y.current.input.value:"..."),setTimeout(()=>{Y.current.focus()}))},th=()=>{Pe(!H),H?(l.setFieldValue("imgReplacer",""),_({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:""}})):setTimeout(()=>I.current.focus())},ih=N=>{N.target.value!==""&&le.current.classList.add("selected-td-form__button--active")},hn=N=>{N.target.value===""?ce("..."):(ee.current.classList.add("selected-td-form__button--active"),ce(N.target.value))},rh=N=>{l.setFieldValue("link",N!=="mergetag"?N:""),me(N)};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_image_form",initialValues:{src:"",width:"",height:"",widthDim:"",heightDim:"",alt:"",align:"left",border:"",boxShadow:"",show:"all",borderPosition:U.BORDER_POSITIONS[Re]||"borderAll",mobileBorderPosition:U.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:Nr,autoComplete:"off",disabled:io,className:io?"element-controls selected-image-form_busy":"element-controls",children:[io&&(0,o.jsx)("div",{className:"selected-image-form__loader",ref:fo,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:je.type==="countdown"?i("Preparing countdown preview…"):i("Preparing video preview…")})]})}),!K&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),h==="mobile"&&k.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(zr,{form:l,elementSettings:e,handleChangeValues:Nr,boxShadow:Ne,mobileBordersShow:q,mobileBorderRadiusShow:de,mobileBoxShadowShow:_e,mobileSizeShow:R,oneMobileBorderRadiusValue:ne,setOneMobileBorderRadiusValue:Fe,hasLink:Le,hasAlt:ve,hasTitle:xe,linkInputRef:A,linkButtonRef:$,altInputRef:j,altButtonRef:W,titleInputRef:Y,titleButtonRef:ee,linkInputHandler:cn,altButtonHandler:un,altInputHandler:mn,titleButtonHandler:pn,titleInputHandler:hn,linkButtonHandler:dn,toggleShowMobileBorderHandler:qp,toggleShowMobileBorderRadiusHandler:Qp,toggleShowMobileBoxShadowHandler:eh,toggleShowMobileSizeHandler:oh})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Wr,{form:l,elementSettings:e,boxShadow:Ne,bordersShow:be,borderRadiusShow:te,boxShadowShow:oe,oneBorderRadiusValue:fe,setOneBorderRadiusValue:Ae,hasLink:Le,hasAlt:ve,hasTitle:xe,isOpenSrcReplacer:H,mergeTagItems:O,mergeMenuOpen:ye,setMergeMenuOpen:ze,cascaderRef:ke,linkInputRef:A,linkButtonRef:$,altInputRef:j,altButtonRef:W,titleInputRef:Y,titleButtonRef:ee,srcReplacerInputRef:I,srcReplacerButtonRef:le,linkProtocol:ie,handleLinkProtocolsChange:rh,linkButtonHandler:dn,linkInputHandler:cn,altButtonHandler:un,altInputHandler:mn,titleButtonHandler:pn,titleInputHandler:hn,srcReplacerButtonHandler:th,srcInputHandler:ih,handleSelect:wo,onChange:qe,filter:We,renderSearchOption:to,handleChangeValues:Nr,toggleShowBorderHandler:Kp,toggleShowBorderRadiusHandler:Jp,toggleShowBoxShadowHandler:Zp})})]})};Kr.propTypes={elementSettings:f.default.object.isRequired};var qr=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:e("The font-size CSS property sets the size of the font."),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileFontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:e("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})},st=({form:e,elementSettings:i,imgParent:l=!1,name:s="align",setAlignStateHandle:n=()=>{},withHotKeys:d=!0})=>{const{__:c}=r.useI18n(),p=r.useSendPostMessage(),g=r.useAppConfig(),[m,_]=(0,a.useState)(null);(0,a.useEffect)(()=>{globalThis?.navigator?.userAgent.includes("Macintosh")&&_(!0)},[]);const E=v=>{n(v),e.setFieldsValue({[s]:v}),p({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[s]:v}})},b=d?{alignLeft:c("Text align left ( ⌘+Shift+L )"),alignCenter:c("Text align center ( ⌘+Shift+E )"),alignRight:c("Text align right ( ⌘+Shift+R )"),alignJustify:c("Text align justify ( ⌘+Shift+J )")}:void 0,h=d?{alignLeft:c("Text align left ( Ctrl+Shift+L )"),alignCenter:c("Text align center ( Ctrl+Shift+E )"),alignRight:c("Text align right ( Ctrl+Shift+R )"),alignJustify:c("Text align justify ( Ctrl+Shift+J )")}:void 0,k=d?m?b:h:void 0,x=i[s],T=typeof x=="string"?x:"";return(0,o.jsx)(t.ui_kit$Form.Item,{name:s,children:(0,o.jsx)(t.ui_kit$FormAlignTextControl,{value:T,onChange:E,disabled:l&&!i.parent,strokeWidth:g?.iconStrokeWidth,labels:k})})},no=({form:e,elementSettings:i,name:l,icon:s,tooltipTitle:n=null,showTooltip:d=!0,forceInactive:c=!1})=>{const{__:p}=r.useI18n(),g=e.getFieldValue(l),m=r.useSendPostMessage(),[_,E]=(0,a.useState)(i[l]);(0,a.useEffect)(()=>{i[l]!==e.getFieldValue(l)&&(e.setFieldValue(l,i[l]),E(i[l]))},[i,e,l]),(0,a.useEffect)(()=>{_!==g&&E(g)},[g,_,l]);const b=()=>{const h={[l]:!_};e.setFieldValue(l,!_),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:h}),l==="textSuperscript"?e.setFieldValue("textSubscript",!1):l==="textSubscript"&&e.setFieldValue("textSuperscript",!1),E(k=>!k)};return(0,o.jsx)(t.ui_kit$Form.Item,{name:l,children:d?(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:n||p(l.substring(4)),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":_&&!c}),onClick:b,children:s})}):(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":_&&!c}),onClick:b,children:s})})};no.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,tooltipTitle:f.default.string,imgParent:f.default.bool};var Mn=["email","block"];function Dn(e){const i=r.getMessageService(e).getTarget(),l=r.getCanvasService(e);Mn.map(s=>l?.peek(s)?.element).find(s=>!!i&&s?.contentWindow===i)?.focus({preventScroll:!0})}var Jr=()=>{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")}]},Vn=["hover"],Hn=e=>e.parentNode,Un=(e,i="#c6c3c3",l={},s)=>{const{symbolSize:n="25px",marginRight:d="5px",marginBottom:c="5px",textStyle:p={whiteSpace:"normal",lineHeight:"1.2"}}=l;return e.map(g=>({value:g.code,label:(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,o.jsx)("span",{style:{color:i||"#c6c3c3",marginRight:d,marginBottom:c,fontSize:n,lineHeight:"0.7",width:n,textAlign:"center",...p},children:g.symbol}),(0,o.jsx)("span",{style:p,children:g.description})]})}))},St=({form:e,fillFields:i,elementSettings:l,showAddParagraph:s=!0,isButton:n=!1,linkProtocol:d,setLinkProtocol:c,linkTarget:p,isBulletFontColorChecked:g=!1,setIsBulletFontColorChecked:m=()=>{},showTopDivider:_=!0,showLineHeight:E=!0})=>{const{__:b}=r.useI18n(),h=U.useGoogleFontsLoader(),{token:k}=(0,t.ui_kit$useToken)(),x=r.useNotification(),T=r.useSendPostMessage(),v=r.useContainer(),P=r.useAppConfig(),B=(0,a.useRef)(),y=(0,a.useRef)(null),D=(0,a.useRef)(null),z=(0,a.useRef)(null),A=(0,a.useRef)(!1),$=l,[j,W]=(0,a.useState)(!!$.textReplacer?.length),[Y,ee]=(0,a.useState)(!!$.textAnchor?.length),[I,le]=(0,a.useState)(null),[ke,Ne]=(0,a.useState)({start:0,end:0}),[Q,fe]=(0,a.useState)(!1),[Ae,ne]=(0,a.useState)([]),[Fe,Le]=(0,a.useState)($.list?.bulletsColor),[Ue,ve]=(0,a.useState)(l);l!==Ue&&(ve(l),Le($.list?.bulletsColor),W(!!$.textReplacer?.length),ee(!!$.textAnchor?.length));const[Be,xe]=(0,a.useState)(!1),[ce,be]=(0,a.useState)(!1),ue=(0,a.useRef)(null),q=(0,a.useRef)(""),Z=Jr(),te=(0,a.useMemo)(()=>Z,[]),ae={textColor:t.ui_kit$Form.useWatch("textColor",e),textLink:t.ui_kit$Form.useWatch("textLink",e),linkHref:t.ui_kit$Form.useWatch("linkHref",e),listUL:t.ui_kit$Form.useWatch("listUL",e),listOL:t.ui_kit$Form.useWatch("listOL",e)};(0,a.useEffect)(()=>{n&&l?.textColor!==void 0&&e.setFieldValue("textColor",l.textColor)},[n,l?.textColor,e]);let de=null;(0,a.useEffect)(()=>{if(ae?.textColor&&g){const ge=e.getFieldValue("textColor");T({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{ColorBullets:ge}})}},[ae?.textColor]),(0,a.useEffect)(()=>{const ge=e.getFieldValue("textLink");typeof l.linkHref=="string"&&xe(!0),ue&&!ge&&(xe(!1),e.setFieldsValue({linkHref:null})),ue.current=ge||null},[ae?.textLink,ae?.linkHref,l.linkHref,e]),(0,a.useEffect)(()=>{const ge=e.getFieldValue("listUL"),Ge=e.getFieldValue("listOL");ge&&q.current!=="listUL"?(e.setFieldValue("listOL",!1),q.current="listUL"):Ge&&q.current!=="listOL"&&(e.setFieldValue("listUL",!1),q.current="listOL"),!ge&&!Ge&&(q.current="")},[ae?.listUL,ae?.listOL,e]);const De=ge=>{ge.data.operation===r.EVENT_TYPES.APPLICATION_FOCUS_IN_IFRAME&&le(null)};r.useListenPostMessage(De);const[oe,Te]=(0,a.useState)(null);(0,a.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&Te(!0)},[]);const _e=(0,a.useRef)(null);function Ce(ge){const Ge=ge.key.toLowerCase();let Je=!1;return((de==="control"||de==="meta")&&(Ge==="a"||Ge==="A")||(de==="a"||de==="A")&&(Ge==="control"||Ge==="meta"))&&(Je=!0),de=Ge,Ge!=="control"&&Ge!=="a"&&Ge!=="A"&&Ge!=="meta"&&(de=null),Je}const R=ge=>{T({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:ge,locale:"en_US"}),x.success({title:b("It`s done!")})},V=[{key:"1",label:b("This element"),onClick:()=>R("typograf")},{key:"2",label:b("The whole email"),onClick:()=>R("typograf_all")}],[L,X]=(0,a.useState)(),[ie,me]=(0,a.useState)(!1);(0,a.useEffect)(()=>{const ge=Un(te,Fe,{});ne(ge)},[te,Fe]),(0,a.useEffect)(()=>{const ge=l.linkHref||l.href;ge&&Go(ge,c);const Ge=l.linkHref||l.href,Je=Ge&&Ii(Ge)?Ge.slice(1):Ge||"https://";(i??((io,fo)=>io.setFieldsValue(fo)))(e,{linkHref:Je})},[e,l,c,i]);const he=r.useAppConfig().mergeTags;(0,a.useEffect)(()=>{he?.items?.length&&X(r.mapMargeTags(he.items))},[he,X]);const $e=ge=>{e.setFieldValue("linkHref",ge!=="mergetag"?ge:""),c(ge)},je=(ge,Ge)=>{if(me(!1),ge){const Je=he.syntax.length>1?L.findIndex(fo=>fo.key===Ge[0].key):0,io=he.syntax[Je].replace("%value%",ge[ge.length-1]);if(I?.getAttribute("id")==="selected_button_form_href"||I?.getAttribute("id")==="selected_text_form_linkHref"||I?.getAttribute("id")==="selected_text_form_textReplacer")ze(io,I?.getAttribute("id"));else{e.setFieldValue("textReplacer",io);const fo=Date.now();T({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:`${io}~~${fo}`}}),v&&setTimeout(()=>Dn(v))}}},G=(ge,Ge)=>Ge.some(Je=>Je.label.toLowerCase().indexOf(ge.toLowerCase())>-1),re=(ge,Ge)=>{const Je=Ge.map((io,fo)=>{const F=io.label.split(new RegExp(`(${ge})`,"gi"));return(0,o.jsxs)("span",{children:[fo!==0&&(0,o.jsx)("span",{children:" / "}),F.map((K,Ie)=>K.toLowerCase()===ge.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:K},Ie):K)]},io.value)});return(0,o.jsx)("div",{title:Ge.map(io=>io.label).join(" / "),children:Je})};(0,a.useEffect)(()=>{ie&&_e.current&&_e.current.focus()},[ie]);const O=r.useRootElement();(0,a.useEffect)(()=>{const ge=({target:io})=>{io.closest('[id="merge_tags_wrapper"]')||le(io)},Ge=({target:io})=>{!io.closest(".merge-tags")&&!io.closest("#merge_tags_button")&&me(!1)},Je=new Po.Disposable;return Je.addDisposable(r.addWindowListenerFromShadow(O,"focusin",ge)),Je.addDisposable(r.addWindowListenerFromShadow(O,"click",Ge)),()=>{Je.dispose()}},[O]);const pe=(0,a.useCallback)(()=>{const ge=window.getSelection();ge&&ge.toString().length>0&&(A.current=!0)},[]),ye=(0,a.useCallback)(({target:ge})=>{if(ge&&!Q){const{selectionStart:Ge,selectionEnd:Je}=ge;Ne(io=>io?.start===Ge&&io?.end===Je?io:{start:Ge,end:Je})}fe(!1)},[Q]);(0,a.useEffect)(()=>ye({target:p?.target}),[p,ye]);const ze=(ge,Ge)=>{const Je=document.getElementById(Ge);if(Je){const io=Je.value?.substring(0,ke.start),fo=Je.value?.substring(ke.end),F=Ge.substring(Ge.lastIndexOf("_")+1);T({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{[F]:io+ge+fo}}),e.setFieldValue(F,io+ge+fo),Je.focus(),setTimeout(()=>{Je.selectionStart=ke.start,Je.selectionEnd=ke.start+ge.length},400),fe(!0)}},oo=()=>{W(!j),j?(e.setFieldValue("textReplacer",""),T({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:""}})):setTimeout(()=>y.current.focus())},ro=ge=>{ge.target.value!==""&&D.current?.classList.add("selected-td-form__button--active")},ao=(ge="unknown")=>{ee(!Y),Y?(e.setFieldValue("textAnchor",""),T({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textAnchor:""}})):setTimeout(()=>z.current?.focus())},M=ge=>{const Ge=ge.target,Je=Ge.value,io=Ge.selectionStart,fo=Ce(ge);if(A.current&&io===0&&T({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:l.type,settings:{textReplacer:`${Je}~`}}),A.current=fo,io===0&&ge.key===" "){ge.preventDefault();return}if(ge.key===" "){if(io!==Je.length){ge.preventDefault();return}Je.endsWith(" ")&&ge.preventDefault()}},se=ge=>{Le(ge),g&&m(!1)},C=n?P.formButtonFieldInsertImageEnabled:P.formTextFieldTypografEnabled,H=P.formTextFieldTypografEnabled&&!n,Pe=(0,a.useMemo)(()=>[{message:b("Please set the font color")}],[b]),{showOnMobile:He,usedColors:_o}=l,mo=n&&!E&&!He,co=(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Vn,title:b("Text color"),placement:"bottom",zIndex:1,getPopupContainer:Hn,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:Pe,className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:b("Color"),usedColors:_o})})});return(0,o.jsxs)(o.Fragment,{children:[s&&!l.showOnMobile&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Row,{gutter:20,style:{paddingBottom:4},children:(0,o.jsx)(t.ui_kit$Col,{span:12,gutter:20,children:(0,o.jsx)(st,{form:e,elementSettings:l,name:"textAlign"})})})}),C||H||P.mergeTagsShow&&L?(0,o.jsx)(t.ui_kit$FormSection,{title:null,dividerTop:_,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginTop:4},children:[C&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Col,{span:H?12:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"AddImage",style:{marginBottom:k.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"AddImage",component:t.icons$AddImage}),onClick:()=>R("add_img"),style:{width:"100%"},children:b("Add image")})})})}),H&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"Typography",style:{marginBottom:k.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,menu:{items:V},trigger:["hover"],placement:"bottom",getPopupContainer:ge=>ge.closest(".selected-element-panel"),children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Typograf",component:t.icons$Typograf}),onClick:()=>R("typograf"),style:{width:"100%"},children:b("Typography")})})})})}),P.mergeTagsShow&&L&&(0,o.jsxs)(t.ui_kit$Col,{span:24,id:"merge_tags_wrapper",style:{marginBottom:k.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Button,{id:"merge_tags_button",icon:(0,o.jsx)(r.EmIcons,{icon:"MergeTags",component:t.icons$MergeTags}),style:{width:"100%",display:ie?"none":"inline-flex"},onClick:()=>me(!0),children:b("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:_e,classNames:{popup:{root:"merge-tags"}},options:L,placeholder:b("Start typing the title"),showSearch:{filter:G,render:re},spellCheck:"false",getPopupContainer:ge=>ge.closest(".email-pane__collapse-wrapper"),onChange:je,style:{display:ie?"block":"none",width:"100%"},open:ie,onKeyDown:ge=>{ge.key==="Escape"&&me(!1)}})]})]})}):null,(0,o.jsxs)(t.ui_kit$FormSection,{title:null,dividerTop:_||C||H,bodyStyle:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Text font"),placement:"bottom",zIndex:1,getPopupContainer:ge=>ge.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:h,getPopupContainer:ge=>ge.closest(".email-pane__collapse-wrapper")})})}),!l.showOnMobile&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:b("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),E&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:b("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})}),mo&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:co})]}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{marginBottom:10,marginTop:5},children:(0,o.jsxs)(t.ui_kit$Col,{span:24,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:-10},children:[n&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsxs)("div",{className:"selected-text-common-form__format-toolbar",children:[(0,o.jsx)(no,{form:e,elementSettings:l,name:"textStrong",tooltipTitle:b(oe?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})}),(0,o.jsx)(no,{form:e,elementSettings:l,name:"textItalic",tooltipTitle:b(oe?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})}),(0,o.jsx)(no,{form:e,elementSettings:l,name:"textUnderline",tooltipTitle:b(oe?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})}),(0,o.jsx)(no,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:b(oe?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]})}),!mo&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:co})]}),!n&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:l,name:"textStrong",tooltipTitle:b(oe?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:l,name:"textItalic",tooltipTitle:b(oe?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:l,name:"textUnderline",tooltipTitle:b(oe?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})}),l?.list?.isList&&(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(no,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:b(oe?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]}),!l?.list?.isList&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:l,name:"listUL",tooltipTitle:b("Unordered list"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnorderedListOutlined",component:t.icons$UnorderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:ye})}),!l?.list?.isList&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:l,name:"listOL",tooltipTitle:b("Ordered list"),icon:(0,o.jsx)(r.EmIcons,{icon:"OrderedListOutlined",component:t.icons$OrderedListOutlined,className:"selected-td-form__icon-radius"}),onSelect:ye})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:l,name:"textSuperscript",tooltipTitle:b("Text superscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Superscript",component:t.icons$Superscript})})}),l?.list?.isList&&(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(no,{form:e,elementSettings:l,name:"textSubscript",tooltipTitle:b("Text subscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Subscript",component:t.icons$Subscript})})]}),s&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,className:(0,Ke.default)("selected-text-common-form__button selected-text-common-form__button_style",{"selected-text-common-form__button--active":typeof l.linkHref=="string"}),elementSettings:l,name:"textLink",forceInactive:!!l.textAnchor,tooltipTitle:b("Link"),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"}),onSelect:ye})}),l?.list?.isList&&P.formTextFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:b("Text replacer"),placement:"bottom",getPopupContainer:ge=>ge.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":j}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:oo,ref:D})})}),(!l?.list?.isList||s&&l?.list?.isList)&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:b("More options"),placement:"bottom",getPopupContainer:ge=>ge.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":ce||Y}),icon:(0,o.jsx)(r.EmIcons,{icon:"DotsHoriz",component:t.icons$DotsHoriz,className:"selected-td-form__icon-radius"}),onClick:()=>be(!ce)})})})]})]}),!n&&ce&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[!l?.list?.isList&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(no,{form:e,elementSettings:l,name:"textStrikethrough",tooltipTitle:b(oe?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})]}),(0,o.jsxs)(t.ui_kit$Col,{span:3,children:[" ",(0,o.jsx)(no,{form:e,elementSettings:l,name:"textSubscript",tooltipTitle:b("Text subscript"),icon:(0,o.jsx)(r.EmIcons,{icon:"Subscript",component:t.icons$Subscript})})]}),P.formTextFieldReplacerEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:b("Text replacer"),placement:"bottom",getPopupContainer:ge=>ge.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":j}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:oo,ref:D})})})]}),s&&(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:b("Anchor"),placement:"bottom",getPopupContainer:ge=>ge.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":Y}),icon:(0,o.jsx)(r.EmIcons,{icon:"Anchor",component:t.icons$Anchor,className:"selected-text-common-form__icon-radius"}),onMouseDown:ge=>{ge.preventDefault(),ao("mouseDown")}})})})]}),s&&typeof l.linkHref=="string"&&Be&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(it,{show:d==="#",__:b,style:{marginBottom:k.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b(d==="#"?"Anchor name":"The URL that the hyperlink directs to."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkHref",style:{marginBottom:d==="mailto:"?k.formItemMarginBottomXS:""},children:(0,o.jsx)(t.ui_kit$Input,{ref:B,addonBefore:(0,o.jsx)(tt,{linkProtocol:d,handleLinkProtocolsChange:$e,__:b}),allowClear:!0,placeholder:b(d==="#"?"Anchor name":"Hyperlink URL"),autoFocus:l?.isNewLink,onSelect:ye,prefix:(0,o.jsx)(ot,{linkProtocol:d})})})}),d==="mailto:"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"subject",style:{marginBottom:k.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:b("Subject"),onSelect:ye})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:k.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:b("Body"),onSelect:ye})})]})]}),s&&Y&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Anchor name"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textAnchor",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:b("Anchor name"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content addon-text-content--icon",title:b("Anchor"),"aria-hidden":!0,children:(0,o.jsx)(r.EmIcons,{icon:"Anchor",component:t.icons$Anchor,className:"selected-text-common-form__icon-radius",size:18})}),ref:z,onSelect:ye,onBlur:()=>{e.getFieldValue("textAnchor")?.trim()||ee(!1)}})})}),!n&&j&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textReplacer",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:b("The code that will replace this text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:b("Text")}),onChange:ro,onKeyDown:M,onDoubleClick:pe,ref:y,onSelect:ye})})})]})}),!n&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Text color"),placement:"bottom",zIndex:1,getPopupContainer:ge=>ge.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:b("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:b("Color"),usedColors:l.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Text background"),placement:"bottom",zIndex:1,getPopupContainer:ge=>ge.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:b("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:b("Background color"),usedColors:l.usedColors})})})})]})]}),!n&&l?.list?.isList&&(0,o.jsxs)(t.ui_kit$FormSection,{title:b("List settings"),dividerTop:!0,children:[l?.list?.listType==="OL"&&(0,o.jsx)(t.ui_kit$Row,{children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets font"),placement:"bottom",zIndex:1,getPopupContainer:ge=>ge.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"BulletsFontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:h,getPopupContainer:ge=>ge.closest(".email-pane__collapse-wrapper"),style:{marginTop:"-9px"}})})})})}),(0,o.jsx)(t.ui_kit$Row,{gutter:[10],children:l?.list?.listType==="UL"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets type"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"BulletType",className:"bullet-type",children:(0,o.jsx)(t.ui_kit$Select,{size:"medium",placeholder:b("Bullets type"),onClick:ge=>ge.stopPropagation(),options:Ae})})})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:[10],children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets color"),placement:"bottom",zIndex:1,getPopupContainer:ge=>ge.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"ColorBullets",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:b("Bullets color"),usedColors:l.usedColors,disabled:g,onChange:se,externalValue:g?ae?.textColor:void 0})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Bullets size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"BulletsSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,defaultValue:l?.list?.bulletFontSize,placeholder:b("Bullets size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})})]}),l?.list?.listType==="OL"&&(0,o.jsxs)(t.ui_kit$Row,{children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:l,name:"BulletTextStrong",tooltipTitle:b(oe?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:l,name:"BulletTextItalic",tooltipTitle:b(oe?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:l,name:"BulletTextStrikethrough",tooltipTitle:b(oe?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:l,name:"BulletTextUnderline",tooltipTitle:b(oe?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:[10],style:{marginTop:"-8px"},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Between list items"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"SpacingBetweenParagraphs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:5,max:100,placeholder:b("Between list items"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:b("Between bullets and text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"SpacingBetweenBulletsAndText",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:1,max:100,placeholder:b("Between bullets and text"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px"})})})})]})]})]})},Ai=({form:e,elementSettings:i,showAddParagraph:l=!0,isButton:s=!1})=>{const{__:n}=r.useI18n(),d=U.useGoogleFontsLoader(),c=r.useSendPostMessage(),p=r.useDispatch(),g=r.useElementEntityKind(),m=r.useAppConfig(),[_,E]=(0,a.useState)(null);(0,a.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&E(!0)},[]);const b=P=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:P,locale:"en_US"})},[h,k]=(0,a.useState)(i.textAlign),[x,T]=(0,a.useState)(i.linkHref),v=P=>k(P);return(0,a.useEffect)(()=>{k(i.textAlign),T(i.linkHref)},[i]),(0,o.jsx)("div",{className:"selected_text_common_form_mobile",children:(0,o.jsxs)(t.ui_kit$Space,{size:"8",separator:(0,o.jsx)(t.ui_kit$Divider,{orientation:"vertical"}),children:[(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,o.jsx)("div",{style:{width:190},children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:n("Text font"),placement:"bottom",zIndex:1,getPopupContainer:P=>P.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:d,getPopupContainer:P=>P.closest(".selected_text_common_form_mobile")})})})}),(0,o.jsx)("div",{style:{width:90},children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:n("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:n("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)("div",{style:{width:90},children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:n("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:n("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,o.jsx)(no,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:n(_?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-td-form__icon-radius"})}),(0,o.jsx)(no,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:n(_?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-td-form__icon-radius"})}),(0,o.jsx)(no,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:n(_?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-td-form__icon-radius"})}),(0,o.jsx)(no,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:n(_?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-td-form__icon-radius"})})]}),(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:n("Text color"),placement:"bottom",zIndex:1,getPopupContainer:P=>P.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:n("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:n("Color"),usedColors:i.usedColors,getPopupContainer:P=>P.closest(".selected_text_common_form_mobile")})})}),!s&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:n("Text background"),placement:"bottom",zIndex:1,getPopupContainer:P=>P.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:n("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:n("Background color"),usedColors:i.usedColors})})})})]}),l&&(0,o.jsx)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:(0,o.jsxs)(o.Fragment,{children:[typeof x=="string"?(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,popupRender:()=>(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:n("The URL that the hyperlink directs to."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkHref",children:(0,o.jsx)(t.ui_kit$Input,{allowClear:!0,placeholder:n("Hyperlink URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined}),autoFocus:i?.isNewLink})})}),classNames:{root:"codemode-textalign-dropdown"},styles:{root:{left:520,top:52,transform:"translateX(0)",marginLeft:57}},trigger:["hover"],placement:"bottom",getPopupContainer:P=>P.closest(".selected_text_common_form_mobile"),children:(0,o.jsx)("div",{children:(0,o.jsx)(no,{form:e,className:"selected-td-form__button selected-td-form__button_style selected-td-form__button--active",elementSettings:i,name:"textLink",icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),showTooltip:!1})})}):(0,o.jsx)(no,{form:e,className:"selected-td-form__button selected-td-form__button_style",elementSettings:i,name:"textLink",tooltipTitle:n("Link"),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"})}),(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,popupRender:()=>(0,o.jsx)(st,{form:e,elementSettings:i,name:"textAlign",setAlignStateHandle:v}),classNames:{root:"codemode-textalign-dropdown"},styles:{root:{left:615,top:52,transform:"translateX(0)",marginLeft:57}},trigger:["hover"],placement:"bottom",getPopupContainer:P=>P.closest(".selected_text_common_form_mobile"),children:(0,o.jsx)(t.ui_kit$Button,{icon:h==="right"?(0,o.jsx)(r.EmIcons,{icon:"AlignRightOutlined",component:t.icons$AlignRightOutlined,size:18,strokeWidth:m.iconStrokeWidth}):h==="center"?(0,o.jsx)(r.EmIcons,{icon:"AlignCenterOutlined",component:t.icons$AlignCenterOutlined,size:18,strokeWidth:m.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"AlignLeftOutlined",component:t.icons$AlignLeftOutlined,size:18,strokeWidth:m.iconStrokeWidth}),className:"selected-td-form__button"})})]})}),(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected_text_common_form_mobile__group",children:[l&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:n("Add paragraph"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Paragraph",component:t.icons$Paragraph}),onClick:()=>b("add_p"),className:"selected-td-form__button"})}),(!s||m.formButtonFieldInsertImageEnabled)&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:n("Add inline image"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"ImageAdd",component:t.icons$ImageAdd,size:16,strokeWidth:m.iconStrokeWidth}),onClick:()=>b("add_img"),className:"selected-td-form__button"})})}),!s&&(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Typograf",component:t.icons$Typograf}),className:"selected-td-form__button"}),(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"CloseOutlined",component:t.icons$CloseOutlined}),type:"icon",style:{marginLeft:26},onClick:()=>{c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET}),p(r.resetToLastActiveSettingsTab()),setTimeout(()=>{p(g==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300)}})]})]})})},Vt=({elementSettings:e,imgParent:i=!1,name:l="mobileAlign"})=>{const{__:s}=r.useI18n(),n=r.useAppConfig();return(0,o.jsx)(t.ui_kit$Form.Item,{name:l,children:(0,o.jsx)(t.ui_kit$FormAlignTextControl,{disabled:i&&!e.parent,strokeWidth:n?.iconStrokeWidth,labels:{alignLeft:s("Text align left"),alignCenter:s("Text align center"),alignRight:s("Text align right"),alignJustify:s("Text align justify")}})})};Vt.propTypes={elementSettings:f.default.object.isRequired,imgParent:f.default.bool,name:f.default.string};var Wn=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useDispatch(),s=r.useSendPostMessage(),[n]=t.ui_kit$Form.useForm(),d=r.useSelector(r.selectEmailViewType),c=r.useSelector(r.selectMobileViewActive),p=r.useSelector(r.selectIsCodeMode),g=r.useSelector(r.selectCodeModeDirection),m=p&&g!=="bottom",[_,E]=(0,a.useState)("https://"),[b,h]=(0,a.useState)(!1),k=Jr(),x=(0,a.useMemo)(()=>k,[]),T=r.useElementEntityKind(),{remember:v,fillFields:P}=pt(e),B=(0,a.useCallback)(D=>{v(D),l(T==="email"?r.setElementSettings$1(D):r.setElementSettings(D))},[l,T,v]);(0,a.useEffect)(()=>{if(e){const{subject:D,body:z,baseEmail:A}=Vr(e.linkHref),$=e.linkHref,j=typeof $=="string"&&Ii($),W=typeof $=="string"&&$.startsWith("mailto:")?A:j?$.slice(1):typeof $=="string"?$:"https://";E(Dt($||"","https://")),P(n,{...e,lineHeight:u(e.lineHeight),linkHref:W,subject:D,body:z,mobileFontSize:u(e.mobileFontSize?.value||e.fontSize),mobileFontSizeDim:e.mobileFontSize?.dim||e.fontSizeDim,mobileLineHeight:u(e.mobileLineHeight?.value??e.lineHeight),mobileLineHeightDim:e.mobileLineHeight?.dim||e.lineHeightDim,mobileTextAlign:Hr(e.mobileTextAlign,e.textAlign),SpacingBetweenBulletsAndText:e?.list?.betweenRowCell,SpacingBetweenParagraphs:e?.list?.betweenParagraphs,BulletsSize:e?.list?.bulletFontSize,ColorBullets:e?.list?.bulletsColor,BulletTextStrong:e?.list?.bulletFontBold,BulletTextItalic:e?.list?.bulletFontItalic,CheckboxColor:b,BulletsFontFamily:e?.list?.bulletFontFamily,BulletTextUnderline:e?.list?.bulletFontUnderline,BulletTextStrikethrough:e?.list?.bulletFontStrikethrough,BulletType:x.find(Y=>Y.symbol===e?.list?.bulletType)?.code??x[0].code,textSuperscript:e?.textSuperscript,textSubscript:e?.textSubscript,listOL:e?.standardList?.listTypeOL,listUL:e?.standardList?.listTypeUL})}},[n,e]);const y=D=>{const z=n.getFieldsValue(!0),A=Object.keys(D)[0];let $;switch(A){case"mobileFontSize":$={[A]:{classNamePrefix:"em-mob-font_size-",value:D[A],dim:z.mobileFontSizeDim}};break;case"mobileLineHeight":$={[A]:{classNamePrefix:"em-mob-line_height-",value:D[A],dim:z.mobileLineHeightDim}};break;case"mobileTextAlign":$={[A]:{classNamePrefix:"em-mob-text_align-",value:D[A]}};break;case"linkHref":let j=rt(D[A]);if(j!==D[A]&&n.setFieldValue("linkHref",j),_==="#"&&j&&!j.startsWith("#")&&(j="#"+j),j.startsWith("mailto:")){const Y=n.getFieldValue("subject"),ee=n.getFieldValue("body");$={[A]:Ci(j,Y,ee)}}else $={[A]:j};Go(j,E);break;case"subject":case"body":const W=n.getFieldValue("linkHref")||"";if(W.substring(0,7)==="mailto:"){const Y=W.split("?")[0],ee=A==="subject"?D[A]:n.getFieldValue("subject"),I=A==="body"?D[A]:n.getFieldValue("body"),le=[];ee&&le.push(`subject=${encodeURIComponent(ee)}`),I&&le.push(`body=${encodeURIComponent(I)}`),$={linkHref:le.length>0?`${Y}?${le.join("&")}`:Y}}else return;break;default:$=D}s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:$}),B({...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(j=>j.code===n.getFieldValue("BulletType"))?.symbol??x[0].symbol},...$,activateSection:null,changeKey:A})};return(0,o.jsxs)(t.ui_kit$Form,{form:n,layout:"vertical",name:"selected_text_form",autoComplete:"off",onValuesChange:y,className:"element-controls",initialValues:{textAlign:"left",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1,textColor:"",textBackgroundColor:"",textLink:!1,textReplacer:"",textAnchor:"",subject:"",body:"",SpacingBetweenBulletsAndText:0,SpacingBetweenParagraphs:0,BulletsSize:0,ColorBullets:"",BulletTextStrong:!1,BulletTextItalic:!1,CheckboxColor:!1,BulletsFontFamily:"",BulletTextUnderline:!1,BulletTextStrikethrough:!1,BulletType:"",textSuperscript:!1,textSubscript:!1,listOL:!1,listUL:!1},children:[!m&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),!(d==="mobile"&&!m&&c.styles)&&(0,o.jsx)("div",{id:"selected_element_form_desktop_props",style:{paddingRight:0},children:m?(0,o.jsx)(Ai,{form:n,elementSettings:e}):(0,o.jsx)(St,{form:n,fillFields:P,elementSettings:e,linkProtocol:_,setLinkProtocol:E,isBulletFontColorChecked:b,setIsBulletFontColorChecked:h})}),!m&&(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:d==="mobile"&&c.styles?"block":"none"},children:[(0,o.jsx)(t.ui_kit$Row,{gutter:20,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Vt,{form:n,elementSettings:e,name:"mobileTextAlign"})})}),!!e.showOnMobile&&(0,o.jsx)(St,{form:n,fillFields:P,elementSettings:e,linkProtocol:_,setLinkProtocol:E}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(qr,{})}),(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"})})})]})]})]})},Li=(e,i)=>{const{__:l}=r.useI18n();return(0,o.jsx)(t.ui_kit$Tooltip,{title:l("During export, the element is converted into an image."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"exportAsPicture",valuePropName:"checked",className:"form-item-margin-xs",style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$Switch,{id:"convert-in-image",label:l("Convert into an image"),size:"small",labelStyle:{position:"relative",top:2}})})},"exportAsPicture")},Qr={marginBottom:10},Zr={position:"relative",top:2};function zn(e){return Array.isArray(e)?!!e[0]?.value:typeof e=="string"?e.trim()!=="":!!e}var at=({form:e,showRounding:i=!1,showBackground:l=!1})=>{const{__:s}=r.useI18n(),n=zn(t.ui_kit$Form.useWatch("backgroundImage",e));return(0,o.jsxs)(o.Fragment,{children:[i&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Adds bulletproof VML markup so the button keeps rounded corners in Outlook."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"outlookRounding",valuePropName:"checked",className:"form-item-margin-xs",style:Qr,children:(0,o.jsx)(t.ui_kit$Switch,{id:"outlook-rounding",label:s("Rounded corners in Outlook (VML)"),size:"small",labelStyle:Zr})})},"outlookRounding"),l&&n&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Adds VML markup so the background image is visible in Outlook."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"outlookBackground",valuePropName:"checked",className:"form-item-margin-xs",style:Qr,children:(0,o.jsx)(t.ui_kit$Switch,{id:"outlook-background",label:s("Background image in Outlook (VML)"),size:"small",labelStyle:Zr})})},"outlookBackground")]})};at.propTypes={form:f.default.object,showRounding:f.default.bool,showBackground:f.default.bool};var el=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:n,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:p,backgroundRepeatOptions:g,backgroundSizeOptions:m,sizeShow:_,modificationShow:E,oneBorderRadiusValue:b,setOneBorderRadiusValue:h,toggleShowBorderHandler:k,toggleShowBorderRadiusHandler:x,toggleShowBoxShadowHandler:T,toggleShowSizeHandler:v,toggleShowBackgroundHandler:P,toggleShowModificationHandler:B})=>{const{__:y}=r.useI18n(),D=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:y("The align attribute sets the horizontal alignment of the table.")})}),(0,o.jsx)(t.ui_kit$FormSection,{title:y("Size"),collapsible:!0,open:_,onToggle:v,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{showHeight:!1,showMinMax:!0,columnsPerRow:2,dimensionSelect:Mo,minWidthDimensionSelect:Mo,maxWidthDimensionSelect:Mo,rowStyle:{marginBottom:4},labels:{width:y("Width"),height:y("Height"),minWidth:y("Minimum width"),maxWidth:y("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:y("Background"),collapsible:!0,open:c,onToggle:P,dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{imageEnabled:D.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:p,usedColors:i.usedColors,colorPlaceholder:y("Background color"),horizontalPositionPlaceholder:y("Horizontal position"),horizontalPositionTooltip:y("Horizontal position"),verticalPositionPlaceholder:y("Vertical position"),verticalPositionTooltip:y("Vertical position"),backgroundRepeatTooltip:y("Background image repeat"),backgroundSizeTooltip:y("Background image size"),selectPlaceholder:y("Please choose"),backgroundRepeatOptions:g,backgroundSizeOptions:m,imageUploadSlot:D.formTableFieldBackgroundImageEnabled?(0,o.jsx)(Fo,{form:e,label:y("Background image"),name:"backgroundImage",tooltipTitle:y("Background image"),placeholder:y("Background image link/route")}):void 0}),(0,o.jsx)(at,{form:e,showBackground:!0})]}),D.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Borders"),collapsible:!0,open:s,onToggle:k,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,elementSettings:i})}),D.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Border radius"),collapsible:!0,open:n,onToggle:x,dividerTop:!0,children:(0,o.jsx)(vo,{form:e,oneBorderRadiusValue:b,setOneBorderRadiusValue:h,elementSettings:i})}),D.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Box shadow"),collapsible:!0,open:d,onToggle:T,dividerTop:!0,children:(0,o.jsx)(No,{})}),D.formFieldExportAsPictureEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Export settings"),collapsible:!0,open:E,onToggle:B,dividerTop:!0,children:(0,o.jsx)(Li,{form:e,elementSettings:i})}),D.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e})}),D.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:y("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})};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,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 ol=({form:e,elementSettings:i,label:l})=>{const{__:s}=r.useI18n();(0,a.useRef)();const[n,d]=(0,a.useState)(i.mobileBackgroundColor?.value==="none"),{token:c}=(0,t.ui_kit$useToken)(),p=r.useSendPostMessage(),g=_=>{e.setFieldsValue({mobileBackgroundColor:""}),d(E=>!E),p({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:n?"":"none"}}})},m=_=>{d(!1)};return(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)(t.ui_kit$Tooltip,{trigger:["hover"],title:s("Background color"),placement:"left",children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundColor",style:{marginBottom:c.formItemMarginBottomXS/2},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{onChange:m,placeholder:l,usedColors:i.usedColors})}),(0,o.jsx)(t.ui_kit$Switch,{id:"without-background-color",label:s("Without background color"),labelSize:"small",size:"small",checked:n,onChange:g})]})})};ol.propTypes={form:f.default.shape({setFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired};var Ht={horizontal:[{value:"left",label:"left"},{value:"center",label:"center"},{value:"right",label:"right"}],vertical:[{value:"top",label:"top"},{value:"center",label:"center"},{value:"bottom",label:"bottom"}]},Oi={mobileBackgroundColor:"em-mob-background_color-",mobileBackgroundImage:"em-mob-background_image-",mobileBackgroundPositionX:"em-mob-background_position_x-",mobileBackgroundPositionY:"em-mob-background_position_y-",mobileBackgroundRepeat:"em-mob-background_repeat-",mobileBackgroundSize:"em-mob-background_size-"},ht="none",Gn=/^(https?:)?\/\//i,Yn=/^(\d*\.?\d+)(%|px)$/;function Xn(e){return e in Oi}function tl(e){return Gn.test(e.trim())}function $i(e,i){const l=Oi[e],s=typeof i=="string"?i:"";return e==="mobileBackgroundImage"?s&&s!==ht&&!tl(s)?null:{[e]:[{classNamePrefix:l,value:s,type:"url"}]}:e==="mobileBackgroundRepeat"?{[e]:{classNamePrefix:l,value:s||ht}}:{[e]:{classNamePrefix:l,value:s}}}function Bt(e){const[i]=Object.keys(e??{});return!i||!Xn(i)?null:$i(i,e[i])}function il(){return Object.keys(Oi).reduce((e,i)=>({...e,...$i(i,"")}),{})}function rl(e){const i=(e??"").trim(),l=i.match(Yn);return l?{position:l[1],unit:l[2]}:{position:i,unit:"px"}}function ll(e,i){return e?isNaN(parseFloat(e))?e:e+i:""}function Xo(e){const i=e??{},l=i.customTable??i;return{type:i.type,usedColors:i.usedColors,mobileBackgroundColor:l.mobileBackgroundColor,mobileBackgroundImage:l.mobileBackgroundImage,mobileBackgroundPositionX:l.mobileBackgroundPositionX,mobileBackgroundPositionY:l.mobileBackgroundPositionY,mobileBackgroundRepeat:l.mobileBackgroundRepeat,mobileBackgroundSize:l.mobileBackgroundSize}}function Tt(e){const i=e??{},l=i.customTable??i,s=l.backgroundSize??"";return{image:l.backgroundImage?.[0]?.value??"",positionX:l.backgroundPositionX??"",positionY:l.backgroundPositionY??"",repeat:l.backgroundRepeat??"",size:s==="auto"?"":s}}function nt(e){const i=Xo(e),l=i.mobileBackgroundImage?.[0]?.value??"";return{mobileBackgroundImage:l===ht?"":l,mobileBackgroundPositionX:i.mobileBackgroundPositionX?.value??"",mobileBackgroundPositionY:i.mobileBackgroundPositionY?.value??"",mobileBackgroundRepeat:i.mobileBackgroundRepeat?.value||ht,mobileBackgroundSize:i.mobileBackgroundSize?.value??""}}function Ut(e){const i=Xo(e),l=i.mobileBackgroundRepeat?.value;return!!i.mobileBackgroundColor?.value||!!i.mobileBackgroundImage?.[0]?.value||!!i.mobileBackgroundPositionX?.value||!!i.mobileBackgroundPositionY?.value||!!l&&l!==ht||!!i.mobileBackgroundSize?.value}function Kn(e,i){return e===ht?!1:!!e||!!i}function Wt(e,i,l){e.setFieldsValue({...nt({}),mobileBackgroundColor:""}),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:Xo(i).type,settings:il()})}var qn=/^\d*\.?\d+$/,Jn={bottom:"auto"},sl={marginBottom:0},Qn=(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal}),Zn=(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical}),ed=e=>e.closest(".email-pane__collapse-wrapper")??e.parentNode,al=({value:e,onChange:i,inheritedValue:l,options:s,placeholder:n,prefix:d})=>{const c=e||l,[p,g]=(0,a.useState)(()=>rl(c));(0,a.useEffect)(()=>{g(b=>ll(b.position,b.unit)===c?b:rl(c))},[c]);const m=(0,a.useCallback)((b,h)=>{g({position:b,unit:h});const k=s.some(x=>x.value===b);(b===""||k||qn.test(b))&&i?.(ll(b,h))},[i,s]),_=(0,a.useCallback)(b=>m(b,p.unit),[m,p.unit]),E=(0,a.useCallback)(b=>m(p.position,b),[m,p.position]);return(0,o.jsx)(t.ui_kit$InputSelect,{options:s,position:p.position,setPosition:_,unit:p.unit,setUnit:E,placeholder:n,prefix:d,dropdownStyle:Jn,tooltipTitle:n,getTooltipPopupContainer:ed})},od=({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:sl,children:(0,o.jsx)(al,{inheritedValue:e,options:Ht.horizontal,placeholder:l("Horizontal position"),prefix:Qn})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundPositionY",style:sl,children:(0,o.jsx)(al,{inheritedValue:i,options:Ht.vertical,placeholder:l("Vertical position"),prefix:Zn})})})]})},nl=["hover"],dl=e=>document.querySelector(".email-properties__collapse-panel")??e.parentNode,cl=({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})},td=({desktopPositionX:e,desktopPositionY:i,desktopRepeat:l,desktopSize:s,backgroundRepeatOptions:n,backgroundSizeOptions:d})=>{const{__:c}=r.useI18n(),{token:p}=(0,t.ui_kit$useToken)(),g=p.formItemMarginBottomXS,m=(0,a.useMemo)(()=>({marginBottom:g}),[g]),_=(0,a.useMemo)(()=>({marginBottom:(g??0)*1.5}),[g]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(od,{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:nl,title:c("Background image repeat"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundRepeat",style:m,children:(0,o.jsx)(cl,{emptyValue:"none",inheritedValue:l,options:n,placeholder:c("Please choose"),getPopupContainer:dl})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:nl,title:c("Background image size"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileBackgroundSize",style:m,children:(0,o.jsx)(cl,{emptyValue:"",inheritedValue:s,options:d,placeholder:c("Please choose"),getPopupContainer:dl})})})})]})]})},id=_i,rd=({value:e,inheritedImage:i,...l})=>(0,o.jsx)(id,{...l,value:e||i}),ld=e=>/^https?:\/\//i.test(e.trim()),sd=({form:e,name:i="mobileBackgroundImage",placeholder:l="",disabled:s=!1,elementSettings:n,inheritedImage:d="",isImageNone:c=!1,onImageNoneChange:p})=>{const{__:g}=r.useI18n(),{token:m}=(0,t.ui_kit$useToken)(),_=t.ui_kit$Form.useWatch(i,e),[E,b]=(0,a.useState)(""),h=_||d,k=m.formItemMarginBottomXS??0,x=(0,a.useMemo)(()=>({marginBottom:k/2}),[k]);(0,a.useEffect)(()=>{if(!h){b("");return}b(ld(h)?"validating":"success")},[h]);const T=!!_&&!tl(_),v=T?"error":E;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:i,className:"mobile-background-image-field",validateStatus:v,help:T?g("Enter a URL starting with http:// or https://"):void 0,style:x,children:(0,o.jsx)(rd,{inheritedImage:d,validateStatus:v,placeholder:l,name:i,disabled:s,elementSettings:n,imageInfo:n,onRemotePreviewValidate:b})}),(0,o.jsx)(t.ui_kit$Switch,{label:g("Without image"),labelSize:"small",size:"small",checked:c,onChange:p})]})},ad={image:"",positionX:"",positionY:"",repeat:"",size:""},Rt=({elementSettings:e,imageEnabled:i=!1,desktopBackground:l=ad})=>{const{__:s}=r.useI18n(),{token:n}=(0,t.ui_kit$useToken)(),d=t.ui_kit$Form.useFormInstance(),c=n.formItemMarginBottomMD,p=r.useSendPostMessage(),g=e.mobileBackgroundImage?.[0]?.value,[m,_]=(0,a.useState)(g==="none"),E=t.ui_kit$Form.useWatch("mobileBackgroundImage",d);(0,a.useEffect)(()=>{_(g==="none")},[g]),(0,a.useEffect)(()=>{E&&_(!1)},[E]);const b=(0,a.useCallback)(y=>{_(y),d.setFieldsValue({mobileBackgroundImage:""}),p({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:$i("mobileBackgroundImage",y?"none":"")})},[e.type,d,p]),h=(0,a.useMemo)(()=>[{label:s("Not defined"),value:"none"},{label:s("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:s("Repeat background (repeat)"),value:"repeat"},{label:s("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:s("Repeat background vertically (repeat-y)"),value:"repeat-y"}],[s]),k=(0,a.useMemo)(()=>[{label:s("Not defined"),value:""},{label:s("Contain"),value:"contain"},{label:s("Cover"),value:"cover"}],[s]),x=Kn(m?"none":E,l.image),T=(0,a.useMemo)(()=>({marginBottom:x?c:0}),[c,x]),v=(0,a.useMemo)(()=>(0,o.jsx)("div",{style:T,children:(0,o.jsx)(ol,{form:d,elementSettings:e,label:s("Background color")})}),[s,e,d,T]),P=(0,a.useMemo)(()=>(0,o.jsx)("div",{style:T,children:(0,o.jsx)(sd,{form:d,placeholder:s("Background image"),elementSettings:e,inheritedImage:m?"":l.image,isImageNone:m,onImageNoneChange:b})}),[s,l.image,e,d,b,m,T]),B=(0,a.useMemo)(()=>(0,o.jsx)(td,{desktopPositionX:l.positionX,desktopPositionY:l.positionY,desktopRepeat:l.repeat,desktopSize:l.size,backgroundRepeatOptions:h,backgroundSizeOptions:k}),[h,k,l.positionX,l.positionY,l.repeat,l.size]);return(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{colorFieldName:"mobileBackgroundColor",colorSlot:v,imageEnabled:i,backgroundImageEmpty:!x,imageUploadSlot:P,imageControlsSlot:B,usedColors:e.usedColors})},ul=({form:e,elementSettings:i,mobileBoxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:n,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:p,oneMobileBorderRadiusValue:g,setOneMobileBorderRadiusValue:m,toggleShowMobileBorderHandler:_,toggleShowMobileBorderRadiusHandler:E,toggleShowMobileBoxShadowHandler:b,toggleShowMobileSizeHandler:h,toggleShowMobileBackgroundHandler:k})=>{const{__:x}=r.useI18n(),{token:T}=(0,t.ui_kit$useToken)(),v=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:h,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:x("Table width"),placement:"left",children:(0,o.jsx)("div",{style:{marginBottom:T.formItemMarginBottomMD+4},children:(0,o.jsx)(Yo,{form:e,name:"mobileWidth",elementSettings:i})})})})})}),(0,o.jsx)(t.ui_kit$FormSection,{title:x("Background"),collapsible:!0,open:p,onToggle:k,dividerTop:!0,children:(0,o.jsx)(Rt,{elementSettings:Xo(i),imageEnabled:v.formTableFieldBackgroundImageEnabled,desktopBackground:Tt(i)})}),v.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Borders"),collapsible:!0,open:s,onToggle:_,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),v.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Border radius"),collapsible:!0,open:n,onToggle:E,dividerTop:!0,children:(0,o.jsx)(vo,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:g,setOneBorderRadiusValue:m,elementSettings:i})}),v.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Box shadow"),collapsible:!0,open:d,onToggle:b,dividerTop:!0,children:(0,o.jsx)(No,{typeOfForm:"mobile",form:e,elementSettings:i})}),v.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e})}),v.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})};ul.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 ml=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),n=Do(),d=Do(),c=r.useDispatch(),p=r.useElementEntityKind(),[g,m]=(0,a.useState)({}),[_,E]=(0,a.useState)(!0),[b,h]=(0,a.useState)({}),[k,x]=(0,a.useState)(!0),T=r.useSelector(r.selectEmailViewType),v=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[P,B]=(0,a.useState)(e.backgroundImage[0].value===""),y=r.useSelector(r.selectIsCodeMode),D=r.useSelector(r.selectCodeModeDirection),z=y&&D!=="bottom",[A,$]=(0,a.useState)(!1),[j,W]=(0,a.useState)(!1),[Y,ee]=(0,a.useState)(!1),[I,le]=(0,a.useState)(!1),[ke,Ne]=(0,a.useState)(!1),[Q,fe]=(0,a.useState)(!1),[Ae,ne]=(0,a.useState)(!1),[Fe,Le]=(0,a.useState)(!1),[Ue,ve]=(0,a.useState)(!1),[Be,xe]=(0,a.useState)(!1),[ce,be]=(0,a.useState)(!1),ue=[{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"}],q=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}],Z=O=>O&&(O?.width||O?.style||O?.color)?O:"",te=e.border,ae=e.mobileBorder,de=Object.keys(te).find(O=>te[O]?.width||te[O]?.style||te[O]?.color),De=Object.keys(ae).find(O=>ae[O]?.width||ae[O]?.style||ae[O]?.color),{remember:oe,fillFields:Te}=pt(e);(0,a.useEffect)(()=>{if(e){const O=e.boxShadow,pe=e.mobileBoxShadow;m(O),h(pe),Te(s,{...e,width:e.width?.value,widthDim:e.width?.dim,maxWidth:e.maxWidth?.value,maxWidthDim:e.maxWidth?.dim,minWidth:e.minWidth?.value,minWidthDim:e.minWidth?.dim,backgroundImage:e.backgroundImage[0].value,show:e.show?e.show:"all",borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),borderRadiusAll:u(e.borderRadius.all),borderRadiusTopLeft:u(e.borderRadius.topLeft),borderRadiusBottomLeft:u(e.borderRadius.bottomLeft),borderRadiusTopRight:u(e.borderRadius.topRight),borderRadiusBottomRight:u(e.borderRadius.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:So(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileAlign:e.mobileAlign?.value,mobileBorderAll:Z(e.mobileBorder.all)||!(Z(e.mobileBorder.top)||Z(e.mobileBorder.bottom)||Z(e.mobileBorder.right)||Z(e.mobileBorder.left))&&Z(e.border.all),mobileBorderTop:Z(e.mobileBorder.top)||!Z(e.mobileBorder.all)&&Z(e.border.top),mobileBorderBottom:Z(e.mobileBorder.bottom)||!Z(e.mobileBorder.all)&&Z(e.border.bottom),mobileBorderRight:Z(e.mobileBorder.right)||!Z(e.mobileBorder.all)&&Z(e.border.right),mobileBorderLeft:Z(e.mobileBorder.left)||!Z(e.mobileBorder.all)&&Z(e.border.left),mobileBorderRadiusAll:u(e.mobileBorderRadius.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius.topLeft!==null?e.mobileBorderRadius.topLeft:e.mobileBorderRadius.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius.bottomLeft!==null?e.mobileBorderRadius.bottomLeft:e.mobileBorderRadius.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius.topRight!==null?e.mobileBorderRadius.topRight:e.mobileBorderRadius.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius.bottomRight!==null?e.mobileBorderRadius.bottomRight:e.mobileBorderRadius.all),mobileBoxShadowInset:u(e.mobileBoxShadow?.inset)||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color),mobileBackgroundColor:u(e.mobileBackgroundColor?.value!=="none"?e.mobileBackgroundColor?.value:""),...nt(e),exportAsPicture:e?.exportAsPicture}),!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?E(!1):E(!0),u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight)?x(!1):x(!0),B(e.backgroundImage[0].value==="");const ye=n.isStaleBorderSnapshot(e,!!de),ze=d.isStaleBorderSnapshot(e,!!De);ye&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(ze||ye&&!De)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),$(oo=>de&&!ye?!0:oo),W(oo=>de&&!ye||De&&!ze?!0:oo),ee(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),le(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),Ne(!!e.boxShadow),fe(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),ne(!!e.width?.value||!!e.minWidth?.value||!!e.maxWidth?.value),Le(!!e.mobileWidth.value),ve(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),xe(Ut(e)),be(!!e.exportAsPicture)}},[s,e,de,De,n,d,Te]);const _e=(0,a.useCallback)(O=>{oe(O),c(p==="email"?r.setElementSettings$1(O):r.setElementSettings(O))},[c,p,oe]),Ce=O=>{const pe=s.getFieldsValue(!0),ye=Object.keys(O)[0];let ze;switch(ye){case"exportAsPicture":ze={exportAsPicture:pe.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":ze={boxShadow:{hOffset:pe.boxShadowHOffset,vOffset:pe.boxShadowVOffset,blurRadius:pe.boxShadowBlurRadius,spreadRadius:pe.boxShadowSpreadRadius,color:pe.boxShadowColor,inset:pe.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":pe.borderPosition==="borderAll"?(ze={border:{...r.RESET_BORDER_PARAMS,all:{...U.NULL_BORDER,...pe.borderAll}}},s.setFieldsValue({borderLeft:U.NULL_BORDER,borderRight:U.NULL_BORDER,borderTop:U.NULL_BORDER,borderBottom:U.NULL_BORDER})):pe.borderAll?.width||pe.borderAll?.style||pe.borderAll?.color?(ze={border:{all:null,left:pe.borderAll,right:pe.borderAll,top:pe.borderAll,bottom:pe.borderAll,[U.REVERSE_BORDER_POSITIONS[ye]]:{...pe[ye],...O[ye]}}},s.setFieldsValue({borderAll:null,borderLeft:pe.borderAll,borderRight:pe.borderAll,borderTop:pe.borderAll,borderBottom:pe.borderAll,[ye]:{...pe[ye],...O[ye]}})):(ze={border:{all:null,left:pe.borderLeft,right:pe.borderRight,top:pe.borderTop,bottom:pe.borderBottom,[U.REVERSE_BORDER_POSITIONS[ye]]:{...pe[ye],...O[ye]}}},s.setFieldsValue({border:ze.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(pe.mobileBorderPosition==="mobileBorderAll")ze={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...U.NULL_BORDER,...pe.mobileBorderAll,classNamePrefix:"em-mob-border_"+U.MOBILE_REVERSE_BORDER_POSITIONS[ye]+"-"}}},s.setFieldsValue({borderLeft:U.NULL_BORDER,borderRight:U.NULL_BORDER,borderTop:U.NULL_BORDER,borderBottom:U.NULL_BORDER});else{const oo=U.MOBILE_REVERSE_BORDER_POSITIONS[ye],ro={...pe[ye],...O[ye]},ao=!ro?.width&&!ro?.style&&!ro?.color;if(pe.mobileBorder?.all?.width||pe.mobileBorder?.all?.style||pe.mobileBorder?.all?.color){const M=pe.mobileBorderAll;ze={mobileBorder:{all:null,left:M,right:M,top:M,bottom:M,[oo]:ao?null:{...ro,classNamePrefix:"em-mob-border_"+oo+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:M,mobileBorderRight:M,mobileBorderTop:M,mobileBorderBottom:M,[ye]:ro})}else{const M=e.mobileBorder||{},se=C=>{const H=M[C];return H&&(H?.width||H?.style||H?.color)?H:null};ze={mobileBorder:{all:null,left:oo==="left"?ao?null:{...ro,classNamePrefix:"em-mob-border_left-"}:se("left"),right:oo==="right"?ao?null:{...ro,classNamePrefix:"em-mob-border_right-"}:se("right"),top:oo==="top"?ao?null:{...ro,classNamePrefix:"em-mob-border_top-"}:se("top"),bottom:oo==="bottom"?ao?null:{...ro,classNamePrefix:"em-mob-border_bottom-"}:se("bottom")}},s.setFieldsValue({[ye]:ro})}}break;case"width":ze={[ye]:{value:O[ye],dim:pe.widthDim}};break;case"widthDim":ze={width:{value:pe.width,dim:O[ye]}};break;case"maxWidth":ze={[ye]:{value:O[ye],dim:pe.maxWidthDim}};break;case"maxWidthDim":ze={maxWidth:{value:pe.maxWidth,dim:O[ye]}};break;case"minWidth":ze={[ye]:{value:O[ye],dim:pe.minWidthDim}};break;case"minWidthDim":ze={minWidth:{value:pe.minWidth,dim:O[ye]}};break;case"backgroundImage":B(O[ye]===""),ze={[ye]:[{...e.backgroundImage[0],value:O[ye]}],backgroundSize:"cover"};break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":ze={borderRadius:{[U.BORDER_RADIUS_POSITION[ye]]:+O[ye]}};break;case"mobileWidth":ze={[ye]:{classNamePrefix:"em-mob-width-",value:O[ye],dim:pe.mobileWidthDim}};break;case"mobileWidthDim":ze={mobileWidth:{classNamePrefix:"em-mob-width-",value:pe.mobileWidth||100,dim:O[ye]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":ze={mobileBorderRadius:{[U.MOBILE_BORDER_RADIUS_POSITION[ye]]:O[ye],classNamePrefix:"em-mob-border_radius_"+U.MOBILE_BORDER_RADIUS_POSITION[ye]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":ze={mobileBoxShadow:{hOffset:pe.mobileBoxShadowHOffset,vOffset:pe.mobileBoxShadowVOffset,blurRadius:pe.mobileBoxShadowBlurRadius,spreadRadius:pe.mobileBoxShadowSpreadRadius,color:pe.mobileBoxShadowColor,inset:pe.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(ze=Bt(O),!ze)return;break;case"mobileAlign":ze={[ye]:{classNamePrefix:"em-mob-table_align-",value:O[ye]}};break;default:ze=O}ye!=="borderPosition"&&ye!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:ze}),ye!=="mobileBorderRadiusAll"&&ye!=="mobileBorderRadiusTopLeft"&&ye!=="mobileBorderRadiusTopRight"&&ye!=="mobileBorderRadiusBottomLeft"&&ye!=="mobileBorderRadiusBottomRight"&&_e({...e,...ze,mobileBorderRadius:{...e.mobileBorderRadius,...ze?.mobileBorderRadius},activateSection:null,changeKey:ye}))},R=()=>{const O=s.getFieldsValue(!0);n.markBorderToggled(!A),setTimeout(()=>{$(pe=>!pe),A?(O.borderAll=U.NULL_BORDER,O.borderTop=U.NULL_BORDER,O.borderBottom=U.NULL_BORDER,O.borderRight=U.NULL_BORDER,O.borderLeft=U.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}}}})})},V=()=>{const O=s.getFieldsValue(!0);d.markBorderToggled(!j),setTimeout(()=>{W(pe=>!pe),j?(O.mobileBorderAll=U.NULL_BORDER,O.mobileBorderTop=U.NULL_BORDER,O.mobileBorderBottom=U.NULL_BORDER,O.mobileBorderRight=U.NULL_BORDER,O.mobileBorderLeft=U.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}}}})})},L=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{ee(pe=>!pe),Y?(O.borderRadiusAll=0,E(!0)):O.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:O.borderRadiusAll}}})})},X=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{le(pe=>!pe),I?(O.mobileBorderRadiusAll=null,x(!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-"}}})})},ie=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{Ne(pe=>!pe),ke?(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}}})})},me=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{fe(pe=>!pe),Q?(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-"}}})})},he=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{ne(pe=>!pe),Ae&&(O.width="",O.minWidth="",O.maxWidth="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{width:{value:null,dim:"px"},minWidth:{value:null,dim:"px"},maxWidth:{value:null,dim:"px"}}}))})},$e=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{Le(pe=>!pe),Fe&&(O.mobileWidth="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"}}}))})},je=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{ve(pe=>!pe),Ue?(O.backgroundColor="",O.backgroundImage="",O.backgroundPositionX="",O.backgroundPositionY="",O.backgroundRepeat="none",O.backgroundSize="",B(!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}})})},G=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{xe(pe=>!pe),Be?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}}}),Be&&Wt(s,e,l)})},re=()=>{const O=s.getFieldsValue(!0);setTimeout(()=>{be(pe=>!pe),ce&&(O.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:U.BORDER_POSITIONS[de]||"borderAll",mobileBorderPosition:U.MOBILE_BORDER_POSITIONS[De]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileBackgroundColor:"",mobileBackgroundImage:""},onValuesChange:Ce,autoComplete:"off",className:"element-controls",children:[!z&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),T==="mobile"&&v.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(ul,{form:s,elementSettings:e,mobileBoxShadow:b,mobileBordersShow:j,mobileBorderRadiusShow:I,mobileBoxShadowShow:Q,mobileSizeShow:Fe,mobileBackgroundShow:Be,oneMobileBorderRadiusValue:k,setOneMobileBorderRadiusValue:x,toggleShowMobileBorderHandler:V,toggleShowMobileBorderRadiusHandler:X,toggleShowMobileBoxShadowHandler:me,toggleShowMobileSizeHandler:$e,toggleShowMobileBackgroundHandler:G})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(el,{form:s,elementSettings:e,boxShadow:g,bordersShow:A,borderRadiusShow:Y,boxShadowShow:ke,backgroundShow:Ue,backgroundImageEmpty:P,backgroundRepeatOptions:ue,backgroundSizeOptions:q,sizeShow:Ae,modificationShow:ce,oneBorderRadiusValue:_,setOneBorderRadiusValue:E,toggleShowBorderHandler:R,toggleShowBorderRadiusHandler:L,toggleShowBoxShadowHandler:ie,toggleShowSizeHandler:he,toggleShowBackgroundHandler:je,toggleShowModificationHandler:re})})]})};ml.propTypes={elementSettings:f.default.object.isRequired};var pl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),n=r.useAppConfig(),d=r.useSelector(r.selectIsCodeMode),c=r.useSelector(r.selectCodeModeDirection),[p,g]=(0,a.useState)({}),[m,_]=(0,a.useState)("https://"),E=({target:k})=>{const{selectionStart:x,selectionEnd:T}=k;k&&g({target:k,selection:{start:x,end:T}})};(0,a.useEffect)(()=>{if(e){let k="",x="",T=e.href==null?"https://":e.href;if(T&&T.substring(0,7)==="mailto:"){const v=new URL(e.href);k=v.searchParams.get("subject")||"",x=v.searchParams.get("body")||"",T=e.href.split("?")[0],_("mailto:")}else e.href&&(e.href.substring(0,8)==="https://"||e.href.substring(0,7)==="http://"?_("https://"):e.href.substring(0,4)==="tel:"?_("tel:"):e.href.substring(0,4)==="sms:"?_("sms:"):e.href.substring(0,6)==="ftp://"?_("ftp://"):_(""));s.setFieldsValue({...e,href:T,subject:k,body:x})}},[s,e]);const b=k=>{const x=Object.keys(k)[0];let T=k;if(x==="href"){const v=rt(k[x]);if(v!==k[x]&&s.setFieldValue("href",v),v.substring(0,7)==="mailto:"){const P=s.getFieldValue("subject"),B=s.getFieldValue("body"),y=[];P&&y.push(`subject=${encodeURIComponent(P)}`),B&&y.push(`body=${encodeURIComponent(B)}`),T={href:y.length>0?`${v}?${y.join("&")}`:v}}else T={href:v}}if(x==="subject"||x==="body"){const v=s.getFieldValue("href")||"";if(v.substring(0,7)==="mailto:"){const P=v.split("?")[0],B=x==="subject"?k[x]:s.getFieldValue("subject"),y=x==="body"?k[x]:s.getFieldValue("body"),D=[];B&&D.push(`subject=${encodeURIComponent(B)}`),y&&D.push(`body=${encodeURIComponent(y)}`),T={href:D.length>0?`${P}?${D.join("&")}`:P}}else return}l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:T})},h=k=>{l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:k})};return(0,o.jsx)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_link_form",initialValues:{href:"https://",target:"",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1,textReplacer:"",subject:"",body:""},onValuesChange:b,autoComplete:"off",className:"element-controls",children:!d||c==="bottom"?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Hyperlink URL"),placement:"left",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:24,paddingRight:10},children:(0,o.jsx)(t.ui_kit$Input,{allowClear:!0,placeholder:i("Hyperlink URL"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined}),onSelect:E})})}),n.formLinkFieldInsertImageEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:i("Actions with the chosen text"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$Form.Item,{children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"PicLeftOutlined",component:t.icons$PicLeftOutlined}),onClick:()=>h("add_img"),children:i("Add inline image")})})}),(0,o.jsx)(St,{form:s,elementSettings:e,showAddParagraph:!1,linkTarget:p,linkProtocol:m,setLinkProtocol:_})]}):(0,o.jsx)(Ai,{form:s,elementSettings:e,showAddParagraph:!1})})};pl.propTypes={elementSettings:f.default.object.isRequired};var hl=()=>{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"})})})})};hl.propTypes={};var bl=({form:e,elementSettings:i})=>(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{marginBottom:20},children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(lt,{form:e,name:"mobileHeight",elementSettings:i})})});bl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired};var gl=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm(),s=r.useDispatch(),n=r.useSendPostMessage(),d=r.useSelector(r.selectEmailViewType),c=r.useSelector(r.selectMobileViewActive),p=r.useSelector(r.selectIsCodeMode),g=r.useSelector(r.selectCodeModeDirection),m=p&&g!=="bottom",_=r.useElementEntityKind(),{remember:E,fillFields:b}=pt(e);(0,a.useEffect)(()=>{e&&b(l,{...e,height:e.height?.value,heightDim:e.height?.dim,mobileHeight:So(e.mobileHeight?.value||e.height?.value),mobileHeightDim:e.mobileHeight?.dim||e.height?.dim})},[l,e,b]);const h=(0,a.useCallback)(x=>{E(x),s(_==="email"?r.setElementSettings$1(x):r.setElementSettings(x))},[s,_,E]),k=x=>{const T=l.getFieldsValue(!0),v=Object.keys(x)[0];let P;switch(v){case"height":P={[v]:{value:x[v],dim:T.heightDim}};break;case"heightDim":P={height:{value:T.height,dim:x[v]}};break;case"mobileHeight":P={[v]:{classNamePrefix:"em-mob-height-",value:x[v],dim:T.mobileHeightDim}};break;case"mobileHeightDim":P={mobileHeight:{classNamePrefix:"em-mob-height-",value:T.mobileHeight,dim:x[v]}};break;default:P=x}n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:P}),h({...e,...P,activateSection:null,changeKey:v})};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_vindent_form",initialValues:{height:"",heightDim:"",mobileHeight:"",mobileHeightDim:""},onValuesChange:k,autoComplete:"off",children:[!m&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),d==="mobile"&&c.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:d==="mobile"&&c.styles?"block":"none",marginBottom:10},children:(0,o.jsx)(bl,{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)(hl,{})})]})};gl.propTypes={elementSettings:f.default.object.isRequired};var zt=({form:e,elementSettings:i,typeOfForm:l="desktop"})=>{const s=r.useSendPostMessage(),n=l==="mobile",d=n?"mobileDirection":"direction",c=g=>{e.setFieldsValue({[d]:g}),s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{[d]:g}})},p=n?i.mobileDirection?.value??"":i.direction??"";return(0,o.jsx)(t.ui_kit$Form.Item,{name:d,className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$FormDirectionControl,{value:p,onChange:c})})},Gt=e=>e.closest(".email-pane__collapse-wrapper")||e.parentNode,Fi=({form:e,backgroundImageEmpty:i,appConfig:l,token:s,elementSettings:n,backgroundRepeatOptions:d,handleChangeValues:c})=>{const{__:p}=r.useI18n(),[g,m]=(0,a.useState)(""),[_,E]=(0,a.useState)("px"),[b,h]=(0,a.useState)(""),[k,x]=(0,a.useState)("px"),T=[{label:p("Not defined"),value:""},{label:p("Contain"),value:"contain"},{label:p("Cover"),value:"cover"}],v=y=>{if(!y||typeof y!="string")return{value:"",unit:"px"};y=y.trim();const D=y.match(/^(\d*\.?\d+)(%|px)$/);return D?{value:D[1],unit:D[2]}:{value:y,unit:"px"}};(0,a.useEffect)(()=>{const y=e.getFieldValue("backgroundPositionX"),D=e.getFieldValue("backgroundPositionY"),z=v(y),A=v(D);m(String(z.value)),E(z.unit),h(String(A.value)),x(A.unit)},[e]);const P=(y,D)=>{m(String(y)),E(D),c&&c({backgroundPositionX:{position:y,unit:D}})},B=(y,D)=>{h(String(y)),x(D),c&&c({backgroundPositionY:{position:y,unit:D}})};return(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:8},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:p("Background color"),placement:"bottom",getPopupContainer:Gt,children:(0,o.jsx)("div",{children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"backgroundColor",style:{marginBottom:s.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:p("Background color"),usedColors:n.usedColors,placement:"bottomLeft"})})})})}),l.formCellFieldBackgroundImageEnabled&&(0,o.jsxs)(t.ui_kit$Col,{span:i?12:24,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:p("Background image"),placement:"bottom",getPopupContainer:Gt,children:(0,o.jsx)("div",{children:(0,o.jsx)(Fo,{form:e,label:p("Background image"),name:"backgroundImage",tooltipTitle:p("Background image"),placeholder:p("Background image link/route")})})}),!i&&(0,o.jsxs)(t.ui_kit$Form.Item,{style:{marginBottom:"0"},children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{marginBottom:s.formItemMarginBottomXS},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$InputSelect,{options:Ht.horizontal,position:g,setPosition:y=>P(y,_),unit:_,setUnit:y=>P(g,y),placeholder:p("Horizontal position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionHorizontal",component:t.icons$BgPositionHorizontal}),dropdownStyle:{bottom:"auto"},tooltipTitle:p("Horizontal position"),getTooltipPopupContainer:Gt})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$InputSelect,{options:Ht.vertical,position:b,setPosition:y=>B(y,k),unit:k,setUnit:y=>B(b,y),placeholder:p("Vertical position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical}),dropdownStyle:{bottom:"auto"},tooltipTitle:p("Vertical position"),getTooltipPopupContainer:Gt})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:p("Background image repeat"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"backgroundRepeat",style:{marginBottom:s.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{placeholder:p("Please choose"),options:d,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:p("Background image size"),placement:"top",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"backgroundSize",style:{marginBottom:s.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Select,{placeholder:p("Please choose"),options:T,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})})})})]})]})]})]})},nd=({form:e,elementSettings:i,__:l,appConfig:s})=>{const n=U.useGoogleFontsLoader(),[d,c]=(0,a.useState)(null);return(0,a.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&c(!0)},[]),(0,o.jsxs)("div",{style:{marginBottom:"-15px"},children:[s.formTextFieldTypografEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Text font"),placement:"bottom",zIndex:1,getPopupContainer:p=>p.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontFamily",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{textEditor:!0,loadGoogleFonts:n,getPopupContainer:p=>p.closest(".email-pane__collapse-wrapper")})})}),!i.showOnMobile&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:l("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:l("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:l(d?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:l(d?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:l(d?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:l(d?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Text color"),placement:"bottom",zIndex:2,getPopupContainer:p=>p.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:[{message:l("Please set the font color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l("Color"),usedColors:i.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Text background"),placement:"bottom",zIndex:2,getPopupContainer:p=>p.parentNode,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textBackgroundColor",rules:[{message:l("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l("Background color"),usedColors:i.usedColors})})})})]})]})},fl=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:n,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:p,backgroundRepeatOptions:g,sizeShow:m,maxWidthValue:_,modificationShow:E,paddingsExt:b,oneBorderRadiusValue:h,setOneBorderRadiusValue:k,elementListShow:x,togglePaddingHandler:T,toggleShowBorderHandler:v,toggleShowBorderRadiusHandler:P,toggleShowBoxShadowHandler:B,toggleShowSizeHandler:y,toggleShowBackgroundHandler:D,toggleShowModificationHandler:z,handleChangeValues:A})=>{const{__:$}=r.useI18n(),{token:j}=(0,t.ui_kit$useToken)(),W=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(st,{form:e,elementSettings:i})}),W.formCellFieldVerticalAlignEnabled&&i.type!=="group"&&(i.type!=="structure"||i.type==="structure"&&i.floatBlocks.items.length===1)&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Vo,{form:e,elementSettings:i})})]}),W.formCellFieldPaddingsEnabled&&(0,o.jsxs)(o.Fragment,{children:[x&&(0,o.jsx)("div",{style:{marginTop:"15px"},children:(0,o.jsx)(nd,{form:e,elementSettings:i,appConfig:W,__:$})}),(0,o.jsx)(t.ui_kit$FormSection,{title:$("Padding"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:b,onToggleExtended:T,showHorizontal:i.type!=="group"&&i.type!=="column",rowStyle:{paddingBottom:4},labels:{horizontal:$("Horizontal padding"),vertical:$("Vertical padding"),left:$("Left padding"),right:$("Right padding"),top:$("Top padding"),bottom:$("Bottom padding"),individual:$("Individual padding")}})})]}),i.type!=="group"&&W.formCellFieldSizeEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Size"),collapsible:!0,open:m,onToggle:y,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{showWidth:i.type!=="structure"&&i.type!=="column",maxWidth:_,dimensionSelect:Mo,rowStyle:{paddingBottom:4},labels:{width:$("Width"),height:$("Height"),minWidth:$("Minimum width"),maxWidth:$("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:$("Background"),collapsible:!0,open:c,onToggle:D,dividerTop:!0,children:[(0,o.jsx)(Fi,{form:e,backgroundImageEmpty:p,appConfig:W,token:j,elementSettings:i,backgroundRepeatOptions:g,handleChangeValues:A}),(0,o.jsx)(at,{form:e,showBackground:!0})]}),W.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Borders"),collapsible:!0,open:s,onToggle:v,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,elementSettings:i})}),W.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Border radius"),collapsible:!0,open:n,onToggle:P,dividerTop:!0,children:(0,o.jsx)(vo,{form:e,oneBorderRadiusValue:h,setOneBorderRadiusValue:k,elementSettings:i})}),W.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("Box shadow"),collapsible:!0,open:d,onToggle:B,dividerTop:!0,children:(0,o.jsx)(No,{})}),W.formFieldExportAsPictureEnabled&&i.type!=="group"&&(0,o.jsxs)(t.ui_kit$FormSection,{title:$("Settings"),collapsible:!0,open:E,onToggle:z,dividerTop:!0,children:[i.type==="structure"&&(0,o.jsx)(t.ui_kit$Tooltip,{title:$("The block will change its colors to contrasting colors. You can change them in the Content Styles section."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"isContrastBlock",valuePropName:"checked",style:{marginBottom:0},children:(0,o.jsx)(t.ui_kit$Switch,{id:"contrast-colors",label:$("Contrast block"),size:"small",labelStyle:{position:"relative",top:2}})})},"isContrastBlock"),(0,o.jsx)(Li,{form:e,elementSettings:i})]}),W.formFieldVisibilityEnabled&&i.type!=="column"&&(0,o.jsx)(t.ui_kit$FormSection,{title:$(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,o.jsx)(zt,{elementSettings:i,form:e}):void 0})}),W.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:$("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})};fl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,bordersShow:f.default.bool,borderRadiusShow:f.default.bool,boxShadowShow:f.default.bool,backgroundShow:f.default.bool,backgroundImageEmpty:f.default.bool,backgroundRepeatOptions:f.default.array,sizeShow:f.default.bool,maxWidthValue:f.default.oneOfType([f.default.string,f.default.number]),modificationShow:f.default.bool,paddingsExt:f.default.bool,oneBorderRadiusValue:f.default.bool,setOneBorderRadiusValue:f.default.func,elementListShow:f.default.bool,togglePaddingHandler:f.default.func,toggleShowBorderHandler:f.default.func,toggleShowBorderRadiusHandler:f.default.func,toggleShowBoxShadowHandler:f.default.func,toggleShowSizeHandler:f.default.func,toggleShowBackgroundHandler:f.default.func,toggleShowModificationHandler:f.default.func,handleChangeValues:f.default.func};var Yt=({form:e,elementSettings:i,mobilePaddingsExt:l,setMobilePaddingsExt:s,rowStyle:n,showVertical:d=!0})=>{const{__:c}=r.useI18n(),p=r.useSendPostMessage(),g=()=>{s(_=>!_);const m=e.getFieldsValue(!0);l||(m.mobilePaddingLeftRight=m.mobilePaddingLeft,m.mobilePaddingTopBottom=m.mobilePaddingTop,m.mobilePaddingRight=m.mobilePaddingLeft,m.mobilePaddingBottom=m.mobilePaddingTop,p({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobilePadding:{top:m.mobilePaddingTop!==""?m.mobilePaddingTop:null,bottom:m.mobilePaddingTopBottom!==""?m.mobilePaddingTopBottom:null,left:m.mobilePaddingLeft!==""?m.mobilePaddingLeft:null,right:m.mobilePaddingRight!==""?m.mobilePaddingRight:null,classNamePrefix:"em-mob-padding_"}}}))};return(0,o.jsx)(t.ui_kit$FormPaddingInputs,{typeOfForm:"mobile",extended:l,onToggleExtended:g,showHorizontal:!0,showVertical:d,gutter:10,rowStyle:n,labels:{horizontal:c("Horizontal padding"),vertical:c("Vertical padding"),left:c("Left padding"),right:c("Right padding"),top:c("Top padding"),bottom:c("Bottom padding"),individual:c("Individual padding")}})};Yt.propTypes={form:f.default.shape({getFieldsValue:f.default.func.isRequired}).isRequired,elementSettings:f.default.object.isRequired,mobilePaddingsExt:f.default.bool.isRequired,setMobilePaddingsExt:f.default.func.isRequired,rowStyle:f.default.object,showVertical:f.default.bool};var sh=5,_l=.5,dd=.1;function cd(e){return(100-e*5)/(e-1)}function ud(e,i,l){const s=e.reduce((g,m)=>g+Math.max(m,0),0)>0?e.map(g=>Math.max(g,0)):e.map(()=>1),n=s.map(()=>!1);let d=[];for(let g=!0;g;){g=!1;const m=s.reduce((E,b,h)=>n[h]?E:E+b,0),_=i-l*n.filter(Boolean).length;d=s.map((E,b)=>n[b]?l:m>0?_*E/m:0),d.forEach((E,b)=>{!n[b]&&E<l&&(n[b]=!0,g=!0)})}const c=d.map(g=>Math.floor(g+1e-9));let p=i-c.reduce((g,m)=>g+m,0);return d.map((g,m)=>({i:m,fraction:g-c[m]})).sort((g,m)=>m.fraction-g.fraction||g.i-m.i).forEach(({i:g})=>{p>0&&(c[g]+=1,p-=1)}),c}function bt(e,i){const l=e.length;if(l<2)return{columns:l===1?[100]:[],gap:0};const s=Math.round(Math.min(Math.max(i,0),cd(l))*100);return{columns:ud(e,1e4-s*(l-1),500).map(n=>n/100),gap:s/100}}function md(e){if(e<2)return 0;const i=(100-e*(Math.round(100/e)-2))/(e-1);return Math.round(i/_l)*_l}function pd(e,i){if(e.columns.length!==i.length)return!1;const l=bt(i,e.gap).columns;return e.columns.every((s,n)=>Math.abs(s-l[n])<=dd)}function xl(e){return bt(e,md(e.length))}function yt(e,i){return{items:e.columns,gap:e.gap,linked:pd(e,i)}}function hd(e,i,l){return i.length<2?null:e?l==="follow"&&e.items.length===i.length&&!e.linked?{columns:e.items,gap:e.gap}:bt(i,e.gap):xl(i)}function bd(e,i){return bt(i,e.gap)}function gd(e,i,l){return bt(e.linked?i:e.items,l)}function fd(e,i){return bt(i,e.gap)}function _d(e){if(!e||typeof e!="object")return!1;const i=e;return i.type==="column"&&!!i.floatBlocks?.mobile}function xd(e,i){const l=e&&typeof e=="object"?e[i]:void 0;return typeof l=="string"&&l!==""?l:null}function kd(e,i){const l=e&&typeof e=="object"?e[i]:void 0;if(l==null||l==="")return null;const s=Number(l);return Number.isFinite(s)?s:null}function gt(e){return e.items.map(i=>Number(i.width)||0)}function Ed(e,i){return e.length===i.length&&e.every((l,s)=>l===i[s])}function Sd(e,i){const l=e.mobile??null,s=gt(i);if(!l||i.mobile!==e.mobile||Ed(gt(e),s))return i;const n=hd(l,s,"follow");return{...i,mobile:n?yt(n,s):null}}function Bd(e,i){const l=gt(e);return i||l.length<2?null:yt(xl(l),l)}function Td(e,i){const l=e.mobile,s=gt(e);return l?yt(bd(l,i),s):null}function Rd(e,i){const l=e.mobile,s=gt(e);return l?yt(gd(l,s,i),s):null}function yd(e){const i=e.mobile,l=gt(e);return i?yt(fd(i,l),l):null}function wd(e,i,l){if(!e)return null;const s=[...e.items];return[s[i],s[l]]=[s[l],s[i]],{...e,items:s}}function kl(e,i){const l=(String(i).split(".")[1]??"").length;return Number((Math.round(e/i)*i).toFixed(l))}function jd(e,i,l,s,n){const d=l.findIndex((E,b)=>Math.abs(E-i[b])>.5),c=d+1;if(d<0||c>=l.length||l[d]+l[c]<=0)return[...e];const p=e[d]+e[c],g=l[d]/(l[d]+l[c]),m=Math.min(Math.max(kl(p*g,n),s),p-s),_=[...e];return _[d]=m,_[c]=kl(p-m,n),_}var vd={marginBottom:15},El=({form:e,elementSettings:i,boxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:n,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:p,mobilePaddingShow:g,mobilePaddingsExt:m,setMobilePaddingsExt:_,oneMobileBorderRadiusValue:E,setOneMobileBorderRadiusValue:b,toggleShowMobileBorderHandler:h,toggleShowMobileBorderRadiusHandler:k,toggleShowMobileBoxShadowHandler:x,toggleShowMobileSizeHandler:T,toggleShowMobileBackgroundHandler:v,toggleShowMobilePaddingHandler:P})=>{const{__:B}=r.useI18n(),y=r.useAppConfig(),D=_d(i);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(zo,{form:e,elementSettings:i,imgParent:!0,typeOfForm:"mobile"})}),y.formCellFieldVerticalAlignEnabled&&i.type!=="group"&&(i.type!=="structure"||i.type==="structure"&&i.floatBlocks.items.length===1)&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Vo,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),y.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Padding"),collapsible:!0,open:g,onToggle:P,dividerTop:!0,children:(0,o.jsx)(Yt,{form:e,elementSettings:i,mobilePaddingsExt:m,setMobilePaddingsExt:_,rowStyle:{paddingBottom:4}})}),i.type!=="group"&&y.formCellFieldSizeEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Size"),collapsible:!0,open:c,onToggle:T,dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:9},children:[i.type!=="structure"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:D?(0,o.jsx)("div",{className:"selected-td-form__mobile-width-hint",children:B("The mobile width of the columns is set on the Columns tab")}):(0,o.jsx)("div",{style:vd,children:(0,o.jsx)(Yo,{form:e,name:"mobileWidth",elementSettings:i})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:15},children:(0,o.jsx)(lt,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:B("Background"),collapsible:!0,open:p,onToggle:v,dividerTop:!0,children:(0,o.jsx)(Rt,{elementSettings:Xo(i),imageEnabled:y.formCellFieldBackgroundImageEnabled,desktopBackground:Tt(i)})}),y.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Borders"),collapsible:!0,open:s,onToggle:h,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),y.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Border radius"),collapsible:!0,open:n,onToggle:k,dividerTop:!0,children:(0,o.jsx)(vo,{form:e,oneBorderRadiusValue:E,setOneBorderRadiusValue:b,elementSettings:i,typeOfForm:"mobile"})}),y.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Box shadow"),collapsible:!0,open:d,onToggle:x,dividerTop:!0,children:(0,o.jsx)(No,{typeOfForm:"mobile"})}),y.formFieldVisibilityEnabled&&i.type!=="column"&&(0,o.jsx)(t.ui_kit$FormSection,{title:B(i.type!=="group"?"Display control & Direction":"Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e,directionControl:i.type!=="group"?(0,o.jsx)(zt,{elementSettings:i,form:e,typeOfForm:"mobile"}):void 0})}),y.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})};El.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired,boxShadow:f.default.object,mobileBordersShow:f.default.bool,mobileBorderRadiusShow:f.default.bool,mobileBoxShadowShow:f.default.bool,mobileSizeShow:f.default.bool,mobileBackgroundShow:f.default.bool,mobilePaddingShow:f.default.bool,mobilePaddingsExt:f.default.bool,setMobilePaddingsExt:f.default.func,oneMobileBorderRadiusValue:f.default.bool,setOneMobileBorderRadiusValue:f.default.func,toggleShowMobileBorderHandler:f.default.func,toggleShowMobileBorderRadiusHandler:f.default.func,toggleShowMobileBoxShadowHandler:f.default.func,toggleShowMobileSizeHandler:f.default.func,toggleShowMobileBackgroundHandler:f.default.func,toggleShowMobilePaddingHandler:f.default.func};function Sl(e){return!!e&&typeof e=="object"&&e.type==="column"}function Id(e){const i={value:null,dim:"px"};return Sl(e)?{height:i}:{width:{value:null,dim:"px"},height:i}}function Cd(e){const i={value:null,dim:"px",classNamePrefix:"em-mob-height-"};return Sl(e)?{mobileHeight:i}:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"},mobileHeight:i}}function Bl(e,i){!e||typeof e!="object"||Object.keys(i).forEach(l=>{e[l]=""})}var Tl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),s=r.useDispatch(),[n]=t.ui_kit$Form.useForm(),d=Do(),c=Do(),[p,g]=(0,a.useState)(void 0),[m,_]=(0,a.useState)({}),[E,b]=(0,a.useState)(!0),[h,k]=(0,a.useState)(!0),x=r.useSelector(r.selectEmailViewType),T=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[v,P]=(0,a.useState)(e.backgroundImage[0].value===""),B=r.useSelector(r.selectIsCodeMode),y=r.useSelector(r.selectCodeModeDirection),D=B&&y!=="bottom",[z,A]=(0,a.useState)(!1),[$,j]=(0,a.useState)(!1),[W,Y]=(0,a.useState)(!1),[ee,I]=(0,a.useState)(!1),[le,ke]=(0,a.useState)(!1),[Ne,Q]=(0,a.useState)(!1),[fe,Ae]=(0,a.useState)(!1),[ne,Fe]=(0,a.useState)(!1),[Le,Ue]=(0,a.useState)(!1),[ve,Be]=(0,a.useState)(!1),[xe,ce]=(0,a.useState)(!1),[be,ue]=(0,a.useState)(!1),[q,Z]=(0,a.useState)(!1),[te,ae]=(0,a.useState)(!1),[de,De]=(0,a.useState)(!1),oe=r.useElementEntityKind(),Te=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],_e=e.border,Ce=e.mobileBorder,R=Object.keys(_e).find(C=>_e[C]?.width||_e[C]?.style||_e[C]?.color),V=Object.keys(Ce).find(C=>Ce[C]?.width||Ce[C]?.style||Ce[C]?.color),L=C=>C&&(C?.width||C?.style||C?.color)?C:"",{remember:X,fillFields:ie}=pt(e);(0,a.useEffect)(()=>{if(e){const C=e.boxShadow;_(C),ie(n,{...e,width:e.width?.value,widthDim:e.width?.dim,height:e.height?.value,heightDim:e.height?.dim,backgroundImage:e.backgroundImage[0].value,show:e.show?e.show:"all",isContrastBlock:e.isContrastBlock,borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),mobileBorderAll:L(e.mobileBorder.all)||!(L(e.mobileBorder.top)||L(e.mobileBorder.bottom)||L(e.mobileBorder.right)||L(e.mobileBorder.left))&&L(e.border.all),mobileBorderTop:L(e.mobileBorder.top)||!L(e.mobileBorder.all)&&L(e.border.top),mobileBorderBottom:L(e.mobileBorder.bottom)||!L(e.mobileBorder.all)&&L(e.border.bottom),mobileBorderRight:L(e.mobileBorder.right)||!L(e.mobileBorder.all)&&L(e.border.right),mobileBorderLeft:L(e.mobileBorder.left)||!L(e.mobileBorder.all)&&L(e.border.left),paddingTop:u(e.padding?.all)||u(e.padding?.top),paddingLeft:u(e.padding?.all)||u(e.padding?.left),paddingRight:u(e.padding?.all)||u(e.padding?.right),paddingBottom:u(e.padding?.all)||u(e.padding?.bottom),paddingLeftRight:u(e.padding?.left)||u(e.padding?.right),paddingTopBottom:u(e.padding?.top)||u(e.padding?.bottom),borderRadiusAll:u(e.borderRadius.all),borderRadiusTopLeft:u(e.borderRadius.topLeft),borderRadiusBottomLeft:u(e.borderRadius.bottomLeft),borderRadiusTopRight:u(e.borderRadius.topRight),borderRadiusBottomRight:u(e.borderRadius.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:So(e.mobileWidth?.value)||So(e.width?.value),mobileWidthDim:So(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:So(e.mobileHeight?.value)||So(e.height?.value),mobileHeightDim:So(e.mobileHeight?.value)?e.mobileHeight?.dim:e.height?.dim,mobileBorderRadiusAll:u(e.mobileBorderRadius?.all)||u(e.borderRadius?.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius?.topLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topLeft)||u(e.borderRadius?.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius?.bottomLeft)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomLeft)||u(e.borderRadius?.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius?.topRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.topRight)||u(e.borderRadius?.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius?.bottomRight)||u(e.mobileBorderRadius?.all)||u(e.borderRadius?.bottomRight)||u(e.borderRadius?.all),mobileBoxShadowInset:e.mobileBoxShadow?.inset!=null?e.mobileBoxShadow.inset:e.boxShadow?.inset||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset)||u(e.boxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset)||u(e.boxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius)||u(e.boxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius)||u(e.boxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color)||u(e.boxShadow?.color),mobileAlign:u(e.mobileAlign?.value)||e.align,mobileVerticalAlign:u(e.mobileVerticalAlign?.value||e.valign),mobileDirection:u(e.mobileDirection?.value),mobileBackgroundColor:u(e.mobileBackgroundColor?.value||e.backgroundColor||""),...nt(e),mobilePaddingTop:u(e.mobilePadding.all)||u(e.mobilePadding.top)||u(e.padding?.all)||u(e.padding?.top),mobilePaddingLeft:u(e.mobilePadding.all)||u(e.mobilePadding.left)||u(e.padding?.all)||u(e.padding?.left),mobilePaddingRight:u(e.mobilePadding.all)||u(e.mobilePadding.right)||u(e.padding?.all)||u(e.padding?.right),mobilePaddingBottom:u(e.mobilePadding.all)||u(e.mobilePadding.bottom)||u(e.padding?.all)||u(e.padding?.bottom),mobilePaddingTopBottom:u(e.mobilePadding.top)||u(e.mobilePadding.bottom)||u(e.padding?.top)||u(e.padding?.bottom),mobilePaddingLeftRight:u(e.mobilePadding.left)||u(e.mobilePadding.right)||u(e.padding?.left)||u(e.padding?.right),exportAsPicture:e?.exportAsPicture}),!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?b(!1):b(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||!u(e.borderRadius.all)&&!u(e.mobileBorderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?k(!1):k(!0),P(e.backgroundImage[0].value===""),!u(e.padding.all)&&(u(e.padding.top)||u(e.padding.right)||u(e.padding.bottom)||u(e.padding.left))&&(e.padding.top!==e.padding.bottom||e.padding.right!==e.padding.left)?A(!1):A(!0),!u(e.mobilePadding.all)&&(u(e.mobilePadding.top)||u(e.mobilePadding.right)||u(e.mobilePadding.bottom)||u(e.mobilePadding.left))&&(e.mobilePadding.top!==e.mobilePadding.bottom||e.mobilePadding.right!==e.mobilePadding.left)||!u(e.padding?.all)&&(u(e.padding?.top)||u(e.padding?.right)||u(e.padding?.bottom)||u(e.padding?.left))&&(e.padding?.top!==e.padding?.bottom||e.padding?.right!==e.padding?.left)?j(!1):j(!0);const H=d.isStaleBorderSnapshot(e,!!R),Pe=c.isStaleBorderSnapshot(e,!!V);H&&n.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(Pe||H&&!V)&&n.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),Y(He=>R&&!H?!0:He),I(He=>R&&!H||V&&!Pe?!0:He),ke(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),Q(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight||!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),Ae(!!e.boxShadow),Fe(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),Ue(!!e.width.value&&e.type!=="column"||!!e.height.value),Be(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value&&e.type!=="column"||!!e.height.value),ce(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),ue(!!e.mobileBackgroundColor.value||!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Ut(e)&&ue(!0),Z(!!e.exportAsPicture||!!e.isContrastBlock),ae(!!e.mobilePadding.all||e.mobilePadding.all===0||!!e.mobilePadding.top||e.mobilePadding.top===0||!!e.mobilePadding.bottom||e.mobilePadding.bottom===0||!!e.mobilePadding.left||e.mobilePadding.left===0||!!e.mobilePadding.right||e.mobilePadding.right===0||!!e.padding.all||e.padding.all===0||!!e.padding.top||e.padding.top===0||!!e.padding.bottom||e.padding.bottom===0||!!e.padding.left||e.padding.left===0||!!e.padding.right||e.padding.right===0),e.elementName==="List"?De(!0):De(!1)}},[n,e,R,V,d,c,ie]);const me=(0,a.useCallback)(C=>{X(C),s(oe==="email"?r.setElementSettings$1(C):r.setElementSettings(C))},[s,oe,X]),he=C=>{const H=n.getFieldsValue(!0),Pe=Object.keys(C)[0];let He;const{widthDim:_o}=n.getFieldsValue(!0);switch(g(_o==="%"?100:void 0),Pe){case"exportAsPicture":He={exportAsPicture:H.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":He={boxShadow:{hOffset:H.boxShadowHOffset,vOffset:H.boxShadowVOffset,blurRadius:H.boxShadowBlurRadius,spreadRadius:H.boxShadowSpreadRadius,color:H.boxShadowColor,inset:H.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":H.borderPosition==="borderAll"?(He={border:{...r.RESET_BORDER_PARAMS,all:{...U.NULL_BORDER,...H.borderAll}}},n.setFieldsValue({borderLeft:U.NULL_BORDER,borderRight:U.NULL_BORDER,borderTop:U.NULL_BORDER,borderBottom:U.NULL_BORDER})):H.borderAll?.width||H.borderAll?.style||H.borderAll?.color?(He={border:{all:null,left:H.borderAll,right:H.borderAll,top:H.borderAll,bottom:H.borderAll,[U.REVERSE_BORDER_POSITIONS[Pe]]:{...H[Pe],...C[Pe]}}},n.setFieldsValue({borderAll:null,borderLeft:H.borderAll,borderRight:H.borderAll,borderTop:H.borderAll,borderBottom:H.borderAll,[Pe]:{...H[Pe],...C[Pe]}})):(He={border:{all:null,left:H.borderLeft,right:H.borderRight,top:H.borderTop,bottom:H.borderBottom,[U.REVERSE_BORDER_POSITIONS[Pe]]:{...H[Pe],...C[Pe]}}},n.setFieldsValue({border:He.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(H.mobileBorderPosition==="mobileBorderAll")He={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...U.NULL_BORDER,...H.mobileBorderAll,classNamePrefix:"em-mob-border_"+U.MOBILE_REVERSE_BORDER_POSITIONS[Pe]+"-"}}},n.setFieldsValue({borderLeft:U.NULL_BORDER,borderRight:U.NULL_BORDER,borderTop:U.NULL_BORDER,borderBottom:U.NULL_BORDER});else{const mo=U.MOBILE_REVERSE_BORDER_POSITIONS[Pe],co={...H[Pe],...C[Pe]},ge=!co?.width&&!co?.style&&!co?.color;if(H.mobileBorder?.all?.width||H.mobileBorder?.all?.style||H.mobileBorder?.all?.color){const Ge=H.mobileBorderAll;He={mobileBorder:{all:null,left:Ge,right:Ge,top:Ge,bottom:Ge,[mo]:ge?null:{...co,classNamePrefix:"em-mob-border_"+mo+"-"}}},n.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:Ge,mobileBorderRight:Ge,mobileBorderTop:Ge,mobileBorderBottom:Ge,[Pe]:co})}else{const Ge=e.mobileBorder||{},Je=io=>{const fo=Ge[io];return fo&&(fo?.width||fo?.style||fo?.color)?fo:null};He={mobileBorder:{all:null,left:mo==="left"?ge?null:{...co,classNamePrefix:"em-mob-border_left-"}:Je("left"),right:mo==="right"?ge?null:{...co,classNamePrefix:"em-mob-border_right-"}:Je("right"),top:mo==="top"?ge?null:{...co,classNamePrefix:"em-mob-border_top-"}:Je("top"),bottom:mo==="bottom"?ge?null:{...co,classNamePrefix:"em-mob-border_bottom-"}:Je("bottom")}},n.setFieldsValue({[Pe]:co})}}break;case"width":He={[Pe]:{value:C[Pe],dim:H.widthDim}};break;case"height":He={[Pe]:{value:C[Pe],dim:H.heightDim}};break;case"widthDim":He={width:{value:H.width,dim:C[Pe]}};break;case"heightDim":He={height:{value:H.height,dim:C[Pe]}};break;case"backgroundImage":P(C[Pe]===""),He={[Pe]:[{...e.backgroundImage[0],value:C[Pe]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":He={padding:{left:H.paddingLeft,right:H.paddingRight,top:H.paddingTop,bottom:H.paddingBottom,[U.PADDING_POSITION[Pe]]:+C[Pe]}};break;case"paddingTopBottom":He={padding:{left:H.paddingLeft,right:H.paddingRight,top:+C[Pe],bottom:+C[Pe]}},H.paddingTop=H.paddingBottom=+C[Pe];break;case"paddingLeftRight":He={padding:{top:H.paddingTop,bottom:H.paddingBottom,left:+C[Pe],right:+C[Pe]}},H.paddingLeft=H.paddingRight=+C[Pe];break;case"borderRadiusAll":He={borderRadius:{[U.BORDER_RADIUS_POSITION[Pe]]:+C[Pe]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":He={borderRadius:{topLeft:H.borderRadiusTopLeft,bottomLeft:H.borderRadiusBottomLeft,topRight:H.borderRadiusTopRight,bottomRight:H.borderRadiusBottomRight,[U.BORDER_RADIUS_POSITION[Pe]]:+C[Pe]}};break;case"mobileWidth":He={[Pe]:{classNamePrefix:"em-mob-width-",value:C[Pe],dim:H.mobileWidthDim}};break;case"mobileWidthDim":He={mobileWidth:{classNamePrefix:"em-mob-width-",value:H.mobileWidth||100,dim:C[Pe]}};break;case"mobileHeight":He={[Pe]:{classNamePrefix:"em-mob-height-",value:C[Pe],dim:H.mobileHeightDim}};break;case"mobileHeightDim":He={mobileHeight:{classNamePrefix:"em-mob-height-",value:H.mobileHeight,dim:C[Pe]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":He={mobileBorderRadius:{[U.MOBILE_BORDER_RADIUS_POSITION[Pe]]:C[Pe],classNamePrefix:"em-mob-border_radius_"+U.MOBILE_BORDER_RADIUS_POSITION[Pe]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":He={mobileBoxShadow:{hOffset:H.mobileBoxShadowHOffset,vOffset:H.mobileBoxShadowVOffset,blurRadius:H.mobileBoxShadowBlurRadius,spreadRadius:H.mobileBoxShadowSpreadRadius,color:H.mobileBoxShadowColor,inset:H.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":He={[Pe]:{classNamePrefix:"em-mob-text_align-",value:C[Pe]}};break;case"mobileVerticalAlign":He={[Pe]:{classNamePrefix:"em-mob-vertical_align-",value:C[Pe]}};break;case"mobileDirection":He={[Pe]:{classNamePrefix:"em-mob-direction-",value:C[Pe]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(He=Bt(C),!He)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":He={mobilePadding:{all:null,top:H.mobilePaddingTop!==""?H.mobilePaddingTop:null,right:H.mobilePaddingRight!==""?H.mobilePaddingRight:null,bottom:H.mobilePaddingBottom!==""?H.mobilePaddingBottom:null,left:H.mobilePaddingLeft!==""?H.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":H.mobilePaddingTop=H.mobilePaddingBottom=C[Pe],He={mobilePadding:{all:null,top:H.mobilePaddingTop!==""?H.mobilePaddingTop:null,right:H.mobilePaddingRight!==""?H.mobilePaddingRight:null,bottom:H.mobilePaddingBottom!==""?H.mobilePaddingBottom:null,left:H.mobilePaddingLeft!==""?H.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":H.mobilePaddingLeft=H.mobilePaddingRight=C[Pe],He={mobilePadding:{all:null,top:H.mobilePaddingTop!==""?H.mobilePaddingTop:null,right:H.mobilePaddingRight!==""?H.mobilePaddingRight:null,bottom:H.mobilePaddingBottom!==""?H.mobilePaddingBottom:null,left:H.mobilePaddingLeft!==""?H.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"backgroundPositionX":case"backgroundPositionY":He={[Pe]:isNaN(parseFloat(C[Pe].position))?C[Pe].position:C[Pe].position+C[Pe].unit};break;default:He=C}Pe!=="borderPosition"&&Pe!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:He}),Pe!=="mobileBorderRadiusAll"&&Pe!=="mobileBorderRadiusTopLeft"&&Pe!=="mobileBorderRadiusTopRight"&&Pe!=="mobileBorderRadiusBottomLeft"&&Pe!=="mobileBorderRadiusBottomRight"&&me({...e,...He,mobileBorderRadius:{...e.mobileBorderRadius,...He?.mobileBorderRadius},activateSection:null,changeKey:Pe}))},$e=()=>{A(H=>!H);const C=n.getFieldsValue(!0);z||(C.paddingLeftRight=C.paddingLeft,C.paddingTopBottom=C.paddingTop,C.paddingRight=C.paddingLeft,C.paddingBottom=C.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:C.paddingTopBottom,bottom:C.paddingTopBottom,left:C.paddingLeftRight,right:C.paddingLeftRight}}}))},je=()=>{const C=n.getFieldsValue(!0);d.markBorderToggled(!W),setTimeout(()=>{Y(H=>!H),W?(C.borderAll=U.NULL_BORDER,C.borderTop=U.NULL_BORDER,C.borderBottom=U.NULL_BORDER,C.borderRight=U.NULL_BORDER,C.borderLeft=U.NULL_BORDER):C.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:C.borderAll.color,style:C.borderAll.style,width:C.borderAll.width}}}})})},G=()=>{const C=n.getFieldsValue(!0);c.markBorderToggled(!ee),setTimeout(()=>{I(H=>!H),ee?(C.mobileBorderAll=U.NULL_BORDER,C.mobileBorderTop=U.NULL_BORDER,C.mobileBorderBottom=U.NULL_BORDER,C.mobileBorderRight=U.NULL_BORDER,C.mobileBorderLeft=U.NULL_BORDER):C.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:C.mobileBorderAll.color,style:C.mobileBorderAll.style,width:C.mobileBorderAll.width}}}})})},re=()=>{const C=n.getFieldsValue(!0);setTimeout(()=>{ke(H=>!H),le?(C.borderRadiusAll=0,b(!0)):C.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:C.borderRadiusAll}}})})},O=()=>{const C=n.getFieldsValue(!0);setTimeout(()=>{Q(H=>!H),Ne?(C.mobileBorderRadiusAll=null,k(!0)):C.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:C.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},pe=()=>{const C=n.getFieldsValue(!0);setTimeout(()=>{Ae(H=>!H),fe?(C.boxShadowInset=!1,C.boxShadowHOffset=null,C.boxShadowVOffset=null,C.boxShadowBlurRadius=null,C.boxShadowSpreadRadius=null,C.boxShadowColor=""):(C.boxShadowInset=!1,C.boxShadowHOffset=5,C.boxShadowVOffset=5,C.boxShadowBlurRadius=10,C.boxShadowSpreadRadius=-5,C.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:C.boxShadowBlurRadius,color:C.boxShadowColor,hOffset:C.boxShadowHOffset,inset:C.boxShadowInset,spreadRadius:C.boxShadowSpreadRadius,vOffset:C.boxShadowVOffset}}})})},ye=()=>{const C=n.getFieldsValue(!0);setTimeout(()=>{Fe(H=>!H),ne?(C.mobileBoxShadowInset=!1,C.mobileBoxShadowHOffset=null,C.mobileBoxShadowVOffset=null,C.mobileBoxShadowBlurRadius=null,C.mobileBoxShadowSpreadRadius=null,C.mobileBoxShadowColor=""):(C.mobileBoxShadowInset=!1,C.mobileBoxShadowHOffset=5,C.mobileBoxShadowVOffset=5,C.mobileBoxShadowBlurRadius=10,C.mobileBoxShadowSpreadRadius=-5,C.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:C.mobileBoxShadowBlurRadius,color:C.mobileBoxShadowColor,hOffset:C.mobileBoxShadowHOffset,inset:C.mobileBoxShadowInset,spreadRadius:C.mobileBoxShadowSpreadRadius,vOffset:C.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},ze=()=>{const C=n.getFieldsValue(!0);setTimeout(()=>{if(Ue(H=>!H),Le){const H=Id(e);Bl(C,H),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:H})}})},oo=()=>{const C=n.getFieldsValue(!0);setTimeout(()=>{if(Be(H=>!H),ve){const H=Cd(e);Bl(C,H),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:H})}})},ro=()=>{const C=n.getFieldsValue(!0);setTimeout(()=>{ce(H=>!H),xe?(C.backgroundColor="",C.backgroundImage="",C.backgroundPositionX="",C.backgroundPositionY="",C.backgroundRepeat="none",C.backgroundSize="",P(!0)):(C.backgroundColor="#E5E5E5",C.backgroundSize="",C.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:C.backgroundColor,backgroundImage:[{type:"url",value:C.backgroundImage}],backgroundPositionX:C.backgroundPositionX,backgroundPositionY:C.backgroundPositionY,backgroundRepeat:C.backgroundRepeat,backgroundSize:C.backgroundSize}})})},ao=()=>{const C=n.getFieldsValue(!0);setTimeout(()=>{ue(H=>!H),be?C.mobileBackgroundColor="":C.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:C.mobileBackgroundColor}}}),be&&Wt(n,e,l)})},M=()=>{const C=n.getFieldsValue(!0);setTimeout(()=>{Z(H=>!H),q&&(C.exportAsPicture=!1,C.isContrastBlock=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1,isContrastBlock:!1}}))})},se=()=>{const C=n.getFieldsValue(!0);setTimeout(()=>{ae(H=>!H),te&&(C.mobilePaddingLeftRight="",C.mobilePaddingLeft="",C.mobilePaddingRight="",C.mobilePaddingTopBottom="",C.mobilePaddingTop="",C.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:U.BORDER_POSITIONS[R]||"borderAll",mobileBorderPosition:U.MOBILE_BORDER_POSITIONS[V]||"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:he,autoComplete:"off",className:"element-controls",children:x==="mobile"&&T.styles?(0,o.jsxs)("div",{className:"selected_form-mobile-props-wrapper",style:{display:x==="mobile"&&T.styles?"flex":"none"},children:[(0,o.jsx)("div",{className:"selected_form-mobile-props-header",children:!D&&(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)(El,{form:n,elementSettings:e,boxShadow:m,mobileBordersShow:ee,mobileBorderRadiusShow:Ne,mobileBoxShadowShow:ne,mobileSizeShow:ve,mobileBackgroundShow:be,mobilePaddingShow:te,mobilePaddingsExt:$,setMobilePaddingsExt:j,oneMobileBorderRadiusValue:h,setOneMobileBorderRadiusValue:k,toggleShowMobileBorderHandler:G,toggleShowMobileBorderRadiusHandler:O,toggleShowMobileBoxShadowHandler:ye,toggleShowMobileSizeHandler:oo,toggleShowMobileBackgroundHandler:ao,toggleShowMobilePaddingHandler:se})})]}):(0,o.jsxs)(o.Fragment,{children:[!D&&(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)(fl,{form:n,elementSettings:e,boxShadow:m,bordersShow:W,borderRadiusShow:le,boxShadowShow:fe,backgroundShow:xe,backgroundImageEmpty:v,backgroundRepeatOptions:Te,sizeShow:Le,maxWidthValue:p,modificationShow:q,paddingsExt:z,oneBorderRadiusValue:E,setOneBorderRadiusValue:b,elementListShow:de,togglePaddingHandler:$e,toggleShowBorderHandler:je,toggleShowBorderRadiusHandler:re,toggleShowBoxShadowHandler:pe,toggleShowSizeHandler:ze,toggleShowBackgroundHandler:ro,toggleShowModificationHandler:M,handleChangeValues:he})})]})})};Tl.propTypes={elementSettings:f.default.object.isRequired};var Rl=({form:e,elementSettings:i,boxShadow:l,bordersShow:s,borderRadiusShow:n,boxShadowShow:d,backgroundShow:c,backgroundImageEmpty:p,backgroundRepeatOptions:g,sizeShow:m,maxWidthValue:_,modificationShow:E,paddingShow:b,paddingsExt:h,oneBorderRadiusValue:k,setOneBorderRadiusValue:x,togglePaddingHandler:T,toggleShowPaddingHandler:v,toggleShowBorderHandler:P,toggleShowBorderRadiusHandler:B,toggleShowBoxShadowHandler:y,toggleShowSizeHandler:D,toggleShowBackgroundHandler:z,toggleShowModificationHandler:A,handleChangeValues:$})=>{const{__:j}=r.useI18n(),{token:W}=(0,t.ui_kit$useToken)(),Y=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-desktop-props-title",title:j("Appearance on mobile devices"),type:"info"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{marginBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(st,{form:e,elementSettings:i})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Vo,{form:e,elementSettings:i})})]}),Y.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Padding"),collapsible:!0,open:b,onToggle:v,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:h,onToggleExtended:T,labels:{horizontal:j("Horizontal padding"),vertical:j("Vertical padding"),left:j("Left padding"),right:j("Right padding"),top:j("Top padding"),bottom:j("Bottom padding"),individual:j("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:j("Size"),collapsible:!0,open:m,onToggle:D,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:_,dimensionSelect:Mo,showMinMax:!0,minWidthDimensionSelect:Mo,maxWidthDimensionSelect:Mo,labels:{width:j("Width"),height:j("Height"),minWidth:j("Minimum width"),maxWidth:j("Maximum width")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:j("Background"),collapsible:!0,open:c,onToggle:z,dividerTop:!0,children:[(0,o.jsx)(Fi,{form:e,backgroundImageEmpty:p,appConfig:Y,token:W,elementSettings:i,backgroundRepeatOptions:g,handleChangeValues:$}),(0,o.jsx)(at,{form:e,showBackground:!0})]}),Y.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Borders"),collapsible:!0,open:s,onToggle:P,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,elementSettings:i})}),Y.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Border radius"),collapsible:!0,open:n,onToggle:B,dividerTop:!0,children:(0,o.jsx)(vo,{form:e,oneBorderRadiusValue:k,setOneBorderRadiusValue:x,elementSettings:i})}),Y.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Box shadow"),collapsible:!0,open:d,onToggle:y,dividerTop:!0,children:(0,o.jsx)(No,{})}),Y.formFieldExportAsPictureEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Export settings"),collapsible:!0,open:E,onToggle:A,dividerTop:!0,children:(0,o.jsx)(Li,{form:e,elementSettings:i})}),Y.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("Display control & Direction"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e,directionControl:(0,o.jsx)(zt,{elementSettings:i,form:e})})}),Y.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:j("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})};Rl.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 yl=({form:e,elementSettings:i,mobileBoxShadow:l,mobileBordersShow:s,mobileBorderRadiusShow:n,mobileBoxShadowShow:d,mobileSizeShow:c,mobileBackgroundShow:p,mobilePaddingShow:g,mobilePaddingsExt:m,setMobilePaddingsExt:_,oneMobileBorderRadiusValue:E,setOneMobileBorderRadiusValue:b,toggleShowMobileBorderHandler:h,toggleShowMobileBorderRadiusHandler:k,toggleShowMobileBoxShadowHandler:x,toggleShowMobileSizeHandler:T,toggleShowMobileBackgroundHandler:v,toggleShowMobilePaddingHandler:P})=>{const{__:B}=r.useI18n(),{token:y}=(0,t.ui_kit$useToken)(),D=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(Vt,{form:e,elementSettings:i,imgParent:!0})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Vo,{form:e,elementSettings:i,typeOfForm:"mobile"})})]}),D.formCellFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Padding"),collapsible:!0,open:g,onToggle:P,dividerTop:!0,children:(0,o.jsx)(Yt,{form:e,elementSettings:i,mobilePaddingsExt:m,setMobilePaddingsExt:_})}),(0,o.jsx)(t.ui_kit$FormSection,{title:B("Size"),collapsible:!0,open:c,onToggle:T,dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:8},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:y.formItemMarginBottomXS*2},children:(0,o.jsx)(Yo,{form:e,name:"mobileWidth",elementSettings:i})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:y.formItemMarginBottomXS},children:(0,o.jsx)(lt,{form:e,name:"mobileHeight",elementSettings:i})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:B("Background"),collapsible:!0,open:p,onToggle:v,dividerTop:!0,children:(0,o.jsx)(Rt,{elementSettings:Xo(i),imageEnabled:D.formDivFieldBackgroundImageEnabled,desktopBackground:Tt(i)})}),D.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Borders"),collapsible:!0,open:s,onToggle:h,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),D.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Border radius"),collapsible:!0,open:n,onToggle:k,dividerTop:!0,children:(0,o.jsx)(vo,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:E,setOneBorderRadiusValue:b,elementSettings:i})}),D.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Box shadow"),collapsible:!0,open:d,onToggle:x,dividerTop:!0,children:(0,o.jsx)(No,{typeOfForm:"mobile",form:e,elementSettings:i})}),D.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Display control & Direction"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e,directionControl:(0,o.jsx)(zt,{elementSettings:i,form:e,typeOfForm:"mobile"})})}),D.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})};yl.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 wl=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),n=Do(),d=Do(),[c,p]=(0,a.useState)({}),[g,m]=(0,a.useState)(!0),[_,E]=(0,a.useState)({}),[b,h]=(0,a.useState)(!0),k=r.useSelector(r.selectEmailViewType),x=r.useSelector(r.selectMobileViewActive);r.useAppConfig();const[T,v]=(0,a.useState)(e.backgroundImage[0].value===""),P=r.useSelector(r.selectIsCodeMode),B=r.useSelector(r.selectCodeModeDirection),y=P&&B!=="bottom",[D,z]=(0,a.useState)(!1),[A,$]=(0,a.useState)(!1),[j,W]=(0,a.useState)(!1),[Y,ee]=(0,a.useState)(!1),[I,le]=(0,a.useState)(!1),[ke,Ne]=(0,a.useState)(!1),[Q,fe]=(0,a.useState)(!1),[Ae,ne]=(0,a.useState)(!1),[Fe,Le]=(0,a.useState)(!1),[Ue,ve]=(0,a.useState)(!1),[Be,xe]=(0,a.useState)(!1),[ce,be]=(0,a.useState)(!1),[ue,q]=(0,a.useState)(!1),[Z,te]=(0,a.useState)(!1),[ae,de]=(0,a.useState)(!1),[De,oe]=(0,a.useState)(void 0),Te=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}];i("Not defined"),i("Contain"),i("Cover");const _e=e.border,Ce=e.mobileBorder,R=Object.keys(_e).find(M=>_e[M]?.width||_e[M]?.style||_e[M]?.color),V=Object.keys(Ce).find(M=>Ce[M]?.width||Ce[M]?.style||Ce[M]?.color),L=M=>M&&(M?.width||M?.style||M?.color)?M:"";(0,a.useEffect)(()=>{if(e){const M=e.boxShadow,se=e.mobileBoxShadow;p(M),E(se),s.setFieldsValue({...e,width:e.width?.value,widthDim:e.width?.dim,height:e.height?.value,heightDim:e.height?.dim,maxWidth:e.maxWidth?.value,maxWidthDim:e.maxWidth?.dim,minWidth:e.minWidth?.value,minWidthDim:e.minWidth?.dim,backgroundImage:e.backgroundImage[0].value,show:e.show?e.show:"all",borderAll:u(e.border.all),borderTop:u(e.border.top),borderBottom:u(e.border.bottom),borderRight:u(e.border.right),borderLeft:u(e.border.left),mobileBorderAll:L(e.mobileBorder.all)||!(L(e.mobileBorder.top)||L(e.mobileBorder.bottom)||L(e.mobileBorder.right)||L(e.mobileBorder.left))&&L(e.border.all),mobileBorderTop:L(e.mobileBorder.top)||!L(e.mobileBorder.all)&&L(e.border.top),mobileBorderBottom:L(e.mobileBorder.bottom)||!L(e.mobileBorder.all)&&L(e.border.bottom),mobileBorderRight:L(e.mobileBorder.right)||!L(e.mobileBorder.all)&&L(e.border.right),mobileBorderLeft:L(e.mobileBorder.left)||!L(e.mobileBorder.all)&&L(e.border.left),paddingTop:u(e.padding.all)||u(e.padding.top),paddingLeft:u(e.padding.all)||u(e.padding.left),paddingRight:u(e.padding.all)||u(e.padding.right),paddingBottom:u(e.padding.all)||u(e.padding.bottom),paddingLeftRight:u(e.padding?.left)||u(e.padding?.right),paddingTopBottom:u(e.padding?.top)||u(e.padding?.bottom),borderRadiusAll:u(e.borderRadius.all),borderRadiusTopLeft:u(e.borderRadius.topLeft),borderRadiusBottomLeft:u(e.borderRadius.bottomLeft),borderRadiusTopRight:u(e.borderRadius.topRight),borderRadiusBottomRight:u(e.borderRadius.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:So(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileHeight:So(e.mobileHeight?.value),mobileHeightDim:e.mobileHeight?.dim,mobileBorderRadiusAll:u(e.mobileBorderRadius.all),mobileBorderRadiusTopLeft:u(e.mobileBorderRadius.topLeft!==null?e.mobileBorderRadius.topLeft:e.mobileBorderRadius.all),mobileBorderRadiusBottomLeft:u(e.mobileBorderRadius.bottomLeft!==null?e.mobileBorderRadius.bottomLeft:e.mobileBorderRadius.all),mobileBorderRadiusTopRight:u(e.mobileBorderRadius.topRight!==null?e.mobileBorderRadius.topRight:e.mobileBorderRadius.all),mobileBorderRadiusBottomRight:u(e.mobileBorderRadius.bottomRight!==null?e.mobileBorderRadius.bottomRight:e.mobileBorderRadius.all),mobileBoxShadowInset:u(e.mobileBoxShadow?.inset)||!1,mobileBoxShadowHOffset:u(e.mobileBoxShadow?.hOffset),mobileBoxShadowVOffset:u(e.mobileBoxShadow?.vOffset),mobileBoxShadowBlurRadius:u(e.mobileBoxShadow?.blurRadius),mobileBoxShadowSpreadRadius:u(e.mobileBoxShadow?.spreadRadius),mobileBoxShadowColor:u(e.mobileBoxShadow?.color),mobileAlign:u(e.mobileAlign?.value),mobileVerticalAlign:u(e.mobileVerticalAlign?.value),mobileDirection:u(e.mobileDirection?.value),mobileBackgroundColor:u(e.mobileBackgroundColor?.value!=="none"?e.mobileBackgroundColor?.value:""),...nt(e),mobilePaddingTop:u(e.mobilePadding.all)||u(e.mobilePadding.top),mobilePaddingLeft:u(e.mobilePadding.all)||u(e.mobilePadding.left),mobilePaddingRight:u(e.mobilePadding.all)||u(e.mobilePadding.right),mobilePaddingBottom:u(e.mobilePadding.all)||u(e.mobilePadding.bottom),mobilePaddingTopBottom:u(e.mobilePadding.top)||u(e.mobilePadding.bottom),mobilePaddingLeftRight:u(e.mobilePadding.left)||u(e.mobilePadding.right),exportAsPicture:e?.exportAsPicture}),!u(e.borderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?m(!1):m(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))?h(!1):h(!0),v(e.backgroundImage[0].value===""),!u(e.padding.all)&&(u(e.padding.top)||u(e.padding.right)||u(e.padding.bottom)||u(e.padding.left))&&(e.padding.top!==e.padding.bottom||e.padding.right!==e.padding.left)?z(!1):z(!0),!u(e.mobilePadding.all)&&(u(e.mobilePadding.top)||u(e.mobilePadding.right)||u(e.mobilePadding.bottom)||u(e.mobilePadding.left))&&(e.mobilePadding.top!==e.mobilePadding.bottom||e.mobilePadding.right!==e.mobilePadding.left)?$(!1):$(!0);const C=n.isStaleBorderSnapshot(e,!!R),H=d.isStaleBorderSnapshot(e,!!V);C&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(H||C&&!V)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),W(Pe=>R&&!C?!0:Pe),ee(Pe=>R&&!C||V&&!H?!0:Pe),le(!!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),fe(!!e.boxShadow),ne(!!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),ve(!!e.mobileWidth.value||!!e.mobileHeight.value),xe(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),be(Ut(e)),q(!!e.exportAsPicture),te(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),de(!!e.mobilePadding.all||!!e.mobilePadding.top||!!e.mobilePadding.bottom||!!e.mobilePadding.left||!!e.mobilePadding.right)}},[s,e,R,V,n,d]);const X=M=>{const se=s.getFieldsValue(!0),C=Object.keys(M)[0];let H;const{widthDim:Pe}=s.getFieldsValue(!0);switch(oe(Pe==="%"?100:void 0),C){case"exportAsPicture":H={exportAsPicture:se.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":H={boxShadow:{hOffset:se.boxShadowHOffset,vOffset:se.boxShadowVOffset,blurRadius:se.boxShadowBlurRadius,spreadRadius:se.boxShadowSpreadRadius,color:se.boxShadowColor,inset:se.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":se.borderPosition==="borderAll"?(H={border:{...r.RESET_BORDER_PARAMS,all:{...U.NULL_BORDER,...se.borderAll}}},s.setFieldsValue({borderLeft:U.NULL_BORDER,borderRight:U.NULL_BORDER,borderTop:U.NULL_BORDER,borderBottom:U.NULL_BORDER})):se.borderAll?.width||se.borderAll?.style||se.borderAll?.color?(H={border:{all:null,left:se.borderAll,right:se.borderAll,top:se.borderAll,bottom:se.borderAll,[U.REVERSE_BORDER_POSITIONS[C]]:{...se[C],...M[C]}}},s.setFieldsValue({borderAll:null,borderLeft:se.borderAll,borderRight:se.borderAll,borderTop:se.borderAll,borderBottom:se.borderAll,[C]:{...se[C],...M[C]}})):(H={border:{all:null,left:se.borderLeft,right:se.borderRight,top:se.borderTop,bottom:se.borderBottom,[U.REVERSE_BORDER_POSITIONS[C]]:{...se[C],...M[C]}}},s.setFieldsValue({border:H.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(se.mobileBorderPosition==="mobileBorderAll")H={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...U.NULL_BORDER,...se.mobileBorderAll,classNamePrefix:"em-mob-border_"+U.MOBILE_REVERSE_BORDER_POSITIONS[C]+"-"}}},s.setFieldsValue({borderLeft:U.NULL_BORDER,borderRight:U.NULL_BORDER,borderTop:U.NULL_BORDER,borderBottom:U.NULL_BORDER});else{const He=U.MOBILE_REVERSE_BORDER_POSITIONS[C],_o={...se[C],...M[C]},mo=!_o?.width&&!_o?.style&&!_o?.color;if(se.mobileBorder?.all?.width||se.mobileBorder?.all?.style||se.mobileBorder?.all?.color){const co=se.mobileBorderAll;H={mobileBorder:{all:null,left:co,right:co,top:co,bottom:co,[He]:mo?null:{..._o,classNamePrefix:"em-mob-border_"+He+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:co,mobileBorderRight:co,mobileBorderTop:co,mobileBorderBottom:co,[C]:_o})}else{const co=e.mobileBorder||{},ge=Ge=>{const Je=co[Ge];return Je&&(Je?.width||Je?.style||Je?.color)?Je:null};H={mobileBorder:{all:null,left:He==="left"?mo?null:{..._o,classNamePrefix:"em-mob-border_left-"}:ge("left"),right:He==="right"?mo?null:{..._o,classNamePrefix:"em-mob-border_right-"}:ge("right"),top:He==="top"?mo?null:{..._o,classNamePrefix:"em-mob-border_top-"}:ge("top"),bottom:He==="bottom"?mo?null:{..._o,classNamePrefix:"em-mob-border_bottom-"}:ge("bottom")}},s.setFieldsValue({[C]:_o})}}break;case"width":H={[C]:{value:M[C],dim:se.widthDim}};break;case"height":H={[C]:{value:M[C],dim:se.heightDim}};break;case"widthDim":H={width:{value:se.width,dim:M[C]}};break;case"heightDim":H={height:{value:se.height,dim:M[C]}};break;case"maxWidth":H={[C]:{value:M[C],dim:se.maxWidthDim}};break;case"maxWidthDim":H={maxWidth:{value:se.maxWidth,dim:M[C]}};break;case"minWidth":H={[C]:{value:M[C],dim:se.minWidthDim}};break;case"minWidthDim":H={minWidth:{value:se.minWidth,dim:M[C]}};break;case"backgroundImage":v(M[C]===""),H={[C]:[{...e.backgroundImage[0],value:M[C]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":H={padding:{[U.PADDING_POSITION[C]]:+M[C]}};break;case"paddingTopBottom":H={padding:{top:+M[C],bottom:+M[C]}},se.paddingTop=se.paddingBottom=+M[C];break;case"paddingLeftRight":H={padding:{left:+M[C],right:+M[C]}},se.paddingLeft=se.paddingRight=+M[C];break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":H={borderRadius:{[U.BORDER_RADIUS_POSITION[C]]:+M[C]}};break;case"mobileWidth":H={[C]:{classNamePrefix:"em-mob-width-",value:M[C],dim:se.mobileWidthDim}};break;case"mobileWidthDim":H={mobileWidth:{classNamePrefix:"em-mob-width-",value:se.mobileWidth||100,dim:M[C]}};break;case"mobileHeight":H={[C]:{classNamePrefix:"em-mob-height-",value:M[C],dim:se.mobileHeightDim}};break;case"mobileHeightDim":H={mobileHeight:{classNamePrefix:"em-mob-height-",value:se.mobileHeight,dim:M[C]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":H={mobileBorderRadius:{[U.MOBILE_BORDER_RADIUS_POSITION[C]]:M[C],classNamePrefix:"em-mob-border_radius_"+U.MOBILE_BORDER_RADIUS_POSITION[C]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":H={mobileBoxShadow:{hOffset:se.mobileBoxShadowHOffset,vOffset:se.mobileBoxShadowVOffset,blurRadius:se.mobileBoxShadowBlurRadius,spreadRadius:se.mobileBoxShadowSpreadRadius,color:se.mobileBoxShadowColor,inset:se.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":H={[C]:{classNamePrefix:"em-mob-text_align-",value:M[C]}};break;case"mobileVerticalAlign":H={[C]:{classNamePrefix:"em-mob-vertical_align-",value:M[C]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(H=Bt(M),!H)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":H={mobilePadding:{all:null,top:se.mobilePaddingTop!==""?se.mobilePaddingTop:null,right:se.mobilePaddingRight!==""?se.mobilePaddingRight:null,bottom:se.mobilePaddingBottom!==""?se.mobilePaddingBottom:null,left:se.mobilePaddingLeft!==""?se.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":se.mobilePaddingTop=se.mobilePaddingBottom=M[C],H={mobilePadding:{all:null,top:se.mobilePaddingTop!==""?se.mobilePaddingTop:null,right:se.mobilePaddingRight!==""?se.mobilePaddingRight:null,bottom:se.mobilePaddingBottom!==""?se.mobilePaddingBottom:null,left:se.mobilePaddingLeft!==""?se.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":se.mobilePaddingLeft=se.mobilePaddingRight=M[C],H={mobilePadding:{all:null,top:se.mobilePaddingTop!==""?se.mobilePaddingTop:null,right:se.mobilePaddingRight!==""?se.mobilePaddingRight:null,bottom:se.mobilePaddingBottom!==""?se.mobilePaddingBottom:null,left:se.mobilePaddingLeft!==""?se.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileDirection":H={[C]:{classNamePrefix:"em-mob-direction-",value:M[C]}};break;case"backgroundPositionX":case"backgroundPositionY":H={[C]:isNaN(parseFloat(M[C].position))?M[C].position:M[C].position+M[C].unit};break;default:H=M}C!=="borderPosition"&&C!=="mobileBorderPosition"&&l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:H})},ie=()=>{z(se=>!se);const M=s.getFieldsValue(!0);D||(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}}}))},me=()=>{const M=s.getFieldsValue(!0);n.markBorderToggled(!j),setTimeout(()=>{W(se=>!se),j?(M.borderAll=U.NULL_BORDER,M.borderTop=U.NULL_BORDER,M.borderBottom=U.NULL_BORDER,M.borderRight=U.NULL_BORDER,M.borderLeft=U.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}}}})})},he=()=>{const M=s.getFieldsValue(!0);d.markBorderToggled(!Y),setTimeout(()=>{ee(se=>!se),Y?(M.mobileBorderAll=U.NULL_BORDER,M.mobileBorderTop=U.NULL_BORDER,M.mobileBorderBottom=U.NULL_BORDER,M.mobileBorderRight=U.NULL_BORDER,M.mobileBorderLeft=U.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}}}})})},$e=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{le(se=>!se),I?(M.borderRadiusAll=0,m(!0)):M.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:M.borderRadiusAll}}})})},je=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{Ne(se=>!se),ke?(M.mobileBorderRadiusAll=null,h(!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-"}}})})},G=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{fe(se=>!se),Q?(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}}})})},re=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{ne(se=>!se),Ae?(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-"}}})})},O=()=>{setTimeout(()=>{Le(M=>!M)})},pe=()=>{setTimeout(()=>{ve(M=>!M)})},ye=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{xe(se=>!se),Be?(M.backgroundColor="",M.backgroundImage="",M.backgroundPositionX="",M.backgroundPositionY="",M.backgroundRepeat="none",M.backgroundSize="",v(!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}})})},ze=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{be(se=>!se),ce?M.mobileBackgroundColor="":M.mobileBackgroundColor="#E5E5E5",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:M.mobileBackgroundColor}}}),ce&&Wt(s,e,l)})},oo=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{q(se=>!se),ue&&(M.exportAsPicture=!1,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})},ro=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{te(se=>!se),Z&&(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}}}))})},ao=()=>{const M=s.getFieldsValue(!0);setTimeout(()=>{de(se=>!se),ae&&(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_"}}}))})};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:U.BORDER_POSITIONS[R]||"borderAll",mobileBorderPosition:U.MOBILE_BORDER_POSITIONS[V]||"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:X,autoComplete:"off",className:"element-controls",children:[!y&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),k==="mobile"&&x.styles?(0,o.jsxs)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:[(0,o.jsx)(yl,{form:s,elementSettings:e,mobileBoxShadow:_,mobileBordersShow:Y,mobileBorderRadiusShow:ke,mobileBoxShadowShow:Ae,mobileSizeShow:Ue,mobileBackgroundShow:ce,mobilePaddingShow:ae,mobilePaddingsExt:A,setMobilePaddingsExt:$,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:h,toggleShowMobileBorderHandler:he,toggleShowMobileBorderRadiusHandler:je,toggleShowMobileBoxShadowHandler:re,toggleShowMobileSizeHandler:pe,toggleShowMobileBackgroundHandler:ze,toggleShowMobilePaddingHandler:ao})," "]}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Rl,{form:s,elementSettings:e,boxShadow:c,bordersShow:j,borderRadiusShow:I,boxShadowShow:Q,backgroundShow:Be,backgroundImageEmpty:T,backgroundRepeatOptions:Te,sizeShow:Fe,maxWidthValue:De,modificationShow:ue,paddingShow:Z,paddingsExt:D,oneBorderRadiusValue:g,setOneBorderRadiusValue:m,togglePaddingHandler:ie,toggleShowPaddingHandler:ro,toggleShowBorderHandler:me,toggleShowBorderRadiusHandler:$e,toggleShowBoxShadowHandler:G,toggleShowSizeHandler:O,toggleShowBackgroundHandler:ye,toggleShowModificationHandler:oo,handleChangeValues:X})})]})};wl.propTypes={elementSettings:f.default.object.isRequired};var jl=({form:e,elementSettings:i})=>{const{__:l}=r.useI18n(),s=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:"0"},children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Float block width"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"width",children:(0,o.jsx)(t.ui_kit$InputNumber,{min:0,placeholder:l("Float block width"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:(0,o.jsx)(t.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:Mo})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:l("Column gap"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gap",children:(0,o.jsx)(t.ui_kit$InputNumber,{min:0,placeholder:l("Column gap"),prefix:(0,o.jsx)(r.EmIcons,{icon:"SplitCellsOutlined",component:t.icons$SplitCellsOutlined}),addonAfter:(0,o.jsx)(t.ui_kit$Form.Item,{name:"widthDim",noStyle:!0,children:Nn})})})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Vertical alignment"),dividerTop:!0,children:(0,o.jsx)(Vo,{form:e,elementSettings:i})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e})}),s.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:l("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})};jl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired};var vl=({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)(Yo,{form:e,name:"mobileWidth",elementSettings:i})}),(0,o.jsx)(t.ui_kit$Col,{span:12})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Alignments"),dividerTop:!0,children:(0,o.jsx)(Vo,{form:e,elementSettings:i,typeOfForm:"mobile"})}),(0,o.jsx)(t.ui_kit$FormSection,{title:l("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e})}),s.formFieldAmpVisibilityEnabled&&i.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:l("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})};vl.propTypes={form:f.default.object.isRequired,elementSettings:f.default.object.isRequired};var Mi=0,Il=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),n=r.useSelector(r.selectEmailViewType),d=r.useSelector(r.selectMobileViewActive),c=r.useSelector(r.selectIsCodeMode),p=r.useSelector(r.selectCodeModeDirection),g=c&&p!=="bottom";(0,a.useEffect)(()=>{e&&(s.setFieldsValue({...e,width:e.width?.value,widthDim:e.width?.dim,gap:e.gap?.value,gapDim:e.gap?.dim,maxWidth:e.maxWidth?.value,maxWidthDim:e.maxWidth?.dim,minWidth:e.minWidth?.value,minWidthDim:e.minWidth?.dim,show:e.show?e.show:"all",mobileWidth:So(e.mobileWidth?.value),mobileWidthDim:e.mobileWidth?.dim,mobileContentWidth:So(e.mobileContentWidth?.value),mobileContentWidthDim:e.mobileContentWidth?.dim,mobileVerticalAlign:u(e.mobileVerticalAlign?.value)}),Mi=e.width.value+e.gap.value)},[s,e]);const m=_=>{const E=s.getFieldsValue(!0),b=Object.keys(_)[0];let h;switch(b){case"width":Mi=_[b]+E.gap,h={[b]:{value:_[b],dim:E.widthDim},gap:{value:E.gap}};break;case"widthDim":h={width:{value:E.width,dim:_[b]},gap:{value:E.gap}};break;case"gap":E.width=Mi-_[b],h={[b]:{value:_[b],dim:"px"}};break;case"mobileWidth":h={[b]:{classNamePrefix:"em-mob-width-",value:_[b],dim:E.mobileWidthDim}};break;case"mobileWidthDim":h={mobileWidth:{classNamePrefix:"em-mob-width-",value:E.mobileWidth||100,dim:_[b]}};break;case"mobileContentWidth":h={[b]:{classNamePrefix:"em-mob-width-",value:_[b],dim:E.mobileContentWidthDim}};break;case"mobileContentWidthDim":h={mobileContentWidth:{classNamePrefix:"em-mob-width-",value:100,dim:_[b]}};break;case"mobileVerticalAlign":h={[b]:{classNamePrefix:"em-mob-vertical_align-",value:_[b]}};break;default:h=_}l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:h})};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_float_block_form",initialValues:{width:{value:"",dim:""},gap:{value:"",dim:"px"},valign:"",show:"all",mobileWidth:"",mobileWidthDim:"",mobileContentWidth:"",mobileContentWidthDim:"",mobileVerticalAlign:""},onValuesChange:m,autoComplete:"off",className:"element-controls",children:[!g&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),n==="mobile"&&d.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:n==="mobile"&&d.styles?"block":"none"},children:(0,o.jsx)(vl,{form:s,elementSettings:e})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(jl,{form:s,elementSettings:e})})]})};Il.propTypes={elementSettings:f.default.object.isRequired};function Cl({height:e,multiline:i}){return!i&&Number(e)>0}function Pd(e,i,l){const s={classNamePrefix:"em-mob-height-",value:e,dim:i};return l?{mobileHeight:s}:{mobileHeight:s,mobileLineHeight:{classNamePrefix:"em-mob-line_height-",value:e,dim:i}}}var Pl=({form:e,fillFields:i,elementSettings:l,boxShadow:s,bordersShow:n,borderRadiusShow:d,boxShadowShow:c,backgroundShow:p,backgroundImageEmpty:g,backgroundRepeatOptions:m,paddingShow:_,paddingsExt:E,maxWidthValue:b,oneBorderRadiusValue:h,setOneBorderRadiusValue:k,linkProtocol:x,linkTarget:T,isOpenTextReplacer:v,textReplacerButtonRef:P,textReplacerInputRef:B,handleLinkProtocolsChange:y,handleSelect:D,textReplacerInputHandler:z,handleTextReplacerKeyDown:A,srcButtonHandler:$,togglePaddingHandler:j,toggleShowPaddingHandler:W,toggleShowBackgroundHandler:Y,toggleShowBorderHandler:ee,toggleShowBorderRadiusHandler:I,toggleShowBoxShadowHandler:le,setLinkProtocol:ke,handleChangeValues:Ne})=>{const{__:Q}=r.useI18n(),fe=t.ui_kit$Form.useWatch("height",e),Ae=l,ne=Cl({height:fe??Ae.height?.value,multiline:Ae.multiline}),{token:Fe}=(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:Q("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})}),Le.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(st,{form:e,name:"textAlign",elementSettings:l})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}}),(0,o.jsx)(it,{show:x==="#",__:Q,style:{marginBottom:Fe.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Q("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:Le.formButtonFieldReplacerEnabled?Fe.formItemMarginBottomXS:Fe.formItemMarginBottomMD+4},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(tt,{linkProtocol:x,handleLinkProtocolsChange:y,__:Q}),placeholder:Q("Hyperlink URL"),allowClear:!0,onSelect:D,prefix:(0,o.jsx)(ot,{linkProtocol:x})})})}),x==="mailto:"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"subject",style:{marginBottom:Fe.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:Q("Subject")})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:Fe.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:Q("Body")})})]}),Le.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:Q("Text replacer"),placement:"bottom",getPopupContainer:Ue=>Ue.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button ant-form-item",{"selected-td-form__button--active":v}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:$,ref:P})})}),(0,o.jsx)(t.ui_kit$Col,{span:21,children:v&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:Q("Text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textReplacer",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:Q("The code that will replace this text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:Q("Text")}),onChange:z,onKeyDown:A,ref:B,onSelect:D})})})})]})}),Le.formButtonFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Q("Padding"),collapsible:!0,open:_,onToggle:W,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:E,onToggleExtended:j,showVertical:!ne,gutter:Fe.marginSM,labels:{horizontal:Q("Horizontal padding"),vertical:Q("Vertical padding"),left:Q("Left padding"),right:Q("Right padding"),top:Q("Top padding"),bottom:Q("Bottom padding"),individual:Q("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:Q("Size"),dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormSizeInputs,{maxWidth:b,dimensionSelect:Mo,gutter:Fe.marginSM,labels:{width:Q("Width"),height:Q("Height"),minWidth:Q("Minimum width"),maxWidth:Q("Maximum width")}})}),(0,o.jsx)(St,{form:e,fillFields:i,elementSettings:l,showAddParagraph:!1,isButton:!0,showLineHeight:!ne,setLinkProtocol:ke,linkProtocol:x,linkTarget:T}),(0,o.jsxs)(t.ui_kit$FormSection,{title:Q("Background"),collapsible:!0,open:p,onToggle:Y,dividerTop:!0,children:[(0,o.jsx)(Fi,{form:e,backgroundImageEmpty:g,appConfig:Le,token:Fe,elementSettings:l,backgroundRepeatOptions:m,handleChangeValues:Ne}),(0,o.jsx)(at,{form:e,showBackground:!0})]}),Le.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Q("Borders"),collapsible:!0,open:n,onToggle:ee,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,elementSettings:l})}),Le.formFieldBorderRadiusEnabled&&(0,o.jsxs)(t.ui_kit$FormSection,{title:Q("Border radius"),collapsible:!0,open:d,onToggle:I,dividerTop:!0,children:[(0,o.jsx)(vo,{form:e,oneBorderRadiusValue:h,setOneBorderRadiusValue:k,elementSettings:l}),(0,o.jsx)(at,{form:e,showRounding:!0})]}),Le.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Q("Box shadow"),collapsible:!0,open:c,onToggle:le,dividerTop:!0,children:(0,o.jsx)(No,{})}),Le.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:Q("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:l,form:e})}),Le.formFieldAmpVisibilityEnabled&&l.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:Q("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})]})};Pl.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 Nl=({form:e,fillFields:i,elementSettings:l,boxShadow:s,mobileBordersShow:n,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,mobileSizeShow:p,mobileBackgroundShow:g,mobilePaddingShow:m,mobilePaddingsExt:_,setMobilePaddingsExt:E,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:h,linkProtocol:k,handleLinkProtocolsChange:x,setLinkProtocol:T,toggleShowMobileBorderHandler:v,toggleShowMobileBorderRadiusHandler:P,toggleShowMobileBoxShadowHandler:B,toggleShowMobileSizeHandler:y,toggleShowMobileBackgroundHandler:D,toggleShowMobilePaddingHandler:z})=>{const{__:A}=r.useI18n(),$=t.ui_kit$Form.useWatch("mobileHeight",e),j=l,W=Cl({height:$??j.mobileHeight?.value??j.height?.value,multiline:j.multiline}),{token:Y}=(0,t.ui_kit$useToken)(),ee=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"})}),ee.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,style:{textAlign:"right"},children:(0,o.jsx)(Vt,{form:e,name:"mobileTextAlign",elementSettings:l,imgParent:!0})})]}),!!l.showOnMobile&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:24}}),(0,o.jsx)(it,{show:k==="#",__:A,style:{marginBottom:Y.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:A("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"href",style:{marginBottom:k==="mailto:"?Y.formItemMarginBottomXS:Y.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(tt,{linkProtocol:k,handleLinkProtocolsChange:x,__:A}),placeholder:A("Hyperlink URL"),allowClear:!0,prefix:(0,o.jsx)(ot,{linkProtocol:k})})})}),k==="mailto:"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:"subject",children:(0,o.jsx)(t.ui_kit$Input,{placeholder:A("Subject")})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:"body",style:{marginBottom:Y.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$TextArea,{rows:3,placeholder:A("Body")})})]})]}),!!l.showOnMobile&&(0,o.jsx)(St,{form:e,fillFields:i,elementSettings:l,setLinkProtocol:T,linkProtocol:k,showAddParagraph:!1,isButton:!0}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(qr,{})})}),ee.formButtonFieldPaddingsEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:A("Padding"),collapsible:!0,open:m,onToggle:z,dividerTop:!0,children:(0,o.jsx)(Yt,{form:e,elementSettings:l,mobilePaddingsExt:_,setMobilePaddingsExt:E,showVertical:!W})}),(0,o.jsx)(t.ui_kit$FormSection,{title:A("Size"),collapsible:!0,open:p,onToggle:y,dividerTop:!0,bodyStyle:{paddingBottom:Y.formItemMarginBottomMD},children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:A("Width"),placement:"bottom",children:(0,o.jsx)(Yo,{form:e,name:"mobileWidth",elementSettings:l})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:A("Height"),placement:"bottom",children:(0,o.jsx)(lt,{form:e,name:"mobileHeight",elementSettings:l})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:A("Background"),collapsible:!0,open:g,onToggle:D,dividerTop:!0,bodyStyle:{paddingBottom:Y.formItemMarginBottomMD},children:(0,o.jsx)(Rt,{elementSettings:Xo(l),imageEnabled:ee.formButtonFieldBackgroundImageEnabled,desktopBackground:Tt(l)})}),ee.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:A("Borders"),collapsible:!0,open:n,onToggle:v,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e,typeOfForm:"mobile"})}),ee.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:A("Border radius"),collapsible:!0,open:d,onToggle:P,dividerTop:!0,children:(0,o.jsx)(vo,{form:e,oneBorderRadiusValue:b,setOneBorderRadiusValue:h,elementSettings:l,typeOfForm:"mobile"})}),ee.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:A("Box shadow"),collapsible:!0,open:c,onToggle:B,dividerTop:!0,children:(0,o.jsx)(No,{typeOfForm:"mobile"})}),ee.formFieldAmpVisibilityEnabled&&l.ampShow&&(0,o.jsx)(t.ui_kit$FormSection,{title:A("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})}),ee.formFieldAmpVisibilityEnabled&&l.isAmp&&(0,o.jsx)(t.ui_kit$FormSection,{title:A("AMP visibility"),dividerTop:!0,children:(0,o.jsx)(Lo,{})})]})};Nl.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 Nd=Object.freeze({}),Al=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),[s]=t.ui_kit$Form.useForm(),n=Do(),d=Do(),c=r.useDispatch(),[p,g]=(0,a.useState)({}),[m,_]=(0,a.useState)(!0),[E,b]=(0,a.useState)(!0),h=r.useSelector(r.selectEmailViewType),k=r.useSelector(r.selectMobileViewActive),[x,T]=(0,a.useState)(e.backgroundImage?.[0].value===""),v=r.useSelector(r.selectIsCodeMode),P=r.useSelector(r.selectCodeModeDirection),B=v&&P!=="bottom",y=(0,a.useRef)(null),D=(0,a.useRef)(null),[z,A]=(0,a.useState)(!1),[$,j]=(0,a.useState)(!1),[W,Y]=(0,a.useState)(!1),[ee,I]=(0,a.useState)(!1),[le,ke]=(0,a.useState)(!1),[Ne,Q]=(0,a.useState)(!1),[fe,Ae]=(0,a.useState)(!1),[ne,Fe]=(0,a.useState)(!1),[Le,Ue]=(0,a.useState)(!1),[ve,Be]=(0,a.useState)(!1),[xe,ce]=(0,a.useState)(!1),[be,ue]=(0,a.useState)(!1),[q,Z]=(0,a.useState)(!1),[te,ae]=(0,a.useState)(void 0),[de,De]=(0,a.useState)("https://"),[oe,Te]=(0,a.useState)({}),_e=e,[Ce,R]=(0,a.useState)(!!_e.textReplacer?.length),[V,L]=(0,a.useState)(e);e!==V&&(L(e),R(!!_e.textReplacer?.length));const X=r.useElementEntityKind(),ie=[{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"}],me=e.border,he=e.mobileBorder,$e=Object.keys(me).find(F=>me[F]?.width||me[F]?.style||me[F]?.color),je=Object.keys(he).find(F=>he[F]?.width||he[F]?.style||he[F]?.color),G=F=>F&&(F?.width||F?.style||F?.color)?F:"",{remember:re,fillFields:O,isOwnEcho:pe}=pt(e);(0,a.useEffect)(()=>{if(e){const F=e.boxShadow||Nd,K=e.mobilePadding||{},Ie=e.mobileAlign||{};g(F);let J="",Ve="",qe=e.href||"https://";if(e.href){if(e.href.startsWith("mailto:")){const Qe=Vr(e.href);J=Qe.subject,Ve=Qe.body,qe=Qe.baseEmail}Go(e.href,De)}O(s,{...e,href:qe,subject:J,body:Ve,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:G(e.mobileBorder.all)||!(G(e.mobileBorder.top)||G(e.mobileBorder.bottom)||G(e.mobileBorder.right)||G(e.mobileBorder.left))&&G(e.border.all),mobileBorderTop:G(e.mobileBorder.top)||!G(e.mobileBorder.all)&&G(e.border.top),mobileBorderBottom:G(e.mobileBorder.bottom)||!G(e.mobileBorder.all)&&G(e.border.bottom),mobileBorderRight:G(e.mobileBorder.right)||!G(e.mobileBorder.all)&&G(e.border.right),mobileBorderLeft:G(e.mobileBorder.left)||!G(e.mobileBorder.all)&&G(e.border.left),paddingTop:u(e.padding?.all)||u(e.padding?.top),paddingLeft:u(e.padding?.all)||u(e.padding?.left),paddingRight:u(e.padding?.all)||u(e.padding?.right),paddingBottom:u(e.padding?.all)||u(e.padding?.bottom),paddingLeftRight:u(e.padding?.left)||u(e.padding?.right),paddingTopBottom:u(e.padding?.top)||u(e.padding?.bottom),borderRadiusAll:u(e.borderRadius?.all),borderRadiusTopLeft:u(e.borderRadius?.topLeft),borderRadiusBottomLeft:u(e.borderRadius?.bottomLeft),borderRadiusTopRight:u(e.borderRadius?.topRight),borderRadiusBottomRight:u(e.borderRadius?.bottomRight),boxShadowInset:u(e.boxShadow?.inset)||!1,boxShadowHOffset:u(e.boxShadow?.hOffset),boxShadowVOffset:u(e.boxShadow?.vOffset),boxShadowBlurRadius:u(e.boxShadow?.blurRadius),boxShadowSpreadRadius:u(e.boxShadow?.spreadRadius),boxShadowColor:u(e.boxShadow?.color),mobileWidth:So(e.mobileWidth?.value)||e.width?.value,mobileWidthDim:So(e.mobileWidth?.value)?e.mobileWidth?.dim:e.width?.dim,mobileHeight:So(e.mobileHeight?.value)||e.height?.value,mobileHeightDim:So(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(Ie?.value)||e.align,mobileVerticalAlign:u(e.mobileVerticalAlign?.value||e.valign),mobileBackgroundColor:u(e.mobileBackgroundColor?.value||e.backgroundColor||""),...nt(e),mobilePaddingTop:u(K.all)||u(K.top)||u(e.padding?.all)||u(e.padding?.top),mobilePaddingLeft:u(K.all)||u(K.left)||u(e.padding?.all)||u(e.padding?.left),mobilePaddingRight:u(K.all)||u(K.right)||u(e.padding?.all)||u(e.padding?.right),mobilePaddingBottom:u(K.all)||u(K.bottom)||u(e.padding?.all)||u(e.padding?.bottom),mobilePaddingTopBottom:u(K.top)||u(K.bottom)||u(e.padding?.top)||u(e.padding?.bottom),mobilePaddingLeftRight:u(K.left)||u(K.right)||u(e.padding?.left)||u(e.padding?.right),mobileTextAlign:Hr(e.mobileTextAlign,e.textAlign),exportAsPicture:e?.exportAsPicture,mobileFontSize:u(e.mobileFontSize?.value||e.fontSize)}),!u(e.borderRadius?.all)&&(u(e.borderRadius?.topLeft)||u(e.borderRadius?.bottomLeft)||u(e.borderRadius?.topRight)||u(e.borderRadius?.bottomRight))?_(!1):_(!0),!u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||u(e.mobileBorderRadius.all)&&(u(e.mobileBorderRadius.topLeft)||u(e.mobileBorderRadius.bottomLeft)||u(e.mobileBorderRadius.topRight)||u(e.mobileBorderRadius.bottomRight))||!u(e.borderRadius.all)&&!u(e.mobileBorderRadius.all)&&(u(e.borderRadius.topLeft)||u(e.borderRadius.bottomLeft)||u(e.borderRadius.topRight)||u(e.borderRadius.bottomRight))?b(!1):b(!0),T(e.backgroundImage?.[0].value===""),!u(e.padding?.all)&&(u(e.padding?.top)||u(e.padding?.right)||u(e.padding?.bottom)||u(e.padding?.left))&&(e.padding?.top!==e.padding?.bottom||e.padding?.right!==e.padding?.left)?A(!1):A(!0),!u(K.all)&&(u(K.top)||u(K.right)||u(K.bottom)||u(K.left))&&(K.top!==K.bottom||K.right!==K.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)?j(!1):j(!0);const We=n.isStaleBorderSnapshot(e,!!$e),to=d.isStaleBorderSnapshot(e,!!je);if(We&&s.setFieldsValue({border:r.RESET_BORDER_PARAMS,borderAll:null,borderTop:null,borderBottom:null,borderRight:null,borderLeft:null}),(to||We&&!je)&&s.setFieldsValue({mobileBorder:r.RESET_BORDER_PARAMS,mobileBorderAll:null,mobileBorderTop:null,mobileBorderBottom:null,mobileBorderRight:null,mobileBorderLeft:null}),Y(Qe=>$e&&!We?!0:Qe),I(Qe=>$e&&!We||je&&!to?!0:Qe),pe())return;ke(!!e.borderRadius?.all||!!e.borderRadius?.topLeft||!!e.borderRadius?.bottomLeft||!!e.borderRadius?.topRight||!!e.borderRadius?.bottomRight),Q(!!e.mobileBorderRadius?.all||!!e.mobileBorderRadius?.topLeft||!!e.mobileBorderRadius?.bottomLeft||!!e.mobileBorderRadius?.topRight||!!e.mobileBorderRadius?.bottomRight||!!e.borderRadius?.all||!!e.borderRadius?.topLeft||!!e.borderRadius?.bottomLeft||!!e.borderRadius?.topRight||!!e.borderRadius?.bottomRight),Ae(!!e.boxShadow),Fe(!!e.mobileBoxShadow?.blurRadius||!!e.mobileBoxShadow?.color||!!e.mobileBoxShadow?.hOffset||!!e.mobileBoxShadow?.inset||!!e.mobileBoxShadow?.spreadRadius||!!e.mobileBoxShadow?.vOffset||!!e.boxShadow),Ue(!!e.mobileWidth?.value||!!e.mobileHeight?.value||!!e.width.value||!!e.height.value),Be(!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),ce(!!e.mobileBackgroundColor?.value||!!e.backgroundColor||!!e.backgroundImage?.[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||e.backgroundRepeat!=="repeat"||!e.backgroundRepeat,!!e.backgroundSize),Ut(e)&&ce(!0),ue(!!e.padding?.all||!!e.padding?.top||!!e.padding?.bottom||!!e.padding?.left||!!e.padding?.right),Z(!!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,B,$e,je,n,d,O,pe]);const ye=(0,a.useCallback)(F=>{re(F),c(X==="email"?r.setElementSettings$1(F):r.setElementSettings(F))},[c,X,re]),ze=F=>{const K=s.getFieldsValue(!0),Ie=Object.keys(F)[0];let J;const{widthDim:Ve}=s.getFieldsValue(!0);switch(ae(Ve==="%"?100:void 0),Ie){case"exportAsPicture":J={exportAsPicture:K.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":J={boxShadow:{hOffset:K.boxShadowHOffset,vOffset:K.boxShadowVOffset,blurRadius:K.boxShadowBlurRadius,spreadRadius:K.boxShadowSpreadRadius,color:K.boxShadowColor,inset:K.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":K.borderPosition==="borderAll"?(J={border:{...r.RESET_BORDER_PARAMS,all:{...U.NULL_BORDER,...K.borderAll}}},s.setFieldsValue({borderLeft:U.NULL_BORDER,borderRight:U.NULL_BORDER,borderTop:U.NULL_BORDER,borderBottom:U.NULL_BORDER})):K.borderAll?.width||K.borderAll?.style||K.borderAll?.color?(J={border:{all:null,left:K.borderAll,right:K.borderAll,top:K.borderAll,bottom:K.borderAll,[U.REVERSE_BORDER_POSITIONS[Ie]]:{...K[Ie],...F[Ie]}}},s.setFieldsValue({borderAll:null,borderLeft:K.borderAll,borderRight:K.borderAll,borderTop:K.borderAll,borderBottom:K.borderAll,[Ie]:{...K[Ie],...F[Ie]}})):(J={border:{all:null,left:K.borderLeft,right:K.borderRight,top:K.borderTop,bottom:K.borderBottom,[U.REVERSE_BORDER_POSITIONS[Ie]]:{...K[Ie],...F[Ie]}}},s.setFieldsValue({border:J.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if(K.mobileBorderPosition==="mobileBorderAll")J={mobileBorder:{...r.RESET_BORDER_PARAMS,all:{...U.NULL_BORDER,...K.mobileBorderAll,classNamePrefix:"em-mob-border_"+U.MOBILE_REVERSE_BORDER_POSITIONS[Ie]+"-"}}},s.setFieldsValue({borderLeft:U.NULL_BORDER,borderRight:U.NULL_BORDER,borderTop:U.NULL_BORDER,borderBottom:U.NULL_BORDER});else{const to=U.MOBILE_REVERSE_BORDER_POSITIONS[Ie],Qe={...K[Ie],...F[Ie]},wo=!Qe?.width&&!Qe?.style&&!Qe?.color;if(K.mobileBorder?.all?.width||K.mobileBorder?.all?.style||K.mobileBorder?.all?.color){const Eo=K.mobileBorderAll;J={mobileBorder:{all:null,left:Eo,right:Eo,top:Eo,bottom:Eo,[to]:wo?null:{...Qe,classNamePrefix:"em-mob-border_"+to+"-"}}},s.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:Eo,mobileBorderRight:Eo,mobileBorderTop:Eo,mobileBorderBottom:Eo,[Ie]:Qe})}else{const Eo=e.mobileBorder||{},w=Re=>{const S=Eo[Re];return S&&(S?.width||S?.style||S?.color)?S:null};J={mobileBorder:{all:null,left:to==="left"?wo?null:{...Qe,classNamePrefix:"em-mob-border_left-"}:w("left"),right:to==="right"?wo?null:{...Qe,classNamePrefix:"em-mob-border_right-"}:w("right"),top:to==="top"?wo?null:{...Qe,classNamePrefix:"em-mob-border_top-"}:w("top"),bottom:to==="bottom"?wo?null:{...Qe,classNamePrefix:"em-mob-border_bottom-"}:w("bottom")}},s.setFieldsValue({[Ie]:Qe})}}break;case"width":J={[Ie]:{value:F[Ie],dim:K.widthDim}};break;case"height":J={[Ie]:{value:F[Ie],dim:K.heightDim}};break;case"widthDim":J={width:{value:K.width,dim:F[Ie]}};break;case"heightDim":J={height:{value:K.height,dim:F[Ie]}};break;case"backgroundImage":T(F[Ie]===""),J={[Ie]:[{...e.backgroundImage[0],value:F[Ie]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":J={padding:{left:K.paddingLeft,right:K.paddingRight,top:K.paddingTop,bottom:K.paddingBottom,[U.PADDING_POSITION[Ie]]:+F[Ie]}};break;case"paddingTopBottom":J={padding:{left:K.paddingLeft,right:K.paddingRight,top:+F[Ie],bottom:+F[Ie]}},K.paddingTop=K.paddingBottom=+F[Ie];break;case"paddingLeftRight":J={padding:{top:K.paddingTop,bottom:K.paddingBottom,left:+F[Ie],right:+F[Ie]}},K.paddingLeft=K.paddingRight=+F[Ie];break;case"borderRadiusAll":J={borderRadius:{[U.BORDER_RADIUS_POSITION[Ie]]:+F[Ie]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":J={borderRadius:{topLeft:K.borderRadiusTopLeft,bottomLeft:K.borderRadiusBottomLeft,topRight:K.borderRadiusTopRight,bottomRight:K.borderRadiusBottomRight,[U.BORDER_RADIUS_POSITION[Ie]]:+F[Ie]}};break;case"mobileWidth":J={[Ie]:{classNamePrefix:"em-mob-width-",value:F[Ie],dim:K.mobileWidthDim}};break;case"mobileWidthDim":J={mobileWidth:{classNamePrefix:"em-mob-width-",value:K.mobileWidth||100,dim:F[Ie]}};break;case"mobileHeight":J=Pd(F[Ie],K.mobileHeightDim,!!e.multiline);break;case"mobileHeightDim":J={mobileHeight:{classNamePrefix:"em-mob-height-",value:K.mobileHeight,dim:F[Ie]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":J={mobileBorderRadius:{[U.MOBILE_BORDER_RADIUS_POSITION[Ie]]:F[Ie],classNamePrefix:"em-mob-border_radius_"+U.MOBILE_BORDER_RADIUS_POSITION[Ie]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":J={mobileBoxShadow:{hOffset:K.mobileBoxShadowHOffset,vOffset:K.mobileBoxShadowVOffset,blurRadius:K.mobileBoxShadowBlurRadius,spreadRadius:K.mobileBoxShadowSpreadRadius,color:K.mobileBoxShadowColor,inset:K.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":J={[Ie]:{classNamePrefix:"em-mob-table_align-",value:F[Ie]}};break;case"mobileTextAlign":J={[Ie]:{classNamePrefix:"em-mob-text_align-",value:F[Ie]}};break;case"mobileVerticalAlign":J={[Ie]:{classNamePrefix:"em-mob-vertical_align-",value:F[Ie]}};break;case"mobileBackgroundColor":case"mobileBackgroundImage":case"mobileBackgroundPositionX":case"mobileBackgroundPositionY":case"mobileBackgroundRepeat":case"mobileBackgroundSize":if(J=Bt(F),!J)return;break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":J={mobilePadding:{all:null,top:K.mobilePaddingTop!==""?K.mobilePaddingTop:null,right:K.mobilePaddingRight!==""?K.mobilePaddingRight:null,bottom:K.mobilePaddingBottom!==""?K.mobilePaddingBottom:null,left:K.mobilePaddingLeft!==""?K.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":K.mobilePaddingTop=K.mobilePaddingBottom=F[Ie],J={mobilePadding:{all:null,top:K.mobilePaddingTop!==""?K.mobilePaddingTop:null,right:K.mobilePaddingRight!==""?K.mobilePaddingRight:null,bottom:K.mobilePaddingBottom!==""?K.mobilePaddingBottom:null,left:K.mobilePaddingLeft!==""?K.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":K.mobilePaddingLeft=K.mobilePaddingRight=F[Ie],J={mobilePadding:{all:null,top:K.mobilePaddingTop!==""?K.mobilePaddingTop:null,right:K.mobilePaddingRight!==""?K.mobilePaddingRight:null,bottom:K.mobilePaddingBottom!==""?K.mobilePaddingBottom:null,left:K.mobilePaddingLeft!==""?K.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileFontSize":J={[Ie]:{classNamePrefix:"em-mob-font_size-",value:F[Ie],dim:K.mobileFontSizeDim}};break;case"href":let qe=rt(F[Ie]);qe!==F[Ie]&&(s.setFieldValue("href",qe),K.href=qe),qe.startsWith("mailto:")?J={[Ie]:Ci(qe,K.subject,K.body)}:J={[Ie]:qe},Go(F[Ie],De);break;case"subject":case"body":const We=K.href||"";if(We.startsWith("mailto:")){const to=Ie==="subject"?F[Ie]:K.subject,Qe=Ie==="body"?F[Ie]:K.body;J={href:Ci(We,to,Qe)}}else return;break;case"backgroundPositionX":case"backgroundPositionY":J={[Ie]:isNaN(parseFloat(F[Ie].position))?F[Ie].position:F[Ie].position+F[Ie].unit};break;default:J=F}Ie!=="borderPosition"&&Ie!=="mobileBorderPosition"&&(l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:J}),Ie!=="mobileBorderRadiusAll"&&Ie!=="mobileBorderRadiusTopLeft"&&Ie!=="mobileBorderRadiusTopRight"&&Ie!=="mobileBorderRadiusBottomLeft"&&Ie!=="mobileBorderRadiusBottomRight"&&ye({...e,...J,mobileBorderRadius:{...e.mobileBorderRadius,...J?.mobileBorderRadius},activateSection:null,changeKey:Ie}))},oo=()=>{A(K=>!K);const F=s.getFieldsValue(!0);z||(F.paddingLeftRight=F.paddingLeft,F.paddingTopBottom=F.paddingTop,F.paddingRight=F.paddingLeft,F.paddingBottom=F.paddingTop,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:F.paddingTopBottom,bottom:F.paddingTopBottom,left:F.paddingLeftRight,right:F.paddingLeftRight}}}))},ro=()=>{const F=s.getFieldsValue(!0);n.markBorderToggled(!W),setTimeout(()=>{Y(K=>!K),W?(F.borderAll=U.NULL_BORDER,F.borderTop=U.NULL_BORDER,F.borderBottom=U.NULL_BORDER,F.borderRight=U.NULL_BORDER,F.borderLeft=U.NULL_BORDER):F.borderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:F.borderAll.color,style:F.borderAll.style,width:F.borderAll.width}}}})})},ao=()=>{const F=s.getFieldsValue(!0);d.markBorderToggled(!ee),setTimeout(()=>{I(K=>!K),ee?(F.mobileBorderAll=U.NULL_BORDER,F.mobileBorderTop=U.NULL_BORDER,F.mobileBorderBottom=U.NULL_BORDER,F.mobileBorderRight=U.NULL_BORDER,F.mobileBorderLeft=U.NULL_BORDER):F.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:F.mobileBorderAll.color,style:F.mobileBorderAll.style,width:F.mobileBorderAll.width}}}})})},M=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{ke(K=>!K),le?(F.borderRadiusAll=0,_(!0)):F.borderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:F.borderRadiusAll}}})})},se=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{Q(K=>!K),Ne?(F.mobileBorderRadiusAll=null,b(!0)):F.mobileBorderRadiusAll=5,l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:F.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},C=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{Ae(K=>!K),fe?(F.boxShadowInset=!1,F.boxShadowHOffset=null,F.boxShadowVOffset=null,F.boxShadowBlurRadius=null,F.boxShadowSpreadRadius=null,F.boxShadowColor=""):(F.boxShadowInset=!1,F.boxShadowHOffset=5,F.boxShadowVOffset=5,F.boxShadowBlurRadius=10,F.boxShadowSpreadRadius=-5,F.boxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:F.boxShadowBlurRadius,color:F.boxShadowColor,hOffset:F.boxShadowHOffset,inset:F.boxShadowInset,spreadRadius:F.boxShadowSpreadRadius,vOffset:F.boxShadowVOffset}}})})},H=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{Fe(K=>!K),ne?(F.mobileBoxShadowInset=!1,F.mobileBoxShadowHOffset=null,F.mobileBoxShadowVOffset=null,F.mobileBoxShadowBlurRadius=null,F.mobileBoxShadowSpreadRadius=null,F.mobileBoxShadowColor=""):(F.mobileBoxShadowInset=!1,F.mobileBoxShadowHOffset=5,F.mobileBoxShadowVOffset=5,F.mobileBoxShadowBlurRadius=10,F.mobileBoxShadowSpreadRadius=-5,F.mobileBoxShadowColor="#000000"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:F.mobileBoxShadowBlurRadius,color:F.mobileBoxShadowColor,hOffset:F.mobileBoxShadowHOffset,inset:F.mobileBoxShadowInset,spreadRadius:F.mobileBoxShadowSpreadRadius,vOffset:F.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},Pe=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{Ue(K=>!K),Le&&(F.mobileWidth="",F.mobileHeight="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"},mobileHeight:{value:null,dim:"px",classNamePrefix:"em-mob-height-"}}}))})},He=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{Be(K=>!K),ve?(F.backgroundColor="",F.backgroundImage="",F.backgroundPositionX="",F.backgroundPositionY="",F.backgroundRepeat="none",F.backgroundSize="",T(!0)):(F.backgroundColor="#E5E5E5",F.backgroundSize="",F.backgroundRepeat="none"),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:F.backgroundColor,backgroundImage:[{type:"url",value:F.backgroundImage}],backgroundPositionX:F.backgroundPositionX,backgroundPositionY:F.backgroundPositionY,backgroundRepeat:F.backgroundRepeat,backgroundSize:F.backgroundSize}})})},_o=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{ce(K=>!K),xe?F.mobileBackgroundColor="":F.mobileBackgroundColor=e.commonStyles.buttons.backgroundColor||"#1C52DC",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:F.mobileBackgroundColor}}}),xe&&Wt(s,e,l)})},mo=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{ue(K=>!K),be&&(F.paddingLeftRight="",F.paddingLeft="",F.paddingRight="",F.paddingTopBottom="",F.paddingTop="",F.paddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},co=()=>{const F=s.getFieldsValue(!0);setTimeout(()=>{Z(K=>!K),q&&(F.mobilePaddingLeftRight="",F.mobilePaddingLeft="",F.mobilePaddingRight="",F.mobilePaddingTopBottom="",F.mobilePaddingTop="",F.mobilePaddingBottom="",l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobilePadding:{all:null,top:null,right:null,bottom:null,left:null,classNamePrefix:"em-mob-padding_"}}}))})},ge=F=>{s.setFieldValue("href",F!=="mergetag"?F:""),De(F)},Ge=(0,a.useCallback)(({target:F})=>{if(!F)return;const{selectionStart:K,selectionEnd:Ie}=F;Te(J=>J.target===F&&J.selection?.start===K&&J.selection?.end===Ie?J:{target:F,selection:{start:K,end:Ie}})},[]),Je=F=>{F.target.value!==""&&D.current.classList.add("selected-td-form__button--active")},io=()=>{R(!Ce),Ce?(s.setFieldValue("textReplacer",""),l({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{textReplacer:""}})):setTimeout(()=>y.current.focus())},fo=F=>{const K=F.target,Ie=K.value,J=K.selectionStart;if(J===0&&F.key===" "){F.preventDefault();return}if(F.key===" "){if(J!==Ie.length){F.preventDefault();return}Ie.endsWith(" ")&&F.preventDefault()}};return(0,o.jsxs)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_button_form",initialValues:{backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",align:"",valign:"",border:"",boxShadow:"",show:"all",borderPosition:U.BORDER_POSITIONS[$e]||"borderAll",mobileBorderPosition:U.MOBILE_BORDER_POSITIONS[je]||"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:ze,autoComplete:"off",className:"element-controls",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"})}),B?(0,o.jsx)(Ai,{form:s,elementSettings:e,showAddParagraph:!1,isButton:!0}):(0,o.jsx)(o.Fragment,{children:h==="mobile"&&k.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(Nl,{form:s,fillFields:O,elementSettings:e,boxShadow:p,mobileBordersShow:ee,mobileBorderRadiusShow:Ne,mobileBoxShadowShow:ne,mobileSizeShow:Le,mobileBackgroundShow:xe,mobilePaddingShow:q,mobilePaddingsExt:$,setMobilePaddingsExt:j,oneMobileBorderRadiusValue:E,setOneMobileBorderRadiusValue:b,linkProtocol:de,handleLinkProtocolsChange:ge,setLinkProtocol:De,toggleShowMobileBorderHandler:ao,toggleShowMobileBorderRadiusHandler:se,toggleShowMobileBoxShadowHandler:H,toggleShowMobileSizeHandler:Pe,toggleShowMobileBackgroundHandler:_o,toggleShowMobilePaddingHandler:co})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Pl,{form:s,fillFields:O,elementSettings:e,boxShadow:p,bordersShow:W,borderRadiusShow:le,boxShadowShow:fe,backgroundShow:ve,backgroundImageEmpty:x,backgroundRepeatOptions:ie,paddingShow:be,paddingsExt:z,maxWidthValue:te,oneBorderRadiusValue:m,setOneBorderRadiusValue:_,linkProtocol:de,linkTarget:oe,isOpenTextReplacer:Ce,textReplacerButtonRef:D,textReplacerInputRef:y,handleLinkProtocolsChange:ge,handleSelect:Ge,textReplacerInputHandler:Je,handleTextReplacerKeyDown:fo,srcButtonHandler:io,togglePaddingHandler:oo,toggleShowPaddingHandler:mo,toggleShowBackgroundHandler:He,toggleShowBorderHandler:ro,toggleShowBorderRadiusHandler:M,toggleShowBoxShadowHandler:C,setLinkProtocol:De,handleChangeValues:ze})})})]})};Al.propTypes={elementSettings:f.default.object.isRequired};var Ll=({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")})})})};Ll.propTypes={elementSettings:f.default.object.isRequired};function Ad(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 Ld(e){const i=/^(.+)_(\d+)$/.exec(e);return i?{key:i[1],index:Number(i[2])}:void 0}function Od(e,i,l){return(e??[]).map((s,n)=>n===i.index?{...s,[i.key]:l}:s)}function Ol(e){return(e??[]).map((i,l)=>({...i,slideIndex:l}))}var $l=({elementSettings:e,setElementSettings:i,postfix:l="",form:s,handleSelect:n,previewReloadSignal:d})=>{const{__:c}=r.useI18n(),{token:p}=(0,t.ui_kit$useToken)(),g=r.useAppConfig(),m=r.useSendPostMessage(),_="src"+l,E="title"+l,b="alt"+l,h="link"+l,k="imgReplacer"+l,x=(0,a.useRef)(null),T=(0,a.useRef)(null),v=(0,a.useRef)(null),P=(0,a.useRef)(null),B=(0,a.useRef)(null),y=(0,a.useRef)(null),D=(0,a.useRef)(null),z=(0,a.useRef)(null),[A,$]=(0,a.useState)(""),[j,W]=(0,a.useState)(""),[Y,ee]=(0,a.useState)(""),[I,le]=(0,a.useState)(!1),[ke,Ne]=(0,a.useState)("https://"),Q=(0,a.useRef)(!1),fe=(0,a.useRef)(l);(0,a.useEffect)(()=>{l!==fe.current&&(fe.current=l,Q.current=!1),W(e.images?.[b]),ee(e.images?.[E]);const ue=e.images?.[h];$(ue||(Q.current?"...":""))},[e,b,E,h,l]);const Ae=()=>{A?(Q.current=!1,$(""),s.setFieldValue(h,""),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[h]:""}})):(Q.current=!0,$(x.current&&x.current.input.value?x.current.input.value:"..."),setTimeout(()=>{x.current.focus()}))},ne=ue=>{ue.target.value===""?$("..."):(T.current.classList.add("selected-td-form__button--active"),$(ue.target.value));const q=ue.target.value;Go(q,Ne)},Fe=()=>{j?(W(""),s.setFieldValue("alt",""),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[b]:""}})):(W(v.current&&v.current.input.value?v.current.input.value:"..."),setTimeout(()=>{v.current.focus()}))},Le=ue=>{ue.target.value===""?W("..."):(P.current.classList.add("selected-td-form__button--active"),W(ue.target.value))},Ue=()=>{Y?(ee(!1),s.setFieldValue("title",""),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[E]:""}})):(ee(B.current&&B.current.input.value?B.current.input.value:"..."),setTimeout(()=>{B.current.focus()}))},ve=()=>{le(!I),I?(s.setFieldValue(k,""),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[k]:""}})):setTimeout(()=>D.current.focus())},Be=ue=>{ue.target.value!==""&&z.current.classList.add("selected-td-form__button--active")},xe=ue=>{ue.target.value===""?ee("..."):(y.current.classList.add("selected-td-form__button--active"),ee(ue.target.value))},ce=ue=>{s.setFieldValue("LinkName",ue!=="mergetag"?ue:""),Ne(ue)},be=ue=>{const q=s.getFieldsValue(!0),Z=+l.substring(1),te=Object.keys(q?.images).reduce((de,De)=>(De.includes(l)||(de[De]=q[De]),de),{}),ae=e.carouselImages?.filter((de,De)=>De!==Z);i(de=>({...de,settings:{...de.settings,carouselImages:Ol(ae)}})),m({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:e.caption,settings:{...e,carouselImages:ae}}),s.setFieldsValue({images:te})};return(0,o.jsxs)(o.Fragment,{children:[(e.type==="img"||e.type==="video"||e.type==="carousel")&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:0},children:(0,o.jsx)(Fo,{form:s,label:c("Image path"),name:_,placeholder:c("Image path"),elementSettings:e,previewReloadSignal:d,tooltipTitle:""})}),(0,o.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:j||c("Alternative text"),placement:"bottom",getPopupContainer:ue=>ue.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":!!j}),onClick:Fe,ref:P,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),g.formFieldImageTitleEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:Y||c("Tooltip text"),placement:"bottom",getPopupContainer:ue=>ue.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":!!Y}),onClick:Ue,ref:y,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:A||c("Hyperlink URL"),placement:"bottom",getPopupContainer:ue=>ue.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":!!A}),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-td-form__icon-radius"}),onClick:Ae,ref:T})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:c("Image replacer"),placement:"bottom",getPopupContainer:ue=>ue.closest(".email-pane__collapse-wrapper"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":I}),icon:(0,o.jsx)(r.EmIcons,{icon:"Replacer",component:t.icons$Replacer,className:"selected-td-form__icon-radius"}),onClick:ve,ref:z})})]}),(0,o.jsx)(t.ui_kit$Space,{size:8,children:(0,o.jsx)(t.ui_kit$Tooltip,{title:c("Remove slide"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{type:"text",onClick:be,icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16})})})})]}),(!!A||!!j||!!Y||!!I)&&(0,o.jsxs)("div",{children:[!!A&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(it,{show:ke==="#",__:c,style:{marginBottom:p.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Hyperlink URL"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:h,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(tt,{linkProtocol:ke,handleLinkProtocolsChange:ce,__:c}),placeholder:c("Hyperlink URL"),allowClear:!0,ref:x,onChange:ne,onSelect:n,prefix:(0,o.jsx)(ot,{linkProtocol:ke})})})})]}),!!j&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Alternative text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:b,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:c("Alternative text"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),onChange:Le,ref:v,onSelect:n})})}),g.formFieldImageTitleEnabled&&!!Y&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Tooltip text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:E,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:c("Enter the title of the image"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"}),onChange:xe,ref:B,onSelect:n})})}),!!I&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:c("Image src"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:k,className:"selected-image-form__alt",style:{marginTop:p.formItemMarginBottomXS,marginBottom:0},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:c("Code that will replace the image `src`"),allowClear:!0,prefix:(0,o.jsx)("span",{className:"addon-text-content",children:c("Image src")}),onChange:Be,ref:D,onSelect:n})})})]})]})};$l.propTypes={};var Fl=({form:e,elementSettings:i,formFields:l,setElementSettings:s,borderRadiusShow:n,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,linkProtocol:p,mergeTagItems:g,mergeMenuOpen:m,setMergeMenuOpen:_,cascaderRef:E,handleLinkProtocolsChange:b,handleSelect:h,onChange:k,filter:x,renderSearchOption:T,toggleShowBorderRadiusHandler:v,setNewSlide:P})=>{const{__:B}=r.useI18n(),{token:y}=(0,t.ui_kit$useToken)(),D=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(it,{show:p==="#",__:B,style:{marginBottom:y.formItemMarginBottomXS}}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:B("Link for all slides"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"link",children:(0,o.jsx)(t.ui_kit$Input,{addonBefore:(0,o.jsx)(tt,{linkProtocol:p,handleLinkProtocolsChange:b,__:B}),placeholder:B("Link for all slides"),allowClear:!0,onSelect:h,prefix:(0,o.jsx)(ot,{linkProtocol:p})})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),D.mergeTagsShow&&g&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Col,{span:24,id:"merge_tags_wrapper",children:(0,o.jsxs)(t.ui_kit$Form.Item,{style:{marginBottom:y.formItemMarginBottomMD,marginTop:y.formItemMarginBottomMD},children:[(0,o.jsx)(t.ui_kit$Button,{id:"merge_tags_button",icon:(0,o.jsx)(r.EmIcons,{icon:"MergeTags",component:t.icons$MergeTags}),style:{width:"100%",display:m?"none":"inline-flex"},onClick:()=>_(!0),children:B("Merge tags")}),(0,o.jsx)(t.ui_kit$Cascader,{ref:E,classNames:{popup:{root:"merge-tags"}},options:g,placeholder:B("Start typing the title"),showSearch:{filter:x,render:T},spellCheck:"false",getPopupContainer:z=>z.closest(".email-pane__collapse-wrapper"),onChange:k,style:{display:m?"block":"none"},open:m,onKeyDown:z=>{z.key==="Escape"&&_(!1)}})]})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"})]}),(0,o.jsx)(t.ui_kit$Form.List,{name:"images",initialValue:l?.images,children:()=>(0,o.jsx)("div",{style:{paddingTop:y.formItemMarginBottomMD+4},children:i?.settings?.carouselImages?.map((z,A)=>(0,o.jsx)("div",{className:"carousel__slide",children:(0,o.jsx)($l,{elementSettings:l,setElementSettings:s,postfix:"_"+A,form:e,handleSelect:h})},A))})}),(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:y.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Button,{id:"add_slide_button",icon:(0,o.jsx)(r.EmIcons,{icon:"AddSlide",component:t.icons$AddSlide}),style:{width:"100%"},onClick:()=>P(),children:B("Add slide")})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:20,style:{marginTop:y.formItemMarginBottomMD-10},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"loop",valuePropName:"checked",style:{marginBottom:y.formItemMarginBottomMD-6},children:(0,o.jsx)(t.ui_kit$Switch,{id:"Loop",label:B("Loop"),size:"small",labelStyle:{position:"relative",top:2}})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"autoplay",valuePropName:"checked",style:{marginBottom:y.formItemMarginBottomMD-6},children:(0,o.jsx)(t.ui_kit$Switch,{id:"Autoplay",label:B("Autoplay"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),D.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Border radius"),collapsible:!0,open:n,onToggle:v,dividerTop:!0,children:(0,o.jsx)(vo,{form:e,oneBorderRadiusValue:d,setOneBorderRadiusValue:c,elementSettings:i.settings})})]})};Fl.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 Ml=()=>{const{__:e}=r.useI18n();return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("p",{children:e("No properties to edit.")})})};Ml.propTypes={};var $d={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 Fd(e){const i={...Pi(e)};return delete i.parent,delete i.path,delete i.nextElem,delete i.prevElem,i}var Dl=({elementSettings:e})=>{const{__:i}=r.useI18n(),[l]=t.ui_kit$Form.useForm();let s=r.useDispatch();r.useAppConfig();const n=r.useSendPostMessage(),d=r.useSendPostMessageEx(),{openImagePicker:c}=r.useImagePicker(),p=r.useSelector(r.selectEmailViewType),g=r.useSelector(r.selectMobileViewActive),[m,_]=(0,a.useState)(!0),[E,b]=(0,a.useState)(!0),[h,k]=(0,a.useState)(!1),[x,T]=(0,a.useState)(!1),[v,P]=(0,a.useState)("https://"),[B,y]=(0,a.useState)(l?.getFieldsValue(!0)),[D,z]=(0,a.useState)(e),{remember:A,isOwnEcho:$}=Yr(Fd),[j,W]=(0,a.useState)(e);e!==j&&(W(e),$(e?.settings)||z(e));const[Y,ee]=(0,a.useState)({name:"",counter:0}),[I,le]=(0,a.useState)(null),[ke,Ne]=(0,a.useState)(),[Q,fe]=(0,a.useState)(!1),[Ae,ne]=(0,a.useState)(!1),[Fe,Le]=(0,a.useState)({start:0,end:0}),Ue=(0,a.useRef)(null),ve=`selected_${D.type}_form_link`,Be=r.useSelector(r.selectIsCodeMode),xe=r.useSelector(r.selectCodeModeDirection),ce=Be&&xe!=="bottom";(0,a.useEffect)(()=>{Q&&Ue.current&&Ue.current.focus()},[Q]);const be=(L,X)=>{const ie=document.getElementById(X);if(ie){const me=D,he=Ad(me.type,X),$e=Ld(he),je=ie.value?.substring(0,Fe.start),G=ie.value?.substring(Fe.end);let re={[he]:je+L+G};$e?re={carouselImages:Od(me.settings?.carouselImages,$e,je+L+G)}:D.type===r.ELEMENT_TYPES.CAROUSEL&&ve===X&&(re={[he]:je+L+G,carouselImages:[...D.settings?.carouselImages.map(O=>({...O,link:je+L+G}))||[]]}),n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...D.settings,...re}}),z(O=>({...O,settings:{...O.settings,...re}})),l.setFieldValue(he,je+L+G),ie.focus(),setTimeout(()=>{ie.selectionStart=Fe.start,ie.selectionEnd=Fe.start+L.length},400),ne(!0)}},ue=r.useAppConfig().mergeTags;(0,a.useEffect)(()=>{ue?.items?.length&&Ne(r.mapMargeTags(ue.items))},[ue,Ne]);const q=(L,X)=>{if(fe(!1),L){const ie=ue.syntax.length>1?ke.findIndex($e=>$e.key===X[0].key):0,me=ue.syntax[ie].replace("%value%",L[L.length-1]),he=`selected_${D.type}_form${D.type==="carousel"?"_images":""}`;["imgReplacer","title","alt","src","link"].some($e=>I?.getAttribute("id").includes(`${he}_${$e}`))||I?.getAttribute("id").includes(ve)?be(me,I?.getAttribute("id")):(l.setFieldValue("imgReplacer",me),n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...D.settings,imgReplacer:me}}),z($e=>({...$e,settings:{...$e.settings,imgReplacer:me}})))}},Z=r.useRootElement();(0,a.useEffect)(()=>{const L=({target:me})=>{me.closest('[id="merge_tags_wrapper"]')||le(me)},X=({target:me})=>{!me.closest(".merge-tags")&&!me.closest("#merge_tags_button")&&fe(!1)},ie=new Po.Disposable;return ie.addDisposable(r.addWindowListenerFromShadow(Z,"focusin",L)),ie.addDisposable(r.addWindowListenerFromShadow(Z,"click",X)),()=>{ie.dispose()}},[Z]);const te=(L,X)=>X.some(ie=>ie.label.toLowerCase().indexOf(L.toLowerCase())>-1),ae=(L,X)=>{const ie=X.map((me,he)=>{const $e=me.label.split(new RegExp(`(${L})`,"gi"));return(0,o.jsxs)("span",{children:[he!==0&&(0,o.jsx)("span",{children:" / "}),$e.map((je,G)=>je.toLowerCase()===L.toLowerCase()?(0,o.jsx)("span",{style:{color:"red"},children:je},G):je)]},me.value)});return(0,o.jsx)("div",{title:X.map(me=>me.label).join(" / "),children:ie})};(0,a.useEffect)(()=>{const L=l?.getFieldsValue(!0);y(L)},[l]);const de=({target:L})=>{if(L&&!Ae){const{selectionStart:X,selectionEnd:ie}=L;Le({start:X,end:ie})}ne(!1)};(0,a.useEffect)(()=>{if(D.settings){const L=D.settings,X=Pi(L);l?.setFieldsValue(X),y(X),L.link&&P(Dt(L.link,"https://")),u(L.borderRadius?.all)||(u(L.borderRadius?.topLeft)||u(L.borderRadius?.bottomLeft)||u(L.borderRadius?.topRight)||u(L.borderRadius?.bottomRight)?_(!1):u(L.borderRadius?.all)||_(!0)),u(L.mobileBorderRadius?.topLeft)||u(L.mobileBorderRadius?.bottomLeft)||u(L.mobileBorderRadius?.topRight)||u(L.mobileBorderRadius?.bottomRight)?b(!1):b(!0),k(!!L.borderRadius?.all||!!L.borderRadius?.topLeft||!!L.borderRadius?.bottomLeft||!!L.borderRadius?.topRight||!!L.borderRadius?.bottomRight),T(!!L.mobileBorderRadius?.all||!!L.mobileBorderRadius?.topLeft||!!L.mobileBorderRadius?.bottomLeft||!!L.mobileBorderRadius?.topRight||!!L.mobileBorderRadius?.bottomRight)}},[l,D]);const De=L=>{const X=Ur(D.settings,l,L);n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,caption:X.caption,settings:X}),A({...D.settings,...X}),z(ie=>({...ie,settings:{...ie.settings,...X}}))},oe=(L,X)=>{const ie=r.stripEmVersionFromUrlString(D.settings?.src||"")===r.stripEmVersionFromUrlString(L||"");(!ie||L!==D.settings?.src)&&De({src:L}),X?.mode==="save"&&ie&&(ee(me=>({name:"src",counter:me.counter+1})),d(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(L)}))},Te=async L=>{const X=D.settings?.src||"",ie=r.stripEmVersionFromUrlString(X),me=await c({kind:"img",currentUrl:ut(ie)?"":ie,entryModal:L});me?.url&&oe(me.url,me.meta)},_e=L=>{const X=L.data.operation;X===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?Te(r.MODALS.UPLOAD_IMAGE_MODAL_AI):X===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?Te(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD):X===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?Te(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT):X===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?Te(r.MODALS.UPLOAD_IMAGE_MODAL_GIF):X===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?Te(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK):X===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(s(r.closeSecondModal()),s(r.closeModal$1()))};r.useListenPostMessage(_e);const Ce=()=>{setTimeout(()=>{k(L=>!L),l.setFieldValue("borderRadiusAll",h?0:5),n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...D.settings,borderRadius:{all:h?"":5}}}),z(L=>({...L,settings:{...L.settings,borderRadius:{all:h?null:5}}}))})},R=L=>{l.setFieldValue("link",L!=="mergetag"?L:""),P(L)},V=()=>{const{width:L,height:X,renderedWidth:ie,renderedHeight:me}=D?.settings?.carouselImages[0]||{width:{value:600},height:{value:600},renderedWidth:600,renderedHeight:600},he={src:"https://emcdn.ru/1865/231031_17_BGU9Mso.png",width:{value:L.value,dim:"px"},height:{value:X.value,dim:"px"},alt:"",title:"",link:null,renderedWidth:ie,renderedHeight:me,imgReplacer:"",mobileWidth:{value:null,dim:"px"},mobileHeight:{value:null,dim:"px"},mobileBorderRadius:{all:null,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}},$e=[...D?.settings?.carouselImages,he];n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.CAROUSEL,settings:{...D.settings,carouselImages:$e}});const je=Ol($e);z(G=>({...G,settings:{...G.settings,carouselImages:je}}))};return(0,o.jsxs)(t.ui_kit$Form,{form:l,layout:"vertical",name:"selected_carousel_form",initialValues:$d,onValuesChange:De,autoComplete:"off",className:"element-controls",children:[!ce&&(0,o.jsx)(t.ui_kit$Tooltip,{title:i("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:i("Appearance on mobile devices"),type:"info"})}),p==="mobile"&&g.styles?(0,o.jsx)("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",children:(0,o.jsx)(Ml,{})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Fl,{form:l,elementSettings:D,formFields:B,setElementSettings:z,borderRadiusShow:h,oneBorderRadiusValue:m,setOneBorderRadiusValue:_,linkProtocol:v,mergeTagItems:ke,mergeMenuOpen:Q,setMergeMenuOpen:fe,cascaderRef:Ue,handleLinkProtocolsChange:R,handleSelect:de,onChange:q,filter:te,renderSearchOption:ae,toggleShowBorderRadiusHandler:Ce,setNewSlide:V})})]})};Dl.propTypes={};var Md={animate:!0,expandSingleSection:!0,sections:[{expanded:!1,index:0}]},Vl=({elementSettings:e})=>{const{__:i}=r.useI18n(),{token:l}=(0,t.ui_kit$useToken)(),[s]=t.ui_kit$Form.useForm(),n=r.useSendPostMessage(),d=r.useAppConfig(),[c,p]=(0,a.useState)(e),[g,m]=(0,a.useState)(e);e!==g&&(m(e),p(e)),(0,a.useEffect)(()=>{if(c.settings){const h=c.settings,k=Pi(h);s?.setFieldsValue(k)}},[s,c]);const _=h=>{const k=Ur(c.settings,s,h);n({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:c.type,caption:k.caption,settings:k}),p(x=>({...x,settings:{...x.settings,...k}}))},E=()=>{p(h=>({...h,sections:c?.settings?.sections.push({expanded:!1})})),n({operation:r.EVENT_TYPES.SANDBOX_ACCORDION_ADD_SECTION,settings:{section:i("Section title"),text:i("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")}})},b=h=>{p(k=>({...k,settings:{...k.settings,sections:c.settings.sections?.filter((x,T)=>T!==h)}})),n({operation:r.EVENT_TYPES.SANDBOX_ACCORDION_REMOVE_SECTION,settings:{index:h}})};return(0,o.jsx)(t.ui_kit$Form,{form:s,layout:"vertical",name:"selected_carousel_form",initialValues:Md,onValuesChange:_,autoComplete:"off",className:"element-controls",children:(0,o.jsxs)("div",{id:"selected_element_form_desktop_props",children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:20,children:[(0,o.jsx)(t.ui_kit$Col,{span:15,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"expandSingleSection",valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:"ExpandSingleSection",label:i("Expand only one section"),size:"small",labelStyle:{position:"relative",top:2}})})}),(0,o.jsx)(t.ui_kit$Col,{span:9,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"animate",valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:"Animate",label:i("Animate"),size:"small",labelStyle:{position:"relative",top:2}})})})]}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,o.jsx)(t.ui_kit$Form.List,{name:"sections",children:()=>(0,o.jsx)("div",{style:{paddingTop:l.formItemMarginBottomMD+4},children:c?.settings?.sections?.map((h,k)=>(0,o.jsxs)(t.ui_kit$Row,{gutter:24,children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsxs)(t.ui_kit$Space,{size:10,align:"baseline",children:[(0,o.jsx)("span",{style:{position:"relative",top:2},children:i("Section ")+(k+1)}),(0,o.jsx)(t.ui_kit$Form.Item,{name:`expanded_${k}`,valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:`expanded_${k}`,label:i("expanded"),labelSize:"small",size:"small"})})]})}),(0,o.jsx)(t.ui_kit$Col,{children:c?.settings?.sections?.length>1&&(0,o.jsx)(t.ui_kit$Button,{type:"text",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16}),style:{marginRight:"auto"},onClick:()=>b(k)})})]},`expanded_${k}`))})}),(0,o.jsx)(t.ui_kit$Row,{gutter:20,children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:l.formItemMarginBottomMD},children:(0,o.jsx)(t.ui_kit$Button,{style:{display:"inline-flex",alignItems:"center",width:"100%"},icon:(0,o.jsx)(r.EmIcons,{icon:"PlusCircleOutlined",component:t.icons$PlusCircleOutlined,size:16,strokeWidth:d.iconStrokeWidth}),onClick:()=>E(),children:i(" Add section")})})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"})]})})};Vl.propTypes={};var Dd=[r.SOCIAL_ICONS_CDN_BASE,r.SOCIAL_ICONS_CDN_BASE].map(e=>`${e}/`),Di=r.SOCIAL_ICON_ORIGINAL_BY_PLATFORM;function Hl(e){return e&&typeof e=="object"?e:{}}function Vd(e){return!!Di&&typeof Di=="object"&&Object.keys(Di).includes(e)}function Hd(e){const i=String(e??"").trim();if(!i)return!1;if(ut(i))return!0;const l=r.stripEmVersionFromUrlString(i);return Dd.some(s=>l.startsWith(s))}function Ud(e){const i=Hl(e);if(i.customIcon===!0)return!0;const l=typeof i.iconSrc=="string"?i.iconSrc.trim():"";return typeof i.platform=="string"&&Vd(i.platform)&&!!l&&!Hd(l)}function Wd(e,i,l){const s=Hl(Array.isArray(e)&&typeof i=="number"?e[i]:void 0);return l!==s.iconSrc||s.customIcon!==!0}var Ul=new Set(["image/svg+xml","image/webp"]);function zd(e){const i=typeof e=="string"?e.trim():"";if(!i)return!1;const l=/^data:([^;,]+)/i.exec(i);if(l)return Ul.has(l[1].toLowerCase());let s;try{s=new URL(i,"https://placeholder.invalid").pathname}catch{return!1}const n=s.split("/").pop()??"";if(!n.includes("."))return!1;const d=r.inferImageMimeFromFileName(n);return!!d&&Ul.has(d)}var{Text:Gd}=t.ui_kit$Typography,Yd="blocks",Wl="text/plain",Xd=(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"}),Kd=(0,o.jsx)("span",{className:"addon-text-content",children:"Title"});function $o(e){return e.closest(".email-pane__collapse-wrapper")}function Xt({form:e,name:i,placeholder:l,usedColors:s,onColorChange:n}){const d=t.ui_kit$Form.useWatch(i,e);return(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l,usedColors:s,value:typeof d=="string"?d:"",onChange:c=>n(i,c)})}var qd=/^[a-z][a-z0-9+.-]*:/i;function zl(e){const i=rt(typeof e=="string"?e:String(e??""));return i?qd.test(i)?i:`https://${i}`:""}function Jd(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 Qd(e){const i=zl(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 Gl(e,i){if(i===r.MODALS.UPLOAD_IMAGE_MODAL_EDIT&&ut(e)){try{const l=new URL(e,typeof window<"u"&&window.location?window.location.origin:"http://localhost").href,s=await fetch(l);if(s.ok){const n=await s.blob();return{entryModal:i,currentUrl:"",imageDataUrl:await new Promise((d,c)=>{const p=new FileReader;p.onload=()=>d(p.result),p.onerror=c,p.readAsDataURL(n)})}}}catch{}return{entryModal:r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,currentUrl:""}}return{entryModal:i,currentUrl:e}}function Zd(){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 ec(e){const i=String(e?.bgColor??"").trim();return{blockBgEnabled:!!(e?.bgEnabled&&i),blockBgColor:i}}function Kt(e,i,l){return{...e,buttonBgColor:i,hostCellBgForIconLuminance:String(l??"").trim()}}function Yl(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 Xl(e){if(!Array.isArray(e)||e.length===0)return"";const i=e.map(s=>s.customIcon?"":String(s?.itemBorderColor??"").trim()),l=i[0];return i.every(s=>s===l)?l:""}function qt(e,i){const l=String(e??"").trim(),s=String(i??"").trim();return s||l}function oc(e,i){const l=String(e??"").trim(),s=String(i??"").trim();return!s||l&&s===l?"":s}function tc(e,i,l){const s=String(e??"").trim(),n=String(i??"").trim(),d=String(l??"").trim();return d&&(!s||d!==s)?d:n}function ic(e,i){return(e||[]).map(l=>({...l,itemBorderColor:l.customIcon?"":i}))}function rc(e,i,l){return(e||[]).map(s=>({...s,buttonBgColor:s.customIcon?"":tc(i,l,s.buttonBgColor)}))}function lc(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 Kl({__:e,form:i,fieldName:l,pushSettingsToIframe:s,onMetaActiveChange:n}){const{token:d}=(0,t.ui_kit$useToken)(),c=t.ui_kit$Form.useWatch(["items",l],i),p=c&&typeof c=="object"?c:{},g=typeof p.alt=="string"?p.alt:"",m=typeof p.title=="string"?p.title:"",[_,E]=(0,a.useState)(!1),[b,h]=(0,a.useState)(!1),k=(0,a.useRef)(null),x=(0,a.useRef)(null),T=(0,a.useMemo)(()=>({clearIcon:(0,o.jsx)(t.ui_kit$ColorPickerClearGlyph,{})}),[]);(0,a.useEffect)(()=>{g.trim()&&E(!0)},[g]);const v=!!(g.trim()||_),P=!!(m.trim()||b),B=v||P;(0,a.useLayoutEffect)(()=>{n(l,{alt:v,title:P})},[v,l,n,P]);const y=(0,a.useMemo)(()=>({marginBottom:B?d.formItemMarginBottomXS:0}),[B,d.formItemMarginBottomXS]),D=(0,a.useMemo)(()=>[l,"alt"],[l]),z=(0,a.useMemo)(()=>[l,"title"],[l]),A=B?"selected-social-form__meta-fields":"selected-social-form__meta-fields is-hidden",$=v?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",j=P?"selected-social-form__card-field":"selected-social-form__card-field is-hidden",W=(0,a.useMemo)(()=>g.trim()?g.trim():e("Alternative text"),[e,g]),Y=(0,a.useMemo)(()=>m.trim()?m.trim():e("Tooltip text"),[e,m]),ee=(0,a.useMemo)(()=>(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":v}),[v]),I=(0,a.useMemo)(()=>(0,Ke.default)("selected-td-form__button",{"selected-td-form__button--active":P}),[P]),le=(0,a.useCallback)(Q=>{setTimeout(()=>{const fe=Q.current;if(fe){if(typeof fe.focus=="function"){fe.focus();return}fe.input&&typeof fe.input.focus=="function"&&fe.input.focus()}},0)},[]),ke=(0,a.useCallback)(()=>{v?(E(!1),g.trim()&&(i.setFieldValue(["items",l,"alt"],""),setTimeout(()=>s(),0))):(E(!0),le(k))},[v,g,l,le,i,s]),Ne=(0,a.useCallback)(()=>{if(P)n(l,{title:!1}),h(!1),m.trim()&&(i.setFieldValue(["items",l,"title"],""),setTimeout(()=>s(),0));else{h(!0),n(l,{title:!0});const Q=g.trim();i.setFieldValue(["items",l,"title"],Q),setTimeout(()=>s(),0),le(x)}},[g,l,le,i,n,s,P,m]);return(0,o.jsxs)("div",{className:"selected-social-form__meta-block",children:[(0,o.jsxs)(t.ui_kit$Space,{size:8,className:"selected-social-form__meta-toggle-row",style:y,children:[(0,o.jsx)(t.ui_kit$Tooltip,{title:W,placement:"bottom",getPopupContainer:$o,children:(0,o.jsx)(t.ui_kit$Button,{type:"default",className:ee,onClick:ke,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Alt"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:Y,placement:"bottom",getPopupContainer:$o,children:(0,o.jsx)(t.ui_kit$Button,{type:"default",className:I,onClick:Ne,children:(0,o.jsx)("span",{className:"addon-text-content",children:"Title"})})})]}),(0,o.jsxs)("div",{className:A,children:[(0,o.jsx)(t.ui_kit$Form.Item,{name:D,className:$,children:(0,o.jsx)(t.ui_kit$Input,{ref:k,placeholder:e("Alternative text"),allowClear:T,prefix:Xd})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:z,className:j,children:(0,o.jsx)(t.ui_kit$Input,{ref:x,placeholder:e("Social network name"),allowClear:T,prefix:Kd})})]})]})}Kl.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 sc(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 ac(e){if(!e)return{align:"center",iconSize:40,borderRadius:0,gap:8,globalBgColor:"",globalItemBorderColor:"",buttonBorderWidth:0,showLabel:!1,items:[]};const i=ec(e),l=String(e?.hostCellBgForIconLuminance??"").trim(),s=sc(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:Xl(e.items),buttonBorderWidth:n,showLabel:e.showLabel??!1,items:Array.isArray(e.items)?e.items.map(c=>{const p=Ud(c),g=p?"":qt(d,c.buttonBgColor),m=c.platform&&!p?r.getSocialIconForBlockCell(c.platform,Kt(i,g,l)):null;return{...c,customIcon:p,title:String(c.title??"").trim(),...m?{iconSrc:m}:{},iconWidth:null,iconHeight:null,buttonBgColor:g,itemBorderColor:p?"":String(c.itemBorderColor??"").trim()}}):[]}}var ql=({elementSettings:e})=>{const{__:i}=r.useI18n(),l=r.useAppConfig(),s=r.useDispatch(),[n]=t.ui_kit$Form.useForm(),d=r.useSendPostMessage(),c=r.useSendPostMessageEx(),{openImagePicker:p}=r.useImagePicker(),g=r.useNotification(),[m,_]=(0,a.useState)(e),[E,b]=(0,a.useState)(null),[h,k]=(0,a.useState)(null),x=(0,a.useRef)(null),T=(0,a.useRef)(null),v=(0,a.useRef)(null),P=(0,a.useRef)(Yl(e)),B=r.useSelector(r.selectEmailSettings),y=(0,a.useRef)(null),D=(0,a.useRef)(!1),z=(0,a.useRef)(""),A=(0,a.useRef)({}),$=Zd(),j=B?.usedColors??[],W=t.ui_kit$Form.useWatch("items",n)||[],Y=(0,a.useCallback)(()=>{y.current&&(document.removeEventListener("dragover",y.current,!0),y.current=null)},[]),ee=(0,a.useCallback)(()=>{if(y.current)return;const R=V=>{V.preventDefault(),V.dataTransfer&&(V.dataTransfer.dropEffect="move")};document.addEventListener("dragover",R,!0),y.current=R},[]),I=(0,a.useMemo)(()=>r.getSocialPresetsForBrand(Yd).filter(R=>r.SOCIAL_ICON_ORIGINAL_BY_PLATFORM[R.id]),[]),le=(0,a.useMemo)(()=>I.map(R=>({value:R.id,label:(0,o.jsxs)("span",{className:"selected-social-form__platform-option",children:[(0,o.jsx)("img",{src:r.getSocialIcon(R.id,$),alt:""}),(0,o.jsx)("span",{className:"selected-social-form__platform-option-text",children:i(R.labelMsgid)})]})})),[i,I,$]),ke=(0,a.useCallback)((R,V)=>{A.current={...A.current,[R]:{...A.current[R],...V}}},[]);(0,a.useEffect)(()=>{const R=Yl(e);P.current!==R&&(P.current=R,A.current={},_(e))},[e]);const Ne=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(m?.settings){if(Ne.current){Ne.current=!1;return}const R=m.settings;z.current=R.bgEnabled&&R.bgColor?String(R.bgColor).trim():"",n.setFieldsValue(ac(m.settings))}},[m,n]),(0,a.useEffect)(()=>()=>Y(),[Y]);const Q=(0,a.useCallback)(()=>{const R=n.getFieldsValue(!0),V=m.settings||{},L=String(V.hostCellBgForIconLuminance??"").trim(),X=(R.globalBgColor||"").trim(),ie=typeof R.iconSize=="number"&&!Number.isNaN(R.iconSize)?R.iconSize:V.iconSize??40,me=typeof R.borderRadius=="number"&&!Number.isNaN(R.borderRadius)?R.borderRadius:V.borderRadius??0,he=typeof R.gap=="number"&&!Number.isNaN(R.gap)?R.gap:V.gap??8,$e={blockBgEnabled:!!X,blockBgColor:X},je=(R.globalItemBorderColor||"").trim();let G=typeof R.buttonBorderWidth=="number"&&!Number.isNaN(R.buttonBorderWidth)?R.buttonBorderWidth:0;G=Math.max(0,Math.min(24,Math.round(G)));const re={...V,type:"social",align:R.align??V.align??"center",iconSize:ie,borderRadius:me,gap:he,bgEnabled:!!X,bgColor:X,hostCellBgForIconLuminance:L,borderWidth:typeof V.borderWidth=="number"?V.borderWidth:0,borderColor:typeof V.borderColor=="string"?V.borderColor:"",buttonBorderColor:"",buttonBorderWidth:G,showLabel:R.showLabel,items:(R.items||[]).filter(Boolean).map((O,pe)=>{const ye=!!O.customIcon,ze=A.current[pe]||{},oo=ye?"":oc(X,(O.buttonBgColor||"").trim()),ro=typeof O.href=="string"?zl(O.href):O.href,ao=ye?"":qt(X,oo),M=!ye&&O.platform?r.getSocialIconForBlockCell(O.platform,Kt($e,ao,L)):null,se=ye?"":je||String(O.itemBorderColor??"").trim(),C=Jd(ye?O.iconSrc||"":M||O.iconSrc||"");return{...O,customIcon:ye,href:ro,iconSrc:C,iconWidth:null,iconHeight:null,buttonBgColor:oo,itemBorderColor:se,title:ze.title?String(O.title??"").trim():""}})};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:r.ELEMENT_TYPES.SOCIAL,caption:m.caption,settings:re}),z.current=X,Ne.current=!0,_(O=>({...O,settings:re}))},[m.caption,m.settings,n,d]),fe=(0,a.useCallback)(R=>{if(R==null||R==="")return-1;const V=r.stripEmVersionFromUrlString(String(R));return(n.getFieldValue("items")||[]).findIndex(L=>r.stripEmVersionFromUrlString(L&&L.iconSrc||"")===V)},[n]),Ae=(0,a.useCallback)((R,V,L,X)=>{const ie=[...n.getFieldValue("items")||[]];if(R<0||R>=ie.length)return;if(zd(V)){g.error({title:i("Email clients do not show SVG and WebP images. Choose a PNG or JPG icon.")});return}const me=r.stripEmVersionFromUrlString(String(X||""))===r.stripEmVersionFromUrlString(String(V||""));(!me||Wd(ie,R,V))&&(ie[R]={...ie[R],iconSrc:V,customIcon:!0,buttonBgColor:"",itemBorderColor:""},n.setFieldValue("items",ie),setTimeout(()=>Q(),0)),L?.mode==="save"&&me&&c(r.EVENT_TYPES.SANDBOX_IMAGE_RESET,{url:String(V)})},[i,n,g,Q,c]),ne=(0,a.useCallback)(async(R,V)=>{const L=r.stripEmVersionFromUrlString(String(V||"")),X=fe(V);if(X<0)return;const ie=(n.getFieldValue("items")||[])[X]?.iconSrc,{entryModal:me,currentUrl:he,imageDataUrl:$e}=await Gl(L,R),je=await p({kind:"img",currentUrl:he,entryModal:me,imageDataUrl:$e});je?.url&&Ae(X,je.url,je.meta,ie)},[Ae,fe,n,p]),Fe=(0,a.useCallback)(async R=>{const V=(n.getFieldValue("items")||[])[R];if(!V)return;const{entryModal:L,currentUrl:X,imageDataUrl:ie}=await Gl(r.stripEmVersionFromUrlString(String(V.iconSrc||"")),r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD),me=V.iconSrc,he=await p({kind:"img",currentUrl:X,entryModal:L,imageDataUrl:ie});he?.url&&Ae(R,he.url,he.meta,me)},[Ae,n,p]),Le=(0,a.useCallback)(R=>{const V=parseInt(R.currentTarget.dataset.socialEditIndex??"",10);Number.isNaN(V)||Fe(V)},[Fe]),Ue=(0,a.useCallback)(R=>{const V=R.data?.operation,L=R.data?.src;V===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_AI_POPUP?ne(r.MODALS.UPLOAD_IMAGE_MODAL_AI,L):V===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?ne(r.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD,L):V===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_EDIT_POPUP?ne(r.MODALS.UPLOAD_IMAGE_MODAL_EDIT,L):V===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_GIF_POPUP?ne(r.MODALS.UPLOAD_IMAGE_MODAL_GIF,L):V===r.EVENT_TYPES.APPLICATION_OPEN_IMAGE_STOCK_POPUP?ne(r.MODALS.UPLOAD_IMAGE_MODAL_STOCK,L):V===r.EVENT_TYPES.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(s(r.closeSecondModal()),s(r.closeModal$1()))},[s,ne]);r.useListenPostMessage(Ue);const ve=(0,a.useCallback)(()=>{const R=n.getFieldValue("items")||[],V=I[0],L=(n.getFieldValue("globalItemBorderColor")||"").trim(),X=(n.getFieldValue("globalBgColor")||"").trim();if(!V)n.setFieldsValue({items:[...R,{platform:void 0,customIcon:!1,href:"",alt:"",title:"",iconSrc:"",iconWidth:null,iconHeight:null,buttonBgColor:X,itemBorderColor:L}]});else{const ie=String(m?.settings?.hostCellBgForIconLuminance??"").trim(),me=qt(X,X),he=r.getSocialIconForBlockCell(V.id,Kt({blockBgEnabled:!!X,blockBgColor:X},me,ie)),$e=i(V.labelMsgid);n.setFieldsValue({items:[...R,{platform:V.id,customIcon:!1,href:"",alt:$e,title:"",iconSrc:he,iconWidth:null,iconHeight:null,buttonBgColor:X,itemBorderColor:L}]})}setTimeout(()=>Q(),0)},[i,m?.settings?.hostCellBgForIconLuminance,n,I,Q]),Be=(0,a.useCallback)((R,V)=>{R.dataTransfer.setData(Wl,String(V)),R.dataTransfer.setData(r.DND_SOCIAL_LIST_REORDER_MIME,String(V)),R.dataTransfer.effectAllowed="move",x.current=V,b(V),ee()},[ee]),xe=(0,a.useCallback)(()=>{Y(),x.current=null,b(null),k(null)},[Y]),ce=(0,a.useCallback)((R,V,L)=>{if(L<2)return;R.preventDefault(),R.dataTransfer.dropEffect="move";const X=x.current;X!==null&&X!==V&&k(V)},[]),be=(0,a.useCallback)((R,V)=>{R.currentTarget.contains(R.relatedTarget)||k(L=>L===V?null:L)},[]),ue=(0,a.useCallback)((R,V,L)=>{R.preventDefault(),k(null);const X=R.dataTransfer.getData(Wl),ie=parseInt(X,10);if(Number.isNaN(ie)||ie===V){Y();return}L(ie,V),Y(),setTimeout(()=>Q(),0)},[Y,Q]),q=(0,a.useCallback)(R=>{const V=R.currentTarget,L=parseInt(V.dataset.itemIndex??"",10);Number.isNaN(L)||Be(R,L)},[Be]),Z=(0,a.useCallback)(R=>{const V=R.currentTarget,L=parseInt(V.dataset.itemIndex??"",10),X=parseInt(V.dataset.listLength??"",10);Number.isNaN(L)||Number.isNaN(X)||X<2||(R.preventDefault(),R.dataTransfer&&(R.dataTransfer.dropEffect="move"))},[]),te=(0,a.useCallback)(R=>{const V=R.currentTarget,L=parseInt(V.dataset.itemIndex??"",10),X=parseInt(V.dataset.listLength??"",10);Number.isNaN(L)||Number.isNaN(X)||ce(R,L,X)},[ce]),ae=(0,a.useCallback)(R=>{const V=parseInt(R.currentTarget.dataset.itemIndex??"",10);Number.isNaN(V)||be(R,V)},[be]),de=(0,a.useCallback)(R=>{const V=parseInt(R.currentTarget.dataset.itemIndex??"",10),L=T.current;Number.isNaN(V)||typeof L!="function"||ue(R,V,L)},[ue]),De=(0,a.useCallback)(R=>{R.stopPropagation();const V=parseInt(R.currentTarget.dataset.fieldName??"",10),L=v.current;Number.isNaN(V)||typeof L!="function"||(L(V),queueMicrotask(Q))},[Q]),oe=(0,a.useCallback)((R,V)=>{const L=I.find(re=>re.id===V);if(!L)return;const X=i(L.labelMsgid),ie=A.current[R]||{},me=String(n.getFieldValue(["items",R,"alt"])??"").trim();(ie.alt||me)&&n.setFieldValue(["items",R,"alt"],X),ie.title&&n.setFieldValue(["items",R,"title"],X);const he=(n.getFieldValue("globalBgColor")||"").trim(),$e=qt(he,(n.getFieldValue(["items",R,"buttonBgColor"])||"").trim()),je=String(m?.settings?.hostCellBgForIconLuminance??"").trim(),G=r.getSocialIconForBlockCell(V,Kt({blockBgEnabled:!!he,blockBgColor:he},$e,je));G&&(n.setFieldValue(["items",R,"customIcon"],!1),n.setFieldValue(["items",R,"iconSrc"],G))},[i,m?.settings?.hostCellBgForIconLuminance,n,I]),Te=(0,a.useCallback)(R=>{if(Object.prototype.hasOwnProperty.call(R,"globalItemBorderColor")){if(!D.current){const V=String(R.globalItemBorderColor??"").trim(),L=n.getFieldValue("items")||[];n.setFieldsValue({items:ic(L,V)})}}else if(Object.prototype.hasOwnProperty.call(R,"globalBgColor")){const V=z.current,L=String(R.globalBgColor??"").trim(),X=n.getFieldValue("items")||[];n.setFieldsValue({items:rc(X,V,L)})}else if(R?.items!=null){const V=n.getFieldValue("items")||[],L=Xl(V);L!==(n.getFieldValue("globalItemBorderColor")||"").trim()&&(D.current=!0,n.setFieldValue("globalItemBorderColor",L),queueMicrotask(()=>{D.current=!1}));const X=m.settings?.items||[];V.forEach((ie,me)=>{const he=ie?.platform,$e=X[me]?.platform;he&&he!==$e&&oe(me,he)})}lc(R?.items,oe),Q()},[m.settings?.items,n,Q,oe]),_e=(0,a.useCallback)((R,V)=>{if(n.setFieldValue(R,V),Array.isArray(R)&&R[0]==="items"){Te({items:{[R[1]]:{[R[2]]:V}}});return}Te({[R]:V})},[n,Te]),Ce=(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:{...m,type:r.ELEMENT_TYPES.SOCIAL}})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Button size"),placement:"bottom",getPopupContainer:$o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"iconSize",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:16,max:64,prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px",placeholder:i("Button size"),className:"selected-social-form__input-full"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Corner radius"),placement:"bottom",getPopupContainer:$o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"borderRadius",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,max:48,prefix:(0,o.jsx)(r.EmIcons,{icon:"BorderRadius",component:t.icons$BorderRadius,className:"selected-td-form__icon-radius"}),addonAfter:"px",placeholder:i("Corner radius"),className:"selected-social-form__input-full"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Spacing"),placement:"bottom",getPopupContainer:$o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gap",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,max:48,prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingLeftRight",component:t.icons$PaddingLeftRight}),addonAfter:"px",placeholder:i("Spacing"),className:"selected-social-form__input-full"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",getPopupContainer:$o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"globalBgColor",className:"form-item-margin-xs",children:(0,o.jsx)(Xt,{form:n,name:"globalBgColor",placeholder:i("Background color"),usedColors:j,onColorChange:_e})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Border"),placement:"bottom",getPopupContainer:$o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonBorderWidth",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,max:24,prefix:(0,o.jsx)(r.EmIcons,{icon:"BorderOuterOutlined",component:t.icons$BorderOuterOutlined}),addonAfter:"px",placeholder:i("Border"),className:"selected-social-form__input-full"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Border color"),placement:"bottom",getPopupContainer:$o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"globalItemBorderColor",className:"form-item-margin-xs",children:(0,o.jsx)(Xt,{form:n,name:"globalItemBorderColor",placeholder:i("Border color"),usedColors:j,onColorChange:_e})})})})]})]}),(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:(R,{remove:V,move:L})=>(T.current=L,v.current=V,(0,o.jsx)("div",{className:"selected-social-form__items",children:R.map((X,ie)=>{const me=!!(W[ie]?.customIcon??W[X.name]?.customIcon);return(0,o.jsxs)("div",{className:(0,Ke.default)("selected-social-form__card",E===ie&&"selected-social-form__card--dragging",h===ie&&E!==ie&&"selected-social-form__card--drag-over"),"data-item-index":ie,"data-list-length":R.length,onDragEnterCapture:Z,onDragOverCapture:te,onDragLeave:ae,onDropCapture:de,children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head",children:[(0,o.jsxs)("div",{className:"selected-social-form__card-head-main",children:[R.length>1?(0,o.jsx)("span",{className:"selected-social-form__drag-handle",draggable:!0,"data-item-index":ie,onDragStart:q,onDragEnd:xe,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)(Gd,{className:"selected-social-form__card-title",children:[i("Button")," ",ie+1]})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Delete"),placement:"top",getPopupContainer:$o,children:(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"selected-social-form__card-head-remove",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:18,strokeWidth:l.iconStrokeWidth}),"aria-label":i("Delete"),"data-field-name":X.name,onClick:De})})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[X.name,"iconSrc"],hidden:!0,children:(0,o.jsx)(t.ui_kit$Input,{})}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[X.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:[X.name,"platform"],className:"selected-social-form__platform-field selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:le,className:"selected-social-form__platform-select",classNames:{popup:{root:"selected-social-form__platform-dropdown"}},placeholder:i("Select"),suffixIcon:(0,o.jsx)(r.EmIcons,{icon:"ChevronDownCustom",component:t.icons$ChevronDownCustom,className:"ant-select-suffix"})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Edit icon"),placement:"top",getPopupContainer:$o,children:(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"selected-social-form__platform-edit","data-social-edit-index":ie,icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,size:18,strokeWidth:l.iconStrokeWidth}),"aria-label":i("Edit icon"),onClick:Le})})]}),(0,o.jsx)(t.ui_kit$Form.Item,{name:[X.name,"href"],className:"selected-social-form__card-field",rules:[{required:!0,whitespace:!0,message:i("Please enter the URL.")},{validator:async(he,$e)=>{const je=typeof $e=="string"?$e.trim():String($e??"").trim();if(je&&!Qd(je))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,{})}})}),me?null:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__card-field selected-social-form__bg-color-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",getPopupContainer:$o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:[X.name,"buttonBgColor"],className:"selected-social-form__card-field",children:(0,o.jsx)(Xt,{form:n,name:["items",X.name,"buttonBgColor"],placeholder:i("Background color"),usedColors:j,onColorChange:_e})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Border color"),placement:"bottom",getPopupContainer:$o,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:[X.name,"itemBorderColor"],className:"selected-social-form__card-field",children:(0,o.jsx)(Xt,{form:n,name:["items",X.name,"itemBorderColor"],placeholder:i("Border color"),usedColors:j,onColorChange:_e})})})})]}),(0,o.jsx)(Kl,{__:i,form:n,fieldName:X.name,pushSettingsToIframe:Q,onMetaActiveChange:ke})]},X.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:Te,autoComplete:"off",children:(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:Ce})})})};ql.propTypes={elementSettings:f.default.shape({settings:f.default.object,type:f.default.string,caption:f.default.string})};var wt=["borderAll","borderTop","borderRight","borderBottom","borderLeft"],Jl=["all","top","right","bottom","left"],Vi={width:1,style:"solid",color:"#E5E5E5"},Ql=["All","TopLeft","TopRight","BottomRight","BottomLeft"],so=e=>u(e),Oo=e=>e!==""&&e!==null&&e!==void 0;function jt(e,i=""){return typeof e=="number"?String(e):typeof e=="string"&&e?e:i}function Jt(e){return Oo(e?.width)||!!e?.style||!!e?.color}function Zl(e){const i=wt.find(l=>e[l]?.style);return i?e[i]:null}function Hi(e){return Zl(e)??Vi}function Ui(e,i){const l=Jl.find(n=>Jt(i[n]))??"all",s=Jt(i[l])?i[l]:Zl(e)??{};return{mobileBorderPosition:l,mobileBorderWidth:s.width??"",mobileBorderColor:s.color??"",mobileBorderStyle:s.style??""}}var nc=e=>so(e?.replace(/px$/,""));function es(e,i){return Object.fromEntries(["LeftRight","TopBottom","Left","Right","Top","Bottom"].map(l=>{const s=`${i}padding${l}`;return[s,nc(e[s])]}))}function dc(e){return{borderRadiusAll:so(e.all),borderRadiusTopLeft:so(e.topLeft),borderRadiusTopRight:so(e.topRight),borderRadiusBottomRight:so(e.bottomRight),borderRadiusBottomLeft:so(e.bottomLeft)}}function cc(e){const i=l=>so(l!==null?l:e.all);return{mobileBorderRadiusAll:so(e.all),mobileBorderRadiusTopLeft:i(e.topLeft),mobileBorderRadiusTopRight:i(e.topRight),mobileBorderRadiusBottomRight:i(e.bottomRight),mobileBorderRadiusBottomLeft:i(e.bottomLeft)}}function os(e,i){return{[`${i}Inset`]:so(e?.inset)||!1,[`${i}HOffset`]:so(e?.hOffset),[`${i}VOffset`]:so(e?.vOffset),[`${i}BlurRadius`]:so(e?.blurRadius),[`${i}SpreadRadius`]:so(e?.spreadRadius),[`${i}Color`]:so(e?.color)}}function ts(e,i){return Object.fromEntries(wt.map(l=>[`${i}${l}`,e[`${i}${l}`]]))}function uc(e){return{fontFamily:so(e.fontFamily),fontSize:so(e.fontSize),lineHeight:so(e.lineHeight),textStrong:so(e.textStrong),textItalic:so(e.textItalic),textStrikethrough:so(e.textStrikethrough),textUnderline:so(e.textUnderline),textLink:so(e.textLink),linkHref:so(e.linkHref),linkTarget:so(e.linkTarget),textColor:so(e.textColor),textBackgroundColor:so(e.textBackgroundColor),textAlign:so(e.textAlign),valign:so(e.textValign)}}function is(e){const i=e.customTable,l=i.mobileBackgroundColor;return{show:e.show||"all",outlookBackground:e.outlookBackground,...nt(e),mobileBackgroundColor:so(l?.value!=="none"?l?.value:""),...es(i,""),...es(i,"cell_"),backgroundColor:so(i.backgroundColor),backgroundImage:so(i.backgroundImage?.[0]?.value),backgroundPositionX:so(i.backgroundPositionX),backgroundPositionY:so(i.backgroundPositionY),backgroundRepeat:so(i.backgroundRepeat),backgroundSize:so(i.backgroundSize),...ts(i,""),borderPosition:i.borderPosition||"borderAll",...ts(i,"cell_"),cell_borderPosition:i.cell_borderPosition||"cell_borderAll",cellBackgroundColor:so(i.cellBackgroundColor),...dc(i.borderRadius),...os(i.boxShadow,"boxShadow"),...os(i.mobileBoxShadow,"mobileBoxShadow"),mobileWidth:So(i.mobileWidth?.value),mobileWidthDim:i.mobileWidth?.dim,mobileHeight:So(i.mobileHeight?.value),mobileHeightDim:i.mobileHeight?.dim,...cc(i.mobileBorderRadius),...Ui(i,i.mobileBorder),...uc(i)}}function rs(e,i){return Ql.some(l=>Number(e[`${i}Radius${l}`])>0)}function ls(e,i){return["Color","HOffset","VOffset"].some(l=>Oo(e[`${i}${l}`]))}function mc(e){const i=e.mobileBackgroundRepeat;return["mobileBackgroundColor","mobileBackgroundImage","mobileBackgroundPositionX","mobileBackgroundPositionY"].some(l=>Oo(e[l]))||Oo(i)&&i!=="none"||Oo(e.mobileBackgroundSize)}function ss(e,i,l,s){switch(e){case"border":return wt.some(n=>!!i[`${s?"cell_":""}${n}`]?.style);case"background":return s?Oo(i.cellBackgroundColor):Oo(i.backgroundColor)||Oo(i.backgroundImage);case"borderRadius":return rs(i,"border");case"boxShadow":return ls(i,"boxShadow");case"mobileSize":return Oo(i.mobileWidth)||Oo(i.mobileHeight);case"mobileBackground":return mc(i);case"mobileBorder":return Jl.some(n=>Jt(l[n]));case"mobileBorderRadius":return rs(i,"mobileBorder");case"mobileBoxShadow":return ls(i,"mobileBoxShadow");default:return!1}}var as=["background","border","borderRadius","boxShadow","mobileSize","mobileBackground","mobileBorder","mobileBorderRadius","mobileBoxShadow"];function ns(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 as.forEach(n=>{s[n]=ss(n,e,i,l)}),s}function pc(e,i){const l={...e};return as.forEach(s=>{l[s]=e[s]||i[s]}),l}function Qt(e,i){const l=i==="mobile"?"mobileBorderRadius":"borderRadius",[s,...n]=Ql.map(d=>e[`${l}${d}`]);return!!s||!n.some(d=>!!d)}var hc=["borderRadius","mobileWidth","mobileHeight","mobileBoxShadow","mobileBorder","mobileBorderRadius"],bc=["textStrong","textItalic","textStrikethrough","textUnderline","textLink","linkHref","textAlign"];function ds(e,i){return Object.fromEntries(i.map(l=>[l,e[l]]))}function gc(e){return{...e,...ds(e.customTable,hc)}}function fc(e){return{...e,...ds(e.customTable,bc),valign:e.customTable.textValign}}var Zt={hOffset:5,vOffset:5,blurRadius:10,spreadRadius:-5,color:"#000000",inset:!1},ei={hOffset:null,vOffset:null,blurRadius:null,spreadRadius:null,inset:!1},oi=5,ti="#E5E5E5",cs="em-mob-box_shadow-",us="em-mob-border_radius_all-",_c={width:"",style:"",color:""},xc=["LeftRight","TopBottom","Left","Right","Top","Bottom"],ms=["All","TopLeft","TopRight","BottomRight","BottomLeft"],kc=["backgroundColor","backgroundImage","backgroundPositionX","backgroundPositionY","backgroundRepeat","backgroundSize"];function ii(e,i){return{[`${e}Inset`]:i.inset??!1,[`${e}HOffset`]:i.hOffset??null,[`${e}VOffset`]:i.vOffset??null,[`${e}BlurRadius`]:i.blurRadius??null,[`${e}SpreadRadius`]:i.spreadRadius??null,[`${e}Color`]:i.color??""}}var vt=(e,i="")=>Object.fromEntries(e.map(l=>[l,i])),Ec={padding:{off:()=>({fields:vt(xc.map(e=>`padding${e}`)),settings:{padding:{all:0}}})},background:{on:({prefix:e})=>{const i=e?"cellBackgroundColor":"backgroundColor";return{fields:{[i]:ti},settings:{[i]:ti}}},off:({prefix:e})=>e?{fields:{cellBackgroundColor:""},settings:{cellBackgroundColor:""}}:{fields:vt(kc),backgroundImageEmpty:!0,settings:{backgroundColor:"",backgroundImage:[{type:"url",value:""}],backgroundRepeat:"",backgroundSize:""}}},border:{on:({prefix:e})=>({fields:{[`${e}borderPosition`]:`${e}borderAll`,[`${e}borderAll`]:Vi},settings:{[`${e}borderAll`]:Vi}}),off:({prefix:e})=>({fields:vt(wt.map(i=>`${e}${i}`),_c),settings:{[`${e}borderAll`]:{style:""}}})},borderRadius:{on:()=>({fields:{borderRadiusAll:oi},settings:{borderRadius:{all:oi}},uniformRadius:"desktop"}),off:()=>({fields:vt(ms.map(e=>`borderRadius${e}`)),settings:{borderRadius:{all:0}},uniformRadius:"desktop"})},boxShadow:{on:()=>({fields:ii("boxShadow",Zt),settings:{boxShadow:Zt}}),off:()=>({fields:ii("boxShadow",ei),settings:{boxShadow:{...ei,color:""}}})},mobileSize:{off:({fields:e})=>({fields:{mobileWidth:"",mobileHeight:""},settings:{mobileWidth:{value:null,dim:jt(e.mobileWidthDim,"px"),classNamePrefix:"em-mob-width-"},mobileHeight:{value:null,dim:"px",classNamePrefix:"em-mob-height-"}}})},mobileBackground:{on:()=>({fields:{mobileBackgroundColor:ti},settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:ti}}}),off:()=>({fields:{...nt({}),mobileBackgroundColor:""},settings:il()})},mobileBorder:{on:({settings:e})=>{const i={...Hi(e.customTable),classNamePrefix:"em-mob-border_all-"},l={...r.RESET_BORDER_PARAMS,all:i};return{fields:Ui(e.customTable,l),settings:{mobileBorder:{all:i}},mobileBorders:l}},off:({settings:e})=>({fields:Ui(e.customTable,r.RESET_BORDER_PARAMS),settings:{mobileBorder:r.RESET_BORDER_PARAMS},mobileBorders:r.RESET_BORDER_PARAMS})},mobileBorderRadius:{on:()=>({fields:{mobileBorderRadiusAll:oi},settings:{mobileBorderRadius:{all:oi,classNamePrefix:us}},uniformRadius:"mobile"}),off:()=>({fields:vt(ms.map(e=>`mobileBorderRadius${e}`)),settings:{mobileBorderRadius:{all:null,classNamePrefix:us}},uniformRadius:"mobile"})},mobileBoxShadow:{on:()=>({fields:ii("mobileBoxShadow",Zt),settings:{mobileBoxShadow:{...Zt,classNamePrefix:cs}}}),off:()=>({fields:ii("mobileBoxShadow",ei),settings:{mobileBoxShadow:{...ei,color:null,classNamePrefix:cs}}})}},Sc=["padding","cellPadding","background","border","borderRadius","boxShadow","mobileSize","mobileBackground","mobileBorder","mobileBorderRadius","mobileBoxShadow"];function Bc(e,i,l){const s=c=>`${i}padding${c}`;if(l){const[c,p]=[e[s("LeftRight")],e[s("TopBottom")]];return{fields:{[s("Left")]:c,[s("Right")]:c,[s("Top")]:p,[s("Bottom")]:p}}}const[n,d]=[e[s("Left")],e[s("Top")]];return{fields:{[s("LeftRight")]:n,[s("TopBottom")]:d,[s("Right")]:n,[s("Bottom")]:d},settings:{[`${i}padding`]:{top:d,bottom:d,left:n,right:n}}}}function Tc(e){const{form:i,settings:l,send:s,isTableCells:n,mobileBorders:d,setMobileBorders:c,setBackgroundImageEmpty:p}=e,g=(0,a.useMemo)(()=>is(l),[l]),[m,_]=(0,a.useState)(()=>ns(g,l.customTable.mobileBorder,n)),[E,b]=(0,a.useState)(!0),[h,k]=(0,a.useState)(()=>Qt(g,"desktop")),[x,T]=(0,a.useState)(()=>Qt(g,"mobile"));(0,a.useEffect)(()=>{_(y=>pc(y,ns(g,l.customTable.mobileBorder,n))),k(Qt(g,"desktop")),T(Qt(g,"mobile"))},[g,l,n]);const v=n?"cell_":"",P=(0,a.useMemo)(()=>{const y=z=>{z&&(z.fields&&i.setFieldsValue(z.fields),z.mobileBorders&&c(z.mobileBorders),z.backgroundImageEmpty!==void 0&&p?.(z.backgroundImageEmpty),z.uniformRadius&&(z.uniformRadius==="mobile"?T:k)(!0),z.settings&&s(z.settings))},D=z=>{const A=i.getFieldsValue(!0),$=Ec[z],j={fields:A,settings:l,prefix:v};m[z]?y($?.off?.(j)):ss(z,A,d,n)||y($?.on?.(j)),_(W=>({...W,[z]:!W[z]}))};return Object.fromEntries(Sc.map(z=>[z,()=>D(z)]))},[i,l,s,n,d,c,p,m,v]);return{open:m,toggle:P,paddingsExt:E,togglePaddingMode:()=>{const y=Bc(i.getFieldsValue(!0),v,E);i.setFieldsValue(y.fields??{}),y.settings&&s(y.settings),b(!E)},oneBorderRadiusValue:h,setOneBorderRadiusValue:k,oneMobileBorderRadiusValue:x,setOneMobileBorderRadiusValue:T}}var ri={width:"",style:"",color:""},Rc="em-mob-box_shadow-",ps={mobileBorderWidth:"width",mobileBorderStyle:"style",mobileBorderColor:"color"},yc=(e,i)=>({settings:{[e]:i}});function hs(e,i){return{hOffset:e[`${i}HOffset`],vOffset:e[`${i}VOffset`],blurRadius:e[`${i}BlurRadius`],spreadRadius:e[`${i}SpreadRadius`],color:e[`${i}Color`],inset:e[`${i}Inset`]}}var li=e=>`em-mob-border_${e}-`,It=e=>({...r.RESET_BORDER_PARAMS[e],classNamePrefix:li(e)});function bs(){return{top:It("top"),right:It("right"),bottom:It("bottom"),left:It("left")}}var wc=e=>e?.width!=null&&e?.style!=null&&e?.color!=null;function jc(e){const i=l=>({...e,classNamePrefix:li(l)});return{top:i("top"),right:i("right"),bottom:i("bottom"),left:i("left")}}function vc(e,i,l,s){const n=Hi(s.settings.customTable),d=(c,p)=>{const g=c===i?l:e[p];return Oo(g)?g:n[c]};return{width:d("width","mobileBorderWidth"),style:d("style","mobileBorderStyle"),color:d("color","mobileBorderColor")}}var Ic=(e,i,l,s)=>{const n=l.mobileBorderPosition||"all",d=ps[e],c=s.mobileBorders;if(!Oo(i)){const m=n==="all"?{...bs(),all:{...c.all,[d]:null,classNamePrefix:li("all")}}:{...c,[n]:It(n),all:{...r.RESET_BORDER_PARAMS.all}};return{settings:{mobileBorder:m},mobileBorders:m}}const p={...vc(l,d,i,s),classNamePrefix:li(n)},g=n==="all"?{...bs(),all:p}:{...c,...wc(c.all)?jc(c.all):{},[n]:p,all:{...r.RESET_BORDER_PARAMS.all}};return{settings:{mobileBorder:g},mobileBorders:g,fields:{mobileBorderWidth:p.width,mobileBorderStyle:p.style,mobileBorderColor:p.color}}},Cc=(e,i,l,s)=>{const n=s.mobileBorders[i],d=Jt(n)?n:Hi(s.settings.customTable);return{fields:{mobileBorderWidth:d.width??"",mobileBorderColor:d.color??"",mobileBorderStyle:d.style??""}}},Pc=(e,i,l)=>{if(i?.style==="")return{settings:{[e]:i},fields:{[e]:ri}};const s=l[e]??{},n=l.borderAll??{},d={...s,width:s.width===""?n.width||"1":s.width,color:s.color===""?n.color||"#b9b1b1":s.color,style:s.style===""?n.style||"solid":s.style};return{settings:{[e]:i},fields:{[e]:d,borderAll:ri}}},Nc=(e,i)=>{const l=wt.filter(n=>n!=="borderAll"),s=i?.style===""?{borderAll:ri}:Object.fromEntries(l.map(n=>[n,ri]));return{settings:{[e]:i},fields:s}},Ho=(e,i)=>Object.fromEntries(e.map(l=>[l,i])),Wi=(e,i)=>i.map(l=>e+l),Ac=["textAlign","valign"],gs=["Inset","HOffset","VOffset","BlurRadius","SpreadRadius","Color"],Lc=["Color","Image","PositionX","PositionY","Repeat","Size"],Oc={...Ho(Wi("boxShadow",gs),(e,i,l)=>({settings:{boxShadow:hs(l,"boxShadow")}})),...Ho(Wi("mobileBoxShadow",gs),(e,i,l)=>({settings:{mobileBoxShadow:{...hs(l,"mobileBoxShadow"),classNamePrefix:Rc}}})),...Ho(Object.keys(U.BORDER_RADIUS_POSITION),(e,i)=>({settings:{borderRadius:{[U.BORDER_RADIUS_POSITION[e]]:+i}}})),...Ho(Object.keys(U.MOBILE_BORDER_RADIUS_POSITION),(e,i)=>{const l=U.MOBILE_BORDER_RADIUS_POSITION[e];return{settings:{mobileBorderRadius:{[l]:i,classNamePrefix:`em-mob-border_radius_${l}-`}}}}),...Ho(Wi("mobileBackground",Lc),(e,i)=>{const l=Bt({[e]:i});return l?{settings:l}:{}}),...Ho(Object.keys(ps),Ic),...Ho(["borderTop","borderRight","borderBottom","borderLeft"],Pc),...Ho(["fontSize","lineHeight"],(e,i)=>Oo(i)?{settings:{[e]:i}}:{}),...Ho(Ac,()=>({})),borderAll:Nc,borderPosition:()=>({}),mobileBorderPosition:Cc,backgroundImage:(e,i,l,s)=>({settings:{backgroundImage:[{...s.settings.customTable.backgroundImage?.[0],type:"url",value:jt(i)}],...i?{backgroundSize:"cover"}:{}},backgroundImageEmpty:i===""}),mobileWidth:(e,i,l)=>({settings:{mobileWidth:{classNamePrefix:"em-mob-width-",value:i,dim:jt(l.mobileWidthDim)}}}),mobileWidthDim:(e,i,l)=>({settings:{mobileWidth:{classNamePrefix:"em-mob-width-",value:l.mobileWidth||100,dim:jt(i)}}}),mobileHeight:(e,i,l)=>({settings:{mobileHeight:{classNamePrefix:"em-mob-height-",value:i,dim:jt(l.mobileHeightDim)}}}),linkHref:(e,i)=>{const l=rt(i);return{settings:{linkHref:l},linkHref:l,...l!==i?{fields:{linkHref:l}}:{}}}};function $c(e,i,l){const[s]=Object.keys(e);return s?(Oc[s]??yc)(s,e[s],i,l):{}}function Fc(e){const{form:i,settings:l,send:s,mobileBorders:n,setMobileBorders:d,setBackgroundImageEmpty:c,onLinkHref:p}=e;return(0,a.useCallback)(g=>{const m=$c(g,i.getFieldsValue(!0),{settings:l,mobileBorders:n});m.fields&&i.setFieldsValue(m.fields),m.mobileBorders&&d(m.mobileBorders),m.backgroundImageEmpty!==void 0&&c(m.backgroundImageEmpty),m.linkHref!==void 0&&p(m.linkHref),m.settings&&s(m.settings)},[i,l,s,n,d,c,p])}function Mc(e){const i=e.customTable.mobileBorder,[l,s]=(0,a.useState)(i);return(0,a.useEffect)(()=>s(i),[i]),[l,s]}function Dc(e,i){return(0,a.useCallback)(l=>e({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:i,settings:l}),[e,i])}var dt=["hover"],fs={width:"100%"},_s={paddingBottom:4},Vc={textAlign:"right"},zi=e=>e.parentNode,Hc=e=>e.closest(".selected-element-panel"),Uc=e=>e.closest(".email-pane__collapse-wrapper"),Wc=({elementSettings:e,__:i,token:l,sendAction:s,typografItems:n})=>{const d=U.useGoogleFontsLoader(),c=(0,a.useMemo)(()=>({marginBottom:l.formItemMarginBottomXS}),[l.formItemMarginBottomXS]),p=(0,a.useMemo)(()=>({items:n}),[n]),g=(0,a.useCallback)(()=>s("add_img"),[s]),m=(0,a.useCallback)(()=>s("typograf"),[s]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"AddImage",style:c,children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"AddImage",component:t.icons$AddImage}),onClick:g,style:fs,children:i("Add image")})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"Typography",style:c,children:(0,o.jsx)(t.ui_kit$Dropdown,{arrow:!0,menu:p,trigger:dt,placement:"bottom",getPopupContainer:Hc,children:(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"Typograf",component:t.icons$Typograf}),onClick:m,style:fs,children:i("Typography")})})})})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:dt,title:i("Text font"),placement:"bottom",zIndex:1,getPopupContainer:zi,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:Uc})})}),!e.showOnMobile&&(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:dt,title:i("Font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"fontSize",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:8,max:90,placeholder:i("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:dt,title:i("Line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"lineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:10,max:110,placeholder:i("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]})]})},zc=({elementSettings:e,__:i,token:l,textInputRef:s,linkProtocol:n,handleLinkProtocolsChange:d})=>{const c=!!e.customTable?.isNewLink,p=(0,a.useMemo)(()=>({marginBottom:l.formItemMarginBottomXS}),[l.formItemMarginBottomXS]);return(0,a.useEffect)(()=>{c&&s.current?.focus()},[c,s]),(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsxs)(t.ui_kit$Col,{span:24,children:[(0,o.jsx)(it,{show:n==="#",__:i,style:p}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:dt,title:i("The URL that the hyperlink directs to."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkHref",children:(0,o.jsx)(t.ui_kit$Input,{ref:s,addonBefore:(0,o.jsx)(tt,{linkProtocol:n,handleLinkProtocolsChange:d,__:i}),allowClear:!0,placeholder:i("Hyperlink URL"),prefix:(0,o.jsx)(ot,{linkProtocol:n})})})})]})})},Gc=({form:e,elementSettings:i,__:l,token:s,isMacOS:n,formValues:d,textInputRef:c,linkProtocol:p,handleLinkProtocolsChange:g})=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:l(n?"Strong ( ⌘B )":"Strong ( Ctrl+B )"),icon:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:l(n?"Italic ( ⌘I )":"Italic ( Ctrl+I )"),icon:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:l(n?"Strikethrough ( ⌘+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:(0,o.jsx)(r.EmIcons,{icon:"StrikethroughOutlined",component:t.icons$StrikethroughOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:l(n?"Underline ( ⌘U )":"Underline ( Ctrl+U )"),icon:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined,className:"selected-text-common-form__icon-radius"})})}),(0,o.jsx)(t.ui_kit$Col,{span:3,children:(0,o.jsx)(no,{form:e,className:(0,Ke.default)("selected-text-common-form__button selected-text-common-form__button_style",{"selected-text-common-form__button--active":!!i.textLink}),elementSettings:i,name:"textLink",tooltipTitle:l("Link"),icon:(0,o.jsx)(r.EmIcons,{icon:"LinkOutlined",component:t.icons$LinkOutlined,className:"selected-text-common-form__icon-radius"})})})]}),d?.textLink&&(0,o.jsx)(zc,{elementSettings:i,__:l,token:s,textInputRef:c,linkProtocol:p,handleLinkProtocolsChange:g})]}),Yc=({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:_s,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:dt,title:l("Text color"),placement:"bottom",zIndex:2,getPopupContainer:zi,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",rules:s,children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:l("Color"),usedColors:i.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:dt,title:l("Text background"),placement:"bottom",zIndex:2,getPopupContainer:zi,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:_s,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(st,{form:e,elementSettings:i,name:"textAlign"})}),(0,o.jsx)(t.ui_kit$Col,{span:12,style:Vc,children:(0,o.jsx)(Vo,{form:e,elementSettings:i,name:"valign",isNewIconType:!0})})]})]})},Xc=e=>{const{form:i,elementSettings:l,__:s,token:n,appConfig:d,backgroundRepeatOptions:c,backgroundSizeOptions:p,handleToggleShowPaddingCell:g,handleTogglePaddingCell:m,handleToggleBackground:_,handleToggleBorder:E,handleToggleBorderRadius:b,paddingCellShow:h,paddingsExt:k,backgroundShow:x,cellBordersShow:T,borderRadiusShow:v,oneBorderRadiusValue:P,setOneBorderRadiusValue:B,backgroundImageEmpty:y}=e;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$FormSection,{title:s("Text"),dividerTop:!1,children:[d.formTextFieldTypografEnabled&&(0,o.jsx)(Wc,{...e}),(0,o.jsx)(Gc,{...e}),(0,o.jsx)(Yc,{...e})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:s("Padding"),collapsible:!0,open:h,onToggle:g,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{namePrefix:"cell_",extended:k,onToggleExtended:m,gutter:n.marginSM,rowStyle:{paddingBottom:4},labels:{horizontal:s("Horizontal padding"),vertical:s("Vertical padding"),left:s("Left padding"),right:s("Right padding"),top:s("Top padding"),bottom:s("Bottom padding"),individual:s("Individual padding")}})}),(0,o.jsx)(t.ui_kit$FormSection,{title:s("Background"),collapsible:!0,open:x,onToggle:_,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{colorFieldName:"cellBackgroundColor",imageEnabled:d.formTableFieldBackgroundImageEnabled&&!1,backgroundImageEmpty:y,usedColors:l.usedColors,colorPlaceholder:s("Background color"),horizontalPositionPlaceholder:s("Horizontal position"),horizontalPositionTooltip:s("Horizontal position"),verticalPositionPlaceholder:s("Vertical position"),verticalPositionTooltip:s("Vertical position"),backgroundRepeatTooltip:s("Background image repeat"),backgroundSizeTooltip:s("Background image size"),selectPlaceholder:s("Please choose"),backgroundRepeatOptions:c,backgroundSizeOptions:p,imageUploadSlot:(d.formTableFieldBackgroundImageEnabled,void 0)})}),(0,o.jsx)(t.ui_kit$FormSection,{title:s("Borders"),collapsible:!0,open:T,onToggle:E,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:i,namePrefix:"cell_"})}),d.formFieldBorderRadiusEnabled&&!1]})},xs=({form:e,elementSettings:i,paddingShow:l,paddingsExt:s,backgroundShow:n,bordersShow:d,borderRadiusShow:c,boxShadowShow:p,handleToggleShowPadding:g,handleTogglePadding:m,handleToggleBackground:_,handleToggleBorder:E,handleToggleBorderRadius:b,handleToggleBoxShadow:h,backgroundRepeatOptions:k,backgroundSizeOptions:x,backgroundImageEmpty:T,oneBorderRadiusValue:v,setOneBorderRadiusValue:P})=>{const{__:B}=r.useI18n(),y=r.useAppConfig(),{token:D}=(0,t.ui_kit$useToken)();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$FormSection,{title:B("Padding"),collapsible:!0,open:l,onToggle:g,children:(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:s,onToggleExtended:m,gutter:D.marginSM,labels:{horizontal:B("Horizontal padding"),vertical:B("Vertical padding"),left:B("Left padding"),right:B("Right padding"),top:B("Top padding"),bottom:B("Bottom padding"),individual:B("Individual padding")}})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:B("Background"),collapsible:!0,open:n,onToggle:_,dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$FormBackgroundSettings,{imageEnabled:y.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:T,usedColors:i.usedColors,colorPlaceholder:B("Background color"),horizontalPositionPlaceholder:B("Horizontal position"),horizontalPositionTooltip:B("Horizontal position"),verticalPositionPlaceholder:B("Vertical position"),verticalPositionTooltip:B("Vertical position"),backgroundRepeatTooltip:B("Background image repeat"),backgroundSizeTooltip:B("Background image size"),selectPlaceholder:B("Please choose"),backgroundRepeatOptions:k,backgroundSizeOptions:x,imageUploadSlot:y.formTableFieldBackgroundImageEnabled?(0,o.jsx)(Fo,{form:e,label:B("Background image"),name:"backgroundImage",tooltipTitle:B("Background image"),placeholder:B("Background image link/route")}):void 0}),(0,o.jsx)(at,{form:e,showBackground:!0})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:B("Borders"),collapsible:!0,open:d,onToggle:E,dividerTop:!0,children:(0,o.jsx)(U.SelectedElementFormBorder,{form:e})}),y.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Border radius"),collapsible:!0,open:c,onToggle:b,dividerTop:!0,children:(0,o.jsx)(vo,{form:e,oneBorderRadiusValue:v,setOneBorderRadiusValue:P,elementSettings:i})}),y.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Box shadow"),collapsible:!0,open:p,onToggle:h,dividerTop:!0,children:(0,o.jsx)(No,{})}),y.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:B("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e})})]})};xs.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 ks=({form:e,elementSettings:i,mobileSizeShow:l,mobileBackgroundShow:s,mobileBordersShow:n,mobileBorderRadiusShow:d,mobileBoxShadowShow:c,handleToggleMobileSize:p,handleToggleMobileBackground:g,handleToggleMobileBorder:m,handleToggleMobileBorderRadius:_,handleToggleMobileBoxShadow:E,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:h,mobileBorders:k})=>{const{__:x,_x:T}=r.useI18n(),v=r.useAppConfig(),{token:P}=(0,t.ui_kit$useToken)(),B=r.useSelector(r.selectEmailSettings);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$FormSection,{title:x("Size"),collapsible:!0,open:l,onToggle:p,dividerTop:!0,children:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:x("Table width"),placement:"left",children:(0,o.jsx)("div",{style:{marginBottom:P.formItemMarginBottomMD+4},children:(0,o.jsx)(Yo,{form:e,name:"mobileWidth",elementSettings:i})})})})}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)("div",{style:{marginBottom:P.formItemMarginBottomXS*2},children:(0,o.jsx)(t.ui_kit$Tooltip,{title:x("Height"),placement:"bottom",children:(0,o.jsx)(lt,{form:e,name:"mobileHeight",elementSettings:i})})})})})]})}),(0,o.jsx)(t.ui_kit$FormSection,{title:x("Background"),collapsible:!0,open:s,onToggle:g,dividerTop:!0,children:(0,o.jsx)(Rt,{elementSettings:Xo(i),imageEnabled:v.formTableFieldBackgroundImageEnabled,desktopBackground:Tt(i)})}),v.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Borders"),collapsible:!0,open:n,onToggle:m,dividerTop:!0,children:(0,o.jsx)(t.ui_kit$FormBorderInputs,{form:e,fieldStructure:"flat",borderValues:k,usedColors:B.usedColors,labels:{color:x("Color"),width:T("Width","border"),none:x("None"),solid:x("Solid"),dashed:x("Dashed"),dotted:x("Dotted"),above:x("Above"),below:x("Below"),onLeft:x("On the left"),onRight:x("On the right"),around:x("Around"),usedColors:x("Used"),recommendedColors:x("Recommended")}})}),v.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Border radius"),collapsible:!0,open:d,onToggle:_,dividerTop:!0,children:(0,o.jsx)(vo,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:b,setOneBorderRadiusValue:h,elementSettings:i})}),v.formFieldBoxShadowEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Box shadow"),collapsible:!0,open:c,onToggle:E,dividerTop:!0,children:(0,o.jsx)(No,{typeOfForm:"mobile",form:e,elementSettings:i,enableSwitch:!1})}),v.formFieldVisibilityEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:x("Display control"),dividerTop:!0,children:(0,o.jsx)(Ao,{elementSettings:i,form:e})})]})};ks.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 Kc=({form:e,elementViewType:i,mobileViewActive:l,elementSettings:s,paddingShow:n,paddingsExt:d,backgroundShow:c,bordersShow:p,borderRadiusShow:g,boxShadowShow:m,mobileSizeShow:_,mobileBackgroundShow:E,mobileBordersShow:b,mobileBorderRadiusShow:h,mobileBoxShadowShow:k,handleToggleShowPadding:x,handleTogglePadding:T,handleToggleBackground:v,handleToggleBorder:P,handleToggleBorderRadius:B,handleToggleBoxShadow:y,handleToggleMobileSize:D,handleToggleMobileBackground:z,handleToggleMobileBorder:A,handleToggleMobileBorderRadius:$,handleToggleMobileBoxShadow:j,backgroundRepeatOptions:W,backgroundSizeOptions:Y,backgroundImageEmpty:ee,oneBorderRadiusValue:I,setOneBorderRadiusValue:le,oneMobileBorderRadiusValue:ke,setOneMobileBorderRadiusValue:Ne,mobileBorders:Q})=>(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)(ks,{form:e,elementSettings:s,mobileSizeShow:_,mobileBackgroundShow:E,mobileBordersShow:b,mobileBorderRadiusShow:h,mobileBoxShadowShow:k,handleToggleMobileSize:D,handleToggleMobileBackground:z,handleToggleMobileBorder:A,handleToggleMobileBorderRadius:$,handleToggleMobileBoxShadow:j,oneMobileBorderRadiusValue:ke,setOneMobileBorderRadiusValue:Ne,mobileBorders:Q})}):(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(xs,{form:e,elementSettings:s,paddingShow:n,paddingsExt:d,backgroundShow:c,bordersShow:p,borderRadiusShow:g,boxShadowShow:m,handleToggleShowPadding:x,handleTogglePadding:T,handleToggleBackground:v,handleToggleBorder:P,handleToggleBorderRadius:B,handleToggleBoxShadow:y,backgroundRepeatOptions:W,backgroundSizeOptions:Y,backgroundImageEmpty:ee,oneBorderRadiusValue:I,setOneBorderRadiusValue:le})})}),Es=e=>e.customTable?.backgroundImage?.[0]?.value==="",Ss=({elementSettings:e,formName:i})=>{const{__:l}=r.useI18n(),s=r.useSendPostMessage(),[n]=t.ui_kit$Form.useForm(),{token:d}=(0,t.ui_kit$useToken)(),c=r.useAppConfig(),p=r.useSelector(r.selectEmailViewType),g=r.useSelector(r.selectMobileViewActive),m=r.useSelector(r.selectIsCodeMode),_=r.useSelector(r.selectCodeModeDirection),E=i===r.EDIT_SELECTED_TABLE_CELLS,b=Dc(s,e.type),[h,k]=Mc(e),[x,T]=(0,a.useState)(Es(e)),[v,P]=(0,a.useState)("https://"),B=Tc({form:n,settings:e,send:b,isTableCells:E,mobileBorders:h,setMobileBorders:k,setBackgroundImageEmpty:T}),y=(0,a.useCallback)(Ae=>Go(Ae,P),[]),D=Fc({form:n,settings:e,send:b,mobileBorders:h,setMobileBorders:k,setBackgroundImageEmpty:T,onLinkHref:y}),z=(0,a.useMemo)(()=>({table:gc(e),cell:fc(e)}),[e]),A=(0,a.useRef)(),$=t.ui_kit$Form.useWatch([],n),j=[{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"}],W=[{label:l("Not defined"),value:""},{label:l("Contain"),value:"contain"},{label:l("Cover"),value:"cover"}],Y=m&&_!=="bottom",[ee,I]=(0,a.useState)(null);(0,a.useEffect)(()=>{window?.navigator?.userAgent.includes("Macintosh")&&I(!0)},[]);const le=Ae=>{s({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_TEXT,action:Ae,locale:"en_US"})},ke=[{key:"1",label:l("This element"),onClick:()=>le("typograf")},{key:"2",label:l("The whole email"),onClick:()=>le("typograf_all")}];(0,a.useEffect)(()=>{n.setFieldsValue(is(e)),T(Es(e))},[n,e]),(0,a.useEffect)(()=>{n.getFieldValue("linkHref")||n.setFieldsValue({linkHref:null})},[$?.textLink,$?.linkHref,e.customTable?.linkHref,n]),(0,a.useEffect)(()=>{e.customTable?.linkHref&&Go(e.customTable?.linkHref||"",P),n.setFieldsValue({linkHref:typeof e.customTable?.linkHref=="string"?e.customTable.linkHref:"https://"})},[n,e,P]);const Ne=Ae=>{n.setFieldValue("linkHref",Ae!=="mergetag"?Ae:""),P(Ae)},{open:Q,toggle:fe}=B;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:D,autoComplete:"off",className:"element-controls",style:{padding:0,display:"flex",flexDirection:"column"},children:[!Y&&(0,o.jsx)(t.ui_kit$Tooltip,{title:l("To change the appearance of the element on the mobile device, edit the fields below. If the fields remain empty, the desktop styles will be applied to the mobile version."),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Alert,{className:"selected_form-mobile-props-title",title:l("Appearance on mobile devices"),type:"info"})}),E?(0,o.jsx)("div",{id:"selected_element_form_desktop_props",children:(0,o.jsx)(Xc,{form:n,formValues:$,elementSettings:z.cell,appConfig:c,token:d,isMacOS:ee,__:l,handleToggleShowPaddingCell:fe.cellPadding,handleTogglePaddingCell:B.togglePaddingMode,handleToggleBackground:fe.background,handleToggleBorder:fe.border,handleToggleBorderRadius:fe.borderRadius,paddingCellShow:Q.cellPadding,paddingsExt:B.paddingsExt,backgroundShow:Q.background,cellBordersShow:Q.border,borderRadiusShow:Q.borderRadius,oneBorderRadiusValue:B.oneBorderRadiusValue,setOneBorderRadiusValue:B.setOneBorderRadiusValue,backgroundImageEmpty:x,backgroundRepeatOptions:j,backgroundSizeOptions:W,sendAction:le,typografItems:ke,textInputRef:A,linkProtocol:v,handleLinkProtocolsChange:Ne})}):(0,o.jsx)(Kc,{form:n,elementSettings:z.table,handleToggleShowPadding:fe.padding,handleTogglePadding:B.togglePaddingMode,handleToggleBackground:fe.background,handleToggleBorder:fe.border,handleToggleBorderRadius:fe.borderRadius,handleToggleBoxShadow:fe.boxShadow,handleToggleMobileSize:fe.mobileSize,handleToggleMobileBackground:fe.mobileBackground,handleToggleMobileBorder:fe.mobileBorder,handleToggleMobileBorderRadius:fe.mobileBorderRadius,handleToggleMobileBoxShadow:fe.mobileBoxShadow,paddingShow:Q.padding,paddingsExt:B.paddingsExt,backgroundShow:Q.background,bordersShow:Q.border,borderRadiusShow:Q.borderRadius,boxShadowShow:Q.boxShadow,mobileSizeShow:Q.mobileSize,mobileBackgroundShow:Q.mobileBackground,mobileBordersShow:Q.mobileBorder,mobileBorderRadiusShow:Q.mobileBorderRadius,mobileBoxShadowShow:Q.mobileBoxShadow,oneBorderRadiusValue:B.oneBorderRadiusValue,setOneBorderRadiusValue:B.setOneBorderRadiusValue,oneMobileBorderRadiusValue:B.oneMobileBorderRadiusValue,setOneMobileBorderRadiusValue:B.setOneMobileBorderRadiusValue,backgroundImageEmpty:x,backgroundRepeatOptions:j,backgroundSizeOptions:W,mobileBorders:h,elementViewType:p,mobileViewActive:g})," "]})};Ss.propTypes={elementSettings:f.default.object.isRequired,formName:f.default.string};var ft=({className:e=null,formSettings:i,emailElementType:l,formName:s})=>{const n=r.useDispatch(),d=r.useSendStyleToggleToIframe(),c=(0,a.useRef)(),p=r.useSelector(r.selectActiveSettingsTab),g=r.useSelector(r.selectElementSettings$1),m=r.useSelector(r.selectElementSettings),_=r.useContainer(),E=r.getComponentRegistry(_),b=l==="email"?g:m,h=b.type,k=h===r.ELEMENT_TYPES.CAROUSEL||h===r.ELEMENT_TYPES.IMG?i.settings:b,[x,T]=(0,a.useState)(k),[v,P]=(0,a.useState)(k);k!==v&&(P(k),T(k));const B=D=>{const z=D.data.operation,A=D.data.action;if(z===r.EVENT_TYPES.APPLICATION_ACTION){let j=function(W,Y=null){const ee={[W]:Y||!x[W]};d(ee,x.type),n(r.setEmailSettings(ee)),T(I=>({...I,...ee}))};var $=j;A==="toggle_strong"&&j("textStrong"),A==="toggle_italic"&&j("textItalic"),A==="toggle_underline"&&j("textUnderline"),A==="toggle_strikethrough"&&j("textStrikethrough"),A==="textAlign_left"&&j("textAlign","left"),A==="textAlign_right"&&j("textAlign","right"),A==="textAlign_center"&&j("textAlign","center")}};r.useListenPostMessage(B);const y=b;return(0,o.jsx)("div",{className:"selected-element-panel",children:(0,o.jsx)(r.CSSTransition,{nodeRef:c,in:p===r.PROPERTIES,timeout:300,classNames:"transition",children:(0,o.jsxs)("div",{ref:c,className:(0,Ke.default)("selected-element-panel-content",{[e]:e}),children:[i?.type==="advanced"&&i?.content?(0,o.jsx)(a.Fragment,{children:E.getReactElement(i.content)},i.instanceKey):null,(b.type===r.ELEMENT_TYPES.IMG||b.type===r.ELEMENT_TYPES.COUNTDOWN||b.type===r.ELEMENT_TYPES.VIDEO)&&(0,o.jsx)(Kr,{elementSettings:b}),b.type===r.ELEMENT_TYPES.TEXT&&(0,o.jsx)(Wn,{elementSettings:b}),b.type===r.ELEMENT_TYPES.LINK&&(0,o.jsx)(pl,{elementSettings:b}),b.type===r.ELEMENT_TYPES.TABLE&&(0,o.jsx)(ml,{elementSettings:b}),b.type===r.ELEMENT_TYPES.CUSTOM_TABLE&&(0,o.jsx)(Ss,{elementSettings:y,formName:s},y.customTable.tableKey),(b.type===r.ELEMENT_TYPES.TD||b.type===r.ELEMENT_TYPES.STRUCTURE||b.type===r.ELEMENT_TYPES.GROUP||b.type===r.ELEMENT_TYPES.COLUMN)&&(0,o.jsx)(Tl,{elementSettings:b}),b.type===r.ELEMENT_TYPES.VAR&&(0,o.jsx)(Ll,{elementSettings:b}),b.type===r.ELEMENT_TYPES.BUTTON&&(0,o.jsx)(Al,{elementSettings:b}),b.type===r.ELEMENT_TYPES.DIV&&(0,o.jsx)(wl,{elementSettings:b}),b.type===r.ELEMENT_TYPES.VINDENT&&(0,o.jsx)(gl,{elementSettings:b}),b.type===r.ELEMENT_TYPES.FLOAT_BLOCK&&(0,o.jsx)(Il,{elementSettings:b}),i.type===r.ELEMENT_TYPES.CAROUSEL&&(0,o.jsx)(Dl,{elementSettings:i}),i.type===r.ELEMENT_TYPES.ACCORDION&&(0,o.jsx)(Vl,{elementSettings:i}),i.type===r.ELEMENT_TYPES.SOCIAL&&(0,o.jsx)(ql,{elementSettings:i})]})})})};ft.propTypes={className:f.default.string,formName:f.default.string};var qc=["hover"],Jc={color:"#ff4d4f"},Bs=({index:e,count:i,iconStrokeWidth:l,onSwap:s,onRemove:n,onCopy:d,menu:c})=>{const{__:p}=r.useI18n();return(0,o.jsxs)(o.Fragment,{children:[e>0&&(0,o.jsx)(t.ui_kit$Tooltip,{title:p("Swap columns"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__swap",onClick:s,children:(0,o.jsx)(r.EmIcons,{icon:"SwapHorizontalIcon",component:t.icons$SwapHorizontalIcon,size:15,strokeWidth:l})})}),i>1&&(0,o.jsx)(t.ui_kit$Tooltip,{title:p("Delete column"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__remove",onClick:n,children:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:15,strokeWidth:l,style:Jc})})}),i<8&&(0,o.jsx)(t.ui_kit$Tooltip,{title:p("Copy column"),children:(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__controls__column__copy",onClick:d,children:(0,o.jsx)(r.EmIcons,{icon:"CopyOutlined",component:t.icons$CopyOutlined,size:15,strokeWidth:l})})}),(0,o.jsx)(t.ui_kit$Dropdown,{trigger:qc,menu:c,children:(0,o.jsx)("button",{type:"button","aria-label":p("Actions"),className:"selected-element-panel__columns-settings__controls__column__more",children:(0,o.jsx)(r.EmIcons,{icon:"EllipsisOutlined",component:t.icons$EllipsisOutlined,size:15,strokeWidth:l})})})]})},ah=30;function Ts(e,i){return i+1<e?i+1:0}function Qc(e,i=30){return e.map((l,s)=>{const n=Ts(e.length,s);return n===s?l:l+e[n]-i})}function Zc(e,i,l,s=30){if(!e||typeof e!="object")return null;const n=e,d=Object.keys(n).filter(m=>/^width-\d+$/.test(m)).length,c=Number(i.slice(6)),p=Ts(d,c);if(p===c)return null;const g=l-Object.keys(n).filter(m=>/^width-\d+$/.test(m)&&m!==i&&m!==`width-${p}`).reduce((m,_)=>m+(Number(n[_])||0),0)-s;return(Number(n[i])||0)<=g?null:(n[i]=g,g)}var Rs=({values:e,minimum:i,step:l,renderPanel:s,children:n,onDrag:d,onCommit:c})=>{const[p,g]=(0,a.useState)(null),m=(0,a.useRef)(null),_=p??e,E=_.reduce((v,P)=>v+P,0)||1,b=(0,a.useMemo)(()=>a.Children.toArray(n),[n]),h=(0,a.useCallback)(v=>m.current?jd(e,m.current,v,i,l):e,[e,i,l]),k=(0,a.useCallback)(v=>{m.current=v},[]),x=(0,a.useCallback)(v=>{const P=h(v);g(P),d?.(P)},[h,d]),T=(0,a.useCallback)(v=>{const P=h(v);m.current=null,g(null),P.some((B,y)=>B!==e[y])&&c(P)},[h,e,c]);return(0,o.jsx)(t.ui_kit$Splitter,{onResizeStart:k,onResize:x,onResizeEnd:T,children:_.map((v,P)=>(0,o.jsx)(t.ui_kit$Splitter.Panel,{size:`${v/E*100}%`,min:`${i/E*100}%`,children:s?s(P,v):b[P]},P))})},eu=e=>String(Math.round(e*10)/10),ou={marginBottom:0},tu={paddingTop:20},iu={marginBottom:20},ru=(e,i)=>i?.userTyping?i.input:e==null||e===""?"":String(Number(e));function Ko(){return!!document.querySelector(".selected-element-panel__columns-settings__links__add")?.closest(".selected-element-panel")}var ys=({emailElementType:e,isSelectedElement:i=!1,selectedElement:l={parent:!1}})=>{const{__:s}=r.useI18n(),n=r.useDispatch(),d=r.useSendPostMessage(),[c]=t.ui_kit$Form.useForm(),p=(0,a.useRef)(),g=(0,a.useRef)(),m=(0,a.useRef)(null),_=r.useSelector(r.selectElementSettings$1),E=r.useSelector(r.selectElementSettings),b=r.useAppConfig(),h=l||(e==="email"?_:E),[k,x]=(0,a.useState)(h.floatBlocks?.wrap),[T,v]=(0,a.useState)(h.floatBlocks?.dirRevers),[P,B]=(0,a.useState)(null),[y,D]=(0,a.useState)(0),[z,A]=(0,a.useState)([]),$=r.useSelector(r.selectEmailViewType),j=(0,a.useCallback)(oe=>{const Te=oe.floatBlocks&&h.floatBlocks?{...oe,floatBlocks:Sd(h.floatBlocks,oe.floatBlocks)}:oe;n(e==="email"?r.setElementSettings$1(Te):r.setElementSettings(Te))},[n,e,h.floatBlocks]);(0,a.useEffect)(()=>{if(h&&JSON.stringify(h)!=="{}"&&c._init){const Te=h.floatBlocks?.items.length??0;if(m.current!==Te&&(m.current=Te,c.resetFields()),c.setFieldsValue({gap:h.floatBlocks?.gap,gapMobile:h.floatBlocks?.gapMobile,mobileGap:h.floatBlocks?.mobile?.gap,gapDim:"px",valign:h.floatBlocks?.valign,mobileValign:h.floatBlocks?.mobileValign??h.floatBlocks?.valign}),h.floatBlocks?.items.length>0){let R=function(V,L){if(V.length!==L.length)return!1;for(let X=0;X<V.length;X++)if(V[X]!==L[X])return!1;return!0};var oe=R;const _e=h.floatBlocks.items.reduce((V,L)=>V+L.width,0),Ce=h.floatBlocks.items.map(V=>((V.width||0)/_e*100).toFixed(1));D(_e),!R(Ce,z)&&h.changeKey!=="gap"&&A(Ce),h.floatBlocks.items.forEach((V,L)=>c.setFieldsValue({["width-"+L]:V.width||0})),h.floatBlocks.items.length>=8?document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.add("noactive"):document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.contains("noactive")&&document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.remove("noactive")}x(h.floatBlocks?.wrap)}},[c,h,P,z]);let W=0;h.floatBlocks?.items.length>0&&(W=h.floatBlocks.items.length);const Y=k===!1?h.floatBlocks?.mobile??null:null,ee=$!=="mobile"||!!Y,I=W>1?(100-W*5)/(W-1):0,le=(oe,Te)=>{Object.keys(Te).forEach(_e=>{if(_e.includes("width")){const Ce=parseInt(_e.match(/\d+/));c.setFieldsValue({[_e]:oe.items[Ce]})}})},[ke,Ne]=(0,a.useState)(!1);(0,a.useEffect)(()=>{const oe=()=>Ne(!0),Te=()=>Ne(!1);return document.addEventListener("keyup",Te),document.addEventListener("keydown",oe),()=>{document.removeEventListener("keyup",Te),document.removeEventListener("keydown",oe)}},[]);const Q=oe=>{g.current&&ke&&clearTimeout(g.current),g.current=setTimeout(()=>Te(oe),50);function Te(_e){const Ce=c.getFieldsValue(!0),R=Object.keys(_e)[0];if(B(R),R.includes("width")){if(Ce[R]&&Ce[R]>=30){const V=Zc(Ce,R,y);V!==null&&c.setFieldsValue({[R]:V});let L={items:[],gap:Ce.gap,valign:Ce.valign,activateSection:i?void 0:"structure"},X=0;if(document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").length>1){X=parseFloat(Object.keys(_e)[0].substring(Object.keys(_e)[0].length-1));const ie=Ce["width-"+(X+1)]?X+1:0;let me=y;Object.keys(Ce).forEach(he=>{he.includes("width")&&he.indexOf("width-"+ie)===-1&&(me-=Ce[he])}),Ce["width-"+ie]=me}Object.keys(Ce).forEach(ie=>{ie.includes("width")&&L.items.push(Ce[ie])}),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:L}),j({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...L,items:h.floatBlocks.items.map((ie,me)=>({...h.floatBlocks.items[me],width:L.items[me]}))},changeKey:R})}}else if(R==="gap"){const V={items:h.floatBlocks.items.map(me=>me.width),gap:h.floatBlocks.gap},L=V.items.reduce((me,he)=>me+he,0)+(V.items.length-1)*V.gap,X=Ce.gap,ie=L-(V.items.length-1)*X;if(ie>V.items.length*30||h.floatBlocks.gap-_e>=0){const me=(G,re)=>Math.round(re*G/100);let he=V.items.map((G,re)=>me(z[re],ie));const $e=L-(he.reduce((G,re)=>G+re,0)+(V.items.length-1)*X);if($e!==0){const G=he.length-Math.abs($e);he=he.map((re,O)=>G<=O?re+($e>0?1:-1):re)}let je={items:he,gap:X||0};le(je,Ce),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGap",settings:je,editFromStructure:Ko()}),j({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...je,items:h.floatBlocks.items.map((G,re)=>({...G,width:je.items[re]}))},changeKey:R})}}else if(R==="mobileValign"){const V=xd(_e,R);if(V===null)return;d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksMobileValign",settings:{valign:V}}),j({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,mobileValign:V},changeKey:R})}else if(R==="valign"){let V={valign:Ce.valign};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksValign",settings:V,editFromStructure:Ko()}),j({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...V},changeKey:R})}else if(R==="mobileGap"){const V=kd(_e,R);if(V===null)return;d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksMobileGap",settings:{gap:V}}),j({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,mobile:Rd(h.floatBlocks,V)},changeKey:R})}else if(R==="gapMobile"){let V={mobileHeight:{classNamePrefix:"em-mob-height-",value:_e[R],dim:"px"}};d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGapMobile",settings:V}),j({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,gapMobile:V.mobileHeight.value},changeKey:R})}setTimeout(()=>p?.current&&p.current.focus({cursor:"end"}),600)}},fe=(0,a.useMemo)(()=>(h.floatBlocks?.items??[]).map(oe=>oe.width||0),[h.floatBlocks?.items]),Ae=(0,a.useMemo)(()=>Qc(fe),[fe]),ne=(0,a.useCallback)(oe=>oe.forEach((Te,_e)=>c.setFieldsValue({["width-"+_e]:Te})),[c]),Fe=(0,a.useCallback)(oe=>{const Te=c.getFieldsValue(!0),_e={items:oe,gap:Te.gap,valign:Te.valign,activateSection:i?void 0:"structure"};ne(oe),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:_e}),j({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,..._e,items:h.floatBlocks.items.map((Ce,R)=>({...Ce,width:oe[R]}))},changeKey:"width"})},[h,c,j,i,d,ne]),Le=(0,a.useCallback)(oe=>{d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksMobileWidths",settings:{items:oe}}),j({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,mobile:Td(h.floatBlocks,oe)},changeKey:"mobileWidths"})},[h,j,i,d]),Ue=(0,a.useCallback)(()=>{d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksMobileReset",settings:{}}),j({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,mobile:yd(h.floatBlocks)},changeKey:"mobileWidths"})},[h,j,i,d]),ve=()=>{const oe=c.getFieldsValue(!0),Te=h.floatBlocks.items.map(ie=>ie.width);let _e={items:[],gap:oe.gap};const Ce=Te.reduce((ie,me)=>ie+me,0),R=Te.length,V=Math.ceil(y/R)*R,L=V/R,X=Ce-V;if(_e.items=Array(R).fill(L),X!==0){const ie=Te.length-Math.abs(X);_e.items=_e.items.map((me,he)=>ie<=he?me+(X>0?1:-1):me)}le(_e,oe),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:_e,editFromStructure:Ko()}),j({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,..._e,items:h.floatBlocks.items.map((ie,me)=>({...ie,width:_e.items[me]}))},changeKey:"width"})},Be=oe=>{const Te=c.getFieldsValue(!0),_e=h.floatBlocks.items.map(je=>je.width),Ce=h.floatBlocks.gap||20,R=oe.cols-_e.length;let V=[],L=_e.reduce((je,G)=>je+G,0);oe.cols>=_e.length?L-=Ce*R:L+=Ce*Math.abs(R);const X=Math.round(L/oe.cols);function ie(je,G){const re=[];for(let O=0;O<je;O++)re.push(oe.width?.[O]?Math.round(L/100*oe.width?.[O]):G);return re}V=ie(oe.cols,X);const me=L-V.reduce((je,G)=>je+G,0);if(me!==0){let je=V.map((re,O)=>[O,re]).filter(re=>re[1]>30);const G=je.length-Math.abs(me);je=je.map((re,O)=>{const pe=G<=O?re[1]+(me>0?1:-1):re[1];return[re[0],pe]}),je.map(re=>(V[re[0]]=re[1],re))}let he={items:V,gap:Te.gap||20};const $e=V.reduce((je,G)=>je+G,0);A(V.map(je=>(je/$e*100).toFixed(1))),d({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksPreset",settings:he,editFromStructure:Ko()}),j({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,...he,items:he.items.map((je,G)=>({width:je,current:!1}))},changeKey:"width"})},xe=()=>{const oe=c.getFieldsValue(!0);if(W<8){const Te=h.floatBlocks.items.map(ie=>ie.width),_e=h.floatBlocks.gap,Ce=Te.reduce((ie,me)=>ie+(me>30?me:0),0),R=(Ce-30-_e)/Ce,V=Te.map(ie=>ie>30?Math.round(ie*R):ie).reduce((ie,me)=>ie+(me>30?me:0),0);let L=Te.map(ie=>ie>30?Math.round(ie*R):ie);L.push(30);const X=Ce-V-30-_e;if(X!==0){let ie=L.map((he,$e)=>[$e,he]).filter(he=>he[1]>30);const me=ie.length-Math.abs(X);ie=ie.map((he,$e)=>{const je=me<=$e?he[1]+(X>0?1:-1):he[1];return[he[0],je]}),ie.map(he=>(L[he[0]]=he[1],he))}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_ADD,settings:{gap:oe.gap,gapMobile:oe.gapMobile,minWidth:30},editFromStructure:Ko()}),j({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,items:L.map((ie,me)=>({width:ie,current:h.floatBlocks.items[me]?.current||!1}))},changeKey:"width"})}else document.querySelector(".selected-element-panel__columns-settings__links__add")?.classList.add("noactive")},ce=oe=>{const Te=c.getFieldsValue(!0);let _e=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((je,G)=>{je===oe.target.closest(".selected-element-panel__columns-settings__controls__column")&&(_e=G)});const Ce=+h.floatBlocks.gap,R=+h.floatBlocks.items[_e].width+Ce,V=h.floatBlocks.items.map(je=>+je.width),L=(V.length-1)*Ce,X=V.reduce((je,G)=>je+G,0)+L,ie=V.length-1,me=Math.floor(R/ie);let he=V.filter((je,G)=>G!==_e).map(je=>je+me);const $e=X-(he.reduce((je,G)=>je+G,0)+(V.length-2)*Ce);if($e!==0){const je=he.length-Math.abs($e);he=he.map((G,re)=>je<=re?G+($e>0?1:-1):G)}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_REMOVE,settings:{removedBlockIndex:_e,gap:Te.gap},editFromStructure:Ko()}),j({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,items:he.map((je,G)=>({width:je,current:h.floatBlocks.items.filter((re,O)=>O!==_e)[G].current}))},changeKey:"width"})},be=oe=>{if(W>=8)return;const Te=c.getFieldsValue(!0);let _e=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((re,O)=>{re===oe.target.closest(".selected-element-panel__columns-settings__controls__column")&&(_e=O)});const Ce=parseFloat(Te.gap)||0,R=h.floatBlocks.items.map(re=>+re.width),V=R[_e],L=R.reduce((re,O)=>re+O,0),X=L-Ce,ie=L+V,me=ie>0?X/ie:1;let he=[];const $e=[];R.forEach((re,O)=>{he.push(Math.max(30,Math.round(re*me))),$e.push(h.floatBlocks.items[O]?.current||!1),O===_e&&(he.push(Math.max(30,Math.round(V*me))),$e.push(!1))});const je=X-he.reduce((re,O)=>re+O,0);if(je!==0){let re=he.map((pe,ye)=>[ye,pe]).filter(pe=>pe[1]>30);const O=re.length-Math.abs(je);re=re.map((pe,ye)=>[pe[0],O<=ye?pe[1]+(je>0?1:-1):pe[1]]),re.forEach(pe=>he[pe[0]]=pe[1])}d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_COPY,settings:{copiedBlockIndex:_e,gap:Te.gap,widths:he},editFromStructure:Ko()});const G=he.reduce((re,O)=>re+O,0);A(he.map(re=>(re/G*100).toFixed(1))),j({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,items:he.map((re,O)=>({width:re,current:$e[O]||!1}))},changeKey:"width"})},ue=(0,a.useCallback)(oe=>{const Te=".selected-element-panel__columns-settings__controls__column",_e=Array.from(document.querySelectorAll(Te)).indexOf(oe.target.closest(Te)),Ce=_e-1;if(Ce<0)return;const{floatBlocks:R}=h,V=R.items.map(({width:L,current:X})=>({width:L,current:X||!1}));[V[Ce],V[_e]]=[V[_e],V[Ce]],d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_SWAP,settings:{indexA:Ce,indexB:_e},editFromStructure:Ko()}),j({...h,activateSection:i?void 0:"structure",floatBlocks:{...R,items:V,mobile:wd(R.mobile,Ce,_e)},changeKey:"width"})},[h,j,i,d]),q=oe=>{x(oe),d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_WRAP,settings:{wrap:!k}}),j({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,wrap:!k,mobile:Bd(h.floatBlocks,!k)},changeKey:"wrap"})},Z=oe=>{v(oe),d({operation:r.EVENT_TYPES.SANDBOX_FLOATBLOCK_DIR,settings:{dirRevert:!T}}),j({...h,activateSection:i?void 0:"structure",floatBlocks:{...h.floatBlocks,dirRevert:!T},changeKey:"dir"})},te=(0,a.useMemo)(()=>(h.floatBlocks?.items??[]).map((oe,Te)=>({items:[{key:"copy",label:s("Copy column"),disabled:W>=8},{key:"remove",label:s("Delete column"),danger:!0}],onClick:({key:_e})=>{const Ce={target:document.querySelectorAll(".selected-element-panel__columns-settings__controls__column")[Te]};return _e==="copy"?be(Ce):ce(Ce)}})),[h.floatBlocks?.items,W,s]),ae=(0,a.useCallback)(()=>{const oe=h.floatBlocks?.mobile;if(!oe)return;const Te=oe.items.reduce((_e,Ce)=>_e+Ce,0);Le(oe.items.map(()=>Te/oe.items.length))},[h.floatBlocks?.mobile,Le]),de=(0,a.useCallback)((oe,Te)=>(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__controls__column"+(h.floatBlocks?.items[oe]?.current?" current":""),children:[(0,o.jsx)(Bs,{index:oe,count:h.floatBlocks?.items.length??0,iconStrokeWidth:b.iconStrokeWidth,onSwap:ue,onRemove:ce,onCopy:be,menu:te[oe]}),(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__controls__field selected-element-panel__columns-settings__mobile-column",children:[eu(Te),"%"]})]}),[h.floatBlocks?.items,b.iconStrokeWidth,te]),De=()=>setTimeout(()=>p?.current&&p.current.focus({cursor:"end"}),300);return h.floatBlocks&&h.floatBlocks.items.length>0&&(0,o.jsx)(t.ui_kit$Form,{layout:"vertical",form:c,name:"float_blocks_settings_form",autoComplete:"off",initialValues:{gap:h.floatBlocks?.gap||0,gapDim:"px",gapMobile:h.floatBlocks?.gapMobile||0,mobileGap:h.floatBlocks?.mobile?.gap??0,valign:h.floatBlocks?.valign||"top",mobileValign:h.floatBlocks?.mobileValign??(h.floatBlocks?.valign||"top"),...h.floatBlocks?.items.reduce((oe,{width:Te},_e)=>(oe[`width-${_e}`]=Te,oe),{})},onValuesChange:Q,onFieldsChange:De,className:"element-controls",children:(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings"+($==="mobile"?" selected_form-mobile-props":""),style:{paddingTop:b.switchDesktopMobilePropsEnabled||b.stepToOtherElementEnabled||b.deleteButtonEnabled||h.type==="structure"?0:24},children:[h.floatBlocks.items.length===1&&(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:10},title:s('The selected element is in the block that supports a multicolumn structure. To add a new column, click the "Add a column" button.'),type:"info"}),$!=="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:xe,children:[(0,o.jsx)(r.EmIcons,{icon:"PlusCircleOutlined",component:t.icons$PlusCircleOutlined,size:16,strokeWidth:b.iconStrokeWidth})," ",s("Add column")]}),h.floatBlocks.items.length>1&&(0,o.jsx)("span",{onClick:ve,children:(0,o.jsxs)(t.ui_kit$Tooltip,{title:s("Make columns the same width."),children:[(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined})," ",s("Equalize")]})})]})]}),h.floatBlocks.items.length>1&&(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:16},children:(0,o.jsx)("div",{className:"selected-element-panel__columns-settings__controls",children:(0,o.jsx)(Rs,{values:fe,minimum:30,step:1,onDrag:ne,onCommit:Fe,children:h.floatBlocks.items.map((oe,Te)=>(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__controls__column "+(oe.current?"current":""),children:[(0,o.jsx)(Bs,{index:Te,count:h.floatBlocks.items.length,iconStrokeWidth:b.iconStrokeWidth,onSwap:ue,onRemove:ce,onCopy:be,menu:te[Te]}),(0,o.jsx)("div",{className:"selected-element-panel__columns-settings__controls__field",children:(0,o.jsx)(t.ui_kit$Form.Item,{label:"",name:"width-"+Te,children:(0,o.jsx)(t.ui_kit$InputNumber,{min:30,max:Ae[Te],value:oe.width||0,placeholder:s("Width"),ref:P==="width-"+Te&&p})})})]},"floatblock-"+Te))})})}),(0,o.jsxs)("div",{className:"columns-presets",children:[(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{Be({cols:1})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol1",component:t.icons$LayoutCol1})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{Be({cols:2})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol2",component:t.icons$LayoutCol2})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{Be({cols:2,width:[66,34]})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol2WideLeft",component:t.icons$LayoutCol2WideLeft})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{Be({cols:2,width:[34,66]})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol2WideRight",component:t.icons$LayoutCol2WideRight})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{Be({cols:3})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol3",component:t.icons$LayoutCol3})}),(0,o.jsx)(t.ui_kit$Button,{onClick:()=>{Be({cols:4})},children:(0,o.jsx)(r.EmIcons,{icon:"LayoutCol4",component:t.icons$LayoutCol4})})]})]}),h.floatBlocks.items.length>1&&(0,o.jsxs)(o.Fragment,{children:[$==="mobile"&&(0,o.jsx)("div",{style:{marginBottom:24},children:(0,o.jsx)(t.ui_kit$Switch,{id:"column-wrap",label:s("Line break on mobile devices"),size:"small",disabled:h.floatBlocks?.wrap===void 0,checked:k,onChange:q,labelStyle:{position:"relative",top:2}})}),$==="mobile"&&Y&&(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__mobile",children:[(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__header",children:[(0,o.jsx)("span",{className:"selected-element-panel__columns-settings__header-title",children:s("Columns")}),(0,o.jsxs)("div",{className:"selected-element-panel__columns-settings__links",children:[(0,o.jsx)("button",{type:"button",className:"selected-element-panel__columns-settings__links__add",onClick:xe,children:(0,o.jsxs)("span",{children:[(0,o.jsx)(r.EmIcons,{icon:"PlusCircleOutlined",component:t.icons$PlusCircleOutlined,size:16,strokeWidth:b.iconStrokeWidth})," ",s("Add column")]})}),(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Make columns the same width."),children:(0,o.jsx)("button",{type:"button",onClick:ae,children:(0,o.jsxs)("span",{children:[(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined})," ",s("Equalize")]})})})]})]}),(0,o.jsx)("div",{className:"selected-element-panel__columns-settings__controls",children:(0,o.jsx)(Rs,{values:Y.items,minimum:5,step:.01,onCommit:Le,renderPanel:de})}),!Y.linked&&(0,o.jsx)("div",{className:"selected-element-panel__columns-settings__links",children:(0,o.jsx)("button",{type:"button",onClick:Ue,children:(0,o.jsxs)("span",{children:[(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined})," ",s("Same as desktop")]})})})]}),$!=="mobile"&&(0,o.jsx)("div",{style:{marginBottom:24},children:(0,o.jsx)(t.ui_kit$Switch,{id:"column-dir-revers",label:s("Reverse order on desktop"),size:"small",disabled:h.floatBlocks?.wrap===void 0,checked:T,onChange:Z,labelStyle:{position:"relative",top:2}})})]}),h.floatBlocks.items.length>1&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[ee&&(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:Y&&$==="mobile"?"mobileValign":"valign",style:ou,children:(0,o.jsx)(t.ui_kit$FormVerticalAlignControl,{disabled:h.floatBlocks.items.length<=1,strokeWidth:b.iconStrokeWidth,labels:{alignTop:s("Align top"),alignMiddle:s("Center vertically"),alignBottom:s("Align bottom")}})})})}),(0,o.jsxs)(o.Fragment,{children:[$!=="mobile"&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:s("Indent between columns"),titleStyle:{paddingTop:20},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gap",style:{marginBottom:20},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,disabled:h.floatBlocks.items.length<=1,placeholder:s("Indent between columns"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px",ref:P==="gap"&&p})})})}),$==="mobile"&&Y&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:s("Indent between columns"),titleStyle:tu,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"mobileGap",style:iu,children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,max:I,step:.5,dragStep:.5,dragspeed:.1,formatter:ru,placeholder:s("Indent between columns"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"%"})})})}),$==="mobile"&&!Y&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:s("Indent in mobile"),titleStyle:{paddingTop:20},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"gapMobile",style:{marginBottom:20},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,disabled:h.floatBlocks.items.length<=1,placeholder:s("Indent in mobile"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnHeightOutlined",component:t.icons$ColumnHeightOutlined}),addonAfter:"px"})})})})]})]})]})]})})};ys.propTypes={selectedElement:f.default.shape({parent:f.default.string})};var lu=()=>{},ws=({email:e,formSettings:i={},onClosePanel:l=lu})=>{const{__:s}=r.useI18n(),n=r.useRootElement(),d=r.useDispatch(),c=r.useSendPostMessage(),p=Object.prototype.hasOwnProperty.call(e,"type")?r.BLOCK:r.EMAIL,g=r.useSelector(r.selectElementSettings$1),m=r.useSelector(r.selectElementSettings),_=r.useSelector(r.selectPropertiesPanelKey),E=p==="email"?g:m,b=Object.keys(i).length>0?i.settings:E,h=i?.type==="advanced"&&!!i?.content,k=!!i?.extraTabs?.length,x=r.useAppConfig(),T=b.type==="customTable",v=r.useInspectorTabs(b.type||i.type,T),P=(0,a.useCallback)(le=>{v.activate(le),d(r.setPropertiesPanelKey(le||""))},[v,d]),B=!!b.type&&!!b.floatBlocks?.items.length>0&&!!b.floatBlocks?.items.filter(le=>!!le.width).length>0,y=(0,a.useRef)(null),D=(0,a.useRef)(_);D.current=_,(0,a.useEffect)(()=>{const le=Object.values(r.ELEMENT_TYPES),ke=b.type&&le.includes(b.type)?`${b.type}-${JSON.stringify(b.path||[])}`:null;if(h||k){const Ne=n.querySelector(".email-pane .panel-form__body");Ne&&(Ne.scrollTop=0),d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else if(b.type&&le.includes(b.type)){const Ne=y.current!==ke;if(y.current=ke,b.activateSection!=="structure"){if(Ne){const Q=n.querySelector(".email-pane .panel-form__body");Q&&(Q.scrollTop=0)}r.keepsInspectorTab(String(D.current??""),Ne)||d(r.setPropertiesPanelKey(r.EDIT_SELECTED_ELEMENT))}else d(r.setPropertiesPanelKey(r.STRUCTURE))}else JSON.stringify(b)!=="{}"&&(y.current=null,d(r.setPropertiesPanelKey("")))},[b,d,n,h,k]);const z=(0,a.useMemo)(()=>{const le=[{key:r.EDIT_SELECTED_ELEMENT,label:(0,o.jsx)("span",{style:{textTransform:"capitalize"},children:b.caption?b.caption:s("Edit element")})}];return B&&le.push({key:r.STRUCTURE,label:s("Columns")}),le},[b.caption,B,s]),A=(0,a.useMemo)(()=>[...z,...v.tabs.map(({key:le,label:ke})=>({key:le,label:ke}))],[z,v.tabs]),$=(0,a.useMemo)(()=>[{key:r.EDIT_SELECTED_ELEMENT,label:s("Cell")},{key:r.TABLE_PROPERTIES,label:s("Table")}],[s]),j=le=>{le.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_REMOVE}),d(p==="email"?r.setElementSettings$1({}):r.setElementSettings({}))},W=le=>{le.stopPropagation(),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_PARENT_GET})},Y=()=>{l(b),d(r.resetToLastActiveSettingsTab()),setTimeout(()=>{d(p==="block"?r.setElementSettings({type:null}):r.setElementSettings$1({type:null}))},300),c({operation:r.EVENT_TYPES.SANDBOX_ELEMENT_ACTIVE_RESET})},ee=(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:j,disabled:!b.deletable,icon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:18,strokeWidth:x.iconStrokeWidth})})}),x.stepToOtherElementEnabled&&(0,o.jsx)(t.ui_kit$Tooltip,{title:s("Up to parent element"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Button,{type:"text",onClick:W,disabled:!b.parent,icon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"GoToParent",component:t.icons$GoToParent,size:18,strokeWidth:x.iconStrokeWidth})})})]}),I=x.switchDesktopMobilePropsEnabled||x.stepToOtherElementEnabled||x.deleteButtonEnabled;return(0,o.jsxs)(t.ui_kit$PanelForm,{children:[(0,o.jsx)(t.ui_kit$PanelForm.Header,{onClose:Y,closeIcon:(0,o.jsx)(t.ui_kit$EmIcons,{icon:"Close",component:t.icons$Close,size:24,strokeWidth:x.iconStrokeWidth}),extra:I?ee:void 0,children:(0,o.jsx)(t.ui_kit$Tabs,{items:T?$:A,activeKey:_,onChange:P})}),(0,o.jsx)(t.ui_kit$PanelForm.Body,{children:T?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{display:_==="Edit selected element"?void 0:"none"},children:(0,o.jsx)(ft,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:p,formName:`${r.EDIT_SELECTED_TABLE_CELLS}`})}),(0,o.jsx)("div",{style:{display:_==="Table properties"?void 0:"none"},children:(0,o.jsx)(ft,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:p,formName:`${r.TABLE_PROPERTIES}`})})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{style:{display:_==="Edit selected element"?void 0:"none"},children:(0,o.jsx)(ft,{className:"email-properties__collapse-panel selected-element-panel__content",formSettings:i,emailElementType:p})}),B&&(0,o.jsx)("div",{style:{display:_==="Structure"?void 0:"none"},children:(0,o.jsx)(ys,{selectedElement:b,emailElementType:p,isSelectedElement:!1})}),v.tabs.map(le=>(0,o.jsx)("div",{className:le.className,hidden:_!==le.key,children:le.children},le.key))]})})]})},su=({taxonomy:e})=>{const{__:i,_x:l}=r.useI18n(),s=r.useDispatch(),[n]=t.ui_kit$Form.useForm(),d=(0,a.useRef)(null),c=r.useSelector(r.selectActiveModal$1)===r.MODALS.ADD_NEW_GROUP_MODAL,p=r.useNotification(),g=r.useProjectData(),m=(0,a.useCallback)(()=>{n.resetFields(),setTimeout(()=>d.current?.focus({cursor:"start"}),0)},[n]);(0,a.useEffect)(()=>{c&&m()},[c,m]);const _=()=>s(r.closeModal$1()),[E,b]=r.useAddTermMutation(),[h,k]=(0,a.useState)(!1),x=()=>{n.validateFields().then(({name:T})=>(k(!0),E({project:g,kind:"group",name:T}).then(v=>{if("error"in v){p.error(v);return}p.success({title:i("The group “")+v.data.name+l("” was successfully created.",e)}),_()}))).catch(T=>{}).finally(()=>k(!1))};return(0,o.jsx)(t.ui_kit$Modal,{title:i("Add a new group"),open:c,onOk:x,onCancel:_,className:"new-group-modal",footer:[(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"large",loading:b.isLoading||h,onClick:x,children:i("Create group")},"submit")],children:(0,o.jsx)(t.ui_kit$Form,{form:n,layout:"vertical",name:"add_new_group_form",onFinish:x,initialValues:{remember:!1,name:""},autoComplete:"off",style:{paddingTop:10},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"name",rules:[{required:!0,message:i("Please enter the group name")}],children:(0,o.jsx)(t.ui_kit$Input,{disabled:b.isLoading,size:"large",placeholder:i("Enter the group name"),ref:d,style:{marginBottom:5}})})})})},au=({group:e,refetch:i})=>{const{__:l,_x:s}=r.useI18n(),n=r.useDispatch(),[d]=t.ui_kit$Form.useForm(),c=(0,a.useRef)(null),p=r.useSelector(r.selectActiveModal$1)===r.MODALS.EDIT_GROUP_NAME_MODAL,g=r.useNotification(),{id:m=null,name:_=""}=e,E=()=>n(r.closeModal$1()),[b,h]=r.useEditTermMutation();(0,a.useEffect)(()=>{p&&d.setFieldsValue({name:_})},[p,_,d]);const k=()=>{d.validateFields().then(({name:x})=>{b({kind:"group",id:m,name:x}).then(({data:T,error:v})=>{v?(g.error({error:v}),d.setFieldValue("name",x)):(i().then(({data:P})=>{if(P){const B=P[0]?.children?.find(y=>y.id===m)?.name;d.setFieldValue("name",B)}}),E(),g.success({title:l("The group “")+x+s("” was successfully changed to “","group")+T.name+l("”.")}))})})};return(0,o.jsx)(t.ui_kit$Modal,{title:l("Change group name"),open:p,onOk:k,onCancel:E,className:"new-group-name-modal",footer:[(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"large",loading:h.isLoading,onClick:k,children:l("Change name")},"submit")],children:(0,o.jsx)(t.ui_kit$Form,{form:d,layout:"vertical",name:"rename_group_form",onFinish:k,initialValues:{remember:!1,name:_},autoComplete:"off",style:{paddingTop:10},children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"name",rules:[{required:!0,message:l("Please enter the group name")}],children:(0,o.jsx)(t.ui_kit$Input,{disabled:h.isLoading,size:"large",placeholder:l("Enter the group name"),ref:c,style:{marginBottom:5}})})})})},Gi={width:"100%"},nu=["hover"],du={color:"#ff4d4f"},cu={color:t.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0},uu=({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:du,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:nu,children:(0,o.jsx)("span",{className:"groups-management__actions",children:(0,o.jsx)(r.EmIcons,{icon:"MoreOutlined",component:t.icons$MoreOutlined})})})})},mu=({className:e,levels:i,readOnlyLevels:l=!1,levelsRead:s=!1,refetchProjectGroups:n,isLoading:d})=>{const{__:c,_x:p}=r.useI18n(),g=r.useDispatch(),m=r.useNotification(),{modal:_}=t.ui_kit$App.useApp(),{confirm:E}=_,{token:b}=(0,t.ui_kit$useToken)(),h=r.useSelector(r.selectProjectGroups),k=i??h,[x]=r.useDeleteTermMutation(),[T,v]=(0,a.useState)({id:null,name:""}),P=(0,a.useCallback)((A,$)=>{x({kind:"group",id:Number(A)}).unwrap().then(j=>{j?.deleted&&m.success({title:c("The group “")+$+p("” was successfully deleted.","recovery")})}).catch(j=>{m.error({error:j})})},[x,m,c,p]),B=(0,a.useCallback)(A=>{const $=A.name??"";E({mask:{closable:!0},centered:!0,title:p("Are you sure to delete “","group")+$+c("” group and all nested groups?"),icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:22,style:cu}),okText:c("Yes"),cancelText:c("No"),onOk:()=>P(String(A.id),$)})},[E,P,c,p]),y=(0,a.useCallback)(A=>{g(r.openModal$1(r.MODALS.EDIT_GROUP_NAME_MODAL)),v({id:A.id,name:A.name??""})},[g]),D=(0,a.useMemo)(()=>({marginBottom:b.formItemMarginBottomMD}),[b]),z=(0,a.useCallback)(()=>{g(r.openModal$1(r.MODALS.ADD_NEW_GROUP_MODAL))},[g]);return(0,o.jsxs)("div",{className:(0,Ke.default)("groups-management",{[e]:e}),children:[d?(0,o.jsx)(t.ui_kit$Skeleton,{active:!0}):(0,o.jsxs)(t.ui_kit$Row,{children:[!!k?.length&&k?.map((A,$)=>(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:`group_${A.id}`,style:{marginBottom:b.formItemMarginBottomMD},label:(0,o.jsxs)(t.ui_kit$Flex,{justify:"space-between",align:"center",style:Gi,children:[(0,o.jsx)("span",{children:A.name}),!l&&(0,o.jsx)(uu,{level:A,onRename:y,onRemove:B})]}),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:Gi,placeholder:c(l?"Select a category":"Type category here"),options:A.children?.map(j=>({label:j.name,value:String(j.id)})),tagRender:j=>{const{label:W,closable:Y,onClose:ee}=j,I=le=>{le.preventDefault(),le.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:b.colorPrimary,onMouseDown:I,closable:Y,onClose:ee,style:{borderRadius:6},children:W})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})},A.id)),l&&s&&!k?.length&&(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Text,{type:"secondary",style:D,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:D,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:Gi,onClick:z,children:c("Add group")})})})]}),(0,o.jsx)(su,{taxonomy:r.ELEMENT_TYPES.GROUP}),(0,o.jsx)(au,{group:T,refetch:n})]})};function pu(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:Yi,description:si,tags:ai,type:Xi,is_template:hu,group:js}={title:"title",description:"description",tags:"tags",type:"type",is_template:"is_template",group:"group"},bu={[Yi]:"",[si]:"",[ai]:[],[hu]:!1},gu={[si]:"",[ai]:[],[Xi]:""};function fu(e){const i=new Set;return e?.filter(l=>i.has(l.name)?!1:(i.add(l.name),!0))}var _u=e=>Array.isArray(e)&&e.length>0,vs=({className:e="",element:i})=>{const{__:l}=r.useI18n(),s=r.useDispatch(),n=r.useEmailAttributesWriter(),[d]=t.ui_kit$Form.useForm(),{token:c}=(0,t.ui_kit$useToken)(),p=r.useAppConfig(),g=r.useEditorLocked(),m=r.useEditorLockCheck(),_=r.useSelector(r.selectProjectGroups),{data:E}=r.useGetBlockTypesQuery(),b=r.useProjectData(),h=i.hasOwnProperty("type")?r.BLOCK:r.EMAIL,k=i.hasOwnProperty("type")?r.BLOCK_TAGS:r.EMAIL_TAGS,{emailsOnV2:x,projectSections:T,projectSectionsLoading:v}=pu(b?.id),{data:P,refetch:B,isLoading:y,isFetching:D,isUninitialized:z,isSuccess:A}=r.useGetTermsQuery({project:b,kind:"group"},{skip:x||!b?.id}),$=(0,a.useMemo)(()=>x?T??[]:_,[x,T,_]);(0,a.useEffect)(()=>{P&&s(r.projectGroupsLoaded(P,h==="email"?i.group??[]:void 0))},[s,P,h,i.group]),(0,a.useEffect)(()=>{!z&&B()},[z,B]),(0,a.useEffect)(()=>{if(!x||!i.is_template)return;const ve=new Set(i.projectCategories??[]),Be={};let xe=!1;for(const ce of T??[]){const be=`group_${ce.id}`,ue=(ce.children??[]).filter(Z=>ve.has(String(Z.id))).map(Z=>String(Z.id)),q=d.getFieldValue(be);(!q||q.length!==ue.length||ue.some((Z,te)=>q[te]!==Z))&&(xe=!0),Be[be]=ue}xe&&d.setFieldsValue(Be)},[d,x,i.is_template,i.projectCategories,T]);const[j,W]=(0,a.useState)([]),[Y,ee]=(0,a.useState)([]),I=!!i.is_template,le=r.useProjectData();(0,a.useEffect)(()=>{!z&&B()},[i.group,B,z]),(0,a.useEffect)(()=>{if(A&&i.is_template&&_u(i.group)){const ve=i.group;let Be={};ve.length&&_.length&&ve?.forEach(ce=>{_?.forEach(be=>{let ue=be.children.find(q=>q.id===ce);ue&&(Be.hasOwnProperty(be.id)||(Be[be.id]=[]),Be[be.id].push({label:ue.name,value:ue.id}))})});let xe={};for(let ce in Be)Be.hasOwnProperty(+ce)&&(xe[`group_${ce}`]=Be[ce].map(be=>({...be,value:String(be.value)})));d.setFieldsValue(xe)}},[d,_,i.is_template,i.group,A]);const{data:ke,isFetching:Ne,refetch:Q}=r.useGetTermsQuery({project:le,kind:k},{skip:!le?.id});(0,a.useEffect)(()=>{ee(fu(ke)?.map(ve=>({value:ve.name,key:ve.id})))},[ke]),(0,a.useEffect)(()=>{if(i){const ve=r.getTaxonomy(i,k)??[],Be=ke??[],xe=ve.map(ue=>ue.name??""),ce=i.emailtags||i.blocktags||[],be=ve.concat(Be).filter(ue=>ce.some(q=>r.sameTermId(ue.id,q))).map(ue=>ue.name??"");d.setFieldsValue({title:i.title,description:i.description,tags:Array.isArray(i.tags)?i.tags:be.length?Array.from(new Set(be)):xe,type:i.type,is_template:!!i.is_template})}},[d,i,k,ke]);const fe=(0,a.useMemo)(()=>{if(!(h==="email"?x:r.isBlocksV2Enabled())||!i)return[];const ve=r.getTaxonomy(i,k)??[],Be=ke??[],xe=[...ve,...Be];return((h==="email"?i.emailtags:i.blocktags)??[]).filter(ce=>!xe.some(be=>be.name&&r.sameTermId(be.id,ce)))},[x,h,i,k,ke]),[Ae,ne]=(0,a.useState)(void 0),Fe=!Array.isArray(i?.tags);(0,a.useEffect)(()=>{Fe&&fe.length&&le?.id&&!Ne&&Ae!==i?.id&&(ne(i?.id),Q())},[Fe,fe.length,le?.id,Ne,Ae,i?.id,Q]);const Le=Fe&&fe.length>0&&(ke===void 0||Ne||Ae!==i?.id),Ue=ve=>{if(m())return;const Be=Object.keys(ve)[0],xe=ve,ce=Be.split("_")[0];if(ce===Yi)n({title:xe[Be]});else if(ce===si)n({description:xe[Be]});else if(ce===ai){const be=xe[Be],ue=h==="email"&&(be?.length??0)===0;n({tags:(be??[]).map(q=>q.trim()),...ue?{emailtags:[]}:{}})}else ce==="is"?n({is_template:xe[Be]}):ce===Xi&&h==="block"&&n({type:xe[Be]});switch(Be.split("_")[0]){case js:if(x){const be=new Set((T??[]).flatMap(te=>(te.children??[]).map(ae=>String(ae.id)))),ue=d.getFieldsValue(!0),q=Object.keys(ue).filter(te=>te.startsWith(`${js}_`)).flatMap(te=>ue[te]??[]).map(String).filter(te=>be.has(te)),Z=(i.projectCategories??[]).map(String).filter(te=>!be.has(te));n({projectCategories:[...new Set([...Z,...q])]});break}s(r.setEmailGroups({[Be.split("_")[1]]:ve[Be]}));break;default:return}};return(0,a.useEffect)(()=>{if(E){const ve=E;let Be=[];const xe={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 ce in ve)Be.push({label:xe[ve[ce]],value:ve[ce]});W(Be)}},[E,l]),(0,o.jsx)("div",{className:(0,Ke.default)("settings-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"settings_panel_form",initialValues:h==="email"?{EmailInitialValues:bu}:gu,onValuesChange:Ue,autoComplete:"off",disabled:g,children:[p.subjectEnabled&&h==="email"&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Title"),name:Yi,tooltip:{title:l("The title of the email is displayed in the list of the templates and usually matches the subject line, but you can change it."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$TextArea,{placeholder:l("Type title here"),autoSize:{minRows:1}})}),p.descriptionEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Description"),name:si,tooltip:{title:l("Description is used in other sections of the service."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},children:(0,o.jsx)(t.ui_kit$TextArea,{placeholder:l("Type your description here"),autoSize:{minRows:2}})}),p.tagsEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{label:l("Tags"),name:ai,tooltip:{title:l("Tags help you find the block in the list."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},rules:[{message:l("Please input tags!"),type:"array"}],children:(0,o.jsx)(t.ui_kit$Select,{mode:"tags",style:{width:"100%"},placeholder:l("Type your tags here"),options:Y,disabled:Le||g,loading:Le,tagRender:ve=>{const{label:Be,closable:xe,onClose:ce}=ve,be=ue=>{ue.preventDefault(),ue.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:c.colorPrimary,onMouseDown:be,closable:xe,onClose:ce,style:{borderRadius:6},children:Be})},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})}),p.isTemplateEnabled&&(h==="email"||!1)&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider",style:{marginBottom:16}}),(0,o.jsx)(t.ui_kit$Tooltip,{title:h==="block"?l("Template blocks are shown in the common blocks of the project."):i.isNew?l("Save email first."):l("Use this email as a template for creating future emails."),children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"is_template",valuePropName:"checked",initialValue:I,children:(0,o.jsx)(t.ui_kit$Switch,{id:"setIsTemplate",label:l("Is a template"),size:"small",disabled:h==="email"&&!!i.isNew||g,labelStyle:{position:"relative",top:2,fontSize:14,color:c.colorText}})})},"isTemplate")]}),h==="email"&&I&&(0,o.jsx)(mu,{element:i,levels:$,readOnlyLevels:x,levelsRead:T!==void 0,refetchProjectGroups:B,isLoading:x?v:y||D}),h==="block"&&(0,o.jsx)(t.ui_kit$Form.Item,{name:Xi,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:j,getPopupContainer:()=>document.querySelector(".email-settings__collapse")})})]})})};vs.propTypes={className:f.default.string,email:f.default.object};var{utm_source:Is,utm_medium:Cs,utm_campaign:Ps,utm_term:Ns,utm_content:As}={utm_source:"utm_source",utm_medium:"utm_medium",utm_campaign:"utm_campaign",utm_term:"utm_term",utm_content:"utm_content"},xu={[Is]:"",[Cs]:"",[Ps]:"",[Ns]:"",[As]:""},Ls=({className:e="",email:i=void 0})=>{const{__:l}=r.useI18n(),s=r.useEmailAttributesWriter(),n=r.useEditorLocked(),d=r.useEditorLockCheck(),[c]=t.ui_kit$Form.useForm();(0,a.useEffect)(()=>{i&&c.setFieldsValue({utm_source:i.utm_parameters?.utm_source||"",utm_medium:i.utm_parameters?.utm_medium||"",utm_campaign:i.utm_parameters?.utm_campaign||"",utm_term:i.utm_parameters?.utm_term||"",utm_content:i.utm_parameters?.utm_content||""})},[c,i]);const p=g=>{if(d())return;const m=Object.keys(g)[0],_=g;s({utm_parameters:{...i?.utm_parameters,[m]:_[m]}})};return(0,o.jsx)("div",{className:(0,Ke.default)("settings-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:c,layout:"vertical",name:"settings_panel_form_utm",initialValues:xu,onValuesChange:p,autoComplete:"off",disabled:n,children:[(0,o.jsx)(t.ui_kit$Alert,{title:l("The specified parameters will be added to all links when exporting the email."),type:"info",showIcon:!0,style:{marginBottom:20}}),(0,o.jsx)(t.ui_kit$Form.Item,{label:l("utm_source"),name:Is,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:Cs,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:Ps,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:Ns,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:As,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")})})]})})};Ls.propTypes={className:f.default.string,email:f.default.object};var ku={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 Eu(e){return Number.isInteger(e)?String(e):e.toFixed(2)}function Os(e){const i=e?.trim();return i?ku[i.toUpperCase()]??i:"$"}function Ki(e,i){return`${Os(i)}${Eu(e)}`}function Su(e){const i=parseFloat(e.price??""),l=parseFloat(e.discountValue??"");return!Number.isNaN(i)&&!Number.isNaN(l)&&l>0?{sale:Ki(i-l,e.priceCurrency),original:Ki(i,e.priceCurrency)}:Number.isNaN(i)?{}:{sale:Ki(i,e.priceCurrency)}}var go=({variant:e="line",width:i,height:l,className:s})=>{const n=(0,a.useMemo)(()=>({width:i,height:l}),[i,l]);return(0,o.jsx)("span",{className:(0,Ke.default)("preview-skeleton",`preview-skeleton--${e}`,s),style:n,"aria-hidden":"true"})};function qi({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 $s({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 Bu({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 Tu=2;function Ru({card:e}){const i=Su(e),l=(0,a.useMemo)(()=>({backgroundImage:`url(${e.image})`}),[e.image]),s=!!e.headline?.trim(),n=!!e.image?.trim(),d=!i.sale&&!i.original;return(0,o.jsxs)("div",{className:"product-carousel-preview__card",children:[n?(0,o.jsx)("div",{className:"product-carousel-preview__card-image",style:l}):(0,o.jsx)(go,{variant:"block",className:"product-carousel-preview__card-image-skeleton"}),(0,o.jsxs)("div",{className:"product-carousel-preview__card-body",children:[s?(0,o.jsx)("div",{className:"product-carousel-preview__card-headline",children:e.headline}):(0,o.jsxs)("div",{className:"product-carousel-preview__card-headline-skeleton",children:[(0,o.jsx)(go,{height:12}),(0,o.jsx)(go,{height:12,width:"75%"})]}),d?(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,o.jsx)(go,{width:48,height:14}),(0,o.jsx)(go,{width:40,height:12})]}):(i.sale||i.original)&&(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[i.sale&&(0,o.jsx)("span",{className:"product-carousel-preview__card-sale-price",children:i.sale}),i.original&&(0,o.jsx)("span",{className:"product-carousel-preview__card-original-price",children:i.original})]})]})]})}function yu(){return(0,o.jsxs)("div",{className:"product-carousel-preview__card",children:[(0,o.jsx)(go,{variant:"block",className:"product-carousel-preview__card-image-skeleton"}),(0,o.jsxs)("div",{className:"product-carousel-preview__card-body",children:[(0,o.jsxs)("div",{className:"product-carousel-preview__card-headline-skeleton",children:[(0,o.jsx)(go,{height:12}),(0,o.jsx)(go,{height:12,width:"75%"})]}),(0,o.jsxs)("div",{className:"product-carousel-preview__card-prices",children:[(0,o.jsx)(go,{width:48,height:14}),(0,o.jsx)(go,{width:40,height:12})]})]})]})}var wu=({data:e,subjectLine:i,cards:l})=>{const{__:s}=r.useI18n(),n=!!e.logo?.trim(),d=!!i?.trim();return(0,o.jsxs)("div",{className:"product-carousel-preview",children:[(0,o.jsx)("div",{className:"product-carousel-preview__header",children:(0,o.jsxs)("div",{className:"product-carousel-preview__header-main",children:[n?(0,o.jsx)("img",{src:e.logo,alt:"",className:"product-carousel-preview__logo"}):(0,o.jsx)(go,{variant:"circle",width:40,height:40,className:"product-carousel-preview__logo-skeleton"}),(0,o.jsxs)("div",{className:"product-carousel-preview__header-text",children:[(0,o.jsxs)("div",{className:"product-carousel-preview__header-row",children:[(0,o.jsx)("div",{className:"product-carousel-preview__brand-name",children:s("Your company")}),(0,o.jsx)("div",{className:"product-carousel-preview__time",children:"10:10 AM"})]}),(0,o.jsxs)("div",{className:"product-carousel-preview__header-row product-carousel-preview__header-row--subject",children:[d?(0,o.jsx)("div",{className:"product-carousel-preview__subject-line",children:i}):(0,o.jsx)(go,{height:14,className:"product-carousel-preview__subject-skeleton"}),(0,o.jsx)(qi,{className:"product-carousel-preview__star-icon"})]})]})]})}),(0,o.jsx)("div",{className:"product-carousel-preview__carousel",children:l.length>0?l.map((c,p)=>(0,o.jsx)(Ru,{card:c},c.id||p)):Array.from({length:Tu},(c,p)=>(0,o.jsx)(yu,{},`skeleton-${p}`))})]})};function ju(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 Fs(e){const i=e?.trim();return i?/^code\s/i.test(i)?i:`Code ${i}`:null}var vu=({data:e,subjectLine:i,card:l})=>{const{__:s}=r.useI18n(),n=!!e.logo?.trim(),d=!!i?.trim(),c=!!l?.image?.trim(),p=!!l?.headline?.trim(),g=ju(l),m=Fs(e.discountCode),_=!!(g||m),E=(0,a.useMemo)(()=>({backgroundImage:`url(${l?.image})`}),[l?.image]);return(0,o.jsxs)("div",{className:"single-image-preview",children:[(0,o.jsx)("div",{className:"single-image-preview__header",children:(0,o.jsxs)("div",{className:"single-image-preview__header-main",children:[n?(0,o.jsx)("img",{src:e.logo,alt:"",className:"single-image-preview__logo"}):(0,o.jsx)(go,{variant:"circle",width:40,height:40,className:"single-image-preview__logo-skeleton"}),(0,o.jsxs)("div",{className:"single-image-preview__header-text",children:[(0,o.jsxs)("div",{className:"single-image-preview__header-row",children:[(0,o.jsx)("div",{className:"single-image-preview__brand-name",children:s("Your company")}),(0,o.jsx)("div",{className:"single-image-preview__time",children:"10:10 AM"})]}),d?(0,o.jsx)("div",{className:"single-image-preview__subject-line",children:i}):(0,o.jsx)(go,{height:14,className:"single-image-preview__subject-skeleton"}),(0,o.jsxs)("div",{className:"single-image-preview__promo-row",children:[(0,o.jsxs)("div",{className:"single-image-preview__promo-content",children:[g?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)($s,{className:"single-image-preview__promo-icon"}),(0,o.jsx)("span",{className:"single-image-preview__promo-badge",children:g})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(go,{width:16,height:16,className:"single-image-preview__promo-icon-skeleton"}),(0,o.jsx)(go,{width:72,height:14})]}),_&&(0,o.jsx)("span",{className:"single-image-preview__promo-separator",children:"·"}),m?(0,o.jsx)("span",{className:"single-image-preview__promo-code",children:m}):(0,o.jsx)(go,{width:96,height:14,className:"single-image-preview__promo-skeleton"})]}),(0,o.jsx)(qi,{className:"single-image-preview__star-icon"})]})]})]})}),(0,o.jsxs)("div",{className:"single-image-preview__card",children:[c?(0,o.jsx)("div",{className:"single-image-preview__card-image",style:E}):(0,o.jsx)(go,{variant:"block",className:"single-image-preview__card-image-skeleton"}),(0,o.jsx)("div",{className:"single-image-preview__card-body",children:p?(0,o.jsx)("div",{className:"single-image-preview__card-description",children:l?.headline}):(0,o.jsxs)("div",{className:"single-image-preview__card-description-skeleton",children:[(0,o.jsx)(go,{height:12}),(0,o.jsx)(go,{height:12,width:"92%"})]})})]})]})};function Iu(e){const i=e?.trim();if(!i)return null;const l=(0,ct.default)(i);if(!l.isValid())return null;const s=(0,ct.default)().startOf("day"),n=l.startOf("day").diff(s,"day");return n===0?"Today":n===1?"Tomorrow":n>1&&n<=7?l.format("MMM D"):l.format("MMM D, YYYY")}function Ji(e){const i=e?.trim();return i||null}function Cu(e,i){return e?e==="Today"?i("Today"):e==="Tomorrow"?i("Tomorrow"):e:null}function Pu(e,i){return Cu(Iu(e),i)}var Nu=({data:e,subjectLine:i})=>{const{__:l}=r.useI18n(),s=!!e.logo?.trim(),n=!!i?.trim(),d=Ji(e.description),c=Fs(e.discountCode),p=!!(d||c);return(0,o.jsx)("div",{className:"deal-annotation-preview",children:(0,o.jsxs)("div",{className:"deal-annotation-preview__header-main",children:[s?(0,o.jsx)("img",{src:e.logo,alt:"",className:"deal-annotation-preview__logo"}):(0,o.jsx)(go,{variant:"circle",width:40,height:40,className:"deal-annotation-preview__logo-skeleton"}),(0,o.jsxs)("div",{className:"deal-annotation-preview__header-text",children:[(0,o.jsxs)("div",{className:"deal-annotation-preview__header-row",children:[(0,o.jsx)("div",{className:"deal-annotation-preview__brand-name",children:l("Your company")}),(0,o.jsx)("div",{className:"deal-annotation-preview__time",children:"10:10 AM"})]}),n?(0,o.jsx)("div",{className:"deal-annotation-preview__subject-line",children:i}):(0,o.jsx)(go,{height:14,className:"deal-annotation-preview__subject-skeleton"}),(0,o.jsxs)("div",{className:"deal-annotation-preview__promo-row",children:[(0,o.jsxs)("div",{className:"deal-annotation-preview__promo-content",children:[d?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)($s,{className:"deal-annotation-preview__promo-icon"}),(0,o.jsx)("span",{className:"deal-annotation-preview__promo-badge",children:d})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(go,{width:16,height:16,className:"deal-annotation-preview__promo-icon-skeleton"}),(0,o.jsx)(go,{width:72,height:14})]}),p&&(0,o.jsx)("span",{className:"deal-annotation-preview__promo-separator",children:"·"}),c?(0,o.jsx)("span",{className:"deal-annotation-preview__promo-code",children:c}):(0,o.jsx)(go,{width:96,height:14,className:"deal-annotation-preview__promo-skeleton"})]}),(0,o.jsx)(qi,{className:"deal-annotation-preview__star-icon"})]})]})]})})},Au=({data:e})=>{const{__:i}=r.useI18n(),l=Ji(e.description),s=Pu(e.availabilityEnds,i),n=Ji(e.discountCode);return(0,o.jsxs)("div",{className:"deal-card-preview",children:[(0,o.jsx)("div",{className:"deal-card-preview__sender",children:i("Your company")}),l?(0,o.jsx)("div",{className:"deal-card-preview__headline",children:l}):(0,o.jsx)(go,{height:24,className:"deal-card-preview__headline-skeleton"}),(0,o.jsxs)("div",{className:"deal-card-preview__details",children:[(0,o.jsxs)("div",{className:"deal-card-preview__expires",children:[(0,o.jsx)(Bu,{className:"deal-card-preview__clock-icon"}),(0,o.jsxs)("div",{className:"deal-card-preview__detail-text",children:[(0,o.jsx)("div",{className:"deal-card-preview__detail-label",children:i("Expires")}),s?(0,o.jsx)("div",{className:"deal-card-preview__detail-value",children:s}):(0,o.jsx)(go,{width:72,height:14,className:"deal-card-preview__detail-skeleton"})]})]}),(0,o.jsx)("div",{className:"deal-card-preview__code",children:(0,o.jsxs)("div",{className:"deal-card-preview__detail-text",children:[(0,o.jsx)("div",{className:"deal-card-preview__detail-label",children:i("Code")}),n?(0,o.jsx)("div",{className:"deal-card-preview__detail-value",children:n}):(0,o.jsx)(go,{width:56,height:14,className:"deal-card-preview__detail-skeleton"})]})})]}),(0,o.jsxs)("div",{className:"deal-card-preview__actions",children:[(0,o.jsx)("span",{className:"deal-card-preview__button",children:i("Visit site")}),(0,o.jsx)("span",{className:"deal-card-preview__button",children:i("Copy code")})]})]})};function Lu(e){return e.annotationType===eo.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW?e.cards?.[0]?[e.cards[0]]:[]:e.annotationType===eo.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL?e.cards||[]:[]}function Ou(e,i){switch(e){case eo.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW:return i("Single image preview");case eo.GMAIL_ANNOTATION_TYPES.DEAL_ANNOTATION:return i("Deal Annotation");case eo.GMAIL_ANNOTATION_TYPES.DEAL_CARD:return i("Deal Card");default:return i("Product carousel")}}var Qi=300,qo=16;function $u(e){if(!e||e.offsetParent===null)return!1;const i=e.getBoundingClientRect();return i.width>0&&i.height>0}function Fu(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 Mu=({data:e,subjectLine:i,parentRef:l,overlayTargetSelector:s,onApply:n,applyDisabled:d=!1,applyBlockers:c=[],onRemove:p,visible:g=!0})=>{const{__:m}=r.useI18n(),[_,E]=(0,a.useState)(null),[b,h]=(0,a.useState)(null);(0,a.useEffect)(()=>{if(!g){E(null),h(null);return}const B=()=>{if(!$u(l?.current)){E(null),h(null);return}if(s){const I=l?.current?.closest(".email-pane__col_settings-inner")||Fu(".email-pane__col_settings-inner");if(I){h(I),E({type:"popover"});return}}if(!l?.current)return;let W=l.current.getBoundingClientRect();if(W.width===0&&W.height===0){const I=l.current.closest(".email-pane__col");I&&(W=I.getBoundingClientRect())}const Y=Math.max(qo,Math.min(W.top,window.innerHeight-qo));let ee=W.left-Qi-qo;ee<qo&&(ee=W.right+qo),ee+Qi>window.innerWidth-qo&&(ee=window.innerWidth-Qi-qo),h(document.body),E({type:"side",top:Y,left:Math.max(qo,ee)})};B();const y=window.requestAnimationFrame(B),D=[window],z=l?.current?.closest(".email-pane__collapse-wrapper"),A=l?.current?.closest(".email-pane__col");z&&D.push(z),A&&D.push(A),D.forEach(W=>{W.addEventListener("scroll",B,{passive:!0})}),window.addEventListener("resize",B);const $=l?.current,j=$&&typeof ResizeObserver<"u"?new ResizeObserver(B):null;return j?.observe($),()=>{window.cancelAnimationFrame(y),j?.disconnect(),D.forEach(W=>{W.removeEventListener("scroll",B)}),window.removeEventListener("resize",B)}},[l,e,s,g]);const k=(0,a.useMemo)(()=>_?.type==="side"?{position:"fixed",top:_.top,left:_.left}:void 0,[_]);if(!g||!e||!eo.hasGmailAnnotationsPreviewContent(e)&&!n||!_)return null;const x=Lu(e),T=e.annotationType||eo.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL,v=(()=>{switch(T){case eo.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL:return(0,o.jsx)(wu,{data:e,subjectLine:i,cards:x});case eo.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW:return(0,o.jsx)(vu,{data:e,subjectLine:i,card:x[0]});case eo.GMAIL_ANNOTATION_TYPES.DEAL_ANNOTATION:return(0,o.jsx)(Nu,{data:e,subjectLine:i});case eo.GMAIL_ANNOTATION_TYPES.DEAL_CARD:return(0,o.jsx)(Au,{data:e});default:return null}})(),P=(0,o.jsxs)("div",{className:`annotations-preview${_.type==="popover"?" annotations-preview--popover":""}`,style:k,children:[(0,o.jsxs)("div",{className:"annotations-preview__content",children:[(0,o.jsxs)("div",{className:"annotations-preview__type",children:[m("Preview"),": ",Ou(T,m)]}),v]}),(n||p)&&(0,o.jsxs)("div",{className:"annotations-preview__footer",children:[p&&(0,o.jsx)(t.ui_kit$Button,{type:"text",size:"small",danger:!0,onClick:p,children:m("Remove annotations")}),n&&(0,o.jsx)(t.ui_kit$Tooltip,{title:d&&c.length?c.join(". "):"",children:(0,o.jsx)("span",{className:"annotations-preview__apply-wrap",children:(0,o.jsx)(t.ui_kit$Button,{type:"primary",size:"small",onClick:n,disabled:d,children:m("Apply")})})})]})]});return(0,gn.createPortal)(P,b||document.body)},{Text:Du}=t.ui_kit$Typography,Vu=10,Hu=1,Ms={width:"100%"},Uu="https://developers.google.com/workspace/gmail/promotab",Io=["hover"],Wu=["annotationLogo"],Ds=["cards",0,"price"],zu=["cards",0,"discountPercent"],Gu=["cards",0,"priceCurrency"];function yo(e){return e.closest(".email-pane__collapse-wrapper")??document.body}var Uo={clearIcon:(0,o.jsx)(t.ui_kit$ColorPickerClearGlyph,{})},Yu={optionFilterProp:"label"};function Xu(e){return{value:e||void 0}}var Ku=eo.POPULAR_PRICE_CURRENCIES.map(e=>{const i=Os(e);return{value:e,label:i===e?e:`${e} (${i})`}}),Vs=({name:e,pricePath:i,iconStrokeWidth:l})=>{const{__:s}=r.useI18n(),n=(0,a.useMemo)(()=>[i],[i]),d=(0,a.useMemo)(()=>[({getFieldValue:c})=>({validator:async(p,g)=>{const m=typeof g=="string"?g.trim():"";if(!m)return;if(eo.parseDiscountPercent(m)===null)throw new Error(s("Discount must be a percentage greater than 0 and up to 100"));const _=eo.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:Io,title:s("Discount, %"),placement:"bottom",getPopupContainer:yo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:e,dependencies:n,rules:d,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Percent02Icon",component:t.icons$Percent02Icon,size:16,strokeWidth:l}),placeholder:s("Discount, %"),inputMode:"decimal",allowClear:Uo})})})},Hs=({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&&!eo.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:Io,title:l("Price currency"),placement:"bottom",getPopupContainer:yo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:e,rules:s,getValueProps:Xu,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Select,{options:Ku,placeholder:l("Price currency"),prefix:(0,o.jsx)(r.EmIcons,{icon:"Globe02Icon",component:t.icons$Globe02Icon,size:16,strokeWidth:i}),showSearch:Yu,allowClear:!0,getPopupContainer:yo})})})},qu=({onAdd:e})=>{const{__:i}=r.useI18n(),l=(0,a.useCallback)(()=>e(eo.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")})},Ju=({field:e,index:i,form:l,isSingleImagePreview:s,onRemove:n})=>{const{__:d}=r.useI18n(),c=r.useAppConfig(),p=(0,a.useMemo)(()=>[e.name,"image"],[e.name]),g=(0,a.useMemo)(()=>["cards",e.name,"image"],[e.name]),m=(0,a.useMemo)(()=>[e.name,"headline"],[e.name]),_=(0,a.useMemo)(()=>[e.name,"url"],[e.name]),E=(0,a.useMemo)(()=>[e.name,"price"],[e.name]),b=(0,a.useMemo)(()=>["cards",e.name,"price"],[e.name]),h=(0,a.useMemo)(()=>[e.name,"discountPercent"],[e.name]),k=(0,a.useMemo)(()=>[e.name,"priceCurrency"],[e.name]),x=(0,a.useMemo)(()=>[e.name,"id"],[e.name]),T=(0,a.useMemo)(()=>[{validator:async(P,B)=>{const y=typeof B=="string"?B.trim():"";if(y&&!/^https?:\/\//i.test(y))throw new Error(d("Please enter the correct URL."))}}],[d]),v=(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)(Du,{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:Io,title:d("Delete"),placement:"top",getPopupContainer:yo,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:v})})]}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Io,title:d("Image"),placement:"top",getPopupContainer:yo,children:(0,o.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,o.jsx)(Fo,{form:l,label:d("Image"),name:p,watchPath:g})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Io,title:d("Headline"),placement:"bottom",getPopupContainer:yo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:m,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"ElementTitle",component:t.icons$ElementTitle,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Headline"),allowClear:Uo})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Io,title:d("Link"),placement:"bottom",getPopupContainer:yo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:_,className:"selected-social-form__card-field",rules:T,children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Link03",component:t.icons$Link03,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Enter link"),allowClear:Uo})})}),!s&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Io,title:d("Price"),placement:"bottom",getPopupContainer:yo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:E,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"CreditCard02Icon",component:t.icons$CreditCard02Icon,size:16,strokeWidth:c.iconStrokeWidth}),placeholder:d("Price"),allowClear:Uo})})}),(0,o.jsx)(Vs,{name:h,pricePath:b,iconStrokeWidth:c.iconStrokeWidth}),(0,o.jsx)(Hs,{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 Us({iconStrokeWidth:e}){const{__:i}=r.useI18n();return(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Io,title:i("Discount code"),placement:"bottom",getPopupContainer:yo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"discountCode",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Sale04Icon",component:t.icons$Sale04Icon,size:16,strokeWidth:e}),placeholder:i("Discount code"),allowClear:Uo})})})}var Qu=({className:e="",isActive:i=!0,email:l})=>{const{__:s}=r.useI18n(),n=r.useAppConfig(),d=r.useEditorLocked(),c=r.useEditorLockCheck(),{document:p}=r.useDocumentSessionContext(),g=r.useNotification(),[m]=t.ui_kit$Form.useForm(),_=(0,a.useRef)(null),E=(0,a.useRef)(!1),b=(0,a.useRef)(null),[h,k]=(0,a.useState)(!1),x=t.ui_kit$Form.useWatch("annotationType",m),T=t.ui_kit$Form.useWatch("annotationLogo",m),v=t.ui_kit$Form.useWatch("description",m),P=t.ui_kit$Form.useWatch("discountCode",m),B=t.ui_kit$Form.useWatch("availabilityStarts",m),y=t.ui_kit$Form.useWatch("availabilityEnds",m),D=t.ui_kit$Form.useWatch("offerPageUrl",m),z=t.ui_kit$Form.useWatch("merchantHomepageUrl",m),A=t.ui_kit$Form.useWatch("cards",m),$=JSON.stringify(A??[]),j=(0,a.useMemo)(()=>JSON.parse($)??[],[$]),W=x||eo.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL,Y=W===eo.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL||W===eo.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW,ee=W===eo.GMAIL_ANNOTATION_TYPES.DEAL_ANNOTATION||W===eo.GMAIL_ANNOTATION_TYPES.DEAL_CARD,I=W===eo.GMAIL_ANNOTATION_TYPES.DEAL_CARD,le=W===eo.GMAIL_ANNOTATION_TYPES.DEAL_ANNOTATION,ke=W===eo.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW,Ne=W===eo.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW?Hu:Vu,Q=(0,a.useMemo)(()=>[{value:eo.GMAIL_ANNOTATION_TYPES.PRODUCT_CAROUSEL,label:s("Product carousel")},{value:eo.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW,label:s("Single image preview")},{value:eo.GMAIL_ANNOTATION_TYPES.DEAL_ANNOTATION,label:s("Deal Annotation")},{value:eo.GMAIL_ANNOTATION_TYPES.DEAL_CARD,label:s("Deal Card")}],[s]),fe=(0,a.useMemo)(()=>{let ce="";p&&(ce=p.getContent()),!ce&&l?.html&&(ce=l.html);const be=ce.match(/<title[^>]*>([\s\S]*?)<\/title>/i),ue=be?be[1].trim():l?.title||l?.subject||"";return eo.formatPreviewSubjectLine(ue)},[p,l?.html,l?.title,l?.subject]),Ae=(0,a.useMemo)(()=>eo.buildAnnotationsData({annotationType:W,annotationLogo:T,description:v,discountCode:P,availabilityStarts:B,availabilityEnds:y,offerPageUrl:D,merchantHomepageUrl:z,cards:j}),[W,T,v,P,B,y,D,z,j]),ne=(0,a.useMemo)(()=>Y?eo.getDiscountPercentBlockers(j,s):[],[Y,j,s]),Fe=(0,a.useMemo)(()=>eo.canApplyGmailAnnotations(Ae)&&ne.length===0,[Ae,ne]),Le=(0,a.useMemo)(()=>[...eo.getAnnotationsApplyBlockers(Ae,s),...ne],[Ae,ne,s]),Ue=(0,a.useMemo)(()=>s("Learn more about %s").split("%s"),[s]),ve=(0,a.useCallback)(()=>{!p||c()||!eo.removeAnnotationsFromDocument(p)||(m.setFieldsValue(eo.getEmptyAnnotationsFormValues(W)),b.current={emailId:l?.id,markup:null},k(!1),g.success(s("Gmail annotations were removed from the template code.")))},[p,c,m,W,l?.id,g,s]);(0,a.useEffect)(()=>{if(!Y)return;const ce=m.getFieldValue("cards")??[];if(W===eo.GMAIL_ANNOTATION_TYPES.SINGLE_IMAGE_PREVIEW){if(ce.length>1){m.setFieldsValue({cards:[ce[0]]});return}ce.length===0&&m.setFieldsValue({cards:[eo.createEmptyAnnotationCard()]});return}ce.length===0&&m.setFieldsValue({cards:[eo.createEmptyAnnotationCard()]})},[m,Y,W,j]);const Be=(0,a.useCallback)(ce=>{if(!ce||!E.current||!p||c())return!1;const be=eo.applyAnnotationsEditToDocument(p,eo.buildAnnotationsData(ce));if(be){const ue=eo.readGmailAnnotationsScript(p.getContent());b.current={emailId:l?.id,markup:ue},k(ue!==null)}return be},[p,c,l?.id]),xe=(0,a.useCallback)(()=>{Be(m.getFieldsValue(!0))&&g.success(s("Gmail annotation was successfully applied to the template code."))},[Be,m,g,s]);return(0,a.useEffect)(()=>{if(!i)return;const ce=eo.normalizeEditorHtml(p?.getContent()||l?.html||""),be={emailId:l?.id,markup:ce?eo.readGmailAnnotationsScript(ce):null};if(k(be.markup!==null),!eo.shouldReloadAnnotationsForm(b.current,be))return;b.current=be,E.current=!1;const ue=ce?eo.parseGmailAnnotations(ce):null;m.setFieldsValue(ue?eo.mapParsedAnnotationsToFormValues(ue):eo.getEmptyAnnotationsFormValues()),E.current=!0},[i,l?.id,l?.html,p,m]),(0,o.jsxs)("div",{className:(0,Ke.default)("selected-social-form","annotations-panel",e),ref:_,children:[(0,o.jsx)(Mu,{data:Ae,subjectLine:fe,parentRef:_,overlayTargetSelector:"#pane-content-iframe",onApply:xe,applyDisabled:!Fe||d,applyBlockers:Le,onRemove:h&&!d?ve:void 0,visible:i}),(0,o.jsxs)(t.ui_kit$Form,{form:m,layout:"vertical",className:"selected-social-form__form element-controls",autoComplete:"off",disabled:d,children:[(0,o.jsxs)("div",{className:"selected-social-form__section",children:[(0,o.jsx)("div",{className:"selected-social-form__section-title",children:s("General settings")}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Io,title:s("Annotation type"),placement:"bottom",getPopupContainer:yo,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:Q,placeholder:s("Annotation type"),getPopupContainer:yo})})}),!I&&(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Io,title:s("Organization logo"),placement:"bottom",getPopupContainer:yo,children:(0,o.jsx)("div",{className:"annotations-panel__field-tooltip-wrap",children:(0,o.jsx)(Fo,{form:m,label:s("Organization logo"),name:"annotationLogo",watchPath:Wu})})}),(ke||le)&&(0,o.jsx)(Us,{iconStrokeWidth:n.iconStrokeWidth}),ke&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Io,title:s("Price"),placement:"bottom",getPopupContainer:yo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:Ds,className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"CreditCard02Icon",component:t.icons$CreditCard02Icon,size:16,strokeWidth:n.iconStrokeWidth}),placeholder:s("Price"),allowClear:Uo})})}),(0,o.jsx)(Vs,{name:zu,pricePath:Ds,iconStrokeWidth:n.iconStrokeWidth}),(0,o.jsx)(Hs,{name:Gu,iconStrokeWidth:n.iconStrokeWidth})]}),ee&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Io,title:s("Discount description"),placement:"bottom",getPopupContainer:yo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"description",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"CommentOutlined",component:t.icons$CommentOutlined,size:16,strokeWidth:n.iconStrokeWidth}),placeholder:s("Discount description"),allowClear:Uo})})}),I&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Us,{iconStrokeWidth:n.iconStrokeWidth}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Io,title:s("Offer page URL"),placement:"bottom",getPopupContainer:yo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"offerPageUrl",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Link03",component:t.icons$Link03,size:16,strokeWidth:n.iconStrokeWidth}),placeholder:s("Offer page URL"),allowClear:Uo})})}),(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Io,title:s("Merchant homepage URL"),placement:"bottom",getPopupContainer:yo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"merchantHomepageUrl",className:"selected-social-form__card-field",children:(0,o.jsx)(t.ui_kit$Input,{prefix:(0,o.jsx)(r.EmIcons,{icon:"Link03",component:t.icons$Link03,size:16,strokeWidth:n.iconStrokeWidth}),placeholder:s("Merchant homepage URL"),allowClear:Uo})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,className:"selected-social-form__field-row",children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Io,title:s("Starts"),placement:"bottom",getPopupContainer:yo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"availabilityStarts",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DatePicker,{showTime:!0,placeholder:s("Starts"),style:Ms,getPopupContainer:yo})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:Io,title:s("Ends"),placement:"bottom",getPopupContainer:yo,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"availabilityEnds",className:"form-item-margin-xs",children:(0,o.jsx)(t.ui_kit$DatePicker,{showTime:!0,placeholder:s("Ends"),style:Ms,getPopupContainer:yo})})})})]})]})]}),Y&&(0,o.jsxs)("div",{className:(0,Ke.default)("selected-social-form__section",{"selected-social-form__section--bordered":!ke,"annotations-panel__cards-section":ke}),children:[W===eo.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:(ce,{add:be,remove:ue})=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"selected-social-form__items",children:ce.map((q,Z)=>(0,o.jsx)(Ju,{field:q,index:Z,form:m,isSingleImagePreview:ke,onRemove:ue},q.key))}),!ke&&j.length<Ne&&(0,o.jsx)(qu,{onAdd:be})]})})]}),(0,o.jsxs)("div",{className:"annotations-panel__docs-hint",children:[Ue[0],(0,o.jsx)("a",{href:Uu,target:"_blank",rel:"noopener noreferrer",children:s("Gmail annotations")}),Ue[1]]})]})]})},Zu={appearance:"title"},Zi=({email:e,pluginOnly:i=!1})=>{const{__:l}=r.useI18n(),s=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,[n,d]=(0,a.useState)(r.SETTINGS),c=r.useAppConfig(),p=r.usePluginViewTabs("documentSettings",Zu),{lastOpenedKey:g,lastOpenedStamp:m,claimNewest:_}=p,E=(0,a.useCallback)(A=>{p.activate(A),d(A||"")},[p]);(0,a.useEffect)(()=>{g&&(_(),d(g))},[g,m,_]);const b=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(!b.current&&p.openedKnown){b.current=!0;const A=_();A&&d(A)}},[p.openedKnown,_]);const h=!i&&c.settingsTabEnabled,k=!i&&c.UTMEnabled&&s==="email",x=!i&&c.annotationsEnabled&&s==="email",T=[h&&"Settings",k&&"UTM parameters",x&&"Annotations parameters"].filter(Boolean),v=[...T,...p.openedKeys].includes(n)?n:T[0]??"",P=p.keys[0],B=T.length===0,y=B&&p.openedKnown&&p.openedKeys.length===0,D=(0,a.useRef)(!1);(0,a.useEffect)(()=>{B||(D.current=!1)},[B]),(0,a.useEffect)(()=>{y&&P&&!D.current&&(D.current=!0,p.activate(P))},[y,P,p]);const z=(0,a.useMemo)(()=>{const A=[];return h&&A.push({label:(0,o.jsx)(o.Fragment,{children:l("Settings")}),key:r.SETTINGS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(vs,{className:"email-settings__collapse-panel-content",element:e})}),k&&A.push({label:(0,o.jsx)(o.Fragment,{children:l("UTM parameters")}),key:r.UTM_PARAMETERS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(Ls,{className:"email-settings__collapse-panel-content",email:e})}),x&&A.push({label:(0,o.jsx)(o.Fragment,{children:l("Annotations")}),key:r.ANNOTATIONS_PARAMETERS,forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(Qu,{className:"email-settings__collapse-panel-content",email:e,isActive:v===r.ANNOTATIONS_PARAMETERS})}),A.push(...p.tabs()),A},[l,e,h,k,x,v,p]);return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse",size:"large",activeKey:v,onChange:E,items:z})})};Zi.propTypes={};var Ws=320,em=1200,om=350,{backgroundColor:zs,backgroundImage:er,backgroundPositionX:or,backgroundPositionY:tr,backgroundRepeat:ni,backgroundSize:ir,responsive:tm,backgroundColorContent:im,width:rr}={backgroundColor:"backgroundColor",backgroundImage:"backgroundImage",backgroundPositionX:"backgroundPositionX",backgroundPositionY:"backgroundPositionY",backgroundRepeat:"backgroundRepeat",backgroundSize:"backgroundSize",responsive:"responsive",backgroundColorContent:"backgroundColorContent",width:"width"},rm={[zs]:"",[er]:"",[or]:"",[tr]:"",[ni]:"checked",[ir]:"",[im]:"",[rr]:""};function lr(e){const i=Number(e);return Number.isNaN(i)?null:{value:i,dim:"px"}}var Gs=({className:e=""})=>{const{__:i}=r.useI18n(),{token:l}=(0,t.ui_kit$useToken)(),s=r.useDispatch(),n=r.useAppConfig(),[d]=t.ui_kit$Form.useForm(),c=r.useSendPostMessage(),p=r.useEmailAttribute("common_styles"),g=r.useSelector(r.selectEmailSettings),m=r.useSelector(r.selectIsSettingsDisabled$1),_=r.useSelector(r.selectActiveSettingsTab),E=r.useSelector(r.selectIsNeedUpdateAppearance),[b,h]=(0,a.useState)(!0),k=(0,a.useRef)(!1),x=(0,a.useRef)(null),T=i("Email not yet loaded or global container not found.");(0,a.useEffect)(()=>{E&&(s(r.setIsNeedUpdateAppearance(!1)),c({operation:r.EVENT_TYPES.INIT_PREVIEW}))},[d,E,s,c,p]),(0,a.useEffect)(()=>()=>{x.current&&clearTimeout(x.current)},[]);const v=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}],P=[{label:i("Not defined"),value:""},{label:i("Contain"),value:"contain"},{label:i("Cover"),value:"cover"}];(0,a.useEffect)(()=>{const{width:W,...Y}=g,ee={...Y,backgroundImage:g.backgroundImage?g.backgroundImage[0]?.value:"",backgroundRepeat:g[ni]===""?"repeat":g[ni],backgroundSize:g[ir],responsive:g.responsive?.shutdown};k.current||(ee.width=W?.value,ee.widthDim=W?.dim),d.setFieldsValue(ee),h(!g.backgroundImage)},[g,d]);const B=(0,a.useCallback)(W=>{const Y=lr(W);!Y||Y.value<Ws||c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{width:Y}})},[c]),y=(0,a.useCallback)(W=>{const Y=lr(W);Y&&s(r.setEmailSettings({...g,width:Y}))},[s,g]),D=(0,a.useCallback)(W=>{x.current&&clearTimeout(x.current),y(W),x.current=setTimeout(()=>{B(W)},om)},[B,y]),z=W=>{const Y=d.getFieldsValue(!0),ee=Object.keys(W)[0];switch(ee){case rr:D(W[ee]);break;case or:case tr:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[ee]:W[ee]===""?"none":W[ee]}});break;case er:h(W[ee]===""),c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[ee]:[{...g?.backgroundImage?.[0],type:"url",value:W[ee]}],backgroundSize:"cover"}});break;case tm:{const I=lr(Y.width);c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{responsive:{shutdown:W[ee],styles:W[ee]},...I?{width:I}:{}}});break}default:c({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:W})}},A=W=>{s(r.setMobileViewActive({shutdown:W,styles:W})),c({operation:r.EVENT_TYPES.SANDBOX_IFRAME_SETSIZE,settings:{iframeWidth:document.querySelector(".email-pane__iframe").getBoundingClientRect().width}})},$=()=>{k.current=!0},j=()=>{x.current&&(clearTimeout(x.current),x.current=null);const W=d.getFieldValue(rr);y(W),B(W),requestAnimationFrame(()=>{k.current=!1})};return(0,o.jsx)("div",{className:(0,Ke.default)("appearance-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"appearance_panel_form",initialValues:{remember:!1,...rm},onValuesChange:z,autoComplete:"off",className:"element-controls",children:[m?(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:"24px"},title:T,type:"error"}):null,(0,o.jsx)(t.ui_kit$FormSection,{title:i("Email layout width"),dividerTop:!1,children:(0,o.jsx)(t.ui_kit$Row,{gutter:10,children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:g.width?.value?i("This field sets the width of the email."):i("Couldn`t determine the email width"),placement:"right",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"width",style:{marginBottom:l.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$InputNumber,{min:Ws,max:em,placeholder:i("Width"),disabled:!g.width?.value,addonAfter:"px",onFocus:$,onBlur:j})})})})})}),n.emailResponsiveControlEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{gutter:20,children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"responsive",valuePropName:"checked",children:(0,o.jsx)(t.ui_kit$Switch,{id:"responsive",label:i("Responsive email"),size:"small",name:"responsive",disabled:g.responsive?.shutdown===void 0,onChange:A})})})}),(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider"})]}),(0,o.jsx)(t.ui_kit$FormSection,{title:i("Email background color"),dividerTop:!n.emailResponsiveControlEnabled,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:b?16:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:zs,style:{marginBottom:l.formItemMarginBottomXS},rules:[{message:i("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:g.usedColors,disabled:m})})})}),(0,o.jsx)(t.ui_kit$Col,{span:b?12:24,children:n.formEmailFieldBackgroundImageEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Fo,{form:d,label:i("Background image"),name:er,tooltipTitle:i("Background image"),disabled:m||_!=="Styles",elementSettings:g}),!b&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:"0"},children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Horizontal position"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:or,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:tr,style:{marginBottom:l.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$Input,{placeholder:i("Vertical position"),prefix:(0,o.jsx)(r.EmIcons,{icon:"BgPositionVertical",component:t.icons$BgPositionVertical})})})})})]})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background image repeat"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:ni,children:(0,o.jsx)(t.ui_kit$Select,{placeholder:i("Please select"),disabled:m,options:v})})})}),(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:ir,children:(0,o.jsx)(t.ui_kit$Select,{placeholder:i("Please select"),disabled:m,options:P})})})})]})]})]})})]})})]})})};Gs.propTypes={className:f.default.string};var{Option:Ys}=t.ui_kit$Select,{width:Xs,widthDim:lm}={width:"width",widthDim:"widthDim"},sm={[Xs]:"",[lm]:""},Ks=({className:e=""})=>{const{__:i}=r.useI18n(),l=r.useSelector(r.selectBlockSettings),s=r.useSelector(r.selectIsSettingsDisabled),[n]=t.ui_kit$Form.useForm(),d=r.useSendPostMessage(),c=i("Block not yet loaded or global container not found.");(0,a.useEffect)(()=>{n.setFieldsValue({width:l.width.value,widthDim:l.width.dim})},[l,n]);const p=g=>{const m=n.getFieldsValue(!0),_=Object.keys(g)[0];let E;switch(_){case"width":E={[_]:{value:g[_],dim:m.widthDim}};break;case"widthDim":E={width:{value:m.width,dim:g[_]}};break;default:return}d({operation:r.EVENT_TYPES.SANDBOX_BLOCK_SETTINGS_SET,settings:E})};return(0,o.jsx)("div",{className:(0,Ke.default)("block-appearance-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:n,layout:"vertical",name:"block_appearance_panel_form",initialValues:{remember:!1,...sm},onValuesChange:p,autoComplete:"off",children:[s?(0,o.jsx)(t.ui_kit$Alert,{style:{marginBottom:"24px"},title:c,type:"error"}):null,(0,o.jsx)(t.ui_kit$Form.Item,{label:i("Container width"),name:Xs,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)(Ys,{value:"px",children:"px"}),(0,o.jsx)(Ys,{value:"%",children:"%"})]})})})})]})})};Ks.propTypes={className:f.default.string};var am=()=>{};function qs(){const e=r.useContainer(),i=(0,a.useCallback)(s=>{if(!e)return am;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 Js(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function sr(e,i){const l={...e};for(const s of Object.keys(i)){const n=i[s],d=e[s];Js(n)&&Js(d)?l[s]=sr(d,n):n!==void 0&&(l[s]=n)}return l}function Qs(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 sr(l,n)}catch{}}return i&&typeof i=="object"&&!Array.isArray(i)?sr(l,i):l}var Zs=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}),nm={buttons_borderRadiusAll:"all",buttons_borderRadiusTopLeft:"topLeft",buttons_borderRadiusBottomLeft:"bottomLeft",buttons_borderRadiusTopRight:"topRight",buttons_borderRadiusBottomRight:"bottomRight"},dm={cards_borderRadiusAll:"all",cards_borderRadiusTopLeft:"topLeft",cards_borderRadiusBottomLeft:"bottomLeft",cards_borderRadiusTopRight:"topRight",cards_borderRadiusBottomRight:"bottomRight"},cm={blockPaddingTop:"top",blockPaddingLeft:"left",blockPaddingRight:"right",blockPaddingBottom:"bottom"},um=({className:e})=>{const{__:i}=r.useI18n(),l=U.useGoogleFontsLoader(),s=r.useDispatch(),n=r.useSendPostMessage(),[d]=t.ui_kit$Form.useForm(),c=r.useSelector(r.selectEmailSettings),p=r.useSelector(r.selectIsNeedUpdateContentAppearance),g=qs(),m=r.useEmailAttribute("common_styles"),_=r.useAppConfig(),{token:E}=(0,t.ui_kit$useToken)(),[b,h]=(0,a.useState)({}),[k,x]=(0,a.useState)({}),[T,v]=(0,a.useState)(!0),[P,B]=(0,a.useState)(!0),[y,D]=(0,a.useState)(!1),[z,A]=(0,a.useState)(!1),$={buttonsPaddingTop:"top",buttonsPaddingLeft:"left",buttonsPaddingRight:"right",buttonsPaddingBottom:"bottom"},j=Qs(m,g),[W,Y]=(0,a.useState)(j.headings.bold),[ee,I]=(0,a.useState)(j.headings.italic),[le,ke]=(0,a.useState)(j.links.underline),[Ne,Q]=(0,a.useState)(j.buttons.bold),[fe,Ae]=(0,a.useState)(j.buttons.italic),[ne,Fe]=(0,a.useState)(null),Le=r.useSelector(r.selectIsPanelHistoryCollapsed);(0,a.useEffect)(()=>{Le||Fe(null)},[j,Fe,Le]),(0,a.useEffect)(()=>{Le&&!ne&&Fe(Zs(j))},[j,ne,Le]),(0,a.useEffect)(()=>{p&&(s(r.setIsNeedUpdateContentAppearance(!1)),d.setFieldsValue(Zs(j)))},[d,p,s,j]);const[Ue,ve]=(0,a.useState)(Math.min(j.headings.fontSize-1,19)),[Be,xe]=(0,a.useState)(Math.max(j.text.fontSize+1,20));(0,a.useEffect)(()=>{if(ne){const q=ne.buttonsBorder;h(q);const Z=Object.keys(q).find(de=>q[de]?.width||q[de]?.style||q[de]?.color),te=ne.cardsBorder;x(te);const ae=Object.keys(te).find(de=>te[de]?.width||te[de]?.style||te[de]?.color);d.setFieldsValue({buttons_borderPosition:Z||"all",buttons_borderWidth:q[Z]?.width!==null?q[Z]?.width:"",buttons_borderColor:q[Z]?.color||"",buttons_borderStyle:q[Z]?.style||"",cards_borderPosition:ae||"all",cards_borderWidth:te[ae]?.width!==null?te[ae]?.width:"",cards_borderColor:te[ae]?.color||"",cards_borderStyle:te[ae]?.style||"",buttons_borderRadiusAll:u(ne.buttonsBorderRadius.all),buttons_borderRadiusTopLeft:u(ne.buttonsBorderRadius.topLeft),buttons_borderRadiusBottomLeft:u(ne.buttonsBorderRadius.bottomLeft),buttons_borderRadiusTopRight:u(ne.buttonsBorderRadius.topRight),buttons_borderRadiusBottomRight:u(ne.buttonsBorderRadius.bottomRight),cards_borderRadiusAll:u(ne.cardsBorderRadius.all),cards_borderRadiusTopLeft:u(ne.cardsBorderRadius.topLeft),cards_borderRadiusBottomLeft:u(ne.cardsBorderRadius.bottomLeft),cards_borderRadiusTopRight:u(ne.cardsBorderRadius.topRight),cards_borderRadiusBottomRight:u(ne.cardsBorderRadius.bottomRight),blockPaddingAll:u(ne.blockPaddingAll),blockPaddingTop:u(ne.blockPaddingTop),blockPaddingRight:u(ne.blockPaddingRight),blockPaddingBottom:u(ne.blockPaddingBottom),blockPaddingLeft:u(ne.blockPaddingLeft),blockPaddingLeftRight:u(ne.blockPaddingRight)||u(ne.blockPaddingLeft),blockPaddingTopBottom:u(ne.blockPaddingTop)||u(ne.blockPaddingBottom)}),!u(ne.blockPaddingAll)&&(u(ne.blockPaddingTop)||u(ne.blockPaddingRight)||u(ne.blockPaddingBottom)||u(ne.blockPaddingLeft))&&(ne.blockPaddingTop!==ne.blockPaddingBottom||ne.blockPaddingRight!==ne.blockPaddingLeft)?A(!1):A(!0),!u(ne.buttonsBorderRadius.all)&&(u(ne.buttonsBorderRadius.topLeft)||u(ne.buttonsBorderRadius.bottomLeft)||u(ne.buttonsBorderRadius.topRight)||u(ne.buttonsBorderRadius.bottomRight))?v(!1):v(!0),ne.buttonsPadding&&!u(ne.buttonsPadding.all)&&(u(ne.buttonsPadding.bottom)||u(ne.buttonsPadding.right)||u(ne.buttonsPadding.left)||u(ne.buttonsPadding.top))&&D(!1),!u(ne.cardsBorderRadius?.all)&&(u(ne.cardsBorderRadius?.topLeft)||u(ne.cardsBorderRadius?.bottomLeft)||u(ne.cardsBorderRadius?.topRight)||u(ne.cardsBorderRadius?.bottomRight))?B(!1):B(!0)}},[d,ne]);const ce=()=>{A(Z=>!Z);const q=d.getFieldsValue(!0);if(!z){q.blockPaddingLeftRight=q.blockPaddingLeft,q.blockPaddingTopBottom=q.blockPaddingTop,q.blockPaddingRight=q.blockPaddingLeft,q.blockPaddingBottom=q.blockPaddingTop;const Z=Number(q.blockPaddingTopBottom),te=Number(q.blockPaddingLeftRight);n({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{blockPadding:{top:Number.isFinite(Z)?Z:0,bottom:Number.isFinite(Z)?Z:0,left:Number.isFinite(te)?te:0,right:Number.isFinite(te)?te:0}}})}},be=q=>{const Z=q.target.closest("button");if(!Z)return;const te=Z.name,ae=Z.classList.contains("selected-td-form__button--active");Z.className=ae?"ant-btn ant-btn-default":"ant-btn ant-btn-default selected-td-form__button--active";try{Z.blur()}catch{}te==="headingBold"?Y(!ae):te==="headingItalic"?I(!ae):te==="linkUnderline"?ke(!ae):te==="buttonsBold"?Q(!ae):te==="buttonsItalic"&&Ae(!ae),n({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:{[te]:!ae}})},ue=q=>{const Z=d.getFieldsValue(!0),te=Object.keys(q)[0];let ae={};switch(te){case"headingFontSize":ve(Math.min(Z.headingFontSize-1,19)),ae=q;break;case"textFontSize":xe(Math.max(Z.textFontSize+1,20)),ae=q;break;case"buttons_borderStyle":ae={buttonsBorder:{[Z.buttons_borderPosition]:{...b[Z.buttons_borderPosition],style:q[te]}}},Z.buttons_borderPosition==="all"?h(de=>({...r.RESET_BORDER_PARAMS,[Z.buttons_borderPosition]:{...de[Z.buttons_borderPosition],style:q[te]}})):h(de=>({...de,[Z.buttons_borderPosition]:{...de[Z.buttons_borderPosition],style:q[te]}}));break;case"buttons_borderColor":ae={buttonsBorder:{[Z.buttons_borderPosition]:{...b[Z.buttonsBorderPosition],color:q[te]}}},Z.buttons_borderPosition==="all"?h(de=>({...r.RESET_BORDER_PARAMS,[Z.buttons_borderPosition]:{...de[Z.buttons_borderPosition],color:q[te]}})):h(de=>({...de,[Z.buttons_borderPosition]:{...de[Z.buttons_borderPosition],color:q[te]}}));break;case"buttons_borderWidth":ae={buttonsBorder:{[Z.buttons_borderPosition]:{...b[Z.buttons_borderPosition],width:q[te]}}},Z.buttonsBorderPosition==="all"?h(de=>({...r.RESET_BORDER_PARAMS,[Z.buttons_borderPosition]:{...de[Z.buttons_borderPosition],width:q[te]}})):h(de=>({...de,[Z.buttons_borderPosition]:{...de[Z.buttons_borderPosition],width:q[te]}}));break;case"buttons_borderPosition":d.setFieldsValue({buttons_borderWidth:b[q[te]]?.width||"",buttons_borderColor:b[q[te]]?.color||"",buttons_borderStyle:b[q[te]]?.style||""});break;case"cards_borderStyle":ae={cardsBorder:{[Z.cards_borderPosition]:{...k[Z.cards_borderPosition],style:q[te]}}},Z.cards_borderPosition==="all"?x(de=>({...r.RESET_BORDER_PARAMS,[Z.cards_borderPosition]:{...de[Z.cards_borderPosition],style:q[te]}})):x(de=>({...de,[Z.cards_borderPosition]:{...de[Z.cards_borderPosition],style:q[te]}}));break;case"cards_borderColor":ae={cardsBorder:{[Z.cards_borderPosition]:{...k[Z.cardsBorderPosition],color:q[te]}}},Z.cards_borderPosition==="all"?x(de=>({...r.RESET_BORDER_PARAMS,[Z.cards_borderPosition]:{...de[Z.cards_borderPosition],color:q[te]}})):x(de=>({...de,[Z.cards_borderPosition]:{...de[Z.cards_borderPosition],color:q[te]}}));break;case"cards_borderWidth":ae={cardsBorder:{[Z.cards_borderPosition]:{...k[Z.cards_borderPosition],width:q[te]}}},Z.cardsBorderPosition==="all"?x(de=>({...r.RESET_BORDER_PARAMS,[Z.cards_borderPosition]:{...de[Z.cards_borderPosition],width:q[te]}})):x(de=>({...de,[Z.cards_borderPosition]:{...de[Z.cards_borderPosition],width:q[te]}}));break;case"cards_borderPosition":d.setFieldsValue({cards_borderWidth:k[q[te]]?.width||"",cards_borderColor:k[q[te]]?.color||"",cards_borderStyle:k[q[te]]?.style||""});break;case"buttons_borderRadiusAll":case"buttons_borderRadiusTopLeft":case"buttons_borderRadiusBottomLeft":case"buttons_borderRadiusTopRight":case"buttons_borderRadiusBottomRight":ae={buttonsBorderRadius:{[nm[te]]:+q[te]}};break;case"cards_borderRadiusAll":case"cards_borderRadiusTopLeft":case"cards_borderRadiusBottomLeft":case"cards_borderRadiusTopRight":case"cards_borderRadiusBottomRight":ae={cardsBorderRadius:{[dm[te]]:+q[te]}};break;case"buttonsPaddingTop":case"buttonsPaddingLeft":case"buttonsPaddingRight":case"buttonsPaddingBottom":y?(ae={padding:{all:+q[te]}},d.setFieldsValue({paddingTop:q[te],paddingLeft:q[te],paddingRight:q[te],paddingBottom:q[te]})):ae={buttonsPadding:{[$[te]]:+q[te]}};break;case"blockPaddingTop":case"blockPaddingLeft":case"blockPaddingRight":case"blockPaddingBottom":ae={blockPadding:{[cm[te]]:+q[te]}};break;case"blockPaddingTopBottom":ae={blockPadding:{top:+q[te],bottom:+q[te]}},Z.blockPaddingTop=Z.blockPaddingBottom=+q[te];break;case"blockPaddingLeftRight":ae={blockPadding:{left:+q[te],right:+q[te]}},Z.blockPaddingLeft=Z.blockPaddingRight=+q[te];break;default:ae=q}te!=="buttons_borderPosition"&&n({operation:r.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET,settings:ae})};return ne&&(0,o.jsx)("div",{className:(0,Ke.default)("appearance-panel",{[e]:e}),children:(0,o.jsxs)(t.ui_kit$Form,{form:d,layout:"vertical",name:"content_appearance_panel_form",initialValues:ne,onValuesChange:ue,autoComplete:"off",className:"element-controls",children:[null,(0,o.jsxs)(t.ui_kit$FormSection,{title:i("Blocks"),dividerTop:!1,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Blocks background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"blockBackgroundColor",style:{marginBottom:E.formItemMarginBottomMD+4},rules:[{message:i("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Background color of the contrast blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"blockContrastBackgroundColor",style:{marginBottom:E.formItemMarginBottomMD+4},rules:[{message:i("Please set the background color")}],children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})})]}),(0,o.jsx)(t.ui_kit$FormPaddingInputs,{extended:z,onToggleExtended:ce,fieldNames:{paddingLeftRight:"blockPaddingLeftRight",paddingLeft:"blockPaddingLeft",paddingRight:"blockPaddingRight",paddingTopBottom:"blockPaddingTopBottom",paddingTop:"blockPaddingTop",paddingBottom:"blockPaddingBottom"},labels:{horizontal:i("Horizontal padding"),vertical:i("Vertical padding"),left:i("Left padding"),right:i("Right padding"),top:i("Top padding"),bottom:i("Bottom padding"),individual:i("Individual padding")},gutter:10,rowStyle:{paddingBottom:4}})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:i("General text"),dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Font of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textFontFamily",style:{marginBottom:E.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{loadGoogleFonts:l,getPopupContainer:q=>q.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:Ue,placeholder:i("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Line height of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textLineHeight",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Color of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrast block text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textContrastColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Text color"),usedColors:c.usedColors})})})})]}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom padding of the general text"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"textPaddingBottom",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom padding"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingBottom",component:t.icons$PaddingBottom}),addonAfter:"px"})})})})})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:i("Headings"),dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading font"),placement:"left",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingFontFamily",style:{marginBottom:E.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{loadGoogleFonts:l,getPopupContainer:q=>q.closest(".email-pane__content-col")})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingFontSize",style:{marginBottom:E.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:Be,max:40,placeholder:i("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading line height"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingLineHeight",style:{marginBottom:E.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Line height"),prefix:(0,o.jsx)(r.EmIcons,{icon:"LineHeightOutlined",component:t.icons$LineHeightOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading letter spacing"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingLetterSpacing",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Letter spacing"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsxs)(t.ui_kit$Space,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Strong"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)({"selected-td-form__button--active":W}),type:"default",name:"headingBold",onClick:be,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined})})}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Italic"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)({"selected-td-form__button--active":ee}),type:"default",name:"headingItalic",onClick:be,children:(0,o.jsx)(r.EmIcons,{icon:"ItalicOutlined",component:t.icons$ItalicOutlined})})})]})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Heading color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Heading color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrast block header color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingContrastColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Heading color"),usedColors:c.usedColors})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Top padding"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingPaddingTop",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Top padding"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingTop",component:t.icons$PaddingTop}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom padding"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"headingPaddingBottom",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom padding"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingBottom",component:t.icons$PaddingBottom}),addonAfter:"px"})})})})]})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:i("Links"),dividerTop:!0,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Link color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkColor",style:{marginBottom:E.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Link color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Underline"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)({"selected-td-form__button--active":le}),type:"default",name:"linkUnderline",onClick:be,children:(0,o.jsx)(r.EmIcons,{icon:"UnderlineOutlined",component:t.icons$UnderlineOutlined})})})})]}),(0,o.jsx)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Link color in contrasting blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"linkContrastColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Link color"),usedColors:c.usedColors})})})})})]}),(0,o.jsxs)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Text & background")]}),dividerTop:!0,children:[(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons font"),placement:"left",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsFontFamily",style:{marginBottom:E.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ControlFontFamily,{loadGoogleFonts:l,getPopupContainer:q=>q.closest(".email-pane__content-col")})})}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons font size"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsFontSize",style:{marginBottom:E.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Font size"),prefix:(0,o.jsx)(r.EmIcons,{icon:"FontSizeOutlined",component:t.icons$FontSizeOutlined}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons letter spacing"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsLetterSpacing",style:{marginBottom:E.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Letter spacing"),prefix:(0,o.jsx)(r.EmIcons,{icon:"ColumnWidthOutlined",component:t.icons$ColumnWidthOutlined}),addonAfter:"px"})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsColor",style:{marginBottom:E.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Buttons text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Button text color in contrasting blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsContrastColor",style:{marginBottom:E.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Buttons text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Buttons background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsBackgroundColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Button background color in contrasting blocks"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsContrastBackgroundColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Background color"),usedColors:c.usedColors})})})}),_.formButtonFieldTextAlignEnabled&&(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(st,{form:d,elementSettings:{textAlign:"",type:"email"},imgParent:!1,name:"buttonsAlign",withHotKeys:!1})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsxs)(t.ui_kit$Space,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Strong"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)({"selected-td-form__button--active":Ne}),type:"default",name:"buttonsBold",onClick:be,children:(0,o.jsx)(r.EmIcons,{icon:"BoldOutlined",component:t.icons$BoldOutlined})})}),(0,o.jsx)(t.ui_kit$Tooltip,{placement:"bottom",title:i("Italic"),children:(0,o.jsx)(t.ui_kit$Button,{className:(0,Ke.default)({"selected-td-form__button--active":fe}),type:"default",name:"buttonsItalic",onClick:be,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)(U.SelectedElementFormBorder,{form:d,borders:b,namePrefix:"buttons_"})})}),_.formFieldBorderRadiusEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Border radius")]}),dividerTop:!0,children:(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(vo,{form:d,oneBorderRadiusValue:T,setOneBorderRadiusValue:v,elementSettings:ne,namePrefix:"buttons_"})})}),(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Buttons")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Margins")]}),dividerTop:!0,children:(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Top margin"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsMarginTop",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Top margin"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingTop",component:t.icons$PaddingTop}),addonAfter:"px"})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Bottom margin"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"buttonsMarginBottom",children:(0,o.jsx)(t.ui_kit$DraggableInputNumber,{min:0,placeholder:i("Bottom margin"),prefix:(0,o.jsx)(r.EmIcons,{icon:"PaddingBottom",component:t.icons$PaddingBottom}),addonAfter:"px"})})})})]})}),(0,o.jsxs)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Cards")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Colors")]}),dividerTop:!0,children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:10,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:i("Base colors"),compact:!0,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Base background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsBaseBackgroundColor",style:{marginBottom:E.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Base background color"),usedColors:c.usedColors})})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$FormSection,{title:i("Contrasting colors"),compact:!0,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrasting background color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsContrastBackgroundColor",style:{marginBottom:E.formItemMarginBottomXS},children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Contrasting background color"),usedColors:c.usedColors})})})})})]}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,style:{paddingBottom:4},children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Base text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsBaseTextColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Base text color"),usedColors:c.usedColors})})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Tooltip,{trigger:["hover"],title:i("Contrasting text color"),placement:"bottom",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:"cardsContrastTextColor",children:(0,o.jsx)(t.ui_kit$ColorPickerInput,{placeholder:i("Contrasting text color"),usedColors:c.usedColors})})})})]})]}),_.formFieldBorderEnabled&&(0,o.jsx)(t.ui_kit$FormSection,{title:(0,o.jsxs)(o.Fragment,{children:[i("Cards")," ",(0,o.jsx)("span",{className:"section-title-bull",children:"•"})," ",i("Borders")]}),dividerTop:!0,children:(0,o.jsx)("div",{style:{paddingBottom:4},children:(0,o.jsx)(U.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)(vo,{form:d,oneBorderRadiusValue:P,setOneBorderRadiusValue:B,elementSettings:ne,namePrefix:"cards_"})})})]})})},ar=({email:e})=>{const{__:i}=r.useI18n(),l=e.hasOwnProperty("type")?r.BLOCK:r.EMAIL,[s,n]=(0,a.useState)(r.APPEARANCE),d=r.useAppConfig(),c=m=>n(m||"");e.common_styles&&e.common_styles;const p=l==="email"&&d.commonStylesEnabled&&!0;let g=[{label:(0,o.jsx)(o.Fragment,{children:i(l==="email"?"Global styles":"Block styles")}),key:r.APPEARANCE,forceRender:!0,className:"email-settings__collapse-panel",children:l==="email"?(0,o.jsx)(Gs,{className:"email-settings__collapse-panel-content"}):(0,o.jsx)(Ks,{className:"email-settings__collapse-panel-content"})}];return p&&g.push({label:(0,o.jsx)(o.Fragment,{children:i("Content styles")}),key:"contentStyles",forceRender:!0,className:"email-settings__collapse-panel",children:(0,o.jsx)(um,{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})})};ar.propTypes={};var mm=bo.__commonJSMin((e=>{var i=["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"].reduce((l,s)=>(l[s.toLowerCase()]=s,l),{});e.CASE_SENSITIVE_TAG_NAMES_MAP=i}));function pm(e){return e.type===po.Tag||e.type===po.Script||e.type===po.Style}var po,hm,bm,gm,fm,_m,xm,km,Em,Sm,ea=bo.__esmMin((()=>{(function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"})(po||(po={})),hm=po.Root,bm=po.Text,gm=po.Directive,fm=po.Comment,_m=po.Script,xm=po.Style,km=po.Tag,Em=po.CDATA,Sm=po.Doctype}));function oa(e){return pm(e)}function ta(e){return e.type===po.CDATA}function ia(e){return e.type===po.Text}function ra(e){return e.type===po.Comment}function la(e){return e.type===po.Directive}function sa(e){return e.type===po.Root}function Bm(e){return Object.hasOwn(e,"children")}function nr(e,i=!1){let l;if(ia(e))l=new Pt(e.data);else if(ra(e))l=new ci(e.data);else if(oa(e)){const s=i?dr(e.children):[],n=new pi(e.name,{...e.attribs},s);for(const d of s)d.parent=n;e.namespace!=null&&(n.namespace=e.namespace),e["x-attribsNamespace"]&&(n["x-attribsNamespace"]={...e["x-attribsNamespace"]}),e["x-attribsPrefix"]&&(n["x-attribsPrefix"]={...e["x-attribsPrefix"]}),l=n}else if(ta(e)){const s=i?dr(e.children):[],n=new mi(s);for(const d of s)d.parent=n;l=n}else if(sa(e)){const s=i?dr(e.children):[],n=new At(s);for(const d of s)d.parent=n;e["x-mode"]&&(n["x-mode"]=e["x-mode"]),l=n}else if(la(e)){const s=new ui(e.name,e.data);e["x-name"]!=null&&(s["x-name"]=e["x-name"],s["x-publicId"]=e["x-publicId"],s["x-systemId"]=e["x-systemId"]),l=s}else throw new Error(`Not implemented yet: ${e.type}`);return l.startIndex=e.startIndex,l.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(l.sourceCodeLocation=e.sourceCodeLocation),l}function dr(e){const i=e.map(l=>nr(l,!0));for(let l=1;l<i.length;l++)i[l].prev=i[l-1],i[l-1].next=i[l];return i}var di,Ct,Pt,ci,ui,Nt,mi,At,pi,aa=bo.__esmMin((()=>{ea(),di=class{parent=null;prev=null;next=null;startIndex=null;endIndex=null;get parentNode(){return this.parent}set parentNode(e){this.parent=e}get previousSibling(){return this.prev}set previousSibling(e){this.prev=e}get nextSibling(){return this.next}set nextSibling(e){this.next=e}cloneNode(e=!1){return nr(this,e)}},Ct=class extends di{data;constructor(e){super(),this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}},Pt=class extends Ct{type=po.Text;get nodeType(){return 3}},ci=class extends Ct{type=po.Comment;get nodeType(){return 8}},ui=class extends Ct{type=po.Directive;name;constructor(e,i){super(i),this.name=e}get nodeType(){return 1}"x-name";"x-publicId";"x-systemId"},Nt=class extends di{children;constructor(e){super(),this.children=e}get firstChild(){return this.children[0]??null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(e){this.children=e}},mi=class extends Nt{type=po.CDATA;get nodeType(){return 4}},At=class extends Nt{type=po.Root;get nodeType(){return 9}},pi=class extends Nt{name;attribs;type;constructor(e,i,l=[],s=e==="script"?po.Script:e==="style"?po.Style:po.Tag){super(l),this.name=e,this.attribs=i,this.type=s}get nodeType(){return 1}get tagName(){return this.name}set tagName(e){this.name=e}get attributes(){return Object.keys(this.attribs).map(e=>({name:e,value:this.attribs[e],namespace:this["x-attribsNamespace"]?.[e],prefix:this["x-attribsPrefix"]?.[e]}))}namespace;"x-attribsNamespace";"x-attribsPrefix"}})),cr=bo.__exportAll({CDATA:()=>mi,Comment:()=>ci,DataNode:()=>Ct,Document:()=>At,DomHandler:()=>mr,Element:()=>pi,Node:()=>di,NodeWithChildren:()=>Nt,ProcessingInstruction:()=>ui,Text:()=>Pt,cloneNode:()=>nr,default:()=>mr,hasChildren:()=>Bm,isCDATA:()=>ta,isComment:()=>ra,isDirective:()=>la,isDocument:()=>sa,isTag:()=>oa,isText:()=>ia}),ur,mr,pr=bo.__esmMin((()=>{ea(),aa(),aa(),ur={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},mr=class{dom=[];root=new At(this.dom);callback;options;elementCB;done=!1;tagStack=[this.root];lastNode=null;parser=null;constructor(e,i,l){typeof i=="function"&&(l=i,i=ur),typeof e=="object"&&(i=e,e=void 0),this.callback=e??null,this.options=i??ur,this.elementCB=l??null}onparserinit(e){this.parser=e}onreset(){this.dom=[],this.root=new At(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null}onend(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))}onerror(e){this.handleCallback(e)}onclosetag(){this.lastNode=null;const e=this.tagStack.pop();this.options.withEndIndices&&this.parser&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)}onopentag(e,i){const l=this.options.xmlMode?po.Tag:void 0,s=new pi(e,i,void 0,l);this.addNode(s),this.tagStack.push(s)}ontext(e){const{lastNode:i}=this;if(i&&i.type===po.Text)i.data+=e,this.options.withEndIndices&&this.parser&&(i.endIndex=this.parser.endIndex);else{const l=new Pt(e);this.addNode(l),this.lastNode=l}}oncomment(e){if(this.lastNode&&this.lastNode.type===po.Comment){this.lastNode.data+=e;return}const i=new ci(e);this.addNode(i),this.lastNode=i}oncommentend(){this.lastNode=null}oncdatastart(){const e=new Pt(""),i=new mi([e]);this.addNode(i),e.parent=i,this.lastNode=e}oncdataend(){this.lastNode=null}onprocessinginstruction(e,i){const l=new ui(e,i);this.addNode(l)}handleCallback(e){if(typeof this.callback=="function")this.callback(e,this.dom);else if(e)throw e}addNode(e){const i=this.tagStack[this.tagStack.length-1],l=i.children[i.children.length-1];this.options.withStartIndices&&this.parser&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&this.parser&&(e.endIndex=this.parser.endIndex),i.children.push(e),l&&(e.prev=l,l.next=e),e.parent=i,this.lastNode=null}}})),na=bo.__commonJSMin((e=>{var i=mm(),l=(pr(),bo.__toCommonJS(cr)),s="\r",n=new RegExp(s,"g"),d=`__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_${Date.now().toString()}__`,c=new RegExp(d,"g");function p(k){return i.CASE_SENSITIVE_TAG_NAMES_MAP[k]}function g(k){const x={};let T=0;const v=k.length;for(;T<v;T++){const P=k[T];x[P.name]=P.value}return x}function m(k){k=k.toLowerCase();const x=p(k);return x||k}function _(k,x){const T="<"+x,v=k.toLowerCase().indexOf(T);if(v===-1)return!1;const P=k[v+T.length];return P===">"||P===" "||P===" "||P===`
10
+ `||P==="\r"||P==="/"}function E(k){return k.replace(n,d)}function b(k){return k.replace(c,s)}function h(k,x=null,T){const v=[];let P,B=0;const y=k.length;for(;B<y;B++){const D=k[B];switch(D.nodeType){case 1:{const A=m(D.nodeName);P=new l.Element(A,g(D.attributes)),P.children=h(A==="template"?D.content.childNodes:D.childNodes,P);break}case 3:P=new l.Text(b(D.nodeValue??""));break;case 8:P=new l.Comment(D.nodeValue??"");break;default:continue}const z=v[B-1]??null;z&&(z.next=P),P.parent=x,P.prev=z,P.next=null,v.push(P)}return T&&(P=new l.ProcessingInstruction(T.substring(0,T.indexOf(" ")).toLowerCase(),T),P.next=v[0]??null,P.parent=x,v.unshift(P),v[1]&&(v[1].prev=v[0])),v}e.escapeSpecialCharacters=E,e.formatDOM=h,e.hasOpenTag=_})),Tm=bo.__commonJSMin((e=>{var i=na(),l="html",s="head",n="body",d=/<([a-zA-Z]+[0-9]?)/;function c(k,x){return x?x.createHTML(k):k}var p=(k,x,T)=>{throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},g=(k,x,T)=>{throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},m=typeof window=="object"&&window.DOMParser;if(typeof m=="function"){const k=new m,x="text/html";g=(T,v,P)=>(v&&(T=`<${v}>${T}</${v}>`),k.parseFromString(T,x)),p=g}if(typeof document=="object"&&document.implementation){const k=document.implementation.createHTMLDocument();p=function(x,T,v){if(T){const P=k.documentElement.querySelector(T);return P&&(P.innerHTML=c(x,v)),k}return k.documentElement.innerHTML=c(x,v),k}}var _=typeof document=="object"&&document.createElement("template"),E;_&&_.content&&(E=(k,x)=>(_.innerHTML=c(k,x),_.content.childNodes));var b=()=>document.createDocumentFragment().childNodes;function h(k,x){k=i.escapeSpecialCharacters(k);const T=d.exec(k)?.[1]?.toLowerCase();switch(T){case l:{const v=g(k);if(!i.hasOpenTag(k,s)){const P=v.querySelector(s);P?.parentNode?.removeChild(P)}if(!i.hasOpenTag(k,n)){const P=v.querySelector(n);P?.parentNode?.removeChild(P)}return v.querySelectorAll(l)}case s:case n:{const v=p(k,void 0,x).querySelectorAll(T);return i.hasOpenTag(k,n)&&i.hasOpenTag(k,s)?v[0].parentNode?.childNodes??b():v}default:return E?E(k,x):p(k,n,x).querySelector(n)?.childNodes??b()}}e.default=h})),Rm=bo.__commonJSMin((e=>{Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var i=na(),l=Tm(),s=/<(![a-zA-Z\s]+)>/;function n(d,c){if(typeof d!="string")throw new TypeError("First argument must be a string");if(!d)return[];const p=s.exec(d),g=p?p[1]:void 0;return i.formatDOM(l.default(d,c?.trustedTypePolicy),null,g)}e.default=n})),ym=bo.__commonJSMin((e=>{var i=0;e.SAME=i;var l=1;e.CAMELCASE=l,e.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1}})),wm=bo.__commonJSMin((e=>{var i=0,l=1,s=2,n=3,d=4,c=5,p=6;function g(B){return _.hasOwnProperty(B)?_[B]:null}function m(B,y,D,z,A,$,j){this.acceptsBooleans=y===s||y===n||y===d,this.attributeName=z,this.attributeNamespace=A,this.mustUseProperty=D,this.propertyName=B,this.type=y,this.sanitizeURL=$,this.removeEmptyString=j}var _={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(B=>{_[B]=new m(B,i,!1,B,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([B,y])=>{_[B]=new m(B,l,!1,y,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(B=>{_[B]=new m(B,s,!1,B.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(B=>{_[B]=new m(B,s,!1,B,null,!1,!1)}),["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach(B=>{_[B]=new m(B,n,!1,B.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(B=>{_[B]=new m(B,n,!0,B,null,!1,!1)}),["capture","download"].forEach(B=>{_[B]=new m(B,d,!1,B,null,!1,!1)}),["cols","rows","size","span"].forEach(B=>{_[B]=new m(B,p,!1,B,null,!1,!1)}),["rowSpan","start"].forEach(B=>{_[B]=new m(B,c,!1,B.toLowerCase(),null,!1,!1)});var E=/[\-\:]([a-z])/g,b=B=>B[1].toUpperCase();["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach(B=>{const y=B.replace(E,b);_[y]=new m(y,l,!1,B,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(B=>{const y=B.replace(E,b);_[y]=new m(y,l,!1,B,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(B=>{const y=B.replace(E,b);_[y]=new m(y,l,!1,B,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(B=>{_[B]=new m(B,l,!1,B.toLowerCase(),null,!1,!1)});var h="xlinkHref";_[h]=new m("xlinkHref",l,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(B=>{_[B]=new m(B,l,!1,B.toLowerCase(),null,!0,!0)});var{CAMELCASE:k,SAME:x,possibleStandardNames:T}=ym(),v=RegExp.prototype.test.bind(new RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$")),P=Object.keys(T).reduce((B,y)=>{const D=T[y];return D===x?B[y]=y:D===k?B[y.toLowerCase()]=y:B[y]=D,B},{});e.BOOLEAN=n,e.BOOLEANISH_STRING=s,e.NUMERIC=c,e.OVERLOADED_BOOLEAN=d,e.POSITIVE_NUMERIC=p,e.RESERVED=i,e.STRING=l,e.getPropertyInfo=g,e.isCustomAttribute=v,e.possibleStandardNames=P}));function jm(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(ca);x&&(l+=x.length);var T=k.lastIndexOf(fa);s=~T?k.length-T:s+k.length}function d(){var k={line:l,column:s};return function(x){return x.position=new c(k),m(),x}}function c(k){this.start=k,this.end={line:l,column:s},this.source=i.source}c.prototype.content=e;function p(k){var x=new Error(i.source+":"+l+":"+s+": "+k);if(x.reason=k,x.filename=i.source,x.line=l,x.column=s,x.source=e,!i.silent)throw x}function g(k){var x=k.exec(e);if(x){var T=x[0];return n(T),e=e.slice(T.length),x}}function m(){g(ua)}function _(k){var x;for(k=k||[];x=E();)x!==!1&&k.push(x);return k}function E(){var k=d();if(!(br!=e.charAt(0)||gr!=e.charAt(1))){for(var x=2;Jo!=e.charAt(x)&&(gr!=e.charAt(x)||br!=e.charAt(x+1));)++x;if(x+=2,Jo===e.charAt(x-1))return p("End of comment missing");var T=e.slice(2,x-2);return s+=2,n(T),e=e.slice(x),s+=2,k({type:_a,comment:T})}}function b(){var k=d(),x=g(ma);if(x){if(E(),!g(pa))return p("property missing ':'");var T=g(ha),v=k({type:xa,property:da(x[0].replace(hr,Jo)),value:T?da(T[0].replace(hr,Jo)):Jo});return g(ba),v}}function h(){var k=[];_(k);for(var x;x=b();)x!==!1&&(k.push(x),_(k));return k}return m(),h()}function da(e){return e?e.replace(ga,Jo):Jo}var hr,ca,ua,ma,pa,ha,ba,ga,fa,br,gr,Jo,_a,xa,vm=bo.__esmMin((()=>{hr=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,ca=/\n/g,ua=/^\s*/,ma=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,pa=/^:\s*/,ha=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,ba=/^[;\s]*/,ga=/^\s+|\s+$/g,fa=`
11
+ `,br="/",gr="*",Jo="",_a="comment",xa="declaration"}));function Im(e,i){let l=null;if(!e||typeof e!="string")return l;const s=jm(e),n=typeof i=="function";return s.forEach(d=>{if(d.type!=="declaration")return;const{property:c,value:p}=d;n?i(c,p,d):p&&(l=l??{},l[c]=p)}),l}var Cm=bo.__esmMin((()=>{vm()})),Pm=bo.__exportAll({default:()=>Nm});function Nm(e,i){const l={};return!e||typeof e!="string"||Im(e,(s,n)=>{s&&n&&(l[wa(s,i)]=n)}),l}var ka,Ea,Sa,Ba,Ta,Ra,ya,fr,wa,Am=bo.__esmMin((()=>{Cm(),ka=/^--[a-zA-Z0-9_-]+$/,Ea=/-([a-z])/g,Sa=/^[^-]+$/,Ba=/^-(webkit|moz|ms|o|khtml)-/,Ta=/^-(ms)-/,Ra=e=>!e||Sa.test(e)||ka.test(e),ya=(e,i)=>i.toUpperCase(),fr=(e,i)=>`${i}-`,wa=(e,i={})=>Ra(e)?e:(e=e.toLowerCase(),i.reactCompat?e=e.replace(Ta,fr):e=e.replace(Ba,fr),e.replace(Ea,ya))})),ja=bo.__commonJSMin((e=>{var i=e&&e.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(e,"__esModule",{value:!0}),e.returnFirstArg=e.canTextBeChildOfNode=e.ELEMENTS_WITH_NO_TEXT_CHILDREN=e.PRESERVE_CUSTOM_ATTRIBUTES=void 0,e.isCustomComponent=d,e.setStyleProp=p;var l=ko("react"),s=i((Am(),bo.__toCommonJS(Pm))),n=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function d(_,E){return _.includes("-")?!n.has(_):!!(E&&typeof E.is=="string")}var c={reactCompat:!0};function p(_,E){if(typeof _=="string"){if(!_.trim()){E.style={};return}try{E.style=(0,s.default)(_,c)}catch{E.style={}}}}e.PRESERVE_CUSTOM_ATTRIBUTES=Number(l.version.split(".")[0])>=16,e.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var g=_=>!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(_.name);e.canTextBeChildOfNode=g;var m=_=>_;e.returnFirstArg=m})),va=bo.__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var i=wm(),l=ja(),s=["checked","value"],n=["input","select","textarea"],d={reset:!0,submit:!0};function c(g={},m){const _={},E=!!(g.type&&d[g.type]);for(const b in g){const h=g[b];if((0,i.isCustomAttribute)(b)){_[b]=h;continue}const k=b.toLowerCase();let x=p(k);if(x){const T=(0,i.getPropertyInfo)(x);switch(s.includes(x)&&n.includes(m)&&!E&&(x=p("default"+k)),_[x]=h,T?.type){case i.BOOLEAN:_[x]=!0;break;case i.OVERLOADED_BOOLEAN:h===""&&(_[x]=!0)}continue}l.PRESERVE_CUSTOM_ATTRIBUTES&&(_[b]=h)}return(0,l.setStyleProp)(g.style,_),_}function p(g){return i.possibleStandardNames[g]}})),Lm=bo.__commonJSMin((e=>{var i=e&&e.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=p;var l=(pr(),bo.__toCommonJS(cr)),s=ko("react"),n=i(va()),d=ja(),c={cloneElement:s.cloneElement,createElement:s.createElement,isValidElement:s.isValidElement};function p(_,E={}){var b,h,k,x,T;const v=[],P=typeof E.replace=="function",B=(b=E.transform)!==null&&b!==void 0?b:d.returnFirstArg,{cloneElement:y,createElement:D,isValidElement:z}=(h=E.library)!==null&&h!==void 0?h:c,A=_.length;g(_);for(let $=0;$<A;$++){const j=_[$];if(P){let I=(k=E.replace)===null||k===void 0?void 0:k.call(E,j,$);if(z(I)){A>1&&(I=y(I,{key:(x=I.key)!==null&&x!==void 0?x:$})),v.push(B(I,j,$));continue}}if(j.type==="text"){const I=!j.data.trim().length;if(I&&j.parent&&!(0,d.canTextBeChildOfNode)(j.parent)||E.trim&&I)continue;v.push(B(j.data,j,$));continue}const W=j;let Y={};m(W)?((0,d.setStyleProp)(W.attribs.style,W.attribs),Y=W.attribs):W.attribs&&(Y=(0,n.default)(W.attribs,W.name));let ee;switch(j.type){case"script":case"style":j.children[0]&&(Y.dangerouslySetInnerHTML={__html:j.children[0].data});break;case"tag":j.name==="textarea"&&j.children[0]?Y.defaultValue=j.children[0].data:!((T=j.children)===null||T===void 0)&&T.length&&(ee=p(j.children,E));break;default:continue}A>1&&(Y.key=$),v.push(B(D(j.name,Y,ee),j,$))}return v.length===1?v[0]:v}function g(_){for(const E of _)(E.type==="tag"||E.type==="script"||E.type==="style")&&(Object.setPrototypeOf(E,l.Element.prototype),g(E.children))}function m(_){return d.PRESERVE_CUSTOM_ATTRIBUTES&&_.type==="tag"&&(0,d.isCustomComponent)(_.name,_.attribs)}})),Om=bo.__commonJSMin((e=>{var i=e&&e.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(e,"__esModule",{value:!0}),e.htmlToDOM=e.domToReact=e.attributesToProps=e.Text=e.ProcessingInstruction=e.Element=e.Comment=void 0,e.default=p;var l=i(Rm());e.htmlToDOM=l.default;var s=i(va());e.attributesToProps=s.default;var n=i(Lm());e.domToReact=n.default;var d=(pr(),bo.__toCommonJS(cr));Object.defineProperty(e,"Comment",{enumerable:!0,get:function(){return d.Comment}}),Object.defineProperty(e,"Element",{enumerable:!0,get:function(){return d.Element}}),Object.defineProperty(e,"ProcessingInstruction",{enumerable:!0,get:function(){return d.ProcessingInstruction}}),Object.defineProperty(e,"Text",{enumerable:!0,get:function(){return d.Text}});var c={lowerCaseAttributeNames:!1};function p(g,m){var _;if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];const E=Object.assign(Object.assign({},(_=m?.htmlparser2)!==null&&_!==void 0?_:c),{trustedTypePolicy:m?.trustedTypePolicy});return(0,n.default)((0,l.default)(g,E),m)}})),_t=bo.__toESM(Om(),1),$m=_t.default.default||_t.default,_r=new Set;function Fm(e,i){_r.has(e)||(_r.add(e),Promise.resolve(i()).finally(()=>{_r.delete(e)}))}var Mm={subject:"insert_generated_subject",preheader:"insert_generated_preheader"};function Ia(e,i,l){l.document&&(r.writeEmailAttributes(l.document,{[e]:i}),l.pushToDataLayer({event:"submit",action:Mm[e],entity_type:l.entityType,entity_id:l.entityId,project_id:l.projectId,context:"editor"}))}function xr({limitsInPlugin:e,hostedAiActive:i}){return e&&!i}function Ca({limitsInPlugin:e,hostedAiActive:i,counter:l,limit:s}){return xr({limitsInPlugin:e,hostedAiActive:i})?s>0&&l>=s:!1}function Pa(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 Dm=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")]})}]},Vm={background:r.emCssVar("colorInfo"),color:"#ffffff"},Na=({messages:e,newEmailAiGeneratorRef:i})=>{const l=r.useElementEntityKind(),{document:s}=r.useDocumentSessionContext(),n=r.useContentReader(),d=r.useUserContentReplacer(),{__:c,_n:p}=r.useI18n(),g=r.useDispatch(),m=r.useAppNavigate(),_=(0,a.useRef)(null),E=r.useAppConfig(),b=r.useEditorLocked(),h=r.useEditorLockCheck(),k=r.useNotification(),x=r.useEditorProjectId(),T=r.useWpEntityId(),v=r.usePushToDataLayer(),P={document:s,pushToDataLayer:v,entityType:l==="block"?"block":"email",entityId:T,projectId:x},B=r.useEventEmitter(Po.events.ON_LIMIT_ID),[y,D]=(0,a.useState)(null),[z,A]=(0,a.useState)(0),[$,j]=(0,a.useState)(!1),[W,Y]=(0,a.useState)(""),[ee,I]=(0,a.useState)([]),[le,ke]=(0,a.useState)(!1),[Ne,Q]=(0,a.useState)(!1),[fe,Ae]=(0,a.useState)(null),[ne,Fe]=(0,a.useState)(0),[Le,Ue]=(0,a.useState)(null),ve=r.useEmailAttribute("subject"),Be=r.useEmailAttribute("preheader"),xe=r.useCurrentUser(),ce=r.toLanguageCode(r.useInterfaceLocale()),be=xe.avatar_url||xe.avatar_urls?.[24],ue=[xe.first_name,xe.last_name].filter(Boolean).join(" ")||xe.username,q=r.useMessageService(),[Z]=r.useLazyGetDialogQuery(),te=r.useSendPostMessage(),[ae,de]=r.useSendMessageMutation(),De=(0,a.useRef)(new Set),oe=(0,a.useCallback)(J=>{const Ve=ae(J),qe=De.current;qe.add(Ve);const We=()=>qe.delete(Ve);return Ve.then(We,We),Ve},[ae]);(0,a.useEffect)(()=>{const J=De.current;return()=>{J.forEach(Ve=>Ve.abort?.()),J.clear()}},[]);const[Te,{reset:_e}]=r.useGetAiGenerateStatusMutation(),[Ce,{data:R=[]}]=r.useLazyGetGeneratedContentQuery(),[V]=r.useLazyGetLimitsStatsByTypeQuery(),L={cursor:$?"not-allowed":"default",pointerEvents:$?"none":"auto"};(0,a.useEffect)(()=>{Le&&le&&(i.current=!0),le||(i.current=!1)},[Le,le]);const X=!!(E.limits&&E.counters)&&!0,{limits:ie}=E.limits?E:{limits:{ai_limit:0,ai_generator_limit:0}},{ai_limit:me,ai_generator_limit:he}=ie,$e=r.useEventEmitter(Po.events.AI_TEXT_REQUEST_ID).hasListeners(),je=xr({limitsInPlugin:X,hostedAiActive:$e}),G=Ca({limitsInPlugin:X,hostedAiActive:$e,counter:z,limit:me}),re=Ca({limitsInPlugin:X,hostedAiActive:$e,counter:ne,limit:he}),O=(0,a.useCallback)(()=>{B.fire({name:"AiChatCount",count:z+1})},[B,z]),pe=(0,a.useCallback)(()=>{B.fire({name:"AiGeneratorCount",count:ne+1})},[B,ne]),ye=(0,a.useCallback)(async J=>!0,[c,V,k]);(0,a.useEffect)(()=>{X&&(A(E?.counters?.ai_counter||0),Fe(E?.counters?.ai_generator_counter||0))},[E,X]),(0,a.useEffect)(()=>{Ue(ee.length<=0?!1:ee.toReversed().find(Ve=>Ve.data?.context)?.data.context==="email-generator")},[ee]);const ze=(0,a.useCallback)(async()=>await q.sendAsync(r.EVENT_TYPES.SANDBOX_IS_EMAIL_EMPTY),[q]),oo=(0,a.useCallback)(()=>{const J=_.current?.closest(".ant-tabs-content.ant-tabs-content-top");setTimeout(()=>{J?.scrollTo({top:J.scrollHeight,behavior:"smooth"})},0)},[_]),ro=(0,a.useCallback)(()=>{r.swallowPromiseRejection(Z({entity_id:T}).then(J=>{I(J.data.documents),oo()}))},[T,Z,I,oo]),ao=(0,a.useCallback)(J=>{if(!J?.data?._eventResult)return!1;const{aiMessage:Ve,aiHtml:qe}=J.data;if(I(We=>{const to=[...We];for(let Qe=to.length-1;Qe>=0;Qe--)if(to[Qe]?.data?.isLoading&&to[Qe]?.data?.role==="assistant"){to[Qe]={data:{role:"assistant",message:Ve,isLoading:!1}};break}return to}),qe){const We=Pa(n(),String(qe));d(We,{undoable:!0})}return oo(),!0},[n,d,oo]),M=(0,a.useCallback)(J=>{I(Ve=>{for(let qe=Ve.length-1;qe>=0;qe--)if(Ve[qe]?.data?.isLoading&&Ve[qe]?.data?.role==="assistant"){const We=[...Ve];return J?We[qe]={data:{role:"assistant",message:J}}:We.splice(qe,1),We}return Ve})},[]),se=(0,a.useCallback)(J=>{const Ve=J?.message==="ERROR"?void 0:J?.message;return[J?.data?.message,Ve].find(qe=>typeof qe=="string"&&qe)||c("Something went wrong.")},[c]),C=s?.get().docId,H=r.useEventEmitter(Po.events.AI_TEXT_PROGRESS_ID);(0,a.useEffect)(()=>{const J=H.event(({progress:Ve,status:qe,docId:We})=>{if(We!==C)return;const to=qe||`${Math.round(Ve)}%`;I(Qe=>{const wo=[...Qe];for(let Eo=wo.length-1;Eo>=0;Eo--)if(wo[Eo]?.data?.isLoading&&wo[Eo]?.data?.role==="assistant"){wo[Eo]={data:{...wo[Eo].data,message:to}};break}return wo})});return()=>J.dispose()},[H,C]);const Pe=r.useEventEmitter(Po.events.AI_TEXT_STREAM_ID);(0,a.useEffect)(()=>{const J=Pe.event(({partialHtml:Ve,docId:qe})=>{if(qe!==C)return;const We=Pa(n(),String(Ve));d(We,{undoable:!0})});return()=>J.dispose()},[Pe,n,d,g,C]);const He=(0,a.useCallback)(J=>{ke(!0),j(!0),r.swallowPromiseRejection(Te({task_id:J||y,entity_id:T,status:"started"}).then(()=>{ro()}))},[T,Te,y,ro]),_o=(0,a.useCallback)(()=>{Te({task_id:y,entity_id:T,status:"completed"}).then(J=>{J.data.status===403&&_e(),ro()}).catch(J=>{}),j(!1),ke(!1)},[T,Te,y,ro,_e]);(0,a.useEffect)(()=>{let J;if(le){const Ve=R[R.length-1]?.processing?.email;if(Ve){let qe=R[R.length-1].status;d(String(Ve),{undoable:!0}),qe===0&&_o()}fe&&(clearInterval(J),ke(!1),Ae(!1),j(!1),M())}return()=>{clearInterval(J)}},[d,fe,g,R,le,ve,Be,T,y,ro,Te,de,_o,M]),(0,a.useEffect)(oo,[oo]),(0,a.useEffect)(()=>{e?.length>0&&I(e),te({operation:r.EVENT_TYPES.SANDBOX_EMAIL_CONTENT_GET})},[e,te]),(0,a.useEffect)(()=>{const J=q.onInit(()=>{q.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:$}),q.send({operation:r.EVENT_TYPES.SANDBOX_LOCK_DISCUSS,value:$})});return()=>J.dispose()},[$,q]);const mo=async()=>{if(W&&!h()){const J=W.replaceAll(/\n/g,"<br>"),Ve={project_id:x,connection:"chat",entity_id:T,message:J,locale:ce,subject:ve||"",preheader:Be||"",textContent:gi.extractDocumentTextContent(n())};if(Le&&re||G){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 qe={data:{role:"assistant",message:c(Le?"You have reached the limit of AI generator usage.":"You have reached the limit of AI chat usage.")}};I(We=>[...We,qe])}else{if(!await ye(Le?"email_generate":"ai")){Y("");return}je&&(Le&&ne!==he?(pe(),Fe(We=>We+1)):z!==me&&(O(),A(We=>We+1))),v({event:"submit_form",action:"chat_whit_ai_assistant",entity_id:Ve.entity_id,project_id:Ve.project_id});const qe=[{data:{role:"user",message:J,userInfo:{display_name:ue,avatar_url:be}}},{data:{role:"assistant",message:c("Typing..."),isLoading:!0}}];I(We=>[...We,...qe]),oe({body:Ve}).then(We=>{if(We?.error)throw We.error;if(!We?.data||We.data.status===401)throw new Error(r.ERROR);if(!ao(We)){if(v({event:"submit",action:"send_discussion_chat_message",entity_type:l==="block"?"block":"email",entity_id:T,project_id:x,context:"editor"}),We.data.task_id){let to=We.data.task_id;D(to),Ce({id:to,setError:Ae}),r.swallowPromiseRejection(ze().then(Qe=>{Qe?He(to):Q(!0)}))}ro()}}).catch(We=>{const to=se(We);k.error({title:We?.data?.code||c("Error"),description:to}),M(to)})}Y("")}},co=async J=>{if(h())return;const Ve={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};I(We=>[...We,Ve]);const qe={project_id:x,connection:"chat",entity_id:T,context:J,locale:ce,subject:ve||"",preheader:Be||"",textContent:gi.extractDocumentTextContent(n())};if(je&&(Le&&ne!==he?(pe(),Fe(We=>We+1)):z!==me&&(O(),A(We=>We+1))),G)k.error({title:c("You have reached the limit of AI chat usage."),description:c("Please upgrade your plan.")}),M(c("You have reached the limit of AI chat usage."));else{if(!await ye("ai")){M();return}v({event:"select",action:"select_ai_assistant_role",context:qe.context,entity_id:qe.entity_id,project_id:qe.project_id}),oe({body:qe}).then(We=>{if(We?.error)throw We.error;if(!We?.data||We.data.status===401)throw new Error(r.ERROR);ao(We)||ro()}).catch(We=>{const to=se(We);k.error({title:We?.data?.code||c("Error"),description:to}),M(to)})}},ge=(0,a.useCallback)(async J=>{const Ve={data:{role:"user",message:J,userInfo:{display_name:ue,avatar_url:be}}},qe={data:{role:"assistant",message:c("Typing..."),isLoading:!0}};I(to=>[...to,Ve,qe]);const We={project_id:x,connection:"chat",entity_id:T,message:J,locale:ce,subject:ve||"",preheader:Be||"",textContent:gi.extractDocumentTextContent(n())};if(re)k.error({title:c("You have reached the limit of AI generator usage."),description:c("Please upgrade your plan.")}),M(c("You have reached the limit of AI chat usage."));else{if(!await ye(Le?"email_generate":"ai")){M();return}oe({body:We}).then(to=>{if(to?.error)throw to.error;if(!to?.data||to.data.status===401)throw new Error(r.ERROR);if(!ao(to)){if(v({event:"submit",action:"send_discussion_chat_message",entity_type:l==="block"?"block":"email",entity_id:T,project_id:x,context:"editor"}),to.data.task_id){let Qe=to.data.task_id;D(Qe),Ce({id:Qe,setError:Ae}),r.swallowPromiseRejection(ze().then(wo=>{wo?He(Qe):Q(!0)}))}je&&(Le&&ne!==he?(pe(),Fe(Qe=>Qe+1)):z!==me&&(O(),A(Qe=>Qe+1))),ro()}}).catch(to=>{const Qe=se(to);k.error({title:to?.data?.code||c("Error"),description:Qe}),M(Qe)})}},[c,z,ne,be,ze,M,He,se,ue,me,he,xe,ve,Be,T,Le,re,ce,O,pe,je,n,k,ye,x,oe,Ce,ro]);(0,a.useEffect)(()=>{const J=new Po.Disposable,Ve=window.localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings);if((!e?.length||e.length===1&&e[0]?.data?.role==="assistant")&&Ve&&T&&!b){const qe={project_id:x,connection:"chat",entity_id:T,context:"email-generator",locale:ce};Fm(`discuss-ai-generator-context:${T}`,()=>{if($e){window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),ge(Ve);return}r.swallowPromiseRejection(ae({body:qe}).then(()=>{window.localStorage.removeItem(r.LOCAL_STORAGE_ITEMS.em_ai_settings),J.isDisposed()||ge(Ve)}))})}return()=>J.dispose()},[e,ge,T,ce,x,ae,$e,b]);const Ge=J=>{typeof J.target.className=="string"&&J.target.className.includes("ai-response-change-context")&&(de.isLoading||co(J.target.role))},Je=J=>{if(h())return;const Ve=J.children[0].data??"";Ia("subject",Ve,P),k.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Title copied to email settings"),data:Ve})},io=J=>{if(h())return;const Ve=J.children[0].data??"";Ia("preheader",Ve,P),k.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",title:c("Preheader copied to email settings"),data:Ve,duration:300})},fo=J=>{const Ve=J.children[0].data;navigator.clipboard.writeText(Ve).then(()=>{k.success({id:"TEXT_COPIED_TO_CLIPBOARD",title:c("Text copied to clipboard"),data:Ve})}).catch(qe=>{})},F={replace:J=>{if(J.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:()=>Je(J),children:(0,o.jsx)("span",{className:"ai-response-title",children:(0,_t.domToReact)(J.children,F)})})});if(J.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:()=>io(J),children:(0,o.jsx)("span",{className:"ai-response-preheader",children:(0,_t.domToReact)(J.children,F)})})});if(J.attribs?.class?.split(" ").includes("ai-response-copy"))return(0,o.jsx)(t.ui_kit$Tooltip,{placement:"left",title:c("Copy to clipboard"),children:(0,o.jsx)("div",{onClick:()=>fo(J),children:(0,o.jsx)("span",{className:"ai-response-copy",children:(0,_t.domToReact)(J.children,F)})})});if(J.attribs?.class?.split(" ").includes("ai-response-user-message")){const Ve=J.attribs?.data||J.children?.[0]?.data;return(0,o.jsx)("li",{className:J.attribs?.class,data:J.attribs?.data,onClick:()=>ge(Ve),children:(0,_t.domToReact)(J.children,F)})}}},K=()=>{He(),Q(!1)},Ie=()=>{_o(),Q(!1)};return(0,o.jsxs)("div",{ref:_,className:"discuss-main",children:[ee.length>0&&(0,o.jsx)(t.ui_kit$List,{onClick:Ge,className:"comment-list",itemLayout:"horizontal",dataSource:ee,renderItem:J=>(0,o.jsx)("li",{id:J._id,children:(0,o.jsx)(t.ui_kit$Comment,{className:J.data.userInfo?"":"ai-comment",avatar:J.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"}}):J.data.userInfo&&J.data._modified?J.data.userInfo.avatar_url:be||(0,o.jsx)(r.EmIcons,{icon:"UserOutlined",component:t.icons$UserOutlined,className:"anticon-user",style:{color:"#ffffff",fontSize:16,width:24,height:24,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"}}),author:(0,o.jsx)("div",{style:L,children:J?.data?.role==="user"?xe?.username||c("User"):c("AI Assistant")}),datetime:J._created?(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:r.formatDate(r.parseISO(J._created),p,!0)}}):null,content:J.data.isLoading?(0,o.jsx)("div",{className:"spin",children:(0,o.jsx)(r.EmIcons,{icon:"LoadingOutlined",component:t.icons$LoadingOutlined,style:{fontSize:24},spin:!0})}):(0,o.jsx)("div",{style:L,children:$m(J.data.message,F)})})},J._id)}),X&&(Le?(0,o.jsx)(t.ui_kit$LimitsCounter,{text:`${ne} ${c("of")} ${he>0?he:"∞"} ${c("mail generator")} ${p("was used","were used",ne)}`,exceeded:he>0&&ne>=he,style:{marginTop:-25},extra:(0,o.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>m(E.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})}):(0,o.jsx)(t.ui_kit$LimitsCounter,{text:`${z} ${c("of")} ${me>0?me:"∞"} ${c("messeges")} ${p("was used","were used",z)}`,exceeded:me>0&&z>=me,style:{marginTop:-25},extra:(0,o.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>m(E.billingPageUrl||r.APP_ROUTES.billing),children:c("Need more?")})})),(0,o.jsxs)(t.ui_kit$Form,{onFinish:mo,className:"addMode",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{disabled:$||b,value:W,onChange:J=>Y(J.target.value),rows:4,placeholder:c("Type your request"),className:"textarea-comment",onPressEnter:J=>J.key==="Enter"&&J.ctrlKey&&mo(),spellCheck:"false"})}),(0,o.jsx)(t.ui_kit$Form.Item,{children:(0,o.jsxs)(t.ui_kit$Space,{size:8,children:[(0,o.jsx)(t.ui_kit$Button,{disabled:de.isLoading||$||b,type:"default",style:Vm,className:"button-target",children:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"top",disabled:$,arrow:{pointAtCenter:!0},menu:{items:Dm(co)},children:(0,o.jsxs)("div",{disabled:$,style:{margin:0,padding:0,color:"#ffffff",display:"inline-flex",alignItems:"center"},children:[(0,o.jsx)(r.EmIcons,{icon:"ChatGpt",component:t.icons$ChatGpt,style:{marginRight:5}}),c("Role")]})},"Export")}),(0,o.jsxs)(t.ui_kit$Button,{disabled:de.isLoading||$||b,className:"button-add",type:"primary",htmlType:"submit",children:[c("Send")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:E.iconStrokeWidth})]})]})})]}),(0,o.jsx)(t.ui_kit$Modal,{title:c("Warning"),open:Ne,onOk:K,onCancel:Ie,children:(0,o.jsx)("p",{children:c("The current template will be changed to the generated one, are you sure about this?")})})]})},Hm=[r.VALID,r.ERRORS,r.WARNINGS],Aa=({summary:e,__:i,selectedTags:l,setSelectedTags:s})=>{const n=(0,a.useCallback)((c,p)=>{s(p?l.length===2?[]:[...l,c]:l.filter(g=>g!==c))},[l,s]),d=(0,a.useCallback)(c=>i(c==="valid"?"Valid":c==="warnings"?"Warnings":"Errors"),[i]);return(0,o.jsx)(t.ui_kit$Title,{level:5,className:"optimise__valid-title",children:(0,o.jsx)(t.ui_kit$Space,{className:"optimise__valid-title-space",size:8,children:Hm.map((c,p)=>(0,o.jsxs)(t.ui_kit$CheckableTag,{checked:l?.includes(c),onChange:g=>n(c,g),className:(0,Ke.default)(`${c} optimise__button`,{[`${c}_active`]:l.includes(c)}),children:[d(c),": ",e?.[c]||0]},c+p))})})},{LINKS:Um}=r.OPTIMISE_TABS,La=(0,a.memo)(({__:e,activeTab:i,validateLinksResult:l,validateLinks:s,selectedTags:n,setSelectedTags:d,isLoading:c,disabled:p,iconStrokeWidth:g,onValidate:m,goToLinkHandler:_})=>i!==Um||!l?.links?null:l.links.length===0?(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,o.jsx)(t.ui_kit$Alert,{title:e("No links found."),type:"info"})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-14",children:(0,o.jsxs)("div",{className:"optimise__title-wrapper",children:[(0,o.jsx)(Aa,{__:e,summary:l.summary,setSelectedTags:d,selectedTags:n}),(0,o.jsx)(t.ui_kit$Button,{disabled:p,loading:c,onClick:m,icon:(0,o.jsx)(r.EmIcons,{icon:"SyncOutlined",component:t.icons$SyncOutlined,size:16,strokeWidth:g}),children:e("Refresh")})]})}),(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$List,{itemLayout:"horizontal",dataSource:s,renderItem:(E,b)=>(0,o.jsx)(t.ui_kit$List.Item,{className:t.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{avatar:E.status==="valid"?(0,o.jsx)(r.EmIcons,{icon:"CheckCircleFilled",component:t.icons$CheckCircleFilled,className:r.VALID}):E.status==="warnings"?(0,o.jsx)(r.EmIcons,{icon:"CheckCircleFilled",component:t.icons$CheckCircleFilled,className:r.WARNINGS}):(0,o.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:t.icons$CloseCircleFilled,className:r.ERRORS}),title:(0,o.jsx)(t.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>_(E.linkId,600>(E.statusCode||0)&&(E.statusCode||0)>399||!E.statusCode),children:E.url===""?e("empty link"):E.url}),description:(0,o.jsxs)(o.Fragment,{children:[!!E.text?.length&&(0,o.jsx)(t.ui_kit$Text,{type:"secondary",children:E.text}),E.page?.title&&E.page.title,E.page?.secure&&E.status==="valid"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)("span",{className:"valid",children:e("secure")})]}),!E.resolvedUrl&&!E.statusCode&&E.type==="url"&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:" • "}),(0,o.jsx)(t.ui_kit$Text,{type:"secondary",children:e("Failed to load")})]})]})})},b+"_"+E.linkId)})})})]}));La.displayName="LinksSection";var{IMAGES:Wm}=r.OPTIMISE_TABS,Oa=(0,a.memo)(({__:e,activeTab:i,validateImagesResult:l,validateImages:s,selectedTags:n,setSelectedTags:d,isLoading:c,disabled:p,iconStrokeWidth:g,onValidate:m,goToImageHandler:_,showImgPreviewHandler:E,hideBlockPreviewHandler:b})=>i!==Wm||!l?.images?null:l.images.length===0?(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,o.jsx)(t.ui_kit$Alert,{title:e("No images found."),type:"info"})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-16",children:(0,o.jsx)(t.ui_kit$Alert,{className:"optimise__alert-custom",title:(0,o.jsxs)("div",{className:"optimise__summary",children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)(t.ui_kit$Title,{level:4,className:"optimise__summary-title",children:[l.images.length," "]}),(0,o.jsx)("span",{className:"optimise__summary-label",children:e("images")})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)(t.ui_kit$Title,{level:4,className:"optimise__summary-title",children:[l.summaryTime?.value,l.summaryTime?.name]}),(0,o.jsx)("span",{className:"optimise__summary-label",children:e("total size")})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)(t.ui_kit$Title,{level:4,className:"optimise__summary-title",children:(Math.max(...l.images.map(h=>h.image.responseTime))/1e3).toFixed(2)+e("s")}),(0,o.jsx)("span",{className:"optimise__summary-label",children:e("time to load")})]})]}),type:"warning"})}),(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-12",children:(0,o.jsxs)("div",{className:"optimise__title-wrapper",children:[(0,o.jsx)(Aa,{__:e,summary:l.summary,setSelectedTags:d,selectedTags:n}),(0,o.jsx)(t.ui_kit$Button,{icon:(0,o.jsx)(r.EmIcons,{icon:"SyncOutlined",component:t.icons$SyncOutlined,size:16,strokeWidth:g}),disabled:p,loading:c,onClick:m,children:e("Refresh")})]})}),(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-12",children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$List,{className:"optimise__result-list",itemLayout:"horizontal",dataSource:s,renderItem:(h,k)=>(0,o.jsx)(t.ui_kit$List.Item,{className:`optimise__image-item image-item ${t.ui_kit$LIST_ITEM_BORDERLESS_CLASS}`,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{className:(0,Ke.default)("image-item__meta",{"image-item__meta_fail":!h.resolvedUrl&&!h.statusCode}),avatar:(0,o.jsx)(t.ui_kit$Image,{className:(0,Ke.default)("image-item__image optimise__image-auto-height",{"image-item__image_fail":!h.resolvedUrl||!h.valid}),width:92,height:"auto",src:h.resolvedUrl||"",preview:!1,onMouseEnter:()=>E(h.url,h.image.dimensions?.width),onMouseLeave:()=>b()}),title:h.url?(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:h.message,children:(0,o.jsx)(t.ui_kit$Link,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>_(h.imageId,600>(h.statusCode||0)&&(h.statusCode||0)>399||!h.statusCode),children:h?.url===""?e("empty src"):h.url})}):h.message,description:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"image-size",children:[h.image.dimensions&&(0,o.jsxs)(o.Fragment,{children:[h.image.dimensions.width+" × "+h.image.dimensions.height,(0,o.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,o.jsxs)("span",{children:[Math.round(h.image.bytes/1024),e("kB")]}),(0,o.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,o.jsxs)("span",{children:[h.image.responseTime,e("ms")]}),(0,o.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,o.jsx)("span",{className:"image-size-format",children:et.normalizeImageFormatForDisplay(h.image.contentType)})]}),h.image.secure&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"image-size-splitter",children:"  •  "}),(0,o.jsx)("span",{className:"valid",children:e("secure")})]}),h.resolvedUrl&&!h.valid&&(0,o.jsx)(t.ui_kit$Text,{type:"danger",children:e("not valid")})]}),!h.resolvedUrl&&!h.statusCode&&(0,o.jsx)(t.ui_kit$Text,{type:"danger",children:e("Failed to load")})]})})},k)})})})]}));Oa.displayName="ImagesSection";var{SPAM_ASSASSIN:zm}=r.OPTIMISE_TABS,$a=(0,a.memo)(({__:e,activeTab:i,validateSpamResult:l,isLoading:s,disabled:n,iconStrokeWidth:d,onValidate:c})=>{const p=l?.report?.length||Object.prototype.hasOwnProperty.call(l,"spamScore");if(i!==zm||!p)return null;const g=l.spamScore||0,m=l.baseSpamScore||0,_=g<2||!l.spamScore||g<=m-1?"success":g<m-1?"warning":"danger";return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.ui_kit$Row,{className:"optimise__row-mb-8",children:[(0,o.jsxs)("div",{className:"optimise__title-wrapper optimise__title-wrapper_spam",children:[(0,o.jsxs)(t.ui_kit$Title,{level:1,className:"optimise__spam-score-title",type:_,children:[(0,o.jsx)("span",{className:"optimise__spam-score-value",children:g}),(0,o.jsx)(t.ui_kit$Text,{className:"optimise__spam-score-text",children:"Score"})]}),(0,o.jsx)(t.ui_kit$Button,{disabled:n,icon:(0,o.jsx)(r.EmIcons,{icon:"SyncOutlined",component:t.icons$SyncOutlined,size:16,strokeWidth:d}),loading:s,onClick:c,children:e("Refresh")})]}),g>m-1&&(0,o.jsx)(t.ui_kit$Text,{children:e("Lower scores are better. Aim for a score less than ")+(m-1)+"."})]}),(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-8",children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(l.report?.length||0)>0?(0,o.jsx)(t.ui_kit$List,{itemLayout:"horizontal",dataSource:l.report,renderItem:E=>(0,o.jsx)(t.ui_kit$List.Item,{className:t.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{title:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Text,{className:"optimise__spam-report-score",children:E.score}),(0,o.jsx)("span",{className:"optimise__spam-report-description",children:E.description})]})})})}):(0,o.jsx)(o.Fragment,{children:l.spamScore===0&&e("Your email doesn't look like spam.")})})})]})});$a.displayName="SpamSection";var{PROBLEMS:Gm}=r.OPTIMISE_TABS,Fa=(0,a.memo)(({__:e,activeTab:i,problemsList:l,onSetMonacoPosition:s})=>i!==Gm?null:l?.length?(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-8",children:(0,o.jsx)(t.ui_kit$Col,{span:24,children:(0,o.jsx)(t.ui_kit$List,{itemLayout:"horizontal",dataSource:l,renderItem:n=>(0,o.jsx)(t.ui_kit$List.Item,{className:t.ui_kit$LIST_ITEM_BORDERLESS_CLASS,children:(0,o.jsx)(t.ui_kit$List.Item.Meta,{avatar:n.severity<6?(0,o.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:t.icons$CloseCircleFilled,className:r.WARNINGS}):(0,o.jsx)(r.EmIcons,{icon:"CloseCircleFilled",component:t.icons$CloseCircleFilled,className:r.ERRORS}),title:(0,o.jsxs)(t.ui_kit$Text,{onClick:()=>s(n),className:(0,Ke.default)("optimise__text-clickable",{warning:n.severity<6,error:n.severity>=6}),children:["Line: ",n.startLineNumber," ",n.startLineNumber!==n.endLineNumber&&" – "+n.endLineNumber]}),description:(0,o.jsx)(t.ui_kit$Text,{children:n.message})})})})})}):(0,o.jsx)(t.ui_kit$Row,{className:"optimise__row-mb-24",children:(0,o.jsx)(t.ui_kit$Alert,{title:e("No problems found."),type:"info"})}));Fa.displayName="ProblemsSection";var Ym={activeTab:"",selectedTags:[],validateLinks:[],validateImages:[],validateSpamResult:{},validateLinksResult:{},validateImagesResult:{}},Xm=(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 Km(){const e=r.useContainer(),i=(0,a.useMemo)(()=>{if(!e)throw new Error("[optimise] нет DI-контейнера стора");return fi.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 qm=()=>{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:Jm,IMAGES:Qm}=r.OPTIMISE_TABS,Zm=({activeTab:e,selectedTags:i,validateLinksResult:l,validateImagesResult:s,setValidateLinks:n,setValidateImages:d})=>{(0,a.useEffect)(()=>{e===Jm&&l.links&&n(i.length>0?l.links.filter(c=>i.includes(c.status)):l.links),e===Qm&&s.images&&d(i.length>0?s.images.filter(c=>i.includes(c.status)):s.images)},[l.links,s.images,i,e,n,d])},ep={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 Ma(e,i){if(e==null)return null;if(typeof e=="number"||typeof e=="string"){const l=e==="∞"||typeof e=="string"&&e.toLowerCase()==="infinity";return(0,o.jsx)("span",{className:i==="old"?"limit-upgrade-modal__limit-old":`limit-upgrade-modal__limit-new${l?" limit-upgrade-modal__limit-new--infinity":""}`,children:l?"∞":e})}return e}var hi=({open:e,onClose:i,title:l,subtitle:s,usageResource:n,icon:d,previousDisplay:c,nextDisplay:p,onChangePlan:g,secondaryAction:m,changePlanLabel:_})=>{const{__:E}=r.useI18n(),b=_??E("Change plan"),h=!!m,k=n!=null?ep[n]:d??null;return(0,o.jsx)(t.ui_kit$Modal,{open:e,onCancel:i,footer:null,closable:!1,width:400,centered:!0,className:"limit-upgrade-modal",destroyOnHidden:!0,mask:{closable:!0},children:(0,o.jsxs)("div",{className:"limit-upgrade-modal__wrap",children:[(0,o.jsx)("div",{className:"limit-upgrade-modal__header",children:(0,o.jsx)("button",{type:"button",className:"limit-upgrade-modal__close",onClick:i,"aria-label":E("Close"),children:(0,o.jsx)(r.EmIcons,{icon:"CloseOutlined",component:t.icons$CloseOutlined})})}),(0,o.jsxs)("div",{className:"limit-upgrade-modal__body",children:[(0,o.jsx)("h1",{className:"limit-upgrade-modal__title",children:l}),(0,o.jsx)("p",{className:"limit-upgrade-modal__subtitle",children:s}),(0,o.jsxs)("div",{className:"limit-upgrade-modal__limits-row",children:[(0,o.jsx)("div",{className:"limit-upgrade-modal__icon-circle","aria-hidden":!0,children:k}),Ma(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"})}),Ma(p,"new")]})]}),(0,o.jsx)("hr",{className:"limit-upgrade-modal__divider"}),(0,o.jsx)("div",{className:h?"limit-upgrade-modal__footer limit-upgrade-modal__footer--dual":"limit-upgrade-modal__footer",children:m?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Button,{className:"limit-upgrade-modal__cta-secondary",onClick:m.onClick,children:m.label}),(0,o.jsx)(t.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:g,children:b})]}):(0,o.jsx)(t.ui_kit$Button,{type:"primary",className:"limit-upgrade-modal__cta",onClick:g,children:b})})]})})},{LINKS:kr,IMAGES:Er,SPAM_ASSASSIN:Da,PROBLEMS:Sr}=r.OPTIMISE_TABS,Va={textDecoration:"underline",cursor:"pointer",background:"none",border:"none",padding:0,font:"inherit",color:"inherit"},Ha={link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"},Ua=(e,i,l,s)=>`${e} ${l("of")} ${i>0?i:"∞"} ${s("test","tests",i>0?i:e)} ${s("was used","were used",e)}`,Wa=()=>{const{__:e,_n:i}=r.useI18n(),l=r.useDispatch(),s=r.useOpenPlanCatalog(),n=r.useAppNavigate(),d=r.useNotification(),c=r.useContentReader(),p=r.useAppConfig(),g=r.useEditorProjectId(),m=r.useRouteEmailId(),{document:_}=r.useDocumentSessionContext(),E=r.useEmailOfDocument(_,void 0),b=m||(E?.id!=null?String(E.id):void 0);r.useWpEntityId(),r.isChecksV2Enabled();const h=b||E?.renderGuid,k=g||(E?.project!=null?String(E.project):void 0),[x,T]=(0,a.useState)(null),v=(0,a.useRef)(!1),P=(0,a.useRef)({link_check:!1,image_check:!1,spam_check:!1}),B=(0,a.useCallback)(R=>{T(R)},[]),y=r.useMessageService(),D=r.useSelector(r.selectProblemsList),z=r.usePushToDataLayer(),[A,$]=(0,a.useReducer)(Xm,Ym),{checks:j,limits:W,running:Y}=Km(),{limitsInPlugin:ee,perTypeAvailable:I,aggregateLimit:le,aggregateCounter:ke,disableFields:Ne,typeLimits:Q}=W,fe=(0,a.useCallback)(R=>fi.isOptimiseTypeDisabled(W,R),[W]),Ae=(0,a.useCallback)(R=>$({type:"SET_VALIDATE_LINKS",payload:R}),[]),ne=(0,a.useCallback)(R=>$({type:"SET_VALIDATE_IMAGES",payload:R}),[]),Fe=(0,a.useCallback)(R=>$({type:"SET_SELECTED_TAGS",payload:R}),[]);Zm({activeTab:A.activeTab,selectedTags:A.selectedTags,validateLinksResult:A.validateLinksResult,validateImagesResult:A.validateImagesResult,setValidateLinks:Ae,setValidateImages:ne});const{showImgPreviewHandler:Le,hideBlockPreviewHandler:Ue}=qm(),ve=(0,a.useCallback)(R=>{if(I){const{limit:V}=Q[R];B({presetId:Ha[R],previousDisplay:V>0?V:r.presetLimitDisplay("infinity"),nextDisplay:r.presetLimitDisplay("infinity")});return}B({presetId:"optimization_exceeded",previousDisplay:le,nextDisplay:r.presetLimitDisplay("infinity")})},[I,Q,B,le]),Be=(0,a.useCallback)((R,V)=>{switch(R.reason){case"notSaved":d.error({title:"Save the mail first."});return;case"typeLimit":ve(R.type);return;case"planLimit":B({presetId:R.exceeded.presetId,previousDisplay:R.exceeded.previousLimit,nextDisplay:r.presetLimitDisplay(R.exceeded.nextLimit)});return;case"usageLimit":B({presetId:Ha[R.type],previousDisplay:e("—"),nextDisplay:r.presetLimitDisplay("infinity")});return;case"failed":{if("error"in R){d.error({error:R.error});return}const L=R.data;(L?.statusCode??0)>300||!L?.success?d.error({error:{data:L}}):d.error({title:e("Something went wrong.")}),V();return}default:return}},[d,ve,B,e]),xe=(0,a.useCallback)(R=>{R!=null&&d.warning({title:`${e("Approaching usage limit. Remaining")}: ${R}`})},[d,e]),ce=(0,a.useCallback)(()=>{n(p.billingPageUrl||r.APP_ROUTES.billing)},[p.billingPageUrl,n]),be=R=>{if(!ee||!I)return null;const{counter:V,limit:L,disabled:X}=Q[R];return(0,o.jsx)(t.ui_kit$LimitsCounter,{text:Ua(V,L,e,i),exceeded:X,extra:(0,o.jsx)("button",{type:"button",style:Va,onClick:ce,children:e("Need more?")})})},ue=(0,a.useCallback)((R,V)=>{y.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_LINK,settings:{elementId:R,isError:V}})},[y]),q=(0,a.useCallback)((R,V)=>{y.send({operation:r.EVENT_TYPES.SANDBOX_SET_POSITION_TO_IMG,settings:{elementId:R,isError:V}})},[y]),Z=(0,a.useCallback)(R=>{const V={startColumn:R.startColumn,startLineNumber:R.startLineNumber,endColumn:R.endColumn,endLineNumber:R.endLineNumber};l(r.setActiveProblemRange(V))},[l]),te=(0,a.useCallback)(R=>{$({type:"SET_ACTIVE_TAB",payload:R}),$({type:"RESET_SELECTED_TAGS"}),R===Sr&&D?.length>0&&z({event:"check",action:"check_email_code",email_id:b,project_id:k,problems_count:D?.length||0})},[D,z,b,k]),ae=(0,a.useCallback)(R=>({entityId:h??"",readContent:c,beforeRequest:R}),[h,c]),de=(0,a.useCallback)(async()=>{const R=await j.run("link_check",ae(()=>y.send({operation:"sandbox_set_attr_to_links"})));if(R.ok===!1){Be(R,()=>!A.validateLinksResult.links&&te(""));return}$({type:"SET_VALIDATE_LINKS_RESULT",payload:R.value}),d.success(e("Links validation was successfully completed")),xe(R.limitRemaining),z({event:"check",action:"check_email_links",email_id:b,project_id:k,links_count:R.value.links?.length||0})},[j,ae,y,Be,A.validateLinksResult.links,te,d,e,xe,z,b,k]),De=(0,a.useCallback)(async()=>{const R=await j.run("image_check",ae(()=>y.send({operation:"sandbox_set_attr_to_images"})));if(R.ok===!1){Be(R,()=>!A.validateImagesResult?.images?.length&&te(""));return}const{images:V,summary:L,totalKb:X}=R.value,ie={images:V||[],summary:L,summaryTime:{value:(X>1200?X/1e3:X).toFixed(1),name:X>1200?e("MB"):e("KB")}};$({type:"SET_VALIDATE_IMAGES_RESULT",payload:ie}),d.success(e("Images validation was successfully completed")),xe(R.limitRemaining),z({event:"check",action:"check_email_images",email_id:b,project_id:k,images_count:ie.images?.length||0})},[j,ae,y,Be,A.validateImagesResult,te,d,e,xe,z,b,k]),oe=(0,a.useCallback)(async()=>{const R=await j.run("spam_check",ae());if(R.ok===!1){Be(R,()=>!A.validateSpamResult?.report?.length&&te(""));return}$({type:"SET_VALIDATE_SPAM_RESULT",payload:R.value}),d.success(e("Spam validation was successfully completed")),xe(R.limitRemaining),z({event:"check",action:"check_email_spam",email_id:b,project_id:k,spam_score:R.value.spamScore||0})},[j,ae,Be,A.validateSpamResult,te,d,e,xe,z,b,k]);(0,a.useEffect)(()=>{if(ee){if(I){fi.OPTIMISE_LIMIT_TYPES.forEach(R=>{const{limit:V,counter:L,disabled:X}=Q[R];if(!X){P.current[R]=!1;return}P.current[R]||V>0&&L>=V&&(P.current[R]=!0,ve(R))});return}if(!(le>0&&ke>=le)){v.current=!1;return}v.current||(v.current=!0,ve("link_check"))}},[ee,I,Q,ke,le,ve]);const Te=x?r.getLimitUpgradePresetDefinition(x.presetId):null,_e=(0,a.useCallback)(()=>T(null),[]),Ce=r.useNativeExtraBuyAction(Te?.usageResource,_e);return(0,o.jsxs)("div",{className:"optimise selected_form-props-wrapper selected_form-props-wrapper_optimize",children:[Te&&x?(0,o.jsx)(hi,{open:!0,onClose:_e,title:e(Te.titleKey),subtitle:e(Te.subtitleKey),usageResource:Te.usageResource,previousDisplay:x.previousDisplay,nextDisplay:x.nextDisplay,secondaryAction:Ce,onChangePlan:()=>{T(null),s()}}):null,ee&&!I&&(0,o.jsx)(t.ui_kit$LimitsCounter,{text:Ua(ke,le,e,i),exceeded:Ne,extra:(0,o.jsx)("button",{type:"button",style:Va,onClick:ce,children:e("Need more?")})}),p.optimizeLinksEnabled&&(0,o.jsxs)(o.Fragment,{children:[be("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:R=>R.preventDefault(),onClick:()=>{te(kr),!A.validateLinksResult?.links?.length&&A.activeTab!==kr&&de()},loading:Y.link_check,disabled:fe("link_check")&&!A.validateLinksResult?.links?.length,children:!Y.link_check&&(A.activeTab===kr?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth}))})})]}),(0,o.jsx)(La,{__:e,activeTab:A.activeTab,validateLinksResult:A.validateLinksResult,validateLinks:A.validateLinks,selectedTags:A.selectedTags,setSelectedTags:Fe,isLoading:Y.link_check,disabled:fe("link_check"),iconStrokeWidth:p.iconStrokeWidth,onValidate:de,goToLinkHandler:ue})]}),p.optimizeImagesEnabled&&(0,o.jsxs)(o.Fragment,{children:[be("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:R=>R.preventDefault(),onClick:()=>{te(Er),!A.validateImagesResult?.images?.length&&A.activeTab!==Er&&De()},loading:Y.image_check,children:!Y.image_check&&(A.activeTab===Er?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth}))})})]}),(0,o.jsx)(Oa,{__:e,activeTab:A.activeTab,validateImagesResult:A.validateImagesResult,validateImages:A.validateImages,selectedTags:A.selectedTags,setSelectedTags:Fe,isLoading:Y.image_check,disabled:fe("image_check"),iconStrokeWidth:p.iconStrokeWidth,onValidate:De,goToImageHandler:q,showImgPreviewHandler:Le,hideBlockPreviewHandler:Ue})]}),p.optimizeSpamAssassinEnabled&&(0,o.jsxs)(o.Fragment,{children:[be("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:R=>R.preventDefault(),loading:Y.spam_check,onClick:()=>{te(Da),A.validateSpamResult.report?.length||Object.prototype.hasOwnProperty.call(A.validateSpamResult,"spamScore")||oe()},disabled:fe("spam_check")&&!(A.validateSpamResult?.report?.length||Object.prototype.hasOwnProperty.call(A.validateSpamResult,"spamScore")),children:!Y.spam_check&&(A.activeTab===Da?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth}))})})]}),(0,o.jsx)($a,{__:e,activeTab:A.activeTab,validateSpamResult:A.validateSpamResult,isLoading:Y.spam_check,disabled:fe("spam_check"),iconStrokeWidth:p.iconStrokeWidth,onValidate:oe})]}),p.optimizeCheckCodeEnabled&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Divider,{className:"selected-td-form__divider optimise__divider-no-margin"}),(0,o.jsxs)(t.ui_kit$Row,{gutter:10,align:"middle",children:[(0,o.jsx)(t.ui_kit$Col,{span:20,children:(0,o.jsx)("div",{style:{padding:"15px 0"},children:e("Source code validation")})}),(0,o.jsx)(t.ui_kit$Col,{span:4,className:"optimise__col-align-right",children:(0,o.jsx)(t.ui_kit$Button,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:R=>R.preventDefault(),onClick:()=>te(Sr),children:A.activeTab===Sr?(0,o.jsx)(r.EmIcons,{icon:"DownOutlined",component:t.icons$DownOutlined,size:16,strokeWidth:p.iconStrokeWidth}):(0,o.jsx)(r.EmIcons,{icon:"RightOutlined",component:t.icons$RightOutlined,size:16,strokeWidth:p.iconStrokeWidth})})})]}),(0,o.jsx)(Fa,{__:e,activeTab:A.activeTab,problemsList:D,onSetMonacoPosition:Z})]})]})},op=({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:[tp(e,n),(0,o.jsx)(t.ui_kit$Flex,{justify:"flex-end",children:ip(e,{onCancel:i,onRetry:l,onDismiss:s},n)})]})})})};function tp(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 ip(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 rp=2500,za=48,lp=4e3;function sp(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 ap(e){return e.kind==="done"||e.kind==="failed"||e.kind==="cancelled"}function np({projectId:e,api:i,triggered:l,onCompleted:s}){const[n,d]=(0,a.useState)({kind:"hidden"}),c=(0,a.useRef)(!1),p=(0,a.useRef)(!0),g=(0,a.useRef)(e);g.current=e;const m=(0,a.useRef)(l);m.current=l;const _=(0,a.useRef)(s);_.current=s,(0,a.useEffect)(()=>(p.current=!0,()=>{p.current=!1}),[]),(0,a.useEffect)(()=>{d({kind:"hidden"})},[e]);const E=(0,a.useCallback)(async()=>{try{const h=await i.files.backfillList({project_id:e});return!h.ok||h.error?null:sp(h.data)}catch{return null}},[i,e]),b=(0,a.useCallback)(async()=>{if(c.current)return;c.current=!0;const h=g.current;let k=0;try{for(;p.current&&g.current===h&&m.current;){const x=await E();if(!p.current)break;if(x)if(x.kind==="hidden"){if(k+=1,k>=za){d({kind:"failed"});break}}else{if(k=0,d(x),x.kind==="done")try{await _.current?.()}catch{}if(ap(x))break}else if(k+=1,k>=za){d({kind:"failed"});break}await new Promise(T=>setTimeout(T,rp))}}finally{c.current=!1}},[E]);return(0,a.useEffect)(()=>{l&&b()},[l,b]),(0,a.useEffect)(()=>{if(n.kind!=="done")return;const h=setTimeout(()=>{p.current&&d({kind:"hidden"})},lp);return()=>clearTimeout(h)},[n.kind]),{state:n,cancel:(0,a.useCallback)(()=>{d(h=>h.kind==="scanning"||h.kind==="indexing"?{...h,cancelling:!0}:h),i.files.backfillCancelCreate({project_id:e})},[i,e]),retry:(0,a.useCallback)(()=>{m.current=!0,i.files.backfillCreate({project_id:e}),b()},[i,e,b]),dismiss:(0,a.useCallback)(()=>d({kind:"hidden"}),[])}}var dp=r.lazyRoute(()=>(0,Mt.__vitePreload)(()=>Promise.resolve().then(()=>ko("./519dfcc7.js")),void 0,{}.url)),cp=r.lazyRoute(()=>(0,Mt.__vitePreload)(()=>Promise.resolve().then(()=>ko("./c03fc17e.js")),void 0,{}.url)),Ga={height:"100%"};function up(e){(e?(0,Mt.__vitePreload)(()=>Promise.resolve().then(()=>ko("./e98b0c61.js")),void 0,{}.url):(0,Mt.__vitePreload)(()=>Promise.resolve().then(()=>ko("./3cd95e0a.js")),void 0,{}.url)).catch(()=>{})}var mp=({storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,contentKey:n})=>{const d=r.useAppConfig(),c=r.isImageEditModal(r.useSelector(r.selectActiveModal$1)),p=!!d.imageCenterFileManagerView;(0,a.useEffect)(()=>{c&&up(p)},[c,p]);let g=(0,o.jsx)(t.ui_kit$PageLoader,{style:Ga});return e&&i&&d.imageCenterFileManagerView?g=(0,o.jsx)(dp,{storageProvider:e,dataProvider:i,pathProxy:l},n):e&&i&&(g=(0,o.jsx)(cp,{dataProvider:i,usesBuiltInStorage:s},n)),(0,o.jsx)(a.Suspense,{fallback:(0,o.jsx)(t.ui_kit$PageLoader,{style:Ga}),children:g})};function pp(){const e=r.useAppConfig(),i=r.useIsStandalone(),l=r.useStorageProvider(),s=r.useProjectData(),n=r.useRestClient(r.EM_FILES_MODULES),d=r.useStore(),c=(0,a.useMemo)(()=>r.createRestClientV2(d),[d]),p=r.useI18n(),g=r.useCurrentUser(),m=s?.id?String(s.id):"",_=g?.id!=="0"?String(g.id):"",E=r.isFileManagerV2Enabled(e),[b,h]=(0,a.useState)(null),k=E&&!!m&&b===m,[x,T]=(0,a.useState)(0),[v,P]=(0,a.useState)(0),B=(0,a.useRef)(m);(0,a.useEffect)(()=>{B.current!==m&&(B.current=m,h(null))},[m]);const y=(0,a.useCallback)($=>{$&&m&&h(m)},[m]),D=(0,a.useMemo)(()=>r.buildResolvedFileManagerProviders({storageProvider:l,projectId:m,restApi:n,restApiV2:c,i18n:p,pathPostfix:_,appConfig:e,isStandalone:i,onIndexingStateChange:y}),[e,y,p,i,m,x,n,c,l,_]),z=(0,a.useCallback)(async()=>{try{typeof D.dataProvider?.clearCache=="function"&&await D.dataProvider.clearCache()}catch{}h(null),T($=>$+1),P($=>$+1)},[D.dataProvider]),A=(0,a.useCallback)(()=>{m&&h(m)},[m]);return{...D,projectId:m,restApiV2:c,v2Enabled:E,backfillTriggered:k,contentKey:`${m}:${v}`,handleIndexingCompleted:z,markIndexingStarted:A}}var hp={height:"100%"},Ya=()=>{const{storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,projectId:n,restApiV2:d,v2Enabled:c,backfillTriggered:p,contentKey:g,handleIndexingCompleted:m,markIndexingStarted:_}=pp(),E=r.useSelector(r.selectActiveModal$1),b=r.isImageCenterModal(E),{state:h,cancel:k,retry:x,dismiss:T}=np({projectId:n,api:d,triggered:p,onCompleted:m}),v=a.default.useCallback(()=>{_(),x()},[_,x]);return(0,o.jsxs)(o.Fragment,{children:[b&&(0,o.jsx)(a.Suspense,{fallback:(0,o.jsx)(t.ui_kit$PageLoader,{style:hp}),children:(0,o.jsx)(mp,{storageProvider:e,dataProvider:i,pathProxy:l,usesBuiltInStorage:s,contentKey:g})}),c&&(0,o.jsx)(op,{state:h,onCancel:k,onRetry:v,onDismiss:T})]})},bp=(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 gp(e){return!!(e?.global_block??e?.acf?.global_block)}var fp=({className:e,size:i=16})=>{const l=r.useAppConfig(),{__:s}=r.useI18n(),n=s("Global block");return(0,o.jsx)(t.ui_kit$Tooltip,{title:n,placement:"top",trigger:["hover"],children:(0,o.jsx)("span",{className:(0,Ke.default)("block-global-badge",e),"aria-label":n,role:"img",children:(0,o.jsx)(r.EmIcons,{icon:"Globe02Icon",component:t.icons$Globe02Icon,size:i,strokeWidth:l.iconStrokeWidth})})})},Xa=new Map;function Ka(e){return`<table cellspacing="0" cellpadding="0" border="0" width="100%">${e}</table>`}function Br(e,i){const l=i??"";if(e===void 0)return r.cleanPreviewMarkup(Ka(l));const s=String(e),n=Xa.get(s);if(n&&n.source===l)return n.markup;const d=r.cleanPreviewMarkup(Ka(l));return Xa.set(s,{source:l,markup:d}),d}function _p(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function bi(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">${_p(e.title??"")}</td></tr>`}function xp(e,i,l){e.textContent=l.title;const s=bi(l)??"",n=r.cleanPreviewBody(`<table cellspacing="0" cellpadding="0" border="0" width="100%">${s}</table>`);n.querySelectorAll("style, link").forEach(d=>d.remove()),i.replaceChildren(...Array.from(n.childNodes,d=>i.ownerDocument.importNode(d,!0)))}function kp(e){const i=document.implementation.createHTMLDocument(""),l=i.createElement(e.substring(0,3)==="<tr"?"table":"div");return l.replaceChildren(...r.parseFromString(e,!1,i)),l}function Ep(e,i){return e?i.openBlockFromEmailEnabled===!0?"over-email":null:"link"}var Sp={fontSize:"16px",margin:0},{name:Tr,type:qa,tags:Ja}={name:"name",type:"type",tags:"tags"},Qa={[Tr]:"",[qa]:[],[Ja]:[]},xt={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},Rr=({parentEmailId:e,blocksTab:i,templateBlocksEnabled:l=!1,search:s,reloadBlockScreens:n,setIsShowAddAllBlocksModal:d})=>{const{parentId:c}=r.useBlocksParentId(e),p=r.useEditorProjectId(),g=r.useSetHtmlElementInIframeHandler(),m=r.useDragStartBlockToIframeHandler(),[_]=t.ui_kit$Form.useForm(),{data:E}=r.useGetBlockTypesQuery(),{token:b}=(0,t.ui_kit$useToken)(),{__:h,_x:k}=r.useI18n(),x=r.useNotification(),{modal:T}=t.ui_kit$App.useApp(),{confirm:v}=T,P={pathname:r.useRoutePathname()},B=r.useAppConfig(),y=r.useSelector(w=>r.selectParentBlocks(w,c)),D=qs(),z=(0,a.useRef)(null),A=(0,a.useRef)(null),$=r.useRootElement(),j=640,W=207/j,Y=w=>gp(w)?(0,o.jsx)("div",{className:"blocks-search__result-global-mark",children:(0,o.jsx)(fp,{className:"block-global-badge--tile",size:14})}):null,ee=r.useEmailAttribute("common_styles"),I=(0,a.useMemo)(()=>Qs(ee,D),[ee,D]),le=(0,a.useRef)(null),ke=(0,a.useRef)(null),Ne=(0,a.useRef)(null),Q=r.useStore(),fe=(w,Re=!1)=>(S,we,Xe,ho,Ye)=>{if(!r.isBlocksV2Enabled()){w(S,we,Xe,ho,Ye);return}const Wo=Qo=>{if(Qo===void 0){x.error({id:"BLOCK_GET_ERROR",title:h("Failed to load")});return}if(Qo===Ye.html){w(S,we,Xe,ho,Ye);return}w(S,Xe==="common"?Ie({html:Qo}):Qo,Xe,ho,{...Ye,html:Qo})},kt=()=>Q.getState();if(!Ft.waitsForWrite(Ye)){Wo(Ft.freshBlockHtml(kt,Ye));return}(Re?Ft.blockHtmlForInsertOnce(kt,Ye):Ft.blockHtmlForInsert(kt,Ye))?.then(Wo)},Ae=fe(g,!0),ne=fe(m);(0,a.useEffect)(()=>{A.current?.scrollTo({top:0})},[i,s]);const Fe=r.useProjectData(),{data:Le}=r.useGetTermsQuery({project:Fe,kind:r.BLOCK_TAGS},{skip:!Fe?.id}),[Ue,ve]=(0,a.useState)(()=>r.projectBlocksArgs(p));(0,a.useEffect)(()=>{s||(_.setFieldsValue(Qa),H({type:null,name:null}),n())},[s,_,n]),(0,a.useEffect)(()=>{if(E){const w=E;let Re=[];for(let S in w)Re.push({label:h(r.TYPES_TRANSLATE[w[S]]),value:w[S]})}},[E,h]);const{isSuccess:Be,isError:xe,isLoading:ce,isFetching:be,data:ue,currentData:q,error:Z}=r.useGetBlocksQuery({...Ue,projectId:p,page:1}),te=(ce||be)&&!(Be&&q!==void 0),ae=(0,a.useMemo)(()=>{if(Be&&ue)return[...ue].sort((w,Re)=>xt[w.type]-xt[Re.type])},[Be,ue]),[de,De]=(0,a.useState)({list:void 0,ids:[]}),oe=(0,a.useMemo)(()=>de.list!==void 0&&de.list===q?ae?.filter(w=>!de.ids.includes(w.id)):ae,[de,q,ae]),[Te,_e]=(0,a.useState)([]);r.usePrevious(w=>{w!==xe&&x.fromError("BLOCK_GET_ERROR",{},Z,!0)},[xe,Z,x]);const[Ce,R]=(0,a.useState)(()=>r.parentEmailBlocksArgs(c,p)),{isSuccess:V,isError:L,isLoading:X,isFetching:ie}=r.useGetParentEmailBlocksQuery({...Ce,emailId:c,page:1,...r.pageProjectKey(p)},{skip:!l||!c||y.length}),me=(0,a.useMemo)(()=>{if(V||y.length)return[...y].sort((w,Re)=>xt[w.type]-xt[Re.type])},[V,y]),[he,$e]=(0,a.useState)([]);(0,a.useEffect)(()=>{const w=new Set;if(y.length&&me){for(const Re of me)Re.type&&w.add(Re.type);$e(Array.from(w))}else $e([])},[y,me]);const[je,G]=(0,a.useState)(()=>r.templateBlocksArgs(p)),{isSuccess:re,isError:O,isLoading:pe,isFetching:ye,data:ze=[],currentData:oo}=r.useGetTemplateBlocksQuery({...je,page:1,...r.pageProjectKey(p)}),ro=(pe||ye)&&!(re&&oo!==void 0),ao=(0,a.useMemo)(()=>{if(ze.length)return[...ze].sort((w,Re)=>xt[w.type]-xt[Re.type])},[ze]),[M,se]=(0,a.useState)([]);(0,a.useEffect)(()=>{const w=new Set;if(ao&&ze.length){for(const Re of ao)Re.type&&w.add(Re.type);se(Array.from(w))}},[ze.length,ao]);const C=(0,a.useMemo)(()=>{const w=new Set;for(const Re of Te)w.add(Re);for(const Re of he)w.add(Re);for(const Re of M)w.add(Re);return Array.from(w)},[M,he,Te]),H=w=>{ve(Re=>({...Re,...w,page:1})),R(Re=>({...Re,...w,page:1})),G(Re=>({...Re,...w,page:1}))},Pe=r.useFitBlockPreviewHeight(W),He=(0,a.useCallback)(()=>{$.querySelector(".blocks-search__result-wrapper.is_search")&&($.querySelector(".blocks-search__result-wrapper").style.removeProperty("transition"),$.querySelector(".blocks-search__result-wrapper").style.opacity=0,r.measureBlockPreviews($,207/j),$.querySelector(".blocks-search__result-wrapper").style.transition="opacity 0.2s",$.querySelectorAll(".blocks-search__result-wrapper").forEach(w=>w.style.opacity=1))},[j,$]);(0,a.useEffect)(()=>{!(ye||pe)&&re&&i!=="template"&&(s?He():n())},[ye,pe,re,He,Ue.name,n,s,i]),(0,a.useEffect)(()=>{const w=new Set;if(Be&&ae){for(const Re of ae)Re.type&&w.add(Re.type);_e(Array.from(w))}},[Be,ae]);const _o=w=>{const Re=Object.keys(w)[0],S=_.getFieldsValue(!0);switch(Re){case Ja:const we=(Le||[]).filter(Xe=>w[Re].includes(Xe.name)).map(Xe=>Xe.id)||null;H({tags:we});break;case qa:H({type:S.type||null});break;case Tr:z.current&&window.clearTimeout(z.current),z.current=window.setTimeout(function(){H({name:S.name||null})},300)}},mo=w=>{n(),w.target.getAttribute("data-type")?(w.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(Re=>Re.style.display="none"),w.target.closest(".blocks-search").querySelectorAll(`[data-type="${w.target.getAttribute("data-type")}"]`).forEach(Re=>Re.style.display="block")):w.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach(Re=>Re.style.display="block"),w.target.parentElement.querySelector(".active").classList.remove("active"),w.target.classList.add("active")};let co=null;const ge=w=>{clearTimeout(co);let Re=$.querySelector(".block-search__preview")?$.querySelector(".block-search__preview"):null,S=$.querySelector(".block-search__preview-title")?$.querySelector(".block-search__preview-title"):null,we=$.querySelector(".block-search__preview-content")?$.querySelector(".block-search__preview-content"):null;$.querySelector(".block-search__preview")||(Re=document.createElement("div"),Re.classList.add("block-search__preview"),S=document.createElement("div"),S.classList.add("block-search__preview-title"),we=document.createElement("div"),we.classList.add("block-search__preview-content"),Re.append(we),Re.append(S),$.querySelector(".email-pane__col_settings-inner").append(Re)),xp(S,we,w),Re.style.opacity!=="1"&&setTimeout(function(){Re.style.opacity="1",Re.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(100%)":"translateX(-100%)"},10)},Ge=()=>{let w=$.querySelector(".block-search__preview");w&&(co=setTimeout(()=>{w.style.opacity="0",w.style.transform=document.querySelector(".email-pane__col-wrapper_reverse")?"translateX(99%)":"translateX(-99%)",setTimeout(function(){w.remove()},300)},300))};(0,a.useEffect)(()=>{$.querySelectorAll(".blocks-search__result").forEach(w=>{w.style.display="block"})},[i]);const Je=!ue?.length&&(!c||!y?.length)&&!ze?.length&&(Ue.tags||Ue.name||Ue.type)&&!(ce||be),io=w=>Q.dispatch(r.blocksApi.endpoints.deleteBlock.initiate(w.id)).then(Re=>{if(Re.error){x.fromError("BLOCK_REMOVING_ERROR",r.getBlockDesc(w),Re.error);return}De(S=>({list:q,ids:S.list===q?[...S.ids,w.id]:[w.id]})),x.success({id:"BLOCK_REMOVING_SUCCESS",data:r.getBlockDesc(w),title:h('The block "')+w.title+k('" was successfully removed.',"block")})});(0,a.useEffect)(()=>{!ce&&!be&&n()},[ce,be,n]),(0,a.useEffect)(()=>{(i==="common"||s)&&setTimeout(n,50)},[ue,n,i,s]);const fo=w=>{v({mask:{closable:!0},centered:!0,title:k("Are you sure you want to delete the “","block")+w.title+h("” block?"),icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:22,style:{color:t.ui_kit$iconColors.danger,marginInlineEnd:12,flexShrink:0}}),okText:h("Yes"),cancelText:h("No"),onOk:()=>io(w)})},F=(w,Re)=>`${w.pathname.split("emails")[0]}blocks/${Re.id}`,K=w=>{let Re=[{key:"Delete block",className:"blocks-search__result__menu-item",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16,style:{margin:0}}),style:{color:b.colorError},onClick:()=>fo(w)}];const S=Ep(!0,B);return S==="link"&&Re.unshift({key:"Edit block",className:"blocks-search__result__menu-item",icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,style:{fontSize:"16px",margin:0}}),label:(0,o.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:F(P,w),children:" "})}),S==="over-email"&&Re.unshift({key:"Edit block",className:"blocks-search__result__menu-item",icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,style:Sp}),onClick:()=>{r.getEmitter(r.getContainer(Q),Po.events.OPEN_BLOCK_REQUEST_ID).fireSettled(String(w.id)).then(({errors:we})=>{we.length&&x.fromError("BLOCK_GET_ERROR",r.getBlockDesc(w),we[0])})}}),Re},Ie=w=>{const Re=kp(w.html);if(Object.keys(I).length!==0&&(Re.querySelectorAll(".em-contrast-card").forEach(S=>{I.cards?.contrastBackgroundColor&&(S.getAttribute("bgcolor")?I.cards.contrastBackgroundColor?S.setAttribute("bgcolor",I.cards.contrastBackgroundColor):S.removeAttribute("bgcolor"):I.cards.contrastBackgroundColor?S.style.backgroundColor=I.cards.contrastBackgroundColor:S.style.removeProperty("background-color")),I.cards?.contrastTextColor&&S.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(we=>{if(Ve(we.style.color).toLowerCase()!=="#ffffff"){let Xe=we.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.cards.contrastTextColor};`);we.setAttribute("style",Xe)}})}),Re.querySelectorAll(".em-card").forEach(S=>{I.cards?.baseBackgroundColor&&(S.getAttribute("bgcolor")?I.cards.baseBackgroundColor?S.setAttribute("bgcolor",I.cards.baseBackgroundColor):S.removeAttribute("bgcolor"):I.cards.baseBackgroundColor?S.style.backgroundColor=I.cards.baseBackgroundColor:S.style.removeProperty("background-color")),I.cards?.baseTextColor&&S.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(we=>{if(Ve(we.style.color).toLowerCase()!=="#ffffff"){let Xe=we.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.cards.baseTextColor};`);we.setAttribute("style",Xe)}})}),Re.querySelectorAll(".em-card, .em-contrast-card").forEach(S=>{I.cards?.border&&We({settings:{border:I.cards?.border},elem:S}),I.cards?.borderRadius?.all?(S.style.borderBottomLeftRadius&&S.style.borderBottomLeftRadius!=="0px"&&(S.style.borderBottomLeftRadius=I.cards?.borderRadius.all+"px"),S.style.borderBottomRightRadius&&S.style.borderBottomRightRadius!=="0px"&&(S.style.borderBottomRightRadius=I.cards?.borderRadius.all+"px"),S.style.borderTopLeftRadius&&S.style.borderTopLeftRadius!=="0px"&&(S.style.borderTopLeftRadius=I.cards?.borderRadius.all+"px"),S.style.borderTopRightRadius&&S.style.borderTopRightRadius!=="0px"&&(S.style.borderTopRightRadius=I.cards?.borderRadius.all+"px")):I.cards?.borderRadius?.all===""?S.style.removeProperty("border-radius"):(I.cards?.borderRadius?.topLeft&&S.style.borderTopLeftRadius&&S.style.borderTopLeftRadius!=="0px"?S.style.borderTopLeftRadius=I.cards?.borderRadius.topLeft+"px":I.cards?.borderRadius?.topLeft===""&&S.style.removeProperty("border-top-left-radius"),I.cards?.borderRadius?.topRight&&S.style.borderTopRightRadius&&S.style.borderTopRightRadius!=="0px"?S.style.borderTopRightRadius=I.cards?.borderRadius.topRight+"px":I.cards?.borderRadius?.topRight===""&&S.style.removeProperty("border-top-right-radius"),I.cards?.borderRadius?.bottomRight&&S.style.borderBottomRightRadius&&S.style.borderBottomRightRadius!=="0px"?S.style.borderBottomRightRadius=I.cards?.borderRadius.bottomRight+"px":I.cards?.borderRadius?.bottomRight===""&&S.style.removeProperty("border-bottom-right-radius"),I.cards?.borderRadius?.bottomLeft&&S.style.borderBottomLeftRadius&&S.style.borderBottomLeftRadius!=="0px"?S.style.borderBottomLeftRadius=I.cards?.borderRadius.bottomLeft+"px":I.cards?.borderRadius?.bottomLeft===""&&S.style.removeProperty("border-bottom-left-radius"))}),Re.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(S=>{if(!S.style.display&&parseFloat(S.style.fontSize)<=20){let we="",Xe=I.text.fontFamily;if(parseFloat(S.style.fontSize)>14&&(we=S.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${I.text.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${I.text.lineHeight}px`),S.setAttribute("style",we)),!S.closest(".em-contrast-card, .em-card")&&Ve(S.style.color).toLowerCase()!=="#ffffff"&&(we=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.text.color};`),S.setAttribute("style",we)),S.closest(".em-contrast-block")&&!S.closest(".em-contrast-card, .em-card")&&(we=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.text.contrastColor};`),S.setAttribute("style",we)),Xe[0]==="Safe Fonts"?(S.style.fontFamily=Xe[1],J({elem:Re})):Xe[0]==="Google Fonts"&&(Xe[1]==="Sans Serif"?S.style.fontFamily="Helvetica, Arial, sans-serif":Xe[1]==="Serif"&&(S.style.fontFamily='"Times New Roman", Times, serif'),S.classList.remove(...[...S.classList].filter(ho=>ho.startsWith("em-font"))),S.classList.add(`em-font-${Xe[2].replace(/\s/g,"")}-${Xe[3].replace(/\s/g,"")}`),qe({elem:Re,fontFamilyArray:Xe})),S.closest('[em="atom"] > tr > td')&&S.closest('[em="atom"] > tr > td').style.paddingBottom)S.closest('[em="atom"] > tr > td').style.paddingBottom=I.text.paddingBottom+"px";else if(S.nextElementSibling||S.closest("table")&&S.closest("table").nextElementSibling){let ho=S.nextElementSibling??S.closest("table").nextElementSibling;ho&&ho.tagName==="TABLE"&&(ho.classList.contains("em-vindent-table")||ho.querySelector("td").innerHTML==="")&&ho.querySelector("td").setAttribute("height",I.text.paddingBottom)}}else if(!S.style.display&&parseFloat(S.style.fontSize)>=20&&Ve(S.style.color).toLowerCase()!=="#eb3737"){let we="",Xe=I.headings.fontFamily;parseFloat(S.style.fontSize)<40&&(we=S.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${I.headings.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${I.headings.lineHeight}px`),S.setAttribute("style",we)),!S.closest(".em-contrast-card, .em-card")&&Ve(S.style.color).toLowerCase()!=="#ffffff"&&(we=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.headings.color};`),S.setAttribute("style",we)),S.closest(".em-contrast-block")&&!S.closest(".em-contrast-card, .em-card")&&(we=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.headings.contrastColor};`),S.setAttribute("style",we)),Xe[0]==="Safe Fonts"?(S.style.fontFamily=Xe[1],J({elem:Re})):Xe[0]==="Google Fonts"&&(Xe[1]==="Sans Serif"?S.style.fontFamily="Helvetica, Arial, sans-serif":Xe[1]==="Serif"&&(S.style.fontFamily='"Times New Roman", Times, serif'),S.classList.remove(...[...S.classList].filter(Ye=>Ye.startsWith("em-font"))),S.classList.add(`em-font-${Xe[2].replace(/\s/g,"")}-${Xe[3].replace(/\s/g,"")}`),qe({elem:Re,fontFamilyArray:Xe}));let ho="";if(I.headings.letterSpacing>0?ho=S.style.letterSpacing?S.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${I.headings.letterSpacing}px`):S.getAttribute("style")+` letter-spacing: ${I.headings.letterSpacing}px;`:ho=S.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),S.setAttribute("style",ho),I.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 Ye=S.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");S.setAttribute("style",Ye)}if(I.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 Ye=S.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");S.setAttribute("style",Ye)}if(S.closest('[em="atom"] > tr > td')&&S.closest('[em="atom"] > tr > td').style.paddingTop)S.closest('[em="atom"] > tr > td').style.paddingTop=I.headings.paddingTop+"px";else if(S.previousElementSibling){let Ye=S.previousElementSibling;Ye&&Ye.tagName==="TABLE"&&(Ye.classList.contains("em-vindent-table")||Ye.querySelector("td").innerHTML==="")&&Ye.querySelector("td").setAttribute("height",I.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=I.headings.paddingBottom+"px";else if(S.nextElementSibling){let Ye=S.nextElementSibling;Ye&&Ye.tagName==="TABLE"&&(Ye.classList.contains("em-vindent-table")||Ye.querySelector("td").innerHTML==="")&&Ye.querySelector("td").setAttribute("height",I.headings.paddingBottom)}}}),Re.querySelectorAll('a[style*="color"]').forEach(S=>{if(S.style.display){if(S.style.display&&S.style.display==="block"){let we="";if(we=S.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${I.buttons.fontSize}px`),S.setAttribute("style",we),S.closest("td").style.backgroundColor&&!S.closest("td").style.borderWidth&&!S.closest(".em-contrast-card"))if(S.closest(".em-contrast-block")?we=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.buttons.contrastColor};`):we=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.buttons.color};`),S.setAttribute("style",we),S.closest(".em-contrast-block"))if(I.buttons.contrastBackgroundColor){let Ye=S.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${I.buttons.contrastBackgroundColor};`);S.closest("td").setAttribute("style",Ye)}else S.closest("td").style.removeProperty("background-color");else if(I.buttons.backgroundColor){let Ye=S.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${I.buttons.backgroundColor};`);S.closest("td").setAttribute("style",Ye)}else S.closest("td").style.removeProperty("background-color");else if(S.closest("td").style.borderWidth)if(Object.values(I.buttons.border).every(Ye=>Ye===null)){if(S.closest(".em-contrast-block")){if(I.buttons.contrastBackgroundColor){let Ye=S.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,Wo=>Wo.replace(/#[A-Fa-f0-9]{6}/,`${I.buttons.contrastBackgroundColor}`));S.closest("td").setAttribute("style",Ye),we=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.buttons.contrastBackgroundColor};`),S.setAttribute("style",we)}}else if(I.buttons.backgroundColor){let Ye=S.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,Wo=>Wo.replace(/#[A-Fa-f0-9]{6}/,`${I.buttons.backgroundColor}`));S.closest("td").setAttribute("style",Ye),we=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.buttons.backgroundColor};`),S.setAttribute("style",we)}}else for(const Ye in I.buttons.border)I.buttons.border[Ye]&&I.buttons.border[Ye].color!==void 0&&(we=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.buttons.border[Ye].color};`),S.setAttribute("style",we));else S.closest(".em-contrast-block")?I.buttons.contrastBackgroundColor&&(we=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.buttons.contrastBackgroundColor};`),S.setAttribute("style",we)):I.buttons.backgroundColor&&(we=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.buttons.backgroundColor};`),S.setAttribute("style",we));let Xe=I.buttons.fontFamily;Xe[0]==="Safe Fonts"?(S.style.fontFamily=Xe[1],J({elem:Re})):Xe[0]==="Google Fonts"&&(Xe[1]==="Sans Serif"?S.style.fontFamily="Helvetica, Arial, sans-serif":Xe[1]==="Serif"&&(S.style.fontFamily='"Times New Roman", Times, serif'),S.classList.remove(...[...S.classList].filter(Ye=>Ye.startsWith("em-font"))),S.classList.add(`em-font-${Xe[2].replace(/\s/g,"")}-${Xe[3].replace(/\s/g,"")}`),qe({elem:Re,fontFamilyArray:Xe})),S.closest("td").setAttribute("align",I.buttons.textAlign);let ho="";if(I.buttons.letterSpacing>0?ho=S.style.letterSpacing?S.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${I.buttons.letterSpacing}px`):S.getAttribute("style")+` letter-spacing: ${I.buttons.letterSpacing}px;`:ho=S.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),S.setAttribute("style",ho),I.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 Ye=S.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");S.setAttribute("style",Ye)}if(I.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 Ye=S.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");S.setAttribute("style",Ye)}if(S.closest('[em="atom"] > tr > td')&&S.closest('[em="atom"] > tr > td').style.paddingTop)S.closest('[em="atom"] > tr > td').style.paddingTop=I.buttons.marginTop+"px";else if(S.closest("table").previousElementSibling){let Ye=S.closest("table").previousElementSibling;Ye&&Ye.tagName==="TABLE"&&(Ye.classList.contains("em-vindent-table")||Ye.querySelector("td").innerHTML==="")&&Ye.querySelector("td").setAttribute("height",I.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=I.buttons.marginBottom+"px";else if(S.closest("table").previousElementSibling){let Ye=S.closest("table").nextElementSibling;Ye&&Ye.tagName==="TABLE"&&(Ye.classList.contains("em-vindent-table")||Ye.querySelector("td").innerHTML==="")&&Ye.querySelector("td").setAttribute("height",I.buttons.marginBottom)}I.buttons.padding.all&&(S.style.padding=I.buttons.padding.all+"px"),I.buttons.padding.top&&(S.style.paddingTop=I.buttons.padding.top+"px"),I.buttons.padding.right&&(S.style.paddingRight=I.buttons.padding.right+"px"),I.buttons.padding.bottom&&(S.style.paddingBottom=I.buttons.padding.bottom+"px"),I.buttons.padding.left&&(S.style.paddingLeft=I.buttons.padding.left+"px"),We({settings:{border:I.buttons.border},elem:S.closest("td")}),to({settings:{borderRadius:I.buttons.borderRadius},elem:S.closest("td")})}}else{let we=I.text.fontFamily;if(Ve(S.style.color).toLowerCase()==="#1c52dc"){let ho=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.links.color};`);S.setAttribute("style",ho)}else{let ho=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.text.color};`);S.setAttribute("style",ho)}if(S.closest(".em-contrast-block")){let ho=S.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${I.links.contrastColor};`);S.setAttribute("style",ho)}let Xe="";I.links.underline?Xe=S.style.textDecoration?S.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: underline;"):S.getAttribute("style")+" text-decoration: underline;":Xe=S.style.textDecoration?S.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: none;"):S.getAttribute("style")+" text-decoration: none;",S.setAttribute("style",Xe),we[0]==="Safe Fonts"?(S.style.fontFamily=we[1],J({elem:Re})):we[0]==="Google Fonts"&&(we[1]==="Sans Serif"?S.style.fontFamily="Helvetica, Arial, sans-serif":we[1]==="Serif"&&(S.style.fontFamily='"Times New Roman", Times, serif'),S.classList.remove(...[...S.classList].filter(ho=>ho.startsWith("em-font"))),S.classList.add(`em-font-${we[2].replace(/\s/g,"")}-${we[3].replace(/\s/g,"")}`),qe({elem:Re,fontFamilyArray:we}))}}),Re.querySelector('[em="block"]'))){const S=Re.querySelectorAll('[em="block"]');I.block?.backgroundColor&&S.forEach(we=>{we.querySelectorAll(":scope > td").forEach(Xe=>{Xe.setAttribute("bgcolor",I.block.backgroundColor)})}),I.block?.padding&&S.forEach(we=>{we.querySelectorAll(":scope > td").forEach(Xe=>{Xe.style.paddingTop=I.block.padding.top+"px",Xe.style.paddingRight=I.block.padding.right+"px",Xe.style.paddingBottom=I.block.padding.bottom+"px",Xe.style.paddingLeft=I.block.padding.left+"px"})})}return Re.tagName==="DIV"?r.getElementInnerHTML(Re):r.getElementInnerHTML(Re.querySelector("tbody")||Re)},J=w=>{w.elem.querySelectorAll("link[em-class]").forEach(Re=>{w.elem.querySelector("."+Re.getAttribute("em-class"))||Re.remove()})};function Ve(w){if(w&&w.charAt(0)==="r"){if(w.charAt(3)==="a")return w=w.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i),w&&w.length===4?"#"+("0"+parseInt(w[1],10).toString(16)).slice(-2)+("0"+parseInt(w[2],10).toString(16)).slice(-2)+("0"+parseInt(w[3],10).toString(16)).slice(-2):"";{w=w.replace("rgb(","").replace(")","").split(",");let Re=parseInt(w[0],10).toString(16),S=parseInt(w[1],10).toString(16),we=parseInt(w[2],10).toString(16);return Re=Re.length===1?"0"+Re:Re,S=S.length===1?"0"+S:S,we=we.length===1?"0"+we:we,"#"+Re+S+we}}else if(w&&w.charAt(0)==="#")return w}const qe=w=>{const Re=w.elem.querySelectorAll("link"),S=`em-font-${w.fontFamilyArray[2].replace(/\s/g,"")}-${w.fontFamilyArray[3].replace(/\s/g,"")}`;if(!Array.from(Re)?.find(Xe=>Xe.getAttribute("em-class")===S)){let Xe=document.createElement("link");Xe.setAttribute("rel","stylesheet"),Xe.setAttribute("href",`https://fonts.googleapis.com/css2?family=${w.fontFamilyArray[2]}:ital,wght@${Qe[w.fontFamilyArray[3]].indexOf("i")>-1?"1":"0"},${Qe[w.fontFamilyArray[3]].replaceAll("i","")}&display=swap`),Xe.setAttribute("em-class",S),w.elem.insertAdjacentElement("afterbegin",Xe)}Eo({elem:w.elem});let we=`font-family: '${w.fontFamilyArray[2]}', ${wo[w.fontFamilyArray[1]]}!important;`;we+=` font-weight: ${Qe[w.fontFamilyArray[3]].replaceAll("i","")}!important;`,Qe[w.fontFamilyArray[3]].indexOf("i")>-1&&(we+=" font-style: italic!important;"),w.elem.querySelector('style[em="styles"]').insertAdjacentHTML("beforeend",`
13
+ .em-font-${w.fontFamilyArray[2].replace(/\s/g,"")}-${w.fontFamilyArray[3].replace(/\s/g,"")} { ${we} }`),setTimeout(()=>J({elem:w.elem}),0)},We=w=>{w.settings.border.all?w.settings.border.all.width!=null&&(w.settings.border.all.style||w.settings.border.all.color)?(w.elem.style.borderWidth=w.settings.border.all.width+"px",w.elem.style.borderStyle=w.settings.border.all.style,w.elem.style.borderColor=w.settings.border.all.color):w.elem.style.removeProperty("border"):(w.settings.border.top&&(w.settings.border.top.width!=null&&(w.settings.border.top.style||w.settings.border.top.color)?(w.elem.style.borderTopWidth=w.settings.border.top.width+"px",w.elem.style.borderTopStyle=w.settings.border.top.style,w.elem.style.borderTopColor=w.settings.border.top.color):w.elem.style.removeProperty("border-top")),w.settings.border.right&&(w.settings.border.right.width!=null&&(w.settings.border.right.style||w.settings.border.right.color)?(w.elem.style.borderRightWidth=w.settings.border.right.width+"px",w.elem.style.borderRightStyle=w.settings.border.right.style,w.elem.style.borderRightColor=w.settings.border.right.color):w.elem.style.removeProperty("border-right")),w.settings.border.bottom&&(w.settings.border.bottom.width!=null&&(w.settings.border.bottom.style||w.settings.border.bottom.color)?(w.elem.style.borderBottomWidth=w.settings.border.bottom.width+"px",w.elem.style.borderBottomStyle=w.settings.border.bottom.style,w.elem.style.borderBottomColor=w.settings.border.bottom.color):w.elem.style.removeProperty("border-bottom")),w.settings.border.left&&(w.settings.border.left.width!=null&&(w.settings.border.left.style||w.settings.border.left.color)?(w.elem.style.borderLeftWidth=w.settings.border.left.width+"px",w.elem.style.borderLeftStyle=w.settings.border.left.style,w.elem.style.borderLeftColor=w.settings.border.left.color):w.elem.style.removeProperty("border-left")))},to=w=>{w.settings.borderRadius.all?w.elem.style.borderRadius=w.settings.borderRadius.all+"px":w.settings.borderRadius.all===""?w.elem.style.removeProperty("border-radius"):(w.settings.borderRadius.topLeft?w.elem.style.borderTopLeftRadius=w.settings.borderRadius.topLeft+"px":w.settings.borderRadius.topLeft===""&&w.elem.style.removeProperty("border-top-left-radius"),w.settings.borderRadius.topRight?w.elem.style.borderTopRightRadius=w.settings.borderRadius.topRight+"px":w.settings.borderRadius.topRight===""&&w.elem.style.removeProperty("border-top-right-radius"),w.settings.borderRadius.bottomRight?w.elem.style.borderBottomRightRadius=w.settings.borderRadius.bottomRight+"px":w.settings.borderRadius.bottomRight===""&&w.elem.style.removeProperty("border-bottom-right-radius"),w.settings.borderRadius.bottomLeft?w.elem.style.borderBottomLeftRadius=w.settings.borderRadius.bottomLeft+"px":w.settings.borderRadius.bottomLeft===""&&w.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"},wo={"Sans Serif":"sans-serif",Serif:"serif"};function Eo(w){if(!w.elem.querySelector('style[em="styles"]')){let Re=document.createElement("style");Re.setAttribute("em","styles"),w.elem.append(Re)}}return(0,o.jsxs)("div",{className:(0,Ke.default)("blocks-search",{is_search:s}),children:[(0,o.jsx)(t.ui_kit$Form,{className:(0,Ke.default)("blocks-search__form",{is_search:s}),form:_,layout:"vertical",name:"blocks_search_form",initialValues:{...Qa},onValuesChange:_o,autoComplete:"off",children:(0,o.jsx)(t.ui_kit$Form.Item,{name:Tr,children:(0,o.jsx)(t.ui_kit$SearchInput,{placeholder:h("Search by title"),allowClear:!0,enterButton:!1})})}),((s||i==="project")&&xe||(s||i==="template")&&L||(s||i==="common")&&O)&&(0,o.jsx)(t.ui_kit$Alert,{title:h("Error"),description:h("Error when receiving data. Try again (reload page) or contact support."),type:"error",showIcon:!0}),s&&!Je&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:mo,children:h("All")},"search_All"),C.map(w=>(0,o.jsx)("li",{"data-type":w,onClick:mo,children:h(r.TYPES_TRANSLATE[w])},"search_"+w))]})}),(0,o.jsxs)("div",{ref:A,className:(0,Ke.default)("blocks-search__result-wrapper",{is_search:s}),children:[(i==="project"||s)&&(0,o.jsxs)(o.Fragment,{children:[!!Te.length&&!s&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:mo,children:h("All")},"blocksSections_All"),Te.map(w=>(0,o.jsx)("li",{"data-type":w,onClick:mo,children:h(r.TYPES_TRANSLATE[w])},"blocksSections_"+w))]})}),(0,o.jsxs)("div",{className:(0,Ke.default)("blocks-search__blocks-wrapper",{is_search:s}),ref:le,children:[(0,o.jsx)("div",{className:"blocks-search__result-holder project",children:!te&&(oe?.length?oe.map(w=>{const Re=Br(w.id,bi(w));return(0,o.jsx)("div",{className:"blocks-search__result","data-type":w.type,children:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"leftTop",menu:{items:K(w)},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:S=>Ae(S,w.html,"project",w.title,w),onDragStart:S=>ne(S,w.html,"project",w.title,w),onMouseEnter:()=>ge({html:w.html,title:w.title}),onMouseLeave:Ge,children:[Y(w),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:Re,onContentLoad:Pe,style:{transform:`scale(${W})`}})]})},"commenMenu")},w.id)}):!(Ue.tags||Ue.name||Ue.type)&&Be&&!te&&!s&&(0,o.jsxs)("div",{style:{padding:"10px 0 20px",display:"flex",flexDirection:"row",justifyContent:"space-between"},children:[(0,o.jsxs)("div",{style:{width:"110%"},children:[(0,o.jsx)("h3",{style:{lineHeight:"1.2"},children:h("You don`t have any saved blocks yet.")}),h("To add a block from the dashboard click the"),' "',h("Save to Blocks button."),'" ',(0,o.jsx)(r.EmIcons,{icon:"SaveBlock",component:t.icons$SaveBlock,style:{position:"relative",top:"2px"}}),(0,o.jsx)("br",{}),(0,o.jsx)("br",{}),h("You can also save all blocks at once. The AI assistant will automatically determine the type and create a name for each block when saving."),(0,o.jsx)("br",{}),(0,o.jsx)("br",{}),(0,o.jsx)(t.ui_kit$Flex,{justify:"left",children:(0,o.jsx)(t.ui_kit$Button,{type:"primary",onClick:()=>d(!0),style:{cursor:"pointer"},children:h("Save all blocks")})})]}),(0,o.jsx)("div",{style:{width:"80px",height:"200px"},children:(0,o.jsx)("img",{src:bp,style:{display:"block",width:80,position:"absolute",right:5}})})]}))}),te&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),s&&ue?.length>0&&y?.length>0&&(0,o.jsx)(t.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="template"||s)&&(0,o.jsxs)(o.Fragment,{children:[!!he.length&&!s&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:mo,children:h("All")},"templateBlocksSections_All"),he.map(w=>(0,o.jsx)("li",{"data-type":w,onClick:mo,children:h(r.TYPES_TRANSLATE[w])},"templateBlocksSections_"+w))]})}),(0,o.jsxs)("div",{className:(0,Ke.default)("blocks-search__blocks-wrapper",{is_search:s}),ref:ke,children:[(0,o.jsxs)("div",{className:"blocks-search__result-holder template",children:[y&&!(X||ie)&&me?.length?(0,o.jsx)(o.Fragment,{children:me.map((w,Re)=>{const S=Br(w.id,bi(w));return(0,o.jsx)("div",{className:"blocks-search__result","data-type":w.type,children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:we=>Ae(we,w.html,"template",w.title,w),onDragStart:we=>ne(we,w.html,"template",w.title,w),onMouseEnter:()=>ge({html:w.html,title:w.title}),onMouseLeave:()=>Ge(),children:[Y(w),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:S,onContentLoad:Pe,style:{transform:`scale(${W})`}})]})},w.id+Re.toString())})}):!s&&!pe&&!ie&&!L&&(0,o.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:h("No related blocks found.")})," "]}),(X||ie)&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),s&&y?.length>0&&ze?.length>0&&(0,o.jsx)(t.ui_kit$Divider,{className:"blocks-search__result-divider"}),(i==="common"||s)&&(0,o.jsxs)(o.Fragment,{children:[!!M?.length&&!s&&(0,o.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,o.jsxs)("ul",{children:[(0,o.jsx)("li",{"data-type":"",className:"active",onClick:mo,children:h("All")},"commonBlocksSections_All"),M.map(w=>(0,o.jsx)("li",{"data-type":w,onClick:mo,children:h(r.TYPES_TRANSLATE[w])},"commonBlocksSections_"+w))]})}),(0,o.jsxs)("div",{className:(0,Ke.default)("blocks-search__blocks-wrapper",{is_search:s}),ref:Ne,children:[(0,o.jsxs)("div",{className:"blocks-search__result-holder common",children:[re&&!!ao?.length&&!ro&&(0,o.jsx)(o.Fragment,{children:ao.map((w,Re)=>{const S=Ie({html:Br(w.id,bi(w))});return(0,o.jsx)("div",{className:"blocks-search__result","data-type":w.type,children:(0,o.jsxs)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:we=>Ae(we,Ie({html:w.html}),"common",w.title,w),onDragStart:we=>ne(we,Ie({html:w.html}),"common",w.title,w),onMouseEnter:()=>ge({html:S,title:w.title}),onMouseLeave:()=>Ge(),children:[Y(w),(0,o.jsx)(r.BlockPreviewShadow,{className:"blocks-search__result-html",html:S,onContentLoad:Pe,style:{transform:`scale(${W})`}})]})},w.id+Re.toString())})})," "]}),ro&&(0,o.jsx)(t.ui_kit$Skeleton,{active:!0})]})]}),Je&&(0,o.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:h("There are no blocks for this request.")})]})]})};Rr.propTypes={};function Bp(e,i){return e==="email"||r.isBlocksV2Enabled()?!0:i!==void 0&&r.isPluginGoHistory(i)}var Za=({comments:e,subjectId:i,isLoggedIn:l,projectTitle:s="",emailElementType:n,email:d})=>{const{__:c,_n:p}=r.useI18n(),g=r.useSendPostMessage(),m=r.useNotification(),{token:_}=(0,t.ui_kit$useToken)(),E=r.useAppConfig(),b=r.usePushToDataLayer(),h=(0,a.useRef)(null),[k,x]=(0,a.useState)(""),[T,v]=(0,a.useState)("ADD"),[P,B]=(0,a.useState)(!1),[y,D]=(0,a.useState)(null),[z,A]=(0,a.useState)(null),[$,j]=(0,a.useState)(""),[W,Y]=(0,a.useState)(""),[ee,I]=(0,a.useState)(!1),[le,ke]=(0,a.useState)(""),[Ne,Q]=r.useAddCommentMutation(),[fe,Ae]=r.useDeleteCommentMutation(),[ne,Fe]=r.useEditCommentMutation(),[Le,Ue]=r.useDeleteTargetMutation(),[ve]=r.useAutoSaveBlockMutation(),Be=r.useDispatch(),xe=r.useStore(),ce=r.useCurrentUser(),be=r.useCurrentProjectRequested(),ue=r.useContentReader(),q=G=>{const re=r.getEmailDocuments(r.getContainer(xe));re.save("anchor",{project:G}).then(O=>{const pe=O?re.revisionFacts()?.lastRevisionAt:void 0;pe!==void 0&&d?.id!=null&&Be(r.rememberAutosaveTime({emailId:d.id,modified:new Date(pe).toISOString()}))})},Z=()=>{const G=be;if(Bp(n,r.getContainer(xe))){q(G);return}const re={...d?.meta!==void 0?{meta:d.meta}:{},title:d?.title,emailId:d?.id,project:G,html:ue(),excerpt:d?.date_gmt};d?.id!=null&&ve({blockId:d.id,body:re}).catch(O=>{})};function te(G){I(!1),ke(""),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:le}),B(!0),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!0})}function ae(){A(y),e.filter(G=>G.parent===y).length?ne({commentId:y,status:"deleted"}).unwrap():fe(y),document.querySelector('.discuss-main li[id="'+y+'"] .comment-icon-target')?.getAttribute("target-id")&&g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:document.querySelector('.discuss-main li[id="'+y+'"] .comment-icon-target')?.getAttribute("target-id")}),Z(),ke("")}function de(G){A(y);const re=e.find(pe=>pe.id?.toString()===y),O=re?.target_id?.toString()||"";I(!!O),ke(O),Y(re?.content?.slice(3,-5)?.toString()),v("EDIT")}function De(G){A(y),j(""),v("REPLY")}const oe=()=>{m.error({mask:{closable:!0},centered:!0,title:c("Please log in"),content:(r.isUseBlocksBuild()?c("To leave comments you must be logged into Blocks and added to the project "):c("To leave comments you must be logged into EmailMaker and added to the project "))+`${s}.`,okText:c("Okay. I'll log in.")})};async function Te(){l?(await ne({commentId:z,content:W,targetId:le}).unwrap(),v("ADD"),Y(""),A(0),I(!1),B(!1),ke(""),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):oe()}const _e=G=>{v("ADD"),Y(""),A(0),I(!1),B(!1),ke(""),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})},Ce=async()=>{l?((k||$)&&await Ne({subjectId:i,author:ce.id,parent:T==="ADD"?"0":z,content:k||$,author_name:ce.name,author_email:ce.email,targetId:le}).then(G=>{if(G.error){const{data:re}=G.error;m.error({title:re?.code??c("Error"),description:re?.message??c("Something went wrong. Try again later.")})}else b({event:"submit",action:"send_discussion_chat_message",entity_type:n==="block"?"block":"email",entity_id:d?.id,project_id:d?.project,context:"editor"},void 0,{analyticsName:"editor_comment_sent"})}),ke(""),v("ADD"),j(""),x(""),A(0),I(!1),B(!1),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_RESET})):oe()};function R(){ee?(B(!1),I(!1),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:le})):(B(!P),g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_SET_TARGET,value:!P}),P&&I(!1))}function V(G){let re=JSON.parse(JSON.stringify(G));if(!re||!re.length)return[];let O=[],pe=new Map;for(let ye=0,ze=re.length;ye<ze;++ye){let oo=re[ye],ro=pe.get(oo.id);if((!ro||Array.isArray(ro))&&(ro&&(oo.children=ro),pe.set(oo.id,oo)),String(oo.parent)==="0")O.push(oo);else{let ao=pe.get(oo.parent);ao?(Array.isArray(ao)?ao:ao.children=ao.children||[]).push(oo):pe.set(oo.parent,[oo])}}return O.forEach(ye=>{ye.status==="deleted"&&!ye.children&&(Ae.isUninitialized||Ae.isSuccess)&&fe(ye.id).unwrap().catch(ze=>{})}),O}const L=G=>{const re=G.data.operation;if(re===r.EVENT_TYPES.APPLICATION_DISCUSS_SET_ID&&(ke(G.data.settings.value),G.data.settings.value!==""?(I(!0),B(!1)):(I(!1),B(!0))),re===r.EVENT_TYPES.APPLICATION_DISCUSS_SAVE_TARGET&&Z(),re===r.EVENT_TYPES.APPLICATION_DISCUSS_GET_COMMENT)if(document.querySelector('.comment-icon-target[target-id="'+G.data.settings.targetId+'"]')){let O=document.querySelector('.comment-icon-target[target-id="'+G.data.settings.targetId+'"]').closest(".ant-comment");document.querySelector(".comment-block")?document.querySelector(".comment-block").scrollTo(0,O.offsetTop):document.querySelector(".em-analytics__email-tab-discuss .ant-tabs-content").scrollTo(0,O.offsetTop),O.classList.add("active"),setTimeout(()=>{O.classList.remove("active")},2e3)}else g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_REMOVE_TARGET,value:G.data.settings.targetId}),m.error({title:c("There's no such comment.")});re===r.EVENT_TYPES.APPLICATION_DISCUSS_NO_COMMENT&&m.error({title:c("There's no such element in the email.")})};r.useListenPostMessage(L);const X=G=>{g({operation:r.EVENT_TYPES.SANDBOX_DISCUSS_GET_TARGET,value:G})},ie=G=>(G?.sort((re,O)=>re.date>O.date?1:-1),(0,o.jsx)(o.Fragment,{children:G&&!!G.length&&(0,o.jsx)(t.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:G,renderItem:re=>(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("li",{id:re.id,children:(0,o.jsxs)(o.Fragment,{children:[re.status==="deleted"&&re.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:ie(re.children)}),re.status!=="deleted"&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Comment,{author_id:re.author_id,author:re.author_name,avatar:re.author_avatar_urls&&re.author_avatar_urls[48]||"",className:(0,Ke.default)(re.target_id&&"targetted-comment-item",(!re.author_avatar_urls||!re.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>D(re.id),menu:{items:re.author===ce.id?$e:je},styles:{root:{minWidth:"auto",paddingRight:6}},children:(0,o.jsx)("div",{onClick:()=>re.target_id&&X(re.target_id),dangerouslySetInnerHTML:{__html:re.content}})},"commenMenu"),datetime:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:re.date&&r.formatDate(r.tryParseISO(re.date),p,!0)}}),re.target_id&&(0,o.jsx)("span",{className:"comment-icon-target","target-id":re.target_id,onClick:()=>X(re.target_id),children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,style:{color:_.colorInfo,top:-2,position:"relative"}})})]}),children:(0,o.jsxs)(o.Fragment,{children:[T==="REPLY"&&z===re.id&&he,T==="EDIT"&&z===re.id&&me,ie(re.children)]})})})]})})})})})),me=(0,o.jsxs)(t.ui_kit$Form,{onFinish:Te,className:"commentForm",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{className:"textarea-reply",value:W,onChange:G=>Y(G.target.value),rows:4,placeholder:c("Editing comments"),onKeyDown:G=>G.key==="Escape"&&_e(),onPressEnter:G=>G.key==="Enter"&&G.ctrlKey&&Te(),ref:h})}),(0,o.jsx)(t.ui_kit$Form.Item,{className:"buttons",children:(0,o.jsxs)(t.ui_kit$Space,{children:[ee?(0,o.jsx)(t.ui_kit$Popconfirm,{title:c("Are you sure?"),okText:c("Yes"),cancelText:c("No"),onConfirm:te,children:(0,o.jsx)(t.ui_kit$Button,{loading:Ue.isLoading,type:P||ee&&T==="EDIT"&&le!==""?"primary":"default",className:"button-target "+(P&&!ee?"button-target_choose":""),style:ee&&T==="EDIT"&&le!==""?{background:_.colorInfo}:{},children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,className:"icon-target"})})}):(0,o.jsx)(t.ui_kit$Button,{onClick:R,loading:Ue.isLoading,type:P||ee&&T==="EDIT"&&le!==""?"primary":"default",className:"button-target "+(P&&!ee?"button-target_choose":""),style:ee&&T==="EDIT"&&le!==""?{background:_.colorInfo}:{},children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,className:"icon-target"})}),(0,o.jsxs)(t.ui_kit$Button,{className:"button-reply",type:"primary",loading:Fe.isLoading,htmlType:"submit",children:[c("Save")," ",(0,o.jsx)(r.EmIcons,{icon:"SaveOutlined",component:t.icons$SaveOutlined,size:16,strokeWidth:E.iconStrokeWidth})]}),(0,o.jsx)(t.ui_kit$Button,{onClick:_e,className:"button-reply",children:c("Cancel")})]})})]}),he=(0,o.jsxs)(t.ui_kit$Form,{name:"reply",className:"commentForm",onFinish:Ce,children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{className:"textarea-reply",value:$,onChange:G=>j(G.target.value),rows:4,placeholder:c("Reply to the comment"),onKeyDown:G=>G.key==="Escape"&&_e(),onPressEnter:G=>G.key==="Enter"&&G.ctrlKey&&Ce(),ref:h})}),(0,o.jsx)(t.ui_kit$Form.Item,{hidden:!0,name:"targetId",children:(0,o.jsx)(t.ui_kit$Input,{type:"hidden"})}),(0,o.jsx)(t.ui_kit$Form.Item,{className:"buttons",children:(0,o.jsxs)(t.ui_kit$Space,{children:[(0,o.jsx)(t.ui_kit$Tooltip,{placement:"top",title:c("Add a note"),styles:{body:{maxWidth:"150px"}},children:(0,o.jsx)(t.ui_kit$Button,{onClick:R,type:P||ee&&T==="REPLY"&&le!==""?"primary":"default",className:"button-target "+(P&&!ee?"button-target_choose":""),style:ee&&T==="REPLY"&&le!==""?{background:_.colorInfo}:{},children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,className:"icon-target"})})}),(0,o.jsxs)(t.ui_kit$Button,{className:"button-reply",type:"primary",loading:T==="REPLY"&&Q.isLoading,htmlType:"submit",children:[c("Reply")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:E.iconStrokeWidth})]}),(0,o.jsx)(t.ui_kit$Button,{onClick:_e,className:"button-reply",ghost:!0,type:"primary",children:c("Cancel")})]})})]});(0,a.useEffect)(()=>{T==="REPLY"&&h.current.focus({cursor:"start"}),T==="EDIT"&&h.current.focus({cursor:"end"})},[T]);let $e=[];$e.push({key:"Reply to comment",icon:(0,o.jsx)(r.EmIcons,{icon:"RollbackOutlined",component:t.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:De},{key:"Edit comment",icon:(0,o.jsx)(r.EmIcons,{icon:"EditOutlined",component:t.icons$EditOutlined,style:{fontSize:"16px"}}),label:c("Edit"),onClick:de},{key:"Delete comment",icon:(0,o.jsx)(r.EmIcons,{icon:"DeleteOutlined",component:t.icons$DeleteOutlined,size:16}),label:c("Delete"),style:{color:_.colorError},onClick:ae});let je=[];return je.push({key:"Reply to comment",icon:(0,o.jsx)(r.EmIcons,{icon:"RollbackOutlined",component:t.icons$RollbackOutlined,style:{fontSize:"16px"}}),label:c("Reply"),onClick:De}),(0,o.jsxs)("div",{className:"discuss-main",children:[e.length>0&&(0,o.jsx)(t.ui_kit$List,{className:"comment-list",itemLayout:"horizontal",dataSource:V(e),renderItem:G=>(0,o.jsxs)("li",{id:G.id,children:[G.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:ie(G.children)}),G.comment_status!=="deleted"&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(t.ui_kit$Comment,{author_id:G.author_id,author:G.author_name,avatar:G.author_avatar_urls&&G.author_avatar_urls[48]||"",className:(0,Ke.default)(G.target_id&&"targetted-comment-item",(!G.author_avatar_urls||!G.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,o.jsx)(t.ui_kit$Dropdown,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>D(G.id),menu:{items:G.author===ce.id?$e:je},styles:{root:{minWidth:"auto"}},children:(0,o.jsx)("div",{onClick:()=>G.target_id&&X(G.target_id),dangerouslySetInnerHTML:{__html:G.content}})},"commenMenu"),datetime:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:G.date&&r.formatDate(r.tryParseISO(G.date),p,!0)}}),G.target_id&&(0,o.jsx)("span",{className:"comment-icon-target","target-id":G.target_id,onClick:()=>X(G.target_id),children:(0,o.jsx)(r.EmIcons,{icon:"AimOutlined",component:t.icons$AimOutlined,style:{color:_.colorInfo,top:-2,position:"relative"}})})]}),children:(0,o.jsxs)(o.Fragment,{children:[T==="REPLY"&&z===G.id&&he,T==="EDIT"&&z===G.id&&me,ie(G.children)]})})})]})}),(0,o.jsxs)(t.ui_kit$Form,{onFinish:Ce,className:T==="ADD"?"addMode":"replyEditMode",children:[(0,o.jsx)(t.ui_kit$Form.Item,{style:{marginBottom:10},children:(0,o.jsx)(t.ui_kit$TextArea,{value:k,onChange:G=>x(G.target.value),rows:4,placeholder:c("Leave your comment"),className:"textarea-comment",onPressEnter:G=>G.key==="Enter"&&G.ctrlKey&&Ce()})}),(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:R,type:P||ee&&T==="ADD"&&le!==""?"primary":"default",className:"button-target "+(P&&!ee?"button-target_choose":""),style:ee&&T==="ADD"&&le!==""?{background:_.colorInfo}:{},icon:(0,o.jsx)(r.EmIcons,{icon:"Target",component:t.icons$Target,size:16,strokeWidth:E.iconStrokeWidth,className:"icon-target"})})}),(0,o.jsxs)(t.ui_kit$Button,{className:"button-add",type:"primary",loading:T==="ADD"&&Q.isLoading,htmlType:"submit",children:[c("Send")," ",(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:16,strokeWidth:E.iconStrokeWidth})]})]})})]})]})};function Tp(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 Rp=["common_styles","subject","preheader","meta"];function yp(e,i){r.writeSourceReport(e,r.fromRevision(i))}function wp(e){if(!e)return null;const i=e.get().attributes??{},l={};for(const s of Rp)i[s]!==void 0&&(l[s]=i[s]);return{content:e.getContent(),attributes:l}}function en(e,i){i&&r.writeSourceReport(e,{content:i.content,attributes:i.attributes})}var on=(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}),yr=({emailElement:e})=>{const{__:i}=r.useI18n(),l=r.useSendPostMessage(),s=r.useDispatch(),n=r.useEditorProjectId(),d=r.useEmailAttributesWriter(),c=r.useContentReplacer(),p=r.useEditorLocked(),g=r.useEditorLockCheck(),{document:m}=r.useDocumentSessionContext(),_=r.useSelector(r.selectHistoryData),E=r.useDocumentHistoryReader(),b=r.useRevisionContent(),h=r.useNotification(),k=(0,a.useRef)({preview:0,apply:0}),x=r.useProjectData()?.members,T=r.useSelector(r.selectElementHistoryHasMore),v=r.useSelector(r.selectIsPanelHistoryCollapsed),[P,B]=(0,a.useState)(!0),[y,D]=(0,a.useState)(!1),[z,A]=(0,a.useState)([]),[$,j]=(0,a.useState)([]),W=ae=>s(r.switchIsPanelHistoryCollapsed(ae)),Y=(0,a.useCallback)(ae=>{if(!ae?.html||g())return;const de=r.fromRevision(ae);de?.attributes&&d(de.attributes),s(r.markAppearanceNeedsUpdate());const De=m?.get().version;c(ae.html,{undoable:!0}),m&&m.get().version===De&&m.markUnsaved()},[c,s,d,m,g]),ee=(0,a.useCallback)(ae=>{yp(m,ae),s(r.markAppearanceNeedsUpdate())},[m,s]),{data:I}=r.projectsApi.useGetProjectQuery(Number(n),{skip:!n}),[le,ke]=(0,a.useState)([]);(0,a.useEffect)(()=>{if(I){const{owner:ae,admins:de,users:De}=I?.members;ke([ae&&{...ae},de&&Array.isArray(de)&&de.map(oe=>({...oe})),De&&Array.isArray(De)&&De.map(oe=>({...oe}))].filter(oe=>oe).flat(1).map(oe=>({id:oe.ID,display_name:oe.display_name})))}},[I,I?.members,i]);const[Ne,Q]=(0,a.useState)(1),[fe,Ae]=(0,a.useState)(!1);(0,a.useEffect)(()=>{const ae=Array.isArray(_)&&_.length&&_?.map(de=>on(de,i));j(ae||[]),A(ae),B(!1),T||Ae(!0)},[_,T,i]);const ne=()=>{D(!0),j(z.concat([...new Array(3)].map(()=>({loading:!0})))),E(e.id,Ne+1).then(ae=>{if(ae.isStale)return;const{data:de,hasMore:De}=ae.data,oe=Array.isArray(de)&&de?.map(_e=>on(_e,i)),Te=z.concat(oe);j(Te),A(Te),D(!1),window.dispatchEvent(new Event("resize")),De||Ae(!0),Q(Ne+1)})},Fe=!P&&!y&&!fe?(0,o.jsx)("div",{style:{textAlign:"center",marginTop:24,marginBottom:24,height:32,lineHeight:"32px"},children:(0,o.jsx)(t.ui_kit$Button,{onClick:ne,children:i("loading more")})}):null,[Le,Ue]=(0,a.useState)(),[ve,Be]=(0,a.useState)(null),xe=(0,a.useCallback)(ae=>{Y(ae),Ue(null),Be(null),l({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1}),s(r.resetToLastActiveSettingsTab())},[Y,l,s]),ce=(0,a.useCallback)((ae,de)=>De=>{const oe=k.current;oe[de]+=1,de==="apply"&&(oe.preview+=1);const Te=oe[de],_e=()=>Te===k.current[de];if(De?.html||!De?.id){ae(De);return}b(e.id,De).then(Ce=>{_e()&&ae(Ce)},Ce=>{_e()&&(Ue(null),h.error({message:i("Failed to load"),innerException:Ce}))})},[b,e.id,h,i]),be=ce(xe,"apply"),ue=ce(ee,"preview"),q=({author:ae,authorName:de})=>{if(te.revisionService)return de||ae||"–";const De=le.find(Te=>Te.id?.toString()===ae?.toString())?.display_name;if(De)return De;const oe=r.authorFromMembers(ae,x);return oe?Tp(oe).display_name||oe.email||"–":de||"–"},Z=(0,a.useRef)(void 0);(0,a.useEffect)(()=>{!v&&!ve&&(Z.current=m,Be(wp(m)))},[v,Be,m,ve]),(0,a.useEffect)(()=>{v&&(k.current.preview+=1),v&&ve&&(Z.current===m&&(en(m,ve),s(r.markAppearanceNeedsUpdate())),Be(null))},[v,ve,m,s]);const te=r.useAppConfig();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.ui_kit$Tabs,{className:"secondary-tabs email-settings__collapse secondary-tabs_unset_scroll",size:"large",activeKey:r.HISTORY,items:[{label:(0,o.jsx)(o.Fragment,{children:i("Version history")}),key:r.HISTORY,forceRender:!0,className:"email-settings__collapse-panel",style:{height:"100%"},children:(0,o.jsx)(t.ui_kit$List,{className:"history-panel__list",loading:P,itemLayout:"horizontal",loadMore:Fe,dataSource:$,header:(0,o.jsxs)("div",{className:"history-panel__list-header",children:[(0,o.jsx)("div",{className:"history-panel__list-date",children:i("Time")}),(0,o.jsx)("div",{className:"history-panel__list-author",children:i("Author")}),(0,o.jsx)("div",{className:"history-panel__restore",children:"Set"})]}),renderItem:(ae,de)=>(0,o.jsx)(t.ui_kit$List.Item,{onClick:()=>{de!==Le&&(Ue(de),ue(z[de])),s(r.setBlockSettingsDisable(!0))},className:(0,Ke.default)("history-panel__item",{"history-panel__item_active":de===Le}),children:(0,o.jsxs)(t.ui_kit$Skeleton,{title:!1,loading:ae.loading||!1,active:!0,children:[(0,o.jsx)("div",{className:"history-panel__list-date",children:ae.date}),(0,o.jsx)("div",{className:"history-panel__list-author",children:q(ae)}),ae.isAutosave&&Le!==de&&(0,o.jsx)("div",{style:{opacity:.45},className:"history-panel__list-autosave",children:i("Auto")}),!ae.isAutosave&&(0,o.jsx)(t.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",disabled:p,onClick:De=>{Le===de&&De.stopPropagation(),be(z[de])},children:i("Set")}),ae.isAutosave&&Le===de&&(0,o.jsx)(t.ui_kit$Button,{size:"small",className:"history-panel__restore",type:"link",disabled:p,onClick:De=>{Le===de&&De.stopPropagation(),be(z[de])},children:i("Set")})]})})})}]}),(0,o.jsx)(t.ui_kit$Button,{type:"text",className:"ant-modal-close","aria-label":"Close",onClick:()=>{s(r.resetToLastActiveSettingsTab()),ve&&en(m,ve),Be(null),W(!0),l({operation:r.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!1})},children:(0,o.jsx)(r.EmIcons,{icon:"Close",component:t.icons$Close})})]})};yr.propTypes={};var tn=async({blockTags:e,projectTagsArray:i,addTerm:l,project:s,notification:n})=>{if(!e||e.length===0)return[];const d=e.map(c=>{const p=i.find(g=>g.name===c);return p?Promise.resolve(p.id):l({project:s,kind:r.BLOCK_TAGS,name:c}).then(({error:g,data:m})=>{if(g?.status===400)return r.existingTermIdFromError(g);if(m)return m.id;if(g)return n.fromError("TAG_CREATING_ERROR",c,g),null})});return(await Promise.all(d)).filter(c=>c!=null)},rn=()=>{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))},jp=async e=>{const{block:i,form:l,projectData:s,projectTagsArray:n,projectId:d,addBlock:c,editBlock:p,editProject:g,addTerm:m,notification:_,__:E,handleCloseModal:b,htmlContent:h,reloadBlockScreens:k,onGlobalBlockTemplateSynced:x,onPlainBlockCreated:T}=e;try{const{valid:v,values:P,blockTags:B}=await ln({form:l,notification:_,__:E});if(!v)return;const y=await tn({blockTags:B,projectTagsArray:n,addTerm:m,project:s,notification:_});await r.createBlock({block:i,form:l,projectId:d,htmlContent:h,values:P,tagIds:y,addBlock:c,editBlock:p,editProject:g,notification:_,reloadBlockScreens:k,projectTagsArray:n,__:E,handleCloseModal:b,onGlobalBlockTemplateSynced:x,onPlainBlockCreated:T})}catch{}},ln=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}},wr=({isModalVisible:e,htmlContent:i,projectId:l,setIsShowAddAllBlocksModal:s,setIsShowAddAllBlocksModalForNewEmail:n})=>{const{__:d}=r.useI18n(),c=r.useDispatch(),[p]=t.ui_kit$Form.useForm(),[g,m]=(0,a.useState)([]),[_,E]=r.useAddBlockMutation(),[b]=r.useEditBlockMutation(),{data:h}=r.useGetBlockTypesQuery(),k=r.useNotification(),x=r.useAppConfig(),[T,v]=(0,a.useState)([]),P=r.useProjectData(),[B,y]=r.useAddTermMutation(),[D,z]=r.useEditProjectMutation(),A=r.useSendPostMessage(),$=(0,a.useCallback)((Q,fe)=>{A({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_SET_EM_BLOCK_ID,settings:{emBlockId:Q,...fe?{emBlockVersion:fe}:{}}})},[A]),j=(0,a.useCallback)(()=>{A({operation:r.EVENT_TYPES.SANDBOX_EBLOCK_CLEAR_EM_BLOCK_ID})},[A]),{data:W}=r.useGetTermsQuery({project:P,kind:r.BLOCK_TAGS},{skip:!P?.id});(0,a.useEffect)(()=>{v((W||[]).map(Q=>({value:Q.name})))},[W]),(0,a.useEffect)(()=>{if(h){const Q=h;let fe=[];for(let Ae in Q)fe.push({label:d(r.TYPES_TRANSLATE[Q[Ae]]),value:Q[Ae]});m(fe)}},[h,d]);const Y=()=>{c(r.closeModal())},ee=(0,a.useRef)(!1),I=(0,a.useCallback)(()=>{ee.current&&(ee.current=!1,p.resetFields())},[p]),le=()=>{ee.current=!0,Y()};(0,a.useLayoutEffect)(()=>{e&&I()},[e,I]);const ke=()=>{s(!0),n(!1),Y()},Ne=async()=>{await jp({form:p,projectData:P,projectTagsArray:W||[],projectId:l,addBlock:_,editBlock:b,editProject:D,addTerm:B,notification:k,__:d,handleCloseModal:le,htmlContent:i,reloadBlockScreens:rn,onGlobalBlockTemplateSynced:$,onPlainBlockCreated:j})};return(0,o.jsx)(t.ui_kit$Modal,{title:(0,o.jsx)("div",{className:"ant-modal-title",children:d("Save block")}),open:e,afterClose:I,onOk:()=>ke(),onCancel:Y,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:ke,children:d("Save all blocks")},"create-all-blocks"),(0,o.jsx)(t.ui_kit$Button,{className:"add-new-block-modal__save-btn",size:"large",type:"primary",loading:E.isLoading,onClick:Ne,icon:(0,o.jsx)(r.EmIcons,{icon:"CreateBlock",component:t.icons$CreateBlock,style:{fontSize:22}}),children:d("Save block")},"submit")]}),children:(0,o.jsxs)(t.ui_kit$Form,{form:p,layout:"vertical",name:"add_new_block_form",onFinish:Ne,initialValues:{title:"",type:"",tags:[],global_block:!1},autoComplete:"off",children:[(0,o.jsxs)(t.ui_kit$Row,{gutter:16,children:[(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Block name"),name:"title",rules:[{required:!0,message:d("Please input block name")}],style:{marginBottom:15},children:(0,o.jsx)(t.ui_kit$Input,{disabled:E.isLoading||y.isLoading||z.isLoading,size:"large",placeholder:d("Enter block name"),spellCheck:"false"})})}),(0,o.jsx)(t.ui_kit$Col,{span:12,children:(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Type"),name:"type",rules:[{required:!0,message:d("Please choose block type")}],style:{marginBottom:15},children:(0,o.jsx)(t.ui_kit$Select,{disabled:E.isLoading||y.isLoading||z.isLoading,size:"large",placeholder:d("Choose block type"),options:g})})})]}),x.tagsEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Tags"),name:"tags",children:(0,o.jsx)(t.ui_kit$Select,{size:"large",mode:"tags",placeholder:d("Add some tags"),tooltip:{title:d("Tags help you find the block in the list."),icon:(0,o.jsx)(r.EmIcons,{icon:"InfoCircleOutlined",component:t.icons$InfoCircleOutlined})},disabled:E.isLoading||y.isLoading||z.isLoading,options:T})}),x.globalBlockCheckboxEnabled&&(0,o.jsx)(t.ui_kit$Form.Item,{name:"global_block",valuePropName:"checked",style:{marginBottom:15},children:(0,o.jsx)(t.ui_kit$Switch,{label:d("Global block"),disabled:E.isLoading||y.isLoading||z.isLoading})})]})})};wr.propTypes={};var vp="https://app.useblocks.io/api".replace(/\/+$/,""),Ip=`${vp}/wp-json/ai-generator/v1/identificate_blocks`,Cp=["Menu","Header","Content","Banners","Lists","Buttons","Promocodes","Feature","Call to Action","E-Commerce","Articles","Polls","Applications","Separators","Contacts","Footer","Other"];async function Pp(e){return await e.getInstance(Po.TOKEN_ID)}async function Np(e,i,l,s,n){const d={blocks:s,types:Cp,locale:i};l.current=d;try{const c=await Pp(n),p=await fetch(Ip,{method:"POST",headers:{"Content-Type":"application/json",...c?{Authorization:`Bearer ${c}`}:{}},body:JSON.stringify(d)});if(!p.ok||p.status!==200)throw new Error(`${p.statusText}`);return await p.json()}catch(c){throw c}}var Ap=(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 Lp(e){return Array.from(e).map(i=>i.outerHTML).join("")}var Op=(e,i="block",l=!1)=>{if(!e?.html)return[];const{document:s,blockElements:n,styleElement:d,linksElements:c}=Ap(e.html,i),p=Lp(c);if(!(n instanceof NodeList))return[];const g=s.querySelector("head"),m=g?g.innerHTML:"";return Array.from(n).map((_,E)=>{if(!(_ instanceof Element)||!_.outerHTML)return null;const b=d?d.outerHTML:"";return{id:`${e.id}-${E}`,html:l?`<!DOCTYPE html>
14
+ <html>
15
+ <head>${m}</head>
16
+ <body>
17
+ <table>${_.outerHTML}</table>
18
+ </body>
19
+ </html>`:r.minifyHtml(`${p}${b}${_.outerHTML.replace(/class="em-structure"/,'class=""')}`)}}).filter(Boolean)};function $p(e,i,l){const{images:s}=e,{blocks:n}=i;return s?.map(d=>{const c=n.find(p=>p.id===d.block_id);return{blockType:d.classification,blockTitle:d.name,htmlContent:c?.html||"",projectId:l}})}var Fp=e=>e.replace(/<div\s+[^>]*style="font-family:[^>]*>(.*?)<\/div>/gs,i=>i.replace(/>(.*?)<\/div>/s,"></div>")),Mp=e=>e.replace(/src="[^"]*"/g,'src=""'),Dp=e=>/<div\s+[^>]*style="font-family:/i.test(e),Vp=e=>{const i=new Set,l=[];for(const s of e)if(Dp(s.html)){const n=Mp(Fp(s.html));i.has(n)||(i.add(n),l.push(s))}else l.push(s);return l},Hp=async e=>{const{block:i,form:l,projectData:s,projectId:n,addBlock:d,editProject:c,notification:p,__:g,handleCloseModal:m,htmlContent:_,reloadBlockScreens:E,values:b,tagIds:h,projectTagsArray:k}=e;try{return await r.createBlock({block:i,form:l,projectId:n,htmlContent:_,values:b,tagIds:h,addBlock:d,editProject:c,notification:p,reloadBlockScreens:E,projectTagsArray:k,__:g,handleCloseModal:m})}catch(x){throw x}},Up=({projectData:e,addTerm:i,addBlock:l,editProject:s,reloadBlockScreens:n,notification:d,__:c,handleCloseModal:p,setTriggerOpenSavedBlocksTab:g,setTagsOptions:m,form:_,projectId:E})=>{const[b,h]=(0,a.useState)(!1),k=r.useInvalidateProject(),{data:x}=r.useGetTermsQuery({project:e,kind:r.BLOCK_TAGS},{skip:!e?.id});return(0,a.useEffect)(()=>{m((x||[]).map(v=>({value:v.name})))},[x,m]),{bulkSave:async(v,P,B,y)=>{h(!0);try{if(!P)return;const D=await tn({blockTags:y,projectTagsArray:x||[],addTerm:i,project:e,notification:d});let z=!0,A=0;for(const $ of v)try{await Hp({block:$,form:_,projectData:e,projectId:E,addBlock:l,editProject:s,notification:d,__:c,handleCloseModal:p,values:B,tagIds:D,projectTagsArray:x||[]})}catch{z=!1,A++}if(z&&d.success({id:"BULK_SAVE_SUCCESS",title:c("All blocks saved successfully."),placement:"bottomRight"}),!z){if(A===v.length)throw new Error;d.warning({id:"BULK_SAVE_PARTIAL_SUCCESS",title:c("Some blocks were not saved successfully."),placement:"bottomRight"})}g(!0),k(E),n()}catch(D){throw D}finally{h(!1),_.resetFields(),p()}},confirmSavingBlocksLoading:b}},jr=({isModalVisible:e,currentEmail:i,setIsShowAddAllBlocksModal:l,setTriggerOpenSavedBlocksTab:s,projectId:n})=>{const{__:d,_n:c,sprintf:p}=r.useI18n(),g=r.useContainer(),m=r.useProjectData(),{tagsEnabled:_}=r.useAppConfig(),[E,b]=(0,a.useState)(!1),[h]=t.ui_kit$Form.useForm(),[k,x]=(0,a.useState)([]),[T,v]=(0,a.useState)([]),P=(0,a.useRef)({}),[B]=r.useAddTermMutation(),[y]=r.useEditProjectMutation(),[D,z]=r.useAddBlockMutation(),A=r.useEditorLocale()||void 0,$=Op(i),j=Vp($).map(Ne=>Ne),W=j.length,Y=r.useNotification(),ee=()=>{E||le||l(!1)},{bulkSave:I,confirmSavingBlocksLoading:le}=Up({projectData:m,addTerm:B,addBlock:D,editProject:y,reloadBlockScreens:rn,notification:Y,__:d,handleCloseModal:ee,setTriggerOpenSavedBlocksTab:s,setTagsOptions:v,form:h,projectId:n}),ke=async()=>{try{const{valid:Ne,values:Q,blockTags:fe}=await ln({form:h,notification:Y,__:d});s(!1),b(!0);const Ae=await Np(i,A,P,j,g),ne=r.wpProjectId(i.project,n??m?.id),Fe=$p(Ae,P.current,String(ne??""));b(!1),await I(Fe,Ne,Q,fe)}catch{b(!1),l(!1),Y.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:ke,onCancel:ee,footer:(0,o.jsx)("div",{className:"modal-footer",children:!(E||le)&&(0,o.jsx)(t.ui_kit$Button,{size:"large",type:"primary",disabled:E||le,onClick:ke,children:p(c("Save %d block","Save %d blocks",W),W)},"submit")}),children:[E||le?(0,o.jsx)("div",{children:d("All blocks saved at this point can be found in the “Saved Blocks” section in the sidebar.")}):(0,o.jsx)("div",{children:p(c("Your letter contains %d block that can be saved for future use.","Your letter contains %d blocks that can be saved for future use.",W),W)}),!(E||le)&&_&&(0,o.jsx)(t.ui_kit$Form,{form:h,name:"add_all_blocks_form",layout:"vertical",onFinish:ke,style:{paddingTop:24},children:(0,o.jsx)(t.ui_kit$Form.Item,{label:d("Tags"),name:"tags",labelCol:{span:24},wrapperCol:{span:24},style:{display:"block",marginBottom:0},children:(0,o.jsx)(t.ui_kit$Select,{size:"large",mode:"tags",placeholder:d("Add some tags"),style:{width:"100%"},value:k,onChange:x,disabled:z.isLoading,options:T})})}),(le||E)&&(0,o.jsx)("div",{className:"modal-spinner",children:(0,o.jsx)(t.ui_kit$Spin,{size:"large"})})]})};jr.propTypes={};var vr=({isModalVisible:e=!1,email:i=null})=>{const{__:l}=r.useI18n(),[s]=t.ui_kit$Form.useForm(),n=r.useDispatch(),d=r.useRouteEmailId(),c=r.useNotification(),p=r.useCurrentUser(),g=r.useProjectData()?.projects_test_emails,[m,_]=r.useSendTestEmailMutation(),{token:E}=(0,t.ui_kit$useToken)(),[b,h]=(0,a.useState)(!1);r.useAppConfig(),r.useCookieManager();const k=r.useProjectData(),x=r.testEmailProject(i,k?.id),T=r.testEmailId(d,i,x),{data:v}=r.useGetProjectTestRecipientsQuery(x??0,{skip:!0}),[P,B]=r.useEditProjectMutation(),[y]=r.usePutProjectTestRecipientsMutation(),D=r.useProjectData(),{testEmails:z}=r.useAppConfig(),A=r.usePushToDataLayer(),[$,j]=(0,a.useState)([]),[W,Y]=(0,a.useState)(!1),ee=r.useEventEmitter(Po.events.ON_SEND_EMAIL_MODAL_ID);(0,a.useEffect)(()=>{e?ee.fire(i).then(Q=>{Q.some(fe=>fe===!1)?n(r.closeModal$1()):h(e)}):h(e)},[e,n,h,i,ee]),(0,a.useEffect)(()=>{},[D,x,v]),(0,a.useEffect)(()=>{j(z.map(Q=>({value:Q})))},[z]),(0,a.useEffect)(()=>{const Q=localStorage.getItem(r.LOCAL_STORAGE_ITEMS.em_test_emails);if(Q&&b&&s.getFieldValue("recipients")?.length===0){const fe=JSON.parse(Q);fe?.[x]&&s.setFieldsValue({recipients:fe[x]})}},[x,b,s]),(0,a.useEffect)(()=>{s.setFieldsValue({subject:i.subject})},[s,i.subject]);const I=()=>{n(r.closeModal$1()),s.resetFields()},le=r.useContentReader(),ke=()=>{s.validateFields().then(()=>{const Q={user_id:p.id,project_id:x,email_id:T,subject:s.getFieldValue("subject"),email:s.getFieldValue("recipients").join(","),html:r.encodedHtml(le())};m(Q).unwrap().catch(fe=>{c.error({error:{data:{code:fe?.data?.code,message:fe?.data?.message}}})}),Y(!0),A({event:"submit",action:"send_test_email",entity_id:d,project_id:x,recipients_count:s.getFieldValue("recipients").length})}).catch(Q=>{})},Ne=a.default.useRef(g);return Ne.current=g,(0,a.useEffect)(()=>{const Q=Ne.current;if(_.isSuccess&&W){_.data?.status;{const fe=[...new Set([...$.map(ve=>ve.value),...s.getFieldValue("recipients")])],Ae=fe.map(ve=>({projects_test_email:ve}));((ve,Be)=>{if(!ve||!Be)return ve===Be;if(ve.length!==Be.length)return!1;const xe=ve.map(be=>be.projects_test_email).sort(),ce=Be.map(be=>be.projects_test_email).sort();return xe.every((be,ue)=>be===ce[ue])})(Ae,r.isProjectsV2Enabled()?(v||[]).map(ve=>({projects_test_email:ve})):Q)||(r.isProjectsV2Enabled()?y({projectId:x,emails:fe}):P({projectId:x,projects_test_emails:Ae}));const Fe=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({...Fe,[x]:[...new Set(Le)]}));const Ue=i.title||i.subject||l("Untitled email.").replace(/\.$/,"");c.success(l("The email “")+Ue+l("” was successfully sent."))}Y(!1),s.resetFields(),n(r.closeModal$1())}},[_,s,x,P,y,v,$,W,n,i.title,i.subject,c,B,l]),(0,a.useEffect)(()=>{B.isError&&(c.error(B),Y(!1),s.resetFields(),n(r.closeModal$1()))},[n,B,s]),(0,a.useEffect)(()=>{s.setFieldsValue({subject:i.subject||i.title})},[i,s]),(0,o.jsx)(t.ui_kit$Modal,{width:572,title:(0,o.jsxs)("div",{style:{paddingBottom:8},children:[(0,o.jsx)(r.EmIcons,{icon:"SendOutlined",component:t.icons$SendOutlined,size:20,strokeWidth:2})," ",l("Send a test email")]}),open:b,onCancel:I,footer:[(0,o.jsx)(t.ui_kit$Button,{size:"large",className:"em-analytics__email-send-test",type:"primary",htmlType:"submit",form:"Send mail",loading:B.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:ke,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:(Q,fe)=>fe.length>10?Promise.reject(new Error(l("A test email can be sent to a maximum of 10 addresses."))):fe.length!==0?fe.every(Ae=>r.emailValidation.test(Ae.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:$,tagRender:Q=>{const{label:fe,closable:Ae,onClose:ne}=Q,Fe=Le=>{Le.preventDefault(),Le.stopPropagation()};return(0,o.jsx)(t.ui_kit$Tag,{variant:"solid",color:E.colorPrimary,onMouseDown:Fe,closable:Ae,onClose:ne,style:{borderRadius:6},children:fe})},getPopupContainer:()=>document.getElementById("send_mail_form")})})]})})};vr.propTypes={isModalVisible:f.default.bool,email:f.default.shape({html:f.default.string,subject:f.default.string})};var Wp=bo.__exportAll({AddAllBlocksModal:()=>jr,AddNewBlockModal:()=>wr,BlocksSearch:()=>Rr,Discuss:()=>Za,DiscussAi:()=>Na,EmailProperties:()=>ws,EmailSettings:()=>Zi,EmailStyles:()=>ar,FileManagerDataLayer:()=>Ya,HistoryPanel:()=>yr,LimitUpgradeModal:()=>hi,Optimise:()=>Wa,SaveBlockBtn:()=>Ar.SaveBlockBtn,SelectedElementPanel:()=>ft,SendTestEmailModal:()=>vr});Ro.AddAllBlocksModal=jr,Ro.AddNewBlockModal=wr,Ro.BlocksSearch=Rr,Ro.Discuss=Za,Ro.DiscussAi=Na,Ro.EmailProperties=ws,Ro.EmailSettings=Zi,Ro.EmailStyles=ar,Ro.FileManagerDataLayer=Ya,Ro.HistoryPanel=yr,Ro.LimitUpgradeModal=hi,Ro.LimitUpgradeModal$1=hi,Ro.Optimise=Wa,Ro.SaveBlockBtn=Ar.SaveBlockBtn,Ro.SelectedElementPanel=ft,Ro.SendTestEmailModal=vr,Ro.getImageDimensionsFromBlob=Lr,Object.defineProperty(Ro,"panels_exports",{enumerable:!0,get:function(){return Wp}}),Ro.resolveDataProviderPreview=Or,Ro.shouldCountAiUsage=xr,Ro.useImageBlobFetch=$r});