@emailmaker/emailmaker 1.0.116-alpha.1 → 1.0.116

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 (91) hide show
  1. package/README.md +1 -1
  2. package/asset-manifest.json +62 -66
  3. package/emailmaker-esm.js +1 -1
  4. package/emailmaker.d.ts +72 -1
  5. package/emailmaker.js +1 -1
  6. package/fonts/SegoeUI-Bold.woff2 +0 -0
  7. package/fonts/SegoeUI-Semibold.woff2 +0 -0
  8. package/fonts/SegoeUI.woff2 +0 -0
  9. package/iframe/429.js +1 -1
  10. package/iframe/766.js +1 -1
  11. package/iframe/iframe-eblock.612f5e3292f38c64ed91.html +1 -0
  12. package/iframe/iframe.612f5e3292f38c64ed91.html +1 -0
  13. package/iframe/index.html +1 -1
  14. package/iframe/js/525.5461ecf3.js +1 -0
  15. package/iframe/js/667.25c21b63.js +1 -0
  16. package/iframe/js/882.de4b06e1.js +1 -0
  17. package/iframe/sandbox-eblock.js +1 -1
  18. package/package.json +1 -1
  19. package/static/css/2854.257728de.chunk.css +2 -0
  20. package/static/css/369.d740f134.chunk.css +2 -0
  21. package/static/css/{2557.2ede4a53.chunk.css → 8727.2f8ba497.chunk.css} +1 -1
  22. package/static/css/main.8c8bed31.css +2 -0
  23. package/static/js/1345.70eac4ec.js +3 -0
  24. package/static/js/1345.70eac4ec.js.LICENSE.txt +101 -0
  25. package/static/js/1532.5ef52703.js +3 -0
  26. package/static/js/{2491.d65e25c3.js.LICENSE.txt → 1532.5ef52703.js.LICENSE.txt} +8 -0
  27. package/static/js/1716.2d977604.js +3 -0
  28. package/static/js/1716.2d977604.js.LICENSE.txt +11 -0
  29. package/static/js/1902.9e9ca2af.js +3 -0
  30. package/static/js/{9503.529740b0.js.LICENSE.txt → 1902.9e9ca2af.js.LICENSE.txt} +41 -5
  31. package/static/js/1940.e77ca441.js +3 -0
  32. package/static/js/2022.b4591f7e.js +3 -0
  33. package/static/js/{566.a759ee99.js.LICENSE.txt → 2022.b4591f7e.js.LICENSE.txt} +0 -13
  34. package/static/js/{327.31ca6e0d.js → 262.19eb7dd4.js} +3 -3
  35. package/static/js/2798.9c98addb.js +3 -0
  36. package/static/js/2798.9c98addb.js.LICENSE.txt +97 -0
  37. package/static/js/284.7faba600.js +2 -0
  38. package/static/js/2854.10396f08.js +2 -0
  39. package/static/js/369.05739401.js +3 -0
  40. package/static/js/369.05739401.js.LICENSE.txt +10 -0
  41. package/static/js/3718.76cec3de.js +2 -0
  42. package/static/js/5215.a9897c36.js +2 -0
  43. package/static/js/5333.afbfef64.js +3 -0
  44. package/static/js/{emailmaker_core.03a31b5b.js.LICENSE.txt → 5333.afbfef64.js.LICENSE.txt} +15 -3
  45. package/static/js/6438.78acfa4a.js +2 -0
  46. package/static/js/8466.44341e69.js +2 -0
  47. package/static/js/{8580.fb06c399.js → 8580.4f3e7c56.js} +2 -2
  48. package/static/js/8722.cfde4eb7.js +3 -0
  49. package/static/js/8727.97602af2.js +2 -0
  50. package/static/js/emailmaker_core.d07551cd.js +2 -0
  51. package/iframe/iframe-eblock.8216ee8050e216f489af.html +0 -1
  52. package/iframe/iframe.8216ee8050e216f489af.html +0 -1
  53. package/iframe/js/525.87bb307e.js +0 -1
  54. package/iframe/js/667.5b6da6e1.js +0 -1
  55. package/iframe/js/882.46d35112.js +0 -1
  56. package/static/css/6310.98e625aa.chunk.css +0 -2
  57. package/static/css/9617.0a8094c7.chunk.css +0 -2
  58. package/static/css/main.b7275454.css +0 -2
  59. package/static/js/1902.8d2f3fce.js +0 -2
  60. package/static/js/1940.524f0244.js +0 -3
  61. package/static/js/2491.d65e25c3.js +0 -3
  62. package/static/js/2557.c5dfa9a5.js +0 -2
  63. package/static/js/284.efb80df6.js +0 -2
  64. package/static/js/3628.b5eb07c2.js +0 -3
  65. package/static/js/566.a759ee99.js +0 -3
  66. package/static/js/6310.cafc9a48.js +0 -2
  67. package/static/js/7234.d3966e99.js +0 -2
  68. package/static/js/7673.2db4eeee.js +0 -3
  69. package/static/js/7673.2db4eeee.js.LICENSE.txt +0 -48
  70. package/static/js/8013.e4dee415.js +0 -2
  71. package/static/js/8466.d3339ec9.js +0 -2
  72. package/static/js/912.42ae1bb7.js +0 -3
  73. package/static/js/912.42ae1bb7.js.LICENSE.txt +0 -32
  74. package/static/js/9503.529740b0.js +0 -3
  75. package/static/js/9578.629b57ca.js +0 -2
  76. package/static/js/9617.54df440a.js +0 -3
  77. package/static/js/9617.54df440a.js.LICENSE.txt +0 -32
  78. package/static/js/emailmaker_core.03a31b5b.js +0 -3
  79. package/static/media/fb.ff10384394f8044ec889.png +0 -0
  80. package/static/media/ig.47a89992b4bec92d4364.png +0 -0
  81. package/static/media/tg.10f004529a98df9732b9.png +0 -0
  82. package/static/media/vk.fe41df919f4e8718e0b3.png +0 -0
  83. package/static/media/xa.8e9f984ff84e3f51c6f6.png +0 -0
  84. package/static/media/yd.c40d05dde64ef695fdf2.png +0 -0
  85. package/static/media/yt.4ac57e55d158b40c7fc1.png +0 -0
  86. /package/iframe/js/{525.87bb307e.js.LICENSE.txt → 525.5461ecf3.js.LICENSE.txt} +0 -0
  87. /package/iframe/js/{667.5b6da6e1.js.LICENSE.txt → 667.25c21b63.js.LICENSE.txt} +0 -0
  88. /package/iframe/js/{882.46d35112.js.LICENSE.txt → 882.de4b06e1.js.LICENSE.txt} +0 -0
  89. /package/static/js/{1940.524f0244.js.LICENSE.txt → 1940.e77ca441.js.LICENSE.txt} +0 -0
  90. /package/static/js/{327.31ca6e0d.js.LICENSE.txt → 262.19eb7dd4.js.LICENSE.txt} +0 -0
  91. /package/static/js/{3628.b5eb07c2.js.LICENSE.txt → 8722.cfde4eb7.js.LICENSE.txt} +0 -0
@@ -0,0 +1,2 @@
1
+ "use strict";(globalThis.webpackChunkemail_maker=globalThis.webpackChunkemail_maker||[]).push([[6438],{76614:()=>{},48867:(e,t,o)=>{o.d(t,{w:()=>g});var l=o(24150),i=o(10874),a=o(47706),r=o(2783);class n{constructor(){this.deletingIds=new Set}beginDeleting(e){for(const t of e)t&&this.deletingIds.add(t)}endDeleting(e){for(const t of e)t&&this.deletingIds.delete(t)}isDeleting(e){return!!e&&this.deletingIds.has(e)}}var d,s=o(53687);function m(e,t){const o=null!==e&&void 0!==e?e:{},l=Array.isArray(o.detailed)?o.detailed.map(e=>{var o;return{requestId:null!==(o=e.requestId)&&void 0!==o?o:e.id,success:!!e.success,data:t(e.data),error:e.error}}):void 0;return{success:!!o.success,error:o.error,detailed:l}}function c(e){return null==e?"":String(e)}function u(e){return{...e,name:c(e.name)}}function p(e){return e&&"object"===typeof e&&"name"in e?{...e,name:c(e.name)}:e}let g=(0,l.A)(d=class{async _findOrCreateFolderByPath(e){const{__:t}=this.i18n,o=(l=e)?l.replaceAll("\\","/").split("/").filter(Boolean):[];var l;if(o.length>10){const e=t("Path depth exceeds maximum limit of %s").replace("%s",String(10));throw new r.FileManagerApiError(e,"ValidationError")}let i;for(const d of o){var a;const{files:o}=await this.getFiles({folderId:(null===(a=i)||void 0===a?void 0:a.id)||"",itemType:"folder"}),l=o.find(e=>e.name===d);if(l){if(!l.isFolder){const o=t("Path component '%s' in '%s' is not a folder").replace("%s",d).replace("%s",e);throw new r.FileManagerApiError(o,"ValidationError")}i={id:l.id,name:l.name,parentId:l.folderId}}else{var n;if("function"!==typeof this._dataProvider.createFolder)throw new r.FileManagerApiError(t("Create folder operation is not supported by data provider"),"UnsupportedOperation");i=await this.createFolder({name:d,parentId:null===(n=i)||void 0===n?void 0:n.id})}}return i}getTrashFolder(){return this._findOrCreateFolderByPath(this._pathOptions.trashPath||"Trash")}getTempFolder(){return this._findOrCreateFolderByPath(this._pathOptions.tempPath||"Edited")}constructor(e,t={},o,l=a.nr){var r,d;this._dataProvider=e,this._options=t,this._pathOptions=o,this.i18n=l,this._cache=void 0,this._rootId=void 0,this._useSoftDelete=void 0,this._enableTrash=void 0,this._validateDuplicates=void 0,this._blobFetchForceReloadOnceIds=new Set,this._mutationRegistry=new n,this._mapItem=async({childrenCount:e,...t})=>{const o=u(t);if(o.isFolder)return{...o,childCount:e,url:"",thumbnailUrl:""};const[l,i]=await Promise.all([this._getUrl(o),this._getThumbnailUrl(o)]);return{...o,childCount:0,url:l,thumbnailUrl:i}},this._useSoftDelete=this._pathOptions.useSoftDelete,this._rootId=this._pathOptions.rootId||"",this._enableTrash=void 0===this._options.enableTrash||this._options.enableTrash,this._validateDuplicates=this._dataProvider.validateDuplicates,this._cache=new i.vp(t.cacheStrategy||{},null===(r=t.cacheStrategy)||void 0===r?void 0:r.ttl,null===(d=t.cacheStrategy)||void 0===d?void 0:d.errorTtl),this.setController({invalidateItemCache:e=>{this._cache.forceInvalidate(e)},getCachedItem:e=>this._cache.getEntity(e)}),"function"!==typeof this._dataProvider.clearCache&&(this.clearCache=void 0)}setController(e){"function"===typeof this._dataProvider.setController&&this._dataProvider.setController(e)}async clearCache(e){if("function"!==typeof this._dataProvider.clearCache){const{__:e}=this.i18n;throw new r.FileManagerApiError(e("Clear cache is not supported by data provider"),"UnsupportedOperation")}this._cache.forceInvalidate(this._rootId),await this._dataProvider.clearCache(e)}markNextFileBlobFetchBypassHttpCache(e){this._blobFetchForceReloadOnceIds.add(this.normalizeId(e))}normalizeId(e){return e?"root"===e||"folders"===e?this._rootId:e:this._rootId}_isDeletingId(e){return this._mutationRegistry.isDeleting(this.normalizeId(e))}_collectDeletingIds(e){const t=this.normalizeId(e),o=new Set([t]),l=this._cache.getEntity(t);if(null===l||void 0===l||!l.isFolder)return Array.from(o);const i=[t];for(;i.length>0;){const e=i.pop(),t=this._cache.getChildrenIds(e);for(const l of t){if(o.has(l))continue;o.add(l);const e=this._cache.getEntity(l);null!==e&&void 0!==e&&e.isFolder&&i.push(l)}}return Array.from(o)}_emptyFilesResult(e,t){return{files:[],pagination:{..."number"===typeof e?{page:e}:{},..."number"===typeof t?{limit:t}:{},total:0,totalPages:1,hasNext:!1,hasPrev:!1}}}_validateName(e,t=!1){if(!e||0===e.trim().length){const e=t?"FolderInvalidName":"FileInvalidName",{__:o}=this.i18n,l=o(t?"Folder name cannot be empty":"File name cannot be empty");throw new r.FileManagerApiError(l,e)}if(/[\/\\:*?"<>|]/.test(e)){const{__:o}=this.i18n,l=t?"FolderInvalidName":"FileInvalidName",i=t?o("Folder name contains invalid characters: %s").replace("%s",e):o("File name contains invalid characters: %s").replace("%s",e);throw new r.FileManagerApiError(i,l)}}_validateTargetFolderType(e){const t=this.normalizeId(e);if(t===this._rootId)return;const o=this._cache.getEntity(t);if(o&&!o.isFolder){const{__:t}=this.i18n,o=t("Target item with id '%s' is not a folder").replace("%s",e);throw new r.FileManagerApiError(o,"ValidationError")}}_checkNameExistsInCache(e,t,o,l){const i=this.normalizeId(e),a=this._cache.getChildrenIds(i);for(const r of a){const e=this._cache.getEntity(r);if(e&&e.name===t&&!!e.isFolder===o&&(!l||e.id!==l))return!0}return!1}async _getUrl(e){if(e.url)return e.url;try{var t;return"function"===typeof(null===(t=this._dataProvider)||void 0===t?void 0:t.getUrl)&&this._dataProvider.getUrl(e)||""}catch(o){}return""}async _getThumbnailUrl(e){if(e.thumbnailUrl)return e.thumbnailUrl;try{var t;return"function"===typeof(null===(t=this._dataProvider)||void 0===t?void 0:t.getThumbnailUrl)&&this._dataProvider.getThumbnailUrl(e)||""}catch(o){}return""}_isAncestor(e,t){if(!t)return!1;const o=this.normalizeId(t),l=this.normalizeId(e);if(o===l)return!0;let i=this._cache.getEntity(o);const a=new Set;for(;i&&i.folderId&&!a.has(i.id);){a.add(i.id);const e=this.normalizeId(i.folderId);if(e===l)return!0;if(i=this._cache.getEntity(e),!i||!i.isFolder)break}return!1}async getFile(e,t){return this._isDeletingId(e)?null:this._cache.searchByName(t,{parentId:this.normalizeId(e),caseSensitive:!0,recursive:!1,itemType:"file"})[0]||(await this.getFiles({folderId:e,itemType:"file",search:t})).files[0]}async getFileById(e){const t=this.normalizeId(e);if(this._isDeletingId(t))return null;const o=this._cache.getFileSystemItem(t);if(o&&!o.isFolder)return await this._mapItem(o);if(!this._dataProvider.pathMode)return null;const l=await this._getFileByPathStyleId(t);if(l&&!l.isFolder){const e=u(l);return this._cache.upsertEntity(e),await this._mapItem(e)}return null}async _getFileByPathStyleId(e){const t=e.replace(/\\/g,"/").replace(/^\/+/,""),o=t.lastIndexOf("/"),l=o<0?"":t.slice(0,o),i=o<0?t:t.slice(o+1);return i?this.getFile(l,i):null}async getFileUrl(e,t){const o=await this.getFile(e,t);return await this._getUrl(o)||await this._getThumbnailUrl(o)||o.thumbnail}async getFiles({folderId:e,search:t,sortBy:o,sortOrder:l,page:i,limit:a,itemType:r="all",noFolder:n=!1}){var d,s;n&&(e=null===(s=await this.getTempFolder())||void 0===s?void 0:s.id);const m=this.normalizeId(null!==(d=e)&&void 0!==d?d:this._rootId),c=!1===this._options.enablePagination,p=c?1:i,g=c?1e4:a,h=this._options.clientSideFilter,b=this._options.clientSideSorting,f=this._options.clientSidePaging,v=f?Math.max(1,null!==i&&void 0!==i?i:1):void 0,_=f?"number"===typeof a&&Number.isFinite(a)&&a>0?a:25:void 0,E=this._emptyFilesResult(f?v:p,f?_:g);if(this._isDeletingId(m))return E;const S=!1!==this._options.unifiedCatalogFetch&&c&&("folder"===r||"file"===r),y=S?"all":r,w={folderId:m,itemType:y};h||(w.search=t),b||(w.sortBy=null!==o&&void 0!==o?o:"folder"!==y?"date":void 0,w.sortOrder=null!==l&&void 0!==l?l:"folder"!==y?"desc":void 0),f||(w.page=p,w.limit=S?1e4:g);const k=S?1e4:f?void 0:g,B={folderId:m,itemType:y,search:h?void 0:t,sortBy:b?void 0:w.sortBy,sortOrder:b?void 0:w.sortOrder,page:f?void 0:p,pageSize:k};let R;try{R=await this._cache.getOrCreateChildren(m,B,async(e,t)=>{const o=t.pageSize,l=null!=o&&Number.isFinite(Number(o))?Number(o):1e4,i=await this._dataProvider.getItems({...t,folderId:e,limit:l}),a=function(e){return(null!==e&&void 0!==e?e:[]).map(u)}(i.items);var r;return f?{items:a,total:"number"===typeof(null===(r=i.pagination)||void 0===r?void 0:r.total)?i.pagination.total:a.length}:{items:a,...i.pagination}})}catch(N){if(this._isDeletingId(m))return E;throw N}let x,T=R.items;if(S&&("folder"===r?T=T.filter(e=>e.isFolder):"file"===r&&(T=T.filter(e=>!e.isFolder))),h)if("function"===typeof this._options.clientSideFilter)T=this._options.clientSideFilter(T,t);else if(t){const e=t.toLowerCase();T=T.filter(t=>{var o;return null===(o=t.name)||void 0===o?void 0:o.toLowerCase().includes(e)})}var I;(b&&(T="function"===typeof this._options.clientSideSorting?this._options.clientSideSorting(T,o,l):this._defaultClientSideSort(T,o,l)),f||h||S)?x=T.length:x=null!==(I=R.total)&&void 0!==I?I:T.length;let A=T;if(f)if("function"===typeof this._options.clientSidePaging)A=this._options.clientSidePaging(T,v,_);else{const e=(v-1)*_,t=e+_;A=T.slice(e,t)}if("function"===typeof this._dataProvider.getUrl||"function"===typeof this._dataProvider.getThumbnailUrl){const e=A.map(async e=>{if(e.isFolder)return e;const[t,o]=await Promise.all([e.url?Promise.resolve(e.url):"function"===typeof this._dataProvider.getUrl?this._dataProvider.getUrl(e):Promise.resolve(void 0),e.thumbnailUrl?Promise.resolve(e.thumbnailUrl):"function"===typeof this._dataProvider.getThumbnailUrl?this._dataProvider.getThumbnailUrl(e):Promise.resolve(void 0)]);return{...e,url:t,thumbnailUrl:o}});A=await Promise.all(e)}const C=f?{page:v,limit:_,total:x,totalPages:Math.max(1,Math.ceil(x/_)),hasNext:v*_<x,hasPrev:v>1}:{page:p,limit:g,total:x,...!f&&R.totalPages&&{totalPages:R.totalPages},...!f&&R.hasNextPage&&{hasNextPage:R.hasNextPage}};return{files:await Promise.all(A.map(this._mapItem)),pagination:C}}_defaultClientSideSort(e,t,o){return e.sort((e,l)=>{let i=0;switch(t){case"name":default:i=(e.name||"").localeCompare(l.name||"");break;case"date":i=new Date(e.date||0).getTime()-new Date(l.date||0).getTime();break;case"size":i=(Number(e.size)||0)-(Number(l.size)||0)}return"desc"===o?-i:i})}async getFileData(e,t){const o=this.normalizeId("string"===typeof e?e:e.id);let l=t;this._blobFetchForceReloadOnceIds.delete(o)&&(l={...t,forceReload:!0});const i=this._cache.getEntity(o)||("string"===typeof e?{id:o,name:"",folderId:this._rootId,isFolder:!1}:{...e,childrenCount:e.childCount});if("function"===typeof this._dataProvider.getFileData)return await this._dataProvider.getFileData(i,l);const{__:a}=this.i18n;if(!i.url&&"function"!==typeof this._dataProvider.getUrl)throw new r.FileManagerApiError(a("Cannot read file"),"FileReadError");const n=i.url||("function"===typeof this._dataProvider.getUrl?await this._dataProvider.getUrl(i):"");if(n){var d;return(await(0,s.Be)(n,{config:this._pathOptions.resourceProxyConfig,standalone:this._pathOptions.isStandalone,intent:"downloadBlob",init:null!==(d=l)&&void 0!==d&&d.forceReload?{cache:"no-store"}:void 0})).blob()}throw new r.FileManagerApiError(a("Unable to get file data"),"FileReadError")}async findFileByUrl(e){const t=this._cache.searchByUrl(e);if(t)return t;if("function"===typeof this._dataProvider.findFileByUrl)try{const t=await this._dataProvider.findFileByUrl(e);if(t){const e=u(t);return this._cache.upsertEntity(e),e}}catch(o){}return null}async getChildrenCount(e){if(!e)return 0;const t=this.normalizeId(null!==e&&void 0!==e?e:this._rootId);return this._isDeletingId(t)?0:this._cache.getChildrenCount(t,async()=>{try{if(this._options.clientSidePaging){var e;const o=await this.getFiles({folderId:t,itemType:"all",page:1,limit:25});return null!==(e=o.pagination.total)&&void 0!==e?e:o.files.length}const o=await this._dataProvider.getItems({folderId:t,limit:0,itemType:"all"});return"undefined"!==typeof o.pagination?o.pagination.total||0:!1===this._options.enablePagination?o.items.length:0}catch(o){if(this._isDeletingId(t))return 0;if(this._isPathFolderNotFoundError(o))return 0;throw o}})}_isPathFolderNotFoundError(e){var t,o,l;if(!e||"object"!==typeof e)return!1;const i=e;return"path_folder_not_found"===i.code||"path_folder_not_found"===(null===(t=i.data)||void 0===t?void 0:t.code)||404===i.status||404===(null===(o=i.data)||void 0===o||null===(l=o.data)||void 0===l?void 0:l.status)}async _uploadFile(e){var t;const o=this.normalizeId(null!==(t=e.folderId)&&void 0!==t?t:this._rootId),{__:l}=this.i18n;if("function"!==typeof this._dataProvider.uploadFile)throw new r.FileManagerApiError(l("Upload file operation is not supported by data provider"),"UnsupportedOperation");if(this._validateName(e.name,!1),this._validateDuplicates){if(this._checkNameExistsInCache(o,e.name,!1)){const t=l("File '%s' already exists in target folder").replace("%s",e.name);throw new r.FileManagerApiError(t,"FileAlreadyExists")}}const i=await this._dataProvider.uploadFile({...e,folderId:o}),a=u({name:e.name,size:e.size,...i,folderId:o});return this._cache.upsertEntity(a),a}async uploadFiles(e){var t,o;const l=e.items.some(e=>e.noFolder)?await this.getTempFolder():null;e={...e,items:null===(t=e.items)||void 0===t?void 0:t.map(e=>({...e,folderId:e.noFolder?null===l||void 0===l?void 0:l.id:e.folderId}))};for(const r of e.items)r.folderId&&(e.folderId=r.folderId);const i=e.items||[],a=null!==(o=e.folderId)&&void 0!==o?o:this._rootId,n=this.normalizeId(a);if(this._validateDuplicates)for(const m of i)if(m.name){var d;this._validateName(m.name,!1);const e=this.normalizeId(null!==(d=m.folderId)&&void 0!==d?d:n);if(this._checkNameExistsInCache(e,m.name,!1)){const{__:e}=this.i18n,t=e("File '%s' already exists in target folder").replace("%s",m.name);throw new r.FileManagerApiError(t,"FileAlreadyExists")}}const s=this._cache.getEntity(n);let p={detailed:new Array(i.length),success:!0};if("function"===typeof this._dataProvider.uploadFiles){const e=i.map(e=>{var t;return{...e,folderId:this.normalizeId(null!==(t=e.folderId)&&void 0!==t?t:n)}});if(p=m(await this._dataProvider.uploadFiles({folderId:n,items:e}),e=>{if(e)return{id:e.id,name:c(e.name),folderId:e.folderId}}),p.detailed&&p.detailed.length){for(let e=0;e<p.detailed.length;e++){const t=p.detailed[e];if(t&&t.success){var g,h;const e=t.data,o=null!==(g=null===e||void 0===e?void 0:e.id)&&void 0!==g?g:t.requestId,l=u({...s,...e,folderId:null!==(h=null===e||void 0===e?void 0:e.folderId)&&void 0!==h?h:n});this._cache.upsertEntity(l),t.requestId=o}}void 0===p.success&&(p.success=!p.detailed.some(e=>!e.success))}else p.success=!p.error&&!!p.success}else{if("function"!==typeof this._dataProvider.uploadFile)throw new r.FileManagerApiError("Upload files is not supported by data provider","UnsupportedOperation");p.detailed=await Promise.all(i.map(async e=>{var t;const o=this.normalizeId(null!==(t=e.folderId)&&void 0!==t?t:n);try{const t=await this._uploadFile({...e,folderId:o});return{requestId:t.id,data:t,success:!0}}catch(l){return{requestId:null===e||void 0===e?void 0:e.id,success:!1,error:l}}})),p.success=!p.detailed.some(e=>!e.success)}if(p.success&&this._enableTrash)try{this._cache.forceInvalidate(n)}catch(b){}return p}async deleteFile(e){const t=this.normalizeId(e),o=[t];this._mutationRegistry.beginDeleting(o);try{if(this._useSoftDelete&&this._enableTrash){const e=await this.getTrashFolder();return await this.moveItem({itemId:t,targetFolderId:e.id,isFolder:!1})}return await this.hardDeleteItem(t)}finally{this._mutationRegistry.endDeleting(o)}}async deleteItems(e,t){const o=Array.from(new Set(e.flatMap(e=>this._collectDeletingIds(this.normalizeId(e)))));this._mutationRegistry.beginDeleting(o);try{if(this._useSoftDelete&&this._enableTrash&&!0!==t.permanent){const t=await this.getTrashFolder();return await this.moveItems(t.id,e)}return await this.hardDeleteItems(e,t)}finally{this._mutationRegistry.endDeleting(o)}}async hardDeleteItems(e,t){let o={success:!0,detailed:[]};const l=t.permanent?null:await this.getTrashFolder();if("function"===typeof this._dataProvider.deleteItems){if(o=m(await this._dataProvider.deleteItems(e.map(e=>this._cache.getEntity(e)),t),e=>e),o.success){const t=o.detailed||e.map(e=>({requestId:e,success:!0,error:void 0}));for(const e of t)e.success&&(l?this._cache.moveEntity(e.requestId,l.id):this._cache.deleteEntity(e.requestId))}}else"function"===typeof this._dataProvider.deleteItem&&(o.detailed=await Promise.all(e.map(async e=>{const o=this._cache.getEntity(e);if(!o){const t="FileNotFound",{__:o}=this.i18n,l=o("Item with id '%s' not found").replace("%s",e);return{requestId:e,success:!1,error:new r.FileManagerApiError(l,t)}}try{return await this._dataProvider.deleteItem(o,t),l?this._cache.moveEntity(e,l.id):this._cache.deleteEntity(e),{requestId:e,success:!0}}catch(i){return{requestId:e,error:i,success:!1}}})),o.success=!o.detailed.some(e=>!e.success));if(o.success&&l)try{this._cache.forceInvalidate(l.id)}catch(i){}return o}async hardDeleteItem(e){const t=this._cache.getEntity(e);if(!t){const{__:t}=this.i18n,o=t("Item with id '%s' not found in cache").replace("%s",e);throw new r.FileManagerApiError(o,"FileNotFound")}if("function"!==typeof this._dataProvider.deleteItem){const{__:e}=this.i18n;throw new r.FileManagerApiError(e("Delete item operation is not supported by data provider"),"DeleteNotAllowed")}if(await this._dataProvider.deleteItem(t,{permanent:!0}),this._cache.deleteEntity(e),this._enableTrash)try{const e=await this.getTrashFolder();e&&this._cache.forceInvalidate(e.id)}catch(o){}return!0}async cleanTrash(){const{__:e}=this.i18n;if(!this._enableTrash)throw new r.FileManagerApiError(e("Trash is not enabled"),"UnsupportedOperation");if("function"===typeof this._dataProvider.cleanTrash){const e=await this._dataProvider.cleanTrash();try{const e=await this.getTrashFolder();e&&this._cache.forceInvalidate(e.id)}catch(t){}return e}throw new r.FileManagerApiError(e("Clean trash is not supported by data provider"),"UnsupportedOperation")}async createFolder({name:e,parentId:t,is_force_create:o}){const l=this.normalizeId(null!==t&&void 0!==t?t:this._rootId);if(this._validateName(e,!0),this._validateDuplicates){if(this._checkNameExistsInCache(l,e,!0)){const{__:t}=this.i18n,o=t("Folder '%s' already exists in parent folder").replace("%s",e);throw new r.FileManagerApiError(o,"FolderAlreadyExists")}}const i=await this._dataProvider.createFolder(e,l,o),a=u({id:i.id,folderId:l,name:i.name,isFolder:!0,childrenCount:i.childrenCount});return this._cache.upsertEntity(a),{...i,name:a.name}}async deleteFolder(e){const t=this.normalizeId(e),o=this._collectDeletingIds(t);this._mutationRegistry.beginDeleting(o);try{if(this._useSoftDelete&&this._enableTrash)try{const e=await this.getTrashFolder();return!!await this.moveItem({itemId:t,targetFolderId:e.id,isFolder:!0})&&(this._cache.deleteFolderRecursive(t),!0)}catch(l){return await this.hardDeleteItem(t)}return await this.hardDeleteItem(t)}finally{this._mutationRegistry.endDeleting(o)}}async renameFolder(e,t){const{__:o}=this.i18n;if("function"!==typeof this._dataProvider.renameItem)throw new r.FileManagerApiError(o("Rename folder is not supported"),"RenameNotAllowed");const l=this.normalizeId(e),i=this._cache.getEntity(l);if(!i){const t=o("Folder with id '%s' not found in cache").replace("%s",e);throw new r.FileManagerApiError(t,"FolderNotFound")}if(this._validateName(t,!0),this._validateDuplicates){const e=this.normalizeId(i.folderId);if(this._checkNameExistsInCache(e,t,!0,l)){const e=o("Folder '%s' already exists in parent folder").replace("%s",t);throw new r.FileManagerApiError(e,"FolderAlreadyExists")}}const a=p(await this._dataProvider.renameItem(i,t));return this._cache.upsertEntity(u({...this._cache.getEntity(a.id),...a})),this._cache.getEntity(a.id)}async renameFile(e,t){const{__:o}=this.i18n;if("function"!==typeof this._dataProvider.renameItem)throw new r.FileManagerApiError(o("Rename file is not supported"),"RenameNotAllowed");const l=this._cache.getEntity(e);if(!l){const t=o("File with id '%s' not found in cache").replace("%s",e);throw new r.FileManagerApiError(t,"FileNotFound")}const i=this.normalizeId(e);if(this._validateName(t,!1),this._validateDuplicates){const e=this.normalizeId(l.folderId);if(this._checkNameExistsInCache(e,t,!1,i)){const e=o("File '%s' already exists in parent folder").replace("%s",t);throw new r.FileManagerApiError(e,"FileAlreadyExists")}}const a=p(await this._dataProvider.renameItem(l,t));return a&&this._cache.upsertEntity(u({...this._cache.getEntity(i),...a})),this._cache.getEntity(i)}async moveItem({itemId:e,targetFolderId:t,isFolder:o}){if("function"!==typeof this._dataProvider.moveItem){const{__:e}=this.i18n;throw new r.FileManagerApiError(e("Move item operation is not supported by data provider"),"MoveNotAllowed")}const l=this.normalizeId(t);this._validateTargetFolderType(t);const i=this._cache.getEntity(e);if(!i){const t=p(await this._dataProvider.moveItem({id:e,folderId:l,isFolder:o},l));if(t.id===e)this._cache.upsertEntity(u({...t,folderId:l}));else{try{this._cache.deleteEntity(e)}catch(d){}this._cache.upsertEntity(u({...t,folderId:l}))}return!0}const{__:a}=this.i18n;if(i.isFolder){if(e===l)throw new r.FileManagerApiError(a("Cannot move folder into itself"),"MoveIntoSelf");if(this._isAncestor(e,l))throw new r.FileManagerApiError(a("Cannot move folder into its descendant"),"MoveIntoDescendant")}if(this._validateDuplicates){if(l!==this.normalizeId(i.folderId)&&i.name){if(this._checkNameExistsInCache(l,i.name,!!i.isFolder,e)){const e=i.isFolder?"FolderAlreadyExists":"FileAlreadyExists";throw new r.FileManagerApiError(`${i.isFolder?"Folder":"File"} '${i.name}' already exists in target folder`,e)}}}const n=p(await this._dataProvider.moveItem(i,l));if(n.id===e){const t=this._cache.moveEntity(e,l);return this._cache.upsertEntity(u({...t,...n})),!0}{const t=this._cache.deleteEntity(e);return this._cache.upsertEntity(u({...t,...n,folderId:l})),!0}}async moveItems(e,t){const o=this.normalizeId(e);this._validateTargetFolderType(e);const l=t.map(e=>this._cache.getEntity(e));for(const a of l)if(a){if(a.isFolder){const{__:e}=this.i18n;if(a.id===o){const t=e("Cannot move folder '%s' into itself").replace("%s",a.name);throw new r.FileManagerApiError(t,"MoveIntoSelf")}if(this._isAncestor(a.id,o)){const t=e("Cannot move folder '%s' into its descendant").replace("%s",a.name);throw new r.FileManagerApiError(t,"MoveIntoDescendant")}}if(this._validateDuplicates){const e=this.normalizeId(a.folderId);if(o!==e&&a.name){if(this._checkNameExistsInCache(o,a.name,!!a.isFolder,a.id)){const e=a.isFolder?"FolderAlreadyExists":"FileAlreadyExists";throw new r.FileManagerApiError(`${a.isFolder?"Folder":"File"} '${a.name}' already exists in target folder`,e)}}}}let i={detailed:new Array(l.length),success:!0};if("function"===typeof this._dataProvider.moveItems){i=m(await this._dataProvider.moveItems(l,o),e=>e)}else{if("function"!==typeof this._dataProvider.moveItem)throw new r.FileManagerApiError("Move items is not supported","MoveNotAllowed");i.detailed=await Promise.all(t.map(async(e,t)=>{const i=l[t]||{id:e,folderId:null,isFolder:!1,name:e};try{return{requestId:e,data:p(await this._dataProvider.moveItem(i,o)),success:!0}}catch(a){return{requestId:e,success:!1,error:a}}}))}if(i.success){const e=i.detailed||t.map(e=>({requestId:e,success:!0,data:void 0}));for(const t of e)if(t.success)if(t.data&&t.data.id!==t.requestId){const e=this._cache.deleteEntity(t.requestId);this._cache.upsertEntity(u({...e,...t.data,folderId:o}))}else this._cache.moveEntity(t.requestId,o),t.data&&this._cache.upsertEntity(u({...this._cache.getEntity(t.requestId),...t.data,folderId:o}));return i}{const{__:e}=this.i18n;return{success:!1,error:i.error||new r.FileManagerApiError(e("Move items failed"),"MoveNotAllowed")}}}async copyItem({itemId:e,targetFolderId:t}){if("function"!==typeof this._dataProvider.copyItem){const{__:e}=this.i18n;throw new r.FileManagerApiError(e("Copy item is not supported"),"CopyNotAllowed")}const o=this.normalizeId(t);this._validateTargetFolderType(t);const l=this._cache.getEntity(e);if(!l){const t=p(await this._dataProvider.copyItem({id:e,folderId:o},o));return this._cache.copyEntity(e,o,t.id),this._cache.upsertEntity(u({...t,folderId:o})),!0}if(this._validateDuplicates&&l.name){const t=o===this.normalizeId(l.folderId)?e:void 0;if(this._checkNameExistsInCache(o,l.name,!!l.isFolder,t)){const e=l.isFolder?"FolderAlreadyExists":"FileAlreadyExists";throw new r.FileManagerApiError(`${l.isFolder?"Folder":"File"} '${l.name}' already exists in target folder`,e)}}const i=p(await this._dataProvider.copyItem(l,o));return this._cache.copyEntity(e,o,i.id,{...i,folderId:o})||this._cache.upsertEntity(u({...i,folderId:o})),!0}async copyItems(e,t){const o=this.normalizeId(e);this._validateTargetFolderType(e);const l=t.map(e=>"string"===typeof e?{id:e}:e),i=l.map(e=>e.id),a=i.map((e,t)=>{var o;const i=this._cache.getEntity(e),a=null===(o=l[t])||void 0===o?void 0:o.newName;return i?a?{...i,name:a}:i:void 0});if(this._validateDuplicates)for(let s=0;s<a.length;s++){const e=a[s];if(e&&e.name){const t=this.normalizeId(e.folderId),l=o===t?i[s]:void 0;if(this._checkNameExistsInCache(o,e.name,!!e.isFolder,l)){const t=e.isFolder?"FolderAlreadyExists":"FileAlreadyExists";throw new r.FileManagerApiError(`${e.isFolder?"Folder":"File"} '${e.name}' already exists in target folder`,t)}}}let n={detailed:new Array(a.length),success:!0};if("function"===typeof this._dataProvider.copyItems){n=m(await this._dataProvider.copyItems(a,o),e=>e)}else{if("function"!==typeof this._dataProvider.copyItem){const{__:e}=this.i18n;throw new r.FileManagerApiError(e("Copy items is not supported"),"CopyNotAllowed")}n.detailed=await Promise.all(i.map(async(e,t)=>{const l=a[t]||{id:e,folderId:null,isFolder:!1};try{return{requestId:e,data:p(await this._dataProvider.copyItem(l,o)),success:!0}}catch(i){return{requestId:e,success:!1,error:i}}}))}if(n.success&&n.detailed)for(let r=0,s=n.detailed.length;r<s;r++){const e=n.detailed[r];var d;if(e.success)if(null!==(d=e.data)&&void 0!==d&&d.id){const t=e.data.folderId||o;!this._cache.copyEntity(e.requestId,t,e.data.id,{...e.data,folderId:t})&&e.data&&this._cache.upsertEntity(u({...e.data,folderId:t}))}}else if(!n.detailed)throw new r.FileManagerApiError("batchResult in copy method must have detailed results","ValidationError");return n}async uploadFileByUrl(e){var t;if(e.noFolder){const t=await this.getTempFolder();e={...e,folderId:t.id}}const o=this.normalizeId(null!==(t=e.folderId)&&void 0!==t?t:this._rootId);try{const t=u({...await this._dataProvider.uploadFileByUrl(e.url,o,{eventSource:e.eventSource}),folderId:o});return this._cache.upsertEntity(t),t}catch(l){throw l}}async updateFile(e,t){const{__:o}=this.i18n;if("function"!==typeof this._dataProvider.updateFile)throw new r.FileManagerApiError(o("Update file is not supported"),"UnsupportedOperation");const l=this.normalizeId(e),i=this._cache.getEntity(l);if(!i){const t=o("File with id '%s' not found in cache").replace("%s",e);throw new r.FileManagerApiError(t,"FileNotFound")}if(t.name&&t.name!==i.name&&this._validateName(t.name,!1),this._validateDuplicates&&t.name&&t.name!==i.name){const e=this.normalizeId(i.folderId);if(this._checkNameExistsInCache(e,t.name,!1,l)){const e=o("File '%s' already exists in parent folder").replace("%s",t.name);throw new r.FileManagerApiError(e,"FileAlreadyExists")}}const a=p(await this._dataProvider.updateFile(i,{...t}));return this._cache.upsertEntity(u({...this._cache.getEntity(l),...a,...t})),this._cache.getEntity(l)}})||d},58022:(e,t,o)=>{o.d(t,{I:()=>f});var l=o(1936),i=o(69962),a=o(26967),r=o(22817),n=o(12650),d=o(68876),s=o(47706),m=o(98173),c=o(93506),u=o(79292),p=o(50879);const g=(0,l.lazy)(()=>Promise.all([o.e(262),o.e(8722),o.e(2854)]).then(o.bind(o,47688))),h=(0,l.lazy)(()=>Promise.all([o.e(5365),o.e(9487),o.e(8727)]).then(o.bind(o,58727))),b={height:"100%"},f=()=>{const e=(0,d.rD)(),t=(0,p.L)(),o=(0,a.of)(),f=(0,i.d4)(r.yN),v=(0,a.XB)(),_=(0,s.s9)(),E=(0,i.d4)(m.C1),S=void 0!==(null===f||void 0===f?void 0:f.id)?String(null===f||void 0===f?void 0:f.id):"",y=c.EW.isPlugin&&"0"!==(null===E||void 0===E?void 0:E.id)?String(E.id):"",{storageProvider:w,pathProxy:k,dataProvider:B}=(0,l.useMemo)(()=>(0,u.C)({storageProvider:o,projectId:S,restApi:v,i18n:_,pathPostfix:y,appConfig:e,isStandalone:t}),[e,_,t,S,v,o,y]);let R=l.createElement(n.A,{style:b});return w&&B&&e.imageCenterFileManagerView?R=l.createElement(g,{storageProvider:w,dataProvider:B,pathProxy:k}):w&&B&&(R=l.createElement(h,{dataProvider:B})),l.createElement(l.Suspense,{fallback:l.createElement(n.A,{style:b})},R)}},12371:(e,t,o)=>{o.d(t,{T:()=>r});var l=o(854),i=o(47706),a=o(2783);class r{constructor(e,t="",o="Trash",l="Trash",a=!0,r=i.nr){this._inner=e,this.rootPath=t,this.trashId=o,this.trashPath=l,this.ensureFolderTrailingSlash=a,this.i18n=r,this._pathToId=new Map,this._idToPath=new Map,this.getUrl=void 0,this.getThumbnailUrl=void 0,this.validateDuplicates=void 0,this.validateDuplicates=this._inner.validateDuplicates,"function"===typeof e.getUrl&&(this.getUrl=t=>e.getUrl({...t,id:this.pathForId(t.id,!1),folderId:t.folderId?this.pathForId(t.folderId,!0):this.rootPath})),"function"===typeof e.getThumbnailUrl&&(this.getThumbnailUrl=t=>e.getThumbnailUrl({...t,id:this.pathForId(t.id,!1),folderId:t.folderId?this.pathForId(t.folderId,!0):this.rootPath})),"function"!==typeof this._inner.deleteItems&&(this.deleteItems=void 0),"function"!==typeof this._inner.deleteItem&&(this.deleteItem=void 0),"function"!==typeof this._inner.moveItems?this.moveItems=void 0:this.moveItem=void 0,"function"!==typeof this._inner.copyItems?this.copyItems=void 0:this.copyItem=void 0,"function"!==typeof this._inner.uploadFiles?this.uploadFiles=void 0:this.uploadFile=void 0,"function"!==typeof this._inner.clearCache&&(this.clearCache=void 0),this._getOrGenerateId(this.rootPath)}setController(e){"function"===typeof this._inner.setController&&this._inner.setController({invalidateItemCache:t=>{const o=t.replace(/^\/+|\/+$/g,""),l=this._pathToId.get(o);l&&e.invalidateItemCache(l)},getCachedItem:t=>{const o=t.replace(/^\/+|\/+$/g,""),l=this._pathToId.get(o);if(l){const t=e.getCachedItem(l);if(t)return{...t,id:this.pathForId(t.id,t.isFolder),folderId:this.pathForId(t.folderId,t.isFolder)}}}})}clearCache(e){if("function"===typeof this._inner.clearCache)return this._inner.clearCache(e)}_getOrGenerateId(e){if(e===this.rootPath)return;const t=e.replaceAll(/^\/+|\/+$/g,"");if(t===this.trashPath.replaceAll(/^\/+|\/+$/g,""))return this.trashId;if(this._pathToId.has(t))return this._pathToId.get(t);const o=(0,l.A)();return this._pathToId.set(t,o),this._idToPath.set(o,t),o}pathForId(e,t,o){const{__:l}=this.i18n;if(""===e||void 0===e)return this.rootPath;if(e===this.trashId)return this.trashPath;let i=this._idToPath.get(e);if(!i){if(o)return`unknown folder ${e}`;{const t=l?l(`Path for id '${e}' not found in mapping`):`Path for id '${e}' not found in mapping`;throw new a.FileManagerApiError(t,"FileNotFound")}}let r=0;for(;r<this.rootPath.length&&"/"===this.rootPath[r];)r++;if(r){let e=0;for(;e<i.length&&"/"===i[e];)e++;const t=i.slice(e);i="/".repeat(r)+t}return t&&this.ensureFolderTrailingSlash&&!i.endsWith("/")&&(i+="/"),i}_updateIdMapping(e,t){const o=t.replace(/^\/+|\/+$/g,""),l=this._idToPath.get(e);l&&this._pathToId.delete(l),this._idToPath.set(e,o),this._pathToId.set(o,e)}async getItems(e){const t=e.folderId?this.pathForId(e.folderId,!0):this.rootPath,o=await this._inner.getItems({...e,folderId:t}),l=o.items.map(e=>{const t=this._getOrGenerateId(e.id),o=e.folderId?this._getOrGenerateId(e.folderId):this._getOrGenerateId(this.rootPath);return{...e,id:t,folderId:o}});return{...o,items:l}}async createFolder(e,t,o){const l=t?this.pathForId(t,!0):this.rootPath,i=await this._inner.createFolder(e,l,o),a=this._getOrGenerateId(i.id),r=i.folderId?this._getOrGenerateId(i.folderId):this._getOrGenerateId(this.rootPath);return{...i,id:a,folderId:r}}async renameItem(e,t){const{__:o}=this.i18n;if("function"!==typeof this._inner.renameItem){const e=o?o("Rename item is not supported by inner storage"):"Rename item is not supported by inner storage";throw new a.FileManagerApiError(e,"RenameNotAllowed")}const l=this.pathForId(e.id,e.isFolder),i=l;let{...r}=await this._inner.renameItem({...e,id:l,folderId:this.pathForId(e.folderId,!0)},t);return this._updateIdMapping(e.id,r.id),e.isFolder&&this.remapCachedFolderContents(e.id,i,r.id),r.folderId&&(r={...r,folderId:this._getOrGenerateId(r.folderId)}),{...r,id:this._getOrGenerateId(r.id)}}async deleteItem(e,t){const{__:o}=this.i18n;if("function"!==typeof this._inner.deleteItem){const e=o?o("Delete item is not supported by inner storage"):"Delete item is not supported by inner storage";throw new a.FileManagerApiError(e,"DeleteNotAllowed")}const l=this.pathForId(e.id,e.isFolder);await this._inner.deleteItem({...e,id:l,folderId:this.pathForId(e.folderId,!0)},t),this.recursivelyRemoveMappings(e.id,l)}async uploadFile(e){const{__:t}=this.i18n;if("function"!==typeof this._inner.uploadFile){const e=t?t("Upload file is not supported by inner storage"):"Upload file is not supported by inner storage";throw new a.FileManagerApiError(e,"UnsupportedOperation")}const o=e.folderId?this.pathForId(e.folderId,!0):this.rootPath,l=await this._inner.uploadFile({...e,folderId:o}),i=this._getOrGenerateId(l.id),r=l.folderId?this._getOrGenerateId(l.folderId):this._getOrGenerateId(this.rootPath);return{...l,id:i,folderId:r}}async uploadFiles(e){var t,o,l,i,a;const r=e.folderId,n=null!==(t=null===(o=e.items)||void 0===o?void 0:o.map(e=>e.folderId))&&void 0!==t?t:[],d=e.folderId?this.pathForId(e.folderId,!0):this.rootPath,s={...e,folderId:d,items:null!==(l=null===(i=e.items)||void 0===i?void 0:i.map(e=>({...e,folderId:e.folderId?this.pathForId(e.folderId,!0):d})))&&void 0!==l?l:[]},m=await this._inner.uploadFiles(s);return{...m,detailed:null===(a=m.detailed)||void 0===a?void 0:a.map((e,t)=>{var o,l;if(null===e||void 0===e||!e.data)return e;const i=e.data.id?this._getOrGenerateId(e.data.id):void 0,a=e.data.folderId?this._getOrGenerateId(e.data.folderId):null!==(o=null!==(l=n[t])&&void 0!==l?l:r)&&void 0!==o?o:this._getOrGenerateId(this.rootPath);return{...e,data:{...e.data,id:i,folderId:a}}})}}async findFileByUrl(e,t){const o=t?this.pathForId(t,!0):this.rootPath;if("function"===typeof this._inner.findFileByUrl){const t=await this._inner.findFileByUrl(e,o);if(!t)return;const l=this._getOrGenerateId(t.id),i=t.folderId?this._getOrGenerateId(t.folderId):this._getOrGenerateId(this.rootPath);return{...t,id:l,folderId:i}}}async uploadFileByUrl(e,t,o){const l=t?this.pathForId(t,!0):this.rootPath,i=await this._inner.uploadFileByUrl(e,l,o),a=this._getOrGenerateId(i.id),r=i.folderId?this._getOrGenerateId(i.folderId):this._getOrGenerateId(this.rootPath);return{...i,id:a,folderId:r}}async moveItem(e,t){const{__:o}=this.i18n;if("function"!==typeof this._inner.moveItem){const e=o?o("Move item is not supported by inner storage"):"Move item is not supported by inner storage";throw new a.FileManagerApiError(e,"MoveNotAllowed")}const l=this.pathForId(e.id,e.isFolder),i=this.pathForId(t,!0),r=await this._inner.moveItem({...e,id:l,folderId:this.pathForId(e.folderId,!0)},i);this._updateIdMapping(e.id,r.id),e.isFolder&&this.remapCachedFolderContents(e.id,l,r.id);const n=this._getOrGenerateId(r.id),d=r.folderId?this._getOrGenerateId(r.folderId):t;return{...r,id:n,folderId:d}}async moveItems(e,t){const{__:o}=this.i18n;if("function"!==typeof this._inner.moveItems){const e=o?o("Move items is not supported by inner storage"):"Move items is not supported by inner storage";throw new a.FileManagerApiError(e,"MoveNotAllowed")}const l=t?this.pathForId(t,!0):this.rootPath,i=e.map(e=>({...e,id:this.pathForId(e.id,e.isFolder),folderId:e.folderId?this.pathForId(e.folderId,!0):this.rootPath})),r=await this._inner.moveItems(i,l),n=[];if(r.detailed&&r.detailed.length>0){const l=new Map;for(let t=0;t<r.detailed.length;t++){const o=r.detailed[t],i=o.requestId||(t<e.length?e[t].id:void 0);i&&l.set(i,o)}for(const i of e){const a=l.get(i.id)||(r.detailed.length===e.length?r.detailed[e.indexOf(i)]:void 0);if(null!==a&&void 0!==a&&a.success&&a.data){if(this._updateIdMapping(i.id,a.data.id),i.isFolder){const e=this.pathForId(i.id,i.isFolder);this.remapCachedFolderContents(i.id,e,a.data.id)}n.push({requestId:i.id,success:!0,data:{...a.data,id:this._getOrGenerateId(a.data.id),folderId:a.data.folderId?this._getOrGenerateId(a.data.folderId):t||this._getOrGenerateId(this.rootPath)}})}else{const e=o?o("Move operation failed - no detailed result"):"Move operation failed - no detailed result";n.push({requestId:i.id,success:!1,error:(null===a||void 0===a?void 0:a.error)||{message:e,code:"MoveNotAllowed"}})}}}else for(const a of e){const e=o?o("Move operation failed - no detailed results"):"Move operation failed - no detailed results";n.push({requestId:a.id,success:!1,error:{message:e,code:"MoveNotAllowed"}})}return{success:r.success,detailed:n,error:r.error}}async copyItems(e,t){const{__:o}=this.i18n;if("function"!==typeof this._inner.copyItems){const e=o?o("Copy items is not supported by inner storage"):"Copy items is not supported by inner storage";throw new a.FileManagerApiError(e,"CopyNotAllowed")}const l=t?this.pathForId(t,!0):this.rootPath,i=e.map(e=>({...e,id:this.pathForId(e.id,e.isFolder),folderId:e.folderId?this.pathForId(e.folderId,!0):this.rootPath})),r=await this._inner.copyItems(i,l),n=[];if(r.detailed&&r.detailed.length>0){const l=new Map;for(let t=0;t<r.detailed.length;t++){const o=r.detailed[t],i=o.requestId||(t<e.length?e[t].id:void 0);i&&l.set(i,o)}for(const i of e){var d;const a=l.get(i.id)||(r.detailed.length===e.length?r.detailed[e.indexOf(i)]:void 0);if(null!==a&&void 0!==a&&a.success&&null!==(d=a.data)&&void 0!==d&&d.id){const e=this._getOrGenerateId(a.data.id);n.push({requestId:i.id,success:!0,data:{...a.data,id:e,folderId:a.data.folderId?this._getOrGenerateId(a.data.folderId):t||this._getOrGenerateId(this.rootPath)}})}else{const e=a?a.success?a.data?a.data.id?{message:o?o("Unknown copy error"):"Unknown copy error",code:"CopyNotAllowed"}:{message:o?o("No ID in copied item data"):"No ID in copied item data",code:"CopyNotAllowed"}:{message:o?o("No data returned from copy operation"):"No data returned from copy operation",code:"CopyNotAllowed"}:a.error||{message:o?o("Copy operation failed"):"Copy operation failed",code:"CopyNotAllowed"}:{message:o?o("No detailed result from copy operation"):"No detailed result from copy operation",code:"CopyNotAllowed"};n.push({requestId:i.id,success:!1,error:e})}}}else for(const a of e){const e=o?o("No detailed results from copy operation"):"No detailed results from copy operation";n.push({requestId:a.id,success:!1,error:{message:e,code:"CopyNotAllowed"}})}const s=n.every(e=>e.success),m=o?o("Copy operation completed with errors"):"Copy operation completed with errors";return{success:s,detailed:n,error:s?void 0:r.error||{message:m,code:"CopyNotAllowed"}}}async deleteItems(e,t){const{__:o}=this.i18n;if("function"!==typeof this._inner.deleteItems){const e=o?o("Delete items is not supported by inner storage"):"Delete items is not supported by inner storage";throw new a.FileManagerApiError(e,"DeleteNotAllowed")}const l=e.map(e=>({...e,id:this.pathForId(e.id,e.isFolder),folderId:e.folderId?this.pathForId(e.folderId,!0):this.rootPath})),i=await this._inner.deleteItems(l,t),r=[];if(i.detailed&&i.detailed.length>0){const l=new Map;for(let t=0;t<i.detailed.length;t++){const o=i.detailed[t],a=o.requestId||(t<e.length?e[t].id:void 0);a&&l.set(a,o)}for(const a of e){const n=l.get(a.id)||(i.detailed.length===e.length?i.detailed[e.indexOf(a)]:void 0);if(null!==n&&void 0!==n&&n.success){const e=this.pathForId(a.id,a.isFolder);if(t.permanent)this.recursivelyRemoveMappings(a.id,e);else if(this._updateIdMapping(a.id,this.trashPath+"/"+e+(a.isFolder?"/":"")),a.isFolder){const t=this.pathForId(a.id,a.isFolder);this.remapCachedFolderContents(a.id,t,this.trashPath+"/"+e+(a.isFolder?"/":""))}r.push({requestId:a.id,success:!0})}else{const e=o?o("Delete operation failed"):"Delete operation failed";r.push({requestId:a.id,success:!1,error:(null===n||void 0===n?void 0:n.error)||{message:e,code:"DeleteNotAllowed"}})}}}else for(const a of e)if(i.success){const e=this.pathForId(a.id,a.isFolder);if(t.permanent)this.recursivelyRemoveMappings(a.id,e);else if(this._updateIdMapping(a.id,this.trashPath+"/"+e+(a.isFolder?"/":"")),a.isFolder){const t=this.pathForId(a.id,a.isFolder);this.remapCachedFolderContents(a.id,t,this.trashPath+"/"+e+(a.isFolder?"/":""))}r.push({requestId:a.id,success:!0})}else{const e=o?o("Delete operation failed"):"Delete operation failed";r.push({requestId:a.id,success:!1,error:i.error||{message:e,code:"DeleteNotAllowed"}})}const n=r.every(e=>e.success),d=o?o("Some items failed to delete"):"Some items failed to delete";return{success:n,detailed:r,error:n?void 0:i.error||{message:d,code:"DeleteNotAllowed"}}}remapCachedFolderContents(e,t,o){const l=t.replace(/\/+$/,""),i=o.replace(/\/+$/,""),a=[];for(const[r,n]of this._idToPath.entries()){const e=n.replace(/\/+$/,"");e!==l&&e.startsWith(l+"/")&&a.push({id:r,oldPath:e})}for(const{id:r,oldPath:n}of a){const e=i+n.substring(l.length);this._updateIdMapping(r,e)}}recursivelyRemoveMappings(e,t){const o=t.replace(/\/+$/,""),l=[],i=[];for(const[a,r]of this._idToPath.entries()){const e=r.replace(/\/+$/,"");(e===o||e.startsWith(o+"/"))&&(l.push(a),i.push(e))}for(let a=0;a<l.length;a++)this._idToPath.delete(l[a]),this._pathToId.delete(i[a])}async copyItem(e,t){const{__:o}=this.i18n;if("function"!==typeof this._inner.copyItem){const e=o?o("Copy item is not supported by inner storage"):"Copy item is not supported by inner storage";throw new a.FileManagerApiError(e,"CopyNotAllowed")}const l=this.pathForId(e.id,e.isFolder),i=this.pathForId(t,!0),r=await this._inner.copyItem({...e,id:l,folderId:this.pathForId(e.folderId,!0)},i),n=this._getOrGenerateId(r.id),d=r.folderId?this._getOrGenerateId(r.folderId):t;return{...r,id:n,folderId:d}}async updateFile(e,t){const{__:o}=this.i18n;if("function"!==typeof this._inner.updateFile){const e=o?o("Update file is not supported by inner storage"):"Update file is not supported by inner storage";throw new a.FileManagerApiError(e,"UnsupportedOperation")}const l=this.pathForId(e.id,!1);let{...i}=await this._inner.updateFile({...e,id:l,folderId:this.pathForId(e.folderId,!0)},t);return this._updateIdMapping(e.id,i.id),i.folderId&&(i={...i,folderId:this._getOrGenerateId(i.folderId)}),{...i,id:this._getOrGenerateId(i.id)}}async getFileData(e,t){const{__:o}=this.i18n,l=this.pathForId(e.id,!1);if("function"===typeof this._inner.getFileData)return this._inner.getFileData({...e,id:l,folderId:this.pathForId(e.folderId,!0)},t);const i=e.url||("function"===typeof this.getUrl?await this.getUrl(e):void 0);if(!i){const e=o?o("Cannot get file data: no url and no inner.getFileData"):"Cannot get file data: no url and no inner.getFileData";throw new a.FileManagerApiError(e,"FileReadError")}return fetch(i,null!==t&&void 0!==t&&t.forceReload?{cache:"no-store"}:void 0).then(e=>e.blob())}async cleanTrash(){const{__:e}=this.i18n;if("function"!==typeof this._inner.cleanTrash){const t=e?e("Clean trash is not supported by inner storage"):"Clean trash is not supported by inner storage";throw new a.FileManagerApiError(t,"UnsupportedOperation")}return await this._inner.cleanTrash()}}},10874:(e,t,o)=>{o.d(t,{mK:()=>a,vp:()=>g});const l="\x1e";class i{constructor(){this.map=new Map}static childrenViewKey(e,t){return`v${l}${e}${l}${t}`}static childrenCountKey(e){return`c${l}${e}`}getFreshError(e,t){const o=this.map.get(e);return o?t!==1/0&&Date.now()-o.updatedAt>t?(this.map.delete(e),null):o.error:null}setError(e,t){this.map.set(e,{error:t,updatedAt:Date.now()})}delete(e){this.map.delete(e)}clearChildrenViewErrorsForParent(e){const t=`v${l}${e}${l}`;for(const o of[...this.map.keys()])o.startsWith(t)&&this.map.delete(o)}clearAll(){this.map.clear()}}const a=18e5;function r(e){return null==e||""===e?"":e}function n(e){if(null==e)return 1/0;const t=Number(e);return Number.isFinite(t)&&t>=0?t:1/0}function d(e){if(!e)return null;const t=e.folderId;return null==t?null:String(t)}function s(e){return!!e&&e.isFolder}function m(){var e;if("function"===typeof(null===globalThis||void 0===globalThis||null===(e=globalThis.crypto)||void 0===e?void 0:e.randomUUID))return globalThis.crypto.randomUUID();try{const e=globalThis.crypto||globalThis.msCrypto;if(e&&"function"===typeof e.getRandomValues){const t=new Uint8Array(16);e.getRandomValues(t);let o="";for(let e=0;e<t.length;e++)o+=t[e].toString(16).padStart(2,"0");return`id_${o}`}}catch{}return`id_fallback_${Date.now().toString(36)}_${Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(36).slice(0,8)}`}function c(e){if(!e||"object"!==typeof e)return String(null!==e&&void 0!==e?e:"");const t=e,o=[],l={},i=["page","pageSize","sortBy","sortOrder","search","itemType","limit"];for(const d of Object.keys(t).sort()){const e=t[d];i.includes(d)?o.push(`${d}=${String(null!==e&&void 0!==e?e:"")}`):l[d]=e}const a=Object.keys(l).length?JSON.stringify(l):"",r=o.join("|"),n=a?function(e){let t=2166136261;for(let o=0;o<e.length;o++)t^=e.charCodeAt(o),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t.toString(36)}(a):"";return`${r}${n?`|${n}`:""}`}class u{constructor(){this.entities=new Map,this.childrenByParent=new Map,this.maxCacheSize=1e4}now(){return Date.now()}checkCacheSize(){if(this.entities.size>this.maxCacheSize){const e=Array.from(this.entities.entries()).sort((e,t)=>e[1].updatedAt-t[1].updatedAt),t=Math.floor(.1*this.maxCacheSize);for(let o=0;o<t&&o<e.length;o++){const[t,l]=e[o];this.deleteEntityById(t)}}}getEntity(e){var t;return null===(t=this.entities.get(e))||void 0===t?void 0:t.value}getRecord(e){return this.entities.get(e)}getFileSystemItem(e){const t=this.getEntity(e);return t&&!s(t)?t:void 0}getFolder(e){const t=this.getEntity(e);return t&&s(t)?t:void 0}getChildrenIds(e,t={}){const o=r(e),l=this.childrenByParent.get(o);return l?t.onlyFileSystemItems?Array.from(l.files):t.onlyFolders?Array.from(l.folders):[...Array.from(l.folders),...Array.from(l.files)]:[]}searchByUrl(e){for(const t of this.entities.values())if(t.value.url===e)return t.value;return null}upsertEntity(e){var t;const o=null!==(t=this.entities.get(e.id))&&void 0!==t?t:null,l=o?o.value:null,i=l?d(l):null,a=d(e),n=!!l&&s(l),m=s(e);let c;if(l&&s(l)&&m){const t=l.childrenCount,o=e.childrenCount;void 0!==t&&void 0===o&&(c=t)}if(l&&(i!==a||n!==m)){const t=r(i),o=this.childrenByParent.get(t);o&&(n?o.folders.delete(e.id):o.files.delete(e.id),0===o.files.size&&0===o.folders.size&&this.childrenByParent.delete(t))}let u=e;void 0!==c&&(u={...e,childrenCount:c}),this.entities.set(e.id,{value:{...u},updatedAt:this.now()}),this.checkCacheSize();const p=r(a);let g=this.childrenByParent.get(p);g||(g={files:new Set,folders:new Set},this.childrenByParent.set(p,g)),m?g.folders.add(e.id):g.files.add(e.id)}updateServerChildrenCount(e,t){if(null==e||null==t||Number.isNaN(t))return;const o=this.entities.get(e);if(!o||!s(o.value))return;const l={...o.value,childrenCount:t};this.entities.set(e,{value:l,updatedAt:this.now()})}deleteEntityById(e){var t;const o=null!==(t=this.entities.get(e))&&void 0!==t?t:null;if(!o)return{entity:null,parentId:null};const l=o.value,i=d(l),a=r(i),n=this.childrenByParent.get(a);return n&&(s(l)?n.folders.delete(e):n.files.delete(e),0===n.files.size&&0===n.folders.size&&this.childrenByParent.delete(a)),this.entities.delete(e),{entity:{...l},parentId:i}}deleteFolderRecursive(e){const t=this.entities.get(e);if(!t||!s(t.value))return{deletedFolderRecords:[],deletedFileSystemItemRecords:[]};const o=[{id:e,parentId:d(t.value)}],l=[],i=[];for(;o.length;){const e=o.shift();l.push(e);const t=this.childrenByParent.get(r(e.id));if(t){for(const e of Array.from(t.folders)){const t=this.entities.get(e);t&&o.push({id:e,parentId:d(t.value)})}for(const e of Array.from(t.files))i.push(e)}}const a=[];for(const s of i){const e=this.entities.get(s);if(!e)continue;const t=e.value,o=r(d(t)),l=this.childrenByParent.get(o);l&&(l.files.delete(s),0===l.files.size&&0===l.folders.size&&this.childrenByParent.delete(o)),this.entities.delete(s),a.push({...t})}const n=[];for(let d=l.length-1;d>=0;d--){const{id:e,parentId:t}=l[d],o=this.entities.get(e);if(!o)continue;const i=o.value,a=r(i.id);this.childrenByParent.delete(a);const s=r(t),m=this.childrenByParent.get(s);m&&(m.folders.delete(e),0===m.files.size&&0===m.folders.size&&this.childrenByParent.delete(s)),this.entities.delete(e),n.push({...i})}return{deletedFolderRecords:n,deletedFileSystemItemRecords:a}}moveEntityById(e,t){var o;const l=null!==(o=this.entities.get(e))&&void 0!==o?o:null;if(!l)return null;const i=l.value,a=r(d(i)),n=this.childrenByParent.get(a);n&&(s(i)?n.folders.delete(e):n.files.delete(e),0===n.files.size&&0===n.folders.size&&this.childrenByParent.delete(a));const m={...i,folderId:t};if(s(i)&&s(m)){const e=i.childrenCount;void 0!==e&&(m.childrenCount=e)}this.entities.set(e,{value:m,updatedAt:this.now()});const c=r(t);let u=this.childrenByParent.get(c);return u||(u={files:new Set,folders:new Set},this.childrenByParent.set(c,u)),s(m)?u.folders.add(e):u.files.add(e),{...m}}copyFileSystemItem(e,t,o){var l;const i=null!==(l=this.entities.get(e))&&void 0!==l?l:null;if(!i||s(i.value))return null;const a={...i.value,id:t,folderId:o};return this.upsertEntity(a),{...a}}copyFolderShallow(e,t,o){var l;const i=null!==(l=this.entities.get(e))&&void 0!==l?l:null;if(!i||!s(i.value))return null;const a={...i.value,id:t,folderId:o};return this.upsertEntity(a),{...a}}isEntityStale(e,t){var o;const l=null!==(o=this.entities.get(e))&&void 0!==o?o:null;return!l||t!==1/0&&this.now()-l.updatedAt>t}touch(e,t){const o=this.entities.get(e);o&&(o.updatedAt=null!==t&&void 0!==t?t:this.now())}getEntitiesByIds(e){return e.map(e=>{var t,o;return null!==(t=null===(o=this.entities.get(e))||void 0===o?void 0:o.value)&&void 0!==t?t:null})}searchByName(e,t){var o,l,i,a;if(!e||""===e.trim())return[];const n=null===t||void 0===t?void 0:t.parentId,m=null!==(o=null===t||void 0===t?void 0:t.recursive)&&void 0!==o&&o,c=null!==(l=null===t||void 0===t?void 0:t.itemType)&&void 0!==l?l:"all",u=null!==(i=null===t||void 0===t?void 0:t.caseSensitive)&&void 0!==i&&i,p=null!==(a=null===t||void 0===t?void 0:t.limit)&&void 0!==a?a:1/0,g=u?e.trim():e.trim().toLowerCase(),h=[];let b=null;if(void 0!==n){b=new Set;const e=r(n);if(b.add(e),m){const t=[e],o=new Set;for(;t.length>0;){const e=t.shift();if(o.has(e))continue;o.add(e);const l=this.childrenByParent.get(e);if(l)for(const o of l.folders)b.add(o),t.push(o)}}}for(const[,v]of this.entities){var f;if(h.length>=p)break;const e=v.value;if(null!==b){const t=r(d(e));if(!b.has(t))continue}if("file"===c&&s(e))continue;if("folder"===c&&!s(e))continue;const t=null!==(f=e.name)&&void 0!==f?f:"";(u?t:t.toLowerCase()).includes(g)&&h.push({...e})}return h}toJSON(){return{entities:Array.from(this.entities.entries()),childrenByParent:Array.from(this.childrenByParent.entries()).map(([e,t])=>[e,{files:Array.from(t.files),folders:Array.from(t.folders)}])}}static fromJSON(e){const t=new u;for(const[i,a]of null!==(o=e.entities)&&void 0!==o?o:[]){var o;t.entities.set(i,{value:a.value,updatedAt:a.updatedAt})}for(const[i,a]of null!==(l=e.childrenByParent)&&void 0!==l?l:[]){var l;t.childrenByParent.set(i,{files:new Set(a.files),folders:new Set(a.folders)})}return t}}class p{constructor(e={},t=a,o,l,r=new i){var n,d,s,m,c;this.views=new Map,this.strategy=void 0,this.ttl=void 0,this.errorTtl=void 0,this.entityTtl=void 0,this.failedRequests=void 0,this.serverChildrenCountHandler=void 0,this.childrenCountInvalidator=void 0,this.maxViewsPerParent=50,this.strategy={allowSortedInsert:null===(n=e.allowSortedInsert)||void 0===n||n,allowSearchInsert:null===(d=e.allowSearchInsert)||void 0===d||d,invalidateOnPaginationFull:null===(s=e.invalidateOnPaginationFull)||void 0===s||s,preloadPagesBefore:null!==(m=e.preloadPagesBefore)&&void 0!==m?m:0,preloadPagesAfter:null!==(c=e.preloadPagesAfter)&&void 0!==c?c:1,comparator:e.comparator,filterMatch:e.filterMatch},this.ttl=t,this.errorTtl=null!==o&&void 0!==o?o:t,this.entityTtl=null!==l&&void 0!==l?l:t,this.failedRequests=r}setServerChildrenCountHandler(e){this.serverChildrenCountHandler=e}setChildrenCountInvalidator(e){this.childrenCountInvalidator=e}now(){return Date.now()}parentKey(e){return r(null!==e&&void 0!==e?e:null)}isExpired(e){return null==e||this.ttl!==1/0&&this.now()-e>this.ttl}areEntitiesStale(e,t){return!e||e.some(e=>!t.getEntity(e)||t.isEntityStale(e,this.entityTtl))}isEntityTypeCompatible(e,t){return!t||"all"===t||("file"===t&&!s(e)||!("folder"!==t||!s(e)))}cleanupOldViews(e){if(e.size<=this.maxViewsPerParent)return;const t=Array.from(e.entries()).sort((e,t)=>(t[1].view.updatedAt||0)-(e[1].view.updatedAt||0));for(;e.size>this.maxViewsPerParent&&t.length>0;){const[o]=t.pop();e.delete(o)}}async getOrCreateChildren(e,t,o,l){var a;const r=this.parentKey(e),d=c(null!==t&&void 0!==t?t:{});let s=this.views.get(r);s||(s=new Map,this.views.set(r,s));const u=i.childrenViewKey(r,d);let p=s.get(d);if(!p){p={params:t,view:{promise:null,value:void 0,meta:void 0,updatedAt:0,loadId:null}},s.set(d,p),this.cleanupOldViews(s)}const g=this.failedRequests.getFreshError(u,this.errorTtl);if(null!=g)throw g;if(p.view.value&&!this.isExpired(p.view.updatedAt)&&!this.areEntitiesStale(p.view.value,l)&&(null===(a=p.view.meta)||void 0===a||!a.stale)){var h,b;const e=p.view.value.map(e=>l.getEntity(e)).filter(Boolean),t=(null===(h=p.params)||void 0===h?void 0:h.itemType)||"all";return{items:e.filter(e=>this.isEntityTypeCompatible(e,t)),...null!==(b=p.view.meta)&&void 0!==b?b:{}}}if(p.view.promise)return p.view.promise;const f=m();p.view.loadId=f;const v=(async()=>{try{var i,a,d;const m=await o(e,t),g=function(e){return!!e&&"string"===typeof e.search&&e.search.trim().length>0}(t),h=g?{...m,total:void 0}:m,b=null===(i=this.views.get(r))||void 0===i?void 0:i.get(c(t));if(!b||b.view.loadId!==f){const e=new Error("StaleLoad");throw e.name="StaleLoad",e}for(const e of h.items)l.upsertEntity(e);p.view.value=h.items.map(e=>e.id);const{items:v,..._}=h,E={..._};p.view.meta=E,p.view.meta.stale=!1,this.failedRequests.delete(u),p.view.updatedAt=this.now(),g||"number"!==typeof E.total||(this.serverChildrenCountHandler?this.serverChildrenCountHandler(null!==e&&void 0!==e?e:null,E.total,l):l.updateServerChildrenCount(e,E.total));const S=null!==(a=this.strategy.preloadPagesAfter)&&void 0!==a?a:0,y=null!==(d=this.strategy.preloadPagesBefore)&&void 0!==d?d:0,w=n(null===t||void 0===t?void 0:t.pageSize),k=Number.isFinite(w);if((S>0||y>0)&&k){var s;const i=e,a={...t},r="number"===typeof E.totalPages?E.totalPages:1,n=null!==(s=null===t||void 0===t?void 0:t.page)&&void 0!==s?s:1,d=w,m=o,c=f;setTimeout(()=>{this.preloadPagesAsync(i,a,n,r,d,S,y,l,E,m,c)},0)}return h}catch(v){var m,g,h,b;if("StaleLoad"===(null===v||void 0===v?void 0:v.name))throw this.failedRequests.delete(u),p.view.value=void 0,p.view.updatedAt=this.now(),v;const e=v,t=null!==(m=null===e||void 0===e?void 0:e.status)&&void 0!==m?m:null===e||void 0===e||null===(g=e.data)||void 0===g?void 0:g.status,o=null!==(h=null===e||void 0===e?void 0:e.code)&&void 0!==h?h:null===e||void 0===e||null===(b=e.data)||void 0===b?void 0:b.code;if(404===t||"FileNotFound"===o||"FolderNotFound"===o||"path_folder_not_found"===o)return this.failedRequests.delete(u),p.view.value=[],p.view.meta={total:0,totalPages:0},p.view.updatedAt=this.now(),{items:[],total:0,totalPages:0};throw this.failedRequests.setError(u,v),p.view.value=void 0,p.view.updatedAt=this.now(),v}finally{p.view.promise=null}})();return p.view.promise=v,v}async preloadPagesAsync(e,t,o,l,i,a,r,n,d,s,m){try{const i=this.parentKey(e),d=this.views.get(i);if(!d)return;const u=d.get(c(t));if(!u)return;if(null!=m&&u.view.loadId!==m)return;const p=d.get(c(t));if(null===p||void 0===p||!p.view.meta)return;const g="number"===typeof p.view.meta.totalPages?p.view.meta.totalPages:1;if(g!==l)return;const h=async o=>{const l={...t,page:o};try{const a=await s(e,l),r=this.views.get(i);if(!r)return;const d=r.get(c(t));if(!d)return;if(null!=m&&d.view.loadId!==m)return;if(d.view.loadId!==m)return;for(const e of a.items)n.upsertEntity(e);const u=c(l);let p=r.get(u);if(!p){p={params:l,view:{promise:null,value:void 0,meta:void 0,updatedAt:0,loadId:d.view.loadId}},r.set(u,p),this.cleanupOldViews(r)}if(!p.view.value||this.isExpired(p.view.updatedAt)){p.view.value=a.items.map(e=>e.id);const{items:e,...t}=a;p.view.meta={...t,page:o,totalPages:g},p.view.updatedAt=this.now()}}catch(a){}};if(a>0&&o<g)for(let e=1;e<=Math.min(a,g-o);e++){const l=o+e,i=c({...t,page:l}),a=d.get(i);null!==a&&void 0!==a&&a.view.value&&!this.isExpired(a.view.updatedAt)||h(l)}if(r>0&&o>1)for(let e=1;e<=Math.min(r,o-1);e++){const l=o-e,i=c({...t,page:l}),a=d.get(i);null!==a&&void 0!==a&&a.view.value&&!this.isExpired(a.view.updatedAt)||h(l)}}catch(u){}}removeEmptyPageIfNeeded(e,t,o,l,i){if(t.view.value&&0===t.view.value.length&&o<l){const t=c({...i,page:o});e.delete(t)}}updateTotalPagesForAllViews(e,t){for(const[,o]of e)o.view.meta&&(o.view.meta.totalPages=t)}isParamsSame(e,t){const o=Object.keys(null!==e&&void 0!==e?e:{}).filter(e=>"page"!==e).sort(),l=Object.keys(null!==t&&void 0!==t?t:{}).filter(e=>"page"!==e).sort();if(o.length!==l.length)return!1;for(let i=0;i<o.length;i++){const a=o[i];if(a!==l[i])return!1;if(e[a]!==t[a])return!1}return!0}syncTotalsInSameViews(e,t){var o;const l=t.view.meta;if(!l||"number"!==typeof l.total)return;const i=Number(l.total),a=n(null===(o=t.params)||void 0===o?void 0:o.pageSize),r=Number.isFinite(a)&&a>0?Math.max(1,Math.ceil(i/a)):void 0;for(const[,n]of e){var d,s;this.isParamsSame(null!==(d=n.params)&&void 0!==d?d:{},null!==(s=t.params)&&void 0!==s?s:{})&&(n.view.meta||(n.view.meta={}),n.view.meta.total=i,void 0!==r&&(n.view.meta.totalPages=r))}}canSafelyModifySortedView(e){return!e.sortBy&&!e.sortOrder||!!this.strategy.comparator}cascadeShiftPages(e,t,o,l,i,a,r){let n=t,d=o,s=!1;let m=0;for(;n.view.value&&n.view.value.length<l&&d<i&&m<100;){m++;const t=c({...r,page:d+1}),o=e.get(t);if(null===o||void 0===o||!o.view.value||this.isExpired(o.view.updatedAt)){var u;n.view.meta={...null!==(u=n.view.meta)&&void 0!==u?u:{},stale:!0};break}const i=l-n.view.value.length,g=o.view.value.slice(0,i).filter(e=>a.getEntity(e));if(0===g.length){var p;n.view.meta={...null!==(p=n.view.meta)&&void 0!==p?p:{},stale:!0};break}if(n.view.value=[...n.view.value,...g],n.view.updatedAt=Date.now(),o.view.value=o.view.value.slice(g.length),o.view.updatedAt=Date.now(),0===o.view.value.length){const t=d+1,l=o.view.meta;if(t<(l&&"number"===typeof l.totalPages?l.totalPages:1)){const o=c({...r,page:t});e.delete(o),s=!0}break}n=o,d++}var g;(!n.view.value||n.view.value.length<l)&&d>=i&&(n.view.meta={...null!==(g=n.view.meta)&&void 0!==g?g:{},stale:!0});return s}cascadeShiftToNextPage(e,t,o,l,i,a,r){var n,d;if(!t.view.value||t.view.value.length<=l)return!1;var s;if(o-(r.page||1)>=10)return t.view.meta={...null!==(s=t.view.meta)&&void 0!==s?s:{},stale:!0},!1;const m={...r,page:o+1},u=c(m);let p=e.get(u),g=!1;if(null===(n=p)||void 0===n||!n.view.value||this.isExpired(p.view.updatedAt)){var h;if(!(o>=i))return t.view.meta={...null!==(h=t.view.meta)&&void 0!==h?h:{},stale:!0},!1;{p={params:m,view:{promise:null,value:void 0,meta:void 0,updatedAt:0,loadId:null}},e.set(u,p),this.cleanupOldViews(e);const l=t.view.meta;l&&(p.view.meta={...l,page:o+1}),g=!0}}const b=t.view.value.slice(l).filter(e=>a.getEntity(e));if(0===b.length)return g&&e.delete(u),!1;t.view.value=t.view.value.slice(0,l),t.view.updatedAt=Date.now(),p.view.value=[...b,...null!==(d=p.view.value)&&void 0!==d?d:[]],p.view.updatedAt=Date.now();const f=p.view.meta&&"number"===typeof p.view.meta.totalPages?p.view.meta.totalPages:i;if(!g){if(this.cascadeShiftToNextPage(e,p,o+1,l,f,a,r))return!0}if(!p.view.value||0===p.view.value.length){const t=o+1,l=p.view.meta,i=l&&"number"===typeof l.totalPages?l.totalPages:1;this.removeEmptyPageIfNeeded(e,p,t,i,r)}return g}tryInsertSorted(e,t,o){var l;const i=this.strategy.comparator;if(!i)return!1;if(!e.view.value)return!1;const a=(null===(l=e.params)||void 0===l?void 0:l.itemType)||"all";if(!this.isEntityTypeCompatible(t,a))return!1;const r=e.view.value.map(e=>o.getEntity(e));if(r.some(e=>!e))return!1;let n=0,d=r.length;for(;n<d;){const o=Math.floor((n+d)/2),l=i(t,r[o],e.params);if("number"!==typeof l||Number.isNaN(l))return!1;l>=0?n=o+1:d=o}return e.view.value.includes(t.id)?(e.view.updatedAt=this.now(),!0):(e.view.value=[...e.view.value.slice(0,n),t.id,...e.view.value.slice(n)],e.view.updatedAt=this.now(),e.view.meta&&"number"===typeof e.view.meta.total&&(e.view.meta.total=Number(e.view.meta.total)+1),!0)}updateChildrenCountForOperation(e,t,o,l){var i,a,r,n;const s=d(t);switch(e){case"delete":this.adjustChildrenCount(l,s,-1),null===(i=this.childrenCountInvalidator)||void 0===i||i.call(this,s);break;case"insert":case"copy":this.adjustChildrenCount(l,s,1),null===(a=this.childrenCountInvalidator)||void 0===a||a.call(this,s);break;case"move":this.adjustChildrenCount(l,o,-1),this.adjustChildrenCount(l,s,1),null===(r=this.childrenCountInvalidator)||void 0===r||r.call(this,o),null===(n=this.childrenCountInvalidator)||void 0===n||n.call(this,s)}}adjustChildrenCount(e,t,o){if(!t)return;const l=e.getFolder(t);if(l&&"number"===typeof l.childrenCount){const i=Math.max(0,l.childrenCount+o);e.updateServerChildrenCount(t,i)}}smartInvalidateChildrenViews(e,t,o,l,i,a){if(!t)return;this.updateChildrenCountForOperation(o,t,i,l);const r=this.parentKey(e),d=this.views.get(r);if(d)for(const[,g]of d){var s,c;const e=null!==(s=g.params)&&void 0!==s?s:{},a=null!==(c=null===e||void 0===e?void 0:e.page)&&void 0!==c?c:1,r=n(null===e||void 0===e?void 0:e.pageSize),h=Number.isFinite(r),b=!!(null!==e&&void 0!==e&&e.sortBy||null!==e&&void 0!==e&&e.sortOrder),f=!(null===e||void 0===e||!e.search),v=(null===e||void 0===e?void 0:e.itemType)||"all";if(!this.isEntityTypeCompatible(t,v))continue;if(f&&this.strategy.filterMatch&&!this.strategy.filterMatch(t,g.params)){var u;null!==(u=g.view.value)&&void 0!==u&&u.includes(t.id)&&(g.view.value=g.view.value.filter(e=>e!==t.id),g.view.meta&&"number"===typeof g.view.meta.total&&(g.view.meta.total=Math.max(0,g.view.meta.total-1)),g.view.updatedAt=Date.now());continue}if(!g.view.value){g.view.meta&&(g.view.meta.stale=!0),g.view.loadId=m(),g.view.abortController&&(g.view.abortController.abort(),g.view.abortController=void 0);continue}g.view.value.includes(t.id);var p;if(this.shouldInvalidateCompletely(g,o,t,b,h,a))g.view.meta={...null!==(p=g.view.meta)&&void 0!==p?p:{},stale:!0},g.view.loadId=m(),g.view.abortController&&(g.view.abortController.abort(),g.view.abortController=void 0);else switch(o){case"delete":this.handleDelete(d,g,a,r,h,t,l);break;case"insert":case"copy":this.handleInsert(d,g,a,r,h,b,t,l);break;case"update":this.handleUpdate(d,g,a,r,h,b,f,t,l);break;case"move":this.handleMove(d,g,a,r,h,b,t,i,l)}}}shouldInvalidateCompletely(e,t,o,l,i,a){return!(!(i&&a>1)||"insert"!==t&&"delete"!==t&&"move"!==t)||(!(!l||this.strategy.comparator||"insert"!==t&&"move"!==t)||!!this.isExpired(e.view.updatedAt))}tryReinsertEntity(e,t,o,l,i){var a,r;const n=(null===(a=e.params)||void 0===a?void 0:a.itemType)||"all";if(!this.isEntityTypeCompatible(t,n))return!1;if(this.strategy.comparator&&this.strategy.filterMatch){if(!this.strategy.filterMatch(t,e.params))return!1;if(this.tryInsertSorted(e,t,o))return!0}const d=null!==(r=e.params)&&void 0!==r?r:{};return!(!(!d.sortBy&&!d.sortOrder)&&!this.canSafelyModifySortedView(d))&&((!l||e.view.value.length<i)&&(e.view.value.push(t.id),!0))}handleDelete(e,t,o,l,i,a,r){const n=t.view.value.includes(a.id);if(n&&(t.view.value=t.view.value.filter(e=>e!==a.id)),t.view.meta&&"number"===typeof t.view.meta.total){if(t.view.meta.total=Math.max(0,t.view.meta.total-1),i&&Number.isFinite(l)&&"number"===typeof t.view.meta.total){const e=l;e>0&&(t.view.meta.totalPages=Math.max(1,Math.ceil(t.view.meta.total/e)))}this.syncTotalsInSameViews(e,t)}if(t.view.updatedAt=Date.now(),n&&i&&t.view.value.length<l&&r){var d;const i=t.view.meta,a=i&&"number"===typeof i.totalPages?i.totalPages:1;if(this.cascadeShiftPages(e,t,o,l,a,r,null!==(d=t.params)&&void 0!==d?d:{})&&t.view.meta&&"number"===typeof t.view.meta.totalPages){const o=Math.max(1,t.view.meta.totalPages-1);t.view.meta.totalPages=o,this.updateTotalPagesForAllViews(e,o)}}t.view.loadId=m(),t.view.abortController&&(t.view.abortController.abort(),t.view.abortController=void 0)}handleInsert(e,t,o,l,i,a,r,n){if(!t.view.value.includes(r.id)){if(a&&this.strategy.allowSortedInsert&&this.strategy.comparator&&n){if(this.tryInsertSorted(t,r,n)&&t.view.meta&&"number"===typeof t.view.meta.total){if(t.view.meta.total+=1,i&&Number.isFinite(l)){const e=l;e>0&&(t.view.meta.totalPages=Math.max(1,Math.ceil(t.view.meta.total/e)))}this.syncTotalsInSameViews(e,t)}if(i&&t.view.value.length>l&&n){var d;const i=t.view.meta,a=i&&"number"===typeof i.totalPages?i.totalPages:1;if(this.cascadeShiftToNextPage(e,t,o,l,a,n,null!==(d=t.params)&&void 0!==d?d:{})&&t.view.meta&&"number"===typeof t.view.meta.totalPages){const o=t.view.meta.totalPages+1;t.view.meta.totalPages=o,this.updateTotalPagesForAllViews(e,o)}}}else if(!i||t.view.value.length<l){if(t.view.value.push(r.id),t.view.meta&&"number"===typeof t.view.meta.total){if(t.view.meta.total+=1,i&&Number.isFinite(l)){const e=l;e>0&&(t.view.meta.totalPages=Math.max(1,Math.ceil(t.view.meta.total/e)))}this.syncTotalsInSameViews(e,t)}t.view.updatedAt=Date.now()}else{var s;t.view.meta={...null!==(s=t.view.meta)&&void 0!==s?s:{},stale:!0}}t.view.loadId=m(),t.view.abortController&&(t.view.abortController.abort(),t.view.abortController=void 0)}}handleUpdate(e,t,o,l,i,a,r,n,d){var s;const c=t.view.value.includes(n.id),u=this.isEntityTypeCompatible(n,(null===(s=t.params)||void 0===s?void 0:s.itemType)||"all");if(c&&!u){if(t.view.value=t.view.value.filter(e=>e!==n.id),t.view.meta&&"number"===typeof t.view.meta.total&&(t.view.meta.total=Math.max(0,t.view.meta.total-1),i&&Number.isFinite(l)&&"number"===typeof t.view.meta.total)){const e=l;e>0&&(t.view.meta.totalPages=Math.max(1,Math.ceil(t.view.meta.total/e)))}if(t.view.updatedAt=Date.now(),i&&t.view.value.length<l&&d){var p;const i=t.view.meta,a=i&&"number"===typeof i.totalPages?i.totalPages:1;if(this.cascadeShiftPages(e,t,o,l,a,d,null!==(p=t.params)&&void 0!==p?p:{})&&t.view.meta&&"number"===typeof t.view.meta.totalPages){const o=Math.max(1,t.view.meta.totalPages-1);t.view.meta.totalPages=o,this.updateTotalPagesForAllViews(e,o)}}return t.view.loadId=m(),void(t.view.abortController&&(t.view.abortController.abort(),t.view.abortController=void 0))}if(c&&(a||r)){t.view.value=t.view.value.filter(e=>e!==n.id);if(this.tryReinsertEntity(t,n,d,i,l)){if(t.view.meta&&"number"===typeof t.view.meta.total){if(t.view.meta.total+=1,i&&Number.isFinite(l)){const e=l;e>0&&(t.view.meta.totalPages=Math.max(1,Math.ceil(t.view.meta.total/e)))}this.syncTotalsInSameViews(e,t)}}else{if(t.view.meta&&"number"===typeof t.view.meta.total){if(t.view.meta.total=Math.max(0,t.view.meta.total-1),i&&Number.isFinite(l)&&"number"===typeof t.view.meta.total){const e=l;e>0&&(t.view.meta.totalPages=Math.max(1,Math.ceil(t.view.meta.total/e)))}this.syncTotalsInSameViews(e,t)}if(i&&t.view.value.length<l&&d){var g;const i=t.view.meta,a=i&&"number"===typeof i.totalPages?i.totalPages:1;if(this.cascadeShiftPages(e,t,o,l,a,d,null!==(g=t.params)&&void 0!==g?g:{})&&t.view.meta&&"number"===typeof t.view.meta.totalPages){const o=Math.max(1,t.view.meta.totalPages-1);t.view.meta.totalPages=o,this.updateTotalPagesForAllViews(e,o)}}}return t.view.updatedAt=Date.now(),t.view.loadId=m(),void(t.view.abortController&&(t.view.abortController.abort(),t.view.abortController=void 0))}if(c)return t.view.updatedAt=Date.now(),t.view.loadId=m(),void(t.view.abortController&&(t.view.abortController.abort(),t.view.abortController=void 0));if(u&&!r){if(a&&this.strategy.allowSortedInsert&&this.strategy.comparator&&d){if(this.tryInsertSorted(t,n,d)&&t.view.meta&&"number"===typeof t.view.meta.total){if(t.view.meta.total+=1,i&&Number.isFinite(l)){const e=l;e>0&&(t.view.meta.totalPages=Math.max(1,Math.ceil(t.view.meta.total/e)))}this.syncTotalsInSameViews(e,t)}}else if(!i||t.view.value.length<l){if(t.view.value.push(n.id),t.view.meta&&"number"===typeof t.view.meta.total){if(t.view.meta.total+=1,i&&Number.isFinite(l)){const e=l;e>0&&(t.view.meta.totalPages=Math.max(1,Math.ceil(t.view.meta.total/e)))}this.syncTotalsInSameViews(e,t)}t.view.updatedAt=Date.now()}else{var h;t.view.meta={...null!==(h=t.view.meta)&&void 0!==h?h:{},stale:!0}}t.view.loadId=m(),t.view.abortController&&(t.view.abortController.abort(),t.view.abortController=void 0)}}handleMove(e,t,o,l,i,a,r,n,d){if(t.view.value.includes(r.id)){if(t.view.value=t.view.value.filter(e=>e!==r.id),t.view.meta&&"number"===typeof t.view.meta.total&&(t.view.meta.total=Math.max(0,t.view.meta.total-1),i&&Number.isFinite(l)&&"number"===typeof t.view.meta.total)){const e=l;e>0&&(t.view.meta.totalPages=Math.max(1,Math.ceil(t.view.meta.total/e)))}if(t.view.updatedAt=Date.now(),i&&t.view.value.length<l&&d){var s;const i=t.view.meta,a=i&&"number"===typeof i.totalPages?i.totalPages:1;if(this.cascadeShiftPages(e,t,o,l,a,d,null!==(s=t.params)&&void 0!==s?s:{})&&t.view.meta&&"number"===typeof t.view.meta.totalPages){const o=Math.max(1,t.view.meta.totalPages-1);t.view.meta.totalPages=o,this.updateTotalPagesForAllViews(e,o)}}this.syncTotalsInSameViews(e,t)}t.view.loadId=m(),t.view.abortController&&(t.view.abortController.abort(),t.view.abortController=void 0)}forceInvalidateChildrenViews(e){const t=this.parentKey(null!==e&&void 0!==e?e:null);this.failedRequests.clearChildrenViewErrorsForParent(t);const o=this.views.get(t);if(o)for(const[,l]of o)l.view.value=void 0,l.view.meta=void 0,l.view.promise=null,l.view.updatedAt=0,l.view.loadId=m(),l.view.abortController&&(l.view.abortController.abort(),l.view.abortController=void 0)}getKnownTotal(e){const t=this.parentKey(null!==e&&void 0!==e?e:null),o=this.views.get(t);if(!o)return;let l=null;for(const[,r]of o){const e=r.view.meta;var i,a;if(e&&"number"===typeof e.total)if(!l||(null!==(i=r.view.updatedAt)&&void 0!==i?i:0)>l.updatedAt)l={total:Number(e.total),updatedAt:null!==(a=r.view.updatedAt)&&void 0!==a?a:0}}return l?l.total:void 0}toJSON(){return{views:Array.from(this.views.entries()).map(([e,t])=>[e,Array.from(t.entries())]),ttl:this.ttl,errorTtl:this.errorTtl,entityTtl:this.entityTtl,strategy:{allowSortedInsert:this.strategy.allowSortedInsert,allowSearchInsert:this.strategy.allowSearchInsert,invalidateOnPaginationFull:this.strategy.invalidateOnPaginationFull,preloadPagesBefore:this.strategy.preloadPagesBefore,preloadPagesAfter:this.strategy.preloadPagesAfter}}}static fromJSON(e,t){var o,l,r,n,d;const s=null!==(o=null!==(l=null===t||void 0===t?void 0:t.ttl)&&void 0!==l?l:null===e||void 0===e?void 0:e.ttl)&&void 0!==o?o:a,m=null!==(r=null!==(n=null===t||void 0===t?void 0:t.errorTtl)&&void 0!==n?n:null===e||void 0===e?void 0:e.errorTtl)&&void 0!==r?r:s,c=null!==(d=null===t||void 0===t?void 0:t.failedRequests)&&void 0!==d?d:new i,u=new p({},s,m,void 0,c);for(const[i,a]of null!==(g=e.views)&&void 0!==g?g:[]){var g;const e=new Map;for(const[t,o]of a){const l=o;null!==l&&void 0!==l&&l.view&&"error"in l.view&&delete l.view.error,e.set(t,l)}u.views.set(i,e)}return u}}class g{invalidateChildrenCountCache(e){const t=r(null!==e&&void 0!==e?e:"");this.childrenCountPromises.delete(t),this.failedRequests.delete(i.childrenCountKey(t))}constructor(e={},t=a,o){this.entities=void 0,this.views=void 0,this.ttl=void 0,this.errorTtl=void 0,this.failedRequests=void 0,this.childrenCountPromises=new Map,this.failedRequests=new i,this.ttl=t,this.errorTtl=null!==o&&void 0!==o?o:t,this.entities=new u,this.views=new p(e,t,this.errorTtl,void 0,this.failedRequests),this.views.setServerChildrenCountHandler((e,t,o)=>{this.handleServerReportedChildrenCount(e,t,null!==o&&void 0!==o?o:this.entities)}),this.views.setChildrenCountInvalidator(e=>{this.invalidateChildrenCountCache(e)})}getEntity(e){var t;return null!==(t=this.entities.getEntity(e))&&void 0!==t?t:null}getFileSystemItem(e){var t;return null!==(t=this.entities.getFileSystemItem(e))&&void 0!==t?t:null}getFolder(e){var t;return null!==(t=this.entities.getFolder(e))&&void 0!==t?t:null}async getOrCreateChildren(e,t,o){return this.views.getOrCreateChildren(e,t,o,this.entities)}upsertEntity(e){const t=this.entities.getEntity(e.id),o=t?d(t):null,l=d(e),i=!!t&&s(t),a=s(e);if(this.entities.upsertEntity(e),t){if(o!==l||i!==a)return this.views.smartInvalidateChildrenViews(o,t,"delete",this.entities),void this.views.smartInvalidateChildrenViews(l,e,"insert",this.entities);this.views.smartInvalidateChildrenViews(l,e,"update",this.entities,void 0,t)}else this.views.smartInvalidateChildrenViews(l,e,"insert",this.entities)}isAncestor(e,t){let o=t;const l=new Set;for(;o&&!l.has(o);){l.add(o);if(r(o)===r(e))return!0;const t=this.entities.getEntity(o);if(!t)break;o=d(t),null===o&&(o="")}return!1}moveEntity(e,t){const o=this.entities.getEntity(e);if(!o)return null;if(s(o)&&null!==t&&this.isAncestor(e,t))return null;const l=d(o),i=this.entities.moveEntityById(e,t);return i?(this.views.smartInvalidateChildrenViews(l,o,"delete",this.entities),this.views.smartInvalidateChildrenViews(t,i,"insert",this.entities),i):null}copyEntity(e,t,o,l){const i=this.entities.getEntity(e);if(!i)return null;let a=null;if(s(i)){var r;const o=[e],i=[];for(;o.length;){const e=o.shift();i.push(e);const t=this.entities.getChildrenIds(e,{onlyFolders:!0});for(const l of t)o.push(l)}const s=new Map;for(const e of i)s.set(e,m());for(const a of i){var n,c;const o=this.entities.getFolder(a),i=s.get(a),r=d(o),m=null===r?t:null!==(n=s.get(r))&&void 0!==n?n:null,u={...o,...a===e?l:void 0,id:i,folderId:null!==(c=a===e?null===l||void 0===l?void 0:l.folderId:void 0)&&void 0!==c?c:m};this.entities.upsertEntity(u)}for(const e of i){const t=s.get(e),o=this.entities.getChildrenIds(e,{onlyFileSystemItems:!0});for(const e of o){const o=this.entities.getFileSystemItem(e);if(!o)continue;const l=m(),i={...o,id:l,folderId:t};this.entities.upsertEntity(i)}}a=null!==(r=this.entities.getEntity(s.get(e)))&&void 0!==r?r:null}else{const i=null!==o&&void 0!==o?o:m();if(a=this.entities.copyFileSystemItem(e,i,null!==t&&void 0!==t?t:null),a&&l){var u,p;const e={...a,...l,id:i,folderId:null!==(u=null!==(p=l.folderId)&&void 0!==p?p:t)&&void 0!==u?u:null};this.entities.upsertEntity(e),a=e}}return a&&this.views.smartInvalidateChildrenViews(t,a,"copy",this.entities),a}searchByUrl(e){var t;return null!==(t=this.entities.searchByUrl(e))&&void 0!==t?t:null}deleteEntity(e){const t=this.entities.getEntity(e);if(!t)return null;if(s(t)){const{deletedFolderRecords:o,deletedFileSystemItemRecords:l}=this.entities.deleteFolderRecursive(e);for(const e of l)this.views.smartInvalidateChildrenViews(e.folderId,e,"delete",this.entities);for(const e of o)this.views.smartInvalidateChildrenViews(e.folderId,e,"delete",this.entities);for(const e of o)this.views.forceInvalidateChildrenViews(e.id);return t}{const{entity:t,parentId:o}=this.entities.deleteEntityById(e);return t&&this.views.smartInvalidateChildrenViews(o,t,"delete",this.entities),t}}deleteFolderRecursive(e){const{deletedFolderRecords:t,deletedFileSystemItemRecords:o}=this.entities.deleteFolderRecursive(e);for(const l of o)this.views.smartInvalidateChildrenViews(l.folderId,l,"delete",this.entities);for(const l of t)this.views.smartInvalidateChildrenViews(l.folderId,l,"delete",this.entities);for(const l of t)this.views.forceInvalidateChildrenViews(l.id);return{deletedFileSystemItemIds:o.map(e=>e.id),deletedFolderIds:t.map(e=>e.id)}}forceInvalidate(e){const t=this.entities.getEntity(e);if(!t)return;const o=new Set;if(s(t)){const t=[e];for(;t.length;){const e=t.pop();if(o.has(e))continue;o.add(e),this.views.forceInvalidateChildrenViews(e),this.invalidateChildrenCountCache(e);const l=this.entities.getChildrenIds(e,{onlyFolders:!0});for(const o of l)t.push(o)}}else{var l;const e=null!==(l=t.folderId)&&void 0!==l?l:null;this.views.forceInvalidateChildrenViews(e),this.invalidateChildrenCountCache(e)}}getChildrenIds(e){return this.entities.getChildrenIds(e)}searchByName(e,t){return this.entities.searchByName(e,t)}async getChildrenCount(e="",t){const o=r(e),l=i.childrenCountKey(o),a=this.failedRequests.getFreshError(l,this.errorTtl);if(null!=a)return Promise.reject(a);const n=this.childrenCountPromises.get(o);if(n)return n;const d=(async()=>{try{const o=this.entities.getFolder(e);if(o&&"number"===typeof o.childrenCount)return this.failedRequests.delete(l),o.childrenCount;const i=this.views.getKnownTotal(e);if("number"===typeof i)return o&&this.handleServerReportedChildrenCount(e,i,this.entities),this.failedRequests.delete(l),i;if(t){const o=await t(e);return this.entities.getFolder(e)&&this.handleServerReportedChildrenCount(e,o,this.entities),this.failedRequests.delete(l),o}return this.failedRequests.delete(l),this.entities.getChildrenIds(e).length}catch(i){if(this.childrenCountPromises.delete(o),function(e){var t,o,l;if(!e||"object"!==typeof e)return!1;const i=e;return"path_folder_not_found"===i.code||"path_folder_not_found"===(null===(t=i.data)||void 0===t?void 0:t.code)||404===i.status||404===(null===(o=i.data)||void 0===o||null===(l=o.data)||void 0===l?void 0:l.status)}(i))return this.failedRequests.delete(l),0;throw this.failedRequests.setError(l,i),i}finally{this.childrenCountPromises.delete(o)}})();return this.childrenCountPromises.set(o,d),d}toJSON(){return{entities:this.entities.toJSON(),views:this.views.toJSON(),ttl:this.ttl,errorTtl:this.errorTtl}}static fromJSON(e,t){var o,l,i,r;const n=null!==(o=null===e||void 0===e?void 0:e.ttl)&&void 0!==o?o:a,d=null!==(l=null===e||void 0===e?void 0:e.errorTtl)&&void 0!==l?l:n,s=new g(null!==t&&void 0!==t?t:{},n,d),m=u.fromJSON(null!==(i=null===e||void 0===e?void 0:e.entities)&&void 0!==i?i:{}),c=p.fromJSON(null!==(r=null===e||void 0===e?void 0:e.views)&&void 0!==r?r:{},{failedRequests:s.failedRequests,ttl:n,errorTtl:d});var h,b,f,v,_;t&&(c.strategy={allowSortedInsert:null===(h=t.allowSortedInsert)||void 0===h||h,allowSearchInsert:null===(b=t.allowSearchInsert)||void 0===b||b,invalidateOnPaginationFull:null===(f=t.invalidateOnPaginationFull)||void 0===f||f,preloadPagesBefore:null!==(v=t.preloadPagesBefore)&&void 0!==v?v:0,preloadPagesAfter:null!==(_=t.preloadPagesAfter)&&void 0!==_?_:1,comparator:t.comparator,filterMatch:t.filterMatch});return s.entities=m,s.views=c,c.setServerChildrenCountHandler((e,t,o)=>{s.handleServerReportedChildrenCount(e,t,null!==o&&void 0!==o?o:m)}),c.setChildrenCountInvalidator(e=>{s.invalidateChildrenCountCache(e)}),s}handleServerReportedChildrenCount(e,t,o){this.checkAndResolveChildrenCountConflict(e,t,o),this.invalidateChildrenCountCache(e)}checkAndResolveChildrenCountConflict(e,t,o){if(!o||void 0===t)return;const l=null!==e&&void 0!==e?e:null;if(!l)return void o.updateServerChildrenCount(l,t);const i=o.getFolder(l),a=null===i||void 0===i?void 0:i.childrenCount;void 0!==a&&a!==t&&this.views.forceInvalidateChildrenViews(l),o.updateServerChildrenCount(l,t)}}},79292:(e,t,o)=>{o.d(t,{C:()=>f});var l=o(74778),i=o(4889),a=o(30338),r=o(47706),n=o(2783),d=o(86080),s=o(53687);function m(e,t="BackendError"){switch(e){case 400:return"ValidationError";case 401:return"AuthenticationFailed";case 403:return"AuthorizationFailed";case 404:return"FileNotFound";case 409:return"FolderAlreadyExists";case 413:return"PayloadTooLarge";case 415:return"UnsupportedMediaType";case 429:return"RateLimitExceeded";case 500:return"BackendError";case 503:return"ServiceUnavailable";case 504:return"Timeout";default:return t}}const c={file_too_large:"FileTooLarge",file_size_exceeded:"FileTooLarge",file_size_limit:"FileTooLarge",invalid_file_name:"FileInvalidName",file_name_invalid:"FileInvalidName",invalid_name:"FileInvalidName",invalid_folder_name:"FolderInvalidName",folder_name_invalid:"FolderInvalidName",folder_invalid_name:"FolderInvalidName",file_type_not_allowed:"FileTypeNotAllowed",unsupported_type:"FileTypeNotAllowed",invalid_format:"FileTypeNotAllowed",batch_limit_exceeded:"BatchItemLimitExceeded",exceeded_max_files:"BatchItemLimitExceeded",file_count_exceeded:"BatchItemLimitExceeded",upload_limit_exceeded:"BatchItemLimitExceeded",too_many_files:"BatchItemLimitExceeded"};function u(e){if("string"===typeof e)return e;if(null!==e&&"object"===typeof e&&!Array.isArray(e)&&"400x400"in e){const t=e["400x400"];return"string"===typeof t?t:void 0}}function p(e){if(!e)return["",""];const t=e.replaceAll("\\","/").split("/").filter(Boolean),o=t.pop()||"";return[t.join("/"),o]}class g{constructor(e){this._restApi=void 0,this._projectId=void 0,this.i18n=void 0,this.pathPostfix=void 0,this.appConfig=void 0,this.isStandalone=void 0,this.pathMode=!0,this.rootId="",this.trashPath="trash",this.tempPath="Edited",this.getFileData=async(e,t)=>{const o=e.url||("function"===typeof this.getUrl?this.getUrl(e):""),l=await(0,s.Be)(o,{config:this.appConfig,standalone:this.isStandalone,resourceType:(0,s.dg)(o,this.appConfig)?"cdn":"generic",intent:"downloadBlob",init:null!==t&&void 0!==t&&t.forceReload?{cache:"no-store"}:void 0});if(l.ok)return l.blob();const i=await l.text(),a=m(l.status,"FileReadError"),{__:r}=this.i18n,d=i||r("Failed to get file: %s").replace("%s",l.statusText);throw new n.FileManagerApiError(d,a,l.status)},this.getUrl=e=>(0,s.hs)(this.appConfig,[this._projectId,this.pathPostfix,e.folderId,e.name]),this.getThumbnailUrl=e=>{const t=e.name.lastIndexOf("."),o=t>0?e.name.slice(0,t):e.name,l=t>0?e.name.slice(t+1):"";return(0,s.hs)(this.appConfig,[this._projectId,this.pathPostfix,".thumbs",e.folderId,o,o+"-400x400."+l])},this._restApi=e.restApi,this._projectId=e.projectId,this.i18n=e.i18n||r.nr,this.pathPostfix=e.pathPostfix,this.appConfig=e.appConfig,this.isStandalone=!!e.isStandalone}removePrefix(e){let t=function(e,t){if(!e)return"";const o=new RegExp(`^/?${t}/?`);return e.replace(o,"")}(e,this._projectId);if(this.pathPostfix){const e=new RegExp(`^/?${this.pathPostfix}/?`);t=t.replace(e,"")}return t}handleError(e,t){var o,l;const{__:i}=this.i18n;if(e instanceof Error){if(e instanceof n.FileManagerApiError)throw e;throw new n.FileManagerApiError(e.message,t||"BackendError")}const a=e.data,r=(null===a||void 0===a?void 0:a.message)||i("Unknown error"),d=null!==(o=null===a||void 0===a||null===(l=a.data)||void 0===l?void 0:l.status)&&void 0!==o?o:null===a||void 0===a?void 0:a.status,s=null===a||void 0===a?void 0:a.code,u=t||(s?c[s]:void 0)||("number"===typeof d?m(d):void 0)||"BackendError";throw new n.FileManagerApiError(r,u,d)}convertRestError(e,t){const{__:o}=this.i18n;if(e instanceof n.FileManagerApiError)return e;if(e instanceof Error)return e;if(e&&"object"===typeof e&&"data"in e&&!(e instanceof Error)){var l,i;const a=e.data,r=(null===a||void 0===a?void 0:a.message)||o("Unknown error"),n=null!==(l=null===a||void 0===a||null===(i=a.data)||void 0===i?void 0:i.status)&&void 0!==l?l:null===a||void 0===a?void 0:a.status,d=null===a||void 0===a?void 0:a.code;return{message:r,code:t||(d?c[d]:void 0)||(n?m(n):void 0)||"BackendError",status:n,raw:e}}return null!==e&&void 0!==e?e:{message:o("Unknown error")}}async getFolders({parentId:e}){const t=await this._restApi.emFiles.folders_list({project_id:this._projectId,path_folder:e,per_page:1e4},{type:l.cM.Json});if(t.error){if(this.isPathFolderNotFound(t.error))return[];this.handleError(t.error)}return await t.data.folders.map(e=>({id:this.removePrefix(e.full_path),name:e.name,folderId:this.removePrefix(e.parent_folder),childrenCount:e.files_count+e.folders_count,isFolder:!0}))}async getItems(e){if(void 0===e.limit&&(e.limit=Number.MAX_SAFE_INTEGER),"folder"===e.itemType)return{items:await this.getFolders({parentId:e.folderId})};let t;try{t=await this._restApi.emFiles.files_list({project_id:this._projectId,path_folder:e.folderId,filter_name:e.search,sort_by:e.sortBy,sort_order:e.sortOrder,per_page:e.limit,page:e.page})}catch(r){if(this.isPathFolderNotFound(r)||404===(null===r||void 0===r?void 0:r.status))return{items:[],pagination:{limit:e.limit,page:1,total:0,totalPages:0}};throw r}const o=t,l=!o.ok&&404===o.status||this.isPathFolderNotFound(t.error);if(t.error||!o.ok){if(l)return{items:[],pagination:{limit:e.limit,page:1,total:0,totalPages:0}};t.error&&this.handleError(t.error)}const i=t.data;let a=((null===i||void 0===i?void 0:i.files)||[]).map(e=>{const t=e.thumbnail,o=function(e){var t,o;const l=e.is_folder;if(!0===l||1===l)return!0;if(!1===l||0===l)return!1;if("string"===typeof l){const e=l.trim().toLowerCase();if("true"===e||"1"===e||"yes"===e)return!0;if("false"===e||"0"===e||"no"===e||""===e)return!1}if("folder"===String(null!==(t=e.item_type)&&void 0!==t?t:"").toLowerCase())return!0;const i=String(null!==(o=e.type)&&void 0!==o?o:"").toLowerCase();return"folder"===i||"directory"===i||"dir"===i||!("inode/directory"!==i&&"application/x-directory"!==i&&"httpd/unix-directory"!==i&&!i.endsWith("/directory"))}(e);return{...e,id:`${this.removePrefix(e.folder)}/${e.name}`,size:Number(e.size),date:e.date||(new Date).toISOString(),folderId:this.removePrefix(e.folder),selected:!1,isFolder:o,thumbnail:u(t)}});return i.total===Number.MAX_SAFE_INTEGER&&(i.total=a.length),"file"===e.itemType&&(a=a.filter(e=>!e.isFolder)),{items:a,pagination:{limit:i.per_page,page:i.page,total:i.total,totalPages:i.total_pages}}}async getFile(e){const t=await(0,s.Be)((0,s.hs)(this.appConfig,[this._projectId,e]),{config:this.appConfig,standalone:this.isStandalone,resourceType:"cdn",intent:"downloadBlob"});if(t.ok)return t.blob();{const e=await t.text(),o=m(t.status,"FileReadError"),{__:l}=this.i18n,i=e||l("Failed to get file: %s").replace("%s",t.statusText);throw new n.FileManagerApiError(i,o,t.status)}}isPathFolderNotFound(e){var t,o,l;if(!e||"object"!==typeof e||e instanceof Error)return!1;const i=e;return"path_folder_not_found"===i.code||"path_folder_not_found"===(null===(t=i.data)||void 0===t?void 0:t.code)||404===(null===(o=i.data)||void 0===o||null===(l=o.data)||void 0===l?void 0:l.status)}async deleteItem(e,t){if(e.isFolder){var o;const a=await this._restApi.emFiles.folders_delete({path_folder:e.id,project_id:this._projectId,force:t.permanent},{type:l.cM.Json});if(a.error){var i;if(this.isPathFolderNotFound(a.error))return void await this.clearCache(null!==(i=e.folderId)&&void 0!==i?i:void 0);const t="FolderNotFound";this.handleError(a.error,t)}await this.clearCache(null!==(o=e.folderId)&&void 0!==o?o:void 0)}else{var a;const o=await this._restApi.emFiles.files_delete({project_id:this._projectId,path_folder:null!==(a=e.folderId)&&void 0!==a?a:"",file_name:[e.name],force:t.permanent},{type:l.cM.Json});o.error&&this.handleError(o.error,"FileNotFound")}}async deleteItems(e,t){try{if(0===e.length)return{success:!0};const a=e.filter(e=>e.isFolder),r=e.filter(e=>!e.isFolder);if(a.length>0){const e=new Set(a.map(e=>e.id)),i=a.filter(t=>{var o;const l=null!==(o=t.folderId)&&void 0!==o?o:"";return!e.has(l)}).map(e=>e.id),r=await this._restApi.emFiles.folders_delete({project_id:this._projectId,path_folder:1===i.length?i[0]:i,force:t.permanent},{type:l.cM.Json});if(r.error&&!this.isPathFolderNotFound(r.error))return{success:!1,error:this.convertRestError(r.error)};for(const t of a)try{var o;await this.clearCache(null!==(o=t.folderId)&&void 0!==o?o:void 0)}catch{}}if(r.length>0){const e=new Map;for(const t of r){var i;const o=null!==(i=t.folderId)&&void 0!==i?i:"";e.has(o)||e.set(o,[]),e.get(o).push(t)}for(const[o,i]of e){const e=await this._restApi.emFiles.files_delete({project_id:this._projectId,path_folder:o,file_name:i.map(e=>e.name),force:t.permanent},{type:l.cM.Json});if(e.error)return{success:!1,error:this.convertRestError(e.error)}}}return{success:!0}}catch(a){return{success:!1,error:a}}}async createFolder(e,t,o){const{__:i}=this.i18n;if(!e)throw new n.FileManagerApiError(i("Folder name is required"),"FolderInvalidName");const a=await this._restApi.emFiles.folders_create({name:e,project_id:this._projectId,path_folder:t,is_force_create:o},{type:l.cM.Json});return a.error&&this.handleError(a.error),{id:this.removePrefix(a.data.full_path),name:a.data.name,folderId:this.removePrefix(a.data.parent_folder),childrenCount:a.data.files_count|a.data.folders_count,isFolder:!0}}async _uploadFile(e){var t;const{__:o}=this.i18n;if(!e.name||!e.data)throw new n.FileManagerApiError(o("Invalid file data"),"ValidationError");const i=await this._restApi.emFiles.files_create({file:e.data instanceof File?e.data:new File([e.data],e.name,{type:e.type}),path_folder:e.folderId,project_id:this._projectId},{type:l.cM.FormData});i.error&&this.handleError(i.error);const a=i.data instanceof Array?i.data[0]:i.data;if(!a)throw new n.FileManagerApiError(o("File upload failed"),"ValidationError");return{...a,id:this.removePrefix(a.folder)+"/"+a.name,size:Number(a.size),folderId:this.removePrefix(a.folder),date:a.date||(new Date).toISOString(),selected:!1,isFolder:!1,thumbnail:null===(t=a.thumbnail)||void 0===t?void 0:t["400x400"]}}async uploadFiles(e){try{const t=e.items.map(e=>{if(e.data instanceof File)return e.data;const t=e.name||"file",o=e.data.type||e.type||"application/octet-stream";return new File([e.data],t,{type:o})}),o=await this._restApi.emFiles.files_create({project_id:this._projectId,path_folder:e.folderId,file:t},{type:l.cM.FormData});if(o.error)return{success:!1,error:this.convertRestError(o.error)};const i=Array.isArray(o.data)?o.data:[o.data];return{success:!0,detailed:i.map(e=>{var t;return{success:!0,data:{id:[this.removePrefix(e.folder),e.name].filter(Boolean).join("/"),name:e.name,size:Number(e.size),folderId:this.removePrefix(e.folder),type:e.type,date:e.date||(new Date).toISOString(),selected:!1,isFolder:!1,thumbnail:null===(t=e.thumbnail)||void 0===t?void 0:t["400x400"]}}})}}catch(t){return{success:!1,error:t}}}async renameItem(e,t){const{__:o}=this.i18n;if(!t){const t=e.isFolder?"FolderInvalidName":"FileInvalidName",l=e.isFolder?o("New folder name is required"):o("New file name is required");throw new n.FileManagerApiError(l,t)}const[i,a]=p(e.id),r=await this._restApi.emFiles.files_rename_partial_update({file_name:a,new_name:t,path_folder:i,project_id:this._projectId,is_folder:e.isFolder},{type:l.cM.Json});r.error&&this.handleError(r.error);const d=r.data;return{id:this.removePrefix(d.folder)+"/"+d.name,name:d.name,folderId:this.removePrefix(d.folder)}}async moveItems(e,t){try{const o=e.map(e=>p(e.id)),i=await this._restApi.emFiles.items_move_partial_update({file_name:o.map(e=>e[1]),target_folder:t,path_folder:o[0][0],project_id:this._projectId},{type:l.cM.Json});if(i.error)return{success:!1,error:this.convertRestError(i.error)};const a=i.data;return{success:!0,detailed:a.results.map(e=>({success:e.success,error:this.convertRestError(e.error),data:{id:[this.removePrefix(e.new_path||""),e.item_name].filter(e=>e).join("/")}}))}}catch(o){this.convertRestError(o);return{success:!1,error:o}}}async copyItems(e,t){try{const o=e.map(e=>p(e.id)),i=await this._restApi.emFiles.items_move_partial_update({file_name:o.map(e=>e[1]),target_folder:t,path_folder:o[0][0],project_id:this._projectId,is_copy:!0},{type:l.cM.Json});if(i.error)return{success:!1,error:this.convertRestError(i.error)};const a=i.data;return{success:!0,detailed:a.results.map((t,o)=>({success:t.success,error:this.convertRestError(t.error),requestId:e[o].id,data:{id:[this.removePrefix(t.new_path||""),t.item_name].filter(e=>e).join("/")}}))}}catch(o){return{success:!1,error:this.convertRestError(o)}}}async uploadFileByUrl(e,t,o){const r=(0,i.o)(e);try{var n;if(r.startsWith("http://localhost")||r.startsWith("https://localhost")||null!==(n=this.appConfig)&&void 0!==n&&n.resourceProxy||this.isStandalone){const e=await(await(0,s.Be)(r,{config:this.appConfig,standalone:this.isStandalone,resourceType:"imageStock"===(null===o||void 0===o?void 0:o.eventSource)?"stockImages":"generic",intent:"downloadBlob"})).blob();return this._uploadFile({name:r.split("/").pop()||"file",size:e.size,folderId:t,data:e,type:a.A.getType(r)||"application/octet-stream"})}const e=await this._restApi.emFiles.files_upload_by_url_create({url:r,path_folder:t,project_id:this._projectId},{type:l.cM.Json});e.error&&this.handleError(e.error);const i=e.data instanceof Array?e.data[0]:e.data;return{id:`${this.removePrefix(i.folder)}/${i.name}`,name:i.name,size:Number(i.size),type:i.type,folderId:this.removePrefix(i.folder)||null,date:i.date||(new Date).toISOString(),url:i.url}}catch(d){throw d}}async updateFile(e,t){const[o,i]=p(e.id),a=await this._restApi.emFiles.files_partial_update({file_name:i,project_id:this._projectId,path_folder:o,updates:{data:"string"===typeof t.data?t.data:await(r=t.data,new Promise((e,t)=>{const o=new FileReader;o.onload=()=>{const t=o.result.toString().split(",")[1];e(t)},o.onerror=t,o.readAsDataURL(r)})),name:t.name}},{type:l.cM.Json});var r;if(!a.error){var n;const e=a.data;return{...e,id:`${this.removePrefix(e.folder)}/${e.name}`,size:Number(e.size),folderId:this.removePrefix(e.folder),date:e.date||(new Date).toISOString(),thumbnail:null===(n=e.thumbnail)||void 0===n?void 0:n["400x400"],selected:!1}}this.handleError(a.error)}findFileByUrl(e,t){const o=(0,s.no)(e,this.appConfig),l=(0,s.hs)(this.appConfig,[]);if(l&&(0,d.Ay)(o).startsWith((0,d.Ay)(l))){const e=o.replace((0,d.Ay)(l)+"/","").split("/").filter(Boolean);if(e[0]===this._projectId){const l=this.removePrefix(e.slice(1,-1).join("/")),i=e[e.length-1];if(!t||l===this.removePrefix(t))return{id:[l,i].filter(Boolean).join("/"),name:i,folderId:l,isFolder:!1,url:o}}}}async clearCache(e){const t={project_id:this._projectId,path_folder:e||void 0},o=await this._restApi.emFiles.cache_clear_create(t);o.error&&this.handleError(o.error)}async cleanTrash(){try{var e,t;const o=await this._restApi.emFiles.empty_trash_create({project_id:this._projectId},{type:l.cM.UrlEncoded});o.error&&this.handleError(o.error,"BackendError");const i=o.data;return{success:null===(e=null===i||void 0===i?void 0:i.success)||void 0===e||e,deletedCount:null!==(t=null===i||void 0===i?void 0:i.deleted_count)&&void 0!==t?t:0}}catch(o){if(o instanceof n.FileManagerApiError)throw o;const{__:e}=this.i18n;throw new n.FileManagerApiError(e("Failed to clean trash"),"BackendError")}}}var h=o(48867),b=o(12371);function f({storageProvider:e,projectId:t,restApi:o,i18n:l,pathPostfix:i,appConfig:a,isStandalone:r}){var n,d;const s=null===a||void 0===a?void 0:a.fileManager,m=s?{...s,enablePagination:!1===s.enablePagination?Boolean(s.clientSidePaging):s.enablePagination}:void 0,c=e||new g({projectId:t,restApi:o,i18n:l,pathPostfix:i,appConfig:a,isStandalone:r}),u=c.pathMode?new b.T(c,null!==(n=c.rootId)&&void 0!==n?n:"","Trash",c.trashPath,!0,l):null;return{storageProvider:c,pathProxy:u,dataProvider:new h.w(null!==u&&void 0!==u?u:c,m,{...c,trashPath:c.pathMode?"trash":c.trashPath,rootId:c.pathMode?"":null!==(d=c.rootId)&&void 0!==d?d:"",resourceProxyConfig:a,isStandalone:r},l)}}},96553:(e,t,o)=>{o.d(t,{A:()=>g});var l=o(1936),i=o(69962),a=o(96040),r=o(57549),n=o(47706),d=o(52898),s=o(68069),m=o(40867),c=o(7714),u=o(68876),p=o(93506);const g=({emailElementType:e,isSelectedElement:t=!1,selectedElement:o={parent:!1}})=>{var g,h,b,f,v,_,E,S,y;const{__:w}=(0,n.s9)(),k=(0,i.wA)(),B=(0,c.XW)(),[R]=r.lV.useForm(),x=(0,l.useRef)(),T=(0,l.useRef)(),I=(0,i.d4)(d.qX),A=(0,i.d4)(s.qX),C=(0,u.rD)(),N=o||(e===p.Tm?I:A),[P,L]=(0,l.useState)(null===(g=N.floatBlocks)||void 0===g?void 0:g.wrap),[F,O]=(0,l.useState)(null===(h=N.floatBlocks)||void 0===h?void 0:h.dirRevers),[V,M]=(0,l.useState)(null),[D,H]=(0,l.useState)(0),[z,W]=(0,l.useState)([]),U=(0,i.d4)(m.Ct),$=(0,l.useCallback)(t=>{k(e===p.Tm?(0,d.A9)(t):(0,s.A9)(t))},[k,e]);(0,l.useEffect)(()=>{if(N&&"{}"!==JSON.stringify(N)&&R._init){var e,t,o,l,i;if(R.resetFields(),R.setFieldsValue({gap:null===(e=N.floatBlocks)||void 0===e?void 0:e.gap,gapMobile:null===(t=N.floatBlocks)||void 0===t?void 0:t.gapMobile,gapDim:"px",valign:null===(o=N.floatBlocks)||void 0===o?void 0:o.valign}),(null===(l=N.floatBlocks)||void 0===l?void 0:l.items.length)>0){var a;const r=N.floatBlocks.items.reduce((e,t)=>e+t.width,0),n=N.floatBlocks.items.map(e=>{var t;return null===(t=(e.width||0)/r*100)||void 0===t?void 0:t.toFixed(1)});function d(e,t){if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(e[o]!==t[o])return!1;return!0}H(r),d(n,z)||"gap"===N.changeKey||W(n),N.floatBlocks.items.forEach((e,t)=>R.setFieldsValue({["width-"+t]:e.width||0})),N.floatBlocks.items.length>=8?document.querySelector(".selected-element-panel__columns-settings__links__add").classList.add("noactive"):null!==(a=document.querySelector(".selected-element-panel__columns-settings__links__add"))&&void 0!==a&&a.classList.contains("noactive")&&document.querySelector(".selected-element-panel__columns-settings__links__add").classList.remove("noactive")}L(null===(i=N.floatBlocks)||void 0===i?void 0:i.wrap)}},[R,N,V,z]);let G=0;(null===(b=N.floatBlocks)||void 0===b?void 0:b.items.length)>0&&(G=N.floatBlocks.items.length);const j=(e,t)=>{Object.keys(t).forEach(t=>{if(t.includes("width")){const o=parseInt(t.match(/\d+/));R.setFieldsValue({[t]:e.items[o]})}})},[X,q]=(0,l.useState)(!1);(0,l.useEffect)(()=>{const e=()=>q(!0),t=()=>q(!1);return document.addEventListener("keyup",t),document.addEventListener("keydown",e),()=>{document.removeEventListener("keyup",t),document.removeEventListener("keydown",e)}},[]);const Y=e=>{const o=R.getFieldsValue(!0),l=N.floatBlocks.items.map(e=>e.width),i=N.floatBlocks.gap||20,a=e.cols-l.length;let r=[],n=l.reduce((e,t)=>e+t,0);e.cols>=l.length?n-=i*a:n+=i*Math.abs(a);const d=Math.round(n/e.cols);r=function(t,o){const l=[];for(let r=0;r<t;r++){var i,a;l.push(null!==(i=e.width)&&void 0!==i&&i[r]?Math.round(n/100*(null===(a=e.width)||void 0===a?void 0:a[r])):o)}return l}(e.cols,d);const s=n-r.reduce((e,t)=>e+t,0);if(0!==s){let e=r.map((e,t)=>[t,e]).filter(e=>e[1]>30);const t=e.length-Math.abs(s);e=e.map((e,o)=>{const l=t<=o?e[1]+(s>0?1:-1):e[1];return[e[0],l]}),e.map(e=>(r[e[0]]=e[1],e))}let m={items:r,gap:o.gap||20};const c=r.reduce((e,t)=>e+t,0);W(r.map(e=>{var t;return null===(t=e/c*100)||void 0===t?void 0:t.toFixed(1)})),B({operation:p.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksPreset",settings:m,editFromStructure:!!document.querySelector(".selected-element-panel__columns-settings__links__add").closest(".selected-element-panel")}),$({...N,activateSection:t?void 0:"structure",floatBlocks:{...N.floatBlocks,...m,items:m.items.map((e,t)=>({width:e,current:!1}))},changeKey:"width"})},K=e=>{const o=R.getFieldsValue(!0);let l=0;document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").forEach((t,o)=>{t===e.target.closest(".selected-element-panel__columns-settings__controls__column")&&(l=o)});const i=+N.floatBlocks.gap,a=+N.floatBlocks.items[l].width+i,r=N.floatBlocks.items.map(e=>+e.width),n=(r.length-1)*i,d=r.reduce((e,t)=>e+t,0)+n,s=r.length-1,m=Math.floor(a/s);let c=r.filter((e,t)=>t!==l).map(e=>e+m);const u=d-(c.reduce((e,t)=>e+t,0)+(r.length-2)*i);if(0!==u){const e=c.length-Math.abs(u);c=c.map((t,o)=>e<=o?t+(u>0?1:-1):t)}B({operation:p.Ru.SANDBOX_FLOATBLOCK_REMOVE,settings:{removedBlockIndex:l,gap:o.gap},editFromStructure:!!document.querySelector(".selected-element-panel__columns-settings__links__add").closest(".selected-element-panel")}),$({...N,activateSection:t?void 0:"structure",floatBlocks:{...N.floatBlocks,items:c.map((e,t)=>({width:e,current:N.floatBlocks.items.filter((e,t)=>t!==l)[t].current}))},changeKey:"width"})};return N.floatBlocks&&N.floatBlocks.items.length>0&&l.createElement(r.lV,{layout:"vertical",form:R,name:"float_blocks_settings_form",autoComplete:"off",initialValues:{gap:(null===(f=N.floatBlocks)||void 0===f?void 0:f.gap)||0,gapDim:"px",gapMobile:(null===(v=N.floatBlocks)||void 0===v?void 0:v.gapMobile)||0,valign:(null===(_=N.floatBlocks)||void 0===_?void 0:_.valign)||"top",...null===(E=N.floatBlocks)||void 0===E?void 0:E.items.reduce((e,{width:t},o)=>(e[`width-${o}`]=t,e),{})},onValuesChange:e=>{T.current&&X&&clearTimeout(T.current),T.current=setTimeout(()=>function(e){const o=R.getFieldsValue(!0),l=Object.keys(e)[0];if(M(l),l.includes("width")){if(o[l]&&o[l]>=30){let i={items:[],gap:o.gap,valign:o.valign,activateSection:t?void 0:"structure"},a=0;if(document.querySelectorAll(".selected-element-panel__columns-settings__controls__column").length>1){a=parseFloat(Object.keys(e)[0].substring(Object.keys(e)[0].length-1));const t=o["width-"+(a+1)]?a+1:0;let l=D;Object.keys(o).forEach(e=>{e.includes("width")&&-1===e.indexOf("width-"+t)&&(l-=o[e])}),o["width-"+t]=l}Object.keys(o).forEach(e=>{e.includes("width")&&i.items.push(o[e])}),B({operation:p.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:i}),$({...N,activateSection:t?void 0:"structure",floatBlocks:{...N.floatBlocks,...i,items:N.floatBlocks.items.map((e,t)=>({...N.floatBlocks.items[t],width:i.items[t]}))},changeKey:l})}}else if("gap"===l){const i={items:N.floatBlocks.items.map(e=>e.width),gap:N.floatBlocks.gap},a=i.items.reduce((e,t)=>e+t,0)+(i.items.length-1)*i.gap,r=o.gap,n=a-(i.items.length-1)*r;if(n>30*i.items.length||N.floatBlocks.gap-e>=0){const e=(e,t)=>Math.round(t*e/100);let d=i.items.map((t,o)=>e(z[o],n));const s=a-(d.reduce((e,t)=>e+t,0)+(i.items.length-1)*r);if(0!==s){const e=d.length-Math.abs(s);d=d.map((t,o)=>e<=o?t+(s>0?1:-1):t)}let m={items:d,gap:r||0};j(m,o),B({operation:p.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGap",settings:m,editFromStructure:!!document.querySelector(".selected-element-panel__columns-settings__links__add").closest(".selected-element-panel")}),$({...N,activateSection:t?void 0:"structure",floatBlocks:{...N.floatBlocks,...m,items:N.floatBlocks.items.map((e,t)=>({...e,width:m.items[t]}))},changeKey:l})}}else if("valign"===l){let e={valign:o.valign};B({operation:p.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksValign",settings:e,editFromStructure:!!document.querySelector(".selected-element-panel__columns-settings__links__add").closest(".selected-element-panel")}),$({...N,activateSection:t?void 0:"structure",floatBlocks:{...N.floatBlocks,...e},changeKey:l})}else if("gapMobile"===l){let o={mobileHeight:{classNamePrefix:"em-mob-height-",value:e[l],dim:"px"}};B({operation:p.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksGapMobile",settings:o}),$({...N,activateSection:t?void 0:"structure",floatBlocks:{...N.floatBlocks,gapMobile:o.mobileHeight.value},changeKey:l})}setTimeout(()=>(null===x||void 0===x?void 0:x.current)&&x.current.focus({cursor:"end"}),600)}(e),50)},onFieldsChange:()=>setTimeout(()=>(null===x||void 0===x?void 0:x.current)&&x.current.focus({cursor:"end"}),300),className:"element-controls"},l.createElement("div",{className:"selected-element-panel__columns-settings",style:{paddingTop:C.switchDesktopMobilePropsEnabled||C.stepToOtherElementEnabled||C.deleteButtonEnabled||"structure"===N.type?0:24}},1===N.floatBlocks.items.length&&l.createElement(r.Fc,{style:{marginBottom:10},message:w('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"}),U!==p.ND&&l.createElement(l.Fragment,null,l.createElement("div",{className:"selected-element-panel__columns-settings__header"},l.createElement("span",{className:"selected-element-panel__columns-settings__header-title"},w("Columns")),l.createElement("div",{className:"selected-element-panel__columns-settings__links"},l.createElement("span",{className:"selected-element-panel__columns-settings__links__add",onClick:()=>{const e=R.getFieldsValue(!0);if(G<8){const o=N.floatBlocks.items.map(e=>e.width),l=N.floatBlocks.gap,i=o.reduce((e,t)=>e+(t>30?t:0),0),a=(i-30-l)/i,r=o.map(e=>e>30?Math.round(e*a):e).reduce((e,t)=>e+(t>30?t:0),0);let n=o.map(e=>e>30?Math.round(e*a):e);n.push(30);const d=i-r-30-l;if(0!==d){let e=n.map((e,t)=>[t,e]).filter(e=>e[1]>30);const t=e.length-Math.abs(d);e=e.map((e,o)=>{const l=t<=o?e[1]+(d>0?1:-1):e[1];return[e[0],l]}),e.map(e=>(n[e[0]]=e[1],e))}B({operation:p.Ru.SANDBOX_FLOATBLOCK_ADD,settings:{gap:e.gap,gapMobile:e.gapMobile,minWidth:30},editFromStructure:!!document.querySelector(".selected-element-panel__columns-settings__links__add").closest(".selected-element-panel")}),$({...N,activateSection:t?void 0:"structure",floatBlocks:{...N.floatBlocks,items:n.map((e,t)=>{var o;return{width:e,current:(null===(o=N.floatBlocks.items[t])||void 0===o?void 0:o.current)||!1}})},changeKey:"width"})}else document.querySelector(".selected-element-panel__columns-settings__links__add").classList.add("noactive")}},l.createElement(a.Ay,{icon:"PlusCircleOutlined",size:16,strokeWidth:C.iconStrokeWidth})," ",w("Add column")),N.floatBlocks.items.length>1&&l.createElement("span",{onClick:()=>{const e=R.getFieldsValue(!0),o=N.floatBlocks.items.map(e=>e.width);let l={items:[],gap:e.gap};const i=o.reduce((e,t)=>e+t,0),a=o.length,r=Math.ceil(D/a)*a,n=r/a,d=i-r;if(l.items=Array(a).fill(n),0!==d){const e=o.length-Math.abs(d);l.items=l.items.map((t,o)=>e<=o?t+(d>0?1:-1):t)}j(l,e),B({operation:p.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:"floatBlocksWidths",settings:l,editFromStructure:!!document.querySelector(".selected-element-panel__columns-settings__links__add").closest(".selected-element-panel")}),$({...N,activateSection:t?void 0:"structure",floatBlocks:{...N.floatBlocks,...l,items:N.floatBlocks.items.map((e,t)=>({...e,width:l.items[t]}))},changeKey:"width"})}},l.createElement(r.m_,{title:w("Make columns the same width.")},l.createElement(a.Ay,{icon:"ColumnWidthOutlined"})," ",w("Equalize"))))),N.floatBlocks.items.length>1&&l.createElement(r.lV.Item,{style:{marginBottom:16}},l.createElement("div",{className:"selected-element-panel__columns-settings__controls"},N.floatBlocks.items.map((e,t)=>l.createElement("div",{key:"floatblock-"+t,className:"selected-element-panel__columns-settings__controls__column "+(e.current?"current":""),style:{width:e.width/D*100+"%"}},N.floatBlocks.items.length>1&&l.createElement("span",{className:"selected-element-panel__columns-settings__controls__column__remove",onClick:K},l.createElement(a.Ay,{icon:"DeleteOutlined",style:{color:"#ff4d4f"}})),l.createElement("div",{className:"selected-element-panel__columns-settings__controls__field"},l.createElement(r.lV.Item,{label:"",name:"width-"+t},l.createElement(r.YI,{min:30,value:e.width||0,placeholder:w("Width"),ref:V==="width-"+t&&x}))))))),l.createElement("div",{className:"columns-presets"},l.createElement(r.$n,{onClick:()=>{Y({cols:1})}},l.createElement(a.Ay,{icon:"LayoutCol1"})),l.createElement(r.$n,{onClick:()=>{Y({cols:2})}},l.createElement(a.Ay,{icon:"LayoutCol2"})),l.createElement(r.$n,{onClick:()=>{Y({cols:2,width:[66,34]})}},l.createElement(a.Ay,{icon:"LayoutCol2WideLeft"})),l.createElement(r.$n,{onClick:()=>{Y({cols:2,width:[34,66]})}},l.createElement(a.Ay,{icon:"LayoutCol2WideRight"})),l.createElement(r.$n,{onClick:()=>{Y({cols:3})}},l.createElement(a.Ay,{icon:"LayoutCol3"})),l.createElement(r.$n,{onClick:()=>{Y({cols:4})}},l.createElement(a.Ay,{icon:"LayoutCol4"})))),N.floatBlocks.items.length>1&&l.createElement(l.Fragment,null,U===p.ND&&l.createElement("div",{style:{marginBottom:24}},l.createElement(r.dO,{id:"column-wrap",label:w("Line break on mobile devices"),size:"small",disabled:void 0===(null===(S=N.floatBlocks)||void 0===S?void 0:S.wrap),checked:P,onChange:e=>{L(e),B({operation:p.Ru.SANDBOX_FLOATBLOCK_WRAP,settings:{wrap:!P}}),$({...N,activateSection:t?void 0:"structure",floatBlocks:{...N.floatBlocks,wrap:!P},changeKey:"wrap"})},labelStyle:{position:"relative",top:2}})),U!==p.ND&&l.createElement("div",{style:{marginBottom:24}},l.createElement(r.dO,{id:"column-dir-revers",label:w("Reverse order on desktop"),size:"small",disabled:void 0===(null===(y=N.floatBlocks)||void 0===y?void 0:y.wrap),checked:F,onChange:e=>{O(e),B({operation:p.Ru.SANDBOX_FLOATBLOCK_DIR,settings:{dirRevert:!F}}),$({...N,activateSection:t?void 0:"structure",floatBlocks:{...N.floatBlocks,dirRevert:!F},changeKey:"dir"})},labelStyle:{position:"relative",top:2}}))),N.floatBlocks.items.length>1&&l.createElement(l.Fragment,null,l.createElement(r.cG,{className:"selected-td-form__divider"}),l.createElement(r.fI,{gutter:10},l.createElement(r.fv,{span:12},l.createElement(r.y9,{title:w("Vertical alignment"),titleStyle:{paddingTop:20}},l.createElement(r.lV.Item,{name:"valign",style:{marginBottom:0}},l.createElement(r.VX,{disabled:N.floatBlocks.items.length<=1,strokeWidth:C.iconStrokeWidth,labels:{alignTop:w("Align top"),alignMiddle:w("Center vertically"),alignBottom:w("Align bottom")}})))),l.createElement(l.Fragment,null,U!==p.ND&&l.createElement(r.fv,{span:12},l.createElement(r.y9,{title:w("Indent between columns"),titleStyle:{paddingTop:20}},l.createElement(r.lV.Item,{name:"gap",style:{marginBottom:20}},l.createElement(r.FQ,{min:0,disabled:N.floatBlocks.items.length<=1,placeholder:w("Indent between columns"),prefix:l.createElement(a.Ay,{icon:"ColumnWidthOutlined"}),addonAfter:"px",ref:"gap"===V&&x})))),U===p.ND&&l.createElement(r.fv,{span:12},l.createElement(r.y9,{title:w("Indent in mobile"),titleStyle:{paddingTop:20}},l.createElement(r.lV.Item,{name:"gapMobile",style:{marginBottom:20}},l.createElement(r.FQ,{min:0,disabled:N.floatBlocks.items.length<=1,placeholder:w("Indent in mobile"),prefix:l.createElement(a.Ay,{icon:"ColumnHeightOutlined"}),addonAfter:"px"})))))))))}},7729:(e,t,o)=>{o.d(t,{A:()=>k});var l=o(1936),i=o(69962),a=o(57549),r=o(47706),n=o(68876),d=o(43284),s=o(71461),m=o(40867),c=o(52898),u=o(93506),p=o(57546);const g="calendar_",h=`${g}borderRadiusAll`,b=`${g}borderRadiusTopLeft`,f=`${g}borderRadiusTopRight`,v=`${g}borderRadiusBottomLeft`,_=`${g}borderRadiusBottomRight`,E="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",S=e=>e.closest(".email-pane__collapse-wrapper")||e.closest(".email-pane__content-col")||document.body;function y({namePrefix:e,microLabel:t}){const{__:o}=(0,r.s9)(),n=(0,i.d4)(c.uJ),s=null===n||void 0===n?void 0:n.usedColors;return l.createElement(a.H6,{namePrefix:e,microLabel:t,usedColors:s,usedLabel:o("Used"),recommendedLabel:o("Recommended"),loadGoogleFonts:d.c,getPopupContainer:S,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 w(){const e=a.lV.useWatch("inactiveDateBg"),t=a.lV.useWatch("activeDateBg"),o=a.lV.useWatch("inactiveColor"),i=a.lV.useWatch("activeColor"),r=a.lV.useWatch("inactiveFontFamily"),n=a.lV.useWatch("activeFontFamily"),d=a.lV.useWatch("inactiveFontSize"),s=a.lV.useWatch("activeFontSize"),m=a.lV.useWatch("inactiveTextStrong"),c=a.lV.useWatch("activeTextStrong");return l.createElement("div",{className:"form-editor-calendar__bg-preview","aria-hidden":!0},l.createElement("span",{className:"form-editor-calendar__bg-chip",style:{background:e,color:o,fontFamily:r,fontSize:d,fontWeight:m?700:400}},"31"),l.createElement("span",{className:"form-editor-calendar__bg-chip form-editor-calendar__bg-chip--active",style:{background:t,color:i,fontFamily:n,fontSize:s,fontWeight:c?700:400}},"15"))}const k=()=>{const{__:e}=(0,r.s9)(),t=(0,i.wA)(),o=(0,n.rD)(),[d]=a.lV.useForm(),[c,S]=(0,l.useState)(!1),[k,B]=(0,l.useState)(!0),R=(0,l.useMemo)(()=>({placeholder:"",valueMode:void 0,dateFormat:"24h",required:!1,inactiveDateBg:"#ffffff",activeDateBg:"#01bca6",inactiveFontFamily:E,inactiveFontSize:19,inactiveLineHeight:24,inactiveColor:"#333333",inactiveTextStrong:!1,inactiveTextItalic:!1,inactiveTextStrikethrough:!1,inactiveTextUnderline:!1,activeFontFamily:E,activeFontSize:19,activeLineHeight:24,activeColor:"#ffffff",activeTextStrong:!0,activeTextItalic:!1,activeTextStrikethrough:!1,activeTextUnderline:!1,[`${g}borderPosition`]:`${g}borderAll`,[`${g}borderAll`]:{width:1,style:"solid",color:"#ffffff"},[`${g}borderTop`]:{...p.RH},[`${g}borderBottom`]:{...p.RH},[`${g}borderRight`]:{...p.RH},[`${g}borderLeft`]:{...p.RH},[h]:5,[b]:null,[f]:null,[v]:null,[_]:null}),[]),x=(0,l.useCallback)(()=>{t((0,m.PM)(u.Bv))},[t]),T=(0,l.useCallback)(()=>{const e=d.getFieldsValue(!0);if(k){var t;const o=null!==(t=e[h])&&void 0!==t?t:0;d.setFieldsValue({[b]:o,[f]:o,[v]:o,[_]:o})}else{const t=e[b];t===e[f]&&t===e[v]&&t===e[_]?d.setFieldsValue({[h]:t}):d.setFieldsValue({[b]:null,[f]:null,[v]:null,[_]:null})}B(e=>!e)},[d,k]),I=[{value:"24h",label:e("24 hours")},{value:"12h",label:e("12 hours")},{value:"DDMMYYYY",label:"DD.MM.YYYY"},{value:"YYYYMMDD",label:"YYYY-MM-DD"}],A=[{value:"empty",label:e("Enter value")},{value:"today",label:e("Today")},{value:"custom",label:e("Custom")}],C=l.createElement(l.Fragment,null,l.createElement(a.m_,{title:e("Remove"),placement:"bottom"},l.createElement(a.$n,{type:"text",icon:l.createElement(a.HQ,{icon:"DeleteOutlined",size:18,strokeWidth:o.iconStrokeWidth})})),l.createElement(a.m_,{title:e("Link"),placement:"bottom"},l.createElement(a.$n,{type:"text",icon:l.createElement(a.HQ,{icon:"LinkOutlined",size:18,strokeWidth:o.iconStrokeWidth})}))),N=l.createElement("div",{className:"form-editor-calendar-panel__inner"},l.createElement(a.lV,{form:d,layout:"vertical",className:"element-controls form-editor-calendar",autoComplete:"off",initialValues:R},l.createElement(a.lV.Item,{name:"placeholder",label:e("Placeholder")},l.createElement(a.pd,{placeholder:e("Text visible at the start"),allowClear:!0})),l.createElement(a.lV.Item,{name:"valueMode",label:l.createElement("span",{className:"form-editor-calendar__label-with-info"},e("Value"),l.createElement(a.m_,{title:e("Default or bound value for the field")},l.createElement("span",{className:"form-editor-calendar__info-icon"},l.createElement(a.HQ,{icon:"InfoCircleOutlined",size:16}))))},l.createElement(a.Select,{className:"form-editor-calendar__full-width",placeholder:e("Enter value"),options:A,allowClear:!0})),l.createElement(a.lV.Item,{name:"dateFormat",label:e("Date format")},l.createElement(a.Select,{className:"form-editor-calendar__full-width",options:I})),l.createElement(a.Pr,{name:"required",label:e("Required field")}),l.createElement(a.cG,{className:"form-editor-calendar__section-divider"}),l.createElement(a.$n,{type:c?"primary":"default",block:!0,className:"form-editor-calendar__more-btn",icon:l.createElement(a.HQ,{icon:"SettingOutlined",size:16}),onClick:()=>S(e=>!e)},e(c?"Fewer settings":"More settings")),c&&l.createElement("div",{className:"form-editor-calendar__expanded"},l.createElement(a.y9,{className:"form-editor-calendar__section",title:e("Background")},l.createElement(a.$x,{direction:"vertical",size:20,className:"form-editor-calendar__full-width"},l.createElement(a.eZ,{name:"inactiveDateBg",label:e("Inactive date background color")}),l.createElement(a.eZ,{name:"activeDateBg",label:e("Active date background color")}),l.createElement(w,null))),l.createElement(a.y9,{className:"form-editor-calendar__section",title:e("Input field text")},l.createElement("div",{className:"form-editor-calendar__typography-stack"},l.createElement(y,{namePrefix:"inactive",microLabel:e("Inactive date font")}),l.createElement(y,{namePrefix:"active",microLabel:e("Active date font")}))),l.createElement(a.y9,{className:"form-editor-calendar__section",title:e("Border radius"),collapsible:!0,defaultOpen:!0},l.createElement(a.sQ,{namePrefix:g,typeOfForm:"desktop",oneBorderRadiusValue:k,onToggle:T,borderRadiusIcon:l.createElement(a.HQ,{icon:"RadiusUpleftOutlined",className:"selected-td-form__icon-radius"}),labels:{borderRadius:e("Border radius"),topLeft:e("Top left corner"),topRight:e("Top right corner"),bottomLeft:e("Bottom left corner"),bottomRight:e("Bottom right corner")}})),l.createElement(a.y9,{className:"form-editor-calendar__section",title:e("Border")},l.createElement(s.A,{form:d,namePrefix:g})))));return l.createElement(a.T8,{className:"form-editor-calendar-panel"},l.createElement(a.T8.Header,{onClose:x,closeIcon:l.createElement(a.HQ,{icon:"Close",size:24,strokeWidth:o.iconStrokeWidth}),extra:C},l.createElement(a.T8.HeaderTitle,{className:"form-editor-calendar-panel__title"},e("Calendar"))),l.createElement(a.T8.Body,{className:"form-editor-calendar-panel__body",padding:{horizontal:0,vertical:0}},N))}},43752:(e,t,o)=>{o.d(t,{A:()=>T});var l=o(1936),i=o(6056),a=o.n(i),r=o(69962),n=o(57549),d=o(47706),s=o(68876),m=o(43284),c=o(71461),u=o(40867),p=o(52898),g=o(93506),h=o(57546);const b="checkbox_",f=`${b}borderRadiusAll`,v=`${b}borderRadiusTopLeft`,_=`${b}borderRadiusTopRight`,E=`${b}borderRadiusBottomLeft`,S=`${b}borderRadiusBottomRight`,y=e=>e.closest(".email-pane__collapse-wrapper")||e.closest(".email-pane__content-col")||document.body;function w({namePrefix:e,microLabel:t}){const{__:o}=(0,d.s9)(),i=(0,r.d4)(p.uJ),a=null===i||void 0===i?void 0:i.usedColors;return l.createElement(n.H6,{namePrefix:e,microLabel:t,usedColors:a,usedLabel:o("Used"),recommendedLabel:o("Recommended"),loadGoogleFonts:m.c,getPopupContainer:y,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 k(){const{__:e}=(0,d.s9)(),t=n.lV.useWatch("markerShape"),o=n.lV.useWatch("appearanceBackground"),i=n.lV.useWatch("appearanceStrokeColor"),r=n.lV.useWatch("appearanceCheckColor"),s=n.lV.useWatch("useCustomCheckIcon"),m=a()("form-editor-checkbox__preview-checkbox","round"===t&&"form-editor-checkbox__preview-checkbox--round","square"===t&&"form-editor-checkbox__preview-checkbox--square");return l.createElement("div",{className:"form-editor-checkbox__bg-preview","aria-hidden":!0},l.createElement("div",{className:"form-editor-checkbox__preview-panel"},l.createElement("div",{className:"form-editor-checkbox__preview-row"},l.createElement("span",{className:m,style:{borderColor:i,background:r}},!s&&l.createElement(n.HQ,{icon:"CheckOutlined",size:10,style:{color:"#ffffff"}})),l.createElement("span",{className:"form-editor-checkbox__preview-label"},e("Checked"))),l.createElement("div",{className:"form-editor-checkbox__preview-row"},l.createElement("span",{className:m,style:{borderColor:i,background:o}}),l.createElement("span",{className:"form-editor-checkbox__preview-label"},e("Unchecked")))))}function B(){const{__:e}=(0,d.s9)(),t=n.lV.useWatch("useCustomCheckIcon");return l.createElement(l.Fragment,null,l.createElement(n.lV.Item,{name:"markerShape",label:e("Marker shape")},l.createElement(n.sx.Group,{className:"form-editor-checkbox__shape-radios"},l.createElement(n.sx,{value:"round"},e("Round")),l.createElement(n.sx,{value:"square"},e("Square")))),l.createElement(n.cG,{className:"form-editor-checkbox__inner-section-divider"}),l.createElement(n.$x,{direction:"vertical",size:16,className:"form-editor-checkbox__full-width"},l.createElement(n.eZ,{name:"appearanceBackground",label:e("Background color")}),l.createElement(n.eZ,{name:"appearanceStrokeColor",label:e("Stroke color")}),l.createElement(n.eZ,{name:"appearanceCheckColor",label:e("Checked fill color")})),l.createElement(n.Pr,{name:"useCustomCheckIcon",label:e("Use custom icon for checked state")}),t&&l.createElement(n.lV.Item,{name:"customCheckIconUrl",label:e("Checked icon URL")},l.createElement(n.pd,{placeholder:"https://",allowClear:!0})),l.createElement(k,null))}function R(){const{__:e}=(0,d.s9)(),t=(0,s.rD)().iconStrokeWidth;return l.createElement(n.y9,{className:"form-editor-checkbox__section",title:e("Position in cell")},l.createElement("div",{className:"form-editor-checkbox__align-columns"},l.createElement("div",{className:"form-editor-checkbox__align-column"},l.createElement(n.Typography.Text,{type:"secondary",className:"form-editor-checkbox__micro-label"},e("Horizontal alignment")),l.createElement(n.lV.Item,{name:"alignHorizontal",className:"form-editor-checkbox__align-form-item"},l.createElement(n.sx.Group,{className:"form-editor-checkbox__icon-toggle-group"},l.createElement(n.sx.Button,{value:"left",title:e("Align left")},l.createElement(n.HQ,{icon:"AlignLeftOutlined",size:16,strokeWidth:t})),l.createElement(n.sx.Button,{value:"center",title:e("Align center")},l.createElement(n.HQ,{icon:"AlignCenterOutlined",size:16,strokeWidth:t})),l.createElement(n.sx.Button,{value:"right",title:e("Align right")},l.createElement(n.HQ,{icon:"AlignRightOutlined",size:16,strokeWidth:t}))))),l.createElement("div",{className:"form-editor-checkbox__align-column"},l.createElement(n.Typography.Text,{type:"secondary",className:"form-editor-checkbox__micro-label"},e("Vertical alignment")),l.createElement(n.lV.Item,{name:"alignVertical",className:"form-editor-checkbox__align-form-item"},l.createElement(n.sx.Group,{className:"form-editor-checkbox__icon-toggle-group"},l.createElement(n.sx.Button,{value:"top",title:e("Align top")},l.createElement(n.HQ,{icon:"AlignVerticalTop",size:16,strokeWidth:t})),l.createElement(n.sx.Button,{value:"middle",title:e("Align middle")},l.createElement(n.HQ,{icon:"AlignVerticalCenter",size:16,strokeWidth:t})),l.createElement(n.sx.Button,{value:"bottom",title:e("Align bottom")},l.createElement(n.HQ,{icon:"AlignVerticalBottom",size:16,strokeWidth:t})))))))}function x(){const{__:e}=(0,d.s9)();return n.lV.useWatch("showHelperText")?l.createElement(l.Fragment,null,l.createElement(n.lV.Item,{name:"helperText",label:e("Helper text")},l.createElement(n.pd.TextArea,{rows:2,placeholder:e("Tooltip or hint text"),allowClear:!0})),l.createElement(n.lV.Item,{name:"validationErrorText",label:e("Validation error message")},l.createElement(n.pd.TextArea,{rows:2,placeholder:e("Message when validation fails"),allowClear:!0}))):null}const T=()=>{const{__:e}=(0,d.s9)(),t=(0,r.wA)(),o=(0,s.rD)(),[i]=n.lV.useForm(),[a,m]=(0,l.useState)(!1),[p,k]=(0,l.useState)(!0),T=(0,l.useMemo)(()=>[{value:"v1",label:`${e("Value")} 1`},{value:"v2",label:`${e("Value")} 2`},{value:"custom",label:e("Custom")}],[e]),I=(0,l.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:"Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",labelTextFontSize:19,labelTextLineHeight:24,labelTextColor:"#333333",labelTextStrong:!1,labelTextItalic:!1,labelTextStrikethrough:!1,labelTextUnderline:!1,[`${b}borderPosition`]:`${b}borderAll`,[`${b}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${b}borderTop`]:{...h.RH},[`${b}borderBottom`]:{...h.RH},[`${b}borderRight`]:{...h.RH},[`${b}borderLeft`]:{...h.RH},[f]:5,[v]:null,[_]:null,[E]:null,[S]:null}),[]),A=(0,l.useCallback)(()=>{t((0,u.PM)(g.Bv))},[t]),C=(0,l.useCallback)(()=>{const e=i.getFieldsValue(!0);if(p){var t;const o=null!==(t=e[f])&&void 0!==t?t:0;i.setFieldsValue({[v]:o,[_]:o,[E]:o,[S]:o})}else{const t=e[v];t===e[_]&&t===e[E]&&t===e[S]?i.setFieldsValue({[f]:t}):i.setFieldsValue({[v]:null,[_]:null,[E]:null,[S]:null})}k(e=>!e)},[i,p]),N=l.createElement(l.Fragment,null,l.createElement(n.m_,{title:e("Remove"),placement:"bottom"},l.createElement(n.$n,{type:"text",icon:l.createElement(n.HQ,{icon:"DeleteOutlined",size:18,strokeWidth:o.iconStrokeWidth})})),l.createElement(n.m_,{title:e("Link"),placement:"bottom"},l.createElement(n.$n,{type:"text",icon:l.createElement(n.HQ,{icon:"LinkOutlined",size:18,strokeWidth:o.iconStrokeWidth})}))),P=l.createElement("div",{className:"form-editor-checkbox-panel__inner"},l.createElement(n.lV,{form:i,layout:"vertical",className:"element-controls form-editor-checkbox",autoComplete:"off",initialValues:I},l.createElement(n.lV.Item,{name:"fieldHeading",label:e("Field heading")},l.createElement(n.pd.TextArea,{rows:2,placeholder:e("Title shown above the control"),allowClear:!0})),l.createElement(n.lV.Item,{name:"boundValue",label:l.createElement("span",{className:"form-editor-checkbox__label-with-info"},e("Value"),l.createElement(n.m_,{title:e("Stored or bound value for this field")},l.createElement("span",{className:"form-editor-checkbox__info-icon"},l.createElement(n.HQ,{icon:"InfoCircleOutlined",size:12}))))},l.createElement(n.Select,{className:"form-editor-checkbox__full-width",placeholder:e("Enter value"),options:T,allowClear:!0,getPopupContainer:y})),l.createElement(n.lV.Item,{name:"checkboxLabel",label:e("Label next to checkbox")},l.createElement(n.pd,{placeholder:e("Text beside the box"),allowClear:!0})),l.createElement(n.Pr,{name:"required",label:e("Required field")}),l.createElement(n.lV.Item,{name:"defaultState",label:e("Default value")},l.createElement(n.sx.Group,{className:"form-editor-checkbox__default-radios"},l.createElement(n.sx,{value:"enabled"},e("Enabled")),l.createElement(n.sx,{value:"disabled"},e("Disabled")))),l.createElement(n.Pr,{name:"showHelperText",label:e("Helper text / tooltip")}),l.createElement(x,null),l.createElement(n.cG,{className:"form-editor-checkbox__section-divider"}),l.createElement(n.$n,{type:a?"primary":"default",block:!0,className:"form-editor-checkbox__more-btn",icon:l.createElement(n.HQ,{icon:"SettingOutlined",size:16}),onClick:()=>m(e=>!e)},e(a?"Fewer settings":"More settings")),a&&l.createElement("div",{className:"form-editor-checkbox__expanded"},l.createElement(R,null),l.createElement(n.y9,{className:"form-editor-checkbox__section",title:e("Appearance")},l.createElement(B,null)),l.createElement(n.y9,{className:"form-editor-checkbox__section",title:e("Label text style")},l.createElement(w,{namePrefix:"labelText",microLabel:e("Caption next to checkbox")})),l.createElement(n.y9,{className:"form-editor-checkbox__section",title:e("Border radius"),collapsible:!0,defaultOpen:!0},l.createElement(n.sQ,{namePrefix:b,typeOfForm:"desktop",oneBorderRadiusValue:p,onToggle:C,borderRadiusIcon:l.createElement(n.HQ,{icon:"RadiusUpleftOutlined",className:"selected-td-form__icon-radius"}),labels:{borderRadius:e("Border radius"),topLeft:e("Top left corner"),topRight:e("Top right corner"),bottomLeft:e("Bottom left corner"),bottomRight:e("Bottom right corner")}})),l.createElement(n.y9,{className:"form-editor-checkbox__section",title:e("Border")},l.createElement(c.A,{form:i,namePrefix:b})))));return l.createElement(n.T8,{className:"form-editor-checkbox-panel"},l.createElement(n.T8.Header,{onClose:A,closeIcon:l.createElement(n.HQ,{icon:"Close",size:24,strokeWidth:o.iconStrokeWidth}),extra:N},l.createElement(n.T8.HeaderTitle,{className:"form-editor-checkbox-panel__title"},e("Checkbox"))),l.createElement(n.T8.Body,{className:"form-editor-checkbox-panel__body",padding:{horizontal:0,vertical:0}},P))}},85878:(e,t,o)=>{o.d(t,{A:()=>w});var l=o(1936),i=o(69962),a=o(57549),r=o(47706),n=o(68876),d=o(43284),s=o(71461),m=o(40867),c=o(52898),u=o(93506),p=o(57546);const g="dropdown_",h=`${g}borderRadiusAll`,b=`${g}borderRadiusTopLeft`,f=`${g}borderRadiusTopRight`,v=`${g}borderRadiusBottomLeft`,_=`${g}borderRadiusBottomRight`,E=e=>e.closest(".email-pane__collapse-wrapper")||e.closest(".email-pane__content-col")||document.body;function S({namePrefix:e,microLabel:t}){const{__:o}=(0,r.s9)(),n=(0,i.d4)(c.uJ),s=null===n||void 0===n?void 0:n.usedColors;return l.createElement(a.H6,{namePrefix:e,microLabel:t,usedColors:s,usedLabel:o("Used"),recommendedLabel:o("Recommended"),loadGoogleFonts:d.c,getPopupContainer:E,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 y(){const{__:e}=(0,r.s9)(),t=a.lV.useWatch("triggerBackground"),o=a.lV.useWatch("listPanelBackground"),i=a.lV.useWatch("arrowColor");return l.createElement("div",{className:"form-editor-dropdown__bg-preview","aria-hidden":!0},l.createElement("div",{className:"form-editor-dropdown__trigger-mock",style:{background:t}},l.createElement("span",{className:"form-editor-dropdown__trigger-mock-text"},e("Text visible at the start")),l.createElement("span",{className:"form-editor-dropdown__trigger-mock-arrow",style:{color:i}},l.createElement(a.HQ,{icon:"DownOutlined",size:14}))),l.createElement("div",{className:"form-editor-dropdown__list-mock",style:{background:o}},l.createElement("span",{className:"form-editor-dropdown__list-mock-item"},e("Value")," 1"),l.createElement("span",{className:"form-editor-dropdown__list-mock-item"},e("Value")," 2")))}const w=()=>{const{__:e}=(0,r.s9)(),t=(0,i.wA)(),o=(0,n.rD)(),[d]=a.lV.useForm(),[c,w]=(0,l.useState)(!1),[k,B]=(0,l.useState)(!0),R=(0,l.useMemo)(()=>[{value:"v1",label:`${e("Value")} 1`},{value:"v2",label:`${e("Value")} 2`},{value:"custom",label:e("Custom")}],[e]),x=(0,l.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:"Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",listTextFontSize:14,listTextLineHeight:22,listTextColor:"#333333",listTextStrong:!1,listTextItalic:!1,listTextStrikethrough:!1,listTextUnderline:!1,[`${g}borderPosition`]:`${g}borderAll`,[`${g}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${g}borderTop`]:{...p.RH},[`${g}borderBottom`]:{...p.RH},[`${g}borderRight`]:{...p.RH},[`${g}borderLeft`]:{...p.RH},[h]:5,[b]:null,[f]:null,[v]:null,[_]:null}),[]),T=(0,l.useCallback)(()=>{t((0,m.PM)(u.Bv))},[t]),I=(0,l.useCallback)(()=>{const e=d.getFieldsValue(!0);if(k){var t;const o=null!==(t=e[h])&&void 0!==t?t:0;d.setFieldsValue({[b]:o,[f]:o,[v]:o,[_]:o})}else{const t=e[b];t===e[f]&&t===e[v]&&t===e[_]?d.setFieldsValue({[h]:t}):d.setFieldsValue({[b]:null,[f]:null,[v]:null,[_]:null})}B(e=>!e)},[d,k]),A=l.createElement(l.Fragment,null,l.createElement(a.m_,{title:e("Remove"),placement:"bottom"},l.createElement(a.$n,{type:"text",icon:l.createElement(a.HQ,{icon:"DeleteOutlined",size:18,strokeWidth:o.iconStrokeWidth})})),l.createElement(a.m_,{title:e("Link"),placement:"bottom"},l.createElement(a.$n,{type:"text",icon:l.createElement(a.HQ,{icon:"LinkOutlined",size:18,strokeWidth:o.iconStrokeWidth})}))),C=l.createElement("div",{className:"form-editor-dropdown-list-panel__inner"},l.createElement(a.lV,{form:d,layout:"vertical",className:"element-controls form-editor-dropdown",autoComplete:"off",initialValues:x},l.createElement(a.lV.Item,{name:"placeholder",label:e("Placeholder")},l.createElement(a.pd,{placeholder:e("Text visible at the start"),allowClear:!0})),l.createElement(a.v6,{name:"options",boundValueOptions:R,getPopupContainer:E,labels:{itemTitle:t=>`${e("Value")} ${t}`,headingLabel:e("Heading"),valueLabel:e("Value"),valueTooltip:e("Stored or bound value for this option"),addLabel:e("Add value"),removeTooltip:e("Remove"),headingPlaceholder:e("Enter heading"),valuePlaceholder:e("Enter value")}}),l.createElement(a.Pr,{name:"allowMultiple",label:e("Allow multiple selection")}),l.createElement(a.Pr,{name:"required",label:e("Required field")}),l.createElement(a.cG,{className:"form-editor-dropdown__section-divider"}),l.createElement(a.$n,{type:c?"primary":"default",block:!0,className:"form-editor-dropdown__more-btn",icon:l.createElement(a.HQ,{icon:"SettingOutlined",size:16}),onClick:()=>w(e=>!e)},e(c?"Fewer settings":"More settings")),c&&l.createElement("div",{className:"form-editor-dropdown__expanded"},l.createElement(a.y9,{className:"form-editor-dropdown__section",title:e("Background")},l.createElement(a.$x,{direction:"vertical",size:20,className:"form-editor-dropdown__full-width"},l.createElement(a.eZ,{name:"triggerBackground",label:e("Closed field background")}),l.createElement(a.eZ,{name:"listPanelBackground",label:e("List panel background")}),l.createElement(a.eZ,{name:"arrowColor",label:e("Arrow color")}),l.createElement(y,null))),l.createElement(a.y9,{className:"form-editor-dropdown__section",title:e("List text style")},l.createElement(S,{namePrefix:"listText",microLabel:e("List item appearance")})),l.createElement(a.y9,{className:"form-editor-dropdown__section",title:e("Border radius"),collapsible:!0,defaultOpen:!0},l.createElement(a.sQ,{namePrefix:g,typeOfForm:"desktop",oneBorderRadiusValue:k,onToggle:I,borderRadiusIcon:l.createElement(a.HQ,{icon:"RadiusUpleftOutlined",className:"selected-td-form__icon-radius"}),labels:{borderRadius:e("Border radius"),topLeft:e("Top left corner"),topRight:e("Top right corner"),bottomLeft:e("Bottom left corner"),bottomRight:e("Bottom right corner")}})),l.createElement(a.y9,{className:"form-editor-dropdown__section",title:e("Border")},l.createElement(s.A,{form:d,namePrefix:g})))));return l.createElement(a.T8,{className:"form-editor-dropdown-list-panel"},l.createElement(a.T8.Header,{onClose:T,closeIcon:l.createElement(a.HQ,{icon:"Close",size:24,strokeWidth:o.iconStrokeWidth}),extra:A},l.createElement(a.T8.HeaderTitle,{className:"form-editor-dropdown-list-panel__title"},e("Dropdown list"))),l.createElement(a.T8.Body,{className:"form-editor-dropdown-list-panel__body",padding:{horizontal:0,vertical:0}},C))}},5333:(e,t,o)=>{o.d(t,{A:()=>F});var l=o(1936),i=o(69962),a=o(57549),r=o(47706),n=o(68876),d=o(43284),s=o(71461),m=o(40867),c=o(52898),u=o(93506),p=o(57546);const g="text",h="email",b="phone",f="name",v="url",_="password",E="inputField_",S=`${E}borderRadiusAll`,y=`${E}borderRadiusTopLeft`,w=`${E}borderRadiusTopRight`,k=`${E}borderRadiusBottomLeft`,B=`${E}borderRadiusBottomRight`,R="Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",x=e=>e.closest(".email-pane__collapse-wrapper")||e.closest(".email-pane__content-col")||document.body;function T({namePrefix:e,microLabel:t}){const{__:o}=(0,r.s9)(),n=(0,i.d4)(c.uJ),s=null===n||void 0===n?void 0:n.usedColors;return l.createElement(a.H6,{namePrefix:e,microLabel:t,usedColors:s,usedLabel:o("Used"),recommendedLabel:o("Recommended"),loadGoogleFonts:d.c,getPopupContainer:x,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 I(){var e;const{__:t}=(0,r.s9)(),o=a.lV.useWatch("fieldBackground"),i=a.lV.useWatch(`${E}borderAll`),n=a.lV.useWatch("placeholderTextColor"),d=a.lV.useWatch("inputValueTextColor"),s=null!==(e=null===i||void 0===i?void 0:i.color)&&void 0!==e?e:"#d9d9d9";return l.createElement("div",{className:"form-editor-input__bg-preview","aria-hidden":!0},l.createElement("div",{className:"form-editor-input__preview-panel"},l.createElement("div",{className:"form-editor-input__preview-input",style:{background:o,borderColor:s,color:d}},l.createElement("span",{className:"form-editor-input__preview-placeholder-bit",style:{color:n}},t("Placeholder")),l.createElement("span",null," \xb7 "),l.createElement("span",null,t("Value")))))}function A(){const{__:e}=(0,r.s9)(),t=a.lV.useFormInstance(),o=(0,l.useCallback)(()=>{const e=t.getFieldValue("paddingHorizontal");null!=e&&""!==e&&t.setFieldValue("fieldMinHeight",e)},[t]);return l.createElement(a.y9,{className:"form-editor-input__section",title:e("Internal padding")},l.createElement("div",{className:"form-editor-input__padding-row"},l.createElement(a.lV.Item,{name:"paddingHorizontal",className:"form-editor-input__padding-field"},l.createElement(a.FQ,{min:0,max:200,placeholder:"0",prefix:l.createElement(a.HQ,{icon:"ColumnWidthOutlined"}),addonAfter:"px"})),l.createElement(a.lV.Item,{name:"fieldMinHeight",className:"form-editor-input__padding-field"},l.createElement(a.FQ,{min:0,max:200,placeholder:e("Height"),prefix:l.createElement(a.HQ,{icon:"ColumnHeightOutlined"}),addonAfter:"px"})),l.createElement(a.m_,{title:e("Apply horizontal padding to height")},l.createElement(a.$n,{type:"default",className:"form-editor-input__padding-link-btn",icon:l.createElement(a.HQ,{icon:"BorderOuterOutlined",size:16}),onClick:o}))))}function C(){const{__:e}=(0,r.s9)();return l.createElement(l.Fragment,null,l.createElement("div",{className:"form-editor-input__advanced-block"},l.createElement("div",{className:"form-editor-input__advanced-switch-row"},l.createElement(a.Typography.Text,{className:"form-editor-input__advanced-switch-label"},e("Field state appearance")),l.createElement(a.lV.Item,{name:"customStylesForStates",valuePropName:"checked",noStyle:!0},l.createElement(a.dO,null))),l.createElement(a.Typography.Text,{type:"secondary",className:"form-editor-input__advanced-description"},e("Use your own styles instead of defaults for states such as error, focus, and success."))),l.createElement("div",{className:"form-editor-input__advanced-block"},l.createElement("div",{className:"form-editor-input__advanced-switch-row"},l.createElement(a.Typography.Text,{className:"form-editor-input__advanced-switch-label"},e("High contrast mode")),l.createElement(a.lV.Item,{name:"highContrastMode",valuePropName:"checked",noStyle:!0},l.createElement(a.dO,null))),l.createElement(a.Typography.Text,{type:"secondary",className:"form-editor-input__advanced-description"},e("Improves visibility by automatically tuning the form for accessibility. Turn off to restore the previous look."))))}function N(){const{__:e}=(0,r.s9)(),t=(0,n.rD)().iconStrokeWidth;return l.createElement(l.Fragment,null,l.createElement(a.y9,{className:"form-editor-input__section",title:e("Visibility")},l.createElement("div",{className:"form-editor-input__visibility-row"},l.createElement(a.lV.Item,{name:"fieldVisibility",className:"form-editor-input__visibility-form-item"},l.createElement(a.sx.Group,{className:"form-editor-input__visibility-segment"},l.createElement(a.sx.Button,{value:"always"},e("Always")),l.createElement(a.sx.Button,{value:"desktop",title:e("Desktop")},l.createElement(a.HQ,{icon:"DesktopOutlined",size:16,strokeWidth:t})),l.createElement(a.sx.Button,{value:"mobile",title:e("Mobile")},l.createElement(a.HQ,{icon:"MobileOutlined",size:16,strokeWidth:t})))),l.createElement(a.lV.Item,{name:"fieldDirection",className:"form-editor-input__direction-form-item"},l.createElement(a.sx.Group,{className:"form-editor-input__icon-toggle-group"},l.createElement(a.sx.Button,{value:"ltr",title:e("Left to right")},l.createElement(a.HQ,{icon:"ArrowLeftOutlined",size:16,strokeWidth:t})),l.createElement(a.sx.Button,{value:"rtl",title:e("Right to left")},l.createElement(a.HQ,{icon:"ArrowRightOutlined",size:16,strokeWidth:t})))))),l.createElement(a.y9,{className:"form-editor-input__section",title:e("Visibility in AMP")},l.createElement(a.lV.Item,{name:"ampVisibility",className:"form-editor-input__align-form-item"},l.createElement(a.sx.Group,{className:"form-editor-input__visibility-amp"},l.createElement(a.sx.Button,{value:"always"},e("Always")),l.createElement(a.sx.Button,{value:"amp"},"AMP"),l.createElement(a.sx.Button,{value:"html"},"HTML")))))}function P(){const{__:e}=(0,r.s9)();return a.lV.useWatch("limitLength")?l.createElement(a.lV.Item,{name:"maxLength",label:e("Maximum length")},l.createElement(a.FQ,{min:1,max:9999,placeholder:e("Characters"),addonAfter:e("chars")})):null}function L(){const{__:e}=(0,r.s9)(),t=a.lV.useWatch("inputType"),o=(0,l.useMemo)(()=>[{value:"minLength8",label:e("Minimum length 8 characters")},{value:"lowercase",label:e("Lowercase letters (a-z)")},{value:"uppercase",label:e("Uppercase letters (A-Z)")},{value:"digits",label:e("Digits (0-9)")},{value:"special",label:e("Special characters")}],[e]),i=(0,l.useMemo)(()=>[{value:"https",label:"HTTPS"},{value:"http",label:"HTTP"},{value:"mailto",label:"mailto:"},{value:"ftp",label:"FTP"}],[]);return t?l.createElement(l.Fragment,null,t===g&&l.createElement(l.Fragment,null,l.createElement(a.Pr,{name:"limitLength",label:e("Character limit")}),l.createElement(P,null)),t===b&&l.createElement(a.Pr,{name:"countryCodeSelector",label:e("Country selector (flag+code)")}),t===v&&l.createElement(l.Fragment,null,l.createElement(a.Pr,{name:"urlAutoPrependProtocol",label:e("Auto-prepend protocol on blur")}),l.createElement(a.lV.Item,{name:"allowedProtocols",label:e("Allowed protocols")},l.createElement(a.Select,{mode:"multiple",className:"form-editor-input__full-width",placeholder:e("Choose allowed protocols"),options:i,getPopupContainer:x,allowClear:!0}))),t===_&&l.createElement(l.Fragment,null,l.createElement(a.Pr,{name:"showPasswordEye",label:e("Show eye icon")}),l.createElement(a.lV.Item,{name:"passwordComplexityRules",label:e("Complexity rules")},l.createElement(a.Select,{mode:"multiple",className:"form-editor-input__full-width",placeholder:e("Choose complexity rules"),options:o,getPopupContainer:x,allowClear:!0})))):null}const F=()=>{const{__:e}=(0,r.s9)(),t=(0,i.wA)(),o=(0,n.rD)(),[d]=a.lV.useForm(),[c,P]=(0,l.useState)(!1),[F,O]=(0,l.useState)(!0),V=(0,l.useMemo)(()=>[{value:g,label:e("Text")},{value:h,label:e("Email")},{value:b,label:e("Phone number")},{value:f,label:e("Name")},{value:v,label:e("URL")},{value:_,label:e("Password")}],[e]),M=(0,l.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:R,inputValueTextFontSize:14,inputValueTextLineHeight:22,inputValueTextColor:"#333333",inputValueTextStrong:!1,inputValueTextItalic:!1,inputValueTextStrikethrough:!1,inputValueTextUnderline:!1,placeholderTextFontFamily:R,placeholderTextFontSize:14,placeholderTextLineHeight:22,placeholderTextColor:"rgba(0, 0, 0, 0.25)",placeholderTextStrong:!1,placeholderTextItalic:!1,placeholderTextStrikethrough:!1,placeholderTextUnderline:!1,[`${E}borderPosition`]:`${E}borderAll`,[`${E}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${E}borderTop`]:{...p.RH},[`${E}borderBottom`]:{...p.RH},[`${E}borderRight`]:{...p.RH},[`${E}borderLeft`]:{...p.RH},[S]:5,[y]:null,[w]:null,[k]:null,[B]:null}),[]),D=(0,l.useCallback)(()=>{t((0,m.PM)(u.Bv))},[t]),H=(0,l.useCallback)(()=>{const e=d.getFieldsValue(!0);if(F){var t;const o=null!==(t=e[S])&&void 0!==t?t:0;d.setFieldsValue({[y]:o,[w]:o,[k]:o,[B]:o})}else{const t=e[y];t===e[w]&&t===e[k]&&t===e[B]?d.setFieldsValue({[S]:t}):d.setFieldsValue({[y]:null,[w]:null,[k]:null,[B]:null})}O(e=>!e)},[d,F]),z=l.createElement(l.Fragment,null,l.createElement(a.m_,{title:e("Remove"),placement:"bottom"},l.createElement(a.$n,{type:"text",icon:l.createElement(a.HQ,{icon:"DeleteOutlined",size:18,strokeWidth:o.iconStrokeWidth})})),l.createElement(a.m_,{title:e("Link"),placement:"bottom"},l.createElement(a.$n,{type:"text",icon:l.createElement(a.HQ,{icon:"LinkOutlined",size:18,strokeWidth:o.iconStrokeWidth})}))),W=l.createElement("div",{className:"form-editor-input-panel__inner"},l.createElement(a.lV,{form:d,layout:"vertical",className:"element-controls form-editor-input",autoComplete:"off",initialValues:M},l.createElement(a.lV.Item,{name:"inputType",label:e("Type")},l.createElement(a.Select,{className:"form-editor-input__full-width",placeholder:e("Choose input type"),options:V,allowClear:!0,getPopupContainer:x})),l.createElement(a.Pr,{name:"required",label:e("Field required")}),l.createElement(a.lV.Item,{name:"placeholder",label:e("Placeholder")},l.createElement(a.pd,{placeholder:e("Text visible at the start"),allowClear:!0})),l.createElement(a.lV.Item,{name:"hintText",label:e("Hint text")},l.createElement(a.pd,{placeholder:e("Come up with a hint"),allowClear:!0})),l.createElement(L,null),l.createElement(a.cG,{className:"form-editor-input__section-divider"}),l.createElement(a.$n,{type:c?"primary":"default",block:!0,className:"form-editor-input__more-btn",icon:l.createElement(a.HQ,{icon:"SettingOutlined",size:16}),onClick:()=>P(e=>!e)},e(c?"Fewer settings":"More settings")),c&&l.createElement("div",{className:"form-editor-input__expanded"},l.createElement(A,null),l.createElement(a.y9,{className:"form-editor-input__section",title:e("Size"),collapsible:!0,defaultOpen:!1},l.createElement(a.lV.Item,{name:"fieldMaxWidth",label:e("Max width")},l.createElement(a.FQ,{min:0,max:2e3,placeholder:e("Not set"),addonAfter:"px"}))),l.createElement(a.y9,{className:"form-editor-input__section",title:e("Background")},l.createElement(a.eZ,{name:"fieldBackground",label:e("Background color")})),l.createElement(a.y9,{className:"form-editor-input__section",title:e("Input field text")},l.createElement(T,{namePrefix:"inputValueText",microLabel:e("Font")})),l.createElement(a.y9,{className:"form-editor-input__section",title:e("Placeholder text"),collapsible:!0,defaultOpen:!0},l.createElement(T,{namePrefix:"placeholderText",microLabel:e("Font")})),l.createElement(I,null),l.createElement(a.y9,{className:"form-editor-input__section",title:e("Border radius"),collapsible:!0,defaultOpen:!0},l.createElement(a.sQ,{namePrefix:E,typeOfForm:"desktop",oneBorderRadiusValue:F,onToggle:H,borderRadiusIcon:l.createElement(a.HQ,{icon:"RadiusUpleftOutlined",className:"selected-td-form__icon-radius"}),labels:{borderRadius:e("Border radius"),topLeft:e("Top left corner"),topRight:e("Top right corner"),bottomLeft:e("Bottom left corner"),bottomRight:e("Bottom right corner")}})),l.createElement(a.y9,{className:"form-editor-input__section",title:e("Border")},l.createElement(s.A,{form:d,namePrefix:E})),l.createElement(a.y9,{className:"form-editor-input__section",title:e("Accessibility")},l.createElement(C,null)),l.createElement(N,null))));return l.createElement(a.T8,{className:"form-editor-input-panel"},l.createElement(a.T8.Header,{onClose:D,closeIcon:l.createElement(a.HQ,{icon:"Close",size:24,strokeWidth:o.iconStrokeWidth}),extra:z},l.createElement(a.T8.HeaderTitle,{className:"form-editor-input-panel__title"},e("Input"))),l.createElement(a.T8.Body,{className:"form-editor-input-panel__body",padding:{horizontal:0,vertical:0}},W))}},42512:(e,t,o)=>{o.d(t,{A:()=>B});var l=o(1936),i=o(69962),a=o(57549),r=o(47706),n=o(68876),d=o(43284),s=o(71461),m=o(40867),c=o(52898),u=o(93506),p=o(57546);const g="radio_",h=`${g}borderRadiusAll`,b=`${g}borderRadiusTopLeft`,f=`${g}borderRadiusTopRight`,v=`${g}borderRadiusBottomLeft`,_=`${g}borderRadiusBottomRight`,E=e=>e.closest(".email-pane__collapse-wrapper")||e.closest(".email-pane__content-col")||document.body;function S({namePrefix:e,microLabel:t}){const{__:o}=(0,r.s9)(),n=(0,i.d4)(c.uJ),s=null===n||void 0===n?void 0:n.usedColors;return l.createElement(a.H6,{namePrefix:e,microLabel:t,usedColors:s,usedLabel:o("Used"),recommendedLabel:o("Recommended"),loadGoogleFonts:d.c,getPopupContainer:E,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 y(){const{__:e}=(0,r.s9)(),t=a.lV.useWatch("appearanceBackground"),o=a.lV.useWatch("appearanceStrokeColor"),i=a.lV.useWatch("appearanceDotColor");return l.createElement("div",{className:"form-editor-radio__bg-preview","aria-hidden":!0},l.createElement("div",{className:"form-editor-radio__preview-panel"},l.createElement("div",{className:"form-editor-radio__preview-row",style:{background:t}},l.createElement("span",{className:"form-editor-radio__preview-dot form-editor-radio__preview-dot--selected",style:{borderColor:o,background:i}}),l.createElement("span",{className:"form-editor-radio__preview-label"},e("Value")," 1")),l.createElement("div",{className:"form-editor-radio__preview-row",style:{background:t}},l.createElement("span",{className:"form-editor-radio__preview-dot",style:{borderColor:o,background:"transparent"}}),l.createElement("span",{className:"form-editor-radio__preview-label"},e("Value")," 2"))))}function w(){const{__:e}=(0,r.s9)(),t=a.lV.useWatch("markerShape");return l.createElement(l.Fragment,null,l.createElement(a.lV.Item,{name:"markerShape",label:e("Marker shape")},l.createElement(a.sx.Group,{className:"form-editor-radio__shape-radios"},l.createElement(a.sx,{value:"round"},e("Round")),l.createElement(a.sx,{value:"custom"},e("Custom icon")))),"custom"===t&&l.createElement(l.Fragment,null,l.createElement(a.lV.Item,{name:"customIconUrl",label:e("Icon URL")},l.createElement(a.pd,{placeholder:"https://",allowClear:!0})),l.createElement(a.lV.Item,{name:"customIconAlt",label:e("Icon description")},l.createElement(a.pd,{placeholder:e("Accessibility text"),allowClear:!0}))),l.createElement(a.cG,{className:"form-editor-radio__inner-section-divider"}),l.createElement(a.$x,{direction:"vertical",size:16,className:"form-editor-radio__full-width"},l.createElement(a.eZ,{name:"appearanceBackground",label:e("Background color")}),l.createElement(a.eZ,{name:"appearanceStrokeColor",label:e("Stroke color")}),l.createElement(a.eZ,{name:"appearanceDotColor",label:e("Dot color")})),l.createElement(y,null))}function k(){const{__:e}=(0,r.s9)(),t=(0,n.rD)().iconStrokeWidth;return l.createElement(a.y9,{className:"form-editor-radio__section",title:e("Position in cell")},l.createElement(a.fI,{gutter:[12,16],className:"form-editor-radio__position-block"},l.createElement(a.fv,{xs:24,sm:10,md:9},l.createElement(a.Typography.Text,{type:"secondary",className:"form-editor-radio__micro-label"},e("Layout")),l.createElement(a.lV.Item,{name:"radioLayout",className:"form-editor-radio__layout-form-item"},l.createElement(a.sx.Group,{className:"form-editor-radio__icon-toggle-group"},l.createElement(a.sx.Button,{value:"horizontal",title:e("Horizontal")},l.createElement(a.HQ,{icon:"MenuOutlined",size:16,strokeWidth:t})),l.createElement(a.sx.Button,{value:"vertical",title:e("Vertical")},l.createElement(a.HQ,{icon:"Column",size:16,strokeWidth:t})),l.createElement(a.sx.Button,{value:"grid",title:e("Grid")},l.createElement(a.HQ,{icon:"Grid01Icon",size:16,strokeWidth:t}))))),l.createElement(a.fv,{xs:24,sm:14,md:15},l.createElement(a.lV.Item,{name:"radioOptionGap",label:e("Spacing")},l.createElement(a.FQ,{min:0,max:120,placeholder:e("Spacing"),addonAfter:"px"})))),l.createElement("div",{className:"form-editor-radio__align-block"},l.createElement(a.Typography.Text,{type:"secondary",className:"form-editor-radio__micro-label"},e("Horizontal alignment")),l.createElement(a.lV.Item,{name:"alignHorizontal",className:"form-editor-radio__align-form-item"},l.createElement(a.sx.Group,{className:"form-editor-radio__icon-toggle-group"},l.createElement(a.sx.Button,{value:"left",title:e("Align left")},l.createElement(a.HQ,{icon:"AlignLeftOutlined",size:16,strokeWidth:t})),l.createElement(a.sx.Button,{value:"center",title:e("Align center")},l.createElement(a.HQ,{icon:"AlignCenterOutlined",size:16,strokeWidth:t})),l.createElement(a.sx.Button,{value:"right",title:e("Align right")},l.createElement(a.HQ,{icon:"AlignRightOutlined",size:16,strokeWidth:t}))))),l.createElement("div",{className:"form-editor-radio__align-block"},l.createElement(a.Typography.Text,{type:"secondary",className:"form-editor-radio__micro-label"},e("Vertical alignment")),l.createElement(a.lV.Item,{name:"alignVertical",className:"form-editor-radio__align-form-item"},l.createElement(a.sx.Group,{className:"form-editor-radio__icon-toggle-group"},l.createElement(a.sx.Button,{value:"top",title:e("Align top")},l.createElement(a.HQ,{icon:"AlignVerticalTop",size:16,strokeWidth:t})),l.createElement(a.sx.Button,{value:"middle",title:e("Align middle")},l.createElement(a.HQ,{icon:"AlignVerticalCenter",size:16,strokeWidth:t})),l.createElement(a.sx.Button,{value:"bottom",title:e("Align bottom")},l.createElement(a.HQ,{icon:"AlignVerticalBottom",size:16,strokeWidth:t}))))))}const B=()=>{const{__:e}=(0,r.s9)(),t=(0,i.wA)(),o=(0,n.rD)(),[d]=a.lV.useForm(),[c,y]=(0,l.useState)(!1),[B,R]=(0,l.useState)(!0),x=(0,l.useMemo)(()=>[{value:"v1",label:`${e("Value")} 1`},{value:"v2",label:`${e("Value")} 2`},{value:"custom",label:e("Custom")}],[e]),T=(0,l.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:"Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif",labelTextFontSize:19,labelTextLineHeight:24,labelTextColor:"#333333",labelTextStrong:!1,labelTextItalic:!1,labelTextStrikethrough:!1,labelTextUnderline:!1,[`${g}borderPosition`]:`${g}borderAll`,[`${g}borderAll`]:{width:1,style:"solid",color:"#d9d9d9"},[`${g}borderTop`]:{...p.RH},[`${g}borderBottom`]:{...p.RH},[`${g}borderRight`]:{...p.RH},[`${g}borderLeft`]:{...p.RH},[h]:5,[b]:null,[f]:null,[v]:null,[_]:null}),[]),I=(0,l.useCallback)(()=>{t((0,m.PM)(u.Bv))},[t]),A=(0,l.useCallback)(()=>{const e=d.getFieldsValue(!0);if(B){var t;const o=null!==(t=e[h])&&void 0!==t?t:0;d.setFieldsValue({[b]:o,[f]:o,[v]:o,[_]:o})}else{const t=e[b];t===e[f]&&t===e[v]&&t===e[_]?d.setFieldsValue({[h]:t}):d.setFieldsValue({[b]:null,[f]:null,[v]:null,[_]:null})}R(e=>!e)},[d,B]),C=l.createElement(l.Fragment,null,l.createElement(a.m_,{title:e("Remove"),placement:"bottom"},l.createElement(a.$n,{type:"text",icon:l.createElement(a.HQ,{icon:"DeleteOutlined",size:18,strokeWidth:o.iconStrokeWidth})})),l.createElement(a.m_,{title:e("Link"),placement:"bottom"},l.createElement(a.$n,{type:"text",icon:l.createElement(a.HQ,{icon:"LinkOutlined",size:18,strokeWidth:o.iconStrokeWidth})}))),N=l.createElement("div",{className:"form-editor-radio-panel__inner"},l.createElement(a.lV,{form:d,layout:"vertical",className:"element-controls form-editor-radio",autoComplete:"off",initialValues:T},l.createElement(a.lV.Item,{name:"placeholder",label:e("Placeholder")},l.createElement(a.pd,{placeholder:e("Text visible at the start"),allowClear:!0})),l.createElement(a.v6,{name:"options",boundValueOptions:x,getPopupContainer:E,labels:{itemTitle:t=>`${e("Value")} ${t}`,headingLabel:e("Heading"),valueLabel:e("Value"),valueTooltip:e("Stored or bound value for this option"),addLabel:e("Add value"),removeTooltip:e("Remove"),headingPlaceholder:e("Enter heading"),valuePlaceholder:e("Enter value")}}),l.createElement(a.Pr,{name:"allowShuffle",label:e("Shuffle options")}),l.createElement(a.Pr,{name:"required",label:e("Required field")}),l.createElement(a.lV.Item,{name:"defaultState",label:e("Default value")},l.createElement(a.sx.Group,{className:"form-editor-radio__default-radios"},l.createElement(a.sx,{value:"enabled"},e("Enabled")),l.createElement(a.sx,{value:"disabled"},e("Disabled")))),l.createElement(a.cG,{className:"form-editor-radio__section-divider"}),l.createElement(a.$n,{type:c?"primary":"default",block:!0,className:"form-editor-radio__more-btn",icon:l.createElement(a.HQ,{icon:"SettingOutlined",size:16}),onClick:()=>y(e=>!e)},e(c?"Fewer settings":"More settings")),c&&l.createElement("div",{className:"form-editor-radio__expanded"},l.createElement(k,null),l.createElement(a.y9,{className:"form-editor-radio__section",title:e("Appearance")},l.createElement(w,null)),l.createElement(a.y9,{className:"form-editor-radio__section",title:e("Label text style")},l.createElement(S,{namePrefix:"labelText",microLabel:e("Caption next to options")})),l.createElement(a.y9,{className:"form-editor-radio__section",title:e("Border radius"),collapsible:!0,defaultOpen:!0},l.createElement(a.sQ,{namePrefix:g,typeOfForm:"desktop",oneBorderRadiusValue:B,onToggle:A,borderRadiusIcon:l.createElement(a.HQ,{icon:"RadiusUpleftOutlined",className:"selected-td-form__icon-radius"}),labels:{borderRadius:e("Border radius"),topLeft:e("Top left corner"),topRight:e("Top right corner"),bottomLeft:e("Bottom left corner"),bottomRight:e("Bottom right corner")}})),l.createElement(a.y9,{className:"form-editor-radio__section",title:e("Border")},l.createElement(s.A,{form:d,namePrefix:g})))));return l.createElement(a.T8,{className:"form-editor-radio-panel"},l.createElement(a.T8.Header,{onClose:I,closeIcon:l.createElement(a.HQ,{icon:"Close",size:24,strokeWidth:o.iconStrokeWidth}),extra:C},l.createElement(a.T8.HeaderTitle,{className:"form-editor-radio-panel__title"},e("Radio button"))),l.createElement(a.T8.Body,{className:"form-editor-radio-panel__body",padding:{horizontal:0,vertical:0}},N))}},72153:(e,t,o)=>{o.d(t,{A:()=>f});var l=o(1936),i=o(34010),a=o(6056),r=o.n(a),n=o(57549),d=o(69962),s=o(3711),m=o(98173),c=o(96040),u=o(6403),p=o(47706),g=o(91480);const h=()=>{const{__:e}=(0,p.s9)(),t=(0,u.hN)(),o=(0,d.d4)(m.C1),[i]=(0,s.C)(),[a,r]=(0,l.useState)(!1),h=(0,g.u)();(0,l.useEffect)(()=>{o.hasOwnProperty("email_confirmation")&&r(o.email_confirmation)},[o,a]);return null!==o&&void 0!==o&&o.email_confirmation||null===o||void 0===o||!o.privacy_policy_agreement?null:l.createElement("div",{className:"main__ribbon"},l.createElement("span",null,l.createElement(c.Ay,{icon:"EmailConfirmation",size:16,style:{marginRight:10,verticalAlign:"-0.15em"}}),e("Confirmation email was sent to"),"\xa0",l.createElement("em",null,o.email),".\xa0",e("Didn't receive an email?"),"\xa0",l.createElement(n.$n,{type:"primary",size:"small",className:"main__ribbon-resend",style:{fontSize:16,lineHeight:1,display:"inline-flex",alignItems:"center",gap:8},onClick:()=>{h({event:"click",action:"click_resend_confirmation_email",user_email:o.email,user_id:o.id}),i({userId:o.id,email:o.email}).then(({data:l,error:i})=>{l?t.success(e("Confirmation email has been sent to {confirmedEmail}.").replace("{confirmedEmail}",o.email)):i&&t.error(i)})}},e("Resend"),l.createElement(c.Ay,{icon:"SendOutlined",size:16,style:{flexShrink:0}}))))};var b=o(68876);const f=({className:e,leftBlock:t,rightBlock:o,isHeaderCodeMenuOpen:a=!1})=>{const{token:d}=(0,n.rd)(),s=(0,l.useRef)(),m=(0,b.rD)();return l.createElement(l.Fragment,null,l.createElement(h,null),m.headerShow&&l.createElement("header",{className:r()("header",{[e]:e}),style:{borderColor:d.colorBorder}},!a&&l.createElement(i.A,{nodeRef:s,in:!a,timeout:300,classNames:"transition"},l.createElement("div",{className:"header__container container"},l.createElement("div",{className:"header__left",style:{flexGrow:1}},t),l.createElement("div",{className:"header__right"},l.createElement(n.$x,{size:10},o))))))}},58716:(e,t,o)=>{o.d(t,{A:()=>y});var l=o(1936),i=o(69962),a=o(84075),r=o(57549),n=o(6056),d=o.n(n),s=o(96040),m=o(89591),c=o(487),u=o(74663),p=o(40867),g=o(68069),h=o(52898),b=o(47706),f=o(41244),v=o(7714),_=o(7314),E=o(93506),S=o(68876);const y=({emailElement:e})=>{const{__:t}=(0,b.s9)(),o=(0,v.XW)(),n=(0,i.wA)(),{projectId:y}=(0,a.g)(),w=(0,_.fn)(),k=(0,i.d4)(u.p1),B=(0,i.d4)(u.RL),R=(0,i.d4)(p.Wm),[x,T]=(0,l.useState)(!0),[I,A]=(0,l.useState)(!1),[C,N]=(0,l.useState)([]),[P,L]=(0,l.useState)([]),F=e=>n((0,p.mi)(e)),O=(0,l.useCallback)(e=>{n((0,h.no)(e)),w.setValue(null===e||void 0===e?void 0:e.html.replaceAll("\r\n","\n"))},[w,n]),{data:V}=c.Nq.useGetProjectQuery(Number(y),{skip:!y}),[M,D]=(0,l.useState)([]);(0,l.useEffect)(()=>{if(V){const{owner:e,admins:t,users:o}=null===V||void 0===V?void 0:V.members;D([e&&{...e},t&&Array.isArray(t)&&t.map(e=>({...e})),o&&Array.isArray(o)&&o.map(e=>({...e}))].filter(e=>e).flat(1).map(e=>({id:e.ID,display_name:e.display_name})))}},[V,null===V||void 0===V?void 0:V.members,t]);const[H,z]=(0,l.useState)(1),[W,U]=(0,l.useState)(!1);(0,l.useEffect)(()=>{const e=Array.isArray(k)&&k.length&&(null===k||void 0===k?void 0:k.map(e=>{var o;return{key:e.id,author:e.author,date:(0,f.Yq)((0,f.Cl)(e.date||e.modified),t),title:e.title,html:e.html,common_styles:e.common_styles,loading:!1,isAutosave:null===(o=e.slug)||void 0===o?void 0:o.includes("autosave")}}));L(e||[]),N(e),T(!1),B<2&&U(!0)},[k,B,t]);const $=x||I||W?null:l.createElement("div",{style:{textAlign:"center",marginTop:24,marginBottom:24,height:32,lineHeight:"32px"}},l.createElement(r.$n,{onClick:()=>{A(!0),L(C.concat([...new Array(3)].map(()=>({loading:!0})))),n(m.GY.endpoints.getEmailHistory.initiate({emailId:e.id,page:H+1})).then(e=>{const{data:o,totalPages:l}=e.data,i=Array.isArray(o)&&(null===o||void 0===o?void 0:o.map(e=>({key:e.id,author:e.author,date:(0,f.Yq)((0,f.Cl)(e.date||e.modified),t),title:e.title,html:e.html,loading:!1}))),a=C.concat(i);L(a),N(a),A(!1),window.dispatchEvent(new Event("resize")),H+1>=l&&U(!0),z(H+1)})}},t("loading more"))),[G,j]=(0,l.useState)(),[X,q]=(0,l.useState)(null),Y=(0,l.useRef)();Y.current=e,(0,l.useEffect)(()=>{if(!R&&!X){const e=Y.current;e&&q({html:w.getValue(),preheader:e.preheader,common_styles:e.common_styles,subject:e.subject})}},[R,q,w,X]),(0,l.useEffect)(()=>{R&&X&&(O(X),q(null))},[R,X,O]);const K=(0,S.rD)();return l.createElement(l.Fragment,null,l.createElement(r.tU,{className:"secondary-tabs email-settings__collapse secondary-tabs_unset_scroll",size:"large",activeKey:E.Vv,items:[{label:l.createElement(l.Fragment,null,t("Version history")),key:E.Vv,forceRender:!0,className:"email-settings__collapse-panel",style:{height:"100%"},children:l.createElement(r.B8,{className:"history-panel__list",loading:x,itemLayout:"horizontal",loadMore:$,dataSource:P,header:l.createElement("div",{className:"history-panel__list-header"},l.createElement("div",{className:"history-panel__list-date"},t("Time")),l.createElement("div",{className:"history-panel__list-author"},t("Author")),l.createElement("div",{className:"history-panel__restore"},"Set")),renderItem:(e,i)=>{var a;return l.createElement(r.B8.Item,{onClick:()=>{i!==G&&(j(i),O(C[i])),n((0,g.rc)(!0))},className:d()("history-panel__item",{"history-panel__item_active":i===G})},l.createElement(r.EA,{title:!1,loading:e.loading||!1,active:!0},l.createElement("div",{className:"history-panel__list-date"},e.date),l.createElement("div",{className:"history-panel__list-author"},E.EW.isPlugin&&K.revisionService?e.author:(null===(a=M.find(t=>{var o,l;return(null===(o=t.id)||void 0===o?void 0:o.toString())===(null===(l=e.author)||void 0===l?void 0:l.toString())}))||void 0===a?void 0:a.display_name)||"\u2013"),e.isAutosave&&G!==i&&l.createElement("div",{style:{opacity:.45},className:"history-panel__list-autosave"},t("Auto")),!e.isAutosave&&l.createElement(r.$n,{size:"small",className:"history-panel__restore",type:"link",onClick:e=>{G===i&&e.stopPropagation(),O(C[i]),j(null),q(null),o({operation:E.Ru.SANDBOX_LOCK_EDIT,data:!1}),n((0,p.Fk)())}},t("Set")),e.isAutosave&&G===i&&l.createElement(r.$n,{size:"small",className:"history-panel__restore",type:"link",onClick:e=>{G===i&&e.stopPropagation(),O(C[i]),F(!0),j(null),q(null),o({operation:E.Ru.SANDBOX_LOCK_EDIT,data:!1})}},t("Set"))))}})}]}),l.createElement(r.$n,{type:"text",className:"ant-modal-close","aria-label":"Close",onClick:()=>{n((0,p.Fk)()),O(X),q(null),F(!0),o({operation:E.Ru.SANDBOX_LOCK_EDIT,data:!1})}},l.createElement(s.Ay,{icon:"Close"})))}},92539:(e,t,o)=>{o.d(t,{H:()=>n,p:()=>d});var l=o(1936),i=o(69962),a=o(78443);const r=(0,l.createContext)(null),n=({children:e})=>{const t=(0,i.wA)(),o=(0,i.d4)(a.cL),[n,d]=(0,l.useState)(null),s=(0,l.useRef)(null),m=(0,l.useCallback)(e=>{var t;null===(t=s.current)||void 0===t||t.call(s,e),s.current=null},[]),c=(0,l.useCallback)(e=>(m(null),d(e),t((0,a.qf)(e.entryModal)),new Promise(e=>{s.current=e})),[t,m]);(0,l.useEffect)(()=>{(e=>e.includes("UPLOAD_IMAGE_")||e.includes("UPLOAD_BACKGROUND_"))(o)||(d(null),s.current&&m(null))},[o,m]);const u=(0,l.useMemo)(()=>({request:n,openImagePicker:c,resolveImagePicker:m}),[n,c,m]);return l.createElement(r.Provider,{value:u},e)},d=()=>{const e=(0,l.useContext)(r);if(!e)throw new Error("useImagePicker must be used within ImagePickerProvider");return e}},74397:(e,t,o)=>{o.d(t,{p:()=>l.p});var l=o(92539)},81644:(e,t,o)=>{o.d(t,{A:()=>s});var l=o(1936),i=o(57549),a=o(47706),r=o(84075),n=o(91480),d=o(1936);const s=({open:e,sideOnOk:t,onCancel:o,initialSlide:s=0})=>{const{__:m}=(0,a.s9)(),c=(0,r.Zp)(),[u,p]=(0,l.useState)(s),g=(0,l.useRef)(null),h=(0,n.u)();(0,l.useEffect)(()=>{e&&g.current&&(g.current.goTo(s,!0),p(s))},[e,s]);const b=(0,l.useMemo)(()=>[{image:m("https://cdn.useblocks.io/1351/241017_18_1sGjUaZ.png"),backgroundColor:"var(--blue-2)",title:m("More editing features"),description:m("Use our visual editor to customize every element to your needs: change borders and their radius, box shadows, paddings, background, and much more.")},{image:m("https://cdn.useblocks.io/1351/241017_18_J7QtvZ3.png"),backgroundColor:"var(--purple-2)",title:m("Work with the HTML code"),description:m("Edit the HTML version of your email template in the Code mode and see the changes in real time. Builder has no code restrictions \u2014 you can create templates of any complexity!")},{image:m("https://cdn.useblocks.io/1351/241017_18_2fjDRfL.png"),backgroundColor:"var(--cyan-2)",title:m("AI image generation"),description:m("Generate stunning visuals for your emails with ease. We have trained our AI model to ensure the highest quality images.")},{image:m("https://cdn.useblocks.io/1351/241017_18_D5C25Zp.png"),backgroundColor:"var(--green-2)",title:m("Stock photos and GIFs"),description:m("Search the vast gallery of stock photos and GIFs to find visuals for any occasion. You can filter the results by image orientation, color scheme, and more.")},{image:m("https://cdn.useblocks.io/1351/241017_18_NDYloAO.png"),backgroundColor:"var(--magenta-2)",title:m("Version history"),description:m("Check who and when made changes to the email template and, if necessary, restore one of the previous versions.")},{image:m("https://cdn.useblocks.io/1351/241017_18_g5mVlmh.png"),backgroundColor:"var(--red-2)",title:m("Image editor"),description:m("Want to resize an image, add some text, or apply a filter? No need to leave builder! You can make all the basic changes in our image editor.")},{image:m("https://cdn.useblocks.io/1351/241017_18_ur8Lh3W.png"),backgroundColor:"var(--orange-2)",title:m("Email optimization"),description:m("Check your email against broken links, missing alt texts, large images, and other issues that might prevent your emails from hitting inboxes.")},{image:m("https://cdn.useblocks.io/1351/241017_18_S5Pld9p.png"),backgroundColor:"var(--volcano-2)",title:m("Team collaboration"),description:m("Share the project with your team and collaborate in real time. Add comments to individual email blocks and discuss necessary edits right in the builder.")},{image:m("https://cdn.useblocks.io/1351/241017_18_tGbb2j9.png"),backgroundColor:"var(--geekblue-2)",title:m("Email testing"),description:m("Check how your email appears across various devices and email clients.")},{image:m("https://cdn.useblocks.io/1351/241017_18_gDXi4uM.png"),backgroundColor:"var(--geekblue-2)",title:m("AI assistant"),description:m("Let our AI assistant enhance your email template! From creating subject lines and preheaders based on the email copy to generating the whole email with your website in mind!")}],[m]);return(0,l.useEffect)(()=>{if(e&&g.current){g.current.goTo(s,!0),p(s);const e=b[s];h({event:"open_modal",action:"open_premium-features_modal",modal_id:"premium-features",offer_id:e.title})}},[e,b,s,h]),d.createElement(i.aF,{open:e,footer:null,onCancel:o,closable:!1,className:"premium-features-modal",classNames:{mask:"premium-features-modal-mask"},styles:{mask:{background:"rgba(0, 0, 0, 0.65)"}},width:1100,style:{maxWidth:"80%"}},d.createElement(i.FN,{dots:!0,slidesToShow:1,slidesToScroll:1,autoplay:!0,className:"carousel-slider",draggable:!0,autoplaySpeed:5e3,initialSlide:u,ref:g},b.map((e,t)=>d.createElement("div",{key:t},d.createElement("div",{className:"carousel-slide",style:{background:`${e.backgroundColor}`}},d.createElement("div",{className:"slide-item-image"},d.createElement("img",{src:e.image,alt:`slide-${t}`})),d.createElement("div",{className:"slide-item-content"},d.createElement("h3",{className:"slide-title"},e.title),d.createElement("p",{className:"slide-description"},e.description)))))),d.createElement("div",{className:"modal-subtitle"},m("This and other features are available for you on any paid plan.")),d.createElement("div",{className:"modal-buttons"},d.createElement(i.$n,{size:"large",onClick:()=>o(!1)},m("Cancel")),d.createElement(i.$n,{type:"primary",size:"large",onClick:()=>{t&&t(),c("/billing"),o(!1)},style:{padding:"0 30px"}},m("Select plan"))))}},11128:(e,t,o)=>{o.d(t,{A:()=>n});var l=o(1936),i=o(57549);const a=(0,l.lazy)(()=>Promise.all([o.e(2139),o.e(284),o.e(1940),o.e(8580)]).then(o.bind(o,73696))),r={height:"100%"};function n(e){return l.createElement(l.Suspense,{fallback:l.createElement(i.so,{justify:"center",align:"center",style:r},l.createElement(i.tK,{size:"large"}))},l.createElement(a,e))}},41007:(e,t,o)=>{o.d(t,{A:()=>a});var l=o(1936),i=o(84075);const a=({lastProjectId:e})=>{const{pathname:t,search:o}=(0,i.zy)();return!1===e?l.createElement(i.C5,{to:"/projects"}):e&&l.createElement(i.C5,{to:`/projects/${e+t+o}`})}},91785:(e,t,o)=>{o.d(t,{A:()=>a});var l=o(1936),i=o(84075);const a=({to:e})=>l.createElement(i.C5,{to:e})},57774:(e,t,o)=>{o.d(t,{A:()=>X});var l=o(1936),i=o(84075),a=o(69962),r=o(57549),n=o(96040),d=o(6056),s=o.n(d),m=o(93506);const c=[m.dO,m.Sr,m.e8],u=({summary:e,__:t,selectedTags:o,setSelectedTags:i})=>{const a=(0,l.useCallback)((e,t)=>{const l=t?2===o.length?[]:[...o,e]:o.filter(t=>t!==e);i(l)},[o,i]),n=(0,l.useCallback)(e=>e===m.dO?t("Valid"):e===m.e8?t("Warnings"):t("Errors"),[t]);return l.createElement(r.hE,{level:5,className:"optimise__valid-title"},l.createElement(r.$x,{className:"optimise__valid-title-space",size:8},c.map((t,i)=>l.createElement(r.Xl,{key:t+i,checked:null===o||void 0===o?void 0:o.includes(t),onChange:e=>a(t,e),className:s()(`${t} optimise__button`,{[`${t}_active`]:o.includes(t)})},n(t),": ",(null===e||void 0===e?void 0:e[t])||0))))},{LINKS:p}=m.qG,g=(0,l.memo)(({__:e,activeTab:t,validateLinksResult:o,validateLinks:i,selectedTags:a,setSelectedTags:d,isLoading:s,disabled:c,iconStrokeWidth:g,onValidate:h,goToLinkHandler:b})=>t===p&&null!==o&&void 0!==o&&o.links?0===o.links.length?l.createElement(r.fI,{className:"optimise__row-mb-24"},l.createElement(r.Fc,{message:e("No links found."),type:"info"})):l.createElement(l.Fragment,null,l.createElement(r.fI,{className:"optimise__row-mb-14"},l.createElement("div",{className:"optimise__title-wrapper"},l.createElement(u,{__:e,summary:o.summary,setSelectedTags:d,selectedTags:a}),l.createElement(r.$n,{disabled:c,loading:s,onClick:h,icon:l.createElement(n.Ay,{icon:"SyncOutlined",size:16,strokeWidth:g})},e("Refresh")))),l.createElement(r.fI,{className:"optimise__row-mb-24"},l.createElement(r.fv,{span:24},l.createElement(r.B8,{itemLayout:"horizontal",dataSource:i,renderItem:(t,o)=>{var i,a,d;return l.createElement(r.B8.Item,{className:r.CN,key:o+"_"+t.linkId},l.createElement(r.B8.Item.Meta,{avatar:t.status===m.dO?l.createElement(n.Ay,{icon:"CheckCircleFilled",className:m.dO}):t.status===m.e8?l.createElement(n.Ay,{icon:"CheckCircleFilled",className:m.e8}):l.createElement(n.Ay,{icon:"CloseCircleFilled",className:m.Sr}),title:l.createElement(r.N_,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>b(t.linkId,600>(t.statusCode||0)&&(t.statusCode||0)>399||!t.statusCode)},""===t.url?e("empty link"):t.url),description:l.createElement(l.Fragment,null,!(null===(i=t.text)||void 0===i||!i.length)&&l.createElement(r.EY,{type:"secondary"},t.text),(null===(a=t.page)||void 0===a?void 0:a.title)&&t.page.title,(null===(d=t.page)||void 0===d?void 0:d.secure)&&t.status===m.dO&&l.createElement(l.Fragment,null,l.createElement("span",{className:"image-size-splitter"},"\xa0\u2022\xa0"),l.createElement("span",{className:m.dO},e("secure"))),!t.resolvedUrl&&!t.statusCode&&"url"===t.type&&l.createElement(l.Fragment,null,l.createElement("span",{className:"image-size-splitter"},"\xa0\u2022\xa0"),l.createElement(r.EY,{type:"secondary"},e("Failed to load"))))}))}})))):null);g.displayName="LinksSection";const{IMAGES:h}=m.qG,b=(0,l.memo)(({__:e,activeTab:t,validateImagesResult:o,validateImages:i,selectedTags:a,setSelectedTags:d,isLoading:c,disabled:p,iconStrokeWidth:g,onValidate:b,goToImageHandler:f,showImgPreviewHandler:v,hideBlockPreviewHandler:_})=>{var E,S;return t===h&&null!==o&&void 0!==o&&o.images?0===o.images.length?l.createElement(r.fI,{className:"optimise__row-mb-24"},l.createElement(r.Fc,{message:e("No images found."),type:"info"})):l.createElement(l.Fragment,null,l.createElement(r.fI,{className:"optimise__row-mb-16"},l.createElement(r.Fc,{className:"optimise__alert-custom",message:l.createElement("div",{className:"optimise__summary"},l.createElement("div",null,l.createElement(r.hE,{level:4,className:"optimise__summary-title"},o.images.length," "),l.createElement("span",{className:"optimise__summary-label"},e("images"))),l.createElement("div",null,l.createElement(r.hE,{level:4,className:"optimise__summary-title"},null===(E=o.summaryTime)||void 0===E?void 0:E.value,null===(S=o.summaryTime)||void 0===S?void 0:S.name),l.createElement("span",{className:"optimise__summary-label"},e("total size"))),l.createElement("div",null,l.createElement(r.hE,{level:4,className:"optimise__summary-title"},(Math.max(...o.images.map(e=>e.image.responseTime))/1e3).toFixed(2)+e("s")),l.createElement("span",{className:"optimise__summary-label"},e("time to load")))),type:"warning"})),l.createElement(r.fI,{className:"optimise__row-mb-12"},l.createElement("div",{className:"optimise__title-wrapper"},l.createElement(u,{__:e,summary:o.summary,setSelectedTags:d,selectedTags:a}),l.createElement(r.$n,{icon:l.createElement(n.Ay,{icon:"SyncOutlined",size:16,strokeWidth:g}),disabled:p,loading:c,onClick:b},e("Refresh")))),l.createElement(r.fI,{className:"optimise__row-mb-12"},l.createElement(r.fv,{span:24},l.createElement(r.B8,{className:"optimise__result-list",itemLayout:"horizontal",dataSource:i,renderItem:(t,o)=>l.createElement(r.B8.Item,{className:`optimise__image-item image-item ${r.CN}`,key:o},l.createElement(r.B8.Item.Meta,{className:s()("image-item__meta",{"image-item__meta_fail":!t.resolvedUrl&&!t.statusCode}),avatar:l.createElement(r._V,{className:s()("image-item__image optimise__image-auto-height",{"image-item__image_fail":!t.resolvedUrl||!t.valid}),width:92,height:"auto",src:t.resolvedUrl||"",preview:!1,onMouseEnter:()=>{var e;return v(t.url,null===(e=t.image.dimensions)||void 0===e?void 0:e.width)},onMouseLeave:()=>_()}),title:t.url?l.createElement(r.m_,{placement:"top",title:t.message},l.createElement(r.N_,{className:"optimise__link optimise__link-blue",draggable:!1,onClick:()=>f(t.imageId,600>(t.statusCode||0)&&(t.statusCode||0)>399||!t.statusCode)},""===(null===t||void 0===t?void 0:t.url)?e("empty src"):t.url)):t.message,description:l.createElement(l.Fragment,null,l.createElement("div",{className:"image-size"},t.image.dimensions&&l.createElement(l.Fragment,null,t.image.dimensions.width+" \xd7 "+t.image.dimensions.height,l.createElement("span",{className:"image-size-splitter"}," \xa0\u2022\xa0 "),l.createElement("span",null,Math.round(t.image.bytes/1024),e("kB")),l.createElement("span",{className:"image-size-splitter"}," \xa0\u2022\xa0 "),l.createElement("span",null,t.image.responseTime,e("ms")),l.createElement("span",{className:"image-size-splitter"}," \xa0\u2022\xa0 "),l.createElement("span",{className:"image-size-format"},t.image.contentType)),t.image.secure&&l.createElement(l.Fragment,null,l.createElement("span",{className:"image-size-splitter"}," \xa0\u2022\xa0 "),l.createElement("span",{className:m.dO},e("secure"))),t.resolvedUrl&&!t.valid&&l.createElement(r.EY,{type:"danger"},e("not valid"))),!t.resolvedUrl&&!t.statusCode&&l.createElement(r.EY,{type:"danger"},e("Failed to load")))}))})))):null});b.displayName="ImagesSection";const{SPAM_ASSASSIN:f}=m.qG,v=(0,l.memo)(({__:e,activeTab:t,validateSpamResult:o,isLoading:i,disabled:a,iconStrokeWidth:d,onValidate:s})=>{var m,c;const u=(null===o||void 0===o||null===(m=o.report)||void 0===m?void 0:m.length)||Object.prototype.hasOwnProperty.call(o,"spamScore");if(t!==f||!u)return null;const p=o.spamScore||0,g=o.baseSpamScore||0,h=p<2||!o.spamScore||p<=g-1?"success":p<g-1?"warning":"danger";return l.createElement(l.Fragment,null,l.createElement(r.fI,{className:"optimise__row-mb-8"},l.createElement("div",{className:"optimise__title-wrapper optimise__title-wrapper_spam"},l.createElement(r.hE,{level:1,className:"optimise__spam-score-title",type:h},l.createElement("span",{className:"optimise__spam-score-value"},p),l.createElement(r.EY,{className:"optimise__spam-score-text"},"Score")),l.createElement(r.$n,{disabled:a,icon:l.createElement(n.Ay,{icon:"SyncOutlined",size:16,strokeWidth:d}),loading:i,onClick:s},e("Refresh"))),p>g-1&&l.createElement(r.EY,null,e("Lower scores are better. Aim for a score less than ")+(g-1)+".")),l.createElement(r.fI,{className:"optimise__row-mb-8"},l.createElement(r.fv,{span:24},((null===(c=o.report)||void 0===c?void 0:c.length)||0)>0?l.createElement(r.B8,{itemLayout:"horizontal",dataSource:o.report,renderItem:e=>l.createElement(r.B8.Item,{className:r.CN},l.createElement(r.B8.Item.Meta,{title:l.createElement(l.Fragment,null,l.createElement(r.EY,{className:"optimise__spam-report-score"},e.score),l.createElement("span",{className:"optimise__spam-report-description"},e.description))}))}):l.createElement(l.Fragment,null,0===o.spamScore&&e("Your email doesn't look like spam.")))))});v.displayName="SpamSection";const{PROBLEMS:_}=m.qG,E=(0,l.memo)(({__:e,activeTab:t,problemsList:o,onSetMonacoPosition:i})=>t!==_?null:null!==o&&void 0!==o&&o.length?l.createElement(r.fI,{className:"optimise__row-mb-8"},l.createElement(r.fv,{span:24},l.createElement(r.B8,{itemLayout:"horizontal",dataSource:o,renderItem:e=>l.createElement(r.B8.Item,{className:r.CN},l.createElement(r.B8.Item.Meta,{avatar:e.severity<6?l.createElement(n.Ay,{icon:"CloseCircleFilled",className:m.e8}):l.createElement(n.Ay,{icon:"CloseCircleFilled",className:m.Sr}),title:l.createElement(r.EY,{onClick:()=>i(e),className:s()("optimise__text-clickable",{warning:e.severity<6,error:e.severity>=6})},"Line: ",e.startLineNumber," ",e.startLineNumber!==e.endLineNumber&&" \u2013 "+e.endLineNumber),description:l.createElement(r.EY,null,e.message)}))}))):l.createElement(r.fI,{className:"optimise__row-mb-24"},l.createElement(r.Fc,{message:e("No problems found."),type:"info"})));E.displayName="ProblemsSection";var S=o(70339),y=o(57701),w=o(52898),k=o(487),B=o(6403),R=o(7714),x=o(65185),T=o(68876),I=o(47706),A=o(7314),C=o(91480),N=o(65893);const P={activeTab:"",selectedTags:[],validateLinks:[],validateImages:[],validateSpamResult:{},optimisationCounter:0,validateLinksResult:{},validateImagesResult:{}},L=(e,t)=>{switch(t.type){case"SET_ACTIVE_TAB":return{...e,activeTab:t.payload!==e.activeTab?t.payload:""};case"SET_SELECTED_TAGS":return{...e,selectedTags:t.payload};case"SET_VALIDATE_LINKS":return{...e,validateLinks:t.payload};case"SET_VALIDATE_IMAGES":return{...e,validateImages:t.payload};case"SET_VALIDATE_SPAM_RESULT":return{...e,validateSpamResult:t.payload};case"SET_OPTIMISATION_COUNTER":return{...e,optimisationCounter:t.payload};case"INCREMENT_OPTIMISATION_COUNTER":return{...e,optimisationCounter:e.optimisationCounter+1};case"SET_VALIDATE_LINKS_RESULT":return{...e,validateLinksResult:t.payload};case"SET_VALIDATE_IMAGES_RESULT":return{...e,validateImagesResult:t.payload};case"RESET_SELECTED_TAGS":return{...e,selectedTags:[]};default:return e}},{LINKS:F,IMAGES:O}=m.qG,V=e=>{var t,o,l,i;if(null!==e.statusCode?e.statusCode<300&&(null===(t=null===(o=e.page)||void 0===o?void 0:o.secure)||void 0===t||t):"invalid"!==e.type)return m.dO;return(e.statusCode&&e.statusCode<400||200===e.statusCode&&(null===(l=null===(i=e.page)||void 0===i?void 0:i.secure)||void 0===l||l))&&"invalid"!==e.type?m.e8:m.Sr},M=e=>null!==e.statusCode&&e.statusCode<300?m.dO:e.statusCode<400&&e.statusCode>=300||200===e.statusCode&&!e.valid?m.e8:m.Sr,D=e=>({valid:e.filter(e=>e.status===m.dO).length,warnings:e.filter(e=>e.status===m.e8).length,errors:e.filter(e=>e.status===m.Sr).length});var H=o(54729),z=o(50003),W=o(37444);const{LINKS:U,IMAGES:$,SPAM_ASSASSIN:G,PROBLEMS:j}=m.qG,X=()=>{var e,t,o,d;const{__:s,_n:c}=(0,I.s9)(),u=(0,a.wA)(),p=(0,i.Zp)(),h=(0,B.hN)(),f=(0,A.fn)(),_=(0,T.rD)(),{emailId:X,projectId:q}=(0,i.g)(),[Y,K]=(0,l.useState)(null),Q=(0,l.useRef)(!1),[J]=(0,y.Oq)(),Z=(0,l.useCallback)(e=>{K(e)},[]),ee=(0,l.useCallback)((e,t)=>{var o;if(401===(null===e||void 0===e?void 0:e.status)&&(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.code)===S.wv){return Z({presetId:{link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"}[t],previousDisplay:s("\u2014"),nextDisplay:(0,z.hO)("infinity")}),u(y.B3.util.invalidateTags(["LimitsStats","LimitsWarnings"])),!0}return!1},[u,s,Z]),te=(0,l.useCallback)(async e=>{var t;if(m.EW.isPlugin)return!0;const o=await J(e),l=(0,W.c0)(e,null===(t=o.data)||void 0===t?void 0:t.stats);return!l||(Z({presetId:l.presetId,previousDisplay:l.previousLimit,nextDisplay:(0,z.hO)(l.nextLimit)}),u(y.B3.util.invalidateTags(["LimitsStats","LimitsWarnings"])),!1)},[u,J,Z]),oe=(0,R.QC)(),le=(0,a.d4)(w.rd),ie=(0,x.ml)(N.AZ.ON_LIMIT_ID),ae=(0,C.u)(),[re,ne]=(0,l.useReducer)(L,P),[de,se]=(0,S.Sr)(),[me,ce]=(0,S.ku)(),[ue,pe]=(0,S.Ju)(),{data:ge,isSuccess:he,refetch:be}=(0,k.fo)(+(q||0),{skip:!!m.EW.isPlugin||!+q}),fe=(0,l.useCallback)(e=>ne({type:"SET_OPTIMISATION_COUNTER",payload:e}),[]),ve=(0,l.useCallback)(e=>ne({type:"SET_VALIDATE_LINKS",payload:e}),[]),_e=(0,l.useCallback)(e=>ne({type:"SET_VALIDATE_IMAGES",payload:e}),[]),Ee=(0,l.useCallback)(e=>ne({type:"SET_SELECTED_TAGS",payload:e}),[]),{limitsInPlugin:Se,currentBillingOptimisationLimits:ye,disableFields:we}=(({appConfig:e,data:t,isSuccess:o,optimisationCounter:i,setOptimisationCounter:a})=>{const r=(0,l.useMemo)(()=>!(!e.limits||!e.counters)&&m.EW.isPlugin,[e]),{limits:n}=(0,l.useMemo)(()=>m.EW.isPlugin?e.limits?e:{limits:{optimization_limit:0}}:null!==t&&void 0!==t&&t.limits?t:{limits:{optimization_limit:0}},[e,t]),d=(0,l.useMemo)(()=>n.optimization_limit,[n]),s=(0,l.useMemo)(()=>i>=d&&d>0,[i,d]);return(0,l.useEffect)(()=>{if(r){var l;a((null===e||void 0===e||null===(l=e.counters)||void 0===l?void 0:l.optimization_counter)||0)}else{const e=null===t||void 0===t?void 0:t.counters;o&&null!==e&&void 0!==e&&e.optimization_counter&&a(e.optimization_counter)}},[r,t,o,e,a]),{limitsInPlugin:r,currentBillingOptimisationLimits:d,disableFields:s}})({appConfig:_,data:ge,isSuccess:he,optimisationCounter:re.optimisationCounter,setOptimisationCounter:fe});(({activeTab:e,selectedTags:t,validateLinksResult:o,validateImagesResult:i,setValidateLinks:a,setValidateImages:r})=>{(0,l.useEffect)(()=>{e===F&&o.links&&a(t.length>0?o.links.filter(e=>t.includes(e.status)):o.links),e===O&&i.images&&r(t.length>0?i.images.filter(e=>t.includes(e.status)):i.images)},[o.links,i.images,t,e,a,r])})({activeTab:re.activeTab,selectedTags:re.selectedTags,validateLinksResult:re.validateLinksResult,validateImagesResult:re.validateImagesResult,setValidateLinks:ve,setValidateImages:_e});const{showImgPreviewHandler:ke,hideBlockPreviewHandler:Be}=(()=>{const e=(0,l.useRef)(null);return{showImgPreviewHandler:(0,l.useCallback)((t,o)=>{e.current&&clearTimeout(e.current);let l=document.querySelector(".img-preview"),i=document.querySelector(".img-preview-content");var a;document.querySelector(".img-preview")||(l=document.createElement("div"),l.classList.add("img-preview"),i=document.createElement("div"),i.classList.add("img-preview-content"),l.append(i),null===(a=document.querySelector(".email-pane__col_settings-inner"))||void 0===a||a.append(l)),i&&(i.innerHTML=`<table cellspacing="0" cellpadding="0" border="0" width="100%"><img height="auto" width=${(o||0)+"px"} alt="" style="max-width: 100%; object-fit: contain" src=${t}></table>`),l&&"1"!==l.style.opacity&&setTimeout(()=>{l&&(l.style.opacity="1",l.style.transform="translateX(-100%)")},10)},[]),hideBlockPreviewHandler:(0,l.useCallback)(()=>{const t=document.querySelector(".img-preview");t&&(e.current=setTimeout(()=>{t&&(t.style.opacity="0",t.style.transform="translateX(-99%)",setTimeout(()=>{null===t||void 0===t||t.remove()},300))},300))},[])}})(),Re=(0,l.useCallback)(()=>{ie.fire({name:"OptimizationCount",count:re.optimisationCounter+1})},[ie,re.optimisationCounter]),xe=(0,l.useCallback)((e,t)=>{oe.send({operation:m.Ru.SANDBOX_SET_POSITION_TO_LINK,settings:{elementId:e,isError:t}})},[oe]),Te=(0,l.useCallback)((e,t)=>{oe.send({operation:m.Ru.SANDBOX_SET_POSITION_TO_IMG,settings:{elementId:e,isError:t}})},[oe]),Ie=(0,l.useCallback)(e=>{const t={startColumn:e.startColumn,startLineNumber:e.startLineNumber,endColumn:e.endColumn,endLineNumber:e.endLineNumber};u((0,w.ps)(t))},[u]),Ae=(0,l.useCallback)(e=>{ne({type:"SET_ACTIVE_TAB",payload:e}),ne({type:"RESET_SELECTED_TAGS"}),e===j&&(null===le||void 0===le?void 0:le.length)>0&&ae({event:"check",action:"check_email_code",email_id:X,project_id:q,problems_count:(null===le||void 0===le?void 0:le.length)||0})},[le,ae,X,q]),Ce=(0,l.useCallback)(async()=>{if(!X)return void h.error({message:"Save the mail first."});if(we)return void Z({presetId:"optimization_exceeded",previousDisplay:ye,nextDisplay:(0,z.hO)("infinity")});if(!await te("link_check"))return;Se&&(ne({type:"INCREMENT_OPTIMISATION_COUNTER"}),Re());const e=f.getValue(),t=(new DOMParser).parseFromString(e,"text/html"),o={},l={};t.querySelectorAll("a[href]").forEach((e,t)=>{o[`link_${t}`]=e.getAttribute("href"),l[`link_${t}`]=e.textContent||""}),oe.send({operation:"sandbox_set_attr_to_links"}),me({entity_id:X,data:o}).then(({data:e,error:t})=>{if(t)ee(t,"link_check")||h.error({error:t});else if(null!==e&&void 0!==e&&e.result){var o;const t=[...e.result];null===t||void 0===t||t.sort((e,t)=>e.linkId-t.linkId);const i=t.map(e=>({...e,text:l[e.linkId],status:V(e)})),a={links:i,summary:D(i)};ne({type:"SET_VALIDATE_LINKS_RESULT",payload:a}),h.success(s("Links validation was successfully completed")),e.limit_warning&&null!=e.limit_remaining&&h.warning({message:`${s("Approaching usage limit. Remaining")}: ${e.limit_remaining}`}),ae({event:"check",action:"check_email_links",email_id:X,project_id:q,links_count:(null===(o=a.links)||void 0===o?void 0:o.length)||0}),!m.EW.isPlugin&&be()}else e.statusCode>300||!e.success?h.error({error:{data:e}}):h.error({message:s("Something went wrong.")}),!re.validateLinksResult.links&&Ae("")}).catch(e=>{ee(e,"link_check")||h.error({error:e})})},[X,Se,we,ye,Z,f,oe,me,h,s,ae,q,be,Re,re.validateLinksResult.links,ee,te]),Ne=(0,l.useCallback)(async()=>{if(!X)return void h.error({message:"Save the mail first."});if(we)return void Z({presetId:"optimization_exceeded",previousDisplay:ye,nextDisplay:(0,z.hO)("infinity")});if(!await te("image_check"))return;Se&&(ne({type:"INCREMENT_OPTIMISATION_COUNTER"}),Re());const e=f.getValue(),t=(new DOMParser).parseFromString(e,"text/html"),o={};t.querySelectorAll("img").forEach((e,t)=>o[`image_${t}`]=e.src),oe.send({operation:"sandbox_set_attr_to_images"}),ue({entity_id:X,data:o}).then(({data:e,error:t})=>{let o;if(t)ee(t,"image_check")||h.error({error:t});else if(null!==e&&void 0!==e&&e.result){var l;const t=Object.values(e.result);t.sort((e,t)=>e.imageId-t.imageId);const i=t.reduce((e,t)=>e+Math.round(t.image.bytes/1024),0);o={images:t.map(e=>({...e,status:M(e)}))||[],summary:D(t.map(e=>({...e,status:M(e)}))),summaryTime:{value:(i>1200?i/1e3:i).toFixed(1),name:s(i>1200?"MB":"KB")}},o&&ne({type:"SET_VALIDATE_IMAGES_RESULT",payload:o}),h.success(s("Images validation was successfully completed")),e.limit_warning&&null!=e.limit_remaining&&h.warning({message:`${s("Approaching usage limit. Remaining")}: ${e.limit_remaining}`}),ae({event:"check",action:"check_email_images",email_id:X,project_id:q,images_count:(null===(l=o.images)||void 0===l?void 0:l.length)||0}),!m.EW.isPlugin&&be()}else{var i,a;e.statusCode>300||!e.success?h.error({error:{data:e}}):h.error({message:s("Something went wrong.")}),(null===(i=re.validateImagesResult)||void 0===i||null===(a=i.images)||void 0===a||!a.length)&&Ae("")}}).catch(e=>{ee(e,"image_check")||h.error({error:e})})},[X,Se,we,ye,Z,f,oe,ue,h,s,ae,q,be,Re,re.validateImagesResult,ee,te]),Pe=(0,l.useCallback)(async()=>{X?we?Z({presetId:"optimization_exceeded",previousDisplay:ye,nextDisplay:(0,z.hO)("infinity")}):await te("spam_check")&&(Se&&(ne({type:"INCREMENT_OPTIMISATION_COUNTER"}),Re()),de({entity_id:X,data:{html:f.getValue()}}).then(({data:e,error:t})=>{if(t)ee(t,"spam_check")||h.error({error:t});else if(e&&e.success){var o;const t=!!e.result.report&&Object.values(e.result.report);t?(t.sort((e,t)=>e.score-t.score),ne({type:"SET_VALIDATE_SPAM_RESULT",payload:{...e.result,report:t}})):e.result&&ne({type:"SET_VALIDATE_SPAM_RESULT",payload:{...e.result,report:t}}),h.success(s("Spam validation was successfully completed")),e.limit_warning&&null!=e.limit_remaining&&h.warning({message:`${s("Approaching usage limit. Remaining")}: ${e.limit_remaining}`}),ae({event:"check",action:"check_email_spam",email_id:X,project_id:q,spam_score:(null===(o=e.result)||void 0===o?void 0:o.spamScore)||0}),!m.EW.isPlugin&&be()}else{var l,i;e.statusCode>300||!e.success?h.error({error:{data:e}}):h.error({message:s("Something went wrong.")}),(null===(l=re.validateSpamResult)||void 0===l||null===(i=l.report)||void 0===i||!i.length)&&Ae("")}}).catch(e=>{ee(e,"spam_check")||h.error({error:e})})):h.error({message:"Save the mail first."})},[X,Se,we,ye,Z,f,de,h,s,ae,q,be,Re,re.validateSpamResult,ee,te]);(0,l.useEffect)(()=>{ye>0&&re.optimisationCounter>=+ye?Q.current||(Q.current=!0,Z({presetId:"optimization_exceeded",previousDisplay:ye,nextDisplay:(0,z.hO)("infinity")})):Q.current=!1},[re.optimisationCounter,ye,Z]);const Le=Y?(0,z.Si)(Y.presetId):null;return l.createElement("div",{className:"optimise selected_form-props-wrapper selected_form-props-wrapper_optimize"},Le&&Y?l.createElement(H.X,{open:!0,onClose:()=>K(null),title:s(Le.titleKey),subtitle:s(Le.subtitleKey),usageResource:Le.usageResource,previousDisplay:Y.previousDisplay,nextDisplay:Y.nextDisplay,onChangePlan:()=>{K(null),p("/billing")}}):null,Se&&l.createElement(r.xl,{text:`${re.optimisationCounter} ${s("of")} ${ye>0?ye:"\u221e"} ${c("test","tests",ye)} ${c("was used","were used",re.optimisationCounter)}`,exceeded:ye>0&&re.optimisationCounter>=ye,extra:l.createElement("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>p(_.billingPageUrl||m.vc.billing)},s("Need more?"))}),_.optimizeLinksEnabled&&l.createElement(l.Fragment,null,l.createElement(r.cG,{className:"selected-td-form__divider optimise__divider-no-margin"}),l.createElement(r.fI,{gutter:10,align:"middle"},l.createElement(r.fv,{span:20},l.createElement("div",{style:{padding:"15px 0"}},s("Links validation"))),l.createElement(r.fv,{span:4,className:"optimise__col-align-right"},l.createElement(r.$n,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:e=>e.preventDefault(),onClick:()=>{var e,t;Ae(U),null!==(e=re.validateLinksResult)&&void 0!==e&&null!==(t=e.links)&&void 0!==t&&t.length||re.activeTab===U||Ce()},loading:ce.isLoading,disabled:we&&!(null!==(e=re.validateLinksResult)&&void 0!==e&&null!==(t=e.links)&&void 0!==t&&t.length)},!ce.isLoading&&(re.activeTab===U?l.createElement(n.Ay,{icon:"DownOutlined",size:16,strokeWidth:_.iconStrokeWidth}):l.createElement(n.Ay,{icon:"RightOutlined",size:16,strokeWidth:_.iconStrokeWidth}))))),l.createElement(g,{__:s,activeTab:re.activeTab,validateLinksResult:re.validateLinksResult,validateLinks:re.validateLinks,selectedTags:re.selectedTags,setSelectedTags:Ee,isLoading:ce.isLoading,disabled:we,iconStrokeWidth:_.iconStrokeWidth,onValidate:Ce,goToLinkHandler:xe})),_.optimizeImagesEnabled&&l.createElement(l.Fragment,null,l.createElement(r.cG,{className:"selected-td-form__divider optimise__divider-no-margin"}),l.createElement(r.fI,{gutter:10,align:"middle"},l.createElement(r.fv,{span:20},l.createElement("div",{style:{padding:"15px 0"}},s("Images validation"))),l.createElement(r.fv,{span:4,className:"optimise__col-align-right"},l.createElement(r.$n,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:e=>e.preventDefault(),onClick:()=>{var e,t;Ae($),null!==(e=re.validateImagesResult)&&void 0!==e&&null!==(t=e.images)&&void 0!==t&&t.length||re.activeTab===$||Ne()},loading:pe.isLoading},!pe.isLoading&&(re.activeTab===$?l.createElement(n.Ay,{icon:"DownOutlined",size:16,strokeWidth:_.iconStrokeWidth}):l.createElement(n.Ay,{icon:"RightOutlined",size:16,strokeWidth:_.iconStrokeWidth}))))),l.createElement(b,{__:s,activeTab:re.activeTab,validateImagesResult:re.validateImagesResult,validateImages:re.validateImages,selectedTags:re.selectedTags,setSelectedTags:Ee,isLoading:pe.isLoading,disabled:we,iconStrokeWidth:_.iconStrokeWidth,onValidate:Ne,goToImageHandler:Te,showImgPreviewHandler:ke,hideBlockPreviewHandler:Be})),_.optimizeSpamAssassinEnabled&&l.createElement(l.Fragment,null,l.createElement(r.cG,{className:"selected-td-form__divider optimise__divider-no-margin"}),l.createElement(r.fI,{gutter:10,align:"middle"},l.createElement(r.fv,{span:20},l.createElement("div",{style:{padding:"15px 0"}},s("SpamAssassin"))),l.createElement(r.fv,{span:4,className:"optimise__col-align-right"},l.createElement(r.$n,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:e=>e.preventDefault(),loading:se.isLoading,onClick:()=>{var e;Ae(G),null!==(e=re.validateSpamResult.report)&&void 0!==e&&e.length||Object.prototype.hasOwnProperty.call(re.validateSpamResult,"spamScore")||Pe()},disabled:we&&!(null!==(o=re.validateSpamResult)&&void 0!==o&&null!==(d=o.report)&&void 0!==d&&d.length||Object.prototype.hasOwnProperty.call(re.validateSpamResult,"spamScore"))},!se.isLoading&&(re.activeTab===G?l.createElement(n.Ay,{icon:"DownOutlined",size:16,strokeWidth:_.iconStrokeWidth}):l.createElement(n.Ay,{icon:"RightOutlined",size:16,strokeWidth:_.iconStrokeWidth}))))),l.createElement(v,{__:s,activeTab:re.activeTab,validateSpamResult:re.validateSpamResult,isLoading:se.isLoading,disabled:we,iconStrokeWidth:_.iconStrokeWidth,onValidate:Pe})),_.optimizeCheckCodeEnabled&&l.createElement(l.Fragment,null,l.createElement(r.cG,{className:"selected-td-form__divider optimise__divider-no-margin"}),l.createElement(r.fI,{gutter:10,align:"middle"},l.createElement(r.fv,{span:20},l.createElement("div",{style:{padding:"15px 0"}},s("Source code validation"))),l.createElement(r.fv,{span:4,className:"optimise__col-align-right"},l.createElement(r.$n,{className:"selected-td-form__button ghost-button",type:"text",onMouseDown:e=>e.preventDefault(),onClick:()=>Ae(j)},re.activeTab===j?l.createElement(n.Ay,{icon:"DownOutlined",size:16,strokeWidth:_.iconStrokeWidth}):l.createElement(n.Ay,{icon:"RightOutlined",size:16,strokeWidth:_.iconStrokeWidth})))),l.createElement(E,{__:s,activeTab:re.activeTab,problemsList:le,onSetMonacoPosition:Ie})))}},12650:(e,t,o)=>{o.d(t,{A:()=>a});var l=o(1936),i=o(57549);const a=({small:e=!1,style:t={}})=>{const o={width:e?"100%":"100vw",height:"80vh",...t};return l.createElement(i.so,{justify:"center",align:"center",style:o},l.createElement(i.tK,{size:"large"}))}},44454:(e,t,o)=>{o.d(t,{A:()=>p});var l=o(1936),i=o(84075),a=o(88260),r=o(6403),n=o(51432),d=o(41244),s=o(91480),m=o(2527),c=o(93506);const u="emailmaker.ru",p=({children:e})=>{const t=(0,i.zy)(),o=(0,r.hN)(),p=(0,m.p)(),[g,h]=(0,a.ok)(),b=(0,s.u)(),[f,{isError:v,isSuccess:_,error:E,data:S}]=(0,n.i2)(),{isError:y,isUninitialized:w,isLoading:k,isSuccess:B,error:R,data:x,refetch:T}=(0,n.CR)("",{skip:c.EW.isPlugin||!p.get(c.A9.em_token)}),I=(0,l.useMemo)(()=>({email:g.get("email"),hash:g.get("hash"),event:"confirmation"===g.get("event")}),[g]);if((0,l.useEffect)(()=>{v?o.error({error:E}):_&&(b({event:"confirm",action:"confirm_email",user_email:(null===S||void 0===S?void 0:S.email)||I.email,user_id:null===x||void 0===x?void 0:x.id}),o.success(S.message),x&&T())},[S,E,v,_,x,T,b]),(0,l.useEffect)(()=>{!(I.email&&I.hash&&I.event)||!1!==(null===x||void 0===x?void 0:x.email_confirmation)&&p.get(c.A9.em_token)||S||f({hash:I.hash,email:I.email,event:I.event}).catch(e=>{}).finally(()=>h(""))},[I,f,x,p,h,S]),(0,l.useEffect)(()=>{y&&R&&(o.error({error:R}),(0,d.Id)(p))},[x,y,R,p]),c.EW.isPlugin)return e;if(!c.EW.isPlugin&&!p.get(c.A9.em_token)&&!t.pathname.includes("auth"))return l.createElement(i.C5,{to:"/auth",state:{from:t}});if((w||k)&&!t.pathname.includes("auth"))return l.createElement(l.Fragment,null);if(y&&!t.pathname.includes("auth"))return l.createElement(i.C5,{to:"/auth",state:{from:t}});if(B){const{id:o,email:a,name:r,locale:n,carrotquest_hash:d,ducalis_hash:s,email_subscription_consent:m,last_used_project:g}=x;return p.set(c.A9.em_id,o,{domain:u}),p.set(c.A9.em_email,a,{domain:u}),p.set(c.A9.em_name,r,{domain:u}),p.set(c.A9.em_locale,n,{domain:u}),p.set(c.A9.em_carrotquest_hash,d,{domain:u}),p.set(c.A9.em_ducalis_hash,s,{domain:u}),p.set(c.A9.em_email_subscription_consent,m,{domain:u}),g&&"/"===t.pathname?l.createElement(i.C5,{to:`/projects/${g}/emails`,replace:!0}):e}return t.pathname.includes("auth")?e:void 0}},40146:(e,t,o)=>{o.d(t,{A:()=>c});var l=o(1936),i=o(57549),a=o(69962),r=o(47706),n=o(6403),d=o(89591),s=o(78443),m=o(93506);const c=({email:e,onUpdated:t})=>{const{__:o}=(0,r.s9)(),c=(0,a.wA)(),[u]=i.lV.useForm(),p=(0,l.useRef)(null),g=(0,n.hN)(),h=(0,a.d4)(s.cL)===m.lx.RENAME_EMAIL_MODAL,[b,f]=(0,d.dN)(),{id:v=null,title:_=""}=e||{};(0,l.useEffect)(()=>{h&&(u.setFieldsValue({name:_}),setTimeout(()=>{var e;return null===(e=p.current)||void 0===e?void 0:e.focus()},0))},[h,_,u]);const E=(0,l.useCallback)(()=>c((0,s.Oo)()),[c]),S=(0,l.useCallback)(()=>{u.validateFields().then(({name:e})=>{const l=(e||"").trim();l?b({emailId:v,title:l}).then(e=>{var l,i;null!==e&&void 0!==e&&e.error?g.error({message:null===(l=e.error.data)||void 0===l?void 0:l.code,description:null===(i=e.error.data)||void 0===i?void 0:i.message}):(g.success({message:o("The email was successfully renamed.")}),t&&t(),E())}):g.error({message:o("Title should not be empty")})})},[u,g,o,b,v,t,E]),y=(0,l.useMemo)(()=>({color:"var(--colorTextSecondary)"}),[]),w=(0,l.useMemo)(()=>l.createElement("span",{style:y},o("Email name")),[o,y]),k=(0,l.useMemo)(()=>[{required:!0,message:o("Please enter the email name")}],[o]),B=(0,l.useMemo)(()=>({remember:!1,name:_}),[_]),R=(0,l.useMemo)(()=>({paddingTop:10}),[]),x=(0,l.useMemo)(()=>({marginBottom:5}),[]),T=(0,l.useMemo)(()=>[l.createElement(i.$n,{key:"submit",type:"primary",size:"large",loading:f.isLoading,onClick:S},o("Done"))],[o,f.isLoading,S]);return l.createElement(i.aF,{title:o("Rename email"),open:h,onOk:S,onCancel:E,className:"new-folder-name-modal",footer:T},l.createElement(i.lV,{form:u,layout:"vertical",name:"rename_email_form",onFinish:S,initialValues:B,autoComplete:"off",requiredMark:!1,style:R},l.createElement(i.lV.Item,{name:"name",label:w,rules:k},l.createElement(i.pd,{disabled:f.isLoading,size:"large",placeholder:o("Enter the email name"),ref:p,style:x}))))}},98612:(e,t,o)=>{o.d(t,{A:()=>S});var l=o(1936),i=o(96040),a=o(57549),r=o(6403),n=o(84075),d=o(69962),s=o(47706),m=o(48155),c=o.n(m),u=o(45988),p=o(487),g=o(87796),h=o(15582),b=o(68069),f=o(41244),v=o(91480),_=o(7314),E=o(93506);const S=({block:e=null,isEditableRights:t,rightCol:o,autoSaveBlockResult:m,disabled:S})=>{const{__:y}=(0,s.s9)(),{projectId:w,blockId:k}=(0,n.g)();let B=(0,d.d4)(b.Fv),R=(0,d.d4)(b.Fv),x=(0,d.wA)();const T=(0,r.hN)(),I=(0,_.fn)(),A=(0,d.Pj)(),[C,N]=(0,l.useState)(!1),[P,L]=(0,l.useState)(null),[F,O]=(0,l.useState)(!1),[V,M]=(0,l.useState)(!1),D=(0,v.u)();(0,l.useEffect)(()=>{var e,t;null!==(e=window)&&void 0!==e&&null!==(t=e.navigator)&&void 0!==t&&t.userAgent.includes("Macintosh")&&L(!0)},[]);const{data:H,refetch:z}=(0,p.fo)(+w,{skip:!+w}),[W]=(0,u.Gr)(),[U,$]=(0,u.OZ)(),[G,j]=(0,u.pP)(),[X]=(0,p.OD)(),q=`project_${w}`,Y=H&&(0,f._q)(H,E.YY).find(e=>e.name===q),K=H&&(0,f.HT)(H,E.YY),Q=(0,l.useCallback)(o=>{var l,i;if(O(!0),!t&&e.lock&&V)return T.error({id:"BLOCK_ACCESS_TO_LOCKED_ERROR",message:y("No access to edit the letter."),data:(0,r.x_)(e)}),void O(!1);if(((null===(l=e.tags)||void 0===l?void 0:l.length)||(null===(i=e.blocktags)||void 0===i?void 0:i.length))>10&&V)return T.error({id:"BLOCK_TOO_MANY_TAGS_ERROR",message:y("Maximum 10 tags available."),data:(0,r.x_)(e)}),void O(!1);if(""===e.type)return T.error({message:y("Set the type"),description:y("Please set the 'Type' field in the Settings section.")}),void O(!1);const a=t=>{var l;const i=null===(l=e.tags)||void 0===l?void 0:l.map(e=>{const o=null===K||void 0===K?void 0:K.find(t=>t.name===e);return o?o.id:W({name:e,parent:t}).then(({error:t,data:o})=>{var l,i;return 400===(null===t||void 0===t?void 0:t.status)?null===t||void 0===t||null===(l=t.data)||void 0===l||null===(i=l.data)||void 0===i?void 0:i.term_id:o?o.id:void(t&&(T.fromError("TAG_CREATING_ERROR",e,t),O(!1)))})}),a=(l=null)=>{const i=o=>{A.dispatch(g.kE.endpoints.getTags.initiate({parent:t})),z(),V&&(T.success({id:"BLOCK_EDITING_SUCCESS",message:y("The block was successfully saved.","block"),data:(0,r.x_)(e)}),O(!1)),fetch(((e,t,o,l)=>`https://scr.emcdn.ru/screenshot?delay=1000&width=800&fullPage=true&deviceScaleFactor=0.8&format=jpg&clearCache=true${l?`&cacheControl=true&cache-hash=${c()(l)}`:""}&url=${encodeURIComponent(`https://dev-backend-1.emailmaker.ru/get${e}/${o}?secret_hash=${c()(`${t}${o}${E.KI}`)}&raw=true`)}`)(E.IE,w,o.id,o.modified),{mode:"no-cors"}).then(()=>{})},a=(0,f._q)(e,E.zh).filter(t=>(l||e.blocktags).includes(t.id)).map(e=>e.name);e.isNew?j.status!==E.eG&&G({source:o,title:null===e.title?y("New block title"):e.title,project:e.project,type:e.type?e.type:"Other",description:e.description,html:(null===I||void 0===I?void 0:I.getValue())||"",blocktags:l?l.join(","):e.blocktags,tags:a}).then(({data:t,error:o})=>{o?(T.fromError("BLOCK_CREATING_ERROR",{title:e.title,html:(null===I||void 0===I?void 0:I.getValue())||""},o),O(!1)):i(t)}):$.status!==E.eG&&U({blockId:e.id,source:o,title:e.title,project:e.project,type:e.type?e.type:"Other",description:e.description,html:(null===I||void 0===I?void 0:I.getValue())||"",blocktags:l||e.blocktags,tags:a}).then(({data:t,error:o})=>{o&&V?(T.fromError("BLOCK_EDITING_ERROR",(0,r.x_)(e),o),O(!1)):i(t)})};i?Promise.all(i).then(e=>a(e)):a(null)};O(!0),Y?a(Y.id):W({name:q}).then(async({data:t,error:o})=>{if(o)T.fromError("FOLDER_CREATING_ERROR",q,o),O(!1);else{const{data:o,error:l}=await X({projectId:w,blocktags:t.id});l?(T.fromError("BLOCK_CLONING_ERROR",(0,r.x_)(e),l),O(!1)):o&&a(o.blocktags&&o.blocktags[0])}}).catch(e=>{})},[j.status,G,$.status,U,e,t,W,X,w,y,V,I,T,K,z,A,Y,q]);(0,l.useEffect)(()=>{V&&(Q(),M(!1))},[V,Q]);const J=(0,l.useCallback)(e=>{(e.ctrlKey||e.metaKey)&&83===e.keyCode&&(e.preventDefault(),M(!0))},[]);(0,l.useEffect)(()=>(document.addEventListener("keydown",J),()=>{document.removeEventListener("keydown",J)}),[J]);const Z=(0,l.useCallback)(e=>{const t=e.data.operation,o=e.data.action;t===E.Ru.APPLICATION_ACTION&&"save_email"===o&&M(!0)},[]);return(0,h.A)(Z),(0,l.useEffect)(()=>{j.isError&&(O(!1),T.error(j))},[x,j]),(0,l.useEffect)(()=>{const e=setTimeout(()=>{N(!0)},1e4);return()=>{clearTimeout(e)}},[]),(0,l.useEffect)(()=>{e.isNew&&!k&&C&&(Q(),N(!1))},[C,e,Q,k]),l.createElement(a.m_,{title:y(P?"Save by \u2318S":"Save by Ctrl+S"),placement:o?"right":"bottomRight"},l.createElement(a.$n,{type:"primary",block:o,className:"em-analytics__block-save",icon:l.createElement(i.Ay,{icon:"SaveOutlined"}),onClick:()=>{D({event:"click",action:"save_block"}),M(!0)},loading:$.isLoading||X.isLoading||j.isLoading||F||m},o||B||R?"":y("Save")))}},32638:(e,t,o)=>{o.d(t,{Ay:()=>L,QG:()=>P,Wv:()=>N});var l=o(1936),i=o(57549),a=o(6403),r=o(84075),n=o(69962),d=o(48155),s=o.n(d),m=o(47706),c=o(89591),u=o(487),p=o(87796),g=o(15582),h=o(61062),b=o(52898),f=o(41244),v=o(68876),_=o(91480),E=o(7314),S=o(36234),y=o(65185),w=o(2527),k=o(96040),B=o(93506),R=o(65893),x=o(51597),T=o(19684),I=o(98173);const A="NEXT_BUTTON",C="KEYBOARD",N=(e,t,o,l,i=!0,a=.8,r,n)=>{var d;const m=null!==(d=null!==l&&void 0!==l?l:n)&&void 0!==d?d:o;return`${window.location.host.indexOf("localhost"),"https://scr.emcdn.ru"}/screenshot?delay=1000&width=800${r?"":"&fullPage=true"}&deviceScaleFactor=${a}&format=jpg&clearCache=${i}${`&cacheControl=true&cache-hash=${s()(String(m))}`}&url=${encodeURIComponent(`https://app.emailmaker.ru/get${e}/${o}?secret_hash=${s()(`${t}${o}${B.KI}`)}&raw=true`)}${r?`&selector=${r}`:""}`},P=(e,t,o=!0,l=.8,i,a)=>{var r;let n=`https://racs.emcdn.ru/v3/file/${e}?resource=exportPngApi`;const d=null!==(r=null!==t&&void 0!==t?t:a)&&void 0!==r?r:e;return`${window.location.host.indexOf("localhost"),"https://scr.emcdn.ru"}/screenshot?delay=1000&width=800${i?"":"&fullPage=true"}&deviceScaleFactor=${l}&format=jpg&clearCache=${o}${`&cacheControl=true&cache-hash=${s()(String(d))}`}&url=${encodeURIComponent(`${n}`,`${n}`)}${i?`&selector=${i}`:""}`},L=({email:e=null,isEditableRights:t=null,autoSaveEmailResult:o,disabled:d})=>{var s,P;let L=(0,n.wA)(),F=(0,r.Zp)();const{__:O,_x:V}=(0,m.s9)(),{projectId:M,emailId:D}=(0,r.g)(),H=(0,w.p)(),z=(0,a.hN)(),W=(0,v.rD)(),U=(0,E.fn)(),$=(0,n.Pj)(),G=(0,n.d4)(b.rY),j=(0,n.d4)(b.UI),X=(0,n.d4)(I.C1),[q,Y]=(0,l.useState)(!1),[K,Q]=(0,l.useState)(null);(0,l.useEffect)(()=>{var e,t;null!==(e=window)&&void 0!==e&&null!==(t=e.navigator)&&void 0!==t&&t.userAgent.includes("Macintosh")&&Q(!0)},[]);const{data:J,refetch:Z}=(0,u.fo)(+M,{skip:!+M}),{data:ee,refetch:te}=(0,p.Jz)({parent:null===J||void 0===J||null===(s=J.folder)||void 0===s?void 0:s[0]},{skip:!B.EW.isPlugin||!(null!==J&&void 0!==J&&null!==(P=J.folder)&&void 0!==P&&P[0])}),[oe]=(0,c.Gr)(),[le]=(0,p.JI)(),[ie,ae]=(0,c.dN)(),[re,ne]=(0,c.Kh)(),[de]=(0,u.OD)(),[se,me]=(0,l.useState)(!1),[ce,ue]=(0,l.useState)(""),pe=`project_${M}`,ge=J&&(0,f._q)(J,B.zh).find(e=>e.name===pe),he=J&&(0,f.HT)(J,B.zh),be=(0,y.ml)(R.AZ.BEFORE_SAVE_EMAIL),fe=(0,_.u)(),ve=(0,l.useCallback)(o=>{var l,i;if(!t&&e.lock&&ce)return void z.error({id:"EMAIL_ACCESS_TO_LOCKED_ERROR",data:(0,a.Gy)(e),message:O("No access to edit the letter.")});if(((null===e||void 0===e||null===(l=e.tags)||void 0===l?void 0:l.length)||(null===(i=e.emailtags)||void 0===i?void 0:i.length))>10&&ce)return void z.error({id:"EMAIL_TOO_MANY_TAGS_ERROR",data:(0,a.Gy)(e),message:O("Maximum 10 tags available.")});const r=async t=>{var l;const i=Object.entries(G).flatMap(([e,t])=>t.map(({value:t,label:o})=>({id:+t,name:o,parent:+e.split("_")[0]})));let r=[];j.length&&j.forEach(e=>{r.push(...null===e||void 0===e?void 0:e.children.map(e=>({id:e.id,parentId:e.parent})))});const n=(null===(l=e.tags)||void 0===l?void 0:l.map(e=>{const o=null===he||void 0===he?void 0:he.find(t=>t.name===e);return o?o.id:oe({name:e,parent:t}).then(({error:t,data:o})=>{var l,i;return 400===(null===t||void 0===t?void 0:t.status)?null===t||void 0===t||null===(l=t.data)||void 0===l||null===(i=l.data)||void 0===i?void 0:i.term_id:o?o.id:void(t&&(z.fromError("TAG_CREATING_ERROR",e,t),me(!1)))})}))||[],d=(null===i||void 0===i?void 0:i.map(e=>{const t=null===r||void 0===r?void 0:r.find(t=>t.id===e.id);return t?t.id:le({name:e.name,parent:e.parent}).then(({error:t,data:o})=>{var l,i;return 400===(null===t||void 0===t?void 0:t.status)?null===t||void 0===t||null===(l=t.data)||void 0===l||null===(i=l.data)||void 0===i?void 0:i.term_id:o?o.id:void(t&&(z.fromError("GROUP_CREATING_ERROR",e,t),me(!1)))})}))||[],s=void 0!==e.tags,m=(null===i||void 0===i?void 0:i.length)>0,c=(e,l=null,i=null,r=[])=>{var n,d,s;const m=(null===(n=e.title)||void 0===n?void 0:n.trim())||(null===(d=e.subject)||void 0===d?void 0:d.trim())||O("Untitled email."),c=o=>{if($.dispatch(p.kE.endpoints.getTags.initiate({parent:t})),!B.EW.isPlugin&&Z)try{Z()}catch(l){}if(ce&&(z.success({id:"EMAIL_SAVING_SUCCESS",message:O("The email was successfully saved."),data:(0,a.Gy)(e)}),me(!1),!B.EW.isPlugin&&ee&&te))try{te()}catch(l){}B.EW.isPlugin||fetch(N(B.Tm,M,o.id,o.modified),{mode:"no-cors"}).then(()=>{})},u=(0,f._q)(e,B.zh).filter(t=>(l||e.emailtags).includes(t.id)).map(e=>e.name);var g,b,v,_,E;if(e.isNew){if(ne.status!==B.eG){const t=H.get(B.A9.em_folder);re({title:m,source:o,...void 0!==e.meta?{meta:e.meta}:{},project:e.project,subject:e.subject,preheader:e.preheader,description:e.description,utm_parameters:{utm_source:e.utm_parameters.utm_source,utm_medium:e.utm_parameters.utm_medium,utm_campaign:e.utm_parameters.utm_campaign,utm_term:e.utm_parameters.utm_term,utm_content:e.utm_parameters.utm_content},html:(null===U||void 0===U?void 0:U.getValue())||"",parent_email:e.parent_email||B.iU,common_styles:e.common_styles||"",emailtags:l?l.join(","):e.emailtags,tags:u,group:i||e.group,is_template:e.is_template||!1,is_inited:e.is_inited,renderGuid:e.renderGuid,folder:t!==B.y2&&t}).then(({data:t,error:l})=>{Te.current=!1,l?(o===A&&Ie(!1),ce&&z.fromError("EMAIL_CREATING_ERROR",{title:e.title,code:(null===U||void 0===U?void 0:U.getValue())||""},l),me(!1)):(L((0,h.aY)(null)),c(t),H.remove(B.A9.em_folder))})}}else ae.status!==B.eG&&ie({emailId:e.id,source:o,title:m,...void 0!==e.meta?{meta:e.meta}:{},project:e.project,preheader:e.preheader,subject:e.subject,utm_parameters:{utm_source:null===(g=e.utm_parameters)||void 0===g?void 0:g.utm_source,utm_medium:null===(b=e.utm_parameters)||void 0===b?void 0:b.utm_medium,utm_campaign:null===(v=e.utm_parameters)||void 0===v?void 0:v.utm_campaign,utm_term:null===(_=e.utm_parameters)||void 0===_?void 0:_.utm_term,utm_content:null===(E=e.utm_parameters)||void 0===E?void 0:E.utm_content},description:e.description,html:(null===U||void 0===U?void 0:U.getValue())||"",common_styles:e.common_styles||"",emailtags:l||e.emailtags,tags:u,group:i||e.group,is_template:e.is_template||!1}).then(({error:t})=>{Te.current=!1,t?(o===A&&Ie(!1),ce&&z.fromError("EMAIL_EDITING_ERROR",(0,a.Gy)(e),t),me(!1)):c(e)});fe({event:"save",action:o?"save_email":"auto_save_email",email_id:e.id,project_id:M,subscription:null===X||void 0===X||null===(s=X.subscription)||void 0===s?void 0:s.post_title})},u={...e};be.fire(u).finally(()=>{s||m?Promise.all(n).then(e=>{Promise.all(d).then(t=>{c(u,s?e:null,m?t:null,[])})}):c(u,null,null,[])})};me(!0),ge?r(ge.id):oe({name:pe}).then(async({data:t,error:o})=>{if(o)z.fromError("FOLDER_CREATING_ERROR",pe,o),me(!1);else{const{data:o,error:l}=await de({projectId:M,emailtags:t.id});l?(z.fromError("EMAIL_CLONING_ERROR",(0,a.Gy)(e),l),me(!1)):o&&r(o.emailtags&&o.emailtags[0])}}).catch(e=>{})},[ne.status,re,ae.status,ie,e,t,oe,L,de,M,J,O,V,ce,U,he,be]);(0,S.D3)(x.Kp,(0,l.useCallback)(e=>ve(e||"EXTERNAL"),[ve]));const _e=(0,y.ml)(R.AZ.ON_NEXTBUTTON_CLICK_ID),Ee=(0,y.ml)(R.AZ.ON_SAVEBUTTON_CLICK_ID);(0,l.useEffect)(()=>{ce&&(setTimeout(()=>ve(ce)),ue(""))},[ce]);const Se=(0,l.useCallback)(e=>{(e.ctrlKey||e.metaKey)&&83===e.keyCode&&(e.preventDefault(),ue(C))},[ve]);(0,l.useEffect)(()=>(document.addEventListener("keydown",Se),()=>{document.removeEventListener("keydown",Se)}),[Se]);const ye=(0,l.useCallback)(e=>{const t=e.data.operation,o=e.data.action;t===B.Ru.APPLICATION_ACTION&&"save_email"===o&&ue(C)},[ve]);(0,g.A)(ye),(0,l.useEffect)(()=>{e.isNew&&ne.isSuccess&&(me(!0),L(c.GY.util.upsertQueryData("getEmail",ne.data.id,{...ne.data,...void 0!==e.meta?{meta:e.meta}:{},lock:e.lock,isAmp:e.isAmp,subject:e.subject,preheader:e.preheader,description:e.description,html:(null===U||void 0===U?void 0:U.getValue())||"",project:e.project,tags:e.tags,utm_parameters:e.utm_parameters,parent_email:e.parent_email,common_styles:e.common_styles,renderGuid:e.renderGuid,is_inited:e.is_inited,isNew:!1})).then(()=>{F(`/projects/${ne.data.project}/emails/${ne.data.id}`),me(!1),ce&&z.success({id:"EMAIL_SAVING_SUCCESS",message:O("The email was successfully saved."),data:(0,a.Gy)(e)})}))},[F,L,ne,e.isNew,O,V,ce,U]);const we=(0,y._q)(R.AZ.ON_EMAIL_INIT_ID);(0,l.useEffect)(()=>{let e=0;const t=we(()=>{e=setTimeout(()=>Y(!0),1e4)});return()=>{e&&clearTimeout(e),t.dispose()}},[Y,we]),(0,l.useEffect)(()=>{e.isNew&&!D&&q&&(ve(),Y(!1))},[q,e,ve,D]);const ke=ae.isLoading||(null===de||void 0===de?void 0:de.isLoading)||ne.isLoading||se||o&&o.isLoading,Be=W.saveButtonEnabled&&l.createElement(i.m_,{key:"save-button",title:O(K?"Save by \u2318S":"Save by Ctrl+S"),placement:"bottom"},l.createElement(i.$n,{disabled:d,type:W.nextButtonEnabled?"default":"primary",block:"false",className:"em-analytics__email-save",loading:ke,icon:l.createElement(k.Ay,{icon:"SaveOutlined",size:16,strokeWidth:W.iconStrokeWidth}),onClick:async()=>{const t={...e,html:U.getValue()};try{!1!==await Ee.fire(t)&&ue("SAVE_BUTTON")}catch(o){z.fromError("SAVE_BUTTON_CLICK_EVENT_ERROR",(0,a.Gy)(t),o,!0)}}},W.saveButtonText||O("Save"))),Re=!1!==W.disableDoubleClickNextButton,xe=!1===W.activeNextButton,Te=(0,l.useRef)(!1),Ie=e=>{L((0,T.wj)(!e))},Ae=W.nextButtonEnabled&&l.createElement(i.$n,{disabled:d||xe,key:"next-button",type:"primary",block:"false",className:"em-analytics__email-save",icon:W.primaryCommandButtonIcon,loading:ke,onClick:async()=>{if(Te.current)return;Te.current=!0;const t={...e,html:U.getValue()};try{Re&&Ie(!0),(await _e.fire(t)).every(e=>!1!==e)?ue(A):(Ie(!1),Te.current=!1)}catch(o){z.fromError("NEXT_BUTTON_CLICK_EVENT_ERROR",(0,a.Gy)(t),o,!0),Ie(!1),Te.current=!1}}},W.nextButtonText||O("Continue"));return l.createElement(l.Fragment,null,W.saveButtonEnabled&&W.nextButtonEnabled?l.createElement(i.$x,null,[Be,Ae]):[Be,Ae])}},56315:(e,t,o)=>{o.d(t,{A:()=>s});var l=o(1936),i=o(57549),a=o(47706),r=o(93506),n=o(7714),d=o(68876);const s=({form:e,elementSettings:t,imgParent:o=!1,name:s="align",setAlignStateHandle:m=()=>{},withHotKeys:c=!0})=>{const{__:u}=(0,a.s9)(),p=(0,n.XW)(),g=(0,d.rD)(),[h,b]=(0,l.useState)(null);(0,l.useEffect)(()=>{var e;null!==globalThis&&void 0!==globalThis&&null!==(e=globalThis.navigator)&&void 0!==e&&e.userAgent.includes("Macintosh")&&b(!0)},[]);const f={alignLeft:u("Text align left"),alignCenter:u("Text align center"),alignRight:u("Text align right"),alignJustify:u("Text align justify")},v={alignLeft:u("Text align left ( \u2318+Shift+L )"),alignCenter:u("Text align center ( \u2318+Shift+E )"),alignRight:u("Text align right ( \u2318+Shift+R )"),alignJustify:u("Text align justify ( \u2318+Shift+J )")},_={alignLeft:u("Text align left ( Ctrl+Shift+L )"),alignCenter:u("Text align center ( Ctrl+Shift+E )"),alignRight:u("Text align right ( Ctrl+Shift+R )"),alignJustify:u("Text align justify ( Ctrl+Shift+J )")};let E=f;c&&(E=h?v:_);const S=t[s],y="string"===typeof S?S:"";return l.createElement(i.lV.Item,{name:s},l.createElement(i.Qx,{value:y,onChange:o=>{m(o),e.setFieldsValue({[s]:o}),p({operation:r.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:t.type,settings:{[s]:o}})},disabled:o&&!t.parent,strokeWidth:null===g||void 0===g?void 0:g.iconStrokeWidth,labels:E}))}},71461:(e,t,o)=>{o.d(t,{A:()=>d});var l=o(1936),i=o(57549),a=o(47706),r=o(69962),n=o(52898);const d=e=>{const{form:t,namePrefix:o="",typeOfForm:d="desktop"}=e,{__:s,_x:m}=(0,a.s9)(),c=(0,r.d4)(n.uJ).usedColors;return l.createElement(i.Ok,{form:t,namePrefix:o,typeOfForm:d,usedColors:c,labels:{color:s("Color"),width:m("Width","border"),none:s("None"),solid:s("Solid"),dashed:s("Dashed"),dotted:s("Dotted"),above:s("Above"),below:s("Below"),onLeft:s("On the left"),onRight:s("On the right"),around:s("Around"),usedColors:s("Used"),recommendedColors:s("Recommended")}})}},73847:(e,t,o)=>{o.d(t,{A:()=>m});var l=o(1936),i=o(57549),a=o(47706),r=o(7714),n=o(93506),d=o(57546);const s=({form:e,oneBorderRadiusValue:t,setOneBorderRadiusValue:o,elementSettings:s,namePrefix:m="",typeOfForm:c="desktop"})=>{const{__:u}=(0,a.s9)(),p=(0,r.XW)(),g="mobile"===c,h=g?"mobileBorderRadius":"borderRadius",b=g?"mobileBorderRadiusAll":"borderRadiusAll",f=g?"mobileBorderRadiusTopLeft":"borderRadiusTopLeft",v=g?"mobileBorderRadiusTopRight":"borderRadiusTopRight",_=g?"mobileBorderRadiusBottomRight":"borderRadiusBottomRight",E=g?"mobileBorderRadiusBottomLeft":"borderRadiusBottomLeft",S=g?d.NW:d.wF;return l.createElement(i.sQ,{namePrefix:m,typeOfForm:c,oneBorderRadiusValue:t,onToggle:()=>{const l=e.getFieldsValue(!0);let i;if(t)e.setFieldsValue({[f]:l[b]||null,[E]:l[b]||null,[v]:l[b]||null,[_]:l[b]||null}),i={[h]:{[S[f]]:l[b]||0,[S[E]]:l[b]||0,[S[v]]:l[b]||0,[S[_]]:l[b]||0}};else{l[f]===l[E]&&l[f]===l[v]&&l[f]===l[_]?(e.setFieldsValue({[b]:l[f]}),i={[h]:{[S[b]]:l[f]}}):(e.setFieldsValue({[f]:null,[E]:null,[v]:null,[_]:null}),i={[h]:{[S[b]]:0,[S[f]]:0,[S[E]]:0,[S[v]]:0,[S[_]]:0}})}const a=g?{mobileBorderRadius:{all:l.mobileBorderRadiusAll||null,classNamePrefix:"em-mob-border_radius_all-"}}:{[`${m}${h}`]:{...s[`${m}${h}`],...i[`${m}${h}`]}};p({operation:n.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:s.type,settings:a}),o(e=>!e)},borderRadiusIcon:l.createElement(i.HQ,{icon:"BorderRadius",className:"selected-td-form__icon-radius"}),labels:{borderRadius:u("Border radius"),topLeft:u("Top left corner"),topRight:u("Top right corner"),bottomLeft:u("Bottom left corner"),bottomRight:u("Bottom right corner")}})};s.displayName="SelectedElementFormBorderRadius";const m=s},27468:(e,t,o)=>{o.d(t,{A:()=>d});var l=o(1936),i=o(57549),a=o(91113),r=o(93506);const n=({form:e,label:t,name:o,disabled:n,elementSettings:d,previewReloadSignal:s})=>{var m;const{token:c}=(0,i.rd)(),[u,p]=(0,l.useState)("success"),g=i.lV.useWatch((null===d||void 0===d?void 0:d.type)===r.bV.CAROUSEL?["images",o]:[o],e);return(0,l.useEffect)(()=>{var e;g?("string"!==typeof g||!g.startsWith("data:")&&!g.startsWith("blob:"))&&"string"===typeof(e=g)&&/^https?:\/\//i.test(e.trim())?p("validating"):p("success"):p("")},[g]),l.createElement(i.lV.Item,{name:o,validateStatus:u,style:{marginBottom:c.formItemMarginBottomXS}},l.createElement(a.A,{validateStatus:u,placeholder:t,name:o,disabled:n,elementSettings:d,imageInfo:(null===d||void 0===d?void 0:d.type)===r.bV.CAROUSEL?null===d||void 0===d||null===(m=d.carouselImages)||void 0===m?void 0:m[o.split("_")[1]]:d,previewReloadSignal:s,onRemotePreviewValidate:p}))};n.defaulProps={disabled:!1,previewReloadSignal:null};const d=n},81793:(e,t,o)=>{o.d(t,{A:()=>Lt});var l=o(1936),i=o(34010),a=o(6056),r=o.n(a),n=o(69962),d=o(52898),s=o(68069),m=o(84075),c=o(57549),u=o(50028),p=o(72533),g=o.n(p),h=o(6403),b=o(27468),f=o(71461),v=o(73847),_=o(47706),E=o(93506),S=o(7714),y=o(68876);const w=({value:e,onChange:t,onSync:o,fieldName:i,...a})=>{var r;const n=null!==(r="object"===typeof e?null===e||void 0===e?void 0:e.value:e)&&void 0!==r?r:"";return l.createElement(c.BK,Object.assign({value:n,onChange:e=>{const l={classNamePrefix:"em-mob-text_align-",value:e};null===t||void 0===t||t(l),null===o||void 0===o||o({[i]:l})}},a))},k=({form:e,elementSettings:t,imgParent:o=!1,name:i="align",tooltipTitle:a,typeOfForm:r="desktop"})=>{const{__:n}=(0,_.s9)(),d=(0,S.XW)(),s=(0,y.rD)(),m="mobile"===r,u=m?"mobileAlign":i,p={alignLeft:n("Align left"),alignCenter:n("Center horizontally"),alignRight:n("Align right")};if(m){const e=e=>{d({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:t.type,settings:e})};return l.createElement(c.lV.Item,{name:u},l.createElement(w,{fieldName:u,onSync:e,disabled:o&&!t.parent,strokeWidth:s.iconStrokeWidth,tooltipTitle:a,labels:p}))}return l.createElement(c.lV.Item,{name:u},l.createElement(c.BK,{disabled:o&&!t.parent,strokeWidth:s.iconStrokeWidth,tooltipTitle:a,labels:p}))},B=({form:e,elementSettings:t,tooltipTitle:o,disabled:i=!1,isNewIconType:a=!1,typeOfForm:r="desktop"})=>{const{__:n}=(0,_.s9)(),d=(0,S.XW)(),s=(0,y.rD)(),m="mobile"===r,u=m?"mobileVerticalAlign":"valign";return l.createElement(c.lV.Item,{name:u},l.createElement(c.VX,Object.assign({},!m&&{value:t.valign,onChange:o=>{e.setFieldsValue({[u]:o}),m||d({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:t.type,settings:{[u]:o}})}},{disabled:i,isNewIconType:a,strokeWidth:s.iconStrokeWidth,labels:{alignTop:n("Align top"),alignMiddle:n("Center vertically"),alignBottom:n("Align bottom")}})))},R=["mobileBoxShadowHOffset","mobileBoxShadowVOffset","mobileBoxShadowBlurRadius","mobileBoxShadowSpreadRadius","mobileBoxShadowColor","mobileBoxShadowInset"],x=({form:e,elementSettings:t,enableSwitch:o,usedColors:i,labels:a,withoutShadowLabel:r})=>{const n=(0,S.XW)(),d=t.mobileBoxShadow,[s,m]=(0,l.useState)(!d||0===d.hOffset&&0===d.vOffset&&0===d.blurRadius&&0===d.spreadRadius),u=c.lV.useWatch(R,e);(0,l.useEffect)(()=>{if(!u)return;const[e,t,o,l,i,a]=u;(0===e||void 0===e||null===e)&&(0===t||void 0===t||null===t)&&(0===o||void 0===o||null===o)&&(0===l||void 0===l||null===l)&&(""===i||void 0===i||null===i)&&(!1===a||void 0===a)||m(!1)},[u]);return l.createElement(l.Fragment,null,o&&l.createElement("div",{style:{float:"right",marginTop:-9,marginRight:50}},l.createElement(c.dO,{id:"without-shadow",label:r,labelSize:"small",size:"small",checked:s,onChange:()=>{m(e=>!e),e.setFieldsValue({mobileBoxShadowHOffset:s?"":0,mobileBoxShadowVOffset:s?"":0,mobileBoxShadowBlurRadius:s?"":0,mobileBoxShadowSpreadRadius:s?"":0,mobileBoxShadowColor:"",mobileBoxShadowInset:!1}),n({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:t.type,settings:{mobileBoxShadow:{classNamePrefix:"em-mob-box_shadow-",hOffset:s?null:0,vOffset:s?null:0,blurRadius:s?null:0,spreadRadius:s?null:0,color:null,inset:!1}}})}})),l.createElement("p",{style:{paddingBottom:"8px",margin:"-30px 0 0"}},"\xa0"),l.createElement(c.nD,{typeOfForm:"mobile",usedColors:i,labels:a}))},T=({typeOfForm:e="desktop",form:t,elementSettings:o,enableSwitch:i=!0})=>{const{__:a}=(0,_.s9)(),r=(0,n.d4)(d.uJ),s={hOffset:a("Horizontal offset"),vOffset:a("Vertical offset"),blurRadius:a("Blur radius"),spreadRadius:a("Spread radius"),outside:a("Outside"),inside:a("Inside"),shadowDirection:a("Shadow inside or outside of the element"),usedColors:a("Used"),recommendedColors:a("Recommended")},m=r.usedColors;return"mobile"===e&&t&&o?l.createElement(x,{form:t,elementSettings:o,enableSwitch:i,usedColors:m,labels:s,withoutShadowLabel:a("Without shadow")}):l.createElement(c.nD,{typeOfForm:e,usedColors:m,labels:s})};T.displayName="SelectedElementFormBoxShadow";const I=T;var A=o(96040);const C=({form:e,elementSettings:t,directionControl:o})=>{const{__:i}=(0,_.s9)();return l.createElement(c.mw,{directionControl:o,className:"selected-element-form-show"},l.createElement(c.lV.Item,{name:"show",className:"form-item-margin-xs"},l.createElement(c.sx.Group,null,l.createElement(c.$x,{size:8},l.createElement(c.sx.Button,{value:"all"},i("Both")),l.createElement(c.m_,{placement:"top",title:i("Desktop")},l.createElement(c.sx.Button,{value:"desktop"},l.createElement(A.Ay,{icon:"DesktopOutlined"}))),l.createElement(c.m_,{placement:"top",title:i("Mobile")},l.createElement(c.sx.Button,{value:"mobile"},l.createElement(A.Ay,{icon:"MobileOutlined"})))))))},N=({form:e,elementSettings:t,handleChangeValues:o})=>{const{__:i}=(0,_.s9)(),a=(0,l.useRef)(),{token:n}=(0,c.rd)(),[d,s]=(0,l.useState)(!1),[m,u]=(0,l.useState)(!1),[p,h]=(0,l.useState)(!1),[b,f]=(0,l.useState)(!1),[v,E]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=new URL("https://emailmaker.ru/?"+t.countdown);s(e.searchParams.get("font1").endsWith("-b")||e.searchParams.get("font1").endsWith("-bi")),u(e.searchParams.get("font1").endsWith("-i")||e.searchParams.get("font1").endsWith("-bi")),h(e.searchParams.get("font2").endsWith("-b")||e.searchParams.get("font2").endsWith("-bi")),f(e.searchParams.get("font2").endsWith("-i")||e.searchParams.get("font2").endsWith("-bi")),E("true"===e.searchParams.get("tp"))},[t]);const S=[{value:"-12",label:i("-12:00 Apia")},{value:"-11",label:i("-11:00 Pago Pago, Midway Atoll")},{value:"-10",label:i("-10:00 Honolulu, Anchorage")},{value:"-9",label:i("-9:00 Anchorage, Yukon")},{value:"-8",label:i("-8:00 Los Angeles, Vancouver")},{value:"-7",label:i("-7:00 Denver, Phoenix")},{value:"-6",label:i("-6:00 Mexico City, Guadalajara")},{value:"-5",label:i("-5:00 New York, Toronto, Havana")},{value:"-4",label:i("-4:00 Caracas, Santo Domingo")},{value:"-3",label:i("-3:00 Buenos Aires, Santiago, Montevideo")},{value:"-2",label:i("-2:00 South Georgia, Saint Helena")},{value:"-1",label:i("-1:00 Azores, Cape Verde")},{value:"0",label:i("+0:00 London, Lisbon, Dublin")},{value:"1",label:i("+1:00 Paris, Berlin, Rome")},{value:"2",label:i("+2:00 Athens, Kiev, Istanbul")},{value:"3",label:i("+3:00 Istanbul, Doha, Baghdad")},{value:"4",label:i("+4:00 Baku, Dubai, Tbilisi")},{value:"5",label:i("+5:00 Karachi, Tashkent, Islamabad")},{value:"6",label:i("+6:00 Almaty, Dhaka, Bishkek")},{value:"7",label:i("+7:00 Bangkok, Ho Chi Minh City, Jakarta")},{value:"8",label:i("+8:00 Beijing, Hong Kong, Singapore")},{value:"9",label:i("+9:00 Tokyo, Seoul, Jayapura")},{value:"10",label:i("+10:00 Sydney, Melbourne, Port Moresby")},{value:"11",label:i("+11:00 Honiara, Nuku'alofa, Apia")}],y=[{value:"20",label:i("20 s")},{value:"40",label:i("40 s")},{value:"60",label:i("60 s")}],w=[{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"}],k=e=>{var t;e.target.closest(".ant-picker-dropdown")||(null===(t=a.current)||void 0===t||t.blur())};(0,l.useEffect)(()=>(window.addEventListener("scroll",k,!0),()=>{window.removeEventListener("scroll",k,!0)}));return l.createElement(l.Fragment,null,l.createElement(c.fI,{gutter:10},l.createElement(c.fv,{span:12},l.createElement(c.lV.Item,{label:i("End time"),name:"countdownTime"},l.createElement(c.lr,{ref:a,format:"DD.MM.YYYY HH:mm",disabledDate:e=>e&&e<g()().endOf("day")-864e5,showTime:!0,getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper"),allowClear:!1,allowEmpty:!1}))),l.createElement(c.fv,{span:12},l.createElement(c.lV.Item,{label:i("Time zone"),name:"countdownTimeZone",style:{width:"100%"}},l.createElement(c.Select,{placeholder:i("Select the time zone"),getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")},S.map(e=>l.createElement(c.Select.Option,{key:e.value,value:e.value},e.label)))))),l.createElement(c.fI,{gutter:20},l.createElement(c.fv,{span:12},l.createElement(c.lV.Item,{label:i("Background color"),name:"countdownBackgroundColor",className:"countdown-color"},l.createElement(c.it,{placeholder:i("Background color"),usedColors:t.usedColors,usedLabel:i("Used"),recommendedLabel:i("Recommended")}))),l.createElement(c.fv,{span:12},l.createElement(c.lV.Item,{name:"countdownTransparency",valuePropName:"checked",style:{paddingTop:29}},l.createElement(c.dO,{id:"countdownTransparency",label:i("Transparency"),labelSize:"small",size:"small",onChange:e=>{E(e)}})))),l.createElement(c.y9,{title:i("Countdown font settings"),compact:!0},l.createElement(c.fI,{gutter:10},l.createElement(c.fv,{span:12},l.createElement(c.lV.Item,{name:"countdownNumbersFont",style:{marginBottom:n.formItemMarginBottomXS}},l.createElement(c.Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:w}))),l.createElement(c.fv,{span:12},l.createElement(c.lV.Item,{name:"countdownNumbersColor",className:"countdown-color",style:{marginBottom:n.formItemMarginBottomXS}},l.createElement(c.it,{usedColors:t.usedColors,usedLabel:i("Used"),recommendedLabel:i("Recommended")}))),l.createElement(c.fv,{span:12},l.createElement(c.lV.Item,{name:"countdownNumbersFontSize"},l.createElement(c.YI,{min:12,placeholder:i("Font size"),prefix:l.createElement(A.Ay,{icon:"FontSizeOutlined"}),addonAfter:"px"}))),l.createElement(c.fv,{span:3},l.createElement(c.m_,{placement:"bottom",title:i("Strong")},l.createElement(c.lV.Item,{name:"countdownNumbersStrong"},l.createElement(c.$n,{className:r()("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":d}),onClick:()=>{const t=!d;e.setFieldValue("countdownNumbersStrong",t),o({countdownNumbersStrong:t}),s(t)}},l.createElement(A.Ay,{icon:"BoldOutlined",className:"selected-td-form__icon-radius"}))))),l.createElement(c.fv,{span:3},l.createElement(c.m_,{placement:"bottom",title:i("Italic")},l.createElement(c.lV.Item,{name:"countdownNumbersItalic"},l.createElement(c.$n,{className:r()("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":m}),onClick:()=>{const t=!m;e.setFieldValue("countdownNumbersItalic",t),o({countdownNumbersItalic:t}),u(t)}},l.createElement(A.Ay,{icon:"ItalicOutlined",className:"selected-td-form__icon-radius"}))))))),l.createElement(c.y9,{title:i("Time units font settings"),compact:!0},l.createElement(c.fI,{gutter:10},l.createElement(c.fv,{span:12},l.createElement(c.lV.Item,{name:"countdownLabelsFont",style:{marginBottom:n.formItemMarginBottomXS}},l.createElement(c.Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:w}))),l.createElement(c.fv,{span:12},l.createElement(c.lV.Item,{name:"countdownLabelsColor",className:"countdown-color",style:{marginBottom:n.formItemMarginBottomXS}},l.createElement(c.it,{usedColors:t.usedColors,usedLabel:i("Used"),recommendedLabel:i("Recommended")}))),l.createElement(c.fv,{span:12},l.createElement(c.lV.Item,{name:"countdownLabelsFontSize"},l.createElement(c.YI,{min:8,placeholder:i("Font size"),addonAfter:"px",prefix:l.createElement(A.Ay,{icon:"FontSizeOutlined"})}))),l.createElement(c.fv,{span:3},l.createElement(c.m_,{placement:"bottom",title:i("Strong")},l.createElement(c.lV.Item,{name:"countdownLabelsStrong"},l.createElement(c.$n,{className:r()("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":p}),onClick:()=>{const t=!p;e.setFieldValue("countdownLabelsStrong",t),o({countdownLabelsStrong:t}),h(t)}},l.createElement(A.Ay,{icon:"BoldOutlined",className:"selected-td-form__icon-radius"}))))),l.createElement(c.fv,{span:3},l.createElement(c.m_,{placement:"bottom",title:i("Italic")},l.createElement(c.lV.Item,{name:"countdownLabelsItalic"},l.createElement(c.$n,{className:r()("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":b}),onClick:()=>{const t=!b;e.setFieldValue("countdownLabelsItalic",t),o({countdownLabelsItalic:t}),f(t)}},l.createElement(A.Ay,{icon:"ItalicOutlined",className:"selected-td-form__icon-radius"}))))))),l.createElement(c.fI,{gutter:10,style:{marginBottom:4}},l.createElement(c.fv,{span:12},l.createElement(c.lV.Item,{label:i("Language"),name:"countdownLanguage",style:{width:"100%"}},l.createElement(c.Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:[{value:"ru_RU",label:"\u0420\u0443\u0441\u0441\u043a\u0438\u0439"},{value:"en_US",label:"English"},{value:"uk_UA",label:"\u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430"},{value:"pt_BR",label:"Portugu\xeas"},{value:"fr-CA",label:"Fran\xe7ais"},{value:"de_DE",label:"Deutsch"},{value:"pl_PL",label:"Polski"},{value:"es_ES",label:"Espa\xf1ol"},{value:"tr_TR",label:"T\xfcrk\xe7e"},{value:"lt_LT",label:"Lietuvi\u0173 kalba"},{value:"lv_LV",label:"Latvie\u0161u valoda"},{value:"et_EE",label:"Eesti keel"},{value:"hu_HU",label:"Magyar"},{value:"el_GR",label:"\u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac"},{value:"it_IT",label:"Italiano"}]}))),l.createElement(c.fv,{span:12},l.createElement(c.lV.Item,{label:i("Duration"),name:"countdownDuration",style:{width:"100%"}},l.createElement(c.Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel"),options:y})))))},P=({form:e,elementSettings:t})=>{const{__:o}=(0,_.s9)(),{token:i}=(0,c.rd)();return l.createElement(l.Fragment,null,l.createElement(c.m_,{trigger:["hover"],title:o("URL of the video clip."),placement:"right"},l.createElement(c.lV.Item,{name:["video","source"],className:"selected-image-form__alt"},l.createElement(c.pd,{allowClear:!0,placeholder:o("Video URL"),prefix:l.createElement(A.Ay,{icon:"VideoCameraOutlined"})}))),l.createElement(c.lV.Item,{label:o("Play button"),name:["video","playButton"],style:{width:"100%",marginBottom:i.formItemMarginBottomMD+4}},l.createElement(c.Select,{getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")},l.createElement(c.Select.Option,{value:"youtube_red"},l.createElement(A.Ay,{icon:"YoutubeOutlined",style:{color:"#FF0000"}})," ",o("Youtube Red")),l.createElement(c.Select.Option,{value:"youtube_black"},l.createElement(A.Ay,{icon:"YoutubeOutlined"})," ",o("Youtube Black")),l.createElement(c.Select.Option,{value:"youtube_white"},l.createElement(A.Ay,{icon:"YoutubeOutlined",style:{color:"#aaa"}})," ",o("Youtube White")),l.createElement(c.Select.Option,{value:"vimeo"},l.createElement(A.Ay,{icon:"Vimeo"})," ",o("Vimeo")),l.createElement(c.Select.Option,{value:"white_circle"},l.createElement(A.Ay,{icon:"PlayCircleOutlined",style:{color:"#aaa"}})," ",o("White circle")),l.createElement(c.Select.Option,{value:"black_circle"},l.createElement(A.Ay,{icon:"PlayCircleOutlined"})," ",o("Black circle")),l.createElement(c.Select.Option,{value:"white_circle_outlined"},l.createElement(A.Ay,{icon:"RightCircleOutlined",style:{color:"#aaa"}})," ",o("White circle outlined")),l.createElement(c.Select.Option,{value:"black_circle_outlined"},l.createElement(A.Ay,{icon:"RightCircleOutlined"})," ",o("Black circle outlined")),l.createElement(c.Select.Option,{value:"none"}," ",o("Without button")))))},L={marginBottom:10},F=()=>{const{__:e}=(0,_.s9)();return l.createElement(c.fI,{gutter:20,style:L},l.createElement(c.fv,{span:12},l.createElement(c.lV.Item,{name:"ampShow",className:"form-item-margin-xs"},l.createElement(c.sx.Group,null,l.createElement(c.$x,{size:8},l.createElement(c.sx.Button,{value:"all"},e("Both")),l.createElement(c.m_,{placement:"top",title:e("AMP")},l.createElement(c.sx.Button,{value:"amp"},"AMP")),l.createElement(c.m_,{placement:"top",title:e("HTML")},l.createElement(c.sx.Button,{value:"html"},"HTML")))))))};var O=o(20279);const V=({form:e,elementSettings:t,boxShadow:o,bordersShow:i,borderRadiusShow:a,boxShadowShow:n,oneBorderRadiusValue:d,setOneBorderRadiusValue:s,hasLink:m,hasAlt:u,hasTitle:p,isOpenSrcReplacer:g,mergeTagItems:h,mergeMenuOpen:E,setMergeMenuOpen:S,cascaderRef:w,linkInputRef:R,linkButtonRef:x,altInputRef:T,altButtonRef:L,titleInputRef:V,titleButtonRef:M,srcReplacerInputRef:D,srcReplacerButtonRef:H,linkProtocol:z,handleLinkProtocolsChange:W,linkButtonHandler:U,linkInputHandler:$,altButtonHandler:G,altInputHandler:j,titleButtonHandler:X,titleInputHandler:q,srcReplacerButtonHandler:Y,srcInputHandler:K,handleSelect:Q,onChange:J,filter:Z,renderSearchOption:ee,handleChangeValues:te,toggleShowBorderHandler:oe,toggleShowBorderRadiusHandler:le,toggleShowBoxShadowHandler:ie})=>{const{__:ae}=(0,_.s9)(),{token:re}=(0,c.rd)(),ne=(0,y.rD)();return l.createElement(l.Fragment,null,l.createElement(c.fI,{gutter:10,style:{marginBottom:4}},l.createElement(c.fv,{span:12},l.createElement(k,{form:e,elementSettings:t,imgParent:!0})),ne.formImageFieldVerticalAlignEnabled&&l.createElement(c.fv,{span:12,align:"right"},l.createElement(B,{form:e,elementSettings:t}))),l.createElement(c.cG,{className:"selected-td-form__divider",style:{marginBottom:"countdown"===t.type?15:24}}),"countdown"===t.type&&l.createElement(l.Fragment,null,l.createElement(N,{form:e,elementSettings:t,handleChangeValues:te}),l.createElement(c.cG,{className:"selected-td-form__divider",style:{marginBottom:24}})),ne.mergeTagsShow&&h&&l.createElement(c.fv,{span:24,id:"merge_tags_wrapper"},l.createElement(c.lV.Item,{style:{marginBottom:24}},l.createElement(c.$n,{id:"merge_tags_button",icon:l.createElement(A.Ay,{icon:"MergeTags"}),style:{width:"100%",display:E?"none":"inline-flex"},onClick:()=>S(!0)},ae("Merge tags")),l.createElement(c.vx,{ref:w,popupClassName:"merge-tags",options:h,placeholder:ae("Start typing the title"),showSearch:{filter:Z,render:ee},spellCheck:"false",getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper"),onChange:J,style:{display:E?"block":"none"},open:E,onKeyDown:e=>{"Escape"===e.key&&S(!1)}}))),"video"===t.type&&l.createElement(l.Fragment,null,l.createElement(P,{form:e,elementSettings:t}),l.createElement(c.cG,{className:"selected-td-form__divider",style:{marginBottom:24}})),("img"===t.type||"video"===t.type)&&l.createElement(c.lV.Item,{style:{marginBottom:0}},l.createElement(b.A,{form:e,label:ae("Image path"),name:"src",placeholder:ae("Image path"),elementSettings:t,tooltipTitle:""})),l.createElement(c.$x,{size:8,style:{marginBottom:u||m||p||g?re.formItemMarginBottomXS:re.formItemMarginBottomMD+4}},l.createElement(c.m_,{title:u||ae("Alternative text"),placement:"bottom",getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper")},l.createElement(c.$n,{className:r()("selected-td-form__button",{"selected-td-form__button--active":!!u}),onClick:G,ref:L},l.createElement("span",{className:"addon-text-content"},"Alt"))),ne.formFieldImageTitleEnabled&&l.createElement(c.m_,{title:p||ae("Tooltip text"),placement:"bottom",getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper")},l.createElement(c.$n,{className:r()("selected-td-form__button",{"selected-td-form__button--active":!!p}),onClick:X,ref:M},l.createElement("span",{className:"addon-text-content"},"Title"))),l.createElement(c.m_,{title:m||ae("Hyperlink URL"),placement:"bottom",getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper")},l.createElement(c.$n,{className:r()("selected-td-form__button",{"selected-td-form__button--active":!!m}),icon:l.createElement(A.Ay,{icon:"LinkOutlined",className:"selected-td-form__icon-radius"}),onClick:U,ref:x})),ne.formImageFieldReplacerEnabled&&l.createElement(c.m_,{title:ae("Image replacer"),placement:"bottom",getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper")},l.createElement(c.$n,{className:r()("selected-td-form__button",{"selected-td-form__button--active":g}),icon:l.createElement(A.Ay,{icon:"Replacer",className:"selected-td-form__icon-radius"}),onClick:Y,ref:H}))),(!!m||!!u||!!p||!!g)&&l.createElement("div",{style:{marginBottom:re.formItemMarginBottomMD+4}},!!m&&l.createElement(c.m_,{trigger:["hover"],title:ae("Hyperlink URL"),placement:"bottom"},l.createElement(c.lV.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:re.formItemMarginBottomXS}},l.createElement(c.pd,{addonBefore:l.createElement(O.Ai,{linkProtocol:z,handleLinkProtocolsChange:W,__:ae}),placeholder:ae("Hyperlink URL"),allowClear:!0,ref:R,onChange:$,onSelect:Q,prefix:l.createElement(O.RM,{linkProtocol:z})}))),!!u&&l.createElement(c.m_,{trigger:["hover"],title:ae("Alternative text"),placement:"bottom"},l.createElement(c.lV.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:re.formItemMarginBottomXS}},l.createElement(c.pd,{placeholder:ae("Alternative text"),allowClear:!0,prefix:l.createElement("span",{className:"addon-text-content"},"Alt"),onChange:j,ref:T,onSelect:Q}))),ne.formFieldImageTitleEnabled&&!!p&&l.createElement(c.m_,{trigger:["hover"],title:ae("Tooltip text"),placement:"bottom"},l.createElement(c.lV.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:re.formItemMarginBottomXS}},l.createElement(c.pd,{placeholder:ae("Enter the title of the image"),allowClear:!0,prefix:l.createElement("span",{className:"addon-text-content"},"Title"),onChange:q,ref:V,onSelect:Q}))),!!g&&l.createElement(c.m_,{trigger:["hover"],title:ae("Image src"),placement:"bottom"},l.createElement(c.lV.Item,{name:"imgReplacer",className:"selected-image-form__alt",style:{marginBottom:re.formItemMarginBottomXS}},l.createElement(c.pd,{placeholder:ae("Code that will replace the image `src`"),allowClear:!0,prefix:l.createElement("span",{className:"addon-text-content"},ae("Image src")),onChange:K,ref:D,onSelect:Q})))),l.createElement(c.y9,{title:ae("Size"),dividerTop:!0},l.createElement(c.n6,{maxWidth:t.maxWidth,showHeight:ne.formImageFieldHeightEnabled,showMinMax:!1,gutter:re.marginSM,rowStyle:{marginBottom:ne.formImageFieldHeightEnabled?4:24},labels:{width:ae("Width"),height:ae("Height"),minWidth:ae("Minimum width"),maxWidth:ae("Maximum width")}})),ne.formFieldBorderEnabled&&l.createElement(c.y9,{title:ae("Borders"),collapsible:!0,open:i,onToggle:oe,dividerTop:!0},l.createElement(f.A,{form:e,elementSettings:t})),ne.formFieldBorderRadiusEnabled&&l.createElement(c.y9,{title:ae("Border radius"),collapsible:!0,open:a,onToggle:le,dividerTop:!0},l.createElement(v.A,{form:e,oneBorderRadiusValue:d,setOneBorderRadiusValue:s,elementSettings:t})),ne.formFieldBoxShadowEnabled&&l.createElement(c.y9,{title:ae("Box shadow"),collapsible:!0,open:n,onToggle:ie,dividerTop:!0},l.createElement(I,null)),ne.formFieldVisibilityEnabled&&l.createElement(c.y9,{title:ae("Display control"),dividerTop:!0},l.createElement(C,{elementSettings:t,form:e})),ne.formFieldAmpVisibilityEnabled&&t.ampShow&&l.createElement(c.y9,{title:ae("AMP visibility"),dividerTop:!0},l.createElement(F,null)))},M=({form:e,name:t,elementSettings:o,isPicture:i,tooltipTitle:a})=>{var r;const{__:n}=(0,_.s9)(),d=(0,S.XW)(),s=(0,l.useRef)(),[m,u]=(0,l.useState)("auto"===(null===(r=o[t])||void 0===r?void 0:r.value)),{token:p}=(0,c.rd)(),[g,h]=(0,l.useState)("");return l.createElement(l.Fragment,null,l.createElement(c.m_,{title:a,placement:"bottom"},l.createElement("div",null,l.createElement(c.lV.Item,{name:t,style:{marginBottom:p.formItemMarginBottomXS/2}},l.createElement(c.FQ,{ref:s,min:0,max:g,placeholder:n("Width"),onChange:o=>{u(!1),h("%"===e.getFieldsValue(!0)[t+"Dim"]?100:"")},prefix:l.createElement(A.Ay,{icon:"ColumnWidthOutlined"}),addonAfter:l.createElement(c.lV.Item,{name:t+"Dim",noStyle:!0},O.z$)})))),!i&&l.createElement(c.dO,{id:"auto-width",label:n("Auto"),labelSize:"small",size:"small",checked:m,onChange:l=>{s.current.value=null,e.setFieldsValue({[t]:"",[t+"Dim"]:"px"}),u(e=>!e),d({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:o.type,settings:{[t]:{classNamePrefix:"em-mob-width-",value:m?null:"auto",dim:""}}})}}))},D=({form:e,name:t,elementSettings:o,isPicture:i,tooltipTitle:a})=>{var r;const{__:n}=(0,_.s9)(),d=(0,S.XW)(),s=(0,l.useRef)(),[m,u]=(0,l.useState)("auto"===(null===(r=o.mobileHeight)||void 0===r?void 0:r.value)),{token:p}=(0,c.rd)();return l.createElement(l.Fragment,null,l.createElement(c.m_,{title:a,placement:"bottom"},l.createElement("div",null,l.createElement(c.lV.Item,{name:t,style:{marginBottom:p.formItemMarginBottomXS/2}},l.createElement(c.FQ,{ref:s,min:0,placeholder:n("Height"),onChange:e=>{u(!1)},prefix:l.createElement(A.Ay,{icon:"ColumnHeightOutlined"}),addonAfter:"px"})))),!i&&l.createElement(c.dO,{id:"auto-height",label:n("Auto"),labelSize:"small",size:"small",checked:m,onChange:t=>{s.current.value=null,e.setFieldsValue({mobileHeight:"",mobileHeightDim:"px"}),u(e=>!e),d({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:o.type,settings:{mobileHeight:{classNamePrefix:"em-mob-height-",value:m?null:"auto",dim:""}}})}}))},H=({form:e,elementSettings:t,boxShadow:o,mobileBordersShow:i,mobileBorderRadiusShow:a,mobileBoxShadowShow:n,mobileSizeShow:d,oneMobileBorderRadiusValue:s,setOneMobileBorderRadiusValue:m,hasLink:u,hasAlt:p,hasTitle:g,linkInputRef:h,linkButtonRef:E,altInputRef:S,altButtonRef:w,titleInputRef:R,titleButtonRef:x,linkInputHandler:T,altButtonHandler:L,altInputHandler:O,titleButtonHandler:V,titleInputHandler:H,linkButtonHandler:z,toggleShowMobileBorderHandler:W,toggleShowMobileBorderRadiusHandler:U,toggleShowMobileBoxShadowHandler:$,toggleShowMobileSizeHandler:G})=>{const{__:j}=(0,_.s9)(),{token:X}=(0,c.rd)(),q=(0,y.rD)();return l.createElement(l.Fragment,null,l.createElement(c.fI,{gutter:30,style:{paddingBottom:4}},l.createElement(c.fv,{span:12},l.createElement(k,{form:e,elementSettings:t,imgParent:!0,typeOfForm:"mobile"})),q.formImageFieldVerticalAlignEnabled&&l.createElement(c.fv,{span:12,align:"right"},l.createElement(B,{form:e,elementSettings:t,typeOfForm:"mobile"}))),l.createElement(c.cG,{className:"selected-td-form__divider",style:{marginBottom:"countdown"===t.type?15:24}}),"countdown"===t.type&&l.createElement(l.Fragment,null,l.createElement(N,{form:e,elementSettings:t}),l.createElement(c.cG,{className:"selected-td-form__divider",style:{marginBottom:24}})),"video"===t.type&&l.createElement(l.Fragment,null,l.createElement(P,{form:e,elementSettings:t}),l.createElement(c.cG,{className:"selected-td-form__divider",style:{marginBottom:24}})),("img"===t.type||"video"===t.type)&&l.createElement(c.lV.Item,{style:{marginBottom:0}},l.createElement(b.A,{form:e,label:j("Image path"),name:"src",placeholder:j("Image path"),elementSettings:t,tooltipTitle:""})),l.createElement(c.$x,{size:8,style:{marginBottom:p||u||g?X.formItemMarginBottomXS:X.formItemMarginBottomMD+4}},l.createElement(c.m_,{title:p||j("Alternative text"),placement:"bottom",getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper")},l.createElement(c.$n,{className:r()("selected-td-form__button",{"selected-td-form__button--active":!!p}),onClick:L,ref:w},l.createElement("span",{className:"addon-text-content"},"Alt"))),q.formFieldImageTitleEnabled&&l.createElement(c.m_,{title:g||j("Tooltip text"),placement:"bottom",getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper")},l.createElement(c.$n,{className:r()("selected-td-form__button",{"selected-td-form__button--active":!!g}),onClick:V,ref:x},l.createElement("span",{className:"addon-text-content"},"Title"))),l.createElement(c.m_,{title:u||j("Hyperlink URL"),placement:"bottom",getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper")},l.createElement(c.$n,{className:r()("selected-td-form__button",{"selected-td-form__button--active":!!u}),icon:l.createElement(A.Ay,{icon:"LinkOutlined",className:"selected-td-form__icon-radius"}),onClick:z,ref:E}))),(!!u||!!p||!!g)&&l.createElement("div",{style:{marginBottom:X.formItemMarginBottomMD+4}},!!u&&l.createElement(c.m_,{trigger:["hover"],title:j("Hyperlink URL"),placement:"bottom"},l.createElement(c.lV.Item,{name:"link",className:"selected-image-form__alt",style:{marginBottom:X.formItemMarginBottomXS}},l.createElement(c.pd,{ref:h,allowClear:!0,placeholder:j("Hyperlink URL"),prefix:l.createElement(A.Ay,{icon:"LinkOutlined"}),onChange:T}))),!!p&&l.createElement(c.m_,{trigger:["hover"],title:j("Alternative text"),placement:"bottom"},l.createElement(c.lV.Item,{name:"alt",className:"selected-image-form__alt",style:{marginBottom:X.formItemMarginBottomXS}},l.createElement(c.pd,{placeholder:j("Alternative text"),allowClear:!0,prefix:l.createElement("span",{className:"addon-text-content"},"Alt"),onChange:O,ref:S}))),q.formFieldImageTitleEnabled&&!!g&&l.createElement(c.m_,{trigger:["hover"],title:j("Tooltip text"),placement:"bottom"},l.createElement(c.lV.Item,{name:"title",className:"selected-image-form__alt",style:{marginBottom:X.formItemMarginBottomXS}},l.createElement(c.pd,{placeholder:j("Tooltip text"),allowClear:!0,prefix:l.createElement("span",{className:"addon-text-content"},"Title"),onChange:H,ref:R})))),l.createElement(c.y9,{title:j("Size"),collapsible:!0,open:d,onToggle:G,dividerTop:!0},l.createElement(c.fI,{gutter:10,style:{paddingBottom:24}},l.createElement(c.fv,{span:12},l.createElement(M,{form:e,name:"mobileWidth",elementSettings:t,isPicture:"true",tooltipTitle:j("Width")})),q.formImageFieldHeightEnabled&&l.createElement(c.fv,{span:12},l.createElement(D,{form:e,name:"mobileHeight",elementSettings:t,isPicture:"true",tooltipTitle:j("Height")})))),q.formFieldBorderEnabled&&l.createElement(c.y9,{title:j("Borders"),collapsible:!0,open:i,onToggle:W,dividerTop:!0},l.createElement(f.A,{form:e,typeOfForm:"mobile"})),q.formFieldBorderRadiusEnabled&&l.createElement(c.y9,{title:j("Border radius"),collapsible:!0,open:a,onToggle:U,dividerTop:!0},l.createElement(v.A,{form:e,oneBorderRadiusValue:s,setOneBorderRadiusValue:m,elementSettings:t,typeOfForm:"mobile"})),q.formFieldBoxShadowEnabled&&l.createElement(c.y9,{title:j("Box shadow"),collapsible:!0,open:n,onToggle:$,dividerTop:!0},l.createElement(I,{typeOfForm:"mobile"})),q.formFieldVisibilityEnabled&&l.createElement(c.y9,{title:j("Display control"),dividerTop:!0},l.createElement(C,{elementSettings:t,form:e})),q.formFieldAmpVisibilityEnabled&&t.ampShow&&l.createElement(c.y9,{title:j("AMP visibility"),dividerTop:!0},l.createElement(F,null)))};var z=o(15582),W=o(44004),U=o(47794),$=o(78443),G=o(40867),j=o(98173),X=o(57546),q=o(19684),Y=o(20387),K=o(41244),Q=o(3875),J=o(32467),Z=o(74397);const ee=({elementSettings:e})=>{const{__:t}=(0,_.s9)(),[o]=c.lV.useForm();let i=(0,n.wA)();const a=(0,y.rD)(),{projectId:r}=(0,m.g)(),p=(0,h.hN)(),b=(0,n.d4)(d.Hs),f=(0,S.XW)(),v=(0,S.K9)(),{openImagePicker:w}=(0,Z.p)(),k=(0,n.d4)(G.Ct),B=(0,n.d4)(G.CS),R=(0,n.d4)(j.C1),x=(0,n.d4)(G.Fv),T=(0,n.d4)(G.yy),[I]=(0,W.dS)(),[A,C]=(0,W.tb)(),[N,P]=(0,l.useState)({name:"",counter:0}),L=(0,l.useRef)(null),F=(0,l.useRef)(null),M=(0,l.useRef)(null),D=(0,l.useRef)(null),ee=(0,l.useRef)(null),te=(0,l.useRef)(null),oe=(0,l.useRef)(null),le=(0,l.useRef)(null),ie=(0,l.useRef)(null),[ae,re]=(0,l.useState)({}),[ne,de]=(0,l.useState)(!0),[se,me]=(0,l.useState)(!0),[ce,ue]=(0,l.useState)(""),[pe,ge]=(0,l.useState)(""),[he,be]=(0,l.useState)(""),[fe,ve]=(0,l.useState)(!1),[_e,Ee]=(0,l.useState)(!1),[Se,ye]=(0,l.useState)(!1),[we,ke]=(0,l.useState)(!1),[Be,Re]=(0,l.useState)(!1),[xe,Te]=(0,l.useState)(!1),[Ie,Ae]=(0,l.useState)(!1),[Ce,Ne]=(0,l.useState)(!1),[Pe,Le]=(0,l.useState)("https://"),Fe=(0,l.useRef)(!1),Oe=(0,l.useRef)(),[Ve,Me]=(0,l.useState)(),[De,He]=(0,l.useState)(!1),[ze,We]=(0,l.useState)(null),[Ue,$e]=(0,l.useState)({start:0,end:0}),[Ge,je]=(0,l.useState)(!1),[Xe,qe]=(0,l.useState)(!1),[Ye,Ke]=(0,l.useState)(!1),Qe=x&&"bottom"!==T,Je=b.hasOwnProperty("type")?E.IE:E.Tm;(0,l.useEffect)(()=>{De&&ie.current&&ie.current.focus()},[De]);const Ze=(0,n.d4)(q.GH);(0,l.useEffect)(()=>{var e;null!==Ze&&void 0!==Ze&&null!==(e=Ze.items)&&void 0!==e&&e.length&&Me((0,y.cM)(Ze.items,t,(e,t)=>{He(!1),v(E.Ru.SANDBOX_ADD_MERGETAG,e),t.stopPropagation(),t.preventDefault()}))},[Ze,Me,t,He,v]);const et=(0,Q.cR)();(0,l.useEffect)(()=>{const e=new K.jG;return e.addDisposable((0,Y.a)(et,"focusin",({target:e})=>{e.closest('[id="merge_tags_wrapper"]')||We(e)})),e.addDisposable((0,Y.a)(et,"click",({target:e})=>{e.closest(".merge-tags")||e.closest("#merge_tags_button")||He(!1)})),()=>{e.dispose()}},[et]);const tt=e.border,ot=e.mobileBorder,lt=Object.keys(tt).find(e=>{var t,o,l;return(null===(t=tt[e])||void 0===t?void 0:t.width)||(null===(o=tt[e])||void 0===o?void 0:o.style)||(null===(l=tt[e])||void 0===l?void 0:l.color)}),it=Object.keys(ot).find(e=>{var t,o,l;return(null===(t=ot[e])||void 0===t?void 0:t.width)||(null===(o=ot[e])||void 0===o?void 0:o.style)||(null===(l=ot[e])||void 0===l?void 0:l.color)}),at=e=>e&&(null!==e&&void 0!==e&&e.width||null!==e&&void 0!==e&&e.style||null!==e&&void 0!==e&&e.color)?e:"";(0,l.useEffect)(()=>{if(e){var t,l,i,a,r,n,d,s,m,c,u,p,h,b,f,v,_,E,S,y,w,k,B,R,x,T,I,A,C,N,P,L,F,V,M,D,H,z,W,U,$,G,j,X,q,Y,K,Q,J,Z,ee;e.src!==Oe.current&&(Oe.current=e.src,Fe.current=!1);const te=e.boxShadow;if(re(te),e.link&&Le((0,O.TW)(e.link,"https://")),o.setFieldsValue({...e,link:null==e.link?"https://":e.link,width:null===(t=e.width)||void 0===t?void 0:t.value,widthDim:null===(l=e.width)||void 0===l?void 0:l.dim,height:null===(i=e.height)||void 0===i?void 0:i.value,heightDim:null===(a=e.height)||void 0===a?void 0:a.dim,borderAll:(0,O.ok)(e.border.all),borderTop:(0,O.ok)(e.border.top),borderBottom:(0,O.ok)(e.border.bottom),borderRight:(0,O.ok)(e.border.right),borderLeft:(0,O.ok)(e.border.left),mobileBorderAll:at(e.mobileBorder.all)||!(at(e.mobileBorder.top)||at(e.mobileBorder.bottom)||at(e.mobileBorder.right)||at(e.mobileBorder.left))&&at(e.border.all),mobileBorderTop:at(e.mobileBorder.top)||!at(e.mobileBorder.all)&&at(e.border.top),mobileBorderBottom:at(e.mobileBorder.bottom)||!at(e.mobileBorder.all)&&at(e.border.bottom),mobileBorderRight:at(e.mobileBorder.right)||!at(e.mobileBorder.all)&&at(e.border.right),mobileBorderLeft:at(e.mobileBorder.left)||!at(e.mobileBorder.all)&&at(e.border.left),borderRadiusAll:(0,O.ok)(e.borderRadius.all),borderRadiusTopLeft:(0,O.ok)(e.borderRadius.topLeft),borderRadiusBottomLeft:(0,O.ok)(e.borderRadius.bottomLeft),borderRadiusTopRight:(0,O.ok)(e.borderRadius.topRight),borderRadiusBottomRight:(0,O.ok)(e.borderRadius.bottomRight),boxShadowInset:(0,O.ok)(null===(r=e.boxShadow)||void 0===r?void 0:r.inset)||!1,boxShadowHOffset:(0,O.ok)(null===(n=e.boxShadow)||void 0===n?void 0:n.hOffset),boxShadowVOffset:(0,O.ok)(null===(d=e.boxShadow)||void 0===d?void 0:d.vOffset),boxShadowBlurRadius:(0,O.ok)(null===(s=e.boxShadow)||void 0===s?void 0:s.blurRadius),boxShadowSpreadRadius:(0,O.ok)(null===(m=e.boxShadow)||void 0===m?void 0:m.spreadRadius),boxShadowColor:(0,O.ok)(null===(c=e.boxShadow)||void 0===c?void 0:c.color),mobileWidth:(0,O.xc)(null===(u=e.mobileWidth)||void 0===u?void 0:u.value)||(null===(p=e.width)||void 0===p?void 0:p.value),mobileWidthDim:(0,O.xc)(null===(h=e.mobileWidth)||void 0===h?void 0:h.value)?null===(b=e.mobileWidth)||void 0===b?void 0:b.dim:null===(f=e.width)||void 0===f?void 0:f.dim,mobileHeight:(0,O.xc)(null===(v=e.mobileHeight)||void 0===v?void 0:v.value)||(null===(_=e.height)||void 0===_?void 0:_.value),mobileHeightDim:(0,O.xc)(null===(E=e.mobileHeight)||void 0===E?void 0:E.value)?null===(S=e.mobileHeight)||void 0===S?void 0:S.dim:null===(y=e.height)||void 0===y?void 0:y.dim,mobileBorderRadiusAll:(0,O.ok)(e.mobileBorderRadius.all)||(0,O.ok)(e.borderRadius.all),mobileBorderRadiusTopLeft:(0,O.ok)(null===(w=e.mobileBorderRadius)||void 0===w?void 0:w.topLeft)||(0,O.ok)(null===(k=e.mobileBorderRadius)||void 0===k?void 0:k.all)||(0,O.ok)(null===(B=e.borderRadius)||void 0===B?void 0:B.topLeft)||(0,O.ok)(null===(R=e.borderRadius)||void 0===R?void 0:R.all),mobileBorderRadiusBottomLeft:(0,O.ok)(null===(x=e.mobileBorderRadius)||void 0===x?void 0:x.bottomLeft)||(0,O.ok)(null===(T=e.mobileBorderRadius)||void 0===T?void 0:T.all)||(0,O.ok)(null===(I=e.borderRadius)||void 0===I?void 0:I.bottomLeft)||(0,O.ok)(null===(A=e.borderRadius)||void 0===A?void 0:A.all),mobileBorderRadiusTopRight:(0,O.ok)(null===(C=e.mobileBorderRadius)||void 0===C?void 0:C.topRight)||(0,O.ok)(null===(N=e.mobileBorderRadius)||void 0===N?void 0:N.all)||(0,O.ok)(null===(P=e.borderRadius)||void 0===P?void 0:P.topRight)||(0,O.ok)(null===(L=e.borderRadius)||void 0===L?void 0:L.all),mobileBorderRadiusBottomRight:(0,O.ok)(null===(F=e.mobileBorderRadius)||void 0===F?void 0:F.bottomRight)||(0,O.ok)(null===(V=e.mobileBorderRadius)||void 0===V?void 0:V.all)||(0,O.ok)(null===(M=e.borderRadius)||void 0===M?void 0:M.bottomRight)||(0,O.ok)(null===(D=e.borderRadius)||void 0===D?void 0:D.all),mobileBoxShadowInset:null!=(null===(H=e.mobileBoxShadow)||void 0===H?void 0:H.inset)?e.mobileBoxShadow.inset:(null===(z=e.boxShadow)||void 0===z?void 0:z.inset)||!1,mobileBoxShadowHOffset:(0,O.ok)(null===(W=e.mobileBoxShadow)||void 0===W?void 0:W.hOffset)||(0,O.ok)(null===(U=e.boxShadow)||void 0===U?void 0:U.hOffset),mobileBoxShadowVOffset:(0,O.ok)(null===($=e.mobileBoxShadow)||void 0===$?void 0:$.vOffset)||(0,O.ok)(null===(G=e.boxShadow)||void 0===G?void 0:G.vOffset),mobileBoxShadowBlurRadius:(0,O.ok)(null===(j=e.mobileBoxShadow)||void 0===j?void 0:j.blurRadius)||(0,O.ok)(null===(X=e.boxShadow)||void 0===X?void 0:X.blurRadius),mobileBoxShadowSpreadRadius:(0,O.ok)(null===(q=e.mobileBoxShadow)||void 0===q?void 0:q.spreadRadius)||(0,O.ok)(null===(Y=e.boxShadow)||void 0===Y?void 0:Y.spreadRadius),mobileBoxShadowColor:(0,O.ok)((null===(K=e.mobileBoxShadow)||void 0===K?void 0:K.color)||(null===(Q=e.boxShadow)||void 0===Q?void 0:Q.color)),mobileAlign:(0,O.ok)(null===(J=e.mobileAlign)||void 0===J?void 0:J.value)||e.align,mobileVerticalAlign:(0,O.ok)((null===(Z=e.mobileVerticalAlign)||void 0===Z?void 0:Z.value)||e.valign),show:e.show?e.show:"all",altSrc:e.src}),e.countdown){let t=new URL("https://emailmaker.ru/?"+e.countdown),l=t.searchParams.get("font1"),i=!1,a=!1;l.endsWith("-b")?(l=l.substring(0,l.length-2),i=!0):l.endsWith("-i")?(l=l.substring(0,l.length-2),a=!0):l.endsWith("-bi")&&(l=l.substring(0,l.length-3),i=!0,a=!0);let r=t.searchParams.get("font2"),n=!1,d=!1;r.endsWith("-b")?(r=r.substring(0,r.length-2),n=!0):r.endsWith("-i")?(r=r.substring(0,r.length-2),d=!0):r.endsWith("-bi")&&(r=r.substring(0,r.length-3),n=!0,d=!0),o.setFieldsValue({countdownTime:g()(new Date(Date.parse(t.searchParams.get("time"))+36e5*t.searchParams.get("timezone")+(new Date).getTimezoneOffset()/60*36e5).toISOString()),countdownDuration:t.searchParams.get("frames")||20,countdownTimeZone:t.searchParams.get("timezone"),countdownLanguage:t.searchParams.get("locale").replace("-","_"),countdownBackgroundColor:"#"+t.searchParams.get("bg"),countdownTransparency:"true"===t.searchParams.get("tp")?"checked":"",countdownNumbersFont:l,countdownNumbersFontSize:t.searchParams.get("size1")/2,countdownNumbersFontSizeDim:"px",countdownNumbersColor:"#"+t.searchParams.get("color1"),countdownLabelsFont:r,countdownLabelsFontSize:t.searchParams.get("size2")/2,countdownLabelsFontSizeDim:"px",countdownLabelsColor:"#"+t.searchParams.get("color2"),countdownNumbersStrong:i,countdownNumbersItalic:a,countdownLabelsStrong:n,countdownLabelsItalic:d})}!(0,O.ok)(e.borderRadius.all)&&((0,O.ok)(e.borderRadius.topLeft)||(0,O.ok)(e.borderRadius.bottomLeft)||(0,O.ok)(e.borderRadius.topRight)||(0,O.ok)(e.borderRadius.bottomRight))?de(!1):de(!0),!(0,O.ok)(e.mobileBorderRadius.all)&&((0,O.ok)(e.mobileBorderRadius.topLeft)||(0,O.ok)(e.mobileBorderRadius.bottomLeft)||(0,O.ok)(e.mobileBorderRadius.topRight)||(0,O.ok)(e.mobileBorderRadius.bottomRight))||(0,O.ok)(e.mobileBorderRadius.all)&&((0,O.ok)(e.mobileBorderRadius.topLeft)||(0,O.ok)(e.mobileBorderRadius.bottomLeft)||(0,O.ok)(e.mobileBorderRadius.topRight)||(0,O.ok)(e.mobileBorderRadius.bottomRight))||!(0,O.ok)(e.borderRadius.all)&&!(0,O.ok)(e.mobileBorderRadius.all)&&((0,O.ok)(e.borderRadius.topLeft)||(0,O.ok)(e.borderRadius.bottomLeft)||(0,O.ok)(e.borderRadius.topRight)||(0,O.ok)(e.borderRadius.bottomRight))?me(!1):me(!0),ve(e=>!!lt||e),Ee(e=>!(!lt&&!it)||e),ye(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),ke(!!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),Re(!!e.boxShadow),Te(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),Ae(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value||!!e.height.value),e.link?ue(e.link):ue(Fe.current?"...":""),ge(e.alt),be(e.title),qe(null===(ee=e.imgReplacer)||void 0===ee?void 0:ee.length)}},[o,e]);const rt=async(e,t,o)=>{const l={};l.user_id=R.id,l.folder=e,t&&("image/gif"!==t.type&&(t=await(0,u.A)(t,{maxSizeMB:a.compressMaxSize||.45,maxWidthOrHeight:a.compressMaxWidthOrHeight||2e3})),l.file=t),o&&(l.page_url=o);const i=await I(l);if(i.error)p.fromError("IMAGE_UPLOAD_ERROR",t,i.error,!0);else{const e=(0,U.g0)(i.data);if(e.error)return;if(e.file_url)return e.file_url}},nt=((e,t)=>{let o;return function(...l){clearTimeout(o),o=setTimeout(()=>{clearTimeout(o),e(...l)},t)}})(()=>{const t=o.getFieldsValue(!0);let l=new URL("https://cdt3.emcdn.ru/rndt?"+e.countdown),i=t.countdownNumbersFont;t.countdownNumbersStrong&&t.countdownNumbersItalic?i+="-bi":t.countdownNumbersStrong?i+="-b":t.countdownNumbersItalic&&(i+="-i");let a=t.countdownLabelsFont;t.countdownLabelsStrong&&t.countdownLabelsItalic?a+="-bi":t.countdownLabelsStrong?a+="-b":t.countdownLabelsItalic&&(a+="-i"),l.searchParams.set("time",new Date(t.countdownTime.$d-36e5*t.countdownTimeZone-(new Date).getTimezoneOffset()/60*36e5).toISOString()),l.searchParams.set("bg",t.countdownBackgroundColor.substring(1)||"#FFFFFF"),l.searchParams.set("tp",!!t.countdownTransparency),l.searchParams.set("font1",i),l.searchParams.set("size1",2*t.countdownNumbersFontSize||12),l.searchParams.set("color1",t.countdownNumbersColor.substring(1)||"#000000"),l.searchParams.set("font2",a),l.searchParams.set("size2",2*t.countdownLabelsFontSize||8),l.searchParams.set("color2",t.countdownLabelsColor.substring(1)||"#959595"),l.searchParams.set("spacing",Math.round(.4*t.countdownNumbersFontSize)||5),l.searchParams.set("locale",t.countdownLanguage.replace("_","-")),l.searchParams.set("timezone",t.countdownTimeZone),l.searchParams.set("frames",t.countdownDuration),A({link:JSON.stringify({target:l.href})}),Ne(!0)},500),dt=(0,l.useCallback)(e=>{i(Je===E.Tm?(0,d.A9)(e):(0,s.A9)(e))},[i,Je]),st=(0,l.useCallback)((t,l)=>{const i=(0,J.xv)(e.src||"")===(0,J.xv)(t||"");i&&t===e.src||(f({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{src:t}}),dt({...e,src:t,activateSection:null,changeKey:"src"}),o.setFieldValue("src",t)),"save"===(null===l||void 0===l?void 0:l.mode)&&i&&(P(e=>({name:"src",counter:e.counter+1})),f({operation:E.Ru.SANDBOX_CURRENT_IMAGE_RELOAD,src:t,forceReload:!0}))},[e,o,dt,f]),mt=(0,l.useCallback)(async t=>{const o=await w({kind:"img",currentUrl:(0,J.xv)(e.src||""),entryModal:t});null!==o&&void 0!==o&&o.url&&st(o.url,o.meta)},[st,e.src,w]),ct=(t,...l)=>{var i,n;const d=o.getFieldsValue(!0),s=Object.keys(t)[0];let m;switch(s){case"link":let l=t[s];"string"===typeof l&&"https://http"===l.substring(0,12)&&(l=l.substring(8,l.length),o.setFieldValue("link",l)),m={link:l};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":m={boxShadow:{hOffset:d.boxShadowHOffset,vOffset:d.boxShadowVOffset,blurRadius:d.boxShadowBlurRadius,spreadRadius:d.boxShadowSpreadRadius,color:d.boxShadowColor,inset:d.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":var c,p,g;if("borderAll"===d.borderPosition)m={border:{...E.iV,all:{...X.RH,...d.borderAll}}},o.setFieldsValue({borderLeft:X.RH,borderRight:X.RH,borderTop:X.RH,borderBottom:X.RH});else null!==(c=d.borderAll)&&void 0!==c&&c.width||null!==(p=d.borderAll)&&void 0!==p&&p.style||null!==(g=d.borderAll)&&void 0!==g&&g.color?(m={border:{all:null,left:d.borderAll,right:d.borderAll,top:d.borderAll,bottom:d.borderAll,[X.Vz[s]]:{...d[s],...t[s]}}},o.setFieldsValue({borderAll:null,borderLeft:d.borderAll,borderRight:d.borderAll,borderTop:d.borderAll,borderBottom:d.borderAll,[s]:{...d[s],...t[s]}})):(m={border:{all:null,left:d.borderLeft,right:d.borderRight,top:d.borderTop,bottom:d.borderBottom,[X.Vz[s]]:{...d[s],...t[s]}}},o.setFieldsValue({border:m.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if("mobileBorderAll"===d.mobileBorderPosition)m={mobileBorder:{...E.iV,all:{...X.RH,...d.mobileBorderAll,classNamePrefix:"em-mob-border_"+X.ax[s]+"-"}}},o.setFieldsValue({borderLeft:X.RH,borderRight:X.RH,borderTop:X.RH,borderBottom:X.RH});else{var h,b,v,_,S,y;const l=X.ax[s],i={...d[s],...t[s]},a=!(null!==i&&void 0!==i&&i.width)&&!(null!==i&&void 0!==i&&i.style)&&!(null!==i&&void 0!==i&&i.color);if(null!==(h=d.mobileBorder)&&void 0!==h&&null!==(b=h.all)&&void 0!==b&&b.width||null!==(v=d.mobileBorder)&&void 0!==v&&null!==(_=v.all)&&void 0!==_&&_.style||null!==(S=d.mobileBorder)&&void 0!==S&&null!==(y=S.all)&&void 0!==y&&y.color){const e=d.mobileBorderAll;m={mobileBorder:{all:null,left:e,right:e,top:e,bottom:e,[l]:a?null:{...i,classNamePrefix:"em-mob-border_"+l+"-"}}},o.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:e,mobileBorderRight:e,mobileBorderTop:e,mobileBorderBottom:e,[s]:i})}else{const t=e.mobileBorder||{},r=e=>{const o=t[e];return o&&(null!==o&&void 0!==o&&o.width||null!==o&&void 0!==o&&o.style||null!==o&&void 0!==o&&o.color)?o:null};m={mobileBorder:{all:null,left:"left"===l?a?null:{...i,classNamePrefix:"em-mob-border_left-"}:r("left"),right:"right"===l?a?null:{...i,classNamePrefix:"em-mob-border_right-"}:r("right"),top:"top"===l?a?null:{...i,classNamePrefix:"em-mob-border_top-"}:r("top"),bottom:"bottom"===l?a?null:{...i,classNamePrefix:"em-mob-border_bottom-"}:r("bottom")}},o.setFieldsValue({[s]:i})}}break;case"width":m={[s]:{value:t[s],dim:d.widthDim}};break;case"widthDim":m={width:{value:d.width,dim:t[s]}};break;case"height":m={[s]:{value:t[s],dim:d.heightDim}};break;case"heightDim":m={height:{value:d.height,dim:t[s]}};break;case"borderRadiusAll":m={borderRadius:{[X.wF[s]]:+t[s]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":m={borderRadius:{topLeft:d.borderRadiusTopLeft,bottomLeft:d.borderRadiusBottomLeft,topRight:d.borderRadiusTopRight,bottomRight:d.borderRadiusBottomRight,[X.wF[s]]:+t[s]}};break;case"mobileWidth":m={[s]:{classNamePrefix:"em-mob-width-",value:t[s],dim:d.mobileWidthDim}};break;case"mobileWidthDim":m={mobileWidth:{classNamePrefix:"em-mob-width-",value:d.mobileWidth||100,dim:t[s]}};break;case"mobileHeight":m={[s]:{classNamePrefix:"em-mob-height-",value:t[s],dim:d.mobileHeightDim}};break;case"mobileHeightDim":m={mobileHeight:{classNamePrefix:"em-mob-height-",value:d.mobileHeight,dim:t[s]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":m={mobileBorderRadius:{[X.NW[s]]:t[s],classNamePrefix:"em-mob-border_radius_"+X.NW[s]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":m={mobileBoxShadow:{hOffset:d.mobileBoxShadowHOffset,vOffset:d.mobileBoxShadowVOffset,blurRadius:d.mobileBoxShadowBlurRadius,spreadRadius:d.mobileBoxShadowSpreadRadius,color:d.mobileBoxShadowColor,inset:d.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":m={[s]:{classNamePrefix:"em-mob-text_align-",value:t[s]}};break;case"mobileVerticalAlign":m={[s]:{classNamePrefix:"em-mob-vertical_align-",value:t[s]}};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":nt();break;case"video":(async()=>{const e=o.getFieldsValue(!0);e.video.source&&rt("tmp",null,e.video.source).then(t=>{var o=document.createElement("canvas"),l=o.getContext("2d"),i=new Image,n=new Image;let d=t,s="https://useblocks.io/app/"+e.video.playButton+".png";i.crossOrigin="Anonymous",n.crossOrigin="Anonymous";let m=!1,c=!1;i.onload=function(){l.clearRect(0,0,o.width,o.height),l.drawImage(i,0,0,o.width,o.height),m=!0},i.src=d,n.onload=function(){c=!0},n.src=s;let p=setInterval(function(){if(m&&c){o.width=i.width,o.height=i.height,l.clearRect(0,0,o.width,o.height),l.drawImage(i,0,0,i.width,i.height);const d=Math.min(o.width,o.height);let s;if(i.height>i.width)s=.3;else{const e=i.width/i.height,t=2.5;s=Math.min(.35,.3+(e-1)/(t-1)*.1)}const m=d*s,c=n.width/n.height;let g,h;c>=1?(g=m,h=m/c):(h=m,g=m*c);var e=(o.width-g)/2,t=(o.height-h)/2;l.drawImage(n,e,t,g,h),o.toBlob(async function(e){const t=await(0,u.A)(new File([e],"image.jpeg",{type:"image/jpeg"}),{maxSizeMB:a.compressMaxSize||.45,maxWidthOrHeight:a.compressMaxWidthOrHeight||2e3});rt(r,t).then(e=>{st(e)})},"image/jpg",1),clearInterval(p)}},300)})})(),d.link=d.video.source,f({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:"video",settings:{video:{...d.video,...t.video},link:d.link}});break;case"src":const w=t[s],k=e.src,B=(null===(i=d.video)||void 0===i?void 0:i.playButton)||(null===(n=e.video)||void 0===n?void 0:n.playButton);if("video"===e.type&&B&&"none"!==B&&!Ye&&w&&(!k||w!==k))return void(async t=>{var l,i;const n=(null===(l=o.getFieldsValue(!0).video)||void 0===l?void 0:l.playButton)||(null===(i=e.video)||void 0===i?void 0:i.playButton);if(!t||!n||"none"===n||Ye)return;Ke(!0);var d=document.createElement("canvas"),s=d.getContext("2d"),m=new Image,c=new Image;let p=t,g="https://useblocks.io/app/"+n+".png";m.crossOrigin="Anonymous",c.crossOrigin="Anonymous";let h=!1,b=!1;m.onload=function(){s.clearRect(0,0,d.width,d.height),s.drawImage(m,0,0,d.width,d.height),h=!0},m.src=p,c.onload=function(){b=!0},c.src=g;let v=setInterval(function(){if(h&&b){d.width=m.width,d.height=m.height,s.clearRect(0,0,d.width,d.height),s.drawImage(m,0,0,m.width,m.height);const i=Math.min(d.width,d.height);let n;if(m.height>m.width)n=.3;else{const e=m.width/m.height,t=2;n=Math.min(.4,.3+(e-1)/(t-1)*.1)}const p=i*n,g=c.width/c.height;let h,b;g>=1?(h=p,b=p/g):(b=p,h=p*g);var t=(d.width-h)/2,l=(d.height-b)/2;s.drawImage(c,t,l,h,b),d.toBlob(async function(t){const l=await(0,u.A)(new File([t],"image.jpeg",{type:"image/jpeg"}),{maxSizeMB:a.compressMaxSize||.45,maxWidthOrHeight:a.compressMaxWidthOrHeight||2e3});rt(r,l).then(t=>{Ke(!1),f({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{src:t}}),dt({...e,src:t,activateSection:null,changeKey:"src"}),setTimeout(()=>{o.setFieldValue("src",t)},100)}).catch(e=>{Ke(!1)})},"image/jpg",1),clearInterval(v)}},300)})(w);m=t;break;default:m=t}var w;"borderPosition"!==s&&"mobileBorderPosition"!==s&&-1===s.indexOf("countdown")&&"video"!==s&&(f({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:m}),"video"!==s&&-1===s.indexOf("countdown")&&"mobileBorderRadiusAll"!==s&&"mobileBorderRadiusTopLeft"!==s&&"mobileBorderRadiusTopRight"!==s&&"mobileBorderRadiusBottomLeft"!==s&&"mobileBorderRadiusBottomRight"!==s&&dt({...e,...m,mobileBorderRadius:{...e.mobileBorderRadius,...null===(w=m)||void 0===w?void 0:w.mobileBorderRadius},activateSection:null,changeKey:s}))};(0,l.useEffect)(()=>{C.isError&&(p.error(C),Ne(!1))},[C]),(0,l.useEffect)(()=>{if(C.isSuccess&&Ce){var t;if(400===(null===(t=C.data.data)||void 0===t?void 0:t.status))p.error({message:C.data.code,description:C.data.message});else{let t=new URL(C.data.target),o={countdown:{link:C.data.link,params:t.search.substring(1)}};f({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:o})}Ne(!1)}},[C,Ce,e,p,f]);(0,z.A)(e=>{const t=e.data.operation;t===E.Ru.APPLICATION_OPEN_IMAGE_AI_POPUP?mt(E.lx.UPLOAD_IMAGE_MODAL_AI):t===E.Ru.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?mt(E.lx.UPLOAD_IMAGE_MODAL_UPLOAD):t===E.Ru.APPLICATION_OPEN_IMAGE_EDIT_POPUP?mt(E.lx.UPLOAD_IMAGE_MODAL_EDIT):t===E.Ru.APPLICATION_OPEN_IMAGE_GIF_POPUP?mt(E.lx.UPLOAD_IMAGE_MODAL_GIF):t===E.Ru.APPLICATION_OPEN_IMAGE_STOCK_POPUP?mt(E.lx.UPLOAD_IMAGE_MODAL_STOCK):t===E.Ru.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(i((0,$.Os)()),i((0,$.Oo)()))});const ut=()=>{ce?(Fe.current=!1,ue(""),o.setFieldValue("link",""),f({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{link:""}})):(Fe.current=!0,ue(L.current&&L.current.input.value?L.current.input.value:"..."),setTimeout(()=>{L.current.focus()}))},pt=e=>{""===e.target.value?ue("..."):(F.current.classList.add("selected-td-form__button--active"),ue(e.target.value)),(0,O.b9)(e.target.value,Le)},gt=()=>{const t=o.getFieldsValue(!0);pe?(ge(""),t.alt="",f({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{alt:""}})):(ge(M.current&&M.current.input.value?M.current.input.value:"..."),setTimeout(()=>{M.current.focus()}))},ht=e=>{""===e.target.value?ge("..."):(D.current.classList.add("selected-td-form__button--active"),ge(e.target.value))},bt=()=>{const t=o.getFieldsValue(!0);he?(be(""),t.title="",f({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{title:""}})):(be(ee.current&&ee.current.input.value?ee.current.input.value:"..."),setTimeout(()=>{ee.current.focus()}))},ft=e=>{""===e.target.value?be("..."):(te.current.classList.add("selected-td-form__button--active"),be(e.target.value))};return l.createElement(c.lV,{form:o,layout:"vertical",name:"selected_image_form",initialValues:{src:"",width:"",height:"",widthDim:"",heightDim:"",alt:"",align:"left",border:"",boxShadow:"",show:"all",borderPosition:X.uE[lt]||"borderAll",mobileBorderPosition:X.lS[it]||"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:ct,autoComplete:"off",className:"element-controls"},!Qe&&l.createElement(c.m_,{title:t("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"},l.createElement(c.Fc,{className:"selected_form-mobile-props-title",message:t("Appearance on mobile devices"),type:"info"})),k===E.ND&&B.styles?l.createElement("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props"},l.createElement(H,{form:o,elementSettings:e,boxShadow:ae,mobileBordersShow:_e,mobileBorderRadiusShow:we,mobileBoxShadowShow:xe,mobileSizeShow:Ie,oneMobileBorderRadiusValue:se,setOneMobileBorderRadiusValue:me,hasLink:ce,hasAlt:pe,hasTitle:he,linkInputRef:L,linkButtonRef:F,altInputRef:M,altButtonRef:D,titleInputRef:ee,titleButtonRef:te,linkInputHandler:pt,altButtonHandler:gt,altInputHandler:ht,titleButtonHandler:bt,titleInputHandler:ft,linkButtonHandler:ut,toggleShowMobileBorderHandler:()=>{const t=o.getFieldsValue(!0);setTimeout(()=>{Ee(e=>!e),_e?(t.mobileBorderAll=X.RH,t.mobileBorderTop=X.RH,t.mobileBorderBottom=X.RH,t.mobileBorderRight=X.RH,t.mobileBorderLeft=X.RH):t.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},f({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:t.mobileBorderAll.color,style:t.mobileBorderAll.style,width:t.mobileBorderAll.width}}}})})},toggleShowMobileBorderRadiusHandler:()=>{const t=o.getFieldsValue(!0);setTimeout(()=>{ke(e=>!e),we?(t.mobileBorderRadiusAll=null,me(!0)):t.mobileBorderRadiusAll=5,f({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:t.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},toggleShowMobileBoxShadowHandler:()=>{const t=o.getFieldsValue(!0);setTimeout(()=>{Te(e=>!e),xe?(t.mobileBoxShadowInset=!1,t.mobileBoxShadowHOffset=null,t.mobileBoxShadowVOffset=null,t.mobileBoxShadowBlurRadius=null,t.mobileBoxShadowSpreadRadius=null,t.mobileBoxShadowColor=""):(t.mobileBoxShadowInset=!1,t.mobileBoxShadowHOffset=5,t.mobileBoxShadowVOffset=5,t.mobileBoxShadowBlurRadius=10,t.mobileBoxShadowSpreadRadius=-5,t.mobileBoxShadowColor="#000000"),f({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:t.mobileBoxShadowBlurRadius,color:t.mobileBoxShadowColor,hOffset:t.mobileBoxShadowHOffset,inset:t.mobileBoxShadowInset,spreadRadius:t.mobileBoxShadowSpreadRadius,vOffset:t.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},toggleShowMobileSizeHandler:()=>{const t=o.getFieldsValue(!0);setTimeout(()=>{Ae(e=>!e),Ie&&(t.mobileWidth="",t.mobileHeight="",f({operation:E.Ru.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-"}}}))})}})," "):l.createElement("div",{id:"selected_element_form_desktop_props"},l.createElement(V,{form:o,elementSettings:e,boxShadow:ae,bordersShow:fe,borderRadiusShow:Se,boxShadowShow:Be,oneBorderRadiusValue:ne,setOneBorderRadiusValue:de,hasLink:ce,hasAlt:pe,hasTitle:he,isOpenSrcReplacer:Xe,mergeTagItems:Ve,mergeMenuOpen:De,setMergeMenuOpen:He,cascaderRef:ie,linkInputRef:L,linkButtonRef:F,altInputRef:M,altButtonRef:D,titleInputRef:ee,titleButtonRef:te,srcReplacerInputRef:oe,srcReplacerButtonRef:le,linkProtocol:Pe,handleLinkProtocolsChange:e=>{o.setFieldValue("link","mergetag"!==e?e:""),Le(e)},linkButtonHandler:ut,linkInputHandler:pt,altButtonHandler:gt,altInputHandler:ht,titleButtonHandler:bt,titleInputHandler:ft,srcReplacerButtonHandler:()=>{qe(!Xe),Xe?(o.setFieldValue("imgReplacer",""),f({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:""}})):setTimeout(()=>oe.current.focus())},srcInputHandler:e=>{""!==e.target.value&&le.current.classList.add("selected-td-form__button--active")},handleSelect:({target:e})=>{if(e&&!Ge){const{selectionStart:t,selectionEnd:o}=e;$e({start:t,end:o})}je(!1)},onChange:(t,l)=>{if(He(!1),t){const i=Ze.syntax.length>1?Ve.findIndex(e=>e.key===l[0].key):0,a=Ze.syntax[i].replace("%value%",t[t.length-1]);"selected_image_form_title"===(null===ze||void 0===ze?void 0:ze.getAttribute("id"))||"selected_image_form_alt"===(null===ze||void 0===ze?void 0:ze.getAttribute("id"))||"selected_image_form_link"===(null===ze||void 0===ze?void 0:ze.getAttribute("id"))||"selected_image_form_imgReplacer"===(null===ze||void 0===ze?void 0:ze.getAttribute("id"))?((t,l)=>{const i=document.getElementById(l);if(i){var a,r;const n="selected_image_form_",d=l.substring(l.indexOf(n)+n.length),s=null===(a=i.value)||void 0===a?void 0:a.substring(0,Ue.start),m=null===(r=i.value)||void 0===r?void 0:r.substring(Ue.end);f({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{...e,[d]:s+t+m}}),o.setFieldValue(d,s+t+m),i.focus(),setTimeout(()=>{i.selectionStart=Ue.start,i.selectionEnd=Ue.start+t.length},400),je(!0)}})(a,null===ze||void 0===ze?void 0:ze.getAttribute("id")):(o.setFieldValue("imgReplacer",a),f({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{imgReplacer:a}}))}},filter:(e,t)=>t.some(t=>t.label.toLowerCase().indexOf(e.toLowerCase())>-1),renderSearchOption:(e,t)=>{const o=t.map((t,o)=>{const i=t.label.split(new RegExp(`(${e})`,"gi"));return l.createElement("span",{key:t.value},0!==o&&l.createElement("span",null,"\xa0/\xa0"),i.map((t,o)=>t.toLowerCase()===e.toLowerCase()?l.createElement("span",{key:o,style:{color:"red"}},t):t))});return l.createElement("div",{title:t.map(e=>e.label).join(" / ")},o)},handleChangeValues:ct,toggleShowBorderHandler:()=>{const t=o.getFieldsValue(!0);setTimeout(()=>{ve(e=>!e),fe?(t.borderAll=X.RH,t.borderTop=X.RH,t.borderBottom=X.RH,t.borderRight=X.RH,t.borderLeft=X.RH):t.borderAll={width:1,color:"#E5E5E5",style:"solid"},f({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:t.borderAll.color,style:t.borderAll.style,width:t.borderAll.width}}}})})},toggleShowBorderRadiusHandler:()=>{const t=o.getFieldsValue(!0);setTimeout(()=>{ye(e=>!e),Se?(t.borderRadiusAll=0,de(!0)):t.borderRadiusAll=5,f({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:t.borderRadiusAll}}})})},toggleShowBoxShadowHandler:()=>{const t=o.getFieldsValue(!0);setTimeout(()=>{Re(e=>!e),Be?(t.boxShadowInset=!1,t.boxShadowHOffset=null,t.boxShadowVOffset=null,t.boxShadowBlurRadius=null,t.boxShadowSpreadRadius=null,t.boxShadowColor=""):(t.boxShadowInset=!1,t.boxShadowHOffset=5,t.boxShadowVOffset=5,t.boxShadowBlurRadius=10,t.boxShadowSpreadRadius=-5,t.boxShadowColor="#000000"),f({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:t.boxShadowBlurRadius,color:t.boxShadowColor,hOffset:t.boxShadowHOffset,inset:t.boxShadowInset,spreadRadius:t.boxShadowSpreadRadius,vOffset:t.boxShadowVOffset}}})})}})))},te=()=>{const{__:e}=(0,_.s9)();return l.createElement(c.m_,{trigger:["hover"],title:e("The font-size CSS property sets the size of the font."),placement:"top"},l.createElement(c.lV.Item,{name:"mobileFontSize"},l.createElement(c.FQ,{min:8,max:90,placeholder:e("Font size"),prefix:l.createElement(A.Ay,{icon:"FontSizeOutlined"}),addonAfter:"px"})))};var oe=o(43284),le=o(56315);const ie=({form:e,elementSettings:t,name:o,icon:i,tooltipTitle:a=null,showTooltip:n=!0,forceInactive:d=!1})=>{const{__:s}=(0,_.s9)(),m=e.getFieldValue(o),u=(0,S.XW)(),[p,g]=(0,l.useState)(t[o]);(0,l.useEffect)(()=>{t[o]!==e.getFieldValue(o)&&(e.setFieldValue(o,t[o]),g(t[o]))},[t,e,o]),(0,l.useEffect)(()=>{p!==m&&g(m)},[m,p,o]);const h=()=>{const l={[o]:!p};e.setFieldValue(o,!p),u({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:t.type,settings:l}),"textSuperscript"===o?e.setFieldValue("textSubscript",!1):"textSubscript"===o&&e.setFieldValue("textSuperscript",!1),g(e=>!e)};return l.createElement(c.lV.Item,{name:o},n?l.createElement(c.m_,{placement:"bottom",title:a||s(o.substring(4))},l.createElement(c.$n,{className:r()("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":p&&!d}),onClick:h},i)):l.createElement(c.$n,{className:r()("selected-td-form__button selected-td-form__button_style",{"selected-td-form__button--active":p&&!d}),onClick:h},i))};var ae=o(64433);const re=({form:e,elementSettings:t,showAddParagraph:o=!0,isButton:i=!1,linkProtocol:a,setLinkProtocol:d,linkTarget:s,isBulletFontColorChecked:m=!1,setIsBulletFontColorChecked:u=()=>{},showTopDivider:p=!0})=>{var g,b,f,v,w,k,B,R,x,T,I,C,N;const{__:P}=(0,_.s9)(),{token:L}=(0,c.rd)(),F=(0,h.hN)(),V=(0,S.XW)(),M=(0,S.K9)(),D=(0,y.rD)(),H=(0,l.useRef)(),W=(0,l.useRef)(null),U=(0,l.useRef)(null),$=(0,l.useRef)(null),G=(0,l.useRef)(!1),[j,X]=(0,l.useState)(!1),[J,Z]=(0,l.useState)(!1),[ee,te]=(0,l.useState)(null),[re,ne]=(0,l.useState)({start:0,end:0}),[de,se]=(0,l.useState)(!1),[me,ce]=(0,l.useState)([]),[ue,pe]=(0,l.useState)("#c6c3c3"),[ge,he]=(0,l.useState)(!1),[be,fe]=(0,l.useState)(!1),ve=(0,l.useRef)(null),_e=(0,l.useRef)(""),Ee=(0,ae.A)(),Se=(0,l.useMemo)(()=>Ee,[]),ye=c.lV.useWatch([],e);(0,l.useEffect)(()=>{i&&void 0!==(null===t||void 0===t?void 0:t.textColor)&&e.setFieldValue("textColor",t.textColor)},[i,null===t||void 0===t?void 0:t.textColor,e]);let we=null;(0,l.useEffect)(()=>{if(null!==ye&&void 0!==ye&&ye.textColor&&m){const o=e.getFieldValue("textColor");V({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:t.type,settings:{ColorBullets:o}})}},[null===ye||void 0===ye?void 0:ye.textColor]),(0,l.useEffect)(()=>{const o=e.getFieldValue("textLink");"string"===typeof t.linkHref&&he(!0),ve&&!o&&(he(!1),e.setFieldsValue({linkHref:null})),ve.current=o||null},[null===ye||void 0===ye?void 0:ye.textLink,null===ye||void 0===ye?void 0:ye.linkHref,t.linkHref,e]),(0,l.useEffect)(()=>{const t=e.getFieldValue("listUL"),o=e.getFieldValue("listOL");t&&"listUL"!==_e.current?(e.setFieldValue("listOL",!1),_e.current="listUL"):o&&"listOL"!==_e.current&&(e.setFieldValue("listUL",!1),_e.current="listOL"),t||o||(_e.current="")},[null===ye||void 0===ye?void 0:ye.listUL,null===ye||void 0===ye?void 0:ye.listOL,e]);(0,z.A)(e=>{e.data.operation===E.Ru.APPLICATION_FOCUS_IN_IFRAME&&te(null)});const[ke,Be]=(0,l.useState)(null);(0,l.useEffect)(()=>{var e,t;null!==(e=window)&&void 0!==e&&null!==(t=e.navigator)&&void 0!==t&&t.userAgent.includes("Macintosh")&&Be(!0)},[]);const Re=(0,l.useRef)(null);const xe=e=>{V({operation:E.Ru.SANDBOX_ELEMENT_TEXT,action:e,locale:"ru_RU"}),F.success({message:P("It`s done!")})},Te=[{key:"1",label:P("This element"),onClick:()=>xe("typograf")},{key:"2",label:P("The whole email"),onClick:()=>xe("typograf_all")}],[Ie,Ae]=(0,l.useState)(),[Ce,Ne]=(0,l.useState)(!1);(0,l.useEffect)(()=>{const e=((e,t="#c6c3c3",o={})=>{const{symbolSize:i="25px",marginRight:a="5px",marginBottom:r="5px",textStyle:n={whiteSpace:"normal",lineHeight:"1.2"}}=o;return e.map(e=>({value:e.code,label:l.createElement("div",{style:{display:"flex",alignItems:"center"}},l.createElement("span",{style:{color:t||"#c6c3c3",marginRight:a,marginBottom:r,fontSize:i,lineHeight:"0.7",width:i,textAlign:"center",...n}},e.symbol),l.createElement("span",{style:n},e.description))}))})(Se,ue,{});ce(e)},[Se,ue]),(0,l.useEffect)(()=>{var e;pe(null===t||void 0===t||null===(e=t.list)||void 0===e?void 0:e.bulletsColor)},[e,t]),(0,l.useEffect)(()=>{const o=t.linkHref||t.href;o&&(0,O.b9)(o,d);const l=t.linkHref||t.href,i=null!==l&&void 0!==l&&l.startsWith("#")?l.slice(1):l||"https://";e.setFieldsValue({linkHref:i})},[e,t,d]);const Pe=(0,n.d4)(q.GH);(0,l.useEffect)(()=>{var e;null!==Pe&&void 0!==Pe&&null!==(e=Pe.items)&&void 0!==e&&e.length&&Ae((0,y.cM)(Pe.items,P,(e,t)=>{Ne(!1),M(E.Ru.SANDBOX_ADD_MERGETAG,e),t.stopPropagation(),t.preventDefault()}))},[Pe,Ae,P,Ne,M]);(0,l.useEffect)(()=>{Ce&&Re.current&&Re.current.focus()},[Ce]);const Le=(0,Q.cR)();(0,l.useEffect)(()=>{const e=new K.jG;return e.addDisposable((0,Y.a)(Le,"focusin",({target:e})=>{e.closest('[id="merge_tags_wrapper"]')||te(e)})),e.addDisposable((0,Y.a)(Le,"click",({target:e})=>{e.closest(".merge-tags")||e.closest("#merge_tags_button")||Ne(!1)})),()=>{e.dispose()}},[Le]),(0,l.useEffect)(()=>{const e=(null===W||void 0===W?void 0:W.current)||document,t=()=>{window.getSelection().toString().length>0&&(G.current=!0)};return e.addEventListener("dblclick",t),()=>{e.removeEventListener("dblclick",t)}},[W]);const Fe=(0,l.useCallback)(({target:e})=>{if(e&&!de){const{selectionStart:t,selectionEnd:o}=e;ne({start:t,end:o})}se(!1)},[de]);(0,l.useEffect)(()=>Fe({target:null===s||void 0===s?void 0:s.target}),[s,Fe]);const Oe=(o,l)=>{const i=document.getElementById(l);if(i){var a,r;const n=null===(a=i.value)||void 0===a?void 0:a.substring(0,re.start),d=null===(r=i.value)||void 0===r?void 0:r.substring(re.end),s=l.substring(l.lastIndexOf("_")+1);V({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:t.type,settings:{[s]:n+o+d}}),e.setFieldValue(s,n+o+d),i.focus(),setTimeout(()=>{i.selectionStart=re.start,i.selectionEnd=re.start+o.length},400),se(!0)}},Ve=()=>{X(!j),j?(e.setFieldValue("textReplacer",""),V({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:t.type,settings:{textReplacer:""}})):setTimeout(()=>W.current.focus())};(0,l.useEffect)(()=>{var e;X(!(null===(e=t.textReplacer)||void 0===e||!e.length))},[t,e]);(0,l.useEffect)(()=>{var e;Z(!(null===(e=t.textAnchor)||void 0===e||!e.length))},[t,e]);return l.createElement(l.Fragment,null,o&&!t.showOnMobile&&l.createElement(l.Fragment,null,l.createElement(c.fI,{gutter:20,style:{paddingBottom:4}},l.createElement(c.fv,{span:12,gutter:20},l.createElement(le.A,{form:e,elementSettings:t,name:"textAlign"})))),D.formTextFieldTypografEnabled&&l.createElement(c.y9,{title:null,dividerTop:p},l.createElement(c.fI,{gutter:10,style:{marginTop:4}},l.createElement(c.fv,{span:12},l.createElement(c.lV.Item,{name:"AddImage",style:{marginBottom:L.formItemMarginBottomXS}},l.createElement(c.$n,{icon:l.createElement(A.Ay,{icon:"AddImage"}),onClick:()=>xe("add_img"),style:{width:"100%"}},P("Add image")))),l.createElement(c.fv,{span:12},l.createElement(c.lV.Item,{name:"Typography",style:{marginBottom:L.formItemMarginBottomXS}},l.createElement(c.ms,{arrow:!0,menu:{items:Te},trigger:["hover"],placement:"bottom",getPopupContainer:e=>e.closest(".selected-element-panel")},l.createElement(c.$n,{icon:l.createElement(A.Ay,{icon:"Typograf"}),onClick:()=>xe("typograf"),style:{width:"100%"}},P("Typography"))))),D.mergeTagsShow&&Ie&&l.createElement(c.fv,{span:24,id:"merge_tags_wrapper",style:{marginBottom:L.formItemMarginBottomXS}},l.createElement(c.$n,{id:"merge_tags_button",icon:l.createElement(A.Ay,{icon:"MergeTags"}),style:{width:"100%",display:Ce?"none":"inline-flex"},onClick:()=>Ne(!0)},P("Merge tags")),l.createElement(c.vx,{ref:Re,popupClassName:"merge-tags",options:Ie,placeholder:P("Start typing the title"),showSearch:{filter:(e,t)=>t.some(t=>t.label.toLowerCase().indexOf(e.toLowerCase())>-1),render:(e,t)=>{const o=t.map((t,o)=>{const i=t.label.split(new RegExp(`(${e})`,"gi"));return l.createElement("span",{key:t.value},0!==o&&l.createElement("span",null,"\xa0/\xa0"),i.map((t,o)=>t.toLowerCase()===e.toLowerCase()?l.createElement("span",{key:o,style:{color:"red"}},t):t))});return l.createElement("div",{title:t.map(e=>e.label).join(" / ")},o)}},spellCheck:"false",getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper"),onChange:(o,l)=>{if(Ne(!1),o){const i=Pe.syntax.length>1?Ie.findIndex(e=>e.key===l[0].key):0,a=Pe.syntax[i].replace("%value%",o[o.length-1]);if("selected_button_form_href"===(null===ee||void 0===ee?void 0:ee.getAttribute("id"))||"selected_text_form_linkHref"===(null===ee||void 0===ee?void 0:ee.getAttribute("id"))||"selected_text_form_textReplacer"===(null===ee||void 0===ee?void 0:ee.getAttribute("id")))Oe(a,null===ee||void 0===ee?void 0:ee.getAttribute("id"));else{e.setFieldValue("textReplacer",a);const o=Date.now();V({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:t.type,settings:{textReplacer:`${a}~~${o}`}})}}},style:{display:Ce?"block":"none",width:"100%"},open:Ce,onKeyDown:e=>{"Escape"===e.key&&Ne(!1)}})))),l.createElement(c.y9,{title:null,dividerTop:p||D.formTextFieldTypografEnabled,bodyStyle:{paddingBottom:4}},l.createElement(c.m_,{trigger:["hover"],title:P("Text font"),placement:"bottom",zIndex:1,getPopupContainer:e=>e.parentNode},l.createElement(c.lV.Item,{name:"fontFamily",className:"form-item-margin-xs"},l.createElement(c.LW,{textEditor:!0,loadGoogleFonts:oe.c,getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper")}))),!t.showOnMobile&&l.createElement(c.fI,{gutter:10},l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:P("Font size"),placement:"bottom"},l.createElement(c.lV.Item,{name:"fontSize",className:"form-item-margin-xs"},l.createElement(c.FQ,{min:8,max:90,placeholder:P("Font size"),prefix:l.createElement(A.Ay,{icon:"FontSizeOutlined"}),addonAfter:"px"})))),l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:P("Line height"),placement:"bottom"},l.createElement(c.lV.Item,{name:"lineHeight",className:"form-item-margin-xs"},l.createElement(c.FQ,{min:10,max:110,placeholder:P("Line height"),prefix:l.createElement(A.Ay,{icon:"LineHeightOutlined"}),addonAfter:"px"}))))),l.createElement(c.fI,{gutter:10,style:{marginBottom:10,marginTop:5}},l.createElement(c.fv,{span:24},l.createElement(c.fI,{gutter:10,style:{marginBottom:-10}},i&&l.createElement(l.Fragment,null,l.createElement(c.fv,{span:12},l.createElement("div",{className:"selected-text-common-form__format-toolbar"},l.createElement(ie,{form:e,elementSettings:t,name:"textStrong",tooltipTitle:P(ke?"Strong ( \u2318B )":"Strong ( Ctrl+B )"),icon:l.createElement(A.Ay,{icon:"BoldOutlined",className:"selected-text-common-form__icon-radius"})}),l.createElement(ie,{form:e,elementSettings:t,name:"textItalic",tooltipTitle:P(ke?"Italic ( \u2318I )":"Italic ( Ctrl+I )"),icon:l.createElement(A.Ay,{icon:"ItalicOutlined",className:"selected-text-common-form__icon-radius"})}),l.createElement(ie,{form:e,elementSettings:t,name:"textUnderline",tooltipTitle:P(ke?"Underline ( \u2318U )":"Underline ( Ctrl+U )"),icon:l.createElement(A.Ay,{icon:"UnderlineOutlined",className:"selected-text-common-form__icon-radius"})}))),l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:P("Text color"),placement:"bottom",zIndex:1,getPopupContainer:e=>e.parentNode},l.createElement(c.lV.Item,{name:"textColor",rules:[{message:P("Please set the font color")}],className:"form-item-margin-xs"},l.createElement(c.it,{placeholder:P("Color"),usedColors:t.usedColors,usedLabel:P("Used"),recommendedLabel:P("Recommended")}))))),!i&&l.createElement(l.Fragment,null,l.createElement(c.fv,{span:3},l.createElement(ie,{form:e,elementSettings:t,name:"textStrong",tooltipTitle:P(ke?"Strong ( \u2318B )":"Strong ( Ctrl+B )"),icon:l.createElement(A.Ay,{icon:"BoldOutlined",className:"selected-text-common-form__icon-radius"})})),l.createElement(c.fv,{span:3},l.createElement(ie,{form:e,elementSettings:t,name:"textItalic",tooltipTitle:P(ke?"Italic ( \u2318I )":"Italic ( Ctrl+I )"),icon:l.createElement(A.Ay,{icon:"ItalicOutlined",className:"selected-text-common-form__icon-radius"})})),l.createElement(c.fv,{span:3},l.createElement(ie,{form:e,elementSettings:t,name:"textUnderline",tooltipTitle:P(ke?"Underline ( \u2318U )":"Underline ( Ctrl+U )"),icon:l.createElement(A.Ay,{icon:"UnderlineOutlined",className:"selected-text-common-form__icon-radius"})})),(null===t||void 0===t||null===(g=t.list)||void 0===g?void 0:g.isList)&&l.createElement(c.fv,{span:3}," ",l.createElement(ie,{form:e,elementSettings:t,name:"textStrikethrough",tooltipTitle:P(ke?"Strikethrough ( \u2318+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:l.createElement(A.Ay,{icon:"StrikethroughOutlined",className:"selected-text-common-form__icon-radius"})})),!(null!==t&&void 0!==t&&null!==(b=t.list)&&void 0!==b&&b.isList)&&l.createElement(c.fv,{span:3},l.createElement(ie,{form:e,elementSettings:t,name:"listUL",tooltipTitle:P("Unordered list"),icon:l.createElement(A.Ay,{icon:"UnorderedListOutlined",className:"selected-td-form__icon-radius"}),onSelect:Fe})),!(null!==t&&void 0!==t&&null!==(f=t.list)&&void 0!==f&&f.isList)&&l.createElement(c.fv,{span:3},l.createElement(ie,{form:e,elementSettings:t,name:"listOL",tooltipTitle:P("Ordered list"),icon:l.createElement(A.Ay,{icon:"OrderedListOutlined",className:"selected-td-form__icon-radius"}),onSelect:Fe})),l.createElement(c.fv,{span:3},l.createElement(ie,{form:e,elementSettings:t,name:"textSuperscript",tooltipTitle:P("Text superscript"),icon:l.createElement(A.Ay,{icon:"Superscript"})})),(null===t||void 0===t||null===(v=t.list)||void 0===v?void 0:v.isList)&&l.createElement(c.fv,{span:3}," ",l.createElement(ie,{form:e,elementSettings:t,name:"textSubscript",tooltipTitle:P("Text subscript"),icon:l.createElement(A.Ay,{icon:"Subscript"})})),o&&l.createElement(c.fv,{span:3},l.createElement(ie,{form:e,className:r()("selected-text-common-form__button selected-text-common-form__button_style",{"selected-text-common-form__button--active":"string"===typeof t.linkHref}),elementSettings:t,name:"textLink",forceInactive:!!t.textAnchor,tooltipTitle:P("Link"),icon:l.createElement(A.Ay,{icon:"LinkOutlined",className:"selected-text-common-form__icon-radius"}),onSelect:Fe})),(null===t||void 0===t||null===(w=t.list)||void 0===w?void 0:w.isList)&&D.formTextFieldReplacerEnabled&&l.createElement(c.fv,{span:3},l.createElement(c.m_,{title:P("Text replacer"),placement:"bottom",getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper")},l.createElement(c.$n,{className:r()("selected-td-form__button ant-form-item",{"selected-td-form__button--active":j}),icon:l.createElement(A.Ay,{icon:"Replacer",className:"selected-td-form__icon-radius"}),onClick:Ve,ref:U}))),(!(null!==t&&void 0!==t&&null!==(k=t.list)&&void 0!==k&&k.isList)||o&&(null===t||void 0===t||null===(B=t.list)||void 0===B?void 0:B.isList))&&l.createElement(c.fv,{span:3},l.createElement(c.m_,{title:P("More options"),placement:"bottom",getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper")},l.createElement(c.$n,{className:r()("selected-td-form__button ant-form-item",{"selected-td-form__button--active":be||J}),icon:l.createElement(A.Ay,{icon:"DotsHoriz",className:"selected-td-form__icon-radius"}),onClick:()=>fe(!be)}))))),!i&&be&&l.createElement(c.fI,{gutter:10},!(null!==t&&void 0!==t&&null!==(R=t.list)&&void 0!==R&&R.isList)&&l.createElement(l.Fragment,null,l.createElement(c.fv,{span:3}," ",l.createElement(ie,{form:e,elementSettings:t,name:"textStrikethrough",tooltipTitle:P(ke?"Strikethrough ( \u2318+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:l.createElement(A.Ay,{icon:"StrikethroughOutlined",className:"selected-text-common-form__icon-radius"})})),l.createElement(c.fv,{span:3}," ",l.createElement(ie,{form:e,elementSettings:t,name:"textSubscript",tooltipTitle:P("Text subscript"),icon:l.createElement(A.Ay,{icon:"Subscript"})})),D.formTextFieldReplacerEnabled&&l.createElement(c.fv,{span:3},l.createElement(c.m_,{title:P("Text replacer"),placement:"bottom",getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper")},l.createElement(c.$n,{className:r()("selected-td-form__button ant-form-item",{"selected-td-form__button--active":j}),icon:l.createElement(A.Ay,{icon:"Replacer",className:"selected-td-form__icon-radius"}),onClick:Ve,ref:U})))),o&&l.createElement(c.fv,{span:3},l.createElement(c.m_,{title:P("Anchor"),placement:"bottom",getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper")},l.createElement(c.$n,{className:r()("selected-td-form__button ant-form-item",{"selected-td-form__button--active":J}),icon:l.createElement(A.Ay,{icon:"Anchor",className:"selected-text-common-form__icon-radius"}),onMouseDown:o=>{o.preventDefault(),Z(!J),J?(e.setFieldValue("textAnchor",""),V({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:t.type,settings:{textAnchor:""}})):setTimeout(()=>{var e;return null===(e=$.current)||void 0===e?void 0:e.focus()})}})))),o&&"string"===typeof t.linkHref&&ge&&l.createElement(l.Fragment,null,l.createElement(c.m_,{trigger:["hover"],title:P("#"===a?"Anchor name":"The URL that the hyperlink directs to."),placement:"bottom"},l.createElement(c.lV.Item,{name:"linkHref",style:{marginBottom:"mailto:"===a?L.formItemMarginBottomXS:""}},l.createElement(c.pd,{ref:H,addonBefore:l.createElement(O.Ai,{linkProtocol:a,handleLinkProtocolsChange:t=>{e.setFieldValue("linkHref","mergetag"!==t?t:""),d(t)},__:P}),allowClear:!0,placeholder:P("#"===a?"Anchor name":"Hyperlink URL"),autoFocus:null===t||void 0===t?void 0:t.isNewLink,onSelect:Fe,prefix:l.createElement(O.RM,{linkProtocol:a})}))),"mailto:"===a&&l.createElement(l.Fragment,null,l.createElement(c.lV.Item,{name:"subject",style:{marginBottom:L.formItemMarginBottomXS}},l.createElement(c.pd,{placeholder:P("Subject"),onSelect:Fe})),l.createElement(c.lV.Item,{name:"body",style:{marginBottom:L.formItemMarginBottomMD}},l.createElement(c.fs,{rows:3,placeholder:P("Body"),onSelect:Fe})))),o&&J&&l.createElement(c.m_,{trigger:["hover"],title:P("Anchor name"),placement:"bottom"},l.createElement(c.lV.Item,{name:"textAnchor"},l.createElement(c.pd,{placeholder:P("Anchor name"),allowClear:!0,prefix:l.createElement("span",{className:"addon-text-content addon-text-content--icon",title:P("Anchor"),"aria-hidden":!0},l.createElement(A.Ay,{icon:"Anchor",className:"selected-text-common-form__icon-radius",size:18})),ref:$,onSelect:Fe,onBlur:()=>{const t=e.getFieldValue("textAnchor");null!==t&&void 0!==t&&t.trim()||Z(!1)}}))),!i&&j&&l.createElement(c.m_,{trigger:["hover"],title:P("Text"),placement:"bottom"},l.createElement(c.lV.Item,{name:"textReplacer"},l.createElement(c.pd,{placeholder:P("The code that will replace this text"),allowClear:!0,prefix:l.createElement("span",{className:"addon-text-content"},P("Text")),onChange:e=>{""!==e.target.value&&U.current.classList.add("selected-td-form__button--active")},onKeyDown:e=>{const o=e.target,l=o.value,i=o.selectionStart,a=function(e){const t=e.key.toLowerCase();let o=!1;return("control"!==we&&"meta"!==we||"a"!==t&&"A"!==t)&&("a"!==we&&"A"!==we||"control"!==t&&"meta"!==t)||(o=!0),we=t,"control"!==t&&"a"!==t&&"A"!==t&&"meta"!==t&&(we=null),o}(e);if(G.current&&0===i&&V({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:t.type,settings:{textReplacer:`${l}~`}}),G.current=a,0!==i||" "!==e.key){if(" "===e.key){if(i!==l.length)return void e.preventDefault();l.endsWith(" ")&&e.preventDefault()}}else e.preventDefault()},ref:W,onSelect:Fe}))))),!i&&l.createElement(c.fI,{gutter:10,style:{paddingBottom:4}},l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:P("Text color"),placement:"bottom",zIndex:1,getPopupContainer:e=>e.parentNode},l.createElement(c.lV.Item,{name:"textColor",rules:[{message:P("Please set the font color")}]},l.createElement(c.it,{placeholder:P("Color"),usedColors:t.usedColors,usedLabel:P("Used"),recommendedLabel:P("Recommended")})))),l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:P("Text background"),placement:"bottom",zIndex:1,getPopupContainer:e=>e.parentNode},l.createElement(c.lV.Item,{name:"textBackgroundColor",rules:[{message:P("Please set the background color")}]},l.createElement(c.it,{placeholder:P("Background color"),usedColors:t.usedColors,usedLabel:P("Used"),recommendedLabel:P("Recommended")})))))),!i&&(null===t||void 0===t||null===(x=t.list)||void 0===x?void 0:x.isList)&&l.createElement(c.y9,{title:P("List settings"),dividerTop:!0},"OL"===(null===t||void 0===t||null===(T=t.list)||void 0===T?void 0:T.listType)&&l.createElement(c.fI,null,l.createElement(c.fv,{span:24},l.createElement(c.m_,{trigger:["hover"],title:P("Bullets font"),placement:"bottom",zIndex:1,getPopupContainer:e=>e.parentNode},l.createElement(c.lV.Item,{name:"BulletsFontFamily",className:"form-item-margin-xs"},l.createElement(c.LW,{textEditor:!0,loadGoogleFonts:oe.c,getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper"),style:{marginTop:"-9px"}}))))),l.createElement(c.fI,{gutter:[10]},"UL"===(null===t||void 0===t||null===(I=t.list)||void 0===I?void 0:I.listType)&&l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:P("Bullets type"),placement:"bottom"},l.createElement(c.lV.Item,{name:"BulletType",className:"bullet-type"},l.createElement(c.Select,{size:"middle",placeholder:P("Bullets type"),onClick:e=>e.stopPropagation(),options:me}))))),l.createElement(c.fI,{gutter:[10]},l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:P("Bullets color"),placement:"bottom",zIndex:1,getPopupContainer:e=>e.parentNode},l.createElement(c.lV.Item,{name:"ColorBullets"},l.createElement(c.it,{placeholder:P("Bullets color"),usedColors:t.usedColors,usedLabel:P("Used"),recommendedLabel:P("Recommended"),disabled:m,onChange:e=>{pe(e),m&&u(!1)},externalValue:m?null===ye||void 0===ye?void 0:ye.textColor:void 0})))),l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:P("Bullets size"),placement:"bottom"},l.createElement(c.lV.Item,{name:"BulletsSize"},l.createElement(c.FQ,{min:8,max:90,defaultValue:null===t||void 0===t||null===(C=t.list)||void 0===C?void 0:C.bulletFontSize,placeholder:P("Bullets size"),prefix:l.createElement(A.Ay,{icon:"FontSizeOutlined"}),addonAfter:"px"}))))),"OL"===(null===t||void 0===t||null===(N=t.list)||void 0===N?void 0:N.listType)&&l.createElement(c.fI,null,l.createElement(c.fv,{span:3},l.createElement(ie,{form:e,elementSettings:t,name:"BulletTextStrong",tooltipTitle:P(ke?"Strong ( \u2318B )":"Strong ( Ctrl+B )"),icon:l.createElement(A.Ay,{icon:"BoldOutlined",className:"selected-text-common-form__icon-radius"})})),l.createElement(c.fv,{span:3},l.createElement(ie,{form:e,elementSettings:t,name:"BulletTextItalic",tooltipTitle:P(ke?"Italic ( \u2318I )":"Italic ( Ctrl+I )"),icon:l.createElement(A.Ay,{icon:"ItalicOutlined",className:"selected-text-common-form__icon-radius"})})),l.createElement(c.fv,{span:3},l.createElement(ie,{form:e,elementSettings:t,name:"BulletTextStrikethrough",tooltipTitle:P(ke?"Strikethrough ( \u2318+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:l.createElement(A.Ay,{icon:"StrikethroughOutlined",className:"selected-text-common-form__icon-radius"})})),l.createElement(c.fv,{span:3},l.createElement(ie,{form:e,elementSettings:t,name:"BulletTextUnderline",tooltipTitle:P(ke?"Underline ( \u2318U )":"Underline ( Ctrl+U )"),icon:l.createElement(A.Ay,{icon:"UnderlineOutlined",className:"selected-text-common-form__icon-radius"})}))),l.createElement(c.fI,{gutter:[10],style:{marginTop:"-8px"}},l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:P("Between list items"),placement:"bottom"},l.createElement(c.lV.Item,{name:"SpacingBetweenParagraphs"},l.createElement(c.FQ,{min:5,max:100,placeholder:P("Between list items"),prefix:l.createElement(A.Ay,{icon:"ColumnHeightOutlined"}),addonAfter:"px"})))),l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:P("Between bullets and text"),placement:"bottom"},l.createElement(c.lV.Item,{name:"SpacingBetweenBulletsAndText"},l.createElement(c.FQ,{min:1,max:100,placeholder:P("Between bullets and text"),prefix:l.createElement(A.Ay,{icon:"ColumnWidthOutlined"}),addonAfter:"px"})))))))},ne=({form:e,elementSettings:t,showAddParagraph:o=!0,isButton:i=!1})=>{const{__:a}=(0,_.s9)(),r=(0,S.XW)(),u=(0,n.wA)(),{emailId:p}=(0,m.g)(),g=(0,n.d4)(p?d.Hs:s.gm).hasOwnProperty("type")?E.IE:E.Tm,h=(0,y.rD)(),[b,f]=(0,l.useState)(null);(0,l.useEffect)(()=>{var e,t;null!==(e=window)&&void 0!==e&&null!==(t=e.navigator)&&void 0!==t&&t.userAgent.includes("Macintosh")&&f(!0)},[]);const v=e=>{r({operation:E.Ru.SANDBOX_ELEMENT_TEXT,action:e,locale:"ru_RU"})},[w,k]=(0,l.useState)(t.textAlign),[B,R]=(0,l.useState)(t.linkHref),x=e=>k(e);return(0,l.useEffect)(()=>{k(t.textAlign),R(t.linkHref)},[t]),l.createElement("div",{className:"selected_text_common_form_mobile"},l.createElement(c.$x,{size:"8",split:l.createElement(c.cG,{type:"vertical"})},l.createElement(c.$x,{size:8,className:"selected_text_common_form_mobile__group"},l.createElement("div",{style:{width:190}},l.createElement(c.m_,{trigger:["hover"],title:a("Text font"),placement:"bottom",zIndex:1,getPopupContainer:e=>e.parentNode},l.createElement(c.lV.Item,{name:"fontFamily"},l.createElement(c.LW,{textEditor:!0,loadGoogleFonts:oe.c,getPopupContainer:e=>e.closest(".selected_text_common_form_mobile")})))),l.createElement("div",{style:{width:90}},l.createElement(c.m_,{trigger:["hover"],title:a("Font size"),placement:"bottom"},l.createElement(c.lV.Item,{name:"fontSize"},l.createElement(c.FQ,{min:8,max:90,placeholder:a("Font size"),prefix:l.createElement(A.Ay,{icon:"FontSizeOutlined"}),addonAfter:"px"})))),l.createElement("div",{style:{width:90}},l.createElement(c.m_,{trigger:["hover"],title:a("Line height"),placement:"bottom"},l.createElement(c.lV.Item,{name:"lineHeight"},l.createElement(c.FQ,{min:10,max:110,placeholder:a("Line height"),prefix:l.createElement(A.Ay,{icon:"LineHeightOutlined"}),addonAfter:"px"}))))),l.createElement(c.$x,{size:8,className:"selected_text_common_form_mobile__group"},l.createElement(ie,{form:e,elementSettings:t,name:"textStrong",tooltipTitle:a(b?"Strong ( \u2318B )":"Strong ( Ctrl+B )"),icon:l.createElement(A.Ay,{icon:"BoldOutlined",className:"selected-td-form__icon-radius"})}),l.createElement(ie,{form:e,elementSettings:t,name:"textItalic",tooltipTitle:a(b?"Italic ( \u2318I )":"Italic ( Ctrl+I )"),icon:l.createElement(A.Ay,{icon:"ItalicOutlined",className:"selected-td-form__icon-radius"})}),l.createElement(ie,{form:e,elementSettings:t,name:"textStrikethrough",tooltipTitle:a(b?"Strikethrough ( \u2318+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:l.createElement(A.Ay,{icon:"StrikethroughOutlined",className:"selected-td-form__icon-radius"})}),l.createElement(ie,{form:e,elementSettings:t,name:"textUnderline",tooltipTitle:a(b?"Underline ( \u2318U )":"Underline ( Ctrl+U )"),icon:l.createElement(A.Ay,{icon:"UnderlineOutlined",className:"selected-td-form__icon-radius"})})),l.createElement(c.$x,{size:8,className:"selected_text_common_form_mobile__group"},l.createElement(c.m_,{trigger:["hover"],title:a("Text color"),placement:"bottom",zIndex:1,getPopupContainer:e=>e.parentNode},l.createElement(c.lV.Item,{name:"textColor",rules:[{message:a("Please set the font color")}]},l.createElement(c.it,{placeholder:a("Color"),usedColors:t.usedColors,usedLabel:a("Used"),recommendedLabel:a("Recommended"),getPopupContainer:e=>e.closest(".selected_text_common_form_mobile")}))),!i&&l.createElement(l.Fragment,null,l.createElement(c.m_,{trigger:["hover"],title:a("Text background"),placement:"bottom",zIndex:1,getPopupContainer:e=>e.parentNode},l.createElement(c.lV.Item,{name:"textBackgroundColor",rules:[{message:a("Please set the background color")}]},l.createElement(c.it,{placeholder:a("Background color"),usedColors:t.usedColors,usedLabel:a("Used"),recommendedLabel:a("Recommended")}))))),o&&l.createElement(c.$x,{size:8,className:"selected_text_common_form_mobile__group"},l.createElement(l.Fragment,null,"string"===typeof B?l.createElement(c.ms,{arrow:!0,dropdownRender:()=>l.createElement(c.m_,{trigger:["hover"],title:a("The URL that the hyperlink directs to."),placement:"bottom"},l.createElement(c.lV.Item,{name:"linkHref"},l.createElement(c.pd,{allowClear:!0,placeholder:a("Hyperlink URL"),prefix:l.createElement(A.Ay,{icon:"LinkOutlined"}),autoFocus:null===t||void 0===t?void 0:t.isNewLink}))),overlayClassName:"codemode-textalign-dropdown",overlayStyle:{left:520,top:52,transform:"translateX(0)",marginLeft:57},trigger:["hover"],placement:"bottom",getPopupContainer:e=>e.closest(".selected_text_common_form_mobile")},l.createElement("div",null,l.createElement(ie,{form:e,className:"selected-td-form__button selected-td-form__button_style selected-td-form__button--active",elementSettings:t,name:"textLink",icon:l.createElement(A.Ay,{icon:"LinkOutlined",className:"selected-td-form__icon-radius"}),showTooltip:!1}))):l.createElement(ie,{form:e,className:"selected-td-form__button selected-td-form__button_style",elementSettings:t,name:"textLink",tooltipTitle:a("Link"),icon:l.createElement(A.Ay,{icon:"LinkOutlined",className:"selected-td-form__icon-radius"})}),l.createElement(c.ms,{arrow:!0,dropdownRender:()=>l.createElement(le.A,{form:e,elementSettings:t,name:"textAlign",setAlignStateHandle:x}),overlayClassName:"codemode-textalign-dropdown",overlayStyle:{left:615,top:52,transform:"translateX(0)",marginLeft:57},trigger:["hover"],placement:"bottom",getPopupContainer:e=>e.closest(".selected_text_common_form_mobile")},l.createElement(c.$n,{icon:"right"===w?l.createElement(A.Ay,{icon:"AlignRightOutlined",size:18,strokeWidth:h.iconStrokeWidth}):"center"===w?l.createElement(A.Ay,{icon:"AlignCenterOutlined",size:18,strokeWidth:h.iconStrokeWidth}):l.createElement(A.Ay,{icon:"AlignLeftOutlined",size:18,strokeWidth:h.iconStrokeWidth}),className:"selected-td-form__button"})))),l.createElement(c.$x,{size:8,className:"selected_text_common_form_mobile__group"},o&&l.createElement(c.m_,{trigger:["hover"],title:a("Add paragraph"),placement:"bottom"},l.createElement(c.$n,{icon:l.createElement(A.Ay,{icon:"Paragraph"}),onClick:()=>v("add_p"),className:"selected-td-form__button"})),l.createElement(c.m_,{trigger:["hover"],title:a("Add inline image"),placement:"bottom"},l.createElement(c.$n,{icon:l.createElement(A.Ay,{icon:"ImageAdd",size:16,strokeWidth:h.iconStrokeWidth}),onClick:()=>v("add_img"),className:"selected-td-form__button"})),l.createElement(c.$n,{icon:l.createElement(A.Ay,{icon:"Typograf"}),className:"selected-td-form__button"}),l.createElement(c.$n,{icon:l.createElement(A.Ay,{icon:"CloseOutlined"}),type:"icon",style:{marginLeft:26},onClick:()=>{r({operation:E.Ru.SANDBOX_ELEMENT_ACTIVE_RESET}),u((0,G.Fk)()),setTimeout(()=>{g===E.IE?u((0,s.A9)({type:null})):u((0,d.A9)({type:null}))},300)}}))))},de=({form:e,elementSettings:t,imgParent:o=!1,name:i="mobileAlign"})=>{var a;const{__:r}=(0,_.s9)(),[n,d]=(0,l.useState)(null===(a=t[i])||void 0===a?void 0:a.value),s=(0,S.XW)(),m=(0,y.rD)(),u=o=>{const l=o.target.value,a={[i]:{classNamePrefix:"em-mob-text_align-",value:""}};l!==n?d(l):(d(""),e.setFieldsValue(a),s({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:t.type,settings:a}))};return l.createElement(c.lV.Item,{name:i},l.createElement(c.sx.Group,{disabled:o&&!t.parent},l.createElement(c.$x,{size:8},l.createElement(c.m_,{placement:"bottom",title:r("Text align left")},l.createElement(c.sx.Button,{value:"left",onClick:u},l.createElement(A.Ay,{icon:"AlignLeftOutlined",size:18,strokeWidth:m.iconStrokeWidth}))),l.createElement(c.m_,{placement:"bottom",title:r("Text align center")},l.createElement(c.sx.Button,{value:"center",onClick:u},l.createElement(A.Ay,{icon:"AlignCenterOutlined",size:18,strokeWidth:m.iconStrokeWidth}))),l.createElement(c.m_,{placement:"bottom",title:r("Text align right")},l.createElement(c.sx.Button,{value:"right",onClick:u},l.createElement(A.Ay,{icon:"AlignRightOutlined",size:18,strokeWidth:m.iconStrokeWidth}))),l.createElement(c.m_,{placement:"bottom",title:r("Text align justify")},l.createElement(c.sx.Button,{value:"justify",onClick:u},l.createElement(A.Ay,{icon:"Justify",size:18,strokeWidth:m.iconStrokeWidth}))))))},se=({elementSettings:e})=>{const{__:t}=(0,_.s9)(),o=(0,n.wA)(),i=(0,S.XW)(),[a]=c.lV.useForm(),r=(0,n.d4)(d.Hs),m=(0,n.d4)(G.Ct),u=(0,n.d4)(G.CS),p=(0,n.d4)(G.Fv),g=(0,n.d4)(G.yy),h=p&&"bottom"!==g,[b,f]=(0,l.useState)("https://"),[v,y]=(0,l.useState)(!1),w=(0,ae.A)(),k=(0,l.useMemo)(()=>w,[]),B=r.hasOwnProperty("type")?E.IE:E.Tm,R=(0,l.useCallback)(e=>{o(B===E.Tm?(0,d.A9)(e):(0,s.A9)(e))},[o,B]);(0,l.useEffect)(()=>{if(e){var t,o,l,i,r,n,d,s,m,c,u,p,g,h,b,_,E,S;const{subject:y,body:w,baseEmail:B}=(0,O.kl)(e.linkHref),R=e.linkHref,x="string"===typeof R&&R.startsWith("#"),T="string"===typeof R&&R.startsWith("mailto:")?B:x?R.slice(1):"string"===typeof R?R:"https://";f((0,O.TW)(R||"","https://")),a.setFieldsValue({...e,linkHref:T,subject:y,body:w,mobileFontSize:(0,O.ok)((null===(t=e.mobileFontSize)||void 0===t?void 0:t.value)||e.fontSize),mobileFontSizeDim:(null===(o=e.mobileFontSize)||void 0===o?void 0:o.dim)||e.fontSizeDim,mobileLineHeight:(0,O.ok)((null===(l=e.mobileLineHeight)||void 0===l?void 0:l.value)||e.lineHeight),mobileLineHeightDim:(null===(i=e.mobileLineHeight)||void 0===i?void 0:i.dim)||e.lineHeightDim,mobileTextAlign:(0,O.ok)((null===(r=e.mobileTextAlign)||void 0===r?void 0:r.value)||e.textAlign),SpacingBetweenBulletsAndText:null===e||void 0===e||null===(n=e.list)||void 0===n?void 0:n.betweenRowCell,SpacingBetweenParagraphs:null===e||void 0===e||null===(d=e.list)||void 0===d?void 0:d.betweenParagraphs,BulletsSize:null===e||void 0===e||null===(s=e.list)||void 0===s?void 0:s.bulletFontSize,ColorBullets:null===e||void 0===e||null===(m=e.list)||void 0===m?void 0:m.bulletsColor,BulletTextStrong:null===e||void 0===e||null===(c=e.list)||void 0===c?void 0:c.bulletFontBold,BulletTextItalic:null===e||void 0===e||null===(u=e.list)||void 0===u?void 0:u.bulletFontItalic,CheckboxColor:v,BulletsFontFamily:null===e||void 0===e||null===(p=e.list)||void 0===p?void 0:p.bulletFontFamily,BulletTextUnderline:null===e||void 0===e||null===(g=e.list)||void 0===g?void 0:g.bulletFontUnderline,BulletTextStrikethrough:null===e||void 0===e||null===(h=e.list)||void 0===h?void 0:h.bulletFontStrikethrough,BulletType:null!==(b=null===(_=k.find(t=>{var o;return t.symbol===(null===e||void 0===e||null===(o=e.list)||void 0===o?void 0:o.bulletType)}))||void 0===_?void 0:_.code)&&void 0!==b?b:k[0].code,textSuperscript:null===e||void 0===e?void 0:e.textSuperscript,textSubscript:null===e||void 0===e?void 0:e.textSubscript,listOL:null===e||void 0===e||null===(E=e.standardList)||void 0===E?void 0:E.listTypeOL,listUL:null===e||void 0===e||null===(S=e.standardList)||void 0===S?void 0:S.listTypeUL})}},[a,e]);return l.createElement(c.lV,{form:a,layout:"vertical",name:"selected_text_form",autoComplete:"off",onValuesChange:t=>{var o,l;const r=a.getFieldsValue(!0),n=Object.keys(t)[0];let d;switch(n){case"mobileFontSize":d={[n]:{classNamePrefix:"em-mob-font_size-",value:t[n],dim:r.mobileFontSizeDim}};break;case"mobileLineHeight":d={[n]:{classNamePrefix:"em-mob-line_height-",value:t[n],dim:r.mobileLineHeightDim}};break;case"mobileTextAlign":d={[n]:{classNamePrefix:"em-mob-text_align-",value:t[n]}};break;case"linkHref":let e=t[n];if("string"===typeof e&&"https://http"===e.substring(0,12)&&(e=e.substring(8,e.length),a.setFieldValue("linkHref",e)),"#"===b&&e&&!e.startsWith("#")&&(e="#"+e),e.startsWith("mailto:")){const t=a.getFieldValue("subject"),o=a.getFieldValue("body");d={[n]:(0,O.N_)(e,t,o)}}else d={[n]:e};(0,O.b9)(e,f);break;case"subject":case"body":const o=a.getFieldValue("linkHref")||"";if("mailto:"!==o.substring(0,7))return;{const e=o.split("?")[0],l="subject"===n?t[n]:a.getFieldValue("subject"),i="body"===n?t[n]:a.getFieldValue("body"),r=[];l&&r.push(`subject=${encodeURIComponent(l)}`),i&&r.push(`body=${encodeURIComponent(i)}`);d={linkHref:r.length>0?`${e}?${r.join("&")}`:e}}break;default:d=t}i({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:d}),R({...e,list:{...e.list,bulletsColor:a.getFieldValue("ColorBullets"),bulletFontFamily:a.getFieldValue("BulletsFontFamily"),bulletFontSize:a.getFieldValue("BulletsSize"),betweenParagraphs:a.getFieldValue("SpacingBetweenParagraphs"),betweenRowCell:a.getFieldValue("SpacingBetweenBulletsAndText"),bulletType:null!==(o=null===(l=k.find(e=>e.code===a.getFieldValue("BulletType")))||void 0===l?void 0:l.symbol)&&void 0!==o?o:k[0].symbol},...d,activateSection:null,changeKey:n})},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}},!h&&l.createElement(c.m_,{title:t("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"},l.createElement(c.Fc,{className:"selected_form-mobile-props-title",message:t("Appearance on mobile devices"),type:"info"})),!(m===E.ND&&!h&&u.styles)&&l.createElement("div",{id:"selected_element_form_desktop_props",style:{paddingRight:0}},h?l.createElement(ne,{form:a,elementSettings:e}):l.createElement(re,{form:a,elementSettings:e,linkProtocol:b,setLinkProtocol:f,isBulletFontColorChecked:v,setIsBulletFontColorChecked:y})),!h&&l.createElement("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:m===E.ND&&u.styles?"block":"none"}},l.createElement(c.fI,{gutter:20},l.createElement(c.fv,{span:12},l.createElement(de,{form:a,elementSettings:e,name:"mobileTextAlign"}))),!!e.showOnMobile&&l.createElement(re,{form:a,elementSettings:e,linkProtocol:b,setLinkProtocol:f}),l.createElement(c.fI,{gutter:10,style:{marginBottom:4}},l.createElement(c.fv,{span:12},l.createElement(te,null)),l.createElement(c.fv,{span:12},l.createElement(c.lV.Item,{name:"mobileLineHeight"},l.createElement(c.FQ,{min:0,placeholder:t("Line height"),prefix:l.createElement(A.Ay,{icon:"LineHeightOutlined"}),addonAfter:"px"}))))))},me=(e,t)=>{const{__:o}=(0,_.s9)();return l.createElement(c.m_,{title:o("During export, the element is converted into an image."),key:"exportAsPicture"},l.createElement(c.lV.Item,{name:"exportAsPicture",valuePropName:"checked",className:"form-item-margin-xs",style:{marginBottom:10}},l.createElement(c.dO,{id:"convert-in-image",label:o("Convert into an image"),size:"small",labelStyle:{position:"relative",top:2}})))},ce=({form:e,elementSettings:t,boxShadow:o,bordersShow:i,borderRadiusShow:a,boxShadowShow:r,backgroundShow:n,backgroundImageEmpty:d,backgroundRepeatOptions:s,backgroundSizeOptions:m,sizeShow:u,modificationShow:p,oneBorderRadiusValue:g,setOneBorderRadiusValue:h,toggleShowBorderHandler:E,toggleShowBorderRadiusHandler:S,toggleShowBoxShadowHandler:w,toggleShowSizeHandler:B,toggleShowBackgroundHandler:R,toggleShowModificationHandler:x})=>{const{__:T}=(0,_.s9)(),A=(0,y.rD)();return l.createElement(l.Fragment,null,l.createElement("div",{style:{paddingBottom:4}},l.createElement(k,{form:e,elementSettings:t,tooltipTitle:T("The align attribute sets the horizontal alignment of the table.")})),l.createElement(c.y9,{title:T("Size"),collapsible:!0,open:u,onToggle:B,dividerTop:!0},l.createElement(c.n6,{showHeight:!1,showMinMax:!0,dimensionSelect:O.z$,minWidthDimensionSelect:O.z$,maxWidthDimensionSelect:O.z$,rowStyle:{marginBottom:4},labels:{width:T("Width"),height:T("Height"),minWidth:T("Minimum width"),maxWidth:T("Maximum width")}})),l.createElement(c.y9,{title:T("Background"),collapsible:!0,open:n,onToggle:R,dividerTop:!0},l.createElement(c.Qm,{imageEnabled:A.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:d,usedColors:t.usedColors,colorPlaceholder:T("Background color"),usedLabel:T("Used"),recommendedLabel:T("Recommended"),horizontalPositionPlaceholder:T("Horizontal position"),horizontalPositionTooltip:T("Horizontal position"),verticalPositionPlaceholder:T("Vertical position"),verticalPositionTooltip:T("Vertical position"),backgroundRepeatTooltip:T("Background image repeat"),backgroundSizeTooltip:T("Background image size"),selectPlaceholder:T("Please choose"),backgroundRepeatOptions:s,backgroundSizeOptions:m,imageUploadSlot:A.formTableFieldBackgroundImageEnabled?l.createElement(b.A,{form:e,label:T("Background image"),name:"backgroundImage",tooltipTitle:T("Background image"),placeholder:T("Background image link/route")}):void 0})),A.formFieldBorderEnabled&&l.createElement(c.y9,{title:T("Borders"),collapsible:!0,open:i,onToggle:E,dividerTop:!0},l.createElement(f.A,{form:e,elementSettings:t})),A.formFieldBorderRadiusEnabled&&l.createElement(c.y9,{title:T("Border radius"),collapsible:!0,open:a,onToggle:S,dividerTop:!0},l.createElement(v.A,{form:e,oneBorderRadiusValue:g,setOneBorderRadiusValue:h,elementSettings:t})),A.formFieldBoxShadowEnabled&&l.createElement(c.y9,{title:T("Box shadow"),collapsible:!0,open:r,onToggle:w,dividerTop:!0},l.createElement(I,null)),A.formFieldExportAsPictureEnabled&&l.createElement(c.y9,{title:T("Export settings"),collapsible:!0,open:p,onToggle:x,dividerTop:!0},l.createElement(me,{form:e,elementSettings:t})),A.formFieldVisibilityEnabled&&l.createElement(c.y9,{title:T("Display control"),dividerTop:!0},l.createElement(C,{elementSettings:t,form:e})),A.formFieldAmpVisibilityEnabled&&t.ampShow&&l.createElement(c.y9,{title:T("AMP visibility"),dividerTop:!0},l.createElement(F,null)))},ue=({form:e,elementSettings:t,label:o})=>{var i;const{__:a}=(0,_.s9)(),[r,n]=((0,l.useRef)(),(0,l.useState)("none"===(null===(i=t.mobileBackgroundColor)||void 0===i?void 0:i.value))),{token:d}=(0,c.rd)(),s=(0,S.XW)();return l.createElement(l.Fragment,null,l.createElement(c.m_,{trigger:["hover"],title:a("Background color"),placement:"left"},l.createElement(c.lV.Item,{name:"mobileBackgroundColor",style:{marginBottom:d.formItemMarginBottomXS/2}},l.createElement(c.it,{onChange:e=>{n(!1)},placeholder:o,usedColors:t.usedColors,usedLabel:a("Used"),recommendedLabel:a("Recommended")})),l.createElement(c.dO,{id:"without-background-color",label:a("Without background color"),labelSize:"small",size:"small",checked:r,onChange:o=>{e.setFieldsValue({mobileBackgroundColor:""}),n(e=>!e),s({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:t.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:r?"":"none"}}})}})))};var pe=o(91113);const ge=({form:e,placeholder:t,name:o,tooltipTitle:i,disabled:a,elementSettings:r})=>{var n;const{__:d}=(0,_.s9)(),s=(0,S.XW)(),m=c.lV.useWatch(o,e),[u,p]=(0,l.useState)("success"),g=(0,l.useRef)(),[h,b]=(0,l.useState)(!(!r.mobileBackgroundImage||"none"!==r.mobileBackgroundImage[0].value));(0,l.useEffect)(()=>{var e;m?("string"!==typeof m||!m.startsWith("data:")&&!m.startsWith("blob:"))&&"string"===typeof(e=m)&&/^https?:\/\//i.test(e.trim())?p("validating"):p("success"):p("")},[m]);const f=t=>{e.setFieldsValue({mobileBackgroundImage:""}),b(e=>!e),s({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:r.type,settings:{mobileBackgroundImage:[{classNamePrefix:"em-mob-background_image-",value:h?"":"none",type:"url"}]}})};return l.createElement(l.Fragment,null,l.createElement("div",{style:{float:"right"}},l.createElement(c.$n,{ref:g,size:"small",type:r.mobileBackgroundImage&&"none"===r.mobileBackgroundImage[0].value?"primary":"default",ghost:!(!r.mobileBackgroundImage||"none"!==r.mobileBackgroundImage[0].value),onClick:f},d("Without background image"))),l.createElement(c.m_,{trigger:["hover"],title:i,placement:"left"},l.createElement(c.lV.Item,{name:o,validateStatus:u,style:{marginBottom:-7}},l.createElement(pe.A,{validateStatus:u,placeholder:t,name:o,disabled:a,elementSettings:r,imageInfo:r.type===E.bV.CAROUSEL?null===(n=r.carouselImages)||void 0===n?void 0:n[o.split("_")[1]]:r,onRemotePreviewValidate:p})),l.createElement("div",{style:{marginTop:-3}},l.createElement(c.dO,{id:"without-background-image",label:d("Without background image"),labelSize:"small",size:"small",checked:h,onChange:f}))))};ge.defaulProps={disabled:!1};const he=({form:e,elementSettings:t,mobileBoxShadow:o,mobileBordersShow:i,mobileBorderRadiusShow:a,mobileBoxShadowShow:r,mobileSizeShow:n,mobileBackgroundShow:d,oneMobileBorderRadiusValue:s,setOneMobileBorderRadiusValue:m,backgroundRepeatOptions:u,toggleShowMobileBorderHandler:p,toggleShowMobileBorderRadiusHandler:g,toggleShowMobileBoxShadowHandler:h,toggleShowMobileSizeHandler:b,toggleShowMobileBackgroundHandler:E})=>{const{__:S}=(0,_.s9)(),{token:w}=(0,c.rd)(),B=(0,y.rD)();return l.createElement(l.Fragment,null,l.createElement("div",{style:{paddingBottom:4}},l.createElement(k,{form:e,elementSettings:t,typeOfForm:"mobile"})),l.createElement(c.y9,{title:S("Size"),collapsible:!0,open:n,onToggle:b,dividerTop:!0},l.createElement(c.fI,{gutter:10},l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:S("Table width"),placement:"left"},l.createElement("div",{style:{marginBottom:w.formItemMarginBottomMD+4}},l.createElement(M,{form:e,name:"mobileWidth",elementSettings:t})))))),l.createElement(c.y9,{title:S("Background"),collapsible:!0,open:d,onToggle:E,dividerTop:!0},l.createElement(ue,{form:e,elementSettings:t})),!1,B.formFieldBorderEnabled&&l.createElement(c.y9,{title:S("Borders"),collapsible:!0,open:i,onToggle:p,dividerTop:!0},l.createElement(f.A,{form:e,typeOfForm:"mobile"})),B.formFieldBorderRadiusEnabled&&l.createElement(c.y9,{title:S("Border radius"),collapsible:!0,open:a,onToggle:g,dividerTop:!0},l.createElement(v.A,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:s,setOneBorderRadiusValue:m,elementSettings:t})),B.formFieldBoxShadowEnabled&&l.createElement(c.y9,{title:S("Box shadow"),collapsible:!0,open:r,onToggle:h,dividerTop:!0},l.createElement(I,{typeOfForm:"mobile",form:e,elementSettings:t})),B.formFieldVisibilityEnabled&&l.createElement(c.y9,{title:S("Display control"),dividerTop:!0},l.createElement(C,{elementSettings:t,form:e})),B.formFieldAmpVisibilityEnabled&&t.ampShow&&l.createElement(c.y9,{title:S("AMP visibility"),dividerTop:!0},l.createElement(F,null)))},be=({elementSettings:e})=>{const{__:t}=(0,_.s9)(),o=(0,S.XW)(),[i]=c.lV.useForm(),a=(0,n.wA)(),r=(0,n.d4)(d.Hs).hasOwnProperty("type")?E.IE:E.Tm,[m,u]=(0,l.useState)({}),[p,g]=(0,l.useState)(!0),[h,b]=(0,l.useState)({}),[f,v]=(0,l.useState)(!0),w=(0,n.d4)(G.Ct),k=(0,n.d4)(G.CS),[B,R]=((0,y.rD)(),(0,l.useState)(""===e.backgroundImage[0].value)),x=(0,n.d4)(G.Fv),T=(0,n.d4)(G.yy),I=x&&"bottom"!==T,[A,C]=(0,l.useState)(!1),[N,P]=(0,l.useState)(!1),[L,F]=(0,l.useState)(!1),[V,M]=(0,l.useState)(!1),[D,H]=(0,l.useState)(!1),[z,W]=(0,l.useState)(!1),[U,$]=(0,l.useState)(!1),[j,q]=(0,l.useState)(!1),[Y,K]=(0,l.useState)(!1),[Q,J]=(0,l.useState)(!1),[Z,ee]=(0,l.useState)(!1),te=[{label:t("Not defined"),value:"none"},{label:t("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:t("Repeat background (repeat)"),value:"repeat"},{label:t("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:t("Repeat background vertically (repeat-y)"),value:"repeat-y"}],oe=[{label:t("Not defined"),value:""},{label:t("Contain"),value:"contain"},{label:t("Cover"),value:"cover"}],le=e=>e&&(null!==e&&void 0!==e&&e.width||null!==e&&void 0!==e&&e.style||null!==e&&void 0!==e&&e.color)?e:"",ie=e.border,ae=e.mobileBorder,re=Object.keys(ie).find(e=>{var t,o,l;return(null===(t=ie[e])||void 0===t?void 0:t.width)||(null===(o=ie[e])||void 0===o?void 0:o.style)||(null===(l=ie[e])||void 0===l?void 0:l.color)}),ne=Object.keys(ae).find(e=>{var t,o,l;return(null===(t=ae[e])||void 0===t?void 0:t.width)||(null===(o=ae[e])||void 0===o?void 0:o.style)||(null===(l=ae[e])||void 0===l?void 0:l.color)});(0,l.useEffect)(()=>{if(e){var t,o,l,a,r,n,d,s,m,c,p,h,f,_,E,S,y,w,k,B,x,T,I,A,N,L,V,D,z,U;const G=e.boxShadow,j=e.mobileBoxShadow;u(G),b(j),i.setFieldsValue({...e,width:null===(t=e.width)||void 0===t?void 0:t.value,widthDim:null===(o=e.width)||void 0===o?void 0:o.dim,maxWidth:null===(l=e.maxWidth)||void 0===l?void 0:l.value,maxWidthDim:null===(a=e.maxWidth)||void 0===a?void 0:a.dim,minWidth:null===(r=e.minWidth)||void 0===r?void 0:r.value,minWidthDim:null===(n=e.minWidth)||void 0===n?void 0:n.dim,backgroundImage:e.backgroundImage[0].value,show:e.show?e.show:"all",borderAll:(0,O.ok)(e.border.all),borderTop:(0,O.ok)(e.border.top),borderBottom:(0,O.ok)(e.border.bottom),borderRight:(0,O.ok)(e.border.right),borderLeft:(0,O.ok)(e.border.left),borderRadiusAll:(0,O.ok)(e.borderRadius.all),borderRadiusTopLeft:(0,O.ok)(e.borderRadius.topLeft),borderRadiusBottomLeft:(0,O.ok)(e.borderRadius.bottomLeft),borderRadiusTopRight:(0,O.ok)(e.borderRadius.topRight),borderRadiusBottomRight:(0,O.ok)(e.borderRadius.bottomRight),boxShadowInset:(0,O.ok)(null===(d=e.boxShadow)||void 0===d?void 0:d.inset)||!1,boxShadowHOffset:(0,O.ok)(null===(s=e.boxShadow)||void 0===s?void 0:s.hOffset),boxShadowVOffset:(0,O.ok)(null===(m=e.boxShadow)||void 0===m?void 0:m.vOffset),boxShadowBlurRadius:(0,O.ok)(null===(c=e.boxShadow)||void 0===c?void 0:c.blurRadius),boxShadowSpreadRadius:(0,O.ok)(null===(p=e.boxShadow)||void 0===p?void 0:p.spreadRadius),boxShadowColor:(0,O.ok)(null===(h=e.boxShadow)||void 0===h?void 0:h.color),mobileWidth:(0,O.xc)(null===(f=e.mobileWidth)||void 0===f?void 0:f.value),mobileWidthDim:null===(_=e.mobileWidth)||void 0===_?void 0:_.dim,mobileAlign:null===(E=e.mobileAlign)||void 0===E?void 0:E.value,mobileBorderAll:le(e.mobileBorder.all)||!(le(e.mobileBorder.top)||le(e.mobileBorder.bottom)||le(e.mobileBorder.right)||le(e.mobileBorder.left))&&le(e.border.all),mobileBorderTop:le(e.mobileBorder.top)||!le(e.mobileBorder.all)&&le(e.border.top),mobileBorderBottom:le(e.mobileBorder.bottom)||!le(e.mobileBorder.all)&&le(e.border.bottom),mobileBorderRight:le(e.mobileBorder.right)||!le(e.mobileBorder.all)&&le(e.border.right),mobileBorderLeft:le(e.mobileBorder.left)||!le(e.mobileBorder.all)&&le(e.border.left),mobileBorderRadiusAll:(0,O.ok)(e.mobileBorderRadius.all),mobileBorderRadiusTopLeft:(0,O.ok)(null!==e.mobileBorderRadius.topLeft?e.mobileBorderRadius.topLeft:e.mobileBorderRadius.all),mobileBorderRadiusBottomLeft:(0,O.ok)(null!==e.mobileBorderRadius.bottomLeft?e.mobileBorderRadius.bottomLeft:e.mobileBorderRadius.all),mobileBorderRadiusTopRight:(0,O.ok)(null!==e.mobileBorderRadius.topRight?e.mobileBorderRadius.topRight:e.mobileBorderRadius.all),mobileBorderRadiusBottomRight:(0,O.ok)(null!==e.mobileBorderRadius.bottomRight?e.mobileBorderRadius.bottomRight:e.mobileBorderRadius.all),mobileBoxShadowInset:(0,O.ok)(null===(S=e.mobileBoxShadow)||void 0===S?void 0:S.inset)||!1,mobileBoxShadowHOffset:(0,O.ok)(null===(y=e.mobileBoxShadow)||void 0===y?void 0:y.hOffset),mobileBoxShadowVOffset:(0,O.ok)(null===(w=e.mobileBoxShadow)||void 0===w?void 0:w.vOffset),mobileBoxShadowBlurRadius:(0,O.ok)(null===(k=e.mobileBoxShadow)||void 0===k?void 0:k.blurRadius),mobileBoxShadowSpreadRadius:(0,O.ok)(null===(B=e.mobileBoxShadow)||void 0===B?void 0:B.spreadRadius),mobileBoxShadowColor:(0,O.ok)(null===(x=e.mobileBoxShadow)||void 0===x?void 0:x.color),mobileBackgroundColor:(0,O.ok)("none"!==(null===(T=e.mobileBackgroundColor)||void 0===T?void 0:T.value)?null===(I=e.mobileBackgroundColor)||void 0===I?void 0:I.value:""),mobileBackgroundImage:"none"!==e.mobileBackgroundImage[0].value?e.mobileBackgroundImage[0].value:"",mobileBackgroundPositionX:(0,O.ok)(null===(A=e.mobileBackgroundPositionX)||void 0===A?void 0:A.value),mobileBackgroundPositionY:(0,O.ok)(null===(N=e.mobileBackgroundPositionY)||void 0===N?void 0:N.value),mobileBackgroundRepeat:null!==(L=e.mobileBackgroundRepeat)&&void 0!==L&&L.value?null===(V=e.mobileBackgroundRepeat)||void 0===V?void 0:V.value:"none",exportAsPicture:null===e||void 0===e?void 0:e.exportAsPicture}),!(0,O.ok)(e.borderRadius.all)&&((0,O.ok)(e.borderRadius.topLeft)||(0,O.ok)(e.borderRadius.bottomLeft)||(0,O.ok)(e.borderRadius.topRight)||(0,O.ok)(e.borderRadius.bottomRight))?g(!1):g(!0),(0,O.ok)(e.mobileBorderRadius.topLeft)||(0,O.ok)(e.mobileBorderRadius.bottomLeft)||(0,O.ok)(e.mobileBorderRadius.topRight)||(0,O.ok)(e.mobileBorderRadius.bottomRight)?v(!1):v(!0),R(""===e.backgroundImage[0].value),C(e=>!!re||e),P(e=>!(!re&&!ne)||e),F(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),M(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),H(!!e.boxShadow),W(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),$(!(null===(D=e.width)||void 0===D||!D.value)||!(null===(z=e.minWidth)||void 0===z||!z.value)||!(null===(U=e.maxWidth)||void 0===U||!U.value)),q(!!e.mobileWidth.value),K(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||"repeat"!==e.backgroundRepeat||!e.backgroundRepeat,!!e.backgroundSize),J(!!e.mobileBackgroundColor.value),ee(!!e.exportAsPicture)}},[i,e]);const de=(0,l.useCallback)(e=>{a(r===E.Tm?(0,d.A9)(e):(0,s.A9)(e))},[a,r]);return l.createElement(c.lV,{form:i,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:X.uE[re]||"borderAll",mobileBorderPosition:X.lS[ne]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileBackgroundColor:"",mobileBackgroundImage:""},onValuesChange:t=>{const l=i.getFieldsValue(!0),a=Object.keys(t)[0];let r;switch(a){case"exportAsPicture":r={exportAsPicture:l.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":r={boxShadow:{hOffset:l.boxShadowHOffset,vOffset:l.boxShadowVOffset,blurRadius:l.boxShadowBlurRadius,spreadRadius:l.boxShadowSpreadRadius,color:l.boxShadowColor,inset:l.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":var n,d,s;if("borderAll"===l.borderPosition)r={border:{...E.iV,all:{...X.RH,...l.borderAll}}},i.setFieldsValue({borderLeft:X.RH,borderRight:X.RH,borderTop:X.RH,borderBottom:X.RH});else null!==(n=l.borderAll)&&void 0!==n&&n.width||null!==(d=l.borderAll)&&void 0!==d&&d.style||null!==(s=l.borderAll)&&void 0!==s&&s.color?(r={border:{all:null,left:l.borderAll,right:l.borderAll,top:l.borderAll,bottom:l.borderAll,[X.Vz[a]]:{...l[a],...t[a]}}},i.setFieldsValue({borderAll:null,borderLeft:l.borderAll,borderRight:l.borderAll,borderTop:l.borderAll,borderBottom:l.borderAll,[a]:{...l[a],...t[a]}})):(r={border:{all:null,left:l.borderLeft,right:l.borderRight,top:l.borderTop,bottom:l.borderBottom,[X.Vz[a]]:{...l[a],...t[a]}}},i.setFieldsValue({border:r.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if("mobileBorderAll"===l.mobileBorderPosition)r={mobileBorder:{...E.iV,all:{...X.RH,...l.mobileBorderAll,classNamePrefix:"em-mob-border_"+X.ax[a]+"-"}}},i.setFieldsValue({borderLeft:X.RH,borderRight:X.RH,borderTop:X.RH,borderBottom:X.RH});else{var m,c,u,p,g,h;const o=X.ax[a],n={...l[a],...t[a]},d=!(null!==n&&void 0!==n&&n.width)&&!(null!==n&&void 0!==n&&n.style)&&!(null!==n&&void 0!==n&&n.color);if(null!==(m=l.mobileBorder)&&void 0!==m&&null!==(c=m.all)&&void 0!==c&&c.width||null!==(u=l.mobileBorder)&&void 0!==u&&null!==(p=u.all)&&void 0!==p&&p.style||null!==(g=l.mobileBorder)&&void 0!==g&&null!==(h=g.all)&&void 0!==h&&h.color){const e=l.mobileBorderAll;r={mobileBorder:{all:null,left:e,right:e,top:e,bottom:e,[o]:d?null:{...n,classNamePrefix:"em-mob-border_"+o+"-"}}},i.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:e,mobileBorderRight:e,mobileBorderTop:e,mobileBorderBottom:e,[a]:n})}else{const t=e.mobileBorder||{},l=e=>{const o=t[e];return o&&(null!==o&&void 0!==o&&o.width||null!==o&&void 0!==o&&o.style||null!==o&&void 0!==o&&o.color)?o:null};r={mobileBorder:{all:null,left:"left"===o?d?null:{...n,classNamePrefix:"em-mob-border_left-"}:l("left"),right:"right"===o?d?null:{...n,classNamePrefix:"em-mob-border_right-"}:l("right"),top:"top"===o?d?null:{...n,classNamePrefix:"em-mob-border_top-"}:l("top"),bottom:"bottom"===o?d?null:{...n,classNamePrefix:"em-mob-border_bottom-"}:l("bottom")}},i.setFieldsValue({[a]:n})}}break;case"width":r={[a]:{value:t[a],dim:l.widthDim}};break;case"widthDim":r={width:{value:l.width,dim:t[a]}};break;case"maxWidth":r={[a]:{value:t[a],dim:l.maxWidthDim}};break;case"maxWidthDim":r={maxWidth:{value:l.maxWidth,dim:t[a]}};break;case"minWidth":r={[a]:{value:t[a],dim:l.minWidthDim}};break;case"minWidthDim":r={minWidth:{value:l.minWidth,dim:t[a]}};break;case"backgroundImage":R(""===t[a]),r={[a]:[{...e.backgroundImage[0],value:t[a]}],backgroundSize:"cover"};break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":r={borderRadius:{[X.wF[a]]:+t[a]}};break;case"mobileWidth":r={[a]:{classNamePrefix:"em-mob-width-",value:t[a],dim:l.mobileWidthDim}};break;case"mobileWidthDim":r={mobileWidth:{classNamePrefix:"em-mob-width-",value:l.mobileWidth||100,dim:t[a]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":r={mobileBorderRadius:{[mobileBorderRadiusPosition[a]]:t[a],classNamePrefix:"em-mob-border_radius_"+mobileBorderRadiusPosition[a]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":r={mobileBoxShadow:{hOffset:l.mobileBoxShadowHOffset,vOffset:l.mobileBoxShadowVOffset,blurRadius:l.mobileBoxShadowBlurRadius,spreadRadius:l.mobileBoxShadowSpreadRadius,color:l.mobileBoxShadowColor,inset:l.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":r={[a]:{classNamePrefix:"em-mob-background_color-",value:t[a]}};break;case"mobileBackgroundImage":r={[a]:[{...e.mobileBackgroundImage[0],classNamePrefix:"em-mob-background_image-",value:t[a]}]};break;case"mobileBackgroundPositionX":r={[a]:{classNamePrefix:"em-mob-background_position_x-",value:t[a]}};break;case"mobileBackgroundPositionY":r={[a]:{classNamePrefix:"em-mob-background_position_x-",value:t[a]}};break;case"mobileBackgroundRepeat":r={[a]:{classNamePrefix:"em-mob-background_repeat-",value:t[a]}};break;case"mobileAlign":r={[a]:{classNamePrefix:"em-mob-table_align-",value:t[a]}};break;default:r=t}var b;"borderPosition"!==a&&"mobileBorderPosition"!==a&&(o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:r}),"mobileBorderRadiusAll"!==a&&"mobileBorderRadiusTopLeft"!==a&&"mobileBorderRadiusTopRight"!==a&&"mobileBorderRadiusBottomLeft"!==a&&"mobileBorderRadiusBottomRight"!==a&&de({...e,...r,mobileBorderRadius:{...e.mobileBorderRadius,...null===(b=r)||void 0===b?void 0:b.mobileBorderRadius},activateSection:null,changeKey:a}))},autoComplete:"off",className:"element-controls"},!I&&l.createElement(c.m_,{title:t("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"},l.createElement(c.Fc,{className:"selected_form-mobile-props-title",message:t("Appearance on mobile devices"),type:"info"})),w===E.ND&&k.styles?l.createElement("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props"},l.createElement(he,{form:i,elementSettings:e,mobileBoxShadow:h,mobileBordersShow:N,mobileBorderRadiusShow:V,mobileBoxShadowShow:z,mobileSizeShow:j,mobileBackgroundShow:Q,oneMobileBorderRadiusValue:f,setOneMobileBorderRadiusValue:v,backgroundRepeatOptions:te,toggleShowMobileBorderHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{P(e=>!e),N?(t.mobileBorderAll=X.RH,t.mobileBorderTop=X.RH,t.mobileBorderBottom=X.RH,t.mobileBorderRight=X.RH,t.mobileBorderLeft=X.RH):t.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:t.mobileBorderAll.color,style:t.mobileBorderAll.style,width:t.mobileBorderAll.width}}}})})},toggleShowMobileBorderRadiusHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{M(e=>!e),V?(t.mobileBorderRadiusAll=null,v(!0)):t.mobileBorderRadiusAll=5,o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:t.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},toggleShowMobileBoxShadowHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{W(e=>!e),z?(t.mobileBoxShadowInset=!1,t.mobileBoxShadowHOffset=null,t.mobileBoxShadowVOffset=null,t.mobileBoxShadowBlurRadius=null,t.mobileBoxShadowSpreadRadius=null,t.mobileBoxShadowColor=""):(t.mobileBoxShadowInset=!1,t.mobileBoxShadowHOffset=5,t.mobileBoxShadowVOffset=5,t.mobileBoxShadowBlurRadius=10,t.mobileBoxShadowSpreadRadius=-5,t.mobileBoxShadowColor="#000000"),o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:t.mobileBoxShadowBlurRadius,color:t.mobileBoxShadowColor,hOffset:t.mobileBoxShadowHOffset,inset:t.mobileBoxShadowInset,spreadRadius:t.mobileBoxShadowSpreadRadius,vOffset:t.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},toggleShowMobileSizeHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{q(e=>!e),j&&(t.mobileWidth="",o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileWidth:{value:null,dim:"px",classNamePrefix:"em-mob-width-"}}}))})},toggleShowMobileBackgroundHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{J(e=>!e),t.mobileBackgroundColor=Q?"":"#E5E5E5",o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:t.mobileBackgroundColor}}})})}})," "):l.createElement("div",{id:"selected_element_form_desktop_props"},l.createElement(ce,{form:i,elementSettings:e,boxShadow:m,bordersShow:A,borderRadiusShow:L,boxShadowShow:D,backgroundShow:Y,backgroundImageEmpty:B,backgroundRepeatOptions:te,backgroundSizeOptions:oe,sizeShow:U,modificationShow:Z,oneBorderRadiusValue:p,setOneBorderRadiusValue:g,toggleShowBorderHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{C(e=>!e),A?(t.borderAll=X.RH,t.borderTop=X.RH,t.borderBottom=X.RH,t.borderRight=X.RH,t.borderLeft=X.RH):t.borderAll={width:1,color:"#E5E5E5",style:"solid"},o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:t.borderAll.color,style:t.borderAll.style,width:t.borderAll.width}}}})})},toggleShowBorderRadiusHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{F(e=>!e),L?(t.borderRadiusAll=0,g(!0)):t.borderRadiusAll=5,o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:t.borderRadiusAll}}})})},toggleShowBoxShadowHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{H(e=>!e),D?(t.boxShadowInset=!1,t.boxShadowHOffset=null,t.boxShadowVOffset=null,t.boxShadowBlurRadius=null,t.boxShadowSpreadRadius=null,t.boxShadowColor=""):(t.boxShadowInset=!1,t.boxShadowHOffset=5,t.boxShadowVOffset=5,t.boxShadowBlurRadius=10,t.boxShadowSpreadRadius=-5,t.boxShadowColor="#000000"),o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:t.boxShadowBlurRadius,color:t.boxShadowColor,hOffset:t.boxShadowHOffset,inset:t.boxShadowInset,spreadRadius:t.boxShadowSpreadRadius,vOffset:t.boxShadowVOffset}}})})},toggleShowSizeHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{$(e=>!e),U&&(t.width="",t.minWidth="",t.maxWidth="",o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{width:{value:null,dim:"px"},minWidth:{value:null,dim:"px"},maxWidth:{value:null,dim:"px"}}}))})},toggleShowBackgroundHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{K(e=>!e),Y?(t.backgroundColor="",t.backgroundImage="",t.backgroundPositionX="",t.backgroundPositionY="",t.backgroundRepeat="none",t.backgroundSize="",R(!0)):(t.backgroundColor="#E5E5E5",t.backgroundSize="",t.backgroundRepeat="none"),o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:t.backgroundColor,backgroundImage:[{type:"url",value:t.backgroundImage}],backgroundPositionX:t.backgroundPositionX,backgroundPositionY:t.backgroundPositionY,backgroundRepeat:t.backgroundRepeat,backgroundSize:t.backgroundSize}})})},toggleShowModificationHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{ee(e=>!e),Z&&(t.exportAsPicture=!1,o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})}})))},fe=({elementSettings:e})=>{const{__:t}=(0,_.s9)(),o=(0,S.XW)(),[i]=c.lV.useForm(),a=(0,y.rD)(),r=(0,n.d4)(G.Fv),d=(0,n.d4)(G.yy),[s,m]=(0,l.useState)({}),[u,p]=(0,l.useState)("https://");(0,l.useEffect)(()=>{if(e){let t="",o="",l=null==e.href?"https://":e.href;if(l&&"mailto:"===l.substring(0,7)){const i=new URL(e.href);t=i.searchParams.get("subject")||"",o=i.searchParams.get("body")||"",l=e.href.split("?")[0],p("mailto:")}else e.href&&("https://"===e.href.substring(0,8)||"http://"===e.href.substring(0,7)?p("https://"):"tel:"===e.href.substring(0,4)?p("tel:"):"sms:"===e.href.substring(0,4)?p("sms:"):"ftp://"===e.href.substring(0,6)?p("ftp://"):p(""));i.setFieldsValue({...e,href:l,subject:t,body:o})}},[i,e]);return l.createElement(c.lV,{form:i,layout:"vertical",name:"selected_link_form",initialValues:{href:"https://",target:"",textStrong:!1,textItalic:!1,textStrikethrough:!1,textUnderline:!1,textReplacer:"",subject:"",body:""},onValuesChange:t=>{const l=Object.keys(t)[0];let a=t;if("href"===l){const e=t[l];if("mailto:"===e.substring(0,7)){const t=i.getFieldValue("subject"),o=i.getFieldValue("body"),l=[];t&&l.push(`subject=${encodeURIComponent(t)}`),o&&l.push(`body=${encodeURIComponent(o)}`);a={href:l.length>0?`${e}?${l.join("&")}`:e}}}if("subject"===l||"body"===l){const e=i.getFieldValue("href")||"";if("mailto:"!==e.substring(0,7))return;{const o=e.split("?")[0],r="subject"===l?t[l]:i.getFieldValue("subject"),n="body"===l?t[l]:i.getFieldValue("body"),d=[];r&&d.push(`subject=${encodeURIComponent(r)}`),n&&d.push(`body=${encodeURIComponent(n)}`);a={href:d.length>0?`${o}?${d.join("&")}`:o}}}o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:a})},autoComplete:"off",className:"element-controls"},r&&"bottom"!==d?l.createElement(ne,{form:i,elementSettings:e,showAddParagraph:!1}):l.createElement(l.Fragment,null,l.createElement(c.m_,{trigger:["hover"],title:t("Hyperlink URL"),placement:"left"},l.createElement(c.lV.Item,{name:"href",style:{marginBottom:24,paddingRight:10}},l.createElement(c.pd,{allowClear:!0,placeholder:t("Hyperlink URL"),prefix:l.createElement(A.Ay,{icon:"LinkOutlined"}),onSelect:({target:e})=>{const{selectionStart:t,selectionEnd:o}=e;e&&m({target:e,selection:{start:t,end:o}})}}))),a.formLinkFieldInsertImageEnabled&&l.createElement(c.y9,{title:t("Actions with the chosen text"),dividerTop:!0},l.createElement(c.lV.Item,null,l.createElement(c.$n,{icon:l.createElement(A.Ay,{icon:"PicLeftOutlined"}),onClick:()=>{return e="add_img",void o({operation:E.Ru.SANDBOX_ELEMENT_TEXT,action:e});var e}},t("Add inline image")))),l.createElement(re,{form:i,elementSettings:e,showAddParagraph:!1,linkTarget:s,linkProtocol:u,setLinkProtocol:p})))},ve=()=>{const{__:e}=(0,_.s9)();return l.createElement(c.fI,{gutter:10},l.createElement(c.fv,{span:14},l.createElement(c.lV.Item,{name:"height"},l.createElement(c.FQ,{min:0,placeholder:e("Indent height"),prefix:l.createElement(A.Ay,{icon:"ColumnHeightOutlined"}),addonAfter:"px"}))))},_e=({form:e,elementSettings:t})=>l.createElement(c.fI,{gutter:10,style:{marginBottom:20}},l.createElement(c.fv,{span:12},l.createElement(D,{form:e,name:"mobileHeight",elementSettings:t}))),Ee=({elementSettings:e})=>{const{__:t}=(0,_.s9)(),[o]=c.lV.useForm(),i=(0,n.wA)(),a=(0,n.d4)(d.Hs),r=(0,S.XW)(),m=(0,n.d4)(G.Ct),u=(0,n.d4)(G.CS),p=(0,n.d4)(G.Fv),g=(0,n.d4)(G.yy),h=p&&"bottom"!==g,b=a.hasOwnProperty("type")?E.IE:E.Tm;(0,l.useEffect)(()=>{var t,l,i,a,r,n;e&&o.setFieldsValue({...e,height:null===(t=e.height)||void 0===t?void 0:t.value,heightDim:null===(l=e.height)||void 0===l?void 0:l.dim,mobileHeight:(0,O.xc)((null===(i=e.mobileHeight)||void 0===i?void 0:i.value)||(null===(a=e.height)||void 0===a?void 0:a.value)),mobileHeightDim:(null===(r=e.mobileHeight)||void 0===r?void 0:r.dim)||(null===(n=e.height)||void 0===n?void 0:n.dim)})},[o,e]);const f=(0,l.useCallback)(e=>{i(b===E.Tm?(0,d.A9)(e):(0,s.A9)(e))},[i,b]);return l.createElement(c.lV,{form:o,layout:"vertical",name:"selected_vindent_form",initialValues:{height:"",heightDim:"",mobileHeight:"",mobileHeightDim:""},onValuesChange:t=>{const l=o.getFieldsValue(!0),i=Object.keys(t)[0];let a;switch(i){case"height":a={[i]:{value:t[i],dim:l.heightDim}};break;case"heightDim":a={height:{value:l.height,dim:t[i]}};break;case"mobileHeight":a={[i]:{classNamePrefix:"em-mob-height-",value:t[i],dim:l.mobileHeightDim}};break;case"mobileHeightDim":a={mobileHeight:{classNamePrefix:"em-mob-height-",value:l.mobileHeight,dim:t[i]}};break;default:a=t}r({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:a}),f({...e,...a,activateSection:null,changeKey:i})},autoComplete:"off"},!h&&l.createElement(c.m_,{title:t("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"},l.createElement(c.Fc,{className:"selected_form-mobile-props-title",message:t("Appearance on mobile devices"),type:"info"})),m===E.ND&&u.styles?l.createElement("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:m===E.ND&&u.styles?"block":"none",marginBottom:10}},l.createElement(_e,{form:o,elementSettings:e})):l.createElement("div",{id:"selected_element_form_desktop_props",style:{display:m===E.ND&&u.styles?"none":"block"}},l.createElement(ve,null)))},Se=({form:e,elementSettings:t,typeOfForm:o="desktop"})=>{var i,a,r;const{__:n}=(0,_.s9)(),d=(0,S.XW)(),s="mobile"===o,m=s?"mobileDirection":"direction",u=s?null!==(i=null===(a=t.mobileDirection)||void 0===a?void 0:a.value)&&void 0!==i?i:"":null!==(r=t.direction)&&void 0!==r?r:"";return l.createElement(c.lV.Item,{name:m,className:"form-item-margin-xs"},l.createElement(c.vp,{value:u,onChange:o=>{e.setFieldsValue({[m]:o}),d({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:t.type,settings:{[m]:o}})},labels:{rtlLabel:n("Right to left"),ltrLabel:n("Left to right")}}))},ye={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"}]},we=e=>e.closest(".email-pane__collapse-wrapper")||e.parentNode,ke=({form:e,backgroundImageEmpty:t,appConfig:o,token:i,elementSettings:a,backgroundRepeatOptions:r,handleChangeValues:n})=>{const{__:d}=(0,_.s9)(),[s,m]=(0,l.useState)(""),[u,p]=(0,l.useState)("px"),[g,h]=(0,l.useState)(""),[f,v]=(0,l.useState)("px"),E=[{label:d("Not defined"),value:""},{label:d("Contain"),value:"contain"},{label:d("Cover"),value:"cover"}],S=e=>{if(!e||"string"!==typeof e)return{value:"",unit:"px"};const t=(e=e.trim()).match(/^(\d*\.?\d+)(%|px)$/);if(t){return{value:t[1],unit:t[2]}}return{value:e,unit:"px"}};(0,l.useEffect)(()=>{const t=e.getFieldValue("backgroundPositionX"),o=e.getFieldValue("backgroundPositionY"),l=S(t),i=S(o);m(String(l.value)),p(l.unit),h(String(i.value)),v(i.unit)},[e]);const y=(e,t)=>{m(String(e)),p(t),n&&n({backgroundPositionX:{position:e,unit:t}})},w=(e,t)=>{h(String(e)),v(t),n&&n({backgroundPositionY:{position:e,unit:t}})};return l.createElement(c.fI,{gutter:10,style:{marginBottom:8}},l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:d("Background color"),placement:"bottom",getPopupContainer:we},l.createElement("div",null,l.createElement(c.lV.Item,{name:"backgroundColor",style:{marginBottom:i.formItemMarginBottomXS}},l.createElement(c.it,{placeholder:d("Background color"),usedColors:a.usedColors,usedLabel:d("Used"),recommendedLabel:d("Recommended"),placement:"bottomLeft"}))))),o.formCellFieldBackgroundImageEnabled&&l.createElement(c.fv,{span:t?12:24},l.createElement(c.m_,{trigger:["hover"],title:d("Background image"),placement:"bottom",getPopupContainer:we},l.createElement("div",null,l.createElement(b.A,{form:e,label:d("Background image"),name:"backgroundImage",tooltipTitle:d("Background image"),placeholder:d("Background image link/route")}))),!t&&l.createElement(c.lV.Item,{style:{marginBottom:"0"}},l.createElement(c.fI,{gutter:10,style:{marginBottom:i.formItemMarginBottomXS}},l.createElement(c.fv,{span:12},l.createElement(c.$k,{options:ye.horizontal,position:s,setPosition:e=>y(e,u),unit:u,setUnit:e=>y(s,e),placeholder:d("Horizontal position"),prefix:l.createElement(A.Ay,{icon:"BgPositionHorizontal"}),dropdownStyle:{bottom:"auto"},tooltipTitle:d("Horizontal position"),getTooltipPopupContainer:we})),l.createElement(c.fv,{span:12},l.createElement(c.$k,{options:ye.vertical,position:g,setPosition:e=>w(e,f),unit:f,setUnit:e=>w(g,e),placeholder:d("Vertical position"),prefix:l.createElement(A.Ay,{icon:"BgPositionVertical"}),dropdownStyle:{bottom:"auto"},tooltipTitle:d("Vertical position"),getTooltipPopupContainer:we}))),l.createElement(c.fI,{gutter:10},l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:d("Background image repeat"),placement:"top"},l.createElement(c.lV.Item,{name:"backgroundRepeat",style:{marginBottom:i.formItemMarginBottomXS}},l.createElement(c.Select,{placeholder:d("Please choose"),options:r,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")})))),l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:d("Background image size"),placement:"top"},l.createElement(c.lV.Item,{name:"backgroundSize",style:{marginBottom:i.formItemMarginBottomXS}},l.createElement(c.Select,{placeholder:d("Please choose"),options:E,getPopupContainer:()=>document.querySelector(".email-properties__collapse-panel")}))))))))},Be=({form:e,elementSettings:t,__:o,appConfig:i})=>{const[a,r]=(0,l.useState)(null);return(0,l.useEffect)(()=>{var e,t;null!==(e=window)&&void 0!==e&&null!==(t=e.navigator)&&void 0!==t&&t.userAgent.includes("Macintosh")&&r(!0)},[]),l.createElement("div",{style:{marginBottom:"-15px"}},i.formTextFieldTypografEnabled&&l.createElement(l.Fragment,null,l.createElement(c.m_,{trigger:["hover"],title:o("Text font"),placement:"bottom",zIndex:1,getPopupContainer:e=>e.parentNode},l.createElement(c.lV.Item,{name:"fontFamily",className:"form-item-margin-xs"},l.createElement(c.LW,{textEditor:!0,loadGoogleFonts:oe.c,getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper")}))),!t.showOnMobile&&l.createElement(c.fI,{gutter:10},l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:o("Font size"),placement:"bottom"},l.createElement(c.lV.Item,{name:"fontSize"},l.createElement(c.FQ,{min:8,max:90,placeholder:o("Font size"),prefix:l.createElement(A.Ay,{icon:"FontSizeOutlined"}),addonAfter:"px"})))),l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:o("Line height"),placement:"bottom"},l.createElement(c.lV.Item,{name:"lineHeight"},l.createElement(c.FQ,{min:10,max:110,placeholder:o("Line height"),prefix:l.createElement(A.Ay,{icon:"LineHeightOutlined"}),addonAfter:"px"})))))),l.createElement(c.fI,{gutter:10},l.createElement(c.fv,{span:3},l.createElement(ie,{form:e,elementSettings:t,name:"textStrong",tooltipTitle:o(a?"Strong ( \u2318B )":"Strong ( Ctrl+B )"),icon:l.createElement(A.Ay,{icon:"BoldOutlined",className:"selected-text-common-form__icon-radius"})})),l.createElement(c.fv,{span:3},l.createElement(ie,{form:e,elementSettings:t,name:"textItalic",tooltipTitle:o(a?"Italic ( \u2318I )":"Italic ( Ctrl+I )"),icon:l.createElement(A.Ay,{icon:"ItalicOutlined",className:"selected-text-common-form__icon-radius"})})),l.createElement(c.fv,{span:3},l.createElement(ie,{form:e,elementSettings:t,name:"textStrikethrough",tooltipTitle:o(a?"Strikethrough ( \u2318+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:l.createElement(A.Ay,{icon:"StrikethroughOutlined",className:"selected-text-common-form__icon-radius"})})),l.createElement(c.fv,{span:3},l.createElement(ie,{form:e,elementSettings:t,name:"textUnderline",tooltipTitle:o(a?"Underline ( \u2318U )":"Underline ( Ctrl+U )"),icon:l.createElement(A.Ay,{icon:"UnderlineOutlined",className:"selected-text-common-form__icon-radius"})}))),l.createElement(c.fI,{gutter:10,style:{paddingBottom:4}},l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:o("Text color"),placement:"bottom",zIndex:2,getPopupContainer:e=>e.parentNode},l.createElement(c.lV.Item,{name:"textColor",rules:[{message:o("Please set the font color")}]},l.createElement(c.it,{placeholder:o("Color"),usedColors:t.usedColors,usedLabel:o("Used"),recommendedLabel:o("Recommended")})))),l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:o("Text background"),placement:"bottom",zIndex:2,getPopupContainer:e=>e.parentNode},l.createElement(c.lV.Item,{name:"textBackgroundColor",rules:[{message:o("Please set the background color")}]},l.createElement(c.it,{placeholder:o("Background color"),usedColors:t.usedColors,usedLabel:o("Used"),recommendedLabel:o("Recommended")}))))))},Re=({form:e,elementSettings:t,boxShadow:o,bordersShow:i,borderRadiusShow:a,boxShadowShow:r,backgroundShow:n,backgroundImageEmpty:d,backgroundRepeatOptions:s,sizeShow:m,maxWidthValue:u,modificationShow:p,paddingsExt:g,oneBorderRadiusValue:h,setOneBorderRadiusValue:b,elementListShow:E,togglePaddingHandler:S,toggleShowBorderHandler:w,toggleShowBorderRadiusHandler:k,toggleShowBoxShadowHandler:R,toggleShowSizeHandler:x,toggleShowBackgroundHandler:T,toggleShowModificationHandler:A,handleChangeValues:N})=>{const{__:P}=(0,_.s9)(),{token:L}=(0,c.rd)(),V=(0,y.rD)();return l.createElement(l.Fragment,null,l.createElement(c.fI,{gutter:10,style:{paddingBottom:4}},l.createElement(c.fv,{span:12},l.createElement(le.A,{form:e,elementSettings:t})),V.formCellFieldVerticalAlignEnabled&&"group"!==t.type&&("structure"!==t.type||"structure"===t.type&&1===t.floatBlocks.items.length)&&l.createElement(c.fv,{span:12,style:{textAlign:"right"}},l.createElement(B,{form:e,elementSettings:t}))),V.formCellFieldPaddingsEnabled&&l.createElement(l.Fragment,null,E&&l.createElement("div",{style:{marginTop:"15px"}},l.createElement(Be,{form:e,elementSettings:t,appConfig:V,__:P})),l.createElement(c.y9,{title:P("Padding"),dividerTop:!0},l.createElement(c.L1,{extended:g,onToggleExtended:S,showHorizontal:"group"!==t.type&&"column"!==t.type,rowStyle:{paddingBottom:4},labels:{horizontal:P("Horizontal padding"),vertical:P("Vertical padding"),left:P("Left padding"),right:P("Right padding"),top:P("Top padding"),bottom:P("Bottom padding"),individual:P("Individual padding")}}))),"group"!==t.type&&V.formCellFieldSizeEnabled&&l.createElement(c.y9,{title:P("Size"),collapsible:!0,open:m,onToggle:x,dividerTop:!0},l.createElement(c.n6,{showWidth:"structure"!==t.type&&"column"!==t.type,maxWidth:u,dimensionSelect:O.z$,rowStyle:{paddingBottom:4},labels:{width:P("Width"),height:P("Height"),minWidth:P("Minimum width"),maxWidth:P("Maximum width")}})),l.createElement(c.y9,{title:P("Background"),collapsible:!0,open:n,onToggle:T,dividerTop:!0},l.createElement(ke,{form:e,backgroundImageEmpty:d,appConfig:V,token:L,elementSettings:t,backgroundRepeatOptions:s,handleChangeValues:N})),V.formFieldBorderEnabled&&l.createElement(c.y9,{title:P("Borders"),collapsible:!0,open:i,onToggle:w,dividerTop:!0},l.createElement(f.A,{form:e,elementSettings:t})),V.formFieldBorderRadiusEnabled&&l.createElement(c.y9,{title:P("Border radius"),collapsible:!0,open:a,onToggle:k,dividerTop:!0},l.createElement(v.A,{form:e,oneBorderRadiusValue:h,setOneBorderRadiusValue:b,elementSettings:t})),V.formFieldBoxShadowEnabled&&l.createElement(c.y9,{title:P("Box shadow"),collapsible:!0,open:r,onToggle:R,dividerTop:!0},l.createElement(I,null)),V.formFieldExportAsPictureEnabled&&"group"!==t.type&&l.createElement(c.y9,{title:P("Settings"),collapsible:!0,open:p,onToggle:A,dividerTop:!0},"structure"===t.type&&l.createElement(c.m_,{title:P("The block will change its colors to contrasting colors. You can change them in the Content Styles section."),key:"isContrastBlock"},l.createElement(c.lV.Item,{name:"isContrastBlock",valuePropName:"checked",style:{marginBottom:0}},l.createElement(c.dO,{id:"contrast-colors",label:P("Contrast block"),size:"small",labelStyle:{position:"relative",top:2}}))),l.createElement(me,{form:e,elementSettings:t})),V.formFieldVisibilityEnabled&&"column"!==t.type&&l.createElement(c.y9,{title:P("group"!==t.type?"Display control & Direction":"Display control"),dividerTop:!0},l.createElement(C,{elementSettings:t,form:e,directionControl:"group"!==t.type?l.createElement(Se,{elementSettings:t,form:e}):void 0})),V.formFieldAmpVisibilityEnabled&&t.ampShow&&l.createElement(c.y9,{title:P("AMP visibility"),dividerTop:!0},l.createElement(F,null)))},xe=({form:e,elementSettings:t,mobilePaddingsExt:o,setMobilePaddingsExt:i,rowStyle:a})=>{const{__:r}=(0,_.s9)(),n=(0,S.XW)();return l.createElement(c.L1,{typeOfForm:"mobile",extended:o,onToggleExtended:()=>{i(e=>!e);const l=e.getFieldsValue(!0);o||(l.mobilePaddingLeftRight=l.mobilePaddingLeft,l.mobilePaddingTopBottom=l.mobilePaddingTop,l.mobilePaddingRight=l.mobilePaddingLeft,l.mobilePaddingBottom=l.mobilePaddingTop,n({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:t.type,settings:{mobilePadding:{top:""!==l.mobilePaddingTop?l.mobilePaddingTop:null,bottom:""!==l.mobilePaddingTopBottom?l.mobilePaddingTopBottom:null,left:""!==l.mobilePaddingLeft?l.mobilePaddingLeft:null,right:""!==l.mobilePaddingRight?l.mobilePaddingRight:null,classNamePrefix:"em-mob-padding_"}}}))},showHorizontal:!0,gutter:10,rowStyle:a,labels:{horizontal:r("Horizontal padding"),vertical:r("Vertical padding"),left:r("Left padding"),right:r("Right padding"),top:r("Top padding"),bottom:r("Bottom padding"),individual:r("Individual padding")}})},Te=({form:e,elementSettings:t,boxShadow:o,mobileBordersShow:i,mobileBorderRadiusShow:a,mobileBoxShadowShow:r,mobileSizeShow:n,mobileBackgroundShow:d,mobilePaddingShow:s,mobilePaddingsExt:m,setMobilePaddingsExt:u,oneMobileBorderRadiusValue:p,setOneMobileBorderRadiusValue:g,toggleShowMobileBorderHandler:h,toggleShowMobileBorderRadiusHandler:b,toggleShowMobileBoxShadowHandler:E,toggleShowMobileSizeHandler:S,toggleShowMobileBackgroundHandler:w,toggleShowMobilePaddingHandler:R})=>{const{__:x}=(0,_.s9)(),{token:T}=(0,c.rd)(),A=(0,y.rD)();return l.createElement(l.Fragment,null,l.createElement(c.fI,{gutter:20},l.createElement(c.fv,{span:12},l.createElement(k,{form:e,elementSettings:t,imgParent:!0,typeOfForm:"mobile"})),A.formCellFieldVerticalAlignEnabled&&"group"!==t.type&&("structure"!==t.type||"structure"===t.type&&1===t.floatBlocks.items.length)&&l.createElement(c.fv,{span:12,style:{textAlign:"right"}},l.createElement(B,{form:e,elementSettings:t,typeOfForm:"mobile"}))),A.formCellFieldPaddingsEnabled&&l.createElement(c.y9,{title:x("Padding"),collapsible:!0,open:s,onToggle:R,dividerTop:!0},l.createElement(xe,{form:e,elementSettings:t,mobilePaddingsExt:m,setMobilePaddingsExt:u,rowStyle:{paddingBottom:4}})),"group"!==t.type&&A.formCellFieldSizeEnabled&&l.createElement(c.y9,{title:x("Size"),collapsible:!0,open:n,onToggle:S,dividerTop:!0},l.createElement(c.fI,{gutter:10,style:{paddingBottom:9}},"structure"!==t.type&&l.createElement(c.fv,{span:12},l.createElement("div",{style:{marginBottom:15}},l.createElement(M,{form:e,name:"mobileWidth",elementSettings:t}))),l.createElement(c.fv,{span:12},l.createElement("div",{style:{marginBottom:15}},l.createElement(D,{form:e,name:"mobileHeight",elementSettings:t}))))),l.createElement(c.y9,{title:x("Background"),collapsible:!0,open:d,onToggle:w,dividerTop:!0},l.createElement("div",{style:{marginBottom:T.formItemMarginBottomMD+4}},l.createElement(ue,{form:e,elementSettings:t,label:x("Background color")}))),A.formFieldBorderEnabled&&l.createElement(c.y9,{title:x("Borders"),collapsible:!0,open:i,onToggle:h,dividerTop:!0},l.createElement(f.A,{form:e,typeOfForm:"mobile"})),A.formFieldBorderRadiusEnabled&&l.createElement(c.y9,{title:x("Border radius"),collapsible:!0,open:a,onToggle:b,dividerTop:!0},l.createElement(v.A,{form:e,oneBorderRadiusValue:p,setOneBorderRadiusValue:g,elementSettings:t,typeOfForm:"mobile"})),A.formFieldBoxShadowEnabled&&l.createElement(c.y9,{title:x("Box shadow"),collapsible:!0,open:r,onToggle:E,dividerTop:!0},l.createElement(I,{typeOfForm:"mobile"})),A.formFieldVisibilityEnabled&&"column"!==t.type&&l.createElement(c.y9,{title:x("group"!==t.type?"Display control & Direction":"Display control"),dividerTop:!0},l.createElement(C,{elementSettings:t,form:e,directionControl:"group"!==t.type?l.createElement(Se,{elementSettings:t,form:e,typeOfForm:"mobile"}):void 0})),A.formFieldAmpVisibilityEnabled&&t.ampShow&&l.createElement(c.y9,{title:x("AMP visibility"),dividerTop:!0},l.createElement(F,null)))},Ie=({elementSettings:e})=>{const{__:t}=(0,_.s9)(),o=(0,S.XW)(),i=(0,n.wA)(),[a]=c.lV.useForm(),[r,m]=(0,l.useState)(""),[u,p]=(0,l.useState)({}),[g,h]=(0,l.useState)(!0),[b,f]=(0,l.useState)(!0),v=(0,n.d4)(G.Ct),w=(0,n.d4)(G.CS),k=(0,n.d4)(d.Hs),[B,R]=((0,y.rD)(),(0,l.useState)(""===e.backgroundImage[0].value)),x=(0,n.d4)(G.Fv),T=(0,n.d4)(G.yy),I=x&&"bottom"!==T,[A,C]=(0,l.useState)(!1),[N,P]=(0,l.useState)(!1),[L,F]=(0,l.useState)(!1),[V,M]=(0,l.useState)(!1),[D,H]=(0,l.useState)(!1),[z,W]=(0,l.useState)(!1),[U,$]=(0,l.useState)(!1),[j,q]=(0,l.useState)(!1),[Y,K]=(0,l.useState)(!1),[Q,J]=(0,l.useState)(!1),[Z,ee]=(0,l.useState)(!1),[te,oe]=(0,l.useState)(!1),[le,ie]=(0,l.useState)(!1),[ae,re]=(0,l.useState)(!1),[ne,de]=(0,l.useState)(!1),se=k.hasOwnProperty("type")?E.IE:E.Tm,me=[{label:t("Not defined"),value:"none"},{label:t("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:t("Repeat background (repeat)"),value:"repeat"},{label:t("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:t("Repeat background vertically (repeat-y)"),value:"repeat-y"}],ce=e.border,ue=e.mobileBorder,pe=Object.keys(ce).find(e=>{var t,o,l;return(null===(t=ce[e])||void 0===t?void 0:t.width)||(null===(o=ce[e])||void 0===o?void 0:o.style)||(null===(l=ce[e])||void 0===l?void 0:l.color)}),ge=Object.keys(ue).find(e=>{var t,o,l;return(null===(t=ue[e])||void 0===t?void 0:t.width)||(null===(o=ue[e])||void 0===o?void 0:o.style)||(null===(l=ue[e])||void 0===l?void 0:l.color)}),he=e=>e&&(null!==e&&void 0!==e&&e.width||null!==e&&void 0!==e&&e.style||null!==e&&void 0!==e&&e.color)?e:"";(0,l.useEffect)(()=>{if(e){var t,o,l,i,r,n,d,s,m,c,u,g,b,v,_,E,S,y,w,k,B,x,T,I,A,N,L,V,D,z,U,G,j,X,Y,Q,Z,te,le,ae,ne,se,me,ce,ue,be,fe,ve,_e,Ee,Se,ye,we,ke,Be,Re,xe,Te,Ie,Ae,Ce,Ne,Pe,Le,Fe,Oe,Ve,Me,De,He,ze,We,Ue,$e,Ge,je,Xe,qe,Ye,Ke,Qe,Je,Ze,et,tt,ot,lt,it,at,rt,nt,dt,st,mt,ct;const ut=e.boxShadow;p(ut),a.setFieldsValue({...e,width:null===(t=e.width)||void 0===t?void 0:t.value,widthDim:null===(o=e.width)||void 0===o?void 0:o.dim,height:null===(l=e.height)||void 0===l?void 0:l.value,heightDim:null===(i=e.height)||void 0===i?void 0:i.dim,backgroundImage:e.backgroundImage[0].value,show:e.show?e.show:"all",isContrastBlock:e.isContrastBlock,borderAll:(0,O.ok)(e.border.all),borderTop:(0,O.ok)(e.border.top),borderBottom:(0,O.ok)(e.border.bottom),borderRight:(0,O.ok)(e.border.right),borderLeft:(0,O.ok)(e.border.left),mobileBorderAll:he(e.mobileBorder.all)||!(he(e.mobileBorder.top)||he(e.mobileBorder.bottom)||he(e.mobileBorder.right)||he(e.mobileBorder.left))&&he(e.border.all),mobileBorderTop:he(e.mobileBorder.top)||!he(e.mobileBorder.all)&&he(e.border.top),mobileBorderBottom:he(e.mobileBorder.bottom)||!he(e.mobileBorder.all)&&he(e.border.bottom),mobileBorderRight:he(e.mobileBorder.right)||!he(e.mobileBorder.all)&&he(e.border.right),mobileBorderLeft:he(e.mobileBorder.left)||!he(e.mobileBorder.all)&&he(e.border.left),paddingTop:(0,O.ok)(null===(r=e.padding)||void 0===r?void 0:r.all)||(0,O.ok)(null===(n=e.padding)||void 0===n?void 0:n.top),paddingLeft:(0,O.ok)(null===(d=e.padding)||void 0===d?void 0:d.all)||(0,O.ok)(null===(s=e.padding)||void 0===s?void 0:s.left),paddingRight:(0,O.ok)(null===(m=e.padding)||void 0===m?void 0:m.all)||(0,O.ok)(null===(c=e.padding)||void 0===c?void 0:c.right),paddingBottom:(0,O.ok)(null===(u=e.padding)||void 0===u?void 0:u.all)||(0,O.ok)(null===(g=e.padding)||void 0===g?void 0:g.bottom),paddingLeftRight:(0,O.ok)(null===(b=e.padding)||void 0===b?void 0:b.left)||(0,O.ok)(null===(v=e.padding)||void 0===v?void 0:v.right),paddingTopBottom:(0,O.ok)(null===(_=e.padding)||void 0===_?void 0:_.top)||(0,O.ok)(null===(E=e.padding)||void 0===E?void 0:E.bottom),borderRadiusAll:(0,O.ok)(e.borderRadius.all),borderRadiusTopLeft:(0,O.ok)(e.borderRadius.topLeft),borderRadiusBottomLeft:(0,O.ok)(e.borderRadius.bottomLeft),borderRadiusTopRight:(0,O.ok)(e.borderRadius.topRight),borderRadiusBottomRight:(0,O.ok)(e.borderRadius.bottomRight),boxShadowInset:(0,O.ok)(null===(S=e.boxShadow)||void 0===S?void 0:S.inset)||!1,boxShadowHOffset:(0,O.ok)(null===(y=e.boxShadow)||void 0===y?void 0:y.hOffset),boxShadowVOffset:(0,O.ok)(null===(w=e.boxShadow)||void 0===w?void 0:w.vOffset),boxShadowBlurRadius:(0,O.ok)(null===(k=e.boxShadow)||void 0===k?void 0:k.blurRadius),boxShadowSpreadRadius:(0,O.ok)(null===(B=e.boxShadow)||void 0===B?void 0:B.spreadRadius),boxShadowColor:(0,O.ok)(null===(x=e.boxShadow)||void 0===x?void 0:x.color),mobileWidth:(0,O.xc)(null===(T=e.mobileWidth)||void 0===T?void 0:T.value)||(0,O.xc)(null===(I=e.width)||void 0===I?void 0:I.value),mobileWidthDim:(0,O.xc)(null===(A=e.mobileWidth)||void 0===A?void 0:A.value)?null===(N=e.mobileWidth)||void 0===N?void 0:N.dim:null===(L=e.width)||void 0===L?void 0:L.dim,mobileHeight:(0,O.xc)(null===(V=e.mobileHeight)||void 0===V?void 0:V.value)||(0,O.xc)(null===(D=e.height)||void 0===D?void 0:D.value),mobileHeightDim:(0,O.xc)(null===(z=e.mobileHeight)||void 0===z?void 0:z.value)?null===(U=e.mobileHeight)||void 0===U?void 0:U.dim:null===(G=e.height)||void 0===G?void 0:G.dim,mobileBorderRadiusAll:(0,O.ok)(null===(j=e.mobileBorderRadius)||void 0===j?void 0:j.all)||(0,O.ok)(null===(X=e.borderRadius)||void 0===X?void 0:X.all),mobileBorderRadiusTopLeft:(0,O.ok)(null===(Y=e.mobileBorderRadius)||void 0===Y?void 0:Y.topLeft)||(0,O.ok)(null===(Q=e.mobileBorderRadius)||void 0===Q?void 0:Q.all)||(0,O.ok)(null===(Z=e.borderRadius)||void 0===Z?void 0:Z.topLeft)||(0,O.ok)(null===(te=e.borderRadius)||void 0===te?void 0:te.all),mobileBorderRadiusBottomLeft:(0,O.ok)(null===(le=e.mobileBorderRadius)||void 0===le?void 0:le.bottomLeft)||(0,O.ok)(null===(ae=e.mobileBorderRadius)||void 0===ae?void 0:ae.all)||(0,O.ok)(null===(ne=e.borderRadius)||void 0===ne?void 0:ne.bottomLeft)||(0,O.ok)(null===(se=e.borderRadius)||void 0===se?void 0:se.all),mobileBorderRadiusTopRight:(0,O.ok)(null===(me=e.mobileBorderRadius)||void 0===me?void 0:me.topRight)||(0,O.ok)(null===(ce=e.mobileBorderRadius)||void 0===ce?void 0:ce.all)||(0,O.ok)(null===(ue=e.borderRadius)||void 0===ue?void 0:ue.topRight)||(0,O.ok)(null===(be=e.borderRadius)||void 0===be?void 0:be.all),mobileBorderRadiusBottomRight:(0,O.ok)(null===(fe=e.mobileBorderRadius)||void 0===fe?void 0:fe.bottomRight)||(0,O.ok)(null===(ve=e.mobileBorderRadius)||void 0===ve?void 0:ve.all)||(0,O.ok)(null===(_e=e.borderRadius)||void 0===_e?void 0:_e.bottomRight)||(0,O.ok)(null===(Ee=e.borderRadius)||void 0===Ee?void 0:Ee.all),mobileBoxShadowInset:null!=(null===(Se=e.mobileBoxShadow)||void 0===Se?void 0:Se.inset)?e.mobileBoxShadow.inset:(null===(ye=e.boxShadow)||void 0===ye?void 0:ye.inset)||!1,mobileBoxShadowHOffset:(0,O.ok)(null===(we=e.mobileBoxShadow)||void 0===we?void 0:we.hOffset)||(0,O.ok)(null===(ke=e.boxShadow)||void 0===ke?void 0:ke.hOffset),mobileBoxShadowVOffset:(0,O.ok)(null===(Be=e.mobileBoxShadow)||void 0===Be?void 0:Be.vOffset)||(0,O.ok)(null===(Re=e.boxShadow)||void 0===Re?void 0:Re.vOffset),mobileBoxShadowBlurRadius:(0,O.ok)(null===(xe=e.mobileBoxShadow)||void 0===xe?void 0:xe.blurRadius)||(0,O.ok)(null===(Te=e.boxShadow)||void 0===Te?void 0:Te.blurRadius),mobileBoxShadowSpreadRadius:(0,O.ok)(null===(Ie=e.mobileBoxShadow)||void 0===Ie?void 0:Ie.spreadRadius)||(0,O.ok)(null===(Ae=e.boxShadow)||void 0===Ae?void 0:Ae.spreadRadius),mobileBoxShadowColor:(0,O.ok)(null===(Ce=e.mobileBoxShadow)||void 0===Ce?void 0:Ce.color)||(0,O.ok)(null===(Ne=e.boxShadow)||void 0===Ne?void 0:Ne.color),mobileAlign:(0,O.ok)(null===(Pe=e.mobileAlign)||void 0===Pe?void 0:Pe.value)||e.align,mobileVerticalAlign:(0,O.ok)((null===(Le=e.mobileVerticalAlign)||void 0===Le?void 0:Le.value)||e.valign),mobileDirection:(0,O.ok)(null===(Fe=e.mobileDirection)||void 0===Fe?void 0:Fe.value),mobileBackgroundColor:(0,O.ok)((null===(Oe=e.mobileBackgroundColor)||void 0===Oe?void 0:Oe.value)||e.backgroundColor||""),mobileBackgroundImage:"none"!==(null===(Ve=e.mobileBackgroundImage[0])||void 0===Ve?void 0:Ve.value)?null===(Me=e.mobileBackgroundImage[0])||void 0===Me?void 0:Me.value:(null===(De=e.backgroundImage)||void 0===De?void 0:De[0].value)||"",mobileBackgroundPositionX:(0,O.ok)(null===(He=e.mobileBackgroundPositionX)||void 0===He?void 0:He.value)||(0,O.ok)(null===(ze=e.backgroundPositionX)||void 0===ze?void 0:ze.value),mobileBackgroundPositionY:(0,O.ok)(null===(We=e.mobileBackgroundPositionY)||void 0===We?void 0:We.value)||(0,O.ok)(null===(Ue=e.backgroundPositionY)||void 0===Ue?void 0:Ue.value),mobileBackgroundRepeat:!(null===($e=e.mobileBackgroundRepeat)||void 0===$e||!$e.value)||e.backgroundRepeat||"none",mobilePaddingTop:(0,O.ok)(e.mobilePadding.all)||(0,O.ok)(e.mobilePadding.top)||(0,O.ok)(null===(Ge=e.padding)||void 0===Ge?void 0:Ge.all)||(0,O.ok)(null===(je=e.padding)||void 0===je?void 0:je.top),mobilePaddingLeft:(0,O.ok)(e.mobilePadding.all)||(0,O.ok)(e.mobilePadding.left)||(0,O.ok)(null===(Xe=e.padding)||void 0===Xe?void 0:Xe.all)||(0,O.ok)(null===(qe=e.padding)||void 0===qe?void 0:qe.left),mobilePaddingRight:(0,O.ok)(e.mobilePadding.all)||(0,O.ok)(e.mobilePadding.right)||(0,O.ok)(null===(Ye=e.padding)||void 0===Ye?void 0:Ye.all)||(0,O.ok)(null===(Ke=e.padding)||void 0===Ke?void 0:Ke.right),mobilePaddingBottom:(0,O.ok)(e.mobilePadding.all)||(0,O.ok)(e.mobilePadding.bottom)||(0,O.ok)(null===(Qe=e.padding)||void 0===Qe?void 0:Qe.all)||(0,O.ok)(null===(Je=e.padding)||void 0===Je?void 0:Je.bottom),mobilePaddingTopBottom:(0,O.ok)(e.mobilePadding.top)||(0,O.ok)(e.mobilePadding.bottom)||(0,O.ok)(null===(Ze=e.padding)||void 0===Ze?void 0:Ze.top)||(0,O.ok)(null===(et=e.padding)||void 0===et?void 0:et.bottom),mobilePaddingLeftRight:(0,O.ok)(e.mobilePadding.left)||(0,O.ok)(e.mobilePadding.right)||(0,O.ok)(null===(tt=e.padding)||void 0===tt?void 0:tt.left)||(0,O.ok)(null===(ot=e.padding)||void 0===ot?void 0:ot.right),exportAsPicture:null===e||void 0===e?void 0:e.exportAsPicture}),!(0,O.ok)(e.borderRadius.all)&&((0,O.ok)(e.borderRadius.topLeft)||(0,O.ok)(e.borderRadius.bottomLeft)||(0,O.ok)(e.borderRadius.topRight)||(0,O.ok)(e.borderRadius.bottomRight))?h(!1):h(!0),!(0,O.ok)(e.mobileBorderRadius.all)&&((0,O.ok)(e.mobileBorderRadius.topLeft)||(0,O.ok)(e.mobileBorderRadius.bottomLeft)||(0,O.ok)(e.mobileBorderRadius.topRight)||(0,O.ok)(e.mobileBorderRadius.bottomRight))||(0,O.ok)(e.mobileBorderRadius.all)&&((0,O.ok)(e.mobileBorderRadius.topLeft)||(0,O.ok)(e.mobileBorderRadius.bottomLeft)||(0,O.ok)(e.mobileBorderRadius.topRight)||(0,O.ok)(e.mobileBorderRadius.bottomRight))||!(0,O.ok)(e.borderRadius.all)&&!(0,O.ok)(e.mobileBorderRadius.all)&&((0,O.ok)(e.borderRadius.topLeft)||(0,O.ok)(e.borderRadius.bottomLeft)||(0,O.ok)(e.borderRadius.topRight)||(0,O.ok)(e.borderRadius.bottomRight))?f(!1):f(!0),R(""===e.backgroundImage[0].value),(0,O.ok)(e.padding.all)||!((0,O.ok)(e.padding.top)||(0,O.ok)(e.padding.right)||(0,O.ok)(e.padding.bottom)||(0,O.ok)(e.padding.left))||e.padding.top===e.padding.bottom&&e.padding.right===e.padding.left?C(!0):C(!1),!(0,O.ok)(e.mobilePadding.all)&&((0,O.ok)(e.mobilePadding.top)||(0,O.ok)(e.mobilePadding.right)||(0,O.ok)(e.mobilePadding.bottom)||(0,O.ok)(e.mobilePadding.left))&&(e.mobilePadding.top!==e.mobilePadding.bottom||e.mobilePadding.right!==e.mobilePadding.left)||!(0,O.ok)(null===(lt=e.padding)||void 0===lt?void 0:lt.all)&&((0,O.ok)(null===(it=e.padding)||void 0===it?void 0:it.top)||(0,O.ok)(null===(at=e.padding)||void 0===at?void 0:at.right)||(0,O.ok)(null===(rt=e.padding)||void 0===rt?void 0:rt.bottom)||(0,O.ok)(null===(nt=e.padding)||void 0===nt?void 0:nt.left))&&((null===(dt=e.padding)||void 0===dt?void 0:dt.top)!==(null===(st=e.padding)||void 0===st?void 0:st.bottom)||(null===(mt=e.padding)||void 0===mt?void 0:mt.right)!==(null===(ct=e.padding)||void 0===ct?void 0:ct.left))?P(!1):P(!0),F(e=>!!pe||e),M(e=>!(!pe&&!ge)||e),H(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),W(!!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),$(!!e.boxShadow),q(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset||!!e.boxShadow),K(!!e.width.value&&"column"!==e.type||!!e.height.value),J(!!e.mobileWidth.value||!!e.mobileHeight.value||!!e.width.value&&"column"!==e.type||!!e.height.value),ee(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||"repeat"!==e.backgroundRepeat||!e.backgroundRepeat,!!e.backgroundSize),oe(!!e.mobileBackgroundColor.value||!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||"repeat"!==e.backgroundRepeat||!e.backgroundRepeat,!!e.backgroundSize),ie(!!e.exportAsPicture||!!e.isContrastBlock),re(!!e.mobilePadding.all||0===e.mobilePadding.all||!!e.mobilePadding.top||0===e.mobilePadding.top||!!e.mobilePadding.bottom||0===e.mobilePadding.bottom||!!e.mobilePadding.left||0===e.mobilePadding.left||!!e.mobilePadding.right||0===e.mobilePadding.right||!!e.padding.all||0===e.padding.all||!!e.padding.top||0===e.padding.top||!!e.padding.bottom||0===e.padding.bottom||!!e.padding.left||0===e.padding.left||!!e.padding.right||0===e.padding.right),"List"===e.elementName?de(!0):de(!1)}},[a,e]);const be=(0,l.useCallback)(e=>{i(se===E.Tm?(0,d.A9)(e):(0,s.A9)(e))},[i,se]),fe=t=>{const l=a.getFieldsValue(!0),i=Object.keys(t)[0];let r;switch(m("%"===a.getFieldsValue(!0).widthDim?100:""),i){case"exportAsPicture":r={exportAsPicture:l.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":r={boxShadow:{hOffset:l.boxShadowHOffset,vOffset:l.boxShadowVOffset,blurRadius:l.boxShadowBlurRadius,spreadRadius:l.boxShadowSpreadRadius,color:l.boxShadowColor,inset:l.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":var n,d,s;if("borderAll"===l.borderPosition)r={border:{...E.iV,all:{...X.RH,...l.borderAll}}},a.setFieldsValue({borderLeft:X.RH,borderRight:X.RH,borderTop:X.RH,borderBottom:X.RH});else null!==(n=l.borderAll)&&void 0!==n&&n.width||null!==(d=l.borderAll)&&void 0!==d&&d.style||null!==(s=l.borderAll)&&void 0!==s&&s.color?(r={border:{all:null,left:l.borderAll,right:l.borderAll,top:l.borderAll,bottom:l.borderAll,[X.Vz[i]]:{...l[i],...t[i]}}},a.setFieldsValue({borderAll:null,borderLeft:l.borderAll,borderRight:l.borderAll,borderTop:l.borderAll,borderBottom:l.borderAll,[i]:{...l[i],...t[i]}})):(r={border:{all:null,left:l.borderLeft,right:l.borderRight,top:l.borderTop,bottom:l.borderBottom,[X.Vz[i]]:{...l[i],...t[i]}}},a.setFieldsValue({border:r.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if("mobileBorderAll"===l.mobileBorderPosition)r={mobileBorder:{...E.iV,all:{...X.RH,...l.mobileBorderAll,classNamePrefix:"em-mob-border_"+X.ax[i]+"-"}}},a.setFieldsValue({borderLeft:X.RH,borderRight:X.RH,borderTop:X.RH,borderBottom:X.RH});else{var c,u,p,g,h,b;const o=X.ax[i],n={...l[i],...t[i]},d=!(null!==n&&void 0!==n&&n.width)&&!(null!==n&&void 0!==n&&n.style)&&!(null!==n&&void 0!==n&&n.color);if(null!==(c=l.mobileBorder)&&void 0!==c&&null!==(u=c.all)&&void 0!==u&&u.width||null!==(p=l.mobileBorder)&&void 0!==p&&null!==(g=p.all)&&void 0!==g&&g.style||null!==(h=l.mobileBorder)&&void 0!==h&&null!==(b=h.all)&&void 0!==b&&b.color){const e=l.mobileBorderAll;r={mobileBorder:{all:null,left:e,right:e,top:e,bottom:e,[o]:d?null:{...n,classNamePrefix:"em-mob-border_"+o+"-"}}},a.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:e,mobileBorderRight:e,mobileBorderTop:e,mobileBorderBottom:e,[i]:n})}else{const t=e.mobileBorder||{},l=e=>{const o=t[e];return o&&(null!==o&&void 0!==o&&o.width||null!==o&&void 0!==o&&o.style||null!==o&&void 0!==o&&o.color)?o:null};r={mobileBorder:{all:null,left:"left"===o?d?null:{...n,classNamePrefix:"em-mob-border_left-"}:l("left"),right:"right"===o?d?null:{...n,classNamePrefix:"em-mob-border_right-"}:l("right"),top:"top"===o?d?null:{...n,classNamePrefix:"em-mob-border_top-"}:l("top"),bottom:"bottom"===o?d?null:{...n,classNamePrefix:"em-mob-border_bottom-"}:l("bottom")}},a.setFieldsValue({[i]:n})}}break;case"width":r={[i]:{value:t[i],dim:l.widthDim}};break;case"height":r={[i]:{value:t[i],dim:l.heightDim}};break;case"widthDim":r={width:{value:l.width,dim:t[i]}};break;case"heightDim":r={height:{value:l.height,dim:t[i]}};break;case"backgroundImage":R(""===t[i]),r={[i]:[{...e.backgroundImage[0],value:t[i]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":r={padding:{left:l.paddingLeft,right:l.paddingRight,top:l.paddingTop,bottom:l.paddingBottom,[X.yy[i]]:+t[i]}};break;case"paddingTopBottom":r={padding:{left:l.paddingLeft,right:l.paddingRight,top:+t[i],bottom:+t[i]}},l.paddingTop=l.paddingBottom=+t[i];break;case"paddingLeftRight":r={padding:{top:l.paddingTop,bottom:l.paddingBottom,left:+t[i],right:+t[i]}},l.paddingLeft=l.paddingRight=+t[i];break;case"borderRadiusAll":r={borderRadius:{[X.wF[i]]:+t[i]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":r={borderRadius:{topLeft:l.borderRadiusTopLeft,bottomLeft:l.borderRadiusBottomLeft,topRight:l.borderRadiusTopRight,bottomRight:l.borderRadiusBottomRight,[X.wF[i]]:+t[i]}};break;case"mobileWidth":r={[i]:{classNamePrefix:"em-mob-width-",value:t[i],dim:l.mobileWidthDim}};break;case"mobileWidthDim":r={mobileWidth:{classNamePrefix:"em-mob-width-",value:l.mobileWidth||100,dim:t[i]}};break;case"mobileHeight":r={[i]:{classNamePrefix:"em-mob-height-",value:t[i],dim:l.mobileHeightDim}};break;case"mobileHeightDim":r={mobileHeight:{classNamePrefix:"em-mob-height-",value:l.mobileHeight,dim:t[i]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":r={mobileBorderRadius:{[X.NW[i]]:t[i],classNamePrefix:"em-mob-border_radius_"+X.NW[i]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":r={mobileBoxShadow:{hOffset:l.mobileBoxShadowHOffset,vOffset:l.mobileBoxShadowVOffset,blurRadius:l.mobileBoxShadowBlurRadius,spreadRadius:l.mobileBoxShadowSpreadRadius,color:l.mobileBoxShadowColor,inset:l.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":r={[i]:{classNamePrefix:"em-mob-text_align-",value:t[i]}};break;case"mobileVerticalAlign":r={[i]:{classNamePrefix:"em-mob-vertical_align-",value:t[i]}};break;case"mobileDirection":r={[i]:{classNamePrefix:"em-mob-direction-",value:t[i]}};break;case"mobileBackgroundColor":r={[i]:{classNamePrefix:"em-mob-background_color-",value:t[i]}};break;case"mobileBackgroundImage":r={[i]:[{...e.mobileBackgroundImage[0],classNamePrefix:"em-mob-background_image-",value:t[i]}]};break;case"mobileBackgroundPositionX":r={[i]:{classNamePrefix:"em-mob-background_position_x-",value:t[i]}};break;case"mobileBackgroundPositionY":r={[i]:{classNamePrefix:"em-mob-background_position_y-",value:t[i]}};break;case"mobileBackgroundRepeat":r={[i]:{classNamePrefix:"em-mob-background_repeat-",value:t[i]}};break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":r={mobilePadding:{all:null,top:""!==l.mobilePaddingTop?l.mobilePaddingTop:null,right:""!==l.mobilePaddingRight?l.mobilePaddingRight:null,bottom:""!==l.mobilePaddingBottom?l.mobilePaddingBottom:null,left:""!==l.mobilePaddingLeft?l.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":l.mobilePaddingTop=l.mobilePaddingBottom=t[i],r={mobilePadding:{all:null,top:""!==l.mobilePaddingTop?l.mobilePaddingTop:null,right:""!==l.mobilePaddingRight?l.mobilePaddingRight:null,bottom:""!==l.mobilePaddingBottom?l.mobilePaddingBottom:null,left:""!==l.mobilePaddingLeft?l.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":l.mobilePaddingLeft=l.mobilePaddingRight=t[i],r={mobilePadding:{all:null,top:""!==l.mobilePaddingTop?l.mobilePaddingTop:null,right:""!==l.mobilePaddingRight?l.mobilePaddingRight:null,bottom:""!==l.mobilePaddingBottom?l.mobilePaddingBottom:null,left:""!==l.mobilePaddingLeft?l.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"backgroundPositionX":case"backgroundPositionY":r={[i]:isNaN(parseFloat(t[i].position))?t[i].position:t[i].position+t[i].unit};break;default:r=t}var f;"borderPosition"!==i&&"mobileBorderPosition"!==i&&(o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:r}),"mobileBorderRadiusAll"!==i&&"mobileBorderRadiusTopLeft"!==i&&"mobileBorderRadiusTopRight"!==i&&"mobileBorderRadiusBottomLeft"!==i&&"mobileBorderRadiusBottomRight"!==i&&be({...e,...r,mobileBorderRadius:{...e.mobileBorderRadius,...null===(f=r)||void 0===f?void 0:f.mobileBorderRadius},activateSection:null,changeKey:i}))};return l.createElement(c.lV,{form:a,layout:"vertical",name:"selected_td_form",initialValues:{horizontalPosition:"",horizontalUnit:"px",backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,width:"",height:"",widthDim:"",heightDim:"",align:"",valign:"",border:"",show:"all",borderPosition:X.uE[pe]||"borderAll",mobileBorderPosition:X.lS[ge]||"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:fe,autoComplete:"off",className:"element-controls"},v===E.ND&&w.styles?l.createElement("div",{className:"selected_form-mobile-props-wrapper",style:{display:v===E.ND&&w.styles?"flex":"none"}},l.createElement("div",{className:"selected_form-mobile-props-header"},!I&&l.createElement(c.m_,{title:t("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"},l.createElement(c.Fc,{className:"selected_form-mobile-props-title",message:t("Appearance on mobile devices"),type:"info"}))),l.createElement("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props"},l.createElement(Te,{form:a,elementSettings:e,boxShadow:u,mobileBordersShow:V,mobileBorderRadiusShow:z,mobileBoxShadowShow:j,mobileSizeShow:Q,mobileBackgroundShow:te,mobilePaddingShow:ae,mobilePaddingsExt:N,setMobilePaddingsExt:P,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:f,toggleShowMobileBorderHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{M(e=>!e),V?(t.mobileBorderAll=X.RH,t.mobileBorderTop=X.RH,t.mobileBorderBottom=X.RH,t.mobileBorderRight=X.RH,t.mobileBorderLeft=X.RH):t.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:t.mobileBorderAll.color,style:t.mobileBorderAll.style,width:t.mobileBorderAll.width}}}})})},toggleShowMobileBorderRadiusHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{W(e=>!e),z?(t.mobileBorderRadiusAll=null,f(!0)):t.mobileBorderRadiusAll=5,o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:t.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},toggleShowMobileBoxShadowHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{q(e=>!e),j?(t.mobileBoxShadowInset=!1,t.mobileBoxShadowHOffset=null,t.mobileBoxShadowVOffset=null,t.mobileBoxShadowBlurRadius=null,t.mobileBoxShadowSpreadRadius=null,t.mobileBoxShadowColor=""):(t.mobileBoxShadowInset=!1,t.mobileBoxShadowHOffset=5,t.mobileBoxShadowVOffset=5,t.mobileBoxShadowBlurRadius=10,t.mobileBoxShadowSpreadRadius=-5,t.mobileBoxShadowColor="#000000"),o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:t.mobileBoxShadowBlurRadius,color:t.mobileBoxShadowColor,hOffset:t.mobileBoxShadowHOffset,inset:t.mobileBoxShadowInset,spreadRadius:t.mobileBoxShadowSpreadRadius,vOffset:t.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},toggleShowMobileSizeHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{J(e=>!e),Q&&(t.mobileWidth="",t.mobileHeight="",o({operation:E.Ru.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-"}}}))})},toggleShowMobileBackgroundHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{oe(e=>!e),t.mobileBackgroundColor=te?"":"#E5E5E5",o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:t.mobileBackgroundColor}}})})},toggleShowMobilePaddingHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{re(e=>!e),ae&&(t.mobilePaddingLeftRight="",t.mobilePaddingLeft="",t.mobilePaddingRight="",t.mobilePaddingTopBottom="",t.mobilePaddingTop="",t.mobilePaddingBottom="",o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobilePadding:{all:null,top:null,right:null,bottom:null,left:null,classNamePrefix:"em-mob-padding_"}}}))})}}))):l.createElement(l.Fragment,null,!I&&l.createElement(c.m_,{title:t("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"},l.createElement(c.Fc,{className:"selected_form-mobile-props-title",message:t("Appearance on mobile devices"),type:"info"})),l.createElement("div",{id:"selected_element_form_desktop_props"},l.createElement(Re,{form:a,elementSettings:e,boxShadow:u,bordersShow:L,borderRadiusShow:D,boxShadowShow:U,backgroundShow:Z,backgroundImageEmpty:B,backgroundRepeatOptions:me,sizeShow:Y,maxWidthValue:r,modificationShow:le,paddingsExt:A,oneBorderRadiusValue:g,setOneBorderRadiusValue:h,elementListShow:ne,togglePaddingHandler:()=>{C(e=>!e);const t=a.getFieldsValue(!0);A||(t.paddingLeftRight=t.paddingLeft,t.paddingTopBottom=t.paddingTop,t.paddingRight=t.paddingLeft,t.paddingBottom=t.paddingTop,o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:t.paddingTopBottom,bottom:t.paddingTopBottom,left:t.paddingLeftRight,right:t.paddingLeftRight}}}))},toggleShowBorderHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{F(e=>!e),L?(t.borderAll=X.RH,t.borderTop=X.RH,t.borderBottom=X.RH,t.borderRight=X.RH,t.borderLeft=X.RH):t.borderAll={width:1,color:"#E5E5E5",style:"solid"},o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:t.borderAll.color,style:t.borderAll.style,width:t.borderAll.width}}}})})},toggleShowBorderRadiusHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{H(e=>!e),D?(t.borderRadiusAll=0,h(!0)):t.borderRadiusAll=5,o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:t.borderRadiusAll}}})})},toggleShowBoxShadowHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{$(e=>!e),U?(t.boxShadowInset=!1,t.boxShadowHOffset=null,t.boxShadowVOffset=null,t.boxShadowBlurRadius=null,t.boxShadowSpreadRadius=null,t.boxShadowColor=""):(t.boxShadowInset=!1,t.boxShadowHOffset=5,t.boxShadowVOffset=5,t.boxShadowBlurRadius=10,t.boxShadowSpreadRadius=-5,t.boxShadowColor="#000000"),o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:t.boxShadowBlurRadius,color:t.boxShadowColor,hOffset:t.boxShadowHOffset,inset:t.boxShadowInset,spreadRadius:t.boxShadowSpreadRadius,vOffset:t.boxShadowVOffset}}})})},toggleShowSizeHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{K(e=>!e),Y&&(t.width="",t.height="",o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{width:{value:null,dim:"px"},height:{value:null,dim:"px"}}}))})},toggleShowBackgroundHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{ee(e=>!e),Z?(t.backgroundColor="",t.backgroundImage="",t.backgroundPositionX="",t.backgroundPositionY="",t.backgroundRepeat="none",t.backgroundSize="",R(!0)):(t.backgroundColor="#E5E5E5",t.backgroundSize="",t.backgroundRepeat="none"),o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:t.backgroundColor,backgroundImage:[{type:"url",value:t.backgroundImage}],backgroundPositionX:t.backgroundPositionX,backgroundPositionY:t.backgroundPositionY,backgroundRepeat:t.backgroundRepeat,backgroundSize:t.backgroundSize}})})},toggleShowModificationHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{ie(e=>!e),le&&(t.exportAsPicture=!1,t.isContrastBlock=!1,o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1,isContrastBlock:!1}}))})},handleChangeValues:fe}))))},Ae=({form:e,elementSettings:t,boxShadow:o,bordersShow:i,borderRadiusShow:a,boxShadowShow:r,backgroundShow:n,backgroundImageEmpty:d,backgroundRepeatOptions:s,sizeShow:m,maxWidthValue:u,modificationShow:p,paddingShow:g,paddingsExt:h,oneBorderRadiusValue:b,setOneBorderRadiusValue:E,togglePaddingHandler:S,toggleShowPaddingHandler:w,toggleShowBorderHandler:k,toggleShowBorderRadiusHandler:R,toggleShowBoxShadowHandler:x,toggleShowSizeHandler:T,toggleShowBackgroundHandler:A,toggleShowModificationHandler:N,handleChangeValues:P})=>{const{__:L}=(0,_.s9)(),{token:V}=(0,c.rd)(),M=(0,y.rD)();return l.createElement(l.Fragment,null,l.createElement(c.Fc,{className:"selected_form-desktop-props-title",message:L("Appearance on mobile devices"),type:"info"}),l.createElement(c.fI,{gutter:20,style:{marginBottom:4}},l.createElement(c.fv,{span:12},l.createElement(le.A,{form:e,elementSettings:t})),l.createElement(c.fv,{span:12,style:{textAlign:"right"}},l.createElement(B,{form:e,elementSettings:t}))),M.formCellFieldPaddingsEnabled&&l.createElement(c.y9,{title:L("Padding"),collapsible:!0,open:g,onToggle:w,dividerTop:!0},l.createElement(c.L1,{extended:h,onToggleExtended:S,labels:{horizontal:L("Horizontal padding"),vertical:L("Vertical padding"),left:L("Left padding"),right:L("Right padding"),top:L("Top padding"),bottom:L("Bottom padding"),individual:L("Individual padding")}})),l.createElement(c.y9,{title:L("Size"),collapsible:!0,open:m,onToggle:T,dividerTop:!0},l.createElement(c.n6,{maxWidth:u,dimensionSelect:O.z$,showMinMax:!0,minWidthDimensionSelect:O.z$,maxWidthDimensionSelect:O.z$,labels:{width:L("Width"),height:L("Height"),minWidth:L("Minimum width"),maxWidth:L("Maximum width")}})),l.createElement(c.y9,{title:L("Background"),collapsible:!0,open:n,onToggle:A,dividerTop:!0},l.createElement(ke,{form:e,backgroundImageEmpty:d,appConfig:M,token:V,elementSettings:t,backgroundRepeatOptions:s,handleChangeValues:P})),M.formFieldBorderEnabled&&l.createElement(c.y9,{title:L("Borders"),collapsible:!0,open:i,onToggle:k,dividerTop:!0},l.createElement(f.A,{form:e,elementSettings:t})),M.formFieldBorderRadiusEnabled&&l.createElement(c.y9,{title:L("Border radius"),collapsible:!0,open:a,onToggle:R,dividerTop:!0},l.createElement(v.A,{form:e,oneBorderRadiusValue:b,setOneBorderRadiusValue:E,elementSettings:t})),M.formFieldBoxShadowEnabled&&l.createElement(c.y9,{title:L("Box shadow"),collapsible:!0,open:r,onToggle:x,dividerTop:!0},l.createElement(I,null)),M.formFieldExportAsPictureEnabled&&l.createElement(c.y9,{title:L("Export settings"),collapsible:!0,open:p,onToggle:N,dividerTop:!0},l.createElement(me,{form:e,elementSettings:t})),M.formFieldVisibilityEnabled&&l.createElement(c.y9,{title:L("Display control & Direction"),dividerTop:!0},l.createElement(C,{elementSettings:t,form:e,directionControl:l.createElement(Se,{elementSettings:t,form:e})})),M.formFieldAmpVisibilityEnabled&&t.ampShow&&l.createElement(c.y9,{title:L("AMP visibility"),dividerTop:!0},l.createElement(F,null)))},Ce=({form:e,elementSettings:t,mobileBoxShadow:o,mobileBordersShow:i,mobileBorderRadiusShow:a,mobileBoxShadowShow:r,mobileSizeShow:n,mobileBackgroundShow:d,mobilePaddingShow:s,mobilePaddingsExt:m,setMobilePaddingsExt:u,oneMobileBorderRadiusValue:p,setOneMobileBorderRadiusValue:g,backgroundRepeatOptions:h,toggleShowMobileBorderHandler:b,toggleShowMobileBorderRadiusHandler:E,toggleShowMobileBoxShadowHandler:S,toggleShowMobileSizeHandler:w,toggleShowMobileBackgroundHandler:k,toggleShowMobilePaddingHandler:R})=>{const{__:x}=(0,_.s9)(),{token:T}=(0,c.rd)(),A=(0,y.rD)();return l.createElement(l.Fragment,null,l.createElement(c.fI,{gutter:20,style:{paddingBottom:4}},l.createElement(c.fv,{span:12},l.createElement(de,{form:e,elementSettings:t,imgParent:!0})),l.createElement(c.fv,{span:12,style:{textAlign:"right"}},l.createElement(B,{form:e,elementSettings:t,typeOfForm:"mobile"}))),A.formCellFieldPaddingsEnabled&&l.createElement(c.y9,{title:x("Padding"),collapsible:!0,open:s,onToggle:R,dividerTop:!0},l.createElement(xe,{form:e,elementSettings:t,mobilePaddingsExt:m,setMobilePaddingsExt:u})),l.createElement(c.y9,{title:x("Size"),collapsible:!0,open:n,onToggle:w,dividerTop:!0},l.createElement(c.fI,{gutter:10,style:{paddingBottom:8}},l.createElement(c.fv,{span:12},l.createElement("div",{style:{marginBottom:2*T.formItemMarginBottomXS}},l.createElement(M,{form:e,name:"mobileWidth",elementSettings:t}))),l.createElement(c.fv,{span:12},l.createElement("div",{style:{marginBottom:T.formItemMarginBottomXS}},l.createElement(D,{form:e,name:"mobileHeight",elementSettings:t}))))),l.createElement(c.y9,{title:x("Background"),collapsible:!0,open:d,onToggle:k,dividerTop:!0},l.createElement("div",{style:{marginBottom:(A.formDivFieldBackgroundImageEnabled,T.formItemMarginBottomMD+4)}},l.createElement(ue,{form:e,elementSettings:t,label:x("Background color")})),!1),A.formFieldBorderEnabled&&l.createElement(c.y9,{title:x("Borders"),collapsible:!0,open:i,onToggle:b,dividerTop:!0},l.createElement(f.A,{form:e,typeOfForm:"mobile"})),A.formFieldBorderRadiusEnabled&&l.createElement(c.y9,{title:x("Border radius"),collapsible:!0,open:a,onToggle:E,dividerTop:!0},l.createElement(v.A,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:p,setOneBorderRadiusValue:g,elementSettings:t})),A.formFieldBoxShadowEnabled&&l.createElement(c.y9,{title:x("Box shadow"),collapsible:!0,open:r,onToggle:S,dividerTop:!0},l.createElement(I,{typeOfForm:"mobile",form:e,elementSettings:t})),A.formFieldVisibilityEnabled&&l.createElement(c.y9,{title:x("Display control & Direction"),dividerTop:!0},l.createElement(C,{elementSettings:t,form:e,directionControl:l.createElement(Se,{elementSettings:t,form:e,typeOfForm:"mobile"})})),A.formFieldAmpVisibilityEnabled&&t.ampShow&&l.createElement(c.y9,{title:x("AMP visibility"),dividerTop:!0},l.createElement(F,null)))},Ne=({elementSettings:e})=>{const{__:t}=(0,_.s9)(),o=(0,S.XW)(),[i]=c.lV.useForm(),[a,r]=(0,l.useState)({}),[d,s]=(0,l.useState)(!0),[m,u]=(0,l.useState)({}),[p,g]=(0,l.useState)(!0),h=(0,n.d4)(G.Ct),b=(0,n.d4)(G.CS),[f,v]=((0,y.rD)(),(0,l.useState)(""===e.backgroundImage[0].value)),w=(0,n.d4)(G.Fv),k=(0,n.d4)(G.yy),B=w&&"bottom"!==k,[R,x]=(0,l.useState)(!1),[T,I]=(0,l.useState)(!1),[A,C]=(0,l.useState)(!1),[N,P]=(0,l.useState)(!1),[L,F]=(0,l.useState)(!1),[V,M]=(0,l.useState)(!1),[D,H]=(0,l.useState)(!1),[z,W]=(0,l.useState)(!1),[U,$]=(0,l.useState)(!1),[j,q]=(0,l.useState)(!1),[Y,K]=(0,l.useState)(!1),[Q,J]=(0,l.useState)(!1),[Z,ee]=(0,l.useState)(!1),[te,oe]=(0,l.useState)(!1),[le,ie]=(0,l.useState)(!1),[ae,re]=(0,l.useState)(""),ne=[{label:t("Not defined"),value:"none"},{label:t("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:t("Repeat background (repeat)"),value:"repeat"},{label:t("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:t("Repeat background vertically (repeat-y)"),value:"repeat-y"}],de=(t("Not defined"),t("Contain"),t("Cover"),e.border),se=e.mobileBorder,me=Object.keys(de).find(e=>{var t,o,l;return(null===(t=de[e])||void 0===t?void 0:t.width)||(null===(o=de[e])||void 0===o?void 0:o.style)||(null===(l=de[e])||void 0===l?void 0:l.color)}),ce=Object.keys(se).find(e=>{var t,o,l;return(null===(t=se[e])||void 0===t?void 0:t.width)||(null===(o=se[e])||void 0===o?void 0:o.style)||(null===(l=se[e])||void 0===l?void 0:l.color)}),ue=e=>e&&(null!==e&&void 0!==e&&e.width||null!==e&&void 0!==e&&e.style||null!==e&&void 0!==e&&e.color)?e:"";(0,l.useEffect)(()=>{if(e){var t,o,l,a,n,d,m,c,p,h,b,f,_,E,S,y,w,k,B,R,T,A,N,L,V,D,z,U,G,j,X,Y,Q,Z,te,le,ae,re,ne,de,se,pe;const ge=e.boxShadow,he=e.mobileBoxShadow;r(ge),u(he),i.setFieldsValue({...e,width:null===(t=e.width)||void 0===t?void 0:t.value,widthDim:null===(o=e.width)||void 0===o?void 0:o.dim,height:null===(l=e.height)||void 0===l?void 0:l.value,heightDim:null===(a=e.height)||void 0===a?void 0:a.dim,maxWidth:null===(n=e.maxWidth)||void 0===n?void 0:n.value,maxWidthDim:null===(d=e.maxWidth)||void 0===d?void 0:d.dim,minWidth:null===(m=e.minWidth)||void 0===m?void 0:m.value,minWidthDim:null===(c=e.minWidth)||void 0===c?void 0:c.dim,backgroundImage:e.backgroundImage[0].value,show:e.show?e.show:"all",borderAll:(0,O.ok)(e.border.all),borderTop:(0,O.ok)(e.border.top),borderBottom:(0,O.ok)(e.border.bottom),borderRight:(0,O.ok)(e.border.right),borderLeft:(0,O.ok)(e.border.left),mobileBorderAll:ue(e.mobileBorder.all)||!(ue(e.mobileBorder.top)||ue(e.mobileBorder.bottom)||ue(e.mobileBorder.right)||ue(e.mobileBorder.left))&&ue(e.border.all),mobileBorderTop:ue(e.mobileBorder.top)||!ue(e.mobileBorder.all)&&ue(e.border.top),mobileBorderBottom:ue(e.mobileBorder.bottom)||!ue(e.mobileBorder.all)&&ue(e.border.bottom),mobileBorderRight:ue(e.mobileBorder.right)||!ue(e.mobileBorder.all)&&ue(e.border.right),mobileBorderLeft:ue(e.mobileBorder.left)||!ue(e.mobileBorder.all)&&ue(e.border.left),paddingTop:(0,O.ok)(e.padding.all)||(0,O.ok)(e.padding.top),paddingLeft:(0,O.ok)(e.padding.all)||(0,O.ok)(e.padding.left),paddingRight:(0,O.ok)(e.padding.all)||(0,O.ok)(e.padding.right),paddingBottom:(0,O.ok)(e.padding.all)||(0,O.ok)(e.padding.bottom),paddingLeftRight:(0,O.ok)(null===(p=e.padding)||void 0===p?void 0:p.left)||(0,O.ok)(null===(h=e.padding)||void 0===h?void 0:h.right),paddingTopBottom:(0,O.ok)(null===(b=e.padding)||void 0===b?void 0:b.top)||(0,O.ok)(null===(f=e.padding)||void 0===f?void 0:f.bottom),borderRadiusAll:(0,O.ok)(e.borderRadius.all),borderRadiusTopLeft:(0,O.ok)(e.borderRadius.topLeft),borderRadiusBottomLeft:(0,O.ok)(e.borderRadius.bottomLeft),borderRadiusTopRight:(0,O.ok)(e.borderRadius.topRight),borderRadiusBottomRight:(0,O.ok)(e.borderRadius.bottomRight),boxShadowInset:(0,O.ok)(null===(_=e.boxShadow)||void 0===_?void 0:_.inset)||!1,boxShadowHOffset:(0,O.ok)(null===(E=e.boxShadow)||void 0===E?void 0:E.hOffset),boxShadowVOffset:(0,O.ok)(null===(S=e.boxShadow)||void 0===S?void 0:S.vOffset),boxShadowBlurRadius:(0,O.ok)(null===(y=e.boxShadow)||void 0===y?void 0:y.blurRadius),boxShadowSpreadRadius:(0,O.ok)(null===(w=e.boxShadow)||void 0===w?void 0:w.spreadRadius),boxShadowColor:(0,O.ok)(null===(k=e.boxShadow)||void 0===k?void 0:k.color),mobileWidth:(0,O.xc)(null===(B=e.mobileWidth)||void 0===B?void 0:B.value),mobileWidthDim:null===(R=e.mobileWidth)||void 0===R?void 0:R.dim,mobileHeight:(0,O.xc)(null===(T=e.mobileHeight)||void 0===T?void 0:T.value),mobileHeightDim:null===(A=e.mobileHeight)||void 0===A?void 0:A.dim,mobileBorderRadiusAll:(0,O.ok)(e.mobileBorderRadius.all),mobileBorderRadiusTopLeft:(0,O.ok)(null!==e.mobileBorderRadius.topLeft?e.mobileBorderRadius.topLeft:e.mobileBorderRadius.all),mobileBorderRadiusBottomLeft:(0,O.ok)(null!==e.mobileBorderRadius.bottomLeft?e.mobileBorderRadius.bottomLeft:e.mobileBorderRadius.all),mobileBorderRadiusTopRight:(0,O.ok)(null!==e.mobileBorderRadius.topRight?e.mobileBorderRadius.topRight:e.mobileBorderRadius.all),mobileBorderRadiusBottomRight:(0,O.ok)(null!==e.mobileBorderRadius.bottomRight?e.mobileBorderRadius.bottomRight:e.mobileBorderRadius.all),mobileBoxShadowInset:(0,O.ok)(null===(N=e.mobileBoxShadow)||void 0===N?void 0:N.inset)||!1,mobileBoxShadowHOffset:(0,O.ok)(null===(L=e.mobileBoxShadow)||void 0===L?void 0:L.hOffset),mobileBoxShadowVOffset:(0,O.ok)(null===(V=e.mobileBoxShadow)||void 0===V?void 0:V.vOffset),mobileBoxShadowBlurRadius:(0,O.ok)(null===(D=e.mobileBoxShadow)||void 0===D?void 0:D.blurRadius),mobileBoxShadowSpreadRadius:(0,O.ok)(null===(z=e.mobileBoxShadow)||void 0===z?void 0:z.spreadRadius),mobileBoxShadowColor:(0,O.ok)(null===(U=e.mobileBoxShadow)||void 0===U?void 0:U.color),mobileAlign:(0,O.ok)(null===(G=e.mobileAlign)||void 0===G?void 0:G.value),mobileVerticalAlign:(0,O.ok)(null===(j=e.mobileVerticalAlign)||void 0===j?void 0:j.value),mobileDirection:(0,O.ok)(null===(X=e.mobileDirection)||void 0===X?void 0:X.value),mobileBackgroundColor:(0,O.ok)("none"!==(null===(Y=e.mobileBackgroundColor)||void 0===Y?void 0:Y.value)?null===(Q=e.mobileBackgroundColor)||void 0===Q?void 0:Q.value:""),mobileBackgroundImage:"none"!==e.mobileBackgroundImage[0].value?e.mobileBackgroundImage[0].value:"",mobileBackgroundPositionX:(0,O.ok)(null===(Z=e.mobileBackgroundPositionX)||void 0===Z?void 0:Z.value),mobileBackgroundPositionY:(0,O.ok)(null===(te=e.mobileBackgroundPositionY)||void 0===te?void 0:te.value),mobileBackgroundRepeat:null!==(le=e.mobileBackgroundRepeat)&&void 0!==le&&le.value?null===(ae=e.mobileBackgroundRepeat)||void 0===ae?void 0:ae.value:"none",mobilePaddingTop:(0,O.ok)(e.mobilePadding.all)||(0,O.ok)(e.mobilePadding.top),mobilePaddingLeft:(0,O.ok)(e.mobilePadding.all)||(0,O.ok)(e.mobilePadding.left),mobilePaddingRight:(0,O.ok)(e.mobilePadding.all)||(0,O.ok)(e.mobilePadding.right),mobilePaddingBottom:(0,O.ok)(e.mobilePadding.all)||(0,O.ok)(e.mobilePadding.bottom),mobilePaddingTopBottom:(0,O.ok)(e.mobilePadding.top)||(0,O.ok)(e.mobilePadding.bottom),mobilePaddingLeftRight:(0,O.ok)(e.mobilePadding.left)||(0,O.ok)(e.mobilePadding.right),exportAsPicture:null===e||void 0===e?void 0:e.exportAsPicture}),!(0,O.ok)(e.borderRadius.all)&&((0,O.ok)(e.borderRadius.topLeft)||(0,O.ok)(e.borderRadius.bottomLeft)||(0,O.ok)(e.borderRadius.topRight)||(0,O.ok)(e.borderRadius.bottomRight))?s(!1):s(!0),!(0,O.ok)(e.mobileBorderRadius.all)&&((0,O.ok)(e.mobileBorderRadius.topLeft)||(0,O.ok)(e.mobileBorderRadius.bottomLeft)||(0,O.ok)(e.mobileBorderRadius.topRight)||(0,O.ok)(e.mobileBorderRadius.bottomRight))?g(!1):g(!0),v(""===e.backgroundImage[0].value),(0,O.ok)(e.padding.all)||!((0,O.ok)(e.padding.top)||(0,O.ok)(e.padding.right)||(0,O.ok)(e.padding.bottom)||(0,O.ok)(e.padding.left))||e.padding.top===e.padding.bottom&&e.padding.right===e.padding.left?x(!0):x(!1),(0,O.ok)(e.mobilePadding.all)||!((0,O.ok)(e.mobilePadding.top)||(0,O.ok)(e.mobilePadding.right)||(0,O.ok)(e.mobilePadding.bottom)||(0,O.ok)(e.mobilePadding.left))||e.mobilePadding.top===e.mobilePadding.bottom&&e.mobilePadding.right===e.mobilePadding.left?I(!0):I(!1),C(e=>!!me||e),P(e=>!(!me&&!ce)||e),F(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),M(!!e.mobileBorderRadius.all||!!e.mobileBorderRadius.topLeft||!!e.mobileBorderRadius.bottomLeft||!!e.mobileBorderRadius.topRight||!!e.mobileBorderRadius.bottomRight),H(!!e.boxShadow),W(!!e.mobileBoxShadow.blurRadius||!!e.mobileBoxShadow.color||!!e.mobileBoxShadow.hOffset||!!e.mobileBoxShadow.inset||!!e.mobileBoxShadow.spreadRadius||!!e.mobileBoxShadow.vOffset),$(!!e.width.value||!!e.height.value||!!e.minWidth.value||!!e.maxWidth.value),q(!!e.mobileWidth.value||!!e.mobileHeight.value),K(!!e.backgroundColor||!!e.backgroundImage[0].value||!!e.backgroundPositionY||!!e.backgroundPositionX||"repeat"!==e.backgroundRepeat||!e.backgroundRepeat,!!e.backgroundSize),J(!!e.mobileBackgroundColor.value),ee(!!e.exportAsPicture),oe(!(null===(re=e.padding)||void 0===re||!re.all)||!(null===(ne=e.padding)||void 0===ne||!ne.top)||!(null===(de=e.padding)||void 0===de||!de.bottom)||!(null===(se=e.padding)||void 0===se||!se.left)||!(null===(pe=e.padding)||void 0===pe||!pe.right)),ie(!!e.mobilePadding.all||!!e.mobilePadding.top||!!e.mobilePadding.bottom||!!e.mobilePadding.left||!!e.mobilePadding.right)}},[i,e]);const pe=t=>{const l=i.getFieldsValue(!0),a=Object.keys(t)[0];let r;switch(re("%"===i.getFieldsValue(!0).widthDim?100:""),a){case"exportAsPicture":r={exportAsPicture:l.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":r={boxShadow:{hOffset:l.boxShadowHOffset,vOffset:l.boxShadowVOffset,blurRadius:l.boxShadowBlurRadius,spreadRadius:l.boxShadowSpreadRadius,color:l.boxShadowColor,inset:l.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":var n,d,s;if("borderAll"===l.borderPosition)r={border:{...E.iV,all:{...X.RH,...l.borderAll}}},i.setFieldsValue({borderLeft:X.RH,borderRight:X.RH,borderTop:X.RH,borderBottom:X.RH});else null!==(n=l.borderAll)&&void 0!==n&&n.width||null!==(d=l.borderAll)&&void 0!==d&&d.style||null!==(s=l.borderAll)&&void 0!==s&&s.color?(r={border:{all:null,left:l.borderAll,right:l.borderAll,top:l.borderAll,bottom:l.borderAll,[X.Vz[a]]:{...l[a],...t[a]}}},i.setFieldsValue({borderAll:null,borderLeft:l.borderAll,borderRight:l.borderAll,borderTop:l.borderAll,borderBottom:l.borderAll,[a]:{...l[a],...t[a]}})):(r={border:{all:null,left:l.borderLeft,right:l.borderRight,top:l.borderTop,bottom:l.borderBottom,[X.Vz[a]]:{...l[a],...t[a]}}},i.setFieldsValue({border:r.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if("mobileBorderAll"===l.mobileBorderPosition)r={mobileBorder:{...E.iV,all:{...X.RH,...l.mobileBorderAll,classNamePrefix:"em-mob-border_"+X.ax[a]+"-"}}},i.setFieldsValue({borderLeft:X.RH,borderRight:X.RH,borderTop:X.RH,borderBottom:X.RH});else{var m,c,u,p,g,h;const o=X.ax[a],n={...l[a],...t[a]},d=!(null!==n&&void 0!==n&&n.width)&&!(null!==n&&void 0!==n&&n.style)&&!(null!==n&&void 0!==n&&n.color);if(null!==(m=l.mobileBorder)&&void 0!==m&&null!==(c=m.all)&&void 0!==c&&c.width||null!==(u=l.mobileBorder)&&void 0!==u&&null!==(p=u.all)&&void 0!==p&&p.style||null!==(g=l.mobileBorder)&&void 0!==g&&null!==(h=g.all)&&void 0!==h&&h.color){const e=l.mobileBorderAll;r={mobileBorder:{all:null,left:e,right:e,top:e,bottom:e,[o]:d?null:{...n,classNamePrefix:"em-mob-border_"+o+"-"}}},i.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:e,mobileBorderRight:e,mobileBorderTop:e,mobileBorderBottom:e,[a]:n})}else{const t=e.mobileBorder||{},l=e=>{const o=t[e];return o&&(null!==o&&void 0!==o&&o.width||null!==o&&void 0!==o&&o.style||null!==o&&void 0!==o&&o.color)?o:null};r={mobileBorder:{all:null,left:"left"===o?d?null:{...n,classNamePrefix:"em-mob-border_left-"}:l("left"),right:"right"===o?d?null:{...n,classNamePrefix:"em-mob-border_right-"}:l("right"),top:"top"===o?d?null:{...n,classNamePrefix:"em-mob-border_top-"}:l("top"),bottom:"bottom"===o?d?null:{...n,classNamePrefix:"em-mob-border_bottom-"}:l("bottom")}},i.setFieldsValue({[a]:n})}}break;case"width":r={[a]:{value:t[a],dim:l.widthDim}};break;case"height":r={[a]:{value:t[a],dim:l.heightDim}};break;case"widthDim":r={width:{value:l.width,dim:t[a]}};break;case"heightDim":r={height:{value:l.height,dim:t[a]}};break;case"maxWidth":r={[a]:{value:t[a],dim:l.maxWidthDim}};break;case"maxWidthDim":r={maxWidth:{value:l.maxWidth,dim:t[a]}};break;case"minWidth":r={[a]:{value:t[a],dim:l.minWidthDim}};break;case"minWidthDim":r={minWidth:{value:l.minWidth,dim:t[a]}};break;case"backgroundImage":v(""===t[a]),r={[a]:[{...e.backgroundImage[0],value:t[a]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":r={padding:{[X.yy[a]]:+t[a]}};break;case"paddingTopBottom":r={padding:{top:+t[a],bottom:+t[a]}},l.paddingTop=l.paddingBottom=+t[a];break;case"paddingLeftRight":r={padding:{left:+t[a],right:+t[a]}},l.paddingLeft=l.paddingRight=+t[a];break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":r={borderRadius:{[X.wF[a]]:+t[a]}};break;case"mobileWidth":r={[a]:{classNamePrefix:"em-mob-width-",value:t[a],dim:l.mobileWidthDim}};break;case"mobileWidthDim":r={mobileWidth:{classNamePrefix:"em-mob-width-",value:l.mobileWidth||100,dim:t[a]}};break;case"mobileHeight":r={[a]:{classNamePrefix:"em-mob-height-",value:t[a],dim:l.mobileHeightDim}};break;case"mobileHeightDim":r={mobileHeight:{classNamePrefix:"em-mob-height-",value:l.mobileHeight,dim:t[a]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":r={mobileBorderRadius:{[X.NW[a]]:t[a],classNamePrefix:"em-mob-border_radius_"+X.NW[a]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":r={mobileBoxShadow:{hOffset:l.mobileBoxShadowHOffset,vOffset:l.mobileBoxShadowVOffset,blurRadius:l.mobileBoxShadowBlurRadius,spreadRadius:l.mobileBoxShadowSpreadRadius,color:l.mobileBoxShadowColor,inset:l.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":r={[a]:{classNamePrefix:"em-mob-text_align-",value:t[a]}};break;case"mobileVerticalAlign":r={[a]:{classNamePrefix:"em-mob-vertical_align-",value:t[a]}};break;case"mobileBackgroundColor":r={[a]:{classNamePrefix:"em-mob-background_color-",value:t[a]}};break;case"mobileBackgroundImage":r={[a]:[{...e.mobileBackgroundImage[0],classNamePrefix:"em-mob-background_image-",value:t[a]}]};break;case"mobileBackgroundPositionX":r={[a]:{classNamePrefix:"em-mob-background_position_x-",value:t[a]}};break;case"mobileBackgroundPositionY":r={[a]:{classNamePrefix:"em-mob-background_position_x-",value:t[a]}};break;case"mobileBackgroundRepeat":r={[a]:{classNamePrefix:"em-mob-background_repeat-",value:t[a]}};break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":r={mobilePadding:{all:null,top:""!==l.mobilePaddingTop?l.mobilePaddingTop:null,right:""!==l.mobilePaddingRight?l.mobilePaddingRight:null,bottom:""!==l.mobilePaddingBottom?l.mobilePaddingBottom:null,left:""!==l.mobilePaddingLeft?l.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":l.mobilePaddingTop=l.mobilePaddingBottom=t[a],r={mobilePadding:{all:null,top:""!==l.mobilePaddingTop?l.mobilePaddingTop:null,right:""!==l.mobilePaddingRight?l.mobilePaddingRight:null,bottom:""!==l.mobilePaddingBottom?l.mobilePaddingBottom:null,left:""!==l.mobilePaddingLeft?l.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":l.mobilePaddingLeft=l.mobilePaddingRight=t[a],r={mobilePadding:{all:null,top:""!==l.mobilePaddingTop?l.mobilePaddingTop:null,right:""!==l.mobilePaddingRight?l.mobilePaddingRight:null,bottom:""!==l.mobilePaddingBottom?l.mobilePaddingBottom:null,left:""!==l.mobilePaddingLeft?l.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileDirection":r={[a]:{classNamePrefix:"em-mob-direction-",value:t[a]}};break;case"backgroundPositionX":case"backgroundPositionY":r={[a]:isNaN(parseFloat(t[a].position))?t[a].position:t[a].position+t[a].unit};break;default:r=t}"borderPosition"!==a&&"mobileBorderPosition"!==a&&o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:r})};return l.createElement(c.lV,{form:i,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:X.uE[me]||"borderAll",mobileBorderPosition:X.lS[ce]||"mobileBorderAll",borderColor:"",borderWidth:"",borderStyle:"",paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",borderRadiusAll:"",borderRadiusTopLeft:"",borderRadiusBottomLeft:"",borderRadiusTopRight:"",borderRadiusBottomRight:"",direction:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"",mobileBorder:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBoxShadow:"",mobileAlign:"",mobileDirection:"",mobileVerticalAlign:"",mobileBackgroundColor:"",mobileBackgroundImage:"",mobilePaddingTop:"",mobilePaddingLeft:"",mobilePaddingRight:"",mobilePaddingBottom:""},onValuesChange:pe,autoComplete:"off",className:"element-controls"},!B&&l.createElement(c.m_,{title:t("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"},l.createElement(c.Fc,{className:"selected_form-mobile-props-title",message:t("Appearance on mobile devices"),type:"info"})),h===E.ND&&b.styles?l.createElement("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props"},l.createElement(Ce,{form:i,elementSettings:e,mobileBoxShadow:m,mobileBordersShow:N,mobileBorderRadiusShow:V,mobileBoxShadowShow:z,mobileSizeShow:j,mobileBackgroundShow:Q,mobilePaddingShow:le,mobilePaddingsExt:T,setMobilePaddingsExt:I,oneMobileBorderRadiusValue:p,setOneMobileBorderRadiusValue:g,backgroundRepeatOptions:ne,toggleShowMobileBorderHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{P(e=>!e),N?(t.mobileBorderAll=X.RH,t.mobileBorderTop=X.RH,t.mobileBorderBottom=X.RH,t.mobileBorderRight=X.RH,t.mobileBorderLeft=X.RH):t.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:t.mobileBorderAll.color,style:t.mobileBorderAll.style,width:t.mobileBorderAll.width}}}})})},toggleShowMobileBorderRadiusHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{M(e=>!e),V?(t.mobileBorderRadiusAll=null,g(!0)):t.mobileBorderRadiusAll=5,o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:t.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},toggleShowMobileBoxShadowHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{W(e=>!e),z?(t.mobileBoxShadowInset=!1,t.mobileBoxShadowHOffset=null,t.mobileBoxShadowVOffset=null,t.mobileBoxShadowBlurRadius=null,t.mobileBoxShadowSpreadRadius=null,t.mobileBoxShadowColor=""):(t.mobileBoxShadowInset=!1,t.mobileBoxShadowHOffset=5,t.mobileBoxShadowVOffset=5,t.mobileBoxShadowBlurRadius=10,t.mobileBoxShadowSpreadRadius=-5,t.mobileBoxShadowColor="#000000"),o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:t.mobileBoxShadowBlurRadius,color:t.mobileBoxShadowColor,hOffset:t.mobileBoxShadowHOffset,inset:t.mobileBoxShadowInset,spreadRadius:t.mobileBoxShadowSpreadRadius,vOffset:t.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},toggleShowMobileSizeHandler:()=>{setTimeout(()=>{q(e=>!e)})},toggleShowMobileBackgroundHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{J(e=>!e),t.mobileBackgroundColor=Q?"":"#E5E5E5",o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:t.mobileBackgroundColor}}})})},toggleShowMobilePaddingHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{ie(e=>!e),le&&(t.mobilePaddingLeftRight="",t.mobilePaddingLeft="",t.mobilePaddingRight="",t.mobilePaddingTopBottom="",t.mobilePaddingTop="",t.mobilePaddingBottom="",o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobilePadding:{all:null,top:null,right:null,bottom:null,left:null,classNamePrefix:"em-mob-padding_"}}}))})}})," "):l.createElement("div",{id:"selected_element_form_desktop_props"},l.createElement(Ae,{form:i,elementSettings:e,boxShadow:a,bordersShow:A,borderRadiusShow:L,boxShadowShow:D,backgroundShow:Y,backgroundImageEmpty:f,backgroundRepeatOptions:ne,sizeShow:U,maxWidthValue:ae,modificationShow:Z,paddingShow:te,paddingsExt:R,oneBorderRadiusValue:d,setOneBorderRadiusValue:s,togglePaddingHandler:()=>{x(e=>!e);const t=i.getFieldsValue(!0);R||(t.paddingLeftRight=t.paddingLeft,t.paddingTopBottom=t.paddingTop,t.paddingRight=t.paddingLeft,t.paddingBottom=t.paddingTop,o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:t.paddingTopBottom,bottom:t.paddingTopBottom,left:t.paddingLeftRight,right:t.paddingLeftRight}}}))},toggleShowPaddingHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{oe(e=>!e),te&&(t.paddingLeftRight="",t.paddingLeft="",t.paddingRight="",t.paddingTopBottom="",t.paddingTop="",t.paddingBottom="",o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},toggleShowBorderHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{C(e=>!e),A?(t.borderAll=X.RH,t.borderTop=X.RH,t.borderBottom=X.RH,t.borderRight=X.RH,t.borderLeft=X.RH):t.borderAll={width:1,color:"#E5E5E5",style:"solid"},o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:t.borderAll.color,style:t.borderAll.style,width:t.borderAll.width}}}})})},toggleShowBorderRadiusHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{F(e=>!e),L?(t.borderRadiusAll=0,s(!0)):t.borderRadiusAll=5,o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:t.borderRadiusAll}}})})},toggleShowBoxShadowHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{H(e=>!e),D?(t.boxShadowInset=!1,t.boxShadowHOffset=null,t.boxShadowVOffset=null,t.boxShadowBlurRadius=null,t.boxShadowSpreadRadius=null,t.boxShadowColor=""):(t.boxShadowInset=!1,t.boxShadowHOffset=5,t.boxShadowVOffset=5,t.boxShadowBlurRadius=10,t.boxShadowSpreadRadius=-5,t.boxShadowColor="#000000"),o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:t.boxShadowBlurRadius,color:t.boxShadowColor,hOffset:t.boxShadowHOffset,inset:t.boxShadowInset,spreadRadius:t.boxShadowSpreadRadius,vOffset:t.boxShadowVOffset}}})})},toggleShowSizeHandler:()=>{setTimeout(()=>{$(e=>!e)})},toggleShowBackgroundHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{K(e=>!e),Y?(t.backgroundColor="",t.backgroundImage="",t.backgroundPositionX="",t.backgroundPositionY="",t.backgroundRepeat="none",t.backgroundSize="",v(!0)):(t.backgroundColor="#E5E5E5",t.backgroundSize="",t.backgroundRepeat="none"),o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:t.backgroundColor,backgroundImage:[{type:"url",value:t.backgroundImage}],backgroundPositionX:t.backgroundPositionX,backgroundPositionY:t.backgroundPositionY,backgroundRepeat:t.backgroundRepeat,backgroundSize:t.backgroundSize}})})},toggleShowModificationHandler:()=>{const t=i.getFieldsValue(!0);setTimeout(()=>{ee(e=>!e),Z&&(t.exportAsPicture=!1,o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{exportAsPicture:!1}}))})},handleChangeValues:pe})))},Pe=({form:e,elementSettings:t})=>{const{__:o}=(0,_.s9)(),i=(0,y.rD)();return l.createElement(l.Fragment,null,l.createElement(c.lV.Item,{style:{marginBottom:"0"}},l.createElement(c.fI,{gutter:10},l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:o("Float block width"),placement:"bottom"},l.createElement(c.lV.Item,{name:"width"},l.createElement(c.YI,{min:0,placeholder:o("Float block width"),prefix:l.createElement(A.Ay,{icon:"ColumnWidthOutlined"}),addonAfter:l.createElement(c.lV.Item,{name:"widthDim",noStyle:!0},O.z$)})))),l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:o("Column gap"),placement:"bottom"},l.createElement(c.lV.Item,{name:"gap"},l.createElement(c.YI,{min:0,placeholder:o("Column gap"),prefix:l.createElement(A.Ay,{icon:"SplitCellsOutlined"}),addonAfter:l.createElement(c.lV.Item,{name:"widthDim",noStyle:!0},O.TX)})))))),l.createElement(c.y9,{title:o("Vertical alignment"),dividerTop:!0},l.createElement(B,{form:e,elementSettings:t})),l.createElement(c.y9,{title:o("Display control"),dividerTop:!0},l.createElement(C,{elementSettings:t,form:e})),i.formFieldAmpVisibilityEnabled&&t.ampShow&&l.createElement(c.y9,{title:o("AMP visibility"),dividerTop:!0},l.createElement(F,null)))},Le=({form:e,elementSettings:t})=>{const{__:o}=(0,_.s9)(),i=(0,y.rD)();return l.createElement(l.Fragment,null,l.createElement(c.m_,{title:o("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"},l.createElement(c.Fc,{className:"selected_form-mobile-props-title",message:o("Appearance on mobile devices"),type:"info"})),l.createElement(c.fI,{gutter:10,style:{marginBottom:20}},l.createElement(c.fv,{span:12},l.createElement(M,{form:e,name:"mobileWidth",elementSettings:t})),l.createElement(c.fv,{span:12})),l.createElement(c.y9,{title:o("Alignments"),dividerTop:!0},l.createElement(B,{form:e,elementSettings:t,typeOfForm:"mobile"})),l.createElement(c.y9,{title:o("Display control"),dividerTop:!0},l.createElement(C,{elementSettings:t,form:e})),i.formFieldAmpVisibilityEnabled&&t.ampShow&&l.createElement(c.y9,{title:o("AMP visibility"),dividerTop:!0},l.createElement(F,null)))};let Fe=0;const Oe=({elementSettings:e})=>{const{__:t}=(0,_.s9)(),o=(0,S.XW)(),[i]=c.lV.useForm(),a=(0,n.d4)(G.Ct),r=(0,n.d4)(G.CS),d=(0,n.d4)(G.Fv),s=(0,n.d4)(G.yy),m=d&&"bottom"!==s;(0,l.useEffect)(()=>{var t,o,l,a,r,n,d,s,m,c,u,p,g;e&&(i.setFieldsValue({...e,width:null===(t=e.width)||void 0===t?void 0:t.value,widthDim:null===(o=e.width)||void 0===o?void 0:o.dim,gap:null===(l=e.gap)||void 0===l?void 0:l.value,gapDim:null===(a=e.gap)||void 0===a?void 0:a.dim,maxWidth:null===(r=e.maxWidth)||void 0===r?void 0:r.value,maxWidthDim:null===(n=e.maxWidth)||void 0===n?void 0:n.dim,minWidth:null===(d=e.minWidth)||void 0===d?void 0:d.value,minWidthDim:null===(s=e.minWidth)||void 0===s?void 0:s.dim,show:e.show?e.show:"all",mobileWidth:(0,O.xc)(null===(m=e.mobileWidth)||void 0===m?void 0:m.value),mobileWidthDim:null===(c=e.mobileWidth)||void 0===c?void 0:c.dim,mobileContentWidth:(0,O.xc)(null===(u=e.mobileContentWidth)||void 0===u?void 0:u.value),mobileContentWidthDim:null===(p=e.mobileContentWidth)||void 0===p?void 0:p.dim,mobileVerticalAlign:(0,O.ok)(null===(g=e.mobileVerticalAlign)||void 0===g?void 0:g.value)}),Fe=e.width.value+e.gap.value)},[i,e]);return l.createElement(c.lV,{form:i,layout:"vertical",name:"selected_float_block_form",initialValues:{width:{value:"",dim:""},gap:{value:"",dim:"px"},valign:"",show:"all",mobileWidth:"",mobileWidthDim:"",mobileContentWidth:"",mobileContentWidthDim:"",mobileVerticalAlign:""},onValuesChange:t=>{const l=i.getFieldsValue(!0),a=Object.keys(t)[0];let r;switch(a){case"width":Fe=t[a]+l.gap,r={[a]:{value:t[a],dim:l.widthDim},gap:{value:l.gap}};break;case"widthDim":r={width:{value:l.width,dim:t[a]},gap:{value:l.gap}};break;case"gap":l.width=Fe-t[a],r={[a]:{value:t[a],dim:"px"}};break;case"mobileWidth":r={[a]:{classNamePrefix:"em-mob-width-",value:t[a],dim:l.mobileWidthDim}};break;case"mobileWidthDim":r={mobileWidth:{classNamePrefix:"em-mob-width-",value:l.mobileWidth||100,dim:t[a]}};break;case"mobileContentWidth":r={[a]:{classNamePrefix:"em-mob-width-",value:t[a],dim:l.mobileContentWidthDim}};break;case"mobileContentWidthDim":r={mobileContentWidth:{classNamePrefix:"em-mob-width-",value:100,dim:t[a]}};break;case"mobileVerticalAlign":r={[a]:{classNamePrefix:"em-mob-vertical_align-",value:t[a]}};break;default:r=t}o({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:r})},autoComplete:"off",className:"element-controls"},m&&l.createElement(c.m_,{title:t("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"},l.createElement(c.Fc,{className:"selected_form-mobile-props-title",message:t("Appearance on mobile devices"),type:"info"})),a===E.ND&&r.styles?l.createElement("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props",style:{display:a===E.ND&&r.styles?"block":"none"}},l.createElement(Le,{form:i,elementSettings:e})):l.createElement("div",{id:"selected_element_form_desktop_props"},l.createElement(Pe,{form:i,elementSettings:e})))},Ve=({form:e,elementSettings:t,boxShadow:o,bordersShow:i,borderRadiusShow:a,boxShadowShow:n,backgroundShow:d,backgroundImageEmpty:s,backgroundRepeatOptions:m,paddingShow:u,paddingsExt:p,maxWidthValue:g,oneBorderRadiusValue:h,setOneBorderRadiusValue:b,linkProtocol:E,linkTarget:S,isOpenTextReplacer:w,textReplacerButtonRef:B,textReplacerInputRef:R,handleLinkProtocolsChange:x,handleSelect:T,textReplacerInputHandler:N,handleTextReplacerKeyDown:P,srcButtonHandler:L,togglePaddingHandler:V,toggleShowPaddingHandler:M,toggleShowBackgroundHandler:D,toggleShowBorderHandler:H,toggleShowBorderRadiusHandler:z,toggleShowBoxShadowHandler:W,setLinkProtocol:U,handleChangeValues:$})=>{const{__:G}=(0,_.s9)(),{token:j}=(0,c.rd)(),X=(0,y.rD)();return l.createElement(l.Fragment,null,l.createElement(c.Fc,{className:"selected_form-desktop-props-title",message:G("Appearance on mobile devices"),type:"info"}),l.createElement("div",{className:"selected_form-props-wrapper"},l.createElement(c.fI,{gutter:20,style:{marginBottom:4}},l.createElement(c.fv,{span:12},l.createElement(k,{form:e,elementSettings:t})),X.formButtonFieldTextAlignEnabled&&l.createElement(c.fv,{span:12,style:{textAlign:"right"}},l.createElement(le.A,{form:e,name:"textAlign",elementSettings:t}))),l.createElement(c.cG,{className:"selected-td-form__divider",style:{marginBottom:24}}),l.createElement(c.m_,{trigger:["hover"],title:G("Hyperlink URL"),placement:"bottom"},l.createElement(c.lV.Item,{name:"href",style:{marginBottom:X.formButtonFieldReplacerEnabled?j.formItemMarginBottomXS:j.formItemMarginBottomMD+4}},l.createElement(c.pd,{addonBefore:l.createElement(O.Ai,{linkProtocol:E,handleLinkProtocolsChange:x,__:G}),placeholder:G("Hyperlink URL"),allowClear:!0,onSelect:T,prefix:l.createElement(O.RM,{linkProtocol:E})}))),"mailto:"===E&&l.createElement(l.Fragment,null,l.createElement(c.lV.Item,{name:"subject",style:{marginBottom:j.formItemMarginBottomXS}},l.createElement(c.pd,{placeholder:G("Subject")})),l.createElement(c.lV.Item,{name:"body",style:{marginBottom:j.formItemMarginBottomXS}},l.createElement(c.fs,{rows:3,placeholder:G("Body")}))),X.formButtonFieldReplacerEnabled&&l.createElement(l.Fragment,null,l.createElement(c.fI,{gutter:10},l.createElement(c.fv,{span:3},l.createElement(c.m_,{title:G("Text replacer"),placement:"bottom",getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper")},l.createElement(c.$n,{className:r()("selected-td-form__button ant-form-item",{"selected-td-form__button--active":w}),icon:l.createElement(A.Ay,{icon:"Replacer",className:"selected-td-form__icon-radius"}),onClick:L,ref:B}))),l.createElement(c.fv,{span:21},w&&l.createElement(c.m_,{trigger:["hover"],title:G("Text"),placement:"bottom"},l.createElement(c.lV.Item,{name:"textReplacer"},l.createElement(c.pd,{placeholder:G("The code that will replace this text"),allowClear:!0,prefix:l.createElement("span",{className:"addon-text-content"},"Text"),onChange:N,onKeyDown:P,ref:R,onSelect:T})))))),X.formButtonFieldPaddingsEnabled&&l.createElement(c.y9,{title:G("Padding"),collapsible:!0,open:u,onToggle:M,dividerTop:!0},l.createElement(c.L1,{extended:p,onToggleExtended:V,gutter:j.marginSM,labels:{horizontal:G("Horizontal padding"),vertical:G("Vertical padding"),left:G("Left padding"),right:G("Right padding"),top:G("Top padding"),bottom:G("Bottom padding"),individual:G("Individual padding")}})),l.createElement(c.y9,{title:G("Size"),dividerTop:!0},l.createElement(c.n6,{maxWidth:g,dimensionSelect:O.z$,gutter:j.marginSM,labels:{width:G("Width"),height:G("Height"),minWidth:G("Minimum width"),maxWidth:G("Maximum width")}})),l.createElement(re,{form:e,elementSettings:t,showAddParagraph:!1,isButton:!0,setLinkProtocol:U,linkProtocol:E,linkTarget:S}),l.createElement(c.y9,{title:G("Background"),collapsible:!0,open:d,onToggle:D,dividerTop:!0},l.createElement(ke,{form:e,backgroundImageEmpty:s,appConfig:X,token:j,elementSettings:t,backgroundRepeatOptions:m,handleChangeValues:$})),X.formFieldBorderEnabled&&l.createElement(c.y9,{title:G("Borders"),collapsible:!0,open:i,onToggle:H,dividerTop:!0},l.createElement(f.A,{form:e,elementSettings:t})),X.formFieldBorderRadiusEnabled&&l.createElement(c.y9,{title:G("Border radius"),collapsible:!0,open:a,onToggle:z,dividerTop:!0},l.createElement(v.A,{form:e,oneBorderRadiusValue:h,setOneBorderRadiusValue:b,elementSettings:t})),X.formFieldBoxShadowEnabled&&l.createElement(c.y9,{title:G("Box shadow"),collapsible:!0,open:n,onToggle:W,dividerTop:!0},l.createElement(I,null)),X.formFieldVisibilityEnabled&&l.createElement(c.y9,{title:G("Display control"),dividerTop:!0},l.createElement(C,{elementSettings:t,form:e})),X.formFieldAmpVisibilityEnabled&&t.ampShow&&l.createElement(c.y9,{title:G("AMP visibility"),dividerTop:!0},l.createElement(F,null))))},Me=({form:e,elementSettings:t,boxShadow:o,mobileBordersShow:i,mobileBorderRadiusShow:a,mobileBoxShadowShow:r,mobileSizeShow:n,mobileBackgroundShow:d,mobilePaddingShow:s,mobilePaddingsExt:m,setMobilePaddingsExt:u,oneMobileBorderRadiusValue:p,setOneMobileBorderRadiusValue:g,linkProtocol:h,handleLinkProtocolsChange:b,setLinkProtocol:E,toggleShowMobileBorderHandler:S,toggleShowMobileBorderRadiusHandler:w,toggleShowMobileBoxShadowHandler:B,toggleShowMobileSizeHandler:R,toggleShowMobileBackgroundHandler:x,toggleShowMobilePaddingHandler:T})=>{const{__:A}=(0,_.s9)(),{token:C}=(0,c.rd)(),N=(0,y.rD)();return l.createElement(l.Fragment,null,l.createElement(c.fI,{gutter:20,style:{marginBottom:4}},l.createElement(c.fv,{span:12},l.createElement(k,{form:e,elementSettings:t,imgParent:!0,typeOfForm:"mobile"})),N.formButtonFieldTextAlignEnabled&&l.createElement(c.fv,{span:12,style:{textAlign:"right"}},l.createElement(de,{form:e,name:"mobileTextAlign",elementSettings:t,imgParent:!0}))),!!t.showOnMobile&&l.createElement(l.Fragment,null,l.createElement(c.cG,{className:"selected-td-form__divider",style:{marginBottom:24}}),l.createElement(c.m_,{trigger:["hover"],title:A("Hyperlink URL"),placement:"bottom"},l.createElement(c.lV.Item,{name:"href",style:{marginBottom:"mailto:"===h?C.formItemMarginBottomXS:C.formItemMarginBottomMD}},l.createElement(c.pd,{addonBefore:l.createElement(O.Ai,{linkProtocol:h,handleLinkProtocolsChange:b,__:A}),placeholder:A("Hyperlink URL"),allowClear:!0,prefix:l.createElement(O.RM,{linkProtocol:h})}))),"mailto:"===h&&l.createElement(l.Fragment,null,l.createElement(c.lV.Item,{name:"subject"},l.createElement(c.pd,{placeholder:A("Subject")})),l.createElement(c.lV.Item,{name:"body",style:{marginBottom:C.formItemMarginBottomMD}},l.createElement(c.fs,{rows:3,placeholder:A("Body")})))),!!t.showOnMobile&&l.createElement(re,{form:e,elementSettings:t,setLinkProtocol:E,linkProtocol:h,showAddParagraph:!1,isButton:!0}),l.createElement(c.fI,{gutter:10},l.createElement(c.fv,{span:12},l.createElement(te,null))),N.formButtonFieldPaddingsEnabled&&l.createElement(c.y9,{title:A("Padding"),collapsible:!0,open:s,onToggle:T,dividerTop:!0},l.createElement(xe,{form:e,elementSettings:t,mobilePaddingsExt:m,setMobilePaddingsExt:u})),l.createElement(c.y9,{title:A("Size"),collapsible:!0,open:n,onToggle:R,dividerTop:!0,bodyStyle:{paddingBottom:C.formItemMarginBottomMD}},l.createElement(c.fI,{gutter:10},l.createElement(c.fv,{span:12},l.createElement(c.m_,{title:A("Width"),placement:"bottom"},l.createElement(M,{form:e,name:"mobileWidth",elementSettings:t}))),l.createElement(c.fv,{span:12},l.createElement(c.m_,{title:A("Height"),placement:"bottom"},l.createElement(D,{form:e,name:"mobileHeight",elementSettings:t}))))),l.createElement(c.y9,{title:A("Background"),collapsible:!0,open:d,onToggle:x,dividerTop:!0,bodyStyle:{paddingBottom:C.formItemMarginBottomMD}},l.createElement(ue,{form:e,elementSettings:t,label:A("Background color")})),N.formFieldBorderEnabled&&l.createElement(c.y9,{title:A("Borders"),collapsible:!0,open:i,onToggle:S,dividerTop:!0},l.createElement(f.A,{form:e,typeOfForm:"mobile"})),N.formFieldBorderRadiusEnabled&&l.createElement(c.y9,{title:A("Border radius"),collapsible:!0,open:a,onToggle:w,dividerTop:!0},l.createElement(v.A,{form:e,oneBorderRadiusValue:p,setOneBorderRadiusValue:g,elementSettings:t,typeOfForm:"mobile"})),N.formFieldBoxShadowEnabled&&l.createElement(c.y9,{title:A("Box shadow"),collapsible:!0,open:r,onToggle:B,dividerTop:!0},l.createElement(I,{typeOfForm:"mobile"})),N.formFieldAmpVisibilityEnabled&&t.ampShow&&l.createElement(c.y9,{title:A("AMP visibility"),dividerTop:!0},l.createElement(F,null)),N.formFieldAmpVisibilityEnabled&&t.isAmp&&l.createElement(c.y9,{title:A("AMP visibility"),dividerTop:!0},l.createElement(F,null)))},De=({elementSettings:e})=>{var t;const{__:o}=(0,_.s9)(),i=(0,S.XW)(),[a]=c.lV.useForm(),r=(0,n.wA)(),m=(0,n.d4)(d.Hs),[u,p]=(0,l.useState)({}),[g,h]=(0,l.useState)(!0),[b,f]=(0,l.useState)(!0),v=(0,n.d4)(G.Ct),y=(0,n.d4)(G.CS),[w,k]=(0,l.useState)(""===(null===(t=e.backgroundImage)||void 0===t?void 0:t[0].value)),B=(0,n.d4)(G.Fv),R=(0,n.d4)(G.yy),x=B&&"bottom"!==R,T=(0,l.useRef)(null),I=(0,l.useRef)(null),[A,C]=(0,l.useState)(!1),[N,P]=(0,l.useState)(!1),[L,F]=(0,l.useState)(!1),[V,M]=(0,l.useState)(!1),[D,H]=(0,l.useState)(!1),[z,W]=(0,l.useState)(!1),[U,$]=(0,l.useState)(!1),[j,q]=(0,l.useState)(!1),[Y,K]=(0,l.useState)(!1),[Q,J]=(0,l.useState)(!1),[Z,ee]=(0,l.useState)(!1),[te,oe]=(0,l.useState)(!1),[le,ie]=(0,l.useState)(!1),[ae,re]=(0,l.useState)(""),[de,se]=(0,l.useState)("https://"),[me,ce]=(0,l.useState)({}),[ue,pe]=(0,l.useState)(!1),ge=m.hasOwnProperty("type")?E.IE:E.Tm,he=[{label:o("Not defined"),value:"none"},{label:o("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:o("Repeat background (repeat)"),value:"repeat"},{label:o("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:o("Repeat background vertically (repeat-y)"),value:"repeat-y"}],be=e.border,fe=e.mobileBorder,ve=Object.keys(be).find(e=>{var t,o,l;return(null===(t=be[e])||void 0===t?void 0:t.width)||(null===(o=be[e])||void 0===o?void 0:o.style)||(null===(l=be[e])||void 0===l?void 0:l.color)}),_e=Object.keys(fe).find(e=>{var t,o,l;return(null===(t=fe[e])||void 0===t?void 0:t.width)||(null===(o=fe[e])||void 0===o?void 0:o.style)||(null===(l=fe[e])||void 0===l?void 0:l.color)}),Ee=e=>e&&(null!==e&&void 0!==e&&e.width||null!==e&&void 0!==e&&e.style||null!==e&&void 0!==e&&e.color)?e:"";(0,l.useEffect)(()=>{if(e){var t,o,l,i,r,n,d,s,m,c,u,g,b,v,_,E,S,y,w,B,R,x,T,I,A,N,L,V,D,z,U,G,j,X,Y,Q,Z,te,le,ae,re,ne,de,me,ce,ue,pe,ge,he,be,fe,Se,ye,we,ke,Be,Re,xe,Te,Ie,Ae,Ce,Ne,Pe,Le,Fe,Oe,Ve,Me,De,He,ze,We,Ue,$e,Ge,je,Xe,qe,Ye,Ke,Qe,Je,Ze,et,tt,ot,lt,it,at,rt,nt,dt,st,mt,ct,ut,pt,gt,ht,bt,ft,vt,_t,Et,St,yt,wt,kt,Bt,Rt,xt,Tt,It,At,Ct,Nt,Pt,Lt,Ft,Ot,Vt,Mt,Dt,Ht,zt,Wt,Ut,$t,Gt,jt,Xt,qt,Yt,Kt,Qt,Jt,Zt,eo,to,oo,lo,io,ao,ro,no,so,mo,co,uo,po,go,ho,bo,fo,vo,_o;const Eo=e.boxShadow||{},So=e.mobilePadding||{},yo=e.mobileAlign||{},wo=e.mobileBackgroundImage||[];p(Eo);let ko="",Bo="",Ro=e.href||"https://";if(e.href){if(e.href.startsWith("mailto:")){const t=(0,O.kl)(e.href);ko=t.subject,Bo=t.body,Ro=t.baseEmail}(0,O.b9)(e.href,se)}a.setFieldsValue({...e,href:Ro,subject:ko,body:Bo,width:null===(t=e.width)||void 0===t?void 0:t.value,widthDim:null===(o=e.width)||void 0===o?void 0:o.dim,height:null===(l=e.height)||void 0===l?void 0:l.value,heightDim:null===(i=e.height)||void 0===i?void 0:i.dim,backgroundImage:null===(r=e.backgroundImage)||void 0===r?void 0:r[0].value,show:e.show?e.show:"all",textAlign:e.textAlign,borderAll:(0,O.ok)(e.border.all),borderTop:(0,O.ok)(e.border.top),borderBottom:(0,O.ok)(e.border.bottom),borderRight:(0,O.ok)(e.border.right),borderLeft:(0,O.ok)(e.border.left),mobileBorderAll:Ee(e.mobileBorder.all)||!(Ee(e.mobileBorder.top)||Ee(e.mobileBorder.bottom)||Ee(e.mobileBorder.right)||Ee(e.mobileBorder.left))&&Ee(e.border.all),mobileBorderTop:Ee(e.mobileBorder.top)||!Ee(e.mobileBorder.all)&&Ee(e.border.top),mobileBorderBottom:Ee(e.mobileBorder.bottom)||!Ee(e.mobileBorder.all)&&Ee(e.border.bottom),mobileBorderRight:Ee(e.mobileBorder.right)||!Ee(e.mobileBorder.all)&&Ee(e.border.right),mobileBorderLeft:Ee(e.mobileBorder.left)||!Ee(e.mobileBorder.all)&&Ee(e.border.left),paddingTop:(0,O.ok)(null===(n=e.padding)||void 0===n?void 0:n.all)||(0,O.ok)(null===(d=e.padding)||void 0===d?void 0:d.top),paddingLeft:(0,O.ok)(null===(s=e.padding)||void 0===s?void 0:s.all)||(0,O.ok)(null===(m=e.padding)||void 0===m?void 0:m.left),paddingRight:(0,O.ok)(null===(c=e.padding)||void 0===c?void 0:c.all)||(0,O.ok)(null===(u=e.padding)||void 0===u?void 0:u.right),paddingBottom:(0,O.ok)(null===(g=e.padding)||void 0===g?void 0:g.all)||(0,O.ok)(null===(b=e.padding)||void 0===b?void 0:b.bottom),paddingLeftRight:(0,O.ok)(null===(v=e.padding)||void 0===v?void 0:v.left)||(0,O.ok)(null===(_=e.padding)||void 0===_?void 0:_.right),paddingTopBottom:(0,O.ok)(null===(E=e.padding)||void 0===E?void 0:E.top)||(0,O.ok)(null===(S=e.padding)||void 0===S?void 0:S.bottom),borderRadiusAll:(0,O.ok)(null===(y=e.borderRadius)||void 0===y?void 0:y.all),borderRadiusTopLeft:(0,O.ok)(null===(w=e.borderRadius)||void 0===w?void 0:w.topLeft),borderRadiusBottomLeft:(0,O.ok)(null===(B=e.borderRadius)||void 0===B?void 0:B.bottomLeft),borderRadiusTopRight:(0,O.ok)(null===(R=e.borderRadius)||void 0===R?void 0:R.topRight),borderRadiusBottomRight:(0,O.ok)(null===(x=e.borderRadius)||void 0===x?void 0:x.bottomRight),boxShadowInset:(0,O.ok)(null===(T=e.boxShadow)||void 0===T?void 0:T.inset)||!1,boxShadowHOffset:(0,O.ok)(null===(I=e.boxShadow)||void 0===I?void 0:I.hOffset),boxShadowVOffset:(0,O.ok)(null===(A=e.boxShadow)||void 0===A?void 0:A.vOffset),boxShadowBlurRadius:(0,O.ok)(null===(N=e.boxShadow)||void 0===N?void 0:N.blurRadius),boxShadowSpreadRadius:(0,O.ok)(null===(L=e.boxShadow)||void 0===L?void 0:L.spreadRadius),boxShadowColor:(0,O.ok)(null===(V=e.boxShadow)||void 0===V?void 0:V.color),mobileWidth:(0,O.xc)(null===(D=e.mobileWidth)||void 0===D?void 0:D.value)||(null===(z=e.width)||void 0===z?void 0:z.value),mobileWidthDim:(0,O.xc)(null===(U=e.mobileWidth)||void 0===U?void 0:U.value)?null===(G=e.mobileWidth)||void 0===G?void 0:G.dim:null===(j=e.width)||void 0===j?void 0:j.dim,mobileHeight:(0,O.xc)(null===(X=e.mobileHeight)||void 0===X?void 0:X.value)||(null===(Y=e.height)||void 0===Y?void 0:Y.value),mobileHeightDim:(0,O.xc)(null===(Q=e.mobileHeight)||void 0===Q?void 0:Q.value)?null===(Z=e.mobileHeight)||void 0===Z?void 0:Z.dim:null===(te=e.height)||void 0===te?void 0:te.dim,mobileBorderRadiusAll:(0,O.ok)(null===(le=e.mobileBorderRadius)||void 0===le?void 0:le.all)||(0,O.ok)(null===(ae=e.borderRadius)||void 0===ae?void 0:ae.all),mobileBorderRadiusTopLeft:(0,O.ok)(null===(re=e.mobileBorderRadius)||void 0===re?void 0:re.topLeft)||(0,O.ok)(null===(ne=e.mobileBorderRadius)||void 0===ne?void 0:ne.all)||(0,O.ok)(null===(de=e.borderRadius)||void 0===de?void 0:de.topLeft)||(0,O.ok)(null===(me=e.borderRadius)||void 0===me?void 0:me.all),mobileBorderRadiusBottomLeft:(0,O.ok)(null===(ce=e.mobileBorderRadius)||void 0===ce?void 0:ce.bottomLeft)||(0,O.ok)(null===(ue=e.mobileBorderRadius)||void 0===ue?void 0:ue.all)||(0,O.ok)(null===(pe=e.borderRadius)||void 0===pe?void 0:pe.bottomLeft)||(0,O.ok)(null===(ge=e.borderRadius)||void 0===ge?void 0:ge.all),mobileBorderRadiusTopRight:(0,O.ok)(null===(he=e.mobileBorderRadius)||void 0===he?void 0:he.topRight)||(0,O.ok)(null===(be=e.mobileBorderRadius)||void 0===be?void 0:be.all)||(0,O.ok)(null===(fe=e.borderRadius)||void 0===fe?void 0:fe.topRight)||(0,O.ok)(null===(Se=e.borderRadius)||void 0===Se?void 0:Se.all),mobileBorderRadiusBottomRight:(0,O.ok)(null===(ye=e.mobileBorderRadius)||void 0===ye?void 0:ye.bottomRight)||(0,O.ok)(null===(we=e.mobileBorderRadius)||void 0===we?void 0:we.all)||(0,O.ok)(null===(ke=e.borderRadius)||void 0===ke?void 0:ke.bottomRight)||(0,O.ok)(null===(Be=e.borderRadius)||void 0===Be?void 0:Be.all),mobileBoxShadowInset:null!=(null===(Re=e.mobileBoxShadow)||void 0===Re?void 0:Re.inset)?e.mobileBoxShadow.inset:(null===(xe=e.boxShadow)||void 0===xe?void 0:xe.inset)||!1,mobileBoxShadowHOffset:(0,O.ok)(null===(Te=e.mobileBoxShadow)||void 0===Te?void 0:Te.hOffset)||(0,O.ok)(null===(Ie=e.boxShadow)||void 0===Ie?void 0:Ie.hOffset),mobileBoxShadowVOffset:(0,O.ok)(null===(Ae=e.mobileBoxShadow)||void 0===Ae?void 0:Ae.vOffset)||(0,O.ok)(null===(Ce=e.boxShadow)||void 0===Ce?void 0:Ce.vOffset),mobileBoxShadowBlurRadius:(0,O.ok)(null===(Ne=e.mobileBoxShadow)||void 0===Ne?void 0:Ne.blurRadius)||(0,O.ok)(null===(Pe=e.boxShadow)||void 0===Pe?void 0:Pe.blurRadius),mobileBoxShadowSpreadRadius:(0,O.ok)(null===(Le=e.mobileBoxShadow)||void 0===Le?void 0:Le.spreadRadius)||(0,O.ok)(null===(Fe=e.boxShadow)||void 0===Fe?void 0:Fe.spreadRadius),mobileBoxShadowColor:(0,O.ok)(null===(Oe=e.mobileBoxShadow)||void 0===Oe?void 0:Oe.color)||(0,O.ok)(null===(Ve=e.boxShadow)||void 0===Ve?void 0:Ve.color),mobileAlign:(0,O.ok)(null===yo||void 0===yo?void 0:yo.value)||e.align,mobileVerticalAlign:(0,O.ok)((null===(Me=e.mobileVerticalAlign)||void 0===Me?void 0:Me.value)||e.valign),mobileBackgroundColor:(0,O.ok)((null===(De=e.mobileBackgroundColor)||void 0===De?void 0:De.value)||e.backgroundColor||""),mobileBackgroundImage:"none"!==(null===(He=wo[0])||void 0===He?void 0:He.value)?null===(ze=wo[0])||void 0===ze?void 0:ze.value:(null===(We=e.backgroundImage)||void 0===We?void 0:We[0].value)||"",mobileBackgroundPositionX:(0,O.ok)(null===(Ue=e.mobileBackgroundPositionX)||void 0===Ue?void 0:Ue.value)||(0,O.ok)(null===($e=e.backgroundPositionX)||void 0===$e?void 0:$e.value),mobileBackgroundPositionY:(0,O.ok)(null===(Ge=e.mobileBackgroundPositionY)||void 0===Ge?void 0:Ge.value)||(0,O.ok)(null===(je=e.backgroundPositionY)||void 0===je?void 0:je.value),mobileBackgroundRepeat:(null===(Xe=e.mobileBackgroundRepeat)||void 0===Xe?void 0:Xe.value)||e.backgroundRepeat||"none",mobilePaddingTop:(0,O.ok)(So.all)||(0,O.ok)(So.top)||(0,O.ok)(null===(qe=e.padding)||void 0===qe?void 0:qe.all)||(0,O.ok)(null===(Ye=e.padding)||void 0===Ye?void 0:Ye.top),mobilePaddingLeft:(0,O.ok)(So.all)||(0,O.ok)(So.left)||(0,O.ok)(null===(Ke=e.padding)||void 0===Ke?void 0:Ke.all)||(0,O.ok)(null===(Qe=e.padding)||void 0===Qe?void 0:Qe.left),mobilePaddingRight:(0,O.ok)(So.all)||(0,O.ok)(So.right)||(0,O.ok)(null===(Je=e.padding)||void 0===Je?void 0:Je.all)||(0,O.ok)(null===(Ze=e.padding)||void 0===Ze?void 0:Ze.right),mobilePaddingBottom:(0,O.ok)(So.all)||(0,O.ok)(So.bottom)||(0,O.ok)(null===(et=e.padding)||void 0===et?void 0:et.all)||(0,O.ok)(null===(tt=e.padding)||void 0===tt?void 0:tt.bottom),mobilePaddingTopBottom:(0,O.ok)(So.top)||(0,O.ok)(So.bottom)||(0,O.ok)(null===(ot=e.padding)||void 0===ot?void 0:ot.top)||(0,O.ok)(null===(lt=e.padding)||void 0===lt?void 0:lt.bottom),mobilePaddingLeftRight:(0,O.ok)(So.left)||(0,O.ok)(So.right)||(0,O.ok)(null===(it=e.padding)||void 0===it?void 0:it.left)||(0,O.ok)(null===(at=e.padding)||void 0===at?void 0:at.right),mobileTextAlign:(0,O.ok)((null===(rt=e.mobileTextAlign)||void 0===rt?void 0:rt.value)||e.textAlign),exportAsPicture:null===e||void 0===e?void 0:e.exportAsPicture,mobileFontSize:(0,O.ok)((null===(nt=e.mobileFontSize)||void 0===nt?void 0:nt.value)||e.fontSize)}),!(0,O.ok)(null===(dt=e.borderRadius)||void 0===dt?void 0:dt.all)&&((0,O.ok)(null===(st=e.borderRadius)||void 0===st?void 0:st.topLeft)||(0,O.ok)(null===(mt=e.borderRadius)||void 0===mt?void 0:mt.bottomLeft)||(0,O.ok)(null===(ct=e.borderRadius)||void 0===ct?void 0:ct.topRight)||(0,O.ok)(null===(ut=e.borderRadius)||void 0===ut?void 0:ut.bottomRight))?h(!1):h(!0),!(0,O.ok)(e.mobileBorderRadius.all)&&((0,O.ok)(e.mobileBorderRadius.topLeft)||(0,O.ok)(e.mobileBorderRadius.bottomLeft)||(0,O.ok)(e.mobileBorderRadius.topRight)||(0,O.ok)(e.mobileBorderRadius.bottomRight))||(0,O.ok)(e.mobileBorderRadius.all)&&((0,O.ok)(e.mobileBorderRadius.topLeft)||(0,O.ok)(e.mobileBorderRadius.bottomLeft)||(0,O.ok)(e.mobileBorderRadius.topRight)||(0,O.ok)(e.mobileBorderRadius.bottomRight))||!(0,O.ok)(e.borderRadius.all)&&!(0,O.ok)(e.mobileBorderRadius.all)&&((0,O.ok)(e.borderRadius.topLeft)||(0,O.ok)(e.borderRadius.bottomLeft)||(0,O.ok)(e.borderRadius.topRight)||(0,O.ok)(e.borderRadius.bottomRight))?f(!1):f(!0),k(""===(null===(pt=e.backgroundImage)||void 0===pt?void 0:pt[0].value)),(0,O.ok)(null===(gt=e.padding)||void 0===gt?void 0:gt.all)||!((0,O.ok)(null===(ht=e.padding)||void 0===ht?void 0:ht.top)||(0,O.ok)(null===(bt=e.padding)||void 0===bt?void 0:bt.right)||(0,O.ok)(null===(ft=e.padding)||void 0===ft?void 0:ft.bottom)||(0,O.ok)(null===(vt=e.padding)||void 0===vt?void 0:vt.left))||(null===(_t=e.padding)||void 0===_t?void 0:_t.top)===(null===(Et=e.padding)||void 0===Et?void 0:Et.bottom)&&(null===(St=e.padding)||void 0===St?void 0:St.right)===(null===(yt=e.padding)||void 0===yt?void 0:yt.left)?C(!0):C(!1),!(0,O.ok)(So.all)&&((0,O.ok)(So.top)||(0,O.ok)(So.right)||(0,O.ok)(So.bottom)||(0,O.ok)(So.left))&&(So.top!==So.bottom||So.right!==So.left)||!(0,O.ok)(null===(wt=e.padding)||void 0===wt?void 0:wt.all)&&((0,O.ok)(null===(kt=e.padding)||void 0===kt?void 0:kt.top)||(0,O.ok)(null===(Bt=e.padding)||void 0===Bt?void 0:Bt.right)||(0,O.ok)(null===(Rt=e.padding)||void 0===Rt?void 0:Rt.bottom)||(0,O.ok)(null===(xt=e.padding)||void 0===xt?void 0:xt.left))&&((null===(Tt=e.padding)||void 0===Tt?void 0:Tt.top)!==(null===(It=e.padding)||void 0===It?void 0:It.bottom)||(null===(At=e.padding)||void 0===At?void 0:At.right)!==(null===(Ct=e.padding)||void 0===Ct?void 0:Ct.left))?P(!1):P(!0),F(e=>!!ve||e),M(e=>!(!ve&&!_e)||e),H(!(null===(Nt=e.borderRadius)||void 0===Nt||!Nt.all)||!(null===(Pt=e.borderRadius)||void 0===Pt||!Pt.topLeft)||!(null===(Lt=e.borderRadius)||void 0===Lt||!Lt.bottomLeft)||!(null===(Ft=e.borderRadius)||void 0===Ft||!Ft.topRight)||!(null===(Ot=e.borderRadius)||void 0===Ot||!Ot.bottomRight)),W(!(null===(Vt=e.mobileBorderRadius)||void 0===Vt||!Vt.all)||!(null===(Mt=e.mobileBorderRadius)||void 0===Mt||!Mt.topLeft)||!(null===(Dt=e.mobileBorderRadius)||void 0===Dt||!Dt.bottomLeft)||!(null===(Ht=e.mobileBorderRadius)||void 0===Ht||!Ht.topRight)||!(null===(zt=e.mobileBorderRadius)||void 0===zt||!zt.bottomRight)||!(null===(Wt=e.borderRadius)||void 0===Wt||!Wt.all)||!(null===(Ut=e.borderRadius)||void 0===Ut||!Ut.topLeft)||!(null===($t=e.borderRadius)||void 0===$t||!$t.bottomLeft)||!(null===(Gt=e.borderRadius)||void 0===Gt||!Gt.topRight)||!(null===(jt=e.borderRadius)||void 0===jt||!jt.bottomRight)),$(!!e.boxShadow),q(!(null===(Xt=e.mobileBoxShadow)||void 0===Xt||!Xt.blurRadius)||!(null===(qt=e.mobileBoxShadow)||void 0===qt||!qt.color)||!(null===(Yt=e.mobileBoxShadow)||void 0===Yt||!Yt.hOffset)||!(null===(Kt=e.mobileBoxShadow)||void 0===Kt||!Kt.inset)||!(null===(Qt=e.mobileBoxShadow)||void 0===Qt||!Qt.spreadRadius)||!(null===(Jt=e.mobileBoxShadow)||void 0===Jt||!Jt.vOffset)||!!e.boxShadow),K(!(null===(Zt=e.mobileWidth)||void 0===Zt||!Zt.value)||!(null===(eo=e.mobileHeight)||void 0===eo||!eo.value)||!!e.width.value||!!e.height.value),J(!!e.backgroundColor||!(null===(to=e.backgroundImage)||void 0===to||!to[0].value)||!!e.backgroundPositionY||!!e.backgroundPositionX||"repeat"!==e.backgroundRepeat||!e.backgroundRepeat,!!e.backgroundSize),ee(!(null===(oo=e.mobileBackgroundColor)||void 0===oo||!oo.value)||!!e.backgroundColor||!(null===(lo=e.backgroundImage)||void 0===lo||!lo[0].value)||!!e.backgroundPositionY||!!e.backgroundPositionX||"repeat"!==e.backgroundRepeat||!e.backgroundRepeat,!!e.backgroundSize),oe(!(null===(io=e.padding)||void 0===io||!io.all)||!(null===(ao=e.padding)||void 0===ao||!ao.top)||!(null===(ro=e.padding)||void 0===ro||!ro.bottom)||!(null===(no=e.padding)||void 0===no||!no.left)||!(null===(so=e.padding)||void 0===so||!so.right)),ie(!(null===(mo=e.mobilePadding)||void 0===mo||!mo.all)||!(null===(co=e.mobilePadding)||void 0===co||!co.top)||!(null===(uo=e.mobilePadding)||void 0===uo||!uo.bottom)||!(null===(po=e.mobilePadding)||void 0===po||!po.left)||!(null===(go=e.mobilePadding)||void 0===go||!go.right)||!(null===(ho=e.padding)||void 0===ho||!ho.all)||!(null===(bo=e.padding)||void 0===bo||!bo.top)||!(null===(fo=e.padding)||void 0===fo||!fo.bottom)||!(null===(vo=e.padding)||void 0===vo||!vo.left)||!(null===(_o=e.padding)||void 0===_o||!_o.right))}},[a,e,x]);const Se=(0,l.useCallback)(e=>{r(ge===E.Tm?(0,d.A9)(e):(0,s.A9)(e))},[r,ge]),ye=t=>{const o=a.getFieldsValue(!0),l=Object.keys(t)[0];let r;switch(re("%"===a.getFieldsValue(!0).widthDim?100:""),l){case"exportAsPicture":r={exportAsPicture:o.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":r={boxShadow:{hOffset:o.boxShadowHOffset,vOffset:o.boxShadowVOffset,blurRadius:o.boxShadowBlurRadius,spreadRadius:o.boxShadowSpreadRadius,color:o.boxShadowColor,inset:o.boxShadowInset}};break;case"borderAll":case"borderTop":case"borderBottom":case"borderLeft":case"borderRight":var n,d,s;if("borderAll"===o.borderPosition)r={border:{...E.iV,all:{...X.RH,...o.borderAll}}},a.setFieldsValue({borderLeft:X.RH,borderRight:X.RH,borderTop:X.RH,borderBottom:X.RH});else null!==(n=o.borderAll)&&void 0!==n&&n.width||null!==(d=o.borderAll)&&void 0!==d&&d.style||null!==(s=o.borderAll)&&void 0!==s&&s.color?(r={border:{all:null,left:o.borderAll,right:o.borderAll,top:o.borderAll,bottom:o.borderAll,[X.Vz[l]]:{...o[l],...t[l]}}},a.setFieldsValue({borderAll:null,borderLeft:o.borderAll,borderRight:o.borderAll,borderTop:o.borderAll,borderBottom:o.borderAll,[l]:{...o[l],...t[l]}})):(r={border:{all:null,left:o.borderLeft,right:o.borderRight,top:o.borderTop,bottom:o.borderBottom,[X.Vz[l]]:{...o[l],...t[l]}}},a.setFieldsValue({border:r.border}));break;case"mobileBorderAll":case"mobileBorderTop":case"mobileBorderBottom":case"mobileBorderLeft":case"mobileBorderRight":if("mobileBorderAll"===o.mobileBorderPosition)r={mobileBorder:{...E.iV,all:{...X.RH,...o.mobileBorderAll,classNamePrefix:"em-mob-border_"+X.ax[l]+"-"}}},a.setFieldsValue({borderLeft:X.RH,borderRight:X.RH,borderTop:X.RH,borderBottom:X.RH});else{var m,c,u,p,g,h;const i=X.ax[l],n={...o[l],...t[l]},d=!(null!==n&&void 0!==n&&n.width)&&!(null!==n&&void 0!==n&&n.style)&&!(null!==n&&void 0!==n&&n.color);if(null!==(m=o.mobileBorder)&&void 0!==m&&null!==(c=m.all)&&void 0!==c&&c.width||null!==(u=o.mobileBorder)&&void 0!==u&&null!==(p=u.all)&&void 0!==p&&p.style||null!==(g=o.mobileBorder)&&void 0!==g&&null!==(h=g.all)&&void 0!==h&&h.color){const e=o.mobileBorderAll;r={mobileBorder:{all:null,left:e,right:e,top:e,bottom:e,[i]:d?null:{...n,classNamePrefix:"em-mob-border_"+i+"-"}}},a.setFieldsValue({mobileBorderAll:null,mobileBorderLeft:e,mobileBorderRight:e,mobileBorderTop:e,mobileBorderBottom:e,[l]:n})}else{const t=e.mobileBorder||{},o=e=>{const o=t[e];return o&&(null!==o&&void 0!==o&&o.width||null!==o&&void 0!==o&&o.style||null!==o&&void 0!==o&&o.color)?o:null};r={mobileBorder:{all:null,left:"left"===i?d?null:{...n,classNamePrefix:"em-mob-border_left-"}:o("left"),right:"right"===i?d?null:{...n,classNamePrefix:"em-mob-border_right-"}:o("right"),top:"top"===i?d?null:{...n,classNamePrefix:"em-mob-border_top-"}:o("top"),bottom:"bottom"===i?d?null:{...n,classNamePrefix:"em-mob-border_bottom-"}:o("bottom")}},a.setFieldsValue({[l]:n})}}break;case"width":r={[l]:{value:t[l],dim:o.widthDim}};break;case"height":r={[l]:{value:t[l],dim:o.heightDim}};break;case"widthDim":r={width:{value:o.width,dim:t[l]}};break;case"heightDim":r={height:{value:o.height,dim:t[l]}};break;case"backgroundImage":k(""===t[l]),r={[l]:[{...e.backgroundImage[0],value:t[l]}],backgroundSize:"cover"};break;case"paddingTop":case"paddingLeft":case"paddingRight":case"paddingBottom":r={padding:{left:o.paddingLeft,right:o.paddingRight,top:o.paddingTop,bottom:o.paddingBottom,[X.yy[l]]:+t[l]}};break;case"paddingTopBottom":r={padding:{left:o.paddingLeft,right:o.paddingRight,top:+t[l],bottom:+t[l]}},o.paddingTop=o.paddingBottom=+t[l];break;case"paddingLeftRight":r={padding:{top:o.paddingTop,bottom:o.paddingBottom,left:+t[l],right:+t[l]}},o.paddingLeft=o.paddingRight=+t[l];break;case"borderRadiusAll":r={borderRadius:{[X.wF[l]]:+t[l]}};break;case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":r={borderRadius:{topLeft:o.borderRadiusTopLeft,bottomLeft:o.borderRadiusBottomLeft,topRight:o.borderRadiusTopRight,bottomRight:o.borderRadiusBottomRight,[X.wF[l]]:+t[l]}};break;case"mobileWidth":r={[l]:{classNamePrefix:"em-mob-width-",value:t[l],dim:o.mobileWidthDim}};break;case"mobileWidthDim":r={mobileWidth:{classNamePrefix:"em-mob-width-",value:o.mobileWidth||100,dim:t[l]}};break;case"mobileHeight":r={[l]:{classNamePrefix:"em-mob-height-",value:t[l],dim:o.mobileHeightDim},mobileLineHeight:{classNamePrefix:"em-mob-line_height-",value:t[l],dim:o.mobileHeightDim}};break;case"mobileHeightDim":r={mobileHeight:{classNamePrefix:"em-mob-height-",value:o.mobileHeight,dim:t[l]}};break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":r={mobileBorderRadius:{[X.NW[l]]:t[l],classNamePrefix:"em-mob-border_radius_"+X.NW[l]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":r={mobileBoxShadow:{hOffset:o.mobileBoxShadowHOffset,vOffset:o.mobileBoxShadowVOffset,blurRadius:o.mobileBoxShadowBlurRadius,spreadRadius:o.mobileBoxShadowSpreadRadius,color:o.mobileBoxShadowColor,inset:o.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileAlign":r={[l]:{classNamePrefix:"em-mob-table_align-",value:t[l]}};break;case"mobileTextAlign":r={[l]:{classNamePrefix:"em-mob-text_align-",value:t[l]}};break;case"mobileVerticalAlign":r={[l]:{classNamePrefix:"em-mob-vertical_align-",value:t[l]}};break;case"mobileBackgroundColor":r={[l]:{classNamePrefix:"em-mob-background_color-",value:t[l]}};break;case"mobileBackgroundPositionX":r={[l]:{classNamePrefix:"em-mob-background_position_x-",value:t[l]}};break;case"mobileBackgroundPositionY":r={[l]:{classNamePrefix:"em-mob-background_position_x-",value:t[l]}};break;case"mobileBackgroundRepeat":r={[l]:{classNamePrefix:"em-mob-background_repeat-",value:t[l]}};break;case"mobilePaddingTop":case"mobilePaddingLeft":case"mobilePaddingRight":case"mobilePaddingBottom":r={mobilePadding:{all:null,top:""!==o.mobilePaddingTop?o.mobilePaddingTop:null,right:""!==o.mobilePaddingRight?o.mobilePaddingRight:null,bottom:""!==o.mobilePaddingBottom?o.mobilePaddingBottom:null,left:""!==o.mobilePaddingLeft?o.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingTopBottom":o.mobilePaddingTop=o.mobilePaddingBottom=t[l],r={mobilePadding:{all:null,top:""!==o.mobilePaddingTop?o.mobilePaddingTop:null,right:""!==o.mobilePaddingRight?o.mobilePaddingRight:null,bottom:""!==o.mobilePaddingBottom?o.mobilePaddingBottom:null,left:""!==o.mobilePaddingLeft?o.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobilePaddingLeftRight":o.mobilePaddingLeft=o.mobilePaddingRight=t[l],r={mobilePadding:{all:null,top:""!==o.mobilePaddingTop?o.mobilePaddingTop:null,right:""!==o.mobilePaddingRight?o.mobilePaddingRight:null,bottom:""!==o.mobilePaddingBottom?o.mobilePaddingBottom:null,left:""!==o.mobilePaddingLeft?o.mobilePaddingLeft:null,classNamePrefix:"em-mob-padding_"}};break;case"mobileFontSize":r={[l]:{classNamePrefix:"em-mob-font_size-",value:t[l],dim:o.mobileFontSizeDim}};break;case"href":let i=t[l];"https://http"===i.substring(0,12)&&(i=i.substring(8,i.length),o.href=i),r=i.startsWith("mailto:")?{[l]:(0,O.N_)(i,o.subject,o.body)}:{[l]:i},(0,O.b9)(t[l],se);break;case"subject":case"body":const b=o.href||"";if(!b.startsWith("mailto:"))return;{const e="subject"===l?t[l]:o.subject,i="body"===l?t[l]:o.body;r={href:(0,O.N_)(b,e,i)}}break;case"backgroundPositionX":case"backgroundPositionY":r={[l]:isNaN(parseFloat(t[l].position))?t[l].position:t[l].position+t[l].unit};break;default:r=t}var b;"borderPosition"!==l&&"mobileBorderPosition"!==l&&(i({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:r}),"mobileBorderRadiusAll"!==l&&"mobileBorderRadiusTopLeft"!==l&&"mobileBorderRadiusTopRight"!==l&&"mobileBorderRadiusBottomLeft"!==l&&"mobileBorderRadiusBottomRight"!==l&&Se({...e,...r,mobileBorderRadius:{...e.mobileBorderRadius,...null===(b=r)||void 0===b?void 0:b.mobileBorderRadius},activateSection:null,changeKey:l}))},we=e=>{a.setFieldValue("href","mergetag"!==e?e:""),se(e)};(0,l.useEffect)(()=>{var t;pe(!(null===(t=e.textReplacer)||void 0===t||!t.length))},[e]);return l.createElement(c.lV,{form:a,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:X.uE[ve]||"borderAll",mobileBorderPosition:X.lS[_e]||"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:ye,autoComplete:"off",className:"element-controls"},!x&&l.createElement(c.m_,{title:o("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"},l.createElement(c.Fc,{className:"selected_form-mobile-props-title",message:o("Appearance on mobile devices"),type:"info"})),x?l.createElement(ne,{form:a,elementSettings:e,showAddParagraph:!1,isButton:!0}):l.createElement(l.Fragment,null,v===E.ND&&y.styles?l.createElement("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props"},l.createElement(Me,{form:a,elementSettings:e,boxShadow:u,mobileBordersShow:V,mobileBorderRadiusShow:z,mobileBoxShadowShow:j,mobileSizeShow:Y,mobileBackgroundShow:Z,mobilePaddingShow:le,mobilePaddingsExt:N,setMobilePaddingsExt:P,oneMobileBorderRadiusValue:b,setOneMobileBorderRadiusValue:f,linkProtocol:de,handleLinkProtocolsChange:we,setLinkProtocol:se,toggleShowMobileBorderHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{M(e=>!e),V?(t.mobileBorderAll=X.RH,t.mobileBorderTop=X.RH,t.mobileBorderBottom=X.RH,t.mobileBorderRight=X.RH,t.mobileBorderLeft=X.RH):t.mobileBorderAll={width:1,color:"#E5E5E5",style:"solid"},i({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorder:{all:{color:t.mobileBorderAll.color,style:t.mobileBorderAll.style,width:t.mobileBorderAll.width}}}})})},toggleShowMobileBorderRadiusHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{W(e=>!e),z?(t.mobileBorderRadiusAll=null,f(!0)):t.mobileBorderRadiusAll=5,i({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBorderRadius:{all:t.mobileBorderRadiusAll,classNamePrefix:"em-mob-border_radius_all-"}}})})},toggleShowMobileBoxShadowHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{q(e=>!e),j?(t.mobileBoxShadowInset=!1,t.mobileBoxShadowHOffset=null,t.mobileBoxShadowVOffset=null,t.mobileBoxShadowBlurRadius=null,t.mobileBoxShadowSpreadRadius=null,t.mobileBoxShadowColor=""):(t.mobileBoxShadowInset=!1,t.mobileBoxShadowHOffset=5,t.mobileBoxShadowVOffset=5,t.mobileBoxShadowBlurRadius=10,t.mobileBoxShadowSpreadRadius=-5,t.mobileBoxShadowColor="#000000"),i({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBoxShadow:{blurRadius:t.mobileBoxShadowBlurRadius,color:t.mobileBoxShadowColor,hOffset:t.mobileBoxShadowHOffset,inset:t.mobileBoxShadowInset,spreadRadius:t.mobileBoxShadowSpreadRadius,vOffset:t.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},toggleShowMobileSizeHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{K(e=>!e),Y&&(t.mobileWidth="",t.mobileHeight="",i({operation:E.Ru.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-"}}}))})},toggleShowMobileBackgroundHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{ee(e=>!e),t.mobileBackgroundColor=Z?"":e.commonStyles.buttons.backgroundColor||"#1C52DC",i({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:t.mobileBackgroundColor}}})})},toggleShowMobilePaddingHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{ie(e=>!e),le&&(t.mobilePaddingLeftRight="",t.mobilePaddingLeft="",t.mobilePaddingRight="",t.mobilePaddingTopBottom="",t.mobilePaddingTop="",t.mobilePaddingBottom="",i({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{mobilePadding:{all:null,top:null,right:null,bottom:null,left:null,classNamePrefix:"em-mob-padding_"}}}))})}})):l.createElement("div",{id:"selected_element_form_desktop_props"},l.createElement(Ve,{form:a,elementSettings:e,boxShadow:u,bordersShow:L,borderRadiusShow:D,boxShadowShow:U,backgroundShow:Q,backgroundImageEmpty:w,backgroundRepeatOptions:he,paddingShow:te,paddingsExt:A,maxWidthValue:ae,oneBorderRadiusValue:g,setOneBorderRadiusValue:h,linkProtocol:de,linkTarget:me,isOpenTextReplacer:ue,textReplacerButtonRef:I,textReplacerInputRef:T,handleLinkProtocolsChange:we,handleSelect:({target:e})=>{const{selectionStart:t,selectionEnd:o}=e;e&&ce({target:e,selection:{start:t,end:o}})},textReplacerInputHandler:e=>{""!==e.target.value&&I.current.classList.add("selected-td-form__button--active")},handleTextReplacerKeyDown:e=>{const t=e.target,o=t.value,l=t.selectionStart;if(0!==l||" "!==e.key){if(" "===e.key){if(l!==o.length)return void e.preventDefault();o.endsWith(" ")&&e.preventDefault()}}else e.preventDefault()},srcButtonHandler:()=>{pe(!ue),ue?(a.setFieldValue("textReplacer",""),i({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{textReplacer:""}})):setTimeout(()=>T.current.focus())},togglePaddingHandler:()=>{C(e=>!e);const t=a.getFieldsValue(!0);A||(t.paddingLeftRight=t.paddingLeft,t.paddingTopBottom=t.paddingTop,t.paddingRight=t.paddingLeft,t.paddingBottom=t.paddingTop,i({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{top:t.paddingTopBottom,bottom:t.paddingTopBottom,left:t.paddingLeftRight,right:t.paddingLeftRight}}}))},toggleShowPaddingHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{oe(e=>!e),te&&(t.paddingLeftRight="",t.paddingLeft="",t.paddingRight="",t.paddingTopBottom="",t.paddingTop="",t.paddingBottom="",i({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{padding:{all:0}}}))})},toggleShowBackgroundHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{J(e=>!e),Q?(t.backgroundColor="",t.backgroundImage="",t.backgroundPositionX="",t.backgroundPositionY="",t.backgroundRepeat="none",t.backgroundSize="",k(!0)):(t.backgroundColor="#E5E5E5",t.backgroundSize="",t.backgroundRepeat="none"),i({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{backgroundColor:t.backgroundColor,backgroundImage:[{type:"url",value:t.backgroundImage}],backgroundPositionX:t.backgroundPositionX,backgroundPositionY:t.backgroundPositionY,backgroundRepeat:t.backgroundRepeat,backgroundSize:t.backgroundSize}})})},toggleShowBorderHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{F(e=>!e),L?(t.borderAll=X.RH,t.borderTop=X.RH,t.borderBottom=X.RH,t.borderRight=X.RH,t.borderLeft=X.RH):t.borderAll={width:1,color:"#E5E5E5",style:"solid"},i({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{border:{all:{color:t.borderAll.color,style:t.borderAll.style,width:t.borderAll.width}}}})})},toggleShowBorderRadiusHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{H(e=>!e),D?(t.borderRadiusAll=0,h(!0)):t.borderRadiusAll=5,i({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{borderRadius:{all:t.borderRadiusAll}}})})},toggleShowBoxShadowHandler:()=>{const t=a.getFieldsValue(!0);setTimeout(()=>{$(e=>!e),U?(t.boxShadowInset=!1,t.boxShadowHOffset=null,t.boxShadowVOffset=null,t.boxShadowBlurRadius=null,t.boxShadowSpreadRadius=null,t.boxShadowColor=""):(t.boxShadowInset=!1,t.boxShadowHOffset=5,t.boxShadowVOffset=5,t.boxShadowBlurRadius=10,t.boxShadowSpreadRadius=-5,t.boxShadowColor="#000000"),i({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{boxShadow:{blurRadius:t.boxShadowBlurRadius,color:t.boxShadowColor,hOffset:t.boxShadowHOffset,inset:t.boxShadowInset,spreadRadius:t.boxShadowSpreadRadius,vOffset:t.boxShadowVOffset}}})})},setLinkProtocol:se,handleChangeValues:ye}))))},He=({elementSettings:e})=>{const{__:t}=(0,_.s9)(),[o]=c.lV.useForm(),i=(0,S.XW)();(0,l.useEffect)(()=>{e&&o.setFieldsValue({...e})},[o,e]);return l.createElement(c.lV,{form:o,layout:"vertical",name:"selected_variable_form",initialValues:{value:""},onValuesChange:t=>{i({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:t})},autoComplete:"off"},l.createElement(c.lV.Item,{label:t("Variable value"),name:"value",tooltip:{title:t("Type the output parameters of your platform. E.g., ")+"${Recipient.FirstName}",icon:l.createElement(A.Ay,{icon:"InfoCircleOutlined"})},style:{marginBottom:35}},l.createElement(c.fs,{rows:4,placeholder:t("Variable value")})))},ze=({elementSettings:e,setElementSettings:t,postfix:o="",form:i,handleSelect:a,previewReloadSignal:n})=>{const{__:d}=(0,_.s9)(),{token:s}=(0,c.rd)(),m=(0,y.rD)(),u=(0,S.XW)(),p="src"+o,g="title"+o,h="alt"+o,f="link"+o,v="imgReplacer"+o,w=(0,l.useRef)(null),k=(0,l.useRef)(null),B=(0,l.useRef)(null),R=(0,l.useRef)(null),x=(0,l.useRef)(null),T=(0,l.useRef)(null),I=(0,l.useRef)(null),C=(0,l.useRef)(null),[N,P]=(0,l.useState)(""),[L,F]=(0,l.useState)(""),[V,M]=(0,l.useState)(""),[D,H]=(0,l.useState)(!1),[z,W]=(0,l.useState)("https://"),U=(0,l.useRef)(!1),$=(0,l.useRef)(o);(0,l.useEffect)(()=>{var t,l,i;o!==$.current&&($.current=o,U.current=!1),F(null===(t=e.images)||void 0===t?void 0:t[h]),M(null===(l=e.images)||void 0===l?void 0:l[g]);const a=null===(i=e.images)||void 0===i?void 0:i[f];P(a||(U.current?"...":""))},[e,h,g,f,o]);return l.createElement(l.Fragment,null,("img"===e.type||"video"===e.type||"carousel"===e.type)&&l.createElement(c.lV.Item,{style:{marginBottom:0}},l.createElement(b.A,{form:i,label:d("Image path"),name:p,placeholder:d("Image path"),elementSettings:e,previewReloadSignal:n,tooltipTitle:""})),l.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"}},l.createElement(c.$x,{size:8},l.createElement(c.m_,{title:L||d("Alternative text"),placement:"bottom",getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper")},l.createElement(c.$n,{className:r()("selected-td-form__button",{"selected-td-form__button--active":!!L}),onClick:()=>{L?(F(""),i.setFieldValue("alt",""),u({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[h]:""}})):(F(B.current&&B.current.input.value?B.current.input.value:"..."),setTimeout(()=>{B.current.focus()}))},ref:R},l.createElement("span",{className:"addon-text-content"},"Alt"))),m.formFieldImageTitleEnabled&&l.createElement(c.m_,{title:V||d("Tooltip text"),placement:"bottom",getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper")},l.createElement(c.$n,{className:r()("selected-td-form__button",{"selected-td-form__button--active":!!V}),onClick:()=>{V?(M(!1),i.setFieldValue("title",""),u({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[g]:""}})):(M(x.current&&x.current.input.value?x.current.input.value:"..."),setTimeout(()=>{x.current.focus()}))},ref:T},l.createElement("span",{className:"addon-text-content"},"Title"))),l.createElement(c.m_,{title:N||d("Hyperlink URL"),placement:"bottom",getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper")},l.createElement(c.$n,{className:r()("selected-td-form__button",{"selected-td-form__button--active":!!N}),icon:l.createElement(A.Ay,{icon:"LinkOutlined",className:"selected-td-form__icon-radius"}),onClick:()=>{N?(U.current=!1,P(""),i.setFieldValue(f,""),u({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[f]:""}})):(U.current=!0,P(w.current&&w.current.input.value?w.current.input.value:"..."),setTimeout(()=>{w.current.focus()}))},ref:k})),l.createElement(c.m_,{title:d("Image replacer"),placement:"bottom",getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper")},l.createElement(c.$n,{className:r()("selected-td-form__button",{"selected-td-form__button--active":D}),icon:l.createElement(A.Ay,{icon:"Replacer",className:"selected-td-form__icon-radius"}),onClick:()=>{H(!D),D?(i.setFieldValue(v,""),u({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:{[v]:""}})):setTimeout(()=>I.current.focus())},ref:C}))),l.createElement(c.$x,{size:8},l.createElement(c.m_,{title:d("Remove slide"),placement:"bottom"},l.createElement(c.$n,{type:"text",onClick:l=>{var a;const r=i.getFieldsValue(!0),n=+o.substring(1),d=Object.keys(null===r||void 0===r?void 0:r.images).reduce((e,t)=>(t.includes(o)||(e[t]=r[t]),e),{}),s=null===(a=e.carouselImages)||void 0===a?void 0:a.filter((e,t)=>t!==n);t(e=>({...e,settings:{...e.settings,carouselImages:s}})),u({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:E.bV.CAROUSEL,caption:e.caption,settings:{...e,carouselImages:s}}),i.setFieldsValue({images:d})},icon:l.createElement(A.Ay,{icon:"DeleteOutlined",size:16})})))),(!!N||!!L||!!V||!!D)&&l.createElement("div",null,!!N&&l.createElement(c.m_,{trigger:["hover"],title:d("Hyperlink URL"),placement:"bottom"},l.createElement(c.lV.Item,{name:f,className:"selected-image-form__alt",style:{marginTop:s.formItemMarginBottomXS,marginBottom:0}},l.createElement(c.pd,{addonBefore:l.createElement(O.Ai,{linkProtocol:z,handleLinkProtocolsChange:e=>{i.setFieldValue("LinkName","mergetag"!==e?e:""),W(e)},__:d}),placeholder:d("Hyperlink URL"),allowClear:!0,ref:w,onChange:e=>{""===e.target.value?P("..."):(k.current.classList.add("selected-td-form__button--active"),P(e.target.value));const t=e.target.value;(0,O.b9)(t,W)},onSelect:a,prefix:l.createElement(O.RM,{linkProtocol:z})}))),!!L&&l.createElement(c.m_,{trigger:["hover"],title:d("Alternative text"),placement:"bottom"},l.createElement(c.lV.Item,{name:h,className:"selected-image-form__alt",style:{marginTop:s.formItemMarginBottomXS,marginBottom:0}},l.createElement(c.pd,{placeholder:d("Alternative text"),allowClear:!0,prefix:l.createElement("span",{className:"addon-text-content"},"Alt"),onChange:e=>{""===e.target.value?F("..."):(R.current.classList.add("selected-td-form__button--active"),F(e.target.value))},ref:B,onSelect:a}))),m.formFieldImageTitleEnabled&&!!V&&l.createElement(c.m_,{trigger:["hover"],title:d("Tooltip text"),placement:"bottom"},l.createElement(c.lV.Item,{name:g,className:"selected-image-form__alt",style:{marginTop:s.formItemMarginBottomXS,marginBottom:0}},l.createElement(c.pd,{placeholder:d("Enter the title of the image"),allowClear:!0,prefix:l.createElement("span",{className:"addon-text-content"},"Title"),onChange:e=>{""===e.target.value?M("..."):(T.current.classList.add("selected-td-form__button--active"),M(e.target.value))},ref:x,onSelect:a}))),!!D&&l.createElement(c.m_,{trigger:["hover"],title:d("Image src"),placement:"bottom"},l.createElement(c.lV.Item,{name:v,className:"selected-image-form__alt",style:{marginTop:s.formItemMarginBottomXS,marginBottom:0}},l.createElement(c.pd,{placeholder:d("Code that will replace the image `src`"),allowClear:!0,prefix:l.createElement("span",{className:"addon-text-content"},d("Image src")),onChange:e=>{""!==e.target.value&&C.current.classList.add("selected-td-form__button--active")},ref:I,onSelect:a})))))},We=({form:e,elementSettings:t,formFields:o,setElementSettings:i,borderRadiusShow:a,oneBorderRadiusValue:r,setOneBorderRadiusValue:n,linkProtocol:d,mergeTagItems:s,mergeMenuOpen:m,setMergeMenuOpen:u,cascaderRef:p,handleLinkProtocolsChange:g,handleSelect:h,onChange:b,filter:f,renderSearchOption:E,toggleShowBorderRadiusHandler:S,setNewSlide:w})=>{const{__:k}=(0,_.s9)(),{token:B}=(0,c.rd)(),R=(0,y.rD)();return l.createElement(l.Fragment,null,l.createElement(c.m_,{trigger:["hover"],title:k("Link for all slides"),placement:"bottom"},l.createElement(c.lV.Item,{name:"link"},l.createElement(c.pd,{addonBefore:l.createElement(O.Ai,{linkProtocol:d,handleLinkProtocolsChange:g,__:k}),placeholder:k("Link for all slides"),allowClear:!0,onSelect:h,prefix:l.createElement(O.RM,{linkProtocol:d})}))),l.createElement(c.cG,{className:"selected-td-form__divider"}),R.mergeTagsShow&&s&&l.createElement(l.Fragment,null,l.createElement(c.fv,{span:24,id:"merge_tags_wrapper"},l.createElement(c.lV.Item,{style:{marginBottom:B.formItemMarginBottomMD,marginTop:B.formItemMarginBottomMD}},l.createElement(c.$n,{id:"merge_tags_button",icon:l.createElement(A.Ay,{icon:"MergeTags"}),style:{width:"100%",display:m?"none":"inline-flex"},onClick:()=>u(!0)},k("Merge tags")),l.createElement(c.vx,{ref:p,popupClassName:"merge-tags",options:s,placeholder:k("Start typing the title"),showSearch:{filter:f,render:E},spellCheck:"false",getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper"),onChange:b,style:{display:m?"block":"none"},open:m,onKeyDown:e=>{"Escape"===e.key&&u(!1)}}))),l.createElement(c.cG,{className:"selected-td-form__divider"})),l.createElement(c.lV.List,{name:"images",initialValue:null===o||void 0===o?void 0:o.images},()=>{var a,r;return l.createElement("div",{style:{paddingTop:B.formItemMarginBottomMD+4}},null===t||void 0===t||null===(a=t.settings)||void 0===a||null===(r=a.carouselImages)||void 0===r?void 0:r.map((t,a)=>l.createElement("div",{className:"carousel__slide",key:a},l.createElement(ze,{elementSettings:o,setElementSettings:i,postfix:"_"+a,form:e,handleSelect:h}))))}),l.createElement(c.fv,{span:24},l.createElement(c.lV.Item,{style:{marginBottom:B.formItemMarginBottomMD}},l.createElement(c.$n,{id:"add_slide_button",icon:l.createElement(A.Ay,{icon:"AddSlide"}),style:{width:"100%"},onClick:()=>w()},k("Add slide")))),l.createElement(c.cG,{className:"selected-td-form__divider"}),l.createElement(c.fI,{gutter:20,style:{marginTop:B.formItemMarginBottomMD-10}},l.createElement(c.fv,{span:12},l.createElement(c.lV.Item,{name:"loop",valuePropName:"checked",style:{marginBottom:B.formItemMarginBottomMD-6}},l.createElement(c.dO,{id:"Loop",label:k("Loop"),size:"small",labelStyle:{position:"relative",top:2}}))),l.createElement(c.fv,{span:12},l.createElement(c.lV.Item,{name:"autoplay",valuePropName:"checked",style:{marginBottom:B.formItemMarginBottomMD-6}},l.createElement(c.dO,{id:"Autoplay",label:k("Autoplay"),size:"small",labelStyle:{position:"relative",top:2}})))),R.formFieldBorderRadiusEnabled&&l.createElement(c.y9,{title:k("Border radius"),collapsible:!0,open:a,onToggle:S,dividerTop:!0},l.createElement(v.A,{form:e,oneBorderRadiusValue:r,setOneBorderRadiusValue:n,elementSettings:t.settings})))},Ue=()=>{const{__:e}=(0,_.s9)();return l.createElement(l.Fragment,null,l.createElement("p",null,e("No properties to edit.")))},$e={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:""},Ge=({elementSettings:e})=>{const{__:t}=(0,_.s9)(),[o]=c.lV.useForm();let i=(0,n.wA)();(0,y.rD)();const a=(0,S.K9)(),r=(0,S.XW)(),{openImagePicker:d}=(0,Z.p)(),s=(0,n.d4)(G.Ct),m=(0,n.d4)(G.CS),[u,p]=(0,l.useState)(!0),[g,h]=(0,l.useState)(!0),[b,f]=(0,l.useState)(!1),[v,w]=(0,l.useState)(!1),[k,B]=(0,l.useState)("https://"),[R,x]=(0,l.useState)(null===o||void 0===o?void 0:o.getFieldsValue(!0)),[T,I]=(0,l.useState)(e),[A,C]=(0,l.useState)({name:"",counter:0}),[N,P]=(0,l.useState)(null),[L,F]=(0,l.useState)(),[V,M]=(0,l.useState)(!1),[D,H]=(0,l.useState)(!1),[W,U]=(0,l.useState)({start:0,end:0}),j=(0,l.useRef)(null),X=`selected_${T.type}_form_link`,ee=(0,n.d4)(G.Fv),te=(0,n.d4)(G.yy),oe=ee&&"bottom"!==te;(0,l.useEffect)(()=>{V&&j.current&&j.current.focus()},[V]),(0,l.useEffect)(()=>{I(e)},[e]);const le=(0,n.d4)(q.GH);(0,l.useEffect)(()=>{var e;null!==le&&void 0!==le&&null!==(e=le.items)&&void 0!==e&&e.length&&F((0,y.cM)(le.items,t,(e,t)=>{M(!1),a(E.Ru.SANDBOX_ADD_MERGETAG,e),t.stopPropagation(),t.preventDefault()}))},[le,F,t,M,a]);const ie=(0,Q.cR)();(0,l.useEffect)(()=>{const e=new K.jG;return e.addDisposable((0,Y.a)(ie,"focusin",({target:e})=>{e.closest('[id="merge_tags_wrapper"]')||P(e)})),e.addDisposable((0,Y.a)(ie,"click",({target:e})=>{e.closest(".merge-tags")||e.closest("#merge_tags_button")||M(!1)})),()=>{e.dispose()}},[ie]);(0,l.useEffect)(()=>{const e=null===o||void 0===o?void 0:o.getFieldsValue(!0);x(e)},[o]);(0,l.useEffect)(()=>{if(T.settings){var e,t,l,i,a,r,n,d,s,m,c,u,g,b,v;const R=T.settings,I=(0,O.AO)(R);var _,E,S,y,k;if(null===o||void 0===o||o.setFieldsValue(I),x(I),R.link&&B((0,O.TW)(R.link,"https://")),!(0,O.ok)(null===(e=R.borderRadius)||void 0===e?void 0:e.all))(0,O.ok)(null===(_=R.borderRadius)||void 0===_?void 0:_.topLeft)||(0,O.ok)(null===(E=R.borderRadius)||void 0===E?void 0:E.bottomLeft)||(0,O.ok)(null===(S=R.borderRadius)||void 0===S?void 0:S.topRight)||(0,O.ok)(null===(y=R.borderRadius)||void 0===y?void 0:y.bottomRight)?p(!1):(0,O.ok)(null===(k=R.borderRadius)||void 0===k?void 0:k.all)||p(!0);(0,O.ok)(null===(t=R.mobileBorderRadius)||void 0===t?void 0:t.topLeft)||(0,O.ok)(null===(l=R.mobileBorderRadius)||void 0===l?void 0:l.bottomLeft)||(0,O.ok)(null===(i=R.mobileBorderRadius)||void 0===i?void 0:i.topRight)||(0,O.ok)(null===(a=R.mobileBorderRadius)||void 0===a?void 0:a.bottomRight)?h(!1):h(!0),f(!(null===(r=R.borderRadius)||void 0===r||!r.all)||!(null===(n=R.borderRadius)||void 0===n||!n.topLeft)||!(null===(d=R.borderRadius)||void 0===d||!d.bottomLeft)||!(null===(s=R.borderRadius)||void 0===s||!s.topRight)||!(null===(m=R.borderRadius)||void 0===m||!m.bottomRight)),w(!(null===(c=R.mobileBorderRadius)||void 0===c||!c.all)||!(null===(u=R.mobileBorderRadius)||void 0===u||!u.topLeft)||!(null===(g=R.mobileBorderRadius)||void 0===g||!g.bottomLeft)||!(null===(b=R.mobileBorderRadius)||void 0===b||!b.topRight)||!(null===(v=R.mobileBorderRadius)||void 0===v||!v.bottomRight))}},[o,T]);const ae=e=>{const t=(0,O.Ze)(T.settings,o,e);r({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:E.bV.CAROUSEL,caption:t.caption,settings:t}),I(e=>({...e,settings:{...e.settings,...t}}))},re=async e=>{var t;const o=await d({kind:"img",currentUrl:(0,J.xv)((null===(t=T.settings)||void 0===t?void 0:t.src)||""),entryModal:e});null!==o&&void 0!==o&&o.url&&((e,t)=>{var o,l;const i=(0,J.xv)((null===(o=T.settings)||void 0===o?void 0:o.src)||"")===(0,J.xv)(e||"");i&&e===(null===(l=T.settings)||void 0===l?void 0:l.src)||ae({src:e}),"save"===(null===t||void 0===t?void 0:t.mode)&&i&&(C(e=>({name:"src",counter:e.counter+1})),r({operation:E.Ru.SANDBOX_CURRENT_IMAGE_RELOAD,src:e,forceReload:!0}))})(o.url,o.meta)};(0,z.A)(e=>{const t=e.data.operation;t===E.Ru.APPLICATION_OPEN_IMAGE_AI_POPUP?re(E.lx.UPLOAD_IMAGE_MODAL_AI):t===E.Ru.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?re(E.lx.UPLOAD_IMAGE_MODAL_UPLOAD):t===E.Ru.APPLICATION_OPEN_IMAGE_EDIT_POPUP?re(E.lx.UPLOAD_IMAGE_MODAL_EDIT):t===E.Ru.APPLICATION_OPEN_IMAGE_GIF_POPUP?re(E.lx.UPLOAD_IMAGE_MODAL_GIF):t===E.Ru.APPLICATION_OPEN_IMAGE_STOCK_POPUP?re(E.lx.UPLOAD_IMAGE_MODAL_STOCK):t===E.Ru.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(i((0,$.Os)()),i((0,$.Oo)()))});return l.createElement(c.lV,{form:o,layout:"vertical",name:"selected_carousel_form",initialValues:$e,onValuesChange:ae,autoComplete:"off",className:"element-controls"},!oe&&l.createElement(c.m_,{title:t("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"},l.createElement(c.Fc,{className:"selected_form-mobile-props-title",message:t("Appearance on mobile devices"),type:"info"})),s===E.ND&&m.styles?l.createElement("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props"},l.createElement(Ue,null)):l.createElement("div",{id:"selected_element_form_desktop_props"},l.createElement(We,{form:o,elementSettings:T,formFields:R,setElementSettings:I,borderRadiusShow:b,oneBorderRadiusValue:u,setOneBorderRadiusValue:p,linkProtocol:k,mergeTagItems:L,mergeMenuOpen:V,setMergeMenuOpen:M,cascaderRef:j,handleLinkProtocolsChange:e=>{o.setFieldValue("link","mergetag"!==e?e:""),B(e)},handleSelect:({target:e})=>{if(e&&!D){const{selectionStart:t,selectionEnd:o}=e;U({start:t,end:o})}H(!1)},onChange:(e,t)=>{if(M(!1),e){const l=le.syntax.length>1?L.findIndex(e=>e.key===t[0].key):0,i=le.syntax[l].replace("%value%",e[e.length-1]),a=`selected_${T.type}_form${"carousel"===T.type?"_images":""}`;["imgReplacer","title","alt","src","link"].some(e=>null===N||void 0===N?void 0:N.getAttribute("id").includes(`${a}_${e}`))||null!==N&&void 0!==N&&N.getAttribute("id").includes(X)?((e,t)=>{const l=document.getElementById(t);if(l){var i,a;const s=`selected_${T.type}_form_${t.includes("__images_")?"_images":""}_`,m=t.substring(t.indexOf(s)+s.length),c=null===(i=l.value)||void 0===i?void 0:i.substring(0,W.start),u=null===(a=l.value)||void 0===a?void 0:a.substring(W.end);let p={[m]:c+e+u};var n;if(m.includes("_"))p={carouselImages:[...(null===(n=T.settings)||void 0===n?void 0:n.carouselImages)||[]]},p.carouselImages[m.split("_")[1]][m.split("_")[0]]=c+e+u;else if(T.type===E.bV.CAROUSEL&&X===t){var d;p={[m]:c+e+u,carouselImages:[...(null===(d=T.settings)||void 0===d?void 0:d.carouselImages.map(t=>({...t,link:c+e+u})))||[]]}}r({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:E.bV.CAROUSEL,settings:{...T.settings,...p}}),I(e=>({...e,settings:{...e.settings,...p}})),o.setFieldValue(m,c+e+u),l.focus(),setTimeout(()=>{l.selectionStart=W.start,l.selectionEnd=W.start+e.length},400),H(!0)}})(i,null===N||void 0===N?void 0:N.getAttribute("id")):(o.setFieldValue("imgReplacer",i),r({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:E.bV.CAROUSEL,settings:{...T.settings,imgReplacer:i}}),I(e=>({...e,settings:{...e.settings,imgReplacer:i}})))}},filter:(e,t)=>t.some(t=>t.label.toLowerCase().indexOf(e.toLowerCase())>-1),renderSearchOption:(e,t)=>{const o=t.map((t,o)=>{const i=t.label.split(new RegExp(`(${e})`,"gi"));return l.createElement("span",{key:t.value},0!==o&&l.createElement("span",null,"\xa0/\xa0"),i.map((t,o)=>t.toLowerCase()===e.toLowerCase()?l.createElement("span",{key:o,style:{color:"red"}},t):t))});return l.createElement("div",{title:t.map(e=>e.label).join(" / ")},o)},toggleShowBorderRadiusHandler:()=>{setTimeout(()=>{f(e=>!e),o.setFieldValue("borderRadiusAll",b?0:5),r({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:E.bV.CAROUSEL,settings:{...T.settings,borderRadius:{all:b?"":5}}}),I(e=>({...e,settings:{...e.settings,borderRadius:{all:b?null:5}}}))})},setNewSlide:()=>{var e,t;const{width:o,height:l,renderedWidth:i,renderedHeight:a}=(null===T||void 0===T||null===(e=T.settings)||void 0===e?void 0:e.carouselImages[0])||{width:{value:600},height:{value:600},renderedWidth:600,renderedHeight:600},n={src:"https://emcdn.ru/1865/231031_17_BGU9Mso.png",width:{value:o.value,dim:"px"},height:{value:l.value,dim:"px"},alt:"",title:"",link:null,renderedWidth:i,renderedHeight:a,imgReplacer:"",mobileWidth:{value:null,dim:"px"},mobileHeight:{value:null,dim:"px"},mobileBorderRadius:{all:null,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}},d=[...null===T||void 0===T||null===(t=T.settings)||void 0===t?void 0:t.carouselImages,n];r({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:E.bV.CAROUSEL,settings:{...T.settings,carouselImages:d}}),I(e=>({...e,settings:{...e.settings,carouselImages:d}}))}})))},je={animate:!0,expandSingleSection:!0,sections:[{expanded:!1,index:0}]},Xe=({elementSettings:e})=>{const{__:t}=(0,_.s9)(),{token:o}=(0,c.rd)(),[i]=c.lV.useForm(),a=(0,S.XW)(),r=(0,y.rD)(),[n,d]=(0,l.useState)(e);(0,l.useEffect)(()=>{d(e)},[e]),(0,l.useEffect)(()=>{if(n.settings){const e=n.settings,t=(0,O.AO)(e);null===i||void 0===i||i.setFieldsValue(t)}},[i,n]);return l.createElement(c.lV,{form:i,layout:"vertical",name:"selected_carousel_form",initialValues:je,onValuesChange:e=>{const t=(0,O.Ze)(n.settings,i,e);a({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:n.type,caption:t.caption,settings:t}),d(e=>({...e,settings:{...e.settings,...t}}))},autoComplete:"off",className:"element-controls"},l.createElement("div",{id:"selected_element_form_desktop_props"},l.createElement(c.fI,{gutter:20},l.createElement(c.fv,{span:15},l.createElement(c.lV.Item,{name:"expandSingleSection",valuePropName:"checked"},l.createElement(c.dO,{id:"ExpandSingleSection",label:t("Expand only one section"),size:"small",labelStyle:{position:"relative",top:2}}))),l.createElement(c.fv,{span:9},l.createElement(c.lV.Item,{name:"animate",valuePropName:"checked"},l.createElement(c.dO,{id:"Animate",label:t("Animate"),size:"small",labelStyle:{position:"relative",top:2}})))),l.createElement(c.cG,{className:"selected-td-form__divider"}),l.createElement(c.lV.List,{name:"sections"},()=>{var e,i;return l.createElement("div",{style:{paddingTop:o.formItemMarginBottomMD+4}},null===n||void 0===n||null===(e=n.settings)||void 0===e||null===(i=e.sections)||void 0===i?void 0:i.map((e,o)=>{var i,r;return l.createElement(c.fI,{gutter:24,key:`expanded_${o}`},l.createElement(c.fv,{span:20},l.createElement(c.$x,{size:10,align:"baseline"},l.createElement("span",{style:{position:"relative",top:2}},t("Section ")+(o+1)),l.createElement(c.lV.Item,{name:`expanded_${o}`,valuePropName:"checked"},l.createElement(c.dO,{id:`expanded_${o}`,label:t("expanded"),labelSize:"small",size:"small"})))),l.createElement(c.fv,null,(null===n||void 0===n||null===(i=n.settings)||void 0===i||null===(r=i.sections)||void 0===r?void 0:r.length)>1&&l.createElement(c.$n,{type:"text",icon:l.createElement(A.Ay,{icon:"DeleteOutlined",size:16}),style:{marginRight:"auto"},onClick:()=>{return e=o,d(t=>{var o;return{...t,settings:{...t.settings,sections:null===(o=n.settings.sections)||void 0===o?void 0:o.filter((t,o)=>o!==e)}}}),void a({operation:E.Ru.SANDBOX_ACCORDION_REMOVE_SECTION,settings:{index:e}});var e}})))}))}),l.createElement(c.fI,{gutter:20},l.createElement(c.fv,{span:24},l.createElement(c.lV.Item,{style:{marginBottom:o.formItemMarginBottomMD}},l.createElement(c.$n,{style:{display:"inline-flex",alignItems:"center",width:"100%"},icon:l.createElement(A.Ay,{icon:"PlusCircleOutlined",size:16,strokeWidth:r.iconStrokeWidth}),onClick:()=>(d(e=>{var t;return{...e,sections:null===n||void 0===n||null===(t=n.settings)||void 0===t?void 0:t.sections.push({expanded:!1})}}),void a({operation:E.Ru.SANDBOX_ACCORDION_ADD_SECTION,settings:{section:t("Section title"),text:t("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")}}))},t(" Add section"))))),l.createElement(c.cG,{className:"selected-td-form__divider"})))};var qe=o(63270),Ye=o(46563),Ke=o(59696),Qe=o(3774);const{Text:Je}=c.Typography,Ze="text/plain",et=l.createElement("span",{className:"addon-text-content"},"Alt"),tt=l.createElement("span",{className:"addon-text-content"},"Title");function ot(e){return e.closest(".email-pane__collapse-wrapper")}function lt({form:e,name:t,placeholder:o,usedColors:i,onColorChange:a}){const r=c.lV.useWatch(t,e);return l.createElement(c.it,{placeholder:o,usedColors:i,value:"string"===typeof r?r:"",onChange:e=>a(t,e)})}const it=/^[a-z][a-z0-9+.-]*:/i;function at(e){const t="string"===typeof e?e.trim():String(null!==e&&void 0!==e?e:"").trim();return t?it.test(t)?t:`https://${t}`:""}async function rt(e,t){if(t===E.lx.UPLOAD_IMAGE_MODAL_EDIT&&function(e){if(!e)return!1;try{return new URL(e,"undefined"!==typeof window&&window.location?window.location.origin:"http://localhost").pathname.includes("/static/media/")}catch{return!1}}(e)){try{const o=new URL(e,"undefined"!==typeof window&&window.location?window.location.origin:"http://localhost").href,l=await fetch(o);if(l.ok){const e=await l.blob();return{entryModal:t,currentUrl:"",imageDataUrl:await new Promise((t,o)=>{const l=new FileReader;l.onload=()=>t(l.result),l.onerror=o,l.readAsDataURL(e)})}}}catch{}return{entryModal:E.lx.UPLOAD_IMAGE_MODAL_UPLOAD,currentUrl:""}}return{entryModal:t,currentUrl:e}}function nt(e){var t,o,l,i,a;const r=(null===e||void 0===e?void 0:e.settings)||{};return JSON.stringify({type:null!==(t=null===e||void 0===e?void 0:e.type)&&void 0!==t?t:null,caption:null!==(o=null===e||void 0===e?void 0:e.caption)&&void 0!==o?o:null,parent:null!==(l=null!==(i=null===e||void 0===e?void 0:e.parent)&&void 0!==i?i:r.parent)&&void 0!==l?l:null,path:null!==(a=r.path)&&void 0!==a?a:null})}function dt(e){if(!Array.isArray(e)||0===e.length)return"";const t=e.map(e=>{var t;return String(null!==(t=null===e||void 0===e?void 0:e.itemBorderColor)&&void 0!==t?t:"").trim()}),o=t[0];return t.every(e=>e===o)?o:""}function st(e,t){const o=String(null!==e&&void 0!==e?e:"").trim(),l=String(null!==t&&void 0!==t?t:"").trim();return l||o}function mt(e,t,o){const l=String(null!==e&&void 0!==e?e:"").trim(),i=String(null!==t&&void 0!==t?t:"").trim(),a=String(null!==o&&void 0!==o?o:"").trim();return!a||l&&a===l?i:a}function ct({__:e,form:t,fieldName:o,pushSettingsToIframe:i}){const{token:a}=(0,c.rd)(),n=c.lV.useWatch(["items",o,"alt"],t),d=c.lV.useWatch(["items",o,"title"],t),s="string"===typeof n?n:String(null!==n&&void 0!==n?n:""),m="string"===typeof d?d:String(null!==d&&void 0!==d?d:""),[u,p]=(0,l.useState)(!1),[g,h]=(0,l.useState)(!1),b=(0,l.useRef)(null),f=(0,l.useRef)(null),v=(0,l.useMemo)(()=>({clearIcon:l.createElement(c.tL,null)}),[]);(0,l.useEffect)(()=>{s.trim()&&p(!0)},[s]),(0,l.useEffect)(()=>{m.trim()&&h(!0)},[m]);const _=!(!s.trim()&&!u),E=!(!m.trim()&&!g),S=_||E,y=(0,l.useMemo)(()=>({marginBottom:S?a.formItemMarginBottomXS:a.formItemMarginBottomMD+4}),[S,a.formItemMarginBottomMD,a.formItemMarginBottomXS]),w=(0,l.useMemo)(()=>[o,"alt"],[o]),k=(0,l.useMemo)(()=>[o,"title"],[o]),B=(0,l.useMemo)(()=>s.trim()?s.trim():e("Alternative text"),[e,s]),R=(0,l.useMemo)(()=>m.trim()?m.trim():e("Tooltip text"),[e,m]),x=(0,l.useMemo)(()=>r()("selected-td-form__button",{"selected-td-form__button--active":_}),[_]),T=(0,l.useMemo)(()=>r()("selected-td-form__button",{"selected-td-form__button--active":E}),[E]),I=(0,l.useCallback)(e=>{setTimeout(()=>{const t=e.current;t&&("function"!==typeof t.focus?t.input&&"function"===typeof t.input.focus&&t.input.focus():t.focus())},0)},[]),A=(0,l.useCallback)(()=>{_?(p(!1),s.trim()&&(t.setFieldValue(["items",o,"alt"],""),setTimeout(()=>i(),0))):(p(!0),I(b))},[_,s,o,I,t,i]),C=(0,l.useCallback)(()=>{E?(h(!1),m.trim()&&(t.setFieldValue(["items",o,"title"],""),setTimeout(()=>i(),0))):(h(!0),I(f))},[o,I,t,i,E,m]);return l.createElement("div",{className:"selected-social-form__meta-block"},l.createElement(c.$x,{size:8,className:"selected-social-form__meta-toggle-row",style:y},l.createElement(c.m_,{title:B,placement:"bottom",getPopupContainer:ot},l.createElement(c.$n,{type:"default",className:x,onClick:A},l.createElement("span",{className:"addon-text-content"},"Alt"))),l.createElement(c.m_,{title:R,placement:"bottom",getPopupContainer:ot},l.createElement(c.$n,{type:"default",className:T,onClick:C},l.createElement("span",{className:"addon-text-content"},"Title")))),S&&l.createElement("div",{className:"selected-social-form__meta-fields"},_&&l.createElement(c.lV.Item,{name:w,className:"selected-social-form__card-field"},l.createElement(c.pd,{ref:b,placeholder:e("Alternative text"),allowClear:v,prefix:et})),E&&l.createElement(c.lV.Item,{name:k,className:"selected-social-form__card-field"},l.createElement(c.pd,{ref:f,placeholder:e("Social network name"),allowClear:v,prefix:tt}))))}function ut(e){var t,o,l,i,a;if(!e)return{align:"center",iconSize:40,borderRadius:0,gap:8,globalBgColor:"",globalItemBorderColor:"",buttonBorderWidth:0,showLabel:!1,items:[]};const r=function(e){var t;const o=String(null!==(t=null===e||void 0===e?void 0:e.bgColor)&&void 0!==t?t:"").trim();return{blockBgEnabled:!(null===e||void 0===e||!e.bgEnabled||!o),blockBgColor:o}}(e),n=function(e,t){var o;if(!Array.isArray(e)||0===e.length)return t;let l=null;for(const i of e){const e=i.iconWidth,o=i.iconHeight;if(null==e||null==o||Number.isNaN(e)||Number.isNaN(o)||e<=0||o<=0)return t;if(e!==o)return t;if(null===l)l=e;else if(e!==l)return t}return null!==(o=l)&&void 0!==o?o:t}(e.items,null!==(t=e.iconSize)&&void 0!==t?t:40),d="number"!==typeof e.buttonBorderWidth||Number.isNaN(e.buttonBorderWidth)?0:e.buttonBorderWidth,s=e.bgEnabled&&e.bgColor?String(e.bgColor).trim():"";return{align:null!==(o=e.align)&&void 0!==o?o:"center",iconSize:n,borderRadius:null!==(l=e.borderRadius)&&void 0!==l?l:0,gap:null!==(i=e.gap)&&void 0!==i?i:8,globalBgColor:s,globalItemBorderColor:dt(e.items),buttonBorderWidth:d,showLabel:null!==(a=e.showLabel)&&void 0!==a&&a,items:Array.isArray(e.items)?e.items.map(e=>{var t;const o=st(s,e.buttonBgColor),l=e.platform?(0,Qe.d2)(e.platform,{...r,buttonBgColor:o}):null;return{...e,...l?{iconSrc:l}:{},iconWidth:null,iconHeight:null,buttonBgColor:o,itemBorderColor:String(null!==(t=e.itemBorderColor)&&void 0!==t?t:"").trim()}}):[]}}const pt=({elementSettings:e})=>{var t;const{__:o}=(0,_.s9)(),i=(0,y.rD)(),a=(0,n.wA)(),[s]=c.lV.useForm(),m=(0,S.XW)(),{openImagePicker:u}=(0,Z.p)(),[p,g]=(0,l.useState)(e),[h,b]=(0,l.useState)(null),[f,v]=(0,l.useState)(null),w=(0,l.useRef)(null),B=(0,l.useRef)(null),R=(0,l.useRef)(null),x=(0,l.useRef)(nt(e)),T=(0,n.d4)(d.uJ),I=(0,l.useRef)(null),C=(0,l.useRef)(!1),N=(0,l.useRef)(""),P=function(){const e=(0,n.d4)(d.Up),[t,o]=(0,l.useState)(()=>"undefined"!==typeof document&&document.body.classList.contains("dark"));return(0,l.useEffect)(()=>{const e=()=>o(document.body.classList.contains("dark"));e();const t=new MutationObserver(e);return t.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]),"vs-dark"===e||t?"dark":"light"}(),L=null!==(t=null===T||void 0===T?void 0:T.usedColors)&&void 0!==t?t:[],F=(0,l.useCallback)(()=>{I.current&&(document.removeEventListener("dragover",I.current,!0),I.current=null)},[]),O=(0,l.useCallback)(()=>{if(I.current)return;const e=e=>{e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move")};document.addEventListener("dragover",e,!0),I.current=e},[]),V=(0,l.useMemo)(()=>(0,Ke.EX)("em").filter(e=>Qe.ww[e.id]),[]),M=(0,l.useMemo)(()=>V.map(e=>({value:e.id,label:l.createElement("span",{className:"selected-social-form__platform-option"},l.createElement("img",{src:(0,Qe.BS)(e.id,P),alt:""}),l.createElement("span",{className:"selected-social-form__platform-option-text"},o(e.labelMsgid)))})),[o,V,P]);(0,l.useEffect)(()=>{const t=nt(e);x.current!==t&&(x.current=t,g(e))},[e]),(0,l.useEffect)(()=>{if(null!==p&&void 0!==p&&p.settings){const e=p.settings;N.current=e.bgEnabled&&e.bgColor?String(e.bgColor).trim():"",s.setFieldsValue(ut(p.settings))}},[p,s]),(0,l.useEffect)(()=>()=>F(),[F]);const D=(0,l.useCallback)(()=>{var e,t,o,l,i;const a=s.getFieldsValue(!0),r=p.settings||{},n=(a.globalBgColor||"").trim(),d="number"!==typeof a.iconSize||Number.isNaN(a.iconSize)?null!==(e=r.iconSize)&&void 0!==e?e:40:a.iconSize,c="number"!==typeof a.borderRadius||Number.isNaN(a.borderRadius)?null!==(t=r.borderRadius)&&void 0!==t?t:0:a.borderRadius,u="number"!==typeof a.gap||Number.isNaN(a.gap)?null!==(o=r.gap)&&void 0!==o?o:8:a.gap,h={blockBgEnabled:!!n,blockBgColor:n},b=(a.globalItemBorderColor||"").trim();let f="number"!==typeof a.buttonBorderWidth||Number.isNaN(a.buttonBorderWidth)?0:a.buttonBorderWidth;f=Math.max(0,Math.min(24,Math.round(f)));const v={...r,type:"social",align:null!==(l=null!==(i=a.align)&&void 0!==i?i:r.align)&&void 0!==l?l:"center",iconSize:d,borderRadius:c,gap:u,bgEnabled:!!n,bgColor:n,borderWidth:"number"===typeof r.borderWidth?r.borderWidth:0,borderColor:"string"===typeof r.borderColor?r.borderColor:"",buttonBorderColor:"",buttonBorderWidth:f,showLabel:a.showLabel,items:(a.items||[]).filter(Boolean).map(e=>{var t;const o=function(e,t){const o=String(null!==e&&void 0!==e?e:"").trim(),l=String(null!==t&&void 0!==t?t:"").trim();return l?o&&l===o?"":l:""}(n,(e.buttonBgColor||"").trim()),l="string"===typeof e.href?at(e.href):e.href,i=st(n,o),a=e.platform?(0,Qe.d2)(e.platform,{...h,buttonBgColor:i}):null,r=b||String(null!==(t=e.itemBorderColor)&&void 0!==t?t:"").trim(),d=function(e){const t="string"===typeof e?e.trim():String(null!==e&&void 0!==e?e:"").trim();if(!t)return"";if(/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(t))return t;try{return new URL(t,"undefined"!==typeof window&&window.location?window.location.origin:"http://localhost").href}catch{return t}}(a||e.iconSrc||"");return{...e,href:l,iconSrc:d,iconWidth:null,iconHeight:null,buttonBgColor:o,itemBorderColor:r}})};m({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:E.bV.SOCIAL,caption:p.caption,settings:v}),N.current=n,g(e=>({...e,settings:v}))},[p.caption,p.settings,s,m]),H=(0,l.useCallback)(e=>{if(null==e||""===e)return-1;const t=(0,J.xv)(String(e));return(s.getFieldValue("items")||[]).findIndex(e=>(0,J.xv)(e&&e.iconSrc||"")===t)},[s]),W=(0,l.useCallback)((e,t,o,l)=>{var i;const a=[...s.getFieldValue("items")||[]];if(e<0||e>=a.length)return;const r=(0,J.xv)(String(l||""))===(0,J.xv)(String(t||""));r&&t===(null===(i=a[e])||void 0===i?void 0:i.iconSrc)||(a[e]={...a[e],iconSrc:t,platform:void 0},s.setFieldValue("items",a),setTimeout(()=>D(),0)),"save"===(null===o||void 0===o?void 0:o.mode)&&r&&m({operation:E.Ru.SANDBOX_CURRENT_IMAGE_RELOAD,src:t,forceReload:!0})},[s,D,m]),U=(0,l.useCallback)(async(e,t)=>{var o;const l=(0,J.xv)(String(t||"")),i=H(t);if(i<0)return;const a=null===(o=(s.getFieldValue("items")||[])[i])||void 0===o?void 0:o.iconSrc,{entryModal:r,currentUrl:n,imageDataUrl:d}=await rt(l,e),m=await u({kind:"img",currentUrl:n,entryModal:r,imageDataUrl:d});null!==m&&void 0!==m&&m.url&&W(i,m.url,m.meta,a)},[W,H,s,u]),G=(0,l.useCallback)(e=>{var t,o;const l=null===(t=e.data)||void 0===t?void 0:t.operation,i=null===(o=e.data)||void 0===o?void 0:o.src;l===E.Ru.APPLICATION_OPEN_IMAGE_AI_POPUP?U(E.lx.UPLOAD_IMAGE_MODAL_AI,i):l===E.Ru.APPLICATION_OPEN_IMAGE_UPLOAD_POPUP?U(E.lx.UPLOAD_IMAGE_MODAL_UPLOAD,i):l===E.Ru.APPLICATION_OPEN_IMAGE_EDIT_POPUP?U(E.lx.UPLOAD_IMAGE_MODAL_EDIT,i):l===E.Ru.APPLICATION_OPEN_IMAGE_GIF_POPUP?U(E.lx.UPLOAD_IMAGE_MODAL_GIF,i):l===E.Ru.APPLICATION_OPEN_IMAGE_STOCK_POPUP?U(E.lx.UPLOAD_IMAGE_MODAL_STOCK,i):l===E.Ru.APPLICATION_CLOSE_IMAGE_EDIT_POPUP&&(a((0,$.Os)()),a((0,$.Oo)()))},[a,U]);(0,z.A)(G);const j=(0,l.useCallback)(()=>{const e=s.getFieldValue("items")||[],t=V[0],o=(s.getFieldValue("globalItemBorderColor")||"").trim(),l=(s.getFieldValue("globalBgColor")||"").trim();if(t){const i=(0,Qe.d2)(t.id,{blockBgEnabled:!!l,blockBgColor:l,buttonBgColor:l});s.setFieldsValue({items:[...e,{platform:t.id,href:"",alt:"",title:"",iconSrc:i,iconWidth:null,iconHeight:null,buttonBgColor:l,itemBorderColor:o}]})}else s.setFieldsValue({items:[...e,{platform:void 0,href:"",alt:"",title:"",iconSrc:"",iconWidth:null,iconHeight:null,buttonBgColor:l,itemBorderColor:o}]});setTimeout(()=>D(),0)},[s,V,D]),X=(0,l.useCallback)((e,t)=>{e.dataTransfer.setData(Ze,String(t)),e.dataTransfer.setData(E.hz,String(t)),e.dataTransfer.effectAllowed="move",w.current=t,b(t),O()},[O]),q=(0,l.useCallback)(()=>{F(),w.current=null,b(null),v(null)},[F]),Y=(0,l.useCallback)((e,t,o)=>{if(o<2)return;e.preventDefault(),e.dataTransfer.dropEffect="move";const l=w.current;null!==l&&l!==t&&v(t)},[]),K=(0,l.useCallback)((e,t)=>{e.currentTarget.contains(e.relatedTarget)||v(e=>e===t?null:e)},[]),Q=(0,l.useCallback)((e,t,o)=>{e.preventDefault(),v(null);const l=e.dataTransfer.getData(Ze),i=parseInt(l,10);Number.isNaN(i)||i===t?F():(o(i,t),F(),setTimeout(()=>D(),0))},[F,D]),ee=(0,l.useCallback)(e=>{var t;const o=e.currentTarget,l=parseInt(null!==(t=o.dataset.itemIndex)&&void 0!==t?t:"",10);Number.isNaN(l)||X(e,l)},[X]),te=(0,l.useCallback)(e=>{var t,o;const l=e.currentTarget,i=parseInt(null!==(t=l.dataset.itemIndex)&&void 0!==t?t:"",10),a=parseInt(null!==(o=l.dataset.listLength)&&void 0!==o?o:"",10);Number.isNaN(i)||Number.isNaN(a)||a<2||(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move"))},[]),oe=(0,l.useCallback)(e=>{var t,o;const l=e.currentTarget,i=parseInt(null!==(t=l.dataset.itemIndex)&&void 0!==t?t:"",10),a=parseInt(null!==(o=l.dataset.listLength)&&void 0!==o?o:"",10);Number.isNaN(i)||Number.isNaN(a)||Y(e,i,a)},[Y]),le=(0,l.useCallback)(e=>{var t;const o=parseInt(null!==(t=e.currentTarget.dataset.itemIndex)&&void 0!==t?t:"",10);Number.isNaN(o)||K(e,o)},[K]),ie=(0,l.useCallback)(e=>{var t;const o=parseInt(null!==(t=e.currentTarget.dataset.itemIndex)&&void 0!==t?t:"",10),l=B.current;Number.isNaN(o)||"function"!==typeof l||Q(e,o,l)},[Q]),ae=(0,l.useCallback)(e=>{var t;e.stopPropagation();const o=parseInt(null!==(t=e.currentTarget.dataset.fieldName)&&void 0!==t?t:"",10),l=R.current;Number.isNaN(o)||"function"!==typeof l||(l(o),queueMicrotask(D))},[D]),re=(0,l.useCallback)((e,t)=>{const o=V.find(e=>e.id===t),l=(s.getFieldValue("globalBgColor")||"").trim(),i=(s.getFieldValue(["items",e,"buttonBgColor"])||"").trim(),a=(0,Qe.d2)(t,{blockBgEnabled:!!l,blockBgColor:l,buttonBgColor:i});o&&a&&s.setFieldValue(["items",e,"iconSrc"],a)},[s,V]),ne=(0,l.useCallback)(e=>{if(Object.prototype.hasOwnProperty.call(e,"globalItemBorderColor")){if(!C.current){var t;const o=String(null!==(t=e.globalItemBorderColor)&&void 0!==t?t:"").trim(),l=s.getFieldValue("items")||[];s.setFieldsValue({items:l.map(e=>({...e,itemBorderColor:o}))})}}else if(Object.prototype.hasOwnProperty.call(e,"globalBgColor")){var o;const t=N.current,l=String(null!==(o=e.globalBgColor)&&void 0!==o?o:"").trim(),i=s.getFieldValue("items")||[];s.setFieldsValue({items:i.map(e=>({...e,buttonBgColor:mt(t,l,e.buttonBgColor)}))})}else if(null!=(null===e||void 0===e?void 0:e.items)){const e=dt(s.getFieldValue("items")||[]);e!==(s.getFieldValue("globalItemBorderColor")||"").trim()&&(C.current=!0,s.setFieldValue("globalItemBorderColor",e),queueMicrotask(()=>{C.current=!1}))}const l=null===e||void 0===e?void 0:e.items;if(null!=l){const e=(e,t)=>{if(!t||!Object.prototype.hasOwnProperty.call(t,"platform"))return;const o=t.platform;void 0!==o&&null!==o&&""!==o&&re(e,o)};if(Array.isArray(l))l.forEach((t,o)=>{e(o,t)});else if("object"===typeof l)for(const t of Object.keys(l)){const o=Number.parseInt(t,10);Number.isNaN(o)||e(o,l[t])}}D()},[s,D,re]),de=(0,l.useCallback)((e,t)=>{s.setFieldValue(e,t),Array.isArray(e)&&"items"===e[0]?ne({items:{[e[1]]:{[e[2]]:t}}}):ne({[e]:t})},[s,ne]),se=l.createElement(l.Fragment,null,l.createElement("div",{className:"selected-social-form__section"},l.createElement("div",{className:"selected-social-form__section-title"},o("General settings")),l.createElement("div",{className:"selected-social-form__align-block"},l.createElement(k,{form:s,elementSettings:{...p,type:E.bV.SOCIAL}})),l.createElement(c.fI,{gutter:10,className:"selected-social-form__field-row"},l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:o("Button size"),placement:"bottom",getPopupContainer:ot},l.createElement(c.lV.Item,{name:"iconSize",className:"form-item-margin-xs"},l.createElement(c.FQ,{min:16,max:64,prefix:l.createElement(A.Ay,{icon:"ColumnWidthOutlined"}),addonAfter:"px",placeholder:o("Button size"),className:"selected-social-form__input-full"})))),l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:o("Corner radius"),placement:"bottom",getPopupContainer:ot},l.createElement(c.lV.Item,{name:"borderRadius",className:"form-item-margin-xs"},l.createElement(c.FQ,{min:0,max:48,prefix:l.createElement(A.Ay,{icon:"BorderRadius",className:"selected-td-form__icon-radius"}),addonAfter:"px",placeholder:o("Corner radius"),className:"selected-social-form__input-full"}))))),l.createElement(c.fI,{gutter:10,className:"selected-social-form__field-row"},l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:o("Spacing"),placement:"bottom",getPopupContainer:ot},l.createElement(c.lV.Item,{name:"gap",className:"form-item-margin-xs"},l.createElement(c.FQ,{min:0,max:48,prefix:l.createElement(A.Ay,{icon:"PaddingLeftRight"}),addonAfter:"px",placeholder:o("Spacing"),className:"selected-social-form__input-full"})))),l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:o("Background color"),placement:"bottom",getPopupContainer:ot},l.createElement(c.lV.Item,{name:"globalBgColor",className:"form-item-margin-xs"},l.createElement(lt,{form:s,name:"globalBgColor",placeholder:o("Background color"),usedColors:L,onColorChange:de}))))),l.createElement(c.fI,{gutter:10,className:"selected-social-form__field-row"},l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:o("Border"),placement:"bottom",getPopupContainer:ot},l.createElement(c.lV.Item,{name:"buttonBorderWidth",className:"form-item-margin-xs"},l.createElement(c.FQ,{min:0,max:24,prefix:l.createElement(A.Ay,{icon:"BorderOuterOutlined"}),addonAfter:"px",placeholder:o("Border"),className:"selected-social-form__input-full"})))),l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:o("Border color"),placement:"bottom",getPopupContainer:ot},l.createElement(c.lV.Item,{name:"globalItemBorderColor",className:"form-item-margin-xs"},l.createElement(lt,{form:s,name:"globalItemBorderColor",placeholder:o("Border color"),usedColors:L,onColorChange:de})))))),l.createElement("div",{className:"selected-social-form__section selected-social-form__section--bordered"},l.createElement("div",{className:"selected-social-form__section-title"},o("Social buttons")),l.createElement(c.lV.List,{name:"items"},(e,{remove:t,move:a})=>(B.current=a,R.current=t,l.createElement("div",{className:"selected-social-form__items"},e.map((t,a)=>l.createElement("div",{key:t.key,className:r()("selected-social-form__card",h===a&&"selected-social-form__card--dragging",f===a&&h!==a&&"selected-social-form__card--drag-over"),"data-item-index":a,"data-list-length":e.length,onDragEnterCapture:te,onDragOverCapture:oe,onDragLeave:le,onDropCapture:ie},l.createElement("div",{className:"selected-social-form__card-head"},l.createElement("div",{className:"selected-social-form__card-head-main"},e.length>1?l.createElement("span",{className:"selected-social-form__drag-handle",draggable:!0,"data-item-index":a,onDragStart:ee,onDragEnd:q,role:"button",tabIndex:0,"aria-label":o("Drag to reorder")},l.createElement(qe.A,null)):null,l.createElement(Je,{className:"selected-social-form__card-title"},o("Button")," ",a+1)),l.createElement(c.m_,{trigger:["hover"],title:o("Delete"),placement:"top",getPopupContainer:ot},l.createElement(c.$n,{type:"text",className:"selected-social-form__card-head-remove",icon:l.createElement(A.Ay,{icon:"DeleteOutlined",size:18,strokeWidth:i.iconStrokeWidth}),"aria-label":o("Delete"),"data-field-name":t.name,onClick:ae}))),l.createElement(c.lV.Item,{name:[t.name,"iconSrc"],hidden:!0},l.createElement(c.pd,null)),l.createElement(c.lV.Item,{name:[t.name,"platform"],className:"selected-social-form__card-field"},l.createElement(c.Select,{options:M,className:"selected-social-form__platform-select",popupClassName:"selected-social-form__platform-dropdown",placeholder:o("Select"),suffixIcon:l.createElement(A.Ay,{icon:"ChevronDownCustom"})})),l.createElement(c.lV.Item,{name:[t.name,"href"],className:"selected-social-form__card-field",rules:[{required:!0,whitespace:!0,message:o("Please enter the URL.")},{validator:async(e,t)=>{const l="string"===typeof t?t.trim():String(null!==t&&void 0!==t?t:"").trim();if(l&&!function(e){const t=at(e);if(!t)return!1;try{const e=new URL(t);return("http:"===e.protocol||"https:"===e.protocol)&&!!e.hostname}catch{return!1}}(l))throw new Error(o("Please enter the correct URL."))}}]},l.createElement(c.pd,{prefix:l.createElement(A.Ay,{icon:"Link03",className:"selected-social-form__field-icon"}),placeholder:o("Enter link"),allowClear:{clearIcon:l.createElement(c.tL,null)}})),l.createElement(c.fI,{gutter:10,className:"selected-social-form__card-field selected-social-form__bg-color-row"},l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:o("Background color"),placement:"bottom",getPopupContainer:ot},l.createElement(c.lV.Item,{name:[t.name,"buttonBgColor"],className:"selected-social-form__card-field"},l.createElement(lt,{form:s,name:["items",t.name,"buttonBgColor"],placeholder:o("Background color"),usedColors:L,onColorChange:de})))),l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:o("Border color"),placement:"bottom",getPopupContainer:ot},l.createElement(c.lV.Item,{name:[t.name,"itemBorderColor"],className:"selected-social-form__card-field"},l.createElement(lt,{form:s,name:["items",t.name,"itemBorderColor"],placeholder:o("Border color"),usedColors:L,onColorChange:de}))))),l.createElement(ct,{__:o,form:s,fieldName:t.name,pushSettingsToIframe:D})))))),l.createElement(c.$n,{type:"text",block:!0,className:"selected-social-form__add-bar",icon:l.createElement(Ye.A,null),onClick:j},o("Add button"))));return l.createElement("div",{className:"selected-social-form"},l.createElement(c.lV,{form:s,layout:"vertical",className:"selected-social-form__form element-controls",onValuesChange:ne,autoComplete:"off"},se))},gt=E.K0,ht=(e,t,o,l,i,a,r="")=>{const n=e.getFieldsValue(!0),d=t?"cell_":r;setTimeout(()=>{t?l(e=>!e):o(e=>!e),i&&(n[d+"borderWidth"]=null,n[d+"borderColor"]="",n[d+"borderStyle"]=""),a(e=>({...E.iV,[n[d+"borderPosition"]]:{...e[n[d+"borderPosition"]],width:n[d+"borderWidth"],color:n[d+"borderColor"],style:n[d+"borderStyle"]}}))})},bt=(e,t,o,l,i,a,r)=>{const n=e.getFieldsValue(!0);setTimeout(()=>{var e;t(e=>!e),o||null!==(e=l[null===n||void 0===n?void 0:n.mobileBorderPosition])&&void 0!==e&&e.color||(n.mobileBorderStyle="solid",n.mobileBorderWidth=1,n.mobileBorderColor=gt,i(e=>({...l,[null===n||void 0===n?void 0:n.mobileBorderPosition]:{color:gt,style:"solid",width:1}}))),a({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:r.type,settings:{mobileBorder:{...l,[null===n||void 0===n?void 0:n.mobileBorderPosition]:{color:n.mobileBorderColor,style:n.mobileBorderStyle,width:n.mobileBorderWidth}}}})})},ft=(e,t,o,l,i,a,r="")=>{const n=e.getFieldsValue(!0);setTimeout(()=>{t(e=>!e),o?(n[r+"borderRadiusAll"]=0,l(!0)):n[r+"borderRadiusAll"]||(n[r+"borderRadiusAll"]=0),i({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:a.type,settings:{borderRadius:{all:n[r+"borderRadiusAll"]}}})})},vt=(e,t,o,l,i)=>{const a=e.getFieldsValue(!0);setTimeout(()=>{t(e=>!e),o||a.mobileBorderRadiusAll||a.mobileBorderRadiusTopLeft||a.mobileBorderRadiusTopRight||a.mobileBorderRadiusBottomRight||a.mobileBorderRadiusBottomLeft||(a.mobileBorderRadiusAll=0);["all","topLeft","topRight","bottomRight","bottomLeft"].forEach(e=>{var t;if(!(null===(t=a.mobileBorderRadius)||void 0===t?void 0:t[e]))return;const o=`mobileBorderRadius${e[0].toUpperCase()}${e.slice(1)}`;l({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBorderRadius:{[e]:a[o],classNamePrefix:`em-mob-border_radius_${e}-`}}})})})},_t=(e,t,o,l,i)=>{const a=e.getFieldsValue(!0);setTimeout(()=>{t(e=>!e),o||a.boxShadowColor?o&&(a.boxShadowInset=!1,a.boxShadowHOffset=null,a.boxShadowVOffset=null,a.boxShadowBlurRadius=null,a.boxShadowSpreadRadius=null,a.boxShadowColor=""):(a.boxShadowInset=!1,a.boxShadowHOffset=5,a.boxShadowVOffset=5,a.boxShadowBlurRadius=10,a.boxShadowSpreadRadius=-5,a.boxShadowColor="#000000"),l({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{boxShadow:{blurRadius:a.boxShadowBlurRadius,color:a.boxShadowColor,hOffset:a.boxShadowHOffset,inset:a.boxShadowInset,spreadRadius:a.boxShadowSpreadRadius,vOffset:a.boxShadowVOffset}}})})},Et=(e,t,o,l,i)=>{const a=e.getFieldsValue(!0);setTimeout(()=>{t(e=>!e),o||a.mobileBoxShadowColor||(a.mobileBoxShadowInset=!1,a.mobileBoxShadowHOffset=5,a.mobileBoxShadowVOffset=5,a.mobileBoxShadowBlurRadius=10,a.mobileBoxShadowSpreadRadius=-5,a.mobileBoxShadowColor="#000000"),l({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBoxShadow:{blurRadius:a.mobileBoxShadowBlurRadius,color:a.mobileBoxShadowColor,hOffset:a.mobileBoxShadowHOffset,inset:a.mobileBoxShadowInset,spreadRadius:a.mobileBoxShadowSpreadRadius,vOffset:a.mobileBoxShadowVOffset,classNamePrefix:"em-mob-box_shadow-"}}})})},St=(e,t,o,l,i)=>{const a=e.getFieldsValue(!0);setTimeout(()=>{t(e=>!e),o||a.mobileWidth||(a.mobileWidth=""),l({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileWidth:{value:a.mobileWidth,dim:a.mobileWidthDim,classNamePrefix:"em-mob-width-"}}})})},yt=e=>{setTimeout(()=>{e(e=>!e)})},wt=(e,t,o,l,i)=>{const a=e.getFieldsValue(!0);setTimeout(()=>{t(e=>!e),o||a.mobileBackgroundColor||(a.mobileBackgroundColor="#E5E5E5"),l({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{mobileBackgroundColor:{classNamePrefix:"em-mob-background_color-",value:a.mobileBackgroundColor}}})})},kt=(e,t,o,l,i)=>{const a=e.getFieldsValue(!0);setTimeout(()=>{t(e=>!e),o&&(a.paddingLeftRight="",a.paddingLeft="",a.paddingRight="",a.paddingTopBottom="",a.paddingTop="",a.paddingBottom="",l({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{padding:{all:0}}}))})},Bt=(e,t,o,l,i)=>{t(e=>!e);const a=e.getFieldsValue(!0);o||(a.paddingLeftRight=a.paddingLeft,a.paddingTopBottom=a.paddingTop,a.paddingRight=a.paddingLeft,a.paddingBottom=a.paddingTop,l({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{padding:{top:a.paddingTopBottom,bottom:a.paddingTopBottom,left:a.paddingLeftRight,right:a.paddingLeftRight}}}))},Rt=e=>{setTimeout(()=>{e(e=>!e)})},xt=(e,t,o,l,i)=>{t(e=>!e);const a=e.getFieldsValue(!0);o||(a.cell_paddingLeftRight=a.cell_paddingLeft,a.cell_paddingTopBottom=a.cell_paddingTop,a.cell_paddingRight=a.cell_paddingLeft,a.cell_paddingBottom=a.cell_paddingTop,l({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:i.type,settings:{cell_padding:{top:a.cell_paddingTopBottom,bottom:a.cell_paddingTopBottom,left:a.cell_paddingLeftRight,right:a.cell_paddingLeftRight}}})),(o&&a.cell_paddingLeftRight||0===a.cell_paddingLeftRight)&&(a.cell_paddingLeft=a.cell_paddingLeftRight,a.cell_paddingRight=a.cell_paddingLeftRight),(o&&a.cell_paddingTopBottom||0===a.cell_paddingTopBottom)&&(a.cell_paddingTop=a.cell_paddingTopBottom,a.cell_paddingBottom=a.cell_paddingTopBottom)},Tt=({form:e,onBorderSideClear:t,formName:o,elementSettings:i,formValues:a,isMacOS:n,__:d,token:s,appConfig:m,typografItems:u,backgroundRepeatOptions:p,backgroundSizeOptions:g,sendAction:h,handleToggleShowPaddingCell:b,handleTogglePaddingCell:v,handleToggleBackground:_,handleToggleBorder:E,handleToggleBorderRadius:S,paddingCellShow:y,paddingsExt:w,backgroundShow:k,cellBordersShow:R,borderRadiusShow:x,textInputRef:T,linkProtocol:I,handleLinkProtocolsChange:C,backgroundImageEmpty:N})=>{var P;return l.createElement(l.Fragment,null,l.createElement(c.y9,{title:d("Text"),dividerTop:!1},m.formTextFieldTypografEnabled&&l.createElement(l.Fragment,null,l.createElement(c.fI,{gutter:10},l.createElement(c.fv,{span:12},l.createElement(c.lV.Item,{name:"AddImage",style:{marginBottom:s.formItemMarginBottomXS}},l.createElement(c.$n,{icon:l.createElement(A.Ay,{icon:"AddImage"}),onClick:()=>h("add_img"),style:{width:"100%"}},d("Add image")))),l.createElement(c.fv,{span:12},l.createElement(c.lV.Item,{name:"Typography",style:{marginBottom:s.formItemMarginBottomXS}},l.createElement(c.ms,{arrow:!0,menu:{items:u},trigger:["hover"],placement:"bottom",getPopupContainer:e=>e.closest(".selected-element-panel")},l.createElement(c.$n,{icon:l.createElement(A.Ay,{icon:"Typograf"}),onClick:()=>h("typograf"),style:{width:"100%"}},d("Typography")))))),l.createElement(c.m_,{trigger:["hover"],title:d("Text font"),placement:"bottom",zIndex:1,getPopupContainer:e=>e.parentNode},l.createElement(c.lV.Item,{name:"fontFamily",className:"form-item-margin-xs"},l.createElement(c.LW,{textEditor:!0,loadGoogleFonts:oe.c,getPopupContainer:e=>e.closest(".email-pane__collapse-wrapper")}))),!i.showOnMobile&&l.createElement(c.fI,{gutter:10},l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:d("Font size"),placement:"bottom"},l.createElement(c.lV.Item,{name:"fontSize"},l.createElement(c.FQ,{min:8,max:90,placeholder:d("Font size"),prefix:l.createElement(A.Ay,{icon:"FontSizeOutlined"}),addonAfter:"px"})))),l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:d("Line height"),placement:"bottom"},l.createElement(c.lV.Item,{name:"lineHeight"},l.createElement(c.FQ,{min:10,max:110,placeholder:d("Line height"),prefix:l.createElement(A.Ay,{icon:"LineHeightOutlined"}),addonAfter:"px"})))))),l.createElement(c.fI,{gutter:10},l.createElement(c.fv,{span:3},l.createElement(ie,{form:e,elementSettings:i,name:"textStrong",tooltipTitle:d(n?"Strong ( \u2318B )":"Strong ( Ctrl+B )"),icon:l.createElement(A.Ay,{icon:"BoldOutlined",className:"selected-text-common-form__icon-radius"})})),l.createElement(c.fv,{span:3},l.createElement(ie,{form:e,elementSettings:i,name:"textItalic",tooltipTitle:d(n?"Italic ( \u2318I )":"Italic ( Ctrl+I )"),icon:l.createElement(A.Ay,{icon:"ItalicOutlined",className:"selected-text-common-form__icon-radius"})})),l.createElement(c.fv,{span:3},l.createElement(ie,{form:e,elementSettings:i,name:"textStrikethrough",tooltipTitle:d(n?"Strikethrough ( \u2318+Shift+X )":"Strikethrough ( Alt+Shift+5 )"),icon:l.createElement(A.Ay,{icon:"StrikethroughOutlined",className:"selected-text-common-form__icon-radius"})})),l.createElement(c.fv,{span:3},l.createElement(ie,{form:e,elementSettings:i,name:"textUnderline",tooltipTitle:d(n?"Underline ( \u2318U )":"Underline ( Ctrl+U )"),icon:l.createElement(A.Ay,{icon:"UnderlineOutlined",className:"selected-text-common-form__icon-radius"})})),l.createElement(c.fv,{span:3},l.createElement(ie,{form:e,className:r()("selected-text-common-form__button selected-text-common-form__button_style",{"selected-text-common-form__button--active":"string"===typeof i.linkHref}),elementSettings:i,name:"textLink",tooltipTitle:d("Link"),icon:l.createElement(A.Ay,{icon:"LinkOutlined",className:"selected-text-common-form__icon-radius"})}))),(null===a||void 0===a?void 0:a.textLink)&&l.createElement(c.fI,{gutter:10},l.createElement(c.fv,{span:24},l.createElement(c.m_,{trigger:["hover"],title:d("The URL that the hyperlink directs to."),placement:"bottom"},l.createElement(c.lV.Item,{name:"linkHref"},l.createElement(c.pd,{ref:T,addonBefore:l.createElement(O.Ai,{linkProtocol:I,handleLinkProtocolsChange:C,__:d}),allowClear:!0,placeholder:d("Hyperlink URL"),autoFocus:null===i||void 0===i||null===(P=i.customTable)||void 0===P?void 0:P.isNewLink,prefix:l.createElement(O.RM,{linkProtocol:I})}))))),l.createElement(c.fI,{gutter:10,style:{paddingBottom:4}},l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:d("Text color"),placement:"bottom",zIndex:2,getPopupContainer:e=>e.parentNode},l.createElement(c.lV.Item,{name:"textColor",rules:[{message:d("Please set the font color")}]},l.createElement(c.it,{placeholder:d("Color"),usedColors:i.usedColors,usedLabel:d("Used"),recommendedLabel:d("Recommended")})))),l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:d("Text background"),placement:"bottom",zIndex:2,getPopupContainer:e=>e.parentNode},l.createElement(c.lV.Item,{name:"textBackgroundColor",rules:[{message:d("Please set the background color")}]},l.createElement(c.it,{placeholder:d("Background color"),usedColors:i.usedColors,usedLabel:d("Used"),recommendedLabel:d("Recommended")}))))),l.createElement(c.fI,{gutter:10,style:{paddingBottom:4}},l.createElement(c.fv,{span:12},l.createElement(le.A,{form:e,elementSettings:i,name:"textAlign"})),l.createElement(c.fv,{span:12,style:{textAlign:"right"}},l.createElement(B,{form:e,elementSettings:i,name:"valign",isNewIconType:!0})))),l.createElement(c.y9,{title:d("Padding"),collapsible:!0,open:y,onToggle:b,dividerTop:!0},l.createElement(c.L1,{namePrefix:"cell_",extended:w,onToggleExtended:v,gutter:s.marginSM,rowStyle:{paddingBottom:4},labels:{horizontal:d("Horizontal padding"),vertical:d("Vertical padding"),left:d("Left padding"),right:d("Right padding"),top:d("Top padding"),bottom:d("Bottom padding"),individual:d("Individual padding")}})),l.createElement(c.y9,{title:d("Background"),collapsible:!0,open:k,onToggle:_,dividerTop:!0},l.createElement(c.Qm,{colorFieldName:"cellBackgroundColor",imageEnabled:m.formTableFieldBackgroundImageEnabled&&!1,backgroundImageEmpty:N,usedColors:i.usedColors,colorPlaceholder:d("Background color"),usedLabel:d("Used"),recommendedLabel:d("Recommended"),horizontalPositionPlaceholder:d("Horizontal position"),horizontalPositionTooltip:d("Horizontal position"),verticalPositionPlaceholder:d("Vertical position"),verticalPositionTooltip:d("Vertical position"),backgroundRepeatTooltip:d("Background image repeat"),backgroundSizeTooltip:d("Background image size"),selectPlaceholder:d("Please choose"),backgroundRepeatOptions:p,backgroundSizeOptions:g,imageUploadSlot:(m.formTableFieldBackgroundImageEnabled,void 0)})),l.createElement(c.y9,{title:d("Borders"),collapsible:!0,open:R,onToggle:E,dividerTop:!0},l.createElement(f.A,{form:e,namePrefix:"cell_"})),m.formFieldBorderRadiusEnabled&&!1)},It=({form:e,onBorderSideClear:t,elementSettings:o,paddingShow:i,paddingsExt:a,backgroundShow:r,bordersShow:n,borderRadiusShow:d,boxShadowShow:s,handleToggleShowPadding:m,handleTogglePadding:u,handleToggleBackground:p,handleToggleBorder:g,handleToggleBorderRadius:h,handleToggleBoxShadow:E,backgroundRepeatOptions:S,backgroundSizeOptions:w,backgroundImageEmpty:k,oneBorderRadiusValue:B,setOneBorderRadiusValue:R,boxShadow:x})=>{const{__:T}=(0,_.s9)(),A=(0,y.rD)(),{token:N}=(0,c.rd)();return l.createElement(l.Fragment,null,l.createElement(c.y9,{title:T("Padding"),collapsible:!0,open:i,onToggle:m},l.createElement(c.L1,{extended:a,onToggleExtended:u,gutter:N.marginSM,labels:{horizontal:T("Horizontal padding"),vertical:T("Vertical padding"),left:T("Left padding"),right:T("Right padding"),top:T("Top padding"),bottom:T("Bottom padding"),individual:T("Individual padding")}})),l.createElement(c.y9,{title:T("Background"),collapsible:!0,open:r,onToggle:p,dividerTop:!0},l.createElement(c.Qm,{imageEnabled:A.formTableFieldBackgroundImageEnabled,backgroundImageEmpty:k,usedColors:o.usedColors,colorPlaceholder:T("Background color"),usedLabel:T("Used"),recommendedLabel:T("Recommended"),horizontalPositionPlaceholder:T("Horizontal position"),horizontalPositionTooltip:T("Horizontal position"),verticalPositionPlaceholder:T("Vertical position"),verticalPositionTooltip:T("Vertical position"),backgroundRepeatTooltip:T("Background image repeat"),backgroundSizeTooltip:T("Background image size"),selectPlaceholder:T("Please choose"),backgroundRepeatOptions:S,backgroundSizeOptions:w,imageUploadSlot:A.formTableFieldBackgroundImageEnabled?l.createElement(b.A,{form:e,label:T("Background image"),name:"backgroundImage",tooltipTitle:T("Background image"),placeholder:T("Background image link/route")}):void 0})),l.createElement(c.y9,{title:T("Borders"),collapsible:!0,open:n,onToggle:g,dividerTop:!0},l.createElement(f.A,{form:e,onBorderSideClear:t})),A.formFieldBorderRadiusEnabled&&l.createElement(c.y9,{title:T("Border radius"),collapsible:!0,open:d,onToggle:h,dividerTop:!0},l.createElement(v.A,{form:e,oneBorderRadiusValue:B,setOneBorderRadiusValue:R,elementSettings:o})),A.formFieldBoxShadowEnabled&&l.createElement(c.y9,{title:T("Box shadow"),collapsible:!0,open:s,onToggle:E,dividerTop:!0},l.createElement(I,null)),A.formFieldVisibilityEnabled&&l.createElement(c.y9,{title:T("Display control"),dividerTop:!0},l.createElement(C,{elementSettings:o,form:e})))},At=({form:e,elementSettings:t,mobileSizeShow:o,mobileBackgroundShow:i,mobileBordersShow:a,mobileBorderRadiusShow:r,mobileBoxShadowShow:s,handleToggleMobileSize:m,handleToggleMobileBackground:u,handleToggleMobileBorder:p,handleToggleMobileBorderRadius:g,handleToggleMobileBoxShadow:h,backgroundRepeatOptions:b,oneMobileBorderRadiusValue:f,setOneMobileBorderRadiusValue:E,mobileBorders:S,mobileBoxShadow:w})=>{const{__:k,_x:B}=(0,_.s9)(),R=(0,y.rD)(),{token:x}=(0,c.rd)(),T=(0,n.d4)(d.uJ);return l.createElement(l.Fragment,null,l.createElement(c.y9,{title:k("Size"),collapsible:!0,open:o,onToggle:m,dividerTop:!0},l.createElement(l.Fragment,null,l.createElement(c.fI,{gutter:10},l.createElement(c.fv,{span:12},l.createElement(c.m_,{trigger:["hover"],title:k("Table width"),placement:"left"},l.createElement("div",{style:{marginBottom:x.formItemMarginBottomMD+4}},l.createElement(M,{form:e,name:"mobileWidth",elementSettings:t}))))),l.createElement(c.fI,{gutter:10},l.createElement(c.fv,{span:12},l.createElement("div",{style:{marginBottom:2*x.formItemMarginBottomXS}},l.createElement(c.m_,{title:k("Height"),placement:"bottom"},l.createElement(D,{form:e,name:"mobileHeight",elementSettings:t}))))))),l.createElement(c.y9,{title:k("Background"),collapsible:!0,open:i,onToggle:u,dividerTop:!0},l.createElement("div",{style:{marginBottom:x.formItemMarginBottomMD+4}},l.createElement(ue,{form:e,elementSettings:t})),!1),R.formFieldBorderEnabled&&l.createElement(c.y9,{title:k("Borders"),collapsible:!0,open:a,onToggle:p,dividerTop:!0},l.createElement(c.Ok,{form:e,fieldStructure:"flat",borderValues:S,usedColors:T.usedColors,labels:{color:k("Color"),width:B("Width","border"),none:k("None"),solid:k("Solid"),dashed:k("Dashed"),dotted:k("Dotted"),above:k("Above"),below:k("Below"),onLeft:k("On the left"),onRight:k("On the right"),around:k("Around"),usedColors:k("Used"),recommendedColors:k("Recommended")}})),R.formFieldBorderRadiusEnabled&&l.createElement(c.y9,{title:k("Border radius"),collapsible:!0,open:r,onToggle:g,dividerTop:!0},l.createElement(v.A,{form:e,typeOfForm:"mobile",oneBorderRadiusValue:f,setOneBorderRadiusValue:E,elementSettings:t})),R.formFieldBoxShadowEnabled&&l.createElement(c.y9,{title:k("Box shadow"),collapsible:!0,open:s,onToggle:h,dividerTop:!0},l.createElement(I,{typeOfForm:"mobile",form:e,elementSettings:t,enableSwitch:!1})),R.formFieldVisibilityEnabled&&l.createElement(c.y9,{title:k("Display control"),dividerTop:!0},l.createElement(C,{elementSettings:t,form:e})))},Ct=({form:e,onBorderSideClear:t,elementViewType:o,mobileViewActive:i,elementSettings:a,paddingShow:r,paddingsExt:n,backgroundShow:d,bordersShow:s,borderRadiusShow:m,boxShadowShow:c,mobileSizeShow:u,mobileBackgroundShow:p,mobileBordersShow:g,mobileBorderRadiusShow:h,mobileBoxShadowShow:b,handleToggleShowPadding:f,handleTogglePadding:v,handleToggleBackground:_,handleToggleBorder:S,handleToggleBorderRadius:y,handleToggleBoxShadow:w,handleToggleMobileSize:k,handleToggleMobileBackground:B,handleToggleMobileBorder:R,handleToggleMobileBorderRadius:x,handleToggleMobileBoxShadow:T,backgroundRepeatOptions:I,backgroundSizeOptions:A,backgroundImageEmpty:C,oneBorderRadiusValue:N,setOneBorderRadiusValue:P,oneMobileBorderRadiusValue:L,setOneMobileBorderRadiusValue:F,boxShadow:O,mobileBorders:V,mobileBoxShadow:M})=>l.createElement(l.Fragment,null,o===E.ND&&i.styles?l.createElement("div",{id:"selected_element_form_mobile_props",className:"selected_form-mobile-props"},l.createElement(At,{form:e,elementSettings:a,mobileSizeShow:u,mobileBackgroundShow:p,mobileBordersShow:g,mobileBorderRadiusShow:h,mobileBoxShadowShow:b,handleToggleMobileSize:k,handleToggleMobileBackground:B,handleToggleMobileBorder:R,handleToggleMobileBorderRadius:x,handleToggleMobileBoxShadow:T,backgroundRepeatOptions:I,oneMobileBorderRadiusValue:L,setOneMobileBorderRadiusValue:F,mobileBorders:V,mobileBoxShadow:M})):l.createElement("div",{id:"selected_element_form_desktop_props"},l.createElement(It,{form:e,onBorderSideClear:t,elementSettings:a,paddingShow:r,paddingsExt:n,backgroundShow:d,bordersShow:s,borderRadiusShow:m,boxShadowShow:c,handleToggleShowPadding:f,handleTogglePadding:v,handleToggleBackground:_,handleToggleBorder:S,handleToggleBorderRadius:y,handleToggleBoxShadow:w,backgroundRepeatOptions:I,backgroundSizeOptions:A,backgroundImageEmpty:C,oneBorderRadiusValue:N,setOneBorderRadiusValue:P,boxShadow:O}))),Nt=["borderTop","borderBottom","borderLeft","borderRight"],Pt=({elementSettings:e,formName:t})=>{var o,i;const{__:a}=(0,_.s9)(),r=(0,S.XW)(),[d]=c.lV.useForm(),{token:s}=(0,c.rd)(),m=(0,y.rD)(),u=(0,n.d4)(G.Ct),p=(0,n.d4)(G.CS),g=(0,n.d4)(G.Fv),h=(0,n.d4)(G.yy),[b,f]=(0,l.useState)({}),[v,w]=(0,l.useState)(!0),[k,B]=(0,l.useState)({}),[R,x]=(0,l.useState)({}),[T,I]=(0,l.useState)(!0),[A,C]=(0,l.useState)(""===(null===(o=e.customTable)||void 0===o?void 0:o.backgroundImage[0].value)),[N,P]=(0,l.useState)(),[L,F]=(0,l.useState)(!1),[V,M]=(0,l.useState)(!1),[D,H]=(0,l.useState)(!1),[z,W]=(0,l.useState)(!1),[U,$]=(0,l.useState)(!1),[j,q]=(0,l.useState)(!1),[Y,K]=(0,l.useState)(!1),[Q,J]=(0,l.useState)(!1),[Z,ee]=(0,l.useState)(!0),[te,oe]=(0,l.useState)(!0),[le,ie]=(0,l.useState)(!0),[ae,re]=(0,l.useState)(!1),[ne,de]=(0,l.useState)("https://"),[se,me]=(0,l.useState)({}),[ce,ue]=(0,l.useState)(!1),[pe,ge]=(0,l.useState)(!1),[he,be]=(0,l.useState)(!1),[fe,ve]=(0,l.useState)({}),_e=(0,l.useRef)(null),Ee=(0,l.useRef)(),Se=c.lV.useWatch([],d),ye=[{label:a("Not defined"),value:"none"},{label:a("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:a("Repeat background (repeat)"),value:"repeat"},{label:a("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:a("Repeat background vertically (repeat-y)"),value:"repeat-y"}],we=[{label:a("Not defined"),value:""},{label:a("Contain"),value:"contain"},{label:a("Cover"),value:"cover"}],ke={width:"",style:"",color:""},Be=g&&"bottom"!==h,Re=E.K0,xe=t===E.om||!1,[Te,Ie]=(0,l.useState)(null);(0,l.useEffect)(()=>{var e,t;null!==(e=window)&&void 0!==e&&null!==(t=e.navigator)&&void 0!==t&&t.userAgent.includes("Macintosh")&&Ie(!0)},[]);const Ae=e=>{r({operation:E.Ru.SANDBOX_ELEMENT_TEXT,action:e,locale:"ru_RU"})},Ce=[{key:"1",label:a("This element"),onClick:()=>Ae("typograf")},{key:"2",label:a("The whole email"),onClick:()=>Ae("typograf_all")}];(0,l.useEffect)(()=>{if(e){var t,o,l,i,a,r,n,s,m,c,u,p,g,h,b,v,_,E,S,y,k,R,T,A,N,L,F,V,D,H,z,U,$,G,j,X,Y,K,Q,J,Z,ee,te,oe,le,ie,ae,re,ne,de,se,ce,ue,pe,he,fe,_e,Ee,Se,ye,we,ke,Be,Re,Te,Ie,Ae,Ce,Ne,Pe,Le,Fe,Oe,Ve,Me,De,He,ze,We,Ue,$e,Ge,je,Xe,qe,Ye,Ke,Qe,Je,Ze,et,tt,ot,lt,it,at,rt,nt,dt,st,mt,ct,ut,pt,gt,ht,bt,ft,vt,_t,Et,St,yt,wt,kt,Bt,Rt,xt,Tt,It,At,Ct,Nt,Pt,Lt,Ft,Ot,Vt,Mt,Dt,Ht,zt,Wt,Ut,$t,Gt,jt,Xt,qt,Yt,Kt,Qt,Jt;const Zt=e.border,eo=e.boxShadow,to=null===(t=e.customTable)||void 0===t?void 0:t.mobileBorder,oo=null===(o=e.customTable)||void 0===o?void 0:o.mobileBoxShadow,lo=null===(l=e.customTable)||void 0===l?void 0:l.cellBorders;ve(Zt),f(eo),B(to),x(oo),me(lo);const io=xe?null===e||void 0===e||null===(i=e.customTable)||void 0===i?void 0:i.cell_borderPosition:null===e||void 0===e||null===(a=e.customTable)||void 0===a?void 0:a.borderPosition,ao=Object.keys(to).find(e=>{var t,o,l;return(null===(t=to[e])||void 0===t?void 0:t.width)||(null===(o=to[e])||void 0===o?void 0:o.style)||(null===(l=to[e])||void 0===l?void 0:l.color)});d.setFieldsValue({...e,width:null===(r=e.width)||void 0===r?void 0:r.value,widthDim:null===(n=e.width)||void 0===n?void 0:n.dim,maxWidth:null===(s=e.maxWidth)||void 0===s?void 0:s.value,maxWidthDim:null===(m=e.maxWidth)||void 0===m?void 0:m.dim,minWidth:null===(c=e.minWidth)||void 0===c?void 0:c.value,minWidthDim:null===(u=e.minWidth)||void 0===u?void 0:u.dim,show:e.show?e.show:"all",mobileAlign:null===(p=e.mobileAlign)||void 0===p?void 0:p.value,mobileBorderPosition:ao||"all",mobileBorderWidth:null!==(null===(g=to[ao])||void 0===g?void 0:g.width)?null===(h=to[ao])||void 0===h?void 0:h.width:"",mobileBorderColor:(null===(b=to[ao])||void 0===b?void 0:b.color)||"",mobileBorderStyle:(null===(v=to[ao])||void 0===v?void 0:v.style)||"",mobileBackgroundImage:"none"!==e.mobileBackgroundImage[0].value?e.mobileBackgroundImage[0].value:"",mobileBackgroundPositionX:(0,O.ok)(null===(_=e.mobileBackgroundPositionX)||void 0===_?void 0:_.value),mobileBackgroundPositionY:(0,O.ok)(null===(E=e.mobileBackgroundPositionY)||void 0===E?void 0:E.value),mobileBackgroundRepeat:null!==(S=e.mobileBackgroundRepeat)&&void 0!==S&&S.value?null===(y=e.mobileBackgroundRepeat)||void 0===y?void 0:y.value:"none",exportAsPicture:null===e||void 0===e?void 0:e.exportAsPicture,paddingLeftRight:(0,O.ok)(null===(k=e.customTable)||void 0===k?void 0:k.paddingLeftRight.replace(/px$/,"")),paddingTopBottom:(0,O.ok)(null===(R=e.customTable)||void 0===R?void 0:R.paddingTopBottom.replace(/px$/,"")),paddingRight:(0,O.ok)(null===(T=e.customTable)||void 0===T?void 0:T.paddingRight.replace(/px$/,"")),paddingLeft:(0,O.ok)(null===(A=e.customTable)||void 0===A?void 0:A.paddingLeft.replace(/px$/,"")),paddingTop:(0,O.ok)(null===(N=e.customTable)||void 0===N?void 0:N.paddingTop.replace(/px$/,"")),paddingBottom:(0,O.ok)(null===(L=e.customTable)||void 0===L?void 0:L.paddingBottom.replace(/px$/,"")),backgroundColor:(0,O.ok)(null===(F=e.customTable)||void 0===F?void 0:F.backgroundColor),backgroundImage:(0,O.ok)(null===(V=e.customTable)||void 0===V?void 0:V.backgroundImage[0].value),backgroundPositionX:(0,O.ok)(null===(D=e.customTable)||void 0===D?void 0:D.backgroundPositionX),backgroundPositionY:(0,O.ok)(null===(H=e.customTable)||void 0===H?void 0:H.backgroundPositionY),backgroundRepeat:(0,O.ok)(null===(z=e.customTable)||void 0===z?void 0:z.backgroundRepeat),backgroundSize:(0,O.ok)(null===(U=e.customTable)||void 0===U?void 0:U.backgroundSize),borderAll:(0,O.ok)(null===($=e.customTable)||void 0===$?void 0:$.borderAll),borderRadiusAll:(0,O.ok)(null===(G=e.customTable)||void 0===G?void 0:G.borderRadius.all),borderRadiusTopLeft:(0,O.ok)(null===(j=e.customTable)||void 0===j?void 0:j.borderRadius.topLeft),borderRadiusBottomLeft:(0,O.ok)(null===(X=e.customTable)||void 0===X?void 0:X.borderRadius.bottomLeft),borderRadiusTopRight:(0,O.ok)(null===(Y=e.customTable)||void 0===Y?void 0:Y.borderRadius.topRight),borderRadiusBottomRight:(0,O.ok)(null===(K=e.customTable)||void 0===K?void 0:K.borderRadius.bottomRight),borderRadius:{all:(0,O.ok)(null===(Q=e.customTable)||void 0===Q?void 0:Q.borderRadius.all),topLeft:(0,O.ok)(null===(J=e.customTable)||void 0===J?void 0:J.borderRadius.topLeft),topRight:(0,O.ok)(null===(Z=e.customTable)||void 0===Z?void 0:Z.borderRadius.topRight),bottomLeft:(0,O.ok)(null===(ee=e.customTable)||void 0===ee?void 0:ee.borderRadius.bottomLeft),bottomRight:(0,O.ok)(null===(te=e.customTable)||void 0===te?void 0:te.borderRadius.bottomRight)},borderTop:(0,O.ok)(null===(oe=e.customTable)||void 0===oe?void 0:oe.borderTop),borderBottom:(0,O.ok)(null===(le=e.customTable)||void 0===le?void 0:le.borderBottom),borderLeft:(0,O.ok)(null===(ie=e.customTable)||void 0===ie?void 0:ie.borderLeft),borderRight:(0,O.ok)(null===(ae=e.customTable)||void 0===ae?void 0:ae.borderRight),borderPosition:io||"borderAll",boxShadowInset:(0,O.ok)(null===(re=e.customTable)||void 0===re||null===(ne=re.boxShadow)||void 0===ne?void 0:ne.inset)||!1,boxShadowHOffset:(0,O.ok)(null===(de=e.customTable)||void 0===de||null===(se=de.boxShadow)||void 0===se?void 0:se.hOffset),boxShadowVOffset:(0,O.ok)(null===(ce=e.customTable)||void 0===ce||null===(ue=ce.boxShadow)||void 0===ue?void 0:ue.vOffset),boxShadowBlurRadius:(0,O.ok)(null===(pe=e.customTable)||void 0===pe||null===(he=pe.boxShadow)||void 0===he?void 0:he.blurRadius),boxShadowSpreadRadius:(0,O.ok)(null===(fe=e.customTable)||void 0===fe||null===(_e=fe.boxShadow)||void 0===_e?void 0:_e.spreadRadius),boxShadowColor:(0,O.ok)(null===(Ee=e.customTable)||void 0===Ee||null===(Se=Ee.boxShadow)||void 0===Se?void 0:Se.color),mobileBoxShadowInset:(0,O.ok)(null===(ye=e.customTable)||void 0===ye||null===(we=ye.mobileBoxShadow)||void 0===we?void 0:we.inset)||!1,mobileBoxShadowHOffset:(0,O.ok)(null===(ke=e.customTable)||void 0===ke||null===(Be=ke.mobileBoxShadow)||void 0===Be?void 0:Be.hOffset),mobileBoxShadowVOffset:(0,O.ok)(null===(Re=e.customTable)||void 0===Re||null===(Te=Re.mobileBoxShadow)||void 0===Te?void 0:Te.vOffset),mobileBoxShadowBlurRadius:(0,O.ok)(null===(Ie=e.customTable)||void 0===Ie||null===(Ae=Ie.mobileBoxShadow)||void 0===Ae?void 0:Ae.blurRadius),mobileBoxShadowSpreadRadius:(0,O.ok)(null===(Ce=e.customTable)||void 0===Ce||null===(Ne=Ce.mobileBoxShadow)||void 0===Ne?void 0:Ne.spreadRadius),mobileBoxShadowColor:(0,O.ok)(null===(Pe=e.customTable)||void 0===Pe||null===(Le=Pe.mobileBoxShadow)||void 0===Le?void 0:Le.color),mobileBackgroundColor:(0,O.ok)("none"!==(null===(Fe=e.customTable)||void 0===Fe||null===(Oe=Fe.mobileBackgroundColor)||void 0===Oe?void 0:Oe.value)?null===(Ve=e.customTable)||void 0===Ve||null===(Me=Ve.mobileBackgroundColor)||void 0===Me?void 0:Me.value:""),mobileWidth:(0,O.xc)(null===(De=e.customTable)||void 0===De||null===(He=De.mobileWidth)||void 0===He?void 0:He.value),mobileWidthDim:null===(ze=e.customTable)||void 0===ze||null===(We=ze.mobileWidth)||void 0===We?void 0:We.dim,mobileHeight:(0,O.xc)(null===(Ue=e.customTable)||void 0===Ue||null===($e=Ue.mobileHeight)||void 0===$e?void 0:$e.value),mobileHeightDim:null===(Ge=e.customTable)||void 0===Ge||null===(je=Ge.mobileHeight)||void 0===je?void 0:je.dim,mobileBorderRadiusAll:(0,O.ok)(null===(Xe=e.customTable)||void 0===Xe?void 0:Xe.mobileBorderRadius.all),mobileBorderRadiusTopLeft:(0,O.ok)(null!==(null===(qe=e.customTable)||void 0===qe?void 0:qe.mobileBorderRadius.topLeft)?null===(Ye=e.customTable)||void 0===Ye?void 0:Ye.mobileBorderRadius.topLeft:null===(Ke=e.customTable)||void 0===Ke?void 0:Ke.mobileBorderRadius.all),mobileBorderRadiusBottomLeft:(0,O.ok)(null!==(null===(Qe=e.customTable)||void 0===Qe?void 0:Qe.mobileBorderRadius.bottomLeft)?null===(Je=e.customTable)||void 0===Je?void 0:Je.mobileBorderRadius.bottomLeft:null===(Ze=e.customTable)||void 0===Ze?void 0:Ze.mobileBorderRadius.all),mobileBorderRadiusTopRight:(0,O.ok)(null!==(null===(et=e.customTable)||void 0===et?void 0:et.mobileBorderRadius.topRight)?null===(tt=e.customTable)||void 0===tt?void 0:tt.mobileBorderRadius.topRight:null===(ot=e.customTable)||void 0===ot?void 0:ot.mobileBorderRadius.all),mobileBorderRadiusBottomRight:(0,O.ok)(null!==(null===(lt=e.customTable)||void 0===lt?void 0:lt.mobileBorderRadius.bottomRight)?null===(it=e.customTable)||void 0===it?void 0:it.mobileBorderRadius.bottomRight:null===(at=e.customTable)||void 0===at?void 0:at.mobileBorderRadius.all),cellBackgroundColor:(0,O.ok)(null===(rt=e.customTable)||void 0===rt?void 0:rt.cellBackgroundColor),cell_borderPosition:(0,O.ok)("cell_borderAll"),cell_borderAll:(0,O.ok)(null===(nt=e.customTable)||void 0===nt?void 0:nt.cell_borderAll),cell_borderTop:(0,O.ok)(null===(dt=e.customTable)||void 0===dt?void 0:dt.cell_borderTop),cell_borderBottom:(0,O.ok)(null===(st=e.customTable)||void 0===st?void 0:st.cell_borderBottom),cell_borderLeft:(0,O.ok)(null===(mt=e.customTable)||void 0===mt?void 0:mt.cell_borderLeft),cell_borderRight:(0,O.ok)(null===(ct=e.customTable)||void 0===ct?void 0:ct.cell_borderRight),cell_paddingLeftRight:(0,O.ok)(null===(ut=e.customTable)||void 0===ut||null===(pt=ut.cell_paddingLeftRight)||void 0===pt?void 0:pt.replace(/px$/,"")),cell_paddingTopBottom:(0,O.ok)(null===(gt=e.customTable)||void 0===gt||null===(ht=gt.cell_paddingTopBottom)||void 0===ht?void 0:ht.replace(/px$/,"")),cell_paddingRight:(0,O.ok)(null===(bt=e.customTable)||void 0===bt||null===(ft=bt.cell_paddingRight)||void 0===ft?void 0:ft.replace(/px$/,"")),cell_paddingLeft:(0,O.ok)(null===(vt=e.customTable)||void 0===vt||null===(_t=vt.cell_paddingLeft)||void 0===_t?void 0:_t.replace(/px$/,"")),cell_paddingTop:(0,O.ok)(null===(Et=e.customTable)||void 0===Et||null===(St=Et.cell_paddingTop)||void 0===St?void 0:St.replace(/px$/,"")),cell_paddingBottom:(0,O.ok)(null===(yt=e.customTable)||void 0===yt||null===(wt=yt.cell_paddingBottom)||void 0===wt?void 0:wt.replace(/px$/,"")),fontFamily:(0,O.ok)(null===(kt=e.customTable)||void 0===kt?void 0:kt.fontFamily),fontSize:(0,O.ok)(null===(Bt=e.customTable)||void 0===Bt?void 0:Bt.fontSize),lineHeight:(0,O.ok)(null===(Rt=e.customTable)||void 0===Rt?void 0:Rt.lineHeight),textStrong:(0,O.ok)(null===(xt=e.customTable)||void 0===xt?void 0:xt.textStrong),textItalic:(0,O.ok)(null===(Tt=e.customTable)||void 0===Tt?void 0:Tt.textItalic),textStrikethrough:(0,O.ok)(null===(It=e.customTable)||void 0===It?void 0:It.textStrikethrough),textUnderline:(0,O.ok)(null===(At=e.customTable)||void 0===At?void 0:At.textUnderline),textLink:(0,O.ok)(null===(Ct=e.customTable)||void 0===Ct?void 0:Ct.textLink),linkHref:(0,O.ok)(null===(Nt=e.customTable)||void 0===Nt?void 0:Nt.linkHref),linkTarget:(0,O.ok)(null===(Pt=e.customTable)||void 0===Pt?void 0:Pt.linkTarget),textColor:(0,O.ok)(null===(Lt=e.customTable)||void 0===Lt?void 0:Lt.textColor),textBackgroundColor:(0,O.ok)(null===(Ft=e.customTable)||void 0===Ft?void 0:Ft.textBackgroundColor),textAlign:(0,O.ok)(null===(Ot=e.customTable)||void 0===Ot?void 0:Ot.textAlign),valign:(0,O.ok)(null===(Vt=e.customTable)||void 0===Vt?void 0:Vt.textValign)}),!(0,O.ok)(null===(Mt=e.customTable)||void 0===Mt?void 0:Mt.borderRadius.all)&&((0,O.ok)(null===(Dt=e.customTable)||void 0===Dt?void 0:Dt.borderRadius.topLeft)||(0,O.ok)(null===(Ht=e.customTable)||void 0===Ht?void 0:Ht.borderRadius.bottomLeft)||(0,O.ok)(null===(zt=e.customTable)||void 0===zt?void 0:zt.borderRadius.topRight)||(0,O.ok)(null===(Wt=e.customTable)||void 0===Wt?void 0:Wt.borderRadius.bottomRight))?w(!1):w(!0),!(0,O.ok)(null===(Ut=e.customTable)||void 0===Ut?void 0:Ut.mobileBorderRadius.all)&&(0,O.ok)(null===($t=e.customTable)||void 0===$t?void 0:$t.mobileBorderRadius.topLeft)||(0,O.ok)(null===(Gt=e.customTable)||void 0===Gt?void 0:Gt.mobileBorderRadius.bottomLeft)||(0,O.ok)(null===(jt=e.customTable)||void 0===jt?void 0:jt.mobileBorderRadius.topRight)||(0,O.ok)(null===(Xt=e.customTable)||void 0===Xt?void 0:Xt.mobileBorderRadius.bottomRight)?I(!1):I(!0),C(""===(null===(qt=e.customTable)||void 0===qt?void 0:qt.backgroundImage[0].value)),P(e=>{var t,o,l;return!!(null!==(t=Zt[io])&&void 0!==t&&t.width||null!==(o=Zt[io])&&void 0!==o&&o.style||null!==(l=Zt[io])&&void 0!==l&&l.color)||e}),M(!!e.borderRadius.all||!!e.borderRadius.topLeft||!!e.borderRadius.bottomLeft||!!e.borderRadius.topRight||!!e.borderRadius.bottomRight),W(!!e.boxShadow),be(!(null===(Yt=e.width)||void 0===Yt||!Yt.value)||!(null===(Kt=e.minWidth)||void 0===Kt||!Kt.value)||!(null===(Qt=e.maxWidth)||void 0===Qt||!Qt.value)),q(!(null===(Jt=e.customTable)||void 0===Jt||!Jt.mobileWidth.value)),ge(!!e.exportAsPicture)}},[d,e]),(0,l.useEffect)(()=>{var t;const o=d.getFieldValue("linkHref");"string"===typeof(null===(t=e.customTable)||void 0===t?void 0:t.linkHref)&&ue(!0),_e&&!o&&(ue(!1),d.setFieldsValue({linkHref:null})),_e.current=o||null},[null===Se||void 0===Se?void 0:Se.textLink,null===Se||void 0===Se?void 0:Se.linkHref,null===(i=e.customTable)||void 0===i?void 0:i.linkHref,d]),(0,l.useEffect)(()=>{var t,o,l;null!==(t=e.customTable)&&void 0!==t&&t.linkHref&&(0,O.b9)((null===(l=e.customTable)||void 0===l?void 0:l.linkHref)||"",de);d.setFieldsValue({linkHref:"string"===typeof(null===(o=e.customTable)||void 0===o?void 0:o.linkHref)?e.customTable.linkHref:"https://"})},[d,e,de]);const Ne=t=>{var o,l,i,a,n,s,m,c,u;const p=d.getFieldsValue(!0),g=Object.keys(t)[0];let h;const b=Nt.includes(g)&&p[g]?{...p[g],width:""===p[g].width?(null===(o=p.borderAll)||void 0===o?void 0:o.width)||"1":p[g].width,color:""===p[g].color?(null===(l=p.borderAll)||void 0===l?void 0:l.color)||Re:p[g].color,style:""===p[g].style?(null===(i=p.borderAll)||void 0===i?void 0:i.style)||"solid":p[g].style}:null,f=["top","right","bottom","left"],v="em-mob-border_",_=e=>({...E.iV[e],classNamePrefix:`${v}${e}-`}),S=(e,t,o,l)=>f.reduce((i,a)=>(i[a]={...e,[o]:a===t?l:e[o],classNamePrefix:`${v}${a}-`},i),{});switch(g){case"exportAsPicture":h={exportAsPicture:p.exportAsPicture};break;case"boxShadowInset":case"boxShadowHOffset":case"boxShadowVOffset":case"boxShadowBlurRadius":case"boxShadowSpreadRadius":case"boxShadowColor":h={boxShadow:{hOffset:p.boxShadowHOffset,vOffset:p.boxShadowVOffset,blurRadius:p.boxShadowBlurRadius,spreadRadius:p.boxShadowSpreadRadius,color:p.boxShadowColor,inset:p.boxShadowInset}};break;case"width":h={[g]:{value:t[g],dim:p.widthDim}};break;case"widthDim":h={width:{value:p.width,dim:t[g]}};break;case"maxWidth":h={[g]:{value:t[g],dim:p.maxWidthDim}};break;case"maxWidthDim":h={maxWidth:{value:p.maxWidth,dim:t[g]}};break;case"minWidth":h={[g]:{value:t[g],dim:p.minWidthDim}};break;case"minWidthDim":h={minWidth:{value:p.minWidth,dim:t[g]}};break;case"backgroundImage":C(""===t[g]),h={[g]:[{...null===(a=e.customTable)||void 0===a?void 0:a.backgroundImage[0],value:t[g]}],backgroundSize:"cover"},d.setFieldsValue({backgroundColor:""});break;case"backgroundColor":C(!0),h=t,d.setFieldsValue({backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:""});break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":h={borderRadius:{[X.wF[g]]:+t[g]}};break;case"mobileWidth":h={[g]:{classNamePrefix:"em-mob-width-",value:t[g],dim:p.mobileWidthDim}};break;case"mobileWidthDim":h={mobileWidth:{classNamePrefix:"em-mob-width-",value:p.mobileWidth||100,dim:t[g]}};break;case"mobileHeight":h={[g]:{classNamePrefix:"em-mob-height-",value:t[g],dim:p.mobileHeightDim}};break;case"mobileBorderStyle":case"mobileBorderColor":case"mobileBorderWidth":const o={mobileBorderStyle:"style",mobileBorderColor:"color",mobileBorderWidth:"width"}[g],{newBorders:l,sending:i,formUpdates:y}=((e,t,o,l)=>{var i,a,r,n,d,s;const m=l.mobileBorderPosition,c="all"===m,u=""===t||null==t;let p;p=c?{all:{...o.all,[e]:u?null:t,classNamePrefix:`${v}all-`},...f.reduce((e,t)=>({...e,[t]:_(t)}),{})}:u?{...o,[m]:_(m),all:{...E.iV.all}}:null!=(null===(i=o.all)||void 0===i?void 0:i.color)&&null!=(null===(a=o.all)||void 0===a?void 0:a.width)&&null!=(null===(r=o.all)||void 0===r?void 0:r.style)?{...S(o.all,m,e,t),all:{...E.iV.all}}:{...o,[m]:{...o[m],[e]:t,classNamePrefix:`${v}${m}-`},all:{...E.iV.all}};const g=c?p.all:p[m];return{newBorders:p,sending:{mobileBorder:p},formUpdates:{mobileBorderColor:null!==(n=null===g||void 0===g?void 0:g.color)&&void 0!==n?n:Re,mobileBorderWidth:null!==(d=null===g||void 0===g?void 0:g.width)&&void 0!==d?d:1,mobileBorderStyle:null!==(s=null===g||void 0===g?void 0:g.style)&&void 0!==s?s:"solid"}}})(o,t[g],k,p);Object.assign(p,y),B(l),h=i;break;case"mobileBorderPosition":d.setFieldsValue({mobileBorderWidth:k[t[g]].width||"",mobileBorderColor:k[t[g]].color||"",mobileBorderStyle:k[t[g]].style||""});break;case"mobileBorderRadiusAll":case"mobileBorderRadiusTopLeft":case"mobileBorderRadiusBottomLeft":case"mobileBorderRadiusTopRight":case"mobileBorderRadiusBottomRight":h={mobileBorderRadius:{[X.NW[g]]:t[g],classNamePrefix:"em-mob-border_radius_"+X.NW[g]+"-"}};break;case"mobileBoxShadowInset":case"mobileBoxShadowHOffset":case"mobileBoxShadowVOffset":case"mobileBoxShadowBlurRadius":case"mobileBoxShadowSpreadRadius":case"mobileBoxShadowColor":h={mobileBoxShadow:{hOffset:p.mobileBoxShadowHOffset,vOffset:p.mobileBoxShadowVOffset,blurRadius:p.mobileBoxShadowBlurRadius,spreadRadius:p.mobileBoxShadowSpreadRadius,color:p.mobileBoxShadowColor,inset:p.mobileBoxShadowInset,classNamePrefix:"em-mob-box_shadow-"}};break;case"mobileBackgroundColor":h={[g]:{classNamePrefix:"em-mob-background_color-",value:t[g]}};break;case"mobileBackgroundImage":h={[g]:[{...e.mobileBackgroundImage[0],classNamePrefix:"em-mob-background_image-",value:t[g]}]};break;case"mobileBackgroundPositionX":h={[g]:{classNamePrefix:"em-mob-background_position_x-",value:t[g]}};break;case"mobileBackgroundPositionY":h={[g]:{classNamePrefix:"em-mob-background_position_x-",value:t[g]}};break;case"mobileBackgroundRepeat":h={[g]:{classNamePrefix:"em-mob-background_repeat-",value:t[g]}};break;case"mobileAlign":h={[g]:{classNamePrefix:"em-mob-table_align-",value:t[g]}};break;case"borderPosition":case"cell_borderPosition":h=t,r({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:h});break;case"borderAll":""===(null===(n=t[g])||void 0===n?void 0:n.style)?d.setFieldsValue({borderAll:ke}):d.setFieldsValue({borderTop:ke,borderBottom:ke,borderLeft:ke,borderRight:ke}),h=t;break;case"borderTop":d.setFieldsValue({borderTop:b}),""===(null===(s=t[g])||void 0===s?void 0:s.style)?d.setFieldsValue({borderTop:ke}):d.setFieldsValue({borderAll:ke}),h=t;break;case"borderBottom":d.setFieldsValue({borderBottom:b}),""===(null===(m=t[g])||void 0===m?void 0:m.style)?d.setFieldsValue({borderBottom:ke}):d.setFieldsValue({borderAll:ke}),h=t;break;case"borderLeft":d.setFieldsValue({borderLeft:b}),""===(null===(c=t[g])||void 0===c?void 0:c.style)?d.setFieldsValue({borderLeft:ke}):d.setFieldsValue({borderAll:ke}),h=t;break;case"borderRight":d.setFieldsValue({borderRight:b}),""===(null===(u=t[g])||void 0===u?void 0:u.style)?d.setFieldsValue({borderRight:ke}):d.setFieldsValue({borderAll:ke}),h=t;break;case"fontSize":case"lineHeight":if(null===t[g]||""===t[g]||void 0===t[g])return;h=t;break;default:h=t}"borderPosition"!==g&&r({operation:E.Ru.SANDBOX_ELEMENT_SETTINGS_SET,type:e.type,settings:h})},Pe=(0,l.useCallback)(()=>{ht(d,xe,P,re,N,ve,"")},[d,xe,N,""]),Le=(0,l.useCallback)(()=>{bt(d,F,L,k,B,r,e)},[d,L,k,r,e]),Fe=(0,l.useCallback)(()=>{ft(d,M,V,w,r,e,"")},[d,V,w,r,e,""]),Oe=(0,l.useCallback)(()=>{vt(d,H,D,r,e)},[d,D,r,e]),Ve=(0,l.useCallback)(()=>{_t(d,W,z,r,e)},[d,z,r,e]),Me=(0,l.useCallback)(()=>{Et(d,$,U,r,e)},[d,U,r,e]),De=(0,l.useCallback)(()=>{St(d,q,j,r,e)},[d,j,r,e]),He=(0,l.useCallback)(()=>{yt(K)},[K]),ze=(0,l.useCallback)(()=>{wt(d,J,Q,r,e)},[d,Q,r,e]),We=(0,l.useCallback)(()=>{kt(d,ee,Z,r,e)},[d,Z,r,e]),Ue=(0,l.useCallback)(()=>{Bt(d,oe,te,r,e)},[d,te,r,e]),$e=(0,l.useCallback)(()=>{Rt(ie)},[ie]),Ge=(0,l.useCallback)(()=>{xt(d,oe,te,r,e)},[d,te,r,e]);return l.createElement(c.lV,{form:d,layout:"vertical",name:t,initialValues:{paddingTop:"",paddingLeft:"",paddingRight:"",paddingBottom:"",cell_paddingTop:"",cell_paddingLeft:"",cell_paddingRight:"",cell_paddingBottom:"",cell_paddingLeftRight:"",cell_paddingTopBottom:"",borderAll:{width:"",style:"",color:""},borderTop:{width:"",style:"",color:""},borderBottom:{width:"",style:"",color:""},borderLeft:{width:"",style:"",color:""},borderRight:{width:"",style:"",color:""},cellBackgroundColor:"",backgroundImageForCell:"",cellBackgroundPositionX:"",cellBackgroundPositionY:"",cellBackgroundRepeat:"",cellBackgroundSize:"",backgroundColor:"",backgroundImage:"",backgroundPositionX:"",backgroundPositionY:"",backgroundRepeat:"",backgroundSize:"",exportAsPicture:!1,show:"all",width:{value:"",dim:""},maxWidth:{value:"",dim:""},minWidth:{value:"",dim:""},align:"",mobileAlign:"",border:"",boxShadow:"",borderPosition:"",borderColor:"",borderWidth:"",borderStyle:"",borderRadiusAll:"",RadiusTopLeft:"",RadiusBottomLeft:"",RadiusTopRight:"",RadiusBottomRight:"",mobileWidth:"",mobileWidthDim:"",mobileHeight:"",mobileHeightDim:"px",mobileBorder:"",mobileBorderPosition:"",mobileBorderColor:"",mobileBorderWidth:"",mobileBorderStyle:"",mobileBorderAll:"",mobileBorderTop:"",mobileBorderBottom:"",mobileBorderLeft:"",mobileBorderRight:"",mobileBoxShadow:"",mobileBackgroundColor:"",mobileBackgroundImage:"",cell_border:"",cell_borderColor:"",cell_borderWidth:"",cell_borderStyle:"",cell_borderPosition:"cell_borderAll",cell_borderAll:{color:"",width:"",style:""},cell_borderTop:{color:"",width:"",style:""},cell_borderBottom:{color:"",width:"",style:""},cell_borderLeft:{color:"",width:"",style:""},cell_borderRight:{color:"",width:"",style:""},cell_borderRadiusAll:"",cell_RadiusTopLeft:"",cell_RadiusBottomLeft:"",cell_RadiusTopRight:"",cell_RadiusBottomRight:"",fontFamily:"",fontSize:"",lineHeight:"",textStrong:"",textItalic:"",textStrikethrough:"",textUnderline:"",textLink:"",linkHref:"",textColor:"",textAlign:"",verticalAlign:"",textBackgroundColor:"",valign:""},onValuesChange:Ne,autoComplete:"off",className:"element-controls",style:{padding:0,display:"flex",flexDirection:"column"}},!Be&&l.createElement(c.m_,{title:a("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"},l.createElement(c.Fc,{className:"selected_form-mobile-props-title",message:a("Appearance on mobile devices"),type:"info"})),xe?l.createElement("div",{id:"selected_element_form_desktop_props"},l.createElement(Tt,{form:d,onBorderSideClear:Ne,formValues:Se,elementSettings:e,appConfig:m,token:s,isMacOS:Te,__:a,handleToggleShowPaddingCell:$e,handleTogglePaddingCell:Ge,handleToggleBackground:He,handleToggleBorder:Pe,handleToggleBorderRadius:Fe,paddingCellShow:le,paddingsExt:te,backgroundShow:Y,cellBordersShow:ae,borderRadiusShow:V,oneBorderRadiusValue:v,setOneBorderRadiusValue:w,backgroundImageEmpty:A,backgroundRepeatOptions:ye,backgroundSizeOptions:we,sendAction:Ae,typografItems:Ce,textInputRef:Ee,linkProtocol:ne,handleLinkProtocolsChange:e=>{d.setFieldValue("linkHref","mergetag"!==e?e:""),de(e)},isCodeVision:Be})):l.createElement(Ct,{form:d,onBorderSideClear:Ne,elementSettings:e,handleToggleShowPadding:We,handleTogglePadding:Ue,handleToggleBackground:He,handleToggleBorder:Pe,handleToggleBorderRadius:Fe,handleToggleBoxShadow:Ve,handleToggleMobileSize:De,handleToggleMobileBackground:ze,handleToggleMobileBorder:Le,handleToggleMobileBorderRadius:Oe,handleToggleMobileBoxShadow:Me,paddingShow:Z,paddingsExt:te,backgroundShow:Y,bordersShow:N,borderRadiusShow:V,boxShadowShow:z,mobileSizeShow:j,mobileBackgroundShow:Q,mobileBordersShow:L,mobileBorderRadiusShow:D,mobileBoxShadowShow:U,oneBorderRadiusValue:v,setOneBorderRadiusValue:w,oneMobileBorderRadiusValue:T,setOneMobileBorderRadiusValue:I,backgroundImageEmpty:A,backgroundRepeatOptions:ye,backgroundSizeOptions:we,boxShadow:b,mobileBorders:k,mobileBoxShadow:R,elementViewType:u,mobileViewActive:p})," ")},Lt=({className:e=null,formSettings:t,emailElementType:o,formName:a})=>{const m=(0,n.wA)(),c=(0,K.Cb)(),u=(0,l.useRef)(),p=(0,n.d4)(G.B),g=(0,n.d4)(d.qX),h=(0,n.d4)(s.qX),b=o===E.Tm?g:h,[f,v]=(0,l.useState)(b);(0,l.useEffect)(()=>{v(b.type===E.bV.CAROUSEL||b.type===E.bV.IMG?t.settings:b)},[b,t.settings]);return(0,z.A)(e=>{const t=e.data.operation,o=e.data.action;if(t===E.Ru.APPLICATION_ACTION){function l(e,t=null){const o={[e]:t||!f[e]};c(o,f.type),m((0,d.G_)(o)),v(e=>({...e,...o}))}"toggle_strong"===o&&l("textStrong"),"toggle_italic"===o&&l("textItalic"),"toggle_underline"===o&&l("textUnderline"),"toggle_strikethrough"===o&&l("textStrikethrough"),"textAlign_left"===o&&l("textAlign","left"),"textAlign_right"===o&&l("textAlign","right"),"textAlign_center"===o&&l("textAlign","center")}}),l.createElement("div",{className:"selected-element-panel"},l.createElement(i.A,{nodeRef:u,in:p===E.yI,timeout:300,classNames:"transition"},l.createElement("div",{ref:u,className:r()("selected-element-panel-content",{[e]:e})},(b.type===E.bV.IMG||b.type===E.bV.COUNTDOWN||b.type===E.bV.VIDEO)&&l.createElement(ee,{elementSettings:b}),b.type===E.bV.TEXT&&l.createElement(se,{elementSettings:b}),b.type===E.bV.LINK&&l.createElement(fe,{elementSettings:b}),b.type===E.bV.TABLE&&l.createElement(be,{elementSettings:b}),b.type===E.bV.CUSTOM_TABLE&&l.createElement(Pt,{elementSettings:b,formName:a}),(b.type===E.bV.TD||b.type===E.bV.STRUCTURE||b.type===E.bV.GROUP||b.type===E.bV.COLUMN)&&l.createElement(Ie,{elementSettings:b}),b.type===E.bV.VAR&&l.createElement(He,{elementSettings:b}),b.type===E.bV.BUTTON&&l.createElement(De,{elementSettings:b}),b.type===E.bV.DIV&&l.createElement(Ne,{elementSettings:b}),b.type===E.bV.VINDENT&&l.createElement(Ee,{elementSettings:b}),b.type===E.bV.FLOAT_BLOCK&&l.createElement(Oe,{elementSettings:b}),t.type===E.bV.CAROUSEL&&l.createElement(Ge,{elementSettings:t}),t.type===E.bV.ACCORDION&&l.createElement(Xe,{elementSettings:t}),t.type===E.bV.SOCIAL&&l.createElement(pt,{elementSettings:t}))))}},87826:(e,t,o)=>{o.d(t,{A:()=>S});var l=o(1936),i=o(69962),a=o(84075),r=o(96040),n=o(57549),d=o(6403),s=o(78443),m=o(98173),c=o(22817),u=o(487),p=o(44004),g=o(47706),h=o(41244),b=o(68876),f=(o(91480),o(93506)),v=o(7314),_=o(65185),E=o(65893);const S=({isModalVisible:e=!1,email:t=null})=>{const{__:o}=(0,g.s9)(),[S]=n.lV.useForm(),y=(0,i.wA)(),{emailId:w}=(0,a.g)(),k=(0,d.hN)(),B=(0,i.d4)(m.C1),R=(0,i.d4)(c.Rz),[x,T]=(0,p.lg)(),{token:I}=(0,n.rd)(),A=(0,i.Pj)(),[C,N]=(0,l.useState)(!1),P=((0,b.rD)(),t.project),[L,F]=(0,u.OD)(),{data:O}=u.Nq.endpoints.getProject.select(+P)(A.getState()),{testEmails:V}=(0,b.rD)(),[M,D]=(0,l.useState)([]),[H,z]=(0,l.useState)(!1),W=(0,_.ml)(E.AZ.ON_SEND_EMAIL_MODAL_ID);(0,l.useEffect)(()=>{f.EW.isPlugin&&e?W.fire(t).then(t=>{t.some(e=>!1===e)?y((0,s.Oo)()):N(e)}):N(e)},[e,y,N,t,W]),(0,l.useEffect)(()=>{if(O&&!f.EW.isPlugin){const{owner:e,admins:t,users:o,invited_users:l}=O.members;let i=[];const a=localStorage.getItem(f.V0.em_test_emails)?JSON.parse(localStorage.getItem(f.V0.em_test_emails)):[];if(a.length&&a[P]&&a[P].map(({prevLSEmail:e})=>i.push(e)),l&&l.map(({invited_user_email:e})=>i.push(e)),o&&o.map(({user_email:e})=>i.push(e)),e&&i.push(e.user_email),t&&t.map(({user_email:e})=>i.push(e)),O.projects_test_emails){const e=O.projects_test_emails.map(({projects_test_email:e})=>e);i.push(...e)}const r=Array.from(new Set(i));i.length&&D(r.map(e=>({value:e})))}},[O,P]),(0,l.useEffect)(()=>{f.EW.isPlugin&&D(V.map(e=>({value:e})))},[V]),(0,l.useEffect)(()=>{var e;const t=localStorage.getItem(f.V0.em_test_emails);if(t&&C&&0===(null===(e=S.getFieldValue("recipients"))||void 0===e?void 0:e.length)){const e=JSON.parse(t);null!==e&&void 0!==e&&e[P]&&S.setFieldsValue({recipients:e[P]})}},[P,C,S]),(0,l.useEffect)(()=>{S.setFieldsValue({subject:t.subject})},[S,t.subject]);const U=(0,v.fn)(),$=l.useRef(R);return $.current=R,(0,l.useEffect)(()=>{const e=$.current;if(T.isSuccess&&H){var l;if(200===(null===(l=T.data)||void 0===l?void 0:l.status)||f.EW.isPlugin){const l=[...new Set([...M.map(e=>e.value),...S.getFieldValue("recipients")])].map(e=>({projects_test_email:e})),i=(e,t)=>{if(!e||!t)return e===t;if(e.length!==t.length)return!1;const o=e.map(e=>e.projects_test_email).sort(),l=t.map(e=>e.projects_test_email).sort();return o.every((e,t)=>e===l[t])};i(l,e)||L({projectId:P,projects_test_emails:l});const a=localStorage.getItem(f.V0.em_test_emails)?JSON.parse(localStorage.getItem(f.V0.em_test_emails)):[];let r=S.getFieldValue("recipients");localStorage.setItem(f.V0.em_test_emails,JSON.stringify({...a,[P]:[...new Set(r)]})),k.success(o("The email \u201c")+t.title+o("\u201d was successfully sent."))}else{var i,a;k.error({error:{data:{code:null===(i=T.data)||void 0===i?void 0:i.code,message:null===(a=T.data)||void 0===a?void 0:a.message}}})}z(!1),S.resetFields(),y((0,s.Oo)())}},[T,S,P,L,M,H,y,t.title,F,o]),(0,l.useEffect)(()=>{F.isError&&(k.error(F),z(!1),S.resetFields(),y((0,s.Oo)()))},[y,F,S]),(0,l.useEffect)(()=>{S.setFieldsValue({subject:t.subject||t.title})},[t,S]),l.createElement(n.aF,{width:572,title:l.createElement("div",{style:{paddingBottom:8}},l.createElement(r.Ay,{icon:"SendOutlined",size:20,strokeWidth:2})," ",o("Send a test email")),open:C,onCancel:()=>{y((0,s.Oo)()),S.resetFields()},footer:[l.createElement(n.$n,{key:"submit",size:"large",className:"em-analytics__email-send-test",type:"primary",htmlType:"submit",form:"Send mail",loading:F.isLoading,icon:l.createElement(r.Ay,{icon:"SendOutlined",size:18,strokeWidth:2,className:"email-preview-menu__list-item-icon"}),onClick:()=>{S.validateFields().then(()=>{const e={user_id:B.id,project_id:P,email_id:w,subject:S.getFieldValue("subject"),email:S.getFieldValue("recipients").join(","),html:(t=(null===U||void 0===U?void 0:U.getValue())||"",t.replace(/[\\]/g,"\\\\").replace(/["]/g,'\\"').replace(/[/]/g,"\\/").replace(/[\b]/g,"\\b").replace(/[\f]/g,"\\f").replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r").replace(/[\t]/g,"\\t"))};var t;x(e).unwrap().catch(e=>{var t,o;k.error({error:{data:{code:null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.code,message:null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.message}}})}),z(!0),pushToDataLayer({event:"submit",action:"send_test_email",entity_id:w,project_id:P,recipients_count:S.getFieldValue("recipients").length})}).catch(e=>{})},disabled:T.isLoading},o("Send"))],forceRender:!0},l.createElement(n.lV,{form:S,layout:"vertical",name:"send_mail_form",initialValues:{subject:t.subject||t.title,recipients:[]},autoComplete:"off"},l.createElement(n.lV.Item,{label:o("Subject"),name:"subject",rules:[{required:!1,message:o("Please type subject")}]},l.createElement(n.pd,{size:"large",placeholder:o("Type subject")})),l.createElement(n.lV.Item,{label:o("Recipients"),name:"recipients",tooltip:{title:o("The test email will be sent to the specified addresses."),icon:l.createElement(r.Ay,{icon:"InfoCircleOutlined"})},rules:[{required:!0,validator:(e,t)=>t.length>10?Promise.reject(new Error(o("A test email can be sent to a maximum of 10 addresses."))):0!==t.length?t.every(e=>h.au.test(e.toLowerCase()))?Promise.resolve():Promise.reject(new Error(o("Please type correct emails"))):Promise.reject(new Error(o("Please type emails")))}]},l.createElement(n.Select,{size:"large",mode:"tags",placeholder:o("Add up to 10 recipients"),tooltip:{title:"Tooltip with customize icon",icon:l.createElement(r.Ay,{icon:"InfoCircleOutlined"})},options:M,tagRender:e=>{const{label:t,closable:o,onClose:i}=e;return l.createElement(n.vw,{color:I.colorPrimary,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},closable:o,onClose:i,style:{borderRadius:6}},t)},getPopupContainer:()=>document.getElementById("send_mail_form")}))))}},16432:(e,t,o)=>{o.d(t,{A:()=>F});var l=o(1936),i=o(57549),a=o(69962),r=o(84075),n=o(47706),d=o(6056),s=o.n(d),m=o(96040),c=o(73888),u=o(6403),p=o(87796),g=o(78443),h=o(93506);const b=({group:e,refetch:t})=>{const{__:o,_x:r}=(0,n.s9)(),d=(0,a.wA)(),[s]=i.lV.useForm(),m=(0,l.useRef)(null),c=(0,a.d4)(g.cL)===h.lx.EDIT_GROUP_NAME_MODAL,b=(0,u.hN)(),{id:f=null,name:v=""}=e,_=()=>d((0,g.Oo)()),[E,S]=(0,p.CE)();(0,l.useEffect)(()=>{c&&s.setFieldsValue({name:v})},[c,v,s]);const y=()=>{s.validateFields().then(({name:e})=>{E({id:f,data:{name:e}}).then(({data:l,error:i})=>{i?(b.error({message:i.data.code,description:i.data.message}),s.setFieldValue("name",e)):(t().then(({data:e})=>{if(e){var t,o,l;const i=null===(t=e[0])||void 0===t||null===(o=t.children)||void 0===o||null===(l=o.find(e=>e.id===f))||void 0===l?void 0:l.name;s.setFieldValue("name",i)}}),_(),b.success({message:o("The group \u201c")+e+r("\u201d was successfully changed to \u201c","group")+l.name+o("\u201d.")}))})})};return l.createElement(i.aF,{title:o("Change group name"),open:c,onOk:y,onCancel:_,className:"new-group-name-modal",footer:[l.createElement(i.$n,{key:"submit",type:"primary",size:"large",loading:S.isLoading,onClick:y},o("Change name"))]},l.createElement(i.lV,{form:s,layout:"vertical",name:"rename_group_form",onFinish:y,initialValues:{remember:!1,name:v},autoComplete:"off",style:{paddingTop:10}},l.createElement(i.lV.Item,{name:"name",rules:[{required:!0,message:o("Please enter the group name")}]},l.createElement(i.pd,{disabled:S.isLoading,size:"large",placeholder:o("Enter the group name"),ref:m,style:{marginBottom:5}}))))};var f=o(52898);const v=({className:e,refetchProjectGroups:t,isLoading:o})=>{const{__:r,_x:d}=(0,n.s9)(),v=(0,a.wA)(),_=(0,u.hN)(),{modal:E}=i.qw.useApp(),{confirm:S}=E,{token:y}=(0,i.rd)(),w=(0,a.d4)(f.UI),[k]=(0,p.Lh)(),B=(e,o)=>{S({maskClosable:!0,centered:!0,title:d("Are you sure to delete \u201c","group")+o+r("\u201d group and all nested groups?"),icon:l.createElement(m.Ay,{icon:"DeleteOutlined",style:{color:"#ff4d4f"}}),okText:r("Yes"),cancelText:r("No"),onOk:()=>(e=>{k(e).unwrap().then(e=>{null!==e&&void 0!==e&&e.deleted&&(_.success({message:r("The group \u201c")+e.previous.name+d("\u201d was successfully deleted.","recovery")}),t())}).catch(e=>{_.error({message:e.data.code,description:e.data.message})})})(String(e))})},R=e=>[{label:r("Rename"),key:"Rename",icon:l.createElement(m.Ay,{icon:"CopyOutlined",size:16}),onClick:()=>{return t=e.id,o=e.name,v((0,g.qf)(h.lx.EDIT_GROUP_NAME_MODAL)),void T({id:t,name:o});var t,o}},{label:r("Remove"),icon:l.createElement(m.Ay,{icon:"DeleteOutlined",size:16}),key:"Remove",style:{color:"#ff4d4f"},onClick:()=>B(e.id,e.name)}],[x,T]=(0,l.useState)({id:null,name:""});return l.createElement("div",{className:s()("groups-management",{[e]:e})},o?l.createElement(i.EA,{active:!0}):l.createElement(i.fI,null,!(null===w||void 0===w||!w.length)&&(null===w||void 0===w?void 0:w.map((e,t)=>{var o;return l.createElement(i.fv,{key:e.id,span:24},l.createElement(i.lV.Item,{name:`group_${e.id}`,style:{marginBottom:y.formItemMarginBottomMD},label:l.createElement(i.so,{justify:"space-between",align:"center",style:{width:"100%"}},l.createElement("span",null,e.name),l.createElement(i.$n,{type:"text",className:"groups-management__group_menu","data-group-id":e.id,size:"large"},l.createElement(i.ms,{className:"groups-management__group_menu-inner",placement:"bottomLeft",menu:{items:R(e)},trigger:["hover"]},l.createElement("span",{className:"groups-management__actions"},l.createElement(m.Ay,{icon:"MoreOutlined"}))))),className:"groups-management__group-select",rules:[{message:"Please input category name!",type:"array"}]},l.createElement(i.Select,{mode:"tags",style:{width:"100%"},placeholder:r("Type category here"),options:null===(o=e.children)||void 0===o?void 0:o.map(e=>({label:e.name,value:String(e.id)})),tagRender:e=>{const{label:t,closable:o,onClose:a}=e;return l.createElement(i.vw,{color:y.colorPrimary,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},closable:o,onClose:a,style:{borderRadius:6}},t)},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})))})),l.createElement(i.fv,{span:24},l.createElement(i.lV.Item,{style:{marginBottom:y.formItemMarginBottomMD}},l.createElement(i.$n,{id:"add_group_button",icon:l.createElement(m.Ay,{icon:"AddSlide"}),style:{width:"100%"},onClick:()=>v((0,g.qf)(h.lx.ADD_NEW_GROUP_MODAL))},r("Add group"))))),l.createElement(c.A,{taxonomy:h.bV.GROUP}),l.createElement(b,{group:x,refetch:t}))};var _=o(45988),E=o(89591),S=o(487),y=o(61062),w=o(11105),k=o(68876),B=o(41244);const{title:R,description:x,tags:T,type:I,is_template:A,group:C}={title:"title",description:"description",tags:"tags",type:"type",is_template:"is_template",group:"group"},N={[R]:"",[x]:"",[T]:[],[A]:!1},P={[x]:"",[T]:[],[I]:""};const L=({className:e="",element:t})=>{var o,d;const{__:c}=(0,n.s9)(),{projectId:u}=(0,r.g)(),g=(0,a.wA)(),[b]=i.lV.useForm(),{token:A}=(0,i.rd)(),L=(0,k.rD)(),F=(0,a.Pj)(),O=(0,a.d4)(f.UI),{data:V}=(0,_.h1)(),{data:M}=(0,r.KC)(),D=t.hasOwnProperty("type")?h.IE:h.Tm,H=t.hasOwnProperty("type")?h.YY:h.zh,{refetch:z,isLoading:W,isFetching:U,isUninitialized:$,isSuccess:G}=(0,p.Oo)({parent:null===(o=M.group)||void 0===o?void 0:o[0]},{skip:!(null!==(d=M.group)&&void 0!==d&&d[0])});(0,l.useEffect)(()=>{!$&&z()},[$,z]);const[j,X]=(0,l.useState)([]),[q,Y]=(0,l.useState)([]),[K,Q]=(0,l.useState)(t.is_template||!1),{data:J}=S.Nq.endpoints.getProject.select(+u)(F.getState());(0,l.useEffect)(()=>{!$&&z()},[t.group,z,$]),(0,l.useEffect)(()=>{if(G&&t.is_template&&t.group.length){const e=t.group;let o={};e.length&&O.length&&(null===e||void 0===e||e.forEach(e=>{null===O||void 0===O||O.forEach(t=>{let l=t.children.find(t=>t.id===e);l&&(o.hasOwnProperty(t.id)||(o[t.id]=[]),o[t.id].push({label:l.name,value:l.id}))})}));let l={};for(let t in o)o.hasOwnProperty(+t)&&(l[`group_${t}`]=o[t].map(e=>({...e,value:String(e.value)})));b.setFieldsValue(l)}},[b,O,t.is_template,t.group,G]),(0,l.useEffect)(()=>{var e;Y(null===(e=function(e){const t=new Set;return null===e||void 0===e?void 0:e.filter(e=>!t.has(e.name)&&(t.add(e.name),!0))}((0,B.HT)(J,H)))||void 0===e?void 0:e.map(e=>({value:e.name,key:e.id})))},[J,H]),(0,l.useEffect)(()=>{if(t){var e,o;const l=null===(e=(0,B._q)(t,H))||void 0===e?void 0:e.map(e=>e.name),i=t.emailtags||t.blocktags,a=null===(o=(0,B._q)(t,H))||void 0===o?void 0:o.filter(e=>i.includes(e.id)).map(e=>e.name);b.setFieldsValue({title:t.title,description:t.description,tags:t.tags||a||l,type:t.type})}},[b,t,H]);(0,l.useEffect)(()=>{if(V){const e=V.schema.properties.acf.properties.type.items.enum;let t=[];const o={Applications:c("Apps"),Articles:c("Article"),Banners:c("Banners"),Buttons:c("Buttons"),"Call to Action":c("Call to Action"),Contacts:c("Contacts"),Content:c("Content"),"E-Commerce":c("E-Commerce"),Feature:c("Features"),Footer:c("Footers"),Header:c("Headers"),Lists:c("Lists"),Menu:c("Menus"),Other:c("Others"),Polls:c("Polls"),Promocodes:c("Promocodes"),Separators:c("Separators")};for(let l in e)t.push({label:o[e[l]],value:e[l]});X(t)}},[V,c]);return l.createElement("div",{className:s()("settings-panel",{[e]:e})},l.createElement(i.lV,{form:b,layout:"vertical",name:"settings_panel_form",initialValues:D===h.Tm?{EmailInitialValues:N}:P,onValuesChange:e=>{const o=Object.keys(e)[0];switch(o.split("_")[0]){case R:t.isNew?g((0,y.BQ)(e[o])):g((0,f.VK)(e[o]));break;case C:g((0,f.Bu)({[o.split("_")[1]]:e[o]}));break;case x:D===h.Tm?t.isNew?g((0,y.Zs)(e[o])):g(E.GY.util.updateQueryData("getEmail",t.id,t=>{Object.assign(t,{description:e[o]})})):t.isNew?g((0,w.AS)(e[o])):g(_.VM.util.updateQueryData("getBlock",t.id,t=>{Object.assign(t,{description:e[o]})}));break;case"is":t.isNew?g((0,y.TC)(e[o])):g(E.GY.util.updateQueryData("getEmail",t.id,t=>{Object.assign(t,{is_template:e[o]})}));break;case T:{const l=e[o].map(e=>e.trim());D===h.Tm?t.isNew?g((0,y.yY)(l)):g(E.GY.util.updateQueryData("getEmail",t.id,e=>{Object.assign(e,{tags:l})})):t.isNew?g((0,w.TB)(l)):g(_.VM.util.updateQueryData("getBlock",t.id,e=>{Object.assign(e,{tags:l})}));break}case I:g(_.VM.util.updateQueryData("getBlock",t.id,t=>{Object.assign(t,{type:e[o]})}));break;default:return}},autoComplete:"off"},L.subjectEnabled&&D===h.Tm&&l.createElement(i.lV.Item,{label:c("Title"),name:R,tooltip:{title:c("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:l.createElement(m.Ay,{icon:"InfoCircleOutlined"})}},l.createElement(i.fs,{placeholder:c("Type title here"),autoSize:{minRows:1}})),L.descriptionEnabled&&l.createElement(i.lV.Item,{label:c("Description"),name:x,tooltip:{title:c("Description is used in other sections of the service."),icon:l.createElement(m.Ay,{icon:"InfoCircleOutlined"})}},l.createElement(i.fs,{placeholder:c("Type your description here"),autoSize:{minRows:2}})),L.tagsEnabled&&l.createElement(i.lV.Item,{label:c("Tags"),name:T,tooltip:{title:c("Tags help you find the block in the list."),icon:l.createElement(m.Ay,{icon:"InfoCircleOutlined"})},rules:[{message:c("Please input tags!"),type:"array"}]},l.createElement(i.Select,{mode:"tags",style:{width:"100%"},placeholder:c("Type your tags here"),options:q,tagRender:e=>{const{label:t,closable:o,onClose:a}=e;return l.createElement(i.vw,{color:A.colorPrimary,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},closable:o,onClose:a,style:{borderRadius:6}},t)},getPopupContainer:()=>document.querySelector(".email-settings__collapse")})),D===h.Tm&&L.isTemplateEnabled&&l.createElement(l.Fragment,null,l.createElement(i.cG,{className:"selected-td-form__divider",style:{marginBottom:16}}),l.createElement(i.m_,{title:t.isNew?c("Save email first."):c("Use this email as a template for creating future emails."),key:"isTemplate"},l.createElement(i.lV.Item,{name:"is_template",valuePropName:"checked",initialValue:K},l.createElement(i.dO,{id:"setIsTemplate",label:c("Is a template"),size:"small",onChange:e=>{Q(e)},disabled:t.isNew,labelStyle:{position:"relative",top:2,fontSize:14,color:A.colorText}})))),K&&l.createElement(v,{element:t,refetchProjectGroups:z,isLoading:W||U}),D===h.IE&&l.createElement(i.lV.Item,{name:I,label:c("Type"),tooltip:{title:c("Select the block type to find any block on the list faster."),icon:l.createElement(m.Ay,{icon:"InfoCircleOutlined"})},rules:[{message:c("Please input type!")}]},l.createElement(i.Select,{placeholder:c("Choose block type"),options:j,getPopupContainer:()=>document.querySelector(".email-settings__collapse")}))))};L.defaultProps={email:void 0};const F=L},10336:(e,t,o)=>{o.d(t,{A:()=>_});var l=o(1936),i=o(57549),a=o(9231),r=o.n(a),n=o(89645),d=o.n(n),s=o(34423),m=o.n(s),c=o(85058),u=o.n(c),p=o(14865),g=o.n(p),h=o(91140),b=o.n(h),f=o(41244);o(76614);const v=[{sizeArray:[24],name:"column-one",html:r()},{sizeArray:[12,12],name:"column-two-50",html:u()},{sizeArray:[8,8,8],name:"column-three",html:g()},{sizeArray:[6,6,6,6],name:"column-four",html:b()},{sizeArray:[8,16],name:"column-two-33",html:d()},{sizeArray:[16,8],name:"column-two-66",html:m()}],_=()=>{const e=(0,f.sh)(),t=(0,f._9)();return l.createElement("div",{className:"structures blocks-search__empty-wrapper"},l.createElement("div",{className:"structures__list"},l.createElement("div",null,v&&v.map((o,a)=>l.createElement("div",{key:o.name},l.createElement("div",{className:"structures__item",draggable:!0,onClick:t=>e(t,o.html),onDragStart:e=>t(e,o.html)},l.createElement(i.fI,{gutter:[6,6],className:"structures__item-row"},o.sizeArray.map((e,t)=>l.createElement(i.fv,{span:e,key:o.name+t},l.createElement("div",{className:"structures__item-col"}))))))))))}},50710:(e,t,o)=>{o.d(t,{A:()=>_});var l=o(1936),i=o(57549),a=o(44536),r=o.n(a),n=o(70684),d=o.n(n),s=o(86642),m=o.n(s),c=o(22643),u=o.n(c),p=o(32994),g=o.n(p),h=o(76427),b=o.n(h),f=o(41244);o(76614);const v=[{sizeArray:[24],name:"column-one",html:r()},{sizeArray:[12,12],name:"column-two-50",html:u()},{sizeArray:[8,8,8],name:"column-three",html:g()},{sizeArray:[6,6,6,6],name:"column-four",html:b()},{sizeArray:[8,16],name:"column-two-33",html:d()},{sizeArray:[16,8],name:"column-two-66",html:m()}],_=()=>{const e=(0,f.sh)(),t=(0,f._9)();return l.createElement("div",{className:"structures blocks-search__empty-wrapper"},l.createElement("div",{className:"structures__list"},l.createElement("div",null,v&&v.map((o,a)=>l.createElement("div",{key:o.name},l.createElement("div",{className:"structures__item",draggable:!0,onClick:t=>e(t,o.html),onDragStart:e=>t(e,o.html)},l.createElement(i.fI,{gutter:[6,6],className:"structures__item-row"},o.sizeArray.map((e,t)=>l.createElement(i.fv,{span:e,key:o.name+t},l.createElement("div",{className:"structures__item-col"}))))))))))}},73378:(e,t,o)=>{o.d(t,{A:()=>p});var l=o(1936),i=o(32544),a=o.n(i),r=o(47706),n=o(6403),d=o(89591),s=o(45988),m=o(91480),c=o(93506);const u=({element:e,context:t="list"})=>{const{__:o,_x:i}=(0,r.s9)(),[a]=(0,d.dN)(),[u]=(0,s.OZ)(),p=(0,n.hN)(),g=(0,m.u)(),h=(e.hasOwnProperty("type")?c.IE:c.Tm,(e,t)=>{if(e.error)return p.error(e),!1;p.success(o("The ")+(t.hasOwnProperty("type")?o("block"):i("email","letter"))+" "+o("\u201c")+e.data.title+o("\u201d")+o("was successfully")+" "+(t.lock?t.hasOwnProperty("type")?i("unlocked.","block"):i("unlocked.","email"):t.hasOwnProperty("type")?i("locked.","block"):i("locked.","email")))});return l.createElement("div",{className:e.hasOwnProperty("type")?"em-analytics__block-lock":"em-analytics__email-lock",onClick:()=>{const o=!e.lock,l=o?"lock_email":"unlock_email";e.hasOwnProperty("type")?u({blockId:e.id,lock:o}).then(l=>{h(l,e),l.error||g({event:o?"lock":"unlock",action:o?"lock_block":"unlock_block",entity_type:"block",entity_id:e.id,project_id:e.project,context:t})}):a({emailId:e.id,lock:o}).then(i=>{h(i,e),i.error||g({event:o?"lock":"unlock",action:l,entity_type:"email",entity_id:e.id,project_id:e.project,context:t})})}},e.lock?o("Unlock"):o("Lock"))};u.defaultProps={element:a().shape({lock:null,id:null})};const p=u},37148:(e,t,o)=>{o.d(t,{A:()=>v});var l=o(1936),i=o(57549),a=o(96040),r=o(69962),n=o(6056),d=o.n(n),s=o(47706),m=o(89591),c=o(61062);const{utm_source:u,utm_medium:p,utm_campaign:g,utm_term:h,utm_content:b}={utm_source:"utm_source",utm_medium:"utm_medium",utm_campaign:"utm_campaign",utm_term:"utm_term",utm_content:"utm_content"},f={[u]:"",[p]:"",[g]:"",[h]:"",[b]:""},v=({className:e="",email:t})=>{const{__:o}=(0,s.s9)(),n=(0,r.wA)(),[v]=i.lV.useForm();(0,l.useEffect)(()=>{var e,o,l,i,a;t&&v.setFieldsValue({utm_source:(null===(e=t.utm_parameters)||void 0===e?void 0:e.utm_source)||"",utm_medium:(null===(o=t.utm_parameters)||void 0===o?void 0:o.utm_medium)||"",utm_campaign:(null===(l=t.utm_parameters)||void 0===l?void 0:l.utm_campaign)||"",utm_term:(null===(i=t.utm_parameters)||void 0===i?void 0:i.utm_term)||"",utm_content:(null===(a=t.utm_parameters)||void 0===a?void 0:a.utm_content)||""})},[v,t]);return l.createElement("div",{className:d()("settings-panel",{[e]:e})},l.createElement(i.lV,{form:v,layout:"vertical",name:"settings_panel_form_utm",initialValues:f,onValuesChange:e=>{const o=Object.keys(e)[0];switch(o){case u:t.isNew?n((0,c.K3)(e[o])):n(m.GY.util.updateQueryData("getEmail",t.id,t=>{Object.assign(t,{utm_parameters:{...t.utm_parameters,utm_source:e[o]}})}));break;case p:t.isNew?n((0,c.ol)(e[o])):n(m.GY.util.updateQueryData("getEmail",t.id,t=>{Object.assign(t,{utm_parameters:{...t.utm_parameters,utm_medium:e[o]}})}));break;case g:t.isNew?n((0,c.P3)(e[o])):n(m.GY.util.updateQueryData("getEmail",t.id,t=>{Object.assign(t,{utm_parameters:{...t.utm_parameters,utm_campaign:e[o]}})}));break;case h:t.isNew?n((0,c.zH)(e[o])):n(m.GY.util.updateQueryData("getEmail",t.id,t=>{Object.assign(t,{utm_parameters:{...t.utm_parameters,utm_term:e[o]}})}));break;case b:t.isNew?n((0,c.mk)(e[o])):n(m.GY.util.updateQueryData("getEmail",t.id,t=>{Object.assign(t,{utm_parameters:{...t.utm_parameters,utm_content:e[o]}})}));break;default:return}},autoComplete:"off"},l.createElement(i.Fc,{message:o("The specified parameters will be added to all links when exporting the email."),type:"info",showIcon:!0,style:{marginBottom:20}}),l.createElement(i.lV.Item,{label:o("utm_source"),name:u,tooltip:{title:o("Mandatory. Indicates the traffic source. Example: utm_source=google"),icon:l.createElement(a.Ay,{icon:"InfoCircleOutlined"})}},l.createElement(i.pd,{placeholder:o("google")})),l.createElement(i.lV.Item,{label:o("utm_medium"),name:p,tooltip:{title:o("Identifies what type of link was used, such as cost per click or email. For example: utm_medium=cpc"),icon:l.createElement(a.Ay,{icon:"InfoCircleOutlined"})}},l.createElement(i.pd,{placeholder:o("cpc")})),l.createElement(i.lV.Item,{label:o("utm_campaign"),name:g,tooltip:{title:o("Indicates a specific product promotion or a marketing campaign. Example: utm_campaign=spring_sale"),icon:l.createElement(a.Ay,{icon:"InfoCircleOutlined"})}},l.createElement(i.pd,{placeholder:o("spring_sale")})),l.createElement(i.lV.Item,{label:o("utm_term"),name:h,tooltip:{title:o("Identifies search terms. For example: utm_term=running+shoes"),icon:l.createElement(a.Ay,{icon:"InfoCircleOutlined"})}},l.createElement(i.pd,{placeholder:o("running+shoes")})),l.createElement(i.lV.Item,{label:o("utm_content"),name:b,tooltip:{title:o("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:l.createElement(a.Ay,{icon:"InfoCircleOutlined"})}},l.createElement(i.pd,{placeholder:o("textlink")}))))}},91113:(e,t,o)=>{o.d(t,{A:()=>x});var l=o(1936),i=o(57549),a=o(69962),r=o(6056),n=o.n(r),d=o(47706),s=o(26967),m=o(96040),c=o(81644),u=o(98173),p=o(22817),g=o(68876),h=o(85469),b=o(65287),f=o(74937),v=o(7714),_=o(32467),E=o(74397),S=o(47600),y=o(79292),w=o(50879),k=o(89660),B=o(93506);const R=e=>"string"===typeof e&&/^https?:\/\//i.test(e.trim()),x=({onChange:e,value:t,validateStatus:o,placeholder:r,disabled:x,name:T,elementSettings:I,imageInfo:A,previewReloadSignal:C,onRemotePreviewValidate:N})=>{var P,L;const F=(0,a.d4)(u.C1),O=(0,a.d4)(u.B$),V=(0,a.d4)(p.yN),M=(0,g.rD)(),D=(0,w.L)(),{__:H}=(0,d.s9)(),z=(0,v.XW)(),{openImagePicker:W}=(0,E.p)(),U=(0,s.of)(),$=(0,s.XB)(),G=void 0!==(null===V||void 0===V?void 0:V.id)?String(null===V||void 0===V?void 0:V.id):"",j=B.EW.isPlugin&&"0"!==(null===F||void 0===F?void 0:F.id)?String(F.id):"",{dataProvider:X}=(0,l.useMemo)(()=>(0,y.C)({storageProvider:U,projectId:G,restApi:$,i18n:{__:H},pathPostfix:j,appConfig:M,isStandalone:D}),[M,D,G,$,U,j,H]),q=(0,S.O)(),[Y]=(0,k.FQ)(),[K,Q]=(0,l.useState)({width:"",height:"",size:""}),[J,Z]=(0,l.useState)(!1),[ee,te]=(0,l.useState)(0),[oe,le]=(0,l.useState)(""),ie=(0,l.useRef)(""),ae=(0,l.useRef)((null===C||void 0===C?void 0:C.counter)||0),re=(0,l.useRef)((0,b.a)()),ne=(0,l.useRef)("");let de=!O&&(null===(P=F.id)||void 0===P?void 0:P.toString())===(null===V||void 0===V||null===(L=V.members)||void 0===L?void 0:L.owner.ID);const se=()=>{ne.current&&(URL.revokeObjectURL(ne.current),ne.current="")};(0,l.useEffect)(()=>{if(!t)return Q({width:"",height:"",size:"",format:""}),ie.current="",le(""),void se();if(t.startsWith("data:")||t.startsWith("blob:"))return se(),ie.current=t,le(t),void Q({width:"",height:"",size:"",format:""});const e=(0,_.xv)(t),o=(0,b.e)(e),l=new AbortController;let i=!1;return(async()=>{try{if(!D){const t=await(0,f.q)(X,e);if(null!==t&&void 0!==t&&t.previewUrl){if(await(async t=>{se(),ie.current=t,le(t);try{const{data:t}=await Y(e);return!(i||!t)&&(Q({width:null===t||void 0===t?void 0:t.width,height:null===t||void 0===t?void 0:t.height,size:null!=(null===t||void 0===t?void 0:t.fileSize)?(t.fileSize/1024).toFixed(0):"",format:null===t||void 0===t?void 0:t.format}),!0)}catch{return!1}})(t.previewUrl))return}}await(async()=>{const e=await re.current.resolve(o,l.signal,q);if(i)return;const{width:t,height:a}=await(0,h.Q)(e);if(i)return;se();const r=URL.createObjectURL(e);ne.current=r,ie.current=r,le(r),Q({width:t,height:a,size:(e.size/1024).toFixed(0),format:e.type||""})})()}catch{i||(se(),ie.current="",le(""),Q({width:"",height:"",size:"",format:""}))}})(),()=>{i=!0,l.abort()}},[t,X,q,Y,D]);const me=()=>{const e=ie.current;!e||e.startsWith("data:")||e.startsWith("blob:")||le((0,_.J)((0,_.xv)(e)))};(0,l.useEffect)(()=>{null!==C&&void 0!==C&&C.counter&&C.name===T&&C.counter!==ae.current&&(ae.current=C.counter,me())},[T,C]),(0,l.useEffect)(()=>()=>se(),[]);const ce=async(o=null)=>{var l;const i=T.startsWith("src"),a=o||(i?B.lx.UPLOAD_IMAGE_MODAL:B.lx.UPLOAD_BACKGROUND_MODAL),r=await W({kind:i?"img":"background",currentUrl:(0,_.xv)(t||""),entryModal:a});if(null===r||void 0===r||!r.url)return;const n=(0,_.xv)(t||"")===(0,_.xv)(r.url);n&&r.url===t||e(r.url),"save"===(null===(l=r.meta)||void 0===l?void 0:l.mode)&&n&&(me(),i&&z({operation:B.Ru.SANDBOX_CURRENT_IMAGE_RELOAD,src:r.url,forceReload:!0}))},ue=[{label:H("Upload"),key:"Upload",onClick:()=>ce(T.startsWith("src")?B.lx.UPLOAD_IMAGE_MODAL_UPLOAD:B.lx.UPLOAD_BACKGROUND_MODAL_UPLOAD)}];M.imageCenterStockEnabled&&ue.push({label:H("Stock"),key:"Stock",onClick:()=>ce(T.startsWith("src")?B.lx.UPLOAD_IMAGE_MODAL_STOCK:B.lx.UPLOAD_BACKGROUND_MODAL_STOCK)}),M.imageCenterGifEnabled&&ue.push({label:H("GIF"),key:"GIF",onClick:()=>ce(T.startsWith("src")?B.lx.UPLOAD_IMAGE_MODAL_GIF:B.lx.UPLOAD_BACKGROUND_MODAL_GIF)}),M.elementAIimageEnabled&&ue.push({label:H("AI"),key:"AI",onClick:()=>ce(T.startsWith("src")?B.lx.UPLOAD_IMAGE_MODAL_AI:B.lx.UPLOAD_BACKGROUND_MODAL_AI)});return l.createElement("div",{className:n()("upload-bg-image",{"upload-bg-image_disabled":x})},t?l.createElement("div",{className:"ant-input-file-uploader upload-bg-image__inner-wrap",onClick:e=>{var t,o,l,i;null!==(t=e.target)&&void 0!==t&&t.closest(".upload-bg-image__edit")||null!==(o=e.target)&&void 0!==o&&o.closest(".upload-bg-image__edit-menu")||null!==(l=e.target)&&void 0!==l&&l.closest(".upload-bg-image__menu")||null!==(i=e.target)&&void 0!==i&&i.closest(".inputGroup")||ce(T.startsWith("src")?B.lx.UPLOAD_IMAGE_MODAL_UPLOAD:B.lx.UPLOAD_BACKGROUND_MODAL_UPLOAD)}},l.createElement(i.ms,{arrow:!0,dropdownRender:()=>M.imagePathDropdownEnabled?l.createElement("div",{className:"inputGroup"},l.createElement(i.pd,{prefix:l.createElement(m.Ay,{icon:"Image",size:20,strokeWidth:M.iconStrokeWidth,style:{verticalAlign:"text-top"}}),allowClear:!0,onChange:e,value:t,placeholder:r,name:T,disabled:x,className:"upload-bg-image__input"})):l.createElement(l.Fragment,null),overlayClassName:"upload-bg-image__dropdown-overlay",overlayStyle:{top:32,marginTop:"8px",width:347,left:0},trigger:["hover"],placement:"bottom",getPopupContainer:e=>e.closest(".upload-bg-image__inner-wrap")},l.createElement("div",{className:"upload-bg-image__hover-container",style:{display:"flex",alignItems:"center"}},l.createElement("div",{className:"upload-bg-image__uploader"},l.createElement("div",{className:"upload-bg-image__uploader-content"},l.createElement("div",{className:"upload-bg-image__uploader-content-inner"},l.createElement("div",{className:"upload-bg-image__uploader-img-wrap"},l.createElement("img",{className:"upload-bg-image__uploader-img",src:oe,alt:"",onLoad:()=>{N&&R((0,_.xv)(t||""))&&N("success")},onError:()=>{N&&R((0,_.xv)(t||""))&&N("error")}})),l.createElement("div",{className:"upload-bg-image__uploader-icons-wrap"},l.createElement("div",{className:"upload-bg-image__uploader-content"}))))),K.width&&K.height?l.createElement("div",{className:"image-size"},K.width," \xd7 ",K.height,!!I&&(I.type===B.bV.IMG||I.type===B.bV.CAROUSEL)&&" \u2192 "+A.renderedWidth+" \xd7 "+A.renderedHeight,l.createElement("span",{className:"image-size-splitter"}," \xa0\u2022\xa0 "),l.createElement("span",null,K.size," ",H("kB")),K.format&&l.createElement(l.Fragment,null,l.createElement("span",{className:"image-size-splitter"}," \xa0\u2022\xa0 "),l.createElement("span",{className:"image-size-format"},K.format))):l.createElement(i.EY,{type:"secondary",className:"image-empty-text"},r))),l.createElement("div",{style:{flexGrow:1}}),"gif"!==K.format&&M.imageCenterEditorEnabled&&l.createElement(i.m_,{title:H("Edit")},l.createElement(i.EY,{type:"link",className:"upload-bg-image__edit"},l.createElement(m.Ay,{icon:"Edit",size:16,strokeWidth:M.iconStrokeWidth,onClick:()=>{de?(Z(!0),te(5)):ce(T.startsWith("src")?B.lx.UPLOAD_IMAGE_MODAL_EDIT:B.lx.UPLOAD_BACKGROUND_MODAL_EDIT)}}))),l.createElement(i.ms,{key:"Actions",arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:ue},overlayClassName:"upload-bg-image__menu"},l.createElement(i.EY,{type:"link",className:"upload-bg-image__edit-menu image-change"},t?l.createElement(m.Ay,{size:16,strokeWidth:M.iconStrokeWidth,icon:"SyncOutlined",onClick:()=>ce(T.startsWith("src")?B.lx.UPLOAD_IMAGE_MODAL_UPLOAD:B.lx.UPLOAD_BACKGROUND_MODAL_UPLOAD)}):H("Upload")))):l.createElement(i.$n,{type:"default",block:!0,onClick:()=>ce(T.startsWith("src")?B.lx.UPLOAD_IMAGE_MODAL_UPLOAD:B.lx.UPLOAD_BACKGROUND_MODAL_UPLOAD),icon:l.createElement(m.Ay,{icon:"Image",size:16,strokeWidth:M.iconStrokeWidth})},H("Add image")),l.createElement(c.A,{open:J,onCancel:()=>{Z(!1)},initialSlide:ee}))}},47600:(e,t,o)=>{o.d(t,{O:()=>p});var l=o(1936),i=o(84075),a=o(69962),r=o(22817),n=o(68876),d=o(53687),s=o(50879),m=o(50644),c=o(65185),u=o(65893);function p(){const e=(0,n.rD)(),t=(0,s.L)(),o=(0,a.d4)(r.yN),{projectId:p}=(0,i.g)(),g=void 0!==(null===o||void 0===o?void 0:o.id)?String(o.id):p||"",h=(0,c.ml)(u.AZ.FILE_PROXY_EVENT_ID),b=(0,c.ml)(u.AZ.PROXY_URL_EVENT_ID),f=(0,l.useCallback)(async e=>{const t=await b.fire({url:e,project:g});return(0,m.RU)(t,e)},[g,b]);return(0,l.useCallback)(async(o,l)=>{const i=(0,m.Xb)(await h.fire({url:o,project:g}));if(i)return i;const a=await f(o);if(null!==l&&void 0!==l&&l.aborted)throw new DOMException("Aborted","AbortError");const r=l?{signal:l}:void 0,n=a&&a!==o?await fetch(a,r):await(0,d.Be)(o,{config:e,standalone:t,intent:"downloadBlob",validateBlob:async e=>!e.type||e.type.startsWith("image/"),init:r});if(!n.ok)throw new Error(`Server returned ${n.status}`);return n.blob()},[e,g,t,h,f])}},3132:(e,t,o)=>{o.d(t,{C6:()=>r,rv:()=>a,sj:()=>i});var l=o(1936);const i=({planName:e,availableUntilLabel:t,dateDisplay:o,remainingLabel:i,daysRemaining:a,daysUnit:r})=>l.createElement("div",{className:"billing-banner-modal__banner-inner"},l.createElement("div",{className:"billing-banner-modal__plan-col"},l.createElement("p",{className:"billing-banner-modal__plan-name"},e),l.createElement("div",{className:"billing-banner-modal__date-row"},l.createElement("span",{className:"billing-banner-modal__date-label"},t),l.createElement("span",{className:"billing-banner-modal__date-value"},o))),l.createElement("div",{className:"billing-banner-modal__plan-col"},l.createElement("p",{className:"billing-banner-modal__remaining-label"},i),l.createElement("div",{className:"billing-banner-modal__remaining-row"},l.createElement("span",{className:"billing-banner-modal__days-number"},a),l.createElement("span",{className:"billing-banner-modal__days-unit"},r)))),a=({icon:e,current:t,total:o,ofLabel:i})=>l.createElement("div",{className:"billing-banner-modal__banner-inner billing-banner-modal__banner-inner--center"},l.createElement("div",{className:"billing-banner-modal__icon-circle","aria-hidden":!0},e),l.createElement("div",{className:"billing-banner-modal__ai-metric-row","aria-label":`${t} ${i} ${o}`},l.createElement("span",{className:"billing-banner-modal__ai-metric-num"},t),l.createElement("span",{className:"billing-banner-modal__ai-metric-of"},i),l.createElement("span",{className:"billing-banner-modal__ai-metric-num"},o))),r=({icon:e,amount:t})=>l.createElement("div",{className:"billing-banner-modal__package-row"},l.createElement("span",{className:"billing-banner-modal__package-plus-sign","aria-hidden":!0},"+"),l.createElement("span",{className:"billing-banner-modal__package-amount"},t),l.createElement("div",{className:"billing-banner-modal__icon-circle billing-banner-modal__icon-circle--package","aria-hidden":!0},e))},46018:(e,t,o)=>{o.d(t,{rG:()=>s});var l=o(1936),i=o(51114),a=o(59878),r=o(11930),n=o(96040),d=o(47706);o(3132);const s=({open:e,onClose:t,title:o,subtitle:s,bannerTone:m,bannerVariant:c="default",bannerContent:u,showAutopayButton:p,onEnableAutopay:g,autopayLoading:h=!1,autopayLabel:b,payAction:f})=>{const{__:v}=(0,d.s9)(),_=null!==b&&void 0!==b?b:v("Enable auto-payment"),E=p||!!f,S=!!f&&p,y=["billing-banner-modal__footer",S&&"billing-banner-modal__footer--dual",!S&&f&&"billing-banner-modal__footer--pay-single",!S&&p&&"billing-banner-modal__footer--single",!S&&p&&"packageBonus"===c&&"billing-banner-modal__footer--package-single"].filter(Boolean).join(" ");return l.createElement(i.A,{open:e,onCancel:t,footer:null,closable:!1,width:400,centered:!0,className:"billing-banner-modal",destroyOnClose:!0,maskClosable:!0},l.createElement("div",{className:"billing-banner-modal__wrap"},l.createElement("div",{className:"billing-banner-modal__header"},l.createElement("button",{type:"button",className:"billing-banner-modal__close",onClick:t,"aria-label":v("Close")},l.createElement(r.A,null))),l.createElement("div",{className:"billing-banner-modal__body"},l.createElement("h1",{className:"billing-banner-modal__title"},o),l.createElement("p",{className:"billing-banner-modal__subtitle"},s),l.createElement("div",{className:["billing-banner-modal__banner",`billing-banner-modal__banner--${m}`,"packageBonus"===c?"billing-banner-modal__banner--package-bonus":"","aiUsageCenter"===c?"billing-banner-modal__banner--ai-usage-center":""].filter(Boolean).join(" "),role:"region","aria-label":v("Subscription summary")},u)),E?l.createElement("hr",{className:"billing-banner-modal__divider"}):null,E?l.createElement("div",{className:y},S?l.createElement(l.Fragment,null,l.createElement(a.Ay,{className:"billing-banner-modal__btn-autopay",icon:l.createElement(n.Ay,{icon:"AutoRenewal"}),onClick:g,loading:h,disabled:!g},_),l.createElement(a.Ay,{type:"primary",className:"billing-banner-modal__btn-pay",onClick:f.onClick},f.label)):f?l.createElement(a.Ay,{type:"primary",className:"billing-banner-modal__btn-pay",onClick:f.onClick},f.label):p&&l.createElement(a.Ay,{className:"billing-banner-modal__btn-autopay",icon:l.createElement(n.Ay,{icon:"AutoRenewal"}),onClick:g,loading:h,disabled:!g},_)):null))}},88745:(e,t,o)=>{o(1936),o(47706),o(54729)},10641:(e,t,o)=>{o.d(t,{p:()=>y});var l=o(1936),i=o(41387),a=o(59878),r=o(51114),n=o(236),d=o(1637),s=o(35764),m=o(11930),c=o(47706),u=o(96040),p=o(51826),g=o(69962),h=o(51432),b=o(57701),f=o(2527),v=o(93506),_=o(93953),E=o(85660);var S=o(46939);const y=({open:e,onClose:t,limitType:o,subtitle:y,units:w,priceRub:k,userEmail:B,onInvoiceForLegal:R})=>{const{__:x}=(0,c.s9)(),{payExtraPackage:T,gateway:I}=function(){const e=(0,g.wA)(),t=(0,f.p)(),[o]=(0,h.on)(),i="cloudpayment";return(0,l.useEffect)(()=>{if(i===_.XL.CLOUDPAYMENT&&"undefined"!==typeof window){if(document.querySelector('script[src*="cloudpayments"]'))return;const e=document.createElement("script");e.src="https://widget.cloudpayments.ru/bundles/cloudpayments.js",e.async=!0,document.body.appendChild(e)}},[i]),{payExtraPackage:(0,l.useCallback)(({limitType:l,packageAmount:a,priceRub:r,userEmail:n,descriptionLabel:d,onSuccess:s,onFail:m})=>{if(i!==_.XL.CLOUDPAYMENT)return void(null===m||void 0===m||m("gateway"));const c=t.get(v.A9.em_token),u=window.cp;if(null===u||void 0===u||!u.CloudPayments)return void(null===m||void 0===m||m("widget"));const p=new u.CloudPayments,g=`${d}: +${a}`,h={Items:[{label:g,price:r,quantity:1,amount:r,vat:0}],calculationPlace:"https://emailmaker.ru",taxationSystem:1,email:n,amounts:{electronic:r}};p.pay("charge",{publicId:"pk_e8c7c303759283dc35cf4ad7b396c",description:g,amount:r,currency:(0,E.Wk)(),accountId:n,email:n,data:{CloudPayments:{CustomerReceipt:h,token:c,product:"extra_limit_package",package_type:l,package_amount:a}}},{onComplete:t=>{null!==t&&void 0!==t&&t.success&&setTimeout(()=>{e(b.B3.util.invalidateTags(["LimitsStats","LimitsWarnings"])),o(void 0),null===s||void 0===s||s();try{window.dispatchEvent(new CustomEvent("em-billing-extra-package-success",{detail:{amount:a}}))}catch{}},2e3)}})},[t,e,i,o]),gateway:i}}(),A=(0,l.useCallback)(()=>{!o||w<=0||(I===_.XL.CLOUDPAYMENT?T({limitType:o,packageAmount:w,priceRub:k,userEmail:B,descriptionLabel:`${x("Extra limit package")}: ${y} ${w} ${x("units")} \u2014 ${(0,E.ku)(k)}`,onSuccess:()=>{i.Ay.success(x("Payment was successful. Limits will update in a few seconds.")),t()},onFail:e=>{"gateway"===e?i.Ay.warning(x("Extra packages are only available with CloudPayments at the moment.")):"widget"===e&&i.Ay.error(x("The payment widget failed to load. Refresh the page and try again."))}}):i.Ay.warning(x("Extra packages are only available with CloudPayments at the moment.")))},[x,I,o,t,T,k,y,w,B]),C=(0,l.useCallback)(()=>{null===R||void 0===R||R()},[R]),N=I!==_.XL.CLOUDPAYMENT,P=o?p.w[o]:"AIRequests",L=!(0,E.EP)(),F=l.createElement(a.Ay,{type:"primary",className:"extra-limit-package-modal__pay-btn extra-limit-package-modal__pay-btn--card",disabled:N,icon:l.createElement(d.A,null),onClick:A},x("By card")," "),O=l.createElement(a.Ay,{className:"extra-limit-package-modal__pay-btn extra-limit-package-modal__pay-btn--invoice",disabled:!R,icon:l.createElement(s.A,null),onClick:C},x("Invoice for legal entity")," "),V=e&&!!o&&w>0;return l.createElement(r.A,{open:V,onCancel:t,footer:null,closable:!1,width:400,centered:!0,className:"extra-limit-package-modal",destroyOnClose:!0,maskClosable:!0},l.createElement("div",{className:"extra-limit-package-modal__wrap"},l.createElement("div",{className:"extra-limit-package-modal__header"},l.createElement("button",{type:"button",className:"extra-limit-package-modal__close",onClick:t,"aria-label":x("Close")},l.createElement(m.A,null))),l.createElement("div",{className:"extra-limit-package-modal__body"},l.createElement("h1",{className:"extra-limit-package-modal__title"},x("Payment"))," ",y?l.createElement("p",{className:"extra-limit-package-modal__subtitle"},y):null,l.createElement("div",{className:"extra-limit-package-modal__package-banner"},l.createElement("div",{className:"extra-limit-package-modal__package-content"},l.createElement("span",{className:"extra-limit-package-modal__package-plus","aria-hidden":!0},"+"),l.createElement("span",{className:"extra-limit-package-modal__package-amount"},w),l.createElement("div",{className:"extra-limit-package-modal__package-icon","aria-hidden":!0},l.createElement(u.Ay,{icon:P}))))),l.createElement("hr",{className:"extra-limit-package-modal__divider"}),l.createElement("div",{className:"extra-limit-package-modal__footer"},l.createElement("p",{className:"extra-limit-package-modal__payment-label"},x("Choose a payment method"))," ",l.createElement("div",{className:"extra-limit-package-modal__payment-buttons"},N?l.createElement(n.A,{title:x("Not available for the current payment settings")},l.createElement("span",{className:"extra-limit-package-modal__pay-btn-wrap extra-limit-package-modal__pay-btn-wrap--card"},F)):l.createElement("span",{className:"extra-limit-package-modal__pay-btn-wrap extra-limit-package-modal__pay-btn-wrap--card"},F),L?R?l.createElement("span",{className:"extra-limit-package-modal__pay-btn-wrap extra-limit-package-modal__pay-btn-wrap--invoice"},O):l.createElement(n.A,{title:x("Not available in this context")},l.createElement("span",{className:"extra-limit-package-modal__pay-btn-wrap extra-limit-package-modal__pay-btn-wrap--invoice"},O)):null),l.createElement("div",{className:"extra-limit-package-modal__card-logos"},l.createElement(S.v,null)))))}},54729:(e,t,o)=>{o.d(t,{X:()=>u});var l=o(1936),i=o(51114),a=o(59878),r=o(11930),n=o(52041),d=o(47706),s=o(96040),m=o(51826);function c(e,t){if(null===e||void 0===e)return null;if("number"===typeof e||"string"===typeof e){const o="\u221e"===e||"\u221e"===e||"infinity"===e||"string"===typeof e&&"infinity"===e.toLowerCase(),i="old"===t?"limit-upgrade-modal__limit-old":"limit-upgrade-modal__limit-new"+(o?" limit-upgrade-modal__limit-new--infinity":"");return l.createElement("span",{className:i},o?"\u221e":e)}return e}const u=({open:e,onClose:t,title:o,subtitle:u,usageResource:p,icon:g,previousDisplay:h,nextDisplay:b,onChangePlan:f,secondaryAction:v,changePlanLabel:_})=>{const{__:E}=(0,d.s9)(),S=null!==_&&void 0!==_?_:E("Change plan"),y=!!v,w=null!=p?l.createElement(s.Ay,{icon:m.w[p]}):null!==g&&void 0!==g?g:null;return l.createElement(i.A,{open:e,onCancel:t,footer:null,closable:!1,width:400,centered:!0,className:"limit-upgrade-modal",destroyOnClose:!0,maskClosable:!0},l.createElement("div",{className:"limit-upgrade-modal__wrap"},l.createElement("div",{className:"limit-upgrade-modal__header"},l.createElement("button",{type:"button",className:"limit-upgrade-modal__close",onClick:t,"aria-label":E("Close")},l.createElement(r.A,null))),l.createElement("div",{className:"limit-upgrade-modal__body"},l.createElement("h1",{className:"limit-upgrade-modal__title"},o),l.createElement("p",{className:"limit-upgrade-modal__subtitle"},u),l.createElement("div",{className:"limit-upgrade-modal__limits-row"},l.createElement("div",{className:"limit-upgrade-modal__icon-circle","aria-hidden":!0},w),c(h,"old"),l.createElement("div",{className:"limit-upgrade-modal__arrow-btn","aria-hidden":!0},l.createElement(n.A,{className:"limit-upgrade-modal__arrow-icon"})),c(b,"new"))),l.createElement("hr",{className:"limit-upgrade-modal__divider"}),l.createElement("div",{className:y?"limit-upgrade-modal__footer limit-upgrade-modal__footer--dual":"limit-upgrade-modal__footer"},v?l.createElement(l.Fragment,null,l.createElement(a.Ay,{className:"limit-upgrade-modal__cta-secondary",onClick:v.onClick},v.label),l.createElement(a.Ay,{type:"primary",className:"limit-upgrade-modal__cta",onClick:f},S)):l.createElement(a.Ay,{type:"primary",className:"limit-upgrade-modal__cta",onClick:f},S))))}},46939:(e,t,o)=>{o.d(t,{v:()=>d});var l=o(1936),i=o(78232),a=o(84395),r=o(58092),n=o(12718);const d=()=>l.createElement("div",{className:"payment-card-logos-row"},l.createElement("img",{src:r,alt:"",className:"payment-card-logos-row__img payment-card-logos-row__img--mir",decoding:"async"}),l.createElement("img",{src:n,alt:"",className:"payment-card-logos-row__img payment-card-logos-row__img--sbp",decoding:"async"}),l.createElement("img",{src:i,alt:"",className:"payment-card-logos-row__img payment-card-logos-row__img--visa",decoding:"async"}),l.createElement("img",{src:a,alt:"",className:"payment-card-logos-row__img payment-card-logos-row__img--mastercard",decoding:"async"}))},31206:(e,t,o)=>{o.d(t,{Q:()=>g});var l=o(1936),i=o(59878),a=o(51114),r=o(236),n=o(1637),d=o(35764),s=o(11930),m=o(96526),c=o(47706),u=o(46939),p=o(85660);const g=({open:e,onClose:t,planShortName:o,featureLines:g,canPayWithCard:h,onPayByCard:b,onInvoiceForLegal:f})=>{const{__:v,sprintf:_}=(0,c.s9)(),E=(0,l.useCallback)(()=>{b()},[b]),S=(0,l.useCallback)(()=>{f()},[f]),y=_(v("%s plan"),o),w=!(0,p.EP)(),k=l.createElement(i.Ay,{type:"primary",className:"plan-checkout-choice-modal__pay-btn plan-checkout-choice-modal__pay-btn--primary",disabled:!h,onClick:E,icon:l.createElement(n.A,null)},v("By card")," "),B=l.createElement(i.Ay,{className:"plan-checkout-choice-modal__pay-btn plan-checkout-choice-modal__pay-btn--outline",onClick:S,icon:l.createElement(d.A,null)},v("Invoice for legal entity")," "),R=h?"":v(w?"Card payment is not available for this change. Use an invoice for a legal entity.":"Card payment is not available for this change.");return l.createElement(a.A,{open:e,onCancel:t,footer:null,closable:!1,width:400,centered:!0,className:"plan-checkout-choice-modal",destroyOnClose:!0,maskClosable:!0},l.createElement("div",{className:"plan-checkout-choice-modal__wrap"},l.createElement("div",{className:"plan-checkout-choice-modal__header"},l.createElement("button",{type:"button",className:"plan-checkout-choice-modal__close",onClick:t,"aria-label":v("Close")},l.createElement(s.A,null))),l.createElement("div",{className:"plan-checkout-choice-modal__body"},l.createElement("h1",{className:"plan-checkout-choice-modal__title"},v("Payment"))," ",l.createElement("p",{className:"plan-checkout-choice-modal__subtitle"},v("You are paying for the plan:"))," ",l.createElement("div",{className:"plan-checkout-choice-modal__plan-card"},l.createElement("p",{className:"plan-checkout-choice-modal__plan-name"},y),g.length>0?l.createElement("ul",{className:"plan-checkout-choice-modal__feature-list"},g.map((e,t)=>l.createElement("li",{key:t,className:"plan-checkout-choice-modal__feature-item"},l.createElement("span",{className:"plan-checkout-choice-modal__feature-check","aria-hidden":!0},l.createElement(m.A,{className:"plan-checkout-choice-modal__feature-check-icon"})),l.createElement("span",{className:"plan-checkout-choice-modal__feature-text"},e)))):null)),l.createElement("hr",{className:"plan-checkout-choice-modal__divider"}),l.createElement("div",{className:"plan-checkout-choice-modal__footer"},l.createElement("p",{className:"plan-checkout-choice-modal__payment-label"},v("Choose a payment method"))," ",l.createElement("div",{className:"plan-checkout-choice-modal__payment-buttons"},h?l.createElement("span",{className:"plan-checkout-choice-modal__pay-btn-wrap plan-checkout-choice-modal__pay-btn-wrap--card"},k):l.createElement(r.A,{title:R},l.createElement("span",{className:"plan-checkout-choice-modal__pay-btn-wrap plan-checkout-choice-modal__pay-btn-wrap--card"},k)),w?l.createElement("span",{className:"plan-checkout-choice-modal__pay-btn-wrap plan-checkout-choice-modal__pay-btn-wrap--invoice"},B):null),l.createElement(u.v,null))))}},24808:(e,t,o)=>{o.d(t,{O:()=>_});var l=o(1936),i=o(92416),a=o(51114),r=o(59878),n=o(92927),d=o(14516),s=o(7494),m=o(5464),c=o(47706),u=o(41244),p=o(6403),g=o(64582);function h(e){return e.replace(/\D/g,"")}function b(e,t){return{validator:(o,l)=>{const i=h(l||"");return i?i.length!==e?Promise.reject(new Error(t)):Promise.resolve():Promise.reject(new Error(t))}}}function f(e){return{validator:(t,o)=>{const l=h(o||"");return l?13!==l.length&&15!==l.length?Promise.reject(new Error(e)):Promise.resolve():Promise.reject(new Error(e))}}}const v="invoice_legal_company_full",_=({open:e,onClose:t,requestTariff:o,userEmail:_,userName:E,currentPlane:S})=>{const{__:y}=(0,c.s9)(),[w]=i.A.useForm(),k=(0,p.hN)(),[B,R]=(0,g.Nd)(),x=(0,l.useRef)({userEmail:_,userName:E,currentPlane:S,requestTariff:o});x.current={userEmail:_,userName:E,currentPlane:S,requestTariff:o};const T=(0,l.useCallback)(()=>{const e=x.current;w.setFieldsValue({request_type:"tariff_invoice_request",account_email:e.userEmail,request_email:e.userEmail,request_phone:"",user_name:e.userName,user_tariff:e.currentPlane,request_tariff:e.requestTariff,[v]:"",company_short_name:"",inn:"",kpp:"",ogrn:"",legal_address:"",postal_address:"",bank_name:"",bank_account:"",correspondent_account:"",bik:"",contact_full_name:"",payment_basis:void 0,contract_number:"",contract_date:"",vat_type:void 0,comment:""})},[w]);(0,l.useEffect)(()=>{e&&T()},[e,T]);const I=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(!e)return void(I.current=null);const t=`${E}\0${S}\0${o}`;null!==I.current?I.current!==t&&(I.current=t,w.setFieldsValue({user_name:E,user_tariff:S,request_tariff:o})):I.current=t},[e,w,E,S,o]),(0,l.useEffect)(()=>{if(!e||!_)return;w.setFieldValue("account_email",_);const t=w.getFieldValue("request_email");null!=t&&""!==String(t).trim()||w.setFieldValue("request_email",_)},[e,w,_]);const A=(0,l.useMemo)(()=>({required:!0,message:y("This field is required")}),[y]),C=(0,l.useCallback)(()=>{w.validateFields().then(()=>{var e;const o=w.getFieldsValue(!0),l={...o,company_full_name:null!==(e=o[v])&&void 0!==e?e:""};delete l[v],B(l).then(e=>{var o;const l=null===e||void 0===e?void 0:e.data,i="string"===typeof l&&"request accepted"===l.trim().toLowerCase(),a="object"===typeof l?null===l||void 0===l||null===(o=l.data)||void 0===o?void 0:o.status:void 0,r="object"===typeof l?null===l||void 0===l?void 0:l.status:void 0;if(i||200===a||200===r)return k.success("object"===typeof l?null===l||void 0===l?void 0:l.message:y("Request sent successfully.")),void t();e.error?k.error(e):k.warning({message:y("Something went wrong."),description:y("The server returned an unexpected response. Please try again or contact support.")})})}).catch(e=>{var t,o;const l=null===e||void 0===e||null===(t=e.errorFields)||void 0===t||null===(o=t[0])||void 0===o?void 0:o.name,i=()=>{void 0!==l&&w.scrollToField(l,{behavior:"smooth",block:"center"});const e=document.querySelector(".tariff-invoice-request-modal"),t=null===e||void 0===e?void 0:e.querySelector(".ant-form-item-has-error");null===t||void 0===t||t.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})};requestAnimationFrame(()=>{requestAnimationFrame(i)})})},[w,B,k,t,y]);return l.createElement(a.A,{title:y("Invoice request for a legal entity"),className:"blocks-modal tariff-invoice-request-modal",open:e,afterOpenChange:e=>{e||w.resetFields()},onCancel:t,centered:!0,width:820,footer:[l.createElement(r.Ay,{key:"cancel",size:"large",onClick:t},y("Cancel")," "),l.createElement(r.Ay,{key:"submit",type:"primary",size:"large",onClick:C,loading:R.isLoading},y("Send")," ")],destroyOnClose:!0},l.createElement(i.A,{form:w,layout:"vertical",name:"tariff_invoice_request_form",autoComplete:"off",scrollToFirstError:{behavior:"smooth",block:"center"}},l.createElement(i.A.Item,{label:y("Full legal company name"),name:v,rules:[A]},l.createElement(n.A,{size:"large",placeholder:y('LLC "Example"'),autoComplete:"off"})),l.createElement(i.A.Item,{label:y("Short company name"),name:"company_short_name"}," ",l.createElement(n.A,{size:"large",placeholder:y('LLC "Example"')})),l.createElement(d.A,{gutter:16},l.createElement(s.A,{xs:24,md:12},l.createElement(i.A.Item,{label:y("TIN (INN)"),name:"inn",rules:[A,(N=y("TIN (INN) must be 10 or 12 digits"),{validator:(e,t)=>{const o=h(t||"");return o?10!==o.length&&12!==o.length?Promise.reject(new Error(N)):Promise.resolve():Promise.reject(new Error(N))}})]},l.createElement(n.A,{size:"large",placeholder:"7701234567",inputMode:"numeric"}))),l.createElement(s.A,{xs:24,md:12},l.createElement(i.A.Item,{label:y("KPP"),name:"kpp",rules:[A,b(9,y("KPP must be 9 digits"))]},l.createElement(n.A,{size:"large",placeholder:"770101001",inputMode:"numeric"})))),l.createElement(i.A.Item,{label:y("OGRN / PSRN"),name:"ogrn",rules:[A,f(y("OGRN/PSRN must be 13 or 15 digits"))]},l.createElement(n.A,{size:"large",placeholder:"1027700123456",inputMode:"numeric"})),l.createElement(i.A.Item,{label:y("Legal address"),name:"legal_address",rules:[A]},l.createElement(n.A.TextArea,{placeholder:y("123456, City, 1 Example St."),autoSize:{minRows:2,maxRows:4}})),l.createElement(i.A.Item,{label:y("Mailing address"),name:"postal_address"}," ",l.createElement(n.A.TextArea,{placeholder:y("If different from the legal address"),autoSize:{minRows:2,maxRows:4}})),l.createElement(i.A.Item,{label:y("Bank name"),name:"bank_name",rules:[A]},l.createElement(n.A,{size:"large",placeholder:y("PJSC Sberbank")})),l.createElement(d.A,{gutter:16},l.createElement(s.A,{xs:24,md:12},l.createElement(i.A.Item,{label:y("Bank account (RUB)"),name:"bank_account",rules:[A,b(20,y("The account number must be 20 digits"))]},l.createElement(n.A,{size:"large",placeholder:"40702810XXXXXXXXXXX",inputMode:"numeric"}))),l.createElement(s.A,{xs:24,md:12},l.createElement(i.A.Item,{label:y("Correspondent account"),name:"correspondent_account",rules:[A,b(20,y("The account number must be 20 digits"))]},l.createElement(n.A,{size:"large",placeholder:"30101810XXXXXXXXXXX",inputMode:"numeric"})))),l.createElement(i.A.Item,{label:y("BIK (bank ID)"),name:"bik",rules:[A,b(9,y("BIK must be 9 digits"))]},l.createElement(n.A,{size:"large",placeholder:"044525225",inputMode:"numeric"})),l.createElement(i.A.Item,{label:y("Contact person (full name)"),name:"contact_full_name",rules:[A]},l.createElement(n.A,{size:"large",placeholder:y("Ivan Ivanov")})),l.createElement(d.A,{gutter:16},l.createElement(s.A,{xs:24,md:12},l.createElement(i.A.Item,{label:y("Phone number"),name:"request_phone",rules:[A]},l.createElement(n.A,{size:"large",placeholder:"+7 999 123-45-67"}))),l.createElement(s.A,{xs:24,md:12},l.createElement(i.A.Item,{label:y("Email"),name:"request_email",rules:[A,{validator:(e,t)=>u.au.test(t)?Promise.resolve():Promise.reject(new Error(y("Please enter a valid email address.")))}]},l.createElement(n.A,{size:"large",placeholder:"example@mail.ru",type:"email"})))),l.createElement(i.A.Item,{label:y("Payment basis"),name:"payment_basis",rules:[A]},l.createElement(m.A,{size:"large",placeholder:y("Contract / invoice / public offer"),options:[{value:"contract",label:y("Contract")},{value:"invoice",label:y("Invoice")},{value:"offer",label:y("Public offer")}]})),l.createElement(d.A,{gutter:16},l.createElement(s.A,{xs:24,md:12},l.createElement(i.A.Item,{label:y("Contract number"),name:"contract_number"},l.createElement(n.A,{size:"large",placeholder:"\u2116123"}))),l.createElement(s.A,{xs:24,md:12},l.createElement(i.A.Item,{label:y("Contract date"),name:"contract_date"},l.createElement(n.A,{size:"large",placeholder:"01.01.2026"})))),l.createElement(i.A.Item,{label:y("VAT"),name:"vat_type",rules:[A]},l.createElement(m.A,{size:"large",placeholder:y("With VAT / without VAT"),options:[{value:"with_vat",label:y("With VAT")},{value:"without_vat",label:y("Without VAT")}]})),l.createElement(i.A.Item,{label:y("Comment"),name:"comment"},l.createElement(n.A.TextArea,{placeholder:y("Any additional details"),autoSize:{minRows:2,maxRows:6}})),l.createElement(i.A.Item,{name:"request_type",hidden:!0},l.createElement(n.A,{type:"hidden"})),l.createElement(i.A.Item,{name:"account_email",hidden:!0},l.createElement(n.A,{type:"hidden"})),l.createElement(i.A.Item,{name:"user_name",hidden:!0},l.createElement(n.A,{type:"hidden"})),l.createElement(i.A.Item,{name:"user_tariff",hidden:!0},l.createElement(n.A,{type:"hidden"})),l.createElement(i.A.Item,{name:"request_tariff",hidden:!0},l.createElement(n.A,{type:"hidden"}))));var N}},62669:(e,t,o)=>{o(1936),o(47706)},24671:(e,t,o)=>{o.d(t,{h:()=>d});var l=o(1936),i=o(96040),a=o(51826),r=o(3132);const n=a.w.ai;function d(e,{__:t,_n:o},a){switch(e){case"plan_expiring":case"plan_activated":return a.plan?l.createElement(r.sj,{planName:a.plan.planName,availableUntilLabel:t("Available until:"),dateDisplay:a.plan.subscriptionEndDisplay,remainingLabel:t("Remaining:"),daysRemaining:a.plan.daysRemaining,daysUnit:o("day","days",a.plan.daysRemaining)}):null;case"ai_low":return a.ai?l.createElement(r.rv,{icon:l.createElement(i.Ay,{icon:n}),current:a.ai.current,total:a.ai.total,ofLabel:t("of")}):null;case"package_activated":{var d;const e=null!==(d=a.packageAmount)&&void 0!==d?d:0;return l.createElement(r.C6,{icon:l.createElement(i.Ay,{icon:n}),amount:e})}default:return null}}},39601:(e,t,o)=>{o.d(t,{X$:()=>s,Yc:()=>m,jO:()=>l,l:()=>d,lu:()=>c,rn:()=>r,w5:()=>i});const l=7,i=80,a="em_billing_modal_v1_",r="em_stripe_billing_checkout_pending",n=`${a}period_sig`,d={bannerPlanExpiring:`${a}banner_plan_expiring`,bannerAiLow:`${a}banner_ai_low`,bannerPlanActivated:`${a}banner_plan_activated`,bannerPackageActivated:`${a}banner_package_activated`,limitUpgradeEmail:`${a}limit_upgrade_email`,limitUpgradeAi:`${a}limit_upgrade_ai`,limitUpgradeOptimization:`${a}limit_upgrade_optimization`,limitUpgradeImageGenerate:`${a}limit_upgrade_image_generate`,limitUpgradePreview:`${a}limit_upgrade_preview`,limitUpgradeLinkCheck:`${a}limit_upgrade_link_check`,limitUpgradeImageCheck:`${a}limit_upgrade_image_check`,limitUpgradeSpamCheck:`${a}limit_upgrade_spam_check`};function s(e){try{return"1"===sessionStorage.getItem(e)}catch{return!1}}function m(e){try{sessionStorage.setItem(e,"1")}catch{}}function c(e,t,o){if(null==e||""===e)return;const l=`${e}|${null!==t&&void 0!==t?t:""}|${null!==o&&void 0!==o?o:""}`;try{sessionStorage.getItem(n)!==l&&(!function(){try{for(let e=sessionStorage.length-1;e>=0;e--){const t=sessionStorage.key(e);null!==t&&void 0!==t&&t.startsWith(a)&&t!==n&&sessionStorage.removeItem(t)}}catch{}}(),sessionStorage.setItem(n,l))}catch{}}},51826:(e,t,o)=>{o.d(t,{w:()=>l});const l={ai:"AIRequests",email_generate:"EmailEnvelope",image_generate:"Image",optimization:"Optimization",preview:"SendOutlined",link_check:"Web",image_check:"Image",spam_check:"Block",projects:"FolderOpen",emails:"EmailEnvelope",blocks:"Block",users:"SliderGroup"}},95380:(e,t,o)=>{o.d(t,{y:()=>a});var l=o(1936),i=o(93953);const a=e=>{const{period:t,gateway:o,subscriptionsList:a}=e,r=(0,l.useMemo)(()=>(0,i.w6)(o,t),[o,t]),n=(0,l.useMemo)(()=>a&&0!==a.length?r.map(e=>a.find(t=>t.id===e)).filter(e=>void 0!==e):[],[r,a]),d=(0,l.useMemo)(()=>n[0],[n]),s=(0,l.useMemo)(()=>n.slice(1),[n]);return{planIds:r,pricingCards:n,freePlan:d,paidPlans:s}}},95340:(e,t,o)=>{o.d(t,{m:()=>m});var l=o(1936),i=o(69962),a=o(89600),r=o(6403),n=o(47706),d=o(93953);const s={discount:null,promocode:null,expiration:null,is_for_year:!1,is_for_month:!1,is_for_hard_pay:!1,is_only_first_period:!1},m=()=>{const{__:e}=(0,n.s9)(),t=(0,i.wA)(),o=(0,r.hN)(),[m,c]=(0,l.useState)(s),[u,p]=(0,l.useState)(!1),g=(0,l.useCallback)(async(l,i="self",r)=>{let n=null;if(c(e=>(n=e.promocode,e)),n!==l){p(!0);try{var s,m;const n=await t(a.So.endpoints.checkPromo.initiate({code:l,type:i}));if(n.error)throw n.error;if(200!==(null===(s=n.data)||void 0===s||null===(m=s.data)||void 0===m?void 0:m.status))throw{error:{data:n.data}};if(l){var u,g;const i=await t(a.So.endpoints.getPromoInfo.initiate({code:l}));if(i.error||null!==(u=i.data)&&void 0!==u&&null!==(g=u.data)&&void 0!==g&&g.status&&200!==i.data.data.status)return void o.error(i.data);if(i.data){const t={...i.data},l=new Date(i.data.expiration),a=new Date;var h;if(t.promocode=i.data.promocode.toUpperCase(),l>a)c(t),r&&(t.is_for_month?r(d.h2.MONTHLY):t.is_for_year&&r(d.h2.EARLY)),null!==(h=i.data)&&void 0!==h&&h.message?o.success(i.data.message):o.success({message:e("Promo code applied.")})}else c(e=>({...e,promocode:""}))}}catch(b){o.error(b)}finally{p(!1)}}else o.error({message:e("This promo code is already applied."),description:" "})},[t,o,e]),h=(0,l.useCallback)(()=>{c(s)},[]);return{promoState:m,isLoading:u,applyPromoCode:g,clearPromoCode:h,hasCurrentPayPeriodInActiveTab:e=>e===d.h2.MONTHLY&&m.is_for_month||e===d.h2.EARLY&&m.is_for_year}}},11494:(e,t,o)=>{o.d(t,{C:()=>s});var l=o(1936),i=o(68726),a=o(65098),r=o(51432),n=o(6403),d=o(47706);const s=e=>{const{subscriptionId:t,userId:o,recurringPayments:s}=e,{__:m}=(0,d.s9)(),c=(0,n.hN)(),[u]=(0,i.IJ)(),[p]=(0,a.Cl)(),[g]=(0,r.on)(),[h,b]=(0,l.useState)(s),[f,v]=(0,l.useState)(!1);(0,l.useEffect)(()=>{b(s)},[s]);return{isEnabled:h,isLoading:f,enableRecurring:(0,l.useCallback)(async()=>{if(!t)return void c.error({message:m("Subscription ID is missing"),description:m("Cannot enable recurring payments")});v(!0);const e={sid:t,uid:o};try{var l,i;const t=await u(e);if(t.isSuccess&&200===(null===t||void 0===t||null===(l=t.data)||void 0===l||null===(i=l.data)||void 0===i?void 0:i.status)){b(!0);var a;if((await g(void 0)).data)c.success((null===t||void 0===t||null===(a=t.data)||void 0===a?void 0:a.message)||{message:m("Recurring payments enabled")})}else b(!1),c.error(t)}catch(r){b(!1),c.error(r)}finally{v(!1)}},[m,t,o,u,g,c]),disableRecurring:(0,l.useCallback)(async()=>{if(!t)return void c.error({message:m("Subscription ID is missing"),description:m("Cannot disable recurring payments")});v(!0);const e={sid:t,uid:o};try{var l,i;const t=await p(e);if(t.isSuccess&&200===(null===t||void 0===t||null===(l=t.data)||void 0===l||null===(i=l.data)||void 0===i?void 0:i.status)){b(!1);var a;if((await g(void 0)).data)c.success((null===t||void 0===t||null===(a=t.data)||void 0===a?void 0:a.message)||{message:m("Recurring payments disabled")})}else b(!0),c.error(t)}catch(r){b(!0),c.error(r)}finally{v(!1)}},[m,t,o,p,g,c])}}},90408:(e,t,o)=>{function l(e){const{currentBilling:t,pricingCards:o,enterprise_users_limit:l,enterprise_price:i,enterprise_12_price:a}=e;if(null===t||void 0===t||!t.title)return null;const r=o.find(e=>e.title===t.title);if(!r)return null;const n=r.title,d=n.split(" ")[0],s=!(!l||!i||"Enterprise"!==n),m=!(!l||!a||"Enterprise 12"!==n),c=parseFloat(r.price)||s&&i||m&&a||0;return c||s||m?{title:n,currentItemTitle:d,price:c,isEnterpriseActivePrice:s||m}:null}o.d(t,{h:()=>l})},77596:(e,t,o)=>{function l(e,t,o){const{title:l,limits:{emails_limit:i,projects_limit:a,users_limit:r}}=e,n=l.split(" ")[0];let d=null,s=null;t.enterpriseUsersLimit&&t.enterprisePrice&&"Enterprise"===l&&(d=!0),t.enterpriseUsersLimit&&t.enterprise12Price&&"Enterprise 12"===l&&(s=!0);const m="Enterprise"===n&&!(!d&&!s)&&t.enterpriseUsersLimit?t.enterpriseUsersLimit:r||"\u221e";return[`${i||"\u221e"} ${o(" email"," emails",null!==i&&void 0!==i?i:0)}`,`${a||"\u221e"} ${o(" project"," projects",null!==a&&void 0!==a?a:0)}`,`${m} ${o(" member"," members",null!==r&&void 0!==r?r:0)}`]}o.d(t,{L:()=>l})},33653:(e,t,o)=>{function l(e,t){switch(e){case"ai":return t("You are buying a set of AI generation requests:");case"email_generate":return t("You are buying an extra email generation package:");case"image_generate":return t("You are buying an extra image generation package:");case"optimization":return t("You are buying an extra optimization package:");case"preview":return t("You are buying an extra preview/test sends package:");case"link_check":return t("You are buying an extra link check package:");case"image_check":return t("You are buying an extra image check package:");case"spam_check":return t("You are buying an extra spam check package:");case"users":case"emails":case"blocks":case"projects":return t("Extra package is not configured for this limit.");default:return e}}function i(e,t){switch(e){case"ai":return t("Buy generations");case"email_generate":case"image_generate":case"users":case"emails":case"blocks":case"projects":return t("Buy package");case"optimization":return t("Buy optimization package");case"preview":return t("Buy test sends package");case"link_check":return t("Buy link check package");case"image_check":return t("Buy image check package");case"spam_check":return t("Buy spam check package");default:return e}}o.d(t,{Q:()=>i,a:()=>l})},37444:(e,t,o)=>{o.d(t,{c0:()=>a,jq:()=>i,nx:()=>r});const l={ai:"ai_150_inf",email_generate:"email_300_inf",image_generate:"image_generate_exceeded",preview:"preview_exceeded",link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"};function i(e){return!(!e||e.is_unlimited||e.total_limit<=0)&&(e.remaining<=0||e.used>=e.total_limit)}function a(e,t){var o;return i(t)?{presetId:l[e],previousLimit:null!==(o=null===t||void 0===t?void 0:t.total_limit)&&void 0!==o?o:0,nextLimit:"infinity"}:null}function r(e,t){return a(e,t)}},46234:(e,t,o)=>{o.d(t,{nz:()=>u,r4:()=>p});var l=o(90741);const i=[10,30,300],a=[10,50,150];function r(e,t){for(const o of t)if(o>e)return o;return"infinity"}function n(e){return e<=10?"ai_10_50":e<=50?"ai_30_150":"ai_150_inf"}function d(e,t){return!(null===t||void 0===t||!t.limit_exceeded)||!e.is_unlimited&&(!(e.total_limit<=0)&&(e.remaining<=0||e.used>=e.total_limit))}const s=["optimization","image_generate","preview","link_check","image_check","spam_check"];const m={optimization:"optimization_exceeded",image_generate:"image_generate_exceeded",preview:"preview_exceeded",link_check:"link_check_exceeded",image_check:"image_check_exceeded",spam_check:"spam_check_exceeded"};function c(e,t,o){if(function(e){return s.includes(e)}(e))return null;const i=(0,l.o)(t,e),a=(0,l.$)(o,e);if(!i||!d(i,a))return null;const r=i.total_limit;return{kind:e,presetId:m[e],previousLimit:r,nextLimit:"infinity"}}function u(e,t){if(!e)return null;const o=(0,l.o)(e,"ai"),s=(0,l.$)(t,"ai");if(o&&d(o,s)){const e=o.total_limit;return{kind:"ai",presetId:n(e),previousLimit:e,nextLimit:r(e,a)}}const m=(0,l.o)(e,"email_generate"),u=(0,l.$)(t,"email_generate");if(m&&d(m,u)){const e=m.total_limit;return{kind:"email_generate",presetId:(p=e,p<=10?"email_10_30":p<=30?"email_30_300":"email_300_inf"),previousLimit:e,nextLimit:r(e,i)}}var p;const g=c("image_generate",e,t);if(g)return g;const h=c("optimization",e,t);if(h)return h;const b=c("preview",e,t);if(b)return b;const f=c("link_check",e,t);if(f)return f;const v=c("image_check",e,t);return v||c("spam_check",e,t)}function p(e){return{presetId:n(e),previousLimit:e,nextLimit:r(e,a)}}},90741:(e,t,o)=>{function l(e,t){if(e){if("preview"===t){var o;const t=e;return null!==(o=t.preview)&&void 0!==o?o:t.test_sends}return e[t]}}function i(e,t){if(null!==e&&void 0!==e&&e.flags){if("preview"===t){var o;const t=e.flags;return null!==(o=t.preview)&&void 0!==o?o:t.test_sends}return e.flags[t]}}o.d(t,{$:()=>i,o:()=>l})},52976:(e,t,o)=>{o.d(t,{A:()=>M});var l=o(1936),i=o(61578),a=o(69962),r=o(84075),n=o(88260),d=o(57549),s=o(67351),m=o(12650),c=o(79059),u=o(5134),p=o(66034),g=o(89591),h=o(51432),b=o(98173),f=o(38343),v=o(52898),_=o(40867),E=o(75354),S=o(74663),y=o(78443),w=o(61062),k=o(93506),B=o(7959),R=o(3875),x=o(15582),T=o(96040),I=o(47706),A=o(68876),C=o(7314),N=o(7714),P=o(2527),L=o(49591),F=o(14109),O=o(20387);const{Content:V}=d.Layout,M=()=>{var e;const{__:t}=(0,I.s9)(),{owner:o}=(0,B.A)(),M=(0,a.wA)(),D=(0,r.Zp)(),H=(0,C.fn)(),{modal:z}=d.qw.useApp(),W=(0,A.rD)(),U=(0,R.cR)(),$=(0,P.p)(),G=(0,N.QC)(),j=(0,C.aD)(H),{emailId:X,projectId:q,preview:Y}=(0,r.g)(),[K,Q]=(0,n.ok)(),J=(0,a.d4)(v.Hs),Z=(0,a.d4)(_.Fv),ee=(0,a.d4)(_.cL),te=(0,a.d4)(b.C1),oe=(0,a.d4)(w.YG),le=(0,a.d4)(_.oG),[ie]=(0,h.on)(),{isSuccess:ae,data:re}=(0,h.W5)(),[ne,de]=(0,l.useState)(!1),[se,me]=(0,l.useState)(!1),[ce,ue]=(0,l.useState)(),[pe,ge]=(0,l.useState)(!1),[he,be]=(0,l.useState)(!1),[fe,ve]=(0,l.useState)(!1),[_e,Ee]=(0,l.useState)(!1),[Se,ye]=(0,l.useState)(!1),we=(0,l.useRef)(),{confirm:ke}=z,{counters:Be,subscription:Re}=te,xe=null===Be||void 0===Be?void 0:Be.emails_counter,Te=$.get(k.A9.em_template_email),Ie=K.get("template")||!se&&!X&&$.get(k.A9.em_new_email);(0,l.useEffect)(()=>{!se&&J.id&&me(!0)},[me,se,J.id]);const{isSuccess:Ae,isLoading:Ce,isError:Ne,error:Pe,data:Le}=(0,g.sl)(Ie,{skip:!Ie||!!X}),Fe=Ie?Le:X?J:oe;(0,F.f)(Fe,void 0===X);const Oe=(0,L.r)(Fe),{isLoading:Ve,isSuccess:Me,isError:De,error:He}=(0,g.sl)(X,{skip:!X}),ze=Ie?Pe:He,We=Ie?Ne:De,Ue=Ie?Ce:Ve,$e=Ie?Ae:Me;(0,l.useEffect)(()=>{Ie&&Ae&&(M((0,w.MZ)(Le)),me(!0),Q({}))},[Ie,Ae,M,Le,Te,Q]),(0,l.useEffect)(()=>(M((0,_.mi)(!0)),()=>M((0,_.mi)(!0))),[M]);const Ge=(0,l.useCallback)(()=>{M((0,_.vs)()),M((0,f.rI)())},[M]);(0,l.useEffect)(()=>{Y&&!Z&&Ge()},[Z,Y,Ge]),(0,l.useEffect)(()=>{M((0,E.ff)()),document.body.classList.add("editor"),M((0,_.PM)(k.Bv))},[M]),(0,l.useEffect)(()=>{!ne&&xe<3&&(ie(),de(!0))},[ie,xe,ne]);const je=(0,l.useCallback)(()=>{j.undo()},[j]),Xe=(0,l.useCallback)(()=>{j.redo()},[j]);(0,l.useEffect)(()=>{we.current!==(null===Fe||void 0===Fe?void 0:Fe.id)&&(j.clear(),we.current=null===Fe||void 0===Fe?void 0:Fe.id)},[Fe,j]);const qe=(0,l.useCallback)(e=>{(window.navigator.appVersion.indexOf("Mac")&&e.metaKey||e.ctrlKey)&&"KeyZ"===e.code&&(e.preventDefault(),e.shiftKey?Xe():je())},[je,Xe]);(0,l.useEffect)(()=>()=>{M((0,f.rI)()),M((0,_.Oo)()),M((0,y.Oo)()),M((0,S.qX)())},[M]),(0,l.useEffect)(()=>{const e=G.addListener(k.Ru.APPLICATION_HAS_AMP,e=>{M(null!==Fe&&void 0!==Fe&&Fe.id?(0,v.VO)(e):(0,w.lg)(e))});return()=>e.dispose()},[G,M,null===Fe||void 0===Fe?void 0:Fe.id]);const Ye=(0,l.useCallback)(e=>{const t=e.data.operation,o=e.data,l=e.data.action,i=U.querySelector("#iframe-scroll-top"),a=U.querySelector("#iframe-scroll-bottom");if(t===k.Ru.APPLICATION_EBLOCK_ADD&&(ue(o.data),M((0,_.qf)(k.lx.ADD_NEW_EBLOCK_MODAL))),t===k.Ru.APPLICATION_ACTION&&("undo"===l?je():"redo"===l&&Xe()),t===k.Ru.APPLICATION_SCROLL_BLOCK_SHOW){const e=U.querySelector("#email_iframe"),t=document.body.getBoundingClientRect().height,o=e.getClientRects()[0];o.top<0&&(i.style.display="block"),o.top+o.height>t&&(a.style.display="block")}t===k.Ru.APPLICATION_SCROLL_BLOCK_HIDE&&(i.style.display="none",a.style.display="none")},[M,je,Xe,U]);(0,x.A)(Ye);const Ke=e=>{var t,o,l,i;if(null!==(t=e.target)&&void 0!==t&&null!==(o=t.closest)&&void 0!==o&&o.call(t,".file-manager, .ant-modal.file-manager"))return;const a=e.dataTransfer,r=(a?Array.from(a.types||[]):[]).includes(k.hz),n="function"===typeof e.composedPath?e.composedPath():[];!(null===(l=e.target)||void 0===l||null===(i=l.closest)||void 0===i||!i.call(l,".selected-social-form"))||n.some(e=>{var t;return e&&1===e.nodeType&&"function"===typeof(null===(t=e.classList)||void 0===t?void 0:t.contains)&&e.classList.contains("selected-social-form")})||r||(e.preventDefault(),e.target&&G.send({operation:k.Ru.SANDBOX_DRAG_CANCEL}),U.querySelectorAll(".em-dragging-element").forEach(e=>{e.classList.remove("em-dragging-element")}))};(0,l.useEffect)(()=>{const e=new i.j;return e.addDisposable((0,O.a)(U,"drop",Ke)),e.addDisposable((0,O.a)(U,"dragover",Qe)),e.addDisposable((0,O.a)(U,"dragstart",Ze)),e.addDisposable((0,O.a)(U,"dragend",Je)),()=>{e.dispose()}},[U]),(0,l.useEffect)(()=>{const e=e=>{e.preventDefault()};return window.addEventListener("keydown",qe),window.addEventListener("dragenter dragleave",e),()=>{window.removeEventListener("keydown",qe),window.removeEventListener("dragenter dragleave",e)}});const Qe=e=>{var t,o;if(e.preventDefault(),null!==(t=e.target)&&void 0!==t&&null!==(o=t.closest)&&void 0!==o&&o.call(t,".file-manager, .ant-modal.file-manager"))return;const l=U.querySelector("#iframe-scroll-top"),i=U.querySelector("#iframe-scroll-bottom"),a=W.sidePanelFloating?U.querySelector("#pane-content-wrapper"):U.querySelector(".email-pane__col_preview"),r=U.querySelector(".blocks-app").getBoundingClientRect().top,n=U.querySelector("#email_iframe"),{height:d,top:s}=n.getBoundingClientRect(),m=a.getBoundingClientRect().height;s>96?"block"===l.style.display&&(l.style.display="none"):"none"!==l.style.display&&""!==l.style.display||(l.style.display="block"),d-m+s-r<44?"block"===i.style.display&&(i.style.display="none"):"none"===i.style.display&&(i.style.display="block"),e.target===l&&a.scrollBy(0,-15),e.target===i&&a.scrollBy(0,15)},Je=()=>{const e=U.querySelector("#iframe-scroll-top"),t=U.querySelector("#iframe-scroll-bottom");e&&t&&(e.style.display="none",t.style.display="none"),U.querySelectorAll(".em-dragging-element").forEach(e=>{e.classList.remove("em-dragging-element")})},Ze=e=>{var t,o;if(null===(t=e.target)||void 0===t||null===(o=t.closest)||void 0===o||!o.call(t,".selected-social-form")){e.target.parentElement.classList.add("em-dragging-element");var l=e.target.closest(".blocks-search__result-wrapper")?e.target.querySelector(".blocks-search__result-html").cloneNode(!0):e.target.cloneNode(!0);l.classList.add("em-ghost-element"),l.style.height=e.target.closest(".blocks-search__result-wrapper")?"auto":"70px",l.style.width=e.target.closest(".blocks-search__result-wrapper")?"600px":"109px",l.style.position="absolute",l.style.top="0",l.style.left="0",l.style.zIndex="-1",e.target.appendChild(l),e.dataTransfer.setDragImage(l,0,0),window.setTimeout(function(){l.parentNode.removeChild(l)},1e3)}},et=(0,l.useCallback)(()=>{ke({title:t("You reached the plan limit"),icon:l.createElement(T.Ay,{icon:"ExclamationCircleOutlined"}),content:l.createElement("div",{style:{maxWidth:"330px"}},t("Switch to a different plan to save more emails.")),centered:!0,okText:t("Choose a plan"),cancelText:t("Continue without saving"),width:"unset",onOk(){D("/billing")},onCancel(){}})},[D,t,ke]);return(0,l.useEffect)(()=>{if(ae&&re){var e,t;const l=null===re||void 0===re||null===(e=re.find(e=>{var t,o;return(null===(t=e.id)||void 0===t?void 0:t.toString())===(null===Re||void 0===Re||null===(o=Re.ID)||void 0===o?void 0:o.toString())}))||void 0===e||null===(t=e.limits)||void 0===t?void 0:t.emails_limit;l&&xe>=l&&!pe&&!X&&o&&(et(),ge(!0))}},[re,ae,Re,xe,pe,et,X,o]),(0,l.useEffect)(()=>{const e=G.onInit(()=>{G.send({operation:k.Ru.SANDBOX_LOCK_EDIT,data:!1})});return()=>e.dispose()},[G]),l.createElement(d.Layout,{className:"email-page"},Ue&&l.createElement(m.A,null),We&&ze&&l.createElement(V,{style:{paddingTop:"40px"}},l.createElement("div",{className:"container"},l.createElement(d.Q7,{status:null===ze||void 0===ze?void 0:ze.status,title:null===ze||void 0===ze?void 0:ze.status,subTitle:(null===ze||void 0===ze||null===(e=ze.data)||void 0===e?void 0:e.message)||(null===ze||void 0===ze?void 0:ze.error)||t("Unknown error"),extra:l.createElement(d.$n,{type:"primary",onClick:()=>{D(`/projects/${q}/emails`)}},t("Back To Project"))}))),(!X&&!Ie&&se||Me&&Fe)&&!Ue&&l.createElement(d.Layout,{className:"email-pane"},le&&l.createElement("div",{className:"email-pane__loader"},l.createElement(m.A,{small:!0})),l.createElement(c.A,{email:Fe,autoSaveEmailResult:Oe,isCollaborationEditor:he}),l.createElement(s.A,{emailElement:Fe,isSuccess:$e,setIsCollaborationEditor:be,setIsShowAddAllBlocksModal:ve,triggerOpenSavedBlocksTab:_e})),l.createElement(u.A,{isModalVisible:ee===k.lx.ADD_NEW_EBLOCK_MODAL,htmlContent:ce,projectId:q,setIsShowAddAllBlocksModal:ve,setIsShowAddAllBlocksModalForNewEmail:ye,currentEmail:Fe}),l.createElement(p.A,{isModalVisible:fe,currentEmail:Fe,setIsShowAddAllBlocksModal:ve,setTriggerOpenSavedBlocksTab:Ee,autoStart:!Se,projectId:q}))}},63148:(e,t,o)=>{o.d(t,{A:()=>le});var l=o(57549),i=o(1936),a=o(69962),r=o(84075),n=o(96040),d=o(22817),s=o(52898),m=o(51432),c=o(47706),u=o(91480),p=o(7714),g=o(86457),h=o(93506);const b=()=>{var e;const{__:t}=(0,c.s9)(),o=(0,a.wA)(),{projectId:b}=(0,r.g)(),f=(0,a.d4)(d.yN),[v]=(0,m.b9)(),[_,E]=(0,i.useState)(null===(e=window)||void 0===e?void 0:e.localStorage.getItem(h.V0.em_color_scheme)),S=(0,p.XW)(),y=(0,u.u)(),w=(0,i.useCallback)((e=null)=>{const t=e;(e=>{let t,l;if((0,g.Hk)(e),null===e){const e=matchMedia(h.F3).matches?h.nd:h.T;localStorage.removeItem(h.V0.em_color_scheme),t=e,l="auto"}else localStorage.setItem(h.V0.em_color_scheme,e),t=e,l=e;o((0,s.eX)(t===h.nd?`vs-${t}`:h.T)),(0,g.A5)(t),S({operation:h.Ru.UPDATE_PREVIEW,theme:t}),v({theme:e}),y({event:"change",action:"change_theme",theme_name:l,project_id:(null===f||void 0===f?void 0:f.id)||b})})(t),E(t)},[o,v,S,y,null===f||void 0===f?void 0:f.id,b]);return(0,i.useEffect)(()=>{matchMedia(h.F3).onchange=()=>w()},[w]),i.createElement("div",{onClick:e=>e.stopPropagation()},i.createElement(l.$q,{className:"theme-switcher",style:{cursor:"pointer",color:"var(--colorText)"},value:_,options:[{label:i.createElement(l.m_,{title:t("Light theme")},i.createElement(n.Ay,{icon:"LightMode",size:18,strokeWidth:1.8})),value:h.T},{label:i.createElement(l.m_,{title:t("System theme")},i.createElement(n.Ay,{icon:"AutoMode",size:18,strokeWidth:1.8})),value:null},{label:i.createElement(l.m_,{title:t("Dark theme")},i.createElement(n.Ay,{icon:"DarkMode",size:16,strokeWidth:1.8})),value:h.nd}],onChange:e=>w(e)}))};var f=o(88260),v=o(59922),_=o(6056),E=o.n(_),S=o(78443),y=o(98173),w=o(41244),k=o(2527),B=o(68876),R=o(3639),x=o(34010),T=o(65335),I=o(87669),A=o(11494),C=o(92080),N=o(47085);const P=Math.max(0,80),L={enter:480,exit:0};function F({className:e,children:t}){return i.createElement("div",{className:`menu-tariff-widget__card menu-tariff-widget__card_light ${e||""}`.trim()},t)}function O({className:e,children:t}){return i.createElement("div",{className:`menu-tariff-widget__card menu-tariff-widget__card_purple ${e||""}`.trim()},t)}function V({children:e,billingState:t,onNavClick:o,analyticsAction:l}){return i.createElement(f.N_,{to:"/billing",state:t,className:"menu-tariff-widget__btn menu-tariff-widget__btn_primary","data-em-analytics":l,onClick:o},e)}function M({onClick:e,disabled:t,type:o,className:l,children:a}){return i.createElement("button",{type:o,className:E()("menu-tariff-widget__btn","menu-tariff-widget__btn_outline",l),onClick:e,disabled:t},a)}function D({billingState:e,onNavClick:t,analyticsAction:o,className:l,children:a}){return i.createElement(f.N_,{to:"/billing",state:e,className:E()("menu-tariff-widget__header-link",l),"data-em-analytics":o,onClick:t},a)}const H=({isCollapsed:e,isLocked:t,isSiderHovered:o,subscription:a,subscriptionEnd:r,recurringPayments:n,trialEnabled:d,isPaying:s,subscriptionId:m,userId:p,pathname:g,enterpriseUsersLimit:h,enterprisePrice:b,enterprise12Price:v})=>{const{__:_,_n:S,sprintf:y}=(0,c.s9)(),w=(0,B.rD)(),k=(0,u.u)(),[P,H]=(0,i.useState)(()=>!e&&t);(0,i.useEffect)(()=>{if(e)return void H(!1);if(t)return void H(!0);H(!1);const o=window.setTimeout(()=>H(!0),220);return()=>window.clearTimeout(o)},[e,t]);const{isEnabled:z,isLoading:W,enableRecurring:U,disableRecurring:$}=(0,A.C)({subscriptionId:null!=m?String(m):null,userId:null!=p?String(p):"",recurringPayments:Boolean(n)}),G=(0,C.WU)(r),j=(0,C.Kh)(r),X=Boolean(j&&G>0),q=(0,i.useMemo)(()=>{const e=(null===a||void 0===a?void 0:a.post_title)||(null===a||void 0===a?void 0:a.title)||"";return String(e).trim().split(/\s+/)[0]||_("Plan")},[a,_]),Y=(0,i.useMemo)(()=>String((null===a||void 0===a?void 0:a.post_title)||(null===a||void 0===a?void 0:a.title)||"").trim(),[a]),K=Y?Y.split(/\s+/)[0]:"",Q=Boolean(h&&b&&"Enterprise"===Y),J=Boolean(h&&v&&"Enterprise 12"===Y),Z="Enterprise"===K&&(Q||J),ee=Boolean(m),te=Boolean(r)&&(ee||Z||z),oe=!ee,le=(0,i.useMemo)(()=>{if(!a)return!0;const e=String(a.post_name||"").toLowerCase();if("community"===e||"free"===e)return!0;return"Free"===q||"Community"===q},[a,q]),{isTrialUi:ie,isTrialExpiredByDate:ae,menuActsAsFreeTier:re}=function(e,t,o,l){const i=Boolean(e),a=(0,N.Y1)(i,t),r=!o,n=i&&a&&!(Boolean(l)&&r);return{isTrialUi:n,isTrialExpiredByDate:i&&!a,menuActsAsFreeTier:o&&!n}}(d,r,le,s),ne=(0,i.useMemo)(()=>ie?_("Trial"):re?_("Free"):q.length<=4?q:q.slice(0,3),[re,ie,q,_]),de=ie||re?"menu-tariff-widget__badge_blue":"menu-tariff-widget__badge_purple",se=(0,i.useMemo)(()=>({from:g}),[g]),me=(0,i.useCallback)(e=>{k({event:"click",action:e,location:"left_menu_tariff_widget"})},[k]),ce=(0,i.useCallback)(e=>{const t=e.currentTarget.getAttribute("data-em-analytics");t&&me(t)},[me]),ue=(0,i.useCallback)(()=>{me("menu_tariff_enable_recurring"),U()},[me,U]),pe=(0,i.useCallback)(()=>{me("menu_tariff_disable_recurring"),$()},[me,$]),ge=function({menuActsAsFreeTier:e,isTrialUi:t,daysLeft:o,recurringOn:l}){const i=o<=5&&o>0;return t&&i?"trial_expiring":t?"trial_active":e?"free":i?"paid_expiring":l?"paid_recurring":"paid_enable_recurring"}({menuActsAsFreeTier:re,isTrialUi:ie,daysLeft:G,recurringOn:z}),he=w.iconStrokeWidth,be=e||!t&&!P,fe=(0,i.useRef)(null),ve=()=>i.createElement("span",{className:"menu-tariff-widget__recurring-tooltip-wrap"},i.createElement(M,{type:"button",disabled:W||oe,onClick:oe?void 0:pe},i.createElement(T.C,{size:16,strokeWidth:he,className:"menu-tariff-widget__btn-icon"}),_("Auto-payment enabled")));return i.createElement(R.A,{mode:"out-in"},i.createElement(x.A,{key:be?"badge":"card",nodeRef:fe,timeout:L,classNames:"menu-tariff-widget-anim",appear:!1},i.createElement("div",{ref:fe,className:E()("menu-tariff-widget",{"menu-tariff-widget_collapsed":be})},be?i.createElement(f.N_,{to:"/billing",state:se,className:`menu-tariff-widget__badge ${de}`,"data-em-analytics":"menu_tariff_badge",onClick:ce},i.createElement("span",{className:"menu-tariff-widget__badge-text"},ne)):i.createElement("div",{className:E()("menu-tariff-widget__expanded-fade",{"menu-tariff-widget__expanded-fade_hidden":!t&&!o})},"free"===ge?i.createElement(F,null,i.createElement("div",{className:"menu-tariff-widget__header"},i.createElement(D,{billingState:se,onNavClick:ce,analyticsAction:"menu_tariff_header_to_billing"},i.createElement("span",{className:"menu-tariff-widget__title menu-tariff-widget__title_dark"},_(ae?"Free trial":"Free"))),i.createElement("p",{className:"menu-tariff-widget__desc"},_(ae?"The trial has ended. You are on the Free plan.":"You can get more emails and access to all features."))),i.createElement(V,{billingState:se,onNavClick:ce,analyticsAction:ae?"menu_tariff_choose_plan_free_after_trial":"menu_tariff_choose_plan_free"},_("Choose plan"))):"trial_expiring"===ge?i.createElement(F,{className:"menu-tariff-widget__card_decor menu-tariff-widget__card_decor_trial"},i.createElement("div",{className:"menu-tariff-widget__header"},i.createElement(D,{billingState:se,onNavClick:ce,analyticsAction:"menu_tariff_header_to_billing"},i.createElement("span",{className:"menu-tariff-widget__title menu-tariff-widget__title_dark"},_("Trial")),i.createElement("div",{className:"menu-tariff-widget__row"},i.createElement("span",{className:"menu-tariff-widget__muted"},_("Ends in")),i.createElement("span",{className:"menu-tariff-widget__accent-dark"},(0,C.XQ)(G,S,y))))),i.createElement("p",{className:"menu-tariff-widget__note"},_("When the trial ends, you will return to the Free plan.")),i.createElement(V,{billingState:se,onNavClick:ce,analyticsAction:"menu_tariff_choose_plan_trial_expiring"},_("Choose plan"))):"trial_active"===ge?i.createElement(F,null,i.createElement("div",{className:"menu-tariff-widget__header"},i.createElement(D,{billingState:se,onNavClick:ce,analyticsAction:"menu_tariff_header_to_billing"},i.createElement("span",{className:"menu-tariff-widget__title menu-tariff-widget__title_dark"},_("Trial active")),j?i.createElement("div",{className:"menu-tariff-widget__row"},i.createElement("span",{className:"menu-tariff-widget__muted"},_("Valid until")),i.createElement("span",{className:"menu-tariff-widget__date-dark"},j)):null)),i.createElement("p",{className:"menu-tariff-widget__note"},_("When the trial ends, you will return to the Free plan.")),i.createElement(V,{billingState:se,onNavClick:ce,analyticsAction:"menu_tariff_choose_plan_trial"},_("Choose plan"))):"paid_expiring"===ge?i.createElement(O,{className:"menu-tariff-widget__card_decor menu-tariff-widget__card_decor_paid"},i.createElement("div",{className:"menu-tariff-widget__header"},i.createElement(D,{billingState:se,onNavClick:ce,analyticsAction:"menu_tariff_header_to_billing"},i.createElement("span",{className:"menu-tariff-widget__title"},q),i.createElement("div",{className:"menu-tariff-widget__row"},i.createElement("span",{className:"menu-tariff-widget__muted-white"},_("Ends in")),i.createElement("span",{className:"menu-tariff-widget__accent-white"},(0,C.XQ)(G,S,y))))),z&&te?ve():i.createElement(f.N_,{to:"/billing",state:se,className:"menu-tariff-widget__btn menu-tariff-widget__btn_outline","data-em-analytics":"menu_tariff_extend",onClick:ce},_("Extend plan"))):"paid_recurring"===ge?i.createElement(O,null,i.createElement("div",{className:"menu-tariff-widget__header"},i.createElement(D,{billingState:se,onNavClick:ce,analyticsAction:"menu_tariff_header_to_billing"},i.createElement("span",{className:"menu-tariff-widget__title"},q),X?i.createElement("div",{className:"menu-tariff-widget__row"},i.createElement("span",{className:"menu-tariff-widget__muted-white"},_("Valid until")),i.createElement("span",{className:"menu-tariff-widget__date-white"},j)):null)),te?ve():null):i.createElement(O,null,i.createElement("div",{className:"menu-tariff-widget__header"},i.createElement(D,{billingState:se,onNavClick:ce,analyticsAction:"menu_tariff_header_to_billing"},i.createElement("span",{className:"menu-tariff-widget__title"},q),X?i.createElement("div",{className:"menu-tariff-widget__row"},i.createElement("span",{className:"menu-tariff-widget__muted-white"},_("Valid until")),i.createElement("span",{className:"menu-tariff-widget__date-white"},j)):null)),te?i.createElement(l.m_,{title:oe?_("Auto-payment will be available once the subscription is linked in the payment system."):void 0},i.createElement("span",{className:"menu-tariff-widget__recurring-tooltip-wrap"},i.createElement(M,{type:"button",disabled:W||oe,onClick:oe?void 0:ue},i.createElement(I.W,{size:16,strokeWidth:he,className:"menu-tariff-widget__btn-icon"}),_("Enable auto-payment")))):null)))))};H.defaultProps={isCollapsed:!1,isLocked:!1,isSiderHovered:!0,subscription:null,subscriptionEnd:null,recurringPayments:!1,trialEnabled:!1,isPaying:!1,subscriptionId:null,userId:null,pathname:"",enterpriseUsersLimit:null,enterprisePrice:null,enterprise12Price:null},M.defaultProps={onClick:void 0,disabled:!1,type:"button",className:void 0},D.defaultProps={className:void 0};const z=H,W=({isMenuCollapsed:e,setIsMenuCollapsed:t,isLocked:o})=>{var s,p,g;const{__:b}=(0,c.s9)();let _=(0,a.wA)(),R=(0,r.Zp)();const{projectId:x,emailId:T,blockId:I}=(0,r.g)(),{pathname:A}=(0,r.zy)(),[C,N]=(0,i.useState)(""),P=(0,a.d4)(d.yN),L=(0,a.d4)(y.C1),F=(0,k.p)(),O=(0,u.u)(),V=(0,B.rD)(),M=(0,i.useCallback)(()=>{A.includes("blocks")?N("Blocks"):A.includes("emails")?N("Emails"):A.includes("members")&&N("Members"),o||t(!0)},[A,t,o]);(0,i.useEffect)(()=>{M()},[M]);let D=[],H=[];const W=(null===P||void 0===P?void 0:P.title)||"",U=()=>{try{O({event:"click",action:"editor_tour",project_id:(null===P||void 0===P?void 0:P.id)||x,location:"left_menu"}),window.LP_show(85420)}catch(e){}};let $=[{label:i.createElement("a",{href:"https://emailmaker.ru/help/",target:"_blank",rel:"noopener noreferrer",onClick:()=>{O({event:"click",action:"help_center",project_id:(null===P||void 0===P?void 0:P.id)||x,location:"left_menu"})}},b("Help")),key:"Help center",icon:i.createElement(n.Ay,{icon:"FileQuestion02Icon",size:18,strokeWidth:V.iconStrokeWidth}),className:"help-center"},{label:b("Chat support"),key:"Support chat",icon:i.createElement(n.Ay,{icon:"MessageChatSquareIcon",size:18,strokeWidth:V.iconStrokeWidth}),className:"open-support-chat",onClick:()=>{try{O({event:"click",action:"support_chat",project_id:(null===P||void 0===P?void 0:P.id)||x,location:"left_menu"}),window.carrotquest.open()}catch(e){}}}];(T||I)&&$.push({label:b("Onboarding"),key:"Onboarding",icon:i.createElement(n.Ay,{icon:"LifeBuoy02Icon",size:18,strokeWidth:V.iconStrokeWidth}),className:"open-onboarding",onClick:U});const G=[{label:b("Account settings"),key:"Account settings",icon:i.createElement(n.Ay,{icon:"MenuProfileAccountSettings",size:16,strokeWidth:V.iconStrokeWidth}),className:"em-analytics__account-settings",onClick:()=>{_((0,S.qf)(h.lx.EDIT_PROFILE_MODAL)),o||t(!0)}},{label:i.createElement(f.N_,{to:"/billing",state:{from:A}},b("Billing")),key:"Billing",icon:i.createElement(n.Ay,{icon:"MenuProfileBilling",size:16,strokeWidth:V.iconStrokeWidth}),className:"em-analytics__billing"},{label:b("Sign out"),icon:i.createElement(n.Ay,{icon:"MenuProfileSignOut",size:16,strokeWidth:V.iconStrokeWidth}),key:"Sign out",className:"em-analytics__sign-out",onClick:()=>{O({event:"logout",action:"logout",user_id:null===L||void 0===L?void 0:L.id,user_email:null===L||void 0===L?void 0:L.email,project_id:(null===P||void 0===P?void 0:P.id)||x}),(0,w.Id)(F),_(m.Q2.util.resetApiState()),R("/auth",{replace:!0})}}],j=(null===L||void 0===L?void 0:L.name)||(null===L||void 0===L?void 0:L.username)||"",X=(null===L||void 0===L||null===(s=L.avatar_urls)||void 0===s?void 0:s[48])||(null===L||void 0===L||null===(p=L.avatar_urls)||void 0===p?void 0:p[96]),q=[{type:"group",key:"User profile header",label:i.createElement("div",{className:"project-menu-profile-popup__header"},i.createElement("div",{className:"project-menu-profile-popup__avatar","aria-hidden":!0},X?i.createElement("img",{src:X,alt:"",className:"project-menu-profile-popup__avatar-img"}):i.createElement(v.h,{size:16,strokeWidth:V.iconStrokeWidth,className:"project-menu-profile-popup__avatar-icon"})),i.createElement("div",{className:"project-menu-profile-popup__meta"},j?i.createElement("div",{className:"project-menu-profile-popup__name"},j):null,null!==L&&void 0!==L&&L.email?i.createElement("div",{className:"project-menu-profile-popup__email"},L.email):null)),children:G}],Y="/projects"+(x?"/"+x+"/emails?page=1":""),K=[{label:i.createElement(f.N_,{style:{fontSize:16},to:Y},W),key:"Project",popupOffset:[0,16],style:{fontWeight:500},icon:x?i.createElement(f.N_,{to:Y,className:"project-menu__block",style:{fontSize:"18px",zIndex:99}},i.createElement(l.$n,{type:"primary",className:"project-menu__block-button"},null===W||void 0===W?void 0:W.split(" ").slice(0,2).map(e=>Array.from(e)[0]))):i.createElement(f.N_,{to:Y,rel:"noopener noreferrer",className:"project-menu__block"},!e||o?i.createElement("div",{dangerouslySetInnerHTML:{__html:h.KN}}):i.createElement("div",{dangerouslySetInnerHTML:{__html:h.DS}})),className:E()("project-menu__list-item project-menu__list-item_project project-menu__list-item_project",{"project-menu__list-item_logo":!x,"project-menu__list-item_project":x}),children:x&&[{label:b("Project settings"),key:"Project settings",className:"em-analytics__account-settings",icon:i.createElement(n.Ay,{icon:"SettingOutlined",size:18,strokeWidth:V.iconStrokeWidth}),onClick:()=>{_((0,S.qf)(h.lx.EDIT_PROJECT_MODAL)),o||t(!0)}},{label:i.createElement(f.N_,{to:"/projects"},b("List of projects")),key:"List of projects",icon:i.createElement(n.Ay,{icon:"ElementListUL",size:18,strokeWidth:V.iconStrokeWidth}),className:"em-analytics__sign-out"}]},{type:"divider"}];return D.push({icon:i.createElement(n.Ay,{icon:"Email",size:22,strokeWidth:V.iconStrokeWidth}),label:i.createElement(f.N_,{to:`/projects/${x}/emails`,rel:"noopener noreferrer"},b("Emails")),key:"Emails",className:"project-menu__list-item em-analytics__project-menu-emails"},{icon:i.createElement(n.Ay,{icon:"Grid01Icon",size:22,strokeWidth:V.iconStrokeWidth}),label:i.createElement(f.N_,{to:`/projects/${x}/blocks`,rel:"noopener noreferrer"},b("Blocks")),key:"Blocks",className:"project-menu__list-item em-analytics__project-menu-blocks"},{icon:i.createElement(n.Ay,{icon:"Users02Icon",size:22,strokeWidth:V.iconStrokeWidth}),label:i.createElement(f.N_,{to:`/projects/${x}/members`,rel:"noopener noreferrer"},b("Members")),key:"Members",className:"project-menu__list-item em-analytics__project-menu-members"}),H.push({icon:i.createElement(n.Ay,{icon:"AnnotationQuestionIcon",size:22,strokeWidth:V.iconStrokeWidth}),label:b("Help menu"),key:"Help menu",className:"project-menu__list-item support-center-menu",children:$},{icon:i.createElement(n.Ay,{icon:"BellRinging04Icon",size:22,strokeWidth:V.iconStrokeWidth}),label:b("What's new"),key:"What's new",className:"project-menu__list-item ducalis-changelog-widget em-analytics__project-menu-ducalis",onClick:()=>{O({event:"click",action:"whats_new",project_id:(null===P||void 0===P?void 0:P.id)||x,location:"left_menu"})}},{icon:i.createElement("span",{style:{width:"22px",height:"22px",fontSize:"18px"},className:"user-profile__avatar anticon"},null!==L&&void 0!==L&&null!==(g=L.avatar_urls)&&void 0!==g&&g[48]?[i.createElement("img",{style:{width:"100%"},key:"img",src:null===L||void 0===L?void 0:L.avatar_urls[48],alt:null!==L&&void 0!==L&&L.name?`${null===L||void 0===L?void 0:L.name} avatar`:"User avatar",className:"user-profile__avatar-img"}),i.createElement(n.Ay,{icon:"User03Icon",size:22,strokeWidth:V.iconStrokeWidth,key:"UserOutlined",style:{position:"absolute",fontSize:22,borderRadius:100,overflow:"hidden",height:22,width:22,lineHeight:0,zIndex:-1}})]:i.createElement(n.Ay,{icon:"User03Icon",size:22,style:{color:"white"},strokeWidth:V.iconStrokeWidth})),label:(null===L||void 0===L?void 0:L.name)||null,key:"User profile",className:"project-menu__list-item user-profile",popupClassName:"project-menu-profile-popup",popupOffset:[8,0],children:q}),i.createElement(i.Fragment,null,i.createElement("div",{className:"project-menu"},i.createElement("div",null,i.createElement(l.W1,{disabledOverflow:!0,className:"project-menu__list project-menu__list_top",style:{fontSize:16},items:K,triggerSubMenuAction:"hover",subMenuOpenDelay:.3,subMenuCloseDelay:.6,selectable:!1}),x&&i.createElement(l.W1,{disabledOverflow:!0,selectable:!0,selectedKeys:[C],className:"project-menu__list project-menu__list_second",style:{fontSize:16,marginTop:30},items:D,triggerSubMenuAction:"hover"})),i.createElement("div",{className:"project-menu__bottom-stack"},i.createElement(z,{isCollapsed:e&&!o,isLocked:o,subscription:L.subscription,subscriptionEnd:L.subscription_end,recurringPayments:L.recurring_payments,trialEnabled:L.trial_enabled,isPaying:L.is_paying,subscriptionId:L.subscription_id,userId:L.id,pathname:A,enterpriseUsersLimit:L.enterprise_users_limit,enterprisePrice:L.enterprise_price,enterprise12Price:L.enterprise_12_price}),i.createElement(l.W1,{disabledOverflow:!0,selectable:!0,selectedKeys:["Emails"],forceSubMenuRender:"true",className:"project-menu__list project-menu__list_bottom",style:{fontSize:14,marginBottom:6},subMenuOpenDelay:.3,subMenuCloseDelay:.6,items:H,triggerSubMenuAction:"hover"}))))};var U=o(74516),$=o(11421),G=o(25413),j=o(68069),X=o(6403),q=o(12723),Y=o(34972),K=o(30392),Q=o(36234),J=o(7314),Z=o(51597);const{Sider:ee}=l.Layout,te="em_notification_mark_seen_skipped_ids";function oe(){try{const e=sessionStorage.getItem(te),t=e?JSON.parse(e):[];return Array.isArray(t)?t.map(String):[]}catch{return[]}}const le=()=>{var e;const{token:t}=(0,l.rd)();let o=(0,r.zy)();const d=(0,a.wA)(),m=(0,r.Zp)(),{emailId:c,blockId:p,projectId:f}=(0,r.g)(),v=(0,a.d4)(S.cL),_=(0,a.d4)(y.C1),w=(0,i.useRef)(),k=(0,u.u)(),[R]=(0,G.bw)(),x=(0,X.hN)();w.current||(w.current=(0,J.$Z)()),(0,i.useEffect)(()=>{(0,g.FN)(t)},[t]);const{data:T=[],isSuccess:I}=(0,G.I9)(null!==(e=null===_||void 0===_?void 0:_.id)&&void 0!==e?e:"",{pollingInterval:3e5,skip:!!v||!(null!==_&&void 0!==_&&_.id)});(0,i.useEffect)(()=>{const e=T.filter(e=>""===e.seen||null===e.seen);setTimeout(()=>{if(e.length&&I){const t=new Set(oe());e.forEach(e=>{var o,l;if(t.has(String(e.id)))return;"subscription_payment"===e.event&&k({event:"payment",data:e.data}),x[e.type]({message:(null===(o=e.title)||void 0===o?void 0:o.rendered)||e.title||"",description:(null===(l=e.content)||void 0===l?void 0:l.rendered)||""});const i=(new Date).toLocaleString();R({id:e.id,datetime:i}).unwrap().catch(t=>{const o=t&&"object"===typeof t?t:{};"em_rest_notification_403"===(o.data&&"object"===typeof o.data&&null!==o.data&&"code"in o.data?String(o.data.code):void 0)&&function(e){try{const t=String(e),o=new Set(oe());o.has(t)||(o.add(t),sessionStorage.setItem(te,JSON.stringify([...o])))}catch{}}(e.id)})})}},5e3)},[I,R,T,x]),(0,q.A)(),(0,Y.A)(),(0,K.A)(),(0,i.useEffect)(()=>{p||d((0,j.nJ)()),c||d((0,s.ss)())},[p,c,d,o.pathname]);let A=null;c||p||o.pathname.endsWith("/new")?A=w.current:w.current&&w.current.getValue()&&setTimeout(()=>w.current.setValue(""),1e3);const C=JSON.parse(localStorage.getItem(h.V0.em_menu_is_locked)),[N,L]=(0,i.useState)((null===C||void 0===C?void 0:C.isLocked)||!1),[F,O]=(0,i.useState)(!0),[V,M]=(0,i.useState)(!0),[D,H]=(0,i.useState)(!1),z=(0,i.useRef)({width:null,tariff:null}),le=(0,i.useCallback)(()=>{const{width:e,tariff:t}=z.current;null!=e&&(window.clearTimeout(e),z.current.width=null),null!=t&&(window.clearTimeout(t),z.current.tariff=null)},[]),ie=(0,i.useCallback)(()=>{le(),H(!1),O(!0),M(!0)},[le]);return(0,i.useEffect)(()=>()=>le(),[le]),(0,i.useEffect)(()=>{const e=()=>localStorage.setItem(h.V0.em_menu_is_locked,JSON.stringify({isLocked:N}));return e(),e()},[N]),(0,Q.D3)(Z._1,(0,i.useCallback)(e=>{const t=(0,B.Mu)(e);m(t)},[m])),i.createElement("div",{className:"main"},i.createElement(J.kx.Provider,{value:A},i.createElement("div",{className:"main__pane main__pane_main"},i.createElement("div",{className:"main__pane-content",id:"pane-content-iframe"},i.createElement(l.Layout,{className:"main__pane-layout",hasSider:!0},!h.EW.isPlugin&&i.createElement(ee,{theme:"light",style:{borderColor:t.colorBorder,position:"fixed",overflow:"hidden"},collapsible:!0,collapsed:!N&&F,defaultCollapsed:!0,reverseArrow:!N&&!F||N&&!F,trigger:i.createElement("div",{className:"main__pane-trigger"},N?i.createElement(n.Ay,{icon:"MenuFoldOutlined",style:{fontSize:18}}):i.createElement(i.Fragment,null,i.createElement(n.Ay,{icon:"MenuOutlined",style:{fontSize:18}}),i.createElement(n.Ay,{icon:"MenuUnfoldOutlined",style:{fontSize:18}})),i.createElement(b,null)),className:E()("main__menu",{main__menu_lock:N}),width:260,collapsedWidth:80,zeroWidthTriggerStyle:{},onCollapse:(e,t)=>{le();const o=!N;e?!N&&O(!0):O(!e),L(o),k({event:"toggle",action:"toggle_side_panel_lock",is_locked:o,project_id:f,location:"left_menu"})},onMouseEnter:()=>{N||(le(),H(!0),O(!1),M(!1))},onMouseLeave:()=>{N||(H(!1),le(),z.current.width=window.setTimeout(()=>{z.current.width=null,O(!0)},P),z.current.tariff=window.setTimeout(()=>{z.current.tariff=null,M(!0)},380))}},i.createElement(W,{isMenuCollapsed:F,isMenuTariffCompact:V,setIsMenuCollapsed:ie,isLocked:N,isSiderHovered:D})),i.createElement(U.A,{isModalVisible:v===h.lx.EDIT_PROJECT_MODAL}),i.createElement($.A,{isModalVisible:v===h.lx.EDIT_PROFILE_MODAL}),i.createElement(r.sv,null))))))}},7331:(e,t,o)=>{o.d(t,{A:()=>s});var l=o(1936),i=o(84075),a=o(57549),r=o(41244),n=o(47706);const{Content:d}=a.Layout,s=()=>{const{__:e}=(0,n.s9)();let t=(0,i.Zp)();return l.createElement(a.Layout,null,l.createElement(d,{className:"container"},l.createElement(a.Q7,{status:"500",title:"404",subTitle:e("Sorry, the page you visited does not exist."),extra:l.createElement(a.$n,{type:"primary",onClick:()=>(0,r.XZ)(t,"/projects")},e("Back Home"))})))}},99466:(e,t,o)=>{o.d(t,{A:()=>g});var l=o(1936),i=o(69962),a=o(84075),r=o(487),n=o(22817),d=o(57549),s=o(12650),m=o(93506),c=o(41244),u=o(47706);const{Content:p}=d.Layout,g=()=>{var e;const{__:t}=(0,u.s9)();let o=(0,a.Zp)(),g=(0,a.zy)();const h=(0,i.wA)(),{projectId:b}=(0,a.g)(),f=(0,r.fo)(+b,{skip:!b}),{isLoading:v,isError:_,error:E,isSuccess:S,data:y}=f;return(0,l.useEffect)(()=>{S&&(null===y||void 0===y?void 0:y.id)!==b&&h((0,n.od)(y))},[S,y,h,b]),(0,l.useEffect)(()=>{S&&b&&g.pathname.endsWith(b)&&o(`${g.pathname}/emails`)},[S,g,o,b]),l.createElement(l.Fragment,null,v&&l.createElement(s.A,null),_&&E&&l.createElement(d.Layout,{className:"project-outlet"},l.createElement(p,{className:"project-outlet__container container"},l.createElement(d.Q7,{status:E.status,title:E.status,subTitle:null===(e=E.data)||void 0===e?void 0:e.message,extra:l.createElement(d.$n,{type:"primary",onClick:()=>(0,c.XZ)(o,"/projects")},t("Back To Projects"))}))),(S||m.EW.isPlugin)&&l.createElement(a.sv,{context:{...f}}))}},63873:(e,t,o)=>{o.d(t,{A:()=>h});var l=o(1936),i=o(84075),a=o(72153),r=o(96040),n=o(57549),d=o(9907),s=o(85986),m=o(41244),c=o(47706),u=o(2527),p=o(93506);const{Content:g}=n.Layout,h=()=>{const{__:e}=(0,c.s9)();let t=(0,i.Zp)();const o=(0,u.p)(),{projectId:h,emailId:b}=(0,i.g)(),f=o.get(p.A9.em_template_email)||b;(0,l.useEffect)(()=>{document.body.classList.remove("editor")},[]);const v=l.createElement(l.Fragment,null,l.createElement(n.$x,{size:10},l.createElement(n.m_,{title:e("To emails"),placement:"left"},l.createElement(n.$n,{type:"text",icon:l.createElement(r.Ay,{icon:"ArrowLeftOutlined"}),onClick:()=>(0,m.XZ)(t,`/projects/${h}`),shape:"circle"})),l.createElement(n.fz,{className:"ant-page-header-heading-title"},e("Select email template")),l.createElement(s.A,{isBlocks:!1,templateEmailId:f}))),_=l.createElement(l.Fragment,null);return l.createElement(n.Layout,{className:"template-page"},l.createElement(a.A,{leftBlock:v,rightBlock:_}),l.createElement(g,{className:"template-page__container"},l.createElement("div",{className:"template-page__content container"},l.createElement(d.A,{projectId:p.p5,emailsView:p.Y$,templateEmailId:f}))))}},66163:(e,t,o)=>{o.d(t,{V:()=>n});var l=o(27849),i=o(50548),a=o(93506),r=o(90308);async function n(e,t,o,n,d){const s={blocks:n,types:r.G,locale:t};o.current=s;try{const e=await async function(e){return a.EW.isPlugin?await e.getInstance(i.Y):l.A.get(a.A9.em_token)||null}(d),t=await fetch(r.M,{method:"POST",headers:{"Content-Type":"application/json",...e?{Authorization:`Bearer ${e}`}:{}},body:JSON.stringify(s)});if(!t.ok||200!==t.status)throw new Error(`${t.statusText}`);return await t.json()}catch(m){throw m}}},44731:(e,t,o)=>{function l(e){return`${function(e){let t=String(null!==e&&void 0!==e?e:"");for(;t.endsWith("/");)t=t.slice(0,-1);return t}("https://cdn.useblocks.io/media/socnets")}/${function(e){let t=String(null!==e&&void 0!==e?e:"");for(;t.startsWith("/");)t=t.slice(1);return t}(e)}`}const i={telegram:"tg",youtube:"yt",vk:"vk",yandex_zen:"yd",x:"xa",twitter:"tw",instagram:"ig",facebook:"fb",pinterest:"pi",tiktok:"tt",ok:"ok",max:"max",rutube:"rutube",whatsapp:"whatsapp",linkedin:"linkedin",viber:"viber",apple:"apple",dis:"dis",drbl:"drbl",fig:"fig",gh:"gh",ggl:"ggl",mdm:"mdm",rdt:"rdt",sgnl:"sgnl",sc:"sc",sptf:"sptf",tmblr:"tmblr",twitch:"twitch",thrds:"thrds",msngr:"msngr",bs:"bs"};function a(e,t){return l(`${e}${t?"-negative":""}.png`)}function r(e){return Object.fromEntries(Object.entries(i).map(([t,o])=>[t,a(o,e)]))}r(!1),r(!0);["tg","yt","vk","yd","xa","ig","fb"].map(e=>a(e,!1))}}]);
2
+ //# sourceMappingURL=6438.78acfa4a.js.map